本文整理了Java中org.locationtech.jts.geom.GeometryFactory.createMultiLineString()
方法的一些代码示例,展示了GeometryFactory.createMultiLineString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeometryFactory.createMultiLineString()
方法的具体详情如下:
包路径:org.locationtech.jts.geom.GeometryFactory
类名称:GeometryFactory
方法名:createMultiLineString
[英]Creates a MultiLineString using the given LineStrings; a null or empty array will create an empty MultiLineString.
[中]使用给定的线字符串创建多行线;空数组或空数组将创建空的多重字符串。
代码示例来源:origin: prestodb/presto
if (partCount == 0) {
if (multitype) {
return GEOMETRY_FACTORY.createMultiLineString();
return GEOMETRY_FACTORY.createMultiLineString(lineStrings);
代码示例来源:origin: geotools/geotools
/**
* Creates a MultiLineString from a set of LineStrings
*
* @param lines the component LineStrings
* @return a MultiLineString
*/
public MultiLineString multiLineString(LineString... lines) {
return geomFact.createMultiLineString(lines);
}
代码示例来源:origin: geotools/geotools
public MultiLineString toMultiLineString(List<?> list) {
List<LineString> lines = new ArrayList<LineString>();
for (Object o : list) {
lines.add(toLineString((List<?>) o));
}
return geometryFactory.createMultiLineString(lines.toArray(new LineString[lines.size()]));
}
代码示例来源:origin: geotools/geotools
/**
*
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated modifiable
*/
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
List lines = node.getChildValues(LineString.class);
return gFactory.createMultiLineString(
(LineString[]) lines.toArray(new LineString[lines.size()]));
}
代码示例来源:origin: geotools/geotools
/** Creates a multiline from the specified (<var>x</var>,<var>y</var>) coordinates. */
public MultiLineString lines(int[][] xy) {
LineString[] lines = new LineString[xy.length];
for (int i = 0; i < xy.length; i++) {
lines[i] = line(xy[i]);
}
return gf.createMultiLineString(lines);
}
代码示例来源:origin: geotools/geotools
@Override
protected Geometry getEmpty() {
if (EMPTY == null) {
EMPTY = new GeometryFactory().createMultiLineString(null);
}
return EMPTY;
}
代码示例来源:origin: geotools/geotools
@Override
public MultiLineString createMultiLineString(LineString[] lineStrings) {
if (lineStrings != null && lineStrings.length == 1) {
return new SingleLineCollection(lineStrings, this);
} else {
return super.createMultiLineString(lineStrings);
}
}
代码示例来源:origin: locationtech/spatial4j
@Override
public Shape build() {
return makeShape(geometryFactory.createMultiLineString(geoms.toArray(new LineString[geoms.size()])));
}
}
代码示例来源:origin: geotools/geotools
@Override
public boolean endObject() throws ParseException, IOException {
if (lines != null) {
LineString[] lineStrings = new LineString[lines.size()];
for (int i = 0; i < lines.size(); i++) {
lineStrings[i] = factory.createLineString(lines.get(i));
}
value = factory.createMultiLineString(lineStrings);
lines = null;
}
return true;
}
}
代码示例来源:origin: geotools/geotools
/**
* Generate a MultiLineString from two dimensional ordinates
*
* @param xy
* @return MultiLineStirng
*/
public MultiLineString lines(int[][] xy) {
LineString[] lines = new LineString[xy.length];
for (int i = 0; i < xy.length; i++) {
lines[i] = line(xy[i]);
}
return gf.createMultiLineString(lines);
}
/**
代码示例来源:origin: geotools/geotools
public MultiLineString createMultiLineString(LineString[] lineStrings) {
boolean curved = false;
for (LineString ls : lineStrings) {
if (ls instanceof CurvedGeometry<?>) {
curved = true;
break;
}
}
if (curved) {
return new MultiCurve(Arrays.asList(lineStrings), this, tolerance);
} else {
return delegate.createMultiLineString(lineStrings);
}
}
代码示例来源:origin: mapsforge/mapsforge
static MultiLineString buildMultiLineString(TDWay outerWay, List<TDWay> innerWays) {
List<LineString> lineStrings = new ArrayList<>();
// outer way geometry
lineStrings.add(buildLineString(outerWay));
// inner strings
if (innerWays != null) {
for (TDWay innerWay : innerWays) {
LineString innerRing = buildLineString(innerWay);
lineStrings.add(innerRing);
}
}
return GEOMETRY_FACTORY.createMultiLineString(lineStrings.toArray(new LineString[lineStrings.size()]));
}
代码示例来源:origin: geotools/geotools
/**
* Makes a {@link #MultiLineString} geometry using the {@link LineString} presents in the result
* stack.
*/
@Override
public Geometry build(int linestringtextNode) throws CQLException {
List<Geometry> lineList = popGeometry(linestringtextNode);
LineString[] lineStrings = lineList.toArray(new LineString[lineList.size()]);
MultiLineString multiLineString = getGeometryFactory().createMultiLineString(lineStrings);
return multiLineString;
}
}
代码示例来源:origin: geotools/geotools
private Geometry decodeMultiLinestring(int shapeIndex) {
Collection<Geometry> linestrings = new ArrayList<Geometry>();
for (int i = shapeIndex; i < binary.getShapes().length; i++) {
if (binary.getShape(i).getParentOffset() == shapeIndex) {
linestrings.add(
gf.createLineString(
binary.getSequence(binary.getShape(i).getFigureOffset())));
}
}
return gf.createMultiLineString(linestrings.toArray(new LineString[linestrings.size()]));
}
代码示例来源:origin: geotools/geotools
private MultiLineString readMultiLineString() throws IOException, ParseException {
int numGeom = dis.readInt();
LineString[] geoms = new LineString[numGeom];
for (int i = 0; i < numGeom; i++) {
Geometry g = readGeometry();
if (!(g instanceof LineString))
throw new ParseException(INVALID_GEOM_TYPE_MSG + "MultiLineString");
geoms[i] = (LineString) g;
}
return factory.createMultiLineString(geoms);
}
代码示例来源:origin: geotools/geotools
/** Creates a multiline from the specified (<var>x</var>,<var>y</var>) coordinates. */
public MultiLineString lines(int[][] xy) {
LineString[] lines = new LineString[xy.length];
for (int i = 0; i < xy.length; i++) {
lines[i] = line(xy[i]);
}
return gf.createMultiLineString(lines);
}
代码示例来源:origin: geotools/geotools
private static Geometry smoothMultiLineString(
GeometryFactory factory, GeometrySmoother smoother, Geometry geom, double fit) {
final int N = geom.getNumGeometries();
LineString[] smoothed = new LineString[N];
for (int i = 0; i < N; i++) {
smoothed[i] =
(LineString) smoothLineString(factory, smoother, geom.getGeometryN(i), fit);
}
return factory.createMultiLineString(smoothed);
}
代码示例来源:origin: geotools/geotools
private GeometryCollection wrap(Geometry geometry) {
if (geometry instanceof Point) {
return geometry.getFactory().createMultiPoint(new Point[] {(Point) geometry});
} else if (geometry instanceof LineString) {
return geometry.getFactory()
.createMultiLineString(new LineString[] {(LineString) geometry});
} else if (geometry instanceof Polygon) {
return geometry.getFactory().createMultiPolygon(new Polygon[] {(Polygon) geometry});
}
throw new IllegalArgumentException("Unable to create multi geometry from " + geometry);
}
}
代码示例来源:origin: geotools/geotools
public void testMixedEmptyMultiLine() throws SchemaException, IllegalAttributeException {
GeometryFactory gf = new GeometryFactory();
StyleBuilder sb = new StyleBuilder();
SimpleFeatureType pointType =
DataUtilities.createType("emptyRings", "geom:MultiLineString,name:String");
LineString emptyLine = gf.createLineString((Coordinate[]) null);
LineString realLine =
gf.createLineString(new Coordinate[] {new Coordinate(0, 0), new Coordinate(1, 1)});
MultiLineString mls = gf.createMultiLineString(new LineString[] {emptyLine, realLine});
SimpleFeature f = SimpleFeatureBuilder.build(pointType, new Object[] {mls, "name"}, null);
Style style = sb.createStyle(sb.createPolygonSymbolizer());
renderEmptyGeometry(f, style);
}
代码示例来源:origin: geotools/geotools
@Test
public void smoothMultiLineString() {
LineString[] lines = new LineString[3];
lines[0] = factory.createLineString(getLineCoords(0));
lines[1] = factory.createLineString(getLineCoords(10));
lines[2] = factory.createLineString(getLineCoords(20));
MultiLineString mls = factory.createMultiLineString(lines);
Geometry smoothed = JTS.smooth(mls, 0);
assertTrue(smoothed instanceof MultiLineString);
assertEquals(3, smoothed.getNumGeometries());
Envelope mlsEnv = mls.getEnvelopeInternal();
Envelope smoothEnv = smoothed.getEnvelopeInternal();
assertTrue(smoothEnv.covers(mlsEnv));
}
内容来源于网络,如有侵权,请联系作者删除!