當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。