How to render area features?
Mike,
When i want to render area features in the custom vector layer, i find that my code can work well with few area features and do not work with plent of area features,why?
My code such as :
Int32 lp_LayerHandle = (Int32) mn_CustomLayerHandle;
IntPtr layerInfoPtr = GlobalMapperDLL.GM_GetLayerInfo(lp_LayerHandle);
GM_LayerInfo_t layerInfo_t = (GM_LayerInfo_t) Marshal.PtrToStructure (layerInfoPtr, typeof (GM_LayerInfo_t));
for (UInt32 k = 0; k < layerInfo_t.mNumAreas; k++)
{
IntPtr ptr = GlobalMapperDLL.GM_GetAreaFeature(lp_LayerHandle, k);
if (ptr.ToInt32() == 0) break;
GM_AreaFeature_t areaInfo = (GM_AreaFeature_t) Marshal.PtrToStructure(ptr, typeof (GM_AreaFeature_t));
GM_AreaStyle_t lt_AreaStyle = areaInfo.mAreaStyle;
lt_AreaStyle.mBrushStyle = GM_BrushStyle_t16.GM_BRUSH_SOLID;
lt_AreaStyle.mBrushColor = (uint) Color.FromArgb(255, 0, 80).ToArgb();
//here is no error code is returned.
GlobalMapperDLL.GM_Error_t32 LastGMError=GlobalMapperDLL.GM_SetAreaFeatureDrawStyle(lp_LayerHandle, k, ref lt_AreaStyle);
GlobalMapperDLL.GM_FreeAreaFeature(ptr);
}
When i want to render area features in the custom vector layer, i find that my code can work well with few area features and do not work with plent of area features,why?
My code such as :
Int32 lp_LayerHandle = (Int32) mn_CustomLayerHandle;
IntPtr layerInfoPtr = GlobalMapperDLL.GM_GetLayerInfo(lp_LayerHandle);
GM_LayerInfo_t layerInfo_t = (GM_LayerInfo_t) Marshal.PtrToStructure (layerInfoPtr, typeof (GM_LayerInfo_t));
for (UInt32 k = 0; k < layerInfo_t.mNumAreas; k++)
{
IntPtr ptr = GlobalMapperDLL.GM_GetAreaFeature(lp_LayerHandle, k);
if (ptr.ToInt32() == 0) break;
GM_AreaFeature_t areaInfo = (GM_AreaFeature_t) Marshal.PtrToStructure(ptr, typeof (GM_AreaFeature_t));
GM_AreaStyle_t lt_AreaStyle = areaInfo.mAreaStyle;
lt_AreaStyle.mBrushStyle = GM_BrushStyle_t16.GM_BRUSH_SOLID;
lt_AreaStyle.mBrushColor = (uint) Color.FromArgb(255, 0, 80).ToArgb();
//here is no error code is returned.
GlobalMapperDLL.GM_Error_t32 LastGMError=GlobalMapperDLL.GM_SetAreaFeatureDrawStyle(lp_LayerHandle, k, ref lt_AreaStyle);
GlobalMapperDLL.GM_FreeAreaFeature(ptr);
}
Comments
-
Everything looks ok to me. What kidn of problems are you seeing when you have lots of areas?
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
None of 24289 area features is rendered.
-
Do the areas render if you don't run your loop to edit the drawing style of the areas?
-
Mike,
In fact,there are six area features are rendered and when the k>6,no area feature can be accessed.Zero is returned when the line followed is excuted:
IntPtr ptr = GlobalMapperDLL.GM_GetAreaFeature(lp_LayerHandle, k); -
It sounds like do not have a license file for the SDK. Without a license file the GM_GetAreaFeature function only returns valid information up to an area index of GM_MAX_NON_REGISTERED_VECTOR_IDX, which has a value of 5. Once you have a valid license file then you can get all of the features.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
I see,thanks a lot.
Could you send to me a temp license so that i can study it deeply?I like it very much and soon or later i belive we will pay for it.
JerryLia@gmail.com
Categories
- 12.8K All Categories
- 5.7K Features Discussion
- 345 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 637 GM Script Language
- 54 User Scripts
- 114 GPS Features
- 417 Projection Questions
- 826 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 178 Announcement and News
- 913 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 569 Other Discussion
- 131 GIS Data Sources
- 27 Global Mapper Showcase
- 238 How I use Global Mapper
- 107 Global Mapper Forum Website