Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.LineSegment


 
  /**
   * returns the closest distance between point p and line segment s
   */
  public static final double distanceFromLineSegment(VectorXZ p, LineSegmentXZ s) {
    LineSegment sJTS = new LineSegment(s.p1.x, s.p1.z, s.p2.x, s.p2.z);
    return sJTS.distance(new Coordinate(p.x, p.z));
  }
View Full Code Here


     * @param p0 the start point
     * @param p1 the end point
     * @param data an external data object
     */
    public Segment(Coordinate p0, Coordinate p1, Object data) {
        ls = new LineSegment(p0, p1);
        this.data = data;
    }
View Full Code Here

     *
     * @param p0 the start point
     * @param p1 the end point
     */
    public Segment(Coordinate p0, Coordinate p1) {
        ls = new LineSegment(p0, p1);
    }
View Full Code Here

     * @param seg the encroached segment
     * @param encroachPt the encroaching point
     * @return the point at which to split the encroached segment
     */
    public Coordinate findSplitPoint(Segment seg, Coordinate encroachPt) {
        LineSegment lineSeg = seg.getLineSegment();
        double segLen = lineSeg.getLength();
        double midPtLen = segLen / 2;
        SplitSegment splitSeg = new SplitSegment(lineSeg);

        Coordinate projPt = projectedSplitPoint(seg, encroachPt);
        /**
 
View Full Code Here

     * @param seg
     * @param encroachPt
     * @return
     */
    public static Coordinate projectedSplitPoint(Segment seg, Coordinate encroachPt) {
        LineSegment lineSeg = seg.getLineSegment();
        Coordinate projPt = lineSeg.project(encroachPt);
        return projPt;
    }
View Full Code Here

    public void run( IProgressMonitor monitor ) throws Exception {

        display.addMouseListener(mouseListener);

        LineSegment l = new LineSegment(start, end);
        start = l.pointAlong(0.1);
        end = l.pointAlong(0.9);
        l = new LineSegment(start, end);

        Coordinate tmp = l.pointAlong(0.9);
        double distance = end.distance(tmp);
        Coordinate left = l.pointAlongOffset(0.5, distance / 2);
        Coordinate right = l.pointAlongOffset(0.5, -distance / 2);

        validArea = new Rectangle((int) start.x, (int) start.y, (int) (start.x + (end.x - start.x)),
                (int) (start.y + (end.y - start.y)));

        graphics.setLineWidth(3);
View Full Code Here

                              int index) {

    List<DataSegmentIntersection> relationSegmIntersect = new ArrayList<DataSegmentIntersection>();

    Entry<LineSegment, LineSegment> item = iterator.next();
    LineSegment key = item.getKey();
    LineSegment value = item.getValue();

    SpecificLineBuilder lineBuilder = new SpecificLineBuilder();

    // mount the line that will intersect with the preBuild geometry.
    LineString subjectLine = lineBuilder.mountTheLine(key, value, gf);
View Full Code Here

    lastOffset.setCoordinates(offset0);
    lastCoord.setCoordinate(coord0);

    // create the key and value.
    // key
    LineSegment referencedFromList = new LineSegment();
    referencedFromList.setCoordinates(vertexList.getSecondToLastItem(), vertexList.getLastItem());
    // value
    LineSegment fromOffset = new LineSegment();
    fromOffset.setCoordinates(offset0);

    offsetList.put(referencedFromList, fromOffset);
    lastOutsideTurn = outsideTurn;
  }
View Full Code Here

  }

  private void addLastOffsetToList() {

    // key
    LineSegment derivatedFromList = new LineSegment();
    derivatedFromList.setCoordinates(vertexList.getSecondToLastItem(), vertexList.getLastItem());
    // value
    LineSegment referenceOffset = new LineSegment();
    referenceOffset.setCoordinates(offset0);

    offsetList.put(derivatedFromList, referenceOffset);
  }
View Full Code Here

     * to calculate the arc center by finding the intersection of their normals
     *
     * @return
     */
    public Coordinate getArcCenter() {
        LineSegment chord1 = new LineSegment(point1, point2);
        LineSegment chord2 = new LineSegment(point2, point3);

        final double normalLength = 1E7;
        LineSegment midPointNormal1 = getMidpointNormal(chord1, normalLength);
        LineSegment midPointNormal2 = getMidpointNormal(chord2, normalLength);

        Coordinate center = midPointNormal1.intersection(midPointNormal2);

        return center;
    }
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.LineSegment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.