Exemplo n.º 1
0
        /// <summary>
        /// Computes the buffer of a point for a given buffer distance.
        /// </summary>
        /// <param name="g">The point to buffer.</param>
        /// <param name="distance">The buffer distance.</param>
        /// <returns> The buffer of the input point.</returns>
        public static IGeometry Buffer(IGeometry g, double distance)
        {
            BufferOp  gBuf    = new BufferOp(g);
            IGeometry geomBuf = gBuf.GetResultGeometry(distance);

            return(geomBuf);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Computes the buffer of a point for a given buffer distance,
 /// using the given Cap Style for borders of the point.
 /// </summary>
 /// <param name="g">The point to buffer.</param>
 /// <param name="distance">The buffer distance.</param>        
 /// <param name="endCapStyle">Cap Style to use for compute buffer.</param>
 /// <returns> The buffer of the input point.</returns>
 public static IGeometry Buffer(IGeometry g, double distance, BufferStyle endCapStyle)
 {
     BufferOp gBuf = new BufferOp(g);
     gBuf.EndCapStyle = endCapStyle;
     IGeometry geomBuf = gBuf.GetResultGeometry(distance);
     return geomBuf;
 }
Exemplo n.º 3
0
        public void BufferAroundLine()
        {
            var form = new Form {BackColor = Color.White, Size = new Size(500, 200)};

            form.Paint += delegate
                              {

                                  Graphics g = form.CreateGraphics();

                                  List<ICoordinate> vertices = new List<ICoordinate>();

                                  vertices.Add(new Coordinate(0, 4));
                                  vertices.Add(new Coordinate(40, 15));
                                  vertices.Add(new Coordinate(50, 50));
                                  vertices.Add(new Coordinate(100, 62));
                                  vertices.Add(new Coordinate(240, 45));
                                  vertices.Add(new Coordinate(350, 5));

                                  IGeometry geometry = new LineString(vertices.ToArray());

                                  g.DrawLines(new Pen(Color.Blue, 1), GetPoints(geometry));

                                  BufferOp bufferOp = new BufferOp(geometry);
                                  bufferOp.EndCapStyle = BufferStyle.CapButt;
                                  bufferOp.QuadrantSegments = 0;

                                  IGeometry bufGeo = bufferOp.GetResultGeometry(5);

                                  bufGeo = bufGeo.Union(geometry);
                                  g.FillPolygon(new SolidBrush(Color.Pink), GetPoints(bufGeo));
                              };

            WindowsFormsTestHelper.ShowModal(form);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Computes the buffer of a point for a given buffer distance,
        /// using the given Cap Style for borders of the point.
        /// </summary>
        /// <param name="g">The point to buffer.</param>
        /// <param name="distance">The buffer distance.</param>
        /// <param name="endCapStyle">Cap Style to use for compute buffer.</param>
        /// <returns> The buffer of the input point.</returns>
        public static IGeometry Buffer(IGeometry g, double distance, BufferStyle endCapStyle)
        {
            BufferOp gBuf = new BufferOp(g);

            gBuf.EndCapStyle = endCapStyle;
            IGeometry geomBuf = gBuf.GetResultGeometry(distance);

            return(geomBuf);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Computes the buffer for a point for a given buffer distance
        /// and accuracy of approximation.
        /// </summary>
        /// <param name="g">The point to buffer.</param>
        /// <param name="distance">The buffer distance.</param>
        /// <param name="quadrantSegments">The number of segments used to approximate a quarter circle.</param>
        /// <returns>The buffer of the input point.</returns>
        public static IGeometry Buffer(IGeometry g, double distance, int quadrantSegments)
        {
            BufferOp bufOp = new BufferOp(g);

            bufOp.QuadrantSegments = quadrantSegments;
            IGeometry geomBuf = bufOp.GetResultGeometry(distance);

            return(geomBuf);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Computes the buffer for a point for a given buffer distance
        /// and accuracy of approximation.
        /// </summary>
        /// <param name="g">The point to buffer.</param>
        /// <param name="distance">The buffer distance.</param>
        /// <param name="quadrantSegments">The number of segments used to approximate a quarter circle.</param>
        /// <param name="endCapStyle">Cap Style to use for compute buffer.</param>
        /// <returns>The buffer of the input point.</returns>
        public static IGeometry Buffer(IGeometry g, double distance, int quadrantSegments, BufferStyle endCapStyle)
        {
            var bufOp = new BufferOp(g)
            {
                EndCapStyle = endCapStyle, QuadrantSegments = quadrantSegments
            };
            var geomBuf = bufOp.GetResultGeometry(distance);

            return(geomBuf);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Computes the buffer for a point for a given buffer distance
 /// and accuracy of approximation.
 /// </summary>
 /// <param name="g">The point to buffer.</param>
 /// <param name="distance">The buffer distance.</param>
 /// <param name="quadrantSegments">The number of segments used to approximate a quarter circle.</param>
 /// <returns>The buffer of the input point.</returns>
 public static IGeometry Buffer(IGeometry g, double distance, int quadrantSegments)
 {
     var bufOp = new BufferOp(g) {QuadrantSegments = quadrantSegments};
     var geomBuf = bufOp.GetResultGeometry(distance);
     return geomBuf;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Computes the buffer of a point for a given buffer distance.
 /// </summary>
 /// <param name="g">The point to buffer.</param>
 /// <param name="distance">The buffer distance.</param>
 /// <returns> The buffer of the input point.</returns>
 public static IGeometry Buffer(IGeometry g, double distance) 
 {
     var gBuf = new BufferOp(g);
     var geomBuf = gBuf.GetResultGeometry(distance);        
     return geomBuf;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Computes the buffer for a point for a given buffer distance
 /// and accuracy of approximation.
 /// </summary>
 /// <param name="g">The point to buffer.</param>
 /// <param name="distance">The buffer distance.</param>
 /// <param name="quadrantSegments">The number of segments used to approximate a quarter circle.</param>
 /// <param name="endCapStyle">Cap Style to use for compute buffer.</param>
 /// <returns>The buffer of the input point.</returns>
 public static IGeometry Buffer(IGeometry g, double distance, int quadrantSegments, BufferStyle endCapStyle)
 {
     BufferOp bufOp = new BufferOp(g);
     bufOp.EndCapStyle = endCapStyle;
     bufOp.QuadrantSegments = quadrantSegments;
     IGeometry geomBuf = bufOp.GetResultGeometry(distance);
     return geomBuf;
 }