How to declare the struct FeatureClass_t16?
Hi Mike,
Will the wrong struct declaration cause the program crashing or unstable running?
Please help me find out whether the following declarations are correct:
public struct GM_AreaStyle_t
{
public GM_PenStyle_t16 mBorderPenStyle; // border pen style (i.e. solid, dash, etc.)
public UInt16 mBorderPenWidth; // width to draw border pen in
public UInt32 mBorderPenColor; // color to use for border pen
public UInt32 mBrushColor; // color of brush to fill area with (when applicable to brush style)
public GM_BrushStyle_t16 mBrushStyle; // style of brush to fill area with
public bool mDrawLabel; // render the label for this area if there is one
public bool mDrawLabelAlways; // render the label for this area even if it collides with another display label
public GM_FontDef_t mFont; // font to use to render label
}
public struct GM_AreaFeature_t
{
public GM_VectorFeature_t mFeatureInfo; // General feature info
public IntPtr mPointList;
// List of points in the area (global coordinates when getting, native when adding feature)
public UInt32 mNumPoints; // Number of points in the list
public IntPtr mHoleList; // List of holes in the area
public UInt32 mNumHoles; // Number of holes in the list of holes
public GM_AreaStyle_t mAreaStyle; // Area render style
//public unsafe float* mVertexElevList;
public IntPtr mVertexElevList;//float* mVertexElevList
} ;
public struct GM_VectorFeature_t
{
public string Name; // Name of the feature
public string Desc; // Description of the feature
public UInt16 Class; // Global Mapper classification assigned to the feature
public IntPtr AttrList; // List of attributes associated with feature
public UInt16 NumAttrs; // Number of attributes in mAttrList
} ;
Will the wrong struct declaration cause the program crashing or unstable running?
Please help me find out whether the following declarations are correct:
public struct GM_AreaStyle_t
{
public GM_PenStyle_t16 mBorderPenStyle; // border pen style (i.e. solid, dash, etc.)
public UInt16 mBorderPenWidth; // width to draw border pen in
public UInt32 mBorderPenColor; // color to use for border pen
public UInt32 mBrushColor; // color of brush to fill area with (when applicable to brush style)
public GM_BrushStyle_t16 mBrushStyle; // style of brush to fill area with
public bool mDrawLabel; // render the label for this area if there is one
public bool mDrawLabelAlways; // render the label for this area even if it collides with another display label
public GM_FontDef_t mFont; // font to use to render label
}
public struct GM_AreaFeature_t
{
public GM_VectorFeature_t mFeatureInfo; // General feature info
public IntPtr mPointList;
// List of points in the area (global coordinates when getting, native when adding feature)
public UInt32 mNumPoints; // Number of points in the list
public IntPtr mHoleList; // List of holes in the area
public UInt32 mNumHoles; // Number of holes in the list of holes
public GM_AreaStyle_t mAreaStyle; // Area render style
//public unsafe float* mVertexElevList;
public IntPtr mVertexElevList;//float* mVertexElevList
} ;
public struct GM_VectorFeature_t
{
public string Name; // Name of the feature
public string Desc; // Description of the feature
public UInt16 Class; // Global Mapper classification assigned to the feature
public IntPtr AttrList; // List of attributes associated with feature
public UInt16 NumAttrs; // Number of attributes in mAttrList
} ;
Comments
-
Yes, an incorrect structure definition will likely cause problems. The only problem that I see in your definitions is that I believe the C# 'bool' type is a 32-bit integer, while in C++ the SDK is using the 'boolean' type, which is defined as a 8-bit value. Try replacing your 'bool' values with 'byte' and see if that helps out.
Your definition of GM_FeatureClass_t16 as a UInt16 is correct.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com
Howdy, Stranger!
Categories
- 12.3K All Categories
- 5.3K Features Discussion
- 312 Downloading Imagery
- 1.2K Elevation Data
- 371 Georeferencing Imagery Discussion
- 581 GM Script Language
- 42 User Scripts
- 112 GPS Features
- 388 Projection Questions
- 789 Raster Data
- 1.3K Vector Data
- 6.4K Support
- 159 Announcement and News
- 881 Bug Report
- 554 SDK
- 1.1K Suggestion Box
- 3.6K Technical Support
- 522 Other Discussion
- 126 GIS Data Sources
- 26 Global Mapper Showcase
- 217 How I use Global Mapper
- 100 Global Mapper Forum Website