/[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 332 by alfonx, Wed Aug 26 17:15:49 2009 UTC revision 336 by alfonx, Thu Aug 27 09:10:10 2009 UTC
# Line 45  import org.apache.log4j.Logger; Line 45  import org.apache.log4j.Logger;
45  import org.geotools.data.FeatureSource;  import org.geotools.data.FeatureSource;
46  import org.geotools.feature.FeatureCollection;  import org.geotools.feature.FeatureCollection;
47  import org.geotools.styling.Style;  import org.geotools.styling.Style;
48    import org.opengis.feature.simple.SimpleFeature;
49    import org.opengis.feature.simple.SimpleFeatureType;
50  import org.opengis.feature.type.AttributeDescriptor;  import org.opengis.feature.type.AttributeDescriptor;
51  import org.opengis.referencing.crs.CoordinateReferenceSystem;  import org.opengis.referencing.crs.CoordinateReferenceSystem;
52    
# Line 63  import com.vividsolutions.jts.geom.Envel Line 65  import com.vividsolutions.jts.geom.Envel
65  public class StyledFS implements StyledFeatureSourceInterface {  public class StyledFS implements StyledFeatureSourceInterface {
66          private static final Logger LOGGER = Logger.getLogger(StyledFS.class);          private static final Logger LOGGER = Logger.getLogger(StyledFS.class);
67    
68          private final FeatureSource fs;          private final FeatureSource<SimpleFeatureType, SimpleFeature> fs;
69    
70          /**          /**
71           * A unique ID which identifies the Layer in the Atlas. It's more important           * A unique ID which identifies the Layer in the Atlas. It's more important
# Line 92  public class StyledFS implements StyledF Line 94  public class StyledFS implements StyledF
94           *            may be <code>null</code>. Otherwise the SLD {@link File} to           *            may be <code>null</code>. Otherwise the SLD {@link File} to
95           *            import and associate with this {@link StyledFS}           *            import and associate with this {@link StyledFS}
96           */           */
97          public StyledFS(FeatureSource fs, File sldFile) {          public StyledFS(FeatureSource<SimpleFeatureType, SimpleFeature> fs, File sldFile) {
98    
99                  this.fs = fs;                  this.fs = fs;
100                  id = StyledFS.class.getSimpleName()                  id = StyledFS.class.getSimpleName()
# Line 100  public class StyledFS implements StyledF Line 102  public class StyledFS implements StyledF
102    
103                  this.sldFile = sldFile;                  this.sldFile = sldFile;
104    
105                  if ((sldFile != null) && (sldFile.exists())) {                  if (sldFile != null && sldFile.exists()) {
106                          try {                          try {
107                                  style = StylingUtil.loadSLD(sldFile)[0];                                  style = StylingUtil.loadSLD(sldFile)[0];
108                          } catch (FileNotFoundException e) {                          } catch (FileNotFoundException e) {
# Line 121  public class StyledFS implements StyledF Line 123  public class StyledFS implements StyledF
123          }          }
124    
125          /**          /**
126           * Returnes human readable {@link String} of the CRS natively used by this           * Returns human readable {@link String} of the CRS natively used by this
127           * {@link DpLayer}           * {@link DpLayer}
128           *           *
129           * If crs == null, it will call {@link #getGeoObject()}           * If CRS == null, it will call {@link #getGeoObject()}
130           *           *
131           */           */
132          public String getCRSString() {          public String getCRSString() {
# Line 135  public class StyledFS implements StyledF Line 137  public class StyledFS implements StyledF
137          }          }
138    
139          public CoordinateReferenceSystem getCrs() {          public CoordinateReferenceSystem getCrs() {
140                  return fs.getSchema().getDefaultGeometry().getCoordinateSystem();                  return fs.getSchema().getCoordinateReferenceSystem();
141          }          }
142    
143          public Translation getDesc() {          public Translation getDesc() {
# Line 151  public class StyledFS implements StyledF Line 153  public class StyledFS implements StyledF
153                  }                  }
154          }          }
155    
156          public FeatureSource getGeoObject() {          public FeatureSource<SimpleFeatureType, SimpleFeature> getGeoObject() {
157                  return fs;                  return fs;
158          }          }
159    
# Line 231  public class StyledFS implements StyledF Line 233  public class StyledFS implements StyledF
233    
234                          // Leaving out the first one, it will be the_geom                          // Leaving out the first one, it will be the_geom
235                          for (int i = 1; i < fs.getSchema().getAttributeCount(); i++) {                          for (int i = 1; i < fs.getSchema().getAttributeCount(); i++) {
236                                  AttributeDescriptor att = fs.getSchema().getAttributeType(i);                                  AttributeDescriptor att = fs.getSchema().getDescriptor(i);
237    
238                                  AttributeMetaData attMetaData = new AttributeMetaData(i, att                                  AttributeMetaData attMetaData = new AttributeMetaData(i, att
239                                                  .getLocalName());                                                  .getLocalName());

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26