Example #1
0
 public TopoPolyline()
 {
     this.ArcID  = _ArcID++;
     MiddlePoint = new List <TopoPoint>();
     Innerid     = this.ArcID;
     MBR         = new MinBoundRect();
 }
Example #2
0
 public TopoPolyline(ContourPolyline polyline)
 {
     this.ArcID  = polyline.PID;
     Innerid     = _ArcID++;
     MiddlePoint = new List <TopoPoint>();
     MBR         = new MinBoundRect();
     if (polyline.PointList.Count >= 2)
     {
         TopoPoint startPoint = new TopoPoint(polyline.PointList.First(), true);
         startPoint.TopologyArcs.Add(this);
         this.BeginNode = startPoint;
         TopoPoint endPoint = new TopoPoint(polyline.PointList.Last(), true);
         endPoint.TopologyArcs.Add(this);
         this.EndNode = endPoint;
         MBR.UpdateRect(startPoint.X, startPoint.Y);
         MBR.UpdateRect(endPoint.X, endPoint.Y);
         for (int i = 1; i < polyline.PointList.Count - 1; i++)
         {
             if (polyline.PointList[i].OID != startPoint.PointID &&
                 polyline.PointList[i].OID != EndNode.PointID)
             {
                 TopoPoint midPoint = new TopoPoint(polyline.PointList[i], false);
                 MiddlePoint.Add(midPoint);
                 midPoint.TopologyArcs.Add(this);
             }
             MBR.UpdateRect(polyline.PointList[i].X, polyline.PointList[i].Y);
         }
     }
 }
Example #3
0
 public void UpdateRect(MinBoundRect mbr)
 {
     this.MinX = Math.Min(this.MinX, mbr.MinX);
     this.MinY = Math.Min(this.MinY, mbr.MinY);
     this.MaxX = Math.Max(this.MaxX, mbr.MaxX);
     this.MaxY = Math.Max(this.MaxY, mbr.MaxY);
     return;
 }
Example #4
0
 public TopoPolygon()
 {
     this.PID      = _polygonID++;
     OuterPolygon  = null;
     TopologyArcs  = new List <TopoPolyline>();
     InnerPolygons = new List <TopoPolygon>();
     MBR           = new MinBoundRect();
     innerId       = this.PID;
 }
Example #5
0
 public PointSet(string setname, string filename, DataPoint[] points)
 {
     this.SetName   = setname;
     this.FileName  = filename;
     this.PointList = new List <DataPoint>(points);
     //最小外接矩形
     MBR = new MinBoundRect();
     foreach (DataPoint point in points)
     {
         MBR.UpdateRect(point.X, point.Y);
     }
 }
Example #6
0
        public TopoPolyline(Edge edge)
        {
            this.ArcID  = edge.EID;
            MiddlePoint = new List <TopoPoint>();
            MBR         = new MinBoundRect();
            TopoPoint startPoint = new TopoPoint(edge.StartPoint, true);

            startPoint.TopologyArcs.Add(this);
            this.BeginNode = startPoint;
            TopoPoint endPoint = new TopoPoint(edge.EndPoint, true);

            endPoint.TopologyArcs.Add(this);
            this.EndNode = endPoint;
            MBR.UpdateRect(startPoint.X, startPoint.Y);
            MBR.UpdateRect(endPoint.X, endPoint.Y);
        }
Example #7
0
        public TopoPolygon(TopoPolyline[] lines)
        {
            OuterPolygon  = null;
            MBR           = new MinBoundRect();
            TopologyArcs  = new List <TopoPolyline>();
            InnerPolygons = new List <TopoPolygon>();
            this.TopologyArcs.AddRange(lines);
            List <int> ArcIDList = new List <int>();

            foreach (var arc in lines)
            {
                ArcIDList.Add(arc.ArcID); MBR.UpdateRect(arc.MBR);
            }
            ArcIDList.Sort();
            int hasgCode = 1;

            foreach (var arcid in ArcIDList)
            {
                hasgCode *= arcid;
            }
            this.PID = hasgCode.GetHashCode();
            innerId  = _polygonID++;
        }
Example #8
0
 public PointSet()
 {
     MBR = new MinBoundRect(-1, -1, 1, 1); PointList = new List <DataPoint>();
 }