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


Java ReferencedEnvelope.create方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:STEMLab,项目名称:geoserver-3d-extension,代码行数:18,代码来源:GMLBoxTypeBinding_ISO.java

示例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);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:30,代码来源:EnvironmentVariableManagerTest.java

示例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
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:36,代码来源:APIExamples.java

示例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;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:52,代码来源:RenderPanelImpl.java


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