public static Symbol GetDefaultSymbol(this ESRI.ArcGIS.Client.Geometry.Geometry geometry) { if (geometry == null) { return(null); } Type t = geometry.GetType(); if (t == typeof(MapPoint)) { return(DEFAULT_MARKER_SYMBOL); } else if (t == typeof(MultiPoint)) { return(DEFAULT_MARKER_SYMBOL); } else if (t == typeof(Polyline)) { return(DEFAULT_LINE_SYMBOL); } else if (t == typeof(Polygon)) { return(DEFAULT_FILL_SYMBOL); } else if (t == typeof(Envelope)) { return(DEFAULT_FILL_SYMBOL); } return(null); }
} // public static GraphicsLayer reloadRLData(Map map, string layerID, string layerName) /// <summary> /// Create graphics from xml and restore Symbol for each Graphic in layer /// </summary> /// <param name="gl">redline layer</param> /// <param name="xmlContent">symbols parameters</param> public static void restoreRLGraphics(GraphicsLayer gl, string xmlContent) { // set Graphics symbols gl = VLayer.setContent(gl, xmlContent); foreach (var gr in gl.Graphics) { var t = gr.Attributes["aType"] as string; ESRI.ArcGIS.Client.Geometry.Geometry g = gr.Geometry; if (isText(g, t)) { gr.Symbol = remakeTextSymbol(gr); } else if (isPoint(g)) { gr.Symbol = dicSymbols[t]; } else if (isLine(g)) { gr.Symbol = dicLineSymbols[t]; } else if (isArea(g)) { gr.Symbol = dicAreaSymbols[t]; } else { (string.Format("restoreRLGraphics, unknown Geom type [{0}]", g.GetType())).clog(); continue; } } } // public static void restoreRLGraphics(GraphicsLayer gl, string xmlContent)
public static bool isArea(ESRI.ArcGIS.Client.Geometry.Geometry g) { if (g.GetType() == typeof(ESRI.ArcGIS.Client.Geometry.Polygon)) { return(true); } return(false); }
public static bool isPoint(ESRI.ArcGIS.Client.Geometry.Geometry g) { if (g.GetType() == typeof(ESRI.ArcGIS.Client.Geometry.MapPoint)) { return(true); } return(false); }