|
From: <chr...@us...> - 2010-05-31 15:50:09
|
Revision: 5758
http://fudaa.svn.sourceforge.net/fudaa/?rev=5758&view=rev
Author: chrisc83
Date: 2010-05-31 15:50:02 +0000 (Mon, 31 May 2010)
Log Message:
-----------
Version de tests!!!
Modified Paths:
--------------
trunk/soft/fudaa-prepro/meshview/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvElementLayer.java
trunk/soft/fudaa-prepro/meshview/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvNodeLayer.java
trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java
Added Paths:
-----------
trunk/soft/fudaa-prepro/meshview/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvNodeLayerOriginal.java
Modified: trunk/soft/fudaa-prepro/meshview/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvElementLayer.java
===================================================================
--- trunk/soft/fudaa-prepro/meshview/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvElementLayer.java 2010-05-27 22:17:37 UTC (rev 5757)
+++ trunk/soft/fudaa-prepro/meshview/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvElementLayer.java 2010-05-31 15:50:02 UTC (rev 5758)
@@ -136,6 +136,7 @@
public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel,
final GrBoite _clipReel) {
System.out.println("Start MvElementLayer.paintDonnees");
+ long currentTime = System.currentTimeMillis();
if ((modele_ == null) || (modele_.getNombre() <= 0)) { return; }
final GrBoite clip = _clipReel;
@@ -164,6 +165,15 @@
}
GrPoint ptOri = null;
GrPoint ptDest = null;
+
+ /*******************************************************************************/
+ /** D\xE9claration variables utilis\xE9es par algo optimisation par centre \xE9l\xE9ments **/
+ /*******************************************************************************/
+ GrPoint ptCenter = new GrPoint();
+ final int width = this.getSize().width;
+ int count = 0;
+ CtuluListSelection alreadyExist = new CtuluListSelection();
+
final MvElementModel model = (MvElementModel) modele_;
final boolean containsFr = model.getFrNbFrontier() > 0;
for (int i = 0; i < nombre; i++) {
@@ -171,11 +181,58 @@
if (!modele_.polygone(poly_, i, false)) {
continue;
}
+
poly_.boite(bPoly);
// Si la boite du polygone n'est pas dans la boite d'affichage on passe
if (!bPoly.intersectXY(clip)) {
continue;
}
+
+ /******************************************************/
+ /** D\xE9but code algo optimisation par centre \xE9l\xE9ments **/
+ /******************************************************/
+ poly_.centre(ptCenter);
+// System.out.print("X : " + ptCenter.x_ + ", Y : " + ptCenter.y_);
+ ptCenter.autoApplique(versEcran);
+// System.out.println(", X : " + ptCenter.x_ + ", Y : " + ptCenter.y_);
+ int idx = (width * ((int)ptCenter.y_)) + ((int)ptCenter.x_);
+// System.out.println("id : " + idx);
+
+ if (alreadyExist.isSelected(idx))
+ {
+ count++;
+ continue;
+ }
+ else
+ {
+ alreadyExist.add(idx);
+
+ if (rapide)
+ {
+ int idx2;
+ final int height = this.getSize().height;
+
+ for (int j = ((int)ptCenter.x_) - 1; j < (((int)ptCenter.x_) + 2); j++)
+ {
+ for (int k = ((int)ptCenter.y_) - 1; k < (((int)ptCenter.y_) + 2); k++)
+ {
+ if ((j >= 0) && (j < width) && (k >= 0) && (k < height))
+ {
+ idx2 = (width * k) + j;
+
+ if (idx2 != idx)
+ {
+ alreadyExist.add(idx2);
+ }
+ }
+ }
+ }
+ }
+ }
+ /****************************************************/
+ /** Fin code algo optimisation par centre \xE9l\xE9ments **/
+ /****************************************************/
+
final int nbPoints = poly_.sommets_.nombre();
if (nbPoints <= 0) {
continue;
@@ -228,7 +285,10 @@
}
}
+ currentTime = System.currentTimeMillis() - currentTime;
System.out.println("Stop MvElementLayer.paintDonnees");
+ System.out.println("Dur\xE9e : " + currentTime);
+ System.out.println("Nb \xE9l\xE9ment : " + nombre + ", non affich\xE9 : " + count);
}
public int[] getSelectedElementIdx() {
Modified: trunk/soft/fudaa-prepro/meshview/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvNodeLayer.java
===================================================================
--- trunk/soft/fudaa-prepro/meshview/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvNodeLayer.java 2010-05-27 22:17:37 UTC (rev 5757)
+++ trunk/soft/fudaa-prepro/meshview/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvNodeLayer.java 2010-05-31 15:50:02 UTC (rev 5758)
@@ -10,6 +10,7 @@
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
+import java.awt.Graphics2D;
import org.fudaa.ctulu.CtuluListSelection;
import org.fudaa.ctulu.CtuluRange;
@@ -18,10 +19,14 @@
import org.fudaa.dodico.ef.operation.EfIndexHelper;
import org.fudaa.dodico.ef.operation.EfIndexVisitorHashSetNode;
import org.fudaa.ebli.calque.ZCalquePoint;
+import org.fudaa.ebli.commun.EbliLib;
import org.fudaa.ebli.find.EbliFindActionInterface;
import org.fudaa.ebli.find.EbliFindExpressionContainerInterface;
+import org.fudaa.ebli.geometrie.GrBoite;
import org.fudaa.ebli.geometrie.GrMorphisme;
import org.fudaa.ebli.geometrie.GrPoint;
+import org.fudaa.ebli.palette.BPalettePlage;
+import org.fudaa.ebli.trace.TraceIcon;
import org.fudaa.fudaa.meshviewer.MvLayerGrid;
import org.fudaa.fudaa.meshviewer.model.MvExpressionSupplierNode;
import org.fudaa.fudaa.meshviewer.model.MvNodeModel;
@@ -170,7 +175,111 @@
return isSelectionEmpty();
}
+
+ /******************************************************************/
+ /** M\xE9thode overrid\xE9e pour mettre en place l'algo d'optimisation **/
+ /******************************************************************/
@Override
+ public void paintDonnees(final Graphics2D _g, final int _nbPt, final GrMorphisme _versEcran, final GrBoite _clipReel)
+ {
+ System.out.println("Start MvNodeLayer.paintDonnees");
+ long currentTime = System.currentTimeMillis();
+
+ if ((modele_ == null) || (_nbPt <= 0)) {
+ return;
+ }
+ final boolean attenue = isAttenue();
+ final boolean rapide = isRapide();
+ final GrPoint point = new GrPoint();
+
+ final TraceIcon icone = iconModel_.buildCopy();
+ if (icone == null) {
+ return;
+ }
+ if (isAttenue()) {
+ icone.setCouleur(attenueCouleur(icone.getCouleur()));
+ }
+ if (EbliLib.isAlphaChanged(alpha_)) {
+ icone.setCouleur(EbliLib.getAlphaColor(icone.getCouleur(), alpha_));
+ }
+
+ /*******************************************************************************/
+ /** D\xE9claration variables utilis\xE9es par algo optimisation par centre \xE9l\xE9ments **/
+ /*******************************************************************************/
+ final int width = this.getSize().width;
+ int count = 0;
+ CtuluListSelection alreadyExist = new CtuluListSelection();
+
+ for (int i = _nbPt - 1; i >= 0; i--) {
+ // si le point est filtre on passe. On ne force pas l'affectation.
+ if (!modele_.point(point, i, false)) {
+ continue;
+ }
+ if (!_clipReel.contientXY(point)) {
+ continue;
+ }
+ final double z = point.z_;
+ point.autoApplique(_versEcran);
+
+ /******************************************************/
+ /** D\xE9but code algo optimisation par centre \xE9l\xE9ments **/
+ /******************************************************/
+// System.out.print("X : " + point.x_ + ", Y : " + point.y_);
+ int idx = (width * ((int)point.y_)) + ((int)point.x_);
+// System.out.println("id : " + idx);
+
+ if (alreadyExist.isSelected(idx))
+ {
+ count++;
+ continue;
+ }
+ else
+ {
+ alreadyExist.add(idx);
+
+ if (rapide)
+ {
+ int idx2;
+ final int height = this.getSize().height;
+
+ for (int j = ((int)point.x_) - 1; j < (((int)point.x_) + 2); j++)
+ {
+ for (int k = ((int)point.y_) - 1; k < (((int)point.y_) + 2); k++)
+ {
+ if ((j >= 0) && (j < width) && (k >= 0) && (k < height))
+ {
+ idx2 = (width * k) + j;
+
+ if (idx2 != idx)
+ {
+ alreadyExist.add(idx2);
+ }
+ }
+ }
+ }
+ }
+ }
+ /****************************************************/
+ /** Fin code algo optimisation par centre \xE9l\xE9ments **/
+ /****************************************************/
+
+ if (!rapide && isPaletteCouleurUsed_ && (paletteCouleur_ != null)) {
+ Color c = ((BPalettePlage) paletteCouleur_).getColorFor(z);
+ if (attenue) {
+ c = attenueCouleur(c);
+ }
+ icone.setCouleur(c);
+ }
+ icone.paintIconCentre(this, _g, (int) point.x_, (int) point.y_);
+ }
+
+ currentTime = System.currentTimeMillis() - currentTime;
+ System.out.println("Stop MvNodeLayer.paintDonnees");
+ System.out.println("Dur\xE9e : " + currentTime);
+ System.out.println("Nb point : " + _nbPt + ", non affich\xE9 : " + count);
+ }
+
+ @Override
public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) {
super.paintIcon(_c, _g, _x, _y);
if (modele_ == null || modele_.getNombre() == 0) { return; }
Added: trunk/soft/fudaa-prepro/meshview/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvNodeLayerOriginal.java
===================================================================
--- trunk/soft/fudaa-prepro/meshview/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvNodeLayerOriginal.java (rev 0)
+++ trunk/soft/fudaa-prepro/meshview/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvNodeLayerOriginal.java 2010-05-31 15:50:02 UTC (rev 5758)
@@ -0,0 +1,217 @@
+/**
+ * @creation 13 nov. 2003
+ * @modification $Date: 2007-04-20 16:22:09 $
+ * @license GNU General Public License 2
+ * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
+ * @mail de...@fu...
+ */
+package org.fudaa.fudaa.meshviewer.layer;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+
+import org.fudaa.ctulu.CtuluListSelection;
+import org.fudaa.ctulu.CtuluRange;
+import org.fudaa.ctulu.gis.GISLib;
+import org.fudaa.dodico.ef.EfGridInterface;
+import org.fudaa.dodico.ef.operation.EfIndexHelper;
+import org.fudaa.dodico.ef.operation.EfIndexVisitorHashSetNode;
+import org.fudaa.ebli.calque.ZCalquePoint;
+import org.fudaa.ebli.find.EbliFindActionInterface;
+import org.fudaa.ebli.find.EbliFindExpressionContainerInterface;
+import org.fudaa.ebli.geometrie.GrMorphisme;
+import org.fudaa.ebli.geometrie.GrPoint;
+import org.fudaa.fudaa.meshviewer.MvLayerGrid;
+import org.fudaa.fudaa.meshviewer.model.MvExpressionSupplierNode;
+import org.fudaa.fudaa.meshviewer.model.MvNodeModel;
+
+import com.memoire.fu.Fu;
+import com.memoire.fu.FuLog;
+import com.vividsolutions.jts.algorithm.SIRtreePointInRing;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.LinearRing;
+
+/**
+ * @author deniger
+ * @version $Id: MvNodeLayer.java,v 1.27 2007-04-20 16:22:09 deniger Exp $
+ */
+public class MvNodeLayerOriginal extends ZCalquePoint implements MvLayerGrid {
+
+ /**
+ * @param _modele le nouveau modele
+ */
+ public MvNodeLayerOriginal(final MvNodeModel _modele) {
+ super(_modele);
+ }
+
+ public int[] getSelectedEdgeIdx() {
+ return null;
+ }
+
+ public boolean isSelectionEdgeEmpty() {
+ return true;
+ }
+
+ MvNodeModel getNodeModel() {
+ return (MvNodeModel) modele_;
+ }
+
+ @Override
+ public boolean getRange(final CtuluRange _b) {
+ getNodeModel().getDataRange(_b);
+ return true;
+ }
+
+ @Override
+ public boolean getTimeRange(final CtuluRange _b) {
+ return false;
+ }
+
+ @Override
+ public EbliFindExpressionContainerInterface getExpressionContainer() {
+ final EbliFindExpressionContainerInterface i = getNodeModel().getExpressionContainer();
+ return i == null ? new MvExpressionSupplierNode(getNodeModel()) : i;
+ }
+
+ @Override
+ public EbliFindActionInterface getFinder() {
+ return new MvFindActionNodeElt(this);
+ }
+
+ public int[] getSelectedElementIdx() {
+ return null;
+ }
+
+ @Override
+ public int[] getSelectedObjectInTable() {
+ return getSelectedPtIdx();
+ }
+
+ @Override
+ public CtuluListSelection selection(final GrPoint _pt, final int _tolerance) {
+ return (getNodeModel().getGrid().getIndex() == null) ? super.selection(_pt, _tolerance) : selectionFromIndex(_pt,
+ _tolerance);
+ }
+
+ @Override
+ public CtuluListSelection selection(final LinearRing _poly, final int _mode) {
+ return (getNodeModel().getGrid().getIndex() == null) ? super.selection(_poly, _mode) : selectionFromIndex(_poly);
+ }
+
+ public CtuluListSelection selectionFromIndex(final LinearRing _poly) {
+ if (Fu.DEBUG && FuLog.isDebug()) {
+ FuLog.debug("FMV: layer select from index");
+ }
+ final EfGridInterface grid = getNodeModel().getGrid();
+ final EfIndexVisitorHashSetNode list = new EfIndexVisitorHashSetNode(grid);
+ getNodeModel().getGrid().getIndex().query(_poly.getEnvelopeInternal(), list);
+ final SIRtreePointInRing tester = new SIRtreePointInRing(_poly);
+ final int[] nds = list.getResult();
+ final GrPoint p = new GrPoint();
+ final Coordinate c = new Coordinate();
+ final CtuluListSelection r = creeSelection();
+ for (int i = nds.length - 1; i >= 0; i--) {
+ final int idx = nds[i];
+ modele().point(p, idx, true);
+ c.x = p.x_;
+ c.y = p.y_;
+ if (GISLib.isSelected(c, _poly, tester, 1E-5)) {
+ r.add(idx);
+ }
+ }
+ if (r.isEmpty()) { return null; }
+ return r;
+ }
+
+ /**
+ * Methode qui permet de savoir si un point appartient au layer.
+ *
+ * @param _pt
+ * @param _tolerance
+ * @return
+ */
+ public CtuluListSelection selectionFromIndex(final GrPoint _pt, final int _tolerance) {
+ if (Fu.DEBUG && FuLog.isDebug()) {
+ FuLog.debug("FMV: layer select from index");
+ }
+
+ return EfIndexHelper.getNearestNode(getNodeModel().getGrid(), _pt.x_, _pt.y_, GrMorphisme.convertDistanceXY(
+ getVersReel(), _tolerance), null);
+// final EfIndexVisitorNearestNode visitor = new EfIndexVisitorNearestNode(getNodeModel().getGrid(), _pt.x_, _pt.y_,
+// toleranceReel);
+// getNodeModel().getGrid().getIndex().query(EfIndexVisitorNearestNode.getEnvelope(_pt.x_, _pt.y_, toleranceReel),
+// visitor);
+// return visitor.getSelection();
+ }
+
+ /**
+ * @return les indices des points s\xE9lectionn\xE9s
+ */
+ public int[] getSelectedPtIdx() {
+ if (!isSelectionEmpty()) { return selection_.getSelectedIndex(); }
+ return null;
+ }
+
+ @Override
+ public boolean isDonneesBoiteAvailable() {
+ return true;
+ }
+
+ public boolean isFontModifiable() {
+ return false;
+ }
+
+ public boolean isSelectionElementEmpty() {
+ return true;
+ }
+
+ public boolean isSelectionPointEmpty() {
+ return isSelectionEmpty();
+ }
+
+ @Override
+ public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) {
+ super.paintIcon(_c, _g, _x, _y);
+ if (modele_ == null || modele_.getNombre() == 0) { return; }
+ if (isPaletteCouleurUsed_) {
+ _g.setColor(Color.RED);
+ } else {
+ _g.setColor(getForeground());
+ }
+ final int w = getIconWidth();
+ final int h = getIconHeight();
+ int x1 = _x + 3;
+ int y1 = _y + h / 2;
+ final int x2 = _x + w / 2;
+ final int y2 = _y + 3;
+ final int x3 = _x + w / 4;
+ final int y3 = _y + h - 3;
+ final int x4 = x2;
+ final int y4 = _y + h / 2 + 4;
+ _g.drawLine(x1 - 1, y1, x1 + 1, y1);
+ _g.drawLine(x1, y1 - 1, x1, y1 + 1);
+ if (isPaletteCouleurUsed_) {
+ _g.setColor(Color.BLUE);
+ }
+ _g.drawLine(x2 - 1, y2, x2 + 1, y2);
+ _g.drawLine(x2, y2 - 1, x2, y2 + 1);
+ if (isPaletteCouleurUsed_) {
+ _g.setColor(Color.ORANGE);
+ }
+ _g.drawLine(x3 - 1, y3, x3 + 1, y3);
+ _g.drawLine(x3, y3 - 1, x3, y3 + 1);
+ if (isPaletteCouleurUsed_) {
+ _g.setColor(Color.GREEN);
+ }
+ _g.drawLine(x4 - 1, y4, x4 + 1, y4);
+ _g.drawLine(x4, y4 - 1, x4, y4 + 1);
+ x1 = _x + w - 3;
+ y1 = _y + h / 2 + 3;
+ if (isPaletteCouleurUsed_) {
+ _g.setColor(Color.yellow);
+ }
+ _g.drawLine(x1 - 1, y1, x1 + 1, y1);
+ _g.drawLine(x1, y1 - 1, x1, y1 + 1);
+ }
+}
\ No newline at end of file
Modified: trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java
===================================================================
--- trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java 2010-05-27 22:17:37 UTC (rev 5757)
+++ trunk/soft/fudaa-prepro/ui/src/main/java/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java 2010-05-31 15:50:02 UTC (rev 5758)
@@ -740,6 +740,7 @@
TraceIsoInterface isos = null;
// TrIsoTraceSurface isos = null;
final boolean isElement = getIsoModelAbstract().isCurrentDataElementType();
+ System.out.println(isElement);
boolean keepAntialias = false;
TrPostModelInterface modelToUse = getIsoModelAbstract();
if (traceIsoLine_) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|