svn-gvsig-desktop / trunk / libraries / lib3DMap / src / org / gvsig / gvsig3d / simbology3D / Point3DFeature.java @ 24830
History | View | Annotate | Download (5.33 KB)
1 |
package org.gvsig.gvsig3d.simbology3D; |
---|---|
2 |
|
3 |
import org.apache.log4j.Logger; |
4 |
import org.gvsig.gvsig3d.simbology3D.extrusionSymbols.ExtrusionPointSymbol; |
5 |
import org.gvsig.gvsig3d.simbology3D.geometry3D.Point3DGeometry; |
6 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.I3DSymbol; |
7 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.point.CharacterPoint3DSymbol; |
8 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.point.MultiLayerPoint3DSymbol; |
9 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.point.ObjectPoint3DSymbol; |
10 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.point.PicturePoint3DSymbol; |
11 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.point.SimplePoint3DSymbol; |
12 |
import org.gvsig.osgvp.Group; |
13 |
import org.gvsig.osgvp.exceptions.node.NodeException; |
14 |
import org.gvsig.osgvp.planets.Planet; |
15 |
import org.gvsig.symbology.fmap.symbols.CharacterMarkerSymbol; |
16 |
import org.gvsig.symbology.fmap.symbols.PictureMarkerSymbol; |
17 |
|
18 |
import com.iver.ai2.gvsig3d.legend.Object3DMarkerSymbol; |
19 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
20 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
21 |
import com.iver.cit.gvsig.fmap.core.symbols.MultiLayerMarkerSymbol; |
22 |
import com.iver.cit.gvsig.fmap.core.symbols.SimpleMarkerSymbol; |
23 |
|
24 |
public class Point3DFeature extends AbstractFeature3D { |
25 |
|
26 |
private Point3DGeometry p3DGeometry;
|
27 |
private I3DSymbol p3DSymbol;
|
28 |
|
29 |
private static Logger logger = Logger.getLogger(Point3DFeature.class |
30 |
.getName()); |
31 |
|
32 |
public Point3DFeature(ISymbol symbol, IGeometry geometry) {
|
33 |
super(symbol, geometry);
|
34 |
|
35 |
p3DGeometry = new Point3DGeometry(geometry);
|
36 |
// p3DSymbol = new SimplePolygon3DSymbol(symbol);
|
37 |
if (this.getSymbol().getClass().equals(SimpleMarkerSymbol.class)) { |
38 |
|
39 |
p3DSymbol = new SimplePoint3DSymbol(symbol);
|
40 |
System.err.println("Simbolo tipo PUNTO SIMPLE"); |
41 |
|
42 |
} else if (this.getSymbol().getClass() |
43 |
.equals(PictureMarkerSymbol.class)) { |
44 |
|
45 |
System.err.println("Simbolo tipo PUNTO IMAGEN"); |
46 |
p3DSymbol = new PicturePoint3DSymbol(symbol);
|
47 |
|
48 |
} else if (this.getSymbol().getClass().equals( |
49 |
CharacterMarkerSymbol.class)) { |
50 |
System.err.println("Simbolo tipo PUNTO CARACTER"); |
51 |
p3DSymbol = new CharacterPoint3DSymbol(symbol);
|
52 |
} else if (this.getSymbol().getClass().equals( |
53 |
MultiLayerMarkerSymbol.class)) { |
54 |
System.err.println("Simbolo tipo PUNTO COMPUESTO"); |
55 |
p3DSymbol = new MultiLayerPoint3DSymbol(symbol);
|
56 |
} else if (this.getSymbol().getClass().equals( |
57 |
Object3DMarkerSymbol.class)) { |
58 |
// System.err.println("Simbolo tipo OBJETO 3D");
|
59 |
p3DSymbol = new ObjectPoint3DSymbol(symbol);
|
60 |
} else if (this.getSymbol().getClass().equals( |
61 |
ExtrusionPointSymbol.class)) { |
62 |
// System.err.println("Simbolo tipo OBJETO 3D");
|
63 |
p3DSymbol = (I3DSymbol) this.getSymbol();
|
64 |
} |
65 |
|
66 |
} |
67 |
|
68 |
public Group Draw(Group group) { |
69 |
try {
|
70 |
group.addChild(p3DGeometry.generateGeometry(p3DSymbol)); |
71 |
} catch (NodeException e) {
|
72 |
logger.error("Command: " + "Error adding new child.", e); |
73 |
} |
74 |
return group;
|
75 |
} |
76 |
|
77 |
public void setPlanet(Planet planet) { |
78 |
if (this.p3DGeometry != null) { |
79 |
this.p3DGeometry.setPlanet(planet);
|
80 |
} |
81 |
} |
82 |
|
83 |
public void setHeigth(float heigth) { |
84 |
if (this.p3DGeometry != null) { |
85 |
this.p3DGeometry.setHeigth(heigth);
|
86 |
} |
87 |
} |
88 |
|
89 |
// public Group generateGeometry(Group group) {
|
90 |
// Node node = null;
|
91 |
//
|
92 |
// if (geometry == null || symbol == null)
|
93 |
// return null;
|
94 |
//
|
95 |
// geomType = geometry.getGeometryType();
|
96 |
//
|
97 |
//
|
98 |
// // Setup point hash map
|
99 |
// List pointListAux = null;
|
100 |
// if (pointsMap==null)
|
101 |
// pointsMap = new HashMap<Double, List>();
|
102 |
// if ((geomType & FShape.POINT) == FShape.POINT) {
|
103 |
// if (pointsMap.containsKey(new Integer(pointSize))) {
|
104 |
// // System.out.println("ya contiene esa key");
|
105 |
// pointListAux = (List) pointsMap.get(new Double(pointSize));
|
106 |
// } else {
|
107 |
// pointListAux = new ArrayList();
|
108 |
// pointsMap.put(new Double(pointSize), pointListAux);
|
109 |
// }
|
110 |
//
|
111 |
// }
|
112 |
//
|
113 |
//
|
114 |
// // Getting the Iterator
|
115 |
// PathIterator theIteratorL = geometry.getPathIterator(null);
|
116 |
//
|
117 |
// double[] dataLine = new double[6];
|
118 |
// List<Vec3> posi = new ArrayList<Vec3>();
|
119 |
// int contH = 0;
|
120 |
// // System.out.println("ENTRO");
|
121 |
// while (!theIteratorL.isDone()) {
|
122 |
// // System.out.println("ITERO");
|
123 |
// int type = theIteratorL.currentSegment(dataLine);
|
124 |
//
|
125 |
// Vec3 position = getGeometryPosition(geometry,dataLine,heigth,contH);
|
126 |
// // Adding points
|
127 |
// switch (type) {
|
128 |
// case PathIterator.SEG_MOVETO:
|
129 |
// // System.out.println("SEG_MOVETO");
|
130 |
// // FeatureFactory.addPointToNode(node, pos, rgba, pointSize);
|
131 |
// // posi.add(position);
|
132 |
// pointListAux.add(new Punto3D(position, rgba, pointSize));
|
133 |
// break;
|
134 |
//
|
135 |
// case PathIterator.SEG_LINETO:
|
136 |
// // System.out.println("SEG_LINETO");
|
137 |
// posi.add(position);
|
138 |
// break;
|
139 |
//
|
140 |
// case PathIterator.SEG_QUADTO:
|
141 |
// // System.out.println("SEG_QUADTO");
|
142 |
// break;
|
143 |
//
|
144 |
// case PathIterator.SEG_CUBICTO:
|
145 |
// // System.out.println("SEG_CUBICTO");
|
146 |
// break;
|
147 |
//
|
148 |
// case PathIterator.SEG_CLOSE:
|
149 |
// // System.out.println("SEG_CLOSE");
|
150 |
// break;
|
151 |
// }
|
152 |
// contH++;
|
153 |
// theIteratorL.next();
|
154 |
// }
|
155 |
// // System.out.println("Numero de puntos: " + contH);
|
156 |
//
|
157 |
// // Adding last symbol
|
158 |
// // System.err.println("tama?o de posi " + posi.size());
|
159 |
// // node = FeatureFactory.insertPoints(posi, rgba, pointSize);
|
160 |
// // group.addChild(node);
|
161 |
// // posi.clear();
|
162 |
// return group;
|
163 |
// return null;
|
164 |
// }
|
165 |
|
166 |
} |