[Schmitzm-commits] r1518 - in trunk: schmitzm-core/src/main/java/de/schmitzm/io schmitzm-core/src/main/java/de/schmitzm/swing/swingworker schmitzm-gt/src/main/java/de/schmitzm/geotools/styling
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Mar 18 02:58:54 CET 2011
Author: alfonx
Date: 2011-03-18 02:58:53 +0100 (Fri, 18 Mar 2011)
New Revision: 1518
Modified:
trunk/schmitzm-core/src/main/java/de/schmitzm/io/IOUtil.java
trunk/schmitzm-core/src/main/java/de/schmitzm/swing/swingworker/AtlasStatusDialog.java
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverage.java
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverageReader.java
trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledRasterInterface.java
Log:
Added NODATA fields to StyledRasterInterface.. not sure.. might more to RasterLegendData...
Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/io/IOUtil.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/io/IOUtil.java 2011-03-17 23:28:00 UTC (rev 1517)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/io/IOUtil.java 2011-03-18 01:58:53 UTC (rev 1518)
@@ -534,29 +534,29 @@
return true;
}
- /**
- * Versucht einen {@link Writer} zu schliessen. Zuvor wird ein
- * {@link OutputStream#flush() flush()} auf den Stream getaetigt.<br>
- * Bei Misserfolg werden keine Exceptions geworfen! SK: bei
- * <code>null</code> wird true zurueckgegeben *
- *
- * @param out
- * zu schliessender Writer
- * @return <code>false</code> falls das Schliessen nicht erfolgreich war
- */
- public static boolean closeWriter(Writer out) {
- if (out == null)
- return true;
- try {
- out.flush();
- out.close();
- } catch (Exception err) {
- return false;
- }
- return true;
- }
+ /**
+ * Versucht einen {@link Writer} zu schliessen. Zuvor wird ein
+ * {@link OutputStream#flush() flush()} auf den Stream getaetigt.<br>
+ * Bei Misserfolg werden keine Exceptions geworfen! SK: bei
+ * <code>null</code> wird true zurueckgegeben *
+ *
+ * @param out
+ * zu schliessender Writer
+ * @return <code>false</code> falls das Schliessen nicht erfolgreich war
+ */
+ public static boolean closeWriter(Writer out) {
+ if (out == null)
+ return true;
+ try {
+ out.flush();
+ out.close();
+ } catch (Exception err) {
+ return false;
+ }
+ return true;
+ }
- /**
+ /**
* Prueft, ob eine (Datei-)Zeile mit einem Kommentarkennzeichen beginnt und
* deshalb ignoriert werden muss. Kommentar-Kennzeichen sind <code>//</code>
* , <code>#</code> und <code>|</code>.
@@ -1508,11 +1508,16 @@
* <code>index.html</code><br/>
* <code>http://www.bahn.de/exterme/</code> and
* <code>http://www.bahn.de/exterme<code> both return <code>exterme</code>
+ * Any Exception will return "";
*/
public static String getFilename(URL url) {
- if (url == null)
+ try {
+ return new File(url.getPath()).getName();
+ } catch (Exception e) {
+ LOGGER.debug("Failed to get Filename for URL '" + url
+ + "'. Returning an empty string.", e);
return "";
- return new File(url.getPath()).getName();
+ }
}
/**
Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/swingworker/AtlasStatusDialog.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/swingworker/AtlasStatusDialog.java 2011-03-17 23:28:00 UTC (rev 1517)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/swingworker/AtlasStatusDialog.java 2011-03-18 01:58:53 UTC (rev 1518)
@@ -47,7 +47,6 @@
import de.schmitzm.swing.ExceptionDialog;
import de.schmitzm.swing.OkButton;
import de.schmitzm.swing.SwingUtil;
-import de.schmitzm.swing.formatter.MbDecimalFormatter;
public class AtlasStatusDialog implements AtlasStatusDialogInterface {
@@ -150,13 +149,13 @@
*/
private volatile boolean canceled;
- private Window parentWindow;
+ private final Window parentWindow;
private boolean warningOccured;
- private JButton ok;
+ private final JButton ok;
- private HashSet<ActionListener> listeners = new HashSet<ActionListener>();
+ private final HashSet<ActionListener> listeners = new HashSet<ActionListener>();
/**
* Creates a window for reporting progress. The window will not appears
@@ -173,9 +172,9 @@
* Creates the window containing the components.
*/
Dimension parentSize;
-// final Vocabulary resources = Vocabulary
-// .getResources(parent != null ? parent.getLocale() : null);
-// final String title = resources.getString(VocabularyKeys.PROGRESSION);
+ // final Vocabulary resources = Vocabulary
+ // .getResources(parent != null ? parent.getLocale() : null);
+ // final String title = resources.getString(VocabularyKeys.PROGRESSION);
String title = "";
parentWindow = SwingUtil.getParentWindow(parent);
@@ -261,18 +260,19 @@
if (startText != null)
setDescription(startText);
}
-//
-// /**
-// * Returns a localized string for the specified key.
-// *
-// * @param key
-// * an integer key
-// * @return the associated string
-// */
-// private String getString(final int key) {
-// return Vocabulary.getResources(window.getLocale()).getString(key);
-// }
+ //
+ // /**
+ // * Returns a localized string for the specified key.
+ // *
+ // * @param key
+ // * an integer key
+ // * @return the associated string
+ // */
+ // private String getString(final int key) {
+ // return Vocabulary.getResources(window.getLocale()).getString(key);
+ // }
+
/**
* Returns the window title. The default title is "Progress" localized in
* current locale.
@@ -283,13 +283,14 @@
public String getTitle() {
return (String) get(Caller.TITLE);
}
-//
-// /**
-// * Set the window title. A {@code null} value reset the default title.
-// *
-// * @param title
-// * the window title
-// */
+
+ //
+ // /**
+ // * Set the window title. A {@code null} value reset the default title.
+ // *
+ // * @param title
+ // * the window title
+ // */
@Override
public void setTitle(String title) {
if (title == null) {
@@ -421,8 +422,7 @@
if (warningArea != null) {
buffer.append('\n');
}
- buffer.append(source != null ? source
- : " ");
+ buffer.append(source != null ? source : " ");
buffer.append('\n');
}
int wm = WARNING_MARGIN;
@@ -664,8 +664,7 @@
warningArea.setEditable(false);
namedArea.setBorder(BorderFactory.createEmptyBorder(0,
HMARGIN, VMARGIN, HMARGIN));
- namedArea.add(
- new JLabel(SwingUtil.R("Warning")),
+ namedArea.add(new JLabel(SwingUtil.R("Warning")),
BorderLayout.NORTH);
namedArea.add(scroll, BorderLayout.CENTER);
content.add(namedArea, BorderLayout.CENTER);
@@ -680,15 +679,15 @@
}
}
-// @Override
-// public void setTask(InternationalString task) {
-// setDescription(task.toString());
-// }
-//
-// @Override
-// public InternationalString getTask() {
-// return new SimpleInternationalString(getDescription());
-// }
+ // @Override
+ // public void setTask(InternationalString task) {
+ // setDescription(task.toString());
+ // }
+ //
+ // @Override
+ // public InternationalString getTask() {
+ // return new SimpleInternationalString(getDescription());
+ // }
@Override
public void startModal() {
@@ -732,7 +731,6 @@
}
long lastPercentageUpdate = System.currentTimeMillis() - 10000;
- private final static MbDecimalFormatter mbdf = new MbDecimalFormatter();
@Override
public void progress(URL url, String urlString, long doneSoFar, long full,
@@ -748,6 +746,8 @@
String filename;
filename = getShortFilename(url);
+ if (filename == null || filename.isEmpty())
+ filename = "...";
if (percentage < 0) {
setDescription("Downloading " + filename); // i8n
return;
@@ -824,7 +824,6 @@
fn = matcher.group(1);
}
}
-
return fn;
}
Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverage.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverage.java 2011-03-17 23:28:00 UTC (rev 1517)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverage.java 2011-03-18 01:58:53 UTC (rev 1518)
@@ -55,9 +55,11 @@
public class StyledGridCoverage extends AbstractStyledLayer<GridCoverage2D>
implements StyledGridCoverageInterface {
+ private Double nodataValue;
+
@Override
public Double getNodataValue() {
- return null;
+ return nodataValue;
}
/** Holds the meta data for displaying a legend. */
@@ -332,4 +334,9 @@
return new ReferencedEnvelope(getEnvelope(), getCrs());
}
+ @Override
+ public void setNodataValue(Double nodataValue) {
+ this.nodataValue = nodataValue;
+ }
+
}
Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverageReader.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverageReader.java 2011-03-17 23:28:00 UTC (rev 1517)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledGridCoverageReader.java 2011-03-18 01:58:53 UTC (rev 1518)
@@ -56,6 +56,8 @@
public class StyledGridCoverageReader extends
AbstractStyledLayer<AbstractGridCoverage2DReader> implements
StyledGridCoverageReaderInterface {
+ private Double nodataValue;
+
@Override
public ReferencedEnvelope getReferencedEnvelope() {
return new ReferencedEnvelope(getEnvelope(), getCrs());
@@ -63,11 +65,12 @@
@Override
public Double getNodataValue() {
- return null;
+ return nodataValue;
}
/** Holds the meta data for displaying a legend. */
protected RasterLegendData legendData = null;
+ private Double nodataValue2;
/**
* Creates a styled grid with language-specific informations.
@@ -325,6 +328,11 @@
return null;
}
+ @Override
+ public void setNodataValue(Double nodataValue) {
+ this.nodataValue = nodataValue;
+ }
+
/**
* If true, this layer will not be shown in the legend. Default = false
*/
Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledRasterInterface.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledRasterInterface.java 2011-03-17 23:28:00 UTC (rev 1517)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/styling/StyledRasterInterface.java 2011-03-18 01:58:53 UTC (rev 1518)
@@ -49,4 +49,6 @@
Double getNodataValue();
+ void setNodataValue(Double nodataValue);
+
}
More information about the Schmitzm-commits
mailing list