Search in sources :

Example 1 with GetBoundsResponse

use of org.polymap.core.data.feature.GetBoundsResponse in project polymap4-core by Polymap4.

the class RasterRenderProcessor method getBoundsRequest.

@Override
public void getBoundsRequest(GetBoundsRequest request, ProcessorContext context) throws Exception {
    GeneralEnvelope envelope = reader.getOriginalEnvelope();
    if (envelope != null) {
        context.sendResponse(new GetBoundsResponse(new ReferencedEnvelope(envelope)));
        return;
    }
    CoordinateReferenceSystem crs = reader.getCoordinateReferenceSystem();
    if (crs != null) {
        context.sendResponse(new GetBoundsResponse(new ReferencedEnvelope(crs)));
        return;
    }
    throw new IllegalStateException("No bounds founds.");
}
Also used : ReferencedEnvelope(org.geotools.geometry.jts.ReferencedEnvelope) GetBoundsResponse(org.polymap.core.data.feature.GetBoundsResponse) CoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem) GeneralEnvelope(org.geotools.geometry.GeneralEnvelope)

Example 2 with GetBoundsResponse

use of org.polymap.core.data.feature.GetBoundsResponse in project polymap4-core by Polymap4.

the class WmsRenderProcessor method getBoundsRequest.

@Override
public void getBoundsRequest(GetBoundsRequest request, ProcessorContext context) throws Exception {
    List<CRSEnvelope> bboxes = layer.getLayerBoundingBoxes();
    // log.info( "BBOXES: " + bboxes );
    ReferencedEnvelope result = new ReferencedEnvelope(FluentIterable.from(bboxes).first().get());
    context.sendResponse(new GetBoundsResponse(result));
}
Also used : ReferencedEnvelope(org.geotools.geometry.jts.ReferencedEnvelope) CRSEnvelope(org.geotools.data.ows.CRSEnvelope) GetBoundsResponse(org.polymap.core.data.feature.GetBoundsResponse)

Example 3 with GetBoundsResponse

use of org.polymap.core.data.feature.GetBoundsResponse in project polymap4-core by Polymap4.

the class PipelineFeatureSource method getBoundsInternal.

@Override
@SuppressWarnings("hiding")
protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException {
    try {
        GetBoundsRequest request = new GetBoundsRequest(query);
        AtomicReference<ReferencedEnvelope> result = new AtomicReference();
        newExecutor().execute(pipeline, request, (GetBoundsResponse r) -> {
            result.set(r.bounds.get());
        });
        return result.get();
    } catch (Exception e) {
        Throwables.propagateIfInstanceOf(e, IOException.class);
        throw Throwables.propagate(e);
    }
}
Also used : ReferencedEnvelope(org.geotools.geometry.jts.ReferencedEnvelope) GetBoundsRequest(org.polymap.core.data.feature.GetBoundsRequest) AtomicReference(java.util.concurrent.atomic.AtomicReference) GetBoundsResponse(org.polymap.core.data.feature.GetBoundsResponse) IOException(java.io.IOException) IOException(java.io.IOException)

Aggregations

ReferencedEnvelope (org.geotools.geometry.jts.ReferencedEnvelope)3 GetBoundsResponse (org.polymap.core.data.feature.GetBoundsResponse)3 IOException (java.io.IOException)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 CRSEnvelope (org.geotools.data.ows.CRSEnvelope)1 GeneralEnvelope (org.geotools.geometry.GeneralEnvelope)1 CoordinateReferenceSystem (org.opengis.referencing.crs.CoordinateReferenceSystem)1 GetBoundsRequest (org.polymap.core.data.feature.GetBoundsRequest)1