|
From: <de...@us...> - 2014-02-11 15:48:29
|
Revision: 8609
http://sourceforge.net/p/fudaa/svn/8609
Author: deniger
Date: 2014-02-11 15:48:26 +0000 (Tue, 11 Feb 2014)
Log Message:
-----------
edition axe avec 2-click
Modified Paths:
--------------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGActionAxeRepereConfigure.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontal.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVertical.java
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BVueCalque.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/ZCalqueLigneBriseeEditable.java
Added Paths:
-----------
trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionEditAxe.java
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGActionAxeRepereConfigure.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGActionAxeRepereConfigure.java 2014-02-11 14:28:04 UTC (rev 8608)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGActionAxeRepereConfigure.java 2014-02-11 15:48:26 UTC (rev 8609)
@@ -7,6 +7,7 @@
*/
package org.fudaa.ebli.courbe;
+import java.util.Set;
import javax.swing.JComponent;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.TreeSelectionEvent;
@@ -20,26 +21,30 @@
*/
@SuppressWarnings("serial")
public class EGActionAxeRepereConfigure extends EbliActionPaletteAbstract implements
- EGSelectionListener, EGGrapheModelListener {
-
-
-
-
+ EGSelectionListener, EGGrapheModelListener {
@Override
- public void axeAspectChanged(final EGAxe _c){}
+ public void axeAspectChanged(final EGAxe _c) {
+ }
+
@Override
- public void axeContentChanged(final EGAxe _c){
+ public void axeContentChanged(final EGAxe _c) {
if (axeEditor_ != null && isSelected()) {
axeEditor_.updateAxesValue();
- }
+ }
}
+
@Override
- public void courbeAspectChanged(final EGObject _c, final boolean _visibil){}
+ public void courbeAspectChanged(final EGObject _c, final boolean _visibil) {
+ }
+
@Override
- public void courbeContentChanged(final EGObject _c, final boolean _mustRestore){}
+ public void courbeContentChanged(final EGObject _c, final boolean _mustRestore) {
+ }
+
@Override
- public void structureChanged(){}
+ public void structureChanged() {
+ }
EGGraphe model_;
EGAxeRepereConfigurator axeEditor_;
@@ -49,15 +54,23 @@
*/
public EGActionAxeRepereConfigure(final EGGraphe _g) {
super(EbliLib.getS("Rep\xE8re"), EbliResource.EBLI.getToolIcon("edit-axes"),
- "CONFIGURE_REPERE");
+ "CONFIGURE_REPERE");
model_ = _g;
model_.getModel().addSelectionListener(this);
model_.getModel().addModelListener(this);
setResizable(true);
}
+ public EGGraphe getGraphe() {
+ return model_;
+ }
+
+ public EGAxeRepereConfigurator getAxeEditor() {
+ return axeEditor_;
+ }
+
@Override
- public JComponent buildContentPane(){
+ public JComponent buildContentPane() {
if (axeEditor_ != null) {
return axeEditor_;
}
@@ -67,23 +80,36 @@
}
@Override
- public void updateBeforeShow(){
- updateTarget();
+ public void updateBeforeShow() {
+ if (!ignoreTarget) {
+ updateTarget();
+ }
}
- private void updateTarget(){
+ boolean ignoreTarget;
+
+ protected void showOnTargetAxis(final Set s) {
+ buildContentPane();
+ axeEditor_.setTargetsAxis(s);
+ ignoreTarget = true;
+ actionPerformed(null);
+ ignoreTarget = false;
+
+ }
+
+ private void updateTarget() {
if (axeEditor_ != null && isSelected()) {
axeEditor_.setTargets(model_.getModel().getSelectedObjects());
}
}
@Override
- public void valueChanged(final ListSelectionEvent _e){
+ public void valueChanged(final ListSelectionEvent _e) {
updateTarget();
}
@Override
- public void valueChanged(final TreeSelectionEvent _e){
+ public void valueChanged(final TreeSelectionEvent _e) {
updateTarget();
}
-}
\ No newline at end of file
+}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2014-02-11 14:28:04 UTC (rev 8608)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxe.java 2014-02-11 15:48:26 UTC (rev 8609)
@@ -10,6 +10,7 @@
import com.memoire.fu.FuLog;
import java.awt.Color;
import java.awt.Font;
+import org.apache.commons.lang.math.IntRange;
import org.fudaa.ctulu.CtuluLib;
import org.fudaa.ctulu.CtuluLibString;
import org.fudaa.ctulu.CtuluNumberFormatI;
@@ -47,6 +48,37 @@
TickIterator axisIterator_;
Font font_;
boolean graduations_;
+
+ private CtuluRange xScreen;
+ private CtuluRange yScreen;
+
+ protected void clearXYScreen() {
+ xScreen = null;
+ yScreen = null;
+ }
+
+ protected void addScreenXY(double x, double y) {
+ addScreenXY((int) x, (int) y);
+
+ }
+
+ protected void addScreenXY(int x, int y) {
+ if (xScreen == null) {
+ xScreen = new CtuluRange();
+ }
+ xScreen.expandTo(x);
+ if (yScreen == null) {
+ yScreen = new CtuluRange();
+ }
+ yScreen.expandTo(y);
+ }
+
+ public boolean isInScreenBounds(int x, int y) {
+ if (xScreen != null && yScreen != null) {
+ return xScreen.isValueContained(x) && yScreen.isValueContained(y);
+ }
+ return false;
+ }
/**
* Booleen qui indique si l'on trace ou non la graduation
*/
@@ -225,7 +257,6 @@
((NumberIterator) axisIterator_).setMaxFractionDigits(2);
}
-
if (modeGraduations_ == MANUEL_GRADUATIONS) {
axisIterator_.initExact(getMinimum(), getMaximum(), nbPas_, nbSousGraduations_ + 1);
} else if (modeGraduations_ == MANUEL_LONGUEURPAS) {
@@ -852,4 +883,4 @@
}
return false;
}
-}
\ No newline at end of file
+}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontal.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2014-02-11 14:28:04 UTC (rev 8608)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2014-02-11 15:48:26 UTC (rev 8609)
@@ -109,16 +109,23 @@
traceGraduations.dessineTrait(_g, xe, y, xe, yMaxGrad);
}
_g.drawLine(xe, y, xe, yBasMajor);
+ addScreenXY(xe, y);
+ addScreenXY(xe, yBasMajor);
_g.drawString(t, (int) xLeft, (int) (y + ftHaut));
+ addScreenXY(xLeft, y + ftHaut);
lastMaxX = xLeft + wordWidth;
} else {
_g.drawLine(xe, y, xe, yBas);
+ addScreenXY(xe, y);
+ addScreenXY(xe, yBas);
if (traceGrille_) {
traceGraduations.dessineTrait(_g, xe, y, xe, yMaxGrad);
}
}
} else {
_g.drawLine(xe, y, xe, yBas);
+ addScreenXY(xe, y);
+ addScreenXY(xe, yBas);
if (traceSousGrille_) {
traceSousGraduations.dessineTrait(_g, xe, y, xe, yMaxGrad);
} else {
@@ -173,6 +180,7 @@
* @param _f le repere
*/
public void dessine(final Graphics2D _g, final EGRepere _f) {
+ clearXYScreen();
if (!visible_) {
return;
}
@@ -192,9 +200,13 @@
xf = _f.getMaxEcranX();
}
_g.drawLine(xi, y, xf, y);
+ addScreenXY(xi, y);
+ addScreenXY(xf, y);
if (isExtremiteDessinee_) {
_g.drawLine(xf, y, xf - 3, y - 2);
_g.drawLine(xf, y, xf - 3, y + 2);
+ addScreenXY(xf - 3, y - 2);
+ addScreenXY(xf - 3, y + 2);
}
_g.setFont(old);
if (FuLog.isDebug() && Fu.DEBUG) {
@@ -228,6 +240,8 @@
}
final int xtext = _xi + (_f.getMaxEcranX() - _xi) / 2 - fm.stringWidth(txt) / 2;
_g.drawString(txt, xtext, _y + getBottomHeightNeeded(_g) - fm.getHeight() - 1);
+// addScreenXY(xtext, _y + getBottomHeightNeeded(_g) - fm.getHeight() - 1);
+// addScreenXY(xtext + fm.stringWidth(t), _y + getBottomHeightNeeded(_g));
} else {
if (t != null) {
width = fm.stringWidth(t);
@@ -370,4 +384,4 @@
duplic.nbSousGraduations_ = nbSousGraduations_;
return duplic;
}
-}
\ No newline at end of file
+}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2014-02-11 14:28:04 UTC (rev 8608)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2014-02-11 15:48:26 UTC (rev 8609)
@@ -664,7 +664,6 @@
pnAxeX.add(tfHorSousPas_);
// -- graduations --//
-
modelGraduationsX_ = new BSelecteurLineModel(GRILLE_AXE_X, axeX_.traceGraduations_);
pnAxeX.add(boxAfficheGraduationsX_);
@@ -1112,6 +1111,12 @@
}
}
}
+ setTargetsAxis(s);
+ }
+
+
+
+ protected void setTargetsAxis(final Set s) {
if (s.size() > 0) {
axes_ = new EGAxeVertical[s.size()];
s.toArray(axes_);
@@ -1139,7 +1144,6 @@
revalidate();
// }
pnAxeY_.setToolTipText(EbliLib.getS("Nombre d'axes: {0}", CtuluLibString.getString(nb)));
-
}
void updateAxesValue() {
@@ -1222,4 +1226,4 @@
}
}
-}
\ No newline at end of file
+}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVertical.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVertical.java 2014-02-11 14:28:04 UTC (rev 8608)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGAxeVertical.java 2014-02-11 15:48:26 UTC (rev 8609)
@@ -113,6 +113,8 @@
traceGraduations.dessineTrait(_g2d, (int) xLeft, ye, xMaxGrad, ye);
}
_g2d.drawLine((int) xLeft, ye, _x, ye);
+ addScreenXY(xLeft, ye);
+ addScreenXY(_x, ye);
if (specificFormat_ == null) {
t = it.currentLabel();
} else {
@@ -132,6 +134,8 @@
}
_g2d.drawString(t, tmp, (int) (ye + asc));
+ addScreenXY(tmp, (int) (ye + asc));
+ addScreenXY(tmp + _fm.stringWidth(t), (int) (ye + asc));
maxLastIteration = ye - fontHeight;
}
} else {
@@ -139,6 +143,8 @@
traceSousGraduations.dessineTrait(_g2d, (int) xLeftMinor, ye, xMaxGrad, ye);
}
_g2d.drawLine((int) xLeftMinor, ye, _x, ye);
+ addScreenXY(xLeftMinor, ye);
+ addScreenXY(_x, ye);
}
}
@@ -165,6 +171,7 @@
if (FuLog.isDebug() && Fu.DEBUG) {
FuLog.debug(getClass().getName() + " axe vertical begin ...");
}
+ clearXYScreen();
if (!visible_) {
return;
}
@@ -192,9 +199,13 @@
_g2d.setColor(lineColor_);
_g2d.drawLine(x, y, x, yf);
+ addScreenXY(x, y);
+ addScreenXY(x, yf);
if (isExtremiteDessinee_) {
_g2d.drawLine(x, yf, x - 2, yf + 2);
_g2d.drawLine(x, yf, x + 2, yf + 2);
+ addScreenXY(x - 2, yf + 2);
+ addScreenXY(x + 2, yf + 2);
}
if (t != null) {
if (titreVertical_) {
@@ -221,6 +232,8 @@
_g2d.setTransform(save);
} else {
_g2d.drawString(t, x + 1 - fm.stringWidth(t) / 2, yf - fm.getAscent());
+ addScreenXY(x + 1 - fm.stringWidth(t) / 2, yf - fm.getHeight() - fm.getAscent());
+ addScreenXY(x + 1 + fm.stringWidth(t) / 2, yf);
}
_g2d.setFont(old);
}
@@ -369,4 +382,4 @@
duplic.nbSousGraduations_ = nbSousGraduations_;
return duplic;
}
-}
\ No newline at end of file
+}
Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java 2014-02-11 14:28:04 UTC (rev 8608)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGFillePanel.java 2014-02-11 15:48:26 UTC (rev 8609)
@@ -114,7 +114,6 @@
setDoubleBuffered(false);
// suiviInfos_ = new EGInteractionSuiviAllOrdonnees(vue_.getGraphe());
-
}
protected void addListenerCourbePoint(final CtuluListSelectionListener _l) {
@@ -137,28 +136,30 @@
EbliActionAbstract s = new EbliActionSimple(EbliResource.EBLI.getString("Restaurer"), EbliResource.EBLI
.getIcon("restore"), "RESTORE") {
- @Override
- public void actionPerformed(ActionEvent _e) {
- vue_.getGraphe().restore();
- }
- };
+ @Override
+ public void actionPerformed(ActionEvent _e) {
+ vue_.getGraphe().restore();
+ }
+ };
s.putValue(Action.SHORT_DESCRIPTION, EbliResource.EBLI.getString("Restaurer la vue globale"));
s.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('r'));
s.putValue(EbliActionInterface.SECOND_KEYSTROKE, KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
r.add(s);
s = new EbliActionChangeState(EbliLib.getS("Restaurer automatiquement"), EbliResource.EBLI.getIcon("restoreauto"),
"AUTO_REST") {
- @Override
- public void changeAction() {
- getGraphe().setAutoRestore(isSelected());
- }
- };
+ @Override
+ public void changeAction() {
+ getGraphe().setAutoRestore(isSelected());
+ }
+ };
// EM:Si la fonctionnalit\xE9 'Restaurer automatiquement' est d\xE9j\xE0 activ\xE9e, selectionner l'action.
((EbliActionChangeState) s).setSelected(getGraphe().isAutoRestore());
//
s.putValue(Action.SHORT_DESCRIPTION, EbliLib.getS("Restaurer automatiquement la vue"));
r.add(s);
- r.add(new EGActionAxeRepereConfigure(getGraphe()));
+ final EGActionAxeRepereConfigure actionAxeRepereConfigure = new EGActionAxeRepereConfigure(getGraphe());
+ r.add(actionAxeRepereConfigure);
+ new EGInteractionEditAxe(actionAxeRepereConfigure);
final EGInteractionZoom zoom = new EGInteractionZoom(vue_.graphe_);
// addKeyListener(zoom);
vue_.graphe_.addKeyListener(zoom);
@@ -264,12 +265,12 @@
r.add(null);
final EbliActionSimple addAction = new EbliActionSimple(EbliLib.getS("Ajouter une courbe"), BuResource.BU
.getToolIcon("creer"), "NEW_CURVE") {
- @Override
- public void actionPerformed(ActionEvent _e) {
- getModel().addNewCourbe(vue_.graphe_.getCmd(), EGFillePanel.this, EGFillePanel.this.getGraphe());
- vue_.graphe_.restore();
- }
- };
+ @Override
+ public void actionPerformed(ActionEvent _e) {
+ getModel().addNewCourbe(vue_.graphe_.getCmd(), EGFillePanel.this, EGFillePanel.this.getGraphe());
+ vue_.graphe_.restore();
+ }
+ };
getModel().decoreAddButton(addAction);
addAction.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_M, InputEvent.CTRL_DOWN_MASK
| InputEvent.SHIFT_DOWN_MASK));
@@ -279,6 +280,7 @@
final EbliActionInterface[] rf = new EbliActionInterface[r.size()];
r.toArray(rf);
EbliLib.updateMapKeyStroke(this, rf);
+
return rf;
}
Added: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionEditAxe.java
===================================================================
--- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionEditAxe.java (rev 0)
+++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGInteractionEditAxe.java 2014-02-11 15:48:26 UTC (rev 8609)
@@ -0,0 +1,79 @@
+/*
+ GPL 2
+ */
+package org.fudaa.ebli.courbe;
+
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.Collections;
+import java.util.HashSet;
+
+/**
+ *
+ * @author Frederic Deniger
+ */
+public class EGInteractionEditAxe extends EGInteractiveComponent implements MouseListener {
+
+ private EGActionAxeRepereConfigure configureAction;
+ private EGGraphe target;
+
+ public EGInteractionEditAxe(final EGActionAxeRepereConfigure _a) {
+ configureAction = _a;
+ this.target = configureAction.getGraphe();
+ this.target.addMouseListener(this);
+ }
+
+ @Override
+ public String getDescription() {
+ return "";
+ }
+
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ if (!configureAction.isEnabled()) {
+ return;
+ }
+ if (e.getClickCount() >= 2) {
+ final EGAxeHorizontal axeX = target.getModel().getAxeX();
+ if (axeX.isInScreenBounds(e.getX(), e.getY())) {
+ displayAxeH();
+ return;
+ }
+ for (EGAxeVertical axeV : target.getAllAxeVertical()) {
+ if (axeV.isInScreenBounds(e.getX(), e.getY())) {
+ displayAxeV(axeV);
+ return;
+ }
+ }
+
+ }
+ }
+
+ protected void displayAxeH() {
+ configureAction.buildContentPane();
+ configureAction.actionPerformed(null);
+ }
+
+ protected void displayAxeV(EGAxeVertical v) {
+ configureAction.buildContentPane();
+ configureAction.showOnTargetAxis(new HashSet(Collections.singleton(v)));
+
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseExited(MouseEvent e) {
+ }
+
+}
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BVueCalque.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BVueCalque.java 2014-02-11 14:28:04 UTC (rev 8608)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BVueCalque.java 2014-02-11 15:48:26 UTC (rev 8609)
@@ -71,6 +71,7 @@
GrVecteur vect_ = new GrVecteur();
private double margeXCentre;
private double margeYCentre;
+ private boolean doCheckBoiteBeforeChangeRepere = true;
public BVueCalque(final BCalque _c) {
repere_ = new double[4][3];
@@ -286,14 +287,16 @@
changeRepere(_source, _boite, _rz, _mrg, _mrg, _rapide, changeZ);
}
+
public void changeRepere(final Object _source, final GrBoite _boite, final double _rz, final int mrgHorizontal, final int mrgVertical,
final boolean _rapide, final boolean _changeZ) {
if (_boite == null) {
return;
}
- if (!checkBoite(_boite, true, true)) {
+ if (doCheckBoiteBeforeChangeRepere && !checkBoite(_boite, true, true)) {
return;
}
+ doCheckBoiteBeforeChangeRepere = true
final Insets insets = getInsets();
final double wd = _boite.getDeltaX();
final double hd = _boite.getDeltaY();
@@ -421,9 +424,7 @@
}
/**
- * Renvoie le morphisme versEcran de la propriete
- * <code>calque</code>. equivaut a
- * <code>getCalque().getVersEcran();</code>.
+ * Renvoie le morphisme versEcran de la propriete <code>calque</code>. equivaut a <code>getCalque().getVersEcran();</code>.
*/
@Override
public GrMorphisme getVersEcran() {
@@ -440,6 +441,12 @@
*/
@Override
public GrBoite getViewBoite() {
+ GrBoite b = getGraphicBoite();
+ b.autoApplique(getCalque().getVersReel());
+ return b;
+ }
+
+ protected GrBoite getGraphicBoite() {
double minX = 0;
double minY = 0;
double maxX = getWidth();
@@ -451,7 +458,6 @@
maxY = maxY - insets_.bottom;
}
final GrBoite b = new GrBoite(new GrPoint(minX, minY, 0), new GrPoint(maxX, maxY, 0));
- b.autoApplique(getCalque().getVersReel());
return b;
}
@@ -777,31 +783,52 @@
@Override
public void zoomOnMouse(final MouseEvent _evt, final boolean _isOut) {
+ final GrBoite graphicBoite = getGraphicBoite();
+ double coef;
+ if (_isOut) {
+ coef = 1 / getZoomCoef();
+ } else {
+ coef = getZoomCoef();
+ }
final GrPoint p = new GrPoint(_evt.getPoint());
p.autoApplique(getVersReel());
- zoomOnRealPoint(p.x_, p.y_, _isOut);
+ GrBoite bReel = getBoiteZoomedOnRealPoint(_isOut, p.x_, p.y_);
+ double dx = _evt.getX() - graphicBoite.getMidX();
+ double dy = _evt.getY() - graphicBoite.getMidY();
+ dx = GrMorphisme.convertDistanceXY(getVersReel(), dx) * coef;
+ dy = GrMorphisme.convertDistanceXY(getVersReel(), dy) * coef;
+ bReel.e_.x_ += dx;
+ bReel.o_.x_ += dx;
+ bReel.e_.y_ += dy;
+ bReel.o_.y_ += dy;
+// doCheckBoiteBeforeChangeRepere = false;
+ setViewBoite(bReel);
}
@Override
public void zoomOnRealPoint(final double _x, final double _y, final boolean _out) {
+ GrBoite bReel = getBoiteZoomedOnRealPoint(_out, _x, _y);
+ setViewBoite(bReel);
+ }
+
+ protected GrBoite getBoiteZoomedOnRealPoint(final boolean _out, final double _x, final double _y) {
double coef;
if (_out) {
coef = 1 / getZoomCoef();
} else {
coef = getZoomCoef();
}
- coef = coef / 2;
+// coef = coef / 2;
final GrBoite bReel = getViewBoite();
- final double w = bReel.getDeltaX();
- final double h = bReel.getDeltaY();
+ final double w = bReel.getDeltaX() / 2;
+ final double h = bReel.getDeltaY() / 2;
final double wDelta = w * coef;
final double hDelta = h * coef;
bReel.o_.x_ = _x - wDelta;
-
bReel.o_.y_ = _y - hDelta;
bReel.e_.x_ = _x + wDelta;
bReel.e_.y_ = _y + hDelta;
- setViewBoite(bReel);
+ return bReel;
}
@Override
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 2014-02-11 14:28:04 UTC (rev 8608)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2014-02-11 15:48:26 UTC (rev 8609)
@@ -89,19 +89,19 @@
import org.fudaa.ebli.ressource.EbliResource;
/**
- * Fenetre d'affichage de calques contenant des services de base. (position souris, zoom fenetre, selection,
- * transformations spatiales). Il est possible d'ajouter des boutons grace aux methodes <code>addButtonGroup</code>. Par
- * defaut, 3 groupes de boutons sont proposes : selection, standard et navigation. Ils peuvent etre supprimes ou
- * modifies avec les methodes remove
- *
+ * Fenetre d'affichage de calques contenant des services de base. (position souris, zoom fenetre, selection, transformations spatiales). Il est
+ * possible d'ajouter des boutons grace aux methodes <code>addButtonGroup</code>. Par defaut, 3 groupes de boutons sont proposes : selection, standard
+ * et navigation. Ils peuvent etre supprimes ou modifies avec les methodes remove
+ *
* @version $Id$
* @author Guillaume Desnoix , Axel von Arnim, Fred deniger
*/
public class ZEbliCalquesPanel extends BuPanel implements EbliFilleCalquesInterface, BCalqueContextuelListener,
- CtuluImageProducer, BCalqueSaverTargetInterface, EbliFindable, ActionListener, ZSelectionListener,
- CtuluSelectionInterface {
+ CtuluImageProducer, BCalqueSaverTargetInterface, EbliFindable, ActionListener, ZSelectionListener,
+ CtuluSelectionInterface {
protected ZEditorDefault gisEditor_;
+ private boolean addNbSelectionInInfo = false;
protected class AnimAdapter extends EbliAnimationSourceAbstract {
@@ -180,7 +180,7 @@
/**
* Le menu des th\xE8mes.
- *
+ *
* @author Fred Deniger
* @version $Id$
*/
@@ -211,7 +211,9 @@
}
protected BuMenu createMenu(final BCalque _cq) {
- if (_cq == null) { return null; }
+ if (_cq == null) {
+ return null;
+ }
BuMenu m = null;
if (_cq.isGroupeCalque()) {
m = new ThemeMenu(_cq, _cq.getTitle(), _cq.getName());
@@ -228,7 +230,7 @@
/**
* Remplit un menu avec les actions associees aux calques.
- *
+ *
* @param _projectMenu le menu a remplir
*/
public void fillWithAllLayersAction(final JMenu _projectMenu) {
@@ -245,13 +247,16 @@
}
@Override
- public void treeNodesChanged(final TreeModelEvent _e) {}
+ public void treeNodesChanged(final TreeModelEvent _e) {
+ }
@Override
- public void treeNodesInserted(final TreeModelEvent _e) {}
+ public void treeNodesInserted(final TreeModelEvent _e) {
+ }
@Override
- public void treeNodesRemoved(final TreeModelEvent _e) {}
+ public void treeNodesRemoved(final TreeModelEvent _e) {
+ }
@Override
public void treeStructureChanged(final TreeModelEvent _e) {
@@ -262,7 +267,7 @@
/**
* Rempli le menu avec les actions du calque en question.
- *
+ *
* @param _m le menu a remplir
* @param _c le calque dont les actions seront ajoutees au menu
*/
@@ -274,7 +279,7 @@
/**
* Rempli le menu popup avec les actions du calque en question.
- *
+ *
* @param _m le menu a remplir
* @param _c le calque dont les actions seront ajoutees au menu
*/
@@ -286,7 +291,7 @@
/**
* Rempli le menu avec les actions de la scene
- *
+ *
* @param _m le menu a remplir
*/
protected void fillMenuWithSceneActions(final JMenu _m) {
@@ -297,7 +302,7 @@
/**
* Rempli le menu popup avec les actions de la scene
- *
+ *
* @param _m le menu a remplir
*/
protected void fillMenuWithSceneActions(final JPopupMenu _m) {
@@ -365,14 +370,14 @@
/**
* Constructeur minimal. Les groupes de navigation et standard seront construits.
- *
+ *
* @param _gcInit le calque de base
*/
public ZEbliCalquesPanel(final BCalque _gcInit, final ZEbliCalquePanelController _controller) {
this(_gcInit, _controller, true);
}
-
- /**
+
+ /**
* Attention a n'utiliser que si les composants est d\xE9truit et plus utilise.
*/
public void clearListeners() {
@@ -382,7 +387,7 @@
/**
* Construction des calques par defaut.
- *
+ *
* @param _gcInit le calque de base
* @param _controller
* @param _addSouth Ajout ou non des services d'info en bas de fenetre (position, mode, etc.).
@@ -465,7 +470,9 @@
}
modelArbre_.refresh();
- if (_controller == null) { throw new IllegalArgumentException(); }
+ if (_controller == null) {
+ throw new IllegalArgumentException();
+ }
controller_ = _controller;
controller_.setView(this);
@@ -475,8 +482,9 @@
modelArbre_.addTreeModelListener(scene_);
gisEditor_ = createGisEditor();
- if (gisEditor_!=null)
+ if (gisEditor_ != null) {
gisEditor_.setUi(controller_.getUI());
+ }
controller_.getCqSelectionI().setEditor(gisEditor_);
controller_.getCqCatchI().setScene(scene_);
}
@@ -492,16 +500,63 @@
return gisEditor_;
}
+ public void setAddNbSelectionInInfo(boolean addNbSelectionInInfo) {
+ if (this.addNbSelectionInInfo == addNbSelectionInInfo) {
+ return;
+ }
+ this.addNbSelectionInInfo = addNbSelectionInInfo;
+ infoTextSelectionUpdated();
+ }
+
public void setInfoText(final String _s) {
if (CtuluLibString.isEmpty(_s)) {
unsetInfoText();
} else {
- info_.setText('|' + _s);
+ infoTextUpdated("|" + _s);
}
}
+ protected void infoTextUpdated(String _s) {
+ info_.putClientProperty("infoText", _s);
+ updateInfoText();
+ }
+
+ protected void infoTextSelectionUpdated() {
+ String selection = null;
+ if (addNbSelectionInInfo) {
+ int selected = selected = getScene().getSelectionHelper().getNbTotalSelectedObject();
+ if (selected > 0) {
+ selection = EbliLib.getS("{0} obj. s\xE9lect.", Integer.toString(selected));
+ }
+ }
+ info_.putClientProperty("infoTextSelection", selection);
+ updateInfoText();
+ }
+
+ protected void updateInfoText() {
+ String info = (String) info_.getClientProperty("infoText");
+ String selected = "";
+ if (addNbSelectionInInfo) {
+ selected = (String) info_.getClientProperty("infoTextSelection");
+ if (selected == null) {
+ selected = "";
+ }
+ }
+ if (selected.length() > 0) {
+ if (info.length() > 0) {
+ info = "|" + selected + " " + info;
+ } else {
+ info = "|" + selected;
+ }
+
+ }
+ info_.setText(info);
+ info_.setToolTipText(info);
+
+ }
+
public void unsetInfoText() {
- info_.setText(CtuluLibString.EMPTY_STRING);
+ infoTextUpdated(CtuluLibString.EMPTY_STRING);
}
protected void buildTools() {
@@ -510,9 +565,9 @@
}
/**
- * Creation des menus sp\xE9cifiques. Les menus sp\xE9cifiques sont switch\xE9s d\xE9s que la fenetre passe de l'\xE9tat actif \xE0
- * inactif et inversement. Ils sont ajout\xE9s dans la barre de menus.
- *
+ * Creation des menus sp\xE9cifiques. Les menus sp\xE9cifiques sont switch\xE9s d\xE9s que la fenetre passe de l'\xE9tat actif \xE0 inactif et inversement. Ils sont
+ * ajout\xE9s dans la barre de menus.
+ *
* @return Les menus sp\xE9cifiques.
*/
protected BuMenu[] createSpecificMenus(final String _title) {
@@ -620,7 +675,7 @@
/**
* Met a jour l'association calque/action.
- *
+ *
* @param _c le calque en question
* @param _act les actions associees a ce calque
*/
@@ -728,7 +783,7 @@
/**
* Retourne les menus sp\xE9cifiques pour la fenetre.
- *
+ *
* @see createSpecificMenus(String);
* @return Les menus sp\xE9cifiques.
*/
@@ -749,7 +804,7 @@
/**
* Renvoie true si l'affichage peut-etre "customisable".
- *
+ *
* @return boolean
*/
public boolean isCustomize() {
@@ -764,7 +819,9 @@
}
public int print(final Graphics _g, final PageFormat _format, final int _numPage) {
- if (_numPage != 0) { return Printable.NO_SUCH_PAGE; }
+ if (_numPage != 0) {
+ return Printable.NO_SUCH_PAGE;
+ }
final BVueCalque bv = getVueCalque();
final Graphics2D g2d = (Graphics2D) _g;
g2d.setColor(Color.black);
@@ -867,7 +924,7 @@
/**
* Si true, l'affichage peut-etre modifie.
- *
+ *
* @param _customize The customize to set
*/
public void setCustomize(final boolean _customize) {
@@ -918,7 +975,8 @@
}
@Override
- public void replace() {}
+ public void replace() {
+ }
@Override
public void select() {
@@ -942,7 +1000,7 @@
setToolTipText(lb.getText());
} else {
setToolTipText("<html><body style=\"padding:3px;\">" + lb.getText() + "<br>" + val.toString()
- + "</body></html>");
+ + "</body></html>");
}
if (_isSelected && !EbliFindDialog.isCalqueFindable(_value)) {
setBackground(_l.getBackground());
@@ -965,7 +1023,7 @@
/**
* Definit le nom des coordonn\xE9es affich\xE9es dans la barre de statut.
- *
+ *
* @param _names Le nom des coordonn\xE9es.
*/
public void setCoordinateDefinitions(EbliCoordinateDefinition[] _names) {
@@ -974,7 +1032,7 @@
/**
* Retourne le nom des coordonn\xE9es du syst\xE8me de coordonn\xE9es.
- *
+ *
* @return Le tableau des noms des coordonn\xE9es.
*/
public EbliCoordinateDefinition[] getCoordinateDefinitions() {
@@ -993,10 +1051,9 @@
}
/**
- * 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.
- *
+ * 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: \xE0 voir...
*/
public void zoomOnSelected() {
@@ -1012,7 +1069,7 @@
public boolean isZoomOnSelectedEnable() {
final BCalque cq = getCalqueActif();
return cq instanceof ZCalqueAffichageDonneesInterface
- && !((ZCalqueAffichageDonneesInterface) cq).isSelectionEmpty();
+ && !((ZCalqueAffichageDonneesInterface) cq).isSelectionEmpty();
}
/**
@@ -1024,7 +1081,7 @@
/**
* Retourne les donn\xE9es persistantes.
- *
+ *
* @return
*/
public ZEbliCalquesPanelPersistManager getPersistenceManager() {
@@ -1047,14 +1104,15 @@
}
/**
- * Ajoute les calques d'informations. Les calques contenus dans ce groupe de calques ne sont pas visibles dans l'arbre
- * des calques. Les objets de ces calques ne sont pas s\xE9lectionnables, mais visibles dans la fenetre de vue des
- * calques.
- *
+ * Ajoute les calques d'informations. Les calques contenus dans ce groupe de calques ne sont pas visibles dans l'arbre des calques. Les objets de
+ * ces calques ne sont pas s\xE9lectionnables, mais visibles dans la fenetre de vue des calques.
+ *
* @param _g le maillage associe
*/
protected BGroupeCalque addCqInfos() {
- if (getCqInfos() != null) { return getCqInfos(); }
+ if (getCqInfos() != null) {
+ return getCqInfos();
+ }
final BGroupeCalque gr = new BGroupeCalque();
gr.setName("gpInfo");
gr.setTitle(EbliLib.getS("infos"));
@@ -1068,7 +1126,9 @@
}
protected BGroupeCalque addCqInfos(final BCalqueLegende l) {
- if (getCqInfos() != null) { return getCqInfos(); }
+ if (getCqInfos() != null) {
+ return getCqInfos();
+ }
final BGroupeCalque gr = new BGroupeCalque();
gr.setName("gpInfo");
gr.setTitle(EbliLib.getS("infos"));
@@ -1131,7 +1191,7 @@
ZCalqueSelectionInteractionAbstract.addSelectionAction(selection, true, this);
}
selection.addMenuItem(EbliLib.getS("S\xE9lectionner \xE0 partir de polygones"), "SELECTFROMPOLY", EbliResource.EBLI
- .getMenuIcon("draw-polygon"), this);
+ .getMenuIcon("draw-polygon"), this);
return selection;
}
@@ -1141,6 +1201,7 @@
@Override
public void selectionChanged(final ZSelectionEvent _evt) {
modelArbre_.fireObservableChanged();
+ infoTextSelectionUpdated();
}
public ZEbliCalquesPanel duplicate(final Map options) {
@@ -1148,14 +1209,15 @@
}
/**
- * Cree un tableau qui r\xE9capitule le contenu des infos de cr\xE9ation de la vue 2d. Retourne un panel vide si aucune
- * infos n'est disponible.
- *
+ * Cree un tableau qui r\xE9capitule le contenu des infos de cr\xE9ation de la vue 2d. Retourne un panel vide si aucune infos n'est disponible.
+ *
* @return
*/
public BuPanel buildInfosCreationComposant() {
- if (infosCreation_ == null || infosCreation_.keySet() == null || infosCreation_.keySet().size() == 0) { return new BuPanel(); }
+ if (infosCreation_ == null || infosCreation_.keySet() == null || infosCreation_.keySet().size() == 0) {
+ return new BuPanel();
+ }
final JTable table = createTable();
@@ -1179,7 +1241,7 @@
JPanel top = new BuPanel(new BuBorderLayout());
top.add(new JLabel("<html><body><b>" + EbliLib.getS("Infos cr\xE9ations") + "</b></body></html>",
- SwingConstants.CENTER), BorderLayout.CENTER);
+ SwingConstants.CENTER), BorderLayout.CENTER);
top.add(bt, BuBorderLayout.EAST);
bt.setBorder(null);
bt.setMargin(BuInsets.INSETS0000);
@@ -1207,4 +1269,4 @@
return infosCreation_;
}
-}
\ 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 2014-02-11 14:28:04 UTC (rev 8608)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZCalqueLigneBriseeEditable.java 2014-02-11 15:48:26 UTC (rev 8609)
@@ -522,6 +522,7 @@
if (seg.distanceXY(_ptReel) < distanceReel) {
GrPoint ptOnSeg = seg.pointPlusProcheXY(_ptReel);
modeleDonnees().addPoint(geomIdx, j - 1, ptOnSeg.x_, ptOnSeg.y_, null, _cmd);
+ atomAdded(geomIdx, j - 1);
return true;
}
}
@@ -530,11 +531,17 @@
modele_.point(seg.o_, geomIdx, modele_.getNbPointForGeometry(geomIdx) - 1);
if (seg.distanceXY(_ptReel) < distanceReel) {
GrPoint ptOnSeg = seg.pointPlusProcheXY(_ptReel);
- modeleDonnees().addPoint(geomIdx, modele_.getNbPointForGeometry(geomIdx) - 1, ptOnSeg.x_, ptOnSeg.y_, null, _cmd);
+ final int idxOnLine = modele_.getNbPointForGeometry(geomIdx) - 1;
+ modeleDonnees().addPoint(geomIdx, idxOnLine, ptOnSeg.x_, ptOnSeg.y_, null, _cmd);
+ atomAdded(geomIdx, idxOnLine);
return true;
}
}
}
return false;
}
+
+ protected void atomAdded(int geomIdx, int idxOneLine) {
+
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|