/[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 1191 by alfonx, Sat Oct 30 00:02:44 2010 UTC revision 1228 by alfonx, Wed Nov 3 20:44:16 2010 UTC
# Line 42  import org.apache.log4j.Logger; Line 42  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;
44  import org.geotools.feature.NameImpl;  import org.geotools.feature.NameImpl;
45    import org.geotools.geometry.jts.ReferencedEnvelope;
46  import org.geotools.styling.Style;  import org.geotools.styling.Style;
47  import org.opengis.feature.simple.SimpleFeature;  import org.opengis.feature.simple.SimpleFeature;
48  import org.opengis.feature.simple.SimpleFeatureType;  import org.opengis.feature.simple.SimpleFeatureType;
# Line 52  import org.opengis.referencing.crs.Coord Line 53  import org.opengis.referencing.crs.Coord
53  import schmitzm.geotools.io.GeoImportUtil;  import schmitzm.geotools.io.GeoImportUtil;
54  import schmitzm.geotools.styling.StylingUtil;  import schmitzm.geotools.styling.StylingUtil;
55  import skrueger.AttributeMetadataImpl;  import skrueger.AttributeMetadataImpl;
56    import skrueger.AttributeMetadataInterface;
57  import skrueger.i8n.Translation;  import skrueger.i8n.Translation;
58    
59  import com.vividsolutions.jts.geom.Envelope;  import com.vividsolutions.jts.geom.Envelope;
# Line 87  public class StyledFS implements StyledF Line 89  public class StyledFS implements StyledF
89          private File sldFile;          private File sldFile;
90    
91          /** A map of simple attribute names to their meta-data **/          /** A map of simple attribute names to their meta-data **/
92          private AttributeMetadataMap<AttributeMetadataImpl> map;          private AttributeMetadataMap<AttributeMetadataImpl> attMap;
93    
94          private Filter filter = Filter.INCLUDE;          private Filter filter = Filter.INCLUDE;
95    
# Line 270  public class StyledFS implements StyledF Line 272  public class StyledFS implements StyledF
272          /**          /**
273           *           *
274           */           */
275            @Override
276          public AttributeMetadataMap<AttributeMetadataImpl> getAttributeMetaDataMap() {          public AttributeMetadataMap<AttributeMetadataImpl> getAttributeMetaDataMap() {
277                  if (map == null) {                  if (attMap == null) {
278                            attMap = StyledLayerUtil
279                          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);  
                         }  
280                  }                  }
281                  return map;                  return attMap;
282          }          }
283    
284          /**          /**
# Line 422  public class StyledFS implements StyledF Line 396  public class StyledFS implements StyledF
396                  crs = crs2;                  crs = crs2;
397          }          }
398    
399            @Override
400            public ReferencedEnvelope getReferencedEnvelope() {
401                    return new ReferencedEnvelope(getEnvelope(), getCrs());
402            }
403    
404  }  }

Legend:
Removed from v.1191  
changed lines
  Added in v.1228

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26