Search code examples
c#silverlightrenderingsilverlight-5.0arcgis

performance at arcgis silverlight api


I am using GraphicsLayer for road symbology with SimpleLineSymbol. my code is same with below code:

    for (int i = 0; i < 200000; i++)
    {
        myGraphicsLayer.Graphics[i].Symbol = mySimpleLineSymbol;
    }

this code run fast but draw linesymbol on map is very slow.(Approximately 6 sec). please help me for increase symbology performance.


Solution

  • I collect all geometry into one polyline and create one graphic for that. then i create symbol and display.It takes one second for rendering and display on map.

            var myPolyline = new ESRI.ArcGIS.Client.Geometry.Polyline();
    
            for (int i = 0; i < 200000; i++)
            {
                myPolyline.Paths.Add(((ESRI.ArcGIS.Client.Geometry.Polyline)myGraphicsLayer.Graphics[i].Geometry).Paths[0]);
            }
    
            Graphic myGraph = new Graphic();
    
            myGraph.Geometry = myPolyline;
    
            ESRI.ArcGIS.Client.Symbols.SimpleLineSymbol sym = new ESRI.ArcGIS.Client.Symbols.SimpleLineSymbol();
    
            sym.Color = new SolidColorBrush(Colors.Red);
    
            sym.Width = 2;
    
            myGraph.Symbol = sym;
    
            myGraphicsLayer.Graphics.Add(myGraph);