From: <de...@us...> - 2008-10-05 22:05:37
|
Revision: 4034 http://fudaa.svn.sourceforge.net/fudaa/?rev=4034&view=rev Author: deniger Date: 2008-10-05 22:05:30 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuPreferences.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gis/GISGeometryFactory.java branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/EfNeighborMesh.java branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfLineIntersection.java branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/h2d/type/H2dVariableType.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeTemporelleManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddPointsAction.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddVariableAction.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogLigneCourants.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardCourbeTemporelle.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuPreferences.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuPreferences.java 2008-10-05 20:43:37 UTC (rev 4033) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuPreferences.java 2008-10-05 22:05:30 UTC (rev 4034) @@ -26,17 +26,12 @@ import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.LookAndFeel; -import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.FontUIResource; import javax.swing.plaf.IconUIResource; import javax.swing.plaf.metal.MetalTheme; -import org.jvnet.substance.skin.SubstanceRavenGraphiteLookAndFeel; - - - import com.memoire.fu.FuFactoryInteger; import com.memoire.fu.FuLib; import com.memoire.fu.FuLog; Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gis/GISGeometryFactory.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gis/GISGeometryFactory.java 2008-10-05 20:43:37 UTC (rev 4033) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/gis/GISGeometryFactory.java 2008-10-05 22:05:30 UTC (rev 4034) @@ -9,7 +9,6 @@ import com.vividsolutions.jts.geom.*; - /** * @author Fred Deniger * @version $Id: GISGeometryFactory.java,v 1.10 2007-04-20 16:20:17 deniger Exp $ @@ -26,15 +25,15 @@ super(new PrecisionModel(10E6), 0, new GISCoordinateSequenceFactory()); } - public Point createPoint(final Coordinate _coordinate){ + public Point createPoint(final Coordinate _coordinate) { return new GISPoint(_coordinate); } - public Point createPoint(final double _x,final double _y,final double _z){ + public Point createPoint(final double _x, final double _y, final double _z) { return new GISPoint(_x, _y, _z); } - public CoordinateSequence createLinearRingDefaultSequence(){ + public CoordinateSequence createLinearRingDefaultSequence() { final CoordinateSequence seq = getCoordinateSequenceFactory().create(4, 2); seq.setOrdinate(0, 0, 0); seq.setOrdinate(0, 1, 0); @@ -46,10 +45,8 @@ seq.setOrdinate(3, 1, 0); return seq; } - - - public GISPolygone createLinearRing(final double _xMin,final double _xMax,final double _yMin,final double _yMax){ + public GISPolygone createLinearRing(final double _xMin, final double _xMax, final double _yMin, final double _yMax) { final CoordinateSequence seq = getCoordinateSequenceFactory().create(5, 2); seq.setOrdinate(0, 0, _xMin); seq.setOrdinate(0, 1, _yMin); @@ -64,36 +61,39 @@ return (GISPolygone) createLinearRing(seq); } - public Point createPoint(final CoordinateSequence _coordinates){ + public Point createPoint(final CoordinateSequence _coordinates) { return createPoint(_coordinates.getCoordinate(0)); } - public LinearRing createLinearRing(final Coordinate[] _coordinates){ + public LinearRing createLinearRing(final Coordinate[] _coordinates) { return new GISPolygone(getCoordinateSequenceFactory().create(_coordinates)); } - public LinearRing createLinearRingImmutable(final Coordinate[] _coordinates){ + public GISPolyligne createSegment(final double _x1, final double _y1, final double _x2, final double _y2) { + final CoordinateSequence seq = getCoordinateSequenceFactory().create(2, 2); + seq.setOrdinate(0, 0, _x1); + seq.setOrdinate(0, 1, _y1); + seq.setOrdinate(1, 0, _x2); + seq.setOrdinate(1, 1, _y2); + return (GISPolyligne) createLineString(seq); + } + + public LinearRing createLinearRingImmutable(final Coordinate[] _coordinates) { return new GISPolygone(((GISCoordinateSequenceFactory) getCoordinateSequenceFactory()) .createImmutable(_coordinates)); } - public LinearRing createLinearRing(final CoordinateSequence _coordinates){ + public LinearRing createLinearRing(final CoordinateSequence _coordinates) { return new GISPolygone(_coordinates); } - public LinearRing transformToLinearRing(final LineString _s){ - if(_s==null) { - return null; - } - if (_s instanceof LinearRing) { - return (LinearRing) _s; - } - if (_s.isClosed()) { - return createLinearRing(_s.getCoordinateSequence()); - } + public LinearRing transformToLinearRing(final LineString _s) { + if (_s == null) { return null; } + if (_s instanceof LinearRing) { return (LinearRing) _s; } + if (_s.isClosed()) { return createLinearRing(_s.getCoordinateSequence()); } final CoordinateSequence seq = _s.getCoordinateSequence(); - final CoordinateSequence newSeq = GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create( - seq.size() + 1, 3); + final CoordinateSequence newSeq = GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create(seq.size() + 1, + 3); final int oldSize = seq.size(); for (int i = oldSize - 1; i >= 0; i--) { newSeq.setOrdinate(i, 0, seq.getX(i)); @@ -104,26 +104,24 @@ return createLinearRing(newSeq); } - public LineString createLineString(final Coordinate[] _coordinates){ + public LineString createLineString(final Coordinate[] _coordinates) { return new GISPolyligne(getCoordinateSequenceFactory().create(_coordinates)); } - public LineString createLineString(final CoordinateSequence _coordinates){ + public LineString createLineString(final CoordinateSequence _coordinates) { return new GISPolyligne(_coordinates); } - public LineString createLineStringNiveau(final CoordinateSequence _coordinates){ + public LineString createLineStringNiveau(final CoordinateSequence _coordinates) { return new GISPolyligneNiveau(_coordinates); } - public LinearRing createLinearRingNiveau(final CoordinateSequence _coordinates){ + public LinearRing createLinearRingNiveau(final CoordinateSequence _coordinates) { return new GISPolygoneNiveau(_coordinates); } - public MultiPoint createMultiPoint(final Coordinate[] _coordinates){ - if (_coordinates == null) { - return null; - } + public MultiPoint createMultiPoint(final Coordinate[] _coordinates) { + if (_coordinates == null) { return null; } final int n = _coordinates.length; final GISPoint[] pt = new GISPoint[_coordinates.length]; for (int i = 0; i < n; i++) { @@ -132,27 +130,25 @@ return new GISMultiPoint(pt); } - public MultiPoint createMultiPoint(final Point[] _point){ + public MultiPoint createMultiPoint(final Point[] _point) { return new GISMultiPoint(_point); } - public GeometryCollection createGeometryCollection(final Geometry[] _geometries){ + public GeometryCollection createGeometryCollection(final Geometry[] _geometries) { return super.createGeometryCollection(_geometries); } - public MultiLineString createMultiLineString(final LineString[] _lineStrings){ + public MultiLineString createMultiLineString(final LineString[] _lineStrings) { return new GISMultiPolyligne(_lineStrings); } - public MultiPoint createMultiPoint(final CoordinateSequence _coordinates){ - if (_coordinates == null) { - return null; - } + public MultiPoint createMultiPoint(final CoordinateSequence _coordinates) { + if (_coordinates == null) { return null; } final int n = _coordinates.size(); final GISPoint[] pt = new GISPoint[n]; for (int i = 0; i < n; i++) { - pt[i] = (GISPoint) createPoint(_coordinates.getX(i), _coordinates.getY(i), _coordinates - .getOrdinate(i, CoordinateSequence.Z)); + pt[i] = (GISPoint) createPoint(_coordinates.getX(i), _coordinates.getY(i), _coordinates.getOrdinate(i, + CoordinateSequence.Z)); } return new GISMultiPoint(pt); } @@ -160,30 +156,26 @@ /** * Renvoie un GISPolygone si non vide. */ - public Geometry toGeometry(final Envelope _envelope){ - if (_envelope.isNull()) { - return createPoint((CoordinateSequence) null); - } - if (_envelope.getMinX() == _envelope.getMaxX() && _envelope.getMinY() == _envelope.getMaxY()) { - return createPoint(new Coordinate(_envelope.getMinX(), _envelope.getMinY())); - } - return createLinearRing(new Coordinate[] { - new Coordinate(_envelope.getMinX(), _envelope.getMinY()), + public Geometry toGeometry(final Envelope _envelope) { + if (_envelope.isNull()) { return createPoint((CoordinateSequence) null); } + if (_envelope.getMinX() == _envelope.getMaxX() && _envelope.getMinY() == _envelope.getMaxY()) { return createPoint(new Coordinate( + _envelope.getMinX(), _envelope.getMinY())); } + return createLinearRing(new Coordinate[] { new Coordinate(_envelope.getMinX(), _envelope.getMinY()), new Coordinate(_envelope.getMaxX(), _envelope.getMinY()), new Coordinate(_envelope.getMaxX(), _envelope.getMaxY()), new Coordinate(_envelope.getMinX(), _envelope.getMaxY()), - new Coordinate(_envelope.getMinX(), _envelope.getMinY())}); + new Coordinate(_envelope.getMinX(), _envelope.getMinY()) }); } - public Polygon createPolygon(final LinearRing _shell,final LinearRing[] _holes){ + public Polygon createPolygon(final LinearRing _shell, final LinearRing[] _holes) { return new GISPolygoneWithHole(_shell, _holes); } - public MultiPolygon createMultiPolygon(final Polygon[] _polygons){ + public MultiPolygon createMultiPolygon(final Polygon[] _polygons) { return super.createMultiPolygon(_polygons); } - public Geometry createGeometry(final Geometry _g){ + public Geometry createGeometry(final Geometry _g) { return super.createGeometry(_g); } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/EfNeighborMesh.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/EfNeighborMesh.java 2008-10-05 20:43:37 UTC (rev 4033) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/EfNeighborMesh.java 2008-10-05 22:05:30 UTC (rev 4034) @@ -29,9 +29,7 @@ public class EfNeighborMesh { public static EfNeighborMesh compute(final EfGridInterface _grid, final ProgressionInterface _prog) { - if (_grid == null) { - return null; - } + if (_grid == null) { return null; } final ProgressionUpdater up = new ProgressionUpdater(_prog); up.majProgessionStateOnly(DodicoLib.getS("Recherche des mailles voisines")); final int nbPt = _grid.getPtsNb(); @@ -120,12 +118,8 @@ public int[] getAdjacentMeshes(final int _idxPt1, final int _idxPt2) { final TIntHashSet set = new TIntHashSet(neighbor_[_idxPt1]); set.retainAll(neighbor_[_idxPt2]); - if (set.size() > 2) { - throw new IllegalStateException("maillage non conforme"); - } - if (set.size() == 1) { - return new int[] { set.iterator().next(), -1 }; - } + if (set.size() > 2) { throw new IllegalStateException("maillage non conforme"); } + if (set.size() == 1) { return new int[] { set.iterator().next(), -1 }; } return set.toArray(); } @@ -133,23 +127,15 @@ public int getAdjacentMeshes(final int _idxPt1, final int _idxPt2, final int _idxEltToAvoid) { final TIntHashSet set = new TIntHashSet(neighbor_[_idxPt1]); set.retainAll(neighbor_[_idxPt2]); - if (set.size() > 2) { - throw new IllegalStateException("maillage non conforme"); - } + if (set.size() > 2) { throw new IllegalStateException("maillage non conforme"); } final TIntIterator it = set.iterator(); - if (!it.hasNext()) { - return -1; - } + if (!it.hasNext()) { return -1; } int first = it.next(); - if (first != _idxEltToAvoid) { - return first; - } + if (first != _idxEltToAvoid) { return first; } if (it.hasNext()) { first = it.next(); - if (first != _idxEltToAvoid) { - return first; - } + if (first != _idxEltToAvoid) { return first; } } return -1; @@ -176,8 +162,7 @@ public double getAverageForNode(final CtuluVariable _var, final int _idxPt, final int _tIdx, final EfData _dataElement, EfGridData _datas, InterpolationVectorContainer _vects) { - if (_vects.isVect(_var)) { - return getAverageForVect(_var, _idxPt, _tIdx, _dataElement, _datas, _vects); + if (_vects.isVect(_var)) { return getAverageForVect(_var, _idxPt, _tIdx, _dataElement, _datas, _vects); } return getAverageForNodeDanger(_idxPt, _dataElement); @@ -185,9 +170,8 @@ public double getAverageForNode(final CtuluVariable _var, final int _idxPt, final int _tIdx, final EfData _dataElement, EfGridDataInterpolator _datas) { - if (_datas.getInterpolator().getVect().isVect(_var)) { - return getAverageForVect(_var, _idxPt, _tIdx, _dataElement, _datas.getGridData(), _datas.getInterpolator() - .getVect()); + if (_datas.getInterpolator().getVect().isVect(_var)) { return getAverageForVect(_var, _idxPt, _tIdx, _dataElement, + _datas.getGridData(), _datas.getInterpolator().getVect()); } return getAverageForNodeDanger(_idxPt, _dataElement); @@ -206,25 +190,19 @@ public double getAverageForNode(final CtuluVariable _var, final int _idxPt, InterpolationSupportValuesMultiI _datas, InterpolationVectorContainer _vects) { - if (_vects.isVect(_var)) { - return getAverageForVect(_var, _idxPt, _datas.getValues(_var), _datas, _vects); - } + if (_vects.isVect(_var)) { return getAverageForVect(_var, _idxPt, _datas.getValues(_var), _datas, _vects); } return getAverageForNodeDanger(_idxPt, _datas.getValues(_var)); } public double getAverageForNode(final CtuluVariable _var, final int _idxPt, CtuluCollectionDouble _data, InterpolationSupportValuesMultiI _datas, InterpolationVectorContainer _vects) { - if (_vects.isVect(_var)) { - return getAverageForVect(_var, _idxPt, _data, _datas, _vects); - } + if (_vects.isVect(_var)) { return getAverageForVect(_var, _idxPt, _data, _datas, _vects); } return getAverageForNodeDanger(_idxPt, _data); } public EfDataNode getDataNode(final CtuluVariable _var, final CtuluCollectionDouble _data, InterpolationSupportValuesMultiI _datas, InterpolationVectorContainer _vects) { - if (_vects.isVect(_var)) { - return getDataNodeVecteur(_var, _data, _datas, _vects); - } + if (_vects.isVect(_var)) { return getDataNodeVecteur(_var, _data, _datas, _vects); } return getDataNodeSimple(_data); } @@ -241,9 +219,7 @@ public EfDataNode getDataNode(final CtuluVariable _var, InterpolationSupportValuesMultiI _datas, InterpolationVectorContainer _vects) { - if (_vects.isVect(_var)) { - return getDataNodeVecteur(_var, _datas.getValues(_var), _datas, _vects); - } + if (_vects.isVect(_var)) { return getDataNodeVecteur(_var, _datas.getValues(_var), _datas, _vects); } return getDataNodeSimple(_datas.getValues(_var)); } @@ -259,4 +235,13 @@ public int getNeighborMesh(final int _idxPt, final int _idxMesh) { return neighbor_[_idxPt][_idxMesh]; } + + /** + * @param _idxPt l'indice du noeud + * @param _idxMeshes la liste des indices des \xE9l\xE9ments a remplir + */ + public void fillWithAdjacentMeshes(final int _idxPt, TIntHashSet _idxMeshes) { + _idxMeshes.addAll(neighbor_[_idxPt]); + + } } Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfLineIntersection.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfLineIntersection.java 2008-10-05 20:43:37 UTC (rev 4033) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfLineIntersection.java 2008-10-05 22:05:30 UTC (rev 4034) @@ -7,6 +7,8 @@ */ package org.fudaa.dodico.ef.operation; +import gnu.trove.TIntHashSet; + import java.io.IOException; import java.util.Collection; @@ -18,11 +20,127 @@ import org.fudaa.dodico.ef.EfData; import org.fudaa.dodico.ef.EfElement; import org.fudaa.dodico.ef.EfGridInterface; +import org.fudaa.dodico.ef.EfNeighborMesh; import org.fudaa.dodico.ef.interpolation.EfGridDataInterpolator; import org.fudaa.dodico.ef.interpolation.EfInterpolator; public abstract class EfLineIntersection implements EfLineIntersectionI { + /** + * Definie une intersection sur une arete. + * + * @author fred deniger + * @version $Id: EfLineIntersection.java,v 1.5 2007-06-13 12:55:42 deniger Exp $ + */ + public final static class ItemEdge extends EfLineIntersection { + + int[] adjacentMesh_; + final int i1_; + final int i2_; + final double x_; + final double y_; + + public ItemEdge(final int _i1, final int _i2, final double _x, double _y) { + super(); + i1_ = _i1; + i2_ = _i2; + x_ = _x; + y_ = _y; + } + + @Override + public void fillWithAdjacentMeshes(TIntHashSet _idxMeshes) { + buildAdjacentMeshes(); + if (adjacentMesh_[0] >= 0) _idxMeshes.add(adjacentMesh_[0]); + if (adjacentMesh_[1] >= 0) _idxMeshes.add(adjacentMesh_[1]); + + } + + private double getD1() { + return 1 / CtuluLibGeometrie.getDistance(x_, y_, parent_.getGrid().getPtX(i1_), parent_.getGrid().getPtY(i1_)); + } + + private double getD2() { + return 1 / CtuluLibGeometrie.getDistance(x_, y_, parent_.getGrid().getPtX(i2_), parent_.getGrid().getPtY(i2_)); + } + + public int getI1() { + return i1_; + } + + public int getI2() { + return i2_; + } + + public double getValue(CtuluVariable _var, int _tIdx) { + if (parent_ == null) throw new IllegalAccessError("pas de parent"); + EfGridDataInterpolator data = parent_.getGridData(); + try { + if (data.getGridData().isElementVar(_var)) { + + buildAdjacentMeshes(); + if (adjacentMesh_[1] < 0) return data.getGridData().getData(_var, _tIdx, adjacentMesh_[0]); + return data.getInterpolator().getMidValue(adjacentMesh_[0], adjacentMesh_[1], _var, _tIdx); + } + + double d1 = getD1(); + double d2 = getD2(); + return data.getInterpolator().getValue(i1_, i2_, d1 / (d1 + d2), d2 / (d1 + d2), _var, _tIdx); + } catch (IllegalAccessError _evt) { + FuLog.error(_evt); + + } catch (IOException _evt) { + FuLog.error(_evt); + + } + return 0; + } + + private void buildAdjacentMeshes() { + parent_.buildNeighbor(null); + if (adjacentMesh_ == null) adjacentMesh_ = parent_.getNeighbor().getAdjacentMeshes(i1_, i2_); + } + + public double getValueBadInterpolation(EfData _d) { + if (_d.isElementData()) { + + buildAdjacentMeshes(); + if (adjacentMesh_[1] < 0) return _d.getValue(adjacentMesh_[0]); + return (_d.getValue(adjacentMesh_[0]) + _d.getValue(adjacentMesh_[1])) / 2D; + } + + double d1 = getD1(); + double d2 = getD2(); + return (d1 * _d.getValue(i1_) + d2 * _d.getValue(i2_)) / (d1 + d2); + } + + public double getX() { + return x_; + } + + public double getY() { + return y_; + } + + public boolean isEdgeIntersection() { + return true; + } + + public int isMeshIntersection() { + return -1; + } + + public boolean isOnSameEfObject(EfLineIntersectionI _other) { + if (_other == null) return false; + if (_other.isEdgeIntersection()) { + ItemEdge edge = (ItemEdge) _other; + return (edge.i1_ == i1_ && edge.i2_ == i2_) || (edge.i1_ == i2_ && edge.i2_ == i1_); + } + return false; + } + + } + static class ItemInitial { int ielt_ = -1; @@ -55,9 +173,7 @@ // priorit\xE9 // au point issu du profil - if (item2_ == null && item1_.isNodeIntersection() && !item1_.isAPointProfileIntersection()) { - return; - } + if (item2_ == null && item1_.isNodeIntersection() && !item1_.isAPointProfileIntersection()) { return; } if (item2_ != null && item2_.isAPointProfileIntersection()) { if (_dest.contains(item2_)) _dest.remove(item2_); @@ -148,109 +264,6 @@ } /** - * Definie une intersection sur une arete. - * - * @author fred deniger - * @version $Id: EfLineIntersection.java,v 1.5 2007-06-13 12:55:42 deniger Exp $ - */ - public final static class ItemEdge extends EfLineIntersection { - - int[] adjacentMesh_; - final int i1_; - final int i2_; - final double x_; - final double y_; - - public ItemEdge(final int _i1, final int _i2, final double _x, double _y) { - super(); - i1_ = _i1; - i2_ = _i2; - x_ = _x; - y_ = _y; - } - - public int getI1() { - return i1_; - } - - public int getI2() { - return i2_; - } - - public boolean isOnSameEfObject(EfLineIntersectionI _other) { - if (_other == null) return false; - if (_other.isEdgeIntersection()) { - ItemEdge edge = (ItemEdge) _other; - return (edge.i1_ == i1_ && edge.i2_ == i2_) || (edge.i1_ == i2_ && edge.i2_ == i1_); - } - return false; - } - - public double getValue(CtuluVariable _var, int _tIdx) { - if (parent_ == null) throw new IllegalAccessError("pas de parent"); - EfGridDataInterpolator data = parent_.getGridData(); - try { - if (data.getGridData().isElementVar(_var)) { - - parent_.buildNeighbor(null); - if (adjacentMesh_ == null) adjacentMesh_ = parent_.getNeighbor().getAdjacentMeshes(i1_, i2_); - if (adjacentMesh_[1] < 0) return data.getGridData().getData(_var, _tIdx, adjacentMesh_[0]); - return data.getInterpolator().getMidValue(adjacentMesh_[0], adjacentMesh_[1], _var, _tIdx); - } - - double d1 = getD1(); - double d2 = getD2(); - return data.getInterpolator().getValue(i1_, i2_, d1 / (d1 + d2), d2 / (d1 + d2), _var, _tIdx); - } catch (IllegalAccessError _evt) { - FuLog.error(_evt); - - } catch (IOException _evt) { - FuLog.error(_evt); - - } - return 0; - } - - public double getValueBadInterpolation(EfData _d) { - if (_d.isElementData()) { - parent_.buildNeighbor(null); - if (adjacentMesh_ == null) adjacentMesh_ = parent_.getNeighbor().getAdjacentMeshes(i1_, i2_); - if (adjacentMesh_[1] < 0) return _d.getValue(adjacentMesh_[0]); - return (_d.getValue(adjacentMesh_[0]) + _d.getValue(adjacentMesh_[1])) / 2D; - } - - double d1 = getD1(); - double d2 = getD2(); - return (d1 * _d.getValue(i1_) + d2 * _d.getValue(i2_)) / (d1 + d2); - } - - private double getD2() { - return 1 / CtuluLibGeometrie.getDistance(x_, y_, parent_.getGrid().getPtX(i2_), parent_.getGrid().getPtY(i2_)); - } - - private double getD1() { - return 1 / CtuluLibGeometrie.getDistance(x_, y_, parent_.getGrid().getPtX(i1_), parent_.getGrid().getPtY(i1_)); - } - - public double getX() { - return x_; - } - - public double getY() { - return y_; - } - - public boolean isEdgeIntersection() { - return true; - } - - public int isMeshIntersection() { - return -1; - } - - } - - /** * Une intersection definie sur un \xE9l\xE9ment: utilise pour Rubar et pour un point a interpoler. * * @author fred deniger @@ -270,12 +283,10 @@ } - public boolean isOnSameEfObject(EfLineIntersectionI _other) { - if (_other != null && !_other.isRealIntersection() && !_other.isNodeIntersection()) { - return isMeshIntersection() == _other.isMeshIntersection(); + @Override + public void fillWithAdjacentMeshes(TIntHashSet _idxMeshes) { + _idxMeshes.add(ielt_); - } - return false; } public ItemMesh(final ItemInitial _init) { @@ -321,6 +332,14 @@ return ielt_; } + public boolean isOnSameEfObject(EfLineIntersectionI _other) { + if (_other != null && !_other.isRealIntersection() && !_other.isNodeIntersection()) { return isMeshIntersection() == _other + .isMeshIntersection(); + + } + return false; + } + public boolean isRealIntersection() { return ielt_ >= 0; } @@ -342,18 +361,6 @@ ptIdx_ = _ptIdx; } - public boolean isOnSameEfObject(EfLineIntersectionI _other) { - if (_other == null) return false; - if (_other.isNodeIntersection()) { - return ((ItemNode) _other).ptIdx_ == ptIdx_; - } - return false; - } - - public String toString() { - return getClass().getName() + " " + ptIdx_; - } - public double getValue(CtuluVariable _var, int _tIdx) { EfGridDataInterpolator data = parent_.getGridData(); try { @@ -373,6 +380,14 @@ return 0; } + @Override + public void fillWithAdjacentMeshes(TIntHashSet _idxMeshes) { + // on construit au cas ou... + getParent().buildNeighbor(null); + getParent().getNeighbor().fillWithAdjacentMeshes(ptIdx_, _idxMeshes); + + } + public double getValueBadInterpolation(EfData _d) { if (_d.isElementData()) { parent_.buildNeighbor(null); @@ -406,6 +421,16 @@ return ptIdx_ == _ptIdx; } + public boolean isOnSameEfObject(EfLineIntersectionI _other) { + if (_other == null) return false; + if (_other.isNodeIntersection()) { return ((ItemNode) _other).ptIdx_ == ptIdx_; } + return false; + } + + public String toString() { + return getClass().getName() + " " + ptIdx_; + } + } /** @@ -417,6 +442,7 @@ public final static class ItemNoIntersect extends EfLineIntersection { final double x_; + final double y_; public ItemNoIntersect(final double _x, final double _y) { @@ -425,8 +451,10 @@ y_ = _y; } - public boolean isOnSameEfObject(EfLineIntersectionI _other) { - return false; + @Override + public void fillWithAdjacentMeshes(TIntHashSet _idxMeshes) { + // ne renvoie rien + } public double getValue(CtuluVariable _var, int _tIdx) { @@ -449,6 +477,10 @@ return -1; } + public boolean isOnSameEfObject(EfLineIntersectionI _other) { + return false; + } + public boolean isRealIntersection() { return false; } @@ -461,6 +493,15 @@ protected EfLineIntersection() {} + /** + * Remplit la set avec les indices de tous les \xE9l\xE9mnents adjacents. Si l'intersection est dans un \xE9l\xE9ment seul + * l'indice de l'\xE9l\xE9ment est renvoye. + * + * @param _idxMeshes ne doit pas etre vide et sera rempli avec les indices de tous les \xE9l\xE9ments adjacents \xE0 cette + * intersection. + */ + public abstract void fillWithAdjacentMeshes(TIntHashSet _idxMeshes); + public double getD2From(double _x, double _y) { return CtuluLibGeometrie.getD2(getX(), getY(), _x, _y); } @@ -473,14 +514,20 @@ return parent_; } - public boolean isEdgeIntersection() { - return false; - } + /** + * @param _d les donn\xE9es en accord avec le maillage (meme nombre de point) + * @return la valeur non interpol\xE9e correction + */ + public abstract double getValueBadInterpolation(EfData _d); public boolean isAPointProfileIntersection() { return extremiteIntersect_; } + public boolean isEdgeIntersection() { + return false; + } + public boolean isNodeIntersection() { return false; } @@ -489,18 +536,12 @@ return false; } - /** - * @param _d les donn\xE9es en accord avec le maillage (meme nombre de point) - * @return la valeur non interpol\xE9e correction - */ - public abstract double getValueBadInterpolation(EfData _d); + public abstract boolean isOnSameEfObject(EfLineIntersectionI _other); public boolean isRealIntersection() { return true; } - public abstract boolean isOnSameEfObject(EfLineIntersectionI _other); - public void setParent(EfLineIntersectionParent _parent) { parent_ = _parent; } Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/h2d/type/H2dVariableType.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/h2d/type/H2dVariableType.java 2008-10-05 20:43:37 UTC (rev 4033) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/h2d/type/H2dVariableType.java 2008-10-05 22:05:30 UTC (rev 4034) @@ -106,6 +106,14 @@ return _c.getFriction(); } }; + + public static final H2dVariableType SANS = new H2dVariableType(H2dResource.getS("Sans"), null, "sans") { + + public double getValue(final H2dVariableTypeContainer _c) { + return 0; + } + }; + public static final H2dVariableType COEF_DIFFUSION = new H2dVariableType(H2dResource.getS("Coefficient diffusion"), null, "dif") { @@ -450,9 +458,7 @@ */ public static H2dVariableType getVarFromShortName(final String _shortName, final Map _shortNameVarCreated) { final H2dVariableType t = (H2dVariableType) shortNameVar.get(_shortName); - if (t == null && _shortNameVarCreated != null) { - return (H2dVariableType) _shortNameVarCreated.get(_shortName); - } + if (t == null && _shortNameVarCreated != null) { return (H2dVariableType) _shortNameVarCreated.get(_shortName); } return t; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporter.java 2008-10-05 20:43:37 UTC (rev 4033) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeImporter.java 2008-10-05 22:05:30 UTC (rev 4034) @@ -122,7 +122,7 @@ * a utiliser pour les formats scope * */ - void importCourbes(ScopeStructure _crb, CtuluCommandManager _mng, ProgressionInterface _prog); +// void importCourbes(ScopeStructure _crb, CtuluCommandManager _mng, ProgressionInterface _prog); public boolean isSpatial(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2008-10-05 20:43:37 UTC (rev 4033) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2008-10-05 22:05:30 UTC (rev 4034) @@ -9,24 +9,19 @@ import java.io.File; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; import javax.swing.AbstractAction; -import javax.swing.AbstractListModel; import javax.swing.BorderFactory; import javax.swing.DefaultListModel; -import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.JTextField; import javax.swing.ListSelectionModel; import javax.swing.filechooser.FileFilter; -import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluIOOperationSynthese; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibArray; @@ -38,20 +33,13 @@ import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.dodico.mesure.EvolutionFileFormat; import org.fudaa.dodico.mesure.EvolutionReguliere; -import org.fudaa.dodico.reflux.io.CLTransitoireFileFormat; -import org.fudaa.dodico.reflux.io.CrbFileFormat; -import org.fudaa.dodico.rubar.io.RubarCLIFileFormat; -import org.fudaa.dodico.rubar.io.RubarTARFileFormat; import org.fudaa.dodico.telemac.io.ScopeGENEFileFormat; import org.fudaa.dodico.telemac.io.ScopeSFileFormat; import org.fudaa.dodico.telemac.io.ScopeStructure; import org.fudaa.dodico.telemac.io.ScopeTFileFormat; -import org.fudaa.dodico.telemac.io.TelemacLiquideFileFormat; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.fudaa.commun.FudaaLib; -import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter; -import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporterScope; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.commun.impl.FudaaGuiLib; import org.fudaa.fudaa.ressource.FudaaResource; @@ -61,7 +49,6 @@ import com.memoire.bu.BuButtonPanel; import com.memoire.bu.BuCharValidator; import com.memoire.bu.BuFileFilter; -import com.memoire.bu.BuIcon; import com.memoire.bu.BuResource; import com.memoire.bu.BuStringValidator; import com.memoire.bu.BuTextField; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeTemporelleManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeTemporelleManager.java 2008-10-05 20:43:37 UTC (rev 4033) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrCourbeTemporelleManager.java 2008-10-05 22:05:30 UTC (rev 4034) @@ -462,8 +462,6 @@ fireGlobalChanged(); } - public void importCourbes(ScopeStructure _crb, CtuluCommandManager _mng, ProgressionInterface _prog) { - } public boolean isSpatial() { return false; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java 2008-10-05 20:43:37 UTC (rev 4033) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java 2008-10-05 22:05:30 UTC (rev 4034) @@ -253,7 +253,7 @@ /** - * Recherche le point qui peut contenir la sonde pour bien initialiser la var. + * Recherche l'\xE9l\xE9ment qui peut contenir la sonde pour bien initialiser la var. * * @param _prReel * @param grid Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddPointsAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddPointsAction.java 2008-10-05 20:43:37 UTC (rev 4033) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddPointsAction.java 2008-10-05 22:05:30 UTC (rev 4034) @@ -39,23 +39,24 @@ addNewPoints(impl_, panel_, model_); } - public static void addNewPoints(final FudaaCommonImplementation _impl, final TrPostVisuPanel _panel, final EGGraphe _model) { + public static void addNewPoints(final FudaaCommonImplementation _impl, final TrPostVisuPanel _panel, + final EGGraphe _model) { if (_panel.isSelectionOkForEvolution()) { final int[] idx = _panel.getSelectionForEvolution(); - startImportIdx(_impl, _model, idx); + startImportIdx(_impl, _panel.getSource(),_model, idx); } else if (_panel.isSelectionOkForEvolutionSonde()) { final TrPostInterpolatePoint pt = _panel.getInterpolePointForEvol(); - startImportInterpolate(_impl, _model, pt); + startImportInterpolate(_impl, _panel.getSource(), _model, pt); } } - public static void startImportInterpolate(final FudaaCommonImplementation _impl, final EGGraphe _model, - final TrPostInterpolatePoint _pt) { + public static void startImportInterpolate(final FudaaCommonImplementation _impl, final TrPostSource _src, + final EGGraphe _model, final TrPostInterpolatePoint _pt) { new CtuluTaskOperationGUI(_impl, TrResource.getS("Courbes temporelles")) { public void act() { final TrPostCourbeTreeModel model = (TrPostCourbeTreeModel) _model.getModel(); - model.addPoints(_pt, _model.getCmd(), new ProgressionBuAdapter(this), null); + model.addPoints(_src, _pt, _model.getCmd(), new ProgressionBuAdapter(this), null); BuLib.invokeLater(new Runnable() { public void run() { @@ -67,12 +68,13 @@ }.start(); } - public static void startImportIdx(final FudaaCommonImplementation _impl, final EGGraphe _model, final int[] _idx) { + public static void startImportIdx(final FudaaCommonImplementation _impl, final TrPostSource _src, + final EGGraphe _model, final int[] _idx) { new CtuluTaskOperationGUI(_impl, TrResource.getS("Courbes temporelles")) { public void act() { final TrPostCourbeTreeModel model = (TrPostCourbeTreeModel) _model.getModel(); - model.addPoints(_idx, _model.getCmd(), new ProgressionBuAdapter(this), null); + model.addPoints(_src, _idx, _model.getCmd(), new ProgressionBuAdapter(this), null); BuLib.invokeLater(new Runnable() { public void run() { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddVariableAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddVariableAction.java 2008-10-05 20:43:37 UTC (rev 4033) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddVariableAction.java 2008-10-05 22:05:30 UTC (rev 4034) @@ -24,6 +24,7 @@ import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.courbe.EGCourbe; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; @@ -47,7 +48,7 @@ model_ = _model; } - + public static Object[] select(final Object[] _init, final String _title, final Component _parent) { Arrays.sort(_init, FuComparator.STRING_COMPARATOR); final BuList l = CtuluLibSwing.createBuList(_init); @@ -56,15 +57,20 @@ pn.setBorder(BuBorders.EMPTY3333); pn.add(new BuLabel(CtuluLib.getS("S\xE9lectionner les variables \xE0 ajouter")), BuBorderLayout.NORTH); pn.add(new BuScrollPane(l)); - if (CtuluDialogPanel.isOkResponse(pn.afficheModale(_parent, _title))) { - return l.getSelectedValues(); - } + if (CtuluDialogPanel.isOkResponse(pn.afficheModale(_parent, _title))) { return l.getSelectedValues(); } return null; } public void actionPerformed(final ActionEvent _e) { final TrPostCourbeTreeModel model = (TrPostCourbeTreeModel) model_.getModel(); - final Set var = new HashSet(Arrays.asList(model.src_.getAllVariablesNonVec())); + EGCourbe selectedComponent = model_.getSelectedComponent(); + TrPostSource src = null; + if (selectedComponent != null && selectedComponent.getModel() instanceof TrPostCourbeModel) { + src = ((TrPostCourbeModel) selectedComponent.getModel()).getSource(); + } + if (src == null) return; + final TrPostSource finalSrc = src; + final Set var = new HashSet(Arrays.asList(src.getAllVariablesNonVec())); var.removeAll(model.varSupported_); final H2dVariableType[] vars = (H2dVariableType[]) var.toArray(new H2dVariableType[var.size()]); final Object[] selected = select(vars, (String) getValue(Action.NAME), impl_.getFrame()); @@ -72,7 +78,7 @@ new CtuluTaskOperationGUI(impl_, (String) getValue(Action.NAME)) { public void act() { - model.addVariables(Arrays.asList(selected), new ProgressionBuAdapter(this), model_.getCmd()); + model.addVariables(finalSrc,Arrays.asList(selected), new ProgressionBuAdapter(this), model_.getCmd()); EventQueue.invokeLater(new Runnable() { public void run() { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeBuilder.java 2008-10-05 20:43:37 UTC (rev 4033) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeBuilder.java 2008-10-05 22:05:30 UTC (rev 4034) @@ -28,15 +28,13 @@ public final class TrPostCourbeBuilder { private TrPostCourbeBuilder() {} - public static TrPostCourbeTreeModel build(TrPostProjet projet, final TrPostSource _src, final int[] _tidx, - final H2dVariableType[] _vars, final int[] _idxPtArray, final ProgressionInterface _prog) { + public static TrPostCourbeTreeModel build(TrPostProjet _proj, final TrPostSource _src, final H2dVariableType[] _vars, + final int[] _idxPtArray, final ProgressionInterface _prog) { if (_prog != null) { _prog.setDesc(TrResource.getS("Construction des courbes")); } - final TrPostCourbeTreeModel treeModel = new TrPostCourbeTreeModel(projet.impl_, _src, /* - * _tidx, - */_idxPtArray, _vars, projet); - treeModel.addAllCourbes(_prog, null); + final TrPostCourbeTreeModel treeModel = new TrPostCourbeTreeModel(_idxPtArray, _vars, _proj); + treeModel.addAllCourbes(_src, _prog, null); return treeModel; } @@ -63,7 +61,7 @@ } final TrPostCourbeTreeModel treeModel = new TrPostCourbeTreeModel(projet.impl_, _src, _tidx, _idxPtArray, _vars, projet); - treeModel.addAllCourbes(_prog, null); + treeModel.addAllCourbes(_src, _prog, null); return treeModel; } @@ -85,7 +83,7 @@ } final TrPostCourbeTreeModel treeModel = new TrPostCourbeTreeModel(projet.impl_, _src, _tidx, _idxPtArray, _vars, projet); - treeModel.addAllCourbes(_prog, null); + treeModel.addAllCourbes(_src, _prog, null); return treeModel; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2008-10-05 20:43:37 UTC (rev 4033) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2008-10-05 22:05:30 UTC (rev 4034) @@ -7,6 +7,7 @@ */ package org.fudaa.fudaa.tr.post; +import java.io.IOException; import java.util.Set; import org.fudaa.ctulu.CtuluCommandContainer; @@ -26,52 +27,50 @@ */ public abstract class TrPostCourbeModel extends FudaaCourbeTimeModel { - /** + * @return the source + */ + public TrPostSource getSource() { + return source_; + } + + /** * source utilisee par la courbe */ public TrPostSource source_; - + public final static class Interpolated extends TrPostCourbeModel { final TrPostInterpolatePoint ptIdx_; - - - /** * @param _ptIdx * @param _varIdx * @param _timeIdx */ - public Interpolated(TrPostSource _src, final TrPostInterpolatePoint _ptIdx, final H2dVariableType _varIdx, - final double[] _timeIdx) { - super(_src, _varIdx, _timeIdx); + public Interpolated(TrPostSource _src, final TrPostInterpolatePoint _ptIdx, final H2dVariableType _varIdx) { + super(_src, _varIdx, _src.getTime().getTimeListModel().getTimesInSec()); ptIdx_ = _ptIdx; } - - @Override public double getPtX() { return ptIdx_.getX(); } - - @Override public double getPtY() { return ptIdx_.getY(); } - - - protected void updateY(final int _timeIdx, H2dVariableType _var) { - final EfData data = source_.getData(_var, _timeIdx); - if (data == null) { - FuLog.warning("TRP: data is null for " + _var); + protected void updateY() { + for (int i = 0; i < y_.length; i++) { + final EfData data = source_.getData(var_, i); + if (data == null) { + FuLog.warning("TRP: data is null for " + var_); + super.y_[i] = ptIdx_.getInterpolateValue(getVar(), data, i, source_); + } } - super.y_[_timeIdx] = ptIdx_.getInterpolateValue(getVar(), data, _timeIdx, source_); } public TrPostInterpolatePoint getInterpolatePt() { @@ -102,27 +101,37 @@ ptIdx_ = _ptIdx; } - protected void updateY(final int _timeIdx, H2dVariableType _var) { - - final EfData data = source_.getData(_var, _timeIdx); - if (data == null) { - FuLog.warning("TRP: data is null for " + _var); + protected void updateY() { + for (int i = 0; i < y_.length; i++) { + // final EfData data = source_.getData(var_, i); + // if (data == null) { + // FuLog.warning("TRP: data is null for " + var_); + try { + super.y_[i] = source_.getData(var_, i, ptIdx_); + } catch (IOException e) { + FuLog.error(e); + } + // } } - super.y_[_timeIdx] = data.getValue(ptIdx_); + // final EfData data = source_.getData(_var, _timeIdx); + // if (data == null) { + // FuLog.warning("TRP: data is null for " + _var); + // } + // super.y_[_timeIdx] = data.getValue(ptIdx_); } - - @Override public double getPtX() { // FIXME RUBAR - return source_.getGrid().getPtX(ptIdx_); + return source_.isElementVar(getVar()) ? source_.getGrid().getCentreXElement(ptIdx_) : source_.getGrid().getPtX( + ptIdx_); } @Override public double getPtY() { - return source_.getGrid().getPtY(ptIdx_); + return source_.isElementVar(getVar()) ? source_.getGrid().getCentreYElement(ptIdx_) : source_.getGrid().getPtY( + ptIdx_); } public int getPtIdx() { @@ -139,10 +148,11 @@ } - public static EGCourbeChild buildCourbeModel(final H2dVariableType _var, final int _idxPt, final double[] _ts, - final EGGroup _group, final TrPostSource _src) { - final TrPostCourbeModel model = new TrPostCourbeModel.Node(_src, _idxPt, _var, _ts); - + public static EGCourbeChild buildCourbeModel(final H2dVariableType _var, final int _idxPt, final EGGroup _group, + final TrPostSource _src) { + final TrPostCourbeModel model = new TrPostCourbeModel.Node(_src, _idxPt, _var, _src.getTime().getTimeListModel() + .getTimesInSec()); + final EGCourbeChild courbe = new FudaaCourbeTime(_group, model, _src.getNewTimeListModel()); _group.addEGComponent(courbe); courbe.getModel().setTitle(courbe.getModel().getTitle() + CtuluLibString.ESPACE + (_idxPt + 1)); @@ -150,8 +160,8 @@ } public static EGCourbeChild buildCourbeModel(final H2dVariableType _var, final TrPostInterpolatePoint _idxPt, - final double[] _ts, final EGGroup _group, final TrPostSource _src) { - final TrPostCourbeModel model = new TrPostCourbeModel.Interpolated(_src, _idxPt, _var, _ts); + final EGGroup _group, final TrPostSource _src) { + final TrPostCourbeModel model = new TrPostCourbeModel.Interpolated(_src, _idxPt, _var); final EGCourbeChild courbe = new FudaaCourbeTime(_group, model, _src.getNewTimeListModel()); _group.addEGComponent(courbe); courbe.getModel().setTitle( @@ -160,7 +170,7 @@ return courbe; } - private H2dVariableType var_; + H2dVariableType var_; public TrPostCourbeModel(TrPostSource _src, final H2dVariableType _varIdx, final double[] _timeIdx) { super(_timeIdx); @@ -185,7 +195,7 @@ return false; } - protected abstract void updateY(final int _timeIdx, H2dVariableType _var); + protected abstract void updateY(); public String getTitle() { return nom_ == null ? var_.getName() : nom_; @@ -194,7 +204,7 @@ public final H2dVariableType getVar() { return var_; } - + public abstract double getPtX(); public abstract double getPtY(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java 2008-10-05 20:43:37 UTC (rev 4033) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java 2008-10-05 22:05:30 UTC (rev 4034) @@ -23,11 +23,14 @@ import org.fudaa.ctulu.CtuluCommand; import org.fudaa.ctulu.CtuluCommandComposite; import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.ProgressionUpdater; import org.fudaa.ctulu.gis.GISPrecision; import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.dodico.mesure.EvolutionReguliere; +import org.fudaa.dodico.mesure.EvolutionReguliereInterface; import org.fudaa.ebli.courbe.EGAxeVertical; import org.fudaa.ebli.courbe.EGCourbe; import org.fudaa.ebli.courbe.EGCourbeChild; @@ -35,7 +38,10 @@ import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGGroup; import org.fudaa.ebli.geometrie.GrPoint; +import org.fudaa.fudaa.commun.courbe.FudaaCourbeModel; +import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter.Target; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; +import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrResource; import com.memoire.bu.BuDialogChoice; @@ -43,156 +49,95 @@ import com.memoire.fu.FuComparator; import com.memoire.fu.FuEmptyArrays; -public class TrPostCourbeTreeModel extends EGGrapheTreeModel implements TrPostTimeContentListener { +public class TrPostCourbeTreeModel extends EGGrapheTreeModel implements TrPostTimeContentListener, Target { - private final boolean isAllTimeStep_; - final FudaaCommonImplementation impl_; - // private int[] tidx_; - - private EGGroup updating_; - Set intepolPt_; - public Set getIntepolPt() { - return intepolPt_; - } + private final boolean isAllTimeStep_; int[] objIdx_; - public int[] getObjIdx() { - return objIdx_; - } + // private int[] tidx_; - // les sources devront etre affectees au CourbeModel - final TrPostSource src_; + TrPostProjet projet_; - double[] timeSteps_; + private EGGroup updating_; final Map varGroup_; Set varSupported_; - TrPostProjet projet_; - - public Set getVarSupported() { - return varSupported_; - } - /** * NE PAS UTILISER POUR L'INSTANT SAUVEGARDE. */ protected TrPostCourbeTreeModel() { - src_ = null; + // src_ = null; varGroup_ = new HashMap(); impl_ = null; isAllTimeStep_ = true; } - /** - * @param _src - */ - public TrPostCourbeTreeModel(final FudaaCommonImplementation _impl, final TrPostSource _src/* - * , - * final - * int - * [ - * ] - * _timeIdx - */, - final H2dVariableType[] _vars, TrPostProjet _projet) { - src_ = _src; - varGroup_ = new HashMap(); - // tidx_ = _timeIdx; - // Arrays.sort(tidx_); - objIdx_ = FuEmptyArrays.INT0; - intepolPt_ = new HashSet(); - varSupported_ = new HashSet(Arrays.asList(_vars)); - impl_ = _impl; - isAllTimeStep_ = true;// tidx_.length == _src.getNbTimeStep(); - projet_ = _projet; - } + // les sources devront etre affectees au CourbeModel + // final TrPostSource src_; - public TrPostCourbeTreeModel(final FudaaCommonImplementation _impl, final TrPostSource _src,/* - * final - * int - * [ - * ] - * _timeIdx - * , - */ - final int[] _objIdx, final H2dVariableType[] _vars, TrPostProjet _projet) { - this(_impl, _src/* , _timeIdx */, _vars, _projet); - objIdx_ = _objIdx; - Arrays.sort(objIdx_); - } + // double[] timeSteps_; public TrPostCourbeTreeModel(final FudaaCommonImplementation _impl, final TrPostSource _src, final int[] _timeIdx, final TrPostInterpolatePoint _interpol, final H2dVariableType[] _vars, TrPostProjet _projet) { - this(_impl, _src/* , _timeIdx */, _vars, _projet); + this(_vars, _projet); intepolPt_.add(_interpol); } /** - * Constructeur permettant de creer un treemodel avec plusieurs point - * interpol\xE9s + * Constructeur permettant de creer un treemodel avec plusieurs point interpol\xE9s * * @param _impl * @param _src * @param _timeIdx - * @param _interpol - * : le tableau de points interpoles + * @param _interpol : le tableau de points interpoles * @param _vars * @param _projet - * * @author Adrien Hadoux */ public TrPostCourbeTreeModel(final FudaaCommonImplementation _impl, final TrPostSource _src, final int[] _timeIdx, final TrPostInterpolatePoint[] _interpol, final H2dVariableType[] _vars, TrPostProjet _projet) { - this(_impl, _src/* , _timeIdx */, _vars, _projet); - + this(_vars, _projet); + for (int i = 0; i < _interpol.length; i++) intepolPt_.add(_interpol[i]); } - - private void buildUpdating() { - if (updating_ == null) { - updating_ = new EGGroup(); - updating_.setTitle(TrResource.getS("Mise \xE0 jour")); - } + + /** + * @param _src + */ + public TrPostCourbeTreeModel(final H2dVariableType[] _vars, TrPostProjet _projet) { + // src_ = _src; + varGroup_ = new HashMap(); + // tidx_ = _timeIdx; + // Arrays.sort(tidx_); + objIdx_ = FuEmptyArrays.INT0; + intepolPt_ = new HashSet(); + varSupported_ = new HashSet(Arrays.asList(_vars)); + impl_ = projet_.getImpl(); + isAllTimeStep_ = true;// tidx_.length == _src.getNbTimeStep(); + projet_ = _projet; } - public void updateTimeStep(final int[] _idx, final ProgressionInterface _prog) { - if (!isAllTimeStep()) { - return; - } - // if (CtuluLibArray.isEmpty(_idx)) { - // return; - // } - timeSteps_ = null; - // tidx_ = _idx; - buildTimeSteps(); - final EGCourbe[] cs = getCourbes(); - - if (cs != null) { - final TrPostCourbeModel[] model = new TrPostCourbeModel[cs.length]; - for (int i = cs.length - 1; i >= 0; i--) { - model[i] = (TrPostCourbeModel) cs[i].getModel(); - model[i].setY(null); - model[i].setTidx(timeSteps_); - } - updateCurves(model, _prog); - fireCourbeContentChanged(null); - } + public TrPostCourbeTreeModel(final int[] _objIdx, final H2dVariableType[] _vars, TrPostProjet _projet) { + this(/* _src , _timeIdx */_vars, _projet); + objIdx_ = _objIdx; + Arrays.sort(objIdx_); } - protected void addAllCourbes(final ProgressionInterface _prog, final CtuluCommandContainer _cmd) { - buildTimeSteps(); + protected void addAllCourbes(TrPostSource _src, final ProgressionInterface _prog, final CtuluCommandContainer _cmd) { + // buildTimeSteps(); startUpdating(); final List modelToUpdate = new ArrayList(); final List courbeToMem = _cmd == null ? null : new ArrayList(); final List groupToMem = _cmd == null ? null : new ArrayList(); + // double[] timesInSec = _src.getTime().getTimeListModel().getTimesInSec(); for (final Iterator it = varSupported_.iterator(); it.hasNext();) { final H2dVariableType t = (H2dVariableType) it.next(); final EGGroup g = getGroupFor(t); @@ -201,7 +146,8 @@ final int idx = objIdx_[i]; final TrPostCourbeModel c = containsCourbeFor(t, g, idx); if (c == null) { - final EGCourbeChild courbe = TrPostCourbeModel.buildCourbeModel(t, idx, timeSteps_, g, src_); + + final EGCourbeChild courbe = TrPostCourbeModel.buildCourbeModel(t, idx, g, _src); if (courbeToMem != null) { courbeToMem.add(courbe); groupToMem.add(g); @@ -215,7 +161,7 @@ final TrPostInterpolatePoint element = (TrPostInterpolatePoint) iter.next(); final TrPostCourbeModel c = containsCourbeFor(t, g, element); if (c == null) { - final EGCourbeChild courbe = TrPostCourbeModel.buildCourbeModel(t, element, timeSteps_, g, src_); + final EGCourbeChild courbe = TrPostCourbeModel.buildCourbeModel(t, element, g, _src); if (courbeToMem != null) { courbeToMem.add(courbe); groupToMem.add(g); @@ -236,236 +182,18 @@ } - protected void addVariables(final List _var, final ProgressionInterface _prog, final CtuluCommandContainer _cmd) { - buildTimeSteps(); - startUpdating(); - //fusion graphes - _var.removeAll(varSupported_); - final int nbPt = objIdx_.length; - final TrPostCourbeModel[] model = new TrPostCourbeModel[_var.size() * (nbPt + intepolPt_.size())]; - int idx = 0; - final List courbeToMem = _cmd == null ? null : new ArrayList(); - final List groupToMem = _cmd == null ? null : new ArrayList(); - for (int i = 0; i < _var.size(); i++) { - final H2dVariableType var = (H2dVariableType) _var.get(i); - final EGGroup g = getGroupFor(var); - for (int idxPt = 0; idxPt < nbPt; idxPt++) { - final EGCourbeChild c = TrPostCourbeModel.buildCourbeModel(var, objIdx_[idxPt], timeSteps_, g, src_); - courbeToMem.add(c); - groupToMem.add(g); - model[idx++] = (TrPostCourbeModel) c.getModel(); - } - for (final Iterator iter = intepolPt_.iterator(); iter.hasNext();) { - final TrPostInterpolatePoint element = (TrPostInterpolatePoint) iter.next(); - final EGCourbeChild c = TrPostCourbeModel.buildCourbeModel(var, element, timeSteps_, g, src_); - courbeToMem.add(c); - groupToMem.add(... [truncated message content] |