Revision 369
2.0/trunk/org.gvsig.gvsig3d.app/org.gvsig.gvsig3d.app.extension/package.info | ||
---|---|---|
1 | 1 |
# |
2 |
#Tue May 29 12:04:19 CEST 2012
|
|
2 |
#Wed May 30 13:13:02 CEST 2012
|
|
3 | 3 |
owner=gvSIG Association |
4 | 4 |
code=org.gvsig.gvsig3d.app.extension |
5 | 5 |
java-version=j1_5 |
2.0/trunk/org.gvsig.gvsig3d/org.gvsig.gvsig3d.lib/org.gvsig.gvsig3d.lib.impl/src/main/java/org/gvsig/gvsig3d/impl/symbology3d/extrusion/impl/ExtrusionPolygonSymbol.java | ||
---|---|---|
11 | 11 |
import org.gvsig.osgvp.geometry.GeoPolygonList3D; |
12 | 12 |
import org.gvsig.osgvp.symbology.fill.ExtrudedFill; |
13 | 13 |
import org.gvsig.osgvp.symbology.fill.SimpleFill; |
14 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.AbstractFillSymbol; |
|
14 | 15 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.SimpleFillSymbol; |
16 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol; |
|
17 |
import org.gvsig.tools.ToolsLocator; |
|
18 |
import org.gvsig.tools.dynobject.DynStruct; |
|
19 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
20 |
import org.gvsig.tools.persistence.PersistentState; |
|
21 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
15 | 22 |
import org.gvsig.tools.util.Callable; |
23 |
import org.gvsig.tools.util.Caller; |
|
24 |
import org.gvsig.tools.util.impl.DefaultCaller; |
|
16 | 25 |
|
17 | 26 |
/** |
18 | 27 |
* @author AI2 |
... | ... | |
89 | 98 |
|
90 | 99 |
} |
91 | 100 |
|
101 |
public void loadFromState(PersistentState state) |
|
102 |
throws PersistenceException { |
|
103 |
// Set parent fill symbol properties |
|
104 |
super.loadFromState(state); |
|
92 | 105 |
|
106 |
// // Set own properties |
|
107 |
// setStyle(state.getInt(FIELD_MARKERSTYLE)); |
|
108 |
// setOutlined(state.getBoolean(FIELD_OUTLINED)); |
|
109 |
// if (isOutlined()) { |
|
110 |
// setOutlineColor((Color) state.get(FIELD_OUTLINECOLOR)); |
|
111 |
// setOutlineSize(state.getDouble(FIELD_OUTLINESIZE)); |
|
112 |
// } |
|
113 |
} |
|
114 |
|
|
115 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
116 |
// Save parent fill symbol properties |
|
117 |
super.saveToState(state); |
|
118 |
|
|
119 |
// Save own properties |
|
120 |
// state.set(FIELD_MARKERSTYLE, getStyle()); |
|
121 |
// state.set(FIELD_OUTLINED, isOutlined()); |
|
122 |
// if (isOutlined()) { |
|
123 |
// state.set(FIELD_OUTLINECOLOR, getOutlineColor()); |
|
124 |
// state.set(FIELD_OUTLINESIZE, getOutlineSize()); |
|
125 |
// } |
|
126 |
} |
|
127 |
|
|
128 |
public static class RegisterPersistence implements Callable { |
|
129 |
|
|
130 |
public Object call() throws Exception { |
|
131 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
132 |
if (manager.getDefinition("Symbol") == null) { |
|
133 |
Caller caller = new DefaultCaller(); |
|
134 |
caller.add(new AbstractSymbol.RegisterPersistence()); |
|
135 |
caller.call(); |
|
136 |
} |
|
137 |
|
|
138 |
if (manager.getDefinition("SimpleFill3DSymbol") == null) { |
|
139 |
Caller caller = new DefaultCaller(); |
|
140 |
caller.add(new SimpleFill3DSymbol.RegisterPersistence()); |
|
141 |
caller.call(); |
|
142 |
} |
|
143 |
|
|
144 |
DynStruct definition = manager.addDefinition( |
|
145 |
ExtrusionPolygonSymbol.class, "ExtrusionPolygonSymbol", |
|
146 |
"ExtrusionPolygonSymbol Persistence definition", null, null); |
|
147 |
|
|
148 |
definition.extend(PersistenceManager.PERSISTENCE_NAMESPACE, |
|
149 |
"FillSymbol"); |
|
150 |
|
|
151 |
return Boolean.TRUE; |
|
152 |
} |
|
153 |
} |
|
154 |
|
|
93 | 155 |
} |
2.0/trunk/org.gvsig.gvsig3d/org.gvsig.gvsig3d.lib/org.gvsig.gvsig3d.lib.impl/src/main/java/org/gvsig/gvsig3d/impl/symbology3d/fill/impl/SimpleFill3DSymbol.java | ||
---|---|---|
9 | 9 |
import org.gvsig.compat.print.PrintAttributes; |
10 | 10 |
import org.gvsig.fmap.dal.feature.Feature; |
11 | 11 |
import org.gvsig.fmap.geom.Geometry; |
12 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
12 | 13 |
import org.gvsig.fmap.geom.GeometryLocator; |
13 | 14 |
import org.gvsig.fmap.geom.GeometryManager; |
14 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
15 | 15 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
16 | 16 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
17 |
import org.gvsig.fmap.geom.primitive.GeneralPathXIterator; |
|
18 |
import org.gvsig.fmap.geom.primitive.Surface; |
|
19 | 17 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
20 | 18 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
21 | 19 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException; |
22 | 20 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager; |
23 |
import org.gvsig.fmap.mapcontrol.tools.geo.Geo; |
|
24 |
import org.gvsig.gvsig3d.impl.symbology3d.marker.impl.SimpleMarker3DSymbol; |
|
25 | 21 |
import org.gvsig.gvsig3d.symbology3d.fill.ISimpleFill3DSymbol; |
26 |
import org.gvsig.gvsig3d.symbology3d.marker.ISimpleMarker3DSymbol; |
|
27 | 22 |
import org.gvsig.osgvp.core.osg.Node; |
28 | 23 |
import org.gvsig.osgvp.core.osg.Vec3; |
29 | 24 |
import org.gvsig.osgvp.exceptions.node.NodeException; |
30 | 25 |
import org.gvsig.osgvp.geometry.GeoMultiPolygon3D; |
31 |
import org.gvsig.osgvp.geometry.GeoPointArray3D; |
|
32 | 26 |
import org.gvsig.osgvp.geometry.GeoPolygon3D; |
33 | 27 |
import org.gvsig.osgvp.geometry.GeoPolygonList3D; |
34 | 28 |
import org.gvsig.osgvp.symbology.ISymbol3D; |
35 | 29 |
import org.gvsig.osgvp.symbology.fill.SimpleFill; |
36 | 30 |
import org.gvsig.osgvp.terrain.Terrain; |
37 | 31 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.AbstractFillSymbol; |
38 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.SimpleFillSymbol; |
|
39 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.AbstractMarkerSymbol; |
|
32 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol; |
|
33 |
import org.gvsig.tools.ToolsLocator; |
|
34 |
import org.gvsig.tools.dynobject.DynStruct; |
|
35 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
36 |
import org.gvsig.tools.persistence.PersistentState; |
|
37 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
40 | 38 |
import org.gvsig.tools.task.Cancellable; |
41 | 39 |
import org.gvsig.tools.util.Callable; |
40 |
import org.gvsig.tools.util.Caller; |
|
41 |
import org.gvsig.tools.util.impl.DefaultCaller; |
|
42 | 42 |
import org.slf4j.Logger; |
43 | 43 |
import org.slf4j.LoggerFactory; |
44 | 44 |
|
45 |
|
|
46 | 45 |
/** |
47 | 46 |
* |
48 | 47 |
* @author jtorres |
49 |
* |
|
48 |
*
|
|
50 | 49 |
*/ |
51 |
public class SimpleFill3DSymbol extends AbstractFillSymbol implements ISimpleFill3DSymbol{ |
|
50 |
public class SimpleFill3DSymbol extends AbstractFillSymbol implements |
|
51 |
ISimpleFill3DSymbol { |
|
52 | 52 |
|
53 | 53 |
public static final String SIMPLE_FILL3D_SYMBOL_PERSISTENCE_DEFINITION_NAME = "SimpleFill3DSymbol"; |
54 |
private static final GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
|
55 |
private static final Logger LOG = LoggerFactory.getLogger(SimpleFill3DSymbol.class); |
|
54 |
private static final GeometryManager geomManager = GeometryLocator |
|
55 |
.getGeometryManager(); |
|
56 |
private static final Logger LOG = LoggerFactory |
|
57 |
.getLogger(SimpleFill3DSymbol.class); |
|
56 | 58 |
public GeoPolygonList3D _geometry; |
57 | 59 |
public GeoMultiPolygon3D _mpolygon; |
58 |
protected float _height= 10; |
|
60 |
protected float _height = 10;
|
|
59 | 61 |
private Terrain _terrain; |
60 | 62 |
Vec3 _auxVect; |
61 | 63 |
protected ISymbol3D sm; |
62 | 64 |
protected int _coordinateSystemType; |
63 |
public SimpleFill3DSymbol() |
|
64 |
{ |
|
65 |
|
|
66 |
public SimpleFill3DSymbol() {
|
|
65 | 67 |
super(); |
66 | 68 |
try { |
67 | 69 |
sm = new SimpleFill(); |
... | ... | |
73 | 75 |
// TODO Auto-generated catch block |
74 | 76 |
e.printStackTrace(); |
75 | 77 |
} |
76 |
|
|
78 |
|
|
77 | 79 |
} |
78 | 80 |
|
79 | 81 |
public ISymbol getSymbolForSelection() { |
... | ... | |
86 | 88 |
sm.setColor(this.getColor()); |
87 | 89 |
} |
88 | 90 |
|
89 |
|
|
90 | 91 |
public void draw(Graphics2D g, AffineTransform affineTransform, |
91 | 92 |
Geometry geom, Feature f, Cancellable cancel) { |
92 | 93 |
|
93 |
//Color c = getFillColor(); |
|
94 |
//geom.getClass().getName() |
|
95 |
|
|
94 |
// Color c = getFillColor();
|
|
95 |
// geom.getClass().getName()
|
|
96 |
|
|
96 | 97 |
sm.setColor(this.getColor()); |
97 |
//WAITING for gvSIG ARCHITECTS to do something with polygons with holes in shp files |
|
98 |
//in the meanwhile nothing is gonna happen with this kind of polygons |
|
99 |
// if (geom.getGeometryType().isTypeOf(Geometry.TYPES.SURFACE)) |
|
100 |
// { |
|
101 |
// Surface s = (Surface)geom.cloneGeometry(); |
|
102 |
// _geometry.addMultiPolygon(getGeoMultiPolygon(s)); |
|
103 |
// } |
|
98 |
// WAITING for gvSIG ARCHITECTS to do something with polygons with holes |
|
99 |
// in shp files |
|
100 |
// in the meanwhile nothing is gonna happen with this kind of polygons |
|
101 |
// if (geom.getGeometryType().isTypeOf(Geometry.TYPES.SURFACE)) |
|
102 |
// { |
|
103 |
// Surface s = (Surface)geom.cloneGeometry(); |
|
104 |
// _geometry.addMultiPolygon(getGeoMultiPolygon(s)); |
|
105 |
// } |
|
104 | 106 |
double[] dataLine = new double[6]; |
105 |
GeoMultiPolygon3D mp=null;
|
|
107 |
GeoMultiPolygon3D mp = null;
|
|
106 | 108 |
try { |
107 | 109 |
mp = new GeoMultiPolygon3D(); |
108 | 110 |
} catch (NodeException e1) { |
109 | 111 |
// TODO Auto-generated catch block |
110 | 112 |
e1.printStackTrace(); |
111 | 113 |
} |
112 |
GeoPolygon3D p=null;
|
|
114 |
GeoPolygon3D p = null;
|
|
113 | 115 |
PathIterator theIteratorL = geom.getGeneralPath().getPathIterator(null); |
114 | 116 |
while (!theIteratorL.isDone()) { |
115 |
|
|
117 |
|
|
116 | 118 |
int type = theIteratorL.currentSegment(dataLine); |
117 | 119 |
|
118 | 120 |
// Adding points |
119 | 121 |
switch (type) { |
120 | 122 |
case PathIterator.SEG_MOVETO: |
121 |
|
|
122 |
if(p!=null)
|
|
123 |
|
|
124 |
if (p != null)
|
|
123 | 125 |
mp.addPolygon(p); |
124 | 126 |
try { |
125 |
p= new GeoPolygon3D(); |
|
127 |
p = new GeoPolygon3D();
|
|
126 | 128 |
} catch (NodeException e) { |
127 | 129 |
// TODO Auto-generated catch block |
128 | 130 |
e.printStackTrace(); |
129 | 131 |
} |
130 |
|
|
132 |
|
|
131 | 133 |
if (_coordinateSystemType == Terrain.CoordinateSystemType.PROJECTED) { |
132 |
p.addPoint(dataLine[0], |
|
133 |
dataLine[1],_height ); |
|
134 |
} |
|
135 |
else{ |
|
134 |
p.addPoint(dataLine[0], dataLine[1], _height); |
|
135 |
} else { |
|
136 | 136 |
_auxVect.set(dataLine[0], dataLine[1], _height); |
137 |
Vec3 converted = _terrain.convertLatLongHeightToXYZ(_auxVect); |
|
138 |
p.addPoint(converted.x(), converted.y(), converted.z()); |
|
137 |
Vec3 converted = _terrain |
|
138 |
.convertLatLongHeightToXYZ(_auxVect); |
|
139 |
p.addPoint(converted.x(), converted.y(), converted.z()); |
|
139 | 140 |
} |
140 |
// p.addPoint(dataLine[0], dataLine[1],10);
|
|
141 |
|
|
141 |
// p.addPoint(dataLine[0], dataLine[1],10);
|
|
142 |
|
|
142 | 143 |
break; |
143 | 144 |
|
144 | 145 |
case PathIterator.SEG_LINETO: |
145 | 146 |
// System.out.println("SEG_LINETO"); |
146 |
|
|
147 |
|
|
147 | 148 |
if (_coordinateSystemType == Terrain.CoordinateSystemType.PROJECTED) { |
148 |
p.addPoint(dataLine[0], |
|
149 |
dataLine[1],_height );
|
|
150 |
}else{
|
|
151 |
_auxVect.set(dataLine[0], dataLine[1], _height);
|
|
152 |
Vec3 converted = _terrain.convertLatLongHeightToXYZ(_auxVect);
|
|
153 |
p.addPoint(converted.x(), converted.y(), converted.z());
|
|
154 |
} |
|
149 |
p.addPoint(dataLine[0], dataLine[1], _height);
|
|
150 |
} else {
|
|
151 |
_auxVect.set(dataLine[0], dataLine[1], _height);
|
|
152 |
Vec3 converted = _terrain
|
|
153 |
.convertLatLongHeightToXYZ(_auxVect);
|
|
154 |
p.addPoint(converted.x(), converted.y(), converted.z());
|
|
155 |
}
|
|
155 | 156 |
break; |
156 | 157 |
|
157 | 158 |
case PathIterator.SEG_QUADTO: |
... | ... | |
166 | 167 |
// System.out.println("SEG_CLOSE"); |
167 | 168 |
break; |
168 | 169 |
} |
169 |
|
|
170 |
// contH++;
|
|
170 |
|
|
171 |
// contH++;
|
|
171 | 172 |
theIteratorL.next(); |
172 | 173 |
} |
173 |
|
|
174 |
if(p!=null)mp.addPolygon(p); |
|
175 |
// if(p!=null) |
|
176 |
// mp.addPolygon(p); |
|
177 |
if(mp!=null) |
|
178 |
_geometry.addMultiPolygon(mp); |
|
179 |
|
|
180 |
// if (c!=null && hasFill()) { |
|
181 |
// g.setColor(c);o |
|
182 |
// |
|
183 |
// |
|
184 |
// |
|
185 |
// g.fill(geom.getShape(affineTransform)); |
|
186 |
// } |
|
187 |
// Border color |
|
188 |
// if (getOutline() != null && hasOutline()) { |
|
189 |
// getOutline().draw(g, affineTransform, geom, f, cancel); |
|
190 |
// } |
|
191 | 174 |
|
192 |
|
|
175 |
if (p != null) |
|
176 |
mp.addPolygon(p); |
|
177 |
// if(p!=null) |
|
178 |
// mp.addPolygon(p); |
|
179 |
if (mp != null) |
|
180 |
_geometry.addMultiPolygon(mp); |
|
181 |
|
|
182 |
// if (c!=null && hasFill()) { |
|
183 |
// g.setColor(c);o |
|
184 |
// |
|
185 |
// |
|
186 |
// |
|
187 |
// g.fill(geom.getShape(affineTransform)); |
|
188 |
// } |
|
189 |
// Border color |
|
190 |
// if (getOutline() != null && hasOutline()) { |
|
191 |
// getOutline().draw(g, affineTransform, geom, f, cancel); |
|
192 |
// } |
|
193 |
|
|
193 | 194 |
} |
194 |
|
|
195 |
|
|
196 |
|
|
197 |
public GeoPolygonList3D getGeometry(){ |
|
195 |
|
|
196 |
public GeoPolygonList3D getGeometry() { |
|
198 | 197 |
return _geometry; |
199 | 198 |
} |
199 |
|
|
200 | 200 |
public int getSymbolType() { |
201 | 201 |
// TODO Auto-generated method stub |
202 | 202 |
return 0; |
... | ... | |
207 | 207 |
PrintAttributes properties) throws SymbolDrawingException { |
208 | 208 |
|
209 | 209 |
Rectangle rect = new Rectangle(r.x, r.y, r.width, r.height); |
210 |
rect.setFrame(((int) rect.getMinX())+1, ((int) rect.getMinY())+1, ((int) rect.getWidth())-2, ((int) rect.getHeight())-2); |
|
210 |
rect.setFrame(((int) rect.getMinX()) + 1, ((int) rect.getMinY()) + 1, |
|
211 |
((int) rect.getWidth()) - 2, ((int) rect.getHeight()) - 2); |
|
211 | 212 |
Geometry geom; |
212 | 213 |
try { |
213 |
geom = geomManager.createSurface(new GeneralPathX(rect.getPathIterator(null)), SUBTYPES.GEOM2D); |
|
214 |
geom = geomManager.createSurface( |
|
215 |
new GeneralPathX(rect.getPathIterator(null)), |
|
216 |
SUBTYPES.GEOM2D); |
|
214 | 217 |
} catch (CreateGeometryException e) { |
215 | 218 |
LOG.error("Creating a surface", e); |
216 | 219 |
throw new SymbolDrawingException(getSymbolType()); |
... | ... | |
222 | 225 |
g.fillRect(rect.x, rect.y, rect.width, rect.height); |
223 | 226 |
} |
224 | 227 |
// Border Polygons |
225 |
//
|
|
226 |
// if (getOutline() != null && hasOutline()) {
|
|
227 |
// if (properties==null)
|
|
228 |
// getOutline().draw(g, scaleInstance, geom, null, null);
|
|
229 |
// else
|
|
230 |
// print(g, new AffineTransform(), geom, properties);
|
|
231 |
// }
|
|
228 |
// |
|
229 |
// if (getOutline() != null && hasOutline()) {
|
|
230 |
// if (properties==null)
|
|
231 |
// getOutline().draw(g, scaleInstance, geom, null, null);
|
|
232 |
// else
|
|
233 |
// print(g, new AffineTransform(), geom, properties);
|
|
234 |
// }
|
|
232 | 235 |
|
233 | 236 |
} |
237 |
|
|
238 |
public void loadFromState(PersistentState state) |
|
239 |
throws PersistenceException { |
|
240 |
// Set parent fill symbol properties |
|
241 |
super.loadFromState(state); |
|
242 |
|
|
243 |
// // Set own properties |
|
244 |
// setStyle(state.getInt(FIELD_MARKERSTYLE)); |
|
245 |
// setOutlined(state.getBoolean(FIELD_OUTLINED)); |
|
246 |
// if (isOutlined()) { |
|
247 |
// setOutlineColor((Color) state.get(FIELD_OUTLINECOLOR)); |
|
248 |
// setOutlineSize(state.getDouble(FIELD_OUTLINESIZE)); |
|
249 |
// } |
|
250 |
} |
|
251 |
|
|
252 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
253 |
// Save parent fill symbol properties |
|
254 |
super.saveToState(state); |
|
255 |
|
|
256 |
// Save own properties |
|
257 |
// state.set(FIELD_MARKERSTYLE, getStyle()); |
|
258 |
// state.set(FIELD_OUTLINED, isOutlined()); |
|
259 |
// if (isOutlined()) { |
|
260 |
// state.set(FIELD_OUTLINECOLOR, getOutlineColor()); |
|
261 |
// state.set(FIELD_OUTLINESIZE, getOutlineSize()); |
|
262 |
// } |
|
263 |
} |
|
264 |
|
|
265 |
public static class RegisterPersistence implements Callable { |
|
266 |
|
|
267 |
public Object call() throws Exception { |
|
268 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
269 |
if (manager.getDefinition("Symbol") == null) { |
|
270 |
Caller caller = new DefaultCaller(); |
|
271 |
caller.add(new AbstractSymbol.RegisterPersistence()); |
|
272 |
caller.call(); |
|
273 |
} |
|
274 |
|
|
275 |
if (manager.getDefinition("SimpleFillSymbol") == null) { |
|
276 |
Caller caller = new DefaultCaller(); |
|
277 |
caller.add(new AbstractFillSymbol.RegisterPersistence()); |
|
278 |
caller.call(); |
|
279 |
} |
|
280 |
|
|
281 |
DynStruct definition = manager.addDefinition( |
|
282 |
SimpleFill3DSymbol.class, "SimpleFill3DSymbol", |
|
283 |
"SimpleFill3DSymbol Persistence definition", null, null); |
|
284 |
|
|
285 |
definition.extend(PersistenceManager.PERSISTENCE_NAMESPACE, |
|
286 |
"FillSymbol"); |
|
287 |
|
|
288 |
return Boolean.TRUE; |
|
289 |
} |
|
290 |
} |
|
291 |
|
|
234 | 292 |
public static class RegisterSymbol implements Callable { |
235 | 293 |
|
236 | 294 |
public Object call() throws Exception { |
237 | 295 |
int[] shapeTypes; |
238 | 296 |
SymbolManager manager = MapContextLocator.getSymbolManager(); |
239 | 297 |
|
240 |
shapeTypes = |
|
241 |
new int[] { Geometry.TYPES.SURFACE, Geometry.TYPES.MULTISURFACE}; |
|
242 |
manager.registerSymbol(ISimpleFill3DSymbol.SYMBOL_NAME, |
|
243 |
shapeTypes, |
|
244 |
SimpleFill3DSymbol.class,"project.document.view3d"); |
|
298 |
shapeTypes = new int[] { Geometry.TYPES.SURFACE, |
|
299 |
Geometry.TYPES.MULTISURFACE }; |
|
300 |
manager.registerSymbol(ISimpleFill3DSymbol.SYMBOL_NAME, shapeTypes, |
|
301 |
SimpleFill3DSymbol.class, "project.document.view3d"); |
|
245 | 302 |
|
246 | 303 |
return Boolean.TRUE; |
247 |
}
|
|
304 |
} |
|
248 | 305 |
} |
306 |
|
|
249 | 307 |
public void print(Graphics2D g, AffineTransform at, Geometry shape, |
250 | 308 |
PrintAttributes properties) { |
251 | 309 |
// TODO Auto-generated method stub |
... | ... | |
253 | 311 |
} |
254 | 312 |
|
255 | 313 |
public void setFixedHeight(float height) { |
256 |
_height=height;
|
|
257 |
|
|
314 |
_height = height;
|
|
315 |
|
|
258 | 316 |
} |
259 | 317 |
|
260 | 318 |
public void setCoordinateSystemType(int cst) { |
261 | 319 |
_coordinateSystemType = cst; |
262 |
|
|
320 |
|
|
263 | 321 |
} |
264 | 322 |
|
265 | 323 |
public Node getRenderNode() { |
... | ... | |
268 | 326 |
|
269 | 327 |
public void resetGeometry() { |
270 | 328 |
// TODO Implement dispose |
271 |
// _geometry.dispose();
|
|
329 |
// _geometry.dispose();
|
|
272 | 330 |
try { |
273 | 331 |
_geometry = new GeoPolygonList3D(); |
274 | 332 |
} catch (NodeException e) { |
275 | 333 |
// TODO Auto-generated catch block |
276 | 334 |
e.printStackTrace(); |
277 |
}
|
|
335 |
} |
|
278 | 336 |
} |
337 |
|
|
279 | 338 |
public boolean is3D() { |
280 | 339 |
// TODO Auto-generated method stub |
281 | 340 |
return true; |
282 | 341 |
} |
283 |
|
|
342 |
|
|
284 | 343 |
public void setGeometry(GeoPolygonList3D polygons) { |
285 | 344 |
|
286 | 345 |
this._geometry = polygons; |
2.0/trunk/org.gvsig.gvsig3d/org.gvsig.gvsig3d.lib/org.gvsig.gvsig3d.lib.impl/src/main/java/org/gvsig/gvsig3d/impl/Gvsig3DDefaultImplLibrary.java | ||
---|---|---|
25 | 25 |
import org.gvsig.gvsig3d.Gvsig3DLocator; |
26 | 26 |
import org.gvsig.gvsig3d.Gvsig3DManager; |
27 | 27 |
import org.gvsig.gvsig3d.impl.layers.FLayers3DImpl; |
28 |
import org.gvsig.gvsig3d.impl.legend3d.ExtrusionLegend; |
|
28 | 29 |
import org.gvsig.gvsig3d.impl.map3d.GraphicLayer3DImpl; |
29 | 30 |
import org.gvsig.gvsig3d.impl.map3d.Layer3DPropsImpl; |
30 | 31 |
import org.gvsig.gvsig3d.impl.map3d.MapContext3DImpl; |
31 | 32 |
import org.gvsig.gvsig3d.impl.map3d.MapControl3DImpl; |
32 | 33 |
import org.gvsig.gvsig3d.impl.map3d.Viewport3DImpl; |
34 |
import org.gvsig.gvsig3d.impl.symbology3d.extrusion.impl.ExtrusionPolygonSymbol; |
|
33 | 35 |
import org.gvsig.gvsig3d.impl.symbology3d.fill.impl.SimpleFill3DSymbol; |
34 | 36 |
import org.gvsig.gvsig3d.impl.symbology3d.line.impl.SimpleLine3DSymbol; |
35 | 37 |
import org.gvsig.gvsig3d.impl.symbology3d.marker.impl.NodeMarker3DSymbol; |
... | ... | |
87 | 89 |
caller.add(new SimpleMarker3DSymbol.RegisterPersistence()); |
88 | 90 |
caller.add(new PictureMarker3DSymbol.RegisterPersistence()); |
89 | 91 |
caller.add(new NodeMarker3DSymbol.RegisterPersistence()); |
92 |
caller.add(new SimpleFill3DSymbol.RegisterPersistence()); |
|
93 |
caller.add(new ExtrusionPolygonSymbol.RegisterPersistence()); |
|
94 |
caller.add(new ExtrusionLegend.RegisterPersistence()); |
|
90 | 95 |
|
91 | 96 |
|
92 | 97 |
/* |
2.0/trunk/org.gvsig.gvsig3d/org.gvsig.gvsig3d.lib/org.gvsig.gvsig3d.lib.impl/src/main/java/org/gvsig/gvsig3d/impl/map3d/MapContext3DImpl.java | ||
---|---|---|
1223 | 1223 |
// TODO Auto-generated catch block |
1224 | 1224 |
e.printStackTrace(); |
1225 | 1225 |
} catch (NullPointerException e) { |
1226 |
e.printStackTrace();
|
|
1226 |
System.out.println("NullPointer exception");
|
|
1227 | 1227 |
} |
1228 | 1228 |
|
1229 | 1229 |
} |
2.0/trunk/org.gvsig.gvsig3d/org.gvsig.gvsig3d.lib/org.gvsig.gvsig3d.lib.impl/src/main/java/org/gvsig/gvsig3d/impl/legend3d/ExtrusionLegend.java | ||
---|---|---|
1 | 1 |
package org.gvsig.gvsig3d.impl.legend3d; |
2 | 2 |
|
3 | 3 |
import java.awt.Color; |
4 |
import java.util.ArrayList; |
|
5 |
import java.util.List; |
|
6 |
import java.util.Map; |
|
4 | 7 |
|
5 | 8 |
import org.gvsig.fmap.dal.feature.Feature; |
6 | 9 |
import org.gvsig.fmap.mapcontext.MapContextException; |
... | ... | |
12 | 15 |
import org.gvsig.gvsig3d.impl.symbology3d.line.impl.SimpleLine3DSymbol; |
13 | 16 |
import org.gvsig.gvsig3d.impl.symbology3d.marker.impl.SimpleMarker3DSymbol; |
14 | 17 |
import org.gvsig.osgvp.terrain.Terrain; |
18 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractClassifiedVectorLegend; |
|
19 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractLegend; |
|
20 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractVectorialLegend; |
|
15 | 21 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.VectorialUniqueValueLegend; |
16 | 22 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IFillSymbol; |
17 | 23 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.impl.SimpleFillSymbol; |
24 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.AbstractSymbol; |
|
18 | 25 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol; |
19 | 26 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.SimpleLineSymbol; |
20 | 27 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.IMarkerSymbol; |
21 | 28 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.SimpleMarkerSymbol; |
29 |
import org.gvsig.tools.ToolsLocator; |
|
30 |
import org.gvsig.tools.dynobject.DynStruct; |
|
31 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
32 |
import org.gvsig.tools.persistence.PersistentState; |
|
33 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
34 |
import org.gvsig.tools.util.Callable; |
|
35 |
import org.gvsig.tools.util.Caller; |
|
36 |
import org.gvsig.tools.util.impl.DefaultCaller; |
|
22 | 37 |
|
23 | 38 |
import ucar.nc2.constants._Coordinate; |
24 | 39 |
|
... | ... | |
29 | 44 |
*/ |
30 | 45 |
public class ExtrusionLegend extends VectorialUniqueValueLegend { |
31 | 46 |
|
47 |
public static final String EXTRUSION_LEGEND_PERSISTENCE_DEFINITION_NAME = "ExtrusionLegend"; |
|
48 |
|
|
32 | 49 |
private ExtrusionPolygonSymbol defaultSymbolEx; |
33 | 50 |
private double extrusionFactor = 1.0; |
34 | 51 |
int shapeType = 0; |
35 | 52 |
int coordType = Terrain.CoordinateSystemType.PROJECTED; |
36 | 53 |
|
54 |
public ExtrusionLegend(){ |
|
55 |
super(9); |
|
56 |
this.shapeType = 9; |
|
57 |
} |
|
58 |
|
|
59 |
|
|
37 | 60 |
public ExtrusionLegend(int shapeType) { |
38 | 61 |
super(shapeType); |
39 | 62 |
this.shapeType = shapeType; |
... | ... | |
98 | 121 |
|
99 | 122 |
} |
100 | 123 |
|
124 |
@SuppressWarnings({ "unchecked", "rawtypes" }) |
|
125 |
public void loadFromState(PersistentState state) |
|
126 |
throws PersistenceException { |
|
127 |
// Set parent properties |
|
128 |
super.loadFromState(state); |
|
129 |
// // Set own properties |
|
130 |
// keys = new ArrayList<Object>((List) state.get(FIELD_KEYS)); |
|
131 |
// nullValueSymbol = (ISymbol) state.get(FIELD_NULL_VALUE_SYMBOL); |
|
132 |
// selectedColors = |
|
133 |
// (Color[]) state.getArray(FIELD_SELECTED_COLORS, Color.class); |
|
134 |
// Map persistedSymbolMap = (Map) state.get(FIELD_SYMBOLS); |
|
135 |
// if (persistedSymbolMap != null) { |
|
136 |
// symbols.putAll(persistedSymbolMap); |
|
137 |
// } |
|
138 |
// useDefaultSymbol(state.getBoolean(FIELD_USE_DEFAULT_SYMBOL)); |
|
139 |
} |
|
140 |
|
|
141 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
142 |
// Save parent properties |
|
143 |
super.saveToState(state); |
|
144 |
// Save own properties |
|
145 |
// state.set(FIELD_KEYS, keys); |
|
146 |
// state.set(FIELD_NULL_VALUE_SYMBOL, nullValueSymbol); |
|
147 |
// state.set(FIELD_SELECTED_COLORS, selectedColors); |
|
148 |
// state.set(FIELD_USE_DEFAULT_SYMBOL, isUseDefaultSymbol()); |
|
149 |
// state.set(FIELD_SYMBOLS, symbols); |
|
150 |
} |
|
151 |
|
|
152 |
public static class RegisterPersistence implements Callable { |
|
153 |
|
|
154 |
public Object call() throws Exception { |
|
155 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
156 |
|
|
157 |
if (manager.getDefinition("Legend") == null) { |
|
158 |
Caller caller = new DefaultCaller(); |
|
159 |
caller.add(new AbstractLegend.RegisterPersistence()); |
|
160 |
caller.call(); |
|
161 |
} |
|
162 |
|
|
163 |
if (manager.getDefinition("VectorialLegend") == null) { |
|
164 |
Caller caller = new DefaultCaller(); |
|
165 |
caller.add(new AbstractVectorialLegend.RegisterPersistence()); |
|
166 |
caller.call(); |
|
167 |
} |
|
168 |
|
|
169 |
|
|
170 |
if (manager.getDefinition("ClassifiedVectorLegend") == null) { |
|
171 |
Caller caller = new DefaultCaller(); |
|
172 |
caller.add(new AbstractClassifiedVectorLegend.RegisterPersistence()); |
|
173 |
caller.call(); |
|
174 |
} |
|
175 |
|
|
176 |
if (manager.getDefinition("VectorialUniqueValueLegend") == null) { |
|
177 |
Caller caller = new DefaultCaller(); |
|
178 |
caller.add(new VectorialUniqueValueLegend.RegisterPersistence()); |
|
179 |
caller.call(); |
|
180 |
} |
|
181 |
|
|
182 |
if (manager |
|
183 |
.getDefinition(EXTRUSION_LEGEND_PERSISTENCE_DEFINITION_NAME) == null) { |
|
184 |
DynStruct definition = manager.addDefinition( |
|
185 |
ExtrusionLegend.class, |
|
186 |
EXTRUSION_LEGEND_PERSISTENCE_DEFINITION_NAME, |
|
187 |
EXTRUSION_LEGEND_PERSISTENCE_DEFINITION_NAME |
|
188 |
+ " Persistence definition", null, null); |
|
189 |
// Extend the Classified Vector Legend base definition |
|
190 |
definition |
|
191 |
.extend(manager |
|
192 |
.getDefinition(VECTORIAL_UNIQUE_VALUE_LEGEND_PERSISTENCE_DEFINITION_NAME)); |
|
193 |
|
|
194 |
// // Keys |
|
195 |
// definition.addDynFieldList(FIELD_KEYS).setClassOfItems(Object.class); |
|
196 |
// // Null interval symbol |
|
197 |
// definition.addDynFieldObject(FIELD_NULL_VALUE_SYMBOL).setClassOfValue(ISymbol.class); |
|
198 |
// // Selected colors |
|
199 |
// definition.addDynFieldList(FIELD_SELECTED_COLORS).setClassOfItems(Color.class); |
|
200 |
// // Symbols |
|
201 |
// definition.addDynFieldMap(FIELD_SYMBOLS).setClassOfItems(ISymbol.class); |
|
202 |
// // Use default symbol? |
|
203 |
// definition.addDynFieldBoolean(FIELD_USE_DEFAULT_SYMBOL); |
|
204 |
} |
|
205 |
return Boolean.TRUE; |
|
206 |
} |
|
207 |
|
|
208 |
} |
|
209 |
|
|
101 | 210 |
} |
Also available in: Unified diff