245 |
* @param visible |
* @param visible |
246 |
* indicated whether the visible or invisible entries are |
* indicated whether the visible or invisible entries are |
247 |
* returned |
* returned |
248 |
|
* |
249 |
|
* TODO replace with {@link AttributeMetadataMap#sortedValuesVisibleOnly()} |
250 |
*/ |
*/ |
251 |
public static AttributeMetadataMap getVisibleAttributeMetaData( |
public static AttributeMetadataMap getVisibleAttributeMetaData( |
252 |
final AttributeMetadataMap amdMap, final boolean visible) { |
final AttributeMetadataMap amdMap, final boolean visible) { |
253 |
|
|
254 |
final AttributeMetadataMap filteredMap = new AttributeMetadataMap(); |
final AttributeMetadataMap filteredMap = new AttributeMetadataMap(amdMap.getLanguages()); |
255 |
for (final AttributeMetadata amd : amdMap.values()) |
for (final AttributeMetadata amd : amdMap.values()) |
256 |
if (amd.isVisible() == visible) |
if (amd.isVisible() == visible) |
257 |
filteredMap.put(amd.getName(), amd); |
filteredMap.put(amd.getName(), amd); |
264 |
* This method works like {@link |
* This method works like {@link |
265 |
* AMLImport#parseDataAttribute(org.w3c.dom.Node}, but for JDOM. |
* AMLImport#parseDataAttribute(org.w3c.dom.Node}, but for JDOM. |
266 |
* |
* |
267 |
|
* TODO 20.11.2009, SK: There are some new attribute weight, functiona, |
268 |
|
* functionX and nodata in AttributeMetaData that should be parsed/exported |
269 |
|
* too. but this method is only used by ISDSS, which is not supporting that |
270 |
|
* stuff anyways. |
271 |
|
* |
272 |
* @param element |
* @param element |
273 |
* {@link Element} to parse |
* {@link Element} to parse |
274 |
*/ |
*/ |
916 |
|
|
917 |
final List<FeatureTypeStyle> list = style.featureTypeStyles(); |
final List<FeatureTypeStyle> list = style.featureTypeStyles(); |
918 |
|
|
919 |
final JPanel panel = new JPanel(new MigLayout("wrap 2","[]:3:[]")); |
final JPanel panel = new JPanel(new MigLayout("wrap 2", "[]:3:[]")); |
920 |
|
|
921 |
if (style == null) { |
if (style == null) { |
922 |
// No Style => no legend |
// No Style => no legend |
944 |
final ImageIcon legendIcon = new ImageIcon(imageForRule); |
final ImageIcon legendIcon = new ImageIcon(imageForRule); |
945 |
|
|
946 |
final JLabel iconLabel = new JLabel(legendIcon); |
final JLabel iconLabel = new JLabel(legendIcon); |
947 |
panel.add(iconLabel,"sgx1"); |
panel.add(iconLabel, "sgx1"); |
948 |
// hbox.setAlignmentX(0f); |
// hbox.setAlignmentX(0f); |
949 |
// hbox.add(iconLabel); |
// hbox.add(iconLabel); |
950 |
// hbox.add(Box.createHorizontalStrut(3)); |
// hbox.add(Box.createHorizontalStrut(3)); |
951 |
|
|
952 |
final Translation labelT = new Translation(); |
final Translation labelT = new Translation(); |
953 |
labelT.fromOneLine(rule.getDescription().getTitle()); |
labelT.fromOneLine(rule.getDescription().getTitle()); |
954 |
final JLabel classTitleLabel = new JLabel(labelT.toString()); |
final JLabel classTitleLabel = new JLabel(labelT.toString()); |
955 |
|
|
956 |
panel.add(classTitleLabel,"sgx2"); |
panel.add(classTitleLabel, "sgx2"); |
957 |
classTitleLabel.setLabelFor(iconLabel); |
classTitleLabel.setLabelFor(iconLabel); |
958 |
} |
} |
959 |
} |
} |
1007 |
// **************************************************************************** |
// **************************************************************************** |
1008 |
final BufferedImage buffImage = new BufferedImage(iconWidth, |
final BufferedImage buffImage = new BufferedImage(iconWidth, |
1009 |
iconHeight, BufferedImage.TYPE_INT_ARGB); |
iconHeight, BufferedImage.TYPE_INT_ARGB); |
1010 |
|
|
1011 |
final Graphics2D graphics = buffImage.createGraphics(); |
final Graphics2D graphics = buffImage.createGraphics(); |
1012 |
|
|
1013 |
if (colorModel != null) { |
if (colorModel != null) { |
1014 |
// The colors come from the ColorModel! |
// The colors come from the ColorModel! |
1015 |
|
|
1016 |
try { |
try { |
1017 |
Object inData = null; |
Object inData = null; |
1018 |
switch (colorModel.getTransferType()) { |
switch (colorModel.getTransferType()) { |
1082 |
} |
} |
1083 |
|
|
1084 |
final JLabel iconLabel = new JLabel(new ImageIcon(buffImage)); |
final JLabel iconLabel = new JLabel(new ImageIcon(buffImage)); |
1085 |
// hbox.setAlignmentX(0f); |
// hbox.setAlignmentX(0f); |
1086 |
panel.add(iconLabel,"sgx1"); |
panel.add(iconLabel, "sgx1"); |
1087 |
// hbox.add(Box.createHorizontalStrut(3)); |
// hbox.add(Box.createHorizontalStrut(3)); |
1088 |
|
|
1089 |
final Translation labelT = rasterLegendData.get(rValue); |
final Translation labelT = rasterLegendData.get(rValue); |
1090 |
final JLabel classTitleLabel = new JLabel(labelT.toString()); |
final JLabel classTitleLabel = new JLabel(labelT.toString()); |
1091 |
panel.add(classTitleLabel,"sgx2" + (rasterLegendData.getPaintGaps()? ", gapy 0 3":"")); |
panel.add(classTitleLabel, "sgx2" |
1092 |
|
+ (rasterLegendData.getPaintGaps() ? ", gapy 0 3" : "")); |
1093 |
classTitleLabel.setLabelFor(iconLabel); |
classTitleLabel.setLabelFor(iconLabel); |
1094 |
|
|
1095 |
// box.add(hbox); |
// box.add(hbox); |
1096 |
|
|
1097 |
if (rasterLegendData.getPaintGaps()) { |
if (rasterLegendData.getPaintGaps()) { |
1098 |
iconLabel |
iconLabel |
1152 |
public static boolean isStyleable( |
public static boolean isStyleable( |
1153 |
final StyledRasterInterface<?> styledRaster) { |
final StyledRasterInterface<?> styledRaster) { |
1154 |
final ColorModel colorModel = getColorModel(styledRaster); |
final ColorModel colorModel = getColorModel(styledRaster); |
1155 |
|
|
1156 |
LOGGER.info("The colormodel of " + styledRaster.getTitle() + " is " |
// LOGGER.info("The colormodel of " + styledRaster.getTitle() + " is " |
1157 |
+ colorModel.getClass().getSimpleName()); |
// + colorModel != null ? colorModel.getClass().getSimpleName() : "NULL"); |
1158 |
|
|
1159 |
if (colorModel == null) |
if (colorModel == null) |
1160 |
return true; |
return true; |
1162 |
return true; |
return true; |
1163 |
return false; |
return false; |
1164 |
} |
} |
1165 |
|
|
1166 |
|
/** |
1167 |
|
* Set the given Style as the Style of the {@link MapLayer}, unless the |
1168 |
|
* styles are the same (not comparing selection stuff). If the |
1169 |
|
* {@link MapLayer}s {@link Style} is changed, the selection FTS is kept.<br/> |
1170 |
|
* Remember {@link MapLayer#setStyle(Style)} triggers an event leading to a |
1171 |
|
* repaint, so only use it when needed. |
1172 |
|
* |
1173 |
|
* @return <code>true</code> if the {@link MapLayer}'s {@link Style} has been changed. |
1174 |
|
*/ |
1175 |
|
public static boolean updateMapLayerStyleIfChangedAndKeepSelection(MapLayer mapLayer, |
1176 |
|
Style style2) { |
1177 |
|
|
1178 |
|
Style mapLayerStyleCleaned = StylingUtil |
1179 |
|
.removeSelectionFeatureTypeStyle(mapLayer.getStyle()); |
1180 |
|
|
1181 |
|
Style newStyleCleaned = StylingUtil.removeSelectionFeatureTypeStyle(style2); |
1182 |
|
|
1183 |
|
if (StylingUtil.isStyleDifferent(mapLayerStyleCleaned, |
1184 |
|
newStyleCleaned)) { |
1185 |
|
|
1186 |
|
// They are different when compared without SELECTION FTS! |
1187 |
|
|
1188 |
|
// Now let's copy any SELECTION FTS to the now style |
1189 |
|
FeatureTypeStyle selectionFeatureTypeStyle = StylingUtil.getSelectionFeatureTypeStyle( mapLayer.getStyle() ); |
1190 |
|
if (selectionFeatureTypeStyle != null) { |
1191 |
|
newStyleCleaned.featureTypeStyles().add(selectionFeatureTypeStyle); |
1192 |
|
// newStyleCleaned is not so clean anymore... We just alled a selcetion FTS |
1193 |
|
} |
1194 |
|
|
1195 |
|
mapLayer.setStyle(newStyleCleaned); |
1196 |
|
|
1197 |
|
return true; |
1198 |
|
|
1199 |
|
} else { |
1200 |
|
return false; |
1201 |
|
} |
1202 |
|
} |
1203 |
|
|
1204 |
} |
} |