void freepolygon(List <Point> logPntArr)
        {
            //显示绘制的自由面
            IMSPolygon polygon = new IMSPolygon(CoordinateType.Logic);

            polygon.Stroke             = new SolidColorBrush(Colors.Red); //设置边框颜色
            polygon.Shape.Fill         = new SolidColorBrush(Colors.Red); //填充颜色
            polygon.Shape.Fill.Opacity = 0.5;                             //填充区域透明度
            this.graphicsLayer.AddGraphics(polygon);                      //添加对象
            polygon.Draw(logPntArr);                                      //绘制对象
        }
        //获取第二个要素回调函数
        public void SelectgetGemos(object sender, UploadStringCompletedEventArgs e)
        {
            SFeatureGeometry SelectresutltGemo = this.mapDoc.OnGetGeomByID(e);

            if (SelectresutltGemo != null)
            {
                this._secondFeature = SelectresutltGemo;
                //显示拓扑分析的第二个要素
                this._secondPoly = drawGetFeature(SelectresutltGemo);

                //拓扑分析
                onTopSpanalyse();
            }
            else
            {
                MessageBox.Show("获取第二个要素失败!");
                return;
            }
        }
        private void updateLayerStatus(object sender, UploadStringCompletedEventArgs e)
        {
            //实例化第一个拓扑分析的要素
            _firstFeature = new SFeatureGeometry();
            //实例化第二个拓扑分析的要素
            _secondFeature = new SFeatureGeometry();
            //实例化第一个拓扑分析要素的显示区的对象
            _firstPoly = new IMSPolygon();
            //实例化第二个拓扑分析要素的县市区的对象
            _secondPoly = new IMSPolygon();
            //根据要素id获取需要的数据
            CGetObjByID targetObj = new CGetObjByID();

            //设置第一个要素的id
            targetObj.FeatureID = firstFeatID;
            //设置第一个要素所在的图层号
            targetObj.LayerIndex = 1;
            //获取第一个要素空间信息
            this.mapDoc.GetGeomByID(targetObj, FirstgetGemos);
        }
        private void DrawPolygons(GRegion regions)
        {
            GRegion      _tmp    = regions;
            List <Point> logPnts = new List <Point>();

            this.GraphicsLayer.MapContainer.Refresh();
            for (int i = 0; i < _tmp.Rings.Length; i++)
            {
                logPnts = GetLogPnts(_tmp.Rings[i]);
                IMSPolygon polygon = new IMSPolygon(ZDIMS.Interface.CoordinateType.Logic);
                this.GraphicsLayer.AddGraphics(polygon);
                this.GraphicsLayer.MapContainer.Refresh();
                polygon.StrokeThickness = 1;
                // polygon.Shape.Fill = new SolidColorBrush(Colors.Red);// new SolidColorBrush(t.ToColor("#ee0000"));
                polygon.Points = logPnts;
                polygon.Flicker();

                polygon.FlickerOverCallback += new GraphicsFlickerOverDelegate(fickerover);
            }
        }
        public IMSPolygon drawGetFeature(SFeatureGeometry sfeatureTemp)
        {
            GRegion reg     = sfeatureTemp.RegGeom[0];
            AnyLine arcLine = reg.Rings[0];
            Arc     arc     = arcLine.Arcs[0];

            //获取要素边界的点
            Dot_2D[] Arcpnts   = arc.Dots;
            int      arcpntNum = Arcpnts.Length;
            //绘制多边形
            IMSPolygon poly = new IMSPolygon(CoordinateType.Logic);

            m_gpLayer.AddGraphics(poly);
            for (int i = 0; i < arcpntNum; i++)
            {
                poly.Points.Add(new Point(arc.Dots[i].x, arc.Dots[i].y));
            }
            poly.Draw();

            return(poly);
        }
        public void FirstgetGemos(object sender, UploadStringCompletedEventArgs e)
        {
            SFeatureGeometry FirstResultFeature = this.mapDoc.OnGetGeomByID(e);

            if (FirstResultFeature != null)
            {
                this._firstFeature = FirstResultFeature;
                this._firstPoly    = drawGetFeature(FirstResultFeature);
                //获取第二个要素的空间信息
                CGetObjByID targetObj2 = new CGetObjByID();
                //设置拓扑分析的第二个要素的id
                targetObj2.FeatureID = this.secondFeatID;
                //设置第二个要素所在的图层号
                targetObj2.LayerIndex = 1;
                //获取第二个要素空间信息
                this.mapDoc.GetGeomByID(targetObj2, SelectgetGemos);
            }
            else
            {
                MessageBox.Show("获取第一个要素失败!");
                return;
            }
        }
        private void reDrawMeasurePnts(GraphicsLayer gLayer, IGraphics graphics, List <Point> logPntArr)
        {
            IsDrawOver = true;
            this.m_graphicsLayer.RemoveGraphics(this.measurePnts[this.measurePnts.Count - 1]);
            this.measurePnts.RemoveAt(this.measurePnts.Count - 1);
            if (this.measureMarks != null && this.measureMarks.Count != 0)
            {
                this.mymarklayer.RemoveMark(this.measureMarks[this.measureMarks.Count - 1]);
                this.measureMarks.RemoveAt(this.measureMarks.Count - 1);
            }
            if (this.measureCenterMarks != null && this.measureCenterMarks.Count != 0)
            {
                this.mymarklayer.RemoveMark(this.measureCenterMarks[this.measureCenterMarks.Count - 1]);
                this.measureCenterMarks.RemoveAt(this.measureCenterMarks.Count - 1);

                this.mymarklayer.RemoveMark(this.measureCenterMarks[this.measureCenterMarks.Count - 1]);
                this.measureCenterMarks.RemoveAt(this.measureCenterMarks.Count - 1);
            }
            switch (graphics.DrawingType)
            {
            case DrawingType.Polyline:
                IMSPolyline pl = new IMSPolyline(CoordinateType.Logic)
                {
                    EnableEdit = true
                };
                this.m_graphicsLayer.AddGraphics(pl);
                for (int i = 0; i < logPntArr.Count; i++)
                {
                    pl.Points.Add(logPntArr[i]);
                }
                pl.Draw();

                pl.EditMark1DragInCallback   += new EditMarkDelegate(markLengthMove);
                pl.EditMark1DragOverCallback += new EditMarkDelegate(markOver);
                pl.EditMark2DragInCallback   += new EditMarkDelegate(mark2LengthMove);
                pl.EditMark2DragOverCallback += new EditMarkDelegate(mark2LengthOver);
                pl.EnableEdit = false;
                measureGraphic.Add(pl);
                break;

            case DrawingType.Polygon:
                IMSPolygon p2 = new IMSPolygon(CoordinateType.Logic)
                {
                    EnableEdit = true
                };
                this.m_graphicsLayer.AddGraphics(p2);
                for (int i = 0; i < logPntArr.Count; i++)
                {
                    p2.Points.Add(logPntArr[i]);
                }
                p2.Draw();
                p2.EditMark1DragInCallback   += new EditMarkDelegate(markAreaMove);
                p2.EditMark1DragOverCallback += new EditMarkDelegate(markOver);
                p2.EnableEdit = false;
                measureGraphic.Add(p2);
                break;
            }
            //   if (this.measureMark != null)
            //   {
            //   (this.measureMark.MarkControl as Label).Content = "";
            //    (this.measureMark.MarkControl as Label).Visibility = System.Windows.Visibility.Collapsed;
            //   }
            //    if (this.measurePnts != null)
            //     {
            //        for (int i = 0; i < this.measurePnts.Count; i++)
            //        {
            //            this.m_graphicsLayer.RemoveGraphics(this.measurePnts[i]);
            //       }
            //   }
            this.m_mapContainer.MouseMove -= new MouseEventHandler(m_graphicsLayer_MouseMove);
        }