Revision 2126

View differences:

branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/LegendFactory.java
95 95
			case FShape.POLYGON:
96 96
				return new SingleSymbolLegend(new FSymbol(
97 97
						FConstant.SYMBOL_TYPE_FILL));
98
			case FShape.MULTI:
99
				return new SingleSymbolLegend(new FSymbol(
100
						FConstant.SYMBOL_TYPE_POINT));
98 101
		}
99 102

  
100 103
		return new SingleSymbolLegend(new FSymbol(FConstant.SYMBOL_TYPE_FILL));
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/shp/SHP.java
163 163
		DBFFromGeometries dfg=new DBFFromGeometries(fgs,f);
164 164
		dfg.create(sds,bitset);
165 165
	}
166
	public static double[] getZMinMax(double[] zs){
167
		if (zs==null)return null;
168
		double min=Double.MAX_VALUE;
169
		double max=Double.MIN_VALUE;
170
		for (int i=0;i<zs.length;i++){
171
			if (zs[i]>max)max=zs[i];
172
			if (zs[i]<min)min=zs[i];
173
		}
174
		return new double[]{min,max};
175
	}
166 176
}
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/shp/write/SHPShape.java
40 40
 */
41 41
package com.iver.cit.gvsig.fmap.drivers.shp.write;
42 42

  
43
import com.iver.cit.gvsig.fmap.core.GeneralPathXIterator;
44 43
import com.iver.cit.gvsig.fmap.core.IGeometry;
45 44

  
46 45
import java.nio.ByteBuffer;
......
92 91
	 *
93 92
	 * @param iter 
94 93
	 */
95
	public void obtainsPoints(GeneralPathXIterator iter);
94
	public void obtainsPoints(IGeometry g);
96 95
}
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/shp/write/SHPMultiLine.java
40 40
 */
41 41
package com.iver.cit.gvsig.fmap.drivers.shp.write;
42 42

  
43
import java.awt.geom.PathIterator;
44
import java.awt.geom.Rectangle2D;
45
import java.nio.ByteBuffer;
46
import java.nio.MappedByteBuffer;
47
import java.util.ArrayList;
48

  
43 49
import com.iver.cit.gvsig.fmap.core.FPoint2D;
44 50
import com.iver.cit.gvsig.fmap.core.FPolyline2D;
45 51
import com.iver.cit.gvsig.fmap.core.GeneralPathX;
46 52
import com.iver.cit.gvsig.fmap.core.GeneralPathXIterator;
47 53
import com.iver.cit.gvsig.fmap.core.IGeometry;
54
import com.iver.cit.gvsig.fmap.core.IGeometry3D;
48 55
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
56
import com.iver.cit.gvsig.fmap.drivers.shp.SHP;
49 57

  
50
import java.awt.geom.PathIterator;
51
import java.awt.geom.Rectangle2D;
52 58

  
53
import java.nio.ByteBuffer;
54
import java.nio.MappedByteBuffer;
55

  
56
import java.util.ArrayList;
57

  
58

  
59 59
/**
60 60
 * Elemento shape de tipo multil?nea.
61 61
 *
......
65 65
	private int m_type;
66 66
	protected int[] parts;
67 67
	protected FPoint2D[] points;
68
	protected double[] zs;
68 69

  
69 70
	/**
70 71
	 * Crea un nuevo SHPMultiLine.
......
138 139
	 * @see com.iver.cit.gvsig.fmap.shp.SHPShape#write(ByteBuffer, IGeometry)
139 140
	 */
