File |
Line |
org/deegree/services/wms/controller/capabilities/WmsCapabilities111LegacyWriter.java |
176 |
org/deegree/services/wms/controller/capabilities/WmsCapabilities130LegacyWriter.java |
177 |
writer.writeNamespace( XLINK_PREFIX, XLNNS );
writer.writeAttribute( XLNNS, "type", "simple" );
writer.writeAttribute( XLNNS, "href", mdUrl );
writer.writeEndElement();
writer.writeEndElement();
}
}
private String getMetadataUrl( Layer layer ) {
String mdUrl = null;
if ( layer.getName() != null && metadata != null ) {
DatasetMetadata dsMd = metadata.getDatasetMetadata( new QName( layer.getName() ) );
if ( dsMd != null ) {
mdUrl = dsMd.getUrl();
}
}
if ( mdUrl == null && controller.getMetadataURLTemplate() != null ) {
String id = layer.getDataMetadataSetId();
if ( id == null ) {
return null;
}
String mdurlTemplate = controller.getMetadataURLTemplate();
if ( mdurlTemplate.isEmpty() ) {
mdurlTemplate = getUrl;
if ( !( mdurlTemplate.endsWith( "?" ) || mdurlTemplate.endsWith( "&" ) ) ) {
mdurlTemplate += "?";
}
mdurlTemplate += "service=CSW&request=GetRecordById&version=2.0.2&outputSchema=http://www.isotc211.org/2005/gmd&elementSetName=full&id=${metadataSetId}";
}
mdUrl = StringUtils.replaceAll( mdurlTemplate, "${metadataSetId}", id );
}
return mdUrl;
}
private void writeStyles( XMLStreamWriter writer, Layer layer )
throws XMLStreamException {
Style def = service.getStyles().get( layer.getName(), null );
if ( def != null ) {
if ( def.getName() != null && !def.getName().isEmpty() ) {
capWriter.writeStyle( writer, "default", def.getName(), service.getLegendSize( def ), layer.getName(),
def ); // TODO
// title/description/whatever
} else {
capWriter.writeStyle( writer, "default", "default", service.getLegendSize( def ), layer.getName(), def ); // TODO
// title/description/whatever
}
}
HashSet<Style> visited = new HashSet<Style>();
for ( Style s : service.getStyles().getAll( layer.getName() ) ) {
if ( visited.contains( s ) ) {
continue;
}
visited.add( s );
String name = s.getName();
if ( name != null && !name.isEmpty() ) {
capWriter.writeStyle( writer, name, name, service.getLegendSize( s ), layer.getName(), s ); // TODO
// title/description/whatever
}
}
}
private void writeScaleHints( XMLStreamWriter writer, Layer layer )
throws XMLStreamException {
DoublePair hint = layer.getScaleHint();
if ( hint.first != NEGATIVE_INFINITY || hint.second != POSITIVE_INFINITY ) { |
File |
Line |
org/deegree/services/wms/controller/capabilities/WmsCapabilities111ThemeWriter.java |
169 |
org/deegree/services/wms/controller/capabilities/WmsCapabilities130ThemeWriter.java |
167 |
writeElement( writer, "Keyword", ls.getString() );
}
writer.writeEndElement();
}
}
private void writeMetadataUrls( XMLStreamWriter writer, Theme theme )
throws XMLStreamException {
String id = null, name = null;
inner: for ( org.deegree.layer.Layer l : theme.getLayers() ) {
if ( l.getMetadata().getName() != null ) {
name = l.getMetadata().getName();
}
if ( l.getMetadata().getMetadataId() != null ) {
id = l.getMetadata().getMetadataId();
break inner;
}
}
writeMetadataFromProvider( writer, name );
if ( controller.getMetadataURLTemplate() != null ) {
String mdurlTemplate = controller.getMetadataURLTemplate();
if ( mdurlTemplate.isEmpty() ) {
mdurlTemplate = getUrl;
if ( !( mdurlTemplate.endsWith( "?" ) || mdurlTemplate.endsWith( "&" ) ) ) {
mdurlTemplate += "?";
}
mdurlTemplate += "service=CSW&request=GetRecordById&version=2.0.2&outputSchema=http%3A//www.isotc211.org/2005/gmd&elementSetName=full&id=${metadataSetId}";
}
if ( id != null ) {
writeMetadataUrl( writer, StringUtils.replaceAll( mdurlTemplate, "${metadataSetId}", id ) );
}
}
}
// please note that this does NOT support writing of description metadata at the moment!
private void writeMetadataFromProvider( XMLStreamWriter writer, String name )
throws XMLStreamException {
if ( name == null || metadata == null ) {
return;
}
Map<String, String> auths = metadata.getExternalMetadataAuthorities();
DatasetMetadata md = metadata.getDatasetMetadata( new QName( name ) );
if ( md != null ) {
for ( StringPair ext : md.getExternalUrls() ) {
String url = auths.get( ext.first );
writer.writeStartElement( "AuthorityURL" ); |
File |
Line |
org/deegree/services/wms/controller/capabilities/Capabilities111XMLAdapter.java |
164 |
org/deegree/services/wms/controller/capabilities/Capabilities130XMLAdapter.java |
195 |
writeElement( writer, "Title", "Root" );
// TODO think about a push approach instead of a pull approach
LayerMetadata lmd = null;
for ( Theme t : themes ) {
for ( org.deegree.layer.Layer l : Themes.getAllLayers( t ) ) {
if ( lmd == null ) {
lmd = l.getMetadata();
} else {
lmd.merge( l.getMetadata() );
}
}
}
if ( lmd != null ) {
SpatialMetadata smd = lmd.getSpatialMetadata();
writeSrsAndEnvelope( writer, smd.getCoordinateSystems(), smd.getEnvelope() );
}
for ( Theme t : themes ) {
themeWriter.writeTheme( writer, t );
}
writer.writeEndElement();
}
}
static void writeDimensions( XMLStreamWriter writer, Map<String, Dimension<?>> dims )
throws XMLStreamException {
for ( Entry<String, Dimension<?>> entry : dims.entrySet() ) { |
File |
Line |
org/deegree/services/wms/controller/capabilities/WmsCapabilities111ThemeWriter.java |
256 |
org/deegree/services/wms/controller/capabilities/WmsCapabilities130ThemeWriter.java |
256 |
private void writeStyles( XMLStreamWriter writer, LayerMetadata md )
throws XMLStreamException {
Map<String, Style> legends = md.getLegendStyles();
for ( Entry<String, Style> e : md.getStyles().entrySet() ) {
if ( e.getKey() == null || e.getKey().isEmpty() ) {
continue;
}
Style ls = e.getValue();
if ( legends.get( e.getKey() ) != null ) {
ls = legends.get( e.getKey() );
}
Pair<Integer, Integer> p = new Legends().getLegendSize( ls );
capWriter.writeStyle( writer, e.getKey(), e.getKey(), p, md.getName(), e.getValue() );
}
}
private void writeScaleDenominators( XMLStreamWriter writer, LayerMetadata md, Theme theme ) |
File |
Line |
org/deegree/services/wms/model/layers/StatisticsLayer.java |
161 |
org/deegree/services/wms/model/layers/StatisticsLayer.java |
221 |
GenericFeatureCollection col = new GenericFeatureCollection();
for ( ComparablePair<Long, String> req : FrontControllerStats.getKVPRequests() ) {
if ( req.second.toUpperCase().indexOf( "REQUEST=GETMAP" ) != -1 ) {
String srs = null;
try {
Map<String, String> map = KVPUtils.getNormalizedKVPMap( req.second, "UTF-8" );
if ( map.get( "LAYERS" ).equals( "statistics" ) ) {
continue;
}
double[] vals = splitAsDoubles( map.get( "BBOX" ), "," );
srs = map.get( "SRS" );
Envelope box = fac.createEnvelope( vals[0], vals[1], vals[2], vals[3], CRSManager.lookup( srs ) );
if ( !box.intersects( fi.getClickBox() ) ) { |
File |
Line |
org/deegree/services/wms/controller/capabilities/WmsCapabilities111MetadataWriter.java |
183 |
org/deegree/services/wms/controller/capabilities/WmsCapabilities130MetadataWriter.java |
187 |
writeServiceProvider( writer );
writer.writeEndElement();
}
private String getServiceUrl() {
String url = getUrl;
if ( provider != null && provider.getServiceContact() != null
&& provider.getServiceContact().getContactInfo() != null
&& provider.getServiceContact().getContactInfo().getOnlineResource() != null ) {
url = provider.getServiceContact().getContactInfo().getOnlineResource().toExternalForm();
}
return url;
}
private void writeKeywords( XMLStreamWriter writer )
throws XMLStreamException {
List<Pair<List<LanguageString>, CodeType>> keywords = identification == null ? null
: identification.getKeywords();
if ( keywords != null && !keywords.isEmpty() ) {
writer.writeStartElement( "KeywordList" ); |
File |
Line |
org/deegree/services/wms/model/layers/StatisticsLayer.java |
173 |
org/deegree/services/wms/model/layers/StatisticsLayer.java |
234 |
if ( !box.intersects( fi.getClickBox() ) ) {
continue;
}
List<Property> props = new ArrayList<Property>();
props.add( new SimpleProperty( queryProp, req.second ) );
props.add( new SimpleProperty( timeProp, formatDateTime( new Date( req.first ) ) ) );
props.add( new GenericProperty( boxProp, box ) );
GenericFeature f = new GenericFeature( featureType, null, props, null );
try {
if ( filter.first != null && !filter.first.evaluate( f, evaluator ) ) {
continue;
}
} catch ( FilterEvaluationException e ) {
LOG.debug( "Filter could not be evaluated: '{}'", e.getLocalizedMessage() );
LOG.trace( "Stack trace:", e );
} |
File |
Line |
org/deegree/services/wms/controller/ops/GetFeatureInfo.java |
343 |
org/deegree/services/wms/controller/ops/GetMap.java |
673 |
String box = map.get( "BBOX" );
if ( box == null || box.trim().isEmpty() ) {
throw new OWSException( get( "WMS.PARAM_MISSING", "BBOX" ), OWSException.MISSING_PARAMETER_VALUE );
}
double[] vals = splitAsDoubles( box, "," );
if ( vals.length != 4 ) {
throw new OWSException( get( "WMS.BBOX_WRONG_FORMAT", box ), OWSException.INVALID_PARAMETER_VALUE );
}
if ( vals[2] <= vals[0] ) {
throw new OWSException( get( "WMS.MAXX_MINX" ), OWSException.INVALID_PARAMETER_VALUE );
}
if ( vals[3] <= vals[1] ) {
throw new OWSException( get( "WMS.MAXY_MINY" ), OWSException.INVALID_PARAMETER_VALUE );
} |
File |
Line |
org/deegree/services/wms/controller/ops/GetFeatureInfo.java |
265 |
org/deegree/services/wms/controller/ops/GetMap.java |
388 |
String w = map.get( "WIDTH" );
if ( w == null ) {
throw new OWSException( get( "WMS.PARAM_MISSING", "WIDTH" ), OWSException.MISSING_PARAMETER_VALUE );
}
try {
width = parseInt( w );
} catch ( NumberFormatException e ) {
throw new OWSException( get( "WMS.NOT_A_NUMBER", "WIDTH", w ), OWSException.INVALID_PARAMETER_VALUE );
}
String h = map.get( "HEIGHT" );
if ( h == null ) {
throw new OWSException( get( "WMS.PARAM_MISSING", "HEIGHT" ), OWSException.MISSING_PARAMETER_VALUE );
}
try {
height = parseInt( h );
} catch ( NumberFormatException e ) {
throw new OWSException( get( "WMS.NOT_A_NUMBER", "HEIGHT", h ), OWSException.INVALID_PARAMETER_VALUE );
} |
File |
Line |
org/deegree/services/wms/controller/capabilities/WmsCapabilities111ThemeWriter.java |
272 |
org/deegree/services/wms/controller/capabilities/WmsCapabilities130ThemeWriter.java |
272 |
private void writeScaleDenominators( XMLStreamWriter writer, LayerMetadata md, Theme theme )
throws XMLStreamException {
DoublePair hint = md.getScaleDenominators();
// use layers' settings only if not set for theme
if ( hint.first.isInfinite() && hint.second.isInfinite() ) {
hint = new DoublePair( hint.second, hint.first );
for ( org.deegree.layer.Layer l : theme.getLayers() ) {
hint.first = Math.min( l.getMetadata().getScaleDenominators().first, hint.first );
hint.second = Math.max( l.getMetadata().getScaleDenominators().second, hint.second );
}
}
if ( !hint.first.isInfinite() || !hint.second.isInfinite() ) { |
File |
Line |
org/deegree/services/wms/controller/capabilities/WmsCapabilities111ThemeWriter.java |
160 |
org/deegree/services/wms/controller/capabilities/WmsCapabilities130ThemeWriter.java |
158 |
private void writeKeywords( XMLStreamWriter writer, LayerMetadata md, LayerMetadata lmd )
throws XMLStreamException {
List<Pair<List<LanguageString>, CodeType>> kws = md.getDescription().getKeywords();
if ( lmd != null && ( kws == null || kws.isEmpty() || kws.get( 0 ).first.isEmpty() ) ) {
kws = lmd.getDescription().getKeywords();
}
if ( kws != null && !kws.isEmpty() && !kws.get( 0 ).first.isEmpty() ) {
writer.writeStartElement( "KeywordList" ); |