+ Reply to Thread
Results 1 to 15 of 15

Thread: LineSymbol and SimpleLineSymbol not rendering without AcceleratedDisplay

  1. #1
    Aaron High
    Join Date
    Aug 2010
    Posts
    29
    Points
    8
    Answers Provided
    1


    0

    Default LineSymbol and SimpleLineSymbol not rendering without AcceleratedDisplay

    Hello,

    I'm working through some performance issues with the accelerated display and have switched to working without it enabled. With the AcceleratedDisplay enabled, SimpleLineSymbols and LineSymbols both render correctly. If I turn it off, both fail to render completely. Nothing else has changed such as their geometries or symbologies. Is this a known issue and/or am I doing something wrong? Additionally, SimpleFillSymbols, PictureMarkerSymbols, and TextSymbols seem to work just fine regardless of AcceleratedDisplay settings.

    Thanks.

    EDIT: Code sample below

    Code:
    private void MakeSimpleSymbol()
    {
                //Create a simple line symbol
                SimpleLineSymbol sls = new SimpleLineSymbol();
                sls.Color = new SolidColorBrush(Colors.Blue);
                sls.Style = SimpleLineSymbol.LineStyle.Solid;
                sls.Width = 2;
    
                //Create a polygon object
                Polygon p = new Polygon();
                p.SpatialReference = new SpatialReference(102100);
    
                //Populate it with some points
                ESRI.ArcGIS.Client.Geometry.PointCollection pointCollection = new ESRI.ArcGIS.Client.Geometry.PointCollection();
                ObservableCollection<ESRI.ArcGIS.Client.Geometry.PointCollection> rings = new ObservableCollection<ESRI.ArcGIS.Client.Geometry.PointCollection>();
                MapPoint wgsPoint = new MapPoint(0,0);
                MapPoint wgsPoint2 = new MapPoint(50,0);
                MapPoint wgsPoint3 = new MapPoint(0,50);
                pointCollection.Add(wgsPoint);
                pointCollection.Add(wgsPoint2);
                pointCollection.Add(wgsPoint3);
                rings.Add(pointCollection);
                p.Rings = rings;
    
                //Create a graphic and set its properties
                Graphic graphic = new Graphic();
                graphic.Geometry = p;
                graphic.Symbol = sls;
    
                //Create a graphics layer and add the graphic to it
                GraphicsLayer gLayer = new GraphicsLayer();
                gLayer.Graphics.Add(graphic);
    
                //Add the graphics layer to the map
                _map.Layers.Add(gLayer);
    }
    And in the XAML:
    Code:
    <Window x:Class="ESRIWPFTestApplication.MainWindow"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
            Title="MainWindow" Height="350" Width="525">
        <Grid>
            <!-- AcceleratedDisplay is OFF -->
            <esri:Map x:Name="_map" UseAcceleratedDisplay="False">
            </esri:Map>
        </Grid>
    </Window>
    Last edited by ahigh2; 04-19-2013 at 01:17 PM.

  2. #2
    Aaron High
    Join Date
    Aug 2010
    Posts
    29
    Points
    8
    Answers Provided
    1


    0

    Default Re: LineSymbol and SimpleLineSymbol not rendering without AcceleratedDisplay

    For what it's worth, an answer/workaround was posted to this question on Stack Exchange:

    http://gis.stackexchange.com/questio...hout-accelerat

    Using ESRI.ArcGIS.Client.Geometry.Polyline objects instead of ESRI.ArcGIS.Client.Geometry.Polygon objects will allow the use of SimpleLineSymbols for representation in non-accelerated displays. It still seems a bit odd to me that I have to change a geometry object to continue to use a known symbology when I switch out of the Accelerated Display. Any additional input on this would be greatly appreciated.

    Thanks.

  3. #3
    David Martin
    Join Date
    May 2010
    Posts
    55
    Points
    12
    Answers Provided
    2


    0

    Default Re: LineSymbol and SimpleLineSymbol not rendering without AcceleratedDisplay

    The Help on LineSymbol and SimpleLineSymbol say they are to draw Polyline objects. I'd therefore be tempted to shift to FillSymbol or SimpleFillSymbol, which are stated as being there to draw Polygon objects.

    SimpleFillSymbol has 2 properties that take a Brush. BorderBrush and Fill. If you don't want a fill, you could set the Brush.Opacity property on the Fill Brush to zero, to make it transparent.

    You're then left with all the flexibility of the Brush object to determine how your border looks.

  4. #4
    Mike Branscomb

    Join Date
    Feb 2010
    Posts
    882
    Points
    359
    Answers Provided
    59


    0

    Default Re: LineSymbol and SimpleLineSymbol not rendering without AcceleratedDisplay

    Hi,

    It's a feature of the "accelerated" rendering engine at the core of the ArcGIS Runtime, that you can supply marker, line or fill symbols and they'll be applied to the appropriate sub geometry of your shape i.e. SimpleMarkerSymbols will be applied to the vertices of Polylines and Polygons and SimpleLineSymbols will be applied to the line segments of Polylines and Polygons. The original WPF based display does not follow the same pattern.

    Ideally, you should consider the "accelerated" display as the only display. However, currently there are some items which are not supported in the runtime core display, such as KML, clusterer renderers, temporal renderers.

    Cheers

    Mike
    ArcGIS Runtime Product Engineer

  5. #5
    Ankita Bhatia
    Join Date
    Oct 2012
    Posts
    51
    Points
    1
    Answers Provided
    1


    0

    Default Re: LineSymbol and SimpleLineSymbol not rendering without AcceleratedDisplay

    Hi,
    I am using the Draw object and DrawMode.LineSegment to allow the enduser to draw a line between two points.

    The end points of the line are themselves graphic symbols. So actually the user would start drawing a LineSegment by clicking on one point graphic and will click on the next graphic to denote the end of draw.

    The problem I am facing is when I zoom in or Zoom out the End graphics move away from the end points of the line.
    As per my understanding both the Line Segment and the Graphics should move the same amount (and thus the endpoints will coincide with the graphics).

    Kindly help me resolve this issue.
    To mention: I am not using accelerated display coz I need to use clustering and customized Marker Symbols.
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	img1.PNG‎
Views:	34
Size:	51.8 KB
ID:	25492   Click image for larger version

