示例#1
0
        public Triangle(Coordinate p0, Coordinate p1,
                        Coordinate p2, GeometryFactory factory) : base(factory)
        {
            if (p0 == null)
            {
                throw new ArgumentNullException("p0");
            }
            if (p1 == null)
            {
                throw new ArgumentNullException("p1");
            }
            if (p2 == null)
            {
                throw new ArgumentNullException("p2");
            }

            m_objPoint1 = p0;
            m_objPoint2 = p1;
            m_objPoint3 = p2;

            m_objCoordinates = new CoordinateCollection();
            m_objCoordinates.Add(p0);
            m_objCoordinates.Add(p1);
            m_objCoordinates.Add(p2);
        }
示例#2
0
        public Rectangle(Envelope envelope) : base(null)
        {
            m_objCoordinates = new CoordinateCollection();

            if (envelope != null)
            {
                m_objCoordinates.Add(envelope.Min);
                m_objCoordinates.Add(envelope.Max);
            }
            else
            {
                throw new GeometryException("The envelope cannot be null.");
            }
        }
示例#3
0
        public Rectangle(Coordinate minPoint, Coordinate maxPoint)
            : base(null)
        {
            m_objCoordinates = new CoordinateCollection();

            if (minPoint != null && maxPoint != null)
            {
                m_objCoordinates.Add(minPoint);
                m_objCoordinates.Add(maxPoint);
            }
            else
            {
                throw new GeometryException("The coordinate list cannot be null.");
            }
        }
示例#4
0
        /// <param name="coordinates">
        /// Contains the single coordinate on which to base this Point
        /// , or null to create the empty geometry.
        /// </param>
        public Point(Coordinate coordinate, GeometryFactory factory)
            : base(factory)
        {
            coordinates = new CoordinateCollection();

            coordinates.Add(coordinate);
        }
示例#5
0
        private void Normalize(LinearRing ring, bool clockwise)
        {
            if (ring.IsEmpty)
            {
                return;
            }

            CoordinateCollection uniqueCoordinates = new CoordinateCollection();

            for (int i = 0; i < ring.NumPoints - 1; i++)
            {
                uniqueCoordinates.Add(ring.GetCoordinate(i));           // copy all but last one into uniquecoordinates
            }

            Coordinate minCoordinate = CoordinateCollection.MinimumCoordinate(ring.Coordinates);

            uniqueCoordinates.Scroll(minCoordinate);

            ICoordinateList ringCoordinates = ring.Coordinates;

            ringCoordinates.Clear();
            ringCoordinates.AddRange(uniqueCoordinates);
            ringCoordinates.Add(uniqueCoordinates[0].Clone());          // add back in the closing point.

            if (CGAlgorithms.IsCCW(ringCoordinates) == clockwise)
            {
                ringCoordinates.Reverse();
            }
        }
示例#6
0
 private static void AddEdge(ICoordinateList coords, bool isForward,
                             ICoordinateList coordList)
 {
     if (isForward)
     {
         for (int i = 0; i < coords.Count; i++)
         {
             coordList.Add(coords[i], false);
         }
     }
     else
     {
         for (int i = coords.Count - 1; i >= 0; i--)
         {
             coordList.Add(coords[i], false);
         }
     }
 }
示例#7
0
        public RoundedRectangle(Envelope envelope, double cornerRadius) : base(null)
        {
            if (cornerRadius < 0)
            {
                throw new ArgumentException("The corner radius cannot be negative.");
            }

            m_objCoordinates = new CoordinateCollection();
            m_dCornerRadius  = cornerRadius;

            if (envelope != null)
            {
                m_objCoordinates.Add(envelope.Min);
                m_objCoordinates.Add(envelope.Max);
            }
            else
            {
                throw new GeometryException("The envelope cannot be null.");
            }
        }
        private void AddPoint(Coordinate pt)
        {
            Coordinate bufPt = new Coordinate(pt);

            bufPt.MakePrecise(precisionModel);
            // don't Add duplicate points
            Coordinate lastPt = null;

            if (ptList.Count >= 1)
            {
                lastPt = ptList[ptList.Count - 1];
            }

            if (lastPt != null && bufPt.Equals(lastPt))
            {
                return;
            }

            ptList.Add(bufPt);
        }
示例#9
0
        public RoundedRectangle(Coordinate minPoint, Coordinate maxPoint,
                                double cornerRadius, GeometryFactory factory) : base(factory)
        {
            if (cornerRadius < 0)
            {
                throw new ArgumentException("The corner radius cannot be negative.");
            }

            m_objCoordinates = new CoordinateCollection();
            m_dCornerRadius  = cornerRadius;

            if (minPoint != null && maxPoint != null)
            {
                m_objCoordinates.Add(minPoint);
                m_objCoordinates.Add(maxPoint);
            }
            else
            {
                throw new GeometryException("The coordinate list cannot be null.");
            }
        }
        public void Visit(Geometry geometry)
        {
            if (geometry == null)
            {
                throw new ArgumentNullException("geometry");
            }

            GeometryType geomType = geometry.GeometryType;

            if (geomType == GeometryType.Point ||
                geomType == GeometryType.LineString ||
                geomType == GeometryType.LinearRing ||
                geomType == GeometryType.Polygon)
            {
                pts.Add(geometry.Coordinate);
            }
        }