|
From: <de...@us...> - 2013-01-15 00:17:38
|
Revision: 8210
http://fudaa.svn.sourceforge.net/fudaa/?rev=8210&view=rev
Author: deniger
Date: 2013-01-15 00:17:30 +0000 (Tue, 15 Jan 2013)
Log Message:
-----------
Ajout support filtre de points
Modified Paths:
--------------
trunk/soft/fudaa-mesh/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvElementLayer.java
trunk/soft/fudaa-mesh/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvIsoLayerQuickPainter.java
Modified: trunk/soft/fudaa-mesh/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvElementLayer.java
===================================================================
--- trunk/soft/fudaa-mesh/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvElementLayer.java 2013-01-15 00:16:59 UTC (rev 8209)
+++ trunk/soft/fudaa-mesh/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvElementLayer.java 2013-01-15 00:17:30 UTC (rev 8210)
@@ -54,12 +54,12 @@
* @version $Id: MvElementLayer.java,v 1.31.6.1 2008-02-20 10:11:50 bmarchan Exp $
*/
public class MvElementLayer extends ZCalquePolygone implements MvLayerGrid {
-
+
public MvElementLayer() {
super();
iconModel_ = null;
}
-
+
public final static int[] getSelectedEdgeIdx(final EfGridVolumeInterface _grid, final CtuluListSelectionInterface _select) {
if (_grid == null || _select == null) {
return null;
@@ -76,7 +76,7 @@
Arrays.sort(res);
return res;
}
-
+
public final static int[] getSelectedEdgeIdx(final EfGridVolumeInterface _grid, final int[] _select) {
if (_grid == null || _select == null) {
return null;
@@ -90,7 +90,7 @@
Arrays.sort(res);
return res;
}
-
+
@Override
public int[] getSelectedEdgeIdx() {
if (((MvElementModel) modele_).getGrid() instanceof EfGridVolumeInterface) {
@@ -98,7 +98,7 @@
}
return null;
}
-
+
@Override
public boolean isSelectionEdgeEmpty() {
return isSelectionEmpty();
@@ -110,12 +110,12 @@
public MvElementLayer(final MvElementModel _modele) {
super(_modele);
}
-
+
@Override
public EbliFindActionInterface getFinder() {
return new MvFindActionNodeElt(this);
}
-
+
@Override
public EbliFindExpressionContainerInterface getExpressionContainer() {
final EbliFindExpressionContainerInterface i = ((MvElementModel) modele_).getExpressionContainer();
@@ -124,7 +124,7 @@
/**
* Ne dessine que les donn\xE9es.
- *
+ *
* @param _g le graphics cible
*/
@Override
@@ -138,7 +138,6 @@
final int nombre = modele_.getNombre();
// pour ne pas modifier le model par defaut
final TraceIcon icone = iconModel_ == null ? null : new TraceIcon(new TraceIconModel(iconModel_));
- final GrBoite bPoly = new GrBoite();
int incrementPt = 1;
final TraceLigne tl = new TraceLigne(new TraceLigneModel(ligneModel_));
if (isAttenue()) {
@@ -152,9 +151,9 @@
if (icone != null) {
icone.setCouleur(EbliLib.getAlphaColor(icone.getCouleur(), alpha_));
}
-
+
}
-
+
final MvElementModel model = (MvElementModel) modele_;
final boolean containsFr = model.getFrNbFrontier() > 0;
Envelope envReel = _clipReel.getEnv();
@@ -164,6 +163,7 @@
GrPoint pt = new GrPoint();
int w = getWidth() + 1;
CtuluListSelection memory = new CtuluListSelection(w * getHeight());
+
for (int idxElement = 0; idxElement < nombre; idxElement++) {
if (!model.isPainted(idxElement)) {
continue;
@@ -180,23 +180,23 @@
if (y == null || y.length < nbPt) {
y = new int[nbPt];
}
- boolean isOnlyOnePoint = true;
+ boolean eltIsOnePoint = true;
for (int iPt = 0; iPt < nbPt; iPt++) {
pt.x_ = model.getX(idxElement, iPt);
pt.y_ = model.getY(idxElement, iPt);
pt.z_ = 0;
- pt.autoApplique(_versEcran);
+ pt.autoApplique2D(_versEcran);
final int xi = (int) pt.x_;
final int yi = (int) pt.y_;
x[iPt] = xi;
y[iPt] = yi;
- if (iPt > 0 && isOnlyOnePoint) {
- isOnlyOnePoint = (xi == x[iPt - 1] && yi == y[iPt - 1]);
+ if (iPt > 0 && eltIsOnePoint) {
+ eltIsOnePoint = (xi == x[iPt - 1] && yi == y[iPt - 1]);
}
}
-
+
updateTrace(icone == null ? null : icone.getModel(), tl.getModel(), idxElement);
- if (isOnlyOnePoint) {
+ if (eltIsOnePoint) {
int idxDone = x[0] + y[0] * w;
if (idxDone >= 0 && !memory.isSelected(idxDone)) {
memory.add(idxDone);
@@ -216,7 +216,16 @@
if (icone != null) {
icone.paintIconCentre(this, _g, x[ptOri], y[ptOri]);
}
- tl.dessineTrait(_g, x[ptOri], y[ptOri], x[j], y[j]);
+ boolean onePoint = (x[ptOri] == x[j]) && (y[ptOri] == y[j]);
+ if (onePoint) {
+ int idxToDo = x[j] + y[j] * w;
+ if (!memory.isSelected(idxToDo)) {
+ tl.dessineTrait(_g, x[ptOri], y[ptOri], x[j], y[j]);
+ memory.add(idxToDo);
+ }
+ } else {
+ tl.dessineTrait(_g, x[ptOri], y[ptOri], x[j], y[j]);
+ }
}
ptOri = j;
idxFrom = idxTo;
@@ -233,38 +242,40 @@
if (idxFrom > idxTo) {
model.point(idxFrom, ptOri);
model.point(idxTo, ptDest);
- ptDest.autoApplique(versEcran);
- ptOri.autoApplique(versEcran);
- if (icone != null) {
- icone.paintIconCentre(this, _g, ptOri.x_, ptOri.y_);
+ if (_clipReel.intersectXYBoite(ptOri.x_, ptOri.y_, ptDest.x_, ptDest.y_)) {
+ ptDest.autoApplique2D(versEcran);
+ ptOri.autoApplique2D(versEcran);
+ if (icone != null) {
+ icone.paintIconCentre(this, _g, ptOri.x_, ptOri.y_);
+ }
+ tl.dessineTrait(_g, ptOri.x_, ptOri.y_, ptDest.x_, ptDest.y_);
}
- tl.dessineTrait(_g, ptOri.x_, ptOri.y_, ptDest.x_, ptDest.y_);
}
idxFrom = idxTo;
}
-
+
}
}
-
+
@Override
public int[] getSelectedElementIdx() {
return selection_ == null ? null : selection_.getSelectedIndex();
}
-
+
@Override
public int[] getSelectedObjectInTable() {
return getSelectedElementIdx();
}
-
+
protected EfGridInterface getGrid() {
return ((MvElementModel) modele_).getGrid();
}
-
+
@Override
public CtuluListSelection selection(final GrPoint _pt, final int _tolerance) {
return getGrid().getIndex() == null ? super.selection(_pt, _tolerance) : selectionFromIndex(_pt, _tolerance);
}
-
+
public CtuluListSelection selectionFromIndex(final LinearRing _poly, final int _mode) {
if (Fu.DEBUG && FuLog.isDebug()) {
FuLog.debug("FMV: layer select from index");
@@ -286,10 +297,10 @@
r.add(idx);
}
}
-
+
return r;
}
-
+
private CtuluListSelection selectionFromIndex(final GrPoint _pt, final int _tolerance) {
if (Fu.DEBUG && FuLog.isDebug()) {
FuLog.debug("FMV: layer select from index");
@@ -299,12 +310,12 @@
// grid.getIndex().query(EfIndexVisitorNearestNode.getEnvelope(_pt.x_, _pt.y_, toleranceReel), visitor);
// return visitor.getSelection();
}
-
+
@Override
public CtuluListSelection selection(final LinearRing _polySelection, final int _mode) {
return getGrid().getIndex() == null ? super.selection(_polySelection, _mode) : selectionFromIndex(_polySelection, _mode);
}
-
+
@Override
public int[] getSelectedPtIdx() {
if (!isSelectionEmpty()) {
@@ -320,7 +331,7 @@
}
return null;
}
-
+
@Override
public GrBoite getDomaineOnSelected() {
if (isSelectionEmpty()) {
@@ -343,30 +354,30 @@
// ajusteZoomOnSelected(r);
return r;
}
-
+
public boolean isConfigurable() {
return true;
}
-
+
public boolean isFontModifiable() {
return false;
}
-
+
@Override
public boolean isPaletteModifiable() {
return false;
}
-
+
@Override
public boolean isSelectionElementEmpty() {
return isSelectionEmpty();
}
-
+
@Override
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);
@@ -391,4 +402,4 @@
_g.drawLine(x1, y1, x3, y3);
_g.drawLine(x1, y1, x4, y4);
}
-}
\ No newline at end of file
+}
Modified: trunk/soft/fudaa-mesh/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvIsoLayerQuickPainter.java
===================================================================
--- trunk/soft/fudaa-mesh/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvIsoLayerQuickPainter.java 2013-01-15 00:16:59 UTC (rev 8209)
+++ trunk/soft/fudaa-mesh/src/main/java/org/fudaa/fudaa/meshviewer/layer/MvIsoLayerQuickPainter.java 2013-01-15 00:17:30 UTC (rev 8210)
@@ -132,6 +132,10 @@
} else {
isos = new TraceIsoSurfacesAvecPlages(paletteCouleur, alpha);
}
+ GrBoite clipEcran = _clipReel.applique(_versEcran);
+ isos.setRapide(rapide);
+ isos.setDimension(width, height);
+ isos.setClipEcran(clipEcran);
// pour les surfaces, on voudrait eviter d'utiliser l'anticrenelage
if (!keepAntialias && isAntaliasing) {
final RenderingHints renderingHints = _g.getRenderingHints();
@@ -147,6 +151,7 @@
int w = width + 1;
CtuluListSelection memory = new CtuluListSelection(w * height);
Envelope envReel = _clipReel.getEnv();
+
for (idxElt = 0; idxElt < n; idxElt++) {
if (!modelToUse.isPainted(idxElt)) {
continue;
@@ -155,7 +160,7 @@
final int nbPt = modelToUse.getNbPt(idxElt);
Envelope envelopeElement = modelToUse.getEnvelopeForElement(idxElt);
- if (!envReel.intersects(envelopeElement)) {
+ if (!envelopeElement.intersects(envReel)) {
continue;
}
if (x == null || x.length < nbPt) {
@@ -189,31 +194,34 @@
// Trace des isosurfaces / Isolignes (dans la couleur du fond si les isocouleurs sont
// tracees).
if (isos != null) {
- if (isOnlyOnePoint) {
- int idxDone = x[0] + y[0] * w;
- if (idxDone >= 0 && !memory.isSelected(idxDone)) {
- memory.add(idxDone);
- double value = modelToUse.getDatatFor(idxElt, 0);
- final Color c = paletteCouleur == null ? null : ((BPalettePlage) paletteCouleur).getColorFor(value);
- if (c != null) {
- _g.setColor(EbliLib.getAlphaColor(c, alpha));
- _g.drawLine(x[0], y[0], x[0], y[0]);
- }
- }
- } else if (isLineAllPaintedByNode(minX, maxX, minY, maxY, x, y, nbPt)) {
- for (int iPt = 0; iPt < nbPt; iPt++) {
- int idxDone = x[iPt] + y[iPt] * w;
+ if (!traceIsoLine && isOnlyOnePoint) {
+ if (clipEcran.contientXY(x[0], y[0])) {
+ int idxDone = x[0] + y[0] * w;
if (idxDone >= 0 && !memory.isSelected(idxDone)) {
memory.add(idxDone);
- double value = modelToUse.getDatatFor(idxElt, iPt);
- final Color c = EbliLib.getAlphaColor(paletteCouleur == null ? null : ((BPalettePlage) paletteCouleur).getColorFor(
- value), alpha);
+ double value = modelToUse.getDatatFor(idxElt, 0);
+ final Color c = paletteCouleur == null ? null : ((BPalettePlage) paletteCouleur).getColorFor(value);
if (c != null) {
- _g.setColor(c);
- _g.drawLine(x[iPt], y[iPt], x[iPt], y[iPt]);
+ _g.setColor(EbliLib.getAlphaColor(c, alpha));
+ _g.drawLine(x[0], y[0], x[0], y[0]);
}
}
-
+ }
+ } else if (!traceIsoLine && isLineAllPaintedByNode(minX, maxX, minY, maxY, x, y, nbPt)) {
+ for (int iPt = 0; iPt < nbPt; iPt++) {
+ if (clipEcran.contientXY(x[iPt], y[iPt])) {
+ int idxDone = x[iPt] + y[iPt] * w;
+ if (idxDone >= 0 && !memory.isSelected(idxDone)) {
+ memory.add(idxDone);
+ double value = modelToUse.getDatatFor(idxElt, iPt);
+ final Color c = EbliLib.getAlphaColor(paletteCouleur == null ? null : ((BPalettePlage) paletteCouleur).getColorFor(
+ value), alpha);
+ if (c != null) {
+ _g.setColor(c);
+ _g.drawLine(x[iPt], y[iPt], x[iPt], y[iPt]);
+ }
+ }
+ }
}
} else {
value = modelToUse.fillWithData(idxElt, value);
@@ -231,4 +239,9 @@
}
}
}
+ boolean rapide;
+
+ public void setRapide(boolean rapide) {
+ this.rapide = rapide;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|