//添加虚拟线; private void addHoverLineSegment(Point2D p0 , Point2D p1 , int index0 , int index1 , Feature feature , Point2DCollection points , int partIndex) { GeoLine line = new GeoLine(); line.Parts.Add(new Point2DCollection() { p0 , p1 }); Feature segment = new Feature() { Geometry = line , Style = hoverLineStyle }; segment.SetZIndex(1); segment.Attributes.Add("Point2DCollection" , points); segment.Attributes.Add("Feature" , feature); segment.Attributes.Add("Index0" , index0); segment.Attributes.Add("Index1" , index1); segment.Attributes.Add("PartIndex" , partIndex); hoverLayer.Features.Add(segment); }
//添加虚拟顶点; private Feature addHoverVertex(Feature feature , GeoPoint p , int index , int partIndex) { Feature hoverVertex = new Feature() { Geometry = p , Style = HoverVertexStyle }; hoverVertex.SetZIndex(2); hoverLayer.Features.Add(hoverVertex); hoverVertex.Attributes.Add("Feature" , feature); hoverVertex.Attributes.Add("Index" , index); hoverVertex.Attributes.Add("PartIndex" , partIndex); hoverVertex.AddDoubleClick((s , e) => { deleteOneVertex(s as Feature); });//双击删除某个顶点,线和面。 return hoverVertex; }
//当线对象时,显示bounds的中心点; private void addCenterFeature(Feature feature) { GeoPoint center = new GeoPoint(feature.Geometry.Bounds.Center.X , feature.Geometry.Bounds.Center.Y); hoverCenterFeature = new Feature { Geometry = center , Style = HoverCenterStyle }; hoverCenterFeature.SetZIndex(3); hoverLayer.AddFeature(hoverCenterFeature); }