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
Categories
- 12.8K All Categories
- 5.7K Features Discussion
- 346 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 639 GM Script Language
- 54 User Scripts
- 115 GPS Features
- 417 Projection Questions
- 829 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 179 Announcement and News
- 922 Bug Report
- 559 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 573 Other Discussion
- 131 GIS Data Sources
- 27 Global Mapper Showcase
- 241 How I use Global Mapper
- 108 Global Mapper Forum Website