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