本文整理匯總了Java中com.vividsolutions.jts.geom.GeometryFactory.buildGeometry方法的典型用法代碼示例。如果您正苦於以下問題:Java GeometryFactory.buildGeometry方法的具體用法?Java GeometryFactory.buildGeometry怎麽用?Java GeometryFactory.buildGeometry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vividsolutions.jts.geom.GeometryFactory
的用法示例。
在下文中一共展示了GeometryFactory.buildGeometry方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: convertSegStrings
import com.vividsolutions.jts.geom.GeometryFactory; //導入方法依賴的package包/類
private static Geometry convertSegStrings(Iterator it) {
GeometryFactory fact = new GeometryFactory();
List lines = new ArrayList();
while (it.hasNext()) {
SegmentString ss = (SegmentString) it.next();
LineString line = fact.createLineString(ss.getCoordinates());
lines.add(line);
}
return fact.buildGeometry(lines);
}
示例2: read
import com.vividsolutions.jts.geom.GeometryFactory; //導入方法依賴的package包/類
/**
* Converts text rendered in the given {@link Font} to a {@link Geometry}
*
* @param text the text to render
* @param font the font to render with
* @param flatness the flatness to use
* @param geomFact the geometryFactory to use to create the result
* @return a polygonal geometry representing the rendered text
*/
public static Geometry read(String text, Font font, double flatness, GeometryFactory geomFact) {
char[] chs = text.toCharArray();
FontRenderContext fontContext = new FontRenderContext(null, false, true);
GlyphVector gv = font.createGlyphVector(fontContext, chs);
List polys = new ArrayList();
for (int i = 0; i < gv.getNumGlyphs(); i++) {
Geometry geom = ShapeReader.read(gv.getGlyphOutline(i), flatness, geomFact);
for (int j = 0; j < geom.getNumGeometries(); j++) {
polys.add(geom.getGeometryN(j));
}
}
return geomFact.buildGeometry(polys);
}
示例3: bufferUnion
import com.vividsolutions.jts.geom.GeometryFactory; //導入方法依賴的package包/類
private Geometry bufferUnion(List geoms) {
GeometryFactory factory = ((Geometry) geoms.get(0)).getFactory();
Geometry gColl = factory.buildGeometry(geoms);
Geometry unionAll = gColl.buffer(0.0);
return unionAll;
}