Example #1
0
        private void AddShapeLayer(List <IGeoInfo> shapeList, Layer layer)
        {
            foreach (ShapeGeoInfo shape in shapeList)
            {
                if (shape.Polygons.Values.Count == 0)
                {
                    continue;
                }

                PolygonBuilder builder = new PolygonBuilder(SpatialReferences.Wgs84);
                shape.Polygons.Values.ToList().ForEach(p => builder.AddParts(p.Parts));
                Polygon polygon = builder.ToGeometry();

                Dictionary <string, object> attr = new Dictionary <string, object>(shape.AttrList);
                attr[KEY_CODE] = shape.KeyCode;
                layer.GraphicsLayer.Graphics.Add(new Graphic(polygon, attr, MapShapeLayer.GetSymbol(GeoMarkerType.Fill, GeoStatus.Normal)));
                _shapeList.Add(polygon.Extent);

                layer.GraphicsLayer.Graphics.Add(new Graphic(polygon.Extent.GetCenter(), attr, MapShapeLayer.GetSymbol(GeoMarkerType.Point, GeoStatus.Normal)));
            }
        }
Example #2
0
 void HilightItem(Graphic graphic, Layer layer)
 {
     if (layer.Info is MapPointLayer)
     {
         graphic.Symbol = MapPointLayer.GetSymbol(GeoStatus.Hilight);
     }
     else if (layer.Info is MapShapeLayer)
     {
         var code = graphic.Attributes[KEY_CODE];
         var list = layer.GraphicsLayer.Graphics.Where(x => x.Attributes[KEY_CODE].ToString() == code.ToString());
         list.ToList().ForEach(g =>
         {
             if (g.Geometry is MapPoint)
             {
                 g.Symbol = MapShapeLayer.GetSymbol(GeoMarkerType.Point, GeoStatus.Hilight);
             }
             else
             {
                 g.Symbol = MapShapeLayer.GetSymbol(GeoMarkerType.Fill, GeoStatus.Hilight);
             }
         });
     }
     else if (layer.Info is MapLineLayer)
     {
         graphic.Symbol = MapLineLayer.GetSymbol(GeoMarkerType.Line, GeoStatus.Hilight);
     }
     else if (layer.Info is MapEventLayer)
     {
         if (layer.Info.ConvertTo <MapEventLayer>().MarkerType == EventMarkerType.Proportional)
         {
             (graphic.Symbol as SimpleMarkerSymbol).Color = DefaultSettings.GetColor(GeoStatus.Hilight);
         }
         else
         {
             graphic.Symbol = layer.Info.ConvertTo <MapEventLayer>().GetSymbol(GeoStatus.Hilight);
         }
     }
 }
Example #3
0
 void SetAllNormal(Layer layer)
 {
     if (layer.Info is MapPointLayer)
     {
         layer.GraphicsLayer.Graphics.ToList().ForEach(g => g.Symbol = MapPointLayer.GetSymbol(GeoStatus.Normal));
     }
     else if (layer.Info is MapShapeLayer)
     {
         layer.GraphicsLayer.Graphics.ToList().ForEach(g =>
         {
             if (g.Geometry is MapPoint)
             {
                 g.Symbol = MapShapeLayer.GetSymbol(GeoMarkerType.Point, GeoStatus.Normal);
             }
             else
             {
                 g.Symbol = MapShapeLayer.GetSymbol(GeoMarkerType.Fill, GeoStatus.Normal);
             }
         });
     }
     else if (layer.Info is MapLineLayer)
     {
         layer.GraphicsLayer.Graphics.ToList().ForEach(g => g.Symbol = MapLineLayer.GetSymbol(GeoMarkerType.Line, GeoStatus.Normal));
     }
     else if (layer.Info is MapEventLayer)
     {
         if ((layer.Info.ConvertTo <MapEventLayer>()).MarkerType == EventMarkerType.Proportional)
         {
             layer.GraphicsLayer.Graphics.ToList().ForEach(g => (g.Symbol as SimpleMarkerSymbol).Color = DefaultSettings.GetColor(GeoStatus.Normal));
         }
         else
         {
             layer.GraphicsLayer.Graphics.ToList().ForEach(g => g.Symbol = (layer.Info.ConvertTo <MapEventLayer>().GetSymbol(GeoStatus.Normal)));
         }
     }
 }