/[schmitzm]/branches/1.0-gt2-2.6/src/skrueger/geotools/StyledFeatureCollectionTableModel.java
ViewVC logotype

Diff of /branches/1.0-gt2-2.6/src/skrueger/geotools/StyledFeatureCollectionTableModel.java

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

revision 334 by alfonx, Wed Aug 26 17:15:49 2009 UTC revision 335 by alfonx, Wed Aug 26 18:09:39 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.feature.type.FeatureType;
46  import org.opengis.filter.Filter;  import org.opengis.filter.Filter;
47    
48  import schmitzm.geotools.gui.FeatureCollectionTableModel;  import schmitzm.geotools.gui.FeatureCollectionTableModel;
# Line 140  public class StyledFeatureCollectionTabl Line 143  public class StyledFeatureCollectionTabl
143           *            {@link AttributeMetaData}-Map to define the visible attributes           *            {@link AttributeMetaData}-Map to define the visible attributes
144           *            and translation           *            and translation
145           */           */
146          protected void setFeatureSource(FeatureSource fs,          protected void setFeatureSource(FeatureSource<SimpleFeatureType, SimpleFeature> fs,
147                          Map<Integer, AttributeMetaData> amd, Filter filter)                          Map<Integer, AttributeMetaData> amd, Filter filter)
148                          throws Exception {                          throws Exception {
149                  if (filter == null)                  if (filter == null)
# Line 156  public class StyledFeatureCollectionTabl Line 159  public class StyledFeatureCollectionTabl
159    
160                          bounds = fs.getBounds();                          bounds = fs.getBounds();
161    
162                          Query query = new DefaultQuery(fs.getSchema().getTypeName(), filter);                          Query query = new DefaultQuery(fs.getSchema().getName().getLocalPart(), filter);
163                          if (amd != null) {                          if (amd != null) {
164                                  // determine the names of the visible Attributes                                  // determine the names of the visible Attributes
165                                  this.visibleAMD = StyledLayerUtil.getVisibleAttributeMetaData(                                  this.visibleAMD = StyledLayerUtil.getVisibleAttributeMetaData(
166                                                  amd, true);                                                  amd, true);
167                                  Vector<String> visibleAttrNames = new Vector<String>();                                  Vector<String> visibleAttrNames = new Vector<String>();
168                                  // Add the column with the geometry (usually "the_geom")                                  // Add the column with the geometry (usually "the_geom")
169                                  visibleAttrNames.add(fs.getSchema().getDefaultGeometry()                                  visibleAttrNames.add(fs.getSchema().getGeometryDescriptor()
170                                                  .getLocalName());                                                  .getLocalName());
171                                  for (int attrIdx : visibleAMD.keySet()) {                                  for (int attrIdx : visibleAMD.keySet()) {
172    
# Line 175  public class StyledFeatureCollectionTabl Line 178  public class StyledFeatureCollectionTabl
178                                           */                                           */
179                                          if (attrIdx < fs.getSchema().getAttributeCount()) {                                          if (attrIdx < fs.getSchema().getAttributeCount()) {
180                                                  final AttributeDescriptor attributeTypeAtIdx = fs.getSchema()                                                  final AttributeDescriptor attributeTypeAtIdx = fs.getSchema()
181                                                                  .getAttributeType(attrIdx);                                                                  .getAttributeDescriptors().get(attrIdx);
182                                                  visibleAttrNames.add(attributeTypeAtIdx.getLocalName());                                                  visibleAttrNames.add(attributeTypeAtIdx.getLocalName());
183                                          } else {                                          } else {
184                                                  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 230  public class StyledFeatureCollectionTabl
230                                  setFeatureSource(null, null, null);                                  setFeatureSource(null, null, null);
231                          else {                          else {
232                                  FeatureCollection fc = layer.getFeatureCollection();                                  FeatureCollection fc = layer.getFeatureCollection();
233                                  String fcName = fc.getSchema().getTypeName();                                  String fcName = fc.getSchema().getName().getLocalPart();
234                                  FeatureSource fs = new MemoryDataStore(fc)                                  FeatureSource fs = new MemoryDataStore(fc)
235                                                  .getFeatureSource(fcName);                                                  .getFeatureSource(fcName);
236                                  setFeatureSource(fs, layer.getAttributeMetaDataMap(), filter);                                  setFeatureSource(fs, layer.getAttributeMetaDataMap(), filter);

Legend:
Removed from v.334  
changed lines
  Added in v.335

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26