Author: desruisseaux Date: Mon Dec 10 08:50:52 2018 New Revision: 1848556 URL: http://svn.apache.org/viewvc?rev=1848556&view=rev Log: IP review on ScaledColorSpace and ColorModelFactory. Added: sis/ip-review/ColorModelFactory.xhtml sis/ip-review/ScaledColorSpace.xhtml sis/ip-review/ScaledColorSpaceTest.xhtml sis/ip-review/rev/05900/ScaledColorSpaceTest.xhtml sis/ip-review/rev/10796/ColorModelFactory.xhtml sis/ip-review/rev/10796/ScaledColorSpace.xhtml sis/ip-review/rev/10894/ScaledColorSpaceTest.xhtml sis/ip-review/rev/20970/ColorModelFactory.xhtml sis/ip-review/rev/20970/ScaledColorSpace.xhtml sis/ip-review/rev/20970/ScaledColorSpaceTest.xhtml sis/ip-review/rev/24476/ sis/ip-review/rev/24476/ColorModelFactory.xhtml sis/ip-review/rev/24476/HEADER.html Added: sis/ip-review/ColorModelFactory.xhtml URL: http://svn.apache.org/viewvc/sis/ip-review/ColorModelFactory.xhtml?rev=1848556&view=auto ============================================================================== --- sis/ip-review/ColorModelFactory.xhtml (added) +++ sis/ip-review/ColorModelFactory.xhtml Mon Dec 10 08:50:52 2018 @@ -0,0 +1,56 @@ + + + + + ColorModelFactory history + + + +
+

ColorModelFactory history

+

Click on the commit message for inspecting the diff and how the code has been rewritten.

+

Command line:

+
svn log -r31996:1 http://svn.osgeo.org/geotools/trunk/modules/library/coverage/src/main/java/org/geotools/coverage/ColorModelFactory.java
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Rev.DateAuthorMessage
308362008-07-01desruisseauxBest effort in an attempt to bring a little bit of order in the coverage test bazar. A lonely test file moved to the sample-data module. Operation tests moved to the processing package. A few utility methods consolidated in base classes ending in "TestBase.java". Removed redundancy introduced by copy-and-paste. Merged the two occurences of ImageWorkerTest. Examples of coverages provided in a more "Java collection" way. Comparaison of values performed with "assertEquals(a,b)" rather than "assertTrue(a==b)" so we know what was the expected value in case of failure. Tests upgrated to JUnit 4 framework.
306432008-06-12acusterCopyright headers: lib/coverage, this time with feeling (and the el in Toolkit)
305412008-06-06acusterCopyright review: update headers on lib/coverage
302582008-05-08acusterReshuffle the top level repo: drop uDig, move up trunk, tags, and branches.
302572008-05-08acusterMove trunk/gt/ directory contents up to trunk/ and drop gt
290932008-02-05desruisseauxFirst draft of a test suite for ViewsManager in an attempt to understand why our "Piecewise" operation produces different results than what we would expect. Some bug fixes.
289222008-01-24acusterBump the (at)since version to 2.5 since WKTParser was cut from 2.4
285402007-12-29acusterHide buttons which are not yet used
280812007-11-27desruisseauxJava 5 constructs: replaced some StringBuffer by StringBuilder in order to avoid unecessary synchronisation; rely on auto-boxing in order to give a chance to the JVM to reuse its cached values.
275752007-10-22desruisseauxConverted Java source files from ISO-LATIN-1 encoding to UTF-8 (GEOT-1516).
254212007-05-05desruisseauxReviewing current state of core coverage module, prior to image and coverage I/O work.
244762007-02-16simboss-first bunch of changes for the alignment of trunk with 2.3.x
232112006-12-05desruisseauxReplaced Citation.OGC by Citation.GEOTOOLS for non-OGC operations. Code reformating and javadoc.
231202006-11-29desruisseauxCoverage branch review. Reformatted code (including javadoc work), modification of AbstractCoverage.show and AbstractCoverage.evaluate(DirectPosition,Set).
228172006-11-17desruisseauxFixed SVN properties for all Java files.
223272006-10-23desruisseauxGEOT-982: regroup 'module', 'plugin', 'ext' and 'unsupported' in a common directory.
223152006-10-22desruisseauxReorganisation of directory tree structure (GEOT-982) phase 1: moved 'src' to 'src/main/java'.
209702006-08-11jgarnettIP review.txt updated, along with headers
207412006-07-28simboss-cleaning up a bit and improving coverages code
206002006-07-18simboss-committing first bunch of changes from the coverage branch. Modules involved are*api *referencing *coverage *main *renderer *shaperenderer
180172006-02-14desruisseauxAdded support for GraphicStyleListeners.
176722006-01-19desruisseauxAdded @source tag.
176602006-01-18desruisseauxFixed SVN attributes, including the addition of URL attribute.
165722005-11-02desruisseauxMoved coverage implementation to its own module (GEOT-745)
148342005-07-20desruisseauxReorganized I18N resources
139252005-05-30desruisseauxAdded @since javadoc tag
115492005-02-22desruisseauxInitial cleaning for restarting GridCoverage work
110012005-02-02desruisseauxFixed wrong encoding in main/src
107962005-01-28dzwiersimports cleaned
62592004-05-31desruisseauxAdded more implementations for Coverage support
+
+ + Added: sis/ip-review/ScaledColorSpace.xhtml URL: http://svn.apache.org/viewvc/sis/ip-review/ScaledColorSpace.xhtml?rev=1848556&view=auto ============================================================================== --- sis/ip-review/ScaledColorSpace.xhtml (added) +++ sis/ip-review/ScaledColorSpace.xhtml Mon Dec 10 08:50:52 2018 @@ -0,0 +1,50 @@ + + + + + ScaledColorSpace history + + + +
+

