append( 6, out, "<SRS>"+ SRS +"</SRS>"); //$NON-NLS-1$ //$NON-NLS-2$
append( 4, out, "</SimpleFeatureType>" ); //$NON-NLS-1$
}
private static void writeLayer( ILayer layer, BufferedWriter out ) throws IOException {
Layer wmsLayer = layer.getResource( Layer.class, null );
WebMapServer wms = layer.getResource( WebMapServer.class, null );
WMSCapabilities caps = wms.getCapabilities();
String version = caps.getVersion();
String title = wms.getCapabilities().getService().getTitle();
int hidden = layer.isVisible() ? 1 : 0;
int info = layer.getInteraction(Interaction.INFO) ? 1 : 0;
String get = caps.getRequest().getGetCapabilities().getGet().toExternalForm();
System.out.println(get); if (get.endsWith("&")) get = get.substring(0,get.length()-1); //$NON-NLS-1$
append( 4, out, "<Layer hidden=\""+ hidden +"\" queryable=\""+info+"\">" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
append( 6, out, "<Server service=\"OGC:WMS\" title=\""+title+"\" version=\""+version+"\">" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
append( 8, out, "<OnlineResource method=\"GET\" xlink:href=\""+get+"\" xlink:type=\"simple\"/>" ); //$NON-NLS-1$ //$NON-NLS-2$
append( 6, out, "</Server>" ); //$NON-NLS-1$
append( 6, out, "<Name>"+wmsLayer.getName()+"</Name>"); //$NON-NLS-1$ //$NON-NLS-2$
append( 6, out, "<Title>"+wmsLayer.getTitle()+"</Title>"); //$NON-NLS-1$ //$NON-NLS-2$
if( !Double.isNaN( wmsLayer.getScaleHintMin() ))
append( 6, out, "<sld:MinScaleDenominator>"+wmsLayer.getScaleHintMin()+"</sld:MinScaleDenominator>"); //$NON-NLS-1$ //$NON-NLS-2$
if( !Double.isNaN( wmsLayer.getScaleHintMax() ))
append( 6, out, "<sld:MaxScaleDenominator>"+wmsLayer.getScaleHintMax()+"</sld:MaxScaleDenominator>"); //$NON-NLS-1$ //$NON-NLS-2$
for( String srs : (Set<String>) wmsLayer.getSrs() ){
append( 6, out, "<SRS>"+srs+"</SRS>"); //$NON-NLS-1$ //$NON-NLS-2$
}
append( 6, out, "<FormatList>"); //$NON-NLS-1$
boolean first = true; // TODO: look up preferences?
for( String format : caps.getRequest().getGetMap().getFormats() ){
if( first ){
append( 8, out, "<Format current=\"1\">"+format+"</Format>"); //$NON-NLS-1$ //$NON-NLS-2$
first = false;
}
append( 8, out, "<Format>"+format+"</Format>"); //$NON-NLS-1$ //$NON-NLS-2$
}
append( 6, out, "</FormatList>"); //$NON-NLS-1$
first = true; // TODO: look up on styleblackboard?
append( 6, out, "<StyleList>"); //$NON-NLS-1$
Object styles=wmsLayer.getStyles();
List list;
if( styles instanceof String )
list=Collections.singletonList(styles);
else if( styles instanceof List )
list=(List)styles;