%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.deegree.datatypes.QualifiedName" %>
<%@ page import="org.deegree.model.feature.Feature" %>
<%@ page import="org.deegree.model.feature.FeatureCollection" %>
<%@ page import="org.deegree.model.feature.FeatureProperty" %>
<%@ page import="org.deegree.model.feature.GMLFeatureCollectionDocument" %>
<%
FeatureCollection fc = null;
if ( request.getAttribute( "RESULT" ) instanceof GMLFeatureCollectionDocument ) {
GMLFeatureCollectionDocument gmlFcDoc =
(GMLFeatureCollectionDocument) request.getAttribute( "RESULT" );
fc = gmlFcDoc.parse();
} else if ( request.getAttribute( "RESULT" ) instanceof FeatureCollection ) {
fc = (FeatureCollection) request.getAttribute( "RESULT" );
}
%>
var select = parent.document.getElementById( "municipalityID" );
for ( i = select.options.length; i > 0 ; i--) {
select.removeChild( select[i-1] );
}
var opt = parent.document.createElement('option');
var text = parent.document.createTextNode('... select');
opt.appendChild( text );
opt.setAttribute( 'value', 'dummy|...' );
select.appendChild( opt );
<%
String geoId = null;
for ( int i = 0; i < fc.size(); i++) {
Feature feat = fc.getFeature( i );
FeatureProperty[] fps = feat.getProperties();
for ( int j = 0; j < fps.length; j++ ) {
QualifiedName geoIdProp =
new QualifiedName( "geographicIdentifier", fps[j].getName().getNamespace() );
if ( geoIdProp.equals( fps[j].getName() ) ) {
geoId = (String) fps[j].getValue();
}
}
%>
opt = parent.document.createElement('option');
text = parent.document.createTextNode( '<%=geoId %>' );
opt.appendChild( text );
opt.setAttribute( 'value', '<%=geoId %>' );
select.appendChild( opt );
<%
}
%>
parent.setMessage('');