Name:	AfterZooming.PNG‎
Views:	15
Size:	3.7 KB
ID:	25493  
    Last edited by Ankita_Bhatia01; 06-26-2013 at 04:02 AM. Reason: Adding more information

  6. #6
    Mike Branscomb

    Join Date
    Feb 2010
    Posts
    882
    Points
    359
    Answers Provided
    59


    0

    Default Re: LineSymbol and SimpleLineSymbol not rendering without AcceleratedDisplay

    Hi,

    Are you able to post the code which demonstrates this?

    Cheers

    Mike
    ArcGIS Runtime Product Engineer

  7. #7
    Ankita Bhatia
    Join Date
    Oct 2012
    Posts
    51
    Points
    1
    Answers Provided
    1


    0

    Default Re: LineSymbol and SimpleLineSymbol not rendering without AcceleratedDisplay

    The code for drawing the Line in the DrawCompleted Event is
    if (drawVertex1 && drawObject.DrawMode==DrawMode.LineSegment)
    {
    GraphicsLayer gp = GetOrCreateGraphicsLayer("MyGraphicsLayer");
    if (this.selectedGraphic.Count == 1)
    {
    targetID = selectedGraphic.ElementAt(0).Attributes["NAME"].ToString();
    }

    var pipeSymbol =new SimpleLineSymbol() { Style = SimpleLineSymbol.LineStyle.Solid, Color = Brushes.Red, Width = 2 };

    viewMap.Cursor = Cursors.Arrow;
    Graphic g = new Graphic();
    g.Attributes["GraphicId"] = GraphicsCollection.Count;
    g.Attributes["SourceID"] = sourceID; //Start graphic
    g.Attributes["TargetID"] = targetID; //EndGraphic
    g.Attributes["TYPE"] = "XX";
    g.Geometry = e.Geometry;
    g.Symbol = pipeSymbol;
    g.Geometry.SpatialReference = new SpatialReference(102100);
    GraphicsCollection.Add(g);
    drawObject.IsEnabled = false;
    drawVertex1 = false;
    return;
    }
    The Graphics at the end points are Point graphics but have control templates defined as follows:
    <esri:SimpleMarkerSymbol x:Key="StartSymbol">
    <esri:SimpleMarkerSymbol.ControlTemplate>
    <ControlTemplate>
    <Grid>
    <!-- Marker -->
    <StackPanel Orientation="Vertical">

    <Canvas>
    <Ellipse Width="30" Height="15" />
    <Path Width="30"
    Height="15"
    HorizontalAlignment="Left"
    VerticalAlignment="Top"
    Data="M 435.782,256.9C 410.699,256.9 390.365,244.15 390.365,228.421C 390.365,212.693 410.699,199.942 435.782,199.942M 585.239,199.942C 610.322,199.942 630.656,212.692 630.656,228.421C 630.656,244.149 610.322,256.9 585.239,256.9M 436.489,200.001L 585.822,200.001L 585.822,257.335L 436.489,257.335L 436.489,200.001 Z "
    Fill="Azure"
    Stretch="Fill"
    Stroke="Black"
    StrokeLineJoin="Round" />
    </Canvas>
    <TextBlock FontSize="12"
    FontWeight="Bold"
    Foreground="Black"
    Text="{Binding Attributes[NAME]}" />
    </StackPanel>

    </Grid>
    </ControlTemplate>
    </esri:SimpleMarkerSymbol.ControlTemplate>
    </esri:SimpleMarkerSymbol>

  8. #8
    Mike Branscomb

    Join Date
    Feb 2010
    Posts
    882
    Points
    359
    Answers Provided
    59


    0

    Default Re: LineSymbol and SimpleLineSymbol not rendering without AcceleratedDisplay

    Do you see the same behaviour with a regular SimpleMarkerSymbol?
    ArcGIS Runtime Product Engineer

  9. #9
    Ankita Bhatia
    Join Date
    Oct 2012
    Posts
    51
    Points
    1
    Answers Provided
    1


    0

    Default Re: LineSymbol and SimpleLineSymbol not rendering without AcceleratedDisplay

    Yes the same behavior happens even when I use a SimpleMarkerSymbol. (without any control template)

  10. #10
    Mike Branscomb

    Join Date
    Feb 2010
    Posts
    882
    Points
    359
    Answers Provided
    59


    1

    Default Re: LineSymbol and SimpleLineSymbol not rendering without AcceleratedDisplay

    Hi,

    I believe what you're seeing is just a product of the geometry of the start/end point of the line not being exactly the same as the points? i.e. - are you performing a hit test to determine which graphic the user has clicked/selected then using that as the start and end point?

    To do this you could use the FindGraphicsInHostCoordinates method on the GraphicsLayer (http://resources.arcgis.com/en/help/...t,Int32).html).

    ... Actually I see from your code the user should already have a graphic selected - therefore you could use the geometry of the point(s) the user has selected to create the line (to ensure the coordinates are coincident).

    Regarding the cluster renderer - unfortunately that is not yet supported in the accelerated display mode. For custom symbols you could create them programmatically in code and use RenderTargetBitmap to render them as images then assign the image as a PictureMarkerSymbol.

    Generally we also advise using a Renderer to apply symbols to all features in a layer rather than creating individual symbol instances per graphic.

    Cheers

    Mike
    Last edited by mbranscomb; 06-27-2013 at 01:01 AM.
    ArcGIS Runtime Product Engineer

  11. #11
    Ankita Bhatia
    Join Date
    Oct 2012
    Posts
    51
    Points
    1
    Answers Provided
    1


    0

    Default Re: LineSymbol and SimpleLineSymbol not rendering without AcceleratedDisplay

    Hi Mike!
    Strangely when I don't use the geometry returned by Draw object and create my own geometry,using the start and end point as the connected points, the line is not shown.

    I drag my line from one symbol to another but the line does not appear.

  12. #12
    Ankita Bhatia
    Join Date
    Oct 2012
    Posts
    51
    Points
    1
    Answers Provided
    1


    0

    Default Re: LineSymbol and SimpleLineSymbol not rendering without AcceleratedDisplay

    Hi Mike!
    I got this to work by explicitly calling the Complete Draw on MouseUp of the map and finding the Graphic on the clicked location.
    Thanks for helping me out

  13. #13
    Mike Branscomb

    Join Date
    Feb 2010
    Posts
    882
    Points
    359
    Answers Provided
    59


    0

    Default Re: LineSymbol and SimpleLineSymbol not rendering without AcceleratedDisplay

    That's great news, thanks for the update.

    Cheers

    Mike
    ArcGIS Runtime Product Engineer

  14. #14
    Ankita Bhatia
    Join Date
    Oct 2012
    Posts
    51
    Points
    1
    Answers Provided
    1


    0

    Default Re: LineSymbol and SimpleLineSymbol not rendering without AcceleratedDisplay

    Mike,
    I would like to understand why a geometry drawn with the Draw object behaved differently. According to me, it would have taken the location i was clicking on and on zoom both the graphic and the endpoint of the line would have moved equally.
    Thus giving me an appearance like I am getting now.

    Is there an explanation I am not able to figure out?

  15. #15
    Mike Branscomb

    Join Date
    Feb 2010
    Posts
    882
    Points
    359
    Answers Provided
    59


    0

    Default Re: LineSymbol and SimpleLineSymbol not rendering without AcceleratedDisplay

    I'm not aware of anything in the API that would account for this (e.g. some form of scale-dependent precision) but my initial reaction is that perhaps it's something as simple as when digitizing you're at a sufficiently small scale to make the end of the line appear coincident with the point but in reality it's 100s/1000s metres away?

    Cheers
    ArcGIS Runtime Product Engineer

+ Reply to Thread

Tags for this 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