-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GEOS-8581]: WMS GetCapabilities limited CRSs output boundingBoxes im…
…provements
- Loading branch information
1 parent
45bf1cb
commit a3fd16c
Showing
7 changed files
with
152 additions
and
20 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
...rc/main/java/org/geoserver/wms/capabilities/CapabilitiesTransformerProjectionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* (c) 2018 Open Source Geospatial Foundation - all rights reserved | ||
* This code is licensed under the GPL 2.0 license, available at the root | ||
* application directory. | ||
*/ | ||
package org.geoserver.wms.capabilities; | ||
|
||
import org.geotools.geometry.jts.ReferencedEnvelope; | ||
import org.geotools.renderer.crs.ProjectionHandler; | ||
import org.geotools.renderer.crs.ProjectionHandlerFinder; | ||
import org.opengis.geometry.MismatchedDimensionException; | ||
import org.opengis.referencing.FactoryException; | ||
import org.opengis.referencing.crs.CoordinateReferenceSystem; | ||
import org.opengis.referencing.operation.TransformException; | ||
|
||
/** | ||
* Extends ProjectionHandler in order to allow transforming a bbox into a | ||
* target CRS when generating the Capabilities, therefore dealing with | ||
* potential transformation exceptions due to domains out of validity. | ||
* | ||
*/ | ||
class CapabilitiesTransformerProjectionHandler extends ProjectionHandler { | ||
|
||
public CapabilitiesTransformerProjectionHandler(ProjectionHandler handler) | ||
throws FactoryException { | ||
super(handler.getSourceCRS(), handler.getValidAreaBounds(), handler.getRenderingEnvelope()); | ||
} | ||
|
||
@Override | ||
protected ReferencedEnvelope transformEnvelope(ReferencedEnvelope envelope, | ||
CoordinateReferenceSystem targetCRS) throws TransformException, FactoryException { | ||
return super.transformEnvelope(envelope, targetCRS); | ||
} | ||
|
||
/** | ||
* Create a CapabilitiesTransformerProjectionHandler for transformations from | ||
* sourceCrs to targetCrs. | ||
* | ||
* @param sourceCrs the source CoordinateReferenceSystem | ||
* @param targetCrs the target CoordinateReferenceSystem | ||
* @return a proper ProjectionHandler or null if unable to get one. | ||
* | ||
* @throws MismatchedDimensionException | ||
* @throws FactoryException | ||
*/ | ||
public static CapabilitiesTransformerProjectionHandler create( | ||
CoordinateReferenceSystem sourceCrs, CoordinateReferenceSystem targetCrs) | ||
throws MismatchedDimensionException, FactoryException { | ||
ProjectionHandler handler = ProjectionHandlerFinder | ||
.getHandler(new ReferencedEnvelope(targetCrs), sourceCrs, false); | ||
if (handler != null) { | ||
return new CapabilitiesTransformerProjectionHandler(handler); | ||
} | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.