/[schmitzm]/trunk/src/skrueger/geotools/StyledFeatureCollectionTableModel.java
ViewVC logotype

Diff of /trunk/src/skrueger/geotools/StyledFeatureCollectionTableModel.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 332 by alfonx, Wed Aug 26 17:15:49 2009 UTC revision 341 by alfonx, Mon Aug 31 10:16:40 2009 UTC
# Line 39  import org.geotools.data.FeatureSource; Line 39  import org.geotools.data.FeatureSource;
39  import org.geotools.data.Query;  import org.geotools.data.Query;
40  import org.geotools.data.memory.MemoryDataStore;  import org.geotools.data.memory.MemoryDataStore;
41  import org.geotools.feature.FeatureCollection;  import org.geotools.feature.FeatureCollection;
42    import org.opengis.feature.simple.SimpleFeature;
43    import org.opengis.feature.simple.SimpleFeatureType;
44  import org.opengis.feature.type.AttributeDescriptor;  import org.opengis.feature.type.AttributeDescriptor;
45  import org.opengis.filter.Filter;  import org.opengis.filter.Filter;
46    
# Line 140  public class StyledFeatureCollectionTabl Line 142  public class StyledFeatureCollectionTabl
142           *            {@link AttributeMetaData}-Map to define the visible attributes           *            {@link AttributeMetaData}-Map to define the visible attributes
143           *            and translation           *            and translation
144           */           */
145          protected void setFeatureSource(FeatureSource fs,          protected void setFeatureSource(FeatureSource<SimpleFeatureType, SimpleFeature> fs,
146                          Map<Integer, AttributeMetaData> amd, Filter filter)                          Map<Integer, AttributeMetaData> amd, Filter filter)
147                          throws Exception {                          throws Exception {
148                  if (filter == null)                  if (filter == null)
# Line 156  public class StyledFeatureCollectionTabl Line 158  public class StyledFeatureCollectionTabl
158    
159                          bounds = fs.getBounds();                          bounds = fs.getBounds();
160    
161                          Query query = new DefaultQuery(fs.getSchema().getTypeName(), filter);                          Query query = new DefaultQuery(fs.getSchema().getName().getLocalPart(), filter);
162                          if (amd != null) {                          if (amd != null) {
163                                  // determine the names of the visible Attributes                                  // determine the names of the visible Attributes
164                                  this.visibleAMD = StyledLayerUtil.getVisibleAttributeMetaData(                                  this.visibleAMD = StyledLayerUtil.getVisibleAttributeMetaData(
165                                                  amd, true);                                                  amd, true);
166                                  Vector<String> visibleAttrNames = new Vector<String>();                                  Vector<String> visibleAttrNames = new Vector<String>();
167                                  // Add the column with the geometry (usually "the_geom")                                  // Add the column with the geometry (usually "the_geom")
168                                  visibleAttrNames.add(fs.getSchema().getDefaultGeometry()                                  visibleAttrNames.add(fs.getSchema().getGeometryDescriptor()
169                                                  .getLocalName());                                                  .getLocalName());
170                                  for (int attrIdx : visibleAMD.keySet()) {                                  for (int attrIdx : visibleAMD.keySet()) {
171    
# Line 175  public class StyledFeatureCollectionTabl Line 177  public class StyledFeatureCollectionTabl
177                                           */                                           */
178                                          if (attrIdx < fs.getSchema().getAttributeCount()) {                                          if (attrIdx < fs.getSchema().getAttributeCount()) {
179                                                  final AttributeDescriptor attributeTypeAtIdx = fs.getSchema()                                                  final AttributeDescriptor attributeTypeAtIdx = fs.getSchema()
180                                                                  .getAttributeType(attrIdx);                                                                  .getAttributeDescriptors().get(attrIdx);
181                                                  visibleAttrNames.add(attributeTypeAtIdx.getLocalName());                                                  visibleAttrNames.add(attributeTypeAtIdx.getLocalName());
182                                          } else {                                          } else {
183                                                  LOGGER.warn("AttributeMetaData has been found for columnIdx="+attrIdx+", but fs.getSchema().getAttributeCount() = "+fs.getSchema().getAttributeCount()+". Ignored.");                                                  LOGGER.warn("AttributeMetaData has been found for columnIdx="+attrIdx+", but fs.getSchema().getAttributeCount() = "+fs.getSchema().getAttributeCount()+". Ignored.");
# Line 227  public class StyledFeatureCollectionTabl Line 229  public class StyledFeatureCollectionTabl
229                                  setFeatureSource(null, null, null);                                  setFeatureSource(null, null, null);
230                          else {                          else {
231                                  FeatureCollection fc = layer.getFeatureCollection();                                  FeatureCollection fc = layer.getFeatureCollection();
232                                  String fcName = fc.getSchema().getTypeName();                                  String fcName = fc.getSchema().getName().getLocalPart();
233                                  FeatureSource fs = new MemoryDataStore(fc)                                  FeatureSource fs = new MemoryDataStore(fc)
234                                                  .getFeatureSource(fcName);                                                  .getFeatureSource(fcName);
235                                  setFeatureSource(fs, layer.getAttributeMetaDataMap(), filter);                                  setFeatureSource(fs, layer.getAttributeMetaDataMap(), filter);

Legend:
Removed from v.332  
changed lines
  Added in v.341

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26