本文整理了Java中com.vividsolutions.jts.triangulate.quadedge.Vertex.getCoordinate()
方法的一些代码示例,展示了Vertex.getCoordinate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vertex.getCoordinate()
方法的具体详情如下:
包路径:com.vividsolutions.jts.triangulate.quadedge.Vertex
类名称:Vertex
方法名:getCoordinate
暂无
代码示例来源:origin: opentripplanner/OpenTripPlanner
this.coordinates.put(v.getCoordinate(), iV);
this.vertices.put(iV, new Vertex(iV, v.getCoordinate()));
iV++;
代码示例来源:origin: com.vividsolutions/jts
/**
* Tests whether the point pt is contained in the triangle defined by 3
* {@link Vertex}es.
*
* @param tri
* an array containing at least 3 Vertexes
* @param pt
* the point to test
* @return true if the point is contained in the triangle
*/
public static boolean contains(Vertex[] tri, Coordinate pt) {
Coordinate[] ring = new Coordinate[] { tri[0].getCoordinate(),
tri[1].getCoordinate(), tri[2].getCoordinate(), tri[0].getCoordinate() };
return CGAlgorithms.isPointInRing(pt, ring);
}
代码示例来源:origin: com.vividsolutions/jts
public static Geometry toPolygon(Vertex[] v) {
Coordinate[] ringPts = new Coordinate[] { v[0].getCoordinate(),
v[1].getCoordinate(), v[2].getCoordinate(), v[0].getCoordinate() };
GeometryFactory fact = new GeometryFactory();
LinearRing ring = fact.createLinearRing(ringPts);
Polygon tri = fact.createPolygon(ring, null);
return tri;
}
代码示例来源:origin: com.vividsolutions/jts
private Coordinate[] getPointArray() {
Coordinate[] pts = new Coordinate[initialVertices.size()
+ segVertices.size()];
int index = 0;
for (Iterator i = initialVertices.iterator(); i.hasNext();) {
Vertex v = (Vertex) i.next();
pts[index++] = v.getCoordinate();
}
for (Iterator i2 = segVertices.iterator(); i2.hasNext();) {
Vertex v = (Vertex) i2.next();
pts[index++] = v.getCoordinate();
}
return pts;
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Converts this edge to a WKT two-point <tt>LINESTRING</tt> indicating
* the geometry of this edge.
*
* @return a String representing this edge's geometry
*/
public String toString() {
Coordinate p0 = vertex.getCoordinate();
Coordinate p1 = dest().getCoordinate();
return WKTWriter.toLineString(p0, p1);
}
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Creates a {@link LineSegment} representing the
* geometry of this edge.
*
* @return a LineSegment
*/
public LineSegment toLineSegment()
{
return new LineSegment(vertex.getCoordinate(), dest().getCoordinate());
}
代码示例来源:origin: com.vividsolutions/jts
public Coordinate[] getCoordinates() {
Coordinate[] pts = new Coordinate[4];
for (int i = 0; i < 3; i++) {
pts[i] = edge[i].orig().getCoordinate();
}
pts[3] = new Coordinate(pts[0]);
return pts;
}
代码示例来源:origin: com.vividsolutions/jts
public void getEdgeSegment(int i, LineSegment seg) {
seg.p0 = edge[i].orig().getCoordinate();
int nexti = (i + 1) % 3;
seg.p1 = edge[nexti].orig().getCoordinate();
}
代码示例来源:origin: com.vividsolutions/jts
public boolean equals(Vertex _x, double tolerance) {
if (p.distance(_x.getCoordinate()) < tolerance) {
return true;
} else {
return false;
}
}
代码示例来源:origin: com.vividsolutions/jts
public Coordinate getCoordinate(int i) {
return edge[i].orig().getCoordinate();
}
代码示例来源:origin: com.vividsolutions/jts
private static Envelope computeVertexEnvelope(Collection vertices) {
Envelope env = new Envelope();
for (Iterator i = vertices.iterator(); i.hasNext();) {
Vertex v = (Vertex) i.next();
env.expandToInclude(v.getCoordinate());
}
return env;
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Gets the length of the geometry of this quadedge.
*
* @return the length of the quadedge
*/
public double getLength() {
return orig().getCoordinate().distance(dest().getCoordinate());
}
代码示例来源:origin: com.vividsolutions/jts
public static Geometry toPolygon(QuadEdge[] e) {
Coordinate[] ringPts = new Coordinate[] { e[0].orig().getCoordinate(),
e[1].orig().getCoordinate(), e[2].orig().getCoordinate(),
e[0].orig().getCoordinate() };
GeometryFactory fact = new GeometryFactory();
LinearRing ring = fact.createLinearRing(ringPts);
Polygon tri = fact.createPolygon(ring, null);
return tri;
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Tests whether the point pt is contained in the triangle defined by 3
* {@link QuadEdge}es.
*
* @param tri
* an array containing at least 3 QuadEdges
* @param pt
* the point to test
* @return true if the point is contained in the triangle
*/
public static boolean contains(QuadEdge[] tri, Coordinate pt) {
Coordinate[] ring = new Coordinate[] { tri[0].orig().getCoordinate(),
tri[1].orig().getCoordinate(), tri[2].orig().getCoordinate(),
tri[0].orig().getCoordinate() };
return CGAlgorithms.isPointInRing(pt, ring);
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Tests if this quadedge and another have the same line segment geometry
* with the same orientation.
*
* @param qe a quadege
* @return true if the quadedges are based on the same line segment
*/
public boolean equalsOriented(QuadEdge qe) {
if (orig().getCoordinate().equals2D(qe.orig().getCoordinate())
&& dest().getCoordinate().equals2D(qe.dest().getCoordinate()))
return true;
return false;
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Gets the geometry for the edges in the subdivision as a {@link MultiLineString}
* containing 2-point lines.
*
* @param geomFact the GeometryFactory to use
* @return a MultiLineString
*/
public Geometry getEdges(GeometryFactory geomFact) {
List quadEdges = getPrimaryEdges(false);
LineString[] edges = new LineString[quadEdges.size()];
int i = 0;
for (Iterator it = quadEdges.iterator(); it.hasNext();) {
QuadEdge qe = (QuadEdge) it.next();
edges[i++] = geomFact.createLineString(new Coordinate[] {
qe.orig().getCoordinate(), qe.dest().getCoordinate() });
}
return geomFact.createMultiLineString(edges);
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Tests whether a {@link Coordinate} lies on a {@link QuadEdge}, up to a
* tolerance determined by the subdivision tolerance.
*
* @param e
* a QuadEdge
* @param p
* a point
* @return true if the vertex lies on the edge
*/
public boolean isOnEdge(QuadEdge e, Coordinate p) {
seg.setCoordinates(e.orig().getCoordinate(), e.dest().getCoordinate());
double dist = seg.distance(p);
// heuristic (hack?)
return dist < edgeCoincidenceTolerance;
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Gets the primary edge of this quadedge and its <tt>sym</tt>.
* The primary edge is the one for which the origin
* and destination coordinates are ordered
* according to the standard {@link Coordinate} ordering
*
* @return the primary quadedge
*/
public QuadEdge getPrimary()
{
if (orig().getCoordinate().compareTo(dest().getCoordinate()) <= 0)
return this;
else
return sym();
}
代码示例来源:origin: com.vividsolutions/jts
public void visit(QuadEdge[] triEdges)
{
Coordinate a = triEdges[0].orig().getCoordinate();
Coordinate b = triEdges[1].orig().getCoordinate();
Coordinate c = triEdges[2].orig().getCoordinate();
// TODO: choose the most accurate circumcentre based on the edges
Coordinate cc = Triangle.circumcentre(a, b, c);
Vertex ccVertex = new Vertex(cc);
// save the circumcentre as the origin for the dual edges originating in this triangle
for (int i = 0; i < 3; i++) {
triEdges[i].rot().setOrig(ccVertex);
}
}
}
代码示例来源:origin: com.vividsolutions/jts
public void visit(QuadEdge[] triEdges) {
coordList.clear();
for (int i = 0; i < 3; i++) {
Vertex v = triEdges[i].orig();
coordList.add(v.getCoordinate());
}
if (coordList.size() > 0) {
coordList.closeRing();
Coordinate[] pts = coordList.toCoordinateArray();
if (pts.length != 4) {
//checkTriangleSize(pts);
return;
}
triCoords.add(pts);
}
}
内容来源于网络,如有侵权,请联系作者删除!