|
From: Logs S. c. messages. <gvs...@li...> - 2013-11-23 15:53:16
|
Revision: 1076
http://sourceforge.net/p/gvsigce/code/1076
Author: vicgonco
Date: 2013-11-23 15:53:12 +0000 (Sat, 23 Nov 2013)
Log Message:
-----------
Applying https://devel.gvsig.org/redmine/projects/gvsig-desktop/repository/revisions/38060 and https://devel.gvsig.org/redmine/projects/gvsig-desktop/repository/revisions/38061
Modified Paths:
--------------
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrVect.java
Modified: trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrVect.java
===================================================================
--- trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrVect.java 2013-11-23 15:52:55 UTC (rev 1075)
+++ trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrVect.java 2013-11-23 15:53:12 UTC (rev 1076)
@@ -143,19 +143,10 @@
* @author Fernando Gonz�lez Cort�s
*/
-// TODO Cuando no sea para pruebas debe no ser public
public class FLyrVect extends FLyrDefault implements ILabelable,
ClassifiableVectorial, SingleLayer, VectorialData, RandomVectorialData,
AlphanumericData, InfoByPoint, SelectionListener, IEditionListener, LegendContentsChangedListener {
private static Logger logger = Logger.getLogger(FLyrVect.class.getName());
- /**
- * @deprecated Don�t use Strategy, you should be use iterators.
- */
-// public static boolean forTestOnlyVariableUseIterators_REMOVE_THIS_FIELD = true;
- /**
- * @deprecated Don�t use Strategy, you should be use iterators.
- */
-// private boolean useStrategy=false;
/** Leyenda de la capa vectorial */
private IVectorLegend legend;
@@ -383,12 +374,12 @@
}
}
}
- // Get the iterator over the visible features
- IFeatureIterator it = null;
- if (isJoined()) {
- it = new JoinFeatureIterator(this, viewPort,
- fieldList.toArray(new String[fieldList.size()]));
- }
+ // Get the iterator over the visible features
+ IFeatureIterator it = null;
+ if (isJoined()) {
+ it = new JoinFeatureIterator(this, viewPort,
+ fieldList.toArray(new String[fieldList.size()]));
+ }
else {
ReadableVectorial rv=getSource();
// rv.start();
@@ -624,8 +615,6 @@
public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
Cancellable cancel, double scale) throws ReadDriverException {
-// forTestOnlyVariableUseIterators_REMOVE_THIS_FIELD = true;
-// if (!isUseStrategy()) {
if (isWaitTodraw()) {
return;
}
@@ -635,178 +624,10 @@
else {
_draw(image, g, viewPort, cancel, scale);
}
-// } else {
-//// moved up to FLayers
-//// if (isWithinScale(scale)) {
-//
-//
-// // Las que solo tienen etiquetado sin pintar el shape,
-// // no pasamos por ellas
-// boolean bDrawShapes = true;
-// if (legend instanceof SingleSymbolLegend) {
-// if (legend.getDefaultSymbol().isShapeVisible() == false)
-// bDrawShapes = false;
-// }
-// if (bDrawShapes) {
-// Strategy strategy = StrategyManager.getStrategy(this);
-// try {
-// prepareDrawing(image, g, viewPort);
-// strategy.draw(image, g, viewPort, cancel);
-// } catch (ReadDriverException e) {
-// this.setVisible(false);
-// this.setActive(false);
-// throw e;
-// }
-// }
-// if (getVirtualLayers() != null) {
-// getVirtualLayers().draw(image, g, viewPort, cancel, scale);
-// }
-//// }
-// }
}
- /**
- * Se llama antes de empezar a pintar.
- * Es �til para preparar la cache a emplear, las leyendas, etc.
- * @param image
- * @param g
- * @param viewPort
- */
- private void prepareDrawing(BufferedImage image, Graphics2D g, ViewPort viewPort) {
-
- }
-
public void _print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
double scale, PrintRequestAttributeSet properties) throws ReadDriverException {
- // TEST METHOD
-
-
- /* SVN */
-
- /* boolean bDrawShapes = true;
- if (legend instanceof SingleSymbolLegend) {
- bDrawShapes = legend.getDefaultSymbol().isShapeVisible();
- }
-
-
- if (bDrawShapes) {
- double dpi = 72;
-
- PrintQuality resolution=(PrintQuality)properties.get(PrintQuality.class);
- if (resolution.equals(PrintQuality.NORMAL)){
- dpi = 300;
- } else if (resolution.equals(PrintQuality.HIGH)){
- dpi = 600;
- } else if (resolution.equals(PrintQuality.DRAFT)){
- dpi = 72;
- }
-
-
- try {
- prepareDrawing(null, g, viewPort);
- ArrayList<String> fieldList = new ArrayList<String>();
- String[] aux;
-
- // fields from legend
- if (legend instanceof IClassifiedVectorLegend) {
- aux = ((IClassifiedVectorLegend) legend).
- getClassifyingFieldNames();
- for (int i = 0; i < aux.length; i++) {
- fieldList.add(aux[i]);
- }
- }
-
- // fields from labeling
- if (isLabeled()) {
- aux = getLabelingStrategy().getUsedFields();
- for (int i = 0; i < aux.length; i++) {
- fieldList.add(aux[i]);
- }
- }
-
- ZSort zSort = ((IVectorLegend) getLegend()).getZSort();
-
- // if layer has map levels it will use a ZSort
- boolean useZSort = zSort != null && zSort.isUsingZSort();
-
-
- int mapLevelCount = (useZSort) ? zSort.getLevelCount() : 1;
- for (int mapPass = 0; mapPass < mapLevelCount; mapPass++) {
- // Get the iterator over the visible features
- IFeatureIterator it = getSource().getFeatureIterator(
- viewPort.getAdjustedExtent(),
- fieldList.toArray(new String[fieldList.size()]),
- viewPort.getProjection(),
- true);
-
- // Iteration over each feature
- while ( !cancel.isCanceled() && it.hasNext()) {
- IFeature feat = it.next();
- IGeometry geom = feat.getGeometry();
-
- // retreive the symbol associated to such feature
- ISymbol sym = legend.getSymbolByFeature(feat);
-
- if (useZSort) {
- // Check if this symbol is a multilayer
- if (sym instanceof IMultiLayerSymbol) {
- // if so, get the layer corresponding to the current
- // level. If none, continue to next iteration
- IMultiLayerSymbol mlSym = (IMultiLayerSymbol) sym;
- for (int i = 0; i < mlSym.getLayerCount(); i++) {
- ISymbol mySym = mlSym.getLayer(i);
- if (zSort.getSymbolLevel(mySym) == mapPass) {
- sym = mySym;
- break;
- }
- System.out.println("avoided layer "+i+"of symbol '"+mlSym.getDescription()+"' (pass "+mapPass+")");
- }
-
- if (sym == null) {
- continue;
- }
- } else {
- // else, just draw the symbol in its level
- if (zSort.getSymbolLevel(sym) != mapPass) {
- System.out.println("avoided single layer symbol '"+sym.getDescription()+"' (pass "+mapPass+")");
- continue;
- }
- }
- }
-
- // Check if this symbol is sized with CartographicSupport
- CartographicSupport csSym = null;
- int symbolType = sym.getSymbolType();
- boolean bDrawCartographicSupport = false;
-
- if ( symbolType == FShape.POINT
- || symbolType == FShape.LINE
- || sym instanceof CartographicSupport) {
-
- csSym = (CartographicSupport) sym;
- bDrawCartographicSupport = (csSym.getUnit() != -1);
- }
-
- System.err.println("passada "+mapPass+" pinte s�mboll "+sym.getDescription());
-
- if (!bDrawCartographicSupport) {
- geom.drawInts(g, viewPort, sym, null);
- } else {
- geom.drawInts(g, viewPort, dpi, (CartographicSupport) csSym);
- }
-
- }
- it.closeIterator();
- }
- } catch (ReadDriverException e) {
- this.setVisible(false);
- this.setActive(false);
- throw e;
- }
- */
-
-
- // TEST METHOD
boolean bDrawShapes = true;
if (legend instanceof SingleSymbolLegend) {
bDrawShapes = legend.getDefaultSymbol().isShapeVisible();
@@ -850,14 +671,6 @@
fieldList.add(aux[i]);
}
}
-//
-// // fields from labeling
-// if (isLabeled()) {
-// aux = getLabelingStrategy().getUsedFields();
-// for (int i = 0; i < aux.length; i++) {
-// fieldList.add(aux[i]);
-// }
-// }
ZSort zSort = ((IVectorLegend) getLegend()).getZSort();
@@ -868,23 +681,18 @@
int mapLevelCount = (useZSort) ? zSort.getLevelCount() : 1;
for (int mapPass = 0; mapPass < mapLevelCount; mapPass++) {
// Get the iterator over the visible features
-// IFeatureIterator it = getSource().getFeatureIterator(
-// viewPort.getAdjustedExtent(),
-// fieldList.toArray(new String[fieldList.size()]),
-// viewPort.getProjection(),
-// true);
- IFeatureIterator it = null;
- if (isJoined()) {
- it = new JoinFeatureIterator(this, viewPort,
- fieldList.toArray(new String[fieldList.size()]));
- }
- else {
- it = getSource().getFeatureIterator(
- viewPort.getAdjustedExtent(),
- fieldList.toArray(new String[fieldList.size()]),
- viewPort.getProjection(),
- true);
- }
+ IFeatureIterator it = null;
+ if (isJoined()) {
+ it = new JoinFeatureIterator(this, viewPort,
+ fieldList.toArray(new String[fieldList.size()]));
+ } else {
+ it = getSource()
+ .getFeatureIterator(
+ viewPort.getAdjustedExtent(),
+ fieldList.toArray(new String[fieldList
+ .size()]),
+ viewPort.getProjection(), true);
+ }
// Iteration over each feature
while ( !cancel.isCanceled() && it.hasNext()) {
@@ -898,11 +706,13 @@
}
if (useZSort) {
int[] symLevels = zSort.getLevels(sym);
- if(symLevels != null){
+ if (symLevels != null) {
// Check if this symbol is a multilayer
if (sym instanceof IMultiLayerSymbol) {
- // if so, get the layer corresponding to the current
- // level. If none, continue to next iteration
+ // if so, get the layer corresponding to the
+ // current
+ // level. If none, continue to next
+ // iteration
IMultiLayerSymbol mlSym = (IMultiLayerSymbol) sym;
for (int i = 0; i < mlSym.getLayerCount(); i++) {
ISymbol mySym = mlSym.getLayer(i);
@@ -910,12 +720,20 @@
sym = mySym;
break;
}
- System.out.println("avoided layer "+i+"of symbol '"+mlSym.getDescription()+"' (pass "+mapPass+")");
+ System.out.println("avoided layer " + i
+ + "of symbol '"
+ + mlSym.getDescription()
+ + "' (pass " + mapPass + ")");
}
} else {
// else, just draw the symbol in its level
if (symLevels[0] != mapPass) {
- System.out.println("avoided single layer symbol '"+sym.getDescription()+"' (pass "+mapPass+")");
+ System.out
+ .println("avoided single layer symbol '"
+ + sym.getDescription()
+ + "' (pass "
+ + mapPass
+ + ")");
continue;
}
}
@@ -933,8 +751,6 @@
csSym = (CartographicSupport) sym;
}
-// System.err.println("passada "+mapPass+" pinte s�mboll "+sym.getDescription());
-
if (csSym == null) {
geom.drawInts(g, viewPort, sym, null);
} else {
@@ -955,21 +771,9 @@
public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
double scale, PrintRequestAttributeSet properties) throws ReadDriverException {
-// if (forTestOnlyVariableUseIterators_REMOVE_THIS_FIELD) {
+ if (isVisible() && isWithinScale(scale)) {
_print(g, viewPort, cancel, scale, properties);
-// } else {
-//// moved up to Flayers
-//// if (isVisible() && isWithinScale(scale)) {
-// Strategy strategy = StrategyManager.getStrategy(this);
-//
-// strategy.print(g, viewPort, cancel, properties);
-// ILabelingStrategy labeling;
-// if ( (labeling = getLabelingStrategy() ) != null) {
-// // contains labels
-// labeling.print(g, viewPort, cancel, properties);
-// }
-//// }
-// }
+ }
}
public void deleteSpatialIndex() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|