當前位置: 首頁>>代碼示例>>Java>>正文


Java Envelope.getHeight方法代碼示例

本文整理匯總了Java中com.vividsolutions.jts.geom.Envelope.getHeight方法的典型用法代碼示例。如果您正苦於以下問題:Java Envelope.getHeight方法的具體用法?Java Envelope.getHeight怎麽用?Java Envelope.getHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vividsolutions.jts.geom.Envelope的用法示例。


在下文中一共展示了Envelope.getHeight方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: createEllipse

import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
/**
 * Creates an elliptical {@link Polygon}.
 * If the supplied envelope is square the
 * result will be a circle.
 *
 * @return an ellipse or circle
 */
public Polygon createEllipse() {

    Envelope env = this.dim.getEnvelope();
    double xRadius = env.getWidth() / 2.0;
    double yRadius = env.getHeight() / 2.0;

    double centreX = env.getMinX() + xRadius;
    double centreY = env.getMinY() + yRadius;

    Coordinate[] pts = new Coordinate[this.nPts + 1];
    int iPt = 0;
    for (int i = 0; i < this.nPts; i++) {
        double ang = i * (2 * Math.PI / this.nPts);
        double x = xRadius * Math.cos(ang) + centreX;
        double y = yRadius * Math.sin(ang) + centreY;
        pts[iPt++] = this.coord(x, y);
    }
    pts[iPt] = new Coordinate(pts[0]);

    LinearRing ring = this.geomFact.createLinearRing(pts);
    Polygon poly = this.geomFact.createPolygon(ring, null);
    return (Polygon) this.rotate(poly);
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:31,代碼來源:GeometricShapeFactory.java

示例3: fastGetSharedAreaRatio

import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
/**
 * This is ten times faster than the absolutely correct
 * version above, and it's only off by an average of 1%.
 * Note that the first argument MUST be rectangular, or
 * your results will be meaningless.
 */
public static double fastGetSharedAreaRatio (Geometry geom1, Geometry geom2) {
    Envelope env1 = geom1.getEnvelopeInternal();
    if ((SimplePointInAreaLocator.locate(new Coordinate(env1.getMinX(),env1.getMinY()), geom2) == Location.INTERIOR) &&
        (SimplePointInAreaLocator.locate(new Coordinate(env1.getMaxX(),env1.getMaxY()), geom2) == Location.INTERIOR) &&
        (SimplePointInAreaLocator.locate(new Coordinate(env1.getMaxX(),env1.getMinY()), geom2) == Location.INTERIOR) &&
        (SimplePointInAreaLocator.locate(new Coordinate(env1.getMinX(),env1.getMaxY()), geom2) == Location.INTERIOR)) {
        // I suppose it is possible for a valid polygon geometry
        // to contain all four corners and share considerably less
        // than 100% of its area with the envelope in question.
        // But if you're that worried about correctness you
        // shouldn't be using this method in the first place.
        return 1.0;
    }
    double xInc = env1.getWidth() / 9.0;
    double yInc = env1.getHeight() / 9.0;
    double x = env1.getMinX();
    double y = env1.getMinY();
    double ct = 0;
    for (int i = 0; i < 10; i += 1) {
        y = env1.getMinY();
        for (int j = 0; j < 10; j += 1) {
            if (SimplePointInAreaLocator.locate(new Coordinate(x,y), geom2) == Location.INTERIOR) {
                ct += 1;
            }
            y += yInc;
        }
        x += xInc;
    }
    return (ct / 100.0);
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:37,代碼來源:JTSUtil.java

示例4: computeBoundingBox

import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
private void computeBoundingBox() {
    Envelope vertexEnv = computeVertexEnvelope(this.initialVertices);
    Envelope segEnv = computeVertexEnvelope(this.segVertices);

    Envelope allPointsEnv = new Envelope(vertexEnv);
    allPointsEnv.expandToInclude(segEnv);

    double deltaX = allPointsEnv.getWidth() * 0.2;
    double deltaY = allPointsEnv.getHeight() * 0.2;

    double delta = Math.max(deltaX, deltaY);

    this.computeAreaEnv = new Envelope(allPointsEnv);
    this.computeAreaEnv.expandBy(delta);
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:16,代碼來源:ConformingDelaunayTriangulator.java

示例5: diagonalSize

import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
public static double diagonalSize(Envelope env) {
    if (env.isNull()) {
        return 0.0;
    }

    double width = env.getWidth();
    double hgt = env.getHeight();
    return Math.sqrt(width * width + hgt * hgt);
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:10,代碼來源:HausdorffSimilarityMeasure.java

示例6: computeQuadLevel

import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
public static int computeQuadLevel(Envelope env) {
    double dx = env.getWidth();
    double dy = env.getHeight();
    double dMax = dx > dy ? dx : dy;
    int level = DoubleBits.exponent(dMax) + 1;
    return level;
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:8,代碼來源:Key.java

示例7: collectStats

import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
private void collectStats(Envelope itemEnv) {
    double delX = itemEnv.getWidth();
    if (delX < this.minExtent && delX > 0.0) {
        this.minExtent = delX;
    }

    double delY = itemEnv.getHeight();
    if (delY < this.minExtent && delY > 0.0) {
        this.minExtent = delY;
    }
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:12,代碼來源:Quadtree.java

示例8: createArc

import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
/**
 * Creates an elliptical arc, as a {@link LineString}.
 * The arc is always created in a counter-clockwise direction.
 * This can easily be reversed if required by using
 * {#link LineString.reverse()}
 *
 * @param startAng start angle in radians
 * @param angExtent size of angle in radians
 * @return an elliptical arc
 */
public LineString createArc(
        double startAng,
        double angExtent) {
    Envelope env = this.dim.getEnvelope();
    double xRadius = env.getWidth() / 2.0;
    double yRadius = env.getHeight() / 2.0;

    double centreX = env.getMinX() + xRadius;
    double centreY = env.getMinY() + yRadius;

    double angSize = angExtent;
    if (angSize <= 0.0 || angSize > 2 * Math.PI) {
        angSize = 2 * Math.PI;
    }
    double angInc = angSize / (this.nPts - 1);

    Coordinate[] pts = new Coordinate[this.nPts];
    int iPt = 0;
    for (int i = 0; i < this.nPts; i++) {
        double ang = startAng + i * angInc;
        double x = xRadius * Math.cos(ang) + centreX;
        double y = yRadius * Math.sin(ang) + centreY;
        pts[iPt++] = this.coord(x, y);
    }
    LineString line = this.geomFact.createLineString(pts);
    return (LineString) this.rotate(line);
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:38,代碼來源:GeometricShapeFactory.java

示例9: createArcPolygon

import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
/**
 * Creates an elliptical arc polygon.
 * The polygon is formed from the specified arc of an ellipse
 * and the two radii connecting the endpoints to the centre of the ellipse.
 *
 * @param startAng start angle in radians
 * @param angExtent size of angle in radians
 * @return an elliptical arc polygon
 */
public Polygon createArcPolygon(double startAng, double angExtent) {
    Envelope env = this.dim.getEnvelope();
    double xRadius = env.getWidth() / 2.0;
    double yRadius = env.getHeight() / 2.0;

    double centreX = env.getMinX() + xRadius;
    double centreY = env.getMinY() + yRadius;

    double angSize = angExtent;
    if (angSize <= 0.0 || angSize > 2 * Math.PI) {
        angSize = 2 * Math.PI;
    }
    double angInc = angSize / (this.nPts - 1);
    // double check = angInc * nPts;
    // double checkEndAng = startAng + check;

    Coordinate[] pts = new Coordinate[this.nPts + 2];

    int iPt = 0;
    pts[iPt++] = this.coord(centreX, centreY);
    for (int i = 0; i < this.nPts; i++) {
        double ang = startAng + angInc * i;

        double x = xRadius * Math.cos(ang) + centreX;
        double y = yRadius * Math.sin(ang) + centreY;
        pts[iPt++] = this.coord(x, y);
    }
    pts[iPt++] = this.coord(centreX, centreY);
    LinearRing ring = this.geomFact.createLinearRing(pts);
    Polygon poly = this.geomFact.createPolygon(ring, null);
    return (Polygon) this.rotate(poly);
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:42,代碼來源:GeometricShapeFactory.java

示例10: createTileGeom

import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
/**
 * <p>Create geometry clipped and then converted to MVT 'extent' coordinates. Result
 * contains both clipped geometry (intersection) and transformed geometry for encoding to
 * MVT.</p>
 * <p>Allows specifying separate tile and clipping coordinates. {@code clipEnvelope} can be bigger
 * than {@code tileEnvelope} to have geometry exist outside the MVT tile extent.</p>
 *
 * @param geometryList   original 'source' geometry, passed through
 *                       {@link #flatFeatureList(Geometry)}
 * @param tileEnvelope   world coordinate bounds for tile, used for transforms
 * @param clipEnvelope   world coordinates to clip tile by
 * @param geomFactory    creates a geometry for the tile envelope
 * @param mvtLayerParams specifies vector tile properties
 * @param filter         geometry values that fail filter after transforms are removed
 * @return tile geometry result
 * @see TileGeomResult
 */
public static TileGeomResult createTileGeom(List<Geometry> geometryList,
                                            Envelope tileEnvelope,
                                            Envelope clipEnvelope,
                                            GeometryFactory geomFactory,
                                            MvtLayerParams mvtLayerParams,
                                            IGeometryFilter filter) {

  final Geometry tileClipGeom = geomFactory.toGeometry(clipEnvelope);

  final AffineTransformation t = new AffineTransformation();
  final double xDiff = tileEnvelope.getWidth();
  final double yDiff = tileEnvelope.getHeight();

  final double xOffset = -tileEnvelope.getMinX();
  final double yOffset = -tileEnvelope.getMinY();

  // Transform Setup: Shift to 0 as minimum value
  t.translate(xOffset, yOffset);

  // Transform Setup: Scale X and Y to tile extent values, flip Y values
  t.scale(1d / (xDiff / (double) mvtLayerParams.extent),
      -1d / (yDiff / (double) mvtLayerParams.extent));

  // Transform Setup: Bump Y values to positive quadrant
  t.translate(0d, (double) mvtLayerParams.extent);


  // The area contained in BOTH the 'original geometry', g, AND the 'clip envelope geometry' is
  // the 'tile geometry'
  final List<Geometry> intersectedGeoms = flatIntersection(tileClipGeom, geometryList);
  final List<Geometry> transformedGeoms = new ArrayList<>(intersectedGeoms.size());

  // Transform intersected geometry
  Geometry nextTransformGeom;
  Object nextUserData;
  for (Geometry nextInterGeom : intersectedGeoms) {
    nextUserData = nextInterGeom.getUserData();

    nextTransformGeom = t.transform(nextInterGeom);

    // Floating --> Integer, still contained within doubles
    nextTransformGeom.apply(RoundingFilter.INSTANCE);

    // TODO: Refactor line simplification
    // Can't use 0d, specify value < .5d
    nextTransformGeom = TopologyPreservingSimplifier.simplify(nextTransformGeom, .1d);

    nextTransformGeom.setUserData(nextUserData);

    // Apply filter on transformed geometry
    if (filter.accept(nextTransformGeom)) {
      transformedGeoms.add(nextTransformGeom);
    }
  }

  return new TileGeomResult(intersectedGeoms, transformedGeoms);
}
 
開發者ID:OrdnanceSurvey,項目名稱:vt-support,代碼行數:75,代碼來源:JtsAdapter.java

示例11: setEnvelope

import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
public void setEnvelope(Envelope env) {
    this.width = env.getWidth();
    this.height = env.getHeight();
    this.base = new Coordinate(env.getMinX(), env.getMinY());
    this.centre = new Coordinate(env.centre());
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:7,代碼來源:GeometricShapeFactory.java

示例12: createRandomCoord

import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
protected Coordinate createRandomCoord(Envelope env) {
    double x = env.getMinX() + env.getWidth() * Math.random();
    double y = env.getMinY() + env.getHeight() * Math.random();
    return this.createCoord(x, y);
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:6,代碼來源:RandomPointsBuilder.java

示例13: publish

import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
public void publish(DmlEvent event) {

		String metadata = extractMetadata(event);
		String changedTableSchema = event.getSchemaName();
		String changedTableName = event.getTableName();
		String type = event.getType().toString();
		Long transactionId = event.getTransactionId();
		PGobject timestamp = getTimestamp(event);
		PGobject oldjson = getJsonOldValues(event);
		PGobject newjson = getJsonNewValues(event);
		
		Object[] params;
		String sql;
		int[] types;
		
		Envelope envelope = event.getEnvelope();
		if (! envelope.isNull()) {
			
			//expand if necessasry
			if (envelope.getHeight() < minSize  && envelope.getWidth() < minSize) {
				envelope.expandBy(bufferSize);
			}
			
			//Transform Bounding Box of the change into WKB
			
			GeometryFactory geomFactory = new GeometryFactory(new PrecisionModel(), epsgCode);
			WKBWriter wkbWriter = new WKBWriter(2, true);
			byte[] wkb = wkbWriter.write(geomFactory.toGeometry(envelope));
			params = new Object[]{wkb, type, changedTableSchema, changedTableName, transactionId, timestamp, metadata, oldjson, newjson};
			types = new int[] {Types.BINARY, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.BIGINT, Types.OTHER, Types.VARCHAR, Types.OTHER, Types.OTHER};
			sql = "INSERT INTO "+schemaname + "." + tableName + "("+regionColumnName
				+", "+transactionTypeColumnName + ", "+schemaColumnName+", "+tableColumnName+", "+txIdColumnName
				+", "+commitTimestampColumnName+", "+metadataColumnName+", "+jsonOldValuesColumnName+", "+jsonNewValuesColumName
				+") VALUES (?,?,?,?,?,?,?,?,?)";
		}
		else {
			//geometry is null, do not include it in SQL insert statement
			params = new Object[]{type, changedTableSchema, changedTableName, transactionId, timestamp, metadata, oldjson, newjson};
			types = new int[] {Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.BIGINT, Types.OTHER, Types.VARCHAR, Types.OTHER, Types.OTHER};
			sql = "INSERT INTO "+schemaname + "." + tableName + "("
					+transactionTypeColumnName + ", "+schemaColumnName+", "+tableColumnName+", "+txIdColumnName
					+", "+commitTimestampColumnName+", "+metadataColumnName+", "+jsonOldValuesColumnName+", "+jsonNewValuesColumName
					+") VALUES (?,?,?,?,?,?,?,?)";
		}
		template.update(sql, params,types);
	}
 
開發者ID:sebastian-r-schmidt,項目名稱:logicaldecoding,代碼行數:47,代碼來源:TrackTablePublisher.java


注:本文中的com.vividsolutions.jts.geom.Envelope.getHeight方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。