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

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

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

revision 1203 by alfonx, Tue Nov 2 22:53:55 2010 UTC revision 1231 by alfonx, Thu Nov 4 00:53:20 2010 UTC
# Line 41  import javax.swing.JPanel; Line 41  import javax.swing.JPanel;
41  import org.apache.log4j.Logger;  import org.apache.log4j.Logger;
42  import org.geotools.data.FeatureSource;  import org.geotools.data.FeatureSource;
43  import org.geotools.feature.FeatureCollection;  import org.geotools.feature.FeatureCollection;
 import org.geotools.feature.NameImpl;  
44  import org.geotools.geometry.jts.ReferencedEnvelope;  import org.geotools.geometry.jts.ReferencedEnvelope;
45  import org.geotools.styling.Style;  import org.geotools.styling.Style;
46  import org.opengis.feature.simple.SimpleFeature;  import org.opengis.feature.simple.SimpleFeature;
47  import org.opengis.feature.simple.SimpleFeatureType;  import org.opengis.feature.simple.SimpleFeatureType;
 import org.opengis.feature.type.AttributeDescriptor;  
48  import org.opengis.filter.Filter;  import org.opengis.filter.Filter;
49  import org.opengis.referencing.crs.CoordinateReferenceSystem;  import org.opengis.referencing.crs.CoordinateReferenceSystem;
50    
# Line 88  public class StyledFS implements StyledF Line 86  public class StyledFS implements StyledF
86          private File sldFile;          private File sldFile;
87    
88          /** A map of simple attribute names to their meta-data **/          /** A map of simple attribute names to their meta-data **/
89          private AttributeMetadataMap<AttributeMetadataImpl> map;          private AttributeMetadataMap<AttributeMetadataImpl> attMap;
90    
91          private Filter filter = Filter.INCLUDE;          private Filter filter = Filter.INCLUDE;
92    
# Line 271  public class StyledFS implements StyledF Line 269  public class StyledFS implements StyledF
269          /**          /**
270           *           *
271           */           */
272            @Override
273          public AttributeMetadataMap<AttributeMetadataImpl> getAttributeMetaDataMap() {          public AttributeMetadataMap<AttributeMetadataImpl> getAttributeMetaDataMap() {
274                  if (map == null) {                  if (attMap == null) {
275                            attMap = StyledLayerUtil
276                          map = new AttributeMetadataImplMap();                                          .createDefaultAttributeMetadataMap(getSchema());
   
                         // // Leaving out the first one, it will be the_geom  
                         // for (int i = 1; i < fs.getSchema().getAttributeCount(); i++) {  
                         // AttributeDescriptor attDesc = fs.getSchema().getDescriptor(i);  
                         //  
                         // AttributeMetadataImpl attMetaData = new AttributeMetadataImpl(  
                         // new NameImpl(attDesc  
                         // .getName().getNamespaceURI(), attDesc  
                         // .getName().getLocalPart()), map.getLanguages());  
                         // map.put(attDesc.getName(), attMetaData);  
                         // }  
   
                         // Leaving out the first one, it will be the_geom  
                         for (int i = 1; i < fs.getSchema().getAttributeCount(); i++) {  
                                 AttributeDescriptor attDesc = fs.getSchema().getDescriptor(i);  
   
                                 // TODO AttributeMetadataAS would be nicer, which would not work  
                                 // with Translations ;-)  
                                 AttributeMetadataImpl attMetaData = new AttributeMetadataImpl(  
                                                 new NameImpl(attDesc.getName().getNamespaceURI(),  
                                                                 attDesc.getName().getLocalPart()),  
                                                 map.getLanguages());  
                                 if (String.class.isAssignableFrom(attDesc.getType()  
                                                 .getBinding())) {  
                                         // For Strings we add the "" as NODATA values  
                                         attMetaData.addNodataValue("");  
                                 }  
                                 map.put(attDesc.getName(), attMetaData);  
                         }  
277                  }                  }
278                  return map;                  return attMap;
279          }          }
280    
281          /**          /**

Legend:
Removed from v.1203  
changed lines
  Added in v.1231

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26