Exemple #1
0
 /// <summary>
 /// 添加区
 /// </summary>
 /// <param name="gLayer">GraphicsLayer图层对象</param>
 /// <param name="graphics">绘图对象</param>
 /// <param name="logPntArr">绘图保存的逻辑坐标数组</param>
 public void AddArea(GraphicsLayer gLayer, IGraphics graphics, List <Point> logPntArr)
 {
     if (ActiveMapDoc != null && logPntArr.Count > 0)
     {
         if (ActiveMapDoc.ActiveLayerIndex < 0)
         {
             MessageBox.Show("请激活文档的一个区图层", "提示", MessageBoxButton.OK);
             return;
         }
         SFclsGeomType type = ActiveMapDoc.ActiveLayerGeoType;
         if (!type.Equals(SFclsGeomType.Reg))
         {
             MessageBox.Show("当前图层不能添加该几何类型的要素", "提示", MessageBoxButton.OK);
             return;
         }
         ZDIMS.BaseLib.Polygon polygon = new ZDIMS.BaseLib.Polygon();
         polygon.Dots = new Dot_2D[logPntArr.Count];
         for (int i = 0; i < logPntArr.Count; i++)
         {
             polygon.Dots[i] = new Dot_2D()
             {
                 x = logPntArr[i].X,
                 y = logPntArr[i].Y
             };
         }
         m_targetGeo = polygon;
         GetActiveLayerAttStruct();
     }
 }
Exemple #2
0
 /// <summary>
 /// 添加线
 /// </summary>
 /// <param name="gLayer">GraphicsLayer图层对象</param>
 /// <param name="graphics">绘图对象</param>
 /// <param name="logPntArr">绘图保存的逻辑坐标数组</param>
 public void AddLine(GraphicsLayer gLayer, IGraphics graphics, List <Point> logPntArr)
 {
     if (ActiveMapDoc != null && logPntArr.Count > 0)
     {
         if (ActiveMapDoc.ActiveLayerIndex < 0)
         {
             MessageBox.Show("请激活文档的一个线图层", "提示", MessageBoxButton.OK);
             return;
         }
         SFclsGeomType type = ActiveMapDoc.ActiveLayerGeoType;
         if (!type.Equals(SFclsGeomType.Lin))
         {
             MessageBox.Show("当前图层不能添加该几何类型的要素", "提示", MessageBoxButton.OK);
             return;
         }
         AnyLine line = new AnyLine();
         line.Arcs = new Arc[1];
         Arc arc = new Arc();
         arc.Dots = new Dot_2D[logPntArr.Count];
         for (int i = 0; i < logPntArr.Count; i++)
         {
             arc.Dots[i] = new Dot_2D()
             {
                 x = logPntArr[i].X,
                 y = logPntArr[i].Y
             };
         }
         line.Arcs[0] = arc;
         m_targetGeo  = line;
         GetActiveLayerAttStruct();
     }
 }
Exemple #3
0
 /// <summary>
 /// 添加点
 /// </summary>
 /// <param name="gLayer">GraphicsLayer图层对象</param>
 /// <param name="graphics">绘图对象</param>
 /// <param name="logPntArr">绘图保存的逻辑坐标数组</param>
 public void AddDot(GraphicsLayer gLayer, IGraphics graphics, List <Point> logPntArr)
 {
     if (ActiveMapDoc != null && logPntArr.Count > 0)
     {
         if (ActiveMapDoc.ActiveLayerIndex < 0)
         {
             MessageBox.Show("请激活文档的一个点图层", "提示", MessageBoxButton.OK);
             return;
         }
         SFclsGeomType type = ActiveMapDoc.ActiveLayerGeoType;
         if (!type.Equals(SFclsGeomType.Pnt))
         {
             MessageBox.Show("当前图层不能添加该几何类型的要素", "提示", MessageBoxButton.OK);
             return;
         }
         m_targetGeo = new Dot_2D()
         {
             x = logPntArr[0].X,
             y = logPntArr[0].Y
         };
         GetActiveLayerAttStruct();
     }
 }