Revision 15050

View differences:

import/ext3D/trunk/ext3D/src/com/iver/ai2/gvsig3d/cacheservices/VectorCacheService.java
1 1
package com.iver.ai2.gvsig3d.cacheservices;
2 2

  
3
import java.awt.BasicStroke;
3 4
import java.awt.Color;
4 5
import java.awt.Shape;
5 6
import java.awt.geom.PathIterator;
6 7
import java.awt.geom.Rectangle2D;
7 8
import java.util.ArrayList;
8
import java.util.Iterator;
9 9
import java.util.List;
10 10

  
11 11
import org.cresques.cts.ICoordTrans;
......
19 19
import com.hardcode.gdbms.engine.values.Value;
20 20
import com.iver.ai2.gvsig3d.gui.VectorTest;
21 21
import com.iver.cit.gvsig.fmap.DriverException;
22
import com.iver.cit.gvsig.fmap.core.FGeometry;
23
import com.iver.cit.gvsig.fmap.core.FMultipoint3D;
24
import com.iver.cit.gvsig.fmap.core.FPoint3D;
25
import com.iver.cit.gvsig.fmap.core.FPolyline3D;
22 26
import com.iver.cit.gvsig.fmap.core.FShape;
23 27
import com.iver.cit.gvsig.fmap.core.IGeometry;
28
import com.iver.cit.gvsig.fmap.core.IGeometry3D;
24 29
import com.iver.cit.gvsig.fmap.core.ISymbol;
25 30
import com.iver.cit.gvsig.fmap.core.v02.FLabel;
26 31
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
27 32
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes;
28 33
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
29 34
import com.iver.cit.gvsig.fmap.layers.FLayer;
30
import com.iver.cit.gvsig.fmap.layers.FLyrText;
31 35
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
32 36
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial;
33 37
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
......
183 187
		// Setting up geometri
184 188
		startGeometry(geomType, symbol);
185 189

  
190
		System.out.println("Tipo de simbolo : " + geomType);
191

  
186 192
		// Getting symbol
187 193
		FSymbol fsym = (FSymbol) symbol;
188 194

  
195
		FGeometry g3D = null;
196
		if (g instanceof FGeometry) {
197
			g3D = (FGeometry) g;
198
//			Shape x = g3D.getInternalShape();
199
//			if ((x instanceof FPolyline3D) || (x instanceof FPoint3D)) {
200
//				double[] Z = g3D.getZs();
201
//				System.out.println("TAMA?O DEL VECTOR Z : " + Z.length);
202
//			}
203
		}
204

  
189 205
		// Getting simbol parameters
190 206
		Color color = fsym.getColor();
207
		// Point size
191 208
		int size = fsym.getSize();
209
		// Line Size
210
		float lineSize = 0;
211
		if ((BasicStroke) fsym.getStroke() != null)
212
			lineSize = ((BasicStroke) fsym.getStroke()).getLineWidth();
192 213
		float comp[] = new float[4];
193 214
		color.getColorComponents(comp);
194 215
		Vec4 rgba = new Vec4(comp[0], comp[1], comp[2], comp[3]);
195 216

  
196
		Shape shp = g.getInternalShape();
197

  
217
		// FShape3D shp = (FShape3D) g.getInternalShape();
218
		//
219
		// if (g.getInternalShape() instanceof FShape3D) {
220
		// FShape3D shp3D = (FShape3D) g.getInternalShape();
221
		//			
222
		// }
198 223
		// Setting up heigth of feature
199 224
		double heigth = 30000;
200 225

  
......
204 229
		double[] dataLine = new double[6];
205 230
		List posi = new ArrayList();
206 231

  
232
		int contH = 0;
