From: <emm...@us...> - 2009-01-16 13:36:20
|
Revision: 4378 http://fudaa.svn.sourceforge.net/fudaa/?rev=4378&view=rev Author: emmanuel_martin Date: 2009-01-16 13:36:14 +0000 (Fri, 16 Jan 2009) Log Message: ----------- Tache #146 : "Edition de bief : Ajouter la visualisation des lignes directrices" Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGCourbeModelDefault.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGCourbeModelProfile.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGModel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeDefautModel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCoordinatesModel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueCourbe.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacBoundaryCourbeModel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacWeirCourbeModel.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java 2009-01-16 08:31:00 UTC (rev 4377) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java 2009-01-16 13:36:14 UTC (rev 4378) @@ -312,4 +312,16 @@ return "ATTRIBUTE_INTERSECTION_LIMITE_STOCKAGE_DROITE"; } }; + + /** + * Attribut contenant l'index des points correspondants aux l'intersections entre + * les lignes directrices et un profil. Ces index sont stock\xE9s dans une List<Integer>. + */ + public final static GISAttribute INTERSECTIONS_LIGNES_DIRECTRICES=new GISAttribute(null, CtuluLib + .getS("Intersections lignes directrices"), false){ + @Override + public String getID() { + return "ATTRIBUTE_INTERSECTIONS_LIGNES_DIRECTRICES"; + } + }; } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java 2009-01-16 08:31:00 UTC (rev 4377) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java 2009-01-16 13:36:14 UTC (rev 4378) @@ -413,15 +413,39 @@ xiVisible = _t.getXAxe().containsPoint(xi); yiVisible = getAxeY().containsPoint(yi); - if (model_.isPointDrawn(i) && xiVisible && yiVisible && iconeModel_.getType() != TraceIcon.RIEN) { - if (displayTitleOnCurve_) { - if (rangeDisplayed == null) { - rangeDisplayed = new Envelope(); + if(model_.isPointDrawn(i) && xiVisible && yiVisible) { + // Paint point label + String pLabel=model_.getPointLabel(i); + if(pLabel!=null) { + // Dessin de la boite et du label + // X + int xBox; + if(((int) xie)==_t.getMinEcranX()) + xBox=((int) xie); + else if(((int) xie)==_t.getMaxEcranX()) + xBox=((int) xie)-_g.getFontMetrics().stringWidth(pLabel)-3; + else + xBox=((int) xie)-_g.getFontMetrics().stringWidth(pLabel)/2-2; + // Y + int yBox; + if(((int) yie)==_t.getMaxEcranY()) + yBox=((int) yie)-10; + else + yBox=((int) yie)+10; + // Paint + tbox_.paintBox(_g, xBox, yBox, pLabel); + } + // Paint point + if(iconeModel_.getType() != TraceIcon.RIEN) { + if (displayTitleOnCurve_) { + if (rangeDisplayed == null) { + rangeDisplayed = new Envelope(); + } + rangeDisplayed.expandToInclude(xi, yi); } - rangeDisplayed.expandToInclude(xi, yi); + // icone_.couleur(getAspectContour()); + trIcon.paintIconCentre(_g, xie, yie); } - // icone_.couleur(getAspectContour()); - trIcon.paintIconCentre(_g, xie, yie); } if ((i > 0) && model_.isSegmentDrawn(i - 1) && (xpVisible || xiVisible || _t.getXAxe().isContained(xpe, xie))) { if (displayTitleOnCurve_) { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGCourbeModelDefault.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGCourbeModelDefault.java 2009-01-16 08:31:00 UTC (rev 4377) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGCourbeModelDefault.java 2009-01-16 13:36:14 UTC (rev 4378) @@ -113,6 +113,10 @@ return 0; } + public String getPointLabel(int _i) { + return null; + } + public int getNbValues() { return x_.length; } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGCourbeModelProfile.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGCourbeModelProfile.java 2009-01-16 08:31:00 UTC (rev 4377) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGCourbeModelProfile.java 2009-01-16 13:36:14 UTC (rev 4378) @@ -72,6 +72,10 @@ return name_; } + public String getPointLabel(int _i) { + return null; + } + /* (non-Javadoc) * @see org.fudaa.ebli.courbe.EGModel#getX(int) */ Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGModel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGModel.java 2009-01-16 08:31:00 UTC (rev 4377) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/courbe/EGModel.java 2009-01-16 13:36:14 UTC (rev 4378) @@ -47,6 +47,14 @@ boolean isPointDrawn(int _i); /** + * @param _i + * l'indice du point compris entre 0 et getNbPoint()-1 + * @return le text \xE0 afficher concernant le point correspondant \xE0 _i. Null si + * il n'y en a pas. + */ + String getPointLabel(int _i); + + /** * @param _idx l'indice voulu * @return la valeur de x en ce point */ Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeDefautModel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeDefautModel.java 2009-01-16 08:31:00 UTC (rev 4377) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeDefautModel.java 2009-01-16 13:36:14 UTC (rev 4378) @@ -87,6 +87,10 @@ return false; } + public String getPointLabel(int _i) { + return null; + } + public int getNbValues() { return e_.getNbValues(); } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java 2009-01-16 08:31:00 UTC (rev 4377) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java 2009-01-16 13:36:14 UTC (rev 4378) @@ -78,6 +78,10 @@ return false; } + public String getPointLabel(int _i) { + return null; + } + public int getNbValues() { if (y_ == null) { return 0; Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-01-16 08:31:00 UTC (rev 4377) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-01-16 13:36:14 UTC (rev 4378) @@ -116,6 +116,10 @@ return 0; } + public String getPointLabel(int _i) { + return null; + } + public int getNbValues() { return res_.getNbIntersect(); } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCoordinatesModel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCoordinatesModel.java 2009-01-16 08:31:00 UTC (rev 4377) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCoordinatesModel.java 2009-01-16 13:36:14 UTC (rev 4378) @@ -81,6 +81,10 @@ return false; } + public String getPointLabel(int _i) { + return null; + } + public int getNbValues() { return res_.getNbIntersect(); } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java 2009-01-16 08:31:00 UTC (rev 4377) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java 2009-01-16 13:36:14 UTC (rev 4378) @@ -127,6 +127,9 @@ int idxRg=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE); if (idxRg==-1) attToAdd++; + int idxLd=zone.getIndiceOf(GISAttributeConstants.INTERSECTIONS_LIGNES_DIRECTRICES); + if(idxLd==-1) + attToAdd++; // Ajout des attributs manquant \\ if (attToAdd>0) { GISAttributeInterface[] atts=new GISAttributeInterface[zone.getNbAttributes()+attToAdd]; @@ -141,24 +144,28 @@ atts[k++]=GISAttributeConstants.INTERSECTION_RIVE_DROITE; if (idxRg==-1) atts[k++]=GISAttributeConstants.INTERSECTION_RIVE_GAUCHE; + if(idxLd==-1) + atts[k++]=GISAttributeConstants.INTERSECTIONS_LIGNES_DIRECTRICES; zone.setAttributes(atts, null); } int idxAttRiveGauche=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE); int idxAttRiveDroite=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_RIVE_DROITE); int idxAttlsGauche=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE); int idxAttlsDroite=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE); + int idxAttLignesDirectrices=zone.getIndiceOf(GISAttributeConstants.INTERSECTIONS_LIGNES_DIRECTRICES); if (axeHydraulique_.getNombre()==0) for (int i=0; i<profils_.getNombre(); i++) { profils_.getGeomData().setAttributValue(idxAttRiveGauche, i, null, null); profils_.getGeomData().setAttributValue(idxAttRiveDroite, i, null, null); profils_.getGeomData().setAttributValue(idxAttlsGauche, i, null, null); profils_.getGeomData().setAttributValue(idxAttlsDroite, i, null, null); + profils_.getGeomData().setAttributValue(idxAttLignesDirectrices, i, new ArrayList<Integer>(0), null); } if (axeHydraulique_.getNombre()==1) { Geometry axeHydraulique=(Geometry)axeHydraulique_.getObject(0); CoordinateSequence seqAxeHydraulique=((GISCoordinateSequenceContainerInterface)axeHydraulique).getCoordinateSequence(); orderProfils(-1, null); - // Construction des rives et limites de stockages \\ + // Normalise le sens du profil \\ for (int k=0; k<profils_.getNombre(); k++) { Geometry profil=zone.getGeometry(k); CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); @@ -187,7 +194,9 @@ profil=(Geometry)profils_.getGeomData().getGeometry(k); seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); } - double abscisseCurvIntersectionAxe=UtilsProfil1d.abscisseCurviligne(seqProfil, interAxeProfil); + } + // Cr\xE9ation des nouveaux points sur les profils \\ + for (int k=0; k<profils_.getNombre(); k++) { // Ajout des points au profil si n\xE9c\xE9ssaire pour les intersections \\ // Rives for (int l=0; l<rives_.getNombre(); l++) @@ -195,8 +204,16 @@ // Limites de stockages for (int l=0; l<limitesStockages_.getNombre(); l++) createPointIfNeeded(k, (GISPolyligne) limitesStockages_.getObject(l)); - profil=(Geometry)profils_.getGeomData().getGeometry(k); - seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); + // Lignes directrices + for (int l=0; l<lignesDirectrices_.getNombre(); l++) + createPointIfNeeded(k, (GISPolyligne) lignesDirectrices_.getObject(l)); + } + // Valuation des attributs simple d'intersection (rives et limites) \\ + for(int k=0;k<profils_.getNombre();k++) { + Geometry profil=zone.getGeometry(k); + CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); + Coordinate interAxeProfil=profil.intersection(axeHydraulique).getCoordinate(); + double abscisseCurvIntersectionAxe=UtilsProfil1d.abscisseCurviligne(seqProfil, interAxeProfil); // Valuation des attributs avec les index des points des intersections \\ // Rives zone.setAttributValue(idxAttRiveGauche, k, 0, null); @@ -210,6 +227,9 @@ for (int l=0; l<limitesStockages_.getNombre(); l++) valuateProfilIntersection(k, (Geometry) limitesStockages_.getObject(l), idxAttlsGauche, idxAttlsDroite, abscisseCurvIntersectionAxe); } + // Valuation des attributs composites d'intersection (lignes directrices) \\ + // Lignes directrices \\ + valuateProfilIntersection(idxAttLignesDirectrices); } // Activation du synchroniser gisSynchroniser_.enable(); @@ -259,6 +279,79 @@ profils_.getGeomData().setAttributValue(_idxAttrGauche, _idxProfil, idxIntersection, null); } } + + /** + * Valuation des attributs composites des profils, c'est \xE0 dire des attributs contenant plusieurs + * informations d'intersection sous forme d'une liste. + * + * @param _idxAttr l'index de l'attribut o\xF9 sera stock\xE9 les intersections + */ + @SuppressWarnings("unchecked") + private void valuateProfilIntersection(int _idxAttr) { + // Cr\xE9ation des listes + for (int k=0; k<profils_.getNombre(); k++) + profils_.getGeomData().setAttributValue(_idxAttr, k, new ArrayList<Integer>(), null); + // Valuation de l'attribut + int k=0; + int[] lstIntersectionTmp=new int[profils_.getNombre()]; + while (k<lignesDirectrices_.getNombre()) { + Geometry ligneD=(Geometry)lignesDirectrices_.getObject(k); + // Recherche des croisements avec les profils + for (int l=0; l<profils_.getNombre(); l++) { + Geometry profil=profils_.getGeomData().getGeometry(l); + CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); + Geometry inter=((Geometry)profils_.getObject(l)).intersection(ligneD); + if (inter.getNumPoints()==0) + lstIntersectionTmp[l]=-1; + else + lstIntersectionTmp[l]=UtilsProfil1d.getIndex(seqProfil, inter.getCoordinate()); + } + // Test si au moins un croisement existe + boolean ok=false; + int m=-1; + while (!ok&&++m<lstIntersectionTmp.length) + ok=lstIntersectionTmp[m]!=-1; + if (!ok) + // Suppression de la ligne directrice qui est inutile et pas + // incr\xE9mentation de k + lignesDirectrices_.getGeomData().removeGeometries(new int[]{k}, null); + else { + for (int l=0; l<profils_.getNombre(); l++) { + // R\xE9cup\xE9ration de la liste contenant les index + List<Integer> lst=(List<Integer>)profils_.getGeomData().getValue(_idxAttr, l); + if (lstIntersectionTmp[l]!=-1) + // Enregistrement de l'index + lst.add(lstIntersectionTmp[l]); + else { + // Place le permier ou le dernier index \\ + // Recherche d'un point avant + int idxTest=l; + while (idxTest>=0&&lstIntersectionTmp[idxTest]==-1) + idxTest--; + if (idxTest<0) { + // Recherche d'un point apr\xE8s + idxTest=l; + while (idxTest<lstIntersectionTmp.length&&lstIntersectionTmp[idxTest]==-1) + idxTest++; + } + // Extraction d'informations sur le profils et l'axe hydraulique + Geometry profil=profils_.getGeomData().getGeometry(idxTest); + CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); + Coordinate intersection=profil.intersection((Geometry)axeHydraulique_.getObject(0)).getCoordinate(); + int idxAxe=UtilsProfil1d.getPreviousIndex(seqProfil, intersection); + if (idxAxe==-1) + idxAxe=0; + // Enregistrement de l'index + if (lstIntersectionTmp[idxTest]<=idxAxe) + lst.add(0); + else + lst.add(profils_.getGeomData().getCoordinateSequence(l).size()-1); + } + } + k++; + } + } + } /** * Cr\xE9e un point \xE0 l'intersection du profil indiqu\xE9 par _idxProfil et de @@ -456,12 +549,12 @@ private int idxRiveDroite_=-1; private int idxLimiteStockageGauche_=-1; private int idxLimiteStockageDroite_=-1; - private List<Integer> idxLignesDirectrices_=new ArrayList<Integer>(); // Les index des attributs \\ private int idxAttRiveGauche_=-1; private int idxAttRiveDroite_=-1; private int idxAttlsGauche_=-1; private int idxAttlsDroite_=-1; + private int idxAttlignesDirectrices_=-1; /** * Active/met \xE0 jour le synchroniser. @@ -479,6 +572,7 @@ idxAttRiveDroite_=profilsListen_.getGeomData().getIndiceOf(GISAttributeConstants.INTERSECTION_RIVE_DROITE); idxAttlsGauche_=profilsListen_.getGeomData().getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE); idxAttlsDroite_=profilsListen_.getGeomData().getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE); + idxAttlignesDirectrices_=profilsListen_.getGeomData().getIndiceOf(GISAttributeConstants.INTERSECTIONS_LIGNES_DIRECTRICES); // D\xE9termination des index de g\xE9om\xE9tries // Rives if(rivesModified_.getNombre()>0) { @@ -557,11 +651,11 @@ idxRiveDroite_=-1; idxLimiteStockageGauche_=-1; idxLimiteStockageDroite_=-1; - idxLignesDirectrices_.clear(); idxAttRiveGauche_=-1; idxAttRiveDroite_=-1; idxAttlsGauche_=-1; idxAttlsDroite_=-1; + idxAttlignesDirectrices_=-1; } } @@ -593,13 +687,10 @@ idxLimiteStockageGauche_=-1; idxLimiteStockageDroite_=-1; // Lignes directrices - if (idxLignesDirectrices_.size()>0) { - int[] idxLD=new int[idxLignesDirectrices_.size()]; - for (int i=0; i<idxLignesDirectrices_.size(); i++) - idxLD[i]=idxLignesDirectrices_.get(i); - lignesDirectricesModified_.getGeomData().removeGeometries(idxLD, null); - idxLignesDirectrices_.clear(); - } + int[] idx=new int[lignesDirectricesModified_.getNombre()]; + for(int i=0;i<idx.length;i++) + idx[i]=i; + lignesDirectricesModified_.getGeomData().removeGeometries(idx, null); } /** @@ -620,6 +711,8 @@ updateGeom(_idxGeom, limitesStockagsesModified_, idxLimiteStockageGauche_, idxAttlsGauche_); else if(_att==GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE) updateGeom(_idxGeom, limitesStockagsesModified_, idxLimiteStockageDroite_, idxAttlsDroite_); + else if(_att==GISAttributeConstants.INTERSECTIONS_LIGNES_DIRECTRICES) + updateLd(_idxGeom); } public void geometryAction(Object _source, int _idxGeom, Geometry _geom, int _action) { @@ -628,12 +721,14 @@ updateGeom(_idxGeom, rivesModified_, idxRiveDroite_, idxAttRiveDroite_); updateGeom(_idxGeom, limitesStockagsesModified_, idxLimiteStockageGauche_, idxAttlsGauche_); updateGeom(_idxGeom, limitesStockagsesModified_, idxLimiteStockageDroite_, idxAttlsDroite_); + updateLd(_idxGeom); } } /** * R\xE9g\xE9n\xE8re toutes les g\xE9om\xE9tries volatiles. */ + @SuppressWarnings("unchecked") private void regenerateAll() { GISZoneCollection zone=profilsListen_.getGeomData(); // Cr\xE9ation des nouvelles g\xE9om\xE9tries \\ @@ -651,19 +746,35 @@ lsGauche[i]=zone.getCoordinateSequence(i).getCoordinate((Integer)zone.getValue(idxAttlsGauche_, i)); lsDroite[i]=zone.getCoordinateSequence(i).getCoordinate((Integer)zone.getValue(idxAttlsDroite_, i)); } + // Lignes directrices + Coordinate[][] ld=new Coordinate[lignesDirectricesModified_.getNombre()][]; + for(int i=0; i<ld.length; i++) + ld[i]=new Coordinate[profilsListen_.getNombre()]; + for(int i=0; i<profilsListen_.getNombre(); i++) { + List<Integer> lst=(List<Integer>) profilsListen_.getGeomData().getValue(idxAttlignesDirectrices_, i); + for(int j=0; j<lignesDirectricesModified_.getNombre(); j++) + ld[j][i]=profilsListen_.getGeomData().getCoordinateSequence(i).getCoordinate(lst.get(j)); + } + // Ajout des nouvelles g\xE9o\xE9mtries \\ // Extraction des anciennes donn\xE9es Object[] dataRiveGauche=getData(idxRiveGauche_, rivesModified_.getGeomData()); Object[] dataRiveDroite=getData(idxRiveDroite_, rivesModified_.getGeomData()); Object[] dataLsGauche=getData(idxLimiteStockageGauche_, rivesModified_.getGeomData()); Object[] dataLsDroite=getData(idxLimiteStockageDroite_, rivesModified_.getGeomData()); + Object[][] dataLignesDirectrices=new Object[lignesDirectricesModified_.getNombre()][]; + for(int i=0;i<lignesDirectricesModified_.getNombre();i++) + dataLignesDirectrices[i]=getData(i, lignesDirectricesModified_.getGeomData()); // Destruction des g\xE9om\xE9tries destroyGeometries(); - // Ajout des geometries + // Ajout des geometries \\ + // Rives if (riveGauche.length>1&&riveGauche[0]!=null&&rivesModified_!=null) - idxRiveGauche_=rivesModified_.getGeomData().addGeometry(new GISPolyligne(new GISCoordinateSequenceFactory().create(riveGauche)), dataRiveGauche, null); + idxRiveGauche_=rivesModified_.getGeomData().addGeometry( + new GISPolyligne(new GISCoordinateSequenceFactory().create(riveGauche)), dataRiveGauche, null); if (riveDroite.length>1&&riveDroite[0]!=null&&rivesModified_!=null) - idxRiveDroite_=rivesModified_.getGeomData().addGeometry(new GISPolyligne(new GISCoordinateSequenceFactory().create(riveDroite)), dataRiveDroite, null); + idxRiveDroite_=rivesModified_.getGeomData().addGeometry( + new GISPolyligne(new GISCoordinateSequenceFactory().create(riveDroite)), dataRiveDroite, null); // Limites de stockages if (lsGauche.length>1&&lsGauche[0]!=null&&limitesStockagsesModified_!=null) idxLimiteStockageGauche_=limitesStockagsesModified_.getGeomData().addGeometry( @@ -671,6 +782,10 @@ if (lsDroite.length>1&&lsDroite[0]!=null&&limitesStockagsesModified_!=null) idxLimiteStockageDroite_=limitesStockagsesModified_.getGeomData().addGeometry( new GISPolyligne(new GISCoordinateSequenceFactory().create(lsDroite)), dataLsDroite, null); + // Lignes directrices + for (int i=0; i<ld.length; i++) + lignesDirectricesModified_.getGeomData().addGeometry(new GISPolyligne(new GISCoordinateSequenceFactory().create(ld[i])), + dataLignesDirectrices[i], null); } /** @@ -705,6 +820,32 @@ _model.getGeomData().setCoordinateSequence(_idxGeomVolatile, seqGeomV, null); } } + + /** + * Met \xE0 jours les lignes directrices. + * @param _idxPoint indique l'index du point ayant chang\xE9 + */ + @SuppressWarnings("unchecked") + private void updateLd(int _idxGeom) { + if(_idxGeom==-1) + return; + List<Integer> lstIdx=(List<Integer>)profilsListen_.getGeomData().getValue(idxAttlignesDirectrices_, _idxGeom); + CoordinateSequence seqProfil=profilsListen_.getGeomData().getCoordinateSequence(_idxGeom); + boolean found=false; + int i=-1; + while(!found&&++i<lignesDirectricesModified_.getNombre()) { + CoordinateSequence seqLd= lignesDirectricesModified_.getGeomData().getCoordinateSequence(i); + Coordinate coodProfil=seqProfil.getCoordinate(lstIdx.get(i)); + // Test si c'est bien cette ligne directrice \xE0 mettre \xE0 jour + if(!UtilsProfil1d.egal(coodProfil, seqLd.getCoordinate(_idxGeom))) { + found=true; + seqLd.setOrdinate(_idxGeom, 0, coodProfil.x); + seqLd.setOrdinate(_idxGeom, 1, coodProfil.y); + seqLd.setOrdinate(_idxGeom, 2, coodProfil.z); + lignesDirectricesModified_.getGeomData().setCoordinateSequence(i, seqLd, null); + } + } + } } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java 2009-01-16 08:31:00 UTC (rev 4377) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java 2009-01-16 13:36:14 UTC (rev 4378) @@ -59,6 +59,15 @@ /** Retourne l'abscisse curviligne de l'axe sur le profil (ne pas confondre avec getAbsCurvProfilOnAxeHydraulique). -1 si inexistant. */ public double getAbsCurvAxeHydrauliqueOnProfil(); + /** Retourne les index des lignes directrices croisant le profil. null si aucun profil n'est selectionn\xE9. */ + public int[] getIdxLignesDirectrices(); + + /** Retourne les noms des lignes directrices. null si aucun profil n'est s\xE9lectionn\xE9 ou si il n'y a pas de noms.*/ + public String[] getNamesLignesDirectrices(); + + /** Retourneles noms des lignes directrices associ\xE9s \xE0 l'index pass\xE9 en param\xE8tre. null si aucun. */ + public String[] getNamesLignesDirectricesAt(int _idxPoint); + /** * Enregistre l'abcisse curviligne du point indiqu\xE9 en param\xE8tre. * Ce changement d'abscisse curviligne fonctionne sur tout les points. Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-01-16 08:31:00 UTC (rev 4377) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-01-16 13:36:14 UTC (rev 4378) @@ -328,11 +328,11 @@ } /** - * Retourne la valeur de l'attribut d'intersection demand\xE9. C'est donc un index de point qui est renvoy\xE9. + * Retourne la valeur de l'attribut d'intersection demand\xE9. */ - private int getValueOf(GISAttributeInterface attr_) { + private Object getValueOf(GISAttributeInterface attr_) { int idxAtt=biefContainer_.getZoneProfils().getIndiceOf(attr_); - return (Integer) biefContainer_.getZoneProfils().getValue(idxAtt, idxProfilSelected_); + return biefContainer_.getZoneProfils().getValue(idxAtt, idxProfilSelected_); } private CoordinateSequence getCoordSeq() { @@ -341,36 +341,79 @@ } public double getAbsCurvRiveGauche() { - if(idxProfilSelected_==-1) + if (idxProfilSelected_==-1) return -1; - return getCurv(getValueOf(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE)); + return getCurv((Integer)getValueOf(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE)); } - + public double getAbsCurvRiveDroite() { - if(idxProfilSelected_==-1) + if (idxProfilSelected_==-1) return -1; - return getCurv(getValueOf(GISAttributeConstants.INTERSECTION_RIVE_DROITE)); + return getCurv((Integer)getValueOf(GISAttributeConstants.INTERSECTION_RIVE_DROITE)); } - + public double getAbsCurvLimiteStockageGauche() { - if(idxProfilSelected_==-1) + if (idxProfilSelected_==-1) return -1; - return getCurv(getValueOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE)); + return getCurv((Integer)getValueOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE)); } public double getAbsCurvLimiteStockageDroite() { - if(idxProfilSelected_==-1) + if (idxProfilSelected_==-1) return -1; - return getCurv(getValueOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE)); + return getCurv((Integer)getValueOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE)); } - + public double getAbsCurvProfilOnAxeHydraulique() { - if(idxProfilSelected_==-1||biefContainer_.getZoneAxeHydraulique().getNbGeometries()==0) + if (idxProfilSelected_==-1||biefContainer_.getZoneAxeHydraulique().getNbGeometries()==0) return -1; - return UtilsProfil1d.abscisseCurviligne(((GISCoordinateSequenceContainerInterface)biefContainer_.getZoneAxeHydraulique().getGeometry(0)) - .getCoordinateSequence(), getCoordSeq()); + return UtilsProfil1d.abscisseCurviligne(((GISCoordinateSequenceContainerInterface)biefContainer_.getZoneAxeHydraulique() + .getGeometry(0)).getCoordinateSequence(), getCoordSeq()); } + @SuppressWarnings("unchecked") + public int[] getIdxLignesDirectrices() { + if (idxProfilSelected_==-1) + return null; + List<Integer> lst=(List<Integer>)getValueOf(GISAttributeConstants.INTERSECTIONS_LIGNES_DIRECTRICES); + int[] result=new int[lst.size()]; + for (int i=0; i<lst.size(); i++) + result[i]=lst.get(i); + return result; + } + + public String[] getNamesLignesDirectricesAt(int _idxPoint) { + if (idxProfilSelected_==-1||_idxPoint<0||_idxPoint>=getNbPoint()) + return null; + // Nom des lignes directrices + int[] idx=getIdxLignesDirectrices(); + String[] names=getNamesLignesDirectrices(); + if(idx==null||names==null) + return null; + // Construction du label par agr\xE9gation des noms des lignes directrices croisant le point + ArrayList<String> labels=new ArrayList<String>(); + for(int i=0;i<idx.length;i++) + if(idx[i]==_idxPoint) + labels.add(names[i]); + if(labels.size()==0) + return null; + else + return labels.toArray(new String[0]); + } + + public String[] getNamesLignesDirectrices() { + if (idxProfilSelected_==-1) + return null; + GISZoneCollection zoneLd=biefContainer_.getZoneLignesDirectrices(); + int idxTitre=zoneLd.getIndiceOf(GISAttributeConstants.TITRE); + if(idxTitre==-1) + return null; + String[] result=new String[zoneLd.getNbGeometries()]; + for(int i=0; i<result.length;i++) + result[i]=(String) zoneLd.getValue(idxTitre, i); + return result; + } + public double getAbsCurvAxeHydrauliqueOnProfil() { if(idxProfilSelected_==-1||biefContainer_.getZoneAxeHydraulique().getNbGeometries()==0) return -1; @@ -382,7 +425,7 @@ } public void setLimiteGauche(int _idx, CtuluCommandContainer _cmd) { - int idxRiveGauche=getValueOf(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE); + int idxRiveGauche=(Integer) getValueOf(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE); if(_idx<=idxRiveGauche) setIndexIn(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE, _idx, _cmd); else @@ -390,7 +433,7 @@ } public void setLimiteDroite(int _idx, CtuluCommandContainer _cmd) { - int idxRiveDroite=getValueOf(GISAttributeConstants.INTERSECTION_RIVE_DROITE); + int idxRiveDroite=(Integer) getValueOf(GISAttributeConstants.INTERSECTION_RIVE_DROITE); if(_idx>=idxRiveDroite) setIndexIn(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE, _idx, _cmd); else @@ -398,8 +441,8 @@ } public void setRiveGauche(int _idx, CtuluCommandContainer _cmd) { - int idxLimiteGauche=getValueOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE); - int idxRiveDroite=getValueOf(GISAttributeConstants.INTERSECTION_RIVE_DROITE); + int idxLimiteGauche=(Integer) getValueOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE); + int idxRiveDroite=(Integer) getValueOf(GISAttributeConstants.INTERSECTION_RIVE_DROITE); if(_idx>=idxLimiteGauche&&_idx<idxRiveDroite) setIndexIn(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE, _idx, _cmd); else @@ -407,8 +450,8 @@ } public void setRiveDroite(int _idx, CtuluCommandContainer _cmd) { - int idxLimiteDroite=getValueOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE); - int idxRiveGauche=getValueOf(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE); + int idxLimiteDroite=(Integer) getValueOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE); + int idxRiveGauche=(Integer) getValueOf(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE); if(_idx<=idxLimiteDroite&&_idx>idxRiveGauche) setIndexIn(GISAttributeConstants.INTERSECTION_RIVE_DROITE, _idx, _cmd); else Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueCourbe.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueCourbe.java 2009-01-16 08:31:00 UTC (rev 4377) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueCourbe.java 2009-01-16 13:36:14 UTC (rev 4378) @@ -216,6 +216,17 @@ public void fillWithInfo(InfoData _table, CtuluListSelectionInterface pt) { } + public String getPointLabel(int _i) { + String[] names=data_.getNamesLignesDirectricesAt(_i); + if(names==null) + return null; + // Construction du label par agr\xE9gation des noms + String label=""; + for(int i=0;i<names.length;i++) + label+=names[i]; + return label; + } + public int getNbValues() { return data_.getNbPoint(); } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacBoundaryCourbeModel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacBoundaryCourbeModel.java 2009-01-16 08:31:00 UTC (rev 4377) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacBoundaryCourbeModel.java 2009-01-16 13:36:14 UTC (rev 4378) @@ -136,6 +136,10 @@ return 0; } + public String getPointLabel(int _i) { + return null; + } + public int getNbValues() { if (t_ == null) { return 0; Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacWeirCourbeModel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacWeirCourbeModel.java 2009-01-16 08:31:00 UTC (rev 4377) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacWeirCourbeModel.java 2009-01-16 13:36:14 UTC (rev 4378) @@ -71,6 +71,10 @@ return 0; } + public String getPointLabel(int _i) { + return null; + } + public int getNbValues() { return s_.getNbPoint(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |