本文整理汇总了Java中org.geotools.geometry.jts.ReferencedEnvelope.create方法的典型用法代码示例。如果您正苦于以下问题:Java ReferencedEnvelope.create方法的具体用法?Java ReferencedEnvelope.create怎么用?Java ReferencedEnvelope.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.geometry.jts.ReferencedEnvelope
的用法示例。
在下文中一共展示了ReferencedEnvelope.create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
@Override
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
Envelope envelope = (Envelope) super.parse(instance, node, value);
// handle the box CRS
CoordinateReferenceSystem crs = this.crs;
if (node.hasAttribute("srsName")) {
URI srs = (URI) node.getAttributeValue("srsName");
crs = CRS.decode(srs.toString());
}
if(crs != null) {
return ReferencedEnvelope.create(envelope, crs);
} else {
return envelope;
}
}
示例2: testSetWMSEnvVarValues
import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
/**
* Test method for
* {@link com.sldeditor.filter.v2.envvar.EnvironmentVariableManager#setWMSEnvVarValues(com.sldeditor.filter.v2.envvar.WMSEnvVarValues)}.
*/
@Test
public void testSetWMSEnvVarValues() {
EnvironmentVariableManager.getInstance().setWMSEnvVarValues(null);
WMSEnvVarValues wmsEnvVar = new WMSEnvVarValues();
wmsEnvVar.setImageHeight(42);
wmsEnvVar.setImageWidth(454);
Envelope envelope = new Envelope(1.0, 2.0, 50.0, 51.1);
ReferencedEnvelope mapBounds = ReferencedEnvelope.create(envelope,
CoordManager.getInstance().getWGS84());
wmsEnvVar.setMapBounds(mapBounds);
EnvironmentVariableManager.getInstance().setWMSEnvVarValues(wmsEnvVar);
// Update the values again
WMSEnvVarValues wmsEnvVar2 = new WMSEnvVarValues();
wmsEnvVar2.setImageHeight(69);
wmsEnvVar2.setImageWidth(123);
Envelope envelope2 = new Envelope(-1.0, -2.0, 50.0, 51.1);
ReferencedEnvelope mapBounds2 = ReferencedEnvelope.create(envelope2,
CoordManager.getInstance().getWGS84());
wmsEnvVar2.setMapBounds(mapBounds2);
EnvironmentVariableManager.getInstance().setWMSEnvVarValues(wmsEnvVar2);
}
示例3: exampleReferencedEnvelopeStaticMethods
import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
private void exampleReferencedEnvelopeStaticMethods() throws Exception {
// exampleReferencedEnvelopeStaticMethods start
ReferencedEnvelope env; // can hold both regular ReferencedEnvelope as well as ReferencedEnvelope3D
ReferencedEnvelope original = null; // can be instance of ReferencedEnvelope3D;
CoordinateReferenceSystem crs = null; //can be 2D or 3D
org.opengis.geometry.Envelope opengis_env = null; //can be instance of ReferencedEnvelope(3D)
com.vividsolutions.jts.geom.Envelope jts_env = null; //can be instance of ReferencedEnvelope(3D)
BoundingBox bbox = null; //can be instance of ReferencedEnvelope(3D)
//safely copy ReferencedEnvelope, uses type of original to determine type
env = ReferencedEnvelope.create( original );
//safely create ReferencedEnvelope from CRS, uses dimension to determine type
env = ReferencedEnvelope.create( crs );
//safely create ReferencedEnvelope from org.opengis.geometry.Envelope, uses dimension in Envelope to determine type
env = ReferencedEnvelope.create( opengis_env, crs );
//safely create ReferencedEnvelope from com.vividsolutions.jts.geom.Envelope, uses dimension in Envelope to determine type
env = ReferencedEnvelope.create( jts_env, crs );
//safely reference org.opengis.geometry.Envelope as ReferencedEnvelope
//--> if it is a ReferencedEnvelope(3D), simply cast it; if not, create a conversion
env = ReferencedEnvelope.reference ( opengis_env);
//safely reference com.vividsolutions.jts.geom.Envelope as ReferencedEnvelope
//--> if it is a ReferencedEnvelope(3D), simply cast it; if not, create a conversion
env = ReferencedEnvelope.reference ( jts_env);
//safely reference BoundingBox as ReferencedEnvelope
//--> if it is a ReferencedEnvelope(3D), simply cast it; if not, create a conversion
env = ReferencedEnvelope.reference ( bbox);
// exampleReferencedEnvelopeStaticMethods end
}
示例4: calculateBounds
import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
/**
* Calculate bounds.
*
* @return the referenced envelope
*/
private ReferencedEnvelope calculateBounds() {
ReferencedEnvelope bounds = null;
try {
bounds = featureList.getBounds();
if (bounds == null) {
// It could be that the above call was too costly!
bounds = featureList.getFeatures().getBounds();
}
if (bounds.getCoordinateReferenceSystem() == null) {
// We need a coordinate reference system set otherwise
// transformations fail to render
bounds = ReferencedEnvelope.create(bounds, DefaultGeographicCRS.WGS84);
}
if (bounds != null) {
Unit<?> unit = CRSUtilities
.getUnit(bounds.getCoordinateReferenceSystem().getCoordinateSystem());
double width;
double height;
if (unit == NonSI.DEGREE_ANGLE) {
width = (bounds.getWidth() < BOUNDINGBOX_BUFFER_THRESHOLD_ANGLE)
? BOUNDINGBOX_BUFFER_MIN_ANGLE
: (bounds.getWidth() * BOUNDINGBOX_BUFFER_ANGLE);
height = (bounds.getHeight() < BOUNDINGBOX_BUFFER_THRESHOLD_ANGLE)
? BOUNDINGBOX_BUFFER_MIN_ANGLE
: (bounds.getHeight() * BOUNDINGBOX_BUFFER_ANGLE);
} else {
width = (bounds.getWidth() < BOUNDINGBOX_BUFFER_THRESHOLD_LINEAR)
? BOUNDINGBOX_BUFFER_MIN_LINEAR
: (bounds.getWidth() * BOUNDINGBOX_BUFFER_LINEAR);
height = (bounds.getHeight() < BOUNDINGBOX_BUFFER_THRESHOLD_LINEAR)
? BOUNDINGBOX_BUFFER_MIN_LINEAR
: (bounds.getHeight() * BOUNDINGBOX_BUFFER_LINEAR);
}
bounds.expandBy(width, height);
}
} catch (IOException e) {
ConsoleManager.getInstance().exception(this, e);
}
return bounds;
}