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