Java Code Examples for org.geotools.geometry.jts.ReferencedEnvelope#create()

The following examples show how to use org.geotools.geometry.jts.ReferencedEnvelope#create() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RenderPanelImpl.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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) {
            expandEnvelope(bounds);
        }
    } catch (IOException e) {
        ConsoleManager.getInstance().exception(this, e);
    }
    return bounds;
}
 
Example 2
Source File: EnvironmentVariableManagerTest.java    From sldeditor with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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);
}
 
Example 3
Source File: MapRender.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the vector bounds.
 *
 * @param env the new vector bounds
 */
private void setVectorBounds(Envelope env) {
    ReferencedEnvelope refEnv =
            ReferencedEnvelope.create(
                    env, featureList.getSchema().getCoordinateReferenceSystem());
    wmsEnvVarValues.setMapBounds(refEnv);
}
 
Example 4
Source File: MapRender.java    From sldeditor with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Sets the raster bounds.
 *
 * @param env the new raster bounds
 */
private void setRasterBounds(Envelope env) {
    ReferencedEnvelope refEnv =
            ReferencedEnvelope.create(env, gridCoverage.getCoordinateReferenceSystem());
    wmsEnvVarValues.setMapBounds(refEnv);
}