当前位置: 首页>>代码示例>>Java>>正文


Java PreparedGeometryFactory.prepare方法代码示例

本文整理汇总了Java中com.vividsolutions.jts.geom.prep.PreparedGeometryFactory.prepare方法的典型用法代码示例。如果您正苦于以下问题:Java PreparedGeometryFactory.prepare方法的具体用法?Java PreparedGeometryFactory.prepare怎么用?Java PreparedGeometryFactory.prepare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vividsolutions.jts.geom.prep.PreparedGeometryFactory的用法示例。


在下文中一共展示了PreparedGeometryFactory.prepare方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; //导入方法依赖的package包/类
public static void main(String[] args)
        throws Exception {
    Geometry circle = createCircle();
    PreparedGeometry prepCircle = PreparedGeometryFactory.prepare(circle);

    int count = 0;
    int inCount = 0;
    for (int i = 0; i < MAX_ITER; i++) {
        count++;
        Point randPt = createRandomPoint();
        if (prepCircle.intersects(randPt)) {
            inCount++;
        }

        //System.out.println("Approximation to PI: " + (4.0 * inCount / (double) count));
    }
    double approxPi = 4.0 * inCount / (double) count;
    double approxDiffPct = 1.0 - approxPi / Math.PI;

    System.out.println("Approximation to PI: " + approxPi
            + "  ( % difference from actual = " + 100 * approxDiffPct + " )"
    );

}
 
开发者ID:Semantive,项目名称:jts,代码行数:25,代码来源:PreparedGeometryExample.java

示例2: intersectingFeatures

import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; //导入方法依赖的package包/类
/** */
public List<VectorFeature> intersectingFeatures (Geometry geom) {
    final PreparedGeometry pGeom = PreparedGeometryFactory.prepare(geom);
    final List<VectorFeature> result = new ArrayList<VectorFeature>();
    _spatialIndex.query(geom.getEnvelopeInternal(), new ItemVisitor() {
            public void visitItem (Object item) {
                VectorFeature feature = (VectorFeature)item;
                if (pGeom.intersects(feature.getGeometry())) {
                    result.add(feature);
                }
            }
        });
    return result;
}
 
开发者ID:reuven,项目名称:modelingcommons,代码行数:15,代码来源:VectorDataset.java

示例3: FastLiteShape

