Revision 4937 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/dxf/DXFMemoryDriver.java
DXFMemoryDriver.java | ||
---|---|---|
49 | 49 |
import java.awt.Font; |
50 | 50 |
import java.awt.geom.Point2D; |
51 | 51 |
import java.io.File; |
52 |
import java.io.FileInputStream; |
|
53 |
import java.io.FileNotFoundException; |
|
54 |
import java.io.FileOutputStream; |
|
52 | 55 |
import java.io.IOException; |
56 |
import java.nio.channels.FileChannel; |
|
53 | 57 |
import java.util.ArrayList; |
58 |
import java.util.Properties; |
|
54 | 59 |
|
55 | 60 |
import org.cresques.cts.IProjection; |
56 | 61 |
import org.cresques.cts.ProjectionPool; |
... | ... | |
67 | 72 |
import org.cresques.px.gml.Polygon; |
68 | 73 |
import org.cresques.px.gml.Polygon3D; |
69 | 74 |
|
75 |
import com.hardcode.gdbms.driver.DriverUtilities; |
|
70 | 76 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
71 | 77 |
import com.hardcode.gdbms.engine.data.driver.ObjectDriver; |
72 | 78 |
import com.hardcode.gdbms.engine.data.edition.DataWare; |
... | ... | |
87 | 93 |
import com.iver.cit.gvsig.fmap.drivers.MemoryDriver; |
88 | 94 |
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver; |
89 | 95 |
import com.iver.cit.gvsig.fmap.drivers.WithDefaultLegend; |
96 |
import com.iver.cit.gvsig.fmap.edition.EditionException; |
|
97 |
import com.iver.cit.gvsig.fmap.edition.IRowEdited; |
|
98 |
import com.iver.cit.gvsig.fmap.edition.ISpatialWriter; |
|
99 |
import com.iver.cit.gvsig.fmap.edition.writers.dxf.DxfFieldsMapping; |
|
100 |
import com.iver.cit.gvsig.fmap.edition.writers.dxf.DxfWriter; |
|
101 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
90 | 102 |
import com.iver.cit.gvsig.fmap.rendering.Legend; |
91 | 103 |
import com.iver.cit.gvsig.fmap.rendering.LegendFactory; |
92 | 104 |
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend; |
... | ... | |
95 | 107 |
* @author jmorell (jose.morell@gmail.com) |
96 | 108 |
* @version 29-dic-2004 |
97 | 109 |
*/ |
98 |
public class DXFMemoryDriver extends MemoryDriver implements VectorialFileDriver, WithDefaultLegend { |
|
99 |
private final int ID_FIELD_ID=0; |
|
100 |
private final int ID_FIELD_FSHAPE=1; |
|
101 |
private final int ID_FIELD_ENTITY=2; |
|
102 |
private final int ID_FIELD_LAYER=3; |
|
103 |
private final int ID_FIELD_COLOR=4; |
|
104 |
private final int ID_FIELD_ELEVATION=5; |
|
105 |
private final int ID_FIELD_THICKNESS=6; |
|
106 |
private final int ID_FIELD_TEXT=7; |
|
107 |
private final int ID_FIELD_HEIGHTTEXT=8; |
|
108 |
private final int ID_FIELD_ROTATIONTEXT=9; |
|
110 |
public class DXFMemoryDriver extends MemoryDriver implements |
|
111 |
VectorialFileDriver, WithDefaultLegend, ISpatialWriter { |
|
112 |
private static String tempDirectoryPath = System |
|
113 |
.getProperty("java.io.tmpdir"); |
|
109 | 114 |
|
115 |
private final int ID_FIELD_ID = 0; |
|
116 |
|
|
117 |
private final int ID_FIELD_FSHAPE = 1; |
|
118 |
|
|
119 |
private final int ID_FIELD_ENTITY = 2; |
|
120 |
|
|
121 |
private final int ID_FIELD_LAYER = 3; |
|
122 |
|
|
123 |
private final int ID_FIELD_COLOR = 4; |
|
124 |
|
|
125 |
private final int ID_FIELD_ELEVATION = 5; |
|
126 |
|
|
127 |
private final int ID_FIELD_THICKNESS = 6; |
|
128 |
|
|
129 |
private final int ID_FIELD_TEXT = 7; |
|
130 |
|
|
131 |
private final int ID_FIELD_HEIGHTTEXT = 8; |
|
132 |
|
|
133 |
private final int ID_FIELD_ROTATIONTEXT = 9; |
|
134 |
|
|
135 |
private DxfWriter dxfWriter = new DxfWriter(); |
|
136 |
|
|
137 |
private File fTemp; |
|
138 |
|
|
110 | 139 |
VectorialUniqueValueLegend defaultLegend; |
140 |
|
|
111 | 141 |
private String path; |
142 |
|
|
112 | 143 |
private File m_Fich; |
113 |
|
|
144 |
|
|
114 | 145 |
private DxfFile.EntityFactory featureMaker; |
146 |
|
|
115 | 147 |
private DxfFile dxfFeatureFile; |
148 |
|
|
116 | 149 |
private IObjList.vector features; |
150 |
|
|
117 | 151 |
private DriverAttributes attr = new DriverAttributes(); |
118 |
|
|
152 |
|
|
119 | 153 |
/** |
120 | 154 |
* Habilita la utilizaci?n del lector del HEADER del DXF. |
121 | 155 |
*/ |
122 | 156 |
private DxfFile.VarSettings headerManager; |
123 | 157 |
|
124 |
/* (non-Javadoc) |
|
158 |
/* |
|
159 |
* (non-Javadoc) |
|
160 |
* |
|
125 | 161 |
* @see com.iver.cit.gvsig.fmap.drivers.MemoryDriver#open(java.io.File) |
126 | 162 |
*/ |
127 | 163 |
public void open(File f) throws IOException { |
128 |
m_Fich = f;
|
|
164 |
m_Fich = f;
|
|
129 | 165 |
} |
130 |
|
|
166 |
|
|
131 | 167 |
public void initialize() throws IOException { |
132 | 168 |
float heightText = 10; |
133 |
|
|
169 |
|
|
134 | 170 |
attr.setLoadedInMemory(true); |
135 |
|
|
171 |
|
|
136 | 172 |
IProjection proj = ProjectionPool.get("EPSG:23030"); |
137 | 173 |
featureMaker = new DxfFeatureMaker(proj); |
138 |
headerManager = new DxfHeaderManager(); |
|
139 |
dxfFeatureFile = new DxfFile(proj, m_Fich.getAbsolutePath(), featureMaker, headerManager); |
|
174 |
headerManager = new DxfHeaderManager(); |
|
175 |
dxfFeatureFile = new DxfFile(proj, m_Fich.getAbsolutePath(), |
|
176 |
featureMaker, headerManager); |
|
140 | 177 |
dxfFeatureFile.load(); |
141 |
features = (IObjList.vector)((DxfFeatureMaker)featureMaker).getObjects(); |
|
142 |
String acadVersion = (String)((DxfHeaderManager)headerManager).getAcadVersion(); |
|
143 |
System.out.println("initialize(): acadVersion = " + acadVersion); |
|
144 |
if (!featureMaker.isDxf3DFile() && !headerManager.isWritedDxf3D()) { // y no est?n todos a 9999 |
|
145 |
Feature[] features2D = new Feature[features.size()]; |
|
146 |
for (int i=0;i<features.size();i++) { |
|
147 |
Feature fea = (Feature)features.get(i); |
|
178 |
features = (IObjList.vector) ((DxfFeatureMaker) featureMaker) |
|
179 |
.getObjects(); |
|
180 |
String acadVersion = (String) ((DxfHeaderManager) headerManager) |
|
181 |
.getAcadVersion(); |
|
182 |
System.out.println("initialize(): acadVersion = " + acadVersion); |
|
183 |
if (!featureMaker.isDxf3DFile() && !headerManager.isWritedDxf3D()) { // y no |
|
184 |
// est?n |
|
185 |
// todos |
|
186 |
// a |
|
187 |
// 9999 |
|
188 |
Feature[] features2D = new Feature[features.size()]; |
|
189 |
for (int i = 0; i < features.size(); i++) { |
|
190 |
Feature fea = (Feature) features.get(i); |
|
148 | 191 |
if (fea.getGeometry() instanceof org.cresques.px.gml.Point3D) { |
149 |
Point point = (Point)fea.getGeometry(); |
|
192 |
Point point = (Point) fea.getGeometry();
|
|
150 | 193 |
Point point2 = new Point(); |
151 |
for (int j=0;j<point.pointNr();j++) {
|
|
152 |
point2.add(point.get(j));
|
|
194 |
for (int j = 0; j < point.pointNr(); j++) {
|
|
195 |
point2.add(point.get(j));
|
|
153 | 196 |
} |
154 | 197 |
point2.setTextPoint(point.isTextPoint()); |
155 | 198 |
fea.setGeometry(point2); |
156 | 199 |
features2D[i] = fea; |
157 |
//} else if (fea.getGeometry() instanceof InsPoint3D) {
|
|
158 |
// InsPoint insPoint = (InsPoint)fea.getGeometry();
|
|
159 |
// InsPoint insPoint2 = new InsPoint();
|
|
160 |
// for (int j=0;j<insPoint.pointNr();j++) {
|
|
161 |
// insPoint2.add(insPoint.get(j));
|
|
162 |
// }
|
|
163 |
// fea.setGeometry(insPoint2);
|
|
164 |
// features2D[i] = fea;
|
|
200 |
// } else if (fea.getGeometry() instanceof InsPoint3D) {
|
|
201 |
// InsPoint insPoint = (InsPoint)fea.getGeometry();
|
|
202 |
// InsPoint insPoint2 = new InsPoint();
|
|
203 |
// for (int j=0;j<insPoint.pointNr();j++) {
|
|
204 |
// insPoint2.add(insPoint.get(j));
|
|
205 |
// }
|
|
206 |
// fea.setGeometry(insPoint2);
|
|
207 |
// features2D[i] = fea;
|
|
165 | 208 |
} else if (fea.getGeometry() instanceof LineString3D) { |
166 |
LineString lineString = (LineString)fea.getGeometry(); |
|
209 |
LineString lineString = (LineString) fea.getGeometry();
|
|
167 | 210 |
LineString lineString2 = new LineString(); |
168 |
for (int j=0;j<lineString.pointNr();j++) {
|
|
169 |
lineString2.add(lineString.get(j));
|
|
211 |
for (int j = 0; j < lineString.pointNr(); j++) {
|
|
212 |
lineString2.add(lineString.get(j));
|
|
170 | 213 |
} |
171 | 214 |
fea.setGeometry(lineString2); |
172 | 215 |
features2D[i] = fea; |
173 | 216 |
} else if (fea.getGeometry() instanceof Polygon3D) { |
174 |
Polygon polygon = (Polygon)fea.getGeometry(); |
|
217 |
Polygon polygon = (Polygon) fea.getGeometry();
|
|
175 | 218 |
Polygon polygon2 = new Polygon(); |
176 |
for (int j=0;j<polygon.pointNr();j++) {
|
|
177 |
polygon2.add(polygon.get(j));
|
|
219 |
for (int j = 0; j < polygon.pointNr(); j++) {
|
|
220 |
polygon2.add(polygon.get(j));
|
|
178 | 221 |
} |
179 | 222 |
fea.setGeometry(polygon2); |
180 | 223 |
features2D[i] = fea; |
181 | 224 |
} |
182 | 225 |
} |
183 |
features.clear();
|
|
184 |
for (int i=0;i<features2D.length;i++) {
|
|
185 |
features.add(features2D[i]);
|
|
226 |
features.clear();
|
|
227 |
for (int i = 0; i < features2D.length; i++) {
|
|
228 |
features.add(features2D[i]);
|
|
186 | 229 |
} |
187 | 230 |
} |
188 |
//String acadVersion = (String)((DxfHeaderManager)headerManager).getAcadVersion(); |
|
189 |
//System.out.println("initialize(): acadVersion = " + acadVersion); |
|
190 |
|
|
231 |
// String acadVersion = |
|
232 |
// (String)((DxfHeaderManager)headerManager).getAcadVersion(); |
|
233 |
// System.out.println("initialize(): acadVersion = " + acadVersion); |
|
234 |
|
|
191 | 235 |
int nAtt = featureMaker.getAttributes().size(); |
192 |
|
|
236 |
|
|
193 | 237 |
// Campos de las MemoryLayer: |
194 |
Value[] auxRow = new Value[10+nAtt];
|
|
238 |
Value[] auxRow = new Value[10 + nAtt];
|
|
195 | 239 |
ArrayList arrayFields = new ArrayList(); |
196 | 240 |
arrayFields.add("ID"); |
197 | 241 |
arrayFields.add("FShape"); |
... | ... | |
203 | 247 |
arrayFields.add("Text"); |
204 | 248 |
arrayFields.add("HeightText"); |
205 | 249 |
arrayFields.add("RotationText"); |
206 |
for (int i=0;i<nAtt;i++) {
|
|
250 |
for (int i = 0; i < nAtt; i++) {
|
|
207 | 251 |
String att[] = new String[2]; |
208 |
att = (String[])featureMaker.getAttributes().get(i); |
|
252 |
att = (String[]) featureMaker.getAttributes().get(i);
|
|
209 | 253 |
arrayFields.add(att[0]); |
210 | 254 |
} |
211 |
|
|
212 |
getTableModel().setColumnIdentifiers(arrayFields.toArray()); |
|
213 |
|
|
214 |
for (int i=0;i<features.size();i++) { |
|
215 |
|
|
216 |
auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory.createValue(0.0); |
|
217 |
auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory.createValue(0.0); |
|
218 |
auxRow[ID_FIELD_TEXT] = ValueFactory.createNullValue(); |
|
219 |
|
|
220 |
Feature fea = (Feature)features.get(i); |
|
221 |
if (fea.getGeometry() instanceof Point && !(fea.getGeometry() instanceof org.cresques.px.gml.Point3D)) { |
|
222 |
Point point = (Point)fea.getGeometry(); |
|
255 |
|
|
256 |
getTableModel().setColumnIdentifiers(arrayFields.toArray()); |
|
257 |
|
|
258 |
for (int i = 0; i < features.size(); i++) { |
|
259 |
|
|
260 |
auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory.createValue(0.0); |
|
261 |
auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory.createValue(0.0); |
|
262 |
auxRow[ID_FIELD_TEXT] = ValueFactory.createNullValue(); |
|
263 |
|
|
264 |
Feature fea = (Feature) features.get(i); |
|
265 |
if (fea.getGeometry() instanceof Point |
|
266 |
&& !(fea.getGeometry() instanceof org.cresques.px.gml.Point3D)) { |
|
267 |
Point point = (Point) fea.getGeometry(); |
|
223 | 268 |
Point2D pto = new Point2D.Double(); |
224 |
pto = (Point2D)point.get(0); |
|
269 |
pto = (Point2D) point.get(0);
|
|
225 | 270 |
FShape nuevoShp; |
226 |
if (point.isTextPoint()) {
|
|
271 |
if (point.isTextPoint()) {
|
|
227 | 272 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
228 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPoint2D")); |
|
229 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
|
230 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
|
231 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
232 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
233 |
auxRow[ID_FIELD_TEXT] = ValueFactory.createValue(new String(fea.getProp("text"))); |
|
234 |
heightText = Float.parseFloat(fea.getProp("textHeight")); |
|
235 |
auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory.createValue(heightText); |
|
236 |
double auxR = Double.parseDouble(fea.getProp("textRotation")); |
|
237 |
auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory.createValue(auxR); |
|
238 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
239 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
240 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
241 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
242 |
// Attributes |
|
243 |
for (int j=0;j<nAtt;j++) { |
|
244 |
String[] attributes = new String[2]; |
|
245 |
attributes = (String[])featureMaker.getAttributes().get(j); |
|
246 |
auxRow[10+j] = ValueFactory.createValue(new String((String)attributes[1])); |
|
247 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
248 |
auxRow[10+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0]))); |
|
249 |
} |
|
250 |
} |
|
251 |
nuevoShp = new FPoint2D(pto.getX(),pto.getY()); |
|
273 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory |
|
274 |
.createValue(new String("FPoint2D")); |
|
275 |
auxRow[ID_FIELD_ENTITY] = ValueFactory |
|
276 |
.createValue(new String(fea.getProp("dxfEntity"))); |
|
277 |
auxRow[ID_FIELD_LAYER] = ValueFactory |
|
278 |
.createValue(new String(fea.getProp("layer"))); |
|
279 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
280 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
281 |
auxRow[ID_FIELD_TEXT] = ValueFactory |
|
282 |
.createValue(new String(fea.getProp("text"))); |
|
283 |
heightText = Float.parseFloat(fea.getProp("textHeight")); |
|
284 |
auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory |
|
285 |
.createValue(heightText); |
|
286 |
double auxR = Double.parseDouble(fea |
|
287 |
.getProp("textRotation")); |
|
288 |
auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory |
|
289 |
.createValue(auxR); |
|
290 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
291 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
292 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
293 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
294 |
// Attributes |
|
295 |
for (int j = 0; j < nAtt; j++) { |
|
296 |
String[] attributes = new String[2]; |
|
297 |
attributes = (String[]) featureMaker.getAttributes() |
|
298 |
.get(j); |
|
299 |
auxRow[10 + j] = ValueFactory.createValue(new String( |
|
300 |
(String) attributes[1])); |
|
301 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
302 |
auxRow[10 + j] = ValueFactory |
|
303 |
.createValue(new String(fea |
|
304 |
.getProp(attributes[0]))); |
|
305 |
} |
|
306 |
} |
|
307 |
nuevoShp = new FPoint2D(pto.getX(), pto.getY()); |
|
252 | 308 |
addShape(nuevoShp, auxRow); |
253 |
} else { |
|
254 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
255 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPoint2D")); |
|
256 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
|
257 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
|
258 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
259 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
260 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
261 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
262 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
263 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
264 |
// Attributes |
|
265 |
for (int j=0;j<nAtt;j++) { |
|
266 |
String[] attributes = new String[2]; |
|
267 |
attributes = (String[])featureMaker.getAttributes().get(j); |
|
268 |
auxRow[10+j] = ValueFactory.createValue(new String((String)attributes[1])); |
|
269 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
270 |
auxRow[10+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0]))); |
|
271 |
} |
|
272 |
} |
|
273 |
nuevoShp = new FPoint2D(pto.getX(),pto.getY()); |
|
309 |
} else { |
|
310 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
311 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory |
|
312 |
.createValue(new String("FPoint2D")); |
|
313 |
auxRow[ID_FIELD_ENTITY] = ValueFactory |
|
314 |
.createValue(new String(fea.getProp("dxfEntity"))); |
|
315 |
auxRow[ID_FIELD_LAYER] = ValueFactory |
|
316 |
.createValue(new String(fea.getProp("layer"))); |
|
317 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
318 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
319 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
320 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
321 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
322 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
323 |
// Attributes |
|
324 |
for (int j = 0; j < nAtt; j++) { |
|
325 |
String[] attributes = new String[2]; |
|
326 |
attributes = (String[]) featureMaker.getAttributes() |
|
327 |
.get(j); |
|
328 |
auxRow[10 + j] = ValueFactory.createValue(new String( |
|
329 |
(String) attributes[1])); |
|
330 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
331 |
auxRow[10 + j] = ValueFactory |
|
332 |
.createValue(new String(fea |
|
333 |
.getProp(attributes[0]))); |
|
334 |
} |
|
335 |
} |
|
336 |
nuevoShp = new FPoint2D(pto.getX(), pto.getY()); |
|
274 | 337 |
addShape(nuevoShp, auxRow); |
275 |
}
|
|
338 |
}
|
|
276 | 339 |
} else if (fea.getGeometry() instanceof org.cresques.px.gml.Point3D) { |
277 |
org.cresques.px.gml.Point3D point = (org.cresques.px.gml.Point3D)fea.getGeometry(); |
|
340 |
org.cresques.px.gml.Point3D point = (org.cresques.px.gml.Point3D) fea |
|
341 |
.getGeometry(); |
|
278 | 342 |
Point3D pto = new Point3D(); |
279 |
pto = (Point3D)point.getPoint3D(0); |
|
343 |
pto = (Point3D) point.getPoint3D(0);
|
|
280 | 344 |
FShape nuevoShp; |
281 |
if (point.isTextPoint()) {
|
|
345 |
if (point.isTextPoint()) {
|
|
282 | 346 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
283 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPoint3D")); |
|
284 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
|
285 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
|
286 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
287 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
288 |
auxRow[ID_FIELD_TEXT] = ValueFactory.createValue(new String(fea.getProp("text"))); |
|
289 |
heightText = Float.parseFloat(fea.getProp("textHeight")); |
|
290 |
auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory.createValue(heightText); |
|
291 |
double auxR = Double.parseDouble(fea.getProp("textRotation")); |
|
292 |
auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory.createValue(auxR); |
|
293 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
294 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
295 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
296 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
297 |
// Attributes |
|
298 |
for (int j=0;j<nAtt;j++) { |
|
299 |
String[] attributes = new String[2]; |
|
300 |
attributes = (String[])featureMaker.getAttributes().get(j); |
|
301 |
auxRow[10+j] = ValueFactory.createValue(new String((String)attributes[1])); |
|
302 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
303 |
auxRow[10+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0]))); |
|
304 |
} |
|
305 |
} |
|
306 |
nuevoShp = new FPoint3D(pto.getX(),pto.getY(),pto.getZ()); |
|
347 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory |
|
348 |
.createValue(new String("FPoint3D")); |
|
349 |
auxRow[ID_FIELD_ENTITY] = ValueFactory |
|
350 |
.createValue(new String(fea.getProp("dxfEntity"))); |
|
351 |
auxRow[ID_FIELD_LAYER] = ValueFactory |
|
352 |
.createValue(new String(fea.getProp("layer"))); |
|
353 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
354 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
355 |
auxRow[ID_FIELD_TEXT] = ValueFactory |
|
356 |
.createValue(new String(fea.getProp("text"))); |
|
357 |
heightText = Float.parseFloat(fea.getProp("textHeight")); |
|
358 |
auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory |
|
359 |
.createValue(heightText); |
|
360 |
double auxR = Double.parseDouble(fea |
|
361 |
.getProp("textRotation")); |
|
362 |
auxRow[ID_FIELD_ROTATIONTEXT] = ValueFactory |
|
363 |
.createValue(auxR); |
|
364 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
365 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
366 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
367 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
368 |
// Attributes |
|
369 |
for (int j = 0; j < nAtt; j++) { |
|
370 |
String[] attributes = new String[2]; |
|
371 |
attributes = (String[]) featureMaker.getAttributes() |
|
372 |
.get(j); |
|
373 |
auxRow[10 + j] = ValueFactory.createValue(new String( |
|
374 |
(String) attributes[1])); |
|
375 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
376 |
auxRow[10 + j] = ValueFactory |
|
377 |
.createValue(new String(fea |
|
378 |
.getProp(attributes[0]))); |
|
379 |
} |
|
380 |
} |
|
381 |
nuevoShp = new FPoint3D(pto.getX(), pto.getY(), pto.getZ()); |
|
307 | 382 |
addShape(nuevoShp, auxRow); |
308 |
} else { |
|
309 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
310 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPoint3D")); |
|
311 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
|
312 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
|
313 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
314 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
315 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
316 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
317 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
318 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
319 |
// Attributes |
|
320 |
for (int j=0;j<nAtt;j++) { |
|
321 |
String[] attributes = new String[2]; |
|
322 |
attributes = (String[])featureMaker.getAttributes().get(j); |
|
323 |
auxRow[10+j] = ValueFactory.createValue(new String((String)attributes[1])); |
|
324 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
325 |
auxRow[10+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0]))); |
|
326 |
} |
|
327 |
} |
|
328 |
nuevoShp = new FPoint3D(pto.getX(),pto.getY(),pto.getZ()); |
|
383 |
} else { |
|
384 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
385 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory |
|
386 |
.createValue(new String("FPoint3D")); |
|
387 |
auxRow[ID_FIELD_ENTITY] = ValueFactory |
|
388 |
.createValue(new String(fea.getProp("dxfEntity"))); |
|
389 |
auxRow[ID_FIELD_LAYER] = ValueFactory |
|
390 |
.createValue(new String(fea.getProp("layer"))); |
|
391 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
392 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
393 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
394 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
395 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
396 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
397 |
// Attributes |
|
398 |
for (int j = 0; j < nAtt; j++) { |
|
399 |
String[] attributes = new String[2]; |
|
400 |
attributes = (String[]) featureMaker.getAttributes() |
|
401 |
.get(j); |
|
402 |
auxRow[10 + j] = ValueFactory.createValue(new String( |
|
403 |
(String) attributes[1])); |
|
404 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
405 |
auxRow[10 + j] = ValueFactory |
|
406 |
.createValue(new String(fea |
|
407 |
.getProp(attributes[0]))); |
|
408 |
} |
|
409 |
} |
|
410 |
nuevoShp = new FPoint3D(pto.getX(), pto.getY(), pto.getZ()); |
|
329 | 411 |
addShape(nuevoShp, auxRow); |
330 |
} |
|
331 |
/*} else if (fea.getGeometry() instanceof InsPoint && !(fea.getGeometry() instanceof InsPoint3D)) { |
|
332 |
InsPoint insPoint = (InsPoint)fea.getGeometry(); |
|
333 |
Point2D pto = new Point2D.Double(); |
|
334 |
pto = (Point2D)insPoint.get(0); |
|
335 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
336 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("PointZ")); |
|
337 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
|
338 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
|
339 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
340 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
341 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
342 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
343 |
// Attributes |
|
344 |
for (int j=0;j<nAtt;j++) { |
|
345 |
String[] attributes = new String[2]; |
|
346 |
attributes = (String[])featureMaker.getAttributes().get(j); |
|
347 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1])); |
|
348 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
349 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0]))); |
|
350 |
} |
|
351 |
} |
|
352 |
FShape nuevoShp = new FPoint2D(pto.getX(),pto.getY()); |
|
353 |
addShape(nuevoShp, auxRow); |
|
354 |
} else if (fea.getGeometry() instanceof InsPoint3D) { |
|
355 |
InsPoint3D insPoint = (InsPoint3D)fea.getGeometry(); |
|
356 |
Point3D pto = new Point3D(); |
|
357 |
pto = (Point3D)insPoint.getPoint3D(0); |
|
358 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
359 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("PointZ")); |
|
360 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
|
361 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
|
362 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
363 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
364 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
365 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
366 |
// Attributes |
|
367 |
for (int j=0;j<nAtt;j++) { |
|
368 |
String[] attributes = new String[2]; |
|
369 |
attributes = (String[])featureMaker.getAttributes().get(j); |
|
370 |
auxRow[9+j] = ValueFactory.createValue(new String((String)attributes[1])); |
|
371 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
372 |
auxRow[9+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0]))); |
|
373 |
} |
|
374 |
} |
|
375 |
FShape nuevoShp = new FPoint3D(pto.getX(),pto.getY(),pto.getZ()); |
|
376 |
addShape(nuevoShp, auxRow);*/ |
|
377 |
} else if (fea.getGeometry() instanceof LineString && !(fea.getGeometry() instanceof LineString3D)) { |
|
412 |
} |
|
413 |
/* |
|
414 |
* } else if (fea.getGeometry() instanceof InsPoint && |
|
415 |
* !(fea.getGeometry() instanceof InsPoint3D)) { InsPoint |
|
416 |
* insPoint = (InsPoint)fea.getGeometry(); Point2D pto = new |
|
417 |
* Point2D.Double(); pto = (Point2D)insPoint.get(0); |
|
418 |
* auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
419 |
* auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new |
|
420 |
* String("PointZ")); auxRow[ID_FIELD_ENTITY] = |
|
421 |
* ValueFactory.createValue(new |
|
422 |
* String(fea.getProp("dxfEntity"))); auxRow[ID_FIELD_LAYER] = |
|
423 |
* ValueFactory.createValue(new String(fea.getProp("layer"))); |
|
424 |
* int auxInt = Integer.parseInt(fea.getProp("color")); |
|
425 |
* auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
426 |
* double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
427 |
* auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); // |
|
428 |
* Attributes for (int j=0;j<nAtt;j++) { String[] attributes = |
|
429 |
* new String[2]; attributes = |
|
430 |
* (String[])featureMaker.getAttributes().get(j); auxRow[9+j] = |
|
431 |
* ValueFactory.createValue(new String((String)attributes[1])); |
|
432 |
* if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
433 |
* auxRow[9+j] = ValueFactory.createValue(new |
|
434 |
* String(fea.getProp(attributes[0]))); } } FShape nuevoShp = |
|
435 |
* new FPoint2D(pto.getX(),pto.getY()); addShape(nuevoShp, |
|
436 |
* auxRow); } else if (fea.getGeometry() instanceof InsPoint3D) { |
|
437 |
* InsPoint3D insPoint = (InsPoint3D)fea.getGeometry(); Point3D |
|
438 |
* pto = new Point3D(); pto = (Point3D)insPoint.getPoint3D(0); |
|
439 |
* auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
440 |
* auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new |
|
441 |
* String("PointZ")); auxRow[ID_FIELD_ENTITY] = |
|
442 |
* ValueFactory.createValue(new |
|
443 |
* String(fea.getProp("dxfEntity"))); auxRow[ID_FIELD_LAYER] = |
|
444 |
* ValueFactory.createValue(new String(fea.getProp("layer"))); |
|
445 |
* int auxInt = Integer.parseInt(fea.getProp("color")); |
|
446 |
* auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
447 |
* double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
448 |
* auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); // |
|
449 |
* Attributes for (int j=0;j<nAtt;j++) { String[] attributes = |
|
450 |
* new String[2]; attributes = |
|
451 |
* (String[])featureMaker.getAttributes().get(j); auxRow[9+j] = |
|
452 |
* ValueFactory.createValue(new String((String)attributes[1])); |
|
453 |
* if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
454 |
* auxRow[9+j] = ValueFactory.createValue(new |
|
455 |
* String(fea.getProp(attributes[0]))); } } FShape nuevoShp = |
|
456 |
* new FPoint3D(pto.getX(),pto.getY(),pto.getZ()); |
|
457 |
* addShape(nuevoShp, auxRow); |
|
458 |
*/ |
|
459 |
} else if (fea.getGeometry() instanceof LineString |
|
460 |
&& !(fea.getGeometry() instanceof LineString3D)) { |
|
378 | 461 |
GeneralPathX genPathX = new GeneralPathX(); |
379 | 462 |
Point2D[] pts = new Point2D[fea.getGeometry().pointNr()]; |
380 |
for (int j=0; j<fea.getGeometry().pointNr(); j++) {
|
|
381 |
pts[j] = (Point2D)fea.getGeometry().get(j); |
|
463 |
for (int j = 0; j < fea.getGeometry().pointNr(); j++) {
|
|
464 |
pts[j] = (Point2D) fea.getGeometry().get(j);
|
|
382 | 465 |
} |
383 | 466 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
384 |
for (int j=1;j<pts.length;j++) {
|
|
467 |
for (int j = 1; j < pts.length; j++) {
|
|
385 | 468 |
genPathX.lineTo(pts[j].getX(), pts[j].getY()); |
386 | 469 |
} |
387 |
//double[] elevations = new double[pts.length]; |
|
388 |
//for (int j=0;j<pts.length;j++) { |
|
389 |
// elevations[j]=pts[j].getZ(); |
|
390 |
//} |
|
391 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
392 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline2D")); |
|
393 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
|
394 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
|
395 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
396 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
397 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
398 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
399 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
400 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
401 |
// Attributes |
|
402 |
for (int j=0;j<nAtt;j++) { |
|
403 |
String[] attributes = new String[2]; |
|
404 |
attributes = (String[])featureMaker.getAttributes().get(j); |
|
405 |
auxRow[10+j] = ValueFactory.createValue(new String((String)attributes[1])); |
|
406 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
407 |
auxRow[10+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0]))); |
|
408 |
} |
|
409 |
} |
|
470 |
// double[] elevations = new double[pts.length]; |
|
471 |
// for (int j=0;j<pts.length;j++) { |
|
472 |
// elevations[j]=pts[j].getZ(); |
|
473 |
// } |
|
474 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
475 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String( |
|
476 |
"FPolyline2D")); |
|
477 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String( |
|
478 |
fea.getProp("dxfEntity"))); |
|
479 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String( |
|
480 |
fea.getProp("layer"))); |
|
481 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
482 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
483 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
484 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
485 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
486 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
487 |
// Attributes |
|
488 |
for (int j = 0; j < nAtt; j++) { |
|
489 |
String[] attributes = new String[2]; |
|
490 |
attributes = (String[]) featureMaker.getAttributes().get(j); |
|
491 |
auxRow[10 + j] = ValueFactory.createValue(new String( |
|
492 |
(String) attributes[1])); |
|
493 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
494 |
auxRow[10 + j] = ValueFactory.createValue(new String( |
|
495 |
fea.getProp(attributes[0]))); |
|
496 |
} |
|
497 |
} |
|
410 | 498 |
FShape nuevoShp = new FPolyline2D(genPathX); |
411 | 499 |
addShape(nuevoShp, auxRow); |
412 | 500 |
} else if (fea.getGeometry() instanceof LineString3D) { |
413 | 501 |
GeneralPathX genPathX = new GeneralPathX(); |
414 | 502 |
Point3D[] pts = new Point3D[fea.getGeometry().pointNr()]; |
415 |
for (int j=0; j<fea.getGeometry().pointNr(); j++) {
|
|
416 |
pts[j] = ((LineString3D)fea.getGeometry()).getPoint3D(j); |
|
503 |
for (int j = 0; j < fea.getGeometry().pointNr(); j++) {
|
|
504 |
pts[j] = ((LineString3D) fea.getGeometry()).getPoint3D(j);
|
|
417 | 505 |
} |
418 | 506 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
419 |
for (int j=1;j<pts.length;j++) {
|
|
507 |
for (int j = 1; j < pts.length; j++) {
|
|
420 | 508 |
genPathX.lineTo(pts[j].getX(), pts[j].getY()); |
421 | 509 |
} |
422 |
double[] elevations = new double[pts.length]; |
|
423 |
for (int j=0;j<pts.length;j++) { |
|
424 |
elevations[j]=pts[j].getZ(); |
|
425 |
} |
|
426 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
427 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolyline3D")); |
|
428 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
|
429 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
|
430 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
431 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
432 |
if (fea.getProp("elevation")!=null) { |
|
433 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
434 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
435 |
} |
|
436 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
437 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
438 |
// Attributes |
|
439 |
for (int j=0;j<nAtt;j++) { |
|
440 |
String[] attributes = new String[2]; |
|
441 |
attributes = (String[])featureMaker.getAttributes().get(j); |
|
442 |
auxRow[10+j] = ValueFactory.createValue(new String((String)attributes[1])); |
|
443 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
444 |
auxRow[10+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0]))); |
|
445 |
} |
|
446 |
} |
|
510 |
double[] elevations = new double[pts.length]; |
|
511 |
for (int j = 0; j < pts.length; j++) { |
|
512 |
elevations[j] = pts[j].getZ(); |
|
513 |
} |
|
514 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
515 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String( |
|
516 |
"FPolyline3D")); |
|
517 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String( |
|
518 |
fea.getProp("dxfEntity"))); |
|
519 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String( |
|
520 |
fea.getProp("layer"))); |
|
521 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
522 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
523 |
if (fea.getProp("elevation") != null) { |
|
524 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
525 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
526 |
} |
|
527 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
528 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
529 |
// Attributes |
|
530 |
for (int j = 0; j < nAtt; j++) { |
|
531 |
String[] attributes = new String[2]; |
|
532 |
attributes = (String[]) featureMaker.getAttributes().get(j); |
|
533 |
auxRow[10 + j] = ValueFactory.createValue(new String( |
|
534 |
(String) attributes[1])); |
|
535 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
536 |
auxRow[10 + j] = ValueFactory.createValue(new String( |
|
537 |
fea.getProp(attributes[0]))); |
|
538 |
} |
|
539 |
} |
|
447 | 540 |
FShape nuevoShp = new FPolyline3D(genPathX, elevations); |
448 | 541 |
addShape(nuevoShp, auxRow); |
449 |
} else if (fea.getGeometry() instanceof Polygon && !(fea.getGeometry() instanceof Polygon3D)) { |
|
542 |
} else if (fea.getGeometry() instanceof Polygon |
|
543 |
&& !(fea.getGeometry() instanceof Polygon3D)) { |
|
450 | 544 |
GeneralPathX genPathX = new GeneralPathX(); |
451 |
// 050112: A?ado una posici?n m?s para el punto que cierra y
|
|
452 |
// creo el objeto firstPt.
|
|
545 |
// 050112: A?ado una posici?n m?s para el punto que cierra y |
|
546 |
// creo el objeto firstPt. |
|
453 | 547 |
Point2D firstPt = new Point2D.Double(); |
454 |
firstPt = (Point2D)fea.getGeometry().get(0); |
|
455 |
Point2D[] pts = new Point2D[fea.getGeometry().pointNr()+1];
|
|
456 |
for (int j=0; j<fea.getGeometry().pointNr(); j++) {
|
|
457 |
pts[j] = (Point2D)fea.getGeometry().get(j); |
|
548 |
firstPt = (Point2D) fea.getGeometry().get(0);
|
|
549 |
Point2D[] pts = new Point2D[fea.getGeometry().pointNr() + 1];
|
|
550 |
for (int j = 0; j < fea.getGeometry().pointNr(); j++) {
|
|
551 |
pts[j] = (Point2D) fea.getGeometry().get(j);
|
|
458 | 552 |
} |
459 |
// 050112: A?ado el primer punto al final para cerrar los pol?gonos. |
|
553 |
// 050112: A?ado el primer punto al final para cerrar los |
|
554 |
// pol?gonos. |
|
460 | 555 |
pts[fea.getGeometry().pointNr()] = firstPt; |
461 | 556 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
462 |
for (int j=1; j < pts.length; j++) {
|
|
557 |
for (int j = 1; j < pts.length; j++) {
|
|
463 | 558 |
genPathX.lineTo(pts[j].getX(), pts[j].getY()); |
464 | 559 |
} |
465 |
//double[] elevations = new double[pts.length]; |
|
466 |
//for (int j=0;j<pts.length;j++) { |
|
467 |
// elevations[j]=pts[j].getZ(); |
|
468 |
//} |
|
469 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
470 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolygon2D")); |
|
471 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
|
472 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
|
473 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
474 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
475 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
476 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
477 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
478 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
479 |
// Attributes |
|
480 |
for (int j=0;j<nAtt;j++) { |
|
481 |
String[] attributes = new String[2]; |
|
482 |
attributes = (String[])featureMaker.getAttributes().get(j); |
|
483 |
auxRow[10+j] = ValueFactory.createValue(new String((String)attributes[1])); |
|
484 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
485 |
auxRow[10+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0]))); |
|
486 |
} |
|
487 |
} |
|
560 |
// double[] elevations = new double[pts.length]; |
|
561 |
// for (int j=0;j<pts.length;j++) { |
|
562 |
// elevations[j]=pts[j].getZ(); |
|
563 |
// } |
|
564 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
565 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String( |
|
566 |
"FPolygon2D")); |
|
567 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String( |
|
568 |
fea.getProp("dxfEntity"))); |
|
569 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String( |
|
570 |
fea.getProp("layer"))); |
|
571 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
572 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
573 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
574 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
575 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
576 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
577 |
// Attributes |
|
578 |
for (int j = 0; j < nAtt; j++) { |
|
579 |
String[] attributes = new String[2]; |
|
580 |
attributes = (String[]) featureMaker.getAttributes().get(j); |
|
581 |
auxRow[10 + j] = ValueFactory.createValue(new String( |
|
582 |
(String) attributes[1])); |
|
583 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
584 |
auxRow[10 + j] = ValueFactory.createValue(new String( |
|
585 |
fea.getProp(attributes[0]))); |
|
586 |
} |
|
587 |
} |
|
488 | 588 |
FShape nuevoShp = new FPolygon2D(genPathX); |
489 | 589 |
addShape(nuevoShp, auxRow); |
490 | 590 |
} else if (fea.getGeometry() instanceof Polygon3D) { |
491 | 591 |
GeneralPathX genPathX = new GeneralPathX(); |
492 |
// 050112: A?ado una posici?n m?s para el punto que cierra y
|
|
493 |
// creo el objeto firstPt.
|
|
592 |
// 050112: A?ado una posici?n m?s para el punto que cierra y |
|
593 |
// creo el objeto firstPt. |
|
494 | 594 |
Point3D firstPt = new Point3D(); |
495 |
firstPt = (Point3D)((Polygon3D)fea.getGeometry()).getPoint3D(0); |
|
496 |
Point3D[] pts = new Point3D[fea.getGeometry().pointNr()+1]; |
|
497 |
for (int j=0; j<fea.getGeometry().pointNr(); j++) { |
|
498 |
pts[j] = (Point3D)((Polygon3D)fea.getGeometry()).getPoint3D(j); |
|
595 |
firstPt = (Point3D) ((Polygon3D) fea.getGeometry()) |
|
596 |
.getPoint3D(0); |
|
597 |
Point3D[] pts = new Point3D[fea.getGeometry().pointNr() + 1]; |
|
598 |
for (int j = 0; j < fea.getGeometry().pointNr(); j++) { |
|
599 |
pts[j] = (Point3D) ((Polygon3D) fea.getGeometry()) |
|
600 |
.getPoint3D(j); |
|
499 | 601 |
} |
500 |
// 050112: A?ado el primer punto al final para cerrar los pol?gonos. |
|
602 |
// 050112: A?ado el primer punto al final para cerrar los |
|
603 |
// pol?gonos. |
|
501 | 604 |
pts[fea.getGeometry().pointNr()] = firstPt; |
502 | 605 |
genPathX.moveTo(pts[0].getX(), pts[0].getY()); |
503 |
for (int j=1; j < pts.length; j++) {
|
|
606 |
for (int j = 1; j < pts.length; j++) {
|
|
504 | 607 |
genPathX.lineTo(pts[j].getX(), pts[j].getY()); |
505 | 608 |
} |
506 |
double[] elevations = new double[pts.length]; |
|
507 |
for (int j=0;j<pts.length;j++) { |
|
508 |
elevations[j]=pts[j].getZ(); |
|
509 |
} |
|
510 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
511 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String("FPolygon3D")); |
|
512 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String(fea.getProp("dxfEntity"))); |
|
513 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String(fea.getProp("layer"))); |
|
514 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
515 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
516 |
if (fea.getProp("elevation")!=null) { |
|
517 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
518 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
519 |
} |
|
520 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
521 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
522 |
// Attributes |
|
523 |
for (int j=0;j<nAtt;j++) { |
|
524 |
String[] attributes = new String[2]; |
|
525 |
attributes = (String[])featureMaker.getAttributes().get(j); |
|
526 |
auxRow[10+j] = ValueFactory.createValue(new String((String)attributes[1])); |
|
527 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
528 |
auxRow[10+j] = ValueFactory.createValue(new String(fea.getProp(attributes[0]))); |
|
529 |
} |
|
530 |
} |
|
609 |
double[] elevations = new double[pts.length]; |
|
610 |
for (int j = 0; j < pts.length; j++) { |
|
611 |
elevations[j] = pts[j].getZ(); |
|
612 |
} |
|
613 |
auxRow[ID_FIELD_ID] = ValueFactory.createValue(i); |
|
614 |
auxRow[ID_FIELD_FSHAPE] = ValueFactory.createValue(new String( |
|
615 |
"FPolygon3D")); |
|
616 |
auxRow[ID_FIELD_ENTITY] = ValueFactory.createValue(new String( |
|
617 |
fea.getProp("dxfEntity"))); |
|
618 |
auxRow[ID_FIELD_LAYER] = ValueFactory.createValue(new String( |
|
619 |
fea.getProp("layer"))); |
|
620 |
int auxInt = Integer.parseInt(fea.getProp("color")); |
|
621 |
auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(auxInt); |
|
622 |
if (fea.getProp("elevation") != null) { |
|
623 |
double auxE = Double.parseDouble(fea.getProp("elevation")); |
|
624 |
auxRow[ID_FIELD_ELEVATION] = ValueFactory.createValue(auxE); |
|
625 |
} |
|
626 |
double auxT = Double.parseDouble(fea.getProp("thickness")); |
|
627 |
auxRow[ID_FIELD_THICKNESS] = ValueFactory.createValue(auxT); |
|
628 |
// Attributes |
|
629 |
for (int j = 0; j < nAtt; j++) { |
|
630 |
String[] attributes = new String[2]; |
|
631 |
attributes = (String[]) featureMaker.getAttributes().get(j); |
|
632 |
auxRow[10 + j] = ValueFactory.createValue(new String( |
|
633 |
(String) attributes[1])); |
|
634 |
if (!fea.getProp(attributes[0]).equals(attributes[1])) { |
|
635 |
auxRow[10 + j] = ValueFactory.createValue(new String( |
|
636 |
fea.getProp(attributes[0]))); |
|
637 |
} |
|
638 |
} |
|
531 | 639 |
FShape nuevoShp = new FPolygon3D(genPathX, elevations); |
532 | 640 |
addShape(nuevoShp, auxRow); |
533 | 641 |
} else { |
534 |
//System.out.println("Detectado feature desconocido"); |
|
642 |
// System.out.println("Detectado feature desconocido");
|
|
535 | 643 |
} |
536 | 644 |
} |
537 |
|
|
538 |
defaultLegend = LegendFactory.createVectorialUniqueValueLegend(getShapeType()); |
|
645 |
|
|
646 |
defaultLegend = LegendFactory |
|
647 |
.createVectorialUniqueValueLegend(getShapeType()); |
|
539 | 648 |
defaultLegend.setFieldName("Color"); |
540 | 649 |
defaultLegend.setLabelField("Text"); |
541 | 650 |
defaultLegend.setDefaultSymbol(new FSymbol(getShapeType())); |
542 | 651 |
defaultLegend.getDefaultSymbol().setShapeVisible(false); |
543 | 652 |
defaultLegend.getDefaultSymbol().setFontSizeInPixels(false); |
544 |
defaultLegend.getDefaultSymbol().setFont(new Font("SansSerif", Font.PLAIN, 9)); |
|
653 |
defaultLegend.getDefaultSymbol().setFont( |
|
654 |
new Font("SansSerif", Font.PLAIN, 9)); |
|
545 | 655 |
defaultLegend.getDefaultSymbol().setFontColor(Color.BLACK); |
546 | 656 |
defaultLegend.getDefaultSymbol().setFontSize(heightText); |
547 |
defaultLegend.getDefaultSymbol().setStyle(FConstant.SYMBOL_STYLE_DGNSPECIAL); |
|
657 |
defaultLegend.getDefaultSymbol().setStyle( |
|
658 |
FConstant.SYMBOL_STYLE_DGNSPECIAL); |
|
548 | 659 |
defaultLegend.getDefaultSymbol().setSize(3); |
549 | 660 |
defaultLegend.getDefaultSymbol().setSizeInPixels(true); |
550 |
|
|
661 |
|
|
551 | 662 |
defaultLegend.setLabelHeightField("HeightText"); |
552 | 663 |
defaultLegend.setLabelRotationField("RotationText"); |
553 |
|
|
664 |
|
|
554 | 665 |
ObjectDriver rs = this; |
555 | 666 |
IntValue clave; |
556 | 667 |
FSymbol theSymbol = null; |
557 |
|
|
668 |
|
|
558 | 669 |
try { |
559 |
// TODO: Provisional hasta que cambiemos los s?mbolos. |
|
560 |
/* BufferedImage bi= new BufferedImage(5, 5, BufferedImage.TYPE_INT_ARGB); |
|
561 |
Graphics2D big = bi.createGraphics(); |
|
562 |
Color color=new Color(0,0,0,0); |
|
563 |
big.setBackground(color); |
|
564 |
big.clearRect(0, 0, 5, 5); |
|
565 |
Paint fillProv = null; |
|
566 |
Rectangle2D rProv = new Rectangle(); |
|
567 |
rProv.setFrame(0, 0,5,5); |
|
568 |
fillProv = new TexturePaint(bi,rProv); */ |
|
569 |
|
|
570 |
for (long j = 0; j < rs.getRowCount(); j++) |
|
571 |
{ |
|
572 |
clave = (IntValue)rs.getFieldValue(j,ID_FIELD_COLOR); |
|
573 |
if (defaultLegend.getSymbolByValue(clave) == null) |
|
574 |
{ |
|
670 |
// TODO: Provisional hasta que cambiemos los s?mbolos. |
|
671 |
/* |
|
672 |
* BufferedImage bi= new BufferedImage(5, 5, |
|
673 |
* BufferedImage.TYPE_INT_ARGB); Graphics2D big = |
|
674 |
* bi.createGraphics(); Color color=new Color(0,0,0,0); |
|
675 |
* big.setBackground(color); big.clearRect(0, 0, 5, 5); Paint |
|
676 |
* fillProv = null; Rectangle2D rProv = new Rectangle(); |
|
677 |
* rProv.setFrame(0, 0,5,5); fillProv = new TexturePaint(bi,rProv); |
|
678 |
*/ |
|
679 |
|
|
680 |
for (long j = 0; j < rs.getRowCount(); j++) { |
|
681 |
clave = (IntValue) rs.getFieldValue(j, ID_FIELD_COLOR); |
|
682 |
if (defaultLegend.getSymbolByValue(clave) == null) { |
|
575 | 683 |
theSymbol = new FSymbol(getShapeType()); |
576 | 684 |
theSymbol.setDescription(clave.toString()); |
577 | 685 |
theSymbol.setColor(AcadColor.getColor(clave.getValue())); |
578 | 686 |
// theSymbol.setFill(fillProv); |
579 |
// 050202, jmorell: Asigna los colores de Autocad a los bordes |
|
580 |
// de los pol?gonos. |
|
581 |
theSymbol.setOutlineColor(AcadColor.getColor(clave.getValue())); |
|
582 |
|
|
687 |
// 050202, jmorell: Asigna los colores de Autocad a los |
|
688 |
// bordes |
|
689 |
// de los pol?gonos. |
|
690 |
theSymbol.setOutlineColor(AcadColor.getColor(clave |
|
691 |
.getValue())); |
|
692 |
|
|
583 | 693 |
theSymbol.setStyle(FConstant.SYMBOL_STYLE_DGNSPECIAL); |
584 | 694 |
theSymbol.setSize(3); |
585 | 695 |
theSymbol.setSizeInPixels(true); |
586 |
|
|
696 |
|
|
587 | 697 |
defaultLegend.addSymbol(clave, theSymbol); |
588 | 698 |
} |
589 | 699 |
} // for |
590 | 700 |
} catch (DriverException e) { |
591 | 701 |
e.printStackTrace(); |
592 |
throw new IOException("Error al poner la leyenda por defecto en el DXF"); |
|
702 |
throw new IOException( |
|
703 |
"Error al poner la leyenda por defecto en el DXF"); |
|
593 | 704 |
} |
594 | 705 |
} |
595 | 706 |
|
596 |
/* (non-Javadoc) |
|
707 |
/* |
|
708 |
* (non-Javadoc) |
|
709 |
* |
|
597 | 710 |
* @see com.iver.cit.gvsig.fmap.drivers.MemoryDriver#accept(java.io.File) |
598 | 711 |
*/ |
599 | 712 |
public boolean accept(File f) { |
600 | 713 |
return f.getName().toUpperCase().endsWith("DXF"); |
601 | 714 |
} |
602 | 715 |
|
603 |
/* (non-Javadoc) |
|
716 |
/* |
|
717 |
* (non-Javadoc) |
|
718 |
* |
|
604 | 719 |
* @see com.iver.cit.gvsig.fmap.drivers.MemoryDriver#getShapeType() |
605 | 720 |
*/ |
606 | 721 |
public int getShapeType() { |
607 | 722 |
return FShape.MULTI; |
608 | 723 |
} |
609 | 724 |
|
610 |
/* (non-Javadoc) |
|
725 |
/* |
|
726 |
* (non-Javadoc) |
|
727 |
* |
|
611 | 728 |
* @see com.iver.cit.gvsig.fmap.drivers.MemoryDriver#getName() |
612 | 729 |
*/ |
613 | 730 |
public String getName() { |
614 | 731 |
return "gvSIG DXF Memory Driver"; |
615 | 732 |
} |
616 | 733 |
|
617 |
/* (non-Javadoc) |
|
734 |
/* |
|
735 |
* (non-Javadoc) |
|
736 |
* |
|
618 | 737 |
* @see com.iver.cit.gvsig.fmap.drivers.WithDefaultLegend#getDefaultLegend() |
619 | 738 |
*/ |
620 | 739 |
public Legend getDefaultLegend() { |
621 | 740 |
return defaultLegend; |
622 | 741 |
} |
623 | 742 |
|
624 |
/* (non-Javadoc) |
|
625 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialDriver#getDriverAttributes() |
|
626 |
*/ |
|
627 |
public DriverAttributes getDriverAttributes() { |
|
628 |
return attr; |
|
629 |
} |
|
630 |
/** |
|
631 |
* @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#getPrimaryKeys() |
|
632 |
*/ |
|
633 |
public int[] getPrimaryKeys() throws DriverException { |
|
634 |
return null; |
|
635 |
} |
|
743 |
/* |
|
744 |
* (non-Javadoc) |
|
745 |
* |
|
746 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialDriver#getDriverAttributes() |
|
747 |
*/ |
|
748 |
public DriverAttributes getDriverAttributes() { |
|
749 |
return attr; |
|
750 |
} |
|
636 | 751 |
|
637 |
/** |
|
638 |
* @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#write(com.hardcode.gdbms.engine.data.edition.DataWare) |
|
639 |
*/ |
|
640 |
public void write(DataWare arg0) throws DriverException { |
|
641 |
// TODO Auto-generated method stub |
|
642 |
|
|
643 |
} |
|
752 |
/** |
|
753 |
* @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#getPrimaryKeys() |
|
754 |
*/ |
|
755 |
public int[] getPrimaryKeys() throws DriverException { |
|
756 |
return null; |
|
757 |
} |
|
644 | 758 |
|
645 |
/* (non-Javadoc) |
|
646 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#close() |
|
647 |
*/ |
|
648 |
public void close() throws IOException { |
|
649 |
// TODO Auto-generated method stub |
|
650 |
|
|
651 |
} |
|
759 |
/** |
|
760 |
* @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#write(com.hardcode.gdbms.engine.data.edition.DataWare) |
|
761 |
*/ |
|
762 |
public void write(DataWare arg0) throws DriverException { |
|
763 |
// TODO Auto-generated method stub |
|
652 | 764 |
|
765 |
} |
|
766 |
|
|
767 |
/* |
|
768 |
* (non-Javadoc) |
|
769 |
* |
|
770 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver#close() |
|
771 |
*/ |
|
772 |
public void close() throws IOException { |
|
773 |
// TODO Auto-generated method stub |
|
774 |
|
|
775 |
} |
|
776 |
|
|
653 | 777 |
public File getFile() { |
654 | 778 |
return m_Fich; |
655 | 779 |
} |
656 | 780 |
|
781 |
public boolean canWriteGeometry(int gvSIGgeometryType) { |
|
782 |
return dxfWriter.canWriteGeometry(gvSIGgeometryType); |
|
783 |
} |
|
657 | 784 |
|
785 |
public void initialize(FLayer layer) throws EditionException { |
|
786 |
int aux = (int) (Math.random() * 1000); |
|
787 |
fTemp = new File(tempDirectoryPath + "/tmpDxf" + aux + ".dxf"); |
|
788 |
dxfWriter.setFile(fTemp); |
|
789 |
|
|
790 |
dxfWriter.initialize(layer); |
|
791 |
/* |
|
792 |
* arrayFields.add("ID"); arrayFields.add("FShape"); |
|
793 |
* arrayFields.add("Entity"); arrayFields.add("Layer"); |
|
794 |
* arrayFields.add("Color"); arrayFields.add("Elevation"); |
|
795 |
* arrayFields.add("Thickness"); arrayFields.add("Text"); |
|
796 |
* arrayFields.add("HeightText"); arrayFields.add("RotationText"); |
|
797 |
*/ |
|
798 |
|
|
799 |
DxfFieldsMapping fieldsMapping = new DxfFieldsMapping(); |
|
800 |
fieldsMapping.setLayerField("Layer"); |
|
801 |
fieldsMapping.setColorField("Color"); |
|
802 |
fieldsMapping.setElevationField("Elevation"); |
|
803 |
fieldsMapping.setThicknessField("Thickness"); |
|
804 |
fieldsMapping.setTextField("Text"); |
|
805 |
fieldsMapping.setHeightText("HeightText"); |
|
806 |
fieldsMapping.setRotationText("Layer"); |
|
807 |
dxfWriter.setFieldMapping(fieldsMapping); |
|
808 |
dxfWriter.setProjection(layer.getProjection()); |
|
809 |
} |
|
810 |
|
|
811 |
public void preProcess() throws EditionException { |
|
812 |
dxfWriter.preProcess(); |
|
813 |
} |
|
814 |
|
|
815 |
public void process(IRowEdited row) throws EditionException { |
|
816 |
dxfWriter.process(row); |
|
817 |
} |
|
818 |
|
|
819 |
public void postProcess() throws EditionException { |
|
820 |
dxfWriter.postProcess(); |
|
821 |
try { |
|
822 |
|
|
823 |
// close(); |
|
824 |
|
|
825 |
// Dxf |
|
826 |
FileChannel fcinDxf = new FileInputStream(fTemp).getChannel(); |
|
827 |
FileChannel fcoutDxf = new FileOutputStream(m_Fich).getChannel(); |
|
828 |
DriverUtilities.copy(fcinDxf, fcoutDxf); |
|
829 |
|
|
830 |
// Borramos los temporales |
|
831 |
fTemp.delete(); |
|
832 |
reLoad(); |
|
833 |
|
|
834 |
} catch (FileNotFoundException e) { |
|
835 |
e.printStackTrace(); |
|
836 |
throw new EditionException(e); |
|
837 |
} catch (IOException e) { |
|
838 |
e.printStackTrace(); |
|
839 |
throw new EditionException(e); |
|
840 |
} |
|
841 |
|
|
842 |
} |
|
843 |
|
|
844 |
public String getCapability(String capability) { |
|
845 |
return dxfWriter.getCapability(capability); |
|
846 |
} |
|
847 |
|
|
848 |
public void setCapabilities(Properties capabilities) { |
|
849 |
dxfWriter.setCapabilities(capabilities); |
|
850 |
|
|
851 |
} |
|
852 |
|
|
853 |
public boolean canWriteAttribute(int sqlType) { |
|
854 |
return dxfWriter.canWriteAttribute(sqlType); |
|
855 |
} |
|
856 |
|
|
857 |
/* |
|
858 |
* (non-Javadoc) |
|
859 |
* |
|
860 |
* @see com.iver.cit.gvsig.fmap.drivers.MemoryDriver#reLoad() |
|
861 |
*/ |
|
862 |
public void reLoad() throws IOException { |
|
863 |
super.reLoad(); |
|
864 |
try { |
|
865 |
initialize(); |
|
866 |
} catch (IOException e) { |
|
867 |
e.printStackTrace(); |
|
868 |
throw new IOException("DXF: Error reloading " + path + " file."); |
|
869 |
} |
|
870 |
} |
|
871 |
|
|
658 | 872 |
} |
Also available in: Unified diff