You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2014/02/12 20:43:29 UTC
svn commit: r1567739 -
/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
Author: desruisseaux
Date: Wed Feb 12 19:43:29 2014
New Revision: 1567739
URL: http://svn.apache.org/r1567739
Log:
ISO 19162 requires use to consider negative conversion factors as invalid.
Modified:
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1567739&r1=1567738&r2=1567739&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] Wed Feb 12 19:43:29 2014
@@ -552,14 +552,14 @@ public class Formatter implements Locali
keyword = invalidElement;
}
}
- if (colors != null && highlightError) {
- highlightError = false;
+ if (highlightError && colors != null) {
final String color = colors.getAnsiSequence(ElementKind.ERROR);
if (color != null) {
buffer.insert(base, color + BACKGROUND_DEFAULT);
base += color.length();
}
}
+ highlightError = false;
buffer.insert(base, keyword);
/*
* Format the SCOPE["…"], AREA["…"] and other elements. Some of those information
@@ -1004,7 +1004,7 @@ public class Formatter implements Locali
private void appendExact(final double number) {
if (Locale.ROOT.equals(locale)) {
appendSeparator();
- setColor(ElementKind.NUMBER);
+ setColor(highlightError ? ElementKind.ERROR : ElementKind.NUMBER);
final int i = (int) number;
if (i == number) {
buffer.append(i);
@@ -1015,6 +1015,7 @@ public class Formatter implements Locali
} else {
append(number);
}
+ highlightError = false;
}
/**
@@ -1054,7 +1055,11 @@ public class Formatter implements Locali
}
closeQuote(fromIndex);
resetColor();
- appendExact(Units.toStandardUnit(unit));
+ final double conversion = Units.toStandardUnit(unit);
+ if (!(conversion > 0)) { // ISO 19162 requires the conversion factor to be positive.
+ setInvalidWKT(Unit.class, null);
+ }
+ appendExact(conversion);
closeElement(false);
}
}