From: <bma...@us...> - 2008-09-23 13:34:21
|
Revision: 3973 http://fudaa.svn.sourceforge.net/fudaa/?rev=3973&view=rev Author: bmarchan Date: 2008-09-23 13:34:15 +0000 (Tue, 23 Sep 2008) Log Message: ----------- Nouveau package interpolation de profils. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISLib.java Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudFilterAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudI.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudMultipointsAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudPointsAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/ProfileCalculator.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/ProfileCalculatorWindow.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/package.html branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/test/org/fudaa/ctulu/interpolation/profile/ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/test/org/fudaa/ctulu/interpolation/profile/TestInterpolationProfile.java Property Changed: ---------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISLib.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISLib.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISLib.java 2008-09-23 10:40:01 UTC (rev 3972) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISLib.java 2008-09-23 13:34:15 UTC (rev 3973) @@ -29,7 +29,7 @@ /** * @author deniger - * @version $Id: GISLib.java,v 1.23 2007-04-26 14:23:27 deniger Exp $ + * @version $Id$ */ public final class GISLib { @@ -394,6 +394,15 @@ } return r; } + + /** + * @param _c1 La premi\xE8re coordonn\xE9e + * @param _c2 La deuxi\xE8me coordonn\xE9e. + * @return La coordonn\xE9e milieu de 2 coordonn\xE9es + */ + public static Coordinate computeMiddle(Coordinate _c1, Coordinate _c2) { + return new Coordinate((_c1.x+_c2.x)/2.,(_c1.y+_c2.y)/2.,(_c1.z+_c2.z)/2.); + } public static LineString createLineOrLinearFromList(final List _coordinates) { if (_coordinates == null || _coordinates.size() < 2) { Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISLib.java ___________________________________________________________________ Added: svn:keywords + Id Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudFilterAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudFilterAdapter.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudFilterAdapter.java 2008-09-23 13:34:15 UTC (rev 3973) @@ -0,0 +1,48 @@ +/* + * @creation 23 sept. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.ctulu.interpolation.profile; + +/** + * Un filtre de nuage de point. Ne r\xE9cup\xE9rer du nuage que les indices pass\xE9s. Les indices + * des points peuvent provenir d'un filtrage par fenetre de selection. + * + * @author Bertrand Marchand + * @version $Id:$ + */ +public class PointCloudFilterAdapter implements PointCloudI { + /** Les indexes des seuls points \xE0 utiliser */ + int[] indexes_; + /** Le nuage de points initial */ + PointCloudI initialCloud_; + + /** + * Construteur. + * @param _initialCloud Le nuage initial, non modifi\xE9, non dupliqu\xE9. + * @param _idx Les indices des points sur ce nuage. + */ + public PointCloudFilterAdapter(PointCloudI _initialCloud, int[] _idx) { + initialCloud_=_initialCloud; + indexes_=_idx; + } + + public int getNbPoints() { + return indexes_.length; + } + + public double getX(int _idx) { + return initialCloud_.getX(indexes_[_idx]); + } + + public double getY(int _idx) { + return initialCloud_.getY(indexes_[_idx]); + } + + public double getZ(int _idx) { + return initialCloud_.getZ(indexes_[_idx]); + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudFilterAdapter.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudI.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudI.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudI.java 2008-09-23 13:34:15 UTC (rev 3973) @@ -0,0 +1,34 @@ + +package org.fudaa.ctulu.interpolation.profile ; + +/** + * Une interface a implementer pour passer le nuage de points au calculateur de profils. + * @author J.B. Faure + * @author Bertrand Marchand + * @version $Id:$ + */ +public interface PointCloudI { + + /** + * @return Le nombre de points du nuage. + */ + public int getNbPoints() ; + + /** + * @param _idx L'indice du point + * @return La coordonn\xE9e X pour le point d'index _idx. + */ + public double getX(int _idx) ; + + /** + * @param _idx L'indice du point + * @return La coordonn\xE9e X pour le point d'index _idx. + */ + public double getY(int _idx) ; + + /** + * @param _idx L'indice du point + * @return La coordonn\xE9e X pour le point d'index _idx. + */ + public double getZ(int _idx) ; +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudI.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudMultipointsAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudMultipointsAdapter.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudMultipointsAdapter.java 2008-09-23 13:34:15 UTC (rev 3973) @@ -0,0 +1,45 @@ +/* + * @creation 23 sept. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.ctulu.interpolation.profile; + +import org.fudaa.ctulu.gis.GISMultiPoint; + +/** + * Un nuage de point bas\xE9 sur un GISMultiPoint. + * L'adapter permet d'acceder aux informations du nuage sans toucher a la structure des + * donn\xE9es manipul\xE9es. + * + * @author Bertrand Marchand + * @version $Id:$ + */ +public class PointCloudMultipointsAdapter implements PointCloudI { + GISMultiPoint mp_; + + + /** + * Un nuage de point construit a partir d'un multipoint. + * @param _mp Le multipoint. + */ + public PointCloudMultipointsAdapter(GISMultiPoint _mp) { + mp_=_mp; + } + + public int getNbPoints() { + return mp_.getNumPoints(); + } + + public double getX(int _idx) { + return mp_.getCoordinateSequence().getOrdinate(_idx,0); + } + public double getY(int _idx) { + return mp_.getCoordinateSequence().getOrdinate(_idx,1); + } + public double getZ(int _idx) { + return mp_.getCoordinateSequence().getOrdinate(_idx,2); + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudMultipointsAdapter.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudPointsAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudPointsAdapter.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudPointsAdapter.java 2008-09-23 13:34:15 UTC (rev 3973) @@ -0,0 +1,44 @@ +/* + * @creation 23 sept. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.ctulu.interpolation.profile; + +import org.fudaa.ctulu.gis.GISPoint; + +/** + * Un nuage de point bas\xE9 sur un tableau de GISPoint. + * L'adapter permet d'acceder aux informations du nuage sans toucher a la structure des + * donn\xE9es manipul\xE9es. + * + * @author Bertrand Marchand + * @version $Id:$ + */ +public class PointCloudPointsAdapter implements PointCloudI { + GISPoint[] pts_; + + /** + * Un nuage de point construit a partir d'un tableau de points. + * @param _pts Les points. + */ + public PointCloudPointsAdapter(GISPoint[] _pts) { + pts_=_pts; + } + + public int getNbPoints() { + return pts_.length; + } + + public double getX(int _idx) { + return pts_[_idx].getX(); + } + public double getY(int _idx) { + return pts_[_idx].getY(); + } + public double getZ(int _idx) { + return pts_[_idx].getZ(); + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/PointCloudPointsAdapter.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/ProfileCalculator.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/ProfileCalculator.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/ProfileCalculator.java 2008-09-23 13:34:15 UTC (rev 3973) @@ -0,0 +1,178 @@ +/* + * creation 29/08/2008 + * license GNU General Public License 2 + * copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * mail de...@fu... + */ +package org.fudaa.ctulu.interpolation.profile ; + +import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.CtuluLibGeometrie; +import org.fudaa.ctulu.gis.GISGeometryFactory; +import org.fudaa.ctulu.gis.GISLib; +import org.fudaa.ctulu.gis.GISPoint; + +import com.memoire.fu.FuLog; +import com.vividsolutions.jts.geom.Coordinate; + +/** + * Calculateur de profil en travers \xE0 partir d'un nuage de points. + * @author J.B. Faure + * @author Bertrand Marchand + * @version $Id:$ + */ +public class ProfileCalculator { + + /** Le nuage de points */ + PointCloudI cloud_; + /** La trace. Peut \xEAtre d\xE9termin\xE9e automatiquement, ou donn\xE9e. */ + GISPoint[] ptsTrace_; + /** La fenetre de selection */ + ProfileCalculatorWindow window_; + + /** + * Constructeur, vide. + */ + public ProfileCalculator() {} + + /** + * D\xE9finit la trace a utiliser. + * @param _pts Les points dans l'ordre dans lequel ils sont reli\xE9s. + */ + public void setTrace(GISPoint[] _pts) { + ptsTrace_=_pts; + } + + /** + * Retourne la trace, celle d\xE9finie ou calcul\xE9e. + * @return La trace. + */ + public GISPoint[] getTrace() { + return ptsTrace_; + } + + /** + * Definit la fenetre de selection. En principe, les points du nuage a prendre en compte sont dans + * cette fenetre. + * @param _w La fenetre de selection. + */ + public void setWindow(ProfileCalculatorWindow _w) { + window_=_w; + } + + /** + * @return La fenetre de selection. + */ + public ProfileCalculatorWindow getWindow() { + return window_; + } + + //accesseurs du nuage de points + /** + * D\xE9finit le nuage de points. + * @param _cloud Le nuage de points. + */ + public void setCloud(PointCloudI _cloud) { + cloud_=_cloud; + } + + /** + * @return Le nuage de points. + */ + public PointCloudI getCloud() { + return cloud_; + } + + /** + * Calcule la trace a partir des points du nuage et du rectangle de selection des points du nuage. + * TODO : A r\xE9implementer. + */ + public void computeDefaultTrace() { + if (window_==null) throw new IllegalStateException("Window points aren't defined"); + + // Une solution possible. + ptsTrace_=new GISPoint[2]; + Coordinate c1=GISLib.computeMiddle(window_.getCorner(0).getCoordinate(), window_.getCorner(1).getCoordinate()); + Coordinate c2=GISLib.computeMiddle(window_.getCorner(2).getCoordinate(), window_.getCorner(3).getCoordinate()); + + ptsTrace_[0]=(GISPoint)GISGeometryFactory.INSTANCE.createPoint(c1); + ptsTrace_[1]=(GISPoint)GISGeometryFactory.INSTANCE.createPoint(c2); + } + + + /** + * calcul de la pente moyenne du nuage de points obtenu par getCloud() \xE0 l'int\xE9rieur + * de la fen\xEAtre de s\xE9lection + * TODO : A r\xE9implementer. + */ + private double penteMoyenne(ProfileCalculatorWindow _win) { + PointCloudI cloudRestreint=_win.select(cloud_); + + // L'algo propos\xE9 ici n'est que pour donner un apercu +// double dist=ptsTrace_[0].distance(ptsTrace_[ptsTrace_.length-1]); // Fonctionne egalement. + double x1=ptsTrace_[0].getX(); + double y1=ptsTrace_[0].getY(); + double z1=ptsTrace_[0].getZ(); + double x2=ptsTrace_[ptsTrace_.length-1].getX(); + double y2=ptsTrace_[ptsTrace_.length-1].getY(); + double z2=ptsTrace_[ptsTrace_.length-1].getZ(); + + double dist=CtuluLibGeometrie.getDistance3D(x1,y1,z1,x2,y2,z2); + double pente=10/dist; + return pente; + } + + /** + * Calcul du profil \xE0 partir du nuage de points. + * NB : on impose de fournir la fen\xEAtre pour \xEAtre s\xFBr d'avoir un rectangle + * @param _algo : flag de la m\xE9thode \xE0 utiliser + * + * TODO : A r\xE9implementer. + */ + public GISPoint[] extractProfile(int _algo) { + FuLog.debug("CTU:Cloud Nb points="+cloud_.getNbPoints()); + FuLog.debug("CTU:Fenetre selection Nb points="+window_.select(cloud_).getNbPoints()); + + // Un algo tout a fait basique + + double x; + double y; + double[] zh=new double[3]; + + // 3 fenetres de m\xEAme dimension, et calcul d'une hauteur moyenne sur chaque. + for (int i=0; i<3; i++) { + GISPoint[] pts=new GISPoint[4]; + x=window_.getCorner(0).getX()+(window_.getCorner(3).getX()-window_.getCorner(0).getX())*i/3.; + y=window_.getCorner(0).getY()+(window_.getCorner(3).getY()-window_.getCorner(0).getY())*i/3.; + pts[0]=(GISPoint)GISGeometryFactory.INSTANCE.createPoint(x, y, 0); + x=window_.getCorner(1).getX()+(window_.getCorner(2).getX()-window_.getCorner(1).getX())*i/3.; + y=window_.getCorner(1).getY()+(window_.getCorner(2).getY()-window_.getCorner(1).getY())*i/3.; + pts[1]=(GISPoint)GISGeometryFactory.INSTANCE.createPoint(x, y, 0); + x=window_.getCorner(1).getX()+(window_.getCorner(2).getX()-window_.getCorner(1).getX())*(i+1)/3.; + y=window_.getCorner(1).getY()+(window_.getCorner(2).getY()-window_.getCorner(1).getY())*(i+1)/3.; + pts[2]=(GISPoint)GISGeometryFactory.INSTANCE.createPoint(x, y, 0); + x=window_.getCorner(0).getX()+(window_.getCorner(3).getX()-window_.getCorner(0).getX())*(i+1)/3.; + y=window_.getCorner(0).getY()+(window_.getCorner(3).getY()-window_.getCorner(0).getY())*(i+1)/3.; + pts[3]=(GISPoint)GISGeometryFactory.INSTANCE.createPoint(x, y, 0); + + ProfileCalculatorWindow win=new ProfileCalculatorWindow(pts); + PointCloudI cloudwin=win.select(cloud_); + // Calcul de la hauteur moyenne. + zh[i]=0; + for (int j=0; j<cloudwin.getNbPoints(); j++) { + zh[i]+=cloudwin.getZ(j); + } + zh[i]/=cloudwin.getNbPoints(); + + FuLog.debug("CTU:Sous fenetre "+(i+1)+" Nb points="+cloudwin.getNbPoints()+", Zh="+zh[i]); + } + + GISPoint[] prof=new GISPoint[ptsTrace_.length]; + for (int i=0; i<ptsTrace_.length; i++) { + double z=zh[(i*3)/ptsTrace_.length]; + prof[i]=(GISPoint)GISGeometryFactory.INSTANCE.createPoint(ptsTrace_[i].getX(),ptsTrace_[i].getY(),z); + } + + return prof; + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/ProfileCalculator.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/ProfileCalculatorWindow.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/ProfileCalculatorWindow.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/ProfileCalculatorWindow.java 2008-09-23 13:34:15 UTC (rev 3973) @@ -0,0 +1,90 @@ +/* + * creation 29/08/2008 + * license GNU General Public License 2 + * copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * mail de...@fu... + */ +package org.fudaa.ctulu.interpolation.profile ; + +import gnu.trove.TIntArrayList; + +import org.fudaa.ctulu.gis.GISGeometryFactory; +import org.fudaa.ctulu.gis.GISLib; +import org.fudaa.ctulu.gis.GISPoint; + +import com.vividsolutions.jts.algorithm.PointInRing; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.LinearRing; + +/** + * D\xE9finition de la fen\xEAtre rectangulaire dans laquelle on s\xE9lectionne les points \xE0 utiliser + * pour le calcul du profil. + * + * @author J.B. Faure + * @author Bertrand Marchand + * @version $Id:$ + */ +public class ProfileCalculatorWindow { + + /** Les points repr\xE9sentant la fenetre */ + GISPoint[] points_; + /** Le tester associ\xE9 au rectangle de selection */ + PointInRing tester_; + /** Pour optimiser la vitesse de traitement */ + Coordinate ctmp_; + + /** + * Constructeur, a partir des 4 points formant un rectangle. + * @param _points Les points du rectangle. + */ + public ProfileCalculatorWindow(GISPoint[] _points) { + + // TODO : Verifier que les 4 points forment bien un carr\xE9. + Coordinate[] coords=new Coordinate[5]; + for (int i=0; i<_points.length; i++) { + coords[i]=(Coordinate)_points[i].getCoordinate().clone(); + } + coords[4]=coords[0]; // Ferme le polygone. + + // Pour pouvoir tester qu'un point est interne au rectangle. + LinearRing pl=GISGeometryFactory.INSTANCE.createLinearRing(coords); + tester_=GISLib.getTester(new LinearRing[]{pl})[0]; + ctmp_=new Coordinate(); + + points_=_points; + } + + /** + * @param _idx L'index du sommet, de 0 \xE0 3. + * @return Retourne le coin d'index _idx + */ + public GISPoint getCorner(int _idx) { + return points_[_idx]; + } + + /** + * V\xE9rifie si le point pass\xE9 en argument se trouve \xE0 l'int\xE9rieur de la fen\xEAtre + * @param _x La coordonn\xE9e X + * @param _y La coordonn\xE9e Y + * @return True si point \xE0 l'interieur. + */ + public boolean isInside(double _x, double _y) { + ctmp_.x=_x; + ctmp_.y=_y; + return tester_.isInside(ctmp_); + } + + /** + * G\xE9n\xE8re un nouveau nuage de point en s\xE9lectionnant ceux qui sont dans la fen\xEAtre + * @param _cloud Le nuage de points initial + * @return Le nouveau nuage de points. + */ + public PointCloudI select(PointCloudI _cloud) { + TIntArrayList idx=new TIntArrayList(); + int nb=_cloud.getNbPoints(); + for (int i=0; i<nb; i++) { + if (isInside(_cloud.getX(i),_cloud.getY(i))) idx.add(i); + } + return new PointCloudFilterAdapter(_cloud,idx.toNativeArray()); + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/ProfileCalculatorWindow.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/package.html =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/package.html (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/package.html 2008-09-23 13:34:15 UTC (rev 3973) @@ -0,0 +1,8 @@ +<html> +<body> +Ce package permet de cr\xE9er des profils 3D \xE0 partir d'un nuage de points et d'une trace exprim\xE9e sous +forme de GISPoint.<p> +Les points g\xE9n\xE9r\xE9s ne sont pas forcement confondus avec les points de la trace (sauf le premier et dernier point).<p> +Auteur de l'algorithme: JB. Faure - CEMAGREF +</body> +</html> Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/interpolation/profile/package.html ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/test/org/fudaa/ctulu/interpolation/profile/TestInterpolationProfile.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/test/org/fudaa/ctulu/interpolation/profile/TestInterpolationProfile.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/test/org/fudaa/ctulu/interpolation/profile/TestInterpolationProfile.java 2008-09-23 13:34:15 UTC (rev 3973) @@ -0,0 +1,116 @@ +/* + * @creation 23 sept. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.ctulu.interpolation.profile; + +import org.fudaa.ctulu.gis.GISGeometryFactory; +import org.fudaa.ctulu.gis.GISPoint; + +/** + * Test de l'interpolateur de profil. A partir d'un nuage de points et d'une trace 2D. + * @author Bertrand Marchand + * @version $Id:$ + */ +public class TestInterpolationProfile { + + // Coordonn\xE9es trace + static double[][] ctrace={ + {427238.0, 245099.0, 0}, + {427229.6, 245019.8, 0}, + {427223.0, 244852.0, 0} + }; + + // Coordonn\xE9es nuage de points + static double[][] ccloud={ + {427209.348, 245104.277, 25.0}, + {427269.064, 245095.43, 25.0}, + {427212.297, 245076.262, 25.0}, + {427183.545, 245077.736, 25.0}, + {427292.655, 245077.736, 25.0}, + {427191.654, 245031.291, 25.0}, + {427288.969, 245020.232, 25.0}, + {427174.698, 244956.093, 23.0}, + {427276.436, 244963.465, 23.0}, + {427283.071, 244925.129, 23.0}, + {427173.961, 244913.333, 24.0}, + {427221.144, 244889.005, 24.0}, + {427209.348, 244868.362, 24.0}, + {427257.268, 244880.895, 24.0}, + {427265.378, 244851.406, 24.0}, + {427289.706, 244858.041, 24.0}, + {427157.741, 244851.406, 24.0}, + {427198.289, 244833.712, 24.0} + }; + + // Coordonn\xE9es window + static double[][] cwin={ + {427134.887, 244823.391, 0}, + {427324.356, 244823.391, 0}, + {427324.356, 245116.81, 0}, + {427134.887, 245116.81, 0} + }; + + /** + * Lancement du test de calcul de profil. + * @param args + */ + public static void main(String[] args) { + // Un nuage de point. + GISPoint[] ptscloud=new GISPoint[ccloud.length]; + for (int i=0; i<ptscloud.length; i++) { + ptscloud[i]=(GISPoint)GISGeometryFactory.INSTANCE.createPoint(ccloud[i][0],ccloud[i][1],ccloud[i][2]); + } + PointCloudPointsAdapter cloud=new PointCloudPointsAdapter(ptscloud); + + // Une fenetre, rectangle, contenant le nuage de points. + GISPoint[] ptswin=new GISPoint[cwin.length]; + for (int i=0; i<ptswin.length; i++) { + ptswin[i]=(GISPoint)GISGeometryFactory.INSTANCE.createPoint(cwin[i][0],cwin[i][1],cwin[i][2]); + } + ProfileCalculatorWindow win=new ProfileCalculatorWindow(ptswin); + + // Le calculateur de profils + ProfileCalculator pc=new ProfileCalculator(); + pc.setWindow(win); + pc.setCloud(cloud); + + GISPoint[] trace; + GISPoint[] prof; + + // Extraction pour une trace fix\xE9e, a l'interieur de la fenetre de selection. + // A priori, le Z de la trace n'a pas d'importance. + + trace=new GISPoint[ctrace.length]; + for (int i=0; i<trace.length; i++) { + trace[i]=(GISPoint)GISGeometryFactory.INSTANCE.createPoint(ctrace[i][0],ctrace[i][1],ctrace[i][2]); + } + System.out.println("* Trace fixee:"); + for (int i=0; i<trace.length; i++) { + System.out.println("Pt "+i+": X="+trace[i].getX()+" Y="+trace[i].getY()+" Z="+trace[i].getZ()); + } + pc.setTrace(trace); + prof=pc.extractProfile(0); + System.out.println("* Profil obtenu:"); + for (int i=0; i<prof.length; i++) { + System.out.println("Pt "+i+": X="+prof[i].getX()+" Y="+prof[i].getX()+" Z="+prof[i].getZ()); + } + + // Extraction pour une trace calcul\xE9e. + + System.out.println("* Trace calcul\xE9e:"); + pc.computeDefaultTrace(); + trace=pc.getTrace(); + for (int i=0; i<trace.length; i++) { + System.out.println("Pt "+i+": X="+trace[i].getX()+" Y="+trace[i].getY()+" Z="+trace[i].getZ()); + } + prof=pc.extractProfile(0); + System.out.println("* Profil obtenu:"); + for (int i=0; i<prof.length; i++) { + System.out.println("Pt "+i+": X="+prof[i].getX()+" Y="+prof[i].getX()+" Z="+prof[i].getZ()); + } + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/test/org/fudaa/ctulu/interpolation/profile/TestInterpolationProfile.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |