15 |
import org.apache.log4j.Logger; |
import org.apache.log4j.Logger; |
16 |
import org.geotools.data.FeatureSource; |
import org.geotools.data.FeatureSource; |
17 |
import org.geotools.feature.AttributeType; |
import org.geotools.feature.AttributeType; |
18 |
|
import org.geotools.gui.swing.ExceptionMonitor; |
19 |
import org.geotools.styling.Style; |
import org.geotools.styling.Style; |
20 |
import org.opengis.referencing.crs.CoordinateReferenceSystem; |
import org.opengis.referencing.crs.CoordinateReferenceSystem; |
21 |
|
|
65 |
*/ |
*/ |
66 |
public StyledFS(FeatureSource fs, File sldFile) { |
public StyledFS(FeatureSource fs, File sldFile) { |
67 |
|
|
|
super(); |
|
68 |
this.fs = fs; |
this.fs = fs; |
69 |
id = StyledFS.class.getSimpleName() |
id = StyledFS.class.getSimpleName() |
70 |
+ new Random(new Date().getTime()).nextInt(10000000); |
+ new Random(new Date().getTime()).nextInt(10000000); |
77 |
} catch (FileNotFoundException e) { |
} catch (FileNotFoundException e) { |
78 |
LOGGER |
LOGGER |
79 |
.debug("The SLD file passed was empty. Leaving the Style untouched. (We are in the constructor.. so its null"); |
.debug("The SLD file passed was empty. Leaving the Style untouched. (We are in the constructor.. so its null"); |
80 |
|
} catch (Exception e) { |
81 |
|
LOGGER.warn("Reading SLD failed: " + sldFile, e); |
82 |
} |
} |
83 |
} |
} |
|
|
|
84 |
title = new Translation(); |
title = new Translation(); |
85 |
title.fromOneLine(sldFile.getName()); |
title.fromOneLine(sldFile.getName()); |
86 |
|
|
154 |
return false; |
return false; |
155 |
} |
} |
156 |
|
|
157 |
public boolean isHideInLegend() { |
/** |
158 |
return false; |
* If true, this layer will not be shown in the legend. Default = false |
159 |
} |
*/ |
160 |
|
/** |
161 |
|
* |
162 |
|
* Killed by SK: 6. April 09: Ein Layer soll nicht generell auf |
163 |
|
* verstecken/nicht verstecken gestellt werden können. Das sind |
164 |
|
* Eigenschaften der Karte/MapContext, ebenso wie die Reihenfolge der Layer. |
165 |
|
* Im Atlas verwaltet deshalb nun die Klasse skrueger.atlas.Map welche Layer |
166 |
|
* nicht in der Legende auftauchen sollen. Meines Wissens hat keiner bisher |
167 |
|
* die Funktion genutzt. |
168 |
|
* |
169 |
|
* // public boolean isHideInLegend() { // return false; // } |
170 |
|
*/ |
171 |
|
|
172 |
public void setDesc(Translation dec) { |
public void setDesc(Translation dec) { |
173 |
this.desc = dec; |
this.desc = dec; |
174 |
} |
} |
175 |
|
|
176 |
public void setImageIcon(ImageIcon icon) { |
public void setImageIcon(ImageIcon icon) { |
|
// TODO Auto-generated method stub |
|
|
|
|
177 |
} |
} |
178 |
|
|
179 |
public void setKeywords(Translation keywords) { |
public void setKeywords(Translation keywords) { |
192 |
public void uncache() { |
public void uncache() { |
193 |
} |
} |
194 |
|
|
195 |
|
/** |
196 |
|
* |
197 |
|
*/ |
198 |
public Map<Integer, AttributeMetaData> getAttributeMetaDataMap() { |
public Map<Integer, AttributeMetaData> getAttributeMetaDataMap() { |
199 |
if (map == null) { |
if (map == null) { |
200 |
|
|
201 |
map = new HashMap<Integer, AttributeMetaData>(); |
map = new HashMap<Integer, AttributeMetaData>(); |
202 |
|
|
203 |
// Leaving out the first one, it will be the_geom |
// Leaving out the first one, it will be the_geom |
204 |
for (int i = 1; i < fs.getSchema().getAttributeCount(); i++) { |
for (int i = 1; i < fs.getSchema().getAttributeCount(); i++) { |
205 |
AttributeType att = fs.getSchema().getAttributeType(i); |
AttributeType att = fs.getSchema().getAttributeType(i); |
206 |
|
|
207 |
AttributeMetaData attMetaData = new AttributeMetaData(i, att.getLocalName()); |
AttributeMetaData attMetaData = new AttributeMetaData(i, att |
208 |
|
.getLocalName()); |
209 |
map.put(i, attMetaData); |
map.put(i, attMetaData); |
210 |
} |
} |
211 |
} |
} |
214 |
|
|
215 |
/** |
/** |
216 |
* @return The {@link File} where the SLD was loaded from or |
* @return The {@link File} where the SLD was loaded from or |
217 |
* <code>null</code> if there didn't exist a {@link File}. (It |
* <code>null</code> if there didn't exist a {@link File}. (It could |
218 |
* could be a WFS or a PostGIS |
* be a WFS or a PostGIS |
219 |
* |
* |
220 |
* @author <a href="mailto:[email protected]">Stefan Alfons Krüger</a> |
* @author <a href="mailto:[email protected]">Stefan Alfons |
221 |
|
* Krüger</a> |
222 |
*/ |
*/ |
223 |
public File getSldFile() { |
public File getSldFile() { |
224 |
return sldFile; |
return sldFile; |