|
From: <de...@us...> - 2013-01-03 23:00:50
|
Revision: 8175
http://fudaa.svn.sourceforge.net/fudaa/?rev=8175&view=rev
Author: deniger
Date: 2013-01-03 23:00:41 +0000 (Thu, 03 Jan 2013)
Log Message:
-----------
Modified Paths:
--------------
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/CtuluLibGeometrie.java
trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/gml/GMLReader.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/CalqueGISTreeModel.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/CalqueGeometryVisitor.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java
trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/find/CalqueFindCourbeTreeModel.java
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/geometrie/GrPoint.java
trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceIcon.java
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/CtuluLibGeometrie.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/CtuluLibGeometrie.java 2013-01-03 22:57:03 UTC (rev 8174)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/CtuluLibGeometrie.java 2013-01-03 23:00:41 UTC (rev 8175)
@@ -122,7 +122,8 @@
// le vecteur de norme (on reutilise le variable projx)
projx = (_x - _segX1) - projx;
projy = (_y - _segY1) - projy;
- return Math.hypot(projx, projy);
+ return Math.sqrt(projx * projx + projy * projy);
+// too slow: return Math.hypot(projx, projy);
}
// public static double distanceAuCarreFromSegment(final double _segX1, final double _segY1, final double _segX2,
@@ -175,7 +176,7 @@
// le vecteur de norme (on reutilise le variable projx)
projx = (_x3 - _x1) - projx;
projy = (_y3 - _y1) - projy;
- return d1d2 * Math.hypot(projx, projy) / 2;
+ return d1d2 * Math.sqrt(projx * projx + projy * projy) / 2;
}
/**
Modified: trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/gml/GMLReader.java
===================================================================
--- trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/gml/GMLReader.java 2013-01-03 22:57:03 UTC (rev 8174)
+++ trunk/framework/ctulu-gis/src/main/java/org/fudaa/ctulu/gis/gml/GMLReader.java 2013-01-03 23:00:41 UTC (rev 8175)
@@ -917,12 +917,12 @@
Coordinate coord = new Coordinate();
int dim;
String numb;
- StringBuffer sb;
+ StringBuilder sb;
int t;
char ch;
// remove \n and \r and replace with spaces
- sb = new StringBuffer(_ptString);
+ sb = new StringBuilder(_ptString);
for (t = 0; t < sb.length(); t++) {
ch = sb.charAt(t);
@@ -931,8 +931,8 @@
sb.setCharAt(t, ' ');
}
}
-
final StringTokenizer stokenizer = new StringTokenizer(new String(sb), CtuluLibString.ESPACE, false);
+
while (stokenizer.hasMoreElements()) {
// have a point in memory - handle the single point
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/CalqueGISTreeModel.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/CalqueGISTreeModel.java 2013-01-03 22:57:03 UTC (rev 8174)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/CalqueGISTreeModel.java 2013-01-03 23:00:41 UTC (rev 8175)
@@ -193,11 +193,14 @@
* Cr\xE9ation du modele a partir de la racine des calques.
*/
public CalqueGISTreeModel(final BArbreCalqueModel _model, final BGroupeCalque _root) {
+ this(_model,_root,GISLib.MASK_ALL);
+ }
+ public CalqueGISTreeModel(final BArbreCalqueModel _model, final BGroupeCalque _root,int mask) {
super(new LayerNode(_root));
+ finder_.setMask(mask);
if (_model != null) {
_model.getObservable().addObserver(this);
}
-
setRootLayer(_root);
}
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/CalqueGeometryVisitor.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/CalqueGeometryVisitor.java 2013-01-03 22:57:03 UTC (rev 8174)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/CalqueGeometryVisitor.java 2013-01-03 23:00:41 UTC (rev 8175)
@@ -35,7 +35,7 @@
if (found_) {
return false;
}
- if (_cq == null || _cq.isGroupeCalque()) {
+ if (_cq == null) {
return true;
}
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 2013-01-03 22:57:03 UTC (rev 8174)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/ZCalqueGeometry.java 2013-01-03 23:00:41 UTC (rev 8175)
@@ -585,6 +585,7 @@
@Override
public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel,
final GrBoite _clipReel) {
+ long to = System.nanoTime();
if ((modele_ == null) || (modele_.getNombre() <= 0)) {
return;
}
@@ -654,6 +655,7 @@
paintIconsOnAtomics(_g, _versEcran, _versReel, _clipReel);
// Enfin les labels sur les atomiques.
paintLabelsOnAtomics(_g, _versEcran, _versReel, _clipReel);
+ System.err.println("time to paint " + (System.nanoTime() - to) / 1e6);
}
protected void paintSurfaces(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel,
@@ -744,6 +746,8 @@
} else {
icone = iconeModel == null ? null : new TraceIcon(iconeModel);
}
+ int w = getWidth() + 1;
+ CtuluListSelection memory = new CtuluListSelection(w * getHeight());
// on trace les icones apres pour qu'ils soient dessin\xE9s au-dessus des lignes.
if (icone != null) {
@@ -781,8 +785,12 @@
if (!isRapide()) {
initTraceForAtomics(iconeModel, i, j);
}
- ptDest.autoApplique(versEcran);
- icone.paintIconCentre(this, _g, ptDest.x_, ptDest.y_);
+ ptDest.autoApplique2D(versEcran);
+ int idxOnScreen = (int) ptDest.x_ + (int) ptDest.y_ * w;
+ if (idxOnScreen >= 0 && !memory.isSelected(idxOnScreen)) {
+ icone.paintIconCentre(this, _g, ptDest.x_, ptDest.y_);
+ memory.add(idxOnScreen);
+ }
}
}
}
@@ -844,7 +852,7 @@
continue;
}
- ptDest.autoApplique(versEcran);
+ ptDest.autoApplique2D(versEcran);
final Rectangle2D rec = fm.getStringBounds(s, _g);
double x = ptDest.x_ - rec.getWidth() / 2;
double y = ptDest.y_ - 5;
@@ -862,6 +870,7 @@
@Override
public void paintSelection(final Graphics2D _g, final ZSelectionTrace _trace, final GrMorphisme _versEcran,
final GrBoite _clipReel) {
+ long to = System.nanoTime();
if (isSelectionEmpty()) {
return;
}
@@ -878,6 +887,7 @@
} else {
paintSelectionSimple(_g, _trace, _versEcran, _clipReel, selection_);
}
+ System.err.println("time to selection " + (System.nanoTime() - to) / 1e6);
}
public void paintSelectionSimple(final Graphics _g, final ZSelectionTrace _trace, final GrMorphisme _versEcran,
@@ -916,16 +926,30 @@
boolean bferm = modele_.isGeometryFermee(i);
boolean breli = modele_.isGeometryReliee(i);
+ int w = getWidth() + 1;
+ CtuluListSelection memory = new CtuluListSelection(w * getHeight());
+
+
final GrPoint ptOri = new GrPoint();
modele_.point(ptOri, i, nbPoints - 1);
- ptOri.autoApplique(versEcran);
- ic.paintIconCentre(this, _g, ptOri.x_, ptOri.y_);
+ ptOri.autoApplique2D(versEcran);
+
+ int idxOnScreen = (int) ptOri.x_ + (int) ptOri.y_ * w;
+ if (idxOnScreen >= 0 && !memory.isSelected(idxOnScreen)) {
+ ic.paintIconCentre(this, _g, ptOri.x_, ptOri.y_);
+ memory.add(idxOnScreen);
+ }
+
final GrPoint ptDest = new GrPoint();
for (int j = nbPoints - 2; j >= 0; j--) {
// le point de dest est initialise
modele_.point(ptDest, i, j);
- ptDest.autoApplique(versEcran);
- ic.paintIconCentre(this, _g, ptDest.x_, ptDest.y_);
+ ptDest.autoApplique2D(versEcran);
+ idxOnScreen = (int) ptDest.x_ + (int) ptDest.y_ * w;
+ if (idxOnScreen >= 0 && !memory.isSelected(idxOnScreen)) {
+ ic.paintIconCentre(this, _g, ptDest.x_, ptDest.y_);
+ memory.add(idxOnScreen);
+ }
if (breli) {
tlSelection.dessineTrait((Graphics2D) _g, ptOri.x_, ptOri.y_, ptDest.x_, ptDest.y_);
}
@@ -933,7 +957,7 @@
}
if (bferm) {
modele_.point(ptOri, i, nbPoints - 1);
- ptOri.autoApplique(versEcran);
+ ptOri.autoApplique2D(versEcran);
if (breli) {
tlSelection.dessineTrait((Graphics2D) _g, ptOri.x_, ptOri.y_, ptDest.x_, ptDest.y_);
}
Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/find/CalqueFindCourbeTreeModel.java
===================================================================
--- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/find/CalqueFindCourbeTreeModel.java 2013-01-03 22:57:03 UTC (rev 8174)
+++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/find/CalqueFindCourbeTreeModel.java 2013-01-03 23:00:41 UTC (rev 8175)
@@ -44,10 +44,9 @@
import org.fudaa.ebli.ressource.EbliResource;
/**
- * Une classe permettant d'avoir un TreeModel repr\xE9sentant les calques conteant des lignes bris\xE9es et les lignes bris\xE9es
- * Il est possible d'avoir que les calques contenant des lignes ferm\xE9es. Ce mod\xE8le est automatiquement mis a jour si une
- * instance de l'arbre des calque lui est fourni.
- *
+ * Une classe permettant d'avoir un TreeModel repr\xE9sentant les calques conteant des lignes bris\xE9es et les lignes bris\xE9es Il est possible d'avoir que
+ * les calques contenant des lignes ferm\xE9es. Ce mod\xE8le est automatiquement mis a jour si une instance de l'arbre des calque lui est fourni.
+ *
* @author fred deniger
* @version $Id: CalqueFindCourbeTreeModel.java,v 1.5 2007-05-04 13:49:46 deniger Exp $
*/
@@ -59,6 +58,7 @@
final CalqueFindPolyligneVisitor finder_ = new CalqueFindPolyligneVisitor(false);
public static class CellRenderer extends JLabel implements TreeCellRenderer {
+
final Color selectedBackground_ = UIManager.getColor("Tree.selectionBackground");
final Color selectedForground_ = UIManager.getColor("Tree.selectionForeground");
final Border focusBorderColor_ = BorderFactory.createLineBorder(UIManager.getColor("Tree.selectionBorderColor"), 1);
@@ -72,7 +72,9 @@
protected boolean isSelectable(final Object _value, final boolean _leaf) {
if (onlyLineSelectable_) {
- if (!_leaf) { return false; }
+ if (!_leaf) {
+ return false;
+ }
final LayerNode node = (LayerNode) _value;
return node.idxPoly_ >= 0;
}
@@ -82,7 +84,7 @@
@Override
public Component getTreeCellRendererComponent(final JTree _tree, final Object _value, final boolean _selected,
- final boolean _expanded, final boolean _leaf, final int _row, final boolean _hasFocus) {
+ final boolean _expanded, final boolean _leaf, final int _row, final boolean _hasFocus) {
this.setFont(_tree.getFont());
setIcon(((LayerNode) _value).getIcon());
setText(_value.toString());
@@ -132,7 +134,7 @@
final List correctPath = new ArrayList(paths.length);
for (int i = 0; i < paths.length; i++) {
if (paths[i] != null && paths[i].getLastPathComponent() != null
- && ((LayerNode) paths[i].getLastPathComponent()).idxPoly_ >= 0) {
+ && ((LayerNode) paths[i].getLastPathComponent()).idxPoly_ >= 0) {
correctPath.add(paths[i]);
}
}
@@ -142,7 +144,6 @@
}
return paths;
}
-
}
public static class LayerNode extends DefaultMutableTreeNode {
@@ -182,9 +183,8 @@
}
}
- } else {
- addPolygones(_dest, (BCalque) userObject);
}
+ addPolygones(_dest, (BCalque) userObject);
}
@@ -199,7 +199,9 @@
@Override
public String toString() {
- if (titre_ != null) { return titre_; }
+ if (titre_ != null) {
+ return titre_;
+ }
return ((BCalque) userObject).getTitle();
}
@@ -210,9 +212,7 @@
public int getIdxPoly() {
return idxPoly_;
}
-
}
-
DefaultTreeModel treeModel_;
public CalqueFindCourbeTreeModel(final BArbreCalqueModel _model, final BGroupeCalque _root) {
@@ -234,7 +234,6 @@
treeModel_.setRoot(rootNode_);
}
-
private boolean containsAtLeastOnLayer;
protected boolean containsLigne(final BCalque _cq) {
@@ -245,7 +244,9 @@
void addLayer(final LayerNode _parent, final BGroupeCalque _gc) {
final BCalque[] cq = _gc.getCalques();
- if (CtuluLibArray.isEmpty(cq)) { return; }
+ if (CtuluLibArray.isEmpty(cq)) {
+ return;
+ }
for (int i = 0; i < cq.length; i++) {
final LayerNode node = new LayerNode(cq[i]);
if (finder_.isMatching(cq[i])) {
@@ -264,13 +265,12 @@
public boolean isContainsAtLeastOnLayer() {
return containsAtLeastOnLayer;
}
-
GISVisitorChooser chooser_ = new GISVisitorChooser();
void addLigne(final LayerNode _parent, final ZCalqueLigneBrisee _brisee) {
final GISZoneCollectionLigneBrisee collec = (GISZoneCollectionLigneBrisee) _brisee.modeleDonnees().getGeomData();
final GISAttributeModelObjectInterface str = (GISAttributeModelObjectInterface) collec
- .getModel(GISAttributeConstants.TITRE);
+ .getModel(GISAttributeConstants.TITRE);
final int nb = collec.getNumGeometries();
for (int i = 0; i < nb; i++) {
chooser_.clear();
@@ -324,5 +324,4 @@
}
return tree;
}
-
}
Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/geometrie/GrPoint.java
===================================================================
--- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/geometrie/GrPoint.java 2013-01-03 22:57:03 UTC (rev 8174)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/geometrie/GrPoint.java 2013-01-03 23:00:41 UTC (rev 8175)
@@ -18,11 +18,12 @@
/**
* Un point 3D.
- *
+ *
* @version $Revision: 1.19 $ $Date: 2006-12-20 16:08:24 $ by $Author: deniger $
* @author Guillaume Desnoix
*/
public final class GrPoint extends GrObjet implements GrContour {
+
public double x_;
public double y_;
public double z_;
@@ -149,8 +150,15 @@
z_ = tz;
}
+ public void autoApplique2D(final GrMorphisme _t) {
+ final double tx = x_ * _t.a_[0][0] + y_ * _t.a_[1][0] + z_ * _t.a_[2][0] + _t.a_[3][0];
+ final double ty = x_ * _t.a_[0][1] + y_ * _t.a_[1][1] + z_ * _t.a_[2][1] + _t.a_[3][1];
+ x_ = tx;
+ y_ = ty;
+ }
+
public GrPoint[] contour() {
- return new GrPoint[] { this };
+ return new GrPoint[]{this};
}
/**
@@ -176,7 +184,7 @@
/**
* Indique si l'objet est s\xE9lectionn\xE9 pour un point donn\xE9.
- *
+ *
* @param _ecran Le morphisme pour la transformation en coordonn\xE9es \xE9cran.
* @param _dist La tol\xE9rence en coordonn\xE9es \xE9cran pour laquelle on consid\xE8re l'objet s\xE9lectionn\xE9.
* @param _pt Le point de s\xE9lection en coordonn\xE9es \xE9cran.
@@ -189,8 +197,10 @@
}
/**
- * Indique si l'objet <code>_pTest</code> est s\xE9lectionn\xE9 pour un point donn\xE9 <code>_pRef</code>.
- *
+ * Indique si l'objet
+ * <code>_pTest</code> est s\xE9lectionn\xE9 pour un point donn\xE9
+ * <code>_pRef</code>.
+ *
* @param _dist La tol\xE9rence en coordonn\xE9es \xE9cran pour laquelle on consid\xE8re l'objet s\xE9lectionn\xE9.
* @param _pRef Le point de s\xE9lection en coordonn\xE9es \xE9cran (il estmodifie ).
* @param _pTest Le point a teste.
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 2013-01-03 22:57:03 UTC (rev 8174)
+++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/trace/TraceIcon.java 2013-01-03 23:00:41 UTC (rev 8175)
@@ -39,6 +39,8 @@
public final static int PLUS_DOUBLE = 13;
public final static int CARRE_ARRONDI = 14;
private TraceIconModel model_;
+ private TraceLigneModel ligneModel = new TraceLigneModel();
+ private TraceLigne traceLigne = new TraceLigne(ligneModel);
public final TraceIconModel getModel() {
return model_;
@@ -109,8 +111,10 @@
Stroke oldStroke = (g2d).getStroke();
if (model_.typeLigne_ > 0 && model_.epaisseurLigne_ > 0) {
- TraceLigneModel ligneModel = new TraceLigneModel(model_.typeLigne_, model_.epaisseurLigne_, g2d.getColor());
- new TraceLigne(ligneModel).initialisationGraphics(g2d);
+ ligneModel.setEpaisseur(model_.epaisseurLigne_);
+ ligneModel.setTypeTrait(model_.typeLigne_);
+ ligneModel.setColor(g2d.getColor());
+ traceLigne.initialisationGraphics(g2d);
}
final int x = _x;
final int y = _y;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|