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