Revision 25228 trunk/libraries/lib3DMap/src/org/gvsig/gvsig3d/gui/FeatureFactory.java
FeatureFactory.java | ||
---|---|---|
12 | 12 |
import org.gvsig.gvsig3d.utils.Punto3D; |
13 | 13 |
import org.gvsig.osgvp.AutoTransform; |
14 | 14 |
import org.gvsig.osgvp.Geode; |
15 |
import org.gvsig.osgvp.Geometry; |
|
16 | 15 |
import org.gvsig.osgvp.Group; |
17 | 16 |
import org.gvsig.osgvp.Node; |
18 | 17 |
import org.gvsig.osgvp.Optimizer; |
... | ... | |
22 | 21 |
import org.gvsig.osgvp.exceptions.InvalidValueException; |
23 | 22 |
import org.gvsig.osgvp.exceptions.node.NodeException; |
24 | 23 |
import org.gvsig.osgvp.features.PixelPoint; |
24 |
import org.gvsig.osgvp.features.PointExtruder; |
|
25 | 25 |
import org.gvsig.osgvp.features.Polygon; |
26 | 26 |
import org.gvsig.osgvp.features.PolygonExtruder; |
27 | 27 |
import org.gvsig.osgvp.features.Polyline; |
28 |
import org.gvsig.osgvp.features.PolylineExtruder; |
|
28 | 29 |
import org.gvsig.osgvp.features.QuadPoint; |
29 | 30 |
import org.gvsig.osgvp.features.TessellablePolygon; |
30 | 31 |
import org.gvsig.osgvp.features.Text; |
31 | 32 |
import org.gvsig.osgvp.planets.Planet; |
32 | 33 |
|
33 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
34 | 34 |
import com.iver.ai2.gvsig3d.resources.ResourcesFactory; |
35 | 35 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
36 | 36 |
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.AttrInTableLabelingStrategy; |
... | ... | |
471 | 471 |
return p; |
472 | 472 |
} |
473 | 473 |
|
474 |
public static Node insertPointExtruded(List points, Vec4 color,String texture,double heigth) { |
|
475 |
// Creating a polygon |
|
476 |
PixelPoint p = null; |
|
477 |
try { |
|
478 |
p = new PixelPoint(); |
|
479 |
} catch (NodeException e1) { |
|
480 |
// TODO Auto-generated catch block |
|
481 |
e1.printStackTrace(); |
|
482 |
} |
|
483 |
// Adding points |
|
484 |
for (int i = 0; i < points.size(); i++) { |
|
485 |
Vec3 element = (Vec3) points.get(i); |
|
486 |
p.addVertex(element, color); |
|
487 |
//p.addPoint3D(element); |
|
488 |
} |
|
489 |
PointExtruder pe = new PointExtruder(); |
|
490 |
pe.extrude(p,new Vec3 (0.0,0.0,1.0), heigth); |
|
491 |
|
|
492 |
|
|
493 |
Group group = new Group(); |
|
494 |
Geode geode = new Geode(); |
|
495 |
|
|
496 |
geode.getOrCreateStateSet().setTwoSidedLighting(true); |
|
497 |
try { |
|
498 |
geode.addDrawable(pe.getGeometry()); |
|
499 |
group.addChild(geode); |
|
500 |
} catch (NodeException e) { |
|
501 |
logger.error("Command:" + "Error adding drawable object.",e); |
|
502 |
} |
|
503 |
|
|
504 |
return group; |
|
505 |
} |
|
506 |
|
|
507 |
|
|
508 |
|
|
474 | 509 |
/** |
475 | 510 |
* Create a new quad point node with a color, size and texture. Using a position of 3D |
476 | 511 |
* points |
... | ... | |
730 | 765 |
} |
731 | 766 |
|
732 | 767 |
// Set up parameters |
733 |
// p.setType(Polygon.PolygonType.FILLED_POLYGON); |
|
734 | 768 |
p.setWidth(2f); |
735 |
// p.setPattern((short) 0xFFFF); |
|
736 |
// p.setFactor(2); |
|
737 | 769 |
p.setType(Polygon.PolygonType.FILLED_POLYGON); |
738 |
// p.setType(Polygon.PolygonType.EMPTY_POLYGON); |
|
739 |
// p.setType(Polygon.PolygonType.PATTERN_POLYGON); |
|
740 |
|
|
741 | 770 |
// Blending only is active if the alpha component are diferent that 1 |
742 |
// if (color.w() != 1) {
|
|
743 |
// p.setEnabledBlending(true);
|
|
744 |
// }
|
|
771 |
if (color.w() != 1) { |
|
772 |
p.setEnabledBlending(true); |
|
773 |
} |
|
745 | 774 |
List positionTapa = new ArrayList(); |
746 | 775 |
// Adding points |
747 | 776 |
for (int i = 0; i < points.size(); i++) { |
748 | 777 |
Vec3 element = (Vec3) points.get(i); |
749 | 778 |
Vec3 elementTapa = new Vec3(element.x(),element.y(),element.z()+heigth); |
750 | 779 |
positionTapa.add(elementTapa); |
751 |
// System.out.println("posicion : " + element.z()); |
|
752 | 780 |
p.addVertex(element, color); |
753 | 781 |
} |
754 | 782 |
|
755 |
|
|
756 |
|
|
757 | 783 |
PolygonExtruder pe = new PolygonExtruder(); |
758 | 784 |
pe.extrude(p,new Vec3 (0.0,0.0,1.0), heigth); |
759 | 785 |
|
... | ... | |
779 | 805 |
geode.addDrawable(pe.getGeometry()); |
780 | 806 |
group.addChild(geode); |
781 | 807 |
group.addChild(node); |
782 |
// if (color.w() != 1) { |
|
783 |
// group.getOrCreateStateSet().setEnabledBlending(true); |
|
784 |
// } |
|
785 | 808 |
} catch (NodeException e) { |
786 | 809 |
logger.error("Command:" + "Error adding drawable object.",e); |
787 | 810 |
} |
788 | 811 |
|
789 |
// Return node |
|
790 |
// return geode; |
|
791 | 812 |
return group; |
792 | 813 |
} |
793 | 814 |
/** |
... | ... | |
857 | 878 |
return p; |
858 | 879 |
|
859 | 880 |
} |
881 |
|
|
882 |
public static Node insertLineExtruded(List points, Vec4 color,String texture,double heigth) { |
|
883 |
// Creating a polygon |
|
884 |
Polyline p = null; |
|
885 |
try { |
|
886 |
p = new Polyline(); |
|
887 |
} catch (NodeException e1) { |
|
888 |
// TODO Auto-generated catch block |
|
889 |
e1.printStackTrace(); |
|
890 |
} |
|
860 | 891 |
|
892 |
// Set up parameters |
|
893 |
p.setWidth(2f); |
|
894 |
|
|
895 |
// Blending only is active if the alpha component are diferent that 1 |
|
896 |
if (color.w() != 1) { |
|
897 |
p.setEnabledBlending(true); |
|
898 |
} |
|
899 |
// List positionTapa = new ArrayList(); |
|
900 |
// Adding points |
|
901 |
for (int i = 0; i < points.size(); i++) { |
|
902 |
Vec3 element = (Vec3) points.get(i); |
|
903 |
p.addVertex(element, color); |
|
904 |
} |
|
905 |
PolylineExtruder pe = new PolylineExtruder(); |
|
906 |
pe.extrude(p,new Vec3 (0.0,0.0,1.0), heigth); |
|
907 |
|
|
908 |
|
|
909 |
Group group = new Group(); |
|
910 |
Geode geode = new Geode(); |
|
911 |
|
|
912 |
geode.getOrCreateStateSet().setTwoSidedLighting(true); |
|
913 |
try { |
|
914 |
geode.addDrawable(pe.getGeometry()); |
|
915 |
group.addChild(geode); |
|
916 |
} catch (NodeException e) { |
|
917 |
logger.error("Command:" + "Error adding drawable object.",e); |
|
918 |
} |
|
919 |
|
|
920 |
return group; |
|
921 |
} |
|
922 |
|
|
923 |
|
|
924 |
|
|
925 |
|
|
926 |
|
|
861 | 927 |
/** |
862 | 928 |
* Create a new group of 3D points with a color and size. Using a List of 3D |
863 | 929 |
* points |
Also available in: Unified diff