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


Java ReferencedEnvelope.include方法代码示例

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


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

示例1: exampleReferencedEnvelope

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
private void exampleReferencedEnvelope() throws Exception {
    // exampleReferencedEnvelope start
    ReferencedEnvelope envelope = new ReferencedEnvelope(0, 10, 0, 20, DefaultGeographicCRS.WGS84);
    
    double xMin = envelope.getMinX();
    double yMin = envelope.getMinY();
    
    double xMax = envelope.getMaxX();
    double yMax = envelope.getMaxY();
    
    double width = envelope.getWidth();
    double height = envelope.getHeight();
    
    double xCenter = envelope.getMedian(0);
    double yCenter = envelope.getMedian(1);
    
    CoordinateReferenceSystem crs = envelope.getCoordinateReferenceSystem();
    int dimension = envelope.getDimension();
    
    // Direct access to internal upper and lower positions
    DirectPosition lower = envelope.getLowerCorner();
    DirectPosition upper = envelope.getUpperCorner();
    
    // expand to include 15, 30
    envelope.include(15, 30);
    
    envelope.isEmpty(); // check if storing width and height are 0
    
    envelope.isNull(); // check if "null" (not storing anything)
    envelope.setToNull();
    
    // exampleReferencedEnvelope end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:34,代码来源:APIExamples.java

示例2: getBoundsInternal

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
/**
 * Implementation that generates the total bounds
 * (many file formats record this information in the header)
 */
protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException {
    ReferencedEnvelope bounds = new ReferencedEnvelope( getSchema().getCoordinateReferenceSystem() );
    
    FeatureReader<SimpleFeatureType, SimpleFeature> featureReader = getReaderInternal(query);
    try {
        while( featureReader.hasNext() ){
            SimpleFeature feature = featureReader.next();
            bounds.include( feature.getBounds() );
        }
    }
    finally {
        featureReader.close();
    }
    return bounds;
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:20,代码来源:CSVFeatureSource.java

示例3: modify

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
/**
 * Record a modification to the indicated fid
 * 
 * @param fid
 * @param original
 *            the original feature(prior state)
 * @param updated
 *            the update feature replacement feature; null to indicate
 *            remove
 */
public void modify(
		String fid,
		SimpleFeature original,
		SimpleFeature updated )
		throws IOException {
	// point move?
	if (!updated.getBounds().equals(
			original.getBounds())) {
		this.components.remove(
				original,
				this);
		this.components.writeCommit(
				updated,
				new GeoWaveEmptyTransaction(
						components));
	}
	else {
		this.components.writeCommit(
				updated,
				new GeoWaveEmptyTransaction(
						components));
	}

	ReferencedEnvelope bounds = new ReferencedEnvelope();
	bounds.include(updated.getBounds());
	bounds.include(original.getBounds());
	this.components.getGTstore().getListenerManager().fireFeaturesChanged(
			updated.getFeatureType().getTypeName(),
			Transaction.AUTO_COMMIT,
			bounds,
			true);

}
 
开发者ID:locationtech,项目名称:geowave,代码行数:44,代码来源:GeoWaveEmptyTransaction.java

示例4: convertPolygonToWKT

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
private static String convertPolygonToWKT(String text) {
    String[] sep = text.split(" ");
    String[] seperators = new String[TWO];
    seperators[ZERO] = ",";
    seperators[ONE] = ".";
    //cleaning the strings if they have trailing or beginning , or .
    for (int i = 0; i < sep.length; i++) {
        String aSep = sep[i];
        for (String seperator: seperators) {
            if (aSep.contains(seperator)) {
                if (aSep.lastIndexOf(seperator) == aSep.length() - 1) {
                    aSep = aSep.substring(ZERO,
                            aSep.lastIndexOf(seperator));

                }
                if (aSep.indexOf(seperator) == ZERO) {
                    aSep = aSep.substring(ONE, aSep.length());
                }
            }
        }
        sep[i] = aSep;
    }
    //Check for length. If Only Two Pairs are in there, calculate the Box
    //of it.
    if (sep.length == FOUR) {
        ReferencedEnvelope ref = new ReferencedEnvelope();
        ref.include(Double.parseDouble(sep[ZERO]),
                Double.parseDouble(sep[ONE]));
        ref.include(Double.parseDouble(sep[TWO]),
                Double.parseDouble(sep[THREE]));
        Double maxX = ref.getMaxX();
        Double minX = ref.getMinX();
        Double maxY = ref.getMaxY();
        Double minY = ref.getMinY();
        sep = new String[TEN];
        //Upper Left
        sep[ZERO] = String.valueOf(minX);
        sep[ONE] = String.valueOf(maxY);
        //Upper Right
        sep[TWO] = String.valueOf(maxX);
        sep[THREE] = String.valueOf(maxY);
        //Lower Right
        sep[FOUR] = String.valueOf(maxX);
        sep[FIVE] = String.valueOf(minY);
        //Lower Left
        sep[SIX] = String.valueOf(minX);
        sep[SEVEN] = String.valueOf(minY);
        //Upper Right
        sep[EIGHT] = sep[ZERO];
        sep[NINE] = sep[ONE];
    }
    StringBuilder sb = new StringBuilder("POLYGON((");
    for (int j = 0; j < sep.length; j += 2) {
        if (j > 0) {
            sb.append(", ");
        }
        sb.append(sep[j]).append(' ').append(sep[j + 1]);
    }
    return sb.append("))").toString();
}
 
开发者ID:gdi-by,项目名称:downloadclient,代码行数:61,代码来源:Atom.java

示例5: convertAndDisplayBoundingBox

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
private void convertAndDisplayBoundingBox(
        Double x1,
        Double x2,
        Double y1,
        Double y2,
        CoordinateReferenceSystem sourceCRS,
        CoordinateReferenceSystem targetCRS
) throws TransformException, FactoryException {
    com.vividsolutions.jts.geom.Point p1 = convertDoublesToPoint(
            x1,
            y1,
            sourceCRS,
            targetCRS);
    com.vividsolutions.jts.geom.Point p2 = convertDoublesToPoint(
            x2,
            y2,
            sourceCRS,
            targetCRS);
    ReferencedEnvelope re = new ReferencedEnvelope(targetCRS);
    re.include(p1.getX(), p1.getY());
    re.include(p2.getX(), p2.getY());
    DirectPosition lowerCorner = re.getLowerCorner();
    DirectPosition upperCorner = re.getUpperCorner();
    if (lowerCorner != null && upperCorner != null) {
        double valX1 = lowerCorner.getCoordinate()[0];
        double valY1 = lowerCorner.getCoordinate()[1];
        double valX2 = upperCorner.getCoordinate()[0];
        double valY2 = upperCorner.getCoordinate()[1];
        if (CRS.getProjectedCRS(targetCRS) == null) {
            this.coordinateX1TextField.setText(String.valueOf(
                    Math.round(valX1 * HOUNDREDTHOUSAND) / HOUNDREDTHOUSAND
            ));
            this.coordinateY1TextField.setText(String.valueOf(
                    Math.round(valY1 * HOUNDREDTHOUSAND) / HOUNDREDTHOUSAND
            ));
            this.coordinateX2TextField.setText(String.valueOf(
                    Math.round(valX2 * HOUNDREDTHOUSAND) / HOUNDREDTHOUSAND
            ));
            this.coordinateY2TextField.setText(String.valueOf(
                    Math.round(valY2 * HOUNDREDTHOUSAND) / HOUNDREDTHOUSAND
            ));
        } else {
            this.coordinateX1TextField.setText(String.valueOf(
                    Math.round((float) valX1)
            ));
            this.coordinateY1TextField.setText(String.valueOf(
                    Math.round((float) valY1)
            ));
            this.coordinateX2TextField.setText(String.valueOf(
                    Math.round((float) valX2)
            ));
            this.coordinateY2TextField.setText(String.valueOf(
                    Math.round((float) valY2)
            ));
        }
    }
}
 
开发者ID:gdi-by,项目名称:downloadclient,代码行数:58,代码来源:WMSMapSwing.java

示例6: commit

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
public void commit()
		throws IOException {

	flushAddsToStore(true);

	final Iterator<Pair<SimpleFeature, SimpleFeature>> updateIt = getUpdates();

	// if (addedFidList.size() > 0) {
	// final String transId = "\\(?" + txID + "\\)?";
	// final VisibilityTransformer visibilityTransformer = new
	// VisibilityTransformer(
	// "&?" + transId,
	// "");
	// for (final Collection<ByteArrayId> rowIDs : addedFidList.values()) {
	// components.replaceDataVisibility(
	// this,
	// rowIDs,
	// visibilityTransformer);
	// }
	//
	// components.replaceStatsVisibility(
	// this,
	// visibilityTransformer);
	// }

	final Iterator<SimpleFeature> removeIt = removedFeatures.values().iterator();

	while (removeIt.hasNext()) {
		final SimpleFeature delFeatured = removeIt.next();
		components.remove(
				delFeatured,
				this);
		final ModifiedFeature modFeature = modifiedFeatures.get(delFeatured.getID());
		// only want notify updates to existing (not new) features
		if ((modFeature == null) || modFeature.alreadyWritten) {
			components.getGTstore().getListenerManager().fireFeaturesRemoved(
					typeName,
					transaction,
					ReferencedEnvelope.reference(delFeatured.getBounds()),
					true);
		}
	}

	while (updateIt.hasNext()) {
		final Pair<SimpleFeature, SimpleFeature> pair = updateIt.next();
		components.writeCommit(
				pair.getRight(),
				new GeoWaveEmptyTransaction(
						components));
		final ReferencedEnvelope bounds = new ReferencedEnvelope(
				(CoordinateReferenceSystem) null);
		bounds.include(pair.getLeft().getBounds());
		bounds.include(pair.getRight().getBounds());
		components.getGTstore().getListenerManager().fireFeaturesChanged(
				typeName,
				transaction,
				ReferencedEnvelope.reference(pair.getRight().getBounds()),
				true);
	}

	statsCache = null;

}
 
开发者ID:locationtech,项目名称:geowave,代码行数:64,代码来源:GeoWaveTransactionManagement.java

示例7: getBoundsInternal

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
/**
 * Implementation that generates the total bounds
 */
@Override
protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException {
    LOGGER.fine("getBoundsInternal");
    final CoordinateReferenceSystem crs = getSchema().getCoordinateReferenceSystem();
    final ReferencedEnvelope bounds = new ReferencedEnvelope(crs);

    try (FeatureReader<SimpleFeatureType, SimpleFeature> featureReader = getReaderInternal(query)) {
        while (featureReader.hasNext()) {
            final SimpleFeature feature = featureReader.next();
            bounds.include(feature.getBounds());
        }
    }
    return bounds;
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:18,代码来源:ElasticFeatureSource.java


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