Revision 20124 trunk/libraries/lib3DMap/src/com/iver/ai2/gvsig3d/gui/FeatureFactory.java
FeatureFactory.java | ||
---|---|---|
4 | 4 |
import java.util.HashMap; |
5 | 5 |
import java.util.Iterator; |
6 | 6 |
import java.util.List; |
7 |
import java.util.Vector; |
|
8 | 7 |
|
9 | 8 |
import com.iver.ai2.gvsig3d.labels3D.ILabel3D; |
10 | 9 |
import com.iver.ai2.gvsig3d.resources.ResourcesFactory; |
... | ... | |
12 | 11 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
13 | 12 |
|
14 | 13 |
import es.upv.ai2.osgvp.AutoTransform; |
14 |
import es.upv.ai2.osgvp.Geode; |
|
15 | 15 |
import es.upv.ai2.osgvp.Group; |
16 | 16 |
import es.upv.ai2.osgvp.Node; |
17 | 17 |
import es.upv.ai2.osgvp.Optimizer; |
... | ... | |
20 | 20 |
import es.upv.ai2.osgvp.Optimizer.OptimizationOptions; |
21 | 21 |
import es.upv.ai2.osgvp.features.PixelPoint; |
22 | 22 |
import es.upv.ai2.osgvp.features.Polygon; |
23 |
import es.upv.ai2.osgvp.features.PolygonExtruder; |
|
23 | 24 |
import es.upv.ai2.osgvp.features.Polyline; |
24 | 25 |
import es.upv.ai2.osgvp.features.QuadPoint; |
25 | 26 |
import es.upv.ai2.osgvp.features.TessellablePolygon; |
... | ... | |
563 | 564 |
// Return node |
564 | 565 |
return p; |
565 | 566 |
} |
567 |
public static Node insertPolygonExtruded(List points, Vec4 color,String texture,double heigth) { |
|
568 |
// Creating a polygon |
|
569 |
Polygon p = new Polygon(); |
|
566 | 570 |
|
571 |
// Set up parameters |
|
572 |
// p.setType(Polygon.PolygonType.FILLED_POLYGON); |
|
573 |
p.setWidth(2f); |
|
574 |
// p.setPattern((short) 0xFFFF); |
|
575 |
// p.setFactor(2); |
|
576 |
p.setType(Polygon.PolygonType.FILLED_POLYGON); |
|
577 |
// p.setType(Polygon.PolygonType.EMPTY_POLYGON); |
|
578 |
// p.setType(Polygon.PolygonType.PATTERN_POLYGON); |
|
579 |
|
|
580 |
// Blending only is active if the alpha component are diferent that 1 |
|
581 |
if (color.w() != 1) { |
|
582 |
p.setEnabledBlending(true); |
|
583 |
} |
|
584 |
// Adding points |
|
585 |
for (int i = 0; i < points.size(); i++) { |
|
586 |
Vec3 element = (Vec3) points.get(i); |
|
587 |
p.addVertex(element, color); |
|
588 |
} |
|
589 |
|
|
590 |
PolygonExtruder pe = new PolygonExtruder(); |
|
591 |
pe.extrude(p,new Vec3 (0.0,0.0,-1.0), heigth); |
|
592 |
|
|
593 |
|
|
594 |
// Optimizer generated nodes |
|
595 |
Optimizer opt = new Optimizer(); |
|
596 |
opt.optimize(p, OptimizationOptions.ALL_OPTIMIZATIONS); |
|
597 |
|
|
598 |
Geode geode = new Geode(); |
|
599 |
|
|
600 |
geode.addDrawable(pe.getGeometry()); |
|
601 |
// Return node |
|
602 |
return geode; |
|
603 |
} |
|
567 | 604 |
/** |
568 | 605 |
* Method to create a new 3D line. With a List of 3D points and a color |
569 | 606 |
* |
Also available in: Unified diff