Revision 31819
branches/gvSIG_19_ext3D_osgVP_2_2_0/libraries/lib3DMap/src/org/gvsig/gvsig3d/gui/FeatureFactory.java | ||
---|---|---|
963 | 963 |
int emodel=1; |
964 | 964 |
Symbol3DVisitor sv = new Symbol3DVisitor(); |
965 | 965 |
AttrInTableLabelingStrategy strategy; |
966 |
int fontsize = 0; |
|
966 |
float fontsize = 0; |
|
967 |
String fontname = null; |
|
967 | 968 |
// Creating a group node |
968 | 969 |
Group p = new Group(); |
969 | 970 |
|
... | ... | |
992 | 993 |
// if (label3D instanceof SimpleLabel3D) { |
993 | 994 |
strategy = ((SimpleLabel3D) label3D).getStrategy(); |
994 | 995 |
co = strategy.getFixedColor(); |
995 |
fontsize = strategy.getFont().getSize();
|
|
996 |
// } |
|
996 |
fontsize = (float) strategy.getFixedSize();
|
|
997 |
// }
|
|
997 | 998 |
float r, g, b, a; |
998 | 999 |
r = ((float) co.getRed()) / 255.0f; |
999 | 1000 |
g = ((float) co.getGreen()) / 255.0f; |
... | ... | |
1030 | 1031 |
if (total<4000){ |
1031 | 1032 |
ftext.setModel(emodel); |
1032 | 1033 |
ftext.setDrawMode(TextBase.DrawModeMask.TEXT); |
1033 |
ftext.setCharacterSizeMode(TextBase.CharacterSizeMode.OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT);
|
|
1034 |
ftext.setCharacterSizeMode(TextBase.CharacterSizeMode.SCREEN_COORDS);
|
|
1034 | 1035 |
ftext.setBackdropColor(new Vec4(1,1,1,1)); |
1035 |
ftext.setFontSize(300000f);
|
|
1036 |
ftext.setFontSize(fontsize*6);
|
|
1036 | 1037 |
ftext.setBackdropType(Text.BackdropType.NONE); |
1037 | 1038 |
ftext.setFadeSpeed(0.3f); |
1038 | 1039 |
ftext.setAutoRotateToScreen(true); |
... | ... | |
1040 | 1041 |
}else{ |
1041 | 1042 |
text.setModel(emodel); |
1042 | 1043 |
text.setDrawMode(TextBase.DrawModeMask.TEXT); |
1043 |
text.setCharacterSizeMode(TextBase.CharacterSizeMode.OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT);
|
|
1044 |
text.setCharacterSizeMode(TextBase.CharacterSizeMode.SCREEN_COORDS);
|
|
1044 | 1045 |
text.setBackdropColor(new Vec4(1,1,1,1)); |
1045 |
text.setFontSize(300000f);
|
|
1046 |
text.setFontSize(fontsize*6f);
|
|
1046 | 1047 |
text.setBackdropType(Text.BackdropType.NONE); |
1047 | 1048 |
text.setAutoRotateToScreen(true); |
1048 | 1049 |
text.traverse(sv); |
1050 |
|
|
1049 | 1051 |
} |
1050 | 1052 |
|
1051 | 1053 |
Group root= new Group(); |
branches/gvSIG_19_ext3D_osgVP_2_2_0/libraries/lib3DMap/src/org/gvsig/gvsig3d/map3d/MapContext3D.java | ||
---|---|---|
452 | 452 |
if (!_bListenToLegend) |
453 | 453 |
return; |
454 | 454 |
if ((e == null) && (!visibilityChange)) { |
455 |
|
|
456 | 455 |
// find layer whose legend changed |
457 | 456 |
FLayer found = null; |
458 | 457 |
SingleLayerIterator lyrIterator = new SingleLayerIterator(layers); |
... | ... | |
530 | 529 |
if (cacheService != null) { |
531 | 530 |
// use VectorCacheService to add features to terrain |
532 | 531 |
cacheService.refreshFeaturesToTerrain(lyr.isVisible()); |
532 |
props3D.drawVersion = lyr.getDrawVersion(); |
|
533 | 533 |
} |
534 | 534 |
|
535 | 535 |
} |
branches/gvSIG_19_ext3D_osgVP_2_2_0/libraries/lib3DMap/src/org/gvsig/gvsig3d/cacheservices/VectorCacheService.java | ||
---|---|---|
147 | 147 |
try { |
148 | 148 |
newDraw(); |
149 | 149 |
getNames(); |
150 |
//_canvas3D.repaint(); |
|
150 |
// _canvas3D.repaint();
|
|
151 | 151 |
} catch (Exception e) { |
152 | 152 |
e.printStackTrace(); |
153 | 153 |
} |
... | ... | |
179 | 179 |
|
180 | 180 |
try { |
181 | 181 |
_terrainViewer.removeFeature(_layerNode); |
182 |
_layerNode = null; |
|
183 |
|
|
182 | 184 |
} catch (NodeException e) { |
183 | 185 |
logger.error("Command: " |
184 | 186 |
+ "Error removing new child node to the special node.", e); |
... | ... | |
198 | 200 |
this._layerNode.addChild(FeatureFactory.insertLabels( |
199 | 201 |
this._labels, this._terrain, props3D.getHeigth())); |
200 | 202 |
|
201 |
|
|
202 | 203 |
} catch (NodeException e) { |
203 | 204 |
logger.error("Command: " + "Error adding new child node.", e); |
204 | 205 |
} |
... | ... | |
293 | 294 |
|
294 | 295 |
public void newDraw() { |
295 | 296 |
|
296 |
|
|
297 |
Node root = new Group(); |
|
297 |
Node root; |
|
298 | 298 |
|
299 | 299 |
System.err.println("new Draw"); |
300 | 300 |
FLyrVect fLyrVect = (FLyrVect) _layer; |
... | ... | |
332 | 332 |
String[] usetFields = labelStrategy.getUsedFields(); |
333 | 333 |
} |
334 | 334 |
ReadableVectorial source = fLyrVect.getSource(); |
335 |
|
|
336 | 335 |
root = Symbology3DFactory.getNodeSymbol(_layer, source, fieldList |
337 | 336 |
.toArray(new String[fieldList.size()]), _viewProj, legend, |
338 | 337 |
_terrain); |
339 | 338 |
|
340 | 339 |
try { |
340 |
|
|
341 | 341 |
this._layerNode.addChild(root); |
342 | 342 |
} catch (NodeException e) { |
343 | 343 |
// TODO Auto-generated catch block |
branches/gvSIG_19_ext3D_osgVP_2_2_0/libraries/lib3DMap/src/org/gvsig/gvsig3d/simbology3D/Symbology3DFactory.java | ||
---|---|---|
66 | 66 |
import com.iver.ai2.gvsig3d.legend.symbols.Object3DMarkerSymbol; |
67 | 67 |
import com.iver.ai2.gvsig3d.map3d.layers.Layer3DProps; |
68 | 68 |
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException; |
69 |
import com.iver.cit.gvsig.fmap.MapContext; |
|
69 | 70 |
import com.iver.cit.gvsig.fmap.core.FShape; |
70 | 71 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
71 | 72 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
... | ... | |
103 | 104 |
static IVectorLegend _legend; |
104 | 105 |
static String _fields[]; |
105 | 106 |
static FLayer _layer; |
106 |
private static Logger logger = Logger.getLogger(Hud.class.getName()); |
|
107 |
private static Logger logger = Logger.getLogger(Symbology3DFactory.class |
|
108 |
.getName()); |
|
107 | 109 |
|
108 | 110 |
public Symbology3DFactory(double ra, Terrain m_planet) { |
109 | 111 |
// super(); |
... | ... | |
163 | 165 |
co = strategy.getFixedColor(); |
164 | 166 |
fontsize = strategy.getFont().getSize(); |
165 | 167 |
// } |
168 |
System.out.println("fontsize"); |
|
166 | 169 |
float r, g, b, a; |
167 | 170 |
r = ((float) co.getRed()) / 255.0f; |
168 | 171 |
g = ((float) co.getGreen()) / 255.0f; |
... | ... | |
195 | 198 |
text.addTextPoint(textposition, textColor, label); |
196 | 199 |
} |
197 | 200 |
} |
201 |
// hardcoded si el valor es menor que 4000 uso fadetext, sino uso text. |
|
198 | 202 |
if (total < 4000) { |
199 | 203 |
ftext.setModel(emodel); |
200 | 204 |
ftext.setDrawMode(TextBase.DrawModeMask.TEXT); |
201 | 205 |
ftext |
202 |
.setCharacterSizeMode(TextBase.CharacterSizeMode.OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT);
|
|
206 |
.setCharacterSizeMode(TextBase.CharacterSizeMode.SCREEN_COORDS);
|
|
203 | 207 |
ftext.setBackdropColor(new Vec4(1, 1, 1, 1)); |
204 |
ftext.setFontSize(300000f); |
|
208 |
System.err.println("tamaƱo del texto" + fontsize); |
|
209 |
ftext.setFontSize(fontsize * 100000f); |
|
205 | 210 |
ftext.setBackdropType(Text.BackdropType.NONE); |
206 | 211 |
ftext.setFadeSpeed(0.3f); |
207 | 212 |
ftext.setAutoRotateToScreen(true); |
... | ... | |
213 | 218 |
text |
214 | 219 |
.setCharacterSizeMode(TextBase.CharacterSizeMode.OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT); |
215 | 220 |
text.setBackdropColor(new Vec4(1, 1, 1, 1)); |
216 |
text.setFontSize(300000f);
|
|
221 |
text.setFontSize(fontsize * 100000f);
|
|
217 | 222 |
text.setBackdropType(Text.BackdropType.NONE); |
218 | 223 |
text.setAutoRotateToScreen(true); |
219 | 224 |
text.traverse(sv); |
... | ... | |
251 | 256 |
} |
252 | 257 |
|
253 | 258 |
private static Node getPointSymbolNode(ReadableVectorial source) { |
259 |
Symbol3DVisitor sv = new Symbol3DVisitor(); |
|
254 | 260 |
Group root = new Group(); |
255 | 261 |
root.getOrCreateStateSet().setEnabledBlending(true); |
256 | 262 |
IFeatureIterator it = null; |
... | ... | |
270 | 276 |
cs = getPointSymbol(sym); |
271 | 277 |
map.put(sym, cs); |
272 | 278 |
} |
279 |
|
|
273 | 280 |
IGeometry geom = feat.getGeometry(); |
274 | 281 |
int selectionIndex = -1; |
275 | 282 |
if (source instanceof ISpatialDB) { |
... | ... | |
292 | 299 |
if (sym.getClass().equals(BaseExtrusionSymbol.class)) { |
293 | 300 |
pointSymbol = (SimpleFillSymbol) sym; |
294 | 301 |
color = ((SimpleFillSymbol) pointSymbol).getFillColor(); |
295 |
|
|
302 |
|
|
296 | 303 |
} else { |
297 | 304 |
pointSymbol = (AbstractMarkerSymbol) sym; |
298 | 305 |
color = ((AbstractMarkerSymbol) pointSymbol).getColor(); |
... | ... | |
318 | 325 |
.getSize()); |
319 | 326 |
} |
320 | 327 |
|
321 |
cs.setSizeMetric(PointSymbol3D.SizeMetric.PIXELS); |
|
322 |
|
|
323 | 328 |
} |
324 | 329 |
|
325 | 330 |
} catch (ReadDriverException e) { |
... | ... | |
327 | 332 |
e.printStackTrace(); |
328 | 333 |
} |
329 | 334 |
Iterator<PointSymbol3D> pointsymbolsIt = map.values().iterator(); |
335 |
|
|
330 | 336 |
while (pointsymbolsIt.hasNext()) { |
331 |
Symbol3DVisitor sv = new Symbol3DVisitor(); |
|
332 | 337 |
|
333 | 338 |
PointSymbol3D cs = pointsymbolsIt.next(); |
334 | 339 |
cs.traverse(sv); |
... | ... | |
380 | 385 |
ps3d = new PolylineExtrusionSymbol(); |
381 | 386 |
lineSymbol = (SimpleFillSymbol) sym; |
382 | 387 |
color = ((SimpleFillSymbol) lineSymbol).getFillColor(); |
383 |
|
|
388 |
|
|
384 | 389 |
} else { |
385 | 390 |
ps3d = new PolylineSymbol3D(); |
386 | 391 |
lineSymbol = (ILineSymbol) sym; |
... | ... | |
397 | 402 |
Line3DFeature l3D = new Line3DFeature(sym, geom); |
398 | 403 |
l3D.setTerrain(_planet); |
399 | 404 |
l3D.setHeigth(props3D.getHeigth()); |
400 |
|
|
405 |
|
|
401 | 406 |
if (sym.getClass().equals(BaseExtrusionSymbol.class)) { |
402 | 407 |
|
403 | 408 |
for (int i = 0; i < l3D.getPolyline3D().size(); i++) |
... | ... | |
536 | 541 |
ps = new PointExtrusionSymbol(); |
537 | 542 |
} else if (sym.getClass().equals(SimpleMarkerSymbol.class)) { |
538 | 543 |
ps = new CircleSymbol(); |
544 |
ps.setSizeMetric(PointSymbol3D.SizeMetric.PIXELS); |
|
545 |
if(((SimpleMarkerSymbol) sym)!= null) |
|
546 |
if (((SimpleMarkerSymbol) sym).getUnit() == -1) |
|
547 |
ps.setSizeMetric(PointSymbol3D.SizeMetric.PIXELS); |
|
548 |
else |
|
549 |
ps.setSizeMetric(PointSymbol3D.SizeMetric.METERS); |
|
550 |
|
|
551 |
|
|
539 | 552 |
} else if (sym.getClass().equals(PictureMarkerSymbol.class)) { |
553 |
|
|
540 | 554 |
ps = new QuadSymbol(); |
555 |
if (((PictureMarkerSymbol) sym).getUnit() == -1) |
|
556 |
ps.setSizeMetric(PointSymbol3D.SizeMetric.PIXELS); |
|
557 |
else |
|
558 |
ps.setSizeMetric(PointSymbol3D.SizeMetric.METERS); |
|
541 | 559 |
try { |
542 | 560 |
((QuadSymbol) ps).setTexture(new URL( |
543 | 561 |
((PictureMarkerSymbol) sym).getImagePath()).getPath()); |
... | ... | |
549 | 567 |
} else if (sym.getClass().equals(CharacterMarkerSymbol.class)) { |
550 | 568 |
// lo mismo que quad pero con textura mirar CharacterMarkerSymbol |
551 | 569 |
ps = new QuadSymbol(); |
552 |
|
|
553 |
|
|
570 |
|
|
554 | 571 |
String raster = rasterizeSymbol(((CharacterMarkerSymbol) sym)); |
555 |
|
|
556 |
// try { |
|
557 |
//System.err.println("vival las URls"+ new URL(rasterizeSymbol(((CharacterMarkerSymbol) sym))).getPath()); |
|
558 |
((QuadSymbol) ps).setTexture("./SymbolTmp.png"); |
|
559 |
// } catch (MalformedURLException e) { |
|
560 |
// // TODO Auto-generated catch block |
|
561 |
// e.printStackTrace(); |
|
562 |
// } |
|
563 | 572 |
|
573 |
// try { |
|
574 |
// System.err.println("vival las URls"+ new |
|
575 |
// URL(rasterizeSymbol(((CharacterMarkerSymbol) sym))).getPath()); |
|
576 |
((QuadSymbol) ps).setTexture("./SymbolTmp.png"); |
|
577 |
// } catch (MalformedURLException e) { |
|
578 |
// // TODO Auto-generated catch block |
|
579 |
// e.printStackTrace(); |
|
580 |
// } |
|
581 |
|
|
564 | 582 |
} else if (sym.getClass().equals(MultiLayerMarkerSymbol.class)) { |
565 | 583 |
// lo mismo que quad pero con textura mirar MultiLayerMarkerSymbol |
566 | 584 |
ps = new QuadSymbol(); |
567 | 585 |
} else if (sym.getClass().equals(Object3DMarkerSymbol.class)) { |
568 | 586 |
ps = new NodeSymbol3D(); |
569 |
|
|
587 |
if (((Object3DMarkerSymbol) sym).getUnit() == -1) |
|
588 |
ps.setSizeMetric(PointSymbol3D.SizeMetric.PIXELS); |
|
589 |
else |
|
590 |
ps.setSizeMetric(PointSymbol3D.SizeMetric.METERS); |
|
570 | 591 |
Node object3D = null; |
571 | 592 |
try { |
572 |
((NodeSymbol3D) ps).setScale(((Object3DMarkerSymbol) sym).getScale()); |
|
573 |
|
|
593 |
((NodeSymbol3D) ps).setScale(((Object3DMarkerSymbol) sym) |
|
594 |
.getScale()); |
|
595 |
|
|
574 | 596 |
object3D = osgDB.readNodeFile(((Object3DMarkerSymbol) sym) |
575 | 597 |
.getObject3DPath()); |
576 | 598 |
((NodeSymbol3D) ps).setNode(object3D); |
... | ... | |
584 | 606 |
// TODO Auto-generated catch block |
585 | 607 |
e.printStackTrace(); |
586 | 608 |
} |
587 |
|
|
588 |
|
|
589 |
|
|
609 |
|
|
590 | 610 |
} |
591 | 611 |
|
592 | 612 |
return ps; |
613 |
|
|
593 | 614 |
} |
594 | 615 |
|
595 | 616 |
private static String rasterizeSymbol(CharacterMarkerSymbol sym) { |
... | ... | |
627 | 648 |
} |
628 | 649 |
|
629 | 650 |
String sip = "SymbolTmp.png"; |
630 |
File file = new File("/tmp/"+sip);
|
|
651 |
File file = new File("/tmp/" + sip);
|
|
631 | 652 |
String format = "png"; |
632 | 653 |
try { |
633 | 654 |
saveCachedFile(image, format, file); |
Also available in: Unified diff