140 141
	public void write(ByteBuffer buffer, IGeometry geometry) {
141
		//FPolyline2D polyLine = (FPolyline2D) geometry.getShape();
142 142
		Rectangle2D rec = geometry.getBounds2D();
143 143
		buffer.putDouble(rec.getMinX());
144 144
		buffer.putDouble(rec.getMinY());
145 145
		buffer.putDouble(rec.getMaxX());
146 146
		buffer.putDouble(rec.getMaxY());
147
		///obtainsPoints(geometry.getGeneralPathXIterator());
148

  
149
		//int[] parts=polyLine.getParts();
150
		//FPoint2D[] points=polyLine.getPoints();
151 147
		int numParts = parts.length;
152 148
		int npoints = points.length;
153

  
154
		//int numParts = polyLine.getNumParts();
155 149
		buffer.putInt(numParts);
156

  
157
		///int npoints = polyLine.getNumPoints();
158 150
		buffer.putInt(npoints);
159 151

  
160
		//Aqu? es posible que falle algo referente a Parts
161 152
		for (int i = 0; i < numParts; i++) {
162
			///buffer.putInt(polyLine.getPart(i));
163 153
			buffer.putInt(parts[i]);
164 154
		}
165 155

  
166
		/// FPoint2D[] points = polyLine.getPoints();
167 156
		for (int t = 0; t < npoints; t++) {
168 157
			buffer.putDouble(points[t].getX());
169 158
			buffer.putDouble(points[t].getY());
170 159
		}
171 160

  
172
		/*  if (m_type == FConstant.SHAPE_TYPE_POLYLINEZ) {
173
		   double[] zExtreame = JTSUtilities.zMinMax(points);
161
		  if (m_type == FConstant.SHAPE_TYPE_POLYLINEZ) {
162
		   double[] zExtreame = SHP.getZMinMax(zs);
174 163
		   if (Double.isNaN(zExtreame[0])) {
175 164
		       buffer.putDouble(0.0);
176 165
		       buffer.putDouble(0.0);
......
179 168
		       buffer.putDouble(zExtreame[1]);
180 169
		   }
181 170
		   for (int t = 0; t < npoints; t++) {
182
		       double z = points[t].z;
171
		       double z = zs[t];
183 172
		       if (Double.isNaN(z)) {
184 173
		           buffer.putDouble(0.0);
185 174
		       } else {
186 175
		           buffer.putDouble(z);
187 176
		       }
188 177
		   }
178
		  
189 179
		   }
190 180
		   if (m_type == FConstant.SHAPE_TYPE_POLYLINEM) {
191 181
		       buffer.putDouble(-10E40);
......
194 184
		           buffer.putDouble(-10E40);
195 185
		       }
196 186
		   }
197
		 */
187
		 
198 188
	}
199 189

  
200 190
	/**
201 191
	 * @see com.iver.cit.gvsig.fmap.shp.SHPShape#getLength(int)
202 192
	 */
