|
From: <de...@us...> - 2013-01-14 12:44:38
|
Revision: 8205
http://fudaa.svn.sourceforge.net/fudaa/?rev=8205&view=rev
Author: deniger
Date: 2013-01-14 12:44:27 +0000 (Mon, 14 Jan 2013)
Log Message:
-----------
Ajout support filtre de points
Modified Paths:
--------------
trunk/framework/ctulu-common/src/main/resources/org/fudaa/ctulu/ctulu_en.fr_txt
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemover.java
trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoArraysBinaryFileSaver.java
trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaverTest.java
Added Paths:
-----------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMapping.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMappingDefault.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMappingEmpty.java
trunk/framework/ctulu-gis/src/test/java/org/fudaa/ctulu/gis/process/
trunk/framework/ctulu-gis/src/test/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemoverTest.java
trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoDoubleArrayBinaryFileSaverTest.java
Removed Paths:
-------------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZonePointCollectionPointFiltered.java
trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/fortran/DodicoDoubleArrayBinaryFileSaverTest.java
Modified: trunk/framework/ctulu-common/src/main/resources/org/fudaa/ctulu/ctulu_en.fr_txt
===================================================================
--- trunk/framework/ctulu-common/src/main/resources/org/fudaa/ctulu/ctulu_en.fr_txt 2013-01-14 12:43:40 UTC (rev 8204)
+++ trunk/framework/ctulu-common/src/main/resources/org/fudaa/ctulu/ctulu_en.fr_txt 2013-01-14 12:44:27 UTC (rev 8205)
@@ -329,4 +329,5 @@
Une erreur est survenue lors de l'analyse du fichier xml\: {0}=An error occured while analyzing the xml file\: {0}
L'URL n'est pas renseign\xE9e=The URL is not defined
Une incoh\xE9rence a \xE9t\xE9 d\xE9tect\xE9e\: le fichier xml est valide mais les balises {0} ne sont pas support\xE9es par l'application=A mismatch has been detected\: the xml file is valid but the application doesn't support the tag {0}
-Erreur lors de la validation du fichier xml\: {0}=Error while validating the XML file\: {0}
\ No newline at end of file
+Erreur lors de la validation du fichier xml\: {0}=Error while validating the XML file\: {0}
+Indexation des points=Points indexation
\ No newline at end of file
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemover.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemover.java 2013-01-14 12:43:40 UTC (rev 8204)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemover.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -32,7 +32,7 @@
this.eps = eps;
}
- public GisZonePointCollectionPointFiltered createFiltered(ProgressionInterface prog) {
+ public PointsMappingDefault createFiltered(ProgressionInterface prog) {
ProgressionUpdater updater = new ProgressionUpdater(prog);
updater.majProgessionStateOnly(CtuluLib.getS("Indexation des points"));
TreeMap<Coordinate, Integer> indexs = new TreeMap<Coordinate, Integer>(new CoordinateComparator(eps));
@@ -56,6 +56,6 @@
correspondance[idx++] = entry.getValue();
updater.majAvancement();
}
- return new GisZonePointCollectionPointFiltered(correspondance, in);
+ return new PointsMappingDefault(correspondance, in);
}
}
Deleted: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZonePointCollectionPointFiltered.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZonePointCollectionPointFiltered.java 2013-01-14 12:43:40 UTC (rev 8204)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZonePointCollectionPointFiltered.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -1,41 +0,0 @@
-/*
- GPL 2
- */
-package org.fudaa.ctulu.gis.process;
-
-import org.fudaa.ctulu.interpolation.SupportLocationI;
-
-/**
- * Le r\xE9sultat d'un filtre de points.
- *
- * @author Frederic Deniger
- */
-public class GisZonePointCollectionPointFiltered implements SupportLocationI {
-
- private int[] correspondance;
- SupportLocationI init;
-
- public GisZonePointCollectionPointFiltered(int[] correspondance, SupportLocationI init) {
- this.correspondance = correspondance;
- this.init = init;
- }
-
- @Override
- public int getPtsNb() {
- return correspondance.length;
- }
-
- public int getInitialIdx(int _i) {
- return correspondance[_i];
- }
-
- @Override
- public double getPtX(int _i) {
- return init.getPtX(correspondance[_i]);
- }
-
- @Override
- public double getPtY(int _i) {
- return init.getPtY(correspondance[_i]);
- }
-}
Added: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMapping.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMapping.java (rev 0)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMapping.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -0,0 +1,23 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ctulu.gis.process;
+
+import org.fudaa.ctulu.interpolation.SupportLocationI;
+
+/**
+ *
+ * @author Frederic Deniger
+ */
+public interface PointsMapping extends SupportLocationI {
+
+ int getInitialIdx(int _i);
+
+ /**
+ * Attention, pour des raisons de performances le tableau n'est pas copi\xE9.
+ * O
+ * @return null si aucun filtre.
+ */
+ int[] getMapping();
+
+}
Copied: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMappingDefault.java (from rev 8202, trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/GisZonePointCollectionPointFiltered.java)
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMappingDefault.java (rev 0)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMappingDefault.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -0,0 +1,47 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ctulu.gis.process;
+
+import org.fudaa.ctulu.interpolation.SupportLocationI;
+
+/**
+ * Le r\xE9sultat d'un filtre de points.
+ *
+ * @author Frederic Deniger
+ */
+public class PointsMappingDefault implements PointsMapping {
+
+ private int[] mapping;
+ SupportLocationI init;
+
+ public PointsMappingDefault(int[] correspondance, SupportLocationI init) {
+ this.mapping = correspondance;
+ this.init = init;
+ }
+
+ @Override
+ public int getPtsNb() {
+ return mapping.length;
+ }
+
+ @Override
+ public int[] getMapping() {
+ return mapping;
+ }
+
+ @Override
+ public int getInitialIdx(int _i) {
+ return mapping[_i];
+ }
+
+ @Override
+ public double getPtX(int _i) {
+ return init.getPtX(mapping[_i]);
+ }
+
+ @Override
+ public double getPtY(int _i) {
+ return init.getPtY(mapping[_i]);
+ }
+}
Added: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMappingEmpty.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMappingEmpty.java (rev 0)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/process/PointsMappingEmpty.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -0,0 +1,45 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ctulu.gis.process;
+
+import org.fudaa.ctulu.interpolation.SupportLocationI;
+
+/**
+ * Adapter sans modification d'indice.
+ *
+ * @author Frederic Deniger
+ */
+public class PointsMappingEmpty implements PointsMapping {
+
+ private final SupportLocationI init;
+
+ public PointsMappingEmpty(SupportLocationI init) {
+ this.init = init;
+ }
+
+ @Override
+ public int getInitialIdx(int _i) {
+ return _i;
+ }
+
+ @Override
+ public int[] getMapping() {
+ return null;
+ }
+
+ @Override
+ public int getPtsNb() {
+ return init.getPtsNb();
+ }
+
+ @Override
+ public double getPtX(int _i) {
+ return init.getPtX(_i);
+ }
+
+ @Override
+ public double getPtY(int _i) {
+ return init.getPtY(_i);
+ }
+}
Added: trunk/framework/ctulu-gis/src/test/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemoverTest.java
===================================================================
--- trunk/framework/ctulu-gis/src/test/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemoverTest.java (rev 0)
+++ trunk/framework/ctulu-gis/src/test/java/org/fudaa/ctulu/gis/process/GisZoneCollectionPointDoublonRemoverTest.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -0,0 +1,37 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ctulu.gis.process;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import java.util.ArrayList;
+import java.util.List;
+import junit.framework.TestCase;
+import org.fudaa.ctulu.interpolation.SupportCoordinate;
+
+/**
+ *
+ * @author Frederic Deniger
+ */
+public class GisZoneCollectionPointDoublonRemoverTest extends TestCase {
+
+ public void testFilter() {
+ List<Coordinate> coords = new ArrayList<Coordinate>();
+ coords.add(new Coordinate(1, 2));
+ coords.add(new Coordinate(1, 2));//doublon
+ coords.add(new Coordinate(1, 3));
+ coords.add(new Coordinate(1, 5));
+ coords.add(new Coordinate(-100, 5));
+ int[] expected = new int[]{4, 0, 2, 3};
+
+ SupportCoordinate support = new SupportCoordinate((Coordinate[]) coords.toArray(new Coordinate[coords.size()]));
+ GisZoneCollectionPointDoublonRemover remover = new GisZoneCollectionPointDoublonRemover(support, 1e-1);
+ PointsMappingDefault createFiltered = remover.createFiltered(null);
+ assertNotNull(createFiltered);
+ assertEquals(coords.size() - 1, createFiltered.getPtsNb());
+ for (int i = 0; i < expected.length; i++) {
+ assertEquals(expected[i], createFiltered.getInitialIdx(i));
+ }
+
+ }
+}
Modified: trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoArraysBinaryFileSaver.java
===================================================================
--- trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoArraysBinaryFileSaver.java 2013-01-14 12:43:40 UTC (rev 8204)
+++ trunk/framework/dodico-common/src/main/java/org/fudaa/dodico/fortran/DodicoArraysBinaryFileSaver.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -31,9 +31,9 @@
}
public boolean saveSimpleArray(OutputStream file, int[] in) {
- int[][] toSave = new int[1][];
- toSave[0] = in;
- return save(file, toSave);
+ int[][] toSave = new int[1][];
+ toSave[0] = in;
+ return save(file, toSave);
}
public boolean saveDouble(File file, double[] in) {
Deleted: trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/fortran/DodicoDoubleArrayBinaryFileSaverTest.java
===================================================================
--- trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/fortran/DodicoDoubleArrayBinaryFileSaverTest.java 2013-01-14 12:43:40 UTC (rev 8204)
+++ trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/fortran/DodicoDoubleArrayBinaryFileSaverTest.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -1,62 +0,0 @@
-package org.fudaa.dodico.common.fortran;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Random;
-import org.fudaa.ctulu.CtuluLibArray;
-
-import junit.framework.TestCase;
-import org.fudaa.dodico.fortran.DodicoDoubleArrayBinaryFileSaver;
-
-public class DodicoDoubleArrayBinaryFileSaverTest extends TestCase {
-
- public void testWriteRead() {
- File des = null;
- try {
- des = File.createTempFile("test", ".bin");
- DodicoDoubleArrayBinaryFileSaver saver = new DodicoDoubleArrayBinaryFileSaver(des);
- Random random = new Random();
- Map<String, double[]> mapOfValues = generateMaps(random);
- boolean saved = saver.save(mapOfValues);
- assertTrue(saved);
- Map<String, double[]> loaded = saver.load();
- assertEquals(loaded.size(), mapOfValues.size());
- for (Entry<String, double[]> entry : loaded.entrySet()) {
- double[] ds = mapOfValues.get(entry.getKey());
- assertNotNull(ds);
- assertTrue(CtuluLibArray.equals(ds, entry.getValue(), 1e-15));
- }
-
- } catch (Exception e) {
- fail(e.getMessage());
- } finally {
- if (des != null) {
- des.delete();
- }
- }
- }
-
- private static Map<String, double[]> generateMaps(Random random) {
- Map<String, double[]> mapOfValues = new HashMap<String, double[]>();
- for (int i = 10; i < 20; i++) {
- String key = Integer.toString(i);
- double[] values = new double[i];
- for (int j = 0; j < values.length; j++) {
- values[j] = random.nextDouble() * 100;
- }
- values[values.length - 1] = 0;
- mapOfValues.put(key, values);
- }
- return mapOfValues;
- }
-
- public static void main(String[] args) {
- File f = new File(
- "/home/genesis/Devel/test-Fudaa-Prepro/edf/perf/casEdfRElectureVariable/export_partiel_cas180210_p10.res.1.2RC1.POST/Vue_2D_N_4.LAY/GRAPHES/Graphe_0_profil_spatial3136/COURBES/3.bin");
- DodicoDoubleArrayBinaryFileSaver saver=new DodicoDoubleArrayBinaryFileSaver(f);
- Map<String, double[]> load = saver.load();
- System.err.println("load "+load.size());
- }
-}
\ No newline at end of file
Copied: trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoDoubleArrayBinaryFileSaverTest.java (from rev 7771, trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/common/fortran/DodicoDoubleArrayBinaryFileSaverTest.java)
===================================================================
--- trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoDoubleArrayBinaryFileSaverTest.java (rev 0)
+++ trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoDoubleArrayBinaryFileSaverTest.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -0,0 +1,64 @@
+package org.fudaa.dodico.fortran;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Random;
+import org.fudaa.ctulu.CtuluLibArray;
+
+import junit.framework.TestCase;
+import org.fudaa.dodico.fortran.DodicoDoubleArrayBinaryFileSaver;
+import org.fudaa.dodico.fortran.DodicoIntegerArrayBinaryFileSaverTest;
+
+public class DodicoDoubleArrayBinaryFileSaverTest extends TestCase {
+
+
+ public void testWriteRead() {
+ File des = null;
+ try {
+ des = File.createTempFile("test", ".bin");
+ DodicoDoubleArrayBinaryFileSaver saver = new DodicoDoubleArrayBinaryFileSaver(des);
+ Random random = new Random();
+ Map<String, double[]> mapOfValues = generateMaps(random);
+ boolean saved = saver.save(mapOfValues);
+ assertTrue(saved);
+ Map<String, double[]> loaded = saver.load();
+ assertEquals(loaded.size(), mapOfValues.size());
+ for (Entry<String, double[]> entry : loaded.entrySet()) {
+ double[] ds = mapOfValues.get(entry.getKey());
+ assertNotNull(ds);
+ assertTrue(CtuluLibArray.equals(ds, entry.getValue(), 1e-15));
+ }
+
+ } catch (Exception e) {
+ fail(e.getMessage());
+ } finally {
+ if (des != null) {
+ des.delete();
+ }
+ }
+ }
+
+ private static Map<String, double[]> generateMaps(Random random) {
+ Map<String, double[]> mapOfValues = new HashMap<String, double[]>();
+ for (int i = 10; i < 20; i++) {
+ String key = Integer.toString(i);
+ double[] values = new double[i];
+ for (int j = 0; j < values.length; j++) {
+ values[j] = random.nextDouble() * 100;
+ }
+ values[values.length - 1] = 0;
+ mapOfValues.put(key, values);
+ }
+ return mapOfValues;
+ }
+
+ public static void main(String[] args) {
+ File f = new File(
+ "/home/genesis/Devel/test-Fudaa-Prepro/edf/perf/casEdfRElectureVariable/export_partiel_cas180210_p10.res.1.2RC1.POST/Vue_2D_N_4.LAY/GRAPHES/Graphe_0_profil_spatial3136/COURBES/3.bin");
+ DodicoDoubleArrayBinaryFileSaver saver = new DodicoDoubleArrayBinaryFileSaver(f);
+ Map<String, double[]> load = saver.load();
+ System.err.println("load " + load.size());
+ }
+}
\ No newline at end of file
Modified: trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaverTest.java
===================================================================
--- trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaverTest.java 2013-01-14 12:43:40 UTC (rev 8204)
+++ trunk/framework/dodico-common/src/test/java/org/fudaa/dodico/fortran/DodicoIntegerArrayBinaryFileSaverTest.java 2013-01-14 12:44:27 UTC (rev 8205)
@@ -4,6 +4,10 @@
package org.fudaa.dodico.fortran;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
import org.fudaa.dodico.common.TestIO;
/**
@@ -27,14 +31,20 @@
}
File tempFile = createTempFile();
DodicoArraysBinaryFileSaver saver = new DodicoArraysBinaryFileSaver();
- saver.save(tempFile, values);
- int[][] load = saver.load(tempFile);
- assertEquals(values.length, load.length);
- for (int i = 0; i < values.length; i++) {
- assertEquals(values[i].length, load[i].length);
- for (int j = 0; j < values[i].length; j++) {
- assertEquals(values[i][j], load[i][j]);
+ try {
+ OutputStream out = new FileOutputStream(tempFile);
+ saver.save(out, values);
+ InputStream in = new FileInputStream(tempFile);
+ int[][] load = saver.load(in);
+ assertEquals(values.length, load.length);
+ for (int i = 0; i < values.length; i++) {
+ assertEquals(values[i].length, load[i].length);
+ for (int j = 0; j < values[i].length; j++) {
+ assertEquals(values[i][j], load[i][j]);
+ }
}
+ } catch (Exception fileNotFoundException) {
+ fail(fileNotFoundException.getMessage());
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|