ScaledColorSpace history

+

Click on the commit message for inspecting the diff and how the code has been rewritten.

+

Command line:

+
svn log -r31996:1 http://svn.osgeo.org/geotools/trunk/modules/library/coverage/src/main/java/org/geotools/coverage/ScaledColorSpace.java
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Rev.DateAuthorMessage
306432008-06-12acusterCopyright headers: lib/coverage, this time with feeling (and the el in Toolkit)
305412008-06-06acusterCopyright review: update headers on lib/coverage
302582008-05-08acusterReshuffle the top level repo: drop uDig, move up trunk, tags, and branches.
302572008-05-08acusterMove trunk/gt/ directory contents up to trunk/ and drop gt
289222008-01-24acusterBump the (at)since version to 2.5 since WKTParser was cut from 2.4
285402007-12-29acusterHide buttons which are not yet used
282522007-12-04desruisseauxMore MosaicImageReader work. As a side effect, moved Utilities.getShort[Class]Name in a separated utilities class named 'Classes'. Also added a couple of @Override annotations.
275752007-10-22desruisseauxConverted Java source files from ISO-LATIN-1 encoding to UTF-8 (GEOT-1516).
228172006-11-17desruisseauxFixed SVN properties for all Java files.
223272006-10-23desruisseauxGEOT-982: regroup 'module', 'plugin', 'ext' and 'unsupported' in a common directory.
223152006-10-22desruisseauxReorganisation of directory tree structure (GEOT-982) phase 1: moved 'src' to 'src/main/java'.
209702006-08-11jgarnettIP review.txt updated, along with headers
176722006-01-19desruisseauxAdded @source tag.
176602006-01-18desruisseauxFixed SVN attributes, including the addition of URL attribute.
165722005-11-02desruisseauxMoved coverage implementation to its own module (GEOT-745)
158032005-09-22desruisseauxBux fix in automatic axis swapping during GridCoverage(..., Envelope, ...) construction.
139282005-05-30desruisseauxFixed GEOT-482; added a convenience method for loading a matrix from a file
139252005-05-30desruisseauxAdded @since javadoc tag
130162005-04-07desruisseauxMoved 'org.geotools.io.image' to 'org.geotools.image.io' / Continue work on CoverageStack
115722005-02-23desruisseauxInitial port of sub-transform, required for some grid coverages
115492005-02-22desruisseauxInitial cleaning for restarting GridCoverage work
110012005-02-02desruisseauxFixed wrong encoding in main/src
107962005-01-28dzwiersimports cleaned
62592004-05-31desruisseauxAdded more implementations for Coverage support
+
+ + Added: sis/ip-review/ScaledColorSpaceTest.xhtml URL: http://svn.apache.org/viewvc/sis/ip-review/ScaledColorSpaceTest.xhtml?rev=1848556&view=auto ============================================================================== --- sis/ip-review/ScaledColorSpaceTest.xhtml (added) +++ sis/ip-review/ScaledColorSpaceTest.xhtml Mon Dec 10 08:50:52 2018 @@ -0,0 +1,57 @@ + + + + + ScaledColorSpaceTest history + + + +
+

ScaledColorSpaceTest history

+

Click on the commit message for inspecting the diff and how the code has been rewritten.

+

Command line:

