int layerType = mapLayerInfo.getType();
if (layerType == MapLayerInfo.TYPE_REMOTE_VECTOR) {
final SimpleFeatureSource source = mapLayerInfo.getRemoteFeatureSource();
FeatureLayer featureLayer = new FeatureLayer(source, layerStyle);
featureLayer.setTitle(mapLayerInfo.getRemoteFeatureSource().getSchema().getTypeName());
final Query definitionQuery = new Query(source.getSchema().getTypeName());
definitionQuery.setFilter(layerFilter);
definitionQuery.setVersion(featureVersion);
int maxFeatures = request.getMaxFeatures() != null ? request.getMaxFeatures()
: Integer.MAX_VALUE;
definitionQuery.setMaxFeatures(maxFeatures);
featureLayer.setQuery(definitionQuery);
mapContent.addLayer(featureLayer);
layer = featureLayer;
} else if (layerType == MapLayerInfo.TYPE_VECTOR) {
FeatureSource<? extends FeatureType, ? extends Feature> source;
// /////////////////////////////////////////////////////////
//
// Adding a feature layer
//
// /////////////////////////////////////////////////////////
try {
source = mapLayerInfo.getFeatureSource(true);
// NOTE for the feature. Here there was some code that
// sounded like:
// * get the bounding box from feature source
// * eventually reproject it to the actual CRS used for
// map
// * if no intersection, don't bother adding the feature
// source to the map
// This is not an optimization, on the contrary,
// computing the bbox may be
// very expensive depending on the data size. Using
// sigma.openplans.org data
// and a tiled client like OpenLayers, it dragged the
// server to his knees
// and the client simply timed out
} catch (IOException exp) {
if (LOGGER.isLoggable(Level.SEVERE)) {
LOGGER.log(Level.SEVERE, new StringBuffer("Getting feature source: ")
.append(exp.getMessage()).toString(), exp);
}
throw new ServiceException("Internal error", exp);
}
FeatureLayer featureLayer = new FeatureLayer(source, layerStyle);
featureLayer.setTitle(mapLayerInfo.getFeature().prefixedName());
featureLayer.getUserData().put("abstract", mapLayerInfo.getDescription());
// mix the dimension related filter with the layer filter
Filter dimensionFilter = wms.getTimeElevationToFilter(times, elevations, mapLayerInfo.getFeature());
Filter filter = Filters.and(ff, layerFilter, dimensionFilter);
final Query definitionQuery = new Query(source.getSchema().getName().getLocalPart());
definitionQuery.setVersion(featureVersion);
definitionQuery.setFilter(filter);
if (viewParams != null) {
definitionQuery.setHints(new Hints(Hints.VIRTUAL_TABLE_PARAMETERS, viewParams.get(i)));
}
// check for startIndex + offset
final Integer startIndex = request.getStartIndex();
if (startIndex != null) {
QueryCapabilities queryCapabilities = source.getQueryCapabilities();
if (queryCapabilities.isOffsetSupported()) {
// fsource is required to support
// SortBy.NATURAL_ORDER so we don't bother checking
definitionQuery.setStartIndex(startIndex);
} else {
// source = new PagingFeatureSource(source,
// request.getStartIndex(), limit);
throw new ServiceException("startIndex is not supported for the "
+ mapLayerInfo.getName() + " layer");
}
}
int maxFeatures = request.getMaxFeatures() != null ? request.getMaxFeatures()
: Integer.MAX_VALUE;
definitionQuery.setMaxFeatures(maxFeatures);
featureLayer.setQuery(definitionQuery);
mapContent.addLayer(featureLayer);
layer = featureLayer;
} else if (layerType == MapLayerInfo.TYPE_RASTER) {