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


Java Envelope类代码示例

本文整理汇总了Java中com.vividsolutions.jts.geom.Envelope的典型用法代码示例。如果您正苦于以下问题:Java Envelope类的具体用法?Java Envelope怎么用?Java Envelope使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: execute

import com.vividsolutions.jts.geom.Envelope; //导入依赖的package包/类
@DescribeResult(name = "result", description = "Clipped feature collection")
public SimpleFeatureCollection execute(
        @DescribeParameter(name = "features", description = "Input feature collection") SimpleFeatureCollection features,
        @DescribeParameter(name = "clip", description = "Geometry to use for clipping (in same CRS as input features)") Geometry clip,
        @DescribeParameter(name = "preserveZ", min=0,description = "Attempt to preserve Z values from the original geometry (interpolate value for new points)") Boolean preserveZ)
        throws ProcessException {
    // only get the geometries in the bbox of the clip
    Envelope box = clip.getEnvelopeInternal();
    String srs = null;
    if(features.getSchema().getCoordinateReferenceSystem() != null) {
        srs = CRS.toSRS(features.getSchema().getCoordinateReferenceSystem());
    }
    BBOX bboxFilter = ff.bbox("", box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY(), srs);
    
    // default value for preserve Z
    if(preserveZ == null) {
        preserveZ = false;
    }
    
    // return dynamic collection clipping geometries on the fly
    return new ClippingFeatureCollection(features.subCollection(bboxFilter), clip, preserveZ);
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:23,代码来源:ClipProcess.java

示例2: getFeatures

import com.vividsolutions.jts.geom.Envelope; //导入依赖的package包/类
public List<TrafficFeatureInfo> getFeatures(Envelope env)
{
	if (env == null)
		return features;
	
	if (quadTree == null)
		buildQuadTree();
	
	List<TrafficFeatureInfo> list = quadTree.query(env);
	List<TrafficFeatureInfo> result = new ArrayList<TrafficFeatureInfo>(list.size());
	
	for(TrafficFeatureInfo tfi : list)
	{
		Envelope fe = tfi.getEnvelope();
		if (fe != null && fe.intersects(env))
			result.add(tfi);
	}
	
	return result;
}
 
开发者ID:GIScience,项目名称:openrouteservice,代码行数:21,代码来源:RealTrafficDataProvider.java

示例3: applySearchBoundary

import com.vividsolutions.jts.geom.Envelope; //导入依赖的package包/类
private String applySearchBoundary(String reqParams, SearchBoundary searchBoundary)
{
	if (searchBoundary != null)
	{
		if (searchBoundary instanceof RectSearchBoundary)
		{
			RectSearchBoundary rsb = (RectSearchBoundary)searchBoundary;
			Envelope env = rsb.getRectangle();
			reqParams += "&boundary.rect.min_lat=" + env.getMinY() + "&boundary.rect.min_lon=" + env.getMinX() + "&boundary.rect.max_lat=" + env.getMaxY() + "&boundary.rect.max_lon=" + env.getMaxX();
		}
		else if (searchBoundary instanceof CircleSearchBoundary)
		{
			CircleSearchBoundary csb = (CircleSearchBoundary)searchBoundary;
			reqParams += "&boundary.circle.lat=" + csb.getLatitude() + "&boundary.circle.lon=" + csb.getLongitude() + "&boundary.circle.radius=" + csb.getRadius();
		}
	}

	return reqParams;
}
 
开发者ID:GIScience,项目名称:openrouteservice,代码行数:20,代码来源:PeliasGeocoder.java

示例4: postSeedRequest

import com.vividsolutions.jts.geom.Envelope; //导入依赖的package包/类
private void postSeedRequest(Envelope envelope) {

		String gwcurl = gwcBaseUrl + "seed/" + layername + ".json";

		Bounds bounds = new Bounds(new Coordinates(envelope.getMinX(), envelope.getMinY(), envelope.getMaxX(),
				envelope.getMaxY()));
		Srs srs = new Srs(epsgCode);
		SeedRequest request = new SeedRequest(layername, bounds, srs, zoomStart, zoomStop, imageFormat, operation,
				numThreads);

		HttpEntity<GwcSeedDAO> httpentity = new HttpEntity<GwcSeedDAO>(new GwcSeedDAO(request), createHeaders(
				gwcUserName, gwcPassword));
		ResponseEntity response = template.exchange(gwcurl, HttpMethod.POST, httpentity, String.class);
		HttpStatus returncode = response.getStatusCode();
		if (!returncode.is2xxSuccessful()) {
			log.warn("HTTP Call to " + gwcurl + " was not successfull, Status code: " + response.getStatusCode());
		}
		else {
			log.debug("HTTP Call to "+ gwcurl + "succeeded");
		}
		
	}
 
开发者ID:sebastian-r-schmidt,项目名称:logicaldecoding,代码行数:23,代码来源:GWCInvalidator.java

示例5: unionOptimized

import com.vividsolutions.jts.geom.Envelope; //导入依赖的package包/类
private Geometry unionOptimized(Geometry g0, Geometry g1) {
        Envelope g0Env = g0.getEnvelopeInternal();
        Envelope g1Env = g1.getEnvelopeInternal();
        //*
        if (!g0Env.intersects(g1Env)) {
            Geometry combo = GeometryCombiner.combine(g0, g1);
//   		System.out.println("Combined");
//  		System.out.println(combo);
            return combo;
        }
        //*/
//  	System.out.println(g0.getNumGeometries() + ", " + g1.getNumGeometries());

        if (g0.getNumGeometries() <= 1 && g1.getNumGeometries() <= 1) {
            return this.unionActual(g0, g1);
        }

        // for testing...
//  	if (true) return g0.union(g1);

        Envelope commonEnv = g0Env.intersection(g1Env);
        return this.unionUsingEnvelopeIntersection(g0, g1, commonEnv);

//  	return UnionInteracting.union(g0, g1);
    }
 
开发者ID:gegy1000,项目名称:Earth,代码行数:26,代码来源:CascadedPolygonUnion.java

示例6: visit

import com.vividsolutions.jts.geom.Envelope; //导入依赖的package包/类
@Override
protected void visit(Geometry geom) {
    /**
     * It may be the case that the rectangle and the
     * envelope of the geometry component are disjoint,
     * so it is worth checking this simple condition.
     */
    Envelope elementEnv = geom.getEnvelopeInternal();
    if (!this.rectEnv.intersects(elementEnv)) {
        return;
    }

    // check segment intersections
    // get all lines from geometry component
    // (there may be more than one if it's a multi-ring polygon)
    List lines = LinearComponentExtracter.getLines(geom);
    this.checkIntersectionWithLineStrings(lines);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:19,代码来源:RectangleIntersects.java

示例7: select

import com.vividsolutions.jts.geom.Envelope; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Collection<Feat> select(IGeometry geometry) {
  IEnvelope egeox = geometry.getEnvelope();
  Envelope envelopeJts = new Envelope(egeox.maxX(), egeox.minX(),
      egeox.maxY(), egeox.minY());
  List<Integer> indexes = quad.query(envelopeJts);
  Collection<Feat> result = new HashSet<Feat>();
  // System.out.println(indexes.size());
  for (int ind : indexes) {
    Feat f = collection.get(ind);
    if (f.getGeom().intersects(geometry))
      result.add(f);
  }
  return result;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:17,代码来源:QuadTreeJts.java

示例8: checkEnvelope

import com.vividsolutions.jts.geom.Envelope; //导入依赖的package包/类
private void checkEnvelope() {
    if (this.distance < 0.0) {
        return;
    }

    double padding = this.distance * MAX_ENV_DIFF_FRAC;
    if (padding == 0.0) {
        padding = 0.001;
    }

    Envelope expectedEnv = new Envelope(this.input.getEnvelopeInternal());
    expectedEnv.expandBy(this.distance);

    Envelope bufEnv = new Envelope(this.result.getEnvelopeInternal());
    bufEnv.expandBy(padding);

    if (!bufEnv.contains(expectedEnv)) {
        this.isValid = false;
        this.errorMsg = "Buffer envelope is incorrect";
        this.errorIndicator = this.input.getFactory().toGeometry(bufEnv);
    }
    this.report("Envelope");
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:24,代码来源:BufferResultValidator.java

示例9: precisionScaleFactor

import com.vividsolutions.jts.geom.Envelope; //导入依赖的package包/类
/**
 * Compute a scale factor to limit the precision of
 * a given combination of Geometry and buffer distance.
 * The scale factor is determined by
 * the number of digits of precision in the (geometry + buffer distance),
 * limited by the supplied <code>maxPrecisionDigits</code> value.
 * <p>
 * The scale factor is based on the absolute magnitude of the (geometry + buffer distance).
 * since this determines the number of digits of precision which must be handled.
 *
 * @param g the Geometry being buffered
 * @param distance the buffer distance
 * @param maxPrecisionDigits the max # of digits that should be allowed by
 * the precision determined by the computed scale factor
 * @return a scale factor for the buffer computation
 */
private static double precisionScaleFactor(Geometry g,
                                           double distance,
                                           int maxPrecisionDigits) {
    Envelope env = g.getEnvelopeInternal();
    double envMax = MathUtil.max(
            Math.abs(env.getMaxX()),
            Math.abs(env.getMaxY()),
            Math.abs(env.getMinX()),
            Math.abs(env.getMinY())
    );

    double expandByDistance = distance > 0.0 ? distance : 0.0;
    double bufEnvMax = envMax + 2 * expandByDistance;

    // the smallest power of 10 greater than the buffer envelope
    int bufEnvPrecisionDigits = (int) (Math.log(bufEnvMax) / Math.log(10) + 1.0);
    int minUnitLog10 = maxPrecisionDigits - bufEnvPrecisionDigits;

    double scaleFactor = Math.pow(10.0, minUnitLog10);
    return scaleFactor;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:38,代码来源:BufferOp.java

示例10: paint

import com.vividsolutions.jts.geom.Envelope; //导入依赖的package包/类
/**
 * @param obj
 *            The FT_coverage to render This method shall be reworked.
 */
public static void paint(final RasterSymbolizer symbolizer, final IFeature obj, final Viewport viewport, final double opacity) {
    FT_Coverage fcoverage = (FT_Coverage) obj;
    try {
        GridCoverage2D coverage = fcoverage.coverage();
        IEnvelope view = viewport.getEnvelopeInModelCoordinates();
        Envelope renderEnvelope = new Envelope(view.minX(), view.maxX(), view.minY(), view.maxY());
        GridCoverageRenderer renderer = new GridCoverageRenderer(coverage.getCoordinateReferenceSystem(), renderEnvelope, viewport.getLayerViewPanels()
                .iterator().next().getVisibleRect(), null);
        org.geotools.styling.RasterSymbolizer s = new StyleBuilder().createRasterSymbolizer();
        s.setOpacity(new FilterFactoryImpl().literal(opacity * symbolizer.getOpacity()));
        logger.warn("Replace by a GL function");
        // renderer.paint(coverage, s);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:22,代码来源:RenderGL11Util.java

示例11: ensureExtent

import com.vividsolutions.jts.geom.Envelope; //导入依赖的package包/类
/**
 * Ensure that the envelope for the inserted item has non-zero extents.
 * Use the current minExtent to pad the envelope, if necessary
 */
public static Envelope ensureExtent(Envelope itemEnv, double minExtent) {
    //The names "ensureExtent" and "minExtent" are misleading -- sounds like
    //this method ensures that the extents are greater than minExtent.
    //Perhaps we should rename them to "ensurePositiveExtent" and "defaultExtent".
    //[Jon Aquino]
    double minx = itemEnv.getMinX();
    double maxx = itemEnv.getMaxX();
    double miny = itemEnv.getMinY();
    double maxy = itemEnv.getMaxY();
    // has a non-zero extent
    if (minx != maxx && miny != maxy) {
        return itemEnv;
    }

    // pad one or both extents
    if (minx == maxx) {
        minx = minx - minExtent / 2.0;
        maxx = minx + minExtent / 2.0;
    }
    if (miny == maxy) {
        miny = miny - minExtent / 2.0;
        maxy = miny + minExtent / 2.0;
    }
    return new Envelope(minx, maxx, miny, maxy);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:30,代码来源:Quadtree.java

示例12: create

import com.vividsolutions.jts.geom.Envelope; //导入依赖的package包/类
private void create() {
    if (this.subdiv != null) {
        return;
    }

    Envelope siteEnv = DelaunayTriangulationBuilder.envelope(this.siteCoords);
    this.diagramEnv = siteEnv;
    // add a buffer around the final envelope
    double expandBy = Math.max(this.diagramEnv.getWidth(), this.diagramEnv.getHeight());
    this.diagramEnv.expandBy(expandBy);
    if (this.clipEnv != null) {
        this.diagramEnv.expandToInclude(this.clipEnv);
    }

    List vertices = DelaunayTriangulationBuilder.toVertices(this.siteCoords);
    this.subdiv = new QuadEdgeSubdivision(siteEnv, this.tolerance);
    IncrementalDelaunayTriangulator triangulator = new IncrementalDelaunayTriangulator(this.subdiv);
    triangulator.insertSites(vertices);
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:20,代码来源:VoronoiDiagramBuilder.java

示例13: clipGeometryCollection

import com.vividsolutions.jts.geom.Envelope; //导入依赖的package包/类
private static Geometry clipGeometryCollection(Geometry geom, Envelope clipEnv) {
    Geometry clipPoly = geom.getFactory().toGeometry(clipEnv);
    List clipped = new ArrayList();
    for (int i = 0; i < geom.getNumGeometries(); i++) {
        Geometry g = geom.getGeometryN(i);
        Geometry result = null;
        // don't clip unless necessary
        if (clipEnv.contains(g.getEnvelopeInternal())) {
            result = g;
        } else if (clipEnv.intersects(g.getEnvelopeInternal())) {
            result = clipPoly.intersection(g);
            // keep vertex key info
            result.setUserData(g.getUserData());
        }

        if (result != null && !result.isEmpty()) {
            clipped.add(result);
        }
    }
    return geom.getFactory().createGeometryCollection(GeometryFactory.toGeometryArray(clipped));
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:22,代码来源:VoronoiDiagramBuilder.java

示例14: createFrame

import com.vividsolutions.jts.geom.Envelope; //导入依赖的package包/类
private void createFrame(Envelope env) {
    double deltaX = env.getWidth();
    double deltaY = env.getHeight();
    double offset = 0.0;
    if (deltaX > deltaY) {
        offset = deltaX * 10.0;
    } else {
        offset = deltaY * 10.0;
    }

    this.frameVertex[0] = new Vertex((env.getMaxX() + env.getMinX()) / 2.0, env
            .getMaxY()
            + offset);
    this.frameVertex[1] = new Vertex(env.getMinX() - offset, env.getMinY() - offset);
    this.frameVertex[2] = new Vertex(env.getMaxX() + offset, env.getMinY() - offset);

    this.frameEnv = new Envelope(this.frameVertex[0].getCoordinate(), this.frameVertex[1]
            .getCoordinate());
    this.frameEnv.expandToInclude(this.frameVertex[2].getCoordinate());
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:21,代码来源:QuadEdgeSubdivision.java

示例15: isInside

import com.vividsolutions.jts.geom.Envelope; //导入依赖的package包/类
@Override
    public boolean isInside(Coordinate pt) {
        this.crossings = 0;

        // test all segments intersected by ray from pt in positive x direction
        Envelope rayEnv = new Envelope(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, pt.y, pt.y);

        this.interval.min = pt.y;
        this.interval.max = pt.y;
        List segs = this.tree.query(this.interval);
//System.out.println("query size = " + segs.size());

        MCSelecter mcSelecter = new MCSelecter(pt);
        for (Object seg : segs) {
            MonotoneChain mc = (MonotoneChain) seg;
            this.testMonotoneChain(rayEnv, mcSelecter, mc);
        }

    /*
     *  p is inside if number of crossings is odd.
     */
        return (crossings % 2) == 1;
    }
 
开发者ID:gegy1000,项目名称:Earth,代码行数:24,代码来源:MCPointInRing.java


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