30 |
package skrueger.geotools; |
package skrueger.geotools; |
31 |
|
|
32 |
import java.util.HashMap; |
import java.util.HashMap; |
33 |
|
import java.util.LinkedHashSet; |
34 |
import java.util.List; |
import java.util.List; |
|
import java.util.Vector; |
|
35 |
|
|
36 |
import org.apache.log4j.Logger; |
import org.apache.log4j.Logger; |
37 |
import org.geotools.data.DefaultQuery; |
import org.geotools.data.DefaultQuery; |
126 |
this.filter = filter; |
this.filter = filter; |
127 |
this.amdMap = amdm; |
this.amdMap = amdm; |
128 |
this.amdMapVisibleOnly = amdMap.sortedValuesVisibleOnly(); |
this.amdMapVisibleOnly = amdMap.sortedValuesVisibleOnly(); |
129 |
|
|
130 |
FeatureCollection<SimpleFeatureType, SimpleFeature> fc = null; |
FeatureCollection<SimpleFeatureType, SimpleFeature> fc = null; |
131 |
if (fs != null) { |
if (fs != null) { |
132 |
|
|
135 |
final SimpleFeatureType schema = fs.getSchema(); |
final SimpleFeatureType schema = fs.getSchema(); |
136 |
Query query = new DefaultQuery(schema.getTypeName(), filter); |
Query query = new DefaultQuery(schema.getTypeName(), filter); |
137 |
if (amdm != null) { |
if (amdm != null) { |
138 |
Vector<String> visibleAttrNames = new Vector<String>(); |
LinkedHashSet<String> visibleAttrNames = new LinkedHashSet<String>(); |
139 |
|
|
140 |
// Add the column with the geometry (usually "the_geom") always |
// Add the column with the geometry (usually "the_geom") always |
141 |
visibleAttrNames.add(schema.getGeometryDescriptor() |
String geomColumnLocalName = schema.getGeometryDescriptor() |
142 |
.getLocalName()); |
.getLocalName(); |
143 |
|
visibleAttrNames.add(geomColumnLocalName); |
144 |
|
|
145 |
// Add other visible attributes as ordered by weights |
// Add other visible attributes as ordered by weights |
146 |
for (AttributeMetadataInterface a : amdMapVisibleOnly) { |
for (AttributeMetadataInterface a : amdMapVisibleOnly) { |
159 |
// } else { |
// } else { |
160 |
// query = new DefaultQuery(schema.getTypeName(), filter); |
// query = new DefaultQuery(schema.getTypeName(), filter); |
161 |
// } |
// } |
162 |
|
|
163 |
|
System.out.println(query.getPropertyNames()); |
164 |
} |
} |
165 |
fc = fs.getFeatures(query); |
fc = fs.getFeatures(query); |
166 |
} |
} |