There are several classes that provide the following functions for working with geography data (geo-data):
The following picture demonstrates a diagram with Geo-related classes.
This class diagram consists of core Geo-related classes and the classes of four Geo-related modules.
The main Geo-related class is OdDbGeoData. This class defines an active coordinate system (CS) and other global database Geo-related properties. It provides functions for adding a geolocation marker (one per drawing) and a background map to a drawing.
Note: A geolocation marker is drawn on each viewport if the GEOMARKERVISIBILITY system variable is set to 1.
To get the OdDbGeoData object ID, use the global oddbGetGeoDataObjId() method.
The OdDbGeoPositionMarker class represents a marker at a position with comments (not the same as a geolocation marker which is one per drawing; geoposition markers can be multiple per drawing). Geoposition markers can be moved around a geo-map.
OdDbGeoCoordinateSystem is an abstract class that represents a coordinate reference system (CRS) definition.
OdDbGeoCoordinateSystemCategory is an abstract class used for representing a category which holds string identifiers referring to a group of coordinate reference systems.
OdDbGeoCoordinateSystemTransformer is an abstract class that represents a transformer object which is used to transform points from the source CRS to the target CRS.
For working with abstract classes, there is a set of protocol extension classes:
There are four modules that demonstrate how to work with geo-data.
OdGeoData module implements OdDbGeoCoordinateSystemCategoryPE, OdDbGeoCoordinateSystemPE, OdDbGeoCoordinateSystemTransformerPE, and OdDbGeoDataPE classes and is located in Drawing\Extensions\OdGeoData. This module uses csmap and tinyxml libraries.
Note: OdGeoData module does not support coordinate type kCoordTypLocal.
GeolocationObj module provides the following functions for working with geo-maps:
GeolocationObj module is located in Drawing\Examples\GeolocationObj and consists of several classes:
GeolocationObj module implements all OdDbGeoMap methods except the updateMapImage() method because it depends on whether the OdDbGeoMapPE module is loaded.
OdDbGeoMapPE module implements the OdDbGeoMapPE class functionality. It is located in Drawing\Examples\OdDbGeoMapPE. The main purpose of the OdDbGeoMapPE module is implementing the updateMapImage() method for updating geo-map objects.
Note: The updateMapImage() method works correctly only when using the WORLD-MERCATOR coordinate system for a geo-data entity and when OdDbGeoData::TypeOfCoordinates is not equal to kCoordTypLocal.
OdDbGeoMapPE module uses curl and tinyxml third-party libraries. The curl library is used for getting map images from the Internet (uses BING online service). To access the BING service, set your own BING-map key as a value of the sBingMapsKey global variable.
Note: The geo-data protocol extension object should be loaded for the OdDbGeoMapPE module work.
GeoCommands module implements commands for working with geo-data listed below:
The GeoCommands module is located in Drawing\Examples\GeoCommands.
The third-party libraries, used in OdGeoData and OdDbGeoMapPE modules, are located in the .\ThirdParty folder. The csmap library implements coordinate system support and calculations. The curl library implements geo-map image updating. The tinyxml library is used for working with .xml-files.
A drawing that represents the results of GeolocationObj, OdGeoData, and OdDbGeoMapPE modules is below.
The background map comes from geo-data (geo-data drawing not implemented yet). The white border map is the OdDbGeoMap object. The red marker is a geolocation marker. The yellow marker is a geoposition marker.
Note: The csmap library should have access to a folder with
the required dictionaries. All needed files are available in the CSDicts.zip
archive located in the Thirdparty folder of the latest release on OdOutgoing. Go to
https://www.opendesign.com/odoutgoing/LatestRelease/,
navigate to the Thirdparty directory in the latest release version, and download CSDicts.zip. The dictionaries from the most recent release work with any Drawings SDK version.
For all platforms, unzip the CSDicts folder and its contents, set the environment
variable CS_MAP_DIR with the path to the CSDicts folder as its value. Another
option for the Windows platform is to create a "CSDicts" folder in the application's
directory (for example, exe\vc9dlldbg\CSDicts) and unzip the dictionary files
to it.
For ODA members who have access to the Drawings Git repository, the required files are also available
here: ThirdParty\csmap\Dictionaries.
Sample code that illustrates how to work with geo-data can be found in:
Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.
|