/[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 863 by alfonx, Sun May 23 13:42:13 2010 UTC revision 894 by alfonx, Fri Jun 4 09:19:07 2010 UTC
# Line 30  Line 30 
30  package skrueger.geotools;  package skrueger.geotools;
31    
32  import java.io.File;  import java.io.File;
 import java.io.FileNotFoundException;  
33  import java.io.IOException;  import java.io.IOException;
34  import java.net.URL;  import java.net.URL;
35  import java.util.Date;  import java.util.Date;
# Line 53  import org.opengis.referencing.crs.Coord Line 52  import org.opengis.referencing.crs.Coord
52  import schmitzm.geotools.io.GeoImportUtil;  import schmitzm.geotools.io.GeoImportUtil;
53  import schmitzm.geotools.styling.StylingUtil;  import schmitzm.geotools.styling.StylingUtil;
54  import skrueger.AttributeMetadataImpl;  import skrueger.AttributeMetadataImpl;
 import skrueger.AttributeMetadataInterface;  
55  import skrueger.i8n.Translation;  import skrueger.i8n.Translation;
56    
57  import com.vividsolutions.jts.geom.Envelope;  import com.vividsolutions.jts.geom.Envelope;
# Line 62  import com.vividsolutions.jts.geom.Envel Line 60  import com.vividsolutions.jts.geom.Envel
60   * This class enables a non Atlas context to use the Atlas LayerPanel   * This class enables a non Atlas context to use the Atlas LayerPanel
61   * {@link JPanel} as a {@link MapContextManagerInterface}   * {@link JPanel} as a {@link MapContextManagerInterface}
62   *   *
63   * @author <a href="mailto:[email protected]">Stefan Alfons Kr&uuml;ger</a>   * @author <a href="mailto:[email protected]">Stefan Alfons Tzeggai</a>
64   *   *
65   *         TODO Rename to StyledShapefile   *         TODO Rename to StyledShapefile
66   */   */
# Line 158  public class StyledFS implements StyledF Line 156  public class StyledFS implements StyledF
156          public CoordinateReferenceSystem getCrs() {          public CoordinateReferenceSystem getCrs() {
157                  if (crs == null) {                  if (crs == null) {
158                          crs = fs.getSchema().getCoordinateReferenceSystem();                          crs = fs.getSchema().getCoordinateReferenceSystem();
159                          if (fs.getSchema().getCoordinateReferenceSystem() == null) {                          if (crs == null) {
160                                  LOGGER.warn("Could not determine the CRS of " + getTitle()  
161                                                  + ". Using default " + GeoImportUtil.getDefaultCRS());                                  crs = fs.getSchema().getGeometryDescriptor()
162                                  crs = GeoImportUtil.getDefaultCRS();                                                  .getCoordinateReferenceSystem();
163                                    
164                                    if (crs == null) {
165                                            LOGGER.warn("Could not determine the CRS of " + getTitle()
166                                                            + ". Using default "
167                                                            + GeoImportUtil.getDefaultCRS());
168                                            crs = GeoImportUtil.getDefaultCRS();
169                                    }
170                          }                          }
171                  }                  }
172                  return crs;                  return crs;
# Line 294  public class StyledFS implements StyledF Line 299  public class StyledFS implements StyledF
299           * @return The {@link File} where the SLD was loaded from or           * @return The {@link File} where the SLD was loaded from or
300           *         <code>null</code> if there didn't exist a {@link File}.           *         <code>null</code> if there didn't exist a {@link File}.
301           *           *
302           * @author <a href="mailto:[email protected]">Stefan Alfons           * @author <a href="mailto:[email protected]">Stefan Alfons Tzeggai</a>
          *         Kr&uuml;ger</a>  
303           */           */
304          public File getSldFile() {          public File getSldFile() {
305                  return sldFile;                  return sldFile;
# Line 368  public class StyledFS implements StyledF Line 372  public class StyledFS implements StyledF
372          /**          /**
373           * Tries to load a style from the file denoted in {@link #getSldFile()}. If           * Tries to load a style from the file denoted in {@link #getSldFile()}. If
374           * the file doesn't exits, return <code>null</code>;           * the file doesn't exits, return <code>null</code>;
375             *
376           * @return <code>true</code> is style was loaded           * @return <code>true</code> is style was loaded
377           */           */
378          public boolean loadStyle() {          public boolean loadStyle() {
379                  if (getSldFile() == null)                  if (getSldFile() == null)
380                          return false;                          return false;
381                    
382                  try {                  try {
383                          Style[] loadSLD = StylingUtil.loadSLD(getSldFile());                          Style[] loadSLD = StylingUtil.loadSLD(getSldFile());
384                          setStyle(loadSLD[0]);                          setStyle(loadSLD[0]);

Legend:
Removed from v.863  
changed lines
  Added in v.894

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26