+ Reply to Thread
Results 1 to 7 of 7

Thread: Polyline Drawing

  1. #1
    Scott McNeil
    Join Date
    Apr 2010
    Posts
    19
    Points
    0
    Answers Provided
    0


    0

    Default Polyline Drawing

    I am deveoping a standalone c# application using the MapControl in ArcGIS 9.3. I am currently drawing polylines on the map, using the call "PartialRefresh(esriViewDrawPhase.esriViewForeground, null, null) to trigger an event causing my drawing code to be invoked. This all works great however, I'd like to be able to redraw some polylines (that need to be updated/moved) and not others, and using this method all lines must get drawn each time the refresh is performed. This causes the apperance of "flickering" as the majority of the lines did not change but get redrawn anyway.

    Is there a way to just redraw some polylines and not others? Is it possible to group polylines into different layers and only redraw some layers? Ideas/suggestions are appreciated!

  2. #2
    Alexander Gray
    Join Date
    Apr 2010
    Posts
    685
    Points
    201
    Answers Provided
    32


    0

    Default Re: Polyline Drawing

    Perhaps you could benefit from dynamic display (9.3)
    http://resources.esri.com/help/9.3/a...16f65fd94a.htm

    or basemap layers (arcgis 10)
    http://blogs.esri.com/Dev/blogs/arcg...ArcGIS-10.aspx

    Finally also in 10 is the graphic tracker
    http://help.arcgis.com/en/sdk/10.0/a...000004tv000000

  3. #3
    Ken Buja

    Join Date
    Jan 2010
    Posts
    1,209
    Points
    869
    Answers Provided
    150


    0

    Default Re: Polyline Drawing

    Take a look at this thread to see if there's anything in there that would help you.
    Ken Buja
    Silver Spring, MD

  4. #4
    Scott McNeil
    Join Date
    Apr 2010
    Posts
    19
    Points
    0
    Answers Provided
    0


    0

    Default Re: Polyline Drawing

    Thanks for the suggestions. The v10 GraphicsTracker looks promising but unfortunatley I am stuck using 9.3 for now, as my customer invested over 40K in it about a year and a half ago... Also, I had tried using a dynamic display a while back and determined it was not well suited for the application. Dont remember specifically but think it significantly degraded the map grahics.

    I am going to experiment some more with custom layers and see where that takes me. I'm still not sure if its possible to force a refresh on a single custom layer without causing other custom layers to be redrawn. If anyone has tried something like that, Id appriciate any input.

    Thx,
    Scott

  5. #5
    Scott McNeil
    Join Date
    Apr 2010
    Posts
    19
    Points
    0
    Answers Provided
    0


    0

    Default Re: Polyline Drawing

    I tried using separate layers for groups of polylines and using the partialrefresh method that allows a single layer to be specified for redraw as described in docs (How to redraw the display)

    // Refresh a single layer.
    pMap.PartialRefresh(esriViewGeography, pLayer, null);

    http://edndoc.esri.com/arcobjects/9....9af9bd6591.htm


    This partial refresh with an object reference passed does not call Draw() on my object/layer. Draw only gets called if I provide null as the second parameter. And as I expected, when I do that all of my polyline layers are refreshed (Draw is called on each layer)-- exactly what I wanted to avoid.

    Has anyone done something like this and been successful? Doc also implies that using the esriViewGraphics phase individual elements can be refreshed. Has anyone tried that?
    Last edited by Smcneil1; 06-17-2011 at 01:08 PM. Reason: fixed link

  6. #6
    Alexander Gray
    Join Date
    Apr 2010
    Posts
    685
    Points
    201
    Answers Provided
    32


    0

    Default Re: Polyline Drawing

    I have done graphics refresh and foreground refresh. Neither will refresh a geographic layer. Graphics refresh is for graphical elements (IElement) added to the graphics container of the activeview. They work quite well but the elements are not stored in the geodatabase (unless it is annotation), they are stored in mxd. Foreground drawing is trickier but I have used it with good results for non persisting geometries (custom rubber band when editing.) Foreground objects get cleared at every refresh and must be redrawn on the screendisplay in the activeview refresh event for refresh on the foreground phase. I found that gave me the best results for a geometry that changed quickly and often as a result of user interaction and I didn't need to store them at all.
    You could code a custom layer that draws to the foreground or to the graphic phase. ILayer.Draw method passes in the phase to draw to. That way you can chose which phase you want to draw to. Making custom layers increases the difficulty in supporting the code over time though.

  7. #7
    Scott McNeil
    Join Date
    Apr 2010
    Posts
    19
    Points
    0
    Answers Provided
    0


    0

    Default Re: Polyline Drawing

    Hi Alex,
    My original implementation was using the foreground drawing method you describe, but there is no way to only redraw some of the items-- all foreground items must be redrawn. I need to redraw only the items (polylines) that changed, which was my original reason for posting. I tried using esriViewGraphics, but had no luck getting that to work.

    With my most recent attempts I am using a custom layer subclassed from BaseCustomLayer. WIth this approach, no matter what draw phase parameter I provide to PartialRefresh(), my Draw() method override only gets invoked with a phase of esriDPGeography (which, I should note is actually a different enumeration type than is passed to PartialRefresh). Neverthelss, according to ESRI documentation in my previous link, I should be able to refresh only the layer object passed to PartialRefresh.

    I found these posts of others having similar PartialRefresh problems:

    http://forums.arcgis.com/threads/24958

    http://forums.esri.com/Thread.asp?c=159&f=1707&t=180719

    Based on suggestions in the Steven Dunn thread, I was able to make some improvements but its still not working correctly. Draw() is now called on each of my layers independenty, but about 1/2 the time the the previous layer contents are left on the map (not removed). Also, about once a second, it appears the entire map frame is repainted without ever needing to calling my layer's draw method... This is actually worse than redrawing all my layers since the entire map repaints, not just my layers.

    Thus, still working on it...

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts