|
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.
|