207 233
		while (!theIteratorL.isDone()) {
208 234
			int type = theIteratorL.currentSegment(dataLine);
209 235

  
210
			// Transform to geodesical coordinates
211
			Vec3 posGeo = new Vec3(dataLine[1], dataLine[0], heigth);
212
			Vec3 pos = _planet.convertLatLongHeightToXYZ(posGeo);
213
			// System.out.println("Position: " + posL.x() + " " + posL.y()
214
			// + " " + posL.z());
236
			Vec3 posGeo = null;
237
			Vec3 pos = null;
238
			double h = 0;
239
			if ((_currentGeomType & FShape.Z) == FShape.Z) {
240
				if (g3D != null) {
241
//					h = (g3D.getZs()[contH])
242
//							* _planet.getVerticalExaggeration();
243
					h = (g3D.getZs()[contH]) * 30 ;
244
				}
245
//				geomType = _currentGeomType - FShape.Z;
246
			} else {
247
				h = heigth;
248
			}
215 249

  
250
//			System.out.println("Tipo de simbolo : " + geomType);
251

  
252
			if (this._planet.getType() == PlanetType.SPHERICAL_MODE) {
253
				// Transform to geodesical coordinates
254
				// posGeo = new Vec3(dataLine[1], dataLine[0], heigth);
255
				posGeo = new Vec3(dataLine[1], dataLine[0], h);
256
				pos = _planet.convertLatLongHeightToXYZ(posGeo);
257
			} else {
258
				pos = new Vec3(dataLine[0], dataLine[1], h);
259
			}
260
			// System.out.println("Position: " + posGeo.x() + " " + posGeo.y()
261
			// + " " + posGeo.z());
262
			// System.out.println("Position: " + pos.x() + " " + pos.y()
263
			// + " " + pos.z());
264

  
216 265
			// Adding points
217 266
			switch (type) {
218 267
			case PathIterator.SEG_MOVETO:
219 268
				Node node = _currentNode;
220
				switch (geomType) {
221
				case FShape.POINT:
269
				
270
				if ((geomType & FShape.POINT) == FShape.POINT) {
222 271
					VectorTest.addNodeToPoint(node, pos, rgba, size);
223
					break;
224
				case FShape.LINE:
225
					node = VectorTest.insertLine(posi, rgba);
226
					break;
227
				case FShape.POLYGON:
272
				}else if ((geomType & FShape.LINE) == FShape.LINE) {
273
					node = VectorTest.insertLine(posi, rgba, lineSize);
274
				} if ((geomType & FShape.POLYGON) == FShape.POLYGON) {
228 275
					node = VectorTest.insertPolygon(posi, rgba);
229
					break;
230 276
				}
277
				
278
//				switch (geomType) {
279
//				case FShape.POINT:
280
//					VectorTest.addNodeToPoint(node, pos, rgba, size);
281
//					break;
282
//				case FShape.LINE:
283
//					node = VectorTest.insertLine(posi, rgba, lineSize);
284
//					break;
285
//				case FShape.POLYGON:
286
//					node = VectorTest.insertPolygon(posi, rgba);
287
//					break;
288
//				}
231 289

  
232
				if (geomType != FShape.POINT) {
290
//				if (geomType != FShape.POINT) {
291
				if ((geomType & FShape.POINT) != FShape.POINT) {
233 292

  
234 293
					if (node != null) {
235 294
						_layerNode.addChild(node);
......
257 316
				// System.out.println("SEG_CLOSE");
258 317
				break;
259 318
			}
319
			contH++;
260 320
			theIteratorL.next();
261 321
		}
322
//		System.out.println("Numero de puntos: " + contH);
262 323

  
263 324
		// Adding last symbol
264 325
		Node node = _currentNode;
265
		switch (geomType) {
266
		case FShape.POINT:
326
		if ((geomType & FShape.POINT) == FShape.POINT) {
267 327
			node = VectorTest.insertPoints(posi, rgba, size);
268
			break;
269
		case FShape.LINE:
270
			node = VectorTest.insertLine(posi, rgba);
271
			break;
272
		case FShape.POLYGON:
328
		}else if ((geomType & FShape.LINE) == FShape.LINE) {
329
			node = VectorTest.insertLine(posi, rgba, lineSize);
330
		} if ((geomType & FShape.POLYGON) == FShape.POLYGON) {
273 331
			node = VectorTest.insertPolygon(posi, rgba);
274
			break;
275 332
		}
333
//		switch (geomType) {
334
//		case FShape.POINT:
335
//			node = VectorTest.insertPoints(posi, rgba, size);
336
//			break;
337
//		case FShape.LINE:
338
//			node = VectorTest.insertLine(posi, rgba, lineSize);
339
//			break;
340
//		case FShape.POLYGON:
341
//			node = VectorTest.insertPolygon(posi, rgba);
342
//			break;
343
//		}
276 344
		if (geomType != FShape.POINT)
277 345
			if (node != null)
278 346
				_layerNode.addChild(node);
......
287 355

  
288 356
		if (geomType != _currentGeomType) {
289 357
			_currentGeomType = geomType;
358

  
359
			if ((geomType & FShape.Z) == FShape.Z)
360
				geomType = geomType - FShape.Z;
290 361
			switch (geomType) {
291 362

  
292 363
			case FShape.POINT:

Also available in: Unified diff