+
svn log -r31996:1 http://svn.osgeo.org/geotools/trunk/modules/library/coverage/src/test/java/org/geotools/coverage/ScaledColorSpaceTest.java
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Rev.DateAuthorMessage
308362008-07-01desruisseauxBest effort in an attempt to bring a little bit of order in the coverage test bazar. A lonely test file moved to the sample-data module. Operation tests moved to the processing package. A few utility methods consolidated in base classes ending in "TestBase.java". Removed redundancy introduced by copy-and-paste. Merged the two occurences of ImageWorkerTest. Examples of coverages provided in a more "Java collection" way. Comparaison of values performed with "assertEquals(a,b)" rather than "assertTrue(a==b)" so we know what was the expected value in case of failure. Tests upgrated to JUnit 4 framework.
306432008-06-12acusterCopyright headers: lib/coverage, this time with feeling (and the el in Toolkit)
305412008-06-06acusterCopyright review: update headers on lib/coverage
302582008-05-08acusterReshuffle the top level repo: drop uDig, move up trunk, tags, and branches.
302572008-05-08acusterMove trunk/gt/ directory contents up to trunk/ and drop gt
298262008-04-07desruisseauxMore support for PixelOrientation in GridGeometry construction and queries. A side effect of this work is the refactoring of GridGeometry2D translation method into a separated PixelTranslation class.
290522008-02-01desruisseauxMore information in GridCoverage2D.toString(). Attempt to enable "Piecewise" JAI operation when converting from packed to geophysics (not finished). Bug fix in Resampler2D when the only work to do is a Crop.
289222008-01-24acusterBump the (at)since version to 2.5 since WKTParser was cut from 2.4
285402007-12-29acusterHide buttons which are not yet used
285002007-12-24desruisseauxAdded a new GridGeometry implementation (ImageGeometry) has a lightweight placeholder for 'gridRange' as a Rectangle and 'gridToCRS' as an AffineTransform. Used by TileBuilder.
275752007-10-22desruisseauxConverted Java source files from ISO-LATIN-1 encoding to UTF-8 (GEOT-1516).
223272006-10-23desruisseauxGEOT-982: regroup 'module', 'plugin', 'ext' and 'unsupported' in a common directory.
223172006-10-22desruisseauxReorganisation of directory tree structure (GEOT-982) phase 3: moved 'test' to 'src/test/java'.
209702006-08-11jgarnettIP review.txt updated, along with headers
176722006-01-19desruisseauxAdded @source tag.
176602006-01-18desruisseauxFixed SVN attributes, including the addition of URL attribute.
165722005-11-02desruisseauxMoved coverage implementation to its own module (GEOT-745)
119102005-03-09desruisseauxMoved GridCoverage tests from legacy to main module
110042005-02-02desruisseauxFixed wrong encoding in legacy/test
108942005-01-31dzwiersmoved legacy
108222005-01-28dzwiersmoving tests
107962005-01-28dzwiersimports cleaned
62752004-05-31jgarnettfixed format test problem
62552004-05-31desruisseauxBug fix for horizontal and vertical line colinear with an axis
59002004-05-23jgarnettgcs-coverage moved to main
58432004-05-23jgarnettTest directory now assumed to be junit
57742004-05-23jgarnettgeotools-src serves as the start of our new module directory (the data access modules will escape off to plugin directory soon)
57692004-05-23jgarnettProject renamed to gt
56192004-05-13(no author)Move repository under gt.
28582003-05-13desruisseauxAdded PMC owner to copyright notice
13992002-08-09desruisseauxAdded test for ScaledColorSpace
+
+ + Added: sis/ip-review/rev/05900/ScaledColorSpaceTest.xhtml URL: http://svn.apache.org/viewvc/sis/ip-review/rev/05900/ScaledColorSpaceTest.xhtml?rev=1848556&view=auto ============================================================================== --- sis/ip-review/rev/05900/ScaledColorSpaceTest.xhtml (added) +++ sis/ip-review/rev/05900/ScaledColorSpaceTest.xhtml Mon Dec 10 08:50:52 2018 @@ -0,0 +1,21 @@ + + + + + ScaledColorSpaceTest changes for revisions 5618:5900 + + + +
+

ScaledColorSpaceTest changes for revisions 5618:5900

+

No contribution relevant to SIS here.

+

Command line:

+
svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r5618:5900 http://svn.osgeo.org/geotools/trunk/modules/library/coverage/src/test/java/org/geotools/coverage/ScaledColorSpaceTest.java
+ + +
Revision 5618Revision 5900
+
+ + Added: sis/ip-review/rev/10796/ColorModelFactory.xhtml URL: http://svn.apache.org/viewvc/sis/ip-review/rev/10796/ColorModelFactory.xhtml?rev=1848556&view=auto ============================================================================== --- sis/ip-review/rev/10796/ColorModelFactory.xhtml (added) +++ sis/ip-review/rev/10796/ColorModelFactory.xhtml Mon Dec 10 08:50:52 2018 @@ -0,0 +1,130 @@ + + + + + ColorModelFactory changes for revisions 10795:10796 + + + +
+

ColorModelFactory changes for revisions 10795:10796

+

Changes in this commit seem to be the result of some "auto reformat" tool execution. +The Java - GeoAPI - GeoTools import ordering is altered, +imports used only in Javadoc are lost and the encoding of non-ASCII characters is broken. +This commit has been reverted, except for the removal of really unused imports which are keep removed.

+

Command line:

