Click or drag to resize

GM_CombineAreas

Combines the given list of areas into one or more new area features and adds the new area to the given layer. Any areas that touch or overlap should be combined.

Syntax
GM_Error_t32 __stdcall GM_CombineAreas

(

const GM_AreaFeature_t**    aAreaList,      // IN: List of areas to combine

uint32                      aNumAreas,      // IN: Number of areas in aAreaList

const GM_Projection_t*      aAreaProj,      // IN: Projection system the area coordinates are in (use NULL for current projection)

GM_LayerHandle_t32          aNewAreaLayer   // IN: Layer to add new combined areas to

)
Example

Here is an example showing how to combine all of the areas in a layer into a new layer:

// Build the list of areas to combine

GM_AreaFeature_t** theAreaList = new GM_AreaFeature_t*[ theLayerInfo->mNumAreas ];

uint32 i;

for ( i = 0; i < theLayerInfo->mNumAreas; i++ )

{

    // Get the area feature

    theAreaList[i] = GM_GetAreaFeature( aLayerHandle, i );

}



// Create a new layer and combine the areas into it

GM_LayerHandle_t32 theNewAreaLayer = GM_CreateCustomVectorLayer( "CombinedAreas", &theLayerInfo->mNativeProj );

theErr = GM_CombineAreas( (const GM_AreaFeature_t**)theAreaList, theLayerInfo->mNumAreas, &theLayerInfo->mNativeProj, theNewAreaLayer );



// Free the area features that we combined

for ( i = 0; i < theLayerInfo->mNumAreas; i++ )

{

    GM_FreeAreaFeature( theAreaList[i] );

}



// Free the area list

delete[] theAreaList;

theAreaList = NULL;