From: <chr...@us...> - 2009-12-16 17:04:59
|
Revision: 5565 http://fudaa.svn.sourceforge.net/fudaa/?rev=5565&view=rev Author: chrisc83 Date: 2009-12-16 17:04:46 +0000 (Wed, 16 Dec 2009) Log Message: ----------- Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/BPaletteEdition.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2009-12-15 16:35:08 UTC (rev 5564) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2009-12-16 17:04:46 UTC (rev 5565) @@ -214,9 +214,9 @@ } public boolean changeSelection(final GrPoint _pt, final int _tolerancePixel, final int _action) { - //TODO Voir si l'action doit se faire en mode atomique (comme mnt) ou dans tout mode diff\xE9rent du mode normal. + //TODO (Normalement r\xE9solu) Voir si l'action doit se faire en mode atomique ou dans tout mode diff\xE9rent du mode normal (comme mnt). // if (isAtomicMode_) { - if (this.mode == SelectionMode.Atomic) { + if (this.mode != SelectionMode.Normal) { final EbliListeSelectionMulti l = selectionMulti(_pt, _tolerancePixel); changeSelectionMulti(l, _action); if ((l == null) || (l.isEmpty())) { @@ -629,9 +629,9 @@ final GrBoite _clipReel) { if (isSelectionEmpty()) return; - //TODO Voir si l'action doit se faire en mode atomique (comme mnt) ou dans tout mode diff\xE9rent du mode normal. + //TODO (Normalement r\xE9solu) Voir si l'action doit se faire en mode atomique ou dans tout mode diff\xE9rent du mode normal (comme mnt). // if (isAtomicMode_) { - if (this.mode == SelectionMode.Atomic) { + if (this.mode != SelectionMode.Normal) { CtuluListSelection containers=new CtuluListSelection(selectionMulti_.getIdxSelection()); paintSelectionSimple(_g, _trace, _versEcran, _clipReel, containers); paintSelectionMulti(_g, _trace, _versEcran, _clipReel); @@ -845,6 +845,9 @@ for (int i = modele_.getNbLigneBrisee() - 1; i >= 0; i--) { modele_.getDomaineForGeometry(i, btLigne); if (btLigne.contientXY(_pt) || btLigne.distanceXY(_pt) < distanceReel) { + + if (this.mode == SelectionMode.Atomic) + { for (int j = modele_.getNbPointForGeometry(i) - 1; j >= 0; j--) { modele_.point(p, i, j); if (bClip.contientXY(p) && (p.distanceXY(_pt) < distanceReel)) { @@ -853,6 +856,46 @@ return r; } } + } + else + { + GrPoint pt1 = new GrPoint(); + GrPoint pt2 = new GrPoint(); + + for (int j = modele_.getNbPointForGeometry(i) - 2; j >= 0; j--) { + // TODO L'algo peut bugger si le 2 points de la ligne ont les m\xEAme coordonn\xE9es. + modele_.point(pt1, i, j + 1); + modele_.point(pt2, i, j); + + double dx = Math.abs((pt1.x_ - pt2.x_)); + double dy = Math.abs((pt1.y_ - pt2.y_)); + + boolean useX = dx >= dy; + + double a = useX ? ((pt1.y_ - pt2.y_) / (pt1.x_ - pt2.x_)) : ((pt1.x_ - pt2.x_) / (pt1.y_ - pt2.y_)); + double b = useX ? (pt1.y_ - (a * pt1.x_)) : (pt1.x_ - (a * pt1.y_)); + + if (useX) + { + p.x_ = _pt.x_; + p.y_ = (a * p.x_) + b; + } + else + { + p.y_ = _pt.y_; + p.x_ = (a * p.y_) + b; + } + + if (bClip.contientXY(p) && (p.distanceXY(_pt) < distanceReel)) { + final EbliListeSelectionMulti r = new EbliListeSelectionMulti(2); + r.set(i, j + 1); + r.add(i, j); + return r; + } + } + } + + } } return null; Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2009-12-15 16:35:08 UTC (rev 5564) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2009-12-16 17:04:46 UTC (rev 5565) @@ -739,12 +739,19 @@ if (txt == null) { txt = CtuluLibString.EMPTY_STRING; } - // if (cqActif_ instanceof ZCalqueLigneBrisee && ((ZCalqueLigneBrisee) cqActif_).isAtomicMode()) { - //TODO Voir si l'action se fait qu'en mode atomique (comme mnt) ou dans tout mode diff\xE9rent du mode normal. - if (pn_.getScene().getCalqueActif() instanceof ZCalqueLigneBrisee -// && ((ZCalqueLigneBrisee) pn_.getScene().getCalqueActif()).isAtomicMode()) { - && (((ZCalqueLigneBrisee) pn_.getScene().getCalqueActif()).getSelectionMode() == SelectionMode.Atomic)) { - txt = "<u>" + EbliLib.getS("SOMMET") + "</u>: " + txt; + //TODO Voir si modif correct et traduire SEGMENT. + if (pn_.getScene().getCalqueActif() instanceof ZCalqueLigneBrisee) + { + SelectionMode mode = ((ZCalqueLigneBrisee)pn_.getScene().getCalqueActif()).getSelectionMode(); + + if (mode == SelectionMode.Atomic) + { + txt = "<u>" + EbliLib.getS("SOMMET") + "</u>: " + txt; + } + else if (mode == SelectionMode.Segement) + { + txt = "<u>" + EbliLib.getS("SEGMENT") + "</u>: " + txt; + } } pn_.setModeText(txt); } Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/BPaletteEdition.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/BPaletteEdition.java 2009-12-15 16:35:08 UTC (rev 5564) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/BPaletteEdition.java 2009-12-16 17:04:46 UTC (rev 5565) @@ -216,6 +216,7 @@ bt.setActionCommand(ATOM_ACTION); bt.setIcon(EbliResource.EBLI.getToolIcon("draw-atom")); bt.setToolTipText(EbliLib.getS("Mode <SOMMET>")); + decoreButton(bt); bt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -229,13 +230,13 @@ } } }); - decoreButton(bt); _target.add(bt); bt = new BuToolToggleButton(); bt.setActionCommand(SEGMENT_ACTION); bt.setIcon(EbliResource.EBLI.getToolIcon("draw-atom")); bt.setToolTipText(EbliLib.getS("Mode <SEGMENT>")); + decoreButton(bt); bt.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -249,7 +250,6 @@ } } }); - decoreButton(bt); _target.add(bt); /* * bt = new BuToolToggleButton(); bt.setActionCommand("MODE_EDIT"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-12-18 15:13:07
|
Revision: 5568 http://fudaa.svn.sourceforge.net/fudaa/?rev=5568&view=rev Author: chrisc83 Date: 2009-12-18 15:12:59 +0000 (Fri, 18 Dec 2009) Log Message: ----------- Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorDefault.java Added Paths: ----------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsEditorPanel.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsTableModel.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2009-12-17 21:20:05 UTC (rev 5567) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2009-12-18 15:12:59 UTC (rev 5568) @@ -20,6 +20,7 @@ import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.CoordinateSequence; import com.vividsolutions.jts.geom.Envelope; +import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.LineString; import com.vividsolutions.jts.geom.LinearRing; @@ -201,12 +202,23 @@ final int min = s.getMinIndex(); for (int j = s.getMaxIndex(); j >= min; j--) { if (s.isSelected(j)) { - modele_.point(p, idxPoly, j); + if (this.mode == SelectionMode.Atomic) + { + modele_.point(p, idxPoly, j); + } + else + { + GrSegment segment = new GrSegment(new GrPoint(), new GrPoint()); + + modele_.point(segment.e_, idxPoly, j); + modele_.point(segment.o_, idxPoly, ((j + 1) < modele_.getNbPointForGeometry(idxPoly)) ? (j + 1) : 0); + + segment.milieu(p); + } if (clip.contientXY(p)) { p.autoApplique(versEcran); ic.paintIconCentre(this, _g, p.x_, p.y_); } - } } } @@ -228,9 +240,9 @@ } public boolean changeSelection(final LinearRing _poly, final int _action, final int _mode) { - //TODO Voir si l'action doit se faire en mode atomique (comme mnt) ou dans tout mode diff\xE9rent du mode normal. + //TODO (Normalement r\xE9solu) Voir si l'action doit se faire en mode atomique ou dans tout mode diff\xE9rent du mode normal (comme mnt). // if (isAtomicMode_) { - if (this.mode == SelectionMode.Atomic) { + if (this.mode != SelectionMode.Normal) { final EbliListeSelectionMulti l = selectionMulti(_poly); changeSelectionMulti(l, _action); if ((l == null) || (l.isEmpty())) { @@ -272,9 +284,9 @@ public void clearSelection() { // dans le mode edition de noeuds - //TODO Voir si l'action doit se faire en mode atomique (comme mnt) ou dans tout mode diff\xE9rent du mode normal. + //TODO (Normalement r\xE9solu) Voir si l'action doit se faire en mode atomique ou dans tout mode diff\xE9rent du mode normal (comme mnt). // if (isAtomicMode_) { - if (this.mode == SelectionMode.Atomic) { + if (this.mode != SelectionMode.Normal) { if (selectionMulti_ != null && !selectionMulti_.isEmpty()) { selectionMulti_.clear(); @@ -330,9 +342,9 @@ if (isSelectionEmpty()) { return 0; } - //TODO Voir si l'action doit se faire en mode atomique (comme mnt) ou dans tout mode diff\xE9rent du mode normal. + //TODO (Normalement r\xE9solu) Voir si l'action doit se faire en mode atomique ou dans tout mode diff\xE9rent du mode normal (comme mnt). // if (isAtomicMode_) { - if (this.mode == SelectionMode.Atomic) { + if (this.mode != SelectionMode.Normal) { return selectionMulti_.getNbListSelected(); } return super.getNbSelected(); @@ -346,9 +358,9 @@ if (isSelectionEmpty()) { return null; } - //TODO Voir si l'action doit se faire en mode atomique (comme mnt) ou dans tout mode diff\xE9rent du mode normal. + //TODO (Normalement r\xE9solu) Voir si l'action doit se faire en mode atomique ou dans tout mode diff\xE9rent du mode normal (comme mnt). // if (isAtomicMode_) { - if (this.mode == SelectionMode.Atomic) { + if (this.mode != SelectionMode.Normal) { return selectionMulti_.getIdxSelected(); } return super.getSelectedIndex(); @@ -358,7 +370,7 @@ if (isSelectionEmpty()) { return null; } - //TODO Voir si l'action doit se faire en mode normal (comme mnt) ou dans tout mode diff\xE9rent du mode atomique. + //TODO (Normalement r\xE9solu) Voir si l'action doit se faire en mode normal (comme mnt) ou dans tout mode diff\xE9rent du mode atomique. // if (!isAtomicMode_) { if (this.mode == SelectionMode.Normal) { return super.getSelectedObjectInTable(); @@ -510,7 +522,7 @@ * @return true Si aucun objet ni aucun point en mode atomique selectionn\xE9. */ public boolean isSelectionEmpty() { - //TODO Voir si l'action doit se faire dans tout mode diff\xE9rent du mode normal (comme mnt) ou en mode atomique. + //TODO (Normalement r\xE9solu) Voir si l'action doit se faire dans tout mode diff\xE9rent du mode normal (comme mnt) ou en mode atomique. return /*isAtomicMode_*/ (this.mode != SelectionMode.Normal) ? selectionMulti_ == null ? true : selectionMulti_.isEmpty() : super.isSelectionEmpty(); } @@ -848,54 +860,42 @@ if (this.mode == SelectionMode.Atomic) { - for (int j = modele_.getNbPointForGeometry(i) - 1; j >= 0; j--) { - modele_.point(p, i, j); - if (bClip.contientXY(p) && (p.distanceXY(_pt) < distanceReel)) { - final EbliListeSelectionMulti r = new EbliListeSelectionMulti(1); - r.set(i, j); - return r; + for (int j = modele_.getNbPointForGeometry(i) - 1; j >= 0; j--) { + modele_.point(p, i, j); + if (bClip.contientXY(p) && (p.distanceXY(_pt) < distanceReel)) { + final EbliListeSelectionMulti r = new EbliListeSelectionMulti(1); + r.set(i, j); + return r; + } } } - } else { - GrPoint pt1 = new GrPoint(); - GrPoint pt2 = new GrPoint(); - - for (int j = modele_.getNbPointForGeometry(i) - 2; j >= 0; j--) { - // TODO L'algo peut bugger si le 2 points de la ligne ont les m\xEAme coordonn\xE9es. - modele_.point(pt1, i, j + 1); - modele_.point(pt2, i, j); + final GrSegment segment = new GrSegment(new GrPoint(), new GrPoint()); - double dx = Math.abs((pt1.x_ - pt2.x_)); - double dy = Math.abs((pt1.y_ - pt2.y_)); + for (int j = 0; j < modele_.getNbPointForGeometry(i); j++) { + int nextIdx = j + 1; - boolean useX = dx >= dy; - - double a = useX ? ((pt1.y_ - pt2.y_) / (pt1.x_ - pt2.x_)) : ((pt1.x_ - pt2.x_) / (pt1.y_ - pt2.y_)); - double b = useX ? (pt1.y_ - (a * pt1.x_)) : (pt1.x_ - (a * pt1.y_)); - - if (useX) + if (nextIdx == modele_.getNbPointForGeometry(i)) { - p.x_ = _pt.x_; - p.y_ = (a * p.x_) + b; + if (modele_.isGeometryFermee(i)) { + nextIdx = 0; + } + else + { + break; + } } - else - { - p.y_ = _pt.y_; - p.x_ = (a * p.y_) + b; - } - - if (bClip.contientXY(p) && (p.distanceXY(_pt) < distanceReel)) { - final EbliListeSelectionMulti r = new EbliListeSelectionMulti(2); - r.set(i, j + 1); - r.add(i, j); + + modele_.point(segment.e_, i, j); + modele_.point(segment.o_, i, nextIdx); + if (segment.distanceXY(_pt)<distanceReel) { + final EbliListeSelectionMulti r = new EbliListeSelectionMulti(1); + r.set(i, j); return r; } } } - - } } return null; @@ -917,21 +917,60 @@ final EbliListeSelectionMulti r = creeSelectionMutli(); final GrPoint p = new GrPoint(); final SIRtreePointInRing tester = new SIRtreePointInRing(_poly); - final Coordinate c = new Coordinate(); + final Coordinate c1 = new Coordinate(); for (int i = modele_.getNbLigneBrisee() - 1; i >= 0; i--) { CtuluListSelection l = null; final int nbPt = modele_.getNbPointForGeometry(i); - for (int j = nbPt - 1; j >= 0; j--) { - modele_.point(p, i, j); - c.x = p.x_; - c.y = p.y_; - if ((polyEnv.contains(c)) && (tester.isInside(c))) { - if (l == null) { - l = new CtuluListSelection(nbPt); + if (this.mode == SelectionMode.Atomic) + { + for (int j = nbPt - 1; j >= 0; j--) { + modele_.point(p, i, j); + c1.x = p.x_; + c1.y = p.y_; + if ((polyEnv.contains(c1)) && (tester.isInside(c1))) { + if (l == null) { + l = new CtuluListSelection(nbPt); + } + l.add(j); } - l.add(j); } } + else + { + final Coordinate c2 = new Coordinate(); + for (int j = 0; j < nbPt; j++) { + int nextIdx = j + 1; + + if (nextIdx == nbPt) + { + if (modele_.isGeometryFermee(i)) { + nextIdx = 0; + } + else + { + break; + } + } + + GrPoint pt1 = new GrPoint(); + GrPoint pt2 = new GrPoint(); + + modele_.point(pt1, i, j); + modele_.point(pt2, i, nextIdx); + + c1.x = pt1.x_; + c1.y = pt1.y_; + c2.x = pt2.x_; + c2.y = pt2.y_; + + if ((polyEnv.contains(c1)) && (tester.isInside(c1)) && (polyEnv.contains(c2)) && (tester.isInside(c2))) { + if (l == null) { + l = new CtuluListSelection(nbPt); + } + l.add(j); + } + } + } if (l != null) { r.set(i, l); } @@ -987,13 +1026,13 @@ } public boolean setSelection(final int[] _idx) { - //TODO Voir si l'action doit se faire en mode normal (comme mnt) ou dans tout mode diff\xE9rent du mode atomique. + //TODO (Normalement r\xE9solu) Voir si l'action doit se faire en mode normal (comme mnt) ou dans tout mode diff\xE9rent du mode atomique. // if (!isAtomicMode_) { if (this.mode == SelectionMode.Normal) { return super.setSelection(_idx); } - // TODO : Traitement a faire si on est en mode atomique. - FuLog.warning("EBL:ZCalqueLigneBrisee.setSelection() can't be called in atomic mode"); + // TODO : Traitement a faire si on est en mode atomique et segment. + FuLog.warning("EBL:ZCalqueLigneBrisee.setSelection() can't be called in atomic or segment mode"); return false; } Added: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsEditorPanel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsEditorPanel.java (rev 0) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsEditorPanel.java 2009-12-18 15:12:59 UTC (rev 5568) @@ -0,0 +1,57 @@ +package org.fudaa.ebli.calque.edition; + +import javax.swing.JTable; + +import org.fudaa.ctulu.CtuluAnalyze; +import org.fudaa.ctulu.CtuluCommandComposite; +import org.fudaa.ctulu.CtuluCommandContainer; +import org.fudaa.ctulu.CtuluCommandManager; +import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.ctulu.table.CtuluTable; +import org.fudaa.ebli.commun.EbliFormatterInterface; + +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuScrollPane; + +@SuppressWarnings("serial") +public class EbliSegmentsEditorPanel extends CtuluDialogPanel +{ + final CtuluCommandContainer cmd_; + final EbliSegmentsTableModel tableModel_; + final JTable table_; + + public EbliSegmentsEditorPanel(final int _idx, final int[] _segments, final EbliFormatterInterface _xyFormatter, + final ZModeleLigneBriseeEditable _modele, final boolean _editSegment, final CtuluCommandManager _cmd) { + this(new EbliSegmentsTableModel(_xyFormatter, _modele.getGeomData(), _modele, _idx, _segments, _editSegment), _cmd); + } + + public EbliSegmentsEditorPanel(final EbliSegmentsTableModel _model, final CtuluCommandManager _cmd) { + tableModel_ = _model; + cmd_ = _cmd; + table_ = new CtuluTable(); + table_.setModel(tableModel_); + tableModel_.updateCellEditor(table_); + setLayout(new BuBorderLayout()); + add(new BuScrollPane(table_)); + } + + public void apply(){ + final CtuluCommandComposite cmp = cmd_ == null ? null : new CtuluCommandComposite(); + tableModel_.apply(cmp); + if (cmd_ != null) { + cmd_.addCmd(cmp.getSimplify()); + } + } + + public boolean valide(){ + if (table_.isEditing()) { + table_.getCellEditor().stopCellEditing(); + } + final CtuluAnalyze ana = tableModel_.isValid(); + if (ana != null && ana.containsFatalError()) { + setErrorText(ana.getFatalError()); + return false; + } + return true; + } +} Added: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsTableModel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsTableModel.java (rev 0) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsTableModel.java 2009-12-18 15:12:59 UTC (rev 5568) @@ -0,0 +1,373 @@ +package org.fudaa.ebli.calque.edition; + +import gnu.trove.TIntIntHashMap; +import gnu.trove.TIntObjectHashMap; +import gnu.trove.TIntObjectIterator; + +import java.util.Arrays; +import java.util.HashMap; + +import javax.swing.JTable; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableColumnModel; + +import org.fudaa.ctulu.CtuluAnalyze; +import org.fudaa.ctulu.CtuluCommandComposite; +import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.editor.CtuluValueEditorI; +import org.fudaa.ctulu.gis.GISAttributeModel; +import org.fudaa.ctulu.gis.GISCoordinateSequence; +import org.fudaa.ctulu.gis.GISZoneCollection; +import org.fudaa.ebli.commun.EbliFormatterInterface; +import org.fudaa.ebli.commun.EbliLib; + +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.CoordinateSequence; + +@SuppressWarnings("serial") +public class EbliSegmentsTableModel extends AbstractTableModel +{ + private static class Cell + { + private final int row; + private final int column; + + public Cell(int row, int column) + { + this.row = row; + this.column = column; + } + + public int getRow() + { + return row; + } + + public int getColumn() + { + return column; + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = prime * result + column; + result = prime * result + row; + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Cell other = (Cell) obj; + if (column != other.column) + return false; + if (row != other.row) + return false; + return true; + } + } + + private final static int MIN_NB_COLUMN = 5; + private final static int V1_X_COLUMN = 1; + private final static int V1_Y_COLUMN = 2; + private final static int V2_X_COLUMN = 3; + private final static int V2_Y_COLUMN = 4; + + final int idx; + final GISZoneCollection zone; + final EbliFormatterInterface formatter; + final GISAttributeModel[] modeles; + final ZModeleLigneBriseeEditable modele; + TIntObjectHashMap<Coordinate> newCoordinates; + final CoordinateSequence coordinateSequence; + final boolean isFerme; + final int maxNbPts; + final int[] segments; + final HashMap<Cell, Cell> cellsLinked = new HashMap<Cell, Cell>(); + + public EbliSegmentsTableModel(final EbliFormatterInterface formatter, final GISZoneCollection zone, ZModeleLigneBriseeEditable modele, int idx, int[] segments, boolean useAttribute) + { + Arrays.sort(segments); + + this.idx = idx; + this.segments = segments; + this.formatter = formatter; + this.zone = zone; + this.modele = modele; + this.modeles = useAttribute ? zone.getAtomicAttributeSubModel(idx) : null; + this.coordinateSequence = zone.getCoordinateSequence(idx); + this.isFerme = modele.isGeometryFermee(idx); + this.maxNbPts = modele.getNbPointForGeometry(idx); + + TIntIntHashMap segmentsRows = new TIntIntHashMap(); + for (int i = 0; i < segments.length; i++) + { + segmentsRows.put(segments[i], i); + } + + for (int i = 0; i < segments.length; i++) + { + int nextSegment = (segments[i] + 1) % this.maxNbPts; + + if (segmentsRows.containsKey(nextSegment)) + { + int currentRow = segmentsRows.get(segments[i]); + int nextRow = segmentsRows.get(nextSegment); + + Cell cell11 = new Cell(currentRow, V2_X_COLUMN); + Cell cell12 = new Cell(currentRow, V2_Y_COLUMN); + Cell cell21 = new Cell(nextRow, V1_X_COLUMN); + Cell cell22 = new Cell(nextRow, V1_Y_COLUMN); + + cellsLinked.put(cell11, cell21); + cellsLinked.put(cell12, cell22); + cellsLinked.put(cell21, cell11); + cellsLinked.put(cell22, cell12); + } + } + } + + private int getVertexIdx(int rowIdx, int columnIdx) + { + if (columnIdx < V2_X_COLUMN) + { + return segments[rowIdx]; + } + else + { + return ((segments[rowIdx] + 1) % maxNbPts); + } + } + + public int getColumnCount() + { + return (modeles == null ? 0 : modeles.length) + MIN_NB_COLUMN; + } + + public int getRowCount() + { + return segments.length; + } + + private double getX(final int vertexIdx) { + if (newCoordinates != null && newCoordinates.contains(vertexIdx)) + { + return ((Coordinate) newCoordinates.get(vertexIdx)).x; + } + return coordinateSequence.getX(vertexIdx); + } + + private double getY(final int vertexIdx) { + if (newCoordinates != null && newCoordinates.contains(vertexIdx)) + { + return ((Coordinate) newCoordinates.get(vertexIdx)).y; + } + return coordinateSequence.getY(vertexIdx); + } + + public Object getValueAt(int rowIdx, int columnIdx) + { + int vertexIdx = this.getVertexIdx(rowIdx, columnIdx); + switch (columnIdx) + { + case 0 : + { + return String.valueOf(segments[rowIdx] + 1); + } + case V1_X_COLUMN : + case V2_X_COLUMN : + { + return this.formatter.getXYFormatter().format(this.getX(vertexIdx)); + } + case V1_Y_COLUMN : + case V2_Y_COLUMN : + { + return this.formatter.getXYFormatter().format(this.getY(vertexIdx)); + } + } + return null; + } + + public String getColumnName(final int _columnIndex) { + switch (_columnIndex) + { + case 0 : + { + return EbliLib.getS("Index"); + } + case V1_X_COLUMN : + { + return "X1"; + } + case V1_Y_COLUMN : + { + return "Y1"; + } + case V2_X_COLUMN : + { + return "X2"; + } + case V2_Y_COLUMN : + { + return "Y2"; + } + } + final int idx = _columnIndex - MIN_NB_COLUMN; + if (idx >= 0) + { + return modeles[idx].getAttribute().getName(); + } + return CtuluLibString.EMPTY_STRING; + } + + public boolean isCellEditable(final int rowIndex, final int columnIndex) { + if (columnIndex == 0) + { + return false; + } + else if (columnIndex < MIN_NB_COLUMN) + { + return zone.isGeomModifiable(); + } + + return true; + } + + public void updateCellEditor(final JTable _table) { + final TableColumnModel cols = _table.getColumnModel(); + // xy + final TableCellEditor ed = formatter.createTableEditorComponent(); + cols.getColumn(V1_X_COLUMN).setCellEditor(ed); + cols.getColumn(V1_Y_COLUMN).setCellEditor(ed); + cols.getColumn(V2_X_COLUMN).setCellEditor(ed); + cols.getColumn(V2_Y_COLUMN).setCellEditor(ed); + // les attribut + if (modeles != null) { + for (int i = 0; i < modeles.length; i++) { + final CtuluValueEditorI editor = modeles[i].getAttribute().getEditor(); + if (editor != null) { + cols.getColumn(MIN_NB_COLUMN + i).setCellEditor(editor.createTableEditorComponent()); + } + } + } + } + + public void setValueAt(final Object value, final int rowIndex, final int columnIndex) { + if (!this.isCellEditable(rowIndex, columnIndex)) + { + return; + } + + final int segmentIdx = segments[rowIndex];//lines.get(rowIndex).getSegmentIdx(); + + if (columnIndex >= MIN_NB_COLUMN) + { + // l'indice de l'attribut atomic + final int val = columnIndex - MIN_NB_COLUMN; + /* + if (modelesNewValues_ == null) { + modelesNewValues_ = new TIntObjectHashMap[modeles_.length]; + } + if (modelesNewValues_[val] == null) { + modelesNewValues_[val] = new TIntObjectHashMap(); + } + modelesNewValues_[val].put(realIdx, _value); + */ + } + else + { + int vertexIdx = this.getVertexIdx(rowIndex, columnIndex); + + if (newCoordinates == null) { + newCoordinates = new TIntObjectHashMap<Coordinate>(coordinateSequence.size()); + } + Coordinate c = (Coordinate) newCoordinates.get(vertexIdx); + if (c == null) { + c = new Coordinate(); + c.x = coordinateSequence.getX(vertexIdx); + c.y = coordinateSequence.getY(vertexIdx); + newCoordinates.put(vertexIdx, c); + } + if (((columnIndex - 1) % 2) == 0) { + c.x = ((Double)value).doubleValue(); + } else { + c.y = ((Double)value).doubleValue(); + } + + Cell cell = new Cell(rowIndex, columnIndex); + + if (cellsLinked.containsKey(cell)) + { + cell = cellsLinked.get(cell); + + fireTableCellUpdated(cell.getRow(), cell.getColumn()); + } + } + } + + /** + * @return les nouvelles coordonnees. null si pas de modif + */ + public CoordinateSequence getNewCoordinateSequence() { + if (newCoordinates == null) { return null; } + + final GISCoordinateSequence newSeq = new GISCoordinateSequence(coordinateSequence); + final TIntObjectIterator<Coordinate> it = newCoordinates.iterator(); + for (int j = newCoordinates.size(); j-- > 0;) { + it.advance(); + final int idx = it.key(); + final Coordinate c = (Coordinate) it.value(); + newSeq.setX(idx, c.x); + newSeq.setY(idx, c.y); + } + if (isFerme && newCoordinates.contains(0)) { + final int last = newSeq.size() - 1; + final Coordinate c = (Coordinate) newCoordinates.get(0); + newSeq.setX(last, c.x); + newSeq.setY(last, c.y); + } + return newSeq; + } + + protected void apply(final CtuluCommandComposite _cmp) { +/* + if (modelesNewValues_ != null) { + for (int i = modelesNewValues_.length - 1; i >= 0; i--) { + final TIntObjectHashMap val = modelesNewValues_[i]; + if (val != null) { + final TIntObjectIterator it = val.iterator(); + final GISAttributeModel dataModel = modeles_[i]; + for (int j = val.size(); j-- > 0;) { + it.advance(); + dataModel.setObject(it.key(), it.value(), _cmp); + } + } + } + }*/ + final CoordinateSequence newSeq = this.getNewCoordinateSequence(); + if (newSeq != null) { + zone.setCoordinateSequence(idx, newSeq, _cmp); + } + } + + protected CtuluAnalyze isValid() { + if (modele == null) { return null; } + final CoordinateSequence seq = getNewCoordinateSequence(); + if (seq != null) { + final CtuluAnalyze ana = new CtuluAnalyze(); + if (!modele.isCoordinateValid(seq, ana)) { return ana; } + } + return null; + } +} + Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorDefault.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2009-12-17 21:20:05 UTC (rev 5567) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2009-12-18 15:12:59 UTC (rev 5568) @@ -7,6 +7,7 @@ */ package org.fudaa.ebli.calque.edition; +import gnu.trove.TIntHashSet; import gnu.trove.TIntObjectIterator; import java.awt.Frame; @@ -21,6 +22,7 @@ import javax.swing.Action; import javax.swing.JDialog; import javax.swing.JInternalFrame; +import javax.swing.JOptionPane; import javax.swing.KeyStroke; import javax.swing.SwingUtilities; @@ -731,12 +733,17 @@ if (!isEditable(_target)) { return EbliLib.getS("Non \xE9ditable"); } final ZCalqueEditable ed = (ZCalqueEditable) _target; if (ed.isSelectionEmpty()) { return EbliLib.getS("La s\xE9lection courante est vide"); } - //TODO Voir si l'action se fait qu'en mode atomique (comme mnt) ou dans tout mode diff\xE9rent du mode normal. + //TODO (Normalement r\xE9solu) Voir si l'action se fait qu'en mode atomique (comme mnt) ou dans tout mode diff\xE9rent du mode normal. // if (ed.isAtomicMode()) { if (ed.getSelectionMode() == SelectionMode.Atomic) { editVertexObject(ed); return null; } + if (ed.getSelectionMode() == SelectionMode.Segement) + { + editSegmentObject(ed); + return null; + } final ZCalqueAffichageDonnees calque = (ZCalqueAffichageDonnees) ed; if (calque.isOnlyOneObjectSelected()) { editSingleObject(ed); @@ -786,9 +793,38 @@ final EbliAtomicsEditorPanel ed = new EbliAtomicsEditorPanel(idx, vertex, getXYFormatter(), _target .getModelEditable(), editAttribute, getMng()); ed.afficheModale(getFrame(), _target.getTitle()); + } + protected void editSegmentObject(final ZCalqueEditable _target) + { + if (!(_target.getModelEditable() instanceof ZModeleLigneBriseeEditable)) + { + return; + } + final EbliListeSelectionMultiInterface idxSelected = ((ZCalqueAffichageDonnees) _target).getLayerSelectionMulti(); + if (idxSelected.getNbListSelected() > 1) { return; } + final TIntObjectIterator it = idxSelected.getIterator(); + it.advance(); + final int idx = it.key(); + final int[] segments = ((CtuluListSelectionInterface) it.value()).getSelectedIndex(); +// final TIntHashSet vertex = new TIntHashSet(); +// ZModeleLigneBriseeEditable modele = (ZModeleLigneBriseeEditable)_target.getModelEditable(); +// int nbPts = modele.getNbPointForGeometry(idx); + +// for (int i = 0; i < segments.length; i++) +// { +// vertex.add(segments[i]); +// vertex.add((segments[i] + 1) % nbPts); +// } + + final boolean editAttribute = true; + final EbliSegmentsEditorPanel ed = new EbliSegmentsEditorPanel(idx, segments, getXYFormatter(), (ZModeleLigneBriseeEditable)_target + .getModelEditable(), editAttribute, getMng()); + ed.afficheModale(getFrame(), _target.getTitle()); + + //TODO A faire } - + public void visuSelectedLayer() { final BCalque cq = this.getPanel().getArbreCalqueModel().getSelectedCalque(); if (!(cq instanceof ZCalqueAffichageDonnees) || ((ZCalqueAffichageDonnees) cq).isSelectionEmpty()) { return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2010-06-28 22:56:21
|
Revision: 5784 http://fudaa.svn.sourceforge.net/fudaa/?rev=5784&view=rev Author: deniger Date: 2010-06-28 22:56:15 +0000 (Mon, 28 Jun 2010) Log Message: ----------- Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalque.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueSondeInteraction.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueSondeInterface.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliAtomicsEditorPanel.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsEditorPanel.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalque.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalque.java 2010-06-28 22:55:55 UTC (rev 5783) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalque.java 2010-06-28 22:56:15 UTC (rev 5784) @@ -237,7 +237,7 @@ BCalque.this.setTitle(ft.getText()); } - public boolean valide() { + public boolean isDataValid() { final String txt = ft.getText(); if (txt.length() == 0) { setErrorText(CtuluLib.getS("Le champ est vide") + '!'); Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueSondeInteraction.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueSondeInteraction.java 2010-06-28 22:55:55 UTC (rev 5783) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueSondeInteraction.java 2010-06-28 22:56:15 UTC (rev 5784) @@ -18,6 +18,7 @@ * @author Fred Deniger * @version $Id: ZCalqueSondeInteraction.java,v 1.8 2006-09-19 14:55:45 deniger Exp $ */ +@SuppressWarnings("serial") public class ZCalqueSondeInteraction extends ZCalqueClickInteraction { private ZCalqueSondeInterface target_; @@ -80,7 +81,8 @@ } public void setGele(final boolean _gele){ - if (target_ != null) { + //to avoid loose the current sondes we do nothing here: + if (target_ != null && !_gele) { target_.setSondeEnable(!_gele); } super.setGele(_gele); Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueSondeInterface.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueSondeInterface.java 2010-06-28 22:55:55 UTC (rev 5783) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueSondeInterface.java 2010-06-28 22:56:15 UTC (rev 5784) @@ -65,5 +65,11 @@ */ public List<GrPoint> getLigneBriseeFromSondes(); + + /** + * Use to clear all sounds uses. + */ + public void clearSonde(); + } Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliAtomicsEditorPanel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliAtomicsEditorPanel.java 2010-06-28 22:55:55 UTC (rev 5783) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliAtomicsEditorPanel.java 2010-06-28 22:56:15 UTC (rev 5784) @@ -66,7 +66,7 @@ } } - public boolean valide(){ + public boolean isDataValid(){ if (table_.isEditing()) { table_.getCellEditor().stopCellEditing(); } Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsEditorPanel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsEditorPanel.java 2010-06-28 22:55:55 UTC (rev 5783) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsEditorPanel.java 2010-06-28 22:56:15 UTC (rev 5784) @@ -43,7 +43,7 @@ } } - public boolean valide(){ + public boolean isDataValid(){ if (table_.isEditing()) { table_.getCellEditor().stopCellEditing(); } Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java 2010-06-28 22:55:55 UTC (rev 5783) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java 2010-06-28 22:56:15 UTC (rev 5784) @@ -226,7 +226,7 @@ cmd_ = _cmd; } - public boolean valide() { + public boolean isDataValid() { if (table_ != null && table_.isEditing()) { table_.getCellEditor().stopCellEditing(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2010-10-18 00:17:42
|
Revision: 5981 http://fudaa.svn.sourceforge.net/fudaa/?rev=5981&view=rev Author: deniger Date: 2010-10-18 00:17:35 +0000 (Mon, 18 Oct 2010) Log Message: ----------- Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalque.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGrille.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZebliCalquePersist.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalque.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalque.java 2010-10-18 00:17:20 UTC (rev 5980) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalque.java 2010-10-18 00:17:35 UTC (rev 5981) @@ -630,6 +630,9 @@ if (_p.isDefined("calque.foreground") && !isGroupeCalque()) { setForeground((Color) _p.get("calque.foreground")); } + if (_p.isDefined("calque.font")) { + setFont((Font) _p.get("calque.font")); + } } } @@ -698,7 +701,7 @@ if (_g.getClipBounds() == null) { _g.setClip(0, 0, getWidth(), getHeight()); } - super.paint(_g); + super.paint(_g); } public void paintImage(final Graphics _g) { @@ -760,7 +763,7 @@ /** * repaint apres un delai. - * + * * @param _tm delai en millisecondes */ public void repaint(final long _tm) { @@ -775,6 +778,7 @@ final EbliUIProperties prop = new EbliUIProperties(this.getName()); prop.put("calque.visible", isVisible()); prop.put("calque.rapide", isRapide()); + prop.put("calque.font", getFont()); prop.setTitle(getTitle()); if (!isGroupeCalque() && getForeground() != null) { prop.put("calque.foreground", getForeground()); @@ -973,5 +977,4 @@ return r; } - } \ No newline at end of file Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2010-10-18 00:17:20 UTC (rev 5980) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2010-10-18 00:17:35 UTC (rev 5981) @@ -505,6 +505,7 @@ if (paletteCouleur_ != null) { res.put("calque.paletteCouleur", paletteCouleur_.save()); } + if (isAntialiasSupported()) { res.put("calque.antialias", Boolean.valueOf(antialiasing_)); } @@ -526,23 +527,27 @@ } } super.setForeground(_v); - if (isPaletteCouleurUsed_) { - firePropertyChange("paletteCouleur", paletteCouleur_, null); - isPaletteCouleurUsed_ = false; - if (legendContainsOnlyPalette()) { - final BCalqueLegende l = getLegende(); - if (l != null) { - l.enleve(this); - l.revalidate(); - } - } - } + removeUsedPalette(); if (isVisible()) { quickRepaint(); } } + protected void removeUsedPalette() { + if (isPaletteCouleurUsed_) { + firePropertyChange("paletteCouleur", paletteCouleur_, null); + isPaletteCouleurUsed_ = false; + if (legendContainsOnlyPalette()) { + final BCalqueLegende l = getLegende(); + if (l != null) { + l.enleve(this); + l.revalidate(); + } + } + } + } + /** * @return true si la l\xE9gende ne contient que des donn\xE9es concerant la palette de couleur. dans ce cas, la legende est * enlevee si aucune palette n'est utilis\xE9e. Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGrille.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGrille.java 2010-10-18 00:17:20 UTC (rev 5980) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGrille.java 2010-10-18 00:17:35 UTC (rev 5981) @@ -37,6 +37,7 @@ * @version $Revision: 1.11.6.1 $ $Date: 2008-02-20 10:14:40 $ by $Author: bmarchan $ * @author Guillaume Desnoix */ +@SuppressWarnings("serial") public class ZCalqueGrille extends ZCalqueAffichageDonnees { /** * caratere visible de l'axe x @@ -829,6 +830,7 @@ res.put(MINOR_GRADUATION_Y_NB, this.yMinorGraduationNb_); res.put(MINOR_GRADUATION_Y_VISIBLE, this.yMinorDraw_); res.put(MINOR_GRADUATION_X_VISIBLE, this.isXMinorDraw()); + return res; } Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZebliCalquePersist.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZebliCalquePersist.java 2010-10-18 00:17:20 UTC (rev 5980) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZebliCalquePersist.java 2010-10-18 00:17:35 UTC (rev 5981) @@ -60,8 +60,6 @@ */ protected XStream initXmlParser() { XStream xstream = new XStream(new DomDriver()); - // -- creation des alias pour que ce soit + parlant dans le xml file --// - return xstream; } @@ -126,16 +124,6 @@ } } - // TODO il faut generer la classe du persistencemanager - // public ZEbliCalquesPanel generateCalqueInstance(String className) throws ClassNotFoundException, - // InstantiationException, IllegalAccessException { - // if (className.startsWith("class ")) className = className.substring("class ".length()); - // Class myclass = Class.forName(className, true, Thread.currentThread().getContextClassLoader()); - // Object myModel = myclass.newInstance(); - // if (myModel instanceof ZEbliCalquesPanel) return (ZEbliCalquesPanel) myModel; - // return null; - // - // } /** * Methode qui remplit le panel fournit en parametre avec les donn\xE9es sauvegardees. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2010-10-28 11:11:20
|
Revision: 6013 http://fudaa.svn.sourceforge.net/fudaa/?rev=6013&view=rev Author: bmarchan Date: 2010-10-28 11:11:14 +0000 (Thu, 28 Oct 2010) Log Message: ----------- Ajout de la possibilit?\195?\169 d'utiliser un modele ImageRaster sans image associ?\195?\169e. Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueImageRaster.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZModeleStatiqueImageRaster.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueImageRaster.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueImageRaster.java 2010-10-28 11:09:57 UTC (rev 6012) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueImageRaster.java 2010-10-28 11:11:14 UTC (rev 6013) @@ -157,7 +157,7 @@ */ public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) { // boolean attenue = isAttenue(); - if (getModelImage() == null) { + if (getModelImage() == null || getModelImage().getImage()==null) { return; } final int w = getIconWidth() - 1; Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZModeleStatiqueImageRaster.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZModeleStatiqueImageRaster.java 2010-10-28 11:09:57 UTC (rev 6012) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZModeleStatiqueImageRaster.java 2010-10-28 11:11:14 UTC (rev 6013) @@ -143,6 +143,11 @@ File path_; AffineTransform raster_; + public ZModeleStatiqueImageRaster() { + super(false); + pts_ = createZone(); + } + public ZModeleStatiqueImageRaster(final CtuluImageContainer _img) { super(false); pts_ = createZone(); @@ -291,7 +296,8 @@ public final void clear() { pts_.removeAll(null); - initTransform(); + if (image_!=null) + initTransform(); // raster_ = null; } @@ -441,7 +447,9 @@ } public BufferedImage getImage() { - return image_.getSnapshot(); + if (image_!=null) + return image_.getSnapshot(); + return null; } public Object getObject(final int _ind) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2010-11-24 15:35:00
|
Revision: 6047 http://fudaa.svn.sourceforge.net/fudaa/?rev=6047&view=rev Author: bmarchan Date: 2010-11-24 15:34:54 +0000 (Wed, 24 Nov 2010) Log Message: ----------- Ajout de la possibilit?\195?\169 de donner le nom des coordonn?\195?\169es affich?\195?\169es dans la barre de statut d'un panneau de calques. Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/EbliAdapteurSuiviSouris.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquesPanel.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/EbliAdapteurSuiviSouris.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/EbliAdapteurSuiviSouris.java 2010-11-24 14:55:10 UTC (rev 6046) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/EbliAdapteurSuiviSouris.java 2010-11-24 15:34:54 UTC (rev 6047) @@ -24,6 +24,7 @@ JLabel label_; private EbliFormatterInterface fmt_; + private String[] nameCoords_={"X","Y","Z","V"}; public EbliAdapteurSuiviSouris(final JLabel _label) { label_ = _label; @@ -38,6 +39,21 @@ return fmt_; } + /** + * Definit le nom des coordonn\xE9es affich\xE9es dans le label. + * @param _names Le nom des coordonn\xE9es. + */ + public void setCoordinateNames(String[] _names) { + nameCoords_=_names; + } + + /** + * @return Le nom des coordonn\xE9es affich\xE9es dans le label. + */ + public String[] getCoordinateNames() { + return nameCoords_; + } + double[] oldValues_; public void coordonneesModifiees(final CoordonneesEvent _evt){ @@ -51,16 +67,7 @@ final StringBuffer r = new StringBuffer(""); if (oldValues_ != null) { for (int i = 0; i < oldValues_.length; i++) { - //if(i==0) r+=" X:" +(int)c[i]; - if (i == 0) { - r.append(" X:"); - } else if (i == 1) { - r.append(" Y:"); - } else if (i == 2) { - r.append(" Z:"); - } else if (i >= 3) { - r.append(" V"); - } + r.append(" ").append(nameCoords_[Math.min(i,nameCoords_.length-1)]).append(":"); if (fmt_ == null) { r.append(oldValues_[i]); } else { Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2010-11-24 14:55:10 UTC (rev 6046) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2010-11-24 15:34:54 UTC (rev 6047) @@ -692,6 +692,21 @@ suiviSouris_.format(_xyFormatter); } + /** + * Definit le nom des coordonn\xE9es affich\xE9es dans la barre de statut. + * @param _names Le nom des coordonn\xE9es. + */ + public void setCoordinateNames(String[] _names) { + suiviSouris_.setCoordinateNames(_names); + } + + /** + * @return le nom des coordonn\xE9es affich\xE9es dans la barre de statut. + */ + public String[] getCoordinateNames() { + return suiviSouris_.getCoordinateNames(); + } + public void setInfoPaletteActive() { if (infoPalette_ != null && !infoPalette_.isSelected()) { infoPalette_.changeAll(); Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2010-11-24 14:55:10 UTC (rev 6046) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2010-11-24 15:34:54 UTC (rev 6047) @@ -849,6 +849,14 @@ controller_.setEbliFormatter(_xyFormatter); } + /** + * Definit le nom des coordonn\xE9es affich\xE9es dans la barre de statut. + * @param _names Le nom des coordonn\xE9es. + */ + public void setCoordinateNames(String[] _names) { + controller_.setCoordinateNames(_names); + } + public void setModeText(final String _txt) { if (mode_ != null) { if (CtuluLibString.isEmpty(_txt)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2011-02-06 20:28:01
|
Revision: 6103 http://fudaa.svn.sourceforge.net/fudaa/?rev=6103&view=rev Author: bmarchan Date: 2011-02-06 20:27:55 +0000 (Sun, 06 Feb 2011) Log Message: ----------- Legende du calque ZCalqueFleche + conforme ?\195?\160 l'API. Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueFleche.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueFlecheLegend.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueFleche.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueFleche.java 2011-02-06 20:26:08 UTC (rev 6102) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueFleche.java 2011-02-06 20:27:55 UTC (rev 6103) @@ -45,6 +45,8 @@ import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.geometrie.GrSegment; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; +import org.fudaa.ebli.palette.BPalettePlage; +import org.fudaa.ebli.trace.BPlageInterface; import org.fudaa.ebli.trace.TraceIcon; import org.fudaa.ebli.trace.TraceIconModel; import org.fudaa.ebli.trace.TraceLigne; @@ -185,6 +187,11 @@ public ZCalqueFleche() { super(); + // Par defaut aucune plage, mais la palette couleur est cr\xE9\xE9e (n\xE9cessaire pour affichage + // du composant fleche). + BPalettePlage newPlage = new BPalettePlage(new BPlageInterface[0]); + setPaletteCouleurPlages(newPlage); + flecheLegend_=new ZCalqueFlecheLegend(this); } protected boolean isGrilleActivated() { @@ -214,14 +221,6 @@ repaint(); } - private void createFlecheLegend() { - if (flecheLegend_ == null) { - if (getLegende() != null && isVisible()) { - flecheLegend_ = new ZCalqueFlecheLegend(this); - } - } - } - public Font getFontForFlechLegend() { return scale_.getScaleFont(); } @@ -239,8 +238,10 @@ } protected void construitLegende() { - if (flecheLegend_ != null) { - flecheLegend_.construitLegende(); + boolean bpaletteExists=paletteLegende_!=null; + super.construitLegende(); + if (!bpaletteExists && paletteLegende_!=null) { + paletteLegende_.addUserComponent(flecheLegend_.getFlecheComponent()); } } @@ -452,22 +453,6 @@ return cui; } - public void setLegende(final BCalqueLegende _cqLegende) { - super.setLegende(_cqLegende); - createFlecheLegend(); - } - - public void setVisible(final boolean _v) { - super.setVisible(_v); - if (_v) { - scale_.initFactor(); - createFlecheLegend(); - if(!flecheLegend_.isInitialized()){ - flecheLegend_.intializeFlechLegend(); - } - } - } - public FlecheScaleData getScaleData() { return scale_; } Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueFlecheLegend.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueFlecheLegend.java 2011-02-06 20:26:08 UTC (rev 6102) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueFlecheLegend.java 2011-02-06 20:27:55 UTC (rev 6103) @@ -30,6 +30,7 @@ import com.memoire.bu.BuLabel; import com.memoire.bu.BuPanel; import com.memoire.bu.BuVerticalLayout; +import javax.swing.JPanel; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluNumberFormatFortran; @@ -37,9 +38,7 @@ import org.fudaa.ctulu.iterator.NumberIterator; import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.geometrie.GrSegment; -import org.fudaa.ebli.palette.BPalettePlage; import org.fudaa.ebli.palette.BPalettePlageLegende; -import org.fudaa.ebli.trace.BPlageInterface; import org.fudaa.ebli.trace.TraceLigne; /** @@ -144,14 +143,21 @@ private boolean initialized; + /** + * @deprecated Not used + */ public void intializeFlechLegend() { - if (initialized) return; +// if (initialized) return; initialized = true; init(); initLegendPalette(); support_.paletteLegende_.addUserComponent(pnSize_); } + public JPanel getFlecheComponent() { + return pnSize_; + } + final BuPanel pnSize_; protected void init() { @@ -297,18 +303,31 @@ _seg.o_.y_ = 0; } + /** + * @deprecated Not used + */ private void initLegendPalette() { final BCalqueLegende l = support_.getLegende(); - BPalettePlage newPlage = new BPalettePlage(new BPlageInterface[0]); - support_.setPaletteCouleurPlages(newPlage); + +// BPalettePlage newPlage = new BPalettePlage(new BPlageInterface[0]); +// support_.setPaletteCouleurPlages(newPlage); support_.paletteLegende_ = new BPalettePlageLegende(support_.paletteCouleur_); BCalqueLegendePanel pn = new BCalqueLegendePanel(support_, support_.getTitle()); pn.add(support_.paletteLegende_, BorderLayout.CENTER); + + if (l==null) return; + l.enleve(support_); l.ajouteLegendPanel(pn); l.updateAll(); } + /** + * @deprecated Not used + */ protected void construitLegende() { + if (support_.paletteLegende_==null) + return; + if (support_.paletteLegende_.getModel() == support_.paletteCouleur_) { support_.paletteLegende_.allPaletteModified(support_.paletteCouleur_); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2011-02-28 15:07:50
|
Revision: 6124 http://fudaa.svn.sourceforge.net/fudaa/?rev=6124&view=rev Author: bmarchan Date: 2011-02-28 15:07:43 +0000 (Mon, 28 Feb 2011) Log Message: ----------- Grosse modif pour pouvoir donner un nom diff?\195?\169rent de X ou Y sur les coordonn?\195?\169es. Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/EbliAdapteurSuiviSouris.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquesPanel.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliAtomicCoordinatesTableModel.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliAtomicsEditorPanel.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsEditorPanel.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsTableModel.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleGeomVisuPanel.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorDefault.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorLigneBriseePanel.java Added Paths: ----------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/EbliCoordinateDefinition.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/EbliAdapteurSuiviSouris.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/EbliAdapteurSuiviSouris.java 2011-02-28 14:51:14 UTC (rev 6123) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/EbliAdapteurSuiviSouris.java 2011-02-28 15:07:43 UTC (rev 6124) @@ -9,49 +9,69 @@ package org.fudaa.ebli.calque; import javax.swing.JLabel; +import javax.units.SI; import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ebli.commun.EbliFormatter; import org.fudaa.ebli.commun.EbliFormatterInterface; import org.fudaa.ebli.repere.CoordonneesEvent; import org.fudaa.ebli.repere.CoordonneesListener; /** * Adapteur de CoordonneesEvent vers un JLabel. Il est possible de modifier l'affichage des - * coordonnees. Pour cela, il faut ajouter une format <code>format(votreFormat)</code>. + * coordonnees. Pour cela, utilisez la m\xE9thode setCoordinateDefinitions(). * @version $Id: EbliAdapteurSuiviSouris.java,v 1.15 2006-09-19 14:55:47 deniger Exp $ * @author Guillaume Desnoix */ public class EbliAdapteurSuiviSouris implements CoordonneesListener { JLabel label_; - private EbliFormatterInterface fmt_; - private String[] nameCoords_={"X","Y","Z","V"}; + // Les d\xE9finitions de coordonn\xE9es par defaut. + private EbliCoordinateDefinition[] defs_=new EbliCoordinateDefinition[]{ + new EbliCoordinateDefinition("X", new EbliFormatter(SI.METER)), + new EbliCoordinateDefinition("Y", new EbliFormatter(SI.METER)), + new EbliCoordinateDefinition("Z", new EbliFormatter(SI.METER)) + }; + public EbliAdapteurSuiviSouris(final JLabel _label) { label_ = _label; } + /** + * @deprecated Use setCoordinates instead. + * @param _format Le format, modifie tous les formats des d\xE9finitions + * coordonn\xE9es. + */ public void format(final EbliFormatterInterface _format){ - fmt_ = _format; + for (EbliCoordinateDefinition def : defs_) { + def.setFormatter(_format); + } updateLabel(); } + /** + * @deprecated Use getCoordinates instead. + * @return Le format retourn\xE9 est celui de la premi\xE8re coordonn\xE9e. + */ public EbliFormatterInterface format(){ - return fmt_; + return defs_[0].getFormatter(); } /** - * Definit le nom des coordonn\xE9es affich\xE9es dans le label. - * @param _names Le nom des coordonn\xE9es. + * Definit les coordonn\xE9es affich\xE9es dans le label. Le tableau doit \xEAtre de + * longueur 2 au minimum. + * @param _defs Les d\xE9finitions pour chaque coordonn\xE9e dans l'ordre. */ - public void setCoordinateNames(String[] _names) { - nameCoords_=_names; + public void setCoordinateDefinitions(EbliCoordinateDefinition[] _defs) { + defs_=_defs; } /** - * @return Le nom des coordonn\xE9es affich\xE9es dans le label. + * Retourne les d\xE9finition des coordonn\xE9es du syst\xE8me de coordonn\xE9es. + * @return Les d\xE9finitions */ - public String[] getCoordinateNames() { - return nameCoords_; + public EbliCoordinateDefinition[] getCoordinateDefinitions() { + return defs_; } double[] oldValues_; @@ -61,22 +81,29 @@ updateLabel(); } + /** + * Affichage des coordonn\xE9es sous la forme X:{x}, Y:{y} ({unit\xE9}) ou + * X:{x} ({unit\xE9}) Y:{y} ({unit\xE9}) si l'unit\xE9 est diff\xE9rente suivant X ou Y. + */ private void updateLabel(){ - // boolean[] d=_evt.defini(); - // boolean[] m=_evt.modifie(); + boolean sameUnit=true; + for (int i=0; i<defs_.length-1; i++) { + sameUnit&=defs_[i].getFormatter().getUnit().equals(defs_[i+1].getFormatter().getUnit()); + } + final StringBuffer r = new StringBuffer(""); if (oldValues_ != null) { for (int i = 0; i < oldValues_.length; i++) { - r.append(" ").append(nameCoords_[Math.min(i,nameCoords_.length-1)]).append(":"); - if (fmt_ == null) { - r.append(oldValues_[i]); - } else { - r.append(fmt_.getXYFormatter().format(oldValues_[i])); + if (defs_.length>i) { + r.append(" ").append(defs_[i].getName()).append(":"); + r.append(defs_[i].getFormatter().getXYFormatter().format(oldValues_[i])); + if (!sameUnit || i==oldValues_.length-1) + r.append(CtuluLibString.ESPACE).append('(').append(defs_[i].getFormatter().getUnit()).append(')'); } + else { + r.append(" ").append(oldValues_[i]); + } } - if (r.length() > 0 && fmt_ != null && fmt_.getUnit() != null) { - r.append(CtuluLibString.ESPACE).append('(').append(fmt_.getUnit()).append(')'); - } } label_.setText(r.toString()); } Added: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/EbliCoordinateDefinition.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/EbliCoordinateDefinition.java (rev 0) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/EbliCoordinateDefinition.java 2011-02-28 15:07:43 UTC (rev 6124) @@ -0,0 +1,50 @@ +package org.fudaa.ebli.calque; + +import org.fudaa.ebli.commun.EbliFormatterInterface; + +/** + * Une definition pour une coordonn\xE9e, c'est \xE0 dire son unit\xE9, son type (entier + * ou double), son nom. + * + * @author mar...@de... + * @version $Id:$ + */ +public class EbliCoordinateDefinition { + String name_; + EbliFormatterInterface fmt_; + + public EbliCoordinateDefinition(String _name, EbliFormatterInterface _fmt) { + name_=_name; + fmt_=_fmt; + } + + /** + * @return Le nom de la coordonn\xE9e. + */ + public String getName() { + return name_; + } + + /** + * @return Le formatteur pour cette coordonn\xE9e. + */ + public EbliFormatterInterface getFormatter() { + return fmt_; + } + + /** + * Definit le formatteur. + * @param _fmt Le formatteur pour l'unit\xE9. + */ + void setFormatter(EbliFormatterInterface _fmt) { + fmt_=_fmt; + } + + /** + * D\xE9finit le nom pour l'unit\xE9. + * @param _name Le nom de l'unit\xE9. + */ + void setName(String _name) { + name_=_name; + } +} Property changes on: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/EbliCoordinateDefinition.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2011-02-28 14:51:14 UTC (rev 6123) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2011-02-28 15:07:43 UTC (rev 6124) @@ -608,6 +608,10 @@ return cqSelectionI_; } + /** + * @deprecated Use getCoordinateDefinitions() instead. + * @return + */ public final EbliFormatterInterface getEbliFormatter() { return suiviSouris_.format(); } @@ -688,23 +692,28 @@ setCalqueInteractionActif(cqSelectionI_); } + /** + * @deprecated Use setCoordinateDefinitions() instead. + * @param _xyFormatter + */ public final void setEbliFormatter(final EbliFormatterInterface _xyFormatter) { suiviSouris_.format(_xyFormatter); } /** - * Definit le nom des coordonn\xE9es affich\xE9es dans la barre de statut. - * @param _names Le nom des coordonn\xE9es. + * Affecte les d\xE9finitions pour les coordonn\xE9es affich\xE9es dans la barre de statut. + * @param _defs Les d\xE9finitions. */ - public void setCoordinateNames(String[] _names) { - suiviSouris_.setCoordinateNames(_names); + public void setCoordinateDefinitions(EbliCoordinateDefinition[] _defs) { + suiviSouris_.setCoordinateDefinitions(_defs); } /** - * @return le nom des coordonn\xE9es affich\xE9es dans la barre de statut. + * Retourne les d\xE9finition des coordonn\xE9es du syst\xE8me de coordonn\xE9es. + * @return Les d\xE9finitions */ - public String[] getCoordinateNames() { - return suiviSouris_.getCoordinateNames(); + public EbliCoordinateDefinition[] getCoordinateDefinitions() { + return suiviSouris_.getCoordinateDefinitions(); } public void setInfoPaletteActive() { Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2011-02-28 14:51:14 UTC (rev 6123) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2011-02-28 15:07:43 UTC (rev 6124) @@ -613,6 +613,10 @@ return gcDonnees_.getCalqueParTitre(_name); } + /** + * @deprecated Use getCoordinateDefinitions() instead. + * @return + */ public final EbliFormatterInterface getEbliFormatter() { return controller_.getEbliFormatter(); } @@ -845,6 +849,10 @@ }; } + /** + * @deprecated Use setCoordinateDefinitions() instead. + * @param _xyFormatter Le format, unique pour chaque coordonn\xE9e. + */ public final void setEbliFormatter(final EbliFormatterInterface _xyFormatter) { controller_.setEbliFormatter(_xyFormatter); } @@ -853,10 +861,18 @@ * Definit le nom des coordonn\xE9es affich\xE9es dans la barre de statut. * @param _names Le nom des coordonn\xE9es. */ - public void setCoordinateNames(String[] _names) { - controller_.setCoordinateNames(_names); + public void setCoordinateDefinitions(EbliCoordinateDefinition[] _names) { + controller_.setCoordinateDefinitions(_names); } + /** + * Retourne le nom des coordonn\xE9es du syst\xE8me de coordonn\xE9es. + * @return Le tableau des noms des coordonn\xE9es. + */ + public EbliCoordinateDefinition[] getCoordinateDefinitions() { + return controller_.getCoordinateDefinitions(); + } + public void setModeText(final String _txt) { if (mode_ != null) { if (CtuluLibString.isEmpty(_txt)) { Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliAtomicCoordinatesTableModel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliAtomicCoordinatesTableModel.java 2011-02-28 14:51:14 UTC (rev 6123) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliAtomicCoordinatesTableModel.java 2011-02-28 15:07:43 UTC (rev 6124) @@ -27,7 +27,7 @@ import org.fudaa.ctulu.gis.GISCoordinateSequence; import org.fudaa.ctulu.gis.GISZoneCollection; import org.fudaa.ctulu.gis.GISZoneCollectionPoint; -import org.fudaa.ebli.commun.EbliFormatterInterface; +import org.fudaa.ebli.calque.EbliCoordinateDefinition; import org.fudaa.ebli.commun.EbliLib; /** @@ -47,9 +47,9 @@ * @param _zone * @param _selectedAtomic */ - public Point(final EbliFormatterInterface _formatter, final GISZoneCollectionPoint _zone, + public Point(final EbliCoordinateDefinition[] _defs, final GISZoneCollectionPoint _zone, final int[] _selectedAtomic, final boolean _useAttribute) { - super(_formatter, _zone, _selectedAtomic); + super(_defs, _zone, _selectedAtomic); g_ = _zone; modeles_ = _useAttribute ? _zone.getModels() : null; } @@ -77,9 +77,9 @@ int idx_; final ZModeleEditable modele_; - public Line(final EbliFormatterInterface _formatter, final GISZoneCollection _zone, final int _idx, + public Line(final EbliCoordinateDefinition[] _defs, final GISZoneCollection _zone, final int _idx, final int[] _selectedAtomic, final boolean _useAttribute, final ZModeleEditable _model) { - super(_formatter, _zone, _selectedAtomic); + super(_defs, _zone, _selectedAtomic); modele_ = _model; idx_ = _idx; if (selectedAtomic_ == null) { @@ -156,12 +156,12 @@ int[] selectedAtomic_; GISZoneCollection zone_; - EbliFormatterInterface xyFormatter_; + EbliCoordinateDefinition[] coordDefs_; - public EbliAtomicCoordinatesTableModel(final EbliFormatterInterface _formatter, final GISZoneCollection _zone, + public EbliAtomicCoordinatesTableModel(final EbliCoordinateDefinition[] _defs, final GISZoneCollection _zone, final int[] _selectedAtomic) { zone_ = _zone; - xyFormatter_ = _formatter; + coordDefs_=_defs; selectedAtomic_ = _selectedAtomic; } @@ -177,9 +177,10 @@ public void updateCellEditor(final JTable _table) { final TableColumnModel cols = _table.getColumnModel(); // xy - final TableCellEditor ed = xyFormatter_.createTableEditorComponent(); - cols.getColumn(1).setCellEditor(ed); - cols.getColumn(2).setCellEditor(ed); + TableCellEditor edx = coordDefs_[0].getFormatter().createTableEditorComponent(); + TableCellEditor edy = coordDefs_[1].getFormatter().createTableEditorComponent(); + cols.getColumn(1).setCellEditor(edx); + cols.getColumn(2).setCellEditor(edy); // les attribut if (modeles_ != null) { for (int i = 0; i < modeles_.length; i++) { @@ -261,9 +262,9 @@ case 0: return EbliLib.getS("Index"); case 1: - return "X"; + return coordDefs_[0].getName(); case 2: - return "Y"; + return coordDefs_[1].getName(); default: } final int idx = _columnIndex - 3; @@ -286,9 +287,9 @@ case 0: return CtuluLibString.getString(realIdx + 1); case 1: - return xyFormatter_.getXYFormatter().format(getX(realIdx)); + return coordDefs_[0].getFormatter().getXYFormatter().format(getX(realIdx)); case 2: - return xyFormatter_.getXYFormatter().format(getY(realIdx)); + return coordDefs_[1].getFormatter().getXYFormatter().format(getY(realIdx)); default: } final int idx = _columnIndex - 3; Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliAtomicsEditorPanel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliAtomicsEditorPanel.java 2011-02-28 14:51:14 UTC (rev 6123) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliAtomicsEditorPanel.java 2011-02-28 15:07:43 UTC (rev 6124) @@ -18,7 +18,7 @@ import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.table.CtuluTable; -import org.fudaa.ebli.commun.EbliFormatterInterface; +import org.fudaa.ebli.calque.EbliCoordinateDefinition; /** @@ -42,9 +42,9 @@ * @param _cmd la commande * */ - public EbliAtomicsEditorPanel(final int _idx, final int[] _vertex, final EbliFormatterInterface _xyFormatter, + public EbliAtomicsEditorPanel(final int _idx, final int[] _vertex, final EbliCoordinateDefinition[] _defs, final ZModeleEditable _modele, final boolean _editVertex, final CtuluCommandManager _cmd) { - this(new EbliAtomicCoordinatesTableModel.Line(_xyFormatter, _modele.getGeomData(), _idx, _vertex, _editVertex, + this(new EbliAtomicCoordinatesTableModel.Line(_defs, _modele.getGeomData(), _idx, _vertex, _editVertex, _modele), _cmd); } Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsEditorPanel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsEditorPanel.java 2011-02-28 14:51:14 UTC (rev 6123) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsEditorPanel.java 2011-02-28 15:07:43 UTC (rev 6124) @@ -8,10 +8,10 @@ import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.table.CtuluTable; -import org.fudaa.ebli.commun.EbliFormatterInterface; import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuScrollPane; +import org.fudaa.ebli.calque.EbliCoordinateDefinition; @SuppressWarnings("serial") public class EbliSegmentsEditorPanel extends CtuluDialogPanel @@ -20,9 +20,9 @@ final EbliSegmentsTableModel tableModel_; final JTable table_; - public EbliSegmentsEditorPanel(final int _idx, final int[] _segments, final EbliFormatterInterface _xyFormatter, + public EbliSegmentsEditorPanel(final int _idx, final int[] _segments, final EbliCoordinateDefinition[] _defs, final ZModeleLigneBriseeEditable _modele, final boolean _editSegment, final CtuluCommandManager _cmd) { - this(new EbliSegmentsTableModel(_xyFormatter, _modele.getGeomData(), _modele, _idx, _segments, _editSegment), _cmd); + this(new EbliSegmentsTableModel(_defs, _modele.getGeomData(), _modele, _idx, _segments, _editSegment), _cmd); } public EbliSegmentsEditorPanel(final EbliSegmentsTableModel _model, final CtuluCommandManager _cmd) { Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsTableModel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsTableModel.java 2011-02-28 14:51:14 UTC (rev 6123) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSegmentsTableModel.java 2011-02-28 15:07:43 UTC (rev 6124) @@ -19,11 +19,11 @@ import org.fudaa.ctulu.gis.GISAttributeModel; import org.fudaa.ctulu.gis.GISCoordinateSequence; import org.fudaa.ctulu.gis.GISZoneCollection; -import org.fudaa.ebli.commun.EbliFormatterInterface; import org.fudaa.ebli.commun.EbliLib; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.CoordinateSequence; +import org.fudaa.ebli.calque.EbliCoordinateDefinition; @SuppressWarnings("serial") public class EbliSegmentsTableModel extends AbstractTableModel @@ -85,7 +85,8 @@ final int idx; final GISZoneCollection zone; - final EbliFormatterInterface formatter; +// final EbliFormatterInterface formatter; + final EbliCoordinateDefinition[] coordDefs; final GISAttributeModel[] modeles; final ZModeleLigneBriseeEditable modele; TIntObjectHashMap<Coordinate> newCoordinates; @@ -95,13 +96,13 @@ final int[] segments; final HashMap<Cell, Cell> cellsLinked = new HashMap<Cell, Cell>(); - public EbliSegmentsTableModel(final EbliFormatterInterface formatter, final GISZoneCollection zone, ZModeleLigneBriseeEditable modele, int idx, int[] segments, boolean useAttribute) + public EbliSegmentsTableModel(final EbliCoordinateDefinition[] _defs, final GISZoneCollection zone, ZModeleLigneBriseeEditable modele, int idx, int[] segments, boolean useAttribute) { Arrays.sort(segments); this.idx = idx; this.segments = segments; - this.formatter = formatter; + this.coordDefs = _defs; this.zone = zone; this.modele = modele; this.modeles = useAttribute ? zone.getAtomicAttributeSubModel(idx) : null; @@ -187,12 +188,12 @@ case V1_X_COLUMN : case V2_X_COLUMN : { - return this.formatter.getXYFormatter().format(this.getX(vertexIdx)); + return this.coordDefs[0].getFormatter().getXYFormatter().format(this.getX(vertexIdx)); } case V1_Y_COLUMN : case V2_Y_COLUMN : { - return this.formatter.getXYFormatter().format(this.getY(vertexIdx)); + return this.coordDefs[1].getFormatter().getXYFormatter().format(this.getY(vertexIdx)); } } return null; @@ -207,19 +208,19 @@ } case V1_X_COLUMN : { - return "X1"; + return coordDefs[0].getName()+"1"; } case V1_Y_COLUMN : { - return "Y1"; + return coordDefs[1].getName()+"1"; } case V2_X_COLUMN : { - return "X2"; + return coordDefs[0].getName()+"2"; } case V2_Y_COLUMN : { - return "Y2"; + return coordDefs[1].getName()+"2"; } } final int idx = _columnIndex - MIN_NB_COLUMN; @@ -246,11 +247,12 @@ public void updateCellEditor(final JTable _table) { final TableColumnModel cols = _table.getColumnModel(); // xy - final TableCellEditor ed = formatter.createTableEditorComponent(); - cols.getColumn(V1_X_COLUMN).setCellEditor(ed); - cols.getColumn(V1_Y_COLUMN).setCellEditor(ed); - cols.getColumn(V2_X_COLUMN).setCellEditor(ed); - cols.getColumn(V2_Y_COLUMN).setCellEditor(ed); + final TableCellEditor edx = coordDefs[0].getFormatter().createTableEditorComponent(); + final TableCellEditor edy = coordDefs[1].getFormatter().createTableEditorComponent(); + cols.getColumn(V1_X_COLUMN).setCellEditor(edx); + cols.getColumn(V1_Y_COLUMN).setCellEditor(edy); + cols.getColumn(V2_X_COLUMN).setCellEditor(edx); + cols.getColumn(V2_Y_COLUMN).setCellEditor(edy); // les attribut if (modeles != null) { for (int i = 0; i < modeles.length; i++) { Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleGeomVisuPanel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleGeomVisuPanel.java 2011-02-28 14:51:14 UTC (rev 6123) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleGeomVisuPanel.java 2011-02-28 15:07:43 UTC (rev 6124) @@ -18,7 +18,7 @@ import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.table.CtuluTable; import org.fudaa.ctulu.table.CtuluTableColumnHeader; -import org.fudaa.ebli.commun.EbliFormatterInterface; +import org.fudaa.ebli.calque.EbliCoordinateDefinition; /** * @author Fred Deniger @@ -27,7 +27,7 @@ public class EbliSingleGeomVisuPanel extends CtuluDialogPanel { public EbliSingleGeomVisuPanel(final GISZoneCollection _zone, final int _idx, final int[] _idxVertex, - final EbliFormatterInterface _xyFormatter) { + final EbliCoordinateDefinition[] _defs) { final int idx; // TObjectIntHashMap intAttr_; final EbliAtomicCoordinatesTableModel model; @@ -43,18 +43,18 @@ setLayout(new BuGridLayout(2, 5, 5)); final Coordinate coord = g.getCoordinate(); final BuLabel x = new BuLabel(); - x.setText(_xyFormatter.getXYFormatter().format(coord.x)); + x.setText(_defs[0].getFormatter().getXYFormatter().format(coord.x)); final BuLabel y = new BuLabel(); - y.setText(_xyFormatter.getXYFormatter().format(coord.y)); - addLabel("X:"); + y.setText(_defs[1].getFormatter().getXYFormatter().format(coord.y)); + addLabel(_defs[0].getName()+":"); add(x); - addLabel("Y:"); + addLabel(_defs[1].getName()+":"); add(y); } else { setLayout(new BuBorderLayout()); table = new CtuluTable(); - model = new EbliAtomicCoordinatesTableModel.Line(_xyFormatter, zone, idx, _idxVertex, true, null) { + model = new EbliAtomicCoordinatesTableModel.Line(_defs, zone, idx, _idxVertex, true, null) { public boolean isCellEditable(final int _rowIndex, final int _columnIndex) { return false; Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java 2011-02-28 14:51:14 UTC (rev 6123) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/EbliSingleObjectEditorPanel.java 2011-02-28 15:07:43 UTC (rev 6124) @@ -34,7 +34,7 @@ import org.fudaa.ctulu.gis.GISZoneCollection; import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.table.CtuluTable; -import org.fudaa.ebli.commun.EbliFormatterInterface; +import org.fudaa.ebli.calque.EbliCoordinateDefinition; /** * Un panneau d'\xE9dition d'un objet GIS unique contenu dans un calque editable {@link ZCalqueEditable}. Ce panneau permet l'edition @@ -70,7 +70,7 @@ JComponent tfY_; - final EbliFormatterInterface xyFormatter_; + final EbliCoordinateDefinition[] coordDefs_; final GISZoneCollection zone_; @@ -81,12 +81,12 @@ * @param _xyFormatter */ public EbliSingleObjectEditorPanel(final ZModeleEditable _zone, final int _idx, final boolean _editAttribut, - final boolean _editVertexAttribut, final EbliFormatterInterface _xyFormatter) { + final boolean _editVertexAttribut, final EbliCoordinateDefinition[] _defs) { super(); idx_ = _idx; zone_ = _zone.getGeomData(); modeleSrc_ = _zone; - xyFormatter_ = _xyFormatter; + coordDefs_=_defs; final Geometry g = zone_.getGeometry(idx_); // // le nombre de points contenu: si un on se doute que c'est un point ! // final int nbPt = g.getNumPoints(); @@ -138,30 +138,30 @@ pn.setLayout(new BuGridLayout(2, 5, 5)); final Coordinate coord = g.getCoordinate(); if (zone_.isGeomModifiable()) { - tfX_ = xyFormatter_.createEditorComponent(); - tfY_ = xyFormatter_.createEditorComponent(); + tfX_ = coordDefs_[0].getFormatter().createEditorComponent(); + tfY_ = coordDefs_[1].getFormatter().createEditorComponent(); if (FuLog.isTrace()) { FuLog.trace("FTR: set value for x,y"); } - xyFormatter_.setValue(CtuluLib.getDouble(coord.x), tfX_); - xyFormatter_.setValue(CtuluLib.getDouble(coord.y), tfY_); + coordDefs_[0].getFormatter().setValue(CtuluLib.getDouble(coord.x), tfX_); + coordDefs_[1].getFormatter().setValue(CtuluLib.getDouble(coord.y), tfY_); } else { final BuLabel x = new BuLabel(); - x.setText(xyFormatter_.getXYFormatter().format(coord.x)); + x.setText(coordDefs_[0].getFormatter().getXYFormatter().format(coord.x)); final BuLabel y = new BuLabel(); - y.setText(xyFormatter_.getXYFormatter().format(coord.y)); + y.setText(coordDefs_[1].getFormatter().getXYFormatter().format(coord.y)); tfX_ = x; tfY_ = y; } - addLabel(pn, "X:"); + addLabel(pn, coordDefs_[0].getName()+":"); pn.add(tfX_); - addLabel(pn, "Y:"); + addLabel(pn, coordDefs_[1].getName()+":"); pn.add(tfY_); } else { pn.setLayout(new BuBorderLayout()); table_ = new CtuluTable(); - model_ = new EbliAtomicCoordinatesTableModel.Line(_xyFormatter, _zone.getGeomData(), idx_, null, + model_ = new EbliAtomicCoordinatesTableModel.Line(_defs, _zone.getGeomData(), idx_, null, _editVertexAttribut, modeleSrc_); table_.setModel(model_); model_.updateCellEditor(table_); @@ -180,11 +180,11 @@ if (zone_.isGeomModifiable()) { Double newX = null; Double newY = null; - if (!xyFormatter_.isEmpty(tfX_)) { - newX = (Double) xyFormatter_.getValue(tfX_); + if (!coordDefs_[0].getFormatter().isEmpty(tfX_)) { + newX = (Double) coordDefs_[0].getFormatter().getValue(tfX_); } - if (!xyFormatter_.isEmpty(tfY_)) { - newY = (Double) xyFormatter_.getValue(tfY_); + if (!coordDefs_[1].getFormatter().isEmpty(tfY_)) { + newY = (Double) coordDefs_[1].getFormatter().getValue(tfY_); } if (newX != null && newY != null) { return new GISCoordinateSequenceUnique(newX.doubleValue(), Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorDefault.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2011-02-28 14:51:14 UTC (rev 6123) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2011-02-28 15:07:43 UTC (rev 6124) @@ -38,6 +38,7 @@ import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ebli.calque.BCalque; +import org.fudaa.ebli.calque.EbliCoordinateDefinition; import org.fudaa.ebli.calque.ZCalqueAffichageDonnees; import org.fudaa.ebli.calque.ZCalqueClickInteraction; import org.fudaa.ebli.calque.ZCalqueClikInteractionListener; @@ -523,10 +524,17 @@ return CtuluLibSwing.getFrameAncestorHelper(getUi().getParentComponent()); } + /** + * @deprecated Use getCoordinateDefinitions() instead. + */ public EbliFormatterInterface getXYFormatter() { return panel_.getEbliFormatter(); } + public EbliCoordinateDefinition[] getCoordinateDefinitions() { + return panel_.getCoordinateDefinitions(); + } + /** * @param _com la commande * @return true si est une commande de dessin (point, poly, rectangle,...) @@ -774,7 +782,7 @@ final int idxSelected = ((ZCalqueAffichageDonnees) _target).getLayerSelection().getMaxIndex(); final boolean editAttribute = true; final EbliSingleObjectEditorPanel ed = new EbliSingleObjectEditorPanel(_target.getModelEditable(), idxSelected, - true, editAttribute, getXYFormatter()); + true, editAttribute, getCoordinateDefinitions()); ed.setCmd(getMng()); ed.afficheModale(getFrame(), _target.getTitle()); @@ -788,7 +796,7 @@ final int idx = it.key(); final int[] vertex = ((CtuluListSelectionInterface) it.value()).getSelectedIndex(); final boolean editAttribute = true; - final EbliAtomicsEditorPanel ed = new EbliAtomicsEditorPanel(idx, vertex, getXYFormatter(), _target + final EbliAtomicsEditorPanel ed = new EbliAtomicsEditorPanel(idx, vertex, getCoordinateDefinitions(), _target .getModelEditable(), editAttribute, getMng()); ed.afficheModale(getFrame(), _target.getTitle()); } @@ -807,7 +815,7 @@ final int[] segments = ((CtuluListSelectionInterface) it.value()).getSelectedIndex(); final boolean editAttribute = true; - final EbliSegmentsEditorPanel ed = new EbliSegmentsEditorPanel(idx, segments, getXYFormatter(), (ZModeleLigneBriseeEditable)_target + final EbliSegmentsEditorPanel ed = new EbliSegmentsEditorPanel(idx, segments, getCoordinateDefinitions(), (ZModeleLigneBriseeEditable)_target .getModelEditable(), editAttribute, getMng()); ed.afficheModale(getFrame(), _target.getTitle()); } @@ -835,7 +843,7 @@ } if (idxGeom < 0) { return; } final EbliSingleGeomVisuPanel ed = new EbliSingleGeomVisuPanel(((ZModeleGeom) cqDonnees.modeleDonnees()) - .getGeomData(), idxGeom, idxVertex, getXYFormatter()); + .getGeomData(), idxGeom, idxVertex, getCoordinateDefinitions()); ed.afficheModale(getFrame(), cqDonnees.getTitle()); } Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorLigneBriseePanel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorLigneBriseePanel.java 2011-02-28 14:51:14 UTC (rev 6123) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZEditorLigneBriseePanel.java 2011-02-28 15:07:43 UTC (rev 6124) @@ -24,7 +24,6 @@ import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.gis.GISAttributeInterface; import org.fudaa.ebli.calque.dessin.DeForme; -import org.fudaa.ebli.commun.EbliFormatterInterface; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.geometrie.GrPolyligne; @@ -40,8 +39,9 @@ import com.memoire.bu.BuVerticalLayout; import com.memoire.fu.Fu; import com.memoire.fu.FuLog; +import org.fudaa.ctulu.CtuluNumberFormatI; import org.fudaa.ctulu.editor.CtuluValueEditorI; -import org.fudaa.ebli.commun.EbliFormatter; +import org.fudaa.ebli.calque.EbliCoordinateDefinition; /** * Un panneau d'\xE9dition d'une ligne bris\xE9e qui s'affiche lorsque l'outil ligne bris\xE9e est s\xE9lectionn\xE9. @@ -94,10 +94,10 @@ return CtuluLibString.ESPACE; } if (_column == 1) { - return "X"; + return coordDefs_==null?"X":coordDefs_[0].getName(); } if (_column == 2) { - return "Y"; + return coordDefs_==null?"Y":coordDefs_[1].getName(); } final int idxFeature = _column - 3; if (atomicAttr_ != null) { @@ -135,15 +135,17 @@ } if (o != null) { if (_columnIndex == 1) { + CtuluNumberFormatI fmt=(coordDefs_==null?null:coordDefs_[0].getFormatter().getXYFormatter()); if (init == null) { - return formatter_.getXYFormatter().format(o.sommets_.renvoieX(_rowIndex)); + return fmt==null?String.valueOf(o.sommets_.renvoieX(_rowIndex)):fmt.format(o.sommets_.renvoieX(_rowIndex)); } - formatter_.getXYFormatter().format(init.x_); + fmt.format(init.x_); } else if (_columnIndex == 2) { + CtuluNumberFormatI fmt=(coordDefs_==null?null:coordDefs_[1].getFormatter().getXYFormatter()); if (init == null) { - return formatter_.getXYFormatter().format(o.sommets_.renvoieY(_rowIndex)); + return fmt==null?String.valueOf(o.sommets_.renvoieY(_rowIndex)):fmt.format(o.sommets_.renvoieY(_rowIndex)); } - formatter_.getXYFormatter().format(init.y_); + fmt.format(init.y_); } else if (atomicAttr_ != null) { final int featureIdx = _columnIndex - 3; if (featureIdx >= 0 && attributes_ != null && attributes_.length > 0) { @@ -211,8 +213,6 @@ /** Type de g\xE9ometrie a \xE9diter */ int typeForme_; - EbliFormatterInterface formatter_=new EbliFormatter(); - // String initState_; BPaletteEdition palette_; @@ -220,16 +220,19 @@ protected GISAttributeInterface[] attributes_; protected JComponent[] editorComps_; + /** Le nom des coordonn\xE9es */ + protected EbliCoordinateDefinition[] coordDefs_; /** - * Constructeur sans editeur par defaut + * Constructeur depuis l'editeur. */ public ZEditorLigneBriseePanel(final ZEditorDefault _editor) { this(_editor.palette_, _editor.dessin_); targetChanged(_editor.getTarget()); - formatter_ = _editor.getXYFormatter(); + coordDefs_=_editor.getPanel().getCoordinateDefinitions(); } /** + * Constructeur sans editeur par defaut. * @param _editor l'editeur parent * @param _typeForme Le type de g\xE9om\xE9trie a \xE9diter. */ @@ -451,6 +454,10 @@ atomicChanged(); } + public void setCoordinateDefinitions(EbliCoordinateDefinition[] _defs) { + coordDefs_=_defs; + } + public void targetChanged(final ZCalqueEditable _new) { GISAttributeInterface[] newAtt = null; if (_new != null && _new.getModelEditable() != null && _new.getModelEditable().getGeomData() != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2011-04-06 14:11:47
|
Revision: 6208 http://fudaa.svn.sourceforge.net/fudaa/?rev=6208&view=rev Author: bmarchan Date: 2011-04-06 14:11:41 +0000 (Wed, 06 Apr 2011) Log Message: ----------- Fix : Correction mode accrochage sur sommets. Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesInterface.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZScene.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2011-04-06 08:36:36 UTC (rev 6207) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2011-04-06 14:11:41 UTC (rev 6208) @@ -306,7 +306,7 @@ return null; } - public EbliListeSelectionMultiInterface selectionMulti(GrPoint _ptReel, int _tolerancePixel, boolean _inDepth) { + public EbliListeSelectionMultiInterface selectVertices(GrPoint _ptReel, int _tolerancePixel, boolean _inDepth) { return null; } Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesInterface.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesInterface.java 2011-04-06 08:36:36 UTC (rev 6207) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesInterface.java 2011-04-06 14:11:41 UTC (rev 6208) @@ -146,7 +146,7 @@ * points suceptibles d'etre selectionn\xE9s. * @return Les indices des sous objets selectionn\xE9s, ou null si aucune selection. */ - EbliListeSelectionMultiInterface selectionMulti(GrPoint _ptReel, int _tolerancePixel, boolean _inDepth); + EbliListeSelectionMultiInterface selectVertices(GrPoint _ptReel, int _tolerancePixel, boolean _inDepth); /** * @return la ligne repr\xE9sentant la s\xE9lection courant. null si s\xE9lection non adequate Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2011-04-06 08:36:36 UTC (rev 6207) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2011-04-06 14:11:41 UTC (rev 6208) @@ -170,7 +170,7 @@ if (!isSelectable()) return false; if (this.mode!=SelectionMode.NORMAL) { - final EbliListeSelectionMulti l = selectionMulti(_pt, _tolerancePixel, false); + final EbliListeSelectionMulti l = selectionMulti(_pt, _tolerancePixel, false, this.mode); changeSelectionMulti(l, _action); if ((l == null) || (l.isEmpty())) { return false; @@ -957,7 +957,19 @@ return r; } - public EbliListeSelectionMulti selectionMulti(final GrPoint _ptReel, final int _tolerancePixel, boolean _inDepth) { + @Override + public EbliListeSelectionMulti selectVertices(final GrPoint _ptReel, final int _tolerancePixel, boolean _inDepth) { + return selectionMulti(_ptReel, _tolerancePixel, _inDepth, SelectionMode.ATOMIC); + } + + /** + * @param _ptReel + * @param _tolerancePixel + * @param _inDepth False : Seul le premier point trouv\xE9 est retourn\xE9. Sinon, continue avec les points dessous. + * @param _mode Le mode de selection, sur sommets ou segments. + * @return La liste de selection. + */ + public EbliListeSelectionMulti selectionMulti(final GrPoint _ptReel, final int _tolerancePixel, boolean _inDepth, SelectionMode _mode) { final GrMorphisme versReel = getVersReel(); GrBoite bClip = getDomaine(); if (bClip == null || (!bClip.contientXY(_ptReel)) && (bClip.distanceXY(_ptReel) > _tolerancePixel)) { @@ -974,7 +986,7 @@ modele_.getDomaineForGeometry(i, btLigne); if (btLigne.contientXY(_ptReel) || btLigne.distanceXY(_ptReel) < distanceReel) { - if (this.mode==SelectionMode.ATOMIC) { + if (_mode==SelectionMode.ATOMIC) { for (int j=modele_.getNbPointForGeometry(i)-1; j>=0; j--) { modele_.point(p, i, j); if (bClip.contientXY(p)&&(p.distanceXY(_ptReel)<distanceReel)) { @@ -1120,6 +1132,7 @@ return false; } + @Override public boolean setSelection(final int[] _idx) { if (!isSelectable()) return false; @@ -1132,6 +1145,7 @@ return false; } + @Override public boolean changeSelection(EbliListeSelectionMultiInterface _selection, int _action) { if (!isSelectable()) return false; @@ -1144,6 +1158,7 @@ } } + @Override public boolean selectNext() { if (this.mode==SelectionMode.NORMAL) { return super.selectNext(); @@ -1169,6 +1184,7 @@ } } + @Override public boolean selectPrevious() { if (this.mode==SelectionMode.NORMAL) { return super.selectPrevious(); Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZScene.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZScene.java 2011-04-06 08:36:36 UTC (rev 6207) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZScene.java 2011-04-06 14:11:41 UTC (rev 6208) @@ -565,7 +565,7 @@ public ZSceneSelection selection(final GrPoint _pt, final int _tolerance) { selTmp_.clear(); for (ZCalqueAffichageDonneesInterface cq : getTargetLayers()) { - EbliListeSelectionMulti sel=(EbliListeSelectionMulti)cq.selectionMulti(_pt, _tolerance, true); + EbliListeSelectionMulti sel=(EbliListeSelectionMulti)cq.selectVertices(_pt, _tolerance, true); if (sel!=null) selTmp_.addLayerListSelectionMulti(cq,sel); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2011-10-24 13:34:56
|
Revision: 6574 http://fudaa.svn.sourceforge.net/fudaa/?rev=6574&view=rev Author: bmarchan Date: 2011-10-24 13:34:49 +0000 (Mon, 24 Oct 2011) Log Message: ----------- Fix : Tracebacks sur BCalquePaletteInfo Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalquePaletteInfo.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonnees.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalquePaletteInfo.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalquePaletteInfo.java 2011-10-24 08:04:20 UTC (rev 6573) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalquePaletteInfo.java 2011-10-24 13:34:49 UTC (rev 6574) @@ -92,7 +92,7 @@ if(calque != calqueSelected_) if (calque.modeleDonnees() instanceof ZModeleGeometry) ((ZModeleGeometry)calque.modeleDonnees()).removeModelListener(this); - else + else if (calque.modeleDonnees() instanceof ZModeleDonnesAbstract) ((ZModeleDonnesAbstract)calque.modeleDonnees()).removeModelListener(this); // Nombre de calques ayant des selections (atomiques ou globales) calqueWithGeometriesSelected_.clear(); Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonnees.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonnees.java 2011-10-24 08:04:20 UTC (rev 6573) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonnees.java 2011-10-24 13:34:49 UTC (rev 6574) @@ -17,7 +17,6 @@ import org.fudaa.ebli.find.EbliFindExpressionContainerInterface; import org.fudaa.ebli.geometrie.GrPoint; -import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.LinearRing; /** @@ -43,6 +42,7 @@ return new CalqueFindActionDefault(this); } + @Override public int[] getSelectedObjectInTable() { return getSelectedIndex(); } @@ -174,6 +174,7 @@ } } + @Override public CtuluListSelectionInterface getLayerSelection() { return selection_; } @@ -207,6 +208,7 @@ /** * @return true si un seul objet est selectionne */ + @Override public boolean isOnlyOneObjectSelected() { return selection_ != null && selection_.isOnlyOnIndexSelected(); } @@ -299,11 +301,4 @@ if (idx<=0) return false; return setSelection(new int[]{idx-1}); } - - public void geometryAction(Object _source, int _idx, Geometry _geom, int _action) { - // Une g\xE9om\xE9trie a \xE9t\xE9 ajout\xE9e, supprim\xE9e ou ses points la composant ont \xE9t\xE9 - // modifi\xE9s, donc on repaint le tout. - repaint(); - } - } \ No newline at end of file Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2011-10-24 08:04:20 UTC (rev 6573) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2011-10-24 13:34:49 UTC (rev 6574) @@ -17,6 +17,7 @@ import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.CtuluRange; +import org.fudaa.ebli.calque.edition.ZModeleEditable; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.commun.EbliListeSelectionMultiInterface; import org.fudaa.ebli.commun.EbliTableInfoPanel; @@ -120,6 +121,8 @@ } public boolean isEditable() { + // B.M. : Bizarre, on pourrait penser que le caractere editable ou non n'est + // pas lie au nombre de geometries dans le modele... return modeleDonnees() != null && modeleDonnees().getNombre() > 0; } Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2011-10-24 08:04:20 UTC (rev 6573) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2011-10-24 13:34:49 UTC (rev 6574) @@ -49,6 +49,7 @@ import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.CoordinateSequence; import com.vividsolutions.jts.geom.Envelope; +import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.LineString; import com.vividsolutions.jts.geom.LinearRing; @@ -1312,4 +1313,15 @@ repaint(); } + public void geometryAction(Object _source, int _idx, Geometry _geom, int _action) { + // Si une g\xE9om\xE9trie a \xE9t\xE9 supprim\xE9e, on r\xE9initialise la s\xE9lection pour eviter + // les effets de bord. + if (_action==ZModelListener.GEOMETRY_ACTION_REMOVE) + clearSelection(); + + // Une g\xE9om\xE9trie a \xE9t\xE9 ajout\xE9e, supprim\xE9e ou ses points la composant ont \xE9t\xE9 + // modifi\xE9s, donc on repaint le tout. + repaint(); + } + } Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java 2011-10-24 08:04:20 UTC (rev 6573) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZModeleLigneBriseeDefault.java 2011-10-24 13:34:49 UTC (rev 6574) @@ -101,6 +101,7 @@ return 4 + att_.length; } + @Override public Class getColumnClass(final int _columnIndex) { if (_columnIndex <= 1) { return Integer.class; @@ -111,6 +112,7 @@ return Double.class; } + @Override public String getColumnName(final int _column) { switch (_column) { case 0: @@ -193,6 +195,7 @@ return (fermeOuvert_ ? 4 : 3) + att_.length; } + @Override public String getColumnName(final int _column) { switch (_column) { case 0: @@ -255,6 +258,7 @@ return geometries_ == null ? false : getGeomData().containsPolygone(); } + @Override public BuTable createValuesTable(final ZCalqueAffichageDonneesInterface _layer) { final BuTable r = new CtuluTable(); //TODO Voir si l'action se fait qu'en mode atomique (comme mnt) ou dans tout mode diff\xE9rent du mode normal. @@ -275,6 +279,7 @@ return geometries_.getNbAttributes(); } + @Override public void fillWithInfo(final InfoData _d, final ZCalqueAffichageDonneesInterface _layer) { // Selection vide : information sur le calque if (_layer.isSelectionEmpty()) @@ -327,7 +332,7 @@ super.fillWithInfo(_d, _layer); if (nb==1) { final int idxPoly=layer.getLayerSelection().getMaxIndex(); - if (_layer.isEditable()&&((ZCalqueEditable)_layer).canAddForme(DeForme.LIGNE_BRISEE)&&((ZCalqueEditable)_layer).canAddForme(DeForme.POLYGONE)) + if ((_layer instanceof ZCalqueEditable)&&((ZCalqueEditable)_layer).canAddForme(DeForme.LIGNE_BRISEE)&&((ZCalqueEditable)_layer).canAddForme(DeForme.POLYGONE)) _d.put(CtuluLib.getS("Ferm\xE9"), isGeometryFermee(idxPoly) ? CtuluLib.getS("vrai"):CtuluLib.getS("faux"), new CtuluValueEditorChoice(new String[]{CtuluLib.getS("vrai"), CtuluLib.getS("faux")}, null), null, this, new int[]{idxPoly}); @@ -351,7 +356,7 @@ value=isGeometryFermee(selectedIdx[0]) ? CtuluLib.getS("vrai"):CtuluLib.getS("faux"); else value=null; - if (_layer.isEditable()&&((ZCalqueEditable)_layer).canAddForme(DeForme.LIGNE_BRISEE)&&((ZCalqueEditable)_layer).canAddForme(DeForme.POLYGONE)) + if ((_layer instanceof ZCalqueEditable)&&((ZCalqueEditable)_layer).canAddForme(DeForme.LIGNE_BRISEE)&&((ZCalqueEditable)_layer).canAddForme(DeForme.POLYGONE)) _d.put(CtuluLib.getS("Ferm\xE9"), value, new CtuluValueEditorChoice(new String[]{CtuluLib.getS("vrai"), CtuluLib.getS("faux")}, null), null, this, selectedIdx); else @@ -374,19 +379,20 @@ /* (non-Javadoc) * @see org.fudaa.ebli.palette.BPaletteInfo.ModifyPropertyInfo#modifyProperty(java.lang.String, java.lang.Object) */ + @Override public void modifyProperty(String _key, Object _value, final int[] _index, CtuluCommandContainer _cmd) { CtuluCommandComposite cmd=new CtuluCommandComposite(); super.modifyProperty(_key, _value, _index, cmd); - if (_index!=null&&_value!=null&&_key==CtuluLib.getS("Ferm\xE9")) { + if (_index!=null&&_value!=null&&CtuluLib.getS("Ferm\xE9").equals(_key)) { // Modification de la propri\xE9t\xE9 int[] indexPolylines=_index; for (int i=0; i<indexPolylines.length; i++) { int indexPolyligne=indexPolylines[i]; // Cr\xE9ation de la nouvelle g\xE9om\xE9trie Geometry newGeom=null; - if (_value==CtuluLib.getS("vrai")) + if (CtuluLib.getS("vrai").equals(_value)) newGeom=GISLib.toPolygone(((GISCoordinateSequenceContainerInterface)geometries_.getGeometry(indexPolyligne)).getCoordinateSequence()); - else if (_value==CtuluLib.getS("faux")) + else if (CtuluLib.getS("faux").equals(_value)) newGeom=GISLib.toPolyligne(((GISCoordinateSequenceContainerInterface)geometries_.getGeometry(indexPolyligne)).getCoordinateSequence()); else FuLog.error("ZModeleLigneBriseeDefault.modifyProperty : la valeur pour la propri\xE9t\xE9 'ferm\xE9' est inconnue donc intraitable."); @@ -399,6 +405,7 @@ } + @Override public final GISZoneCollectionLigneBrisee getGeomData() { return (GISZoneCollectionLigneBrisee)geometries_; } @@ -407,6 +414,7 @@ return getNombre()-getNbPolygone(); } + @Override public final int getNbPointForGeometry(final int _idxLigne) { if (geometries_ == null) { return 0; @@ -434,6 +442,7 @@ return false; } + @Override public boolean isValuesTableAvailable() { return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2012-05-23 21:51:55
|
Revision: 7228 http://fudaa.svn.sourceforge.net/fudaa/?rev=7228&view=rev Author: deniger Date: 2012-05-23 21:51:48 +0000 (Wed, 23 May 2012) Log Message: ----------- prise en compte du nouveau coeur Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePoint.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZModeleGeometryDefault.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2012-05-23 12:24:03 UTC (rev 7227) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2012-05-23 21:51:48 UTC (rev 7228) @@ -581,6 +581,8 @@ // Enfin les labels sur les atomiques. paintLabelsOnAtomics(_g, _versEcran, _versReel, _clipReel); } + + protected void paintSurfaces(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, final GrBoite _clipReel) { Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePoint.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePoint.java 2012-05-23 12:24:03 UTC (rev 7227) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePoint.java 2012-05-23 21:51:48 UTC (rev 7228) @@ -1,9 +1,6 @@ /** - * @creation 2000-11-09 - * @modification $Date: 2008-02-20 10:16:01 $ - * @license GNU General Public License 2 - * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne - * @mail de...@fu... + * @creation 2000-11-09 @modification $Date: 2008-02-20 10:16:01 $ @license GNU General Public License 2 @copyright (c)1998-2001 + * CETMEF 2 bd Gambetta F-60231 Compiegne @mail de...@fu... */ package org.fudaa.ebli.calque; @@ -35,7 +32,7 @@ /** * Un calque d'affichage de point avec un icone. - * + * * @version $Id: ZCalquePoint.java,v 1.51.6.1 2008-02-20 10:16:01 bmarchan Exp $ * @author Guillaume Desnoix */ @@ -91,11 +88,9 @@ } } - public void fillWithInterpolateInfo(final InfoData _m) { - } - + /** * @author Fred Deniger * @version $Id: ZCalquePoint.java,v 1.51.6.1 2008-02-20 10:16:01 bmarchan Exp $ @@ -126,12 +121,11 @@ } return super.getValueAt(_rowIndex, _columnIndex); } - } - protected ZModelePoint modele_; - /** */ + /** + * */ public ZCalquePoint() { this(null); } @@ -237,7 +231,6 @@ public ZModeleDonnees modeleDonnees() { return modele(); } - GrPoint p_; public void setForeground(final Color _v) { @@ -248,7 +241,7 @@ } public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { + final GrBoite _clipReel) { if ((modele_ != null) && (modele_.getNombre() > 0)) { paintDonnees(_g, modele_.getNombre(), _versEcran, _clipReel); } @@ -291,10 +284,14 @@ icone.setCouleur(c); } icone.paintIconCentre(this, _g, (int) p_.x_, (int) p_.y_); + paintLabels(_g, i, p_); } } + protected void paintLabels(final Graphics2D g2d, int idx, GrPoint pEcran) { + } + protected TraceIcon getTraceIcon() { final TraceIcon icone = iconModel_.buildCopy(); return icone; @@ -305,10 +302,8 @@ return null; } final Coordinate[] cs = new Coordinate[2]; - cs[0] = new Coordinate(modele_.getX(getLayerSelection().getMinIndex()), modele_.getY(getLayerSelection() - .getMinIndex())); - cs[1] = new Coordinate(modele_.getX(getLayerSelection().getMaxIndex()), modele_.getY(getLayerSelection() - .getMaxIndex())); + cs[0] = new Coordinate(modele_.getX(getLayerSelection().getMinIndex()), modele_.getY(getLayerSelection().getMinIndex())); + cs[1] = new Coordinate(modele_.getX(getLayerSelection().getMaxIndex()), modele_.getY(getLayerSelection().getMaxIndex())); if (cs[0].compareTo(cs[1]) > 0) { final Coordinate tmp = cs[0]; cs[0] = cs[1]; @@ -319,7 +314,7 @@ } public void paintSelection(final Graphics2D _g, final ZSelectionTrace _trace, final GrMorphisme _versEcran, - final GrBoite _clipReel) { + final GrBoite _clipReel) { if ((modele_ == null) || (modele_.getNombre() <= 0) || isSelectionEmpty() || isRapide()) { return; } @@ -360,13 +355,13 @@ } public CtuluListSelection selectionBasic(final LinearRing _poly, final int _mode) { - if (modele_==null||modele_.getNombre() == 0 || !isVisible()) { + if (modele_ == null || modele_.getNombre() == 0 || !isVisible()) { return null; } final Envelope polyEnv = _poly.getEnvelopeInternal(); final GrBoite domaineBoite = getDomaine(); final Envelope domaine = new Envelope(domaineBoite.e_.x_, domaineBoite.o_.x_, domaineBoite.e_.y_, - domaineBoite.o_.y_); + domaineBoite.o_.y_); // si l'envelop du polygone n'intersect pas le domaine, il n'y a pas de selection if (!polyEnv.intersects(domaine)) { return null; @@ -392,7 +387,7 @@ } public static int getSelectedPoint(final ZModelePoint _modele, final GrPoint _p, final int _tolerance, - final GrMorphisme _versReel, final GrBoite _clipReel) { + final GrMorphisme _versReel, final GrBoite _clipReel) { final GrBoite bClip = _modele.getDomaine(); final double toleranceReel = GrMorphisme.convertDistanceXY(_versReel, _tolerance); if ((!bClip.contientXY(_p)) && (bClip.distanceXY(_p) > toleranceReel)) { @@ -410,17 +405,18 @@ } return -1; } - - public GrPoint getPoint( int i){ - if(i>= modeleDonnees().getNombre()) - return null; - GrPoint p=new GrPoint(); - modele().point(p, i, true); - return p; + + public GrPoint getPoint(int i) { + if (i >= modeleDonnees().getNombre()) { + return null; + } + GrPoint p = new GrPoint(); + modele().point(p, i, true); + return p; } protected CtuluListSelection selectionBasic(final GrPoint _pt, final int _tolerance) { - if (modele()==null||modele().getNombre() == 0 || (!isVisible())) { + if (modele() == null || modele().getNombre() == 0 || (!isVisible())) { return null; } final int i = getSelectedPoint(modele_, _pt, _tolerance, getVersReel(), getClipReel(getGraphics())); Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZModeleGeometryDefault.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZModeleGeometryDefault.java 2012-05-23 12:24:03 UTC (rev 7227) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZModeleGeometryDefault.java 2012-05-23 21:51:48 UTC (rev 7228) @@ -59,13 +59,13 @@ /** * Called from constructor ! - * @param geometries + * @param geometries */ public void setGeometries(GISZoneCollectionGeometry geometries) { if (geometries_ != null) { if (geometries_.getListener() instanceof GISZoneListenerDispatcher) { ((GISZoneListenerDispatcher) geometries_.getListener()).removeListener(this); - } else { + } else if (geometries_.getListener() == this) { geometries_.setListener(null); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2012-05-29 13:20:30
|
Revision: 7244 http://fudaa.svn.sourceforge.net/fudaa/?rev=7244&view=rev Author: deniger Date: 2012-05-29 13:20:18 +0000 (Tue, 29 May 2012) Log Message: ----------- Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePoint.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZModelePointEditable.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2012-05-29 09:55:46 UTC (rev 7243) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2012-05-29 13:20:18 UTC (rev 7244) @@ -114,7 +114,6 @@ protected EbliListeSelectionMulti creeSelectionMulti() { return new EbliListeSelectionMulti(modeleDonnees().getNombre() / 2); } - protected void initTrace(final TraceIconModel _icon, final int _idxPoly) { _icon.updateData(getIconModel(0)); @@ -504,6 +503,10 @@ return modele_; } + protected boolean isPainted(int idx, GrMorphisme _versEcran) { + return modele_.isGeometryVisible(idx); + } + /** * @param _g */ @@ -533,7 +536,8 @@ // on part de la fin : comme ca la premiere ligne apparait au-dessus for (int i = nombre - 1; i >= 0; i--) { - if (!modele_.isGeometryReliee(i)) { + if (!isPainted(i, _versEcran)//dans certains cas, ne pas dessiner l'objet + || !modele_.isGeometryReliee(i)) { continue; } @@ -542,10 +546,6 @@ if (nbPoints <= 0) { continue; } - // La g\xE9ometrie n'est pas visible - if (!modele_.isGeometryVisible(i)) { - continue; - } modele_.getDomaineForGeometry(i, bPoly); // Si la boite du polygone n'est pas dans la boite d'affichage on passe @@ -582,8 +582,6 @@ // Enfin les labels sur les atomiques. paintLabelsOnAtomics(_g, _versEcran, _versReel, _clipReel); } - - protected void paintSurfaces(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, final GrBoite _clipReel) { @@ -617,7 +615,7 @@ continue; } // La g\xE9ometrie n'est pas visible - if (!modele_.isGeometryVisible(i)) { + if (!isPainted(i,_versEcran)) { continue; } @@ -663,11 +661,11 @@ if (icone != null) { for (int i = nombre - 1; i >= 0; i--) { // il n'y a pas de points pour cette ligne - if (modele_.getNbPointForGeometry(i) <= 0) { + if (modele_.getNbPointForGeometry(i) <= 0 || !isPainted(i, _versEcran)) { continue; } // La g\xE9ometrie n'est pas visible - if (!modele_.isGeometryVisible(i)) { + if (!isPainted(i,_versEcran)) { continue; } @@ -721,7 +719,7 @@ continue; } // La g\xE9ometrie n'est pas visible - if (!modele_.isGeometryVisible(i)) { + if (!isPainted(i,_versEcran)) { continue; } @@ -1183,8 +1181,6 @@ return false; } - - @Override public boolean setSelection(final int[] _idx) { if (!isSelectable()) { Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2012-05-29 09:55:46 UTC (rev 7243) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2012-05-29 13:20:18 UTC (rev 7244) @@ -9,6 +9,7 @@ import java.awt.Color; import java.awt.Graphics2D; +import java.awt.Shape; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.commun.EbliUIProperties; @@ -23,20 +24,26 @@ import org.fudaa.ebli.trace.TraceLigneModel; /** - * Un calque g\xE9rant des lignes bris\xE9es, ouvertes ou ferm\xE9es \xE0 un niveau global ou atomique.<p> - * Le niveau atomique des lignes bris\xE9es est le niveau points. Le calque s'appuie sur un mod\xE8le + * Un calque g\xE9rant des lignes bris\xE9es, ouvertes ou ferm\xE9es \xE0 un niveau global ou atomique.<p> Le niveau atomique des lignes + * bris\xE9es est le niveau points. Le calque s'appuie sur un mod\xE8le * {@link ZModeleLigneBrisee}. - * + * * @author Fred Deniger * @version $Id$ */ public class ZCalqueLigneBrisee extends ZCalqueGeometry { - /** Le modele d'icone pour les lignes ouvertes */ + /** + * Le modele d'icone pour les lignes ouvertes + */ protected TraceIconModel iconeModelOuvert_; - /** Le modele de lignes pour les lignes ouvertes */ + /** + * Le modele de lignes pour les lignes ouvertes + */ protected TraceLigneModel ligneModelOuvert_; - /** On dessine une fl\xE8che sur chaque ligne pour indiquer le sens de celle-ci. */ + /** + * On dessine une fl\xE8che sur chaque ligne pour indiquer le sens de celle-ci. + */ protected boolean showLineOrientation_; /** @@ -52,25 +59,26 @@ public ZCalqueLigneBrisee(final ZModeleLigneBrisee _modele) { super(_modele); modele_ = _modele; - if(modele_!=null) + if (modele_ != null) { modele_.addModelListener(this); + } iconModel_ = new TraceIconModel(TraceIcon.CARRE_PLEIN, 2, Color.BLACK); ligneModelOuvert_ = new TraceLigneModel(ligneModel_); iconeModelOuvert_ = new TraceIconModel(iconModel_); - showLineOrientation_=false; + showLineOrientation_ = false; } - public boolean getShowLineOrientation(){ + public boolean getShowLineOrientation() { return showLineOrientation_; } - - public void setShowLineOrientation(boolean _value){ - if(showLineOrientation_!=_value){ - showLineOrientation_=_value; + + public void setShowLineOrientation(boolean _value) { + if (showLineOrientation_ != _value) { + showLineOrientation_ = _value; repaint(); } } - + protected void initTrace(final TraceLigneModel _ligne, final int _idxPoly) { final int idx = modele_.isGeometryFermee(_idxPoly) ? 0 : 1; _ligne.updateData(getLineModel(idx)); @@ -79,9 +87,23 @@ } else if (EbliLib.isAlphaChanged(alpha_)) { _ligne.setCouleur(EbliLib.getAlphaColor(_ligne.getCouleur(), alpha_)); } + } + public static void initTraceWithAlpha(TraceIconModel model, int alpha) { + if (model.getCouleur() != null && model.getCouleur().getAlpha() != alpha) { + model.setCouleur(EbliLib.getAlphaColor(model.getCouleur(), alpha)); + } + if (model.getBackgroundColor() != null && model.getBackgroundColor().getAlpha() != alpha) { + model.setBackgroundColor(EbliLib.getAlphaColor(model.getBackgroundColor(), alpha)); + } } + protected static void initTraceWithAlpha(TraceLigneModel model, int alpha) { + if (model.getCouleur() != null && model.getCouleur().getAlpha() != alpha) { + model.setCouleur(EbliLib.getAlphaColor(model.getCouleur(), alpha)); + } + } + protected void initTrace(final TraceIconModel _icon, final int _idxPoly) { final int idx = modele_.isGeometryFermee(_idxPoly) ? 0 : 1; _icon.updateData(getIconModel(idx)); @@ -135,21 +157,23 @@ */ public void modele(final ZModeleLigneBrisee _modele) { if (modele_ != _modele) { - if(modele_!=null) + if (modele_ != null) { modele_.removeModelListener(this); + } final ZModeleGeometry vp = modele_; modele_ = _modele; - if(modele_!=null) + if (modele_ != null) { modele_.addModelListener(this); + } firePropertyChange("modele", vp, modele_); } } public ZModeleLigneBrisee modeleDonnees() { - return (ZModeleLigneBrisee)modele_; + return (ZModeleLigneBrisee) modele_; } - - protected boolean showOrientation(int idxPoly){ + + protected boolean showOrientation(int idxPoly) { return showLineOrientation_; } @@ -157,27 +181,29 @@ * @param _g */ public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { + final GrBoite _clipReel) { if ((modele_ == null) || (modele_.getNombre() <= 0)) { return; } - + paintSurfaces(_g, _versEcran, _versReel, _clipReel); - + final GrBoite clip = _clipReel; final GrMorphisme versEcran = _versEcran; final int nombre = modele_.getNombre(); final TraceLigne tl; - if (isRapide()) - tl=new TraceLigne(TraceLigne.LISSE,1,ligneModel_.getCouleur()); - else - tl= ligneModel_.buildCopy(); - + if (isRapide()) { + tl = new TraceLigne(TraceLigne.LISSE, 1, ligneModel_.getCouleur()); + } else { + tl = ligneModel_.buildCopy(); + } + final TraceLigneModel ligneModel = tl.getModel(); final GrBoite bPoly = new GrBoite(); bPoly.o_ = new GrPoint(); bPoly.e_ = new GrPoint(); + Shape oldClip = _g.getClip(); // on part de la fin : comme ca la premiere ligne apparait au-dessus for (int i = nombre - 1; i >= 0; i--) { @@ -186,9 +212,10 @@ continue; } // La g\xE9ometrie n'est pas visible - if (!modele_.isGeometryVisible(i)) + if (!modele_.isGeometryVisible(i)) { continue; - + } + modele_.getDomaineForGeometry(i, bPoly); // Si la boite du polygone n'est pas dans la boite d'affichage on passe if (bPoly.intersectionXY(clip) == null) { @@ -198,70 +225,76 @@ if (nbPoints <= 0) { continue; } - - if (!isRapide()) initTrace(ligneModel, i); - - if(nbPoints <2) + updateClip(_g, oldClip, _versEcran, i); + + if (!isRapide()) { + initTrace(ligneModel, i); + } + + if (nbPoints < 2) { continue; - + } + // Affichage de la polyligne ou polygone \\ /* - * On part de la fin pour commencer \xE0 afficher la fleche si l'option est - * activ\xE9e. Pour \xEAtre sur que la fleche s'affiche correctement, on - * recherche deux points non confondus. + * On part de la fin pour commencer \xE0 afficher la fleche si l'option est activ\xE9e. Pour \xEAtre sur que la fleche s'affiche + * correctement, on recherche deux points non confondus. */ - GrPoint ptDest=new GrPoint(); - GrPoint ptOrig=new GrPoint(); + GrPoint ptDest = new GrPoint(); + GrPoint ptOrig = new GrPoint(); int j; // Si c'est une polyligne on prend le dernier point si c'est un polygone, // on prend le premier (le permier et le dernier doivent \xEAtre confondus). - if(modele_.isGeometryFermee(i)){ + if (modele_.isGeometryFermee(i)) { modele_.point(ptDest, i, 0); - modele_.point(ptOrig, i, nbPoints-1); - j=nbPoints-1; + modele_.point(ptOrig, i, nbPoints - 1); + j = nbPoints - 1; + } else { + modele_.point(ptDest, i, nbPoints - 1); + modele_.point(ptOrig, i, nbPoints - 2); + j = nbPoints - 2; } - else { - modele_.point(ptDest, i, nbPoints-1); - modele_.point(ptOrig, i, nbPoints-2); - j=nbPoints-2; - } // Recherche du point pr\xE9c\xE9dent non identique - while(ptOrig.x_==ptDest.x_&&ptOrig.y_==ptDest.y_&&j>0) + while (ptOrig.x_ == ptDest.x_ && ptOrig.y_ == ptDest.y_ && j > 0) { modele_.point(ptOrig, i, --j); - if(j==0&&(ptOrig.x_==ptDest.x_&&ptOrig.y_==ptDest.y_)) + } + if (j == 0 && (ptOrig.x_ == ptDest.x_ && ptOrig.y_ == ptDest.y_)) { continue; + } ptOrig.autoApplique(versEcran); ptDest.autoApplique(versEcran); - + // Dessin de la fleche - if(showOrientation(i)){ - GrVecteur vct=ptDest.soustraction(ptOrig); + if (showOrientation(i)) { + GrVecteur vct = ptDest.soustraction(ptOrig); vct.autoNormaliseXY(); vct.autoMultiplication(20); // Cr\xE9ation d'un point interm\xE9diare - double xorig=ptDest.x_-vct.x_; - double yorig=ptDest.y_-vct.y_; + double xorig = ptDest.x_ - vct.x_; + double yorig = ptDest.y_ - vct.y_; // La point est lisse - int typeTrait=tl.getTypeTrait(); + int typeTrait = tl.getTypeTrait(); tl.setTypeTrait(TraceLigne.LISSE); - tl.dessinePointe(_g, (int)xorig, (int)yorig, (int)ptDest.x_, (int)ptDest.y_, 11, 5); + tl.dessinePointe(_g, (int) xorig, (int) yorig, (int) ptDest.x_, (int) ptDest.y_, 11, 5); tl.setTypeTrait(typeTrait); } // Dessin des segments - for(;j>=0;j--){ + for (; j >= 0; j--) { modele_.point(ptOrig, i, j); ptOrig.autoApplique(versEcran); tl.dessineTrait(_g, ptOrig.x_, ptOrig.y_, ptDest.x_, ptDest.y_); ptDest.initialiseAvec(ptOrig); } } - + _g.setClip(oldClip); + // Les icones sur les atomiques - if (!isRapide()) + if (!isRapide()) { paintIconsOnAtomics(_g, _versEcran, _versReel, _clipReel); + } // Enfin les labels sur les atomiques. paintLabelsOnAtomics(_g, _versEcran, _versReel, _clipReel); } @@ -278,4 +311,11 @@ firePropertyChange(BSelecteurLineModel.PROPERTY + "open", null, ligneModelOuvert_); } + /** + * To be used to update clip before painting a line + * @param _g + * @param oldClip clip at the beginning of paintDonnees. + */ + protected void updateClip(Graphics2D _g, Shape oldClip, GrMorphisme _versEcran, int idx) { + } } Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePoint.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePoint.java 2012-05-29 09:55:46 UTC (rev 7243) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePoint.java 2012-05-29 13:20:18 UTC (rev 7244) @@ -248,6 +248,10 @@ } } + protected boolean isPainted(int idx) { + return true; + } + public void paintDonnees(final Graphics2D _g, final int _nbPt, final GrMorphisme _versEcran, final GrBoite _clipReel) { if ((modele_ == null) || (_nbPt <= 0)) { return; @@ -268,6 +272,9 @@ icone.setCouleur(EbliLib.getAlphaColor(icone.getCouleur(), alpha_)); } for (int i = _nbPt - 1; i >= 0; i--) { + if (!isPainted(i)) { + continue; + } // si le point est filtre on passe. On ne force pas l'affectation. if (!modele_.point(p_, i, false)) { continue; @@ -351,6 +358,9 @@ p_ = new GrPoint(); } for (int i = selection_.getMinIndex(); i <= nb; i++) { + if (!isPainted(i)) { + continue; + } if (selection_.isSelected(i)) { modele_.point(p_, i, true); if (clip.contientXY(p_)) { @@ -384,6 +394,9 @@ // un testeur optimis\xE9e final SIRtreePointInRing tester = new SIRtreePointInRing(_poly); for (int i = nb; i >= 0; i--) { + if (!isPainted(i)) { + continue; + } modele().point(p, i, true); c.x = p.x_; c.y = p.y_; @@ -431,7 +444,7 @@ return null; } final int i = getSelectedPoint(modele_, _pt, _tolerance, getVersReel(), getClipReel(getGraphics())); - if (i >= 0) { + if (i >= 0 && isPainted(i)) { final CtuluListSelection r = creeSelection(); r.add(i); return r; Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZModelePointEditable.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZModelePointEditable.java 2012-05-29 09:55:46 UTC (rev 7243) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZModelePointEditable.java 2012-05-29 13:20:18 UTC (rev 7244) @@ -127,6 +127,7 @@ pts_.prepareExport(); } + @Override public void setGeometries(GISZoneCollectionGeometry geometries) { super.setGeometries(geometries); pts_ = (GISZoneCollectionPoint) geometries; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2012-06-06 21:52:37
|
Revision: 7274 http://fudaa.svn.sourceforge.net/fudaa/?rev=7274&view=rev Author: deniger Date: 2012-06-06 21:52:30 +0000 (Wed, 06 Jun 2012) Log Message: ----------- Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalque.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalqueModel.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalque.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalque.java 2012-06-06 07:30:35 UTC (rev 7273) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalque.java 2012-06-06 21:52:30 UTC (rev 7274) @@ -1,6 +1,6 @@ /** - * @creation 1998-09-02 @modification $Date$ @license GNU General Public License - * 2 @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne @mail de...@fu... + * @creation 1998-09-02 @modification $Date$ @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne @mail de...@fu... */ package org.fudaa.ebli.calque; @@ -71,7 +71,7 @@ } class ZBArbreNormalMenu extends BuDynamicMenu { - + BArbreCalqueModel arbre_; boolean noLayer_; @@ -117,20 +117,20 @@ * @author Guillaume Desnoix */ public class BArbreCalque extends JTree implements InternalFrameListener, Observer { - + class ArbreCellEditor extends AbstractCellEditor implements TreeCellEditor { - + ArbreCell1 editor_; BCalque cqEdite_; // la largeur par defaut pour la case a cocher 'visible' int cbWidth_; // la hauteur par defaut pour la case a cocher 'visible' int cbHeight_; - + ArbreCellEditor() { editor_ = new ArbreCell1(true); editor_.cbVisible_.addItemListener(new ItemListener() { - + public void itemStateChanged(ItemEvent e) { if (cqEdite_ != null) {; cqEdite_.setVisible(editor_.cbVisible_.isSelected()); @@ -139,10 +139,10 @@ } }); editor_.r1_.addKeyListener(new KeyListener() { - + public void keyPressed(final KeyEvent _e) { } - + public void keyReleased(final KeyEvent _e) { if (_e.getKeyCode() == KeyEvent.VK_ENTER && editor_.r1_.getText() != null && editor_.r1_.getText().trim().length() > 0) { @@ -150,17 +150,17 @@ fireEditingStopped(); } } - + public void keyTyped(final KeyEvent _e) { } }); editor_.r1_.addFocusListener(new FocusListener() { - + public void focusGained(final FocusEvent _e) { editor_.r1_.setBackground(UIManager.getColor("TextField.background")); editor_.r1_.setForeground(Color.BLACK); } - + public void focusLost(final FocusEvent _e) { } }); @@ -169,9 +169,9 @@ final Dimension d = editor_.cbVisible_.getPreferredSize(); cbHeight_ = d.height; cbWidth_ = d.width; - + } - + public boolean isCellEditable(final EventObject _anEvent) { // le calque est mis a null s'il n'est pas edite if (_anEvent instanceof MouseEvent) { @@ -213,25 +213,25 @@ && cq.isTitleModifiable()) { return true; } - + } } return false; } - + public boolean shouldSelectCell(final EventObject _anEvent) { return false; } - + public Object getCellEditorValue() { return null; } - + protected void fireEditingStopped() { getArbreModel().getRootCalque().requestFocusInWindow(); super.fireEditingStopped(); } - + public Component getTreeCellEditorComponent(final JTree _tree, final Object _value, final boolean _isSelected, final boolean _expanded, final boolean _leaf, final int _row) { cqEdite_ = (BCalque) _value; @@ -240,11 +240,11 @@ return editor_; } } - + public static BArbreNormalMenu buildNormalMenu(final BArbreCalqueModel _m) { return new BArbreNormalMenu(_m); } - + public static ZBArbreNormalMenu buildZNormalMenu(final BArbreCalqueModel _m) { return new ZBArbreNormalMenu(_m); } @@ -255,11 +255,22 @@ public BArbreCalque() { this(true); } - + + @Override + public void setEditable(boolean flag) { + boolean old = isEditable(); + if (old != flag) { + super.setEditable(flag); + if (getArbreModel() != null) { + getArbreModel().editableChanged(); + } + } + } + public BArbreCalque(final BArbreCalqueModel _m) { this(_m, true); } - + public BArbreCalque(final BArbreCalqueModel _m, final boolean _editable) { this(_editable); setModel(_m); @@ -272,22 +283,22 @@ setShowsRootHandles(true); setFocusable(false); setBorder(new EmptyBorder(5, 5, 5, 5)); - + final ArbreCell1 c = new ArbreCell1(_editable); setCellRenderer(c); if (_editable) { setEditable(_editable); setCellEditor(new ArbreCellEditor()); } - + c.doLayout(); setRowHeight(35); addMouseListener(new PopupListener()); setExpandsSelectedPaths(true); } - + class PopupListener extends EbliPopupListener { - + public void popup(final Component _c, final int _xe, final int _ye) { if (!BArbreCalque.this.isEditable()) { return; @@ -308,17 +319,17 @@ } } } - + public JPopupMenu buildPopupMenu(final BCalque _calque) { final CtuluPopupMenu r = new CtuluPopupMenu(); getArbreModel().fillPopupMenu(r); return r; } - + public ZBArbreNormalMenu buildZNormalMenu() { return new ZBArbreNormalMenu(getArbreModel()); } - + public BArbreCalqueModel getArbreModel() { return (BArbreCalqueModel) getModel(); } @@ -368,7 +379,7 @@ } } } - + public void internalFrameClosed(final InternalFrameEvent _e) { final JInternalFrame f = _e.getInternalFrame(); if (f instanceof EbliFilleCalquesInterface) { @@ -380,10 +391,10 @@ } } } - + public void internalFrameClosing(final InternalFrameEvent _e) { } - + public void internalFrameDeactivated(final InternalFrameEvent _e) { final JInternalFrame f = _e.getInternalFrame(); if (f instanceof EbliFilleCalquesInterface) { @@ -394,13 +405,13 @@ } } } - + public void internalFrameDeiconified(final InternalFrameEvent _e) { } - + public void internalFrameIconified(final InternalFrameEvent _e) { } - + public void internalFrameOpened(final InternalFrameEvent _e) { } @@ -456,7 +467,7 @@ public void setSelectionCalque(final BCalque _cq) { getArbreModel().setSelectionCalque(_cq); } - + public void updateUI() { super.updateUI(); setRowHeight(35); @@ -467,7 +478,7 @@ * dessine aussi l'etat du calque (attenue, rapide, gele) sous la forme d'une chaine de caracteres. Utilisee pour tous les lnk */ public static class ArbreCell1 extends JPanel implements TreeCellRenderer { - + private final Color treeForeground_ = UIManager.getColor("Tree.foreground"); private final Color treeBackground_ = UIManager.getColor("Tree.background"); private final Color treeSelectionForeground_ = UIManager.getColor("Tree.selectionForeground"); @@ -514,7 +525,7 @@ pnLeft.setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 0)); pnLeft.setLayout(new BuVerticalLayout(1, true, true)); pnLeft.setOpaque(false); - + final JPanel r4 = new JPanel(new BuBorderLayout(2, 1, true, true)); r4.add(r1_, BuBorderLayout.CENTER); r4.add(r2_, BuBorderLayout.SOUTH); @@ -526,7 +537,7 @@ pnRight_.setLayout(new BuBorderLayout(2, 1, true, true)); pnRight_.add(r3_, BuBorderLayout.CENTER); pnRight_.add(r4, BuBorderLayout.EAST); - + if (_editable) { cbVisible_ = new BuCheckBox3States(); cbVisible_.acceptOnly2StatesWhenClicked(true); @@ -544,7 +555,7 @@ setOpaque(true); } final BuLightBorder light_ = new BuLightBorder(BuLightBorder.RAISED, 3); - + public Component getTreeCellRendererComponent(final JTree _tree, final Object _value, final boolean _selected, final boolean _expanded, final boolean _leaf, final int _row, final boolean _hasFocus) { @@ -565,7 +576,7 @@ s.append(calqueInfo); } if (calque instanceof BCalqueAffichage) { - + final BCalqueAffichage ca = (BCalqueAffichage) calque; if (ca.isRapide()) { if (s.length() > 0) { @@ -573,7 +584,7 @@ } s.append(EbliResource.EBLI.getString("rapide")); } - + if (ca.isAttenue()) { if (s.length() > 0) { s.append(CtuluLibString.ESPACE); @@ -593,7 +604,7 @@ if (calque instanceof ZCalqueAffichageDonneesAbstract) { final ZCalqueAffichageDonneesAbstract cq = (ZCalqueAffichageDonneesAbstract) calque; lbSelect_.setVisible(!cq.isSelectionEmpty()); - + if (!cq.isSelectable()) { if (s.length() > 0) { s.append(CtuluLibString.ESPACE); @@ -663,12 +674,12 @@ } else { tooltip.append("<a href=\"").append(link).append("\">").append(_value.toString()).append("</a>"); } - + final String text = r2_.getText(); if (text.length() > 0) { tooltip.append("<br>").append(text); } - + final Object val = cq.getClientProperty(Action.SHORT_DESCRIPTION); if (val != null) { tooltip.append("<br>").append(val.toString()); @@ -692,15 +703,15 @@ * looks Windows et Motif */ public static class ArbreCellLabel extends JLabel implements TreeCellRenderer { - + Color selectedBack_ = UIManager.getColor("Tree.selectionBackground"); Color selectedFor_ = UIManager.getColor("Tree.selectionForeground"); - + public ArbreCellLabel() { this.setOpaque(true); setPreferredSize(new Dimension(120, 25)); } - + public Component getTreeCellRendererComponent(final JTree _tree, final Object _value, final boolean _selected, final boolean _expanded, final boolean _leaf, final int _row, final boolean _hasFocus) { Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalqueModel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalqueModel.java 2012-06-06 07:30:35 UTC (rev 7273) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalqueModel.java 2012-06-06 21:52:30 UTC (rev 7274) @@ -51,9 +51,9 @@ * @version $Id$ */ public class BArbreCalqueModel implements TreeModel, PropertyChangeListener, ActionListener, ContainerListener { + public static final String LAYER_ADDED = "added"; public static final String LAYER_REMOVED = "removed"; - private static final Object[] PROP_TO_LISTEN = CtuluLibArray.sort( new String[]{"foreground", "visible", "attenue", "rapide", "ajustement", "paletteCouleur", "iconeChanged", "title", "nodeEdit", "alpha", "model"}); @@ -618,6 +618,10 @@ } Observable observable_; + void editableChanged() { + refresh(); + } + static class SpecialObservable extends Observable { protected synchronized void setChanged() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2012-06-12 15:42:27
|
Revision: 7298 http://fudaa.svn.sourceforge.net/fudaa/?rev=7298&view=rev Author: deniger Date: 2012-06-12 15:42:18 +0000 (Tue, 12 Jun 2012) Log Message: ----------- Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquesPanel.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZSceneEditor.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2012-06-12 07:38:16 UTC (rev 7297) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2012-06-12 15:42:18 UTC (rev 7298) @@ -63,8 +63,14 @@ } public static final void ajusteZoomOnSelected(final GrBoite _r, final GrBoite _envGeneral) { - final double wT = _envGeneral.getDeltaX(); - final double hT = _envGeneral.getDeltaY(); + double wT = _envGeneral.getDeltaX(); + double hT = _envGeneral.getDeltaY(); + if (wT <= 0) { + wT = hT; + } + else if(hT<=0){ + hT=wT; + } final double coef = 0.1; // premier test: le zoom ne doit pas etre inferieur a 10% du domaine total // sinon l'utilisateur ne sait pas ou il est Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2012-06-12 07:38:16 UTC (rev 7297) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2012-06-12 15:42:18 UTC (rev 7298) @@ -970,8 +970,10 @@ /** * Cette fonctionnalit\xE9 est d\xE9plac\xE9e et \xE9tendue dans ZSceneEditor + * Remarque de Fred: La fonction zoomOnSelected ajoute des marges sur le cote ce qui \xE9vite d'avoir un zoom avec + * une boite de dimension null si un seul point est s\xE9lectionne. * - * @deprecated + * @deprecated: \xE0 voir... */ public void zoomOnSelected() { final BCalque cq = getCalqueActif(); Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZSceneEditor.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZSceneEditor.java 2012-06-12 07:38:16 UTC (rev 7297) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZSceneEditor.java 2012-06-12 15:42:18 UTC (rev 7298) @@ -11,6 +11,7 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluUI; +import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.calque.ZScene; @@ -187,6 +188,24 @@ } /** + * Effectue un zoom sur la selection mais en gardant des dimensions minimums. + */ + public void zoomControlledOnSelected() { + GrBoite boite = null; + for (ZCalqueAffichageDonneesInterface cq : scene_.getAllLayers()) { + GrBoite boiteTmp = cq.getZoomOnSelected(); + if (boite == null) { + boite = boiteTmp; + } else { + boite.ajuste(boiteTmp); + } + } + if (boite != null) { + calquePanel_.getVueCalque().changeRepere(this, boite); + } + } + + /** * Selectionne l'objet suivant celui selectionn\xE9. */ public void selectNextObject() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2012-06-15 10:18:40
|
Revision: 7343 http://fudaa.svn.sourceforge.net/fudaa/?rev=7343&view=rev Author: bmarchan Date: 2012-06-15 10:18:29 +0000 (Fri, 15 Jun 2012) Log Message: ----------- Add : Possibilit?\195?\169 titre long ds tooltip arbre des calques Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalque.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalque.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalque.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalque.java 2012-06-15 10:17:02 UTC (rev 7342) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalque.java 2012-06-15 10:18:29 UTC (rev 7343) @@ -564,10 +564,12 @@ r1_.setFont(ft); r2_.setFont(BuLib.deriveFont(ft, -2)); String calqueInfo = null; + String longTitle=null; final StringBuffer s = new StringBuffer(); if (_value instanceof BCalque) { final BCalque calque = (BCalque) _value; r3_.setIcon(calque); + longTitle=calque.getLongTitle(); // Si on souhaite pouvoir retailler l'icon du calque. // r3_.setIcon(CtuluLibImage.resize(calque,r3_.getPreferredSize().width,r3_.getPreferredSize().height)); @@ -670,7 +672,10 @@ final JComponent cq = (JComponent) _value; final String link = CtuluLibSwing.getHelpUrl(cq); if (link == null) { - tooltip.append(_value.toString()); + if (longTitle==null) + tooltip.append(_value.toString()); + else + tooltip.append(longTitle); } else { tooltip.append("<a href=\"").append(link).append("\">").append(_value.toString()).append("</a>"); } Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalque.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalque.java 2012-06-15 10:17:02 UTC (rev 7342) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalque.java 2012-06-15 10:18:29 UTC (rev 7343) @@ -115,6 +115,8 @@ * Chaine affichee dans l'arbre des calques. */ private String title_; + /** Le titre long affich\xE9 dans le tooltip de l'arbre des calques */ + private String longTitle_; private transient GrMorphisme versEcran_; @@ -920,8 +922,31 @@ } return false; } + + /** + * Definit le titre long, affich\xE9 en tooltip dans l'arbre des calques. + * @param _title Le nouveau titre long. Peut \xEAtre null. + * @return true si changement. + */ + public boolean setLongTitle(final String _title) { + if (_title != longTitle_ || (_title!=null && !_title.equals(longTitle_))) { + final String old = longTitle_; + longTitle_ = _title; + firePropertyChange("longTitle", old, longTitle_); + return true; + } + return false; + } /** + * @return Le titre long, affich\xE9 en tooltip dans l'arbre des calques. null si aucun + * titre long d\xE9fini. + */ + public String getLongTitle() { + return longTitle_; + } + + /** * Affectation de la propriete versEcran. Cette affectation est appliquee aux calques fils. */ public void setVersEcran(final GrMorphisme _v) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2012-06-22 08:40:35
|
Revision: 7383 http://fudaa.svn.sourceforge.net/fudaa/?rev=7383&view=rev Author: deniger Date: 2012-06-22 08:40:25 +0000 (Fri, 22 Jun 2012) Log Message: ----------- Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/action/CalqueGISEditionAction.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/BPaletteEdition.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/action/CalqueGISEditionAction.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/action/CalqueGISEditionAction.java 2012-06-22 07:01:45 UTC (rev 7382) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/action/CalqueGISEditionAction.java 2012-06-22 08:40:25 UTC (rev 7383) @@ -40,7 +40,7 @@ // Calques utilis\xE9 dans cette action private BCalqueInteraction calqueZoom_; // Calque ne fermant pas l'edition private BCalqueInteraction calqueDeplacementVue_; // Calque ne fermant pas l'edition - private ZCalqueEditionInteraction calqueEdition_; // Le calque d'\xE9dition + protected ZCalqueEditionInteraction calqueEdition_; // Le calque d'\xE9dition /** * @param _editor l'editeur @@ -180,6 +180,7 @@ public void propertyChange(PropertyChangeEvent _evt) { // Cas un autre calque que celui du zoom, du deplacement de vue et d'edition // est d\xE9gel\xE9 donc on ferme le pannel d'edition si il \xE9tait ouvert. + //a priori c'est faux car sinon on garde les boutons activ\xE9s pour rien. if (_evt.getSource() != calqueZoom_ && _evt.getSource() != calqueDeplacementVue_ && _evt.getSource() != calqueEdition_ && !((Boolean) _evt.getNewValue()).booleanValue() && palette_ != null && ((BPaletteEdition) palette_).isEditionOnGoing()) { unactivePanel(); Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/BPaletteEdition.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/BPaletteEdition.java 2012-06-22 07:01:45 UTC (rev 7382) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/BPaletteEdition.java 2012-06-22 08:40:25 UTC (rev 7383) @@ -411,6 +411,7 @@ * Reset la palette : ferme le panel de construction de forme en cours. et d\xE9active tout les autres bouton du panel */ public void resetPalette() { + System.err.println("reset"); for (int i = 0; i < globalButtons_.size(); i++) { if (globalButtons_.get(i) != null) { AbstractButton button = (AbstractButton) globalButtons_.get(i); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2012-06-22 09:04:01
|
Revision: 7385 http://fudaa.svn.sourceforge.net/fudaa/?rev=7385&view=rev Author: deniger Date: 2012-06-22 09:03:54 +0000 (Fri, 22 Jun 2012) Log Message: ----------- Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/BPaletteEdition.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2012-06-22 08:41:02 UTC (rev 7384) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2012-06-22 09:03:54 UTC (rev 7385) @@ -858,6 +858,14 @@ } /** + * @return true if at least one interaction layer is enable + */ + public boolean isCalqueInterationEnabled() { + return cqInteractionActif_ != null && !cqInteractionActif_.isGele(); + + } + + /** * @deprecated Use setCoordinateDefinitions() instead. * @param _xyFormatter */ Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/BPaletteEdition.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/BPaletteEdition.java 2012-06-22 08:41:02 UTC (rev 7384) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/BPaletteEdition.java 2012-06-22 09:03:54 UTC (rev 7385) @@ -411,7 +411,6 @@ * Reset la palette : ferme le panel de construction de forme en cours. et d\xE9active tout les autres bouton du panel */ public void resetPalette() { - System.err.println("reset"); for (int i = 0; i < globalButtons_.size(); i++) { if (globalButtons_.get(i) != null) { AbstractButton button = (AbstractButton) globalButtons_.get(i); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2012-07-11 13:36:34
|
Revision: 7479 http://fudaa.svn.sourceforge.net/fudaa/?rev=7479&view=rev Author: deniger Date: 2012-07-11 13:36:23 +0000 (Wed, 11 Jul 2012) Log Message: ----------- Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueSelectionInteractionSimple.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZCalqueLigneBriseeEditable.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueSelectionInteractionSimple.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueSelectionInteractionSimple.java 2012-07-11 09:16:43 UTC (rev 7478) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueSelectionInteractionSimple.java 2012-07-11 13:36:23 UTC (rev 7479) @@ -27,20 +27,40 @@ */ public class ZCalqueSelectionInteractionSimple extends ZCalqueSelectionInteractionAbstract { + private interface EditorDelegate { + + String edit(); + } + EditorDelegate editorDelegate; + // private ZCalqueAffichageDonneesInterface zcalquesActif_; - /** * Cr\xE9ation d'un calque de s\xE9lection sans objets s\xE9lectionnables. */ - public ZCalqueSelectionInteractionSimple( final BGroupeCalque _donnees) { + public ZCalqueSelectionInteractionSimple(final BGroupeCalque _donnees) { super(_donnees); } + public EditorDelegate getEditorDelegate() { + return editorDelegate; + } + + public void setEditorDelegate(EditorDelegate editorDelegate) { + this.editorDelegate = editorDelegate; + } + + @Override public boolean editionAsked() { - String message = editor_.edit(); - if(message!=null) - FuLog.trace("EBL : ZCalqueSelectionInteractionSimple : "+message); - return message!=null; + String message = null; + if (editorDelegate != null) { + message = editorDelegate.edit(); + } else { + message = editor_.edit(); + } + if (message != null) { + FuLog.trace("EBL : ZCalqueSelectionInteractionSimple : " + message); + } + return message != null; } /** @@ -50,23 +70,21 @@ if (internalGetScene().isRestrictedToCalqueActif() && internalGetScene().getCalqueActif() == null) { return; } - if (mode_ == PONCTUEL || - (mode_ == RECTANGLE && listePoints_.renvoie(0).distanceXY(listePoints_.renvoie(2))<4)) { - if (idxGeomAccroch_!=null) { - ZSceneSelection ssel=new ZSceneSelection(internalGetScene()); - CtuluListSelection sel=new CtuluListSelection(new int[]{idxVertexAccroch_}); + if (mode_ == PONCTUEL + || (mode_ == RECTANGLE && listePoints_.renvoie(0).distanceXY(listePoints_.renvoie(2)) < 4)) { + if (idxGeomAccroch_ != null) { + ZSceneSelection ssel = new ZSceneSelection(internalGetScene()); + CtuluListSelection sel = new CtuluListSelection(new int[]{idxVertexAccroch_}); ssel.set(idxGeomAccroch_, sel); internalGetScene().changeSelection(ssel, modificateur_.getModificateur()); - } - else { + } else { final GrPoint pt = listePoints_.renvoie(0); pt.autoApplique(getVersReel()); internalGetScene().changeSelection(pt, tolerancePixel_, modificateur_.getModificateur()); } - } - else { + } else { final GrPolygone poly = plHelper_.toGrPolygone(); - if (poly.nombre()>=3) { + if (poly.nombre() >= 3) { poly.autoApplique(getVersReel()); final LinearRing l = GISGeometryFactory.INSTANCE.createLinearRing(poly.sommets_.createCoordinateSequence(true)); internalGetScene().changeSelection(l, modificateur_.getModificateur(), EbliSelectionMode.MODE_ALL); @@ -74,7 +92,6 @@ } } - /** * Efface les selections de tous les calques. */ @@ -89,26 +106,14 @@ _g.setColor(old); } } - // boolean special_; -/* public void setCalqueActif(final ZCalqueAffichageDonneesInterface _calque) { - if (FuLog.isTrace()) { - FuLog.trace("EBL: selection calque=" + (_calque == null ? "null" : _calque.getTitle())); - } -// addCalqueActif(_calque); - if (_calque != zcalquesActif_) { - if (zcalquesActif_ != null) { - zcalquesActif_.clearSelection(); - } - zcalquesActif_ = _calque; - if (zcalquesActif_ == null) { - modificateur_.setSpecial(false); - } else { - modificateur_.setSpecial(zcalquesActif_.isSpecialSelectionAllowed()); - } - repaint(); - } - - }*/ + /* + * public void setCalqueActif(final ZCalqueAffichageDonneesInterface _calque) { if (FuLog.isTrace()) { FuLog.trace("EBL: selection calque=" + + * (_calque == null ? "null" : _calque.getTitle())); } // addCalqueActif(_calque); if (_calque != zcalquesActif_) { if (zcalquesActif_ != null) { + * zcalquesActif_.clearSelection(); } zcalquesActif_ = _calque; if (zcalquesActif_ == null) { modificateur_.setSpecial(false); } else { + * modificateur_.setSpecial(zcalquesActif_.isSpecialSelectionAllowed()); } repaint(); } + * + * } + */ } \ No newline at end of file Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZCalqueLigneBriseeEditable.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZCalqueLigneBriseeEditable.java 2012-07-11 09:16:43 UTC (rev 7478) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZCalqueLigneBriseeEditable.java 2012-07-11 13:36:23 UTC (rev 7479) @@ -50,6 +50,7 @@ editor_ = _editor; } + @Override public String editSelected() { return editor_ == null ? EbliLib.getS("Edition impossible") : editor_.edit(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2012-09-25 13:33:46
|
Revision: 7656 http://fudaa.svn.sourceforge.net/fudaa/?rev=7656&view=rev Author: deniger Date: 2012-09-25 13:33:35 +0000 (Tue, 25 Sep 2012) Log Message: ----------- ajout fonction ajout point Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalquePositionnementInteraction.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalquePositionnementInteraction.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalquePositionnementInteraction.java 2012-09-25 13:08:28 UTC (rev 7655) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalquePositionnementInteraction.java 2012-09-25 13:33:35 UTC (rev 7656) @@ -18,6 +18,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Set; +import javax.swing.SwingUtilities; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.geometrie.GrPoint; @@ -27,18 +28,18 @@ import org.fudaa.ebli.ressource.EbliResource; /** - * Un calque pour la navigation dans la vue calque. Il permet de d\xE9placer interactivement la zone visualis\xE9e par - * glisser/d\xE9placer. - * <p> - * Le deplacement provoque la diffusion d'un \xE9v\xE8nement <I>RepereEvent</I>. + * Un calque pour la navigation dans la vue calque. Il permet de d\xE9placer interactivement la zone visualis\xE9e par glisser/d\xE9placer. <p> Le deplacement + * provoque la diffusion d'un \xE9v\xE8nement <I>RepereEvent</I>. * * @version $Id: BCalquePositionnementInteraction.java,v 1.12 2006-09-19 14:55:45 deniger Exp $ * @author Bertrand Marchand */ -public class BCalquePositionnementInteraction extends BCalqueInteraction implements MouseListener, MouseMotionListener{ +public class BCalquePositionnementInteraction extends BCalqueInteraction implements MouseListener, MouseMotionListener { + private GrPoint ptOrig_; // Point d'origine du d\xE9placement - private final Set repereEventListeners_; // Listeners de modification de rep\xE8re + private final Set repereEventListeners_; // Listeners de modification de rep\xE8re private BVueCalque vueCalque_; // VueCalque du calque + private boolean restoreDefaultLayer; /** * Cr\xE9ation d'un calque de positionnement. @@ -49,12 +50,11 @@ repereEventListeners_ = new HashSet(); vueCalque_ = null; } - - + public Cursor getSpecificCursor() { return EbliResource.EBLI.getCursor("main", -1, new Point(8, 8)); } - + public String getDescription() { return EbliLib.getS("D\xE9placer la vue"); } @@ -62,19 +62,17 @@ /** * Retourne la VueCalque contenant le calque. * - * @return La <code>BVueCalque</code> contenant le calque. <code>null</code> si le calque n'a pas encore \xE9t\xE9 - * affect\xE9 \xE0 une fen\xEAtre de vue. + * @return La <code>BVueCalque</code> contenant le calque. <code>null</code> si le calque n'a pas encore \xE9t\xE9 affect\xE9 \xE0 une fen\xEAtre de vue. */ public BVueCalque getVueCalque() { return vueCalque_; } /** - * D\xE9finit la VueCalque contenant le calque. Les \xE9v\xE9nements <code>RepereEvent</code> g\xE9n\xE9r\xE9s par le calque sont - * automatiquement envoy\xE9s vers la VueCalque. + * D\xE9finit la VueCalque contenant le calque. Les \xE9v\xE9nements + * <code>RepereEvent</code> g\xE9n\xE9r\xE9s par le calque sont automatiquement envoy\xE9s vers la VueCalque. * - * @param _v La <code>BVueCalque</code> contenant le calque. Peut \xEAtre <code>null</code> si le calque n'a plus - * affect\xE9 \xE0 une fen\xEAtre de vue. + * @param _v La <code>BVueCalque</code> contenant le calque. Peut \xEAtre <code>null</code> si le calque n'a plus affect\xE9 \xE0 une fen\xEAtre de vue. */ public void setVueCalque(final BVueCalque _v) { if (vueCalque_ != _v) { @@ -91,8 +89,7 @@ /** * Dessin de l'icone. * - * @param _c composant dont l'icone peut deriver des proprietes (couleur, ...). Ce parametre peut etre <I>null</I>. - * Il est ignore ici. + * @param _c composant dont l'icone peut deriver des proprietes (couleur, ...). Ce parametre peut etre <I>null</I>. Il est ignore ici. * @param _g le graphics sur lequel dessiner l'icone * @param _x lieu cible de l'icone (x) * @param _y lieu cible de l'icone (y) @@ -136,6 +133,13 @@ * Methode invoqu\xE9e quand on appuie sur un bouton de la souris. Saisie de la position \xE9cran courante. */ public void mousePressed(final MouseEvent _evt) { + restoreDefaultLayer = false; + if (SwingUtilities.isMiddleMouseButton(_evt)) { + if (isGele()) { + restoreDefaultLayer = true; + } + setGele(false); + } if (isGele() || _evt.isConsumed()) { return; } @@ -151,24 +155,28 @@ } final GrPoint ptCur = new GrPoint(_evt.getX(), _evt.getY(), 0.); final GrVecteur v = ptOrig_.soustraction(ptCur); - if(!vueCalque_.checkTranslation(v.applique(vueCalque_.getVersReel()))) { - v.x_=0; - v.y_=0; + if (!vueCalque_.checkTranslation(v.applique(vueCalque_.getVersReel()))) { + v.x_ = 0; + v.y_ = 0; } // v.autoApplique(getVersReel()); ptOrig_ = ptCur; - - + + final RepereEvent re = new RepereEvent(this, false); re.ajouteTransformation(RepereEvent.TRANS_X, v.x_, true); // B.M. 20/09/2000 La translation est invers\xE9e suivant y en attendant de // comprendre pourquoi re.ajouteTransformation(RepereEvent.TRANS_Y, -v.y_, true); fireRepereEvent(re); + if (restoreDefaultLayer) { + restoreDefaultLayer = false; + if (defaultCalqueInteraction != null) { + defaultCalqueInteraction.setGele(false); + } + } } - - /* * Methode invoqu\xE9e quand on deplace la souris avec un bouton appuy\xE9. D\xE9placement de la vue en mode affichage rapide */ @@ -179,7 +187,7 @@ final GrPoint ptCur = new GrPoint(_evt.getX(), _evt.getY(), 0.); final GrVecteur v = ptOrig_.soustraction(ptCur); v.autoApplique(getVersReel()); - if(!vueCalque_.checkTranslation(v)) { + if (!vueCalque_.checkTranslation(v)) { return; } v.autoApplique(getVersEcran()); @@ -195,20 +203,29 @@ /** * <I>Sans objet</I>. */ - public void mouseMoved(final MouseEvent _evt) {} + public void mouseMoved(final MouseEvent _evt) { + } /** * <I>Sans objet</I>. */ - public void mouseClicked(final MouseEvent _evt) {} + public void mouseClicked(final MouseEvent _evt) { + } /** * <I>Sans objet</I>. */ - public void mouseEntered(final MouseEvent _evt) {} + public void mouseEntered(final MouseEvent _evt) { + } /** * <I>Sans objet</I>. */ - public void mouseExited(final MouseEvent _evt) {} + public void mouseExited(final MouseEvent _evt) { + } + BCalqueInteraction defaultCalqueInteraction; + + void setDefaultCalqueInteraction(BCalqueInteraction interaction) { + this.defaultCalqueInteraction = interaction; + } } Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2012-09-25 13:08:28 UTC (rev 7655) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2012-09-25 13:33:35 UTC (rev 7656) @@ -570,6 +570,7 @@ // Calque de d\xE9placement de vue cqDepVueI_ = new BCalquePositionnementInteraction(); cqDepVueI_.setName("cqDEPLACEMENT_VUE-I"); + cqDepVueI_.setDefaultCalqueInteraction(cqSelectionI_); cqDepVueI_.setTitle(EbliLib.getS("D\xE9placement de vue")); cqDepVueI_.setVueCalque(pn_.getVueCalque()); cqDepVueI_.setGele(true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2012-12-21 15:15:08
|
Revision: 8167 http://fudaa.svn.sourceforge.net/fudaa/?rev=8167&view=rev Author: deniger Date: 2012-12-21 15:14:56 +0000 (Fri, 21 Dec 2012) Log Message: ----------- Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalque.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalqueModel.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/action/TreeDeleteCalqueAction.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZCalqueMultiPointEditable.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalque.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalque.java 2012-12-21 15:14:20 UTC (rev 8166) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalque.java 2012-12-21 15:14:56 UTC (rev 8167) @@ -271,8 +271,10 @@ boolean old = isEditable(); if (old != flag) { super.setEditable(flag); + if (getArbreModel() != null) { - getArbreModel().editableChanged(); + getArbreModel().setEditable(flag); + } } } @@ -311,9 +313,9 @@ @Override public void popup(final Component _c, final int _xe, final int _ye) { - if (!BArbreCalque.this.isEditable()) { - return; - } +// if (!BArbreCalque.this.isEditable()) { +// return; +// } int xe = _xe; int ye = _ye; final int selRow = getRowForLocation(xe, ye); Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalqueModel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalqueModel.java 2012-12-21 15:14:20 UTC (rev 8166) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalqueModel.java 2012-12-21 15:14:56 UTC (rev 8167) @@ -98,7 +98,7 @@ mustListen_ = _listener; calque_ = _calque; if ((calque_ != null) && (calque_.isGroupeCalque())) { - addGroupeCalque( calque_); + addGroupeCalque(calque_); } refresh(); } @@ -156,7 +156,7 @@ for (int i = _g.getComponentCount() - 1; i >= 0; i--) { final BCalque c = (BCalque) _g.getComponent(i); if (c.isGroupeCalque()) { - removeGroupeCalque( c); + removeGroupeCalque(c); } else { c.removePropertyChangeListener(this); } @@ -338,7 +338,7 @@ final BCalque c = (BCalque) _e.getChild(); if (mustListen_) { if (c.isGroupeCalque()) { - addGroupeCalque( c); + addGroupeCalque(c); } else { c.addPropertyChangeListener(this); } @@ -394,8 +394,8 @@ public void fillMenu(final BuMenu _m) { _m.addMenuItem(EbliResource.EBLI.getString("Centrer la vue"), getActCenter(), EbliResource.EBLI.getToolIcon("zoom-layer"), true, 0, this); - _m.addMenuItem(EbliResource.EBLI.getString("Visible"), "VISIBLE_OUI", null, true, 0, this); - _m.addMenuItem(EbliResource.EBLI.getString("Cach\xE9"), "VISIBLE_NON", BuResource.BU.getIcon("cacher"), true, 0, this); + _m.addMenuItem(EbliResource.EBLI.getString("Visible"), "VISIBLE_OUI", null, editable, 0, this); + _m.addMenuItem(EbliResource.EBLI.getString("Cach\xE9"), "VISIBLE_NON", BuResource.BU.getIcon("cacher"), editable, 0, this); _m.addSeparator(); _m.addMenuItem(EbliResource.EBLI.getString("S\xE9lectionnable"), "SET_SELECTABLE", EbliResource.EBLI.getIcon("fleche"), true, 0, this); @@ -413,10 +413,10 @@ _m.addSeparator(); _m.addMenuItem(EbliResource.EBLI.getString("En premier"), getActPrem(), EbliResource.EBLI.getIcon("enpremier"), true, 0, this); - _m.addMenuItem(CtuluLib.getS("Monter"), getActUp(), CtuluResource.CTULU.getIcon("monter"), true, 0, this); - _m.addMenuItem(CtuluLib.getS("Descendre"), getActDown(), CtuluResource.CTULU.getIcon("descendre"), true, 0, this); + _m.addMenuItem(CtuluLib.getS("Monter"), getActUp(), CtuluResource.CTULU.getIcon("monter"), editable, 0, this); + _m.addMenuItem(CtuluLib.getS("Descendre"), getActDown(), CtuluResource.CTULU.getIcon("descendre"), editable, 0, this); _m.addMenuItem(EbliResource.EBLI.getString("En dernier"), getActLast(), EbliResource.EBLI.getIcon("endernier"), - true, 0, this); + editable, 0, this); _m.addSeparator(); _m.add(new JMenuItem(actDelete_)); } @@ -428,8 +428,8 @@ public void fillMenu(final CtuluPopupMenu _m) { _m.addMenuItem(EbliResource.EBLI.getString("Centrer la vue"), getActCenter(), EbliResource.EBLI.getToolIcon("zoom-layer"), true, this); - _m.addMenuItem(EbliResource.EBLI.getString("Visible"), "VISIBLE_OUI", null, true, this); - final JMenuItem it = _m.addMenuItem(EbliResource.EBLI.getString("Cach\xE9"), "VISIBLE_NON", null, true, this); + _m.addMenuItem(EbliResource.EBLI.getString("Visible"), "VISIBLE_OUI", null, editable, this); + final JMenuItem it = _m.addMenuItem(EbliResource.EBLI.getString("Cach\xE9"), "VISIBLE_NON", null, editable, this); it.setIcon(BuResource.BU.getIcon("cacher")); _m.addSeparator(); _m.addMenuItem(EbliResource.EBLI.getString("S\xE9lectionnable"), "SET_SELECTABLE", EbliResource.EBLI.getIcon("fleche"), true, @@ -447,11 +447,11 @@ _m.addMenuItem(EbliResource.EBLI.getString("Actif"), "GELE_NON", null, true, this); _m.addSeparator(); _m.addMenuItem(EbliResource.EBLI.getString("En premier"), getActPrem(), EbliResource.EBLI.getIcon("enpremier"), - true, this); - _m.addMenuItem(CtuluLib.getS("Monter"), getActUp(), CtuluResource.CTULU.getIcon("monter"), true, this); - _m.addMenuItem(CtuluLib.getS("Descendre"), getActDown(), CtuluResource.CTULU.getIcon("descendre"), true, this); + editable, this); + _m.addMenuItem(CtuluLib.getS("Monter"), getActUp(), CtuluResource.CTULU.getIcon("monter"), editable, this); + _m.addMenuItem(CtuluLib.getS("Descendre"), getActDown(), CtuluResource.CTULU.getIcon("descendre"), editable, this); _m.addMenuItem(EbliResource.EBLI.getString("En dernier"), getActLast(), EbliResource.EBLI.getIcon("endernier"), - true, this); + editable, this); _m.addSeparator(); _m.add(new JMenuItem(actDelete_)); } @@ -479,7 +479,7 @@ final BCalqueInteraction ci = (BCalqueInteraction) _c; _m.addCheckBox(EbliResource.EBLI.getString("Gel\xE9"), "GELE", true, ci.isGele(), this); } - _m.addCheckBox(EbliResource.EBLI.getString("Visible"), "VISIBLE", true, _c.isVisible(), this); + _m.addCheckBox(EbliResource.EBLI.getString("Visible"), "VISIBLE", editable, _c.isVisible(), this); if (_c instanceof ZCalqueAffichageDonneesAbstract) { ZCalqueAffichageDonneesAbstract cq = (ZCalqueAffichageDonneesAbstract) _c; if (cq.canSetSelectable()) { @@ -492,17 +492,17 @@ if (_c.isMovable()) { _m.addSeparator(); _m.addMenuItem(EbliResource.EBLI.getString("En premier"), getActPrem(), EbliResource.EBLI.getIcon("enpremier"), - true, this); - _m.addMenuItem(CtuluLib.getS("Monter"), getActUp(), CtuluResource.CTULU.getIcon("monter"), true, this); - _m.addMenuItem(CtuluLib.getS("Descendre"), getActDown(), CtuluResource.CTULU.getIcon("descendre"), true, this); + editable, this); + _m.addMenuItem(CtuluLib.getS("Monter"), getActUp(), CtuluResource.CTULU.getIcon("monter"), editable, this); + _m.addMenuItem(CtuluLib.getS("Descendre"), getActDown(), CtuluResource.CTULU.getIcon("descendre"), editable, this); _m.addMenuItem(EbliResource.EBLI.getString("En dernier"), getActLast(), EbliResource.EBLI.getIcon("endernier"), - true, this); + editable, this); } if (_c.isTitleModifiable()) { - _m.addMenuItem(EbliResource.EBLI.getString("Renommer"), "RENAME", BuResource.BU.getIcon("renommer"), true, + _m.addMenuItem(EbliResource.EBLI.getString("Renommer"), "RENAME", BuResource.BU.getIcon("renommer"), editable, this); } - if (_c.isDestructible()) { + if (_c.isDestructible() && editable) { _m.addSeparator(); _m.add(new JMenuItem(actDelete_)); } @@ -681,7 +681,17 @@ fireTreeModelStructureEvent(null); selection_.setSelectionPath(p); } + boolean editable = true; + public void setEditable(boolean editable) { + this.editable = editable; + editableChanged(); + } + + public boolean isEditable() { + return editable; + } + public final void refresh() { final BCalque p = getSelectedCalque(); final TreeModelEvent ev = new TreeModelEvent(this, new Object[]{calque_}); Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2012-12-21 15:14:20 UTC (rev 8166) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2012-12-21 15:14:56 UTC (rev 8167) @@ -473,7 +473,12 @@ public void setCacheManager(BCalqueCacheManager cacheManager) { this.cacheManager = cacheManager; + } + protected void clearCache() { + if (cacheManager != null) { + cacheManager.clearCache(); + } } public RenderingHints getRenderingHintsToUse(Graphics2D graphics2D) { @@ -507,16 +512,12 @@ if (painted_) { final Graphics2D graphics2D = (Graphics2D) _g; - // RenderingHints old=graphics2D.getRenderingHints(); if (cacheManager != null) { cacheManager.paintDonnees(_g); } else { paintDonnees(graphics2D, getVersEcran(), getVersReel(), getClipReel(_g)); } paintTransient(graphics2D, getVersEcran(), getVersReel(), getClipReel(_g)); - // if (old != null) { - // graphics2D.setRenderingHints(old); - // } } } @@ -658,7 +659,7 @@ @Override public void setPaletteCouleurPlages(final BPalettePlageInterface _newPlage) { if (_newPlage == null) { - paletteCouleur_=null; + paletteCouleur_ = null; } else { if (paletteCouleur_ == null) { if (isDiscrete()) { Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2012-12-21 15:14:20 UTC (rev 8166) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2012-12-21 15:14:56 UTC (rev 8167) @@ -66,6 +66,27 @@ protected void initTraceForAtomics(TraceIconModel iconeModel, int idxPoly, int idxVertexInPoly) { } + public void clearCacheAndRepaint() { + /* + * A chaque changement de valeur d'un attribut, tout est redessin\xE9. On pourrai faire quelque chose de plus optimis\xE9 comme un + * repaint seulement quand la valeur de visibilit\xE9 est modifi\xE9 et pas dans les autres cas. + */ + if (!massiveOperationRunning) { + clearCache(); + repaint(0); + } + } + private boolean massiveOperationRunning; + + protected void startMassiveOperation() { + massiveOperationRunning = true; + } + + protected void stopMassiveOperation() { + massiveOperationRunning = false; + clearCacheAndRepaint(); + } + /** * Une enumearion pour le mode de selection */ @@ -107,6 +128,9 @@ * @param _modele le modele du calque */ public ZCalqueGeometry(final M _modele) { + if (modele_ != null) { + modele_.removeModelListener(this); + } modele_ = _modele; if (modele_ != null) { modele_.addModelListener(this); @@ -503,12 +527,15 @@ * @param _att L'attribut. Si Null : Pas d'affichage de labels. */ public void setAttributForLabels(GISAttributeInterface _att) { + if (_att == attrLabels_) { + return; + } if (_att == null || !_att.isAtomicValue()) { attrLabels_ = null; } else { attrLabels_ = _att; } - repaint(); + clearCacheAndRepaint(); } /** @@ -1444,11 +1471,8 @@ @Override public void attributeValueChangeAction(Object _source, int _indexAtt, GISAttributeInterface _att, int _indexGeom, Object _newValue) { - /* - * A chaque changement de valeur d'un attribut, tout est redessin\xE9. On pourrai faire quelque chose de plus optimis\xE9 comme un - * repaint seulement quand la valeur de visibilit\xE9 est modifi\xE9 et pas dans les autres cas. - */ - repaint(); + + clearCacheAndRepaint(); } @Override @@ -1461,6 +1485,6 @@ // Une g\xE9om\xE9trie a \xE9t\xE9 ajout\xE9e, supprim\xE9e ou ses points la composant ont \xE9t\xE9 // modifi\xE9s, donc on repaint le tout. - repaint(); + clearCacheAndRepaint(); } } Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/action/TreeDeleteCalqueAction.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/action/TreeDeleteCalqueAction.java 2012-12-21 15:14:20 UTC (rev 8166) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/action/TreeDeleteCalqueAction.java 2012-12-21 15:14:56 UTC (rev 8167) @@ -17,6 +17,7 @@ /** * Une action pour d\xE9truire un ou plusieurs calque sur un arbre. + * * @author Bertrand Marchand * @version $Id$ */ @@ -26,16 +27,25 @@ /** * Construit l'action. + * * @param _treeModel Le modele d'arbre. */ public TreeDeleteCalqueAction(BArbreCalqueModel _treeModel) { super(EbliLib.getS("D\xE9truire"), EbliResource.EBLI.getIcon("detruire"), "DETRUIRE"); - treeModel_=_treeModel; + treeModel_ = _treeModel; } - + @Override + public void updateStateBeforeShow() { + super.updateStateBeforeShow(); + setEnabled(treeModel_ != null && treeModel_.isEditable()); + } + + @Override public void actionPerformed(final ActionEvent _e) { - if (treeModel_==null) return; + if (treeModel_ == null || !treeModel_.isEditable()) { + return; + } final BCalque[] c = treeModel_.getSelection(); if (c.length == 0) { Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZCalqueMultiPointEditable.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZCalqueMultiPointEditable.java 2012-12-21 15:14:20 UTC (rev 8166) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZCalqueMultiPointEditable.java 2012-12-21 15:14:56 UTC (rev 8167) @@ -29,6 +29,7 @@ /** * Un calque pour les multipoints editables. + * * @author Bertrand Marchand * @version $Id$ */ @@ -38,6 +39,7 @@ /** * Le seul constructeur, avec le modele \xE9ditable. + * * @param _modele * @param _editor */ @@ -64,7 +66,6 @@ // // return getModelePoly().splitGeometry(idxLine, idxSel, _cmd); // } - // /** // * Joint 2 polylignes par leurs sommets d\xE9sign\xE9s. // * @@ -85,37 +86,50 @@ // clearSelection(); // return getModelePoly().joinGeometries(idxLines, idxSels, _cmd)!=-1; // } - @Override public boolean addAtome(final GrPoint _ptReel, final CtuluCommandContainer _cmd, final CtuluUI _ui) { - if (getSelectionMode() == SelectionMode.SEGMENT || getNbSelected()!=1) return false; - - int idx; - if (getSelectionMode() == SelectionMode.ATOMIC) - idx=selectionMulti_.getIdxSelected()[0]; - else - idx=selection_.getMinIndex(); + if (getSelectionMode() == SelectionMode.SEGMENT || getNbSelected() != 1) { + return false; + } + startMassiveOperation(); + try { + int idx; + if (getSelectionMode() == SelectionMode.ATOMIC) { + idx = selectionMulti_.getIdxSelected()[0]; + } else { + idx = selection_.getMinIndex(); + } - int idxBefore=modeleDonnees().getGeomData().getGeometry(idx).getNumGeometries()-1; - ((ZModeleMultiPointEditable)modele_).addAtomic(idx,idxBefore, _ptReel.x_, _ptReel.y_, _ptReel.z_, _cmd); + int idxBefore = modeleDonnees().getGeomData().getGeometry(idx).getNumGeometries() - 1; + ((ZModeleMultiPointEditable) modele_).addAtomic(idx, idxBefore, _ptReel.x_, _ptReel.y_, _ptReel.z_, _cmd); + } finally { + stopMassiveOperation(); + } return true; } @Override public boolean addForme(final GrObjet _o, final int _deforme, final CtuluCommandContainer _cmd, final CtuluUI _ui, - final ZEditionAttributesDataI _data) { + final ZEditionAttributesDataI _data) { if (_deforme == DeForme.MULTI_POINT) { - GrPolyligne gr=(GrPolyligne)_o; - GISMultiPoint poly = (GISMultiPoint) GISGeometryFactory.INSTANCE.createMultiPoint( - GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create(gr.sommets_.createCoordinateSequence(false))); - return modeleDonnees().addGeometry(poly, _cmd, _ui, _data); + boolean added = false; + startMassiveOperation(); + try { + GrPolyligne gr = (GrPolyligne) _o; + GISMultiPoint poly = (GISMultiPoint) GISGeometryFactory.INSTANCE.createMultiPoint( + GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create(gr.sommets_.createCoordinateSequence(false))); + added = modeleDonnees().addGeometry(poly, _cmd, _ui, _data); + } finally { + stopMassiveOperation(); + } + return added; } return false; } - + @Override public boolean canAddForme(int _typeForme) { - return _typeForme==DeForme.MULTI_POINT; + return _typeForme == DeForme.MULTI_POINT; } @Override @@ -130,6 +144,7 @@ /** * Retourne l'\xE9diteur pour les objets selectionn\xE9s. + * * @return L'editeur. Peut \xEAtre null. */ @Override @@ -137,12 +152,11 @@ return editor_; } - @Override public ZModeleMultiPointEditable modeleDonnees() { - return (ZModeleMultiPointEditable)modele_; + return (ZModeleMultiPointEditable) modele_; } - + @Override public ZModeleEditable getModelEditable() { return modeleDonnees(); @@ -152,16 +166,21 @@ * @deprecated Use {@link #modeleDonnees()} instead */ private ZModeleMultiPointEditable getMultiPointModel() { - return (ZModeleMultiPointEditable)modele_; + return (ZModeleMultiPointEditable) modele_; } @Override public boolean moveSelectedObjects(final double _reelDx, final double _reelDy, final double _reelDz, final CtuluCommandContainer _cmd, final CtuluUI _ui) { if (!isSelectionEmpty()) { - if (getSelectionMode() == SelectionMode.ATOMIC) { - modeleDonnees().moveAtomics(selectionMulti_, _reelDx, _reelDy, _reelDz, _cmd, _ui); - } else { - modeleDonnees().moveGeometries(selection_, _reelDx, _reelDy, _reelDz, _cmd); + startMassiveOperation(); + try { + if (getSelectionMode() == SelectionMode.ATOMIC) { + modeleDonnees().moveAtomics(selectionMulti_, _reelDx, _reelDy, _reelDz, _cmd, _ui); + } else { + modeleDonnees().moveGeometries(selection_, _reelDx, _reelDy, _reelDz, _cmd); + } + } finally { + stopMassiveOperation(); } } @@ -174,10 +193,15 @@ @Override public boolean rotateSelectedObjects(double _angRad, double _xreel0, double _yreel0, CtuluCommandContainer _cmd, CtuluUI _ui) { if (!isSelectionEmpty()) { - if (getSelectionMode() == SelectionMode.ATOMIC) { - modeleDonnees().rotateAtomics(selectionMulti_, _angRad, _xreel0, _yreel0, _cmd, _ui); - } else { - modeleDonnees().rotateGeometries(selection_, _angRad, _xreel0, _yreel0, _cmd); + startMassiveOperation(); + try { + if (getSelectionMode() == SelectionMode.ATOMIC) { + modeleDonnees().rotateAtomics(selectionMulti_, _angRad, _xreel0, _yreel0, _cmd, _ui); + } else { + modeleDonnees().rotateGeometries(selection_, _angRad, _xreel0, _yreel0, _cmd); + } + } finally { + stopMassiveOperation(); } } return false; @@ -202,17 +226,21 @@ */ @Override public boolean copySelectedObjects(CtuluCommandContainer _cmd, CtuluUI _ui) { - if (isSelectionEmpty() || (getSelectionMode() != SelectionMode.NORMAL)) return false; - int nb=modeleDonnees().getNombre(); + if (isSelectionEmpty() || (getSelectionMode() != SelectionMode.NORMAL)) { + return false; + } + int nb = modeleDonnees().getNombre(); - GrSegment pdec=new GrSegment(new GrPoint(0,5,0),new GrPoint(5,0,0)); + GrSegment pdec = new GrSegment(new GrPoint(0, 5, 0), new GrPoint(5, 0, 0)); pdec.autoApplique(getVersReel()); - if (!modeleDonnees().copyGlobal(selection_, 0/*pdec.getVx()*/, 0/*pdec.getVy()*/, _cmd)) return false; - + if (!modeleDonnees().copyGlobal(selection_, 0/*pdec.getVx()*/, 0/*pdec.getVy()*/, _cmd)) { + return false; + } + // Changement de selection. - int[] isels=new int[selection_.getNbSelectedIndex()]; - for (int i=0; i<isels.length; i++) { - isels[i]=nb+i; + int[] isels = new int[selection_.getNbSelectedIndex()]; + for (int i = 0; i < isels.length; i++) { + isels[i] = nb + i; } setSelection(isels); return true; @@ -220,23 +248,31 @@ /** * Scinde en 2 une multipoint dont plusieurs sommets sont s\xE9lectionn\xE9s. Les attributs sont copi\xE9s. + * * @param _cmd La pile de commandes. * @return true si le multipoint a \xE9t\xE9 scind\xE9e. */ @Override public boolean splitSelectedObject(CtuluCommandContainer _cmd, CtuluUI _ui) { - if (isSelectionEmpty() || (getSelectionMode() != SelectionMode.ATOMIC)) return false; - - int idxGeom=selectionMulti_.getIdxSelected()[0]; - int[] idxSels=selectionMulti_.get(idxGeom).getSelectedIndex(); + if (isSelectionEmpty() || (getSelectionMode() != SelectionMode.ATOMIC)) { + return false; + } + startMassiveOperation(); + try { + int idxGeom = selectionMulti_.getIdxSelected()[0]; + int[] idxSels = selectionMulti_.get(idxGeom).getSelectedIndex(); - // On vide la selection, le multipoint est supprim\xE9es par le split. - clearSelection(); - return modeleDonnees().splitGeometry(idxGeom, idxSels, _cmd)!=null; + // On vide la selection, le multipoint est supprim\xE9es par le split. + clearSelection(); + return modeleDonnees().splitGeometry(idxGeom, idxSels, _cmd) != null; + } finally { + stopMassiveOperation(); + } } /** * Dessine le deplacement pour les sommets selectionn\xE9s. + * * @param _g2d Le contexte graphique. * @param _dx Le delta suivant X * @param _dy Le delta suivant Y @@ -299,6 +335,7 @@ /** * Dessine le deplacement pour les geometries s\xE9lectionn\xE9es. + * * @param _g2d Le contexte graphique. * @param _dx Le delta suivant X * @param _dy Le delta suivant Y @@ -352,50 +389,65 @@ return false; } boolean r = false; - if (getSelectionMode() == SelectionMode.ATOMIC) { - r = modeleDonnees().removeAtomics(selectionMulti_,_cmd, _ui); - } else { - final int[] idx = selection_.getSelectedIndex(); - super.clearSelection(); - r = modeleDonnees().removeGeometries(idx, _cmd); + startMassiveOperation(); + try { + if (getSelectionMode() == SelectionMode.ATOMIC) { + r = modeleDonnees().removeAtomics(selectionMulti_, _cmd, _ui); + } else { + final int[] idx = selection_.getSelectedIndex(); + super.clearSelection(); + r = modeleDonnees().removeGeometries(idx, _cmd); + } + } finally { + stopMassiveOperation(); } if (r) { super.clearSelection(); - repaint(); } return r; } /** * Definit l'\xE9diteur pour les objets selectionn\xE9s. + * * @param _editor L'editeur. */ @Override public final void setEditor(final ZEditorInterface _editor) { editor_ = _editor; } - + /** * Joint 2 semis de points. - * + * * @param _cmd La pile de commandes. * @return true si les semis de points ont \xE9t\xE9 jointes. */ @Override public boolean joinSelectedObjects(final CtuluCommandContainer _cmd, CtuluUI _ui) { - if (isSelectionEmpty()) + if (isSelectionEmpty()) { return false; - + } + int[] idxSemis; - if(isAtomicMode()) - idxSemis=selectionMulti_.getIdxSelected(); - else - idxSemis=selection_.getSelectedIndex(); - if(idxSemis.length!=2) + if (isAtomicMode()) { + idxSemis = selectionMulti_.getIdxSelected(); + } else { + idxSemis = selection_.getSelectedIndex(); + } + if (idxSemis.length != 2) { return false; - + } + // On vide la selection, les 2 semis sont supprim\xE9es par la jonction. clearSelection(); - return modeleDonnees().joinGeometries(idxSemis, _cmd)!=-1; + boolean res = false; + startMassiveOperation(); + try { + res = modeleDonnees().joinGeometries(idxSemis, _cmd) != -1; + } finally { + stopMassiveOperation(); + } + return res; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2013-01-03 13:44:43
|
Revision: 8170 http://fudaa.svn.sourceforge.net/fudaa/?rev=8170&view=rev Author: deniger Date: 2013-01-03 13:44:37 +0000 (Thu, 03 Jan 2013) Log Message: ----------- ajout methode utilitaire pour r?\195?\169cuperer la couleur correspondant au propri?\195?\169t?\195?\169 attenue et alpha Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalqueAffichage.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalqueAffichage.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalqueAffichage.java 2013-01-03 11:09:50 UTC (rev 8169) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalqueAffichage.java 2013-01-03 13:44:37 UTC (rev 8170) @@ -14,6 +14,7 @@ import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JPopupMenu; +import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.commun.EbliUIProperties; import org.fudaa.ebli.controle.BConfigurableInterface; import org.fudaa.ebli.controle.BConfigurableSingleSection; @@ -44,6 +45,8 @@ public BConfigurableInterface getSingleConfigureInterface() { return new BConfigurableSingleSection(new BCalqueSectionConfigure(this)); } + + public boolean isLegendProperitesSet() { return legendProperties_ != null; Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2013-01-03 11:09:50 UTC (rev 8169) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2013-01-03 13:44:37 UTC (rev 8170) @@ -130,6 +130,15 @@ return modeleDonnees() != null; } + protected Color getColorWithAttenuAlpha(Color init) { + if (isAttenue()) { + return EbliLib.getAlphaColor(attenueCouleur(init), alpha_); + } else if (EbliLib.isAlphaChanged(alpha_)) { + return EbliLib.getAlphaColor(init, alpha_); + } + return init; + } + @Override public boolean isSelectable() { return isSelectable_; Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2013-01-03 11:09:50 UTC (rev 8169) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2013-01-03 13:44:37 UTC (rev 8170) @@ -23,9 +23,8 @@ import org.fudaa.ebli.trace.TraceLigneModel; /** - * Un calque g\xE9rant des lignes bris\xE9es, ouvertes ou ferm\xE9es \xE0 un niveau global ou atomique.<p> Le niveau atomique des lignes - * bris\xE9es est le niveau points. Le calque s'appuie sur un mod\xE8le - * {@link ZModeleLigneBrisee}. + * Un calque g\xE9rant des lignes bris\xE9es, ouvertes ou ferm\xE9es \xE0 un niveau global ou atomique.<p> Le niveau atomique des lignes bris\xE9es est le niveau + * points. Le calque s'appuie sur un mod\xE8le {@link ZModeleLigneBrisee}. * * @author Fred Deniger * @version $Id$ @@ -82,11 +81,7 @@ protected void initTrace(final TraceLigneModel _ligne, final int _idxPoly) { final int idx = modele_.isGeometryFermee(_idxPoly) ? 0 : 1; _ligne.updateData(getLineModel(idx)); - if (isAttenue()) { - _ligne.setCouleur(EbliLib.getAlphaColor(attenueCouleur(_ligne.getCouleur()), alpha_)); - } else if (EbliLib.isAlphaChanged(alpha_)) { - _ligne.setCouleur(EbliLib.getAlphaColor(_ligne.getCouleur(), alpha_)); - } + _ligne.setCouleur(getColorWithAttenuAlpha(_ligne.getCouleur())); } public static void initTraceWithAlpha(TraceIconModel model, int alpha) { @@ -108,12 +103,7 @@ protected void initTrace(final TraceIconModel _icon, final int _idxPoly) { final int idx = modele_.isGeometryFermee(_idxPoly) ? 0 : 1; _icon.updateData(getIconModel(idx)); - if (isAttenue()) { - _icon.setCouleur(EbliLib.getAlphaColor(attenueCouleur(_icon.getCouleur()), alpha_)); - } else if (EbliLib.isAlphaChanged(alpha_)) { - _icon.setCouleur(EbliLib.getAlphaColor(_icon.getCouleur(), alpha_)); - } - + _icon.setCouleur(getColorWithAttenuAlpha(_icon.getCouleur())); } @Override @@ -189,7 +179,7 @@ */ @Override public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { + final GrBoite _clipReel) { if ((modele_ == null) || (modele_.getNombre() <= 0)) { return; } @@ -319,6 +309,7 @@ /** * To be used to update clip before painting a line + * * @param _g * @param oldClip clip at the beginning of paintDonnees. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2013-01-10 14:14:30
|
Revision: 8195 http://fudaa.svn.sourceforge.net/fudaa/?rev=8195&view=rev Author: deniger Date: 2013-01-10 14:14:23 +0000 (Thu, 10 Jan 2013) Log Message: ----------- Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java Added Paths: ----------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometryLabelConfigure.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2013-01-10 14:12:46 UTC (rev 8194) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesAbstract.java 2013-01-10 14:14:23 UTC (rev 8195) @@ -407,12 +407,15 @@ setSurfaceModel(i, (TraceSurfaceModel) _p.get(prop)); } } - + if (_p.isDefined("calque.paletteCouleurUsed")) { + isPaletteCouleurUsed_ = _p.getBoolean("calque.paletteCouleurUsed"); + } if (_p.isDefined("calque.paletteCouleur")) { final BPalettePlageInterface newPalette = createPaletteCouleur(); newPalette.load((BPalettePlageProperties) _p.get("calque.paletteCouleur")); - setPaletteCouleurPlages(newPalette); + setPaletteCouleurPlages(newPalette, false); } + } } @@ -634,6 +637,7 @@ if (isAntialiasSupported()) { res.put("calque.antialias", Boolean.valueOf(antialiasing_)); } + res.put("calque.paletteCouleurUsed", isPaletteCouleurUsed_); return res; } @@ -693,6 +697,10 @@ @Override public void setPaletteCouleurPlages(final BPalettePlageInterface _newPlage) { + setPaletteCouleurPlages(_newPlage, true); + } + + private void setPaletteCouleurPlages(final BPalettePlageInterface _newPlage, boolean updatePaletteCouleurProp) { if (_newPlage == null) { paletteCouleur_ = null; } else { @@ -708,7 +716,9 @@ paletteCouleur_.initFrom(_newPlage); } } - isPaletteCouleurUsed_ = (paletteCouleur_ != null) && paletteCouleur_.getNbPlages() > 0; + if (updatePaletteCouleurProp) { + isPaletteCouleurUsed_ = (paletteCouleur_ != null) && paletteCouleur_.getNbPlages() > 0; + } construitLegende(); firePropertyChange("paletteCouleur", null, paletteCouleur_); repaint(); Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2013-01-10 14:12:46 UTC (rev 8194) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2013-01-10 14:14:23 UTC (rev 8195) @@ -7,6 +7,7 @@ */ package org.fudaa.ebli.calque; +import com.memoire.bu.BuLib; import com.memoire.fu.FuLog; import com.vividsolutions.jts.algorithm.SIRtreePointInRing; import com.vividsolutions.jts.geom.Coordinate; @@ -18,10 +19,13 @@ import gnu.trove.TIntArrayList; import gnu.trove.TIntObjectIterator; import java.awt.Color; +import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; +import org.apache.commons.lang.ObjectUtils; +import org.apache.commons.lang.StringUtils; import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.CtuluRange; @@ -42,6 +46,8 @@ import org.fudaa.ebli.commun.EbliSelectionMode; import org.fudaa.ebli.commun.EbliSelectionState; import org.fudaa.ebli.commun.EbliUIProperties; +import org.fudaa.ebli.controle.BConfigurableComposite; +import org.fudaa.ebli.controle.BConfigurableInterface; import org.fudaa.ebli.find.EbliFindActionInterface; import org.fudaa.ebli.find.EbliFindExpressionContainerInterface; import org.fudaa.ebli.geometrie.GrBoite; @@ -87,6 +93,66 @@ clearCacheAndRepaint(); } + public void paintLines(final GrBoite _clipReel, final GrMorphisme _versEcran, final Graphics2D _g) { + final GrBoite clip = _clipReel; + final GrMorphisme versEcran = _versEcran; + final int nombre = modele_.getNombre(); + + final TraceLigne tl; + if (isRapide()) { + tl = new TraceLigne(TraceLigne.LISSE, 1, ligneModel_.getCouleur()); + } else { + tl = ligneModel_.buildCopy(); + } + + final GrBoite bPoly = new GrBoite(); + bPoly.o_ = new GrPoint(); + bPoly.e_ = new GrPoint(); + + // on part de la fin : comme ca la premiere ligne apparait au-dessus + for (int i = nombre - 1; i >= 0; i--) { + if (!isPainted(i, _versEcran)//dans certains cas, ne pas dessiner l'objet + || !modele_.isGeometryReliee(i)) { + continue; + } + + // il n'y a pas de points pour cette g\xE9om\xE9trie + final int nbPoints = modele_.getNbPointForGeometry(i); + if (nbPoints <= 0) { + continue; + } + + modele_.getDomaineForGeometry(i, bPoly); + // Si la boite du polygone n'est pas dans la boite d'affichage on passe + if (bPoly.intersectionXY(clip) == null) { + continue; + } + + final GrPoint ptOri = new GrPoint(); + modele_.point(ptOri, i, nbPoints - 1); + ptOri.autoApplique(versEcran); + + if (!isRapide()) { + initTrace(ligneModel_, i); + } + final GrPoint ptDest = new GrPoint(); + for (int j = nbPoints - 2; j >= 0; j--) { + // le point de dest est initialise + modele_.point(ptDest, i, j); + ptDest.autoApplique(versEcran); + tl.dessineTrait(_g, ptOri.x_, ptOri.y_, ptDest.x_, ptDest.y_); + ptOri.initialiseAvec(ptDest); + } + if (modele_.isGeometryFermee(i)) { + modele_.point(ptOri, i, nbPoints - 1); + ptOri.autoApplique(versEcran); + tl.dessineTrait(_g, ptOri.x_, ptOri.y_, ptDest.x_, ptDest.y_); + } + modele_.point(ptOri, i, nbPoints - 1); + ptOri.autoApplique(versEcran); + } + } + /** * Une enumearion pour le mode de selection */ @@ -117,11 +183,39 @@ * L'attribut utilis\xE9 pour afficher les labels */ protected GISAttributeInterface attrLabels_ = null; + private Color labelsForegroundColor = Color.BLACK; + private Color labelsBackgroundColor = Color.WHITE; /** * Le finder pour une recherche sur le calque */ protected CalqueFindActionAtomic finder_; + public void setLabelsForegroundColor(Color labelsForegroundColor) { + if (!ObjectUtils.equals(this.labelsForegroundColor, labelsForegroundColor)) { + Color old = this.labelsForegroundColor; + this.labelsForegroundColor = labelsForegroundColor; + repaint(); + firePropertyChange(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_FOREGROUND, old, labelsForegroundColor); + } + } + + public void setLabelsBackgroundColor(Color labelsBackgroundColor) { + if (!ObjectUtils.equals(this.labelsBackgroundColor, labelsBackgroundColor)) { + Color old = this.labelsBackgroundColor; + this.labelsBackgroundColor = labelsBackgroundColor; + repaint(); + firePropertyChange(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_FOREGROUND, old, labelsBackgroundColor); + } + } + + public Color getLabelsBackgroundColor() { + return labelsBackgroundColor; + } + + public Color getLabelsForegroundColor() { + return labelsForegroundColor; + } + /** * Le seul constructeur, avec le mod\xE8le. * @@ -137,6 +231,7 @@ } iconModel_ = new TraceIconModel(TraceIcon.CARRE_PLEIN, 2, Color.BLACK); mode = SelectionMode.NORMAL; + setFont(BuLib.DEFAULT_FONT); } protected EbliListeSelectionMulti creeSelectionMulti() { @@ -453,12 +548,28 @@ } @Override + public EbliUIProperties saveUIProperties() { + EbliUIProperties properties = super.saveUIProperties(); + properties.put(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_BACKGROUND, labelsBackgroundColor); + properties.put(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_FOREGROUND, labelsForegroundColor); + return properties; + } + + @Override public void initFrom(final EbliUIProperties _p) { if (_p != null) { super.initFrom(_p); if (_p.isDefined("calqueGIS.ligneModel")) { setLineModel(0, (TraceLigneModel) _p.get("calqueGIS.ligneModel")); } + if (_p.isDefined(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_BACKGROUND)) { + setLabelsBackgroundColor((Color) _p.get(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_BACKGROUND)); + } + if (_p.isDefined(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_FOREGROUND)) { + setLabelsForegroundColor((Color) _p.get(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_FOREGROUND)); + } + + } } @@ -542,6 +653,17 @@ clearCacheAndRepaint(); } + @Override + protected BConfigurableInterface getAffichageConf() { + final BConfigurableInterface[] sect = new BConfigurableInterface[3 + getNbSet()]; + sect[0] = new ZCalqueAffichageDonneesConfigure(this); + sect[1] = new ZCalqueGeometryLabelConfigure(this); + for (int i = 2; i < sect.length; i++) { + sect[i] = new ZCalqueAffichageDonneesTraceConfigure(this, i - 2); + } + return new BConfigurableComposite(sect, EbliLib.getS("Affichage")); + } + /** * Indique si la s\xE9lection est vide. * @@ -595,65 +717,8 @@ // Trac\xE9 des surfaces paintSurfaces(_g, _versEcran, _versReel, _clipReel); + paintLines(_clipReel, _versEcran, _g); - final GrBoite clip = _clipReel; - final GrMorphisme versEcran = _versEcran; - final int nombre = modele_.getNombre(); - - final TraceLigne tl; - if (isRapide()) { - tl = new TraceLigne(TraceLigne.LISSE, 1, ligneModel_.getCouleur()); - } else { - tl = ligneModel_.buildCopy(); - } - - final GrBoite bPoly = new GrBoite(); - bPoly.o_ = new GrPoint(); - bPoly.e_ = new GrPoint(); - - // on part de la fin : comme ca la premiere ligne apparait au-dessus - for (int i = nombre - 1; i >= 0; i--) { - if (!isPainted(i, _versEcran)//dans certains cas, ne pas dessiner l'objet - || !modele_.isGeometryReliee(i)) { - continue; - } - - // il n'y a pas de points pour cette g\xE9om\xE9trie - final int nbPoints = modele_.getNbPointForGeometry(i); - if (nbPoints <= 0) { - continue; - } - - modele_.getDomaineForGeometry(i, bPoly); - // Si la boite du polygone n'est pas dans la boite d'affichage on passe - if (bPoly.intersectionXY(clip) == null) { - continue; - } - - final GrPoint ptOri = new GrPoint(); - modele_.point(ptOri, i, nbPoints - 1); - ptOri.autoApplique(versEcran); - - if (!isRapide()) { - initTrace(ligneModel_, i); - } - final GrPoint ptDest = new GrPoint(); - for (int j = nbPoints - 2; j >= 0; j--) { - // le point de dest est initialise - modele_.point(ptDest, i, j); - ptDest.autoApplique(versEcran); - tl.dessineTrait(_g, ptOri.x_, ptOri.y_, ptDest.x_, ptDest.y_); - ptOri.initialiseAvec(ptDest); - } - if (modele_.isGeometryFermee(i)) { - modele_.point(ptOri, i, nbPoints - 1); - ptOri.autoApplique(versEcran); - tl.dessineTrait(_g, ptOri.x_, ptOri.y_, ptDest.x_, ptDest.y_); - } - modele_.point(ptOri, i, nbPoints - 1); - ptOri.autoApplique(versEcran); - } - // Les icones sur les atomiques paintIconsOnAtomics(_g, _versEcran, _versReel, _clipReel); // Enfin les labels sur les atomiques. @@ -800,20 +865,20 @@ protected void paintLabelsOnAtomics(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, final GrBoite _clipReel) { - final GrBoite clip = _clipReel; - final GrMorphisme versEcran = _versEcran; - final int nombre = modele_.getNombre(); - final GrBoite bPoly = new GrBoite(); - if (attrLabels_ != null && !isRapide()) { GISZoneCollection geomData = modeleDonnees().getGeomData(); int idxLabels = geomData.getIndiceOf(attrLabels_); if (idxLabels != -1) { + final Color fgColor = labelsForegroundColor; + final Color bgColor = labelsBackgroundColor; + Font old = _g.getFont(); + _g.setFont(getFont()); final FontMetrics fm = _g.getFontMetrics(); - final Color fgColor = _g.getColor(); - final Color bgColor = getBackground(); - + final GrMorphisme versEcran = _versEcran; + final int nombre = modele_.getNombre(); + int w = getWidth() + 1; + CtuluListSelection memory = new CtuluListSelection(w * getHeight()); for (int i = nombre - 1; i >= 0; i--) { // il n'y a pas de points pour cette ligne if (modele_.getNbPointForGeometry(i) <= 0) { @@ -824,12 +889,7 @@ continue; } - modele_.getDomaineForGeometry(i, bPoly); - // Si la boite du polygone n'est pas dans la boite d'affichage on - // passe - if (bPoly.intersectionXY(clip) == null) { - continue; - } + final int nbPoints = modele_.getNbPointForGeometry(i); if (nbPoints <= 0) { continue; @@ -843,27 +903,35 @@ if (!_clipReel.contientXY(ptDest)) { continue; } + int idxOnScreen = (int) ptDest.x_ + (int) ptDest.y_ * w; + //pour \xE9viter de redessiner le texte au m\xEAme endroit: + if (idxOnScreen >= 0 && !memory.isSelected(idxOnScreen)) { + memory.add(idxOnScreen); + Object o = mdl.getObjectValueAt(j); + if (o == null) { + continue; + } + String s = o.toString().trim(); + if (StringUtils.isBlank(s)) { + continue; + } - Object o = mdl.getObjectValueAt(j); - if (o == null) { - continue; + ptDest.autoApplique2D(versEcran); + final Rectangle2D rec = fm.getStringBounds(s, _g); + double x = ptDest.x_ - rec.getWidth() / 2; + double y = ptDest.y_ - 5; + rec.setFrame(x, y - fm.getAscent(), rec.getWidth(), fm.getAscent() + 2); + if (bgColor != null) { + _g.setColor(bgColor); + _g.fill(rec); + } + _g.setColor(fgColor); + _g.drawString(s, (int) x, (int) y); } - String s = o.toString().trim(); - if (s.equals("")) { - continue; - } - - ptDest.autoApplique2D(versEcran); - final Rectangle2D rec = fm.getStringBounds(s, _g); - double x = ptDest.x_ - rec.getWidth() / 2; - double y = ptDest.y_ - 5; - rec.setFrame(x, y - fm.getAscent(), rec.getWidth(), fm.getAscent() + 2); - _g.setColor(bgColor); - _g.fill(rec); - _g.setColor(fgColor); - _g.drawString(s, (int) x, (int) y); } } + _g.setFont(old); + } } } @@ -1481,18 +1549,10 @@ return null; } - /* - * (non-Javadoc) @see org.fudaa.ctulu.gis.AttributeListener#attributeAction(java.lang.Object, int, - * org.fudaa.ctulu.gis.GISAttributeInterface, int) - */ @Override public void attributeAction(Object _source, int _indexAtt, GISAttributeInterface _att, int _action) { } - /* - * (non-Javadoc) @see org.fudaa.ctulu.gis.AttributeListener#attributeValueChangeAction(java.lang.Object, int, - * org.fudaa.ctulu.gis.GISAttributeInterface, int, java.lang.Object) - */ @Override public void attributeValueChangeAction(Object _source, int _indexAtt, GISAttributeInterface _att, int _indexGeom, Object _newValue) { Copied: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometryLabelConfigure.java (from rev 7853, trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueAffichageDonneesConfigure.java) =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometryLabelConfigure.java (rev 0) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometryLabelConfigure.java 2013-01-10 14:14:23 UTC (rev 8195) @@ -0,0 +1,81 @@ +/* + * @creation 9 nov. 06 + * @modification $Date: 2007-05-04 13:49:43 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail de...@fu... + */ +package org.fudaa.ebli.calque; + +import java.awt.Color; +import java.awt.Font; +import java.util.ArrayList; +import java.util.List; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.controle.BSelecteurColorChooserBt; +import org.fudaa.ebli.controle.BSelecteurFont; +import org.fudaa.ebli.controle.BSelecteurInterface; +import org.fudaa.ebli.controle.BSelecteurReduitFonteNewVersion; + +/** + * @author fred deniger + * @version $Id: ZCalqueAffichageDonneesConfigure.java,v 1.4 2007-05-04 13:49:43 deniger Exp $ + */ +public class ZCalqueGeometryLabelConfigure extends BCalqueConfigureSectionAbstract { + + public static final String PROPERTY_LABELS_FOREGROUND = "labelsForegroundColor"; + public static final String PROPERTY_LABELS_BACKGROUND = "labelsBackgroundColor"; + + public ZCalqueGeometryLabelConfigure(final ZCalqueGeometry _target, final boolean _addVisible) { + super(_target, EbliLib.getS("Labels")); + } + + public ZCalqueGeometryLabelConfigure(final ZCalqueGeometry _target) { + this(_target, false); + } + + @Override + public boolean setProperty(final String _key, final Object _newProp) { + if (BSelecteurReduitFonteNewVersion.PROPERTY.equals(_key)) { + ((ZCalqueAffichageDonneesAbstract) target_).setFont(((Font) _newProp)); + return true; + } + if (PROPERTY_LABELS_FOREGROUND.equals(_key)) { + ((ZCalqueGeometry) target_).setLabelsForegroundColor(((Color) _newProp)); + return true; + } + if (PROPERTY_LABELS_BACKGROUND.equals(_key)) { + ((ZCalqueGeometry) target_).setLabelsBackgroundColor(((Color) _newProp)); + return true; + } + return false; + } + + @Override + public Object getProperty(final String _key) { + if (BSelecteurReduitFonteNewVersion.PROPERTY.equals(_key)) { + return ((ZCalqueAffichageDonneesAbstract) target_).getFont(); + } + if (PROPERTY_LABELS_FOREGROUND.equals(_key)) { + return ((ZCalqueGeometry) target_).getLabelsForegroundColor(); + } + if (PROPERTY_LABELS_BACKGROUND.equals(_key)) { + return ((ZCalqueGeometry) target_).getLabelsBackgroundColor(); + } + return null; + } + + @Override + public BSelecteurInterface[] createSelecteurs() { + final List dest = new ArrayList(); + + BSelecteurColorChooserBt foregroundColor = new BSelecteurColorChooserBt(false, PROPERTY_LABELS_FOREGROUND); + foregroundColor.setTitle(EbliLib.getS("Couleur texte")); + dest.add(foregroundColor); + BSelecteurColorChooserBt backgroundColor = new BSelecteurColorChooserBt(true, PROPERTY_LABELS_BACKGROUND); + backgroundColor.setTitle(EbliLib.getS("Couleur fond")); + dest.add(backgroundColor); + dest.add(new BSelecteurFont()); + return (BSelecteurInterface[]) dest.toArray(new BSelecteurInterface[dest.size()]); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2013-01-22 17:00:19
|
Revision: 8242 http://fudaa.svn.sourceforge.net/fudaa/?rev=8242&view=rev Author: deniger Date: 2013-01-22 16:59:58 +0000 (Tue, 22 Jan 2013) Log Message: ----------- Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePoint.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePolygone.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePoint.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePoint.java 2013-01-22 16:09:51 UTC (rev 8241) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePoint.java 2013-01-22 16:59:58 UTC (rev 8242) @@ -1,6 +1,9 @@ /** - * @creation 2000-11-09 @modification $Date: 2008-02-20 10:16:01 $ @license GNU General Public License 2 @copyright (c)1998-2001 - * CETMEF 2 bd Gambetta F-60231 Compiegne @mail de...@fu... + * @creation 2000-11-09 + * @modification $Date: 2008-02-20 10:16:01 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail de...@fu... */ package org.fudaa.ebli.calque; @@ -9,16 +12,20 @@ import com.vividsolutions.jts.geom.Envelope; import com.vividsolutions.jts.geom.LineString; import com.vividsolutions.jts.geom.LinearRing; +import gnu.trove.TIntArrayList; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.swing.table.AbstractTableModel; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.gis.GISGeometryFactory; import org.fudaa.ctulu.gis.GISLib; import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.commun.EbliSelectionState; import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.geometrie.GrMorphisme; import org.fudaa.ebli.geometrie.GrPoint; @@ -252,7 +259,7 @@ @Override public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { + final GrBoite _clipReel) { if ((modele_ != null) && (modele_.getNombre() > 0)) { paintDonnees(_g, modele_.getNombre(), _versEcran, _clipReel); } @@ -311,6 +318,7 @@ /** * Called for each point. By default use to color palette to set the color + * * @param model * @param i * @param z @@ -324,15 +332,39 @@ model.setCouleur(c); } } + TIntArrayList firstTwoSelected = new TIntArrayList(); @Override + public void clearSelection() { + super.clearSelection(); + firstTwoSelected.clear(); + } + + protected int[] getTwoFirstSelected() { + return firstTwoSelected.toNativeArray(); + } + + @Override public LineString getSelectedLine() { if (getNbSelected() != 2) { return null; } final Coordinate[] cs = new Coordinate[2]; - cs[0] = new Coordinate(modele_.getX(getLayerSelection().getMinIndex()), modele_.getY(getLayerSelection().getMinIndex())); - cs[1] = new Coordinate(modele_.getX(getLayerSelection().getMaxIndex()), modele_.getY(getLayerSelection().getMaxIndex())); + int firstIdx = getLayerSelection().getMinIndex(); + int lastIdx = getLayerSelection().getMaxIndex(); + if (firstTwoSelected.size() == 2) { + int newFirst = firstTwoSelected.get(0); + int newLast = firstTwoSelected.get(1); + boolean isOk = (newFirst == firstIdx && newLast == lastIdx) || (newFirst == lastIdx && newLast == firstIdx); + if (!isOk) { + Logger.getLogger(ZCalquePoint.class.getName()).log(Level.INFO, "probleme dans la determination des 2 deux premiers points s\xE9lectionn\xE9s"); + } else { + firstIdx = newFirst; + lastIdx = newLast; + } + } + cs[0] = new Coordinate(modele_.getX(firstIdx), modele_.getY(firstIdx)); + cs[1] = new Coordinate(modele_.getX(lastIdx), modele_.getY(lastIdx)); if (cs[0].compareTo(cs[1]) > 0) { final Coordinate tmp = cs[0]; cs[0] = cs[1]; @@ -344,7 +376,7 @@ @Override public void doPaintSelection(final Graphics2D _g, final ZSelectionTrace _trace, final GrMorphisme _versEcran, - final GrBoite _clipReel) { + final GrBoite _clipReel) { if ((modele_ == null) || (modele_.getNombre() <= 0) || isSelectionEmpty() || isRapide()) { return; } @@ -388,6 +420,37 @@ return selectionBasic(_poly, _mode); } + @Override + public boolean changeSelection(CtuluListSelection _s, int _action) { + boolean res = super.changeSelection(_s, _action); + if (_s != null) { + switch (_action) { + case EbliSelectionState.ACTION_ADD: + if (_s.getNbSelectedIndex() == 1 && firstTwoSelected.size() < 2) { + firstTwoSelected.add(_s.getMinIndex()); + } + break; + case EbliSelectionState.ACTION_DEL: + for (int j = firstTwoSelected.size() - 1; j >= 0; j--) { + if (_s.isSelected(firstTwoSelected.get(j))) { + firstTwoSelected.remove(j); + } + } + break; + case EbliSelectionState.ACTION_REPLACE: + firstTwoSelected.clear(); + if (_s.getNbSelectedIndex() == 1) { + firstTwoSelected.add(_s.getMinIndex()); + } + break; + default: + firstTwoSelected.clear(); + break; + } + } + return res; + } + public CtuluListSelection selectionBasic(final LinearRing _poly, final int _mode) { if (modele_ == null || modele_.getNombre() == 0 || !isVisible()) { return null; @@ -395,7 +458,7 @@ final Envelope polyEnv = _poly.getEnvelopeInternal(); final GrBoite domaineBoite = getDomaine(); final Envelope domaine = new Envelope(domaineBoite.e_.x_, domaineBoite.o_.x_, domaineBoite.e_.y_, - domaineBoite.o_.y_); + domaineBoite.o_.y_); // si l'envelop du polygone n'intersect pas le domaine, il n'y a pas de selection if (!polyEnv.intersects(domaine)) { return null; @@ -424,7 +487,7 @@ } public static int getSelectedPoint(final ZModelePoint _modele, final GrPoint _p, final int _tolerance, - final GrMorphisme _versReel, final GrBoite _clipReel) { + final GrMorphisme _versReel, final GrBoite _clipReel) { final GrBoite bClip = _modele.getDomaine(); final double toleranceReel = GrMorphisme.convertDistanceXY(_versReel, _tolerance); if ((!bClip.contientXY(_p)) && (bClip.distanceXY(_p) > toleranceReel)) { @@ -473,4 +536,4 @@ public boolean isConfigurable() { return true; } -} \ No newline at end of file +} Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePolygone.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePolygone.java 2013-01-22 16:09:51 UTC (rev 8241) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePolygone.java 2013-01-22 16:59:58 UTC (rev 8242) @@ -31,16 +31,19 @@ /** * Un calque d'affichage de polyligne. - * + * * @version $Id: ZCalquePolygone.java,v 1.37.6.1 2008-02-20 10:16:02 bmarchan Exp $ * @author Fred Deniger */ public class ZCalquePolygone extends ZCalqueAffichageDonneesLineAbstract { - /** Propriete modele. */ + /** + * Propriete modele. + */ protected ZModelePolygone modele_; - /** */ + /** + * */ public ZCalquePolygone() { super(); ligneModel_ = new TraceLigneModel(); @@ -96,7 +99,6 @@ public ZModeleDonnees modeleDonnees() { return modele(); } - protected GrPolygone poly_ = new GrPolygone(); /** @@ -105,17 +107,16 @@ * @param _idx l'indice du polygone */ protected void updateTrace(final TraceIconModel _ic, final TraceLigneModel _ligne, final int _idx) { - } /** * Ne dessine que les donn\xE9es. - * + * * @param _g le graphics cible */ @Override public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { + final GrBoite _clipReel) { if ((modele_ == null) || (modele_.getNombre() <= 0)) { return; } @@ -142,7 +143,7 @@ } } for (int i = 0; i < nombre; i++) { - if(!modele_.isPainted(i)){ + if (!modele_.isPainted(i)) { continue; } // si le polygone i est filtre on passe. @@ -180,7 +181,7 @@ * @param _parent le composant parent pour dessiner les icones */ public static void paintPoly(final GrPolygone _p, final int _inc, final TraceLigne _tl, final TraceIcon _ic, final Graphics _g, - final Component _parent) { + final Component _parent) { GrPoint ptOri = _p.sommets_.renvoie(0); GrPoint ptDest = null; @@ -197,7 +198,7 @@ /** * Ne dessine que la selection. - * + * * @param _g le graphics cible */ @Override @@ -313,11 +314,15 @@ if (_cq.getNbSelected() != 2) { return null; } + return getSelectedLine(_cq.getLayerSelection().getMinIndex(), _cq.getLayerSelection().getMaxIndex(), _modele); + } + + public static LineString getSelectedLine(int first, int last, final ZModelePolygone _modele) { final Coordinate[] cs = new Coordinate[2]; final GrPolygone poly = new GrPolygone(); - _modele.polygone(poly, _cq.getLayerSelection().getMinIndex(), true); + _modele.polygone(poly, first, true); cs[0] = poly.sommets_.barycentre(); - _modele.polygone(poly, _cq.getLayerSelection().getMaxIndex(), true); + _modele.polygone(poly, last, true); cs[1] = poly.sommets_.barycentre(); if (cs[0].compareTo(cs[1]) > 0) { final Coordinate tmp = cs[0]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2013-02-07 16:36:59
|
Revision: 8261 http://fudaa.svn.sourceforge.net/fudaa/?rev=8261&view=rev Author: deniger Date: 2013-02-07 16:36:52 +0000 (Thu, 07 Feb 2013) Log Message: ----------- Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZModeleImageRaster.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZModeleStatiqueImageRaster.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZModeleImageRaster.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZModeleImageRaster.java 2013-02-07 16:36:22 UTC (rev 8260) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZModeleImageRaster.java 2013-02-07 16:36:52 UTC (rev 8261) @@ -59,4 +59,6 @@ BufferedImage getImage(GrBoite _clipReel, int _widthEcran, int _heightEcran, AffineTransform _toReel, boolean _quick); + public ZModeleImageRaster cloneModel(); + } Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZModeleStatiqueImageRaster.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZModeleStatiqueImageRaster.java 2013-02-07 16:36:22 UTC (rev 8260) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZModeleStatiqueImageRaster.java 2013-02-07 16:36:52 UTC (rev 8261) @@ -46,8 +46,8 @@ import org.fudaa.ebli.palette.BPaletteInfo.InfoData; /** - * Un modele simple pour le modele Image. Les points et la boite retournes sont des objets r\xE9initialises. Il est possible - * d'auto-appliquer les morphismes sur ces objets. + * Un modele simple pour le modele Image. Les points et la boite retournes sont des objets r\xE9initialises. Il est possible d'auto-appliquer les + * morphismes sur ces objets. * * @version $Id: ZModeleStatiqueImageRaster.java,v 1.20 2007-05-04 13:49:43 deniger Exp $ * @author Fred Deniger @@ -135,12 +135,12 @@ } public static double[] getErreurs(final Point2D.Double[] _img, final Point2D.Double[] _reel, - final AffineTransform _trans) { + final AffineTransform _trans) { return getErreurs(_img, _reel, _trans, null); } public static double[] getErreurs(final Point2D.Double[] _img, final Point2D.Double[] _reel, - final AffineTransform _trans, final double[] _error) { + final AffineTransform _trans, final double[] _error) { if (CtuluLibArray.isEmpty(_img) || CtuluLibArray.isEmpty(_reel) || _trans == null) { return null; } @@ -164,6 +164,17 @@ } @Override + public ZModeleImageRaster cloneModel() { + ZModeleStatiqueImageRaster res = new ZModeleStatiqueImageRaster(); + res.pts_ = (GISZoneCollectionPoint) pts_.clone(); + res.image_ = new CtuluImageContainer(image_.getFile()); + res.erreurs_ = CtuluLibArray.copy(erreurs_); + res.path_ = path_; + res.raster_ = raster_; + return res; + } + + @Override protected ZModeleStatiqueImageRaster clone() { try { ZModeleStatiqueImageRaster cloned = (ZModeleStatiqueImageRaster) super.clone(); @@ -208,8 +219,8 @@ @Override public BufferedImage getImage(final GrBoite _clipReel, final int _widthEcran, final int _heightEcran, - final AffineTransform _toReel, - final boolean _quick) { + final AffineTransform _toReel, + final boolean _quick) { _toReel.setToIdentity(); BufferedImage res; int xOffset = 0; @@ -304,8 +315,8 @@ BufferedImage lastImage_; /** - * Retourne une partie de l'image. Methode optimis\xE9e qui retourne un cache si les dimensions et ratio ne sont pas modifi\xE9s - * depuis le dernier appel. + * Retourne une partie de l'image. Methode optimis\xE9e qui retourne un cache si les dimensions et ratio ne sont pas modifi\xE9s depuis le dernier appel. + * * @param _r Le rectangle de l'image. * @param _ratioX Le ratio suivant X * @param _ratioY Le ratio suivant Y @@ -314,7 +325,7 @@ private BufferedImage getImage(final Rectangle _r, final float _ratioX, final float _ratioY) { // Les dimensions et ratio ne sont pas modifi\xE9s => L'image cache est retourn\xE9e si elle existe. if (lastRec_ != null && lastImage_ != null && lastRec_.contains(_r) && _ratioX <= lastRatioX_ - && _ratioY <= lastRatioY_) { + && _ratioY <= lastRatioY_) { if (Fu.DEBUG && FuLog.isDebug()) { FuLog.debug("ECA: on recupere l'ancienne image"); } @@ -348,10 +359,10 @@ final BuTable r = new CtuluTable(new ImgTableModel()); EbliTableInfoPanel.setTitle(r, _layer.getTitle()); EbliTableInfoPanel.setComponent(r, new BuLabel("<html>" - + EbliLib.getS( + + EbliLib.getS( "Les coordonn\xE9es de l'image sont donn\xE9es \xE0 partir d'en bas \xE0 droite.") - + "<br>" - + EbliLib.getS( + + "<br>" + + EbliLib.getS( "La colonne '{0}' du tableau permet de conna\xEEtre l'ordonn\xE9e du point depuis le haut de l'image", r.getModel().getColumnName(3)))); return r; @@ -422,7 +433,7 @@ final int i = _layer.getLayerSelection().getMaxIndex(); final int i2 = _layer.getLayerSelection().getMinIndex(); _d.put(EbliLib.getS("Distance entre les 2 points"), - CtuluLib.DEFAULT_NUMBER_FORMAT.format(CtuluLibGeometrie.getDistance(getX(i), getY(i), getX(i2), getY(i2)))); + CtuluLib.DEFAULT_NUMBER_FORMAT.format(CtuluLibGeometrie.getDistance(getX(i), getY(i), getX(i2), getY(i2)))); return; } if (nb != 1) { @@ -431,11 +442,11 @@ final int idxNode = _layer.getLayerSelection().getMaxIndex(); _d.setTitle(EbliLib.getS("Point {0}", CtuluLibString.getString(idxNode + 1))); _d.put(EbliLib.getS("Pixels "), (getXImgCalage(idxNode)) + CtuluLibString.VIR - + (getHImg() - getYImgCalageFromTop(idxNode))); + + (getHImg() - getYImgCalageFromTop(idxNode))); _d.put(EbliLib.getS("Pixels (depuis haut,gauche)"), getXImgCalage(idxNode) + CtuluLibString.VIR - + getYImgCalageFromTop(idxNode)); + + getYImgCalageFromTop(idxNode)); _d.put(EbliLib.getS("Reel"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(getX(idxNode)) + CtuluLibString.VIR - + CtuluLib.DEFAULT_NUMBER_FORMAT.format(getY(idxNode))); + + CtuluLib.DEFAULT_NUMBER_FORMAT.format(getY(idxNode))); } @@ -597,7 +608,7 @@ */ @Override public void setProj(final Point2D.Double[] _img, final Point2D.Double[] _reel, final AffineTransform _trans, - final double[] _err) { + final double[] _err) { if (CtuluLibArray.isEmpty(_img) || CtuluLibArray.isEmpty(_reel)) { clear(); return; @@ -644,4 +655,4 @@ public void objectAction(Object _source, int _indexObj, Object _obj, int _action) { autoUpdate(); } -} \ No newline at end of file +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2013-02-14 12:07:25
|
Revision: 8266 http://fudaa.svn.sourceforge.net/fudaa/?rev=8266&view=rev Author: deniger Date: 2013-02-14 12:07:15 +0000 (Thu, 14 Feb 2013) Log Message: ----------- cas ?\195?\160 g?\195?\169rer si titre du calque est null. Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalqueModel.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BGroupeCalque.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalqueModel.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalqueModel.java 2013-02-13 15:38:28 UTC (rev 8265) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalqueModel.java 2013-02-14 12:07:15 UTC (rev 8266) @@ -34,6 +34,7 @@ import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; +import org.apache.commons.lang.StringUtils; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluResource; @@ -278,7 +279,13 @@ } protected void renameLayer(final BCalque _calque) { - final String title = _calque.getTitle(); + String title = _calque.getTitle(); + if(title==null){ + title=_calque.getName(); + } + if(title==null){ + title=StringUtils.EMPTY; + } final BuTextField ft = new BuTextField(title); ft.setColumns(title.length() + 2); final CtuluDialogPanel pn = new CtuluDialogPanel(); Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BGroupeCalque.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BGroupeCalque.java 2013-02-13 15:38:28 UTC (rev 8265) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BGroupeCalque.java 2013-02-14 12:07:15 UTC (rev 8266) @@ -269,10 +269,10 @@ private static String findUniqueName(final String _pref, final BCalque _parent, final int _idx) { final BCalque[] cqs = _parent.getCalques(); final String defaultName=buildName(_pref, _idx); + if (cqs == null || cqs.length == 0) { return defaultName; } // final String defaultName = _pref + '_' + CtuluLibString.getString(_idx); // Aucun calque trouv\xE9 avec ce nom. - if (cqs == null || cqs.length == 0) { return defaultName; } final String[] cqNames = new String[cqs.length]; final int nb = cqNames.length; boolean found = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |