Examples of LineSegment


Examples of com.vividsolutions.jts.geom.LineSegment

     * @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

Examples of com.vividsolutions.jts.geom.LineSegment

     * @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

Examples of com.vividsolutions.jts.geom.LineSegment

    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

Examples of com.vividsolutions.jts.geom.LineSegment

                              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

Examples of com.vividsolutions.jts.geom.LineSegment

    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

Examples of com.vividsolutions.jts.geom.LineSegment

  }

  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

Examples of com.vividsolutions.jts.geom.LineSegment

     * 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

Examples of com.vividsolutions.jts.geom.LineSegment

        double x2 = midPoint.x + dx;
        double y2 = midPoint.y + dy;
        Coordinate p1 = new Coordinate(x1, y1);
        Coordinate p2 = new Coordinate(x2, y2);

        LineSegment normalSegment = new LineSegment(p1, p2);
        return normalSegment;
    }
View Full Code Here

Examples of com.vividsolutions.jts.geom.LineSegment

   *
   * @return the distance
   */
  private double calculateDistanceAndCurrentPostion() {

    LineSegment seg = new LineSegment();
    LineSegment closestSeg = new LineSegment();
    double distance, closestDistance = Double.MAX_VALUE;

    // get the closest segment.
    for (int i = 0; i < inputCoordinates.length - 1; i++) {
      seg.setCoordinates(inputCoordinates[i], inputCoordinates[i + 1]);
      distance = CGAlgorithms.distancePointLine(initialCoordinate, inputCoordinates[i], inputCoordinates[i + 1]);
      if (distance < closestDistance) {
        closestDistance = distance;
        closestSeg = new LineSegment(inputCoordinates[i], inputCoordinates[i + 1]);
      }
    }
    startPosition = Position.LEFT;
    int segmentOrientation = CGAlgorithms.computeOrientation(closestSeg.p0, closestSeg.p1, initialCoordinate);
    // offset position respect the first segment and the initial point.
View Full Code Here

Examples of com.vividsolutions.jts.geom.LineSegment

  /**
   * Add an end cap around point p1, terminating a line segment coming from p0
   */
  public void addLineEndCap(Coordinate p0, Coordinate p1)
  {
    LineSegment seg = new LineSegment(p0, p1);

    LineSegment offsetL = new LineSegment();
    computeOffsetSegment(seg, Position.LEFT, distance, offsetL);
    LineSegment offsetR = new LineSegment();
    computeOffsetSegment(seg, Position.RIGHT, distance, offsetR);

    double dx = p1.x - p0.x;
    double dy = p1.y - p0.y;
    double angle = Math.atan2(dy, dx);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.