203 193
	public int getLength(IGeometry fgeometry) {
204
		///FPolyline2D multi = (FPolyline2D) fgeometry.getShape();
205 194
		int numlines;
206 195
		int numpoints;
207 196
		int length;
208 197

  
209
		///obtainsPoints(fgeometry.getGeneralPathXIterator());
210

  
211
		//int[] parts=multi.getParts();
212
		//FPoint2D[] points=multi.getPoints();
213 198
		numlines = parts.length;
214 199
		numpoints = points.length;
215

  
216
		//numlines = multi.getNumParts();
217
		//numpoints = multi.getNumPoints();
218 200
		if (m_type == FConstant.SHAPE_TYPE_POLYLINE) {
219 201
			length = 44 + (4 * numlines) + (numpoints * 16);
220 202
		} else if (m_type == FConstant.SHAPE_TYPE_POLYLINEM) {
221 203
			length = 44 + (4 * numlines) + (numpoints * 16) + 8 + 8 +
222 204
				(8 * numpoints);
223 205
		} else if (m_type == FConstant.SHAPE_TYPE_POLYLINEZ) {
224
			length = 44 + (4 * numlines) + (numpoints * 16) + 8 + 8 +
225
				(8 * numpoints) + 8 + 8 + (8 * numpoints);
206
			length = 44 + (4 * numlines) + (numpoints * 16) +
207
				(8 * numpoints) + 8 + 8;
226 208
		} else {
227 209
			throw new IllegalStateException("Expected ShapeType of Arc, got " +
228 210
				m_type);
......
262 244
	/**
263 245
	 * @see com.iver.cit.gvsig.fmap.shp.SHPShape#obtainsPoints(com.iver.cit.gvsig.fmap.core.GeneralPathXIterator)
264 246
	 */
265
	public void obtainsPoints(GeneralPathXIterator iter) {
247
	public void obtainsPoints(IGeometry g) {
248
		if (FConstant.SHAPE_TYPE_POLYLINEZ == m_type || FConstant.SHAPE_TYPE_POLYGONZ == m_type){
249
			zs=((IGeometry3D)g).getZs();
250
		}
266 251
		ArrayList arrayPoints = null;
267 252
		ArrayList arrayParts = new ArrayList();
268
		GeneralPathXIterator theIterator = iter; //polyLine.getPathIterator(null, flatness);
253
		GeneralPathXIterator theIterator = g.getGeneralPathXIterator(); //polyLine.getPathIterator(null, flatness);
269 254
		double[] theData = new double[6];
270 255
		int numParts = 0;
271 256
		while (!theIterator.isDone()) {
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/shp/write/SHPMultiPoint.java
42 42

  
43 43
import com.iver.cit.gvsig.fmap.core.FMultiPoint2D;
44 44
import com.iver.cit.gvsig.fmap.core.FPoint2D;
45
import com.iver.cit.gvsig.fmap.core.GeneralPathXIterator;
46 45
import com.iver.cit.gvsig.fmap.core.IGeometry;
47 46
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
48 47

  
......
205 204
	/**
206 205
	 * @see com.iver.cit.gvsig.fmap.drivers.shp.write.SHPShape#obtainsPoints(com.iver.cit.gvsig.fmap.core.GeneralPathXIterator)
207 206
	 */
208
	public void obtainsPoints(GeneralPathXIterator iter) {
207
	public void obtainsPoints(IGeometry g) {
209 208
	}
210 209
}
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/shp/write/SHPPolygon.java
44 44
import com.iver.cit.gvsig.fmap.core.FPolygon2D;
45 45
import com.iver.cit.gvsig.fmap.core.IGeometry;
46 46
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
47
import com.iver.cit.gvsig.fmap.drivers.shp.SHP;
47 48

  
48 49
import java.awt.geom.Rectangle2D;
49 50

  
......
205 206
			buffer.putDouble(points[t].getY());
206 207
		}
207 208

  
208
		/*   if (m_type == FConstant.SHAPE_TYPE_POLYGONZ) {
209
		   double[] zExtreame = JTSUtilities.zMinMax(points);
209
		   if (m_type == FConstant.SHAPE_TYPE_POLYGONZ) {
210
		   double[] zExtreame = SHP.getZMinMax(zs);
210 211
		   if (Double.isNaN(zExtreame[0])) {
211 212
		       buffer.putDouble(0.0);
212 213
		       buffer.putDouble(0.0);
......
215 216
		       buffer.putDouble(zExtreame[1]);
216 217
		   }
217 218
		   for (int t = 0; t < npoints; t++) {
218
		       double z = points[t].z;
219
		       double z = zs[t];
219 220
		       if (Double.isNaN(z)) {
220 221
		           buffer.putDouble(0.0);
221 222
		       } else {
......
223 224
		       }
224 225
		   }
225 226
		   }
226
		 */
227
		 
227 228
		if ((m_type == FConstant.SHAPE_TYPE_POLYGONM) ||
228 229
				(m_type == FConstant.SHAPE_TYPE_POLYGONZ)) {
229 230
			buffer.putDouble(-10E40);
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/shp/write/SHPPoint.java
43 43
import com.iver.cit.gvsig.fmap.core.FPoint2D;
44 44
import com.iver.cit.gvsig.fmap.core.GeneralPathXIterator;
45 45
import com.iver.cit.gvsig.fmap.core.IGeometry;
46
import com.iver.cit.gvsig.fmap.core.IGeometry3D;
46 47
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
47 48

  
48 49
import java.nio.ByteBuffer;
......
57 58
public class SHPPoint implements SHPShape {
58 59
	private int m_type;
59 60
	private FPoint2D point;
61
	private double z;
60 62

  
61 63
	/**
62 64
	 * Crea un nuevo SHPPoint.
......
117 119
		buffer.putDouble(point.getX());
118 120
		buffer.putDouble(point.getY());
119 121

  
120
		/*  if (m_type == FConstant.SHAPE_TYPE_POINTZ) {
121
		   if (Double.isNaN(p2d.getZ())) { // nan means not defined
122
		  if (m_type == FConstant.SHAPE_TYPE_POINTZ) {
123
		   if (Double.isNaN(z)) { // nan means not defined
122 124
		       buffer.putDouble(0.0);
123 125
		   } else {
124
		       buffer.putDouble(p2d.getZ());
126
		       buffer.putDouble(z);
125 127
		   }
126 128
		   }
127 129
		   if ((m_type == FConstant.SHAPE_TYPE_POINTZ) ||
128 130
		           (m_type == FConstant.SHAPE_TYPE_POINTM)) {
129 131
		       buffer.putDouble(-10E40); //M
130 132
		   }
131
		 */
133
		 
132 134
	}
133 135

  
134 136
	/**
......
154 156
	/**
155 157
	 * @see com.iver.cit.gvsig.fmap.drivers.shp.write.SHPShape#obtainsPoints(com.iver.cit.gvsig.fmap.core.GeneralPathXIterator)
156 158
	 */
157
	public void obtainsPoints(GeneralPathXIterator iter) {
158
		GeneralPathXIterator theIterator = iter; //polyLine.getPathIterator(null, flatness);
159
	public void obtainsPoints(IGeometry g) {
160
		if (FConstant.SHAPE_TYPE_POINTZ == m_type){
161
			z=((IGeometry3D)g).getZs()[0];
162
		}
163
		GeneralPathXIterator theIterator = g.getGeneralPathXIterator(); //polyLine.getPathIterator(null, flatness);
159 164
		double[] theData = new double[6];
160 165

  
161 166
		while (!theIterator.isDone()) {
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/shp/write/SHPFileWrite.java
185 185

  
186 186
		for (int i = geometries.length - 1; i >= 0; i--) {
187 187
			IGeometry fgeometry = geometries[i];
188
			m_shape.obtainsPoints(fgeometry.getGeneralPathXIterator());
188
			m_shape.obtainsPoints(fgeometry);
189 189
			int size = m_shape.getLength(fgeometry) + 8;
190 190
			fileLength += size;
191 191

  
......
256 256
		}
257 257

  
258 258
		m_pos = m_bb.position();
259
		m_shape.obtainsPoints(g.getGeneralPathXIterator());
259
		m_shape.obtainsPoints(g);
260 260
		int length = m_shape.getLength(g);
261 261

  
262 262
		// must allocate enough for shape + header (2 ints)
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/shp/DemoSHPDriver.java
449 449
				}
450 450

  
451 451
				return ShapeFactory.createPolyline3D(elShape, pZ);
452
			case (SHP.POLYGON3D):
453
			bb.position(bb.position() + 32);
454
			numParts = bb.getInt();
455
			numPoints = bb.getInt();
456
			elShape = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD, numPoints);
457
			tempParts = new int[numParts];
452 458

  
459
			for (i = 0; i < numParts; i++) {
460
				tempParts[i] = bb.getInt();
461
			}
462

  
463
			j = 0;
464

  
465
			for (i = 0; i < numPoints; i++) {
466
				p = readPoint(bb);
467

  
468
				if (i == tempParts[j]) {
469
					elShape.moveTo(p.x, p.y);
470

  
471
					if (j < (numParts - 1)) {
472
						j++;
473
					}
474
				} else {
475
					elShape.lineTo(p.x, p.y);
476
				}
477
			}
478

  
479
			double[] boxpoZ = new double[2];
480
			boxpoZ[0] = bb.getDouble();
481
			boxpoZ[1] = bb.getDouble();
482

  
483
			double[] poZ = new double[numPoints];
484

  
485
			for (i = 0; i < numPoints; i++) {
486
				poZ[i] = bb.getDouble();
487
			}
488

  
489
			return ShapeFactory.createPolygon3D(elShape, poZ);
490
			
453 491
			case (SHP.MULTIPOINT2D):
454 492
				bb.position(bb.position() + 32);
455 493
				numPoints = bb.getInt();
......
499 537

  
500 538
		switch (type) {
501 539
			case (SHP.POINT2D):
540
			case (SHP.POINT3D):
502 541
				auxType = auxType | FShape.POINT;
503 542

  
504 543
				break;
505 544

  
506 545
			case (SHP.POLYLINE2D):
546
			case (SHP.POLYLINE3D):
507 547
				auxType = auxType | FShape.LINE;
508 548

  
509 549
				break;
510 550

  
511 551
			case (SHP.POLYGON2D):
552
			case (SHP.POLYGON3D):
512 553
				auxType = auxType | FShape.POLYGON;
513 554

  
514 555
				break;
515

  
516
			case (SHP.POINT3D):
517
				auxType = auxType | FShape.POINT;
518

  
519
				break;
520

  
521
			case (SHP.POLYLINE3D):
522
				auxType = auxType | FShape.LINE;
523

  
524
				break;
525

  
526 556
			case (SHP.MULTIPOINT2D):
527
				auxType = auxType | FShape.MULTI;
528

  
529
				break;
530

  
531 557
			case (SHP.MULTIPOINT3D):
532 558
				auxType = auxType | FShape.MULTI;
533 559

  
......
537 563
		return auxType;
538 564
	}
539 565

  
566

  
540 567
	/**
541 568
	 * @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#initialize()
542 569
	 */
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/shp/SHPSHXFromGeometries.java
167 167
	 * @return DOCUMENT ME!
168 168
	 */
169 169
	private int getTypeShape(int geometryType) {
170
	if (geometryType>=FShape.Z){
171
		switch (geometryType - FShape.Z) {
172
		case (FShape.POINT):
173
			return FConstant.SHAPE_TYPE_POINTZ;
174

  
175
		case (FShape.LINE):
176
			return FConstant.SHAPE_TYPE_POLYLINEZ;
177

  
178
		case FShape.POLYGON:
179
			return FConstant.SHAPE_TYPE_POLYGONZ;
180

  
181
		case FShape.MULTI:
182
			return FConstant.SHAPE_TYPE_MULTIPOINTZ; //TODO falta aclarar cosas aqu?.
183
	}
184

  
185
	}else{
170 186
		switch (geometryType) {
171 187
			case FShape.POINT:
172 188
				return FConstant.SHAPE_TYPE_POINT;
......
178 194
				return FConstant.SHAPE_TYPE_POLYGON;
179 195

  
180 196
			case FShape.MULTI:
181
				return 0; //TODO falta aclarar cosas aqu?.
197
				return FConstant.SHAPE_TYPE_MULTIPOINT; //TODO falta aclarar cosas aqu?.
182 198
		}
183

  
199
	}
184 200
		return FConstant.SHAPE_TYPE_NULL;
185 201
	}
186 202
}
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/IGeometry3D.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.fmap.core;
42

  
43
/**
44
 * Interfaz necesaria para aportar los valores de Z en el caso de que las
45
 * geometr?as contenidas sean en 3D.
46
 *
47
 * @author Vicente Caballero Navarro
48
 */
49
public interface IGeometry3D extends IGeometry{
50
	/**
51
	 * Devuelve un array con el valor de todas las Zs.
52
	 */
53
	double[] getZs();
54
}
0 55

  
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FShape3D.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.fmap.core;
42

  
43
/**
44
 * Interfaz que a?ade el m?todo para devolver el valor de las Zs.
45
 *
46
 * @author Vicente Caballero Navarro
47
 */
48
public interface FShape3D extends FShape {
49
	/**
50
	 * Devuelve un array con el valor de las Zs.
51
	 *
52
	 * @return Array con las Zs.
53
	 */
54
	double[] getZs();
55
}
0 56

  
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FMultiPoint2D.java
41 41
package com.iver.cit.gvsig.fmap.core;
42 42

  
43 43
import com.iver.cit.gvsig.fmap.ViewPort;
44
import com.iver.cit.gvsig.fmap.core.v02.FGraphicUtilities;
44 45
import com.iver.cit.gvsig.fmap.core.v02.FLabel;
45 46
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
46 47
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D;
......
118 119
	 * @see com.iver.cit.gvsig.fmap.core.IGeometry#intersects(java.awt.geom.Rectangle2D)
119 120
	 */
120 121
	public boolean intersects(Rectangle2D r) {
121
		// TODO Auto-generated method stub
122
		for (int i=0;i<getNumPoints();i++){
123
			if (r.contains(x[i],y[i]))return true;
124
		}
122 125
		return false;
123 126
	}
124 127

  
......
126 129
	 * @see com.iver.cit.gvsig.fmap.core.IGeometry#getBounds2D()
127 130
	 */
128 131
	public Rectangle2D getBounds2D() {
129
		// TODO Auto-generated method stub
130
		return null;
132
		Rectangle2D r=null;
133
		if (getNumPoints()>0){
134
			r=new Rectangle2D.Double(x[0],y[0],0.001,0.001);
135
		}
136
		for (int i=1;i<getNumPoints();i++){
137
			r.add(x[i],y[i]);
138
		}
139
		return r;
131 140
	}
132 141

  
133 142
	/**
134 143
	 * @see com.iver.cit.gvsig.fmap.core.IGeometry#getGeometryType()
135 144
	 */
136 145
	public int getGeometryType() {
137
		return FShape.POINT;
146
		return FShape.MULTIPOINT;
138 147
	}
139 148

  
140 149
	/* (non-Javadoc)
......
148 157
			java.awt.geom.Point2D.Double p = new java.awt.geom.Point2D.Double(x[i],
149 158
					y[i]);
150 159
			vp.getAffineTransform().transform(p, p);
160
			FGraphicUtilities.DrawShape(g, vp.getAffineTransform(), new FPoint2D(p.getX(),p.getY()), symbol);
161
			
162
		/*	java.awt.geom.Point2D.Double p = new java.awt.geom.Point2D.Double(x[i],
163
					y[i]);
164
			vp.getAffineTransform().transform(p, p);
151 165
			g.setColor(Color.red);
152 166
			g.fillOval((int) p.x - size, (int) p.y - size, (int) hw, (int) hw);
153 167
			g.setColor(Color.black);
154 168
			g.drawOval((int) p.x - size, (int) p.y - size, (int) hw, (int) hw);
169
		*/
155 170
		}
156 171
	}
157 172

  
......
159 174
	 * @see com.iver.cit.gvsig.fmap.core.IGeometry#cloneGeometry()
160 175
	 */
161 176
	public IGeometry cloneGeometry() {
162
		// TODO Auto-generated method stub
163
		return null;
177
		return new FMultiPoint2D((double[])x.clone(),(double[])y.clone());
164 178
	}
165 179

  
166 180
	/* (non-Javadoc)
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FMultipoint3D.java
59 59
		super(x, y);
60 60
		this.z = z;
61 61
	}
62
	/* (non-Javadoc)
63
	 * @see com.iver.cit.gvsig.fmap.core.IGeometry#cloneGeometry()
64
	 */
65
	public IGeometry cloneGeometry() {
66
		return new FMultipoint3D((double[])x.clone(),(double[])y.clone(),(double[])z.clone());
67
	}
62 68
}
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FGeometry.java
67 67
 *
68 68
 * @author FJP
69 69
 */
70
public class FGeometry implements IGeometry {
70
public class FGeometry implements IGeometry3D {
71 71
	private FShape shp;
72 72

  
73 73
	/**
......
208 208
    public boolean fastIntersects(double x, double y, double w, double h) {
209 209
        return shp.intersects(x,y,w,h);
210 210
    }
211

  
212
	public double[] getZs() {
213
		return ((FShape3D)shp).getZs();
214
	}
211 215
}
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FShape.java
55 55
	public final static int POLYGON = 4;
56 56
	public final static int TEXT = 8;
57 57
	public final static int MULTI = 16;
58

  
58
	public final static int MULTIPOINT = 32;
59
	public final static int Z=64;
59 60
	/**
60 61
	 * Obtiene el tipo de shape que contiene. Puede ser una de las constantes
61 62
	 * POINT, LINE o POLYGON
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FPolygon3D.java
45 45
 *
46 46
 * @author Vicente Caballero Navarro
47 47
 */
48
public class FPolygon3D extends FPolygon2D {
48
public class FPolygon3D extends FPolygon2D implements FShape3D {
49 49
	private GeneralPathX gp = null;
50 50
	double[] pZ = null;
51 51

  
......
66 66
	 * @return FShape clonado.
67 67
	 */
68 68
	public FShape cloneFShape() {
69
		// TODO:
70
		return null;
69
		return new FPolygon3D((GeneralPathX) gp.clone(),(double[])pZ.clone());
71 70
	}
71

  
72
	public double[] getZs() {
73
		return pZ;
74
	}
72 75
}
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FPoint3D.java
45 45
 *
46 46
 * @author Vicente Caballero Navarro
47 47
 */
48
public class FPoint3D extends FPoint2D {
48
public class FPoint3D extends FPoint2D implements FShape3D{
49 49
	double z;
50 50

  
51 51
	/**
......
63 63
	{
64 64
	    return z;
65 65
	}
66
	public double[] getZs() {
67
		return new double[]{getZ()};
68
	}
66 69
}
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/v02/FGraphicUtilities.java
233 233
		   {
234 234
		           System.out.println("Entra pol?gono");
235 235
		   } */
236
		switch (shp.getShapeType()) {
236
		int type=shp.getShapeType();
237
		if (shp.getShapeType()>=FShape.Z){
238
			type=shp.getShapeType()-FShape.Z;
239
		}
240
		switch (type) {
237 241
			case FShape.POINT: //Tipo punto
238 242
				drawSymbolPoint(g2, mT, (FPoint2D) shp, theSymbol);
239 243

  
......
336 340
			width = g2.getFontMetrics().stringWidth(theLabel.getString());
337 341
		}
338 342

  
339
		switch (shp.getShapeType()) {
343
		int type=shp.getShapeType();
344
		if (shp.getShapeType()>=FShape.Z){
345
			type=shp.getShapeType()-FShape.Z;
346
		}
347
		switch (type) {
340 348
			case FShape.POINT: //Tipo punto
341 349
				pAux = new Point2D.Double(((FPoint2D) shp).getX(),
342 350
						((FPoint2D) shp).getY());
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/ShapeFactory.java
40 40
 */
41 41
package com.iver.cit.gvsig.fmap.core;
42 42

  
43

  
43 44
/**
44 45
 * Clase que crea las geometr?as, contendra un m?todo create por cada tipo de
45 46
 * geometria que soporte gvSIG
......
122 123
	public static IGeometry createPolyline3D(GeneralPathX shape, double[] pZ) {
123 124
		return new FGeometry(new FPolyline3D(shape, pZ));
124 125
	}
126
	/**
127
	 * Crea una geometr?a que contiene como shape un Pol?gono 3D.
128
	 *
129
	 * @param shape GeneralPathX.
130
	 * @param pZ Vector de Z.
131
	 *
132
	 * @return Geometr?a.
133
	 */
134
	public static IGeometry createPolygon3D(GeneralPathX shape, double[] pZ) {
135
		return new FGeometry(new FPolygon3D(shape, pZ));
136
	}
125 137

  
126 138
	/**
127 139
	 * Crea una geometr?a que contiene como shape un Pol?gono 2D.
......
144 156
	public static FGeometry createGeometry(FShape shp) {
145 157
		return new FGeometry(shp);
146 158
	}
159
    
147 160
}
branches/FMap_SLD/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FPolyline3D.java
46 46
 *
47 47
 * @author Vicente Caballero Navarro
48 48
 */
49
public class FPolyline3D extends FPolyline2D {
49
public class FPolyline3D extends FPolyline2D implements FShape3D{
50 50
	double[] pZ = null;
51 51

  
52 52
	/**
......
59 59
		super(gpx);
60 60
		this.pZ = pZ;
61 61
	}
62
	/**
63
	 * @see com.iver.cit.gvsig.fmap.core.FShape#getShapeType()
64
	 */
65
	public int getShapeType() {
66
		return FShape.LINE | FShape.Z;
67
	}
68
	public double[] getZs() {
69
		return pZ;
70
	}
62 71
}

Also available in: Unified diff