Exemple #1
0
 /// <summary>
 /// 由于多边形创建要求环闭合,需要在调用构造函数前进行检查,故不具备用点数组作为集合的构造函数
 /// </summary>
 /// <param name="ring">单独外环</param>
 public MLPolygon(PolylineD ring)
 {
     featureType = FeatureType.POLYGON;
     mbr[0]      = mbr[1] = ring.GetPoint(0).X;
     mbr[2]      = mbr[3] = ring.GetPoint(0).Y;
     for (int i = 1; i < ring.Count; ++i)
     {
         if (ring.GetPoint(i).X < mbr[0])
         {
             mbr[0] = ring.GetPoint(i).X;
         }
         if (ring.GetPoint(i).X > mbr[1])
         {
             mbr[1] = ring.GetPoint(i).X;
         }
         if (ring.GetPoint(i).Y < mbr[2])
         {
             mbr[2] = ring.GetPoint(i).Y;
         }
         if (ring.GetPoint(i).Y > mbr[3])
         {
             mbr[3] = ring.GetPoint(i).Y;
         }
     }
     pointNum = ring.Count;
     polygon  = new PolygonD(new PolylineD[] { ring });
 }
Exemple #2
0
 public MLPolyline(PolylineD segment)
 {
     featureType = FeatureType.POLYLINE;
     mbr[0]      = mbr[1] = segment.GetPoint(0).X;
     mbr[2]      = mbr[3] = segment.GetPoint(0).Y;
     for (int i = 1; i < segment.Count; ++i)
     {
         if (segment.GetPoint(i).X < mbr[0])
         {
             mbr[0] = segment.GetPoint(i).X;
         }
         if (segment.GetPoint(i).X > mbr[1])
         {
             mbr[1] = segment.GetPoint(i).X;
         }
         if (segment.GetPoint(i).Y < mbr[2])
         {
             mbr[2] = segment.GetPoint(i).Y;
         }
         if (segment.GetPoint(i).Y > mbr[3])
         {
             mbr[3] = segment.GetPoint(i).Y;
         }
     }
     pointNum = segment.Count;
     segments = new PolylineD[] { segment };
 }