ArcEngineUtilities.h
// 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. // // ArcEngineUtilities.h // // Contains various utility functions involving the ArcEngine // components and controls. #ifndef _DEV_CPP_ARCENGINE_UTILITIES_H_ #define _DEV_CPP_ARCENGINE_UTILITIES_H_ // C++ Headers #include <set> #include <string> using std::wstring; typedef std::set< std::wstring > WStringSet; // Motif Headers // // These need to be included before Ao/Map.h #define String esriXString #define Time esriXTime #define Cursor esriXCursor #define Object esriXObject #define ObjectClass esriXObjectClass #include <Xm/Xm.h> #undef String #undef Time #undef Cursor #undef Object #undef ObjectClass // ArcObjects Headers #include <ArcSDK.h> #include <Ao/Map.h> #include <Ao/Toolbar.h> // Function to convert pixel units to map units HRESULT ConvertPixelsToMapUnits ( IActiveView *pActiveView, double pixelUnits, double *mapUnits); // Returns the index in pMapControl's map of the layer w/ name inName, // or -1 if no layer is found. long GetIndexOfLayerName ( IMapControl3 *pMapControl, const char *inName); // Adds some commonly used items to a toolbar control void AddStandardToolbarItems( IToolbarControl *pToolbarControl); HRESULT GetLayerFromName (IMapControl3* pMapControl, BSTR bsLayerName, ILayer** ppOutLayer); HRESULT RecursiveGetLayerFromName (ILayer* pLayer, BSTR bsSearchName, ILayer** ppOutLayer); /* HRESULT GetFeatureLayerSet (IMapControl3* pMapControl, ISet* pSet); */ /* HRESULT RecursiveGetFeatureLayerSet (ILayer* pLayer, ISet* pSet); */ // Calls RecursiveCheckLayerNames to check the layers in the map for // duplicate names. Returns S_OK if the layer names are OK, S_FALSE if // there are duplicates. HRESULT CheckLayerNames (IMapControl3* pMapControl); // Recursively checks the layers in the map for duplicate // names. Returns S_OK if the layer names are OK, S_FALSE if there are // duplicates. HRESULT RecursiveCheckLayerNames (ILayer* pLayer, WStringSet& wss); #endif //_DEV_CPP_ARCENGINE_UTILITIES_H_