GM_SetProjection(Ex) |
Sets the new projection. This is the projection that all draws and exports will be done in. It is also the projection that all world bound rectangles will be in.
GM_Error_t32 GM_SetProjection
(
const GM_Projection_t* aProj
);
GM_Error_t32 GM_SetProjectionEx ( const GM_Projection_t* aProj, const GM_Rectangle_t* aLatLonRect, // IN: Optional lat/lon/degrees rectangle for automatic selection of zone for zoned projections void* aReserved // IN: Reserved for future use, must be NULL );
If you pass in a zoned projection, like UTM, with no ZONE attribute or a ZONE or 0, the lat/lon rectangle (if provided) will be used to automatically select the best zone for the provided bounds. If no rectangle is provided, the last drawn rectangle will be used.
GM_Projection_t theUtmProj; ::memset( &theUtmProj, 0, sizeof theUtmProj ); theUtmProj.mProjSys = GM_PRJ_UTM; theUtmProj.mDatum = GM_DATUM_WGS_84; theUtmProj.mUnit = GM_PRJ_UNIT_METERS; theUtmProj.mAttrList[0].mAttr = ZONE; theUtmProj.mAttrList[0].mValue = 15; theUtmProj.mNumAttrs = 1; GM_SetProjection( &theUtmProj );
GM_Projection_t theGeoProj; ::memset( &theGeoProj, 0, sizeof theGeoProj ); theGeoProj.mProjSys = GM_PRJ_GEO; theGeoProj.mDatum = GM_DATUM_WGS_84; theGeoProj.mUnit = GM_PRJ_UNIT_ARC_DEGREES; GM_SetProjection( &theGeoProj );
GM_Projection_t theUtmProj; ::memset( &theUtmProj, 0, sizeof theUtmProj ); theUtmProj.mProjSys = GM_PRJ_UTM; theUtmProj.mDatum = GM_DATUM_WGS_84; theUtmProj.mUnit = GM_PRJ_UNIT_METERS; theUtmProj.mAttrList[0].mAttr = ZONE; theUtmProj.mAttrList[0].mValue = 0; // use 0 to automatically selected best UTM zone theUtmProj.mNumAttrs = 1; GM_SetProjection( &theUtmProj );
// Set up lat/lon bounds to select zone for GM_Rectangle_t theLatLonRect; theLatLonBounds.mMinX = theLatLonRect.mMinX = -90.0; theLatLonRect.mMaxX = theLatLonRect.mMinX + 0.1; theLatLonRect.mMinY = 35.0; theLatLonRect.mMaxY = theLatLonRect.mMinY + 0.1; // Set up UTM projection with no zone provided GM_Projection_t theUtmProj; ::memset( &theUtmProj, 0, sizeof theUtmProj ); theUtmProj.mProjSys = GM_PRJ_UTM; theUtmProj.mDatum = GM_DATUM_WGS_84; theUtmProj.mUnit = GM_PRJ_UNIT_METERS; theUtmProj.mNumAttrs = 0; GM_SetProjectionEx( &theUtmProj, &theLatLonRect, NULL );