+
svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r10795:10796 http://svn.osgeo.org/geotools/trunk/modules/library/coverage/src/main/java/org/geotools/coverage/ColorModelFactory.java
+ + + + + + + + + + +
Revision 10795Revision 10796
/*
+ * Geotools 2 - OpenSource mapping toolkit
+ * (C) 2003, Geotools Project Management Committee (PMC)
+ * (C) 2001, Institut de Recherche pour le Développement
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
/*
+ * Geotools 2 - OpenSource mapping toolkit
+ * (C) 2003, Geotools Project Management Committee (PMC)
+ * (C) 2001, Institut de Recherche pour le D�veloppement
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
package org.geotools.coverage;
+
+// J2SE dependencies
+import java.util.Map;
+import java.util.Arrays;
+
+// Images and colors
+import java.awt.Transparency;
+import java.awt.color.ColorSpace;
+import java.awt.image.ColorModel;
+import java.awt.image.DataBuffer;
+import java.awt.image.RenderedImage;   // For Javadoc
+import java.awt.image.ComponentColorModel;
+
+// JAI dependencies
+import javax.media.jai.RasterFactory;
+import javax.media.jai.FloatDoubleColorModel;
+
+// Geotools dependencies
+import org.geotools.util.WeakValueHashMap;
+import org.geotools.resources.gcs.Resources;
+import org.geotools.resources.gcs.ResourceKeys;
+import org.geotools.resources.image.ColorUtilities;
+import org.geotools.resources.image.ComponentColorModelJAI;
+
+
+/**
package org.geotools.coverage;
+
+// J2SE dependencies
+import java.awt.Transparency;
+import java.awt.color.ColorSpace;
+import java.awt.image.ColorModel;
+import java.awt.image.ComponentColorModel;
+import java.awt.image.DataBuffer;
+import java.awt.image.RenderedImage;
+import java.util.Arrays;
+import java.util.Map;
+
+import javax.media.jai.FloatDoubleColorModel;
+import javax.media.jai.RasterFactory;
+
+import org.geotools.resources.gcs.ResourceKeys;
+import org.geotools.resources.gcs.Resources;
+import org.geotools.resources.image.ColorUtilities;
+import org.geotools.resources.image.ComponentColorModelJAI;
+import org.geotools.util.WeakValueHashMap;
+
+
+/**
 */
