本文整理汇总了Java中com.vividsolutions.jts.algorithm.locate.IndexedPointInAreaLocator类的典型用法代码示例。如果您正苦于以下问题:Java IndexedPointInAreaLocator类的具体用法?Java IndexedPointInAreaLocator怎么用?Java IndexedPointInAreaLocator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IndexedPointInAreaLocator类属于com.vividsolutions.jts.algorithm.locate包,在下文中一共展示了IndexedPointInAreaLocator类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testGrid
import com.vividsolutions.jts.algorithm.locate.IndexedPointInAreaLocator; //导入依赖的package包/类
public void testGrid()
{
// Use fixed PM to try and get at least some points hitting the boundary
GeometryFactory geomFactory = new GeometryFactory(pmFixed_1);
// GeometryFactory geomFactory = new GeometryFactory();
PerturbedGridPolygonBuilder gridBuilder = new PerturbedGridPolygonBuilder(geomFactory);
gridBuilder.setNumLines(20);
gridBuilder.setLineWidth(10.0);
gridBuilder.setSeed(1185072199562L);
Geometry area = gridBuilder.getGeometry();
// PointInAreaLocator pia = new IndexedPointInAreaLocator(area);
PointOnGeometryLocator pia = new IndexedPointInAreaLocator(area);
PointInAreaStressTester gridTester = new PointInAreaStressTester(geomFactory, area);
gridTester.setNumPoints(100000);
gridTester.setPIA(pia);
boolean isCorrect = gridTester.run();
assertTrue(isCorrect);
}
开发者ID:Semantive,项目名称:jts,代码行数:23,代码来源:IndexedPointInAreaStressTest.java
示例2: locate
import com.vividsolutions.jts.algorithm.locate.IndexedPointInAreaLocator; //导入依赖的package包/类
/**
* Determines the {@link Location} of the given {@link Coordinate}
* in this geometry.
*
* @param p the point to test
* @return the location of the point in the geometry
*/
public int locate(Coordinate pt) {
if (this.parentGeom instanceof Polygonal && this.parentGeom.getNumGeometries() > 50) {
// lazily init point locator
if (this.areaPtLocator == null) {
this.areaPtLocator = new IndexedPointInAreaLocator(this.parentGeom);
}
return this.areaPtLocator.locate(pt);
}
return this.ptLocator.locate(pt, this.parentGeom);
}
开发者ID:gegy1000,项目名称:Earth,代码行数:18,代码来源:GeometryGraph.java
示例3: getPointLocator
import com.vividsolutions.jts.algorithm.locate.IndexedPointInAreaLocator; //导入依赖的package包/类
public synchronized PointOnGeometryLocator getPointLocator() {
if (this.pia == null) {
this.pia = new IndexedPointInAreaLocator(this.getGeometry());
}
return this.pia;
}
开发者ID:gegy1000,项目名称:Earth,代码行数:8,代码来源:PreparedPolygon.java
示例4: setExtent
import com.vividsolutions.jts.algorithm.locate.IndexedPointInAreaLocator; //导入依赖的package包/类
/**
* Sets a polygonal mask.
*
* @param mask
* @throws IllegalArgumentException if the mask is not polygonal
*/
public void setExtent(Geometry mask) {
if (!(mask instanceof Polygonal)) {
throw new IllegalArgumentException("Only polygonal extents are supported");
}
this.maskPoly = mask;
this.setExtent(mask.getEnvelopeInternal());
this.extentLocator = new IndexedPointInAreaLocator(mask);
}
开发者ID:gegy1000,项目名称:Earth,代码行数:15,代码来源:RandomPointsBuilder.java
示例5: setExtent
import com.vividsolutions.jts.algorithm.locate.IndexedPointInAreaLocator; //导入依赖的package包/类
/**
* Sets a polygonal mask.
*
* @param mask
* @throws IllegalArgumentException if the mask is not polygonal
*/
public void setExtent(Geometry mask) {
if (!(mask instanceof Polygonal))
throw new IllegalArgumentException("Only polygonal extents are supported");
this.maskPoly = mask;
setExtent(mask.getEnvelopeInternal());
extentLocator = new IndexedPointInAreaLocator(mask);
}
开发者ID:Semantive,项目名称:jts,代码行数:14,代码来源:RandomPointsBuilder.java
示例6: setExtent
import com.vividsolutions.jts.algorithm.locate.IndexedPointInAreaLocator; //导入依赖的package包/类
/**
* Sets a polygonal mask.
*
* @param mask
* @ throws IllegalArgumentException if the mask is not polygonal
*/
public void setExtent(Geometry mask)
{
if (! (mask instanceof Polygonal))
throw new IllegalArgumentException("Only polygonal extents are supported");
this.maskPoly = mask;
setExtent(mask.getEnvelopeInternal());
extentLocator = new IndexedPointInAreaLocator(mask);
}
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:15,代码来源:RandomPointsBuilder.java
示例7: setExtent
import com.vividsolutions.jts.algorithm.locate.IndexedPointInAreaLocator; //导入依赖的package包/类
/**
* Sets a polygonal mask.
*
* @param mask
* @throws IllegalArgumentException if the mask is not polygonal
*/
public void setExtent(Geometry mask)
{
if (! (mask instanceof Polygonal))
throw new IllegalArgumentException("Only polygonal extents are supported");
this.maskPoly = mask;
setExtent(mask.getEnvelopeInternal());
extentLocator = new IndexedPointInAreaLocator(mask);
}
开发者ID:Jules-,项目名称:terraingis,代码行数:15,代码来源:RandomPointsBuilder.java
示例8: rasterMaskJTS
import com.vividsolutions.jts.algorithm.locate.IndexedPointInAreaLocator; //导入依赖的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
注:本文中的com.vividsolutions.jts.algorithm.locate.IndexedPointInAreaLocator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论