Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / lib3DMap / src / com / iver / ai2 / gvsig3d / simbology3D / Point3DFeature.java @ 18219

History | View | Annotate | Download (4.51 KB)

1
package com.iver.ai2.gvsig3d.simbology3D;
2

    
3
import com.iver.ai2.gvsig3d.simbology3D.geometry3D.Point3DGeometry;
4
import com.iver.ai2.gvsig3d.simbology3D.symbol3D.I3DSymbol;
5
import com.iver.ai2.gvsig3d.simbology3D.symbol3D.point.CharacterPoint3DSymbol;
6
import com.iver.ai2.gvsig3d.simbology3D.symbol3D.point.MultiLayerPoint3DSymbol;
7
import com.iver.ai2.gvsig3d.simbology3D.symbol3D.point.PicturePoint3DSymbol;
8
import com.iver.ai2.gvsig3d.simbology3D.symbol3D.point.SimplePoint3DSymbol;
9
import com.iver.cit.gvsig.fmap.core.IGeometry;
10
import com.iver.cit.gvsig.fmap.core.symbols.CharacterMarkerSymbol;
11
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
12
import com.iver.cit.gvsig.fmap.core.symbols.MultiLayerMarkerSymbol;
13
import com.iver.cit.gvsig.fmap.core.symbols.PictureMarkerSymbol;
14
import com.iver.cit.gvsig.fmap.core.symbols.SimpleMarkerSymbol;
15

    
16
import es.upv.ai2.osgvp.Group;
17
import es.upv.ai2.osgvp.planets.Planet;
18

    
19
public class Point3DFeature extends AbstractFeature3D {
20

    
21
        private Point3DGeometry p3DGeometry;
22
        private I3DSymbol p3DSymbol;
23

    
24
        public Point3DFeature(ISymbol symbol, IGeometry geometry) {
25
                super(symbol, geometry);
26

    
27
                p3DGeometry = new Point3DGeometry(geometry);
28
                // p3DSymbol = new SimplePolygon3DSymbol(symbol);
29
                if (this.getSymbol().getClass().equals(SimpleMarkerSymbol.class)) {
30

    
31
                        p3DSymbol = new SimplePoint3DSymbol(symbol);
32
                        System.err.println("Simbolo tipo PUNTO SIMPLE");
33

    
34
                } else if (this.getSymbol().getClass()
35
                                .equals(PictureMarkerSymbol.class)) {
36

    
37
                        System.err.println("Simbolo tipo PUNTO IMAGEN");
38
                        p3DSymbol = new PicturePoint3DSymbol(symbol);
39

    
40
                } else if (this.getSymbol().getClass().equals(
41
                                CharacterMarkerSymbol.class)) {
42
                        System.err.println("Simbolo tipo PUNTO CARACTER");
43
                        p3DSymbol = new CharacterPoint3DSymbol(symbol);
44
                } else if (this.getSymbol().getClass().equals(
45
                                MultiLayerMarkerSymbol.class)) {
46
                        System.err.println("Simbolo tipo PUNTO COMPUESTO");
47
                        p3DSymbol = new MultiLayerPoint3DSymbol(symbol);
48
                }
49
        }
50

    
51
        public Group Draw(Group group) {
52
                group.addChild(p3DGeometry.generateGeometry(p3DSymbol));
53
                return group;
54
        }
55

    
56
        public void setPlanet(Planet planet) {
57
                if (this.p3DGeometry != null) {
58
                        this.p3DGeometry.setPlanet(planet);
59
                }
60
        }
61

    
62
        public void setHeigth(float heigth) {
63
                if (this.p3DGeometry != null) {
64
                        this.p3DGeometry.setHeigth(heigth);
65
                }
66
        }
67

    
68
        // public Group generateGeometry(Group group) {
69
        // Node node = null;
70
        //
71
        // if (geometry == null || symbol == null)
72
        // return null;
73
        //
74
        // geomType = geometry.getGeometryType();
75
        //                
76
        //                
77
        // // Setup point hash map
78
        // List pointListAux = null;
79
        // if (pointsMap==null)
80
        // pointsMap = new HashMap<Double, List>();
81
        // if ((geomType & FShape.POINT) == FShape.POINT) {
82
        // if (pointsMap.containsKey(new Integer(pointSize))) {
83
        // // System.out.println("ya contiene esa key");
84
        // pointListAux = (List) pointsMap.get(new Double(pointSize));
85
        // } else {
86
        // pointListAux = new ArrayList();
87
        // pointsMap.put(new Double(pointSize), pointListAux);
88
        // }
89
        //
90
        // }
91
        //
92
        //
93
        // // Getting the Iterator
94
        // PathIterator theIteratorL = geometry.getPathIterator(null);
95
        //
96
        // double[] dataLine = new double[6];
97
        // List<Vec3> posi = new ArrayList<Vec3>();
98
        // int contH = 0;
99
        // // System.out.println("ENTRO");
100
        // while (!theIteratorL.isDone()) {
101
        // // System.out.println("ITERO");
102
        // int type = theIteratorL.currentSegment(dataLine);
103
        //                        
104
        // Vec3 position = getGeometryPosition(geometry,dataLine,heigth,contH);
105
        // // Adding points
106
        // switch (type) {
107
        // case PathIterator.SEG_MOVETO:
108
        // // System.out.println("SEG_MOVETO");
109
        // // FeatureFactory.addPointToNode(node, pos, rgba, pointSize);
110
        // // posi.add(position);
111
        // pointListAux.add(new Punto3D(position, rgba, pointSize));
112
        // break;
113
        //
114
        // case PathIterator.SEG_LINETO:
115
        // // System.out.println("SEG_LINETO");
116
        // posi.add(position);
117
        // break;
118
        //
119
        // case PathIterator.SEG_QUADTO:
120
        // // System.out.println("SEG_QUADTO");
121
        // break;
122
        //
123
        // case PathIterator.SEG_CUBICTO:
124
        // // System.out.println("SEG_CUBICTO");
125
        // break;
126
        //
127
        // case PathIterator.SEG_CLOSE:
128
        // // System.out.println("SEG_CLOSE");
129
        // break;
130
        // }
131
        // contH++;
132
        // theIteratorL.next();
133
        // }
134
        // // System.out.println("Numero de puntos: " + contH);
135
        //
136
        // // Adding last symbol
137
        // // System.err.println("tama?o de posi " + posi.size());
138
        // // node = FeatureFactory.insertPoints(posi, rgba, pointSize);
139
        // // group.addChild(node);
140
        // // posi.clear();
141
        // return group;
142
        // return null;
143
        // }
144

    
145
}