|
From: <de...@us...> - 2012-05-30 21:42:08
|
Revision: 7253
http://fudaa.svn.sourceforge.net/fudaa/?rev=7253&view=rev
Author: deniger
Date: 2012-05-30 21:42:01 +0000 (Wed, 30 May 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GisAbscCurviligneToCoordinate.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/BCalque.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliCoordinateDefinition.java
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GisAbscCurviligneToCoordinate.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GisAbscCurviligneToCoordinate.java 2012-05-30 21:41:33 UTC (rev 7252)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/GisAbscCurviligneToCoordinate.java 2012-05-30 21:42:01 UTC (rev 7253)
@@ -80,19 +80,23 @@
Coordinate c2 = coordinateSequence.getCoordinate(i);
final double segmentLength = c2.distance(c1);
end = begin + segmentLength;
- if (targetLength >= begin && targetLength <= end) {
- if (res.coordinate == null) {
- res.coordinate = new Coordinate();
+ if (segmentLength > 0) {
+ if (targetLength >= begin && targetLength <= end) {
+ if (res.coordinate == null) {
+ res.coordinate = new Coordinate();
+ }
+ double ratio = (targetLength - begin) / segmentLength;
+ res.coordinate.x = c1.x + ratio * (c2.x - c1.x);
+ res.coordinate.y = c1.y + ratio * (c2.y - c1.y);
+
+ return;
}
- double ratio = (targetLength - begin) / segmentLength;
- res.coordinate.x = c1.x + ratio * (c2.x - c1.x);
- res.coordinate.y = c1.y + ratio * (c2.y - c1.y);
-
- return;
}
//we move to next segment
begin = end;
res.segmentidx++;
}
+ //non trouve:
+ res.segmentidx = -1;
}
}
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-05-30 21:41:33 UTC (rev 7252)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BArbreCalqueModel.java 2012-05-30 21:42:01 UTC (rev 7253)
@@ -1,9 +1,6 @@
/**
- * @creation 15 sept. 2003
- * @modification $Date$
- * @license GNU General Public License 2
- * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
- * @mail de...@fu...
+ * @creation 15 sept. 2003 @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;
@@ -55,8 +52,9 @@
*/
public class BArbreCalqueModel implements TreeModel, PropertyChangeListener, ActionListener, ContainerListener {
- private static final Object[] PROP_TO_LISTEN = CtuluLibArray.sort(new String[] { "foreground", "visible", "attenue",
- "rapide", "ajustement", "paletteCouleur", "iconeChanged", "title", "nodeEdit", "alpha", "model" });
+ private static final Object[] PROP_TO_LISTEN = CtuluLibArray.sort(
+ new String[]{"foreground", "visible", "attenue",
+ "rapide", "ajustement", "paletteCouleur", "iconeChanged", "title", "nodeEdit", "alpha", "model"});
private static String getActLast() {
return "DERNIER";
@@ -77,12 +75,9 @@
private static String getActCenter() {
return "CENTER";
}
-
BCalque calque_;
-
List listeners_;
- EbliActionInterface actDelete_=new TreeDeleteCalqueAction(this);
-
+ EbliActionInterface actDelete_ = new TreeDeleteCalqueAction(this);
final boolean mustListen_;
TreeSelectionModel selection_;
@@ -92,7 +87,7 @@
/**
* Constructeur.
- *
+ *
* @param _calque calque racine de l'arbre (GroupeCalque de la VueCalque)
*/
public BArbreCalqueModel(final BGroupeCalque _calque, final boolean _listener) {
@@ -202,9 +197,9 @@
} else if (action.equals(getActLast())) {
actLast(c);
} else if (action.equals("SET_SELECTABLE")) {
- actSetSelectable(c,true);
+ actSetSelectable(c, true);
} else if (action.equals("UNSET_SELECTABLE")) {
- actSetSelectable(c,false);
+ actSetSelectable(c, false);
} else {
int i = action.indexOf('_');
if (i >= 0) {
@@ -270,8 +265,10 @@
private void actSetSelectable(final BCalque[] _c, boolean _b) {
for (int i = 0; i < _c.length; i++) {
if (_c[i] instanceof ZCalqueAffichageDonneesAbstract) {
- ZCalqueAffichageDonneesAbstract cq=(ZCalqueAffichageDonneesAbstract)_c[i];
- if (cq.canSetSelectable()) cq.setSelectable(_b);
+ ZCalqueAffichageDonneesAbstract cq = (ZCalqueAffichageDonneesAbstract) _c[i];
+ if (cq.canSetSelectable()) {
+ cq.setSelectable(_b);
+ }
}
}
}
@@ -293,7 +290,7 @@
}
public void setActionDelete(EbliActionInterface _actionDelete) {
- actDelete_=_actionDelete;
+ actDelete_ = _actionDelete;
}
private void actionCenter(final BCalque[] _c) {
@@ -314,7 +311,7 @@
}
public static void actionCenter(final BCalque _c, final ZEbliCalquesPanel _vue) {
- actionCenter(new BCalque[] { _c }, _vue.getVueCalque(), _vue.getDonneesCalque(), _vue);
+ actionCenter(new BCalque[]{_c}, _vue.getVueCalque(), _vue.getDonneesCalque(), _vue);
}
public void addTreeModelListener(final TreeModelListener _l) {
@@ -342,8 +339,8 @@
final BCalque parent = (BCalque) c.getParent();
final int directCalqueIdx = parent.getDirectCalqueIdx(c);
Object[] path = getPath(parent);
- fireTreeModelEventAdded(new TreeModelEvent(this, new TreePath(path), new int[] { directCalqueIdx },
- new Object[] { c }));
+ fireTreeModelEventAdded(new TreeModelEvent(this, new TreePath(path), new int[]{directCalqueIdx},
+ new Object[]{c}));
}
setSelectionCalque(c);
fireObservableChanged("added");
@@ -352,7 +349,7 @@
Object[] getPath(final BCalque _cq) {
final List l = new ArrayList(5);
if (_cq == getRootCalque()) {
- return new Object[] { _cq };
+ return new Object[]{_cq};
}
l.add(_cq);
BCalque parent = _cq;
@@ -376,26 +373,27 @@
}
final BCalque parent = (BCalque) _e.getContainer();
if (parent != null) {
-/* final Integer integer = ((Integer) c.getClientProperty("oldIndice"));
- if (integer == null) {
-*/ refresh();
-/* } else {
- fireTreeModelEventRemoved(new TreeModelEvent(this, new TreePath(getPath(parent)), new int[] { integer
- .intValue() }, new Object[] { c }));
- }
-*/ setSelectionCalque(parent);
+ /*
+ * final Integer integer = ((Integer) c.getClientProperty("oldIndice")); if (integer == null) {
+ */ refresh();
+ /*
+ * } else { fireTreeModelEventRemoved(new TreeModelEvent(this, new TreePath(getPath(parent)), new int[] { integer
+ * .intValue() }, new Object[] { c })); }
+ */ setSelectionCalque(parent);
}
fireObservableChanged("removed");
}
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("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.addSeparator();
- _m.addMenuItem(EbliResource.EBLI.getString("S\xE9lectionnable"), "SET_SELECTABLE", EbliResource.EBLI.getIcon("fleche"), true, 0, this);
- _m.addMenuItem(EbliResource.EBLI.getString("Non s\xE9lectionnable"), "UNSET_SELECTABLE", EbliResource.EBLI.getIcon("non-selectionnable"), true, 0, this);
+ _m.addMenuItem(EbliResource.EBLI.getString("S\xE9lectionnable"), "SET_SELECTABLE", EbliResource.EBLI.getIcon("fleche"), true, 0,
+ this);
+ _m.addMenuItem(EbliResource.EBLI.getString("Non s\xE9lectionnable"), "UNSET_SELECTABLE", EbliResource.EBLI.getIcon(
+ "non-selectionnable"), true, 0, this);
_m.addSeparator();
_m.addMenuItem(EbliResource.EBLI.getString("Att\xE9nu\xE9"), "ATTENUE_OUI", null, true, 0, this);
_m.addMenuItem(EbliResource.EBLI.getString(getActNormal()), "ATTENUE_NON", null, true, 0, this);
@@ -407,11 +405,11 @@
_m.addMenuItem(EbliResource.EBLI.getString("Actif"), "GELE_NON", null, true, 0, this);
_m.addSeparator();
_m.addMenuItem(EbliResource.EBLI.getString("En premier"), getActPrem(), EbliResource.EBLI.getIcon("enpremier"),
- true, 0, this);
+ 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(EbliResource.EBLI.getString("En dernier"), getActLast(), EbliResource.EBLI.getIcon("endernier"),
- true, 0, this);
+ true, 0, this);
_m.addSeparator();
_m.add(new JMenuItem(actDelete_));
}
@@ -421,14 +419,16 @@
}
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("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);
it.setIcon(BuResource.BU.getIcon("cacher"));
_m.addSeparator();
- _m.addMenuItem(EbliResource.EBLI.getString("S\xE9lectionnable"), "SET_SELECTABLE", EbliResource.EBLI.getIcon("fleche"), true, this);
- _m.addMenuItem(EbliResource.EBLI.getString("Non s\xE9lectionnable"), "UNSET_SELECTABLE", EbliResource.EBLI.getIcon("non-selectionnable"), true, this);
+ _m.addMenuItem(EbliResource.EBLI.getString("S\xE9lectionnable"), "SET_SELECTABLE", EbliResource.EBLI.getIcon("fleche"), true,
+ this);
+ _m.addMenuItem(EbliResource.EBLI.getString("Non s\xE9lectionnable"), "UNSET_SELECTABLE", EbliResource.EBLI.getIcon(
+ "non-selectionnable"), true, this);
_m.addSeparator();
_m.addMenuItem(EbliResource.EBLI.getString("Att\xE9nu\xE9"), "ATTENUE_OUI", null, true, this);
_m.addMenuItem(EbliResource.EBLI.getString(getActNormal()), "ATTENUE_NON", null, true, this);
@@ -440,11 +440,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);
+ 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);
_m.addMenuItem(EbliResource.EBLI.getString("En dernier"), getActLast(), EbliResource.EBLI.getIcon("endernier"),
- true, this);
+ true, this);
_m.addSeparator();
_m.add(new JMenuItem(actDelete_));
}
@@ -458,11 +458,11 @@
}
private void fillPopupMenu(final CtuluPopupMenu _m, final BCalque _c) {
- if ((_c == null) ) {
+ if ((_c == null)) {
return;
}
- _m.addMenuItem(EbliResource.EBLI.getString("Centrer la vue"), getActCenter(), EbliResource.EBLI
- .getToolIcon("zoom-layer"), true, this);
+ _m.addMenuItem(EbliResource.EBLI.getString("Centrer la vue"), getActCenter(), EbliResource.EBLI.getToolIcon("zoom-layer"),
+ true, this);
/*
* if (_c instanceof BCalqueAffichage) { final BCalqueAffichage ca = (BCalqueAffichage) _c;
* _m.addCheckBox(EbliResource.EBLI.getString("Att\xE9nu\xE9"), "ATTENUE", true, ca.isAttenue(), _arbre);
@@ -474,24 +474,26 @@
}
_m.addCheckBox(EbliResource.EBLI.getString("Visible"), "VISIBLE", true, _c.isVisible(), this);
if (_c instanceof ZCalqueAffichageDonneesAbstract) {
- ZCalqueAffichageDonneesAbstract cq=(ZCalqueAffichageDonneesAbstract)_c;
+ ZCalqueAffichageDonneesAbstract cq = (ZCalqueAffichageDonneesAbstract) _c;
if (cq.canSetSelectable()) {
- BuCheckBoxMenuItem mi=
- _m.addCheckBox(EbliResource.EBLI.getString("S\xE9lectionnable"), "SELECTABLE", EbliResource.EBLI.getIcon("fleche"), true, cq.isSelectable());
+ BuCheckBoxMenuItem mi =
+ _m.addCheckBox(EbliResource.EBLI.getString("S\xE9lectionnable"), "SELECTABLE", EbliResource.EBLI.getIcon(
+ "fleche"), true, cq.isSelectable());
mi.addActionListener(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);
- _m.addMenuItem(EbliResource.EBLI.getString("En dernier"), getActLast(), EbliResource.EBLI.getIcon("endernier"),
- true, this);
+ 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);
+ _m.addMenuItem(EbliResource.EBLI.getString("En dernier"), getActLast(), EbliResource.EBLI.getIcon("endernier"),
+ true, this);
+ }
if (_c.isTitleModifiable()) {
- _m
- .addMenuItem(EbliResource.EBLI.getString("Renommer"), "RENAME", BuResource.BU.getIcon("renommer"), true,
- this);
+ _m.addMenuItem(EbliResource.EBLI.getString("Renommer"), "RENAME", BuResource.BU.getIcon("renommer"), true,
+ this);
}
if (_c.isDestructible()) {
_m.addSeparator();
@@ -612,7 +614,6 @@
public final boolean isMustListen() {
return mustListen_;
}
-
Observable observable_;
static class SpecialObservable extends Observable {
@@ -647,7 +648,7 @@
public void propertyChange(final PropertyChangeEvent _evt) {
final String propertyName = _evt.getPropertyName();
if (Arrays.binarySearch(PROP_TO_LISTEN, propertyName) >= 0) {
- fireTreeModelEvent(new TreeModelEvent(this, new Object[] { _evt.getSource() }));
+ fireTreeModelEvent(new TreeModelEvent(this, new Object[]{_evt.getSource()}));
} else if (_evt.getSource() == calque_ && _evt.getPropertyName().equals("versEcran")) {
fireObservableChanged(propertyName);
@@ -665,7 +666,7 @@
public final void refresh() {
final BCalque p = getSelectedCalque();
- final TreeModelEvent ev = new TreeModelEvent(this, new Object[] { calque_ });
+ final TreeModelEvent ev = new TreeModelEvent(this, new Object[]{calque_});
fireTreeModelStructureEvent(ev);
setSelectionCalque(p);
}
@@ -709,23 +710,24 @@
}
selection_.addSelectionPaths(ps);
}
-
+
/**
* Autorise la selection multicalques.
* @param _b true La selection est multicalques, false sinon.
*/
public void setSelectionMultiCalques(boolean _b) {
- if (_b)
+ if (_b) {
selection_.setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
- else
+ } else {
selection_.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
-
+ }
+
}
-
+
public boolean isSelectionMultiCalques() {
- return selection_.getSelectionMode()!=TreeSelectionModel.SINGLE_TREE_SELECTION;
+ return selection_.getSelectionMode() != TreeSelectionModel.SINGLE_TREE_SELECTION;
}
- public void valueForPathChanged(final TreePath _path, final Object _newValue) {}
-
+ public void valueForPathChanged(final TreePath _path, final Object _newValue) {
+ }
}
\ No newline at end of file
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-05-30 21:41:33 UTC (rev 7252)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/BCalque.java 2012-05-30 21:42:01 UTC (rev 7253)
@@ -88,6 +88,14 @@
return null;
}
+
+ /**
+ *
+ * @return true if the layer can be move up or down.
+ */
+ public boolean isMovable(){
+ return true;
+ }
public static int findCalqueIdxByName(final BCalque[] _cq, final String _name) {
if (_cq != null && _name != 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 2012-05-30 21:41:33 UTC (rev 7252)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZEbliCalquePanelController.java 2012-05-30 21:42:01 UTC (rev 7253)
@@ -354,8 +354,10 @@
action.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('m'));
navigationActionGroup_[i++] = action;
// REFERENCE
-
- navigationActionGroup_[i++] = createRepereAction();
+ final EbliActionInterface createRepereAction = createRepereAction();
+ if (createRepereAction != null) {
+ navigationActionGroup_[i++] = createRepereAction;
+ }
// NAVIGATION
final EbliActionPaletteAbstract plAction = new EbliActionPaletteAbstract(EbliLib.getS("Navigation"),
EbliResource.EBLI.getIcon("navigation"), "NAVIGATE") {
Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliCoordinateDefinition.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliCoordinateDefinition.java 2012-05-30 21:41:33 UTC (rev 7252)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliCoordinateDefinition.java 2012-05-30 21:42:01 UTC (rev 7253)
@@ -1,7 +1,5 @@
package org.fudaa.ebli.commun;
-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.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|