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


Java Envelope.expandBy方法代碼示例

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


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

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

示例2: findNonGabrielPoint

import com.vividsolutions.jts.geom.Envelope; //導入方法依賴的package包/類
/**
 * Given a set of points stored in the kd-tree and a line segment defined by
 * two points in this set, finds a {@link Coordinate} in the circumcircle of
 * the line segment, if one exists. This is called the Gabriel point - if none
 * exists then the segment is said to have the Gabriel condition. Uses the
 * heuristic of finding the non-Gabriel point closest to the midpoint of the
 * segment.
 *
 * @param p start of the line segment
 * @param q end of the line segment
 * @return a point which is non-Gabriel
 * or null if no point is non-Gabriel
 */
private Coordinate findNonGabrielPoint(Segment seg) {
    Coordinate p = seg.getStart();
    Coordinate q = seg.getEnd();
    // Find the mid point on the line and compute the radius of enclosing circle
    Coordinate midPt = new Coordinate((p.x + q.x) / 2.0, (p.y + q.y) / 2.0);
    double segRadius = p.distance(midPt);

    // compute envelope of circumcircle
    Envelope env = new Envelope(midPt);
    env.expandBy(segRadius);
    // Find all points in envelope
    List result = this.kdt.query(env);

    // For each point found, test if it falls strictly in the circle
    // find closest point
    Coordinate closestNonGabriel = null;
    double minDist = Double.MAX_VALUE;
    for (Object aResult : result) {
        KdNode nextNode = (KdNode) aResult;
        Coordinate testPt = nextNode.getCoordinate();
        // ignore segment endpoints
        if (testPt.equals2D(p) || testPt.equals2D(q)) {
            continue;
        }

        double testRadius = midPt.distance(testPt);
        if (testRadius < segRadius) {
            // double testDist = seg.distance(testPt);
            double testDist = testRadius;
            if (closestNonGabriel == null || testDist < minDist) {
                closestNonGabriel = testPt;
                minDist = testDist;
            }
        }
    }
    return closestNonGabriel;
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:51,代碼來源:ConformingDelaunayTriangulator.java

示例3: 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.expandBy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。