+final class ColorModelFactory {
+    /**
+     * Modèles de couleurs suggérés pour l'affichage des catégories. Ces modèles de couleurs
+     * peuvent être construits à partir des couleurs qui ont été définies dans les différentes
+     * catégories du tableau {@link #categories}.
+     */
+    private static final Map colors = new WeakValueHashMap();
 */
+final class ColorModelFactory {
+    /**
+     * Mod�les de couleurs sugg�r�s pour l'affichage des cat�gories. Ces mod�les de couleurs
+     * peuvent �tre construits � partir des couleurs qui ont �t� d�finies dans les diff�rentes
+     * cat�gories du tableau {@link #categories}.
+     */
+    private static final Map colors = new WeakValueHashMap();
}
+/*
+ * Calcule le nombre de couleurs de la palette
+ * en cherchant l'index le plus élevé des thèmes.
+ */
+final int mapSize = (int)Math.round(categories[categories.length-1].maximum)+1;
+final int[]  ARGB = new int[mapSize];
+/*
+ * Interpole les codes de couleurs dans la palette. Les couleurs
+ * correspondantes aux plages non-définies par un thème seront transparentes.
+ */
+for (int i=0; i<categories.length; i++) {
+    final Category category = categories[i];
}
+/*
+ * Calcule le nombre de couleurs de la palette
+ * en cherchant l'index le plus �lev� des th�mes.
+ */
+final int mapSize = (int)Math.round(categories[categories.length-1].maximum)+1;
+final int[]  ARGB = new int[mapSize];
+/*
+ * Interpole les codes de couleurs dans la palette. Les couleurs
+ * correspondantes aux plages non-d�finies par un th�me seront transparentes.
+ */
+for (int i=0; i<categories.length; i++) {
+    final Category category = categories[i];
+
+ + Added: sis/ip-review/rev/10796/ScaledColorSpace.xhtml URL: http://svn.apache.org/viewvc/sis/ip-review/rev/10796/ScaledColorSpace.xhtml?rev=1848556&view=auto ============================================================================== --- sis/ip-review/rev/10796/ScaledColorSpace.xhtml (added) +++ sis/ip-review/rev/10796/ScaledColorSpace.xhtml Mon Dec 10 08:50:52 2018 @@ -0,0 +1,155 @@ + + + + + ScaledColorSpace changes for revisions 10795:10796 + + + +
+

ScaledColorSpace changes for revisions 10795:10796

+

Changes in this commit seem to be the result of some "auto reformat" tool execution. +The Java - GeoAPI - GeoTools import ordering is altered, +imports used only in Javadoc are lost and the encoding of non-ASCII characters is broken. +This commit has been reverted, except for the removal of really unused imports which are keep removed.

+

Command line:

+
svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r10795:10796 http://svn.osgeo.org/geotools/trunk/modules/library/coverage/src/main/java/org/geotools/coverage/ScaledColorSpace.java
+ + + + + + + + + + + + + + + + +
Revision 10795Revision 10796
/*
+ * Geotools 2 - OpenSource mapping toolkit
+ * (C) 2003, Geotools Project Management Committee (PMC)
+ * (C) 2001, Institut de Recherche pour le Développement
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
/*
+ * Geotools 2 - OpenSource mapping toolkit
+ * (C) 2003, Geotools Project Management Committee (PMC)
+ * (C) 2001, Institut de Recherche pour le D�veloppement
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
// J2SE dependencies
+import java.awt.color.ColorSpace;
+
+// Geotools dependencies
+import org.geotools.resources.Utilities;
+
+
+/**
+ * Espace de couleurs pour les images dont les valeurs
+ * de pixels se situent entre deux nombre réels.
+ *
+ * NOTE: Actual implementation is a copy of org.geotools.io.image.ScaledColorSpace.
+ *       Future implementation will be differents (interpolate in a color table
// J2SE dependencies
+import java.awt.color.ColorSpace;
+
+import org.geotools.resources.Utilities;
+
+
+/**
+ * Espace de couleurs pour les images dont les valeurs
+ * de pixels se situent entre deux nombre r�els.
+ *
+ * NOTE: Actual implementation is a copy of org.geotools.io.image.ScaledColorSpace.
+ *       Future implementation will be differents (interpolate in a color table
private final float scale;
+
+/**
+ * Nombre à aditionner aux pixels après
+ * les avoir multiplier par {@link #scale}.
+ */
+private final float offset;
+
+/**
+ * Construit un modèle de couleurs.
+ *
+ * @param band La bande à rendre visible (habituellement 0).
+ * @param numComponents Nombre de composante (seule la première sera prise en compte).
+ * @param minimum La valeur géophysique minimale.
+ * @param maximum La valeur géophysique maximale.
+ */
+public ScaledColorSpace(final int band, final int numComponents,
+                        final double minimum, final double maximum)
private final float scale;
+
+/**
+ * Nombre � aditionner aux pixels apr�s
+ * les avoir multiplier par {@link #scale}.
+ */
+private final float offset;
+
+/**
+ * Construit un mod�le de couleurs.
+ *
+ * @param band La bande � rendre visible (habituellement 0).
+ * @param numComponents Nombre de composante (seule la premi�re sera prise en compte).
+ * @param minimum La valeur g�ophysique minimale.
+ * @param maximum La valeur g�ophysique maximale.
+ */
+public ScaledColorSpace(final int band, final int numComponents,
+                        final double minimum, final double maximum)
/**
+ * Retourne une couleur RGB en tons de
+ * gris pour le nombre réel spécifié.
+ */
+public float[] toRGB(final float[] values) {
+    float value = (values[band]-offset)/scale;
/**
+ * Retourne une couleur RGB en tons de
+ * gris pour le nombre r�el sp�cifi�.
+ */
+public float[] toRGB(final float[] values) {
+    float value = (values[band]-offset)/scale;
}
+
+/**
+ * Retourne une valeur réelle pour
+ * le ton de gris spécifié.
+ */
+public float[] fromRGB(final float[] RGB) {
+    final float[] values = new float[getNumComponents()];
}
+
+/**
+ * Retourne une valeur r�elle pour
+ * le ton de gris sp�cifi�.
+ */
+public float[] fromRGB(final float[] RGB) {
+    final float[] values = new float[getNumComponents()];
}
+
+/**
+ * Retourne la valeur minimale autorisée.
+ */
+public float getMinValue(final int component) {
+    return MIN_VALUE*scale + offset;
}
+
+/**
+ * Retourne la valeur minimale autoris�e.
+ */
+public float getMinValue(final int component) {
+    return MIN_VALUE*scale + offset;
}
+
+/**
+ * Retourne la valeur maximale autorisée.
+ */
+public float getMaxValue(final int component) {
+    return MAX_VALUE*scale + offset;
}
+
+/**
+ * Retourne la valeur maximale autoris�e.
+ */
+public float getMaxValue(final int component) {
+    return MAX_VALUE*scale + offset;
+
+ + Added: sis/ip-review/rev/10894/ScaledColorSpaceTest.xhtml URL: http://svn.apache.org/viewvc/sis/ip-review/rev/10894/ScaledColorSpaceTest.xhtml?rev=1848556&view=auto ============================================================================== --- sis/ip-review/rev/10894/ScaledColorSpaceTest.xhtml (added) +++ sis/ip-review/rev/10894/ScaledColorSpaceTest.xhtml Mon Dec 10 08:50:52 2018 @@ -0,0 +1,106 @@ + + + + + ScaledColorSpaceTest changes for revisions 6274:10894 + + + +
+

ScaledColorSpaceTest changes for revisions 6274:10894

+ +

Change in LGPL header is not relevant to SIS. Change in import statements is trivial.

+ +

Command line:

+
svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r6274:10894 http://svn.osgeo.org/geotools/trunk/modules/library/coverage/src/test/java/org/geotools/coverage/ScaledColorSpaceTest.java
+ + + + + + + + +
Revision 6274Revision 10894
/*
+ * Geotools 2 - OpenSource mapping toolkit
+ * (C) 2003, Geotools Project Management Committee (PMC)
+ * (C) 2002, Institut de Recherche pour le Développement
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
/*
+ * Geotools 2 - OpenSource mapping toolkit
+ * (C) 2003, Geotools Project Management Committee (PMC)
+ * (C) 2002, Institut de Recherche pour le D�veloppement
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
*     UNITED KINGDOM: James Macgill
+*             mailto:j.macgill@geog.leeds.ac.uk
+*
+*     FRANCE: Surveillance de l'Environnement Assistée par Satellite
+*             Institut de Recherche pour le Développement / US-Espace
+*             mailto:seasnet@teledetection.fr
+*
+*     CANADA: Observatoire du Saint-Laurent
*     UNITED KINGDOM: James Macgill
+*             mailto:j.macgill@geog.leeds.ac.uk
+*
+*     FRANCE: Surveillance de l'Environnement Assist�e par Satellite
+*             Institut de Recherche pour le D�veloppement / US-Espace
+*             mailto:seasnet@teledetection.fr
+*
+*     CANADA: Observatoire du Saint-Laurent
package org.geotools.cv;
+
+// J2SE and JAI dependencies
+import java.util.Random;
+import java.awt.image.*;
+import java.awt.*;
+
+// Geotools dependencies
+import org.geotools.gc.Viewer;
+import org.geotools.resources.XMath;
+
+// JUnit dependencies
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+
+/**
+ * Test the {@link ScaledColorSpace} implementation.
+ * This is a visual test.
+ *
+ * @version $Id: ScaledColorSpaceTest.java,v 1.2 2003/05/13 10:59:53 desruisseaux Exp $
+ * @author Martin Desruisseaux
+ */
+public class ScaledColorSpaceTest extends TestCase {
package org.geotools.cv;
+
+// J2SE and JAI dependencies
+import java.awt.Transparency;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.ComponentColorModel;
+import java.awt.image.DataBuffer;
+import java.awt.image.RenderedImage;
+import java.awt.image.WritableRaster;
+import java.util.Random;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.geotools.gc.Viewer;
+import org.geotools.resources.XMath;
+
+
+/**
+ * Test the {@link ScaledColorSpace} implementation.
+ * This is a visual test.
+ *
+ * @version $Id$
+ * @author Martin Desruisseaux
+ */
+public class ScaledColorSpaceTest extends TestCase {
+
+ + Added: sis/ip-review/rev/20970/ColorModelFactory.xhtml URL: http://svn.apache.org/viewvc/sis/ip-review/rev/20970/ColorModelFactory.xhtml?rev=1848556&view=auto ============================================================================== --- sis/ip-review/rev/20970/ColorModelFactory.xhtml (added) +++ sis/ip-review/rev/20970/ColorModelFactory.xhtml Mon Dec 10 08:50:52 2018 @@ -0,0 +1,179 @@ + + + + + ColorModelFactory changes for revisions 20599:20970 + + + +
+

ColorModelFactory changes for revisions 20599:20970

+ +

Change in LGPL header does not apply to Apache SIS. + Formatting changes are reverted. + Definition of variables for array lengths are reverted. + Changes in synchronization with synchronized (colors) is kept; + this change is wanted.

+ +

Command line:

+
svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r20599:20970 http://svn.osgeo.org/geotools/trunk/modules/library/coverage/src/main/java/org/geotools/coverage/ColorModelFactory.java
+ + + + + + + + + + + + + + + + +
Revision 20599Revision 20970
/*
+ * Geotools 2 - OpenSource mapping toolkit
+ * (C) 2003, Geotools Project Management Committee (PMC)
+ * (C) 2001, Institut de Recherche pour le Développement
+ *
+ *    This library is free software; you can redistribute it and/or
/*
+ *    GeoTools - OpenSource mapping toolkit
+ *    http://geotools.org
+ *    (C) 2003-2006, Geotools Project Management Committee (PMC)
+ * (C) 2001, Institut de Recherche pour le Développement
+ *
+ *    This library is free software; you can redistribute it and/or
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+*    Lesser General Public License for more details.
+*
+*    You should have received a copy of the GNU Lesser General Public
+*    License along with this library; if not, write to the Free Software
+*    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*
+*
+*    This package contains documentation from OpenGIS specifications.
+*    OpenGIS consortium's work is fully acknowledged here.
+*/
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+*    Lesser General Public License for more details.
+*
+*    This package contains documentation from OpenGIS specifications.
+*    OpenGIS consortium's work is fully acknowledged here.
+*/
 * @return The requested color model, suitable for {@link RenderedImage} objects with values
+ *         in the <code>{@link CategoryList#getRange}</code> range.
+ */
+public static synchronized ColorModel getColorModel(final Category[] categories,
+                                                    final int type,
+                                                    final int visibleBand,
+                                                    final int numBands)
+{
+    ColorModelFactory key = new ColorModelFactory(categories, type, visibleBand, numBands);
+    ColorModel model = (ColorModel) colors.get(key);
+    if (model == null) {
 * @return The requested color model, suitable for {@link RenderedImage} objects with values
+ *         in the <code>{@link CategoryList#getRange}</code> range.
+ */
+public static  ColorModel getColorModel(final Category[] categories,
+                                                    final int type,
+                                                    final int visibleBand,
+                                                    final int numBands)
+{
+    synchronized (colors) {
+    ColorModelFactory key = new ColorModelFactory(categories, type, visibleBand, numBands);
+    ColorModel model = (ColorModel) colors.get(key);
+    if (model == null) {
    }
+    return model;
+}
+
+/**
+ * Construct the color model.
+ */
+private ColorModel getColorModel() {
+    if (type != DataBuffer.TYPE_BYTE &&
+        type != DataBuffer.TYPE_USHORT)
+    {
+        // If the requested type is any type not supported by IndexColorModel,
+        // fallback on a generic (but very slow!) color model.
+        double min = 0;
+        double max = 1;
+        if (categories.length != 0) {
+            min = categories[0].minimum;
+            for (int i=categories.length; --i>=0;) {
+                final double val = categories[i].maximum;
+                if (!Double.isNaN(val)) {
+                    max = val;
    }
+    return model;
+}
+}
+
+/**
+ * Construct the color model.
+ */
+private ColorModel getColorModel() {
+   final int length = categories.length;
+   if (type != DataBuffer.TYPE_BYTE && type != DataBuffer.TYPE_USHORT) {
+     // If the requested type is any type not supported by
+     // IndexColorModel,
+        // fallback on a generic (but very slow!) color model.
+        double min = 0;
+        double max = 1;
+
+     if (length != 0) {
+            min = categories[0].minimum;
+      for (int i = length; --i >= 0;) {
+                final double val = categories[i].maximum;
+                if (!Double.isNaN(val)) {
+                    max = val;
    // with something.
+    return RasterFactory.createComponentColorModel(type, colors, false, false, transparency);
+}
+if (numBands==1 && categories.length==0) {
+    // Construct a gray scale palette.
+    final ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
+    final int[] nBits = {DataBuffer.getDataTypeSize(type)};
     // with something.
+     return RasterFactory.createComponentColorModel(type, colors, false, false, transparency);
+ }
+if (numBands == 1 && length == 0) {
+     // Construct a gray scale palette.
+     final ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
+     final int[] nBits = {DataBuffer.getDataTypeSize(type)};
 * Computes the number of entries required for the color palette.
+ * We take the upper range value of the last category.
+ */
+final int mapSize = (int)Math.round(categories[categories.length-1].maximum)+1;
+final int[]  ARGB = new int[mapSize];
+/*
+ * Interpolate the colors in the color palette. Colors that do not fall
+ * in the range of a category will be set to a transparent color.
+ */
+for (int i=0; i<categories.length; i++) {
+    final Category category = categories[i];
+    ColorUtilities.expand(category.getColors(), ARGB,
+                          (int)Math.round(category.minimum),
  * Computes the number of entries required for the color palette.
+  * We take the upper range value of the last category.
+  */
+final int mapSize = (int) Math.round(categories[length - 1].maximum) + 1;
+ final int[]  ARGB = new int[mapSize];
+ /*
+  * Interpolate the colors in the color palette. Colors that do not fall
+  * in the range of a category will be set to a transparent color.
+  */
+for (int i = 0; i < length; i++) {
+     final Category category = categories[i];
+     ColorUtilities.expand(category.getColors(), ARGB,
+                           (int)Math.round(category.minimum),
 */
+public int hashCode() {
+    int code = 962745549 + (numBands*37 + visibleBand)*37 + categories.length;
+    for (int i=0; i<categories.length; i++) {
+        code += categories[i].hashCode();
+        // Better be independant of categories order.
+    }
 */
+public int hashCode() {
+    int code = 962745549 + (numBands*37 + visibleBand)*37 + categories.length;
+   final int length = categories.length;
+   for (int i = 0; i < length; i++) {
+        code += categories[i].hashCode();
+        // Better be independant of categories order.
+    }
+
+ + Added: sis/ip-review/rev/20970/ScaledColorSpace.xhtml URL: http://svn.apache.org/viewvc/sis/ip-review/rev/20970/ScaledColorSpace.xhtml?rev=1848556&view=auto ============================================================================== --- sis/ip-review/rev/20970/ScaledColorSpace.xhtml (added) +++ sis/ip-review/rev/20970/ScaledColorSpace.xhtml Mon Dec 10 08:50:52 2018 @@ -0,0 +1,50 @@ + + + + + ScaledColorSpace changes for revisions 20969:20970 + + + +
+

ScaledColorSpace changes for revisions 20969:20970

+ +

Change in LGPL header does not apply to Apache SIS.

+ +

Command line:

+
svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r20969:20970 http://svn.osgeo.org/geotools/trunk/modules/library/coverage/src/main/java/org/geotools/coverage/ScaledColorSpace.java
+ + + + + + +
Revision 20969Revision 20970
/*
+ * Geotools 2 - OpenSource mapping toolkit
+ * (C) 2003, Geotools Project Management Committee (PMC)
+ * (C) 2001, Institut de Recherche pour le Développement
+ *
+ *    This library is free software; you can redistribute it and/or
/*
+ *    GeoTools - OpenSource mapping toolkit
+ *    http://geotools.org
+ *    (C) 2003-2006, Geotools Project Management Committee (PMC)
+ * (C) 2001, Institut de Recherche pour le Développement
+ *
+ *    This library is free software; you can redistribute it and/or
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+package org.geotools.coverage;
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.coverage;
+
+ + Added: sis/ip-review/rev/20970/ScaledColorSpaceTest.xhtml URL: http://svn.apache.org/viewvc/sis/ip-review/rev/20970/ScaledColorSpaceTest.xhtml?rev=1848556&view=auto ============================================================================== --- sis/ip-review/rev/20970/ScaledColorSpaceTest.xhtml (added) +++ sis/ip-review/rev/20970/ScaledColorSpaceTest.xhtml Mon Dec 10 08:50:52 2018 @@ -0,0 +1,50 @@ + + + + + ScaledColorSpaceTest changes for revisions 20969:20970 + + + +
+

ScaledColorSpaceTest changes for revisions 20969:20970

+ +

Change in LGPL header does not apply to Apache SIS.

+ +

Command line:

+
svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r20969:20970 http://svn.osgeo.org/geotools/trunk/modules/library/coverage/src/test/java/org/geotools/coverage/ScaledColorSpaceTest.java
+ + + + + + +
Revision 20969Revision 20970
/*
+ * Geotools 2 - OpenSource mapping toolkit
+ * (C) 2003, Geotools Project Management Committee (PMC)
+ * (C) 2002, Institut de Recherche pour le Développement
+ *
+ *    This library is free software; you can redistribute it and/or
/*
+ *    GeoTools - OpenSource mapping toolkit
+ *    http://geotools.org
+ *    (C) 2003-2006, Geotools Project Managment Committee (PMC)
+ * (C) 2002, Institut de Recherche pour le Développement
+ *
+ *    This library is free software; you can redistribute it and/or
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+package org.geotools.coverage;
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.coverage;
+
+ + Added: sis/ip-review/rev/24476/ColorModelFactory.xhtml URL: http://svn.apache.org/viewvc/sis/ip-review/rev/24476/ColorModelFactory.xhtml?rev=1848556&view=auto ============================================================================== --- sis/ip-review/rev/24476/ColorModelFactory.xhtml (added) +++ sis/ip-review/rev/24476/ColorModelFactory.xhtml Mon Dec 10 08:50:52 2018 @@ -0,0 +1,49 @@ + + + + + ColorModelFactory changes for revisions 24475:24476 + + + +
+

ColorModelFactory changes for revisions 24475:24476

+

TBD

+

Command line:

+
svn diff --extensions "--unified --ignore-space-change --ignore-all-space --ignore-eol-style" -r24475:24476 http://svn.osgeo.org/geotools/trunk/modules/library/coverage/src/main/java/org/geotools/coverage/ColorModelFactory.java
+ + + + + + +
Revision 24475Revision 24476
import org.geotools.resources.i18n.ErrorKeys;
+import org.geotools.resources.image.ColorUtilities;
+import org.geotools.resources.image.ComponentColorModelJAI;
+import org.geotools.util.WeakValueHashMap;
+
+
+/**
import org.geotools.resources.i18n.ErrorKeys;
+import org.geotools.resources.image.ColorUtilities;
+import org.geotools.resources.image.ComponentColorModelJAI;
+import org.geotools.util.SoftValueHashMap;
+
+
+/**
 * peuvent être construits à partir des couleurs qui ont été définies dans les différentes
+ * catégories du tableau {@link #categories}.
+ */
+private static final Map colors = new WeakValueHashMap();
+
+/**
+ * The list of categories for the construction of a single instance of a {@link ColorModel}.
 * peuvent être construits à partir des couleurs qui ont été définies dans les différentes
+ * catégories du tableau {@link #categories}.
+ */
+private static final Map colors = new SoftValueHashMap();
+
+/**
+ * The list of categories for the construction of a single instance of a {@link ColorModel}.
+
+ + Added: sis/ip-review/rev/24476/HEADER.html URL: http://svn.apache.org/viewvc/sis/ip-review/rev/24476/HEADER.html?rev=1848556&view=auto ============================================================================== --- sis/ip-review/rev/24476/HEADER.html (added) +++ sis/ip-review/rev/24476/HEADER.html Mon Dec 10 08:50:52 2018 @@ -0,0 +1,17 @@ + + + + + Revision 24476 + + +
+

Revision 24476

+ + + + +
Author:simboss
Date:2007-02-16
Message:-first bunch of changes for the alignment of trunk with 2.3.x
+
+ +