From: <de...@us...> - 2012-05-25 17:08:23
|
Revision: 7235 http://fudaa.svn.sourceforge.net/fudaa/?rev=7235&view=rev Author: deniger Date: 2012-05-25 17:08:16 +0000 (Fri, 25 May 2012) Log Message: ----------- Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePoint.java trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceIcon.java trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceIconModel.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2012-05-25 16:28:29 UTC (rev 7234) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2012-05-25 17:08:16 UTC (rev 7235) @@ -114,6 +114,7 @@ protected EbliListeSelectionMulti creeSelectionMulti() { return new EbliListeSelectionMulti(modeleDonnees().getNombre() / 2); } + protected void initTrace(final TraceIconModel _icon, final int _idxPoly) { _icon.updateData(getIconModel(0)); Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2012-05-25 16:28:29 UTC (rev 7234) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueLigneBrisee.java 2012-05-25 17:08:16 UTC (rev 7235) @@ -175,8 +175,6 @@ tl= ligneModel_.buildCopy(); final TraceLigneModel ligneModel = tl.getModel(); - final TraceIconModel iconeModel = iconModel_ == null ? null : new TraceIconModel(iconModel_); - final TraceIcon icone = iconeModel == null ? null : new TraceIcon(iconeModel); final GrBoite bPoly = new GrBoite(); bPoly.o_ = new GrPoint(); bPoly.e_ = new GrPoint(); Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePoint.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePoint.java 2012-05-25 16:28:29 UTC (rev 7234) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalquePoint.java 2012-05-25 17:08:16 UTC (rev 7235) @@ -125,7 +125,8 @@ protected ZModelePoint modele_; /** - * */ + * + */ public ZCalquePoint() { this(null); } @@ -276,13 +277,7 @@ } final double z = p_.z_; p_.autoApplique(_versEcran); - if (!rapide && isPaletteCouleurUsed_ && (paletteCouleur_ != null)) { - Color c = ((BPalettePlage) paletteCouleur_).getColorFor(z); - if (attenue) { - c = attenueCouleur(c); - } - icone.setCouleur(c); - } + initTrace(icone.getModel(), i, p_.z_); icone.paintIconCentre(this, _g, (int) p_.x_, (int) p_.y_); paintLabels(_g, i, p_); } @@ -297,6 +292,22 @@ return icone; } + /** + * Called for each point. By default use to color palette to set the color + * @param model + * @param i + * @param z + */ + protected void initTrace(TraceIconModel model, int i, double z) { + if (!isRapide() && isPaletteCouleurUsed_ && (paletteCouleur_ != null)) { + Color c = ((BPalettePlage) paletteCouleur_).getColorFor(z); + if (isAttenue()) { + c = attenueCouleur(c); + } + model.setCouleur(c); + } + } + public LineString getSelectedLine() { if (getNbSelected() != 2) { return null; Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceIcon.java =================================================================== --- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceIcon.java 2012-05-25 16:28:29 UTC (rev 7234) +++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceIcon.java 2012-05-25 17:08:16 UTC (rev 7235) @@ -37,16 +37,7 @@ public final static int PLUS_DOUBLE = 13; public final static int CARRE_ARRONDI = 14; private TraceIconModel model_; - private TraceLigne traceLigne; - public void setTraceLigne(TraceLigne traceLigne) { - this.traceLigne = traceLigne; - } - - public TraceLigne getTraceLigne() { - return traceLigne; - } - public final TraceIconModel getModel() { return model_; } @@ -105,20 +96,7 @@ public Color getCouleur() { return model_.couleur_; } - private Color filledColor; - /** - * used for shape that are not filled ( circle, ...) If not null, the shape will be fill with this color. - * @return - */ - public Color getFilledColor() { - return filledColor; - } - - public void setFilledColor(Color filledColor) { - this.filledColor = filledColor; - } - public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) { Color old = null; if (model_.couleur_ != null) { @@ -127,8 +105,10 @@ } final Graphics2D g2d = (Graphics2D) _g; Stroke oldStroke = (g2d).getStroke(); - if (traceLigne != null) { - traceLigne.initialisationGraphics(g2d); + + if (model_.typeLigne_ > 0 && model_.epaisseurLigne_ > 0) { + TraceLigneModel ligneModel = new TraceLigneModel(model_.typeLigne_, model_.epaisseurLigne_, g2d.getColor()); + new TraceLigne(ligneModel).initialisationGraphics(g2d); } final int x = _x; final int y = _y; @@ -176,22 +156,23 @@ _g.drawLine(x, y + taille - 1, x + taille - 1, y); break; case CARRE: - if (filledColor != null) { + if (model_.backgroundColor != null) { Color current = _g.getColor(); - _g.setColor(filledColor); + _g.setColor(model_.backgroundColor); _g.fillRect(x, y, taille - 1, taille - 1); _g.setColor(current); } _g.drawRect(x, y, taille - 1, taille - 1); break; case CARRE_ARRONDI: - if (filledColor != null) { + int arc = Math.max(1, (int) (taille * 0.2)); + if (model_.backgroundColor != null) { Color current = _g.getColor(); - _g.setColor(filledColor); - _g.fillRoundRect(x, y, taille - 1, taille - 1, 1, 1); + _g.setColor(model_.backgroundColor); + _g.fillRoundRect(x, y, taille - 1, taille - 1, arc, arc); _g.setColor(current); } - _g.drawRoundRect(x, y, taille - 1, taille - 1, 1, 1); + _g.drawRoundRect(x, y, taille - 1, taille - 1, arc, arc); break; case CARRE_SELECTION: _g.drawRect(x, y, taille - 1, taille - 1); @@ -229,9 +210,9 @@ y + taille - 1}, 4); break; case CERCLE: - if (filledColor != null) { + if (model_.backgroundColor != null) { Color current = _g.getColor(); - _g.setColor(filledColor); + _g.setColor(model_.backgroundColor); _g.fillArc(x, y, taille - 1, taille - 1, 0, 360); _g.setColor(current); } Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceIconModel.java =================================================================== --- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceIconModel.java 2012-05-25 16:28:29 UTC (rev 7234) +++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceIconModel.java 2012-05-25 17:08:16 UTC (rev 7235) @@ -18,9 +18,11 @@ public class TraceIconModel { Color couleur_; + Color backgroundColor; int taille_; - int type_; + float epaisseurLigne_ = 1f; + int typeLigne_ = TraceLigne.LISSE; public TraceIconModel() { setDefaults(); @@ -34,7 +36,9 @@ } public boolean equals(Object _obj) { - if (_obj == this) return true; + if (_obj == this) { + return true; + } if (_obj instanceof TraceIconModel) { TraceIconModel other = (TraceIconModel) _obj; return taille_ == other.taille_ && type_ == other.type_ && CtuluLib.isEquals(couleur_, other.couleur_); @@ -107,10 +111,22 @@ return taille_ < 0; } + public boolean isEpaisseurIgnored() { + return epaisseurLigne_ < 0; + } + public boolean isTypeIgnored() { return type_ < 0; } + public boolean isTypeLigneIgnored() { + return typeLigne_ < 0; + } + + public boolean isBackgroundColorIgnored() { + return backgroundColor == null; + } + public boolean keepCommonValues(final TraceIconModel _d) { if (type_ != _d.type_) { type_ = -1; @@ -121,7 +137,16 @@ if (couleur_ != null && !couleur_.equals(_d.couleur_)) { couleur_ = null; } - return type_ >= 0 || taille_ >= 0 && couleur_ != null; + if (typeLigne_ != _d.typeLigne_) { + typeLigne_ = -1; + } + if (epaisseurLigne_ != _d.epaisseurLigne_) { + epaisseurLigne_ = -1; + } + if (backgroundColor != null && !backgroundColor.equals(_d.backgroundColor)) { + backgroundColor = null; + } + return type_ >= 0 || taille_ >= 0 && couleur_ != null && typeLigne_ > 0 && epaisseurLigne_ > 0; } @@ -130,7 +155,9 @@ } public boolean setCouleur(final Color _couleur) { - if (_couleur == couleur_) return false; + if (_couleur == couleur_) { + return false; + } couleur_ = _couleur; return true; } @@ -161,7 +188,9 @@ */ public boolean updateData(final TraceIconModel _model) { - if (_model == null) return false; + if (_model == null) { + return false; + } boolean r = false; if (!_model.isColorIgnored() && (!_model.getCouleur().equals(getCouleur()))) { setCouleur(_model.getCouleur()); @@ -175,7 +204,14 @@ setTaille(_model.getTaille()); r = true; } + if (!_model.isEpaisseurIgnored() && _model.epaisseurLigne_ != epaisseurLigne_) { + epaisseurLigne_ = _model.epaisseurLigne_; + r = true; + } + if (!_model.isTypeLigneIgnored() && _model.typeLigne_ != typeLigne_) { + typeLigne_ = _model.typeLigne_; + r = true; + } return r; } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |