本文整理汇总了Java中com.vividsolutions.jts.geom.prep.PreparedPolygon类的典型用法代码示例。如果您正苦于以下问题:Java PreparedPolygon类的具体用法?Java PreparedPolygon怎么用?Java PreparedPolygon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PreparedPolygon类属于com.vividsolutions.jts.geom.prep包,在下文中一共展示了PreparedPolygon类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: load
import com.vividsolutions.jts.geom.prep.PreparedPolygon; //导入依赖的package包/类
public static LinkedList<PreparedPolygon> load() throws IOException {
URL krajeShp = Kraje.class
.getResource("kraje/hranice_krajov_simpl.shp");
FileDataStore store = FileDataStoreFinder.getDataStore(krajeShp);
FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = store
.getFeatureSource();
FeatureCollection<SimpleFeatureType, SimpleFeature> fC = featureSource
.getFeatures();
FeatureIterator<SimpleFeature> iter = fC.features();
LinkedList<PreparedPolygon> list = new LinkedList<PreparedPolygon>();
try {
while (iter.hasNext()) {
Feature f = iter.next();
GeometryAttribute geomAttr = f.getDefaultGeometryProperty();
list.add(new PreparedPolygon((Polygonal) geomAttr.getValue()));
}
} finally {
iter.close();
}
return list;
}
开发者ID:MilanNobonn,项目名称:freemapKaPor,代码行数:27,代码来源:Kraje.java
示例2: ViewChangedObserver
import com.vividsolutions.jts.geom.prep.PreparedPolygon; //导入依赖的package包/类
public ViewChangedObserver(Exporter _exporter,
Collection<PreparedPolygon> _kraje, MGMap _map, int _minx,
int _maxx, int _miny, int _maxy) throws IOException, SQLException {
kraje = _kraje;
map = _map;
minx = _minx;
maxx = _maxx;
miny = _miny;
maxy = _maxy;
exporter = _exporter;
// At this point exporter.conn may still be not initialized
}
开发者ID:MilanNobonn,项目名称:freemapKaPor,代码行数:15,代码来源:ViewChangedObserver.java
示例3: intersectionSim
import com.vividsolutions.jts.geom.prep.PreparedPolygon; //导入依赖的package包/类
private static Geometry intersectionSim(
PreparedGeometry pg, Geometry g2)
{
PreparedPolygon ppoly = (PreparedPolygon) pg;
FastSegmentSetIntersectionFinder intf = ppoly.getIntersectionFinder();
Coordinate[] pts = g2.getCoordinates();
List segStrings = SegmentStringUtil.extractSegmentStrings(g2);
intf.intersects(segStrings );
return g2;
}
开发者ID:dr-jts,项目名称:jeql,代码行数:13,代码来源:GeomPrepFunction.java
示例4: rasterMaskJTS
import com.vividsolutions.jts.geom.prep.PreparedPolygon; //导入依赖的package包/类
/**
* rasterize the mask clipped with the Rectangle scaled back to full size with an offset onto a BufferedImage
*/
public int[] rasterMaskJTS(Rectangle rect, int offsetX, int offsetY, double scalingFactor) {
// create the buffered image of the size of the Rectangle
int[] mask = new int[rect.width* rect.height];
GeometryFactory gf = new GeometryFactory();
// define the clipping region in full scale
Coordinate[] coords = new Coordinate[]{
new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),
new Coordinate((int) (((double) rect.getMaxX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),
new Coordinate((int) (((double) rect.getMaxX() / scalingFactor)), (int) (((double) rect.getMaxY() / scalingFactor))),
new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMaxY() / scalingFactor))),
new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),};
Polygon geom = gf.createPolygon(gf.createLinearRing(coords));
PreparedPolygon ppol=new PreparedPolygon(geom);
int numPix=rect.width*rect.height;
for (Geometry p : maskGeometries) {
if (ppol.intersects(p)) {
Geometry pg=p.intersection(geom).buffer(0);
IndexedPointInAreaLocator locator=new IndexedPointInAreaLocator(pg);
int x=0;
int y=0;
for(int ii=0;ii<numPix;ii++){
if(ii%rect.width==0){
x=0;
y++;
}
//Point point=gf.createPoint(new Coordinate(rect.x+x,rect.y+y));
//PreparedPoint ppoint=new PreparedPoint(point);
//if(ppoint.within(pg)){
int loc=locator.locate(new Coordinate(rect.x+x,rect.y+y));
if(loc==Location.INTERIOR||loc==Location.BOUNDARY)
try{
mask[x]=1;
}catch(Exception e){
logger.warn(e.getMessage()+" x:"+x+" y:"+y);
}
}
}
//}
}
return mask;
}
开发者ID:ec-europa,项目名称:sumo,代码行数:53,代码来源:MaskGeometries.java
示例5: PredicateEvaluatorPrepared
import com.vividsolutions.jts.geom.prep.PreparedPolygon; //导入依赖的package包/类
public PredicateEvaluatorPrepared(Geometry geometry) {
this.factory = new GeometryFactory();
this.preparedPolygon = new PreparedPolygon((Polygonal) geometry);
}
开发者ID:gegy1000,项目名称:Earth,代码行数:5,代码来源:PredicateEvaluatorPrepared.java
注:本文中的com.vividsolutions.jts.geom.prep.PreparedPolygon类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论