Global Mapper v25.0

Draw Shapes and Removal of symbols

melonzeus
melonzeus Global Mapper User
edited April 2009 in SDK
Hi,

I would like to know if there exists any API to draw shapes such as circle in the SDK.


Also, i understand that, deleting a symbol means disabling it from being displayed on the map. Is there any way to remove that symbol totally? As in remove it from the memory.

Thanks.

Comments

  • global_mapper
    global_mapper Administrator
    edited April 2009
    While there is not any automated API to create new features with shapes like circles, all that you need to is build a list of vertices that form the shape that you want for a line or area, then add that feature to a layer. To create a circle that is a true ground distance, you can use the GM_CalcProjectedLocation function to create a series of points every so many degrees around the edge of a circle and create your feature with that.

    The only way to completely remove a feature from memory is to close the layer that the feature is in. Deleting a feature just marks it as deleted, but it is still in memory and can be undeleted later.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • melonzeus
    melonzeus Global Mapper User
    edited April 2009
    Hi, through your help, I have managed to draw shapes with transparency on my map using the SDK.

    However, I noticed something odd. When I draw a shape with a green color fill, it seems to affect the zoom-in/out of the map. The zooming in/out seems to lag. When other color is used, eg. red, the zoom in/out is ok.

    I am not very sure of what causes the above observations. Hope you can help. Thanks!
  • global_mapper
    global_mapper Administrator
    edited April 2009
    When you use translucency the SDK switches to drawing the areas with GDI+ rather than normal Windows GDI, although I wouldn't really expect a noticeable slowdown unless you are drawing lots of areas.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • melonzeus
    melonzeus Global Mapper User
    edited April 2009
    Hi,
    I tried drawing one shape with no transparency. I used a COLORREF RGB(0,255,0)
    As i tried to zoom out to infinity, the system seems to lag when the polygon gets smaller and smaller.
  • global_mapper
    global_mapper Administrator
    edited April 2009
    I would actually expect the render to get faster as you zoomed out as no clipping is done and less pixels are actually modified. Have you timed the draw to make sure it is the source of the lag?

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • melonzeus
    melonzeus Global Mapper User
    edited April 2009
    Hi again.

    I timed the draw. (I have a underlying vector map as base.)

    Without any polygon, my map drew at 110 milliseconds.
    With 1 Red polygon, my map drew at 110 milliseconds.
    With 1 Green polygon, my map drew at 20528 milliseconds.

    Hope this provide some useful information to you. Thanks
  • melonzeus
    melonzeus Global Mapper User
    edited April 2009
    I realised the above problem only exists when I have a vector map loaded
    This map contains about 13000 features.

    Hope this additional information is useful to you. Thanks again.
  • global_mapper
    global_mapper Administrator
    edited April 2009
    So if you have a vector map loaded the draw time is always slow or just when you add your translucent green polygon?

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • melonzeus
    melonzeus Global Mapper User
    edited April 2009
    Hi,

    Here are some of the observations I have.

    No lag (about 10 ms) experienced when a polygon with no transluceny is drawn on the screen without the vector map being loaded.

    Slower draw time (about 100 ms) when just a vector map of 13000 points are drawn and shown on the screen. (No polygon is added yet)

    Significant slower draw time when a vector of 13000 points are drawn on the screen with an additional green polygon (no transluceny) added .
  • global_mapper
    global_mapper Administrator
    edited April 2009
    That is very odd. How many vertices does your green polygon have vs. the red one? Are you loading the polygons from a file or programmatically?

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • melonzeus
    melonzeus Global Mapper User
    edited April 2009
    Hi,
    Thanks for helping. I think I know the source of my problem.
    I tried to create a temporary polygon with the points all at the same location.

    Then I tried to "re-size" that polygon with new points that I obtained by clicking on the screen.

    I have removed this portion of the code and now the draw seems to be ok. (about 100 ms)

    Thanks again!