MoleSymbols.cpp
// Copyright 2010 ESRI // // All rights reserved under the copyright laws of the United States // and applicable international laws, treaties, and conventions. // // You may freely redistribute and use this sample code, with or // without modification, provided you include the original copyright // notice and use restrictions. // // See the use restrictions. // #include "MoleSymbols.h" #include "MoleSymbolsWindow.h" // the first macro expands the symbol defined on the command line; the second puts quotes around it #define EXPANDSTRING(x) STRINGIFY(x) #define STRINGIFY(x) #x // get the full path of a dataset in the Defense Solutions sample data CComBSTR dsDataPath (const char *relativeDatasetPath) { #if defined(ESRI_UNIX) CComBSTR path (EXPANDSTRING(DATADIRECTORY) "/Samples/data/defensesolutions/"); #elif defined(ESRI_WINDOWS) CComBSTR path(L"C:\\Program Files\\ArcGIS\\DeveloperKit10.0\\Samples\\data\\defensesolutions\\"); #endif path.Append (relativeDatasetPath); return path.Copy(); } // shut down arc objects and terminate the application void shutdown() { IAoInitializePtr ipInit (CLSID_AoInitialize); ipInit->Shutdown(); ::AoUninitialize(); AoExit (0); } int main(int argc, char **argv) { printf ("initializing application\n"); { printf ("calling AoInitialize\n"); ::AoInitialize (NULL); #if defined(ESRI_UNIX) ::DsInitialize(); #endif { printf ("initializing license\n"); IAoInitializePtr ipInit (CLSID_AoInitialize); esriLicenseStatus status; ipInit->Initialize (esriLicenseProductCodeEngine, &status); if ( status != esriLicenseCheckedOut ) { printf ("Invalid Licensing.\n"); ::AoUninitialize(); AoExit (0); } } // use a compound statement to ensure that destructors will be invoked before the AoExit call QAxApplication qapp (argc, argv); // get the current time and use it to seed the RNG QTime time = QTime::currentTime(); #if defined(ESRI_UNIX) srandom (1000 * time.second() + time.msec()); #elif defined(ESRI_WINDOWS) srand (1000 * time.second() + time.msec()); #endif // instantiate and display the main widget MoleSymbolsWindow mainWindow; mainWindow.show(); printf ("passing control to Qt\n"); qapp.exec(); } shutdown(); return 0; }