Revision 29733 trunk/extensions/extArcims/src/es/prodevelop/cit/gvsig/arcims/fmap/layers/FFeatureLyrArcIMS.java
FFeatureLyrArcIMS.java | ||
---|---|---|
75 | 75 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
76 | 76 |
import com.hardcode.gdbms.engine.data.DataSource; |
77 | 77 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
78 |
import com.hardcode.gdbms.engine.values.Value; |
|
78 | 79 |
import com.iver.andami.PluginServices; |
79 | 80 |
import com.iver.cit.gvsig.fmap.MapContext; |
81 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
80 | 82 |
import com.iver.cit.gvsig.fmap.ViewPort; |
83 |
import com.iver.cit.gvsig.fmap.core.CartographicSupport; |
|
81 | 84 |
import com.iver.cit.gvsig.fmap.core.DefaultFeature; |
85 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
86 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
|
82 | 87 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
83 | 88 |
import com.iver.cit.gvsig.fmap.core.SymbologyFactory; |
89 |
import com.iver.cit.gvsig.fmap.core.symbols.IMultiLayerSymbol; |
|
84 | 90 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
91 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
|
92 |
import com.iver.cit.gvsig.fmap.drivers.IFeatureIterator; |
|
85 | 93 |
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter; |
86 | 94 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
87 | 95 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
96 |
import com.iver.cit.gvsig.fmap.layers.ISpatialDB; |
|
88 | 97 |
import com.iver.cit.gvsig.fmap.layers.LegendChangedEvent; |
89 | 98 |
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial; |
90 | 99 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
100 |
import com.iver.cit.gvsig.fmap.layers.SpatialCache; |
|
91 | 101 |
import com.iver.cit.gvsig.fmap.layers.XMLException; |
92 | 102 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.InfoByPoint; |
103 |
import com.iver.cit.gvsig.fmap.rendering.IClassifiedVectorLegend; |
|
93 | 104 |
import com.iver.cit.gvsig.fmap.rendering.ILegend; |
94 | 105 |
import com.iver.cit.gvsig.fmap.rendering.IVectorLegend; |
95 | 106 |
import com.iver.cit.gvsig.fmap.rendering.LegendListener; |
107 |
import com.iver.cit.gvsig.fmap.rendering.SingleSymbolLegend; |
|
108 |
import com.iver.cit.gvsig.fmap.rendering.ZSort; |
|
96 | 109 |
import com.iver.utiles.XMLEntity; |
97 | 110 |
import com.iver.utiles.connections.ConnectionException; |
98 | 111 |
import com.iver.utiles.swing.threads.Cancellable; |
... | ... | |
134 | 147 |
myCanc = new MyCancellable(new DefaultCancellableMonitorable()); |
135 | 148 |
|
136 | 149 |
setSource(vectAdapter); |
137 |
|
|
138 |
// try { |
|
139 |
// // setRecordset(((FMapFeatureArcImsDriver) getSource().getDriver()).getRecordSet()); |
|
140 |
// shapeType = vectAdapter.getShapeType(); |
|
141 |
// // ((VectorialLegend) getLegend()).setShapeType(shapeType); |
|
142 |
// } catch (Exception e) { |
|
143 |
// logger.error("Unexpected error while getting shape type ", e); |
|
144 |
// } |
|
145 | 150 |
addLegendListener(this); |
146 |
|
|
147 |
// loadInitialColors(); |
|
148 | 151 |
} |
149 | 152 |
|
150 | 153 |
public FFeatureLyrArcIMS() { |
... | ... | |
172 | 175 |
// loadInitialColors(); |
173 | 176 |
} |
174 | 177 |
|
175 |
/* |
|
176 |
public void setLegend(VectorialLegend r) |
|
177 |
throws DriverException, FieldNotFoundException { |
|
178 |
VectorialLegend oldLegend = legend; |
|
179 |
legend = r; |
|
180 |
|
|
181 |
try { |
|
182 |
legend.setDataSource(getRecordset()); |
|
183 |
|
|
184 |
if (legend.getLabelField() != null) { |
|
185 |
// sds.start(); |
|
186 |
// int idLabelField = getRecordset().getFieldIndexByName(legend.getLabelField()); |
|
187 |
createLabelLayer(sds); |
|
188 |
// sds.stop(); |
|
189 |
} |
|
190 |
else |
|
191 |
removeLabels(); |
|
192 |
} catch (DriverException e) { |
|
193 |
throw new DriverException(e); |
|
194 |
} catch (FieldNotFoundException e) { |
|
195 |
// TODO Auto-generated catch block |
|
196 |
e.printStackTrace(); |
|
197 |
} |
|
198 |
|
|
199 |
LegendChangedEvent e = LegendChangedEvent.createLegendChangedEvent(oldLegend, legend); |
|
200 |
callLegendChanged(e); |
|
201 |
} |
|
202 |
*/ |
|
203 |
|
|
204 |
// private void loadInitialColors() { |
|
205 |
// // Color[] cols = |
|
206 |
// initialColors.add(new Color(179, 226, 205)); |
|
207 |
// initialColors.add(new Color(253, 205, 172)); |
|
208 |
// initialColors.add(new Color(203, 213, 232)); |
|
209 |
// initialColors.add(new Color(230, 245, 201)); |
|
210 |
// initialColors.add(new Color(141, 211, 199)); |
|
211 |
// initialColors.add(new Color(255, 255, 179)); |
|
212 |
// initialColors.add(new Color(190, 186, 218)); |
|
213 |
// initialColors.add(new Color(251, 128, 114)); |
|
214 |
// initialColors.add(new Color(128, 177, 211)); |
|
215 |
// } |
|
216 |
|
|
217 | 178 |
/** |
218 |
* |
|
179 |
* Draws using IFeatureIterator. This method will replace the old draw(...) one. |
|
180 |
* @autor jaume dominguez faus - jaume.dominguez@iver.es |
|
181 |
* @param image |
|
182 |
* @param g |
|
183 |
* @param viewPort |
|
184 |
* @param cancel |
|
185 |
* @param scale |
|
186 |
* @throws ReadDriverException |
|
219 | 187 |
*/ |
220 |
public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, |
|
221 |
Cancellable cancel, double scale) throws ReadDriverException { |
|
188 |
private void _draw(BufferedImage image, Graphics2D g, ViewPort viewPort, |
|
189 |
Cancellable cancel, double scale) throws ReadDriverException { |
|
190 |
|
|
222 | 191 |
if (!isVisible()) { |
223 | 192 |
return; |
224 | 193 |
} |
... | ... | |
235 | 204 |
visualStatus.maxX = viewPort.getAdjustedExtent().getMaxX(); |
236 | 205 |
visualStatus.maxY = viewPort.getAdjustedExtent().getMaxY(); |
237 | 206 |
|
238 |
IGeometry geom; |
|
239 |
IGeometry clonedGeom; |
|
207 |
IGeometry geom, clongeom;
|
|
208 |
|
|
240 | 209 |
ICoordTrans layerTransf = getCoordTrans(); |
241 | 210 |
Rectangle2D bBox = viewPort.getAdjustedExtent(); |
211 |
|
|
212 |
arcimsStatus.setExtent(bBox); |
|
213 |
arcimsStatus.setHeight(viewPort.getImageHeight()); |
|
214 |
arcimsStatus.setWidth(viewPort.getImageWidth()); |
|
242 | 215 |
|
243 |
// CSV-WKT or LIBARCIMS |
|
244 |
boolean test = false; |
|
216 |
// one-item vector: |
|
217 |
arcimsStatus.setLayerIds(Utilities.createVector(layerQuery, ",")); |
|
218 |
arcimsStatus.setServer(host.toString()); |
|
219 |
arcimsStatus.setService(service); |
|
220 |
arcimsStatus.setSrs(this.getProjection().getAbrev()); |
|
221 |
arcimsStatus.setTransparency(this.arcImsTransparency); |
|
245 | 222 |
|
246 |
if (test) { |
|
247 |
// -------------------------- TEST START --------------------------------- |
|
248 |
// geometries = ((FMapFeatureArcImsDriver) getSource().getDriver()).getGeometries(); |
|
249 |
for (int i = 0; i < geometries.size(); i++) { |
|
250 |
geom = (IGeometry) geometries.get(i); |
|
223 |
FMapFeatureArcImsDriver drv = |
|
224 |
(FMapFeatureArcImsDriver) getSource().getDriver(); |
|
225 |
IVectorLegend lgnd = (IVectorLegend) getLegend(); |
|
251 | 226 |
|
252 |
if (geom.intersects(bBox)) { |
|
253 |
clonedGeom = geom.cloneGeometry(); |
|
227 |
// get needed fields |
|
228 |
String[] legflds = null; |
|
229 |
String[] savedFieldNames = arcimsStatus.getSubfields(); |
|
254 | 230 |
|
255 |
ISymbol symbol = (ISymbol) ((IVectorLegend) getLegend()).getSymbol(i); |
|
231 |
if (lgnd instanceof IClassifiedVectorLegend) { |
|
232 |
legflds = ((IClassifiedVectorLegend) lgnd).getClassifyingFieldNames(); |
|
233 |
if (legflds!=null) { |
|
234 |
String[] appended = appendAtringArrays(savedFieldNames, legflds); |
|
235 |
arcimsStatus.setSubfields(appended); |
|
236 |
} |
|
237 |
} |
|
256 | 238 |
|
257 |
if (layerTransf != null) { |
|
258 |
geom.reProject(layerTransf); |
|
259 |
} |
|
239 |
try { |
|
240 |
// ******************************************** |
|
241 |
// first item in query must contain ID or #ALL# |
|
242 |
// ******************************************** |
|
243 |
geometries = (ArrayList) drv.getMap(arcimsStatus); |
|
244 |
} catch (Exception e) { |
|
245 |
// restore dubfields |
|
246 |
arcimsStatus.setSubfields(savedFieldNames); |
|
247 |
ReadDriverException de = |
|
248 |
new ReadDriverException("While getting map (ArrayList of geometries) ", e); |
|
249 |
throw de; |
|
250 |
} |
|
251 |
// restore dubfields |
|
252 |
arcimsStatus.setSubfields(savedFieldNames); |
|
260 | 253 |
|
261 |
clonedGeom.draw(g, viewPort, symbol); |
|
262 |
} |
|
263 |
} |
|
254 |
boolean bDrawShapes = true; |
|
255 |
|
|
256 |
if (lgnd instanceof SingleSymbolLegend) { |
|
257 |
bDrawShapes = lgnd.getDefaultSymbol().isShapeVisible(); |
|
258 |
} |
|
259 |
Point2D offset = viewPort.getOffset(); |
|
260 |
double dpi = MapContext.getScreenDPI(); |
|
264 | 261 |
|
265 |
// -------------------------- TEST END --------------------------------- |
|
266 |
} |
|
267 |
else { |
|
268 |
// -------------------------- NOT TEST START --------------------------------- |
|
269 |
arcimsStatus.setExtent(bBox); |
|
270 |
arcimsStatus.setHeight(viewPort.getImageHeight()); |
|
271 |
arcimsStatus.setWidth(viewPort.getImageWidth()); |
|
262 |
if (bDrawShapes) { |
|
272 | 263 |
|
273 |
// one-item vector: |
|
274 |
arcimsStatus.setLayerIds(Utilities.createVector(layerQuery, ",")); |
|
275 |
arcimsStatus.setServer(host.toString()); |
|
276 |
arcimsStatus.setService(service); |
|
277 |
arcimsStatus.setSrs(this.getProjection().getAbrev()); |
|
278 |
arcimsStatus.setTransparency(this.arcImsTransparency); |
|
264 |
try { |
|
279 | 265 |
|
280 |
FMapFeatureArcImsDriver drv = (FMapFeatureArcImsDriver) getSource() |
|
281 |
.getDriver(); |
|
266 |
// Get the iterator over the visible features |
|
267 |
IFeatureIterator it = new AvoidGeometryAndIdFeatureIterator(geometries, savedFieldNames.length); |
|
268 |
ZSort zSort = ((IVectorLegend) getLegend()).getZSort(); |
|
282 | 269 |
|
283 |
try { |
|
284 |
// ******************************************** |
|
285 |
// first item in query must contain ID or #ALL# |
|
286 |
// ******************************************** |
|
287 |
geometries = (ArrayList) drv.getMap(arcimsStatus); |
|
288 |
} |
|
289 |
catch (Exception e) { |
|
290 |
ReadDriverException de = |
|
291 |
new ReadDriverException("While getting map (ArrayList of geometries) ", e); |
|
292 |
throw de; |
|
293 |
} |
|
270 |
boolean bSymbolLevelError = false; |
|
294 | 271 |
|
295 |
for (int i = 0; i < geometries.size(); i++) {
|
|
296 |
geom = (IGeometry) ((DefaultFeature) geometries.get(i)).getGeometry();
|
|
272 |
// if layer has map levels it will use a ZSort
|
|
273 |
boolean useZSort = zSort != null && zSort.isUsingZSort();
|
|
297 | 274 |
|
298 |
if (geom == null) { |
|
299 |
logger.error("Retrieved null geometry "); |
|
300 |
} |
|
301 |
else { |
|
302 |
clonedGeom = geom.cloneGeometry(); |
|
275 |
// -- visual FX stuff |
|
276 |
long time = System.currentTimeMillis(); |
|
277 |
BufferedImage virtualBim; |
|
278 |
Graphics2D virtualGraphics; |
|
303 | 279 |
|
304 |
int ov_index = drv.getOverallIndex(i); |
|
305 |
ISymbol symbol = (ISymbol) getSymbolOrSelected(ov_index, |
|
306 |
((IVectorLegend) getLegend()).getSymbol( |
|
307 |
ov_index)); |
|
280 |
// render temporary map each screenRefreshRate milliseconds; |
|
281 |
int screenRefreshDelay = (int) ((1D/MapControl.getDrawFrameRate())*3*1000); |
|
282 |
BufferedImage[] imageLevels = null; |
|
283 |
Graphics2D[] graphics = null; |
|
284 |
if (useZSort) { |
|
285 |
imageLevels = new BufferedImage[zSort.getLevelCount()]; |
|
286 |
graphics = new Graphics2D[imageLevels.length]; |
|
287 |
for (int i = 0; !cancel.isCanceled() && i < imageLevels.length; i++) { |
|
288 |
imageLevels[i] = new BufferedImage(image.getWidth(), image.getHeight(), image.getType()); |
|
289 |
graphics[i] = imageLevels[i].createGraphics(); |
|
290 |
graphics[i].setTransform(g.getTransform()); |
|
291 |
graphics[i].setRenderingHints(g.getRenderingHints()); |
|
292 |
} |
|
293 |
} |
|
294 |
// -- end visual FX stuff |
|
308 | 295 |
|
309 |
if (layerTransf != null) { |
|
310 |
geom.reProject(layerTransf); |
|
311 |
} |
|
312 | 296 |
|
313 |
clonedGeom.drawInts(g, viewPort, symbol, cancel); |
|
314 |
} |
|
315 |
} |
|
297 |
int featindex = -1; |
|
298 |
// Iteration over each feature |
|
299 |
while ( !cancel.isCanceled() && it.hasNext()) { |
|
300 |
|
|
301 |
featindex++; |
|
302 |
IFeature feat = it.next(); |
|
303 |
geom = feat.getGeometry(); |
|
304 |
|
|
305 |
clongeom = geom.cloneGeometry(); |
|
306 |
geom = clongeom; |
|
307 |
|
|
308 |
if ((layerTransf != null) && (isNotSame(layerTransf))) { |
|
309 |
geom.reProject(layerTransf); |
|
310 |
} |
|
316 | 311 |
|
317 |
// FLyrText possibleLabels = getLayerText(); |
|
318 |
// |
|
319 |
// if (possibleLabels != null) { |
|
320 |
// possibleLabels.createLabels(this); |
|
321 |
// possibleLabels.draw(image, g, viewPort, cancel, scale); |
|
322 |
// } |
|
312 |
// retrieve the symbol associated to such feature |
|
313 |
ISymbol sym = lgnd.getSymbolByFeature(feat); |
|
323 | 314 |
|
324 |
// -------------------------- NOT TEST END --------------------------------- |
|
325 |
} |
|
315 |
if (sym == null) continue; |
|
316 |
|
|
317 |
//C?digo para poder acceder a los ?ndices para ver si est? seleccionado un Feature |
|
318 |
ReadableVectorial rv=getSource(); |
|
319 |
int selectionIndex=-1; |
|
320 |
|
|
321 |
|
|
322 |
FMapFeatureArcImsDriver imsdrv = (FMapFeatureArcImsDriver) getSource().getDriver(); |
|
323 |
selectionIndex = imsdrv.getOverallIndex(featindex); |
|
324 |
|
|
325 |
if (selectionIndex!=-1) { |
|
326 |
if (getSelectionSupport().isSelected(selectionIndex)) { |
|
327 |
sym = sym.getSymbolForSelection(); |
|
328 |
} |
|
329 |
} |
|
330 |
|
|
331 |
// Check if this symbol is sized with CartographicSupport |
|
332 |
CartographicSupport csSym = null; |
|
333 |
int symbolType = sym.getSymbolType(); |
|
334 |
boolean bDrawCartographicSupport = false; |
|
335 |
|
|
336 |
if ( symbolType == FShape.POINT |
|
337 |
|| symbolType == FShape.LINE |
|
338 |
|| sym instanceof CartographicSupport) { |
|
339 |
|
|
340 |
// patch |
|
341 |
if (!sym.getClass().equals(FSymbol.class)) { |
|
342 |
csSym = (CartographicSupport) sym; |
|
343 |
bDrawCartographicSupport = (csSym.getUnit() != -1); |
|
344 |
} |
|
345 |
} |
|
346 |
|
|
347 |
int x = -1; |
|
348 |
int y = -1; |
|
349 |
int[] xyCoords = new int[2]; |
|
350 |
|
|
351 |
// Check if size is a pixel |
|
352 |
boolean onePoint = bDrawCartographicSupport ? |
|
353 |
isOnePoint(g.getTransform(), viewPort, MapContext.getScreenDPI(), csSym, geom, xyCoords) : |
|
354 |
isOnePoint(g.getTransform(), viewPort, geom, xyCoords); |
|
355 |
|
|
356 |
// Avoid out of bounds exceptions |
|
357 |
if (onePoint) { |
|
358 |
x = xyCoords[0]; |
|
359 |
y = xyCoords[1]; |
|
360 |
if (x<0 || y<0 || x>= viewPort.getImageWidth() || y>=viewPort.getImageHeight()) continue; |
|
361 |
} |
|
362 |
|
|
363 |
if (useZSort) { |
|
364 |
// Check if this symbol is a multilayer |
|
365 |
int[] symLevels = zSort.getLevels(sym); |
|
366 |
if (sym instanceof IMultiLayerSymbol) { |
|
367 |
// if so, treat each of its layers as a single symbol |
|
368 |
// in its corresponding map level |
|
369 |
IMultiLayerSymbol mlSym = (IMultiLayerSymbol) sym; |
|
370 |
for (int i = 0; !cancel.isCanceled() && i < mlSym.getLayerCount(); i++) { |
|
371 |
ISymbol mySym = mlSym.getLayer(i); |
|
372 |
int symbolLevel = 0; |
|
373 |
if (symLevels != null) { |
|
374 |
symbolLevel = symLevels[i]; |
|
375 |
} else { |
|
376 |
/* an error occured when managing symbol levels. |
|
377 |
* some of the legend changed events regarding the |
|
378 |
* symbols did not finish satisfactory and the legend |
|
379 |
* is now inconsistent. For this drawing, it will finish |
|
380 |
* as it was at the bottom (level 0) but, when done, the |
|
381 |
* ZSort will be reset to avoid app crashes. This is |
|
382 |
* a bug that has to be fixed. |
|
383 |
*/ |
|
384 |
bSymbolLevelError = true; |
|
385 |
} |
|
386 |
|
|
387 |
if (onePoint) { |
|
388 |
if (x<0 || y<0 || x>= imageLevels[symbolLevel].getWidth() || y>=imageLevels[symbolLevel].getHeight()) continue; |
|
389 |
imageLevels[symbolLevel].setRGB(x, y, mySym.getOnePointRgb()); |
|
390 |
} else { |
|
391 |
if (!bDrawCartographicSupport) { |
|
392 |
geom.drawInts(graphics[symbolLevel], viewPort, mySym, cancel); |
|
393 |
} else { |
|
394 |
geom.drawInts(graphics[symbolLevel], viewPort, dpi, (CartographicSupport) mySym, cancel); |
|
395 |
} |
|
396 |
} |
|
397 |
} |
|
398 |
} else { |
|
399 |
// else, just draw the symbol in its level |
|
400 |
int symbolLevel = 0; |
|
401 |
if (symLevels != null) { |
|
402 |
|
|
403 |
symbolLevel=symLevels[0]; |
|
404 |
} else { |
|
405 |
/* If symLevels == null |
|
406 |
* an error occured when managing symbol levels. |
|
407 |
* some of the legend changed events regarding the |
|
408 |
* symbols did not finish satisfactory and the legend |
|
409 |
* is now inconsistent. For this drawing, it will finish |
|
410 |
* as it was at the bottom (level 0). This is |
|
411 |
* a bug that has to be fixed. |
|
412 |
*/ |
|
413 |
// bSymbolLevelError = true; |
|
414 |
} |
|
415 |
|
|
416 |
if (!bDrawCartographicSupport) { |
|
417 |
geom.drawInts(graphics[symbolLevel], viewPort, sym, cancel); |
|
418 |
} else { |
|
419 |
geom.drawInts(graphics[symbolLevel], viewPort, dpi, (CartographicSupport) csSym, cancel); |
|
420 |
} |
|
421 |
} |
|
422 |
|
|
423 |
// -- visual FX stuff |
|
424 |
// Cuando el offset!=0 se est? dibujando sobre el Layout y por tanto no tiene que ejecutar el siguiente c?digo. |
|
425 |
if (offset.getX()==0 && offset.getY()==0) |
|
426 |
if ((System.currentTimeMillis() - time) > screenRefreshDelay) { |
|
427 |
virtualBim = new BufferedImage(image.getWidth(),image.getHeight(),BufferedImage.TYPE_INT_ARGB); |
|
428 |
virtualGraphics = virtualBim.createGraphics(); |
|
429 |
virtualGraphics.drawImage(image,0,0, null); |
|
430 |
for (int i = 0; !cancel.isCanceled() && i < imageLevels.length; i++) { |
|
431 |
virtualGraphics.drawImage(imageLevels[i],0,0, null); |
|
432 |
} |
|
433 |
g.clearRect(0, 0, image.getWidth(), image.getHeight()); |
|
434 |
g.drawImage(virtualBim, 0, 0, null); |
|
435 |
time = System.currentTimeMillis(); |
|
436 |
} |
|
437 |
// -- end visual FX stuff |
|
438 |
|
|
439 |
} else { |
|
440 |
// no ZSort, so there is only a map level, symbols are |
|
441 |
// just drawn. |
|
442 |
if (onePoint) { |
|
443 |
if (x<0 || y<0 || x>= image.getWidth() || y>=image.getHeight()) continue; |
|
444 |
image.setRGB(x, y, sym.getOnePointRgb()); |
|
445 |
} else { |
|
446 |
if (!bDrawCartographicSupport) { |
|
447 |
geom.drawInts(g, viewPort, sym, cancel); |
|
448 |
} else { |
|
449 |
geom.drawInts(g, viewPort, dpi, csSym, cancel); |
|
450 |
} |
|
451 |
} |
|
452 |
} |
|
453 |
} |
|
454 |
|
|
455 |
if (useZSort) { |
|
456 |
g.drawImage(image, 0, 0, null); |
|
457 |
g.translate(offset.getX(), offset.getY()); |
|
458 |
for (int i = 0; !cancel.isCanceled() && i < imageLevels.length; i++) { |
|
459 |
g.drawImage(imageLevels[i],0,0, null); |
|
460 |
imageLevels[i] = null; |
|
461 |
graphics[i] = null; |
|
462 |
} |
|
463 |
g.translate(-offset.getX(), -offset.getY()); |
|
464 |
imageLevels = null; |
|
465 |
graphics = null; |
|
466 |
} |
|
467 |
it.closeIterator(); |
|
468 |
|
|
469 |
if (bSymbolLevelError) { |
|
470 |
((IVectorLegend) getLegend()).setZSort(null); |
|
471 |
} |
|
472 |
|
|
473 |
} catch (ReadDriverException e) { |
|
474 |
this.setVisible(false); |
|
475 |
this.setActive(false); |
|
476 |
throw e; |
|
477 |
} |
|
478 |
|
|
479 |
|
|
480 |
} |
|
326 | 481 |
} |
327 | 482 |
|
483 |
|
|
484 |
|
|
485 |
private boolean isNotSame(ICoordTrans trans) { |
|
486 |
|
|
487 |
String from_abb = trans.getPOrig().getAbrev(); |
|
488 |
String to_abb = trans.getPDest().getAbrev(); |
|
489 |
return (from_abb.compareTo(to_abb) != 0); |
|
490 |
} |
|
491 |
|
|
492 |
private String[] appendAtringArrays(String[] arr1, String[] arr2) { |
|
493 |
|
|
494 |
int len = arr1.length + arr2.length; |
|
495 |
String[] resp = new String[len]; |
|
496 |
int i = 0; |
|
497 |
for (i=0; i<arr1.length; i++) resp[i] = arr1[i]; |
|
498 |
for (i=0; i<arr2.length; i++) resp[arr1.length+i] = arr2[i]; |
|
499 |
return resp; |
|
500 |
} |
|
501 |
|
|
502 |
/** |
|
503 |
* |
|
504 |
*/ |
|
505 |
public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, |
|
506 |
Cancellable cancel, double scale) throws ReadDriverException { |
|
507 |
|
|
508 |
_draw(image, g, viewPort, cancel, scale); |
|
509 |
} |
|
510 |
|
|
328 | 511 |
private ISymbol getSymbolOrSelected(int i, ISymbol symbol) { |
329 | 512 |
boolean sel = false; |
330 | 513 |
|
... | ... | |
911 | 1094 |
protected double maxX = 0D; |
912 | 1095 |
protected double maxY = 0D; |
913 | 1096 |
} |
1097 |
|
|
1098 |
private class AvoidGeometryAndIdFeatureIterator implements IFeatureIterator { |
|
1099 |
|
|
1100 |
private ArrayList featArray; |
|
1101 |
private int index = 0; |
|
1102 |
private int size = 0; |
|
1103 |
private int noToAvoid = 0; |
|
1104 |
|
|
1105 |
public AvoidGeometryAndIdFeatureIterator(ArrayList arr, int navoided) { |
|
1106 |
featArray = arr; |
|
1107 |
size = arr.size(); |
|
1108 |
index = 0; |
|
1109 |
noToAvoid = navoided; |
|
1110 |
} |
|
1111 |
|
|
1112 |
public void closeIterator() throws ReadDriverException { |
|
1113 |
index = 0; |
|
1114 |
} |
|
1115 |
|
|
1116 |
public boolean hasNext() throws ReadDriverException { |
|
1117 |
return (index < size); |
|
1118 |
} |
|
1119 |
|
|
1120 |
public IFeature next() throws ReadDriverException { |
|
1121 |
index++; |
|
1122 |
if (index > size) { |
|
1123 |
logger.error("Out of index in AuxFeatureIterator: " + (index-1)); |
|
1124 |
return null; |
|
1125 |
} else { |
|
1126 |
IFeature resp = (IFeature) featArray.get(index-1); |
|
1127 |
Value[] oldatts = resp.getAttributes(); |
|
1128 |
Value[] newatts = new Value[oldatts.length - noToAvoid]; |
|
1129 |
for (int i=0; i<newatts.length; i++) newatts[i] = oldatts[i + noToAvoid]; |
|
1130 |
resp.setAttributes(newatts); |
|
1131 |
return resp; |
|
1132 |
} |
|
1133 |
} |
|
1134 |
|
|
1135 |
} |
|
914 | 1136 |
} |
Also available in: Unified diff