How to declare the struct FeatureClass_t16?

JerryLiaJerryLia Global Mapper UserPosts: 26
edited August 2008 in SDK
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
} ;

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited August 2008
    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
Sign In or Register to comment.