45 |
|
|
46 |
import schmitzm.geotools.feature.FeatureUtil; |
import schmitzm.geotools.feature.FeatureUtil; |
47 |
import schmitzm.geotools.gui.FeatureCollectionTableModel; |
import schmitzm.geotools.gui.FeatureCollectionTableModel; |
48 |
import skrueger.AttributeMetadata; |
import skrueger.AttributeMetadataInterface; |
49 |
import skrueger.AttributeMetadataImpl; |
import skrueger.AttributeMetadataImpl; |
50 |
|
|
51 |
import com.vividsolutions.jts.geom.Envelope; |
import com.vividsolutions.jts.geom.Envelope; |
68 |
final static private Logger LOGGER = Logger |
final static private Logger LOGGER = Logger |
69 |
.getLogger(StyledFeatureCollectionTableModel.class); |
.getLogger(StyledFeatureCollectionTableModel.class); |
70 |
/** Contains the complete {@link AttributeMetadataImpl}-Map of the styled layer. */ |
/** Contains the complete {@link AttributeMetadataImpl}-Map of the styled layer. */ |
71 |
protected AttributeMetadataMap<? extends AttributeMetadata> amdMap = null; |
protected AttributeMetadataMap<? extends AttributeMetadataInterface> amdMap = null; |
72 |
/** Holds the current filter on the table */ |
/** Holds the current filter on the table */ |
73 |
protected Filter filter = null; |
protected Filter filter = null; |
74 |
/** Holds the Bounds for all features. Only set once during the constructor **/ |
/** Holds the Bounds for all features. Only set once during the constructor **/ |
80 |
protected String[] colTooltips = null; |
protected String[] colTooltips = null; |
81 |
|
|
82 |
/** A cache for the #sortedValuesVisibleOnly() **/ |
/** A cache for the #sortedValuesVisibleOnly() **/ |
83 |
protected List<? extends AttributeMetadata> amdMapVisibleOnly = null; |
protected List<? extends AttributeMetadataInterface> amdMapVisibleOnly = null; |
84 |
|
|
85 |
/** |
/** |
86 |
* Creates a new table model for a styled layer. |
* Creates a new table model for a styled layer. |
116 |
*/ |
*/ |
117 |
protected void setFeatureSource( |
protected void setFeatureSource( |
118 |
FeatureSource<SimpleFeatureType, SimpleFeature> fs, |
FeatureSource<SimpleFeatureType, SimpleFeature> fs, |
119 |
AttributeMetadataMap<? extends AttributeMetadata> amdm, Filter filter) throws Exception { |
AttributeMetadataMap<? extends AttributeMetadataInterface> amdm, Filter filter) throws Exception { |
120 |
|
|
121 |
if (filter == null) |
if (filter == null) |
122 |
filter = Filter.INCLUDE; |
filter = Filter.INCLUDE; |
141 |
.getLocalName()); |
.getLocalName()); |
142 |
|
|
143 |
// Add other visible attributes as ordered by weights |
// Add other visible attributes as ordered by weights |
144 |
for (AttributeMetadata a : amdMapVisibleOnly) { |
for (AttributeMetadataInterface a : amdMapVisibleOnly) { |
145 |
visibleAttrNames.add(a.getLocalName()); |
visibleAttrNames.add(a.getLocalName()); |
146 |
} |
} |
147 |
|
|
208 |
SimpleFeatureType schema = featureArray[0].getFeatureType(); |
SimpleFeatureType schema = featureArray[0].getFeatureType(); |
209 |
// Pruefen, welche Attribute angezeigt werden |
// Pruefen, welche Attribute angezeigt werden |
210 |
attrTypes.clear(); |
attrTypes.clear(); |
211 |
for (AttributeMetadata amd : amdMapVisibleOnly) { |
for (AttributeMetadataInterface amd : amdMapVisibleOnly) { |
212 |
AttributeDescriptor type = schema.getDescriptor(amd.getName()); |
AttributeDescriptor type = schema.getDescriptor(amd.getName()); |
213 |
if (attrFilter == null || attrFilter.accept(type)) |
if (attrFilter == null || attrFilter.accept(type)) |
214 |
attrTypes.add(type); |
attrTypes.add(type); |
230 |
String attName = schema.getAttributeDescriptors().get(idx) |
String attName = schema.getAttributeDescriptors().get(idx) |
231 |
.getLocalName(); |
.getLocalName(); |
232 |
colNames[i] = amdMap.get(attName).getTitle().toString(); |
colNames[i] = amdMap.get(attName).getTitle().toString(); |
233 |
AttributeMetadata amd = amdMap.get(attName); |
AttributeMetadataInterface amd = amdMap.get(attName); |
234 |
colTooltips[i] = "<html>" + amd.getDesc().toString() + "<br>" |
colTooltips[i] = "<html>" + amd.getDesc().toString() + "<br>" |
235 |
+ amd.getName() + "</html>"; |
+ amd.getName() + "</html>"; |
236 |
colClass[i] = schema.getAttributeDescriptors().get(idx) |
colClass[i] = schema.getAttributeDescriptors().get(idx) |