74 |
74 |
import org.gvsig.fmap.mapcontext.layers.operations.Classifiable;
|
75 |
75 |
import org.gvsig.fmap.mapcontext.layers.operations.SingleLayer;
|
76 |
76 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
|
|
77 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
|
77 |
78 |
import org.gvsig.fmap.mapcontext.rendering.legend.ISingleSymbolLegend;
|
78 |
79 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
|
79 |
80 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent;
|
80 |
81 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendClearEvent;
|
81 |
82 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
|
82 |
83 |
import org.gvsig.fmap.mapcontext.rendering.legend.events.listeners.LegendListener;
|
|
84 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
|
83 |
85 |
import org.gvsig.gvsig3d.impl.symbology3d.Symbol3DFactory;
|
84 |
86 |
import org.gvsig.gvsig3d.impl.symbology3d.marker.impl.SimpleMarker3DSymbol;
|
85 |
87 |
import org.gvsig.gvsig3d.map3d.Layer3DProps;
|
86 |
88 |
import org.gvsig.gvsig3d.map3d.MapContext3D;
|
87 |
89 |
import org.gvsig.gvsig3d.map3d.layers.FLayers3D;
|
88 |
90 |
import org.gvsig.gvsig3d.symbology3d.I3DSymbol;
|
|
91 |
import org.gvsig.gvsig3d.symbology3d.marker.ISimpleMarker3DSymbol;
|
89 |
92 |
import org.gvsig.osgvp.core.osg.Group;
|
90 |
93 |
import org.gvsig.osgvp.core.osg.Image;
|
91 |
94 |
import org.gvsig.osgvp.core.osg.Matrix;
|
... | ... | |
123 |
126 |
import org.gvsig.raster.fmap.layers.DefaultFLyrRaster;
|
124 |
127 |
import org.gvsig.raster.impl.grid.GridImpl;
|
125 |
128 |
import org.gvsig.raster.impl.provider.DefaultRasterProvider;
|
|
129 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractIntervalLegend;
|
|
130 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.VectorialUniqueValueLegend;
|
126 |
131 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IFillSymbol;
|
127 |
132 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol;
|
128 |
133 |
import org.gvsig.tools.ToolsLocator;
|
... | ... | |
221 |
226 |
_canvasoff.addFeature((((TerrainViewer) _canvas3d
|
222 |
227 |
.getOSGViewer()).getFeatures()));
|
223 |
228 |
Vec4 color = ((TerrainViewer) _canvas3d.getOSGViewer())
|
224 |
|
.getClearColor();
|
|
229 |
.getClearColor();
|
225 |
230 |
_canvasoff.setClearColor(color.x(), color.y(), color.z(),
|
226 |
231 |
color.w());
|
227 |
232 |
this.setRenewCanvasOff(false);
|
... | ... | |
246 |
251 |
_canvasoff.frame();
|
247 |
252 |
|
248 |
253 |
org.gvsig.osgvp.core.osg.Image OSGimage = _canvasoff
|
249 |
|
.getScreenshotImage();
|
|
254 |
.getScreenshotImage();
|
250 |
255 |
|
251 |
256 |
BufferedImage img = null;
|
252 |
257 |
try {
|
... | ... | |
320 |
325 |
System.out.println(" Order " + pos);
|
321 |
326 |
pos++;
|
322 |
327 |
}
|
323 |
|
|
324 |
328 |
}
|
325 |
329 |
|
326 |
330 |
public void activationChanged(LayerEvent e) {
|
... | ... | |
389 |
393 |
|
390 |
394 |
extent = new Extent(layerEnvelope.getLowerCorner().getX(),
|
391 |
395 |
layerEnvelope.getLowerCorner().getY(), layerEnvelope
|
392 |
|
.getUpperCorner().getX(), layerEnvelope
|
393 |
|
.getUpperCorner().getY());
|
|
396 |
.getUpperCorner().getX(), layerEnvelope
|
|
397 |
.getUpperCorner().getY());
|
394 |
398 |
|
395 |
399 |
} else {
|
396 |
400 |
extent = new Extent(Math.toRadians(layerEnvelope.getLowerCorner()
|
397 |
401 |
.getX()), Math.toRadians(layerEnvelope.getLowerCorner()
|
398 |
|
.getY()), Math.toRadians(layerEnvelope.getUpperCorner()
|
399 |
|
.getX()), Math.toRadians(layerEnvelope.getUpperCorner()
|
400 |
|
.getY()));
|
|
402 |
.getY()), Math.toRadians(layerEnvelope.getUpperCorner()
|
|
403 |
.getX()), Math.toRadians(layerEnvelope.getUpperCorner()
|
|
404 |
.getY()));
|
401 |
405 |
|
402 |
406 |
}
|
403 |
407 |
|
404 |
408 |
// Raster Layers
|
405 |
409 |
if (props.getType() == Layer3DPropsImpl.layer3DImage)
|
406 |
|
// || props.reasterized()==true) {
|
|
410 |
// || props.reasterized()==true) {
|
407 |
411 |
{
|
408 |
412 |
TextureLayer rlayer = new TextureLayer();
|
409 |
413 |
rlayer.setEnabled(layer.isVisible());
|
... | ... | |
431 |
435 |
// if rasterizing layers set Default 2D symbology
|
432 |
436 |
if (layer instanceof FLyrVect) {
|
433 |
437 |
// Create a 2D Legend for jess
|
434 |
|
try {
|
435 |
|
((FLyrVect) layer)
|
436 |
|
.setLegend((IVectorLegend) MapContextLocator
|
437 |
|
.getMapContextManager()
|
438 |
|
.getLegend(
|
439 |
|
((FLyrVect) layer).getDataStore(),
|
440 |
|
MapContextLocator
|
441 |
|
.getMapContextManager()
|
442 |
|
.getDefaultSymbologyDomain()));
|
443 |
|
} catch (LegendLayerException e) {
|
444 |
|
// TODO Auto-generated catch block
|
445 |
|
e.printStackTrace();
|
446 |
|
} catch (LocatorException e) {
|
447 |
|
// TODO Auto-generated catch block
|
448 |
|
e.printStackTrace();
|
449 |
|
}
|
|
438 |
if (((FLyrVect) (layer)).getLegend().getDefaultSymbol() instanceof I3DSymbol)
|
|
439 |
try {
|
|
440 |
((FLyrVect) layer)
|
|
441 |
.setLegend((IVectorLegend) MapContextLocator
|
|
442 |
.getMapContextManager()
|
|
443 |
.getLegend(
|
|
444 |
((FLyrVect) layer)
|
|
445 |
.getDataStore(),
|
|
446 |
MapContextLocator
|
|
447 |
.getMapContextManager()
|
|
448 |
.getDefaultSymbologyDomain()));
|
|
449 |
} catch (LegendLayerException e) {
|
|
450 |
// TODO Auto-generated catch block
|
|
451 |
e.printStackTrace();
|
|
452 |
} catch (LocatorException e) {
|
|
453 |
// TODO Auto-generated catch block
|
|
454 |
e.printStackTrace();
|
|
455 |
}
|
450 |
456 |
}
|
451 |
457 |
|
452 |
458 |
// Delete the cachestruct if it exists, and create a new one.
|
... | ... | |
462 |
468 |
if (props.getType() == Layer3DPropsImpl.layer3DVector) {
|
463 |
469 |
// if (layer instanceof FLyrVect) {
|
464 |
470 |
// Set a 3D Legend
|
465 |
|
|
466 |
|
if (!(((FLyrVect) layer).getLegend().getDefaultSymbol() instanceof I3DSymbol)) {
|
467 |
|
try {
|
468 |
|
((FLyrVect) layer)
|
469 |
|
.setLegend((IVectorLegend) MapContextLocator
|
470 |
|
.getMapContextManager().getLegend(
|
471 |
|
((FLyrVect) layer).getDataStore(),
|
472 |
|
"project.document.view3d"));
|
473 |
|
} catch (LegendLayerException e) {
|
474 |
|
// TODO Auto-generated catch block
|
475 |
|
e.printStackTrace();
|
476 |
|
} catch (LocatorException e) {
|
477 |
|
// TODO Auto-generated catch block
|
478 |
|
e.printStackTrace();
|
|
471 |
// TODO We don't need to create always a new Legend. We need to
|
|
472 |
if (((FLyrVect) layer).getLegend() instanceof ISingleSymbolLegend)
|
|
473 |
if (!(((FLyrVect) layer).getLegend().getDefaultSymbol() instanceof I3DSymbol)) {
|
|
474 |
try {
|
|
475 |
((FLyrVect) layer)
|
|
476 |
.setLegend((IVectorLegend) MapContextLocator
|
|
477 |
.getMapContextManager().getLegend(
|
|
478 |
((FLyrVect) layer)
|
|
479 |
.getDataStore(),
|
|
480 |
"project.document.view3d"));
|
|
481 |
} catch (LegendLayerException e) {
|
|
482 |
// TODO Auto-generated catch block
|
|
483 |
e.printStackTrace();
|
|
484 |
} catch (LocatorException e) {
|
|
485 |
// TODO Auto-generated catch block
|
|
486 |
e.printStackTrace();
|
|
487 |
}
|
479 |
488 |
}
|
480 |
|
}
|
481 |
489 |
|
|
490 |
|
|
491 |
|
482 |
492 |
VectorLayer vlayer = new VectorLayer();
|
483 |
493 |
vlayer.setEnabled(layer.isVisible());
|
484 |
494 |
vlayer.setExtent(extent);
|
... | ... | |
639 |
649 |
|
640 |
650 |
public Layer3DProps getLayer3DProps(FLayer layer) {
|
641 |
651 |
Layer3DProps props3D = (Layer3DProps) layer
|
642 |
|
.getProperty("3DLayerExtension");
|
|
652 |
.getProperty("3DLayerExtension");
|
643 |
653 |
//
|
644 |
654 |
// // Create instance of props for osg layers.
|
645 |
655 |
if (props3D == null) {
|
... | ... | |
826 |
836 |
coordinates = CacheStruct.GEOGRAFIC;
|
827 |
837 |
|
828 |
838 |
DefaultRasterProvider provider = (DefaultRasterProvider) dataStore
|
829 |
|
.getProvider();
|
|
839 |
.getProvider();
|
830 |
840 |
|
831 |
841 |
provider.setProjection(layer.getProjection());
|
832 |
842 |
|
... | ... | |
850 |
860 |
|
851 |
861 |
CacheStruct struct = manager.createCacheStructure(coordinates,
|
852 |
862 |
TileCacheLibrary.DEFAULT_LEVELS, provider.getExtent()
|
853 |
|
.toRectangle2D(), provider.getCellSize(), resolution,
|
|
863 |
.toRectangle2D(), provider.getCellSize(), resolution,
|
854 |
864 |
resolution, provider.getFullName(),
|
855 |
865 |
TileCacheLibrary.DEFAULT_STRUCTURE,
|
|
866 |
|
856 |
867 |
RasterLibrary.pathTileCache, provider.getFileSuffix(), provider
|
857 |
868 |
.getProjection().getAbrev(), provider.getFileSize());
|
858 |
869 |
|
|
870 |
|
859 |
871 |
return struct;
|
860 |
872 |
|
861 |
873 |
}
|
... | ... | |
937 |
949 |
// TODO Auto-generated catch block
|
938 |
950 |
e.printStackTrace();
|
939 |
951 |
}
|
940 |
|
//
|
941 |
|
// System.out.println("En el toc antes era el " + oldPos +
|
942 |
|
// " y ahora el "
|
943 |
|
// + newPos);
|
944 |
|
// System.out.println("En el terrain antes era el " + terrainOldPos
|
945 |
|
// + " y ahora el " + terrainNewPos);
|
|
952 |
//
|
|
953 |
// System.out.println("En el toc antes era el " + oldPos +
|
|
954 |
// " y ahora el "
|
|
955 |
// + newPos);
|
|
956 |
// System.out.println("En el terrain antes era el " + terrainOldPos
|
|
957 |
// + " y ahora el " + terrainNewPos);
|
946 |
958 |
|
947 |
|
// PrintDebugLayers();
|
|
959 |
// PrintDebugLayers();
|
948 |
960 |
|
949 |
961 |
}
|
950 |
962 |
|
... | ... | |
1006 |
1018 |
&& props3D.getType() != Layer3DProps.layer3DOSG) {
|
1007 |
1019 |
FLyrVect lyrVect = (FLyrVect) lyr;
|
1008 |
1020 |
System.out
|
1009 |
|
.println("Changeando la simbologia de la capa vectorial: "
|
1010 |
|
+ lyrVect);
|
|
1021 |
.println("Changeando la simbologia de la capa vectorial: "
|
|
1022 |
+ lyrVect);
|
1011 |
1023 |
long newDrawVersion = layers.getDrawVersion();
|
1012 |
1024 |
Layer3DProps vectProps = getLayer3DProps(lyrVect);
|
1013 |
1025 |
if ((newDrawVersion - props3D.getDrawVersion()) >= 1) {
|
... | ... | |
1119 |
1131 |
RasterQuery query = RasterLocator.getManager().createQuery();
|
1120 |
1132 |
|
1121 |
1133 |
org.gvsig.fmap.dal.coverage.datastruct.Extent extent = RasterLocator
|
1122 |
|
.getManager()
|
1123 |
|
.getDataStructFactory()
|
1124 |
|
.createExtent(envelope.getLowerCorner().getX(),
|
1125 |
|
envelope.getUpperCorner().getY(),
|
1126 |
|
envelope.getUpperCorner().getX(),
|
1127 |
|
envelope.getLowerCorner().getY());
|
|
1134 |
.getManager()
|
|
1135 |
.getDataStructFactory()
|
|
1136 |
.createExtent(envelope.getLowerCorner().getX(),
|
|
1137 |
envelope.getUpperCorner().getY(),
|
|
1138 |
envelope.getUpperCorner().getX(),
|
|
1139 |
envelope.getLowerCorner().getY());
|
1128 |
1140 |
|
1129 |
1141 |
query.setTileParameters(rde.getTileLevel(), rde.getTileX(),
|
1130 |
1142 |
rde.getTileY(), extent, null);
|
1131 |
1143 |
|
|
1144 |
|
1132 |
1145 |
try {
|
1133 |
1146 |
Object[] result = rLayer.getDataStore().queryArray(query);
|
1134 |
1147 |
Buffer rBuff = (Buffer) result[0];
|
... | ... | |
1160 |
1173 |
numBands = maxBands;
|
1161 |
1174 |
|
1162 |
1175 |
ColorInterpretation cInt = rLayer.getDataStore()
|
1163 |
|
.getColorInterpretation();
|
|
1176 |
.getColorInterpretation();
|
1164 |
1177 |
|
1165 |
1178 |
ColorTable colorTable = rLayer.getDataStore()
|
1166 |
1179 |
.getColorTable();
|
... | ... | |
1224 |
1237 |
buildIntBuffer(ude, rBuff, transparencyBuffer,
|
1225 |
1238 |
numBands, rgba), rBuff.getWidth(),
|
1226 |
1239 |
rBuff.getHeight(), numBands, pixelFormat,
|
1227 |
|
Image.DataType.GL_INT);
|
|
1240 |
Image.DataType.GL_INT);
|
1228 |
1241 |
break;
|
1229 |
1242 |
case Buffer.TYPE_FLOAT:
|
1230 |
1243 |
ude.setRasterData(
|
... | ... | |
1361 |
1374 |
private UpdateDataEvent loadVectorData(FLayer layer, Envelope envelope,
|
1362 |
1375 |
RequestDataEvent rde) {
|
1363 |
1376 |
|
1364 |
|
System.out.println("vector data");
|
1365 |
1377 |
UpdateDataEvent ude = new UpdateDataEvent();
|
1366 |
1378 |
ude.copyDataFromRequest(rde);
|
|
1379 |
Group g= new Group();
|
|
1380 |
// Hack for polylines and polygons to only render them rasterized
|
|
1381 |
// till gvSIG architects solve geometries problem
|
|
1382 |
Layer3DProps layerprops = getLayer3DProps(layer);
|
|
1383 |
try {
|
|
1384 |
if (((FLyrVect) layer).getShapeType()!=1 &&((FLyrVect) layer).getShapeType()!=7)
|
|
1385 |
{
|
|
1386 |
removeLayerToTerrain(layer);
|
|
1387 |
layerprops.setType(Layer3DPropsImpl.layer3DImage);
|
|
1388 |
addLayerToTerrain(layer, true);
|
|
1389 |
return null;
|
|
1390 |
}
|
|
1391 |
} catch (ReadException e1) {
|
|
1392 |
// TODO Auto-generated catch block
|
|
1393 |
e1.printStackTrace();
|
1367 |
1394 |
|
1368 |
|
// Convenience casting, create a default 3D symbol
|
1369 |
|
ISingleSymbolLegend legend = (ISingleSymbolLegend) ((FLyrVect) layer)
|
1370 |
|
.getLegend();
|
1371 |
|
I3DSymbol sy = (I3DSymbol) legend.getDefaultSymbol();
|
1372 |
|
sy.setCoordinateSystemType(_terrain.getCoordinateSystemType());
|
1373 |
|
|
1374 |
|
// Hack for polylines and polygons to only render them rasterized
|
1375 |
|
// till gvSIG architects solve geometries problem
|
1376 |
|
if (sy instanceof IFillSymbol || sy instanceof ILineSymbol) {
|
1377 |
|
|
1378 |
|
removeLayerToTerrain(layer);
|
1379 |
|
getLayer3DProps(layer).setType(Layer3DPropsImpl.layer3DImage);
|
1380 |
|
addLayerToTerrain(layer, true);
|
1381 |
|
return null;
|
|
1395 |
|
1382 |
1396 |
}// End hack
|
1383 |
|
Layer3DProps layerprops = getLayer3DProps(layer);
|
1384 |
1397 |
|
1385 |
|
if (layerprops.isZEnable() == false)
|
1386 |
|
sy.setFixedHeight(layerprops.getHeight());
|
1387 |
|
|
|
1398 |
//Set ViewPort
|
1388 |
1399 |
ViewPort vp = getViewPort();
|
1389 |
1400 |
vp.setEnvelope(envelope); // the real extent of the tile
|
1390 |
1401 |
vp.setAdjustable(false);
|
1391 |
1402 |
vp.setImageSize(new Dimension(256, 256));
|
1392 |
|
vp.setDist1pixel(0.000000001);
|
|
1403 |
vp.setDist1pixel(0.000000001);
|
|
1404 |
ILegend legend= ((FLyrVect) layer).getLegend();
|
|
1405 |
ISymbol[] symbolList = fillSymbolList(legend);
|
|
1406 |
for(int i=0;i<symbolList.length;i++)
|
|
1407 |
{
|
|
1408 |
I3DSymbol sy = (I3DSymbol) symbolList[i];
|
|
1409 |
sy.setCoordinateSystemType(_terrain.getCoordinateSystemType());
|
|
1410 |
if (layerprops.isZEnable() == false)
|
|
1411 |
sy.setFixedHeight(layerprops.getHeight());
|
|
1412 |
}
|
1393 |
1413 |
|
1394 |
1414 |
double scale = 0.5 * (layer.getMaxScale() + layer.getMinScale());
|
1395 |
1415 |
|
1396 |
1416 |
DataStore ds = ((SingleLayer) layer).getDataStore();
|
1397 |
|
if (sy.getGeometry().getSize() == 0
|
1398 |
|
|| ds.getProviderName() == "NetCDFVectorial"
|
1399 |
|
|| layerprops.isGeometryDirty() == true) {
|
|
1417 |
|
|
1418 |
if ( ((I3DSymbol) symbolList[0]).getGeometry().getSize() == 0 || ds.getProviderName() == "NetCDFVectorial" || layerprops.isGeometryDirty()==true)
|
|
1419 |
{
|
1400 |
1420 |
try {
|
1401 |
|
((SimpleMarker3DSymbol) (sy)).resetGeometry();
|
|
1421 |
for(int i=0;i<symbolList.length;i++)
|
|
1422 |
{
|
|
1423 |
((SimpleMarker3DSymbol)(symbolList[i])).resetGeometry();
|
|
1424 |
}
|
1402 |
1425 |
layer.draw(null, null, getViewPort(), new MyCancel(), scale);
|
1403 |
1426 |
// setGeometryDirty to false to avoid unnecessary repaints
|
1404 |
1427 |
layerprops.setDirtyGeometry(false);
|
... | ... | |
1413 |
1436 |
if (ds.getProviderName() == "OSG") {
|
1414 |
1437 |
try {
|
1415 |
1438 |
n = (Node) ds.invokeDynMethod("getNode", null);
|
|
1439 |
g.addChild(n);
|
1416 |
1440 |
} catch (DynMethodException e) {
|
1417 |
1441 |
// TODO Auto-generated catch block
|
1418 |
1442 |
e.printStackTrace();
|
|
1443 |
} catch (NodeException e) {
|
|
1444 |
// TODO Auto-generated catch block
|
|
1445 |
e.printStackTrace();
|
1419 |
1446 |
}
|
1420 |
1447 |
System.out.println("OSG Layer added");
|
1421 |
1448 |
// Change properties to OSG layer
|
... | ... | |
1423 |
1450 |
}
|
1424 |
1451 |
// Vectorial layers
|
1425 |
1452 |
else {
|
1426 |
|
n = this.buildVectors(sy);
|
|
1453 |
for(int i=0;i<symbolList.length;i++)
|
|
1454 |
{
|
|
1455 |
n=((SimpleMarker3DSymbol) symbolList[i]).getRenderNode();
|
|
1456 |
try {
|
|
1457 |
g.addChild(n);
|
|
1458 |
} catch (NodeException e) {
|
|
1459 |
// TODO Auto-generated catch block
|
|
1460 |
e.printStackTrace();
|
|
1461 |
}
|
|
1462 |
}
|
|
1463 |
|
|
1464 |
|
1427 |
1465 |
}
|
1428 |
|
ude.setVectorData(n);
|
1429 |
|
return ude;
|
1430 |
|
}
|
|
1466 |
ude.setVectorData(g);
|
|
1467 |
return ude;
|
|
1468 |
}
|
1431 |
1469 |
|
1432 |
|
private Node buildVectors(I3DSymbol symbol) {
|
1433 |
|
Node n = null;
|
|
1470 |
private ISymbol[] fillSymbolList(ILegend legend) {
|
|
1471 |
ISymbol[] symbolList = null;
|
|
1472 |
if (legend instanceof ISingleSymbolLegend) {
|
|
1473 |
symbolList = new ISymbol[1];
|
|
1474 |
I3DSymbol sy = (I3DSymbol) ((ISingleSymbolLegend) (legend))
|
|
1475 |
.getDefaultSymbol();
|
|
1476 |
symbolList[0] = sy;
|
|
1477 |
}
|
|
1478 |
if (legend instanceof AbstractIntervalLegend)
|
|
1479 |
symbolList = ((AbstractIntervalLegend) (legend)).getSymbols();
|
|
1480 |
if (legend instanceof VectorialUniqueValueLegend) {
|
|
1481 |
((VectorialUniqueValueLegend) (legend))
|
|
1482 |
.setDomain("project.document.view3d");
|
|
1483 |
symbolList = ((VectorialUniqueValueLegend) (legend)).getSymbols();
|
|
1484 |
}
|
|
1485 |
return symbolList;
|
1434 |
1486 |
|
1435 |
|
ISymbol3D sym = null;
|
1436 |
|
try {
|
1437 |
|
sym = Symbol3DFactory.getSymbol3D(symbol);
|
1438 |
|
} catch (NodeException e) {
|
1439 |
|
// TODO Auto-generated catch block
|
1440 |
|
e.printStackTrace();
|
|
1487 |
|
1441 |
1488 |
}
|
1442 |
|
// sm.setPointSize((float) sy.getSize());
|
1443 |
|
n = sym.buildSceneGraph(symbol.getGeometry());
|
1444 |
|
return n;
|
1445 |
|
}
|
1446 |
1489 |
|
|
1490 |
|
|
1491 |
// private Node buildVectors(I3DSymbol symbol) {
|
|
1492 |
// Node n = null;
|
|
1493 |
//
|
|
1494 |
// ISymbol3D sym = null;
|
|
1495 |
// try {
|
|
1496 |
// sym = Symbol3DFactory.getSymbol3D(symbol);
|
|
1497 |
// } catch (NodeException e) {
|
|
1498 |
// // TODO Auto-generated catch block
|
|
1499 |
// e.printStackTrace();
|
|
1500 |
// }
|
|
1501 |
// // sm.setPointSize((float) sy.getSize());
|
|
1502 |
// n = sym.buildSceneGraph(symbol.getGeometry());
|
|
1503 |
// return n;
|
|
1504 |
// }
|
|
1505 |
|
1447 |
1506 |
private UpdateDataEvent loadElevationData(FLayer layer, Envelope envelope,
|
1448 |
1507 |
RequestDataEvent rde) {
|
1449 |
1508 |
|
... | ... | |
1595 |
1654 |
|
1596 |
1655 |
}
|
1597 |
1656 |
|
1598 |
|
protected byte[] buildByteBuffer(UpdateDataEvent ude, Buffer rBuff,
|
|
1657 |
protected byte[] buildByteBuffer(UpdateDataEvent ude, Buffer rBuff,
|
1599 |
1658 |
Buffer transparencyBuffer, int numBands, int[] rgba) {
|
1600 |
1659 |
|
1601 |
1660 |
int cont = 0;
|
... | ... | |
1635 |
1694 |
return data;
|
1636 |
1695 |
}
|
1637 |
1696 |
|
|
1697 |
<<<<<<< .mine
|
|
1698 |
protected short[] buildShortBuffer(UpdateDataEvent ude, Buffer rBuff,
|
|
1699 |
=======
|
1638 |
1700 |
protected byte[] buildByteBufferPalette(UpdateDataEvent ude, Buffer rBuff,
|
1639 |
1701 |
ColorTable colorTable, Buffer transparencyBuffer) {
|
1640 |
1702 |
|
... | ... | |
1665 |
1727 |
}
|
1666 |
1728 |
|
1667 |
1729 |
protected short[] buildShortBuffer(UpdateDataEvent ude, Buffer rBuff,
|
|
1730 |
>>>>>>> .r349
|
1668 |
1731 |
Buffer transparencyBuffer, int numBands, int[] rgba) {
|
1669 |
1732 |
int cont = 0;
|
1670 |
1733 |
int colorBands = numBands;
|
... | ... | |
1882 |
1945 |
}
|
1883 |
1946 |
}
|
1884 |
1947 |
|
1885 |
|
private BufferedImage getLayerDrawImage(FLayer layer, Envelope envelope) {
|
|
1948 |
private BufferedImage getLayerDrawImage(FLayer layer, Envelope envelope) {
|
1886 |
1949 |
|
1887 |
|
int size = 256;
|
1888 |
|
BufferedImage image = new BufferedImage(size, size,
|
1889 |
|
BufferedImage.TYPE_4BYTE_ABGR);
|
|
1950 |
int size = 256;
|
|
1951 |
BufferedImage image = new BufferedImage(size, size,
|
|
1952 |
BufferedImage.TYPE_4BYTE_ABGR);
|
1890 |
1953 |
|
1891 |
|
ViewPort vp = new ViewPort(_viewProjection);
|
1892 |
|
vp.setEnvelope(envelope); // the real extent of the tile
|
|
1954 |
ViewPort vp = new ViewPort(_viewProjection);
|
|
1955 |
vp.setEnvelope(envelope); // the real extent of the tile
|
1893 |
1956 |
|
1894 |
|
vp.setAdjustable(false);
|
1895 |
|
vp.setImageSize(new Dimension(size, size));
|
1896 |
|
vp.setDist1pixel(0.000000001);
|
|
1957 |
vp.setAdjustable(false);
|
|
1958 |
vp.setImageSize(new Dimension(size, size));
|
|
1959 |
vp.setDist1pixel(0.000000001);
|
1897 |
1960 |
|
1898 |
|
Graphics2D graphics = image.createGraphics();
|
1899 |
|
Color backgColor = new Color(255, 255, 255, 0); // transparent
|
1900 |
|
// background
|
1901 |
|
graphics.setColor(backgColor);
|
1902 |
|
graphics.fillRect(0, 0, size, size);
|
|
1961 |
Graphics2D graphics = image.createGraphics();
|
|
1962 |
Color backgColor = new Color(255, 255, 255, 0); // transparent
|
|
1963 |
// background
|
|
1964 |
graphics.setColor(backgColor);
|
|
1965 |
graphics.fillRect(0, 0, size, size);
|
1903 |
1966 |
|
1904 |
|
double scale = 0.5 * (layer.getMaxScale() + layer.getMinScale());
|
|
1967 |
double scale = 0.5 * (layer.getMaxScale() + layer.getMinScale());
|
1905 |
1968 |
|
1906 |
|
try {
|
1907 |
|
layer.draw(image, graphics, vp, new MyCancel(), scale);
|
|
1969 |
try {
|
|
1970 |
layer.draw(image, graphics, vp, new MyCancel(), scale);
|
1908 |
1971 |
|
1909 |
|
} catch (Exception e) {
|
1910 |
|
return null;
|
|
1972 |
} catch (Exception e) {
|
|
1973 |
return null;
|
|
1974 |
}
|
|
1975 |
|
|
1976 |
return image;
|
|
1977 |
|
1911 |
1978 |
}
|
1912 |
1979 |
|
1913 |
|
return image;
|
|
1980 |
public void nameChanged(LayerEvent e) {
|
|
1981 |
System.out.println("Name change");
|
1914 |
1982 |
|
1915 |
|
}
|
|
1983 |
}
|
1916 |
1984 |
|
1917 |
|
public void nameChanged(LayerEvent e) {
|
1918 |
|
System.out.println("Name change");
|
|
1985 |
public void refreshLayerInTerrain(FLayer layer, Layer3DProps props,
|
|
1986 |
boolean bRemoveCache) {
|
1919 |
1987 |
|
1920 |
|
}
|
|
1988 |
System.out.println("Refresh");
|
|
1989 |
if (props == null)
|
|
1990 |
return;
|
1921 |
1991 |
|
1922 |
|
public void refreshLayerInTerrain(FLayer layer, Layer3DProps props,
|
1923 |
|
boolean bRemoveCache) {
|
|
1992 |
if (_terrain == null)
|
|
1993 |
return; // view not opened yet
|
1924 |
1994 |
|
1925 |
|
System.out.println("Refresh");
|
1926 |
|
if (props == null)
|
1927 |
|
return;
|
|
1995 |
// clear cache
|
1928 |
1996 |
|
1929 |
|
if (_terrain == null)
|
1930 |
|
return; // view not opened yet
|
|
1997 |
// refresh layer in terrain
|
|
1998 |
int type = props.getType();
|
|
1999 |
if ((type == Layer3DProps.layer3DImage)
|
|
2000 |
|| (type == Layer3DProps.layer3DElevation)
|
|
2001 |
|| (type == Layer3DProps.layer3DVectorMR)) {
|
1931 |
2002 |
|
1932 |
|
// clear cache
|
|
2003 |
try {
|
|
2004 |
_terrainLayerManager.invalidateLayer(props.getTerrainLayer());
|
|
2005 |
} catch (LayerManagementException e) {
|
|
2006 |
// TODO Auto-generated catch block
|
|
2007 |
e.printStackTrace();
|
|
2008 |
}
|
|
2009 |
} else if (type == Layer3DProps.layer3DVector) {
|
|
2010 |
// ILegend legend = ((FLyrVect) layer).getLegend();
|
|
2011 |
//
|
|
2012 |
// try {
|
|
2013 |
// RequestDataEvent rde = new RequestDataEvent();
|
|
2014 |
// loadVectorData(layer, layer.getFullEnvelope(),
|
|
2015 |
// new RequestDataEvent(), (I3DSymbol) legend.getDefaultSymbol());
|
|
2016 |
// } catch (ReadException e) {
|
|
2017 |
// // TODO Auto-generated catch block
|
|
2018 |
// e.printStackTrace();
|
|
2019 |
// }
|
1933 |
2020 |
|
1934 |
|
// refresh layer in terrain
|
1935 |
|
int type = props.getType();
|
1936 |
|
if ((type == Layer3DProps.layer3DImage)
|
1937 |
|
|| (type == Layer3DProps.layer3DElevation)
|
1938 |
|
|| (type == Layer3DProps.layer3DVectorMR)) {
|
1939 |
|
|
1940 |
|
try {
|
1941 |
|
_terrainLayerManager.invalidateLayer(props.getTerrainLayer());
|
1942 |
|
} catch (LayerManagementException e) {
|
1943 |
|
// TODO Auto-generated catch block
|
1944 |
|
e.printStackTrace();
|
1945 |
2021 |
}
|
1946 |
|
} else if (type == Layer3DProps.layer3DVector) {
|
1947 |
|
// ILegend legend = ((FLyrVect) layer).getLegend();
|
1948 |
|
//
|
1949 |
|
// try {
|
1950 |
|
// RequestDataEvent rde = new RequestDataEvent();
|
1951 |
|
// loadVectorData(layer, layer.getFullEnvelope(),
|
1952 |
|
// new RequestDataEvent(), (I3DSymbol) legend.getDefaultSymbol());
|
1953 |
|
// } catch (ReadException e) {
|
1954 |
|
// // TODO Auto-generated catch block
|
1955 |
|
// e.printStackTrace();
|
1956 |
|
// }
|
1957 |
2022 |
|
1958 |
2023 |
}
|
1959 |
2024 |
|
1960 |
|
}
|
1961 |
|
|
1962 |
|
public boolean removeCache(File path) {
|
1963 |
|
if (path.exists()) {
|
1964 |
|
File[] files = path.listFiles();
|
1965 |
|
for (int i = 0; i < files.length; i++) {
|
1966 |
|
if (files[i].isDirectory()) {
|
1967 |
|
removeCache(files[i]);
|
1968 |
|
} else {
|
1969 |
|
files[i].delete();
|
|
2025 |
public boolean removeCache(File path) {
|
|
2026 |
if (path.exists()) {
|
|
2027 |
File[] files = path.listFiles();
|
|
2028 |
for (int i = 0; i < files.length; i++) {
|
|
2029 |
if (files[i].isDirectory()) {
|
|
2030 |
removeCache(files[i]);
|
|
2031 |
} else {
|
|
2032 |
files[i].delete();
|
|
2033 |
}
|
1970 |
2034 |
}
|
1971 |
2035 |
}
|
|
2036 |
return (path.delete());
|
1972 |
2037 |
}
|
1973 |
|
return (path.delete());
|
1974 |
|
}
|
1975 |
2038 |
|
1976 |
|
public void removeLayerToTerrain(FLayer layer) {
|
|
2039 |
public void removeLayerToTerrain(FLayer layer) {
|
1977 |
2040 |
|
1978 |
|
Layer terrainLayer = _terrainFLayerMap.get(layer);
|
1979 |
|
if (terrainLayer != null) {
|
|
2041 |
Layer terrainLayer = _terrainFLayerMap.get(layer);
|
|
2042 |
if (terrainLayer != null) {
|
1980 |
2043 |
|
1981 |
|
_terrainLayerMap.remove(terrainLayer.getLayerID());
|
1982 |
|
_terrainFLayerMap.remove(layer);
|
|
2044 |
_terrainLayerMap.remove(terrainLayer.getLayerID());
|
|
2045 |
_terrainFLayerMap.remove(layer);
|
1983 |
2046 |
|
1984 |
|
try {
|
1985 |
|
_terrainLayerManager.removeLayer(terrainLayer);
|
1986 |
|
} catch (LayerManagementException e) {
|
1987 |
|
// TODO Auto-generated catch block
|
1988 |
|
e.printStackTrace();
|
1989 |
|
}
|
1990 |
|
}
|
|
2047 |
try {
|
|
2048 |
_terrainLayerManager.removeLayer(terrainLayer);
|
|
2049 |
} catch (LayerManagementException e) {
|
|
2050 |
// TODO Auto-generated catch block
|
|
2051 |
e.printStackTrace();
|
|
2052 |
}
|
|
2053 |
}
|
1991 |
2054 |
|
1992 |
|
}
|
|
2055 |
}
|
|
2056 |
public void selectionChanged(SelectionEvent e) {
|
|
2057 |
// TODO Auto-generated method stub
|
|
2058 |
// SingleLayerIterator lyrIterator = new SingleLayerIterator(layers);
|
|
2059 |
// while (lyrIterator.hasNext()) {
|
|
2060 |
// FLayer layer = lyrIterator.next();
|
|
2061 |
// Layer3DProps props3D = getLayer3DProps(layer);
|
|
2062 |
// if (props3D.getType() != Layer3DProps.layer3DOSG) {
|
|
2063 |
// if (layer.getClass().equals(FLyrVect.class)) {
|
|
2064 |
// FLyrVect lyr = (FLyrVect) layer;
|
|
2065 |
//
|
|
2066 |
// FBitSet selection = null;
|
|
2067 |
// try {
|
|
2068 |
// selection = lyr.getRecordset().getSelectionSupport()
|
|
2069 |
// .getSelection();
|
|
2070 |
// } catch (ReadDriverException e1) {
|
|
2071 |
// // TODO Auto-generated catch block
|
|
2072 |
// e1.printStackTrace();
|
|
2073 |
// }
|
|
2074 |
//
|
|
2075 |
// if ((selection.cardinality() == 0)
|
|
2076 |
// || (!(selection.isEmpty()))) {
|
|
2077 |
// Layer3DProps props = Layer3DProps
|
|
2078 |
// .getLayer3DProps(layer);
|
|
2079 |
// refreshLayerInTerrain(props, true);
|
|
2080 |
// if (layer instanceof FLyrVect) {
|
|
2081 |
// FLyrVect fvect = (FLyrVect) layer;
|
|
2082 |
// props.drawVersion = fvect.getDrawVersion();
|
|
2083 |
// }
|
|
2084 |
// }
|
|
2085 |
// }
|
|
2086 |
// }
|
|
2087 |
// }
|
1993 |
2088 |
|
1994 |
|
public void selectionChanged(SelectionEvent e) {
|
1995 |
|
// TODO Auto-generated method stub
|
1996 |
|
// SingleLayerIterator lyrIterator = new SingleLayerIterator(layers);
|
1997 |
|
// while (lyrIterator.hasNext()) {
|
1998 |
|
// FLayer layer = lyrIterator.next();
|
1999 |
|
// Layer3DProps props3D = getLayer3DProps(layer);
|
2000 |
|
// if (props3D.getType() != Layer3DProps.layer3DOSG) {
|
2001 |
|
// if (layer.getClass().equals(FLyrVect.class)) {
|
2002 |
|
// FLyrVect lyr = (FLyrVect) layer;
|
2003 |
|
//
|
2004 |
|
// FBitSet selection = null;
|
2005 |
|
// try {
|
2006 |
|
// selection = lyr.getRecordset().getSelectionSupport()
|
2007 |
|
// .getSelection();
|
2008 |
|
// } catch (ReadDriverException e1) {
|
2009 |
|
// // TODO Auto-generated catch block
|
2010 |
|
// e1.printStackTrace();
|
2011 |
|
// }
|
2012 |
|
//
|
2013 |
|
// if ((selection.cardinality() == 0)
|
2014 |
|
// || (!(selection.isEmpty()))) {
|
2015 |
|
// Layer3DProps props = Layer3DProps
|
2016 |
|
// .getLayer3DProps(layer);
|
2017 |
|
// refreshLayerInTerrain(props, true);
|
2018 |
|
// if (layer instanceof FLyrVect) {
|
2019 |
|
// FLyrVect fvect = (FLyrVect) layer;
|
2020 |
|
// props.drawVersion = fvect.getDrawVersion();
|
2021 |
|
// }
|
2022 |
|
// }
|
2023 |
|
// }
|
2024 |
|
// }
|
2025 |
|
// }
|
|
2089 |
}
|
|
2090 |
|
|
2091 |
public void setDataManager(JavaDataDriver manager) {
|
|
2092 |
_terrainDataManager = manager;
|
|
2093 |
_terrainDataManager.setDataLoader(this);
|
2026 |
2094 |
|
2027 |
|
}
|
|
2095 |
}
|
2028 |
2096 |
|
2029 |
|
public void setDataManager(JavaDataDriver manager) {
|
2030 |
|
_terrainDataManager = manager;
|
2031 |
|
_terrainDataManager.setDataLoader(this);
|
|
2097 |
public void setLayerManager(LayerManager manager) {
|
|
2098 |
_terrainLayerManager = manager;
|
2032 |
2099 |
|
2033 |
|
}
|
|
2100 |
}
|
2034 |
2101 |
|
2035 |
|
public void setLayerManager(LayerManager manager) {
|
2036 |
|
_terrainLayerManager = manager;
|
|
2102 |
public void setLoading(boolean bLoading) {
|
|
2103 |
_bLoading = bLoading;
|
2037 |
2104 |
|
2038 |
|
}
|
|
2105 |
}
|
2039 |
2106 |
|
2040 |
|
public void setLoading(boolean bLoading) {
|
2041 |
|
_bLoading = bLoading;
|
|
2107 |
public void setRenewCanvasOff(boolean renewCanvasOff) {
|
|
2108 |
_renewCanvasOff = renewCanvasOff;
|
2042 |
2109 |
|
2043 |
|
}
|
|
2110 |
}
|
2044 |
2111 |
|
2045 |
|
public void setRenewCanvasOff(boolean renewCanvasOff) {
|
2046 |
|
_renewCanvasOff = renewCanvasOff;
|
|
2112 |
public void setTerrain(Terrain terrain) {
|
|
2113 |
if (_terrain == terrain)
|
|
2114 |
return;
|
2047 |
2115 |
|
2048 |
|
}
|
|
2116 |
_terrain = terrain;
|
2049 |
2117 |
|
2050 |
|
public void setTerrain(Terrain terrain) {
|
2051 |
|
if (_terrain == terrain)
|
2052 |
|
return;
|
|
2118 |
// add layers to terrain necessary when we are loading
|
|
2119 |
addCurrentLayers();
|
2053 |
2120 |
|
2054 |
|
_terrain = terrain;
|
|
2121 |
}
|
2055 |
2122 |
|
2056 |
|
// add layers to terrain necessary when we are loading
|
2057 |
|
addCurrentLayers();
|
|
2123 |
public void setVerticalExaggeration(float verticalExaggeration) {
|
|
2124 |
_verticalExaggeration = verticalExaggeration;
|
2058 |
2125 |
|
2059 |
|
}
|
|
2126 |
}
|
2060 |
2127 |
|
2061 |
|
public void setVerticalExaggeration(float verticalExaggeration) {
|
2062 |
|
_verticalExaggeration = verticalExaggeration;
|
|
2128 |
public void setViewProjection(IProjection projection) {
|
|
2129 |
_viewProjection = projection;
|
2063 |
2130 |
|
2064 |
|
}
|
|
2131 |
}
|
2065 |
2132 |
|
2066 |
|
public void setViewProjection(IProjection projection) {
|
2067 |
|
_viewProjection = projection;
|
|
2133 |
public void setViewer(IViewerContainer canvas) {
|
|
2134 |
_canvas3d = canvas;
|
|
2135 |
_terrainViewer = (TerrainViewer) _canvas3d.getOSGViewer();
|
2068 |
2136 |
|
2069 |
|
}
|
|
2137 |
}
|
2070 |
2138 |
|
2071 |
|
public void setViewer(IViewerContainer canvas) {
|
2072 |
|
_canvas3d = canvas;
|
2073 |
|
_terrainViewer = (TerrainViewer) _canvas3d.getOSGViewer();
|
|
2139 |
public void visibilityChanged(LayerEvent e) {
|
|
2140 |
FLayer lyr = e.getSource();
|
2074 |
2141 |
|
2075 |
|
}
|
|
2142 |
// if (props3D.getType() == Layer3DProps.layer3DVector) {
|
|
2143 |
// refreshLayerVectorsVisibility(lyr);
|
|
2144 |
// } else if (props3D.getType() == Layer3DProps.layer3DOSG) {
|
|
2145 |
// refreshLayer3DOSGVisibility(lyr);
|
|
2146 |
// } else {
|
|
2147 |
refreshLayerVisibility(lyr);
|
|
2148 |
// }
|
|
2149 |
visibilityChange = true;
|
2076 |
2150 |
|
2077 |
|
public void visibilityChanged(LayerEvent e) {
|
2078 |
|
FLayer lyr = e.getSource();
|
|
2151 |
}
|
2079 |
2152 |
|
2080 |
|
// if (props3D.getType() == Layer3DProps.layer3DVector) {
|
2081 |
|
// refreshLayerVectorsVisibility(lyr);
|
2082 |
|
// } else if (props3D.getType() == Layer3DProps.layer3DOSG) {
|
2083 |
|
// refreshLayer3DOSGVisibility(lyr);
|
2084 |
|
// } else {
|
2085 |
|
refreshLayerVisibility(lyr);
|
2086 |
|
// }
|
2087 |
|
visibilityChange = true;
|
|
2153 |
private void refreshLayerVisibility(FLayer layer) {
|
2088 |
2154 |
|
2089 |
|
}
|
|
2155 |
Layer terrainLayer = _terrainFLayerMap.get(layer);
|
|
2156 |
terrainLayer.setEnabled(layer.isVisible());
|
|
2157 |
// _terrainLayerManager.updateLayers();
|
2090 |
2158 |
|
2091 |
|
private void refreshLayerVisibility(FLayer layer) {
|
|
2159 |
}
|
2092 |
2160 |
|
2093 |
|
Layer terrainLayer = _terrainFLayerMap.get(layer);
|
2094 |
|
terrainLayer.setEnabled(layer.isVisible());
|
2095 |
|
// _terrainLayerManager.updateLayers();
|
|
2161 |
public void zoomToEnvelope(Envelope geoEnvelope) {
|
|
2162 |
if (geoEnvelope == null)
|
|
2163 |
return;
|
|
2164 |
if ((geoEnvelope.getLength(0) == 0) || (geoEnvelope.getLength(1) == 0))
|
|
2165 |
return;
|
2096 |
2166 |
|
2097 |
|
}
|
|
2167 |
double maxHeight = 0.0;
|
2098 |
2168 |
|
2099 |
|
public void zoomToEnvelope(Envelope geoEnvelope) {
|
2100 |
|
if (geoEnvelope == null)
|
2101 |
|
return;
|
2102 |
|
if ((geoEnvelope.getLength(0) == 0) || (geoEnvelope.getLength(1) == 0))
|
2103 |
|
return;
|
2104 |
2169 |
|
2105 |
|
double maxHeight = 0.0;
|
2106 |
|
|
2107 |
2170 |
// Getting envelope positions
|
2108 |
2171 |
double minLat = geoEnvelope.getMinimum(0);
|
2109 |
2172 |
double maxLat = geoEnvelope.getMaximum(0);
|
... | ... | |
2277 |
2340 |
return _layersHandlerMap.get(layer);
|
2278 |
2341 |
|
2279 |
2342 |
}
|
2280 |
|
}
|
|
2343 |
}
|