/[schmitzm]/trunk/src/skrueger/geotools/StyledLayerUtil.java
ViewVC logotype

Diff of /trunk/src/skrueger/geotools/StyledLayerUtil.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 770 by alfonx, Sun Mar 21 11:36:11 2010 UTC revision 824 by alfonx, Wed May 5 10:44:01 2010 UTC
# Line 92  import schmitzm.io.IOUtil; Line 92  import schmitzm.io.IOUtil;
92  import schmitzm.lang.LangUtil;  import schmitzm.lang.LangUtil;
93  import schmitzm.swing.JPanel;  import schmitzm.swing.JPanel;
94  import schmitzm.swing.SwingUtil;  import schmitzm.swing.SwingUtil;
 import skrueger.AttributeMetadata;  
95  import skrueger.AttributeMetadataImpl;  import skrueger.AttributeMetadataImpl;
96    import skrueger.AttributeMetadataInterface;
97  import skrueger.RasterLegendData;  import skrueger.RasterLegendData;
98  import skrueger.i8n.Translation;  import skrueger.i8n.Translation;
99    
# Line 254  public class StyledLayerUtil { Line 254  public class StyledLayerUtil {
254           *            TODO replace with           *            TODO replace with
255           *            {@link AttributeMetadataMap#sortedValuesVisibleOnly()}           *            {@link AttributeMetadataMap#sortedValuesVisibleOnly()}
256           */           */
257          public static AttributeMetadataMap<? extends AttributeMetadata > getVisibleAttributeMetaData(          public static AttributeMetadataMap<? extends AttributeMetadataInterface > getVisibleAttributeMetaData(
258                          final AttributeMetadataMap<? extends AttributeMetadata> amdMap,                          final AttributeMetadataMap<? extends AttributeMetadataInterface> amdMap,
259                          final boolean visible) {                          final boolean visible) {
260    
261                  final AttributeMetadataMap<AttributeMetadata> filteredMap = (AttributeMetadataMap<AttributeMetadata>) amdMap.clone();                  final AttributeMetadataMap<AttributeMetadataInterface> filteredMap = (AttributeMetadataMap<AttributeMetadataInterface>) amdMap.clone();
262                  if (filteredMap.size() > 0 ) {                  if (filteredMap.size() > 0 ) {
263                          filteredMap.clear(); // Just in case the close copies the contents                          filteredMap.clear(); // Just in case the close copies the contents
264                  }                  }
265                                    
266                  for (final AttributeMetadata amd : amdMap.values())                  for (final AttributeMetadataInterface amd : amdMap.values())
267                          if (amd.isVisible() == visible)                          if (amd.isVisible() == visible)
268                                  filteredMap.put(amd.getName(), amd);                                  filteredMap.put(amd.getName(), amd);
269    
# Line 358  public class StyledLayerUtil { Line 358  public class StyledLayerUtil {
358           *            classes. (SK, 3.2.2010)           *            classes. (SK, 3.2.2010)
359           */           */
360          public static Element createAttributeMetaDataElement(          public static Element createAttributeMetaDataElement(
361                          final AttributeMetadata amd) {                          final AttributeMetadataInterface amd) {
362                  final Element element = new Element(ELEM_NAME_ATTRIBUTE, AMLURI);                  final Element element = new Element(ELEM_NAME_ATTRIBUTE, AMLURI);
363                  element.setAttribute("namespace", String.valueOf(amd.getName()                  element.setAttribute("namespace", String.valueOf(amd.getName()
364                                  .getNamespaceURI()));                                  .getNamespaceURI()));
# Line 380  public class StyledLayerUtil { Line 380  public class StyledLayerUtil {
380           *            map of attribute meta data           *            map of attribute meta data
381           */           */
382          public static Element createAttributeMetaDataMapElement(          public static Element createAttributeMetaDataMapElement(
383                          final AttributeMetadataMap<? extends AttributeMetadata> amdMap) {                          final AttributeMetadataMap<? extends AttributeMetadataInterface> amdMap) {
384                  final Element element = new Element(ELEM_NAME_AMD, AMLURI);                  final Element element = new Element(ELEM_NAME_AMD, AMLURI);
385                  for (final AttributeMetadata amd : amdMap.values())                  for (final AttributeMetadataInterface amd : amdMap.values())
386                          element.addContent(createAttributeMetaDataElement(amd));                          element.addContent(createAttributeMetaDataElement(amd));
387                  return element;                  return element;
388          }          }
# Line 931  public class StyledLayerUtil { Line 931  public class StyledLayerUtil {
931           * Creates a {@link JPanel} that shows a legend for a list of           * Creates a {@link JPanel} that shows a legend for a list of
932           * {@link FeatureTypeStyle}s and a targeted featureType           * {@link FeatureTypeStyle}s and a targeted featureType
933           *           *
934             * @param style
935             *            The Style to presented in this legend
936           * @param featureType           * @param featureType
937           *            If this a legend for Point, Polygon or Line?           *            If this a legend for Point, Polygon or Line?
          * @param list  
          *            The Styles to presented in this legend  
938           *           *
939           * @author <a href="mailto:[email protected]">Stefan Alfons           * @author <a href="mailto:[email protected]">Stefan Alfons
940           *         Kr&uuml;ger</a>           *         Kr&uuml;ger</a>
941           */           */
942          public static JPanel createLegendPanel(Style style,          public static JPanel createLegendSwingPanel(Style style,
943                          final SimpleFeatureType featureType, final int iconWidth,                          final SimpleFeatureType featureType, final int iconWidth,
944                          final int iconHeight) {                          final int iconHeight) {
945    
# Line 995  public class StyledLayerUtil { Line 995  public class StyledLayerUtil {
995                  return panel;                  return panel;
996          }          }
997    
998            
999    
1000            
1001          /**          /**
1002           * Creates a {@link JComponent} that contains a legend for a given           * Creates a {@link JComponent} that contains a legend for a given
1003           * rasterLayer and a given {@link Style}.           * {@link StyledRasterInterface} and a given {@link Style}.
1004           *           *
1005           * @param style           * @param style
1006           *            if <code>null</code>, the default {@link Style} is extracetd           *            if <code>null</code>, the default {@link Style} is extracetd
1007           *            from the {@link StyledRasterInterface}           *            from the {@link StyledRasterInterface}
1008           */           */
1009          public static JPanel createLegendPanel(          public static JPanel createLegendSwingPanel(
1010                          final StyledRasterInterface<?> styledRaster, Style style,                          final StyledRasterInterface<?> styledRaster, Style style,
1011                          final int iconWidth, final int iconHeight) {                          final int iconWidth, final int iconHeight) {
1012    
# Line 1134  public class StyledLayerUtil { Line 1137  public class StyledLayerUtil {
1137    
1138                  return panel;                  return panel;
1139          }          }
1140            
1141                    
1142    
1143          /**          /**
1144           * Extracts the {@link ColorModel} of any {@link StyledRasterInterface}. May           * Extracts the {@link ColorModel} of any {@link StyledRasterInterface}. May
# Line 1260  public class StyledLayerUtil { Line 1265  public class StyledLayerUtil {
1265                  // 1. Check.. all attributes in the atm should be in the schema as well.                  // 1. Check.. all attributes in the atm should be in the schema as well.
1266                  // maybe correct some upperCase/loweCase stuff                  // maybe correct some upperCase/loweCase stuff
1267    
1268                  for (AttributeMetadata atm : attributeMetaDataMap.values()) {                  for (AttributeMetadataInterface atm : attributeMetaDataMap.values()) {
1269    
1270                          AttributeDescriptor foundDescr = schema                          AttributeDescriptor foundDescr = schema
1271                                          .getDescriptor(atm.getName());                                          .getDescriptor(atm.getName());
# Line 1306  public class StyledLayerUtil { Line 1311  public class StyledLayerUtil {
1311           * @param schema           * @param schema
1312           */           */
1313          public static void addEmptyStringToAllTextualAttributes(          public static void addEmptyStringToAllTextualAttributes(
1314                          AttributeMetadataMap<? extends AttributeMetadata> attributeMetaDataMap,                          AttributeMetadataMap<? extends AttributeMetadataInterface> attributeMetaDataMap,
1315                          SimpleFeatureType schema) {                          SimpleFeatureType schema) {
1316    
1317                  for (Name name : attributeMetaDataMap.keySet()) {                  for (Name name : attributeMetaDataMap.keySet()) {
# Line 1319  public class StyledLayerUtil { Line 1324  public class StyledLayerUtil {
1324    
1325          /**          /**
1326           * @return a nicely formatted String containing all NODATA values of any           * @return a nicely formatted String containing all NODATA values of any
1327           *         {@link AttributeMetadata} object. Strings are quoted so that any           *         {@link AttributeMetadataInterface} object. Strings are quoted so that any
1328           *         empty {@link String} can be seen.           *         empty {@link String} can be seen.
1329           */           */
1330          public static String formatNoDataValues(Set<Object> nodataValuesList) {          public static String formatNoDataValues(Set<Object> nodataValuesList) {

Legend:
Removed from v.770  
changed lines
  Added in v.824

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26