import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; //导入方法依赖的package包/类
public FastLiteShape( Geometry geom ) {
    super(geom, new AffineTransform(), false);
    this.prepared = PreparedGeometryFactory.prepare(geom);
    GeometryFactory gf = new GeometryFactory();
    pointCS = new LiteCoordinateSequence(1, 2);
    point = gf.createPoint(pointCS);
    rectCS = new LiteCoordinateSequence(5, 2);
    rect = gf.createPolygon(gf.createLinearRing(rectCS), null);
    // System.out.println("Crop area: " + geom);
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:11,代码来源:FastLiteShape.java

示例4: intersects

import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; //导入方法依赖的package包/类
/**
 * Check for intersection.
 * 
 * @param geometry the geometry to check against.
 * @param usePrepared use prepared geometry.
 * @return true if the geometries intersect.
 */
public boolean intersects( Geometry geometry, boolean usePrepared ) {
    if (!getEnvelope().intersects(geometry.getEnvelopeInternal())) {
        return false;
    }
    if (usePrepared) {
        if (preparedGeometry == null) {
            preparedGeometry = PreparedGeometryFactory.prepare(getGeometry());
        }
        return preparedGeometry.intersects(geometry);
    } else {
        return getGeometry().intersects(geometry);
    }
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:21,代码来源:FeatureMate.java

示例5: covers

import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; //导入方法依赖的package包/类
/**
 * Check for cover.
 * 
 * @param geometry the geometry to check against.
 * @param usePrepared use prepared geometry.
 * @return true if the current geometries covers the supplied one.
 */
public boolean covers( Geometry geometry, boolean usePrepared ) {
    if (!getEnvelope().covers(geometry.getEnvelopeInternal())) {
        return false;
    }
    if (usePrepared) {
        if (preparedGeometry == null) {
            preparedGeometry = PreparedGeometryFactory.prepare(getGeometry());
        }
        return preparedGeometry.covers(geometry);
    } else {
        return getGeometry().covers(geometry);
    }
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:21,代码来源:FeatureMate.java

示例6: linkBasinWithNetwork

import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; //导入方法依赖的package包/类
private void linkBasinWithNetwork() throws Exception {
    FeatureExtender fExt = new FeatureExtender(inNetwork.getSchema(), new String[]{NetworkChannel.NETNUMNAME},
            new Class[]{Integer.class});

    DefaultFeatureCollection newCollection = new DefaultFeatureCollection();

    SimpleFeatureIterator hillslopeFeatures = inHillslope.features();
    while( hillslopeFeatures.hasNext() ) {
        SimpleFeature hFeature = hillslopeFeatures.next();
        Object netNum = hFeature.getAttribute(NetworkChannel.NETNUMNAME);
        Geometry hGeometry = (Geometry) hFeature.getDefaultGeometry();
        PreparedGeometry preparedHGeometry = PreparedGeometryFactory.prepare(hGeometry);
        SimpleFeatureIterator netFeatures = inNetwork.features();
        while( netFeatures.hasNext() ) {
            SimpleFeature nFeature = netFeatures.next();
            Geometry geometry = (Geometry) nFeature.getDefaultGeometry();
            if (geometry.getNumGeometries() != 1) {
                throw new ModelsRuntimeException("The network geometries have to be single lines.", this);
            }
            LineString nLine = (LineString) geometry.getGeometryN(0);
            Point startPoint = nLine.getStartPoint();
            if (preparedHGeometry.contains(startPoint)) {
                SimpleFeature extendFeature = fExt.extendFeature(nFeature, new Object[]{netNum});
                newCollection.add(extendFeature);
                break;
            }
        }
    }
    inNetwork = newCollection;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:31,代码来源:OmsAdige.java

示例7: intersects

import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; //导入方法依赖的package包/类
public static boolean intersects(Geometry cachedGeom, Geometry g2) 
{ 
  if (intersectsCacheGeom == null
      || intersectsCacheGeom != cachedGeom) {
    intersectsCacheGeom = cachedGeom;
    intersectsCacheGeomPrep = PreparedGeometryFactory.prepare(cachedGeom);
  }
  return intersectsCacheGeomPrep.intersects(g2); 
}
 
开发者ID:dr-jts,项目名称:jeql,代码行数:10,代码来源:GeomPrepFunction.java

示例8: contains

import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; //导入方法依赖的package包/类
public static boolean contains(Geometry cachedGeom, Geometry g2) 
  { 
    if (containsCacheGeom == null
        || containsCacheGeom != cachedGeom) {
      containsCacheGeom = cachedGeom;
      containsCacheGeomPrep = PreparedGeometryFactory.prepare(cachedGeom);
      
//      System.out.println(hitCount);
      hitCount = 0;
    }
    hitCount++;
    return containsCacheGeomPrep.contains(g2); 
  }
 
开发者ID:dr-jts,项目名称:jeql,代码行数:14,代码来源:GeomPrepFunction.java

示例9: intersection

import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; //导入方法依赖的package包/类
public static Geometry intersection(Geometry cachedGeom, Geometry g2) 
{ 
  if (intersectionCacheGeom == null
      || intersectionCacheGeom != cachedGeom) {
    intersectionCacheGeom = cachedGeom;
    intersectionCacheGeomPrep = PreparedGeometryFactory.prepare(cachedGeom);
  }
  hitCount++;
  if (! intersectionCacheGeomPrep.intersects(g2))
    return g2.getFactory().createGeometryCollection(null);
  if (intersectionCacheGeomPrep.contains(g2))
    return g2;
  return cachedGeom.intersection(g2);
}
 
开发者ID:dr-jts,项目名称:jeql,代码行数:15,代码来源:GeomPrepFunction.java

示例10: intersectionSim

import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; //导入方法依赖的package包/类
public static Geometry intersectionSim(Geometry cachedGeom, Geometry g2) 
{ 
  if (intersectionCacheGeom == null
      || intersectionCacheGeom != cachedGeom) {
    intersectionCacheGeom = cachedGeom;
    intersectionCacheGeomPrep = PreparedGeometryFactory.prepare(cachedGeom);
  }
  hitCount++;
  if (! intersectionCacheGeomPrep.intersects(g2))
    return g2.getFactory().createGeometryCollection(null);
  if (intersectionCacheGeomPrep.contains(g2))
    return g2;
  return intersectionSim(intersectionCacheGeomPrep, g2);
}
 
开发者ID:dr-jts,项目名称:jeql,代码行数:15,代码来源:GeomPrepFunction.java

示例11: cacheFind

import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; //导入方法依赖的package包/类
private static PreparedGeometry cacheFind(Geometry g)
{
  PreparedGeometry pg = cache.get(g);
  if (pg == null) {
    pg = PreparedGeometryFactory.prepare(g);
    cache.put(g, pg);
    //System.out.println("cache size = " + cache.size());
  }
  return pg;
}
 
开发者ID:dr-jts,项目名称:jeql,代码行数:11,代码来源:GeomPrepAllFunction.java

示例12: intersectsPrep

import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; //导入方法依赖的package包/类
public static boolean intersectsPrep(Geometry g1, Geometry g2) 
{ 
  if (intersectsCacheGeom == null
      || intersectsCacheGeom != g1) {
    intersectsCacheGeom = g1;
    intersectsCacheGeomPrep = PreparedGeometryFactory.prepare(g1);
  }
  return intersectsCacheGeomPrep.intersects(g2); 
}
 
开发者ID:dr-jts,项目名称:jeql,代码行数:10,代码来源:GeomExpFunction.java

示例13: containsPrep

import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; //导入方法依赖的package包/类
public static boolean containsPrep(Geometry g1, Geometry g2) 
  { 
    if (containsCacheGeom == null
        || containsCacheGeom != g1) {
      containsCacheGeom = g1;
      containsCacheGeomPrep = PreparedGeometryFactory.prepare(g1);
      
//      System.out.println(hitCount);
      hitCount = 0;
    }
    hitCount++;
    return containsCacheGeomPrep.contains(g2); 
  }
 
开发者ID:dr-jts,项目名称:jeql,代码行数:14,代码来源:GeomExpFunction.java

示例14: intersectionPrep

import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; //导入方法依赖的package包/类
public static Geometry intersectionPrep(Geometry g1, Geometry g2) 
{ 
  if (intersectionCacheGeom == null
      || intersectionCacheGeom != g1) {
    intersectionCacheGeom = g1;
    intersectionCacheGeomPrep = PreparedGeometryFactory.prepare(g1);
  }
  hitCount++;
  if (! intersectionCacheGeomPrep.intersects(g2))
    return g2.getFactory().createGeometryCollection(null);
  if (intersectionCacheGeomPrep.contains(g2))
    return g2;
  return g1.intersection(g2);
}
 
开发者ID:dr-jts,项目名称:jeql,代码行数:15,代码来源:GeomExpFunction.java

示例15: prepare

import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; //导入方法依赖的package包/类
/**
 * Creates a prepared geometry. <p> Prepared geometries make operations like intersection must faster. </p>
 */
public static PreparedGeometry prepare(Geometry g) {
  return PreparedGeometryFactory.prepare(g);
}
 
开发者ID:geomgis,项目名称:geogson,代码行数:7,代码来源:Geom.java


注:本文中的com.vividsolutions.jts.geom.prep.PreparedGeometryFactory.prepare方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。