|
From: <bma...@us...> - 2017-06-01 15:50:27
|
Revision: 9623
http://sourceforge.net/p/fudaa/svn/9623
Author: bmarchan
Date: 2017-06-01 15:50:25 +0000 (Thu, 01 Jun 2017)
Log Message:
-----------
Ajout de la configuration des labels pour le calque ZCalqueEditable
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/ZCalqueGeometryLabelConfigure.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZCalquePointEditable.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 2017-06-01 15:48:31 UTC (rev 9622)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2017-06-01 15:50:25 UTC (rev 9623)
@@ -165,7 +165,7 @@
protected void drawLabelOnAtomic(final FontMetrics fm, String s, final GrPoint ptDest, final Color bgColor, final Graphics2D _g, final Color fgColor) {
int stringWidth = fm.stringWidth(s);
int x = (int) (ptDest.x_ - stringWidth / 2);
- int y = (int) (ptDest.y_ - 5);
+ int y = (int) (ptDest.y_ - 10);
if (bgColor != null) {
_g.setColor(bgColor);
_g.fillRect(x, y - fm.getAscent(), stringWidth, fm.getHeight() + 2);
@@ -677,7 +677,7 @@
@Override
protected BConfigurableInterface getAffichageConf() {
- final BConfigurableInterface[] sect = new BConfigurableInterface[3 + getNbSet()];
+ final BConfigurableInterface[] sect = new BConfigurableInterface[2 + getNbSet()];
sect[0] = new ZCalqueAffichageDonneesConfigure(this);
sect[1] = new ZCalqueGeometryLabelConfigure(this);
for (int i = 2; i < sect.length; i++) {
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometryLabelConfigure.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometryLabelConfigure.java 2017-06-01 15:48:31 UTC (rev 9622)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometryLabelConfigure.java 2017-06-01 15:50:25 UTC (rev 9623)
@@ -11,6 +11,8 @@
import java.awt.Font;
import java.util.ArrayList;
import java.util.List;
+
+import org.fudaa.ebli.calque.edition.ZCalquePointEditable;
import org.fudaa.ebli.commun.EbliLib;
import org.fudaa.ebli.controle.BSelecteurColorChooserBt;
import org.fudaa.ebli.controle.BSelecteurFont;
@@ -26,11 +28,11 @@
public static final String PROPERTY_LABELS_FOREGROUND = "labelsForegroundColor";
public static final String PROPERTY_LABELS_BACKGROUND = "labelsBackgroundColor";
- public ZCalqueGeometryLabelConfigure(final ZCalqueGeometry _target, final boolean _addVisible) {
+ public ZCalqueGeometryLabelConfigure(final ZCalqueAffichageDonneesAbstract _target, final boolean _addVisible) {
super(_target, EbliLib.getS("Labels"));
}
- public ZCalqueGeometryLabelConfigure(final ZCalqueGeometry _target) {
+ public ZCalqueGeometryLabelConfigure(final ZCalqueAffichageDonneesAbstract _target) {
this(_target, false);
}
@@ -41,11 +43,23 @@
return true;
}
if (PROPERTY_LABELS_FOREGROUND.equals(_key)) {
- ((ZCalqueGeometry) target_).setLabelsForegroundColor(((Color) _newProp));
+ if (target_ instanceof ZCalqueGeometry) {
+ ((ZCalqueGeometry) target_).setLabelsForegroundColor(((Color) _newProp));
+ }
+ // Etendu aux ZCalquePointEditable, qui devraient d\xE9river de ZCalqueGeometry
+ else if (target_ instanceof ZCalquePointEditable) {
+ ((ZCalquePointEditable) target_).setLabelsForegroundColor(((Color) _newProp));
+ }
return true;
}
if (PROPERTY_LABELS_BACKGROUND.equals(_key)) {
- ((ZCalqueGeometry) target_).setLabelsBackgroundColor(((Color) _newProp));
+ if (target_ instanceof ZCalqueGeometry) {
+ ((ZCalqueGeometry) target_).setLabelsBackgroundColor(((Color) _newProp));
+ }
+ // Etendu aux ZCalquePointEditable, qui devraient d\xE9river de ZCalqueGeometry
+ else if (target_ instanceof ZCalquePointEditable) {
+ ((ZCalquePointEditable) target_).setLabelsBackgroundColor(((Color) _newProp));
+ }
return true;
}
return false;
@@ -57,10 +71,22 @@
return ((ZCalqueAffichageDonneesAbstract) target_).getFont();
}
if (PROPERTY_LABELS_FOREGROUND.equals(_key)) {
- return ((ZCalqueGeometry) target_).getLabelsForegroundColor();
+ if (target_ instanceof ZCalqueGeometry) {
+ return ((ZCalqueGeometry) target_).getLabelsForegroundColor();
+ }
+ // Etendu aux ZCalquePointEditable, qui devraient d\xE9river de ZCalqueGeometry
+ else if (target_ instanceof ZCalquePointEditable) {
+ return ((ZCalquePointEditable) target_).getLabelsForegroundColor();
+ }
}
if (PROPERTY_LABELS_BACKGROUND.equals(_key)) {
- return ((ZCalqueGeometry) target_).getLabelsBackgroundColor();
+ if (target_ instanceof ZCalqueGeometry) {
+ return ((ZCalqueGeometry) target_).getLabelsBackgroundColor();
+ }
+ // Etendu aux ZCalquePointEditable, qui devraient d\xE9river de ZCalqueGeometry
+ else if (target_ instanceof ZCalquePointEditable) {
+ return ((ZCalquePointEditable) target_).getLabelsBackgroundColor();
+ }
}
return null;
}
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZCalquePointEditable.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZCalquePointEditable.java 2017-06-01 15:48:31 UTC (rev 9622)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/edition/ZCalquePointEditable.java 2017-06-01 15:50:25 UTC (rev 9623)
@@ -7,13 +7,11 @@
*/
package org.fudaa.ebli.calque.edition;
-import com.memoire.fu.FuLog;
-import com.vividsolutions.jts.geom.Geometry;
-import gnu.trove.TObjectIntHashMap;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
+
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.fudaa.ctulu.CtuluCommandComposite;
@@ -25,6 +23,8 @@
import org.fudaa.ctulu.CtuluUI;
import org.fudaa.ctulu.gis.GISAttributeInterface;
import org.fudaa.ctulu.gis.GISZoneCollection;
+import org.fudaa.ebli.calque.ZCalqueAffichageDonneesConfigure;
+import org.fudaa.ebli.calque.ZCalqueAffichageDonneesTraceConfigure;
import org.fudaa.ebli.calque.ZCalqueGeometry.SelectionMode;
import org.fudaa.ebli.calque.ZCalqueGeometryLabelConfigure;
import org.fudaa.ebli.calque.ZCalquePoint;
@@ -34,6 +34,9 @@
import org.fudaa.ebli.calque.find.CalqueFindActionAtomic;
import org.fudaa.ebli.calque.find.CalqueFindPointExpression;
import org.fudaa.ebli.commun.EbliLib;
+import org.fudaa.ebli.commun.EbliUIProperties;
+import org.fudaa.ebli.controle.BConfigurableComposite;
+import org.fudaa.ebli.controle.BConfigurableInterface;
import org.fudaa.ebli.find.EbliFindExpressionContainerInterface;
import org.fudaa.ebli.geometrie.GrBoite;
import org.fudaa.ebli.geometrie.GrMorphisme;
@@ -41,8 +44,14 @@
import org.fudaa.ebli.geometrie.GrPoint;
import org.fudaa.ebli.geometrie.GrSegment;
import org.fudaa.ebli.trace.TraceIcon;
+import org.fudaa.ebli.trace.TraceLigneModel;
import org.nfunk.jep.Variable;
+import com.memoire.fu.FuLog;
+import com.vividsolutions.jts.geom.Geometry;
+
+import gnu.trove.TObjectIntHashMap;
+
/**
* @author Fred Deniger
* @version $Id$
@@ -85,7 +94,7 @@
protected void drawLabel(FontMetrics fm, String s, GrPoint pEcran, Color bgColor, Graphics2D _g, Color fgColor) {
int stringWidth = fm.stringWidth(s);
int x = (int) (pEcran.x_ - stringWidth / 2);
- int y = (int) (pEcran.y_ - 5);
+ int y = (int) (pEcran.y_ - 10);
if (bgColor != null) {
_g.setColor(bgColor);
_g.fillRect(x, y - fm.getAscent(), stringWidth, fm.getHeight() + 2);
@@ -185,8 +194,43 @@
}
clearCacheAndRepaint();
}
+
+ @Override
+ protected BConfigurableInterface getAffichageConf() {
+ final BConfigurableInterface[] sect = new BConfigurableInterface[2 + 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"));
+ }
@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(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_BACKGROUND)) {
+ setLabelsBackgroundColor((Color) _p.get(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_BACKGROUND));
+ } else {
+ setLabelsBackgroundColor(null);
+ }
+ if (_p.isDefined(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_FOREGROUND)) {
+ setLabelsForegroundColor((Color) _p.get(ZCalqueGeometryLabelConfigure.PROPERTY_LABELS_FOREGROUND));
+ }
+
+ }
+ }
+
+ @Override
public void paintDonnees(Graphics2D _g, GrMorphisme _versEcran, GrMorphisme _versReel, GrBoite _clipReel) {
super.paintDonnees(_g, _versEcran, _versReel, _clipReel);
paintLabelsOnAtomics(_g, _versEcran, _versReel, _clipReel);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|