当前位置: 首页>>代码示例>>Java>>正文


Java CoordinateList.toCoordinateArray方法代码示例

本文整理汇总了Java中com.vividsolutions.jts.geom.CoordinateList.toCoordinateArray方法的典型用法代码示例。如果您正苦于以下问题:Java CoordinateList.toCoordinateArray方法的具体用法?Java CoordinateList.toCoordinateArray怎么用?Java CoordinateList.toCoordinateArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vividsolutions.jts.geom.CoordinateList的用法示例。


在下文中一共展示了CoordinateList.toCoordinateArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCoordinates

import com.vividsolutions.jts.geom.CoordinateList; //导入方法依赖的package包/类
private Coordinate[] getCoordinates() {
    if (this.coordinates == null) {
        int forwardDirectedEdges = 0;
        int reverseDirectedEdges = 0;
        CoordinateList coordinateList = new CoordinateList();
        for (Object directedEdge1 : directedEdges) {
            LineMergeDirectedEdge directedEdge = (LineMergeDirectedEdge) directedEdge1;
            if (directedEdge.getEdgeDirection()) {
                forwardDirectedEdges++;
            } else {
                reverseDirectedEdges++;
            }
            coordinateList.add(((LineMergeEdge) directedEdge.getEdge()).getLine()
                            .getCoordinates(), false,
                    directedEdge.getEdgeDirection());
        }
        this.coordinates = coordinateList.toCoordinateArray();
        if (reverseDirectedEdges > forwardDirectedEdges) {
            CoordinateArrays.reverse(this.coordinates);
        }
    }

    return this.coordinates;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:25,代码来源:EdgeString.java

示例2: densifyPoints

import com.vividsolutions.jts.geom.CoordinateList; //导入方法依赖的package包/类
/**
 * Densifies a coordinate sequence.
 *
 * @param pts
 * @param distanceTolerance
 * @return the densified coordinate sequence
 */
private static Coordinate[] densifyPoints(Coordinate[] pts,
                                          double distanceTolerance, PrecisionModel precModel) {
    LineSegment seg = new LineSegment();
    CoordinateList coordList = new CoordinateList();
    for (int i = 0; i < pts.length - 1; i++) {
        seg.p0 = pts[i];
        seg.p1 = pts[i + 1];
        coordList.add(seg.p0, false);
        double len = seg.getLength();
        int densifiedSegCount = (int) (len / distanceTolerance) + 1;
        if (densifiedSegCount > 1) {
            double densifiedSegLen = len / densifiedSegCount;
            for (int j = 1; j < densifiedSegCount; j++) {
                double segFract = (j * densifiedSegLen) / len;
                Coordinate p = seg.pointAlong(segFract);
                precModel.makePrecise(p);
                coordList.add(p, false);
            }
        }
    }
    coordList.add(pts[pts.length - 1], false);
    return coordList.toCoordinateArray();
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:31,代码来源:Densifier.java

示例3: getCoordinates

import com.vividsolutions.jts.geom.CoordinateList; //导入方法依赖的package包/类
private Coordinate[] getCoordinates() {
  if (coordinates == null) {
    int forwardDirectedEdges = 0;
    int reverseDirectedEdges = 0;
    CoordinateList coordinateList = new CoordinateList();
    for (Iterator i = directedEdges.iterator(); i.hasNext();) {
      LineMergeDirectedEdge directedEdge = (LineMergeDirectedEdge) i.next();
      if (directedEdge.getEdgeDirection()) {
        forwardDirectedEdges++;
      }
      else {
        reverseDirectedEdges++;
      }
      coordinateList.add(((LineMergeEdge) directedEdge.getEdge()).getLine()
                          .getCoordinates(), false,
        directedEdge.getEdgeDirection());
    }
    coordinates = coordinateList.toCoordinateArray();
    if (reverseDirectedEdges > forwardDirectedEdges) {
      CoordinateArrays.reverse(coordinates);
    }
  }

  return coordinates;
}
 
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:26,代码来源:EdgeString.java

示例4: densify

import com.vividsolutions.jts.geom.CoordinateList; //导入方法依赖的package包/类
public Geometry densify(double maxSegLenDeg)
{
  double maxSegLenRad = MathFunction.toRadians(maxSegLenDeg);
  
  Coordinate p0 = line.getCoordinates()[0];
  Coordinate p1 = line.getCoordinates()[1];
  
  CoordinateList coords = new CoordinateList();
  
  Coordinate dc1 = GeodeticCoord.toCartesian(p1);
  //coords.add(dc0);
  densify(GeodeticCoord.toCartesian(p0), GeodeticCoord.toCartesian(p1), maxSegLenRad, coords);
  coords.add(dc1);
  
  // convert back to geo
  Coordinate[] dcPts = coords.toCoordinateArray();
  for (int i = 0; i < dcPts.length; i++) {
    dcPts[i] = GeodeticCoord.toGeodetic(dcPts[i]);
  }
  return line.getFactory().createLineString(dcPts);
}
 
开发者ID:dr-jts,项目名称:jeql,代码行数:22,代码来源:GeodeticDensifier.java

示例5: parseCoordinates

import com.vividsolutions.jts.geom.CoordinateList; //导入方法依赖的package包/类
private Coordinate[] parseCoordinates(String coordStr, boolean closeRing) {
  StreamTokenizer st = new StreamTokenizer(new StringReader(coordStr));
  st.parseNumbers();

  CoordinateList coordinates = new CoordinateList();
  try {
    coordinates.add(parseCoordinate(st));
    while (hasMoreTokens(st)) {
      coordinates.add(parseCoordinate(st));
    }
  } catch (IOException ex) {
    // should never happen - throw illegal state exception
    throw new IllegalStateException(
        "IOException during coordinate string parsing");
  }
  // close ring if required
  if (closeRing) 
    coordinates.closeRing();
  
  return coordinates.toCoordinateArray();
  /*
   * System.out.println(coordStr); // TODO: parse it! return new Coordinate[] {
   * new Coordinate(),new Coordinate(),new Coordinate(),new Coordinate() };
   */
}
 
开发者ID:dr-jts,项目名称:jeql,代码行数:26,代码来源:PlacemarkParser.java

示例6: getCoordinates

import com.vividsolutions.jts.geom.CoordinateList; //导入方法依赖的package包/类
/**
 * Computes the list of coordinates which are contained in this ring.
 * The coordinatea are computed once only and cached.
 *
 * @return an array of the {@link Coordinate}s in this ring
 */
private Coordinate[] getCoordinates() {
    if (this.ringPts == null) {
        CoordinateList coordList = new CoordinateList();
        for (Object aDeList : deList) {
            DirectedEdge de = (DirectedEdge) aDeList;
            PolygonizeEdge edge = (PolygonizeEdge) de.getEdge();
            addEdge(edge.getLine().getCoordinates(), de.getEdgeDirection(), coordList);
        }
        this.ringPts = coordList.toCoordinateArray();
    }
    return this.ringPts;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:19,代码来源:EdgeRing.java

示例7: snapTo

import com.vividsolutions.jts.geom.CoordinateList; //导入方法依赖的package包/类
/**
 * Snaps the vertices and segments of the source LineString
 * to the given set of snap vertices.
 *
 * @param snapPts the vertices to snap to
 * @return a list of the snapped points
 */
public Coordinate[] snapTo(Coordinate[] snapPts) {
    CoordinateList coordList = new CoordinateList(this.srcPts);

    this.snapVertices(coordList, snapPts);
    this.snapSegments(coordList, snapPts);

    Coordinate[] newPts = coordList.toCoordinateArray();
    return newPts;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:17,代码来源:LineStringSnapper.java

示例8: collapseLine

import com.vividsolutions.jts.geom.CoordinateList; //导入方法依赖的package包/类
private Coordinate[] collapseLine() {
        CoordinateList coordList = new CoordinateList();
        for (int i = 0; i < this.inputLine.length; i++) {
            if (this.isDeleted[i] != DELETE) {
                coordList.add(this.inputLine[i]);
            }
        }
//    if (coordList.size() < inputLine.length)      System.out.println("Simplified " + (inputLine.length - coordList.size()) + " pts");
        return coordList.toCoordinateArray();
    }
 
开发者ID:gegy1000,项目名称:Earth,代码行数:11,代码来源:BufferInputLineSimplifier.java

示例9: simplify

import com.vividsolutions.jts.geom.CoordinateList; //导入方法依赖的package包/类
public Coordinate[] simplify() {
    this.usePt = new boolean[this.pts.length];
    for (int i = 0; i < this.pts.length; i++) {
        this.usePt[i] = true;
    }
    this.simplifySection(0, this.pts.length - 1);
    CoordinateList coordList = new CoordinateList();
    for (int i = 0; i < this.pts.length; i++) {
        if (this.usePt[i]) {
            coordList.add(new Coordinate(this.pts[i]));
        }
    }
    return coordList.toCoordinateArray();
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:15,代码来源:DouglasPeuckerLineSimplifier.java

示例10: getVoronoiCellPolygon

import com.vividsolutions.jts.geom.CoordinateList; //导入方法依赖的package包/类
/**
     * Gets the Voronoi cell around a site specified
     * by the origin of a QuadEdge.
     * <p>
     * The userData of the polygon is set to be the {@link Coordinate}
     * of the site.  This allows attaching external
     * data associated with the site to this cell polygon.
     *
     * @param qe a quadedge originating at the cell site
     * @param geomFact a factory for building the polygon
     * @return a polygon indicating the cell extent
     */
    public Polygon getVoronoiCellPolygon(QuadEdge qe, GeometryFactory geomFact) {
        List cellPts = new ArrayList();
        QuadEdge startQE = qe;
        do {
//    	Coordinate cc = circumcentre(qe);
            // use previously computed circumcentre
            Coordinate cc = qe.rot().orig().getCoordinate();
            cellPts.add(cc);

            // move to next triangle CW around vertex
            qe = qe.oPrev();
        } while (qe != startQE);

        CoordinateList coordList = new CoordinateList();
        coordList.addAll(cellPts, false);
        coordList.closeRing();

        if (coordList.size() < 4) {
            System.out.println(coordList);
            coordList.add(coordList.get(coordList.size() - 1), true);
        }

        Coordinate[] pts = coordList.toCoordinateArray();
        Polygon cellPoly = geomFact.createPolygon(geomFact.createLinearRing(pts), null);

        Vertex v = startQE.orig();
        cellPoly.setUserData(v.getCoordinate());
        return cellPoly;
    }
 
开发者ID:gegy1000,项目名称:Earth,代码行数:42,代码来源:QuadEdgeSubdivision.java

示例11: computeOctRing

import com.vividsolutions.jts.geom.CoordinateList; //导入方法依赖的package包/类
private Coordinate[] computeOctRing(Coordinate[] inputPts) {
    Coordinate[] octPts = this.computeOctPts(inputPts);
    CoordinateList coordList = new CoordinateList();
    coordList.add(octPts, false);

    // points must all lie in a line
    if (coordList.size() < 3) {
        return null;
    }
    coordList.closeRing();
    return coordList.toCoordinateArray();
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:13,代码来源:ConvexHull.java

示例12: snapTo

import com.vividsolutions.jts.geom.CoordinateList; //导入方法依赖的package包/类
/**
 * Snaps the vertices and segments of the source LineString
 * to the given set of snap vertices.
 *
 * @param snapPts the vertices to snap to
 * @return a list of the snapped points
 */
public Coordinate[] snapTo(Coordinate[] snapPts) {
    CoordinateList coordList = new CoordinateList(srcPts);

    snapVertices(coordList, snapPts);
    snapSegments(coordList, snapPts);

    Coordinate[] newPts = coordList.toCoordinateArray();
    return newPts;
}
 
开发者ID:Semantive,项目名称:jts,代码行数:17,代码来源:LineStringSnapper.java

示例13: collapseLine

import com.vividsolutions.jts.geom.CoordinateList; //导入方法依赖的package包/类
private Coordinate[] collapseLine() {
        CoordinateList coordList = new CoordinateList();
        for (int i = 0; i < inputLine.length; i++) {
            if (isDeleted[i] != DELETE)
                coordList.add(inputLine[i]);
        }
//    if (coordList.size() < inputLine.length)      System.out.println("Simplified " + (inputLine.length - coordList.size()) + " pts");
        return coordList.toCoordinateArray();
    }
 
开发者ID:Semantive,项目名称:jts,代码行数:10,代码来源:BufferInputLineSimplifier.java

示例14: simplify

import com.vividsolutions.jts.geom.CoordinateList; //导入方法依赖的package包/类
public Coordinate[] simplify() {
    usePt = new boolean[pts.length];
    for (int i = 0; i < pts.length; i++) {
        usePt[i] = true;
    }
    simplifySection(0, pts.length - 1);
    CoordinateList coordList = new CoordinateList();
    for (int i = 0; i < pts.length; i++) {
        if (usePt[i])
            coordList.add(new Coordinate(pts[i]));
    }
    return coordList.toCoordinateArray();
}
 
开发者ID:Semantive,项目名称:jts,代码行数:14,代码来源:DouglasPeuckerLineSimplifier.java

示例15: getCoordinates

import com.vividsolutions.jts.geom.CoordinateList; //导入方法依赖的package包/类
public Coordinate[] getCoordinates() {
    CoordinateList coords = new CoordinateList();
    VWLineSimplifier.VWVertex curr = this;
    do {
        coords.add(curr.pt, false);
        curr = curr.next;
    } while (curr != null);
    return coords.toCoordinateArray();
}
 
开发者ID:Semantive,项目名称:jts,代码行数:10,代码来源:VWLineSimplifier.java


注:本文中的com.vividsolutions.jts.geom.CoordinateList.toCoordinateArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。