Exemplo n.º 1
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);
         }
     }
 }
Exemplo n.º 2
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)));
         }
     }
 }
Exemplo n.º 3
0
        static private List <IGeoInfo> GetLineList(HMCon hmConn, List <DataRow> rowList, MapLineLayer layer, string linkCodeList)
        {
            List <IGeoInfo> lineList = CreateList <LineGeoInfo>(layer, rowList);

            string sql       = $"select * from Geo_Link where LinkTableName='{layer.LinkTable}' and Feature='{layer.LayerName}' and LinkCode in ({linkCodeList})";
            var    linkTable = hmConn.SQLExecutor.ExecuteDataAdapter(sql, hmConn.TRConnection);

            string polyIdList = "";

            linkTable.Select().ToList().ForEach(row => polyIdList += $",{row["LinkId"]}");
            if (string.IsNullOrEmpty(polyIdList))
            {
                return(lineList);
            }

            polyIdList = polyIdList.Remove(0, 1);
            sql        = $"select * from Geo_Polyline where PolylineId in ({polyIdList})";
            var geoTable = hmConn.SQLExecutor.ExecuteDataAdapter(sql, hmConn.TRConnection);

            foreach (var row in rowList)
            {
                LineGeoInfo info = lineList.Find(x => x.KeyCode == $"{row[layer.LinkColumn]}").ConvertTo <LineGeoInfo>();

                var linkRow = linkTable.Select($"LinkCode='{row[layer.LinkColumn]}'");
                if (linkRow.Length > 0)
                {
                    info.PolylineId = (int)linkRow[0]["LinkId"];
                    var groups = geoTable.Select($"PolylineId={info.PolylineId}").GroupBy(x => x["LineId"]);
                    foreach (var group in groups)
                    {
                        List <MapPoint> pointList = new List <MapPoint>();
                        group.ToList().ForEach(geo => pointList.Add(new MapPoint(double.Parse(geo["Longitude"].ToString()), double.Parse(geo["Latitude"].ToString()))));
                        Polyline polyline = new Polyline(pointList, SpatialReferences.Wgs84);
                        info.Polylines.Add(int.Parse($"{group.Key}"), polyline);
                    }
                }
            }

            return(lineList);
        }
Exemplo n.º 4
0
        private void AddLineLayer(List <IGeoInfo> lineList, Layer layer)
        {
            foreach (LineGeoInfo line in lineList)
            {
                if (line.Polylines.Values.Count == 0)
                {
                    continue;
                }

                PolylineBuilder builder = new PolylineBuilder(SpatialReferences.Wgs84);
                line.Polylines.Values.ToList().ForEach(p => builder.AddParts(p.Parts));

                Polyline polyline = builder.ToGeometry();
                layer.GraphicsLayer.Graphics.Add(new Graphic(polyline, line.AttrList, MapLineLayer.GetSymbol(GeoMarkerType.Line, GeoStatus.Normal)));
                _shapeList.Add(polyline.Extent);

                //_otherGraphic.Graphics.Add(new Graphic(polyline.Extent.GetCenter(), line.AttrList, MapLineLayer.GetSymbol(GeoType.Point, GeoStatus.Normal)));
            }
        }