Revision 2196
trunk/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.MULTIPOINT: |
|
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; |
... | ... | |
177 | 193 |
case FShape.POLYGON: |
178 | 194 |
return FConstant.SHAPE_TYPE_POLYGON; |
179 | 195 |
|
180 |
case FShape.MULTI: |
|
181 |
return 0; //TODO falta aclarar cosas aqu?.
|
|
196 |
case FShape.MULTIPOINT:
|
|
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 |
} |
trunk/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()) { |
trunk/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()) { |
trunk/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); |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/dxf/DXFMemoryDriver.java | ||
---|---|---|
54 | 54 |
|
55 | 55 |
import org.cresques.cts.IProjection; |
56 | 56 |
import org.cresques.cts.ProjectionPool; |
57 |
import org.cresques.geo.Point3D; |
|
57 | 58 |
import org.cresques.io.DxfFile; |
58 | 59 |
import org.cresques.px.IObjList; |
59 | 60 |
import org.cresques.px.dxf.AcadColor; |
60 | 61 |
import org.cresques.px.dxf.DxfFeatureMaker; |
61 | 62 |
import org.cresques.px.gml.Feature; |
62 | 63 |
import org.cresques.px.gml.InsPoint; |
64 |
import org.cresques.px.gml.InsPoint3D; |
|
63 | 65 |
import org.cresques.px.gml.LineString; |
66 |
import org.cresques.px.gml.LineString3D; |
|
64 | 67 |
import org.cresques.px.gml.Point; |
65 | 68 |
import org.cresques.px.gml.Polygon; |
69 |
import org.cresques.px.gml.Polygon3D; |
|
66 | 70 |
|
67 | 71 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
68 | 72 |
import com.hardcode.gdbms.engine.data.driver.ObjectDriver; |
69 | 73 |
import com.hardcode.gdbms.engine.values.IntValue; |
70 | 74 |
import com.hardcode.gdbms.engine.values.Value; |
71 | 75 |
import com.hardcode.gdbms.engine.values.ValueFactory; |
76 |
import com.iver.cit.gvsig.fmap.core.FPoint2D; |
|
72 | 77 |
import com.iver.cit.gvsig.fmap.core.FPoint3D; |
73 | 78 |
import com.iver.cit.gvsig.fmap.core.FPolygon2D; |
79 |
import com.iver.cit.gvsig.fmap.core.FPolygon3D; |
|
74 | 80 |
import com.iver.cit.gvsig.fmap.core.FPolyline2D; |
81 |
import com.iver.cit.gvsig.fmap.core.FPolyline3D; |
|
75 | 82 |
import com.iver.cit.gvsig.fmap.core.FShape; |
76 | 83 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
77 | 84 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
... | ... | |
89 | 96 |
*/ |
90 | 97 |
public class DXFMemoryDriver extends MemoryDriver implements WithDefaultLegend { |
91 | 98 |
private final int ID_FIELD_ID=0; |
92 |
private final int ID_FIELD_ENTITY=1; |
|
93 |
private final int ID_FIELD_LAYER=2; |
|
94 |
private final int ID_FIELD_COLOR=3; |
|
95 |
private final int ID_FIELD_ELEVATION=4; |
|
96 |
private final int ID_FIELD_THICKNESS=5; |
|
97 |
private final int ID_FIELD_TEXT=6; |
|
98 |
private final int ID_FIELD_HEIGHTTEXT=7; |
|
99 |
private final int ID_FIELD_ROTATIONTEXT=8; |
|
99 |
private final int ID_FIELD_FSHAPE=1; |
|
100 |
private final int ID_FIELD_ENTITY=2; |
|
101 |
private final int ID_FIELD_LAYER=3; |
|
102 |
private final int ID_FIELD_COLOR=4; |
|
103 |
private final int ID_FIELD_ELEVATION=5; |
|
104 |
private final int ID_FIELD_THICKNESS=6; |
|
105 |
private final int ID_FIELD_TEXT=7; |
|
106 |
private final int ID_FIELD_HEIGHTTEXT=8; |
|
107 |
private final int ID_FIELD_ROTATIONTEXT=9; |
|
100 | 108 |
|
101 | 109 |
VectorialUniqueValueLegend defaultLegend; |
102 | 110 |
private String path; |
... | ... | |
129 | 137 |
dxfFeatureFile = new DxfFile(proj, m_Fich.getAbsolutePath(), featureMaker); |
130 | 138 |
dxfFeatureFile.load(); |
131 | 139 |
features = (IObjList.vector)((DxfFeatureMaker)featureMaker).getObjects(); |
132 |
|
|
140 |
if (!featureMaker.isDxf3DFile()) { |
|
141 |
Feature[] features2D = new Feature[features.size()]; |
|
142 |
for (int i=0;i<features.size();i++) { |
|
143 |
Feature fea = (Feature)features.get(i); |
|
144 |
if (fea.getGeometry() instanceof org.cresques.px.gml.Point3D) { |
|
145 |
Point point = (Point)fea.getGeometry(); |
|
146 |
Point point2 = new Point(); |
|
147 |
for (int j=0;j<point.pointNr();j++) { |
|
148 |
point2.add(point.get(j)); |
|
149 |
} |
|
150 |
point2.setTextPoint(point.isTextPoint()); |
|
151 |
fea.setGeometry(point2); |
|
152 |
features2D[i] = fea; |
|
153 |
//} else if (fea.getGeometry() instanceof InsPoint3D) { |
|
154 |
// InsPoint insPoint = (InsPoint)fea.getGeometry(); |
|
155 |
// InsPoint insPoint2 = new InsPoint(); |
|
156 |
// for (int j=0;j<insPoint.pointNr();j++) { |
|
157 |
// insPoint2.add(insPoint.get(j)); |
|
158 |
// } |
|
159 |
// fea.setGeometry(insPoint2); |
|
160 |
// features2D[i] = fea; |
|
161 |
} else if (fea.getGeometry() instanceof LineString3D) { |
|
162 |
LineString lineString = (LineString)fea.getGeometry(); |
|
163 |
LineString lineString2 = new LineString(); |
|
164 |
for (int j=0;j<lineString.pointNr();j++) { |
|
165 |
lineString2.add(lineString.get(j)); |
|
166 |
} |
|
167 |
fea.setGeometry(lineString2); |
|
168 |
features2D[i] = fea; |
|
169 |
} else if (fea.getGeometry() instanceof Polygon3D) { |
|
170 |
Polygon polygon = (Polygon)fea.getGeometry(); |
|
171 |
Polygon polygon2 = new Polygon(); |
|
172 |
for (int j=0;j<polygon.pointNr();j++) { |
|
173 |
polygon2.add(polygon.get(j)); |
|
174 |
} |
|
175 |
fea.setGeometry(polygon2); |
|
176 |
features2D[i] = fea; |
|
177 |
} |
|
178 |
} |
|
179 |
features.clear(); |
|
180 |
for (int i=0;i<features2D.length;i++) { |
|
181 |
features.add(features2D[i]); |
|
182 |
} |
|
183 |
} |
|
133 | 184 |
//String acadVersion = (String)((DxfHeaderManager)headerManager).getAcadVersion(); |
134 | 185 |
//System.out.println("initialize(): acadVersion = " + acadVersion); |
135 | 186 |
|
136 | 187 |
int nAtt = featureMaker.getAttributes().size(); |
137 | 188 |
|
138 | 189 |
// Campos de las MemoryLayer: |
139 |
Value[] auxRow = new Value[9+nAtt];
|
|
190 |
Value[] auxRow = new Value[10+nAtt];
|
|
140 | 191 |
ArrayList arrayFields = new ArrayList(); |
141 | 192 |
arrayFields.add("ID"); |
193 |
arrayFields.add("FShape"); |
|
142 | 194 |
arrayFields.add("Entity"); |
143 | 195 |
arrayFields.add("Layer"); |
144 | 196 |
arrayFields.add("Color"); |
... | ... | |
157 | 209 |
|
158 | 210 |
for (int i=0;i<features.size();i++) { |
159 | 211 |
|
160 |
auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory.createValue(0); |
|
161 |
auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory.createValue(0); |
|
212 |
auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory.createValue(0.0);
|
|
213 |
auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory.createValue(0.0);
|
|
162 | 214 |
auxRow[ID_FIELD_TEXT] = ValueFactory.createNullValue(); |
163 | 215 |
|
164 | 216 |
Feature fea = (Feature)features.get(i); |
165 |
if (fea.getGeometry() instanceof Point) { |
|
166 |
Point point = (Point)fea.getGeometry();
|
|
217 |
if (fea.getGeometry() instanceof Point && !(fea.getGeometry() instanceof org.cresques.px.gml.Point3D)) {
|
|
218 |
Point point = (Point)fea.getGeometry();
|
|
167 | 219 |
Point2D pto = new Point2D.Double(); |
168 |
pto = (Point2D.Double)point.get(0);
|
|
220 |
pto = (Point2D)point.get(0); |
|
169 | 221 |
FShape nuevoShp; |
170 | 222 |
if (point.isTextPoint()) { |
171 | 223 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
224 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPoint2D")); |
|
172 | 225 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
173 | 226 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
174 | 227 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
... | ... | |
186 | 239 |
for (int j=0;j<nAtt;j++) { |
187 | 240 |
String[] attributes = new String[2]; |
188 | 241 |
attributes = (String[])featureMaker.getAttributes().get(j); |
189 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
|
242 |
auxRow[10+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
|
190 | 243 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
191 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
|
244 |
auxRow[10+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
|
192 | 245 |
} |
193 | 246 |
} |
194 |
nuevoShp = new FPoint3D(pto.getX(),pto.getY(),0);
|
|
247 |
nuevoShp = new FPoint2D(pto.getX(),pto.getY());
|
|
195 | 248 |
addShape(nuevoShp, auxRow); |
196 | 249 |
} else { |
197 | 250 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
251 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPoint2D")); |
|
198 | 252 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
199 | 253 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
200 | 254 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
... | ... | |
207 | 261 |
for (int j=0;j<nAtt;j++) { |
208 | 262 |
String[] attributes = new String[2]; |
209 | 263 |
attributes = (String[])featureMaker.getAttributes().get(j); |
210 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
|
264 |
auxRow[10+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
|
211 | 265 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
212 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
|
266 |
auxRow[10+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
|
213 | 267 |
} |
214 | 268 |
} |
215 |
nuevoShp = new FPoint3D(pto.getX(),pto.getY(),0);
|
|
269 |
nuevoShp = new FPoint2D(pto.getX(),pto.getY());
|
|
216 | 270 |
addShape(nuevoShp, auxRow); |
217 | 271 |
} |
218 |
} else if (fea.getGeometry() instanceof InsPoint) { |
|
272 |
} else if (fea.getGeometry() instanceof org.cresques.px.gml.Point3D) { |
|
273 |
org.cresques.px.gml.Point3D point = (org.cresques.px.gml.Point3D)fea.getGeometry(); |
|
274 |
Point3D pto = new Point3D(); |
|
275 |
pto = (Point3D)point.getPoint3D(0); |
|
276 |
FShape nuevoShp; |
|
277 |
if (point.isTextPoint()) { |
|
278 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
279 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPoint3D")); |
|
280 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
|
281 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
|
282 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
283 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
284 |
auxRow[ID_FIELD_TEXT] = ValueFactory.createValue(new String(fea.getProp("text"))); |
|
285 |
heightText = Float.parseFloat(fea.getProp("textHeight")); |
|
286 |
auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory.createValue(heightText); |
|
287 |
double auxR = Double.parseDouble(fea.getProp("textRotation")); |
|
288 |
auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory.createValue(auxR); |
|
289 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
290 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
291 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
292 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
293 |
// Attributes |
|
294 |
for (int j=0;j<nAtt;j++) { |
|
295 |
String[] attributes = new String[2]; |
|
296 |
attributes = (String[])featureMaker.getAttributes().get(j); |
|
297 |
auxRow[10+j] = ValueFactory.createValue(new String((String)attributes[1])); |
|
298 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
299 |
auxRow[10+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0]))); |
|
300 |
} |
|
301 |
} |
|
302 |
nuevoShp = new FPoint3D(pto.getX(),pto.getY(),pto.getZ()); |
|
303 |
addShape(nuevoShp, auxRow); |
|
304 |
} else { |
|
305 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
306 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPoint3D")); |
|
307 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
|
308 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
|
309 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
310 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
311 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
312 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
313 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
314 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
315 |
// Attributes |
|
316 |
for (int j=0;j<nAtt;j++) { |
|
317 |
String[] attributes = new String[2]; |
|
318 |
attributes = (String[])featureMaker.getAttributes().get(j); |
|
319 |
auxRow[10+j] = ValueFactory.createValue(new String((String)attributes[1])); |
|
320 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
321 |
auxRow[10+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0]))); |
|
322 |
} |
|
323 |
} |
|
324 |
nuevoShp = new FPoint3D(pto.getX(),pto.getY(),pto.getZ()); |
|
325 |
addShape(nuevoShp, auxRow); |
|
326 |
} |
|
327 |
/*} else if (fea.getGeometry() instanceof InsPoint && !(fea.getGeometry() instanceof InsPoint3D)) { |
|
219 | 328 |
InsPoint insPoint = (InsPoint)fea.getGeometry(); |
220 | 329 |
Point2D pto = new Point2D.Double(); |
221 |
pto = (Point2D.Double)insPoint.get(0);
|
|
330 |
pto = (Point2D)insPoint.get(0); |
|
222 | 331 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
332 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("PointZ")); |
|
223 | 333 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
224 | 334 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
225 | 335 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
... | ... | |
235 | 345 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0]))); |
236 | 346 |
} |
237 | 347 |
} |
238 |
FShape nuevoShp = new FPoint3D(pto.getX(),pto.getY(),0); |
|
239 |
addShape(nuevoShp, auxRow); |
|
240 |
} else if (fea.getGeometry() instanceof LineString) { |
|
348 |
FShape nuevoShp = new FPoint2D(pto.getX(),pto.getY()); |
|
349 |
addShape(nuevoShp, auxRow); |
|
350 |
} else if (fea.getGeometry() instanceof InsPoint3D) { |
|
351 |
InsPoint3D insPoint = (InsPoint3D)fea.getGeometry(); |
|
352 |
Point3D pto = new Point3D(); |
|
353 |
pto = (Point3D)insPoint.getPoint3D(0); |
|
354 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
355 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("PointZ")); |
|
356 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
|
357 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
|
358 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
359 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
360 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
361 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
362 |
// Attributes |
|
363 |
for (int j=0;j<nAtt;j++) { |
|
364 |
String[] attributes = new String[2]; |
|
365 |
attributes = (String[])featureMaker.getAttributes().get(j); |
|
366 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1])); |
|
367 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
368 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0]))); |
|
369 |
} |
|
370 |
} |
|
371 |
FShape nuevoShp = new FPoint3D(pto.getX(),pto.getY(),pto.getZ()); |
|
372 |
addShape(nuevoShp, auxRow);*/ |
|
373 |
} else if (fea.getGeometry() instanceof LineString && !(fea.getGeometry() instanceof LineString3D)) { |
|
241 | 374 |
GeneralPathX genPathX = new GeneralPathX(); |
242 | 375 |
Point2D[] pts = new Point2D[fea.getGeometry().pointNr()]; |
243 | 376 |
for (int j=0; j<fea.getGeometry().pointNr(); j++) { |
244 | 377 |
pts[j] = (Point2D)fea.getGeometry().get(j); |
245 | 378 |
} |
246 | 379 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
247 |
for (int j=1; j < pts.length; j++) {
|
|
380 |
for (int j=1;j<pts.length;j++) {
|
|
248 | 381 |
genPathX.lineTo(pts[j].getX(), pts[j].getY()); |
249 | 382 |
} |
383 |
//double[] elevations = new double[pts.length]; |
|
384 |
//for (int j=0;j<pts.length;j++) { |
|
385 |
// elevations[j]=pts[j].getZ(); |
|
386 |
//} |
|
250 | 387 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
388 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline2D")); |
|
251 | 389 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
252 | 390 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
253 | 391 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
... | ... | |
260 | 398 |
for (int j=0;j<nAtt;j++) { |
261 | 399 |
String[] attributes = new String[2]; |
262 | 400 |
attributes = (String[])featureMaker.getAttributes().get(j); |
263 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
|
401 |
auxRow[10+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
|
264 | 402 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
265 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
|
403 |
auxRow[10+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
|
266 | 404 |
} |
267 | 405 |
} |
268 | 406 |
FShape nuevoShp = new FPolyline2D(genPathX); |
269 | 407 |
addShape(nuevoShp, auxRow); |
270 |
} else if (fea.getGeometry() instanceof Polygon) {
|
|
408 |
} else if (fea.getGeometry() instanceof LineString3D) {
|
|
271 | 409 |
GeneralPathX genPathX = new GeneralPathX(); |
410 |
Point3D[] pts = new Point3D[fea.getGeometry().pointNr()]; |
|
411 |
for (int j=0; j<fea.getGeometry().pointNr(); j++) { |
|
412 |
pts[j] = ((LineString3D)fea.getGeometry()).getPoint3D(j); |
|
413 |
} |
|
414 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
|
415 |
for (int j=1;j<pts.length;j++) { |
|
416 |
genPathX.lineTo(pts[j].getX(), pts[j].getY()); |
|
417 |
} |
|
418 |
double[] elevations = new double[pts.length]; |
|
419 |
for (int j=0;j<pts.length;j++) { |
|
420 |
elevations[j]=pts[j].getZ(); |
|
421 |
} |
|
422 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
423 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline3D")); |
|
424 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
|
425 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
|
426 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
427 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
428 |
if (fea.getProp("elevation")!=null) { |
|
429 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
430 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
431 |
} |
|
432 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
433 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
434 |
// Attributes |
|
435 |
for (int j=0;j<nAtt;j++) { |
|
436 |
String[] attributes = new String[2]; |
|
437 |
attributes = (String[])featureMaker.getAttributes().get(j); |
|
438 |
auxRow[10+j] = ValueFactory.createValue(new String((String)attributes[1])); |
|
439 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
440 |
auxRow[10+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0]))); |
|
441 |
} |
|
442 |
} |
|
443 |
FShape nuevoShp = new FPolyline3D(genPathX, elevations); |
|
444 |
addShape(nuevoShp, auxRow); |
|
445 |
} else if (fea.getGeometry() instanceof Polygon && !(fea.getGeometry() instanceof Polygon3D)) { |
|
446 |
GeneralPathX genPathX = new GeneralPathX(); |
|
272 | 447 |
// 050112: A?ado una posici?n m?s para el punto que cierra y |
273 | 448 |
// creo el objeto firstPt. |
274 | 449 |
Point2D firstPt = new Point2D.Double(); |
... | ... | |
283 | 458 |
for (int j=1; j < pts.length; j++) { |
284 | 459 |
genPathX.lineTo(pts[j].getX(), pts[j].getY()); |
285 | 460 |
} |
461 |
//double[] elevations = new double[pts.length]; |
|
462 |
//for (int j=0;j<pts.length;j++) { |
|
463 |
// elevations[j]=pts[j].getZ(); |
|
464 |
//} |
|
286 | 465 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
466 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolygon2D")); |
|
287 | 467 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
288 | 468 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
289 | 469 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
... | ... | |
296 | 476 |
for (int j=0;j<nAtt;j++) { |
297 | 477 |
String[] attributes = new String[2]; |
298 | 478 |
attributes = (String[])featureMaker.getAttributes().get(j); |
299 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
|
479 |
auxRow[10+j] = ValueFactory.createValue(new String((String)attributes[1]));
|
|
300 | 480 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
301 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
|
481 |
auxRow[10+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0])));
|
|
302 | 482 |
} |
303 | 483 |
} |
304 | 484 |
FShape nuevoShp = new FPolygon2D(genPathX); |
305 | 485 |
addShape(nuevoShp, auxRow); |
486 |
} else if (fea.getGeometry() instanceof Polygon3D) { |
|
487 |
GeneralPathX genPathX = new GeneralPathX(); |
|
488 |
// 050112: A?ado una posici?n m?s para el punto que cierra y |
|
489 |
// creo el objeto firstPt. |
|
490 |
Point3D firstPt = new Point3D(); |
|
491 |
firstPt = (Point3D)((Polygon3D)fea.getGeometry()).getPoint3D(0); |
|
492 |
Point3D[] pts = new Point3D[fea.getGeometry().pointNr()+1]; |
|
493 |
for (int j=0; j<fea.getGeometry().pointNr(); j++) { |
|
494 |
pts[j] = (Point3D)((Polygon3D)fea.getGeometry()).getPoint3D(j); |
|
495 |
} |
|
496 |
// 050112: A?ado el primer punto al final para cerrar los pol?gonos. |
|
497 |
pts[fea.getGeometry().pointNr()] = firstPt; |
|
498 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
|
499 |
for (int j=1; j < pts.length; j++) { |
|
500 |
genPathX.lineTo(pts[j].getX(), pts[j].getY()); |
|
501 |
} |
|
502 |
double[] elevations = new double[pts.length]; |
|
503 |
for (int j=0;j<pts.length;j++) { |
|
504 |
elevations[j]=pts[j].getZ(); |
|
505 |
} |
|
506 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
507 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolygon3D")); |
|
508 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
|
509 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
|
510 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
511 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
512 |
if (fea.getProp("elevation")!=null) { |
|
513 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
514 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
515 |
} |
|
516 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
517 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
518 |
// Attributes |
|
519 |
for (int j=0;j<nAtt;j++) { |
|
520 |
String[] attributes = new String[2]; |
|
521 |
attributes = (String[])featureMaker.getAttributes().get(j); |
|
522 |
auxRow[10+j] = ValueFactory.createValue(new String((String)attributes[1])); |
|
523 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
524 |
auxRow[10+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0]))); |
|
525 |
} |
|
526 |
} |
|
527 |
FShape nuevoShp = new FPolygon3D(genPathX, elevations); |
|
528 |
addShape(nuevoShp, auxRow); |
|
306 | 529 |
} else { |
307 |
System.out.println("Detectado feature desconocido"); |
|
530 |
//System.out.println("Detectado feature desconocido");
|
|
308 | 531 |
} |
309 | 532 |
} |
310 | 533 |
|
trunk/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 { |
|
49 |
private GeneralPathX gp = null; |
|
48 |
public class FPolygon3D extends FPolygon2D implements FShape3D { |
|
50 | 49 |
double[] pZ = null; |
51 | 50 |
|
52 | 51 |
/** |
... | ... | |
66 | 65 |
* @return FShape clonado. |
67 | 66 |
*/ |
68 | 67 |
public FShape cloneFShape() { |
69 |
return new FPolygon3D((GeneralPathX) gp.clone(),(double[])pZ.clone());
|
|
68 |
return new FPolygon3D((GeneralPathX) gp.clone(), (double[]) pZ.clone());
|
|
70 | 69 |
} |
70 |
|
|
71 |
/** |
|
72 |
* Devuelve un array con los valores de todas las Z. |
|
73 |
* |
|
74 |
* @return Array de Zs. |
|
75 |
*/ |
|
76 |
public double[] getZs() { |
|
77 |
return pZ; |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* @see com.iver.cit.gvsig.fmap.core.FShape#getShapeType() |
|
82 |
*/ |
|
83 |
public int getShapeType() { |
|
84 |
return FShape.LINE | FShape.Z; |
|
85 |
} |
|
71 | 86 |
} |
trunk/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 |
/** |
... | ... | |
59 | 59 |
super(x, y); |
60 | 60 |
this.z = z; |
61 | 61 |
} |
62 |
public double getZ() |
|
63 |
{ |
|
64 |
return z; |
|
62 |
|
|
63 |
/** |
|
64 |
* Devuelve un Array con los valores de todas las Zs, en este caso con un |
|
65 |
* ?nico vaor de z. |
|
66 |
* |
|
67 |
* @return Array de Zs. |
|
68 |
*/ |
|
69 |
public double[] getZs() { |
|
70 |
return new double[] { z }; |
|
65 | 71 |
} |
72 |
|
|
73 |
/** |
|
74 |
* @see com.iver.cit.gvsig.fmap.core.FShape#getShapeType() |
|
75 |
*/ |
|
76 |
public int getShapeType() { |
|
77 |
return FShape.POINT | FShape.Z; |
|
78 |
} |
|
79 |
|
|
80 |
/* (non-Javadoc) |
|
81 |
* @see com.iver.cit.gvsig.fmap.core.FShape#cloneFShape() |
|
82 |
*/ |
|
83 |
public FShape cloneFShape() { |
|
84 |
return new FPoint3D(p.getX(), p.getY(), z); |
|
85 |
} |
|
66 | 86 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FPolyline2D.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.cit.gvsig.fmap.core; |
42 | 42 |
|
43 |
import org.cresques.cts.ICoordTrans; |
|
44 |
|
|
43 | 45 |
import java.awt.Rectangle; |
44 | 46 |
import java.awt.geom.AffineTransform; |
45 |
import java.awt.geom.Line2D; |
|
46 | 47 |
import java.awt.geom.PathIterator; |
48 |
import java.awt.geom.Line2D; |
|
47 | 49 |
import java.awt.geom.Point2D; |
48 | 50 |
import java.awt.geom.Rectangle2D; |
49 |
import java.io.Serializable; |
|
50 | 51 |
import java.util.ArrayList; |
51 | 52 |
|
52 |
import org.cresques.cts.ICoordTrans; |
|
53 | 53 |
|
54 |
|
|
55 | 54 |
/** |
56 | 55 |
* DOCUMENT ME! |
57 | 56 |
* |
58 | 57 |
* @author Fernando Gonz?lez Cort?s |
59 | 58 |
*/ |
60 |
public class FPolyline2D implements FShape{ |
|
59 |
public class FPolyline2D implements FShape {
|
|
61 | 60 |
protected GeneralPathX gp; |
62 | 61 |
/** |
63 | 62 |
* Crea un nuevo FPolyline2D. |
trunk/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()); |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FPolyline3D.java | ||
---|---|---|
1 | 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 |
|
|
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 |
*/ |
|
42 | 41 |
package com.iver.cit.gvsig.fmap.core; |
43 | 42 |
|
44 | 43 |
/** |
... | ... | |
46 | 45 |
* |
47 | 46 |
* @author Vicente Caballero Navarro |
48 | 47 |
*/ |
49 |
public class FPolyline3D extends FPolyline2D { |
|
48 |
public class FPolyline3D extends FPolyline2D implements FShape3D {
|
|
50 | 49 |
double[] pZ = null; |
51 | 50 |
|
52 | 51 |
/** |
... | ... | |
59 | 58 |
super(gpx); |
60 | 59 |
this.pZ = pZ; |
61 | 60 |
} |
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 |
|
|
69 |
/** |
|
70 |
* Devuelve un Array con todos los valores de Z. |
|
71 |
* |
|
72 |
* @return Array de Zs. |
|
73 |
*/ |
|
74 |
public double[] getZs() { |
|
75 |
return pZ; |
|
76 |
} |
|
77 |
|
|
78 |
/* (non-Javadoc) |
|
79 |
* @see com.iver.cit.gvsig.fmap.core.FShape#cloneFShape() |
|
80 |
*/ |
|
81 |
public FShape cloneFShape() { |
|
82 |
return new FPolyline3D((GeneralPathX) gp.clone(), (double[]) pZ); |
|
83 |
} |
|
62 | 84 |
} |
trunk/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 |
trunk/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 |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FGeometry.java | ||
---|---|---|
70 | 70 |
* |
71 | 71 |
* @author FJP |
72 | 72 |
*/ |
73 |
public class FGeometry implements IGeometry { |
|
73 |
public class FGeometry implements IGeometry3D {
|
|
74 | 74 |
private FShape shp; |
75 | 75 |
|
76 | 76 |
/** |
... | ... | |
215 | 215 |
public byte[] toWKB() throws IOException{ |
216 | 216 |
return WKBEncoder.encodeGeometry(toJTSGeometry()); |
217 | 217 |
} |
218 |
/** |
|
219 |
* Devuelve un array con todos los valores de Z. |
|
220 |
* |
|
221 |
* @return Array de Zs. |
|
222 |
*/ |
|
223 |
public double[] getZs() { |
|
224 |
return ((FShape3D) shp).getZs(); |
|
225 |
} |
|
218 | 226 |
} |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/FMultipoint3D.java | ||
---|---|---|
45 | 45 |
* |
46 | 46 |
* @author Vicente Caballero Navarro |
47 | 47 |
*/ |
48 |
public class FMultipoint3D extends FMultiPoint2D { |
|
48 |
public class FMultipoint3D extends FMultiPoint2D implements IGeometry3D {
|
|
49 | 49 |
double[] z = null; |
50 | 50 |
|
51 | 51 |
/** |
52 | 52 |
* Crea un nuevo Multipoint3D. |
53 | 53 |
* |
54 |
* @param x DOCUMENT ME!
|
|
55 |
* @param y DOCUMENT ME!
|
|
56 |
* @param z DOCUMENT ME!
|
|
54 |
* @param x Array de Xs.
|
|
55 |
* @param y Array de Ys.
|
|
56 |
* @param z Array de Zs.
|
|
57 | 57 |
*/ |
58 | 58 |
public FMultipoint3D(double[] x, double[] y, double[] z) { |
59 | 59 |
super(x, y); |
60 | 60 |
this.z = z; |
61 | 61 |
} |
62 |
|
|
63 |
/* (non-Javadoc) |
|
64 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#cloneGeometry() |
|
65 |
*/ |
|
66 |
public IGeometry cloneGeometry() { |
|
67 |
return new FMultipoint3D((double[]) x.clone(), (double[]) y.clone(), |
|
68 |
(double[]) z.clone()); |
|
69 |
} |
|
70 |
|
|
71 |
/** |
|
72 |
* Devuelve un array con todos los valores de Z. |
|
73 |
* |
|
74 |
* @return Array de Zs. |
|
75 |
*/ |
|
76 |
public double[] getZs() { |
|
77 |
return z; |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#getGeometryType() |
|
82 |
*/ |
|
83 |
public int getGeometryType() { |
|
84 |
return FShape.MULTIPOINT | FShape.Z; |
|
85 |
} |
|
62 | 86 |
} |
Also available in: Unified diff