本文整理匯總了Java中com.vividsolutions.jts.geom.LineString.isClosed方法的典型用法代碼示例。如果您正苦於以下問題:Java LineString.isClosed方法的具體用法?Java LineString.isClosed怎麽用?Java LineString.isClosed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vividsolutions.jts.geom.LineString
的用法示例。
在下文中一共展示了LineString.isClosed方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildSequencedGeometry
import com.vividsolutions.jts.geom.LineString; //導入方法依賴的package包/類
/**
* Builds a geometry ({@link LineString} or {@link MultiLineString} )
* representing the sequence.
*
* @param sequences a List of Lists of DirectedEdges with
* LineMergeEdges as their parent edges.
* @return the sequenced geometry, or <code>null</code> if no sequence exists
*/
private Geometry buildSequencedGeometry(List sequences) {
List lines = new ArrayList();
for (Object sequence : sequences) {
List seq = (List) sequence;
for (Object aSeq : seq) {
DirectedEdge de = (DirectedEdge) aSeq;
LineMergeEdge e = (LineMergeEdge) de.getEdge();
LineString line = e.getLine();
LineString lineToAdd = line;
if (!de.getEdgeDirection() && !line.isClosed()) {
lineToAdd = reverse(line);
}
lines.add(lineToAdd);
}
}
if (lines.size() == 0) {
return this.factory.createMultiLineString(new LineString[0]);
}
return this.factory.buildGeometry(lines);
}
示例2: boundaryLineString
import com.vividsolutions.jts.geom.LineString; //導入方法依賴的package包/類
private Geometry boundaryLineString(LineString line) {
if (this.geom.isEmpty()) {
return this.getEmptyMultiPoint();
}
if (line.isClosed()) {
// check whether endpoints of valence 2 are on the boundary or not
boolean closedEndpointOnBoundary = this.bnRule.isInBoundary(2);
if (closedEndpointOnBoundary) {
return line.getStartPoint();
} else {
return this.geomFact.createMultiPoint((Coordinate[]) null);
}
}
return this.geomFact.createMultiPoint(new Point[] {
line.getStartPoint(),
line.getEndPoint()
});
}
示例3: locate
import com.vividsolutions.jts.geom.LineString; //導入方法依賴的package包/類
private int locate(Coordinate p, LineString l) {
// bounding-box check
if (!l.getEnvelopeInternal().intersects(p)) {
return Location.EXTERIOR;
}
Coordinate[] pt = l.getCoordinates();
if (!l.isClosed()) {
if (p.equals(pt[0])
|| p.equals(pt[pt.length - 1])) {
return Location.BOUNDARY;
}
}
if (CGAlgorithms.isOnLine(p, pt)) {
return Location.INTERIOR;
}
return Location.EXTERIOR;
}
示例4: filter
import com.vividsolutions.jts.geom.LineString; //導入方法依賴的package包/類
/**
* Filters linear geometries.
* <p>
* geom a geometry of any type
*/
@Override
public void filter(Geometry geom) {
if (geom instanceof LineString) {
LineString line = (LineString) geom;
int minSize = line.isClosed() ? 4 : 2;
TaggedLineString taggedLine = new TaggedLineString(line, minSize);
TopologyPreservingSimplifier.this.linestringMap.put(line, taggedLine);
}
}