GM_SetPointFeatureDrawStyle question

dzsbpdzsbp Global Mapper UserPosts: 22
edited April 2010 in SDK

I'd like to set thousands of points' attributes (size, color and rotation) from a dxf file but I cannot do this while I'm able to modify these parameters in case of Lines from an other dxf file.

Here is the code (in c#):

GM_LineStyle_t myLineStyle = new GM_LineStyle_t();
GM_PointStyle_t myPointStyle = new GM_PointStyle_t();

myLineStyle.mPenColor = Convert.ToUInt32(sColour);
myLineStyle.mPenWidth = Convert.ToByte(sWidth);
myPointStyle.mFont.mColor = Convert.ToUInt32(sColour);
myPointStyle.mFont.mPointSize = Convert.ToByte(sHeight);

if (Info.mNumLines > 0)
for (Int32 i = 0; i < Convert.ToInt32(Info.mNumLines); i++)
{ GM_SetLineFeatureDrawStyle(layerid, Convert.ToUInt32(i), ref myLineStyle); }

if (Info.mNumPoints > 0)
myPointStyle.mDrawLabel = 1;
for (Int32 i = 0; i < Convert.ToInt32(Info.mNumPoints); i++)
{GM_SetPointFeatureDrawStyle(layerid, Convert.ToUInt32(i), ref myPointStyle); }

This code works with lines but not with points. I've added the neccessary dll reference to the dllWrapper module:

[DllImport(DLLFileName, EntryPoint = "GM_SetPointFeatureDrawStyle")]
public static extern GM_Error_t32 GM_SetPointFeatureDrawStyle
IntPtr aLayer, // Layer the point is in
UInt32 aPointIndex, // Index of point in layer
ref GM_PointStyle_t aPointStyle // New style to use for point

What do I do wrong?
Thanks in advance,


  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited April 2010

    Your GM_PointStyle_t structure isn't going to be initialized properly based on your code. You should also be checking the return values of the GM_SetPointFeatureDrawStyle function to see if you are getting an error.

    If you aren't going to completely setup the point style yourself, I would suggest doing something different to update the font. For each point, make a call to GM_GetPointFeature to get the current point and the style used (copy this to your local GM_PointStyle_t structure), then modify the GM_PointStyle_t structure to change the font as desired, then call GM_SetPointFeatureDrawStyle to update the point style. Finally remember to call GM_FreePointFeature to free the point feature returned by GM_GetPointFeature.

    Let me know if I can be of further assistance.


    Global Mapper Support
  • dzsbpdzsbp Global Mapper User Posts: 22
    edited April 2010
    Hello Mike,

    thanks for the help!

    I checked the attributes of the points as you suggested (with the GM_GetPointFeature call) and used them with the modification in height.

    Then I filled all of the myPointStyle's mFont properties manually, based on these values. After it I started to remove all the attributes one by one and I figured out that the code I quoted above was correct except one thing: I have to define the font's FaceName (Times New Roman in my case).

    So now with this one modification I'm able to change all of the attributes (color, rotation, height, etc.) of the points easily.

    Thanks again,
Sign In or Register to comment.