svn-gvsig-desktop / branches / v02_desarrollo / libraries / libCq CMS for java.old / src / org / cresques / px / dxf / DxfFeatureMaker.java @ 1607
History | View | Annotate | Download (80.7 KB)
1 |
package org.cresques.px.dxf; |
---|---|
2 |
|
3 |
import org.cresques.cts.ICoordTrans; |
4 |
import org.cresques.cts.IProjection; |
5 |
import org.cresques.geo.Point3D; |
6 |
import org.cresques.geo.Projected; |
7 |
import org.cresques.geo.ViewPortData; |
8 |
import org.cresques.io.DxfFile; |
9 |
import org.cresques.io.DxfGroup; |
10 |
import org.cresques.io.DxfGroupVector; |
11 |
import org.cresques.px.Extent; |
12 |
import org.cresques.px.IObjList; |
13 |
import org.cresques.px.gml.Feature; |
14 |
import org.cresques.px.gml.FeatureCollection; |
15 |
import org.cresques.px.gml.InsPoint; |
16 |
import org.cresques.px.gml.LineString; |
17 |
import org.cresques.px.gml.Point; |
18 |
import org.cresques.px.gml.Polygon; |
19 |
|
20 |
import java.util.HashSet; |
21 |
import java.util.Iterator; |
22 |
import java.util.Set; |
23 |
import java.util.Vector; |
24 |
import java.awt.Graphics2D; |
25 |
import java.awt.geom.GeneralPath; |
26 |
import java.awt.geom.Point2D; |
27 |
|
28 |
/**
|
29 |
* Implementaci?n de la creaci?n de features de un DXF2000.
|
30 |
*/
|
31 |
public class DxfFeatureMaker implements DxfFile.EntityFactory, Projected { |
32 |
IProjection proj = null;
|
33 |
//Feature lastFeature = null;
|
34 |
Feature lastFeaBordes = null;
|
35 |
Feature lastFeaFondos = null;
|
36 |
boolean isDoubleFeatured = false; |
37 |
FeatureCollection features = null;
|
38 |
double bulge = 0.0; |
39 |
double xtruX=0.0, xtruY=0.0, xtruZ=1.0; |
40 |
int polylineFlag = 0; |
41 |
Point2D firstPt = new Point2D.Double(); |
42 |
Point2D ptAnterior = null; |
43 |
|
44 |
boolean addingToBlock = false; |
45 |
int iterator = 0; |
46 |
FeatureCollection blk = null;
|
47 |
Vector blkList = null; |
48 |
DxfTable layers = null;
|
49 |
|
50 |
private Vector faces = null; |
51 |
private boolean hasFaces = false; |
52 |
private int facesIterador = 1; |
53 |
private Point2D facesFirstPoint = null; |
54 |
|
55 |
private Vector attributes = null; |
56 |
|
57 |
public DxfFeatureMaker(IProjection proj) {
|
58 |
this.proj = proj;
|
59 |
layers = new DxfTable();
|
60 |
features = new FeatureCollection(proj);
|
61 |
blkList = new Vector(); |
62 |
attributes = new Vector(); |
63 |
} |
64 |
|
65 |
public void setAddingToBlock(boolean a) { addingToBlock = a; } |
66 |
|
67 |
public void createLayer(DxfGroupVector v) throws Exception { |
68 |
int color = v.getDataAsInt(62); |
69 |
DxfLayer layer = new DxfLayer(v.getDataAsString(2), Math.abs(v.getDataAsInt(62))); |
70 |
if (color < 0) { |
71 |
layer.isOff = true;
|
72 |
} |
73 |
layer.lType = v.getDataAsString(6);
|
74 |
layer.setFlags(v.getDataAsInt(70));
|
75 |
// compruebo flags
|
76 |
if ((layer.flags & 0x01) == 0x01) { |
77 |
layer.frozen = true;
|
78 |
} |
79 |
if ((layer.flags & 0x02) == 0x02) { |
80 |
layer.frozen = true;
|
81 |
} |
82 |
System.out.println("LAYER color="+layer.getColor()); |
83 |
|
84 |
layers.add(layer); |
85 |
} |
86 |
|
87 |
public void createPolyline(DxfGroupVector grp) throws Exception { |
88 |
LineString lineString = new LineString();
|
89 |
Polygon polygon = new Polygon(); |
90 |
//Feature feature= new Feature();
|
91 |
Feature feaBordes= new Feature();
|
92 |
Feature feaFondos= new Feature();
|
93 |
double x = 0.0, y = 0.0, z = 0.0; |
94 |
int flags = 0; |
95 |
|
96 |
// 041122: Cada polyline tiene asociado un objeto faces distinto.
|
97 |
faces = new Vector(); |
98 |
|
99 |
//feature.setProp("dxfEntity", "Polyline");
|
100 |
feaBordes.setProp("dxfEntity", "Polyline"); |
101 |
feaFondos.setProp("dxfEntity", "Polyline"); |
102 |
if (grp.hasCode(8)) { |
103 |
//feature.setProp("layer", grp.getDataAsString(8));
|
104 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
105 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
106 |
} |
107 |
if (grp.hasCode(39)) { |
108 |
Double doub = new Double(grp.getDataAsDouble(39)); |
109 |
String string = doub.toString();
|
110 |
//feature.setProp("thickness", string);
|
111 |
feaBordes.setProp("thickness", string);
|
112 |
feaFondos.setProp("thickness", string);
|
113 |
} else {
|
114 |
Double doub = new Double(0.0); |
115 |
//feature.setProp("thickness", doub.toString());
|
116 |
feaBordes.setProp("thickness", doub.toString());
|
117 |
feaFondos.setProp("thickness", doub.toString());
|
118 |
} |
119 |
if (grp.hasCode(62)) { |
120 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
121 |
String string = integer.toString();
|
122 |
//feature.setProp("color", string);
|
123 |
feaBordes.setProp("color", string);
|
124 |
feaFondos.setProp("color", string);
|
125 |
feaBordes.setProp("colorByLayer", "false"); |
126 |
feaFondos.setProp("colorByLayer", "false"); |
127 |
} else {
|
128 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
129 |
int clr = layer.colorNumber;
|
130 |
Integer integer = new Integer(clr); |
131 |
String string = integer.toString();
|
132 |
//feature.setProp("color", string);
|
133 |
feaBordes.setProp("color", string);
|
134 |
feaFondos.setProp("color", string);
|
135 |
feaBordes.setProp("colorByLayer", "true"); |
136 |
feaFondos.setProp("colorByLayer", "true"); |
137 |
} |
138 |
if (grp.hasCode(10)) |
139 |
x = grp.getDataAsDouble(10);
|
140 |
if (grp.hasCode(20)) |
141 |
y = grp.getDataAsDouble(20);
|
142 |
if (grp.hasCode(30)) { |
143 |
z = grp.getDataAsDouble(30);
|
144 |
Double doub = new Double(z); |
145 |
String string = doub.toString();
|
146 |
//feature.setProp("elevation", string);
|
147 |
feaBordes.setProp("elevation", string);
|
148 |
feaFondos.setProp("elevation", string);
|
149 |
} else {
|
150 |
Double doub = new Double(0.0); |
151 |
//feature.setProp("elevation", doub.toString());
|
152 |
feaBordes.setProp("elevation", doub.toString());
|
153 |
feaFondos.setProp("elevation", doub.toString());
|
154 |
} |
155 |
if (grp.hasCode(70)) |
156 |
flags = grp.getDataAsInt(70);
|
157 |
if (grp.hasCode(210)) |
158 |
xtruX = grp.getDataAsDouble(210);
|
159 |
if (grp.hasCode(220)) |
160 |
xtruY = grp.getDataAsDouble(220);
|
161 |
if (grp.hasCode(230)) |
162 |
xtruZ = grp.getDataAsDouble(230);
|
163 |
if ((flags & 0x01) == 0x01 || (flags & 0x40) == 0x40) { |
164 |
feaBordes.setGeometry(lineString); |
165 |
feaFondos.setGeometry(polygon); |
166 |
lastFeaBordes = feaBordes; |
167 |
lastFeaFondos = feaFondos; |
168 |
isDoubleFeatured = true;
|
169 |
} else if ((flags & 0x01) == 0x00) { |
170 |
feaBordes.setGeometry(lineString); |
171 |
lastFeaBordes = feaBordes; |
172 |
isDoubleFeatured = false;
|
173 |
} else {
|
174 |
System.out.println("Detectada una Polyline Flag que no corresponde"); |
175 |
System.out.println("a una Polyline corriente, ni a una Closed Polyline"); |
176 |
} |
177 |
} |
178 |
|
179 |
public void endSeq() throws Exception { |
180 |
if (isDoubleFeatured) {
|
181 |
if (lastFeaBordes.getGeometry() instanceof LineString) { |
182 |
Feature feaBordes = lastFeaBordes; |
183 |
Feature feaFondos = lastFeaFondos; |
184 |
LineString lineString = (LineString)feaBordes.getGeometry(); |
185 |
Polygon polygon = (Polygon)feaFondos.getGeometry(); |
186 |
lineString.add(firstPt); |
187 |
// 041103: linea anulada porque hay pol?gonos en los que al final
|
188 |
// a?ade el (0,0). Parece que a?adimos el punto inicial
|
189 |
// del pol?gono una vez pero parece que el pol?gono, por
|
190 |
// el hecho de ser pol?gono, ya se a?ade el punto inicial
|
191 |
// al final, con lo que estamos duplicando el punto inicial
|
192 |
// del pol?gono al final del mismo.
|
193 |
//polygon.add(firstPt);
|
194 |
if (bulge!=0) { |
195 |
|
196 |
// 041122: Correcci?n del bug en los bulges de FIXT3.DXF
|
197 |
Vector arc = createArc((Point2D)(lineString.get(lineString.pointNr()-2)), (Point2D)(lineString.get(lineString.pointNr()-1)), bulge); |
198 |
lineString.remove(lineString.pointNr()-1);
|
199 |
lineString.remove(lineString.pointNr()-1);
|
200 |
polygon.remove(lineString.pointNr()-1);
|
201 |
polygon.remove(lineString.pointNr()-1);
|
202 |
if (bulge>0) { |
203 |
for (int i=0; i<arc.size(); i++) { |
204 |
Point2D ptAux = new Point2D.Double(); |
205 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
206 |
lineString.add(ptAux); |
207 |
polygon.add(ptAux); |
208 |
if (lineString.pointNr() == 1) firstPt = ptAux; |
209 |
} |
210 |
} else {
|
211 |
for (int i=arc.size()-1; i>=0; i--) { |
212 |
Point2D ptAux = new Point2D.Double(); |
213 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
214 |
lineString.add(ptAux); |
215 |
polygon.add(ptAux); |
216 |
if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux; |
217 |
} |
218 |
} |
219 |
// 041122
|
220 |
|
221 |
bulge = 0.0;
|
222 |
} |
223 |
|
224 |
if (hasFaces) {
|
225 |
//System.out.println("Sabe que es un poligono.");
|
226 |
//System.out.println("POLYLINE: caras=" +faces.size()+", puntos="+ lineString.pointNr());
|
227 |
LineString ls1 = new LineString();
|
228 |
Polygon pl1 = new Polygon(); |
229 |
LineString ls2 = new LineString();
|
230 |
Polygon pl2 = new Polygon(); |
231 |
LineString ls = new LineString();
|
232 |
Polygon pl = new Polygon(); |
233 |
int [] face; |
234 |
int i0, i1;
|
235 |
Iterator iter = faces.iterator();
|
236 |
while (iter.hasNext()) {
|
237 |
face = (int []) iter.next(); |
238 |
i0 = face[3];
|
239 |
for (int i=0; i<4; i++) { |
240 |
i1 = face[i]; |
241 |
if (i0 > 0) { |
242 |
if ((facesIterador%2)!=0) { |
243 |
//System.out.println("endSeq(): hasFaces = " + hasFaces);
|
244 |
//System.out.println("endSeq(): i0 = " + i0);
|
245 |
//System.out.println("endSeq(): lineString.pointNr() = " + lineString.pointNr());
|
246 |
ls1.add((Point2D)lineString.get(i0-1)); |
247 |
pl1.add((Point2D)polygon.get(i0-1)); |
248 |
//ls1.add((Point2D)lineString.get(Math.abs(i1)-1));
|
249 |
//pl1.add((Point2D)polygon.get(Math.abs(i1)-1));
|
250 |
} else {
|
251 |
ls2.add((Point2D)lineString.get(i0-1)); |
252 |
pl2.add((Point2D)polygon.get(i0-1)); |
253 |
//ls2.add((Point2D)lineString.get(Math.abs(i1)-1));
|
254 |
//pl2.add((Point2D)polygon.get(Math.abs(i1)-1));
|
255 |
} |
256 |
facesIterador = facesIterador + 1;
|
257 |
} |
258 |
i0 = i1; |
259 |
} |
260 |
} |
261 |
facesFirstPoint = new Point2D.Double(ls1.get(0).getX(), ls1.get(0).getY()); |
262 |
for (int i=0;i<ls1.pointNr();i++) { |
263 |
ls.add(ls1.get(i)); |
264 |
pl.add(pl1.get(i)); |
265 |
} |
266 |
for (int i=ls2.pointNr()-1;i>0;i--) { |
267 |
ls.add(ls2.get(i)); |
268 |
pl.add(pl2.get(i)); |
269 |
} |
270 |
ls.add(facesFirstPoint); |
271 |
pl.add(facesFirstPoint); |
272 |
lastFeaBordes.setGeometry(ls); |
273 |
lastFeaFondos.setGeometry(pl); |
274 |
} else {
|
275 |
lastFeaBordes.setGeometry(lineString); |
276 |
lastFeaFondos.setGeometry(polygon); |
277 |
} |
278 |
|
279 |
// 041130: Rellena las props con los atributos.
|
280 |
completeAttributes(lastFeaBordes); |
281 |
completeAttributes(lastFeaFondos); |
282 |
|
283 |
if (addingToBlock == false) { |
284 |
features.add(lastFeaBordes); |
285 |
features.add(lastFeaFondos); |
286 |
} else {
|
287 |
blk.add(lastFeaBordes); |
288 |
blk.add(lastFeaFondos); |
289 |
} |
290 |
lastFeaBordes = null;
|
291 |
lastFeaFondos = null;
|
292 |
} else if (lastFeaBordes.getGeometry() instanceof InsPoint) { |
293 |
// Se trata de un SEQEND despues de un ATTRIB
|
294 |
|
295 |
// 041130: Rellena las props con los atributos.
|
296 |
//completeAttributes(lastFeaBordes);
|
297 |
//completeAttributes(lastFeaFondos);
|
298 |
|
299 |
//System.out.println("endSeq(): lastFeaBordes.getProp(\"USER\")" + lastFeaBordes.getProp("USER"));
|
300 |
//System.out.println("endSeq(): lastFeaFondos.getProp(\"USER\")" + lastFeaBordes.getProp("USER"));
|
301 |
|
302 |
copyAttributes(lastFeaBordes); |
303 |
|
304 |
gestionaInsert(lastFeaBordes); |
305 |
|
306 |
if (addingToBlock == false) { |
307 |
features.add(lastFeaFondos); |
308 |
} else {
|
309 |
blk.add(lastFeaBordes); |
310 |
} |
311 |
lastFeaBordes = null;
|
312 |
lastFeaFondos = null;
|
313 |
} else {
|
314 |
// Caso no contemplado.
|
315 |
} |
316 |
} else {
|
317 |
if (lastFeaBordes.getGeometry() instanceof LineString) { |
318 |
Feature feaBordes = lastFeaBordes; |
319 |
LineString lineString = (LineString)feaBordes.getGeometry(); |
320 |
if (bulge!=0) { |
321 |
|
322 |
// 041122: Correcci?n del bug en los bulges de FIXT3.DXF
|
323 |
Vector arc = createArc((Point2D)(lineString.get(lineString.pointNr()-2)), (Point2D)(lineString.get(lineString.pointNr()-1)), bulge); |
324 |
lineString.remove(lineString.pointNr()-1);
|
325 |
lineString.remove(lineString.pointNr()-1);
|
326 |
if (bulge>0) { |
327 |
for (int i=0; i<arc.size(); i++) { |
328 |
Point2D ptAux = new Point2D.Double(); |
329 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
330 |
lineString.add(ptAux); |
331 |
if (lineString.pointNr() == 1) firstPt = ptAux; |
332 |
} |
333 |
} else {
|
334 |
for (int i=arc.size()-1; i>=0; i--) { |
335 |
Point2D ptAux = new Point2D.Double(); |
336 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
337 |
lineString.add(ptAux); |
338 |
if (lineString.pointNr() == 1) firstPt = ptAux; |
339 |
} |
340 |
} |
341 |
// 041122
|
342 |
|
343 |
bulge = 0.0;
|
344 |
} |
345 |
|
346 |
if (hasFaces) {
|
347 |
//System.out.println("POLYLINE: caras=" +faces.size()+", puntos="+ lineString.pointNr());
|
348 |
LineString ls1 = new LineString();
|
349 |
LineString ls2 = new LineString();
|
350 |
LineString ls = new LineString();
|
351 |
int [] face; |
352 |
int i0, i1;
|
353 |
Iterator iter = faces.iterator();
|
354 |
while (iter.hasNext()) {
|
355 |
face = (int []) iter.next(); |
356 |
i0 = face[3];
|
357 |
for (int i=0; i<4; i++) { |
358 |
i1 = face[i]; |
359 |
if (i0 > 0) { |
360 |
if ((facesIterador%2)!=0) { |
361 |
ls1.add((Point2D)lineString.get(i0-1)); |
362 |
//ls.add((Point2D)lineString.get(Math.abs(i1)-1));
|
363 |
} else {
|
364 |
ls2.add((Point2D)lineString.get(i0-1)); |
365 |
//ls.add((Point2D)lineString.get(Math.abs(i1)-1));
|
366 |
} |
367 |
facesIterador = facesIterador + 1;
|
368 |
} |
369 |
i0 = i1; |
370 |
} |
371 |
} |
372 |
facesFirstPoint = new Point2D.Double(ls1.get(0).getX(), ls1.get(0).getY()); |
373 |
for (int i=0;i<ls1.pointNr();i++) { |
374 |
ls.add(ls1.get(i)); |
375 |
} |
376 |
for (int i=ls2.pointNr()-1;i>0;i--) { |
377 |
ls.add(ls2.get(i)); |
378 |
} |
379 |
ls.add(facesFirstPoint); |
380 |
lastFeaBordes.setGeometry(ls); |
381 |
} else {
|
382 |
lastFeaBordes.setGeometry(lineString); |
383 |
} |
384 |
|
385 |
// 041130: Rellena las props con los atributos.
|
386 |
completeAttributes(lastFeaBordes); |
387 |
|
388 |
if (addingToBlock == false) { |
389 |
features.add(lastFeaBordes); |
390 |
} else {
|
391 |
blk.add(lastFeaBordes); |
392 |
} |
393 |
lastFeaBordes = null;
|
394 |
} else {
|
395 |
// Se trata de un SEQEND despues de un ATTRIB
|
396 |
} |
397 |
} |
398 |
xtruX = 0.0;
|
399 |
xtruY = 0.0;
|
400 |
xtruZ = 1.0;
|
401 |
bulge = 0.0;
|
402 |
isDoubleFeatured = false;
|
403 |
hasFaces = false;
|
404 |
facesIterador = 1;
|
405 |
} |
406 |
|
407 |
public void addVertex(DxfGroupVector grp) throws Exception { |
408 |
double x = 0.0, y = 0.0, z = 0.0; |
409 |
int vFlags = 0; |
410 |
if (isDoubleFeatured) {
|
411 |
Feature feaBordes = lastFeaBordes; |
412 |
Feature feaFondos = lastFeaFondos; |
413 |
LineString lineString = (LineString)feaBordes.getGeometry(); |
414 |
Polygon polygon = (Polygon)feaFondos.getGeometry(); |
415 |
if (grp.hasCode(8)) { |
416 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
417 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
418 |
} |
419 |
if (grp.hasCode(70)) { |
420 |
vFlags = grp.getDataAsInt(70);
|
421 |
} |
422 |
x = grp.getDataAsDouble(10);
|
423 |
y = grp.getDataAsDouble(20);
|
424 |
if (grp.hasCode(30)) { |
425 |
z = grp.getDataAsDouble(30);
|
426 |
} |
427 |
Point3D point_in = new Point3D(x, y, z);
|
428 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
429 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
430 |
x = point_out.getX(); |
431 |
y = point_out.getY(); |
432 |
//System.out.println("addVertex(): vFlags = " + vFlags);
|
433 |
if ((vFlags & 0x80) == 0x80 && (vFlags & 0x40) == 0) { |
434 |
int [] face = {0,0,0,0}; |
435 |
face[0] = grp.getDataAsInt(71); |
436 |
face[1] = grp.getDataAsInt(72); |
437 |
face[2] = grp.getDataAsInt(73); |
438 |
face[3] = grp.getDataAsInt(74); |
439 |
addFace(face); |
440 |
} else if ((vFlags & 0x10) == 0x10) { |
441 |
// Son vertices que se trataran cuando se implementen
|
442 |
// los splines. En principio no se hace nada con ellos.
|
443 |
} else {
|
444 |
Point2D pt = proj.createPoint( x, y);
|
445 |
lineString.add(pt); |
446 |
polygon.add(pt); |
447 |
if (lineString.pointNr() == 1) { |
448 |
firstPt = pt; |
449 |
} |
450 |
if (bulge == 0.0) { |
451 |
if (grp.hasCode(42)) { |
452 |
bulge = grp.getDataAsDouble(42);
|
453 |
} else { bulge = 0.0; } |
454 |
} else {
|
455 |
double bulge_aux = 0.0; |
456 |
if (grp.hasCode(42)) { |
457 |
bulge_aux = grp.getDataAsDouble(42);
|
458 |
} else { bulge_aux = 0.0; } |
459 |
//int cnt = lineString.pointNr();
|
460 |
//System.out.println("addVertex(): lineString.pointNr() = " + lineString.pointNr());
|
461 |
lineString.remove(lineString.pointNr()-1);
|
462 |
lineString.remove(lineString.pointNr()-1);
|
463 |
//System.out.println("addVertex(): polygon.pointNr() = " + polygon.pointNr());
|
464 |
polygon.remove(polygon.pointNr()-1);
|
465 |
polygon.remove(polygon.pointNr()-1);
|
466 |
Vector arc = createArc(ptAnterior, pt, bulge);
|
467 |
if (bulge>0) { |
468 |
for (int i=0; i<arc.size(); i++) { |
469 |
Point2D ptAux = new Point2D.Double(); |
470 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
471 |
lineString.add(ptAux); |
472 |
polygon.add(ptAux); |
473 |
if (lineString.pointNr() == 1) firstPt = ptAux; |
474 |
} |
475 |
} else {
|
476 |
for (int i=arc.size()-1; i>=0; i--) { |
477 |
Point2D ptAux = new Point2D.Double(); |
478 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
479 |
lineString.add(ptAux); |
480 |
polygon.add(ptAux); |
481 |
if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux; |
482 |
} |
483 |
} |
484 |
bulge = bulge_aux; |
485 |
} |
486 |
ptAnterior = pt; |
487 |
} |
488 |
} else {
|
489 |
Feature feaBordes = lastFeaBordes; |
490 |
LineString lineString = (LineString)feaBordes.getGeometry(); |
491 |
if (grp.hasCode(8)) |
492 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
493 |
if (grp.hasCode(70)) { |
494 |
vFlags = grp.getDataAsInt(70);
|
495 |
} |
496 |
x = grp.getDataAsDouble(10);
|
497 |
y = grp.getDataAsDouble(20);
|
498 |
if (grp.hasCode(30)) { |
499 |
z = grp.getDataAsDouble(30);
|
500 |
} |
501 |
Point3D point_in = new Point3D(x, y, z);
|
502 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
503 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
504 |
x = point_out.getX(); |
505 |
y = point_out.getY(); |
506 |
if ((vFlags & 0x80) == 0x80 && (vFlags & 0x40) == 0) { |
507 |
int [] face = {0,0,0,0}; |
508 |
face[0] = grp.getDataAsInt(71); |
509 |
face[1] = grp.getDataAsInt(72); |
510 |
face[2] = grp.getDataAsInt(73); |
511 |
face[3] = grp.getDataAsInt(74); |
512 |
addFace(face); |
513 |
} else if ((vFlags & 16) == 16) { |
514 |
// no se hace nada.
|
515 |
} else {
|
516 |
Point2D pt = proj.createPoint( x, y);
|
517 |
lineString.add(pt); |
518 |
//System.out.println("addVertex: pt = " + pt);
|
519 |
if (lineString.pointNr() == 1) { |
520 |
firstPt = pt; |
521 |
//System.out.println("addVertex(Primer pto de la lineString, firstPt=pt): firstPt = " + firstPt);
|
522 |
} |
523 |
if (bulge == 0.0) { |
524 |
if (grp.hasCode(42)) { |
525 |
bulge = grp.getDataAsDouble(42);
|
526 |
} else { bulge = 0.0; } |
527 |
//System.out.println("addVertex: El vertice anterior tenia bulge=0.0");
|
528 |
} else {
|
529 |
//System.out.println("addVertex: El vertice anterior tiene bulge = " + bulge);
|
530 |
double bulge_aux = 0.0; |
531 |
if (grp.hasCode(42)) { |
532 |
bulge_aux = grp.getDataAsDouble(42);
|
533 |
} else { bulge_aux = 0.0; } |
534 |
//int cnt = lineString.pointNr();
|
535 |
//System.out.println("addVertex: El vertice anterior tenia bulge. Se va a crear el");
|
536 |
//System.out.println("addVertex: arco del ptAnterior al ptActual.");
|
537 |
//System.out.println("addVertex: ptAnterior = " + ptAnterior + ", ptActual = " + pt);
|
538 |
// Borro los puntos inicio y final del arco.
|
539 |
lineString.remove(lineString.pointNr()-1);
|
540 |
lineString.remove(lineString.pointNr()-1);
|
541 |
Vector arc = createArc(ptAnterior, pt, bulge);
|
542 |
if (bulge>0) { |
543 |
for (int i=0; i<arc.size(); i++) { |
544 |
Point2D ptAux = new Point2D.Double(); |
545 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
546 |
lineString.add(ptAux); |
547 |
if (lineString.pointNr() == 1) firstPt = ptAux; |
548 |
} |
549 |
} else {
|
550 |
for (int i=arc.size()-1; i>=0; i--) { |
551 |
Point2D ptAux = new Point2D.Double(); |
552 |
ptAux = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
553 |
lineString.add(ptAux); |
554 |
if (lineString.pointNr() == 1) firstPt = ptAux; |
555 |
} |
556 |
} |
557 |
bulge = bulge_aux; |
558 |
} |
559 |
ptAnterior = pt; |
560 |
} |
561 |
} |
562 |
} |
563 |
|
564 |
public void createLwPolyline(DxfGroupVector grp) throws Exception { |
565 |
double x = 0.0, y = 0.0; |
566 |
double elev = 0.0; |
567 |
DxfGroup g = null;
|
568 |
LineString lineString = new LineString();
|
569 |
Polygon polygon = new Polygon(); |
570 |
//Geometry geometria;
|
571 |
//Feature feature= new Feature();
|
572 |
Feature feaBordes= new Feature();
|
573 |
Feature feaFondos= new Feature();
|
574 |
int flags = 0; |
575 |
int NumberOfVertices = 0; |
576 |
|
577 |
//feature.setProp("dxfEntity", "LwPolyline");
|
578 |
feaBordes.setProp("dxfEntity", "LwPolyline"); |
579 |
feaFondos.setProp("dxfEntity", "LwPolyline"); |
580 |
if (grp.hasCode(8)) |
581 |
//feature.setProp("layer", grp.getDataAsString(8));
|
582 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
583 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
584 |
if (grp.hasCode(38)) { |
585 |
elev = grp.getDataAsDouble(38);
|
586 |
Double doub = new Double(elev); |
587 |
String string = doub.toString();
|
588 |
//feature.setProp("elevation", string);
|
589 |
feaBordes.setProp("elevation", string);
|
590 |
feaFondos.setProp("elevation", string);
|
591 |
} else {
|
592 |
Double doub = new Double(0.0); |
593 |
//feature.setProp("elevation", doub.toString());
|
594 |
feaBordes.setProp("elevation", doub.toString());
|
595 |
feaFondos.setProp("elevation", doub.toString());
|
596 |
} |
597 |
if (grp.hasCode(39)) { |
598 |
Double doub = new Double(grp.getDataAsDouble(39)); |
599 |
String string = doub.toString();
|
600 |
//feature.setProp("thickness", string);
|
601 |
feaBordes.setProp("thickness", string);
|
602 |
feaFondos.setProp("thickness", string);
|
603 |
} else {
|
604 |
Double doub = new Double(0.0); |
605 |
//feature.setProp("thickness", doub.toString());
|
606 |
feaBordes.setProp("thickness", doub.toString());
|
607 |
feaFondos.setProp("thickness", doub.toString());
|
608 |
} |
609 |
if (grp.hasCode(62)) { |
610 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
611 |
String string = integer.toString();
|
612 |
//feature.setProp("color", string);
|
613 |
feaBordes.setProp("color", string);
|
614 |
feaFondos.setProp("color", string);
|
615 |
feaBordes.setProp("colorByLayer", "false"); |
616 |
feaFondos.setProp("colorByLayer", "false"); |
617 |
} else {
|
618 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
619 |
int clr = layer.colorNumber;
|
620 |
Integer integer = new Integer(clr); |
621 |
String string = integer.toString();
|
622 |
//feature.setProp("color", string);
|
623 |
feaBordes.setProp("color", string);
|
624 |
feaFondos.setProp("color", string);
|
625 |
feaBordes.setProp("colorByLayer", "true"); |
626 |
feaFondos.setProp("colorByLayer", "true"); |
627 |
} |
628 |
if (grp.hasCode(70)) |
629 |
flags = grp.getDataAsInt(70);
|
630 |
if ((flags & 0x01) == 0x01) { |
631 |
//geometria = new Polygon();
|
632 |
feaBordes.setGeometry(lineString); |
633 |
feaFondos.setGeometry(polygon); |
634 |
isDoubleFeatured = true;
|
635 |
} else {
|
636 |
//geometria = new LineString();
|
637 |
feaBordes.setGeometry(lineString); |
638 |
isDoubleFeatured = false;
|
639 |
} |
640 |
if (grp.hasCode(90)) |
641 |
NumberOfVertices = grp.getDataAsInt(90);
|
642 |
|
643 |
int j = 0; |
644 |
double firstX = 0.0; |
645 |
double firstY = 0.0; |
646 |
boolean hasBulge = false; |
647 |
double bulgeLwp = 0.0; |
648 |
for (int i=0; i<grp.size(); i++) { |
649 |
g = (DxfGroup) grp.get(i); |
650 |
if (g.getCode() == 10) { |
651 |
j++; |
652 |
x = ((Double) g.getData()).doubleValue();
|
653 |
} else if (g.getCode() == 20) { |
654 |
y = ((Double) g.getData()).doubleValue();
|
655 |
//if (y <= 1.0) throw new Exception("Y == "+y);
|
656 |
//lineString.add( proj.createPoint( x, y ) );
|
657 |
//polygon.add( proj.createPoint( x, y ) );
|
658 |
//geometria.add( proj.createPoint( x, y ) );
|
659 |
//lineString.add( proj.createPoint( x, y ) );
|
660 |
//if (isDoubleFeatured) polygon.add( proj.createPoint( x, y ) );
|
661 |
|
662 |
if (hasBulge) {
|
663 |
Point2D finalPoint = new Point2D.Double(x, y); |
664 |
//lineString.remove(lineString.pointNr()-1);
|
665 |
//lineString.remove(lineString.pointNr()-1);
|
666 |
//System.out.println("addVertex(): polygon.pointNr() = " + polygon.pointNr());
|
667 |
//polygon.remove(polygon.pointNr()-1);
|
668 |
//polygon.remove(polygon.pointNr()-1);
|
669 |
Vector arc = createArc(lineString.get(lineString.pointNr()-1), finalPoint, bulgeLwp); |
670 |
lineString.remove(lineString.pointNr()-1);
|
671 |
if (isDoubleFeatured) polygon.remove(polygon.pointNr()-1); |
672 |
if (bulgeLwp>0) { |
673 |
for (int k=0; k<arc.size(); k++) { |
674 |
Point2D ptAux = new Point2D.Double(); |
675 |
ptAux = proj.createPoint(((Point2D)arc.get(k)).getX(), ((Point2D)arc.get(k)).getY()); |
676 |
//System.out.println("createLwPolyline: ptAux = " + ptAux);
|
677 |
lineString.add(ptAux); |
678 |
//if (lineString.pointNr() == 1) firstPt = ptAux;
|
679 |
if (isDoubleFeatured) polygon.add(ptAux);
|
680 |
if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux; |
681 |
} |
682 |
} else {
|
683 |
for (int k=arc.size()-1; k>=0; k--) { |
684 |
Point2D ptAux = new Point2D.Double(); |
685 |
ptAux = proj.createPoint(((Point2D)arc.get(k)).getX(), ((Point2D)arc.get(k)).getY()); |
686 |
lineString.add(ptAux); |
687 |
if (isDoubleFeatured) polygon.add(ptAux);
|
688 |
if (lineString.pointNr() == 1 || polygon.pointNr() == 1) firstPt = ptAux; |
689 |
} |
690 |
} |
691 |
hasBulge = false;
|
692 |
bulgeLwp = 0.0;
|
693 |
} else {
|
694 |
//System.out.println("createLwPolyline: hasBulge siempre es false");
|
695 |
lineString.add( proj.createPoint( x, y ) ); |
696 |
if (isDoubleFeatured) polygon.add( proj.createPoint( x, y ) );
|
697 |
} |
698 |
if (j == 1) { |
699 |
firstX = x; |
700 |
firstY = y; |
701 |
} |
702 |
x = 0.0; y = 0.0; |
703 |
} else if (g.getCode() == 42) { |
704 |
//System.out.println("createLwPolyline: Lee el bulgeLwp");
|
705 |
hasBulge = true;
|
706 |
bulgeLwp = ((Double) g.getData()).doubleValue();
|
707 |
} |
708 |
|
709 |
} |
710 |
if (isDoubleFeatured) {
|
711 |
//geometria.add(proj.createPoint(firstX, firstY));
|
712 |
lineString.add(proj.createPoint(firstX, firstY)); |
713 |
polygon.add(proj.createPoint(firstX, firstY)); |
714 |
} |
715 |
|
716 |
lastFeaBordes = feaBordes; |
717 |
if (isDoubleFeatured) lastFeaFondos = feaFondos;
|
718 |
|
719 |
// 041130: Rellena las props con los atributos.
|
720 |
completeAttributes(lastFeaBordes); |
721 |
completeAttributes(lastFeaFondos); |
722 |
|
723 |
//features.add(feature);
|
724 |
if (addingToBlock == false) { |
725 |
features.add(feaBordes); |
726 |
if (isDoubleFeatured) features.add(feaFondos);
|
727 |
} else {
|
728 |
//System.out.println("createLwPolyline(): A?adimos una lwpolilinea al bloque " + iterator);
|
729 |
blk.add(feaBordes); |
730 |
if (isDoubleFeatured) blk.add(feaFondos);
|
731 |
} |
732 |
isDoubleFeatured = false;
|
733 |
} |
734 |
|
735 |
public void createLine(DxfGroupVector grp) throws Exception { |
736 |
double x = 0.0, y = 0.0, z1 = 0.0, z2 = 0.0; |
737 |
double elev = 0.0; |
738 |
DxfGroup g = null;
|
739 |
Point2D pt1 = null, pt2 = null; |
740 |
LineString lineString = new LineString();
|
741 |
Feature feature = new Feature();
|
742 |
|
743 |
feature.setProp("dxfEntity", "Line"); |
744 |
if (grp.hasCode(8)) |
745 |
feature.setProp("layer", grp.getDataAsString(8)); |
746 |
if (grp.hasCode(39)) { |
747 |
Double doub = new Double(grp.getDataAsDouble(39)); |
748 |
String string = doub.toString();
|
749 |
feature.setProp("thickness", string);
|
750 |
} else {
|
751 |
Double doub = new Double(0.0); |
752 |
feature.setProp("thickness", doub.toString());
|
753 |
} |
754 |
if (grp.hasCode(62)) { |
755 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
756 |
String string = integer.toString();
|
757 |
feature.setProp("color", string);
|
758 |
feature.setProp("colorByLayer", "false"); |
759 |
} else {
|
760 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
761 |
int clr = layer.colorNumber;
|
762 |
Integer integer = new Integer(clr); |
763 |
String string = integer.toString();
|
764 |
feature.setProp("color", string);
|
765 |
feature.setProp("colorByLayer", "true"); |
766 |
} |
767 |
x = grp.getDataAsDouble(10);
|
768 |
y = grp.getDataAsDouble(20);
|
769 |
if (grp.hasCode(30)) { |
770 |
z1 = grp.getDataAsDouble(30);
|
771 |
elev = z1; |
772 |
Double doub = new Double(elev); |
773 |
String string = doub.toString();
|
774 |
feature.setProp("elevation", string);
|
775 |
} |
776 |
pt1 = proj.createPoint(x, y); |
777 |
x = grp.getDataAsDouble(11);
|
778 |
y = grp.getDataAsDouble(21);
|
779 |
if (grp.hasCode(31)) { |
780 |
z2 = grp.getDataAsDouble(31);
|
781 |
} else {
|
782 |
// Cuando no se especifican z para las lineas se asume que la
|
783 |
// z es cero.
|
784 |
Double doub = new Double(0.0); |
785 |
feature.setProp("elevation", doub.toString());
|
786 |
} |
787 |
pt2 = proj.createPoint(x, y); |
788 |
if (grp.hasCode(210)) |
789 |
xtruX = grp.getDataAsDouble(210);
|
790 |
if (grp.hasCode(220)) |
791 |
xtruY = grp.getDataAsDouble(220);
|
792 |
if (grp.hasCode(230)) |
793 |
xtruZ = grp.getDataAsDouble(230);
|
794 |
Point3D point_in1 = new Point3D(pt1.getX(), pt1.getY(), z1);
|
795 |
Point3D point_in2 = new Point3D(pt2.getX(), pt2.getY(), z2);
|
796 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
797 |
Point2D point_out1 = DxfCalXtru.CalculateXtru(point_in1, xtru);
|
798 |
Point2D point_out2 = DxfCalXtru.CalculateXtru(point_in2, xtru);
|
799 |
pt1.setLocation(point_out1); |
800 |
pt2.setLocation(point_out2); |
801 |
lineString.add(pt1); |
802 |
lineString.add(pt2); |
803 |
|
804 |
feature.setGeometry(lineString); |
805 |
|
806 |
// 041130: Rellena las props con los atributos.
|
807 |
completeAttributes(feature); |
808 |
|
809 |
//features.add(feature);
|
810 |
if (addingToBlock == false) { |
811 |
//System.out.println("createLine(): A?adimos una linea a la lista de entidades");
|
812 |
features.add(feature); |
813 |
} else {
|
814 |
//System.out.println("createLine(): A?adimos una linea al bloque " + iterator);
|
815 |
blk.add(feature); |
816 |
} |
817 |
} |
818 |
|
819 |
/* (non-Javadoc)
|
820 |
* @see org.cresques.io.DxfFile.EntityFactory#createText(org.cresques.io.DxfGroupVector)
|
821 |
*/
|
822 |
public void createText(DxfGroupVector grp) throws Exception { |
823 |
double x = 0.0, y = 0.0, z = 0.0, h= 0.0, rot= 0.0; |
824 |
DxfGroup g = null;
|
825 |
Point2D pt1 = null, pt2 = null; |
826 |
Point2D pt = null; |
827 |
Point point = new Point(); |
828 |
|
829 |
point.isText = true;
|
830 |
|
831 |
Feature feature = new Feature();
|
832 |
|
833 |
feature.setProp("dxfEntity", "Text"); |
834 |
if (grp.hasCode(8)) |
835 |
feature.setProp("layer", grp.getDataAsString(8)); |
836 |
if (grp.hasCode(39)) { |
837 |
Double doub = new Double(grp.getDataAsDouble(39)); |
838 |
String string = doub.toString();
|
839 |
feature.setProp("thickness", string);
|
840 |
} else {
|
841 |
Double doub = new Double(0.0); |
842 |
feature.setProp("thickness", doub.toString());
|
843 |
} |
844 |
if (grp.hasCode(62)) { |
845 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
846 |
String string = integer.toString();
|
847 |
feature.setProp("color", string);
|
848 |
feature.setProp("colorByLayer", "false"); |
849 |
} else {
|
850 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
851 |
int clr = layer.colorNumber;
|
852 |
Integer integer = new Integer(clr); |
853 |
String string = integer.toString();
|
854 |
feature.setProp("color", string);
|
855 |
feature.setProp("colorByLayer", "true"); |
856 |
} |
857 |
if (grp.hasCode(1)) { |
858 |
String strAux1 = grp.getDataAsString(1); |
859 |
strAux1 = DxfConvTexts.ConvertText(strAux1); |
860 |
feature.setProp("text", strAux1);
|
861 |
} else {
|
862 |
feature.setProp("text", "No Text Code"); |
863 |
} |
864 |
if (grp.hasCode(40)) { |
865 |
Double heightD = new Double(grp.getDataAsDouble(40)); |
866 |
String heightS = heightD.toString();
|
867 |
feature.setProp("textHeight", heightS);
|
868 |
} else {
|
869 |
feature.setProp("textHeight", "20.0"); |
870 |
} |
871 |
if (grp.hasCode(50)) { |
872 |
Double rotD = new Double(grp.getDataAsDouble(50)); |
873 |
String rotS = rotD.toString();
|
874 |
feature.setProp("textRotation", rotS);
|
875 |
//System.out.println("rotS = " + rotS);
|
876 |
} else {
|
877 |
feature.setProp("textRotation", "0.0"); |
878 |
} |
879 |
x = grp.getDataAsDouble(10);
|
880 |
y = grp.getDataAsDouble(20);
|
881 |
if (grp.hasCode(30)){ |
882 |
z = grp.getDataAsDouble(30);
|
883 |
Double doub = new Double(z); |
884 |
String string = doub.toString();
|
885 |
feature.setProp("elevation", string);
|
886 |
} else {
|
887 |
Double doub = new Double(0.0); |
888 |
feature.setProp("elevation", doub.toString());
|
889 |
} |
890 |
if (grp.hasCode(210)) |
891 |
xtruX = grp.getDataAsDouble(210);
|
892 |
if (grp.hasCode(220)) |
893 |
xtruY = grp.getDataAsDouble(220);
|
894 |
if (grp.hasCode(230)) |
895 |
xtruZ = grp.getDataAsDouble(230);
|
896 |
Point3D point_in = new Point3D(x, y, z);
|
897 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
898 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
899 |
x = point_out.getX(); |
900 |
y = point_out.getY(); |
901 |
point.add(new Point2D.Double(x, y)); |
902 |
feature.setGeometry(point); |
903 |
|
904 |
// 041130: Rellena las props con los atributos.
|
905 |
completeAttributes(feature); |
906 |
|
907 |
//features.add(feature);
|
908 |
if (addingToBlock == false) { |
909 |
features.add(feature); |
910 |
} else {
|
911 |
//System.out.println("createText(): A?adimos un text al bloque " + iterator);
|
912 |
blk.add(feature); |
913 |
} |
914 |
} |
915 |
|
916 |
public void createMText(DxfGroupVector grp) throws Exception { |
917 |
double x = 0.0, y = 0.0, z = 0.0, h= 0.0, rot= 0.0; |
918 |
DxfGroup g = null;
|
919 |
Point2D pt1 = null, pt2 = null; |
920 |
Point2D pt = null; |
921 |
Point point = new Point(); |
922 |
|
923 |
point.isText = true;
|
924 |
|
925 |
Feature feature = new Feature();
|
926 |
|
927 |
feature.setProp("dxfEntity", "Text"); |
928 |
if (grp.hasCode(8)) |
929 |
feature.setProp("layer", grp.getDataAsString(8)); |
930 |
if (grp.hasCode(39)) { |
931 |
Double doub = new Double(grp.getDataAsDouble(39)); |
932 |
String string = doub.toString();
|
933 |
feature.setProp("thickness", string);
|
934 |
} else {
|
935 |
Double doub = new Double(0.0); |
936 |
feature.setProp("thickness", doub.toString());
|
937 |
} |
938 |
if (grp.hasCode(62)) { |
939 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
940 |
String string = integer.toString();
|
941 |
feature.setProp("color", string);
|
942 |
feature.setProp("colorByLayer", "false"); |
943 |
} else {
|
944 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
945 |
int clr = layer.colorNumber;
|
946 |
Integer integer = new Integer(clr); |
947 |
String string = integer.toString();
|
948 |
feature.setProp("color", string);
|
949 |
feature.setProp("colorByLayer", "true"); |
950 |
} |
951 |
if (grp.hasCode(1)) { |
952 |
String strAux1 = grp.getDataAsString(1); |
953 |
strAux1 = DxfConvTexts.ConvertText(strAux1); |
954 |
feature.setProp("text", strAux1);
|
955 |
} else {
|
956 |
feature.setProp("text", "No Text Code"); |
957 |
} |
958 |
if (grp.hasCode(40)) { |
959 |
Double heightD = new Double(grp.getDataAsDouble(40)); |
960 |
String heightS = heightD.toString();
|
961 |
feature.setProp("textHeight", heightS);
|
962 |
} else {
|
963 |
feature.setProp("textHeight", "20.0"); |
964 |
} |
965 |
if (grp.hasCode(50)) { |
966 |
Double rotD = new Double(grp.getDataAsDouble(50)); |
967 |
String rotS = rotD.toString();
|
968 |
feature.setProp("textRotation", rotS);
|
969 |
//System.out.println("rotS = " + rotS);
|
970 |
} else {
|
971 |
feature.setProp("textRotation", "0.0"); |
972 |
} |
973 |
if (grp.hasCode(71)) { |
974 |
int attachPoint = grp.getDataAsInt(71); |
975 |
if (attachPoint == 1) { |
976 |
} else if (attachPoint == 2) { |
977 |
} else if (attachPoint == 3) { |
978 |
} else if (attachPoint == 4) { |
979 |
} else if (attachPoint == 5) { |
980 |
} else if (attachPoint == 6) { |
981 |
} else if (attachPoint == 7) { |
982 |
} else if (attachPoint == 8) { |
983 |
} else if (attachPoint == 9) { |
984 |
} |
985 |
} |
986 |
if (grp.hasCode(72)) { |
987 |
int drawDirection = grp.getDataAsInt(71); |
988 |
if (drawDirection == 1) { |
989 |
} else if (drawDirection == 3) { |
990 |
} else if (drawDirection == 5) { |
991 |
} |
992 |
} |
993 |
if (grp.hasCode(73)) { |
994 |
int spacingStyle = grp.getDataAsInt(71); |
995 |
if (spacingStyle == 1) { |
996 |
} else if (spacingStyle == 2) { |
997 |
} |
998 |
} |
999 |
x = grp.getDataAsDouble(10);
|
1000 |
y = grp.getDataAsDouble(20);
|
1001 |
if (grp.hasCode(30)){ |
1002 |
z = grp.getDataAsDouble(30);
|
1003 |
Double doub = new Double(z); |
1004 |
String string = doub.toString();
|
1005 |
feature.setProp("elevation", string);
|
1006 |
} else {
|
1007 |
Double doub = new Double(0.0); |
1008 |
feature.setProp("elevation", doub.toString());
|
1009 |
} |
1010 |
if (grp.hasCode(210)) |
1011 |
xtruX = grp.getDataAsDouble(210);
|
1012 |
if (grp.hasCode(220)) |
1013 |
xtruY = grp.getDataAsDouble(220);
|
1014 |
if (grp.hasCode(230)) |
1015 |
xtruZ = grp.getDataAsDouble(230);
|
1016 |
Point3D point_in = new Point3D(x, y, z);
|
1017 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
1018 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
1019 |
x = point_out.getX(); |
1020 |
y = point_out.getY(); |
1021 |
point.add(new Point2D.Double(x, y)); |
1022 |
feature.setGeometry(point); |
1023 |
|
1024 |
// 041130: Rellena las props con los atributos.
|
1025 |
completeAttributes(feature); |
1026 |
|
1027 |
//features.add(feature);
|
1028 |
if (addingToBlock == false) { |
1029 |
features.add(feature); |
1030 |
} else {
|
1031 |
//System.out.println("createText(): A?adimos un text al bloque " + iterator);
|
1032 |
blk.add(feature); |
1033 |
} |
1034 |
} |
1035 |
|
1036 |
public void createPoint(DxfGroupVector grp) throws Exception { |
1037 |
double x = 0.0, y = 0.0, z = 0.0; |
1038 |
DxfGroup g = null;
|
1039 |
Point2D pt = null; |
1040 |
Point point = new Point(); |
1041 |
Feature feature = new Feature();
|
1042 |
|
1043 |
feature.setProp("dxfEntity", "Point"); |
1044 |
if (grp.hasCode(8)) |
1045 |
feature.setProp("layer", grp.getDataAsString(8)); |
1046 |
if (grp.hasCode(39)) { |
1047 |
Double doub = new Double(grp.getDataAsDouble(39)); |
1048 |
String string = doub.toString();
|
1049 |
feature.setProp("thickness", string);
|
1050 |
} else {
|
1051 |
Double doub = new Double(0.0); |
1052 |
feature.setProp("thickness", doub.toString());
|
1053 |
} |
1054 |
if (grp.hasCode(62)) { |
1055 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1056 |
String string = integer.toString();
|
1057 |
feature.setProp("color", string);
|
1058 |
feature.setProp("colorByLayer", "false"); |
1059 |
} else {
|
1060 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
1061 |
int clr = layer.colorNumber;
|
1062 |
Integer integer = new Integer(clr); |
1063 |
String string = integer.toString();
|
1064 |
feature.setProp("color", string);
|
1065 |
feature.setProp("colorByLayer", "true"); |
1066 |
} |
1067 |
x = grp.getDataAsDouble(10);
|
1068 |
y = grp.getDataAsDouble(20);
|
1069 |
if (grp.hasCode(30)) { |
1070 |
z = grp.getDataAsDouble(30);
|
1071 |
Double doub = new Double(z); |
1072 |
String string = doub.toString();
|
1073 |
feature.setProp("elevation", string);
|
1074 |
} else {
|
1075 |
Double doub = new Double(0.0); |
1076 |
feature.setProp("elevation", doub.toString());
|
1077 |
} |
1078 |
if (grp.hasCode(210)) |
1079 |
xtruX = grp.getDataAsDouble(210);
|
1080 |
if (grp.hasCode(220)) |
1081 |
xtruY = grp.getDataAsDouble(220);
|
1082 |
if (grp.hasCode(230)) |
1083 |
xtruZ = grp.getDataAsDouble(230);
|
1084 |
Point3D point_in = new Point3D(x, y, z);
|
1085 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
1086 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
1087 |
x = point_out.getX(); |
1088 |
y = point_out.getY(); |
1089 |
point.add(new Point2D.Double(x, y)); |
1090 |
feature.setGeometry(point); |
1091 |
|
1092 |
// 041130: Rellena las props con los atributos.
|
1093 |
completeAttributes(feature); |
1094 |
/*for (int i=0;i<attributes.size();i++) {
|
1095 |
String[] att = new String[2];
|
1096 |
att = (String[])attributes.get(i);
|
1097 |
feature.setProp(att[0],att[1]);
|
1098 |
}*/
|
1099 |
|
1100 |
//features.add(feature);
|
1101 |
if (addingToBlock == false) { |
1102 |
features.add(feature); |
1103 |
} else {
|
1104 |
//System.out.println("createPoint(): A?adimos un punto al bloque " + iterator);
|
1105 |
blk.add(feature); |
1106 |
} |
1107 |
} |
1108 |
|
1109 |
public void createCircle(DxfGroupVector grp) throws Exception { |
1110 |
double x = 0.0, y = 0.0, z = 0.0; |
1111 |
double r = 0.0; |
1112 |
DxfGroup g = null;
|
1113 |
LineString lineString = new LineString();
|
1114 |
Polygon polygon = new Polygon(); |
1115 |
Feature feaBordes = new Feature();
|
1116 |
Feature feaFondos = new Feature();
|
1117 |
|
1118 |
feaBordes.setProp("dxfEntity", "Circle"); |
1119 |
feaFondos.setProp("dxfEntity", "Circle"); |
1120 |
if (grp.hasCode(8)) |
1121 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
1122 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
1123 |
if (grp.hasCode(39)) { |
1124 |
Double doub = new Double(grp.getDataAsDouble(39)); |
1125 |
String string = doub.toString();
|
1126 |
feaBordes.setProp("thickness", string);
|
1127 |
feaFondos.setProp("thickness", string);
|
1128 |
} else {
|
1129 |
Double doub = new Double(0.0); |
1130 |
feaBordes.setProp("thickness", doub.toString());
|
1131 |
feaFondos.setProp("thickness", doub.toString());
|
1132 |
} |
1133 |
if (grp.hasCode(62)) { |
1134 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1135 |
String string = integer.toString();
|
1136 |
feaBordes.setProp("color", string);
|
1137 |
feaFondos.setProp("color", string);
|
1138 |
feaBordes.setProp("colorByLayer", "false"); |
1139 |
feaFondos.setProp("colorByLayer", "false"); |
1140 |
} else {
|
1141 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
1142 |
int clr = layer.colorNumber;
|
1143 |
Integer integer = new Integer(clr); |
1144 |
String string = integer.toString();
|
1145 |
feaBordes.setProp("color", string);
|
1146 |
feaFondos.setProp("color", string);
|
1147 |
feaBordes.setProp("colorByLayer", "true"); |
1148 |
feaFondos.setProp("colorByLayer", "true"); |
1149 |
} |
1150 |
x = grp.getDataAsDouble(10);
|
1151 |
y = grp.getDataAsDouble(20);
|
1152 |
if (grp.hasCode(30)) { |
1153 |
z = grp.getDataAsDouble(30);
|
1154 |
Double doub = new Double(z); |
1155 |
String string = doub.toString();
|
1156 |
feaBordes.setProp("elevation", string);
|
1157 |
feaFondos.setProp("elevation", string);
|
1158 |
} else {
|
1159 |
Double doub = new Double(0.0); |
1160 |
feaBordes.setProp("elevation", doub.toString());
|
1161 |
feaFondos.setProp("elevation", doub.toString());
|
1162 |
} |
1163 |
if (grp.hasCode(40)) r = grp.getDataAsDouble(40); |
1164 |
if (grp.hasCode(210)) |
1165 |
xtruX = grp.getDataAsDouble(210);
|
1166 |
if (grp.hasCode(220)) |
1167 |
xtruY = grp.getDataAsDouble(220);
|
1168 |
if (grp.hasCode(230)) |
1169 |
xtruZ = grp.getDataAsDouble(230);
|
1170 |
Point3D point_in = new Point3D(x, y, z);
|
1171 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
1172 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
1173 |
x = point_out.getX(); |
1174 |
y = point_out.getY(); |
1175 |
|
1176 |
Point2D center = proj.createPoint( x, y);
|
1177 |
Point2D[] pts = new Point2D[360]; |
1178 |
int angulo = 0; |
1179 |
for (angulo=0; angulo<360; angulo++) { |
1180 |
pts[angulo] = new Point2D.Double(center.getX(), center.getY()); |
1181 |
pts[angulo].setLocation(pts[angulo].getX() + r * Math.sin(angulo*Math.PI/(double)180.0), pts[angulo].getY() + r * Math.cos(angulo*Math.PI/(double)180.0)); |
1182 |
if (pts.length == 1) { |
1183 |
firstPt = pts[angulo]; |
1184 |
} |
1185 |
} |
1186 |
for (int i=0; i<pts.length; i++) { |
1187 |
lineString.add(pts[i]); |
1188 |
polygon.add(pts[i]); |
1189 |
} |
1190 |
|
1191 |
feaBordes.setGeometry(lineString); |
1192 |
feaFondos.setGeometry(polygon); |
1193 |
|
1194 |
// 041130: Rellena las props con los atributos.
|
1195 |
completeAttributes(feaBordes); |
1196 |
completeAttributes(feaFondos); |
1197 |
|
1198 |
//features.add(feature);
|
1199 |
if (addingToBlock == false) { |
1200 |
//System.out.println("createCircle(): A?ade un circulo a la lista de entidades");
|
1201 |
features.add(feaBordes); |
1202 |
features.add(feaFondos); |
1203 |
} else {
|
1204 |
//System.out.println("createCircle(): A?adimos un circulo al bloque " + iterator);
|
1205 |
blk.add(feaBordes); |
1206 |
blk.add(feaFondos); |
1207 |
} |
1208 |
} |
1209 |
|
1210 |
public void createArc(DxfGroupVector grp) throws Exception { |
1211 |
double x = 0.0, y = 0.0, z = 0.0; |
1212 |
double r = 0.0, empieza = 0.0, acaba = 0.0; |
1213 |
DxfGroup g = null;
|
1214 |
LineString lineString = new LineString();
|
1215 |
Feature feature = new Feature();
|
1216 |
|
1217 |
feature.setProp("dxfEntity", "Arc"); |
1218 |
if (grp.hasCode(8)) |
1219 |
feature.setProp("layer", grp.getDataAsString(8)); |
1220 |
if (grp.hasCode(39)) { |
1221 |
Double doub = new Double(grp.getDataAsDouble(39)); |
1222 |
String string = doub.toString();
|
1223 |
feature.setProp("thickness", string);
|
1224 |
} else {
|
1225 |
Double doub = new Double(0.0); |
1226 |
feature.setProp("thickness", doub.toString());
|
1227 |
} |
1228 |
if (grp.hasCode(62)) { |
1229 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1230 |
String string = integer.toString();
|
1231 |
feature.setProp("color", string);
|
1232 |
feature.setProp("colorByLayer", "false"); |
1233 |
} else {
|
1234 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
1235 |
int clr = layer.colorNumber;
|
1236 |
Integer integer = new Integer(clr); |
1237 |
String string = integer.toString();
|
1238 |
feature.setProp("color", string);
|
1239 |
feature.setProp("colorByLayer", "true"); |
1240 |
} |
1241 |
x = grp.getDataAsDouble(10);
|
1242 |
y = grp.getDataAsDouble(20);
|
1243 |
if (grp.hasCode(30)) { |
1244 |
z = grp.getDataAsDouble(30);
|
1245 |
Double doub = new Double(z); |
1246 |
String string = doub.toString();
|
1247 |
feature.setProp("elevation", string);
|
1248 |
} else {
|
1249 |
Double doub = new Double(0.0); |
1250 |
feature.setProp("elevation", doub.toString());
|
1251 |
} |
1252 |
if (grp.hasCode(40)) r = grp.getDataAsDouble(40); |
1253 |
if (grp.hasCode(50)) empieza = grp.getDataAsDouble(50); |
1254 |
if (grp.hasCode(51)) acaba = grp.getDataAsDouble(51); |
1255 |
if (grp.hasCode(210)) |
1256 |
xtruX = grp.getDataAsDouble(210);
|
1257 |
if (grp.hasCode(220)) |
1258 |
xtruY = grp.getDataAsDouble(220);
|
1259 |
if (grp.hasCode(230)) |
1260 |
xtruZ = grp.getDataAsDouble(230);
|
1261 |
Point3D point_in = new Point3D(x, y, z);
|
1262 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
1263 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
1264 |
x = point_out.getX(); |
1265 |
y = point_out.getY(); |
1266 |
|
1267 |
Point2D center = proj.createPoint( x, y);
|
1268 |
//System.out.println("empieza = " + empieza + ", acaba = " + acaba);
|
1269 |
int iempieza = (int)empieza; |
1270 |
int iacaba = (int)acaba; |
1271 |
//System.out.println("iempieza = " + iempieza + ", iacaba = " + iacaba);
|
1272 |
double angulo = 0; |
1273 |
Point2D[] pts = null; |
1274 |
if (empieza <= acaba) {
|
1275 |
pts = new Point2D[(iacaba-iempieza)+2]; |
1276 |
angulo = empieza; |
1277 |
pts[0] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
1278 |
for (int i=1; i<=(iacaba-iempieza)+1; i++) { |
1279 |
angulo = (double)(iempieza+i);
|
1280 |
pts[i] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
1281 |
} |
1282 |
angulo = acaba; |
1283 |
pts[(iacaba-iempieza)+1] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
1284 |
} else {
|
1285 |
pts = new Point2D[(360-iempieza)+iacaba+2]; |
1286 |
angulo = empieza; |
1287 |
//System.out.println("pts[0] = " + pts[0] + ", center = " + center + ", angulo = " + angulo);
|
1288 |
pts[0] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
1289 |
for (int i=1; i<=(360-iempieza); i++) { |
1290 |
angulo = (double)(iempieza+i);
|
1291 |
pts[i] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
1292 |
} |
1293 |
for (int i=(360-iempieza)+1; i<=(360-iempieza)+iacaba; i++) { |
1294 |
angulo = (double)(i-(360-iempieza)); |
1295 |
pts[i] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
1296 |
} |
1297 |
angulo = acaba; |
1298 |
pts[(360-iempieza)+iacaba+1] = new Point2D.Double(center.getX() + r * Math.cos(angulo*Math.PI/(double)180.0), center.getY() + r * Math.sin(angulo*Math.PI/(double)180.0)); |
1299 |
} |
1300 |
for (int i=0; i<pts.length; i++) { |
1301 |
lineString.add(pts[i]); |
1302 |
} |
1303 |
|
1304 |
feature.setGeometry(lineString); |
1305 |
|
1306 |
// 041130: Rellena las props con los atributos.
|
1307 |
completeAttributes(feature); |
1308 |
|
1309 |
//features.add(feature);
|
1310 |
if (addingToBlock == false) { |
1311 |
features.add(feature); |
1312 |
} else {
|
1313 |
//System.out.println("createArc(): A?adimos un arco al bloque " + iterator);
|
1314 |
blk.add(feature); |
1315 |
} |
1316 |
} |
1317 |
|
1318 |
public void createInsert(DxfGroupVector grp) throws Exception { |
1319 |
double x = 0.0, y = 0.0, z = 0.0; |
1320 |
DxfGroup g = null;
|
1321 |
Point2D pt = new Point2D.Double(0.0, 0.0); |
1322 |
Point2D scaleFactor = new Point2D.Double(1.0, 1.0); |
1323 |
double rotAngle = 0.0; |
1324 |
String blockName = ""; |
1325 |
|
1326 |
InsPoint insert = new InsPoint();
|
1327 |
Feature feature = new Feature();
|
1328 |
Point secondGeom = new Point(); |
1329 |
Feature secondFeat = new Feature();
|
1330 |
int attributesFollowFlag = 0; |
1331 |
|
1332 |
feature.setProp("dxfEntity", "Insert"); |
1333 |
secondFeat.setProp("dxfEntity", "Insert"); |
1334 |
if (grp.hasCode(2)) { |
1335 |
blockName = grp.getDataAsString(2);
|
1336 |
//feature.setProp("blockName", blockName);
|
1337 |
insert.setBlockName(blockName); |
1338 |
} |
1339 |
if (grp.hasCode(8)) { |
1340 |
feature.setProp("layer", grp.getDataAsString(8)); |
1341 |
secondFeat.setProp("layer", grp.getDataAsString(8)); |
1342 |
} |
1343 |
|
1344 |
Double doub = new Double(0.0); |
1345 |
secondFeat.setProp("thickness", doub.toString());
|
1346 |
|
1347 |
if (grp.hasCode(62)) { |
1348 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1349 |
String string = integer.toString();
|
1350 |
feature.setProp("color", string);
|
1351 |
secondFeat.setProp("color", string);
|
1352 |
feature.setProp("colorByLayer", "false"); |
1353 |
secondFeat.setProp("colorByLayer", "false"); |
1354 |
} else {
|
1355 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
1356 |
int clr = layer.colorNumber;
|
1357 |
Integer integer = new Integer(clr); |
1358 |
String string = integer.toString();
|
1359 |
feature.setProp("color", string);
|
1360 |
secondFeat.setProp("color", string);
|
1361 |
feature.setProp("colorByLayer", "true"); |
1362 |
secondFeat.setProp("colorByLayer", "true"); |
1363 |
} |
1364 |
if (grp.hasCode(66)) { |
1365 |
attributesFollowFlag = grp.getDataAsInt(66);
|
1366 |
} |
1367 |
if (grp.hasCode(10)) x = grp.getDataAsDouble(10); |
1368 |
if (grp.hasCode(20)) y = grp.getDataAsDouble(20); |
1369 |
if (grp.hasCode(30)) { |
1370 |
z = grp.getDataAsDouble(30);
|
1371 |
Double doubz = new Double(z); |
1372 |
String string = doubz.toString();
|
1373 |
feature.setProp("elevation", string);
|
1374 |
secondFeat.setProp("elevation", string);
|
1375 |
} else {
|
1376 |
Double elev = new Double(z); |
1377 |
//feature.setProp("elevation", doub.toString());
|
1378 |
feature.setProp("elevation", elev.toString());
|
1379 |
secondFeat.setProp("elevation", elev.toString());
|
1380 |
} |
1381 |
if (grp.hasCode(41)) { |
1382 |
scaleFactor.setLocation(grp.getDataAsDouble(41), scaleFactor.getY());
|
1383 |
//Double scaleFactorX = new Double(scaleFactor.getX());
|
1384 |
//feature.setProp("scaleFactorX", scaleFactorX.toString());
|
1385 |
insert.setScaleFactor(scaleFactor); |
1386 |
} else {
|
1387 |
//Double scaleFactorX = new Double(scaleFactor.getX());
|
1388 |
//feature.setProp("scaleFactorX", scaleFactorX.toString());
|
1389 |
insert.setScaleFactor(scaleFactor); |
1390 |
} |
1391 |
if (grp.hasCode(42)) { |
1392 |
scaleFactor.setLocation(scaleFactor.getX(), grp.getDataAsDouble(42));
|
1393 |
//Double scaleFactorY = new Double(scaleFactor.getY());
|
1394 |
//feature.setProp("scaleFactorY", scaleFactorY.toString());
|
1395 |
insert.setScaleFactor(scaleFactor); |
1396 |
} else {
|
1397 |
//Double scaleFactorY = new Double(scaleFactor.getY());
|
1398 |
//feature.setProp("scaleFactorY", scaleFactorY.toString());
|
1399 |
insert.setScaleFactor(scaleFactor); |
1400 |
} |
1401 |
if (grp.hasCode(43)) { |
1402 |
// TODO La coordenada z
|
1403 |
} |
1404 |
if (grp.hasCode(50)) { |
1405 |
rotAngle = grp.getDataAsDouble(50);
|
1406 |
//Double objRotAngle = new Double(rotAngle);
|
1407 |
//feature.setProp("rotAngle", objRotAngle.toString());
|
1408 |
insert.setRotAngle(rotAngle); |
1409 |
} |
1410 |
if (grp.hasCode(210)) |
1411 |
xtruX = grp.getDataAsDouble(210);
|
1412 |
if (grp.hasCode(220)) |
1413 |
xtruY = grp.getDataAsDouble(220);
|
1414 |
if (grp.hasCode(230)) |
1415 |
xtruZ = grp.getDataAsDouble(230);
|
1416 |
Point3D point_in = new Point3D(x, y, z);
|
1417 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
1418 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
1419 |
x = point_out.getX(); |
1420 |
y = point_out.getY(); |
1421 |
|
1422 |
insert.setBlkList(blkList); |
1423 |
|
1424 |
insert.encuentraBloque(blockName); |
1425 |
|
1426 |
insert.add(new Point2D.Double(x, y)); |
1427 |
secondGeom.add(new Point2D.Double(x, y)); |
1428 |
|
1429 |
feature.setGeometry(insert); |
1430 |
secondFeat.setGeometry(secondGeom); |
1431 |
|
1432 |
// 041130: Rellena las props con los atributos.
|
1433 |
completeAttributes(feature); |
1434 |
completeAttributes(secondFeat); |
1435 |
/*for (int i=0;i<attributes.size();i++) {
|
1436 |
String[] att = new String[2];
|
1437 |
att = (String[])attributes.get(i);
|
1438 |
secondFeat.setProp(att[0],att[1]);
|
1439 |
}*/
|
1440 |
|
1441 |
if (insert.getBlockFound()==true && attributesFollowFlag!=1) gestionaInsert(feature); |
1442 |
|
1443 |
//if (addingToBlock == false) {
|
1444 |
//features.add(secondFeat);
|
1445 |
//}
|
1446 |
//if (addingToBlock == true/* && insert.getBlockFound() == true*/) {
|
1447 |
//System.out.println("createInsert(): A?adimos un insert al bloque " + iterator);
|
1448 |
//blk.add(feature);
|
1449 |
//}
|
1450 |
|
1451 |
// 041129: A?adido para implementar los ATTRIBS.
|
1452 |
if (attributesFollowFlag==1) { |
1453 |
isDoubleFeatured = true;
|
1454 |
lastFeaBordes = feature; |
1455 |
lastFeaFondos = secondFeat; |
1456 |
} else {
|
1457 |
if (addingToBlock == false) { |
1458 |
features.add(secondFeat); |
1459 |
} |
1460 |
if (addingToBlock == true/* && insert.getBlockFound() == true*/) { |
1461 |
//System.out.println("createInsert(): A?adimos un insert al bloque " + iterator);
|
1462 |
blk.add(feature); |
1463 |
} |
1464 |
} |
1465 |
} |
1466 |
|
1467 |
public void createSolid(DxfGroupVector grp) throws Exception { |
1468 |
double x = 0.0, y = 0.0, z1 = 0.0, z2 = 0.0, z3 = 0.0, z4 = 0.0; |
1469 |
DxfGroup g = null;
|
1470 |
//Point2D pt1 = null, pt2 = null, pt3 = null, pt4 = null;
|
1471 |
Point2D[] pts = new Point2D[4]; |
1472 |
//DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8));
|
1473 |
|
1474 |
LineString lineString = new LineString();
|
1475 |
Polygon polygon = new Polygon(); |
1476 |
Feature feaBordes = new Feature();
|
1477 |
Feature feaFondos = new Feature();
|
1478 |
double elev = 0; |
1479 |
|
1480 |
feaBordes.setProp("dxfEntity", "Solid"); |
1481 |
feaFondos.setProp("dxfEntity", "Solid"); |
1482 |
if (grp.hasCode(8)) |
1483 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
1484 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
1485 |
x = grp.getDataAsDouble(10);
|
1486 |
y = grp.getDataAsDouble(20);
|
1487 |
if (grp.hasCode(30)) { |
1488 |
z1 = grp.getDataAsDouble(30);
|
1489 |
elev = z1; |
1490 |
Double doub = new Double(elev); |
1491 |
String string = doub.toString();
|
1492 |
feaBordes.setProp("elevation", string);
|
1493 |
feaFondos.setProp("elevation", string);
|
1494 |
} else {
|
1495 |
Double doub = new Double(0.0); |
1496 |
feaBordes.setProp("elevation", doub.toString());
|
1497 |
feaFondos.setProp("elevation", doub.toString());
|
1498 |
} |
1499 |
pts[0] = proj.createPoint(x, y);
|
1500 |
x = grp.getDataAsDouble(11);
|
1501 |
y = grp.getDataAsDouble(21);
|
1502 |
if (grp.hasCode(31)) z2 = grp.getDataAsDouble(31); |
1503 |
pts[1] = proj.createPoint(x, y);
|
1504 |
x = grp.getDataAsDouble(12);
|
1505 |
y = grp.getDataAsDouble(22);
|
1506 |
if (grp.hasCode(32)) z3 = grp.getDataAsDouble(32); |
1507 |
pts[2] = proj.createPoint(x, y);
|
1508 |
x = grp.getDataAsDouble(13);
|
1509 |
y = grp.getDataAsDouble(23);
|
1510 |
if (grp.hasCode(33)) z2 = grp.getDataAsDouble(33); |
1511 |
pts[3] = proj.createPoint(x, y);
|
1512 |
if (grp.hasCode(39)) { |
1513 |
Double doub = new Double(grp.getDataAsDouble(39)); |
1514 |
String string = doub.toString();
|
1515 |
feaBordes.setProp("thickness", string);
|
1516 |
feaFondos.setProp("thickness", string);
|
1517 |
} else {
|
1518 |
Double doub = new Double(0.0); |
1519 |
feaBordes.setProp("thickness", doub.toString());
|
1520 |
feaFondos.setProp("thickness", doub.toString());
|
1521 |
} |
1522 |
if (grp.hasCode(62)) { |
1523 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1524 |
String string = integer.toString();
|
1525 |
feaBordes.setProp("color", string);
|
1526 |
feaFondos.setProp("color", string);
|
1527 |
feaBordes.setProp("colorByLayer", "false"); |
1528 |
feaFondos.setProp("colorByLayer", "false"); |
1529 |
} else {
|
1530 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
1531 |
int clr = layer.colorNumber;
|
1532 |
Integer integer = new Integer(clr); |
1533 |
String string = integer.toString();
|
1534 |
feaBordes.setProp("color", string);
|
1535 |
feaFondos.setProp("color", string);
|
1536 |
feaBordes.setProp("colorByLayer", "true"); |
1537 |
feaFondos.setProp("colorByLayer", "true"); |
1538 |
} |
1539 |
if (grp.hasCode(210)) |
1540 |
xtruX = grp.getDataAsDouble(210);
|
1541 |
if (grp.hasCode(220)) |
1542 |
xtruY = grp.getDataAsDouble(220);
|
1543 |
if (grp.hasCode(230)) |
1544 |
xtruZ = grp.getDataAsDouble(230);
|
1545 |
Point3D point_in1 = new Point3D(pts[0].getX(), pts[0].getY(), z1); |
1546 |
Point3D point_in2 = new Point3D(pts[1].getX(), pts[1].getY(), z2); |
1547 |
Point3D point_in3 = new Point3D(pts[2].getX(), pts[2].getY(), z3); |
1548 |
Point3D point_in4 = new Point3D(pts[3].getX(), pts[3].getY(), z4); |
1549 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
1550 |
Point2D point_out1 = DxfCalXtru.CalculateXtru(point_in1, xtru);
|
1551 |
Point2D point_out2 = DxfCalXtru.CalculateXtru(point_in2, xtru);
|
1552 |
Point2D point_out3 = DxfCalXtru.CalculateXtru(point_in3, xtru);
|
1553 |
Point2D point_out4 = DxfCalXtru.CalculateXtru(point_in4, xtru);
|
1554 |
pts[0].setLocation(point_out1);
|
1555 |
pts[1].setLocation(point_out2);
|
1556 |
pts[2].setLocation(point_out3);
|
1557 |
pts[3].setLocation(point_out4);
|
1558 |
|
1559 |
Point2D aux = pts[2]; |
1560 |
pts[2] = pts[3]; |
1561 |
pts[3] = aux;
|
1562 |
|
1563 |
for (int i=0; i<pts.length; i++) { |
1564 |
lineString.add(pts[i]); |
1565 |
polygon.add(pts[i]); |
1566 |
} |
1567 |
|
1568 |
// Para cerrarlos.
|
1569 |
lineString.add(pts[0]);
|
1570 |
polygon.add(pts[0]);
|
1571 |
|
1572 |
feaBordes.setGeometry(lineString); |
1573 |
feaFondos.setGeometry(polygon); |
1574 |
|
1575 |
// 041130: Rellena las props con los atributos.
|
1576 |
completeAttributes(feaBordes); |
1577 |
completeAttributes(feaFondos); |
1578 |
|
1579 |
//features.add(feature);
|
1580 |
if (addingToBlock == false) { |
1581 |
//System.out.println("createSolid(): A?ade un solid a la lista de entidades");
|
1582 |
features.add(feaBordes); |
1583 |
features.add(feaFondos); |
1584 |
} else {
|
1585 |
//System.out.println("createSolid(): A?adimos un circulo al bloque " + iterator);
|
1586 |
blk.add(feaBordes); |
1587 |
blk.add(feaFondos); |
1588 |
} |
1589 |
} |
1590 |
|
1591 |
public void createSpline(DxfGroupVector grp) throws Exception { |
1592 |
double x = 0.0, y = 0.0, z = 0.0, elev = 0.0; |
1593 |
//double elev = 0.0;
|
1594 |
DxfGroup g = null;
|
1595 |
LineString lineString = new LineString();
|
1596 |
Polygon polygon = new Polygon(); |
1597 |
//Geometry geometria;
|
1598 |
//Feature feature= new Feature();
|
1599 |
Feature feaBordes= new Feature();
|
1600 |
Feature feaFondos= new Feature();
|
1601 |
int flags = 0; |
1602 |
|
1603 |
//feature.setProp("dxfEntity", "LwPolyline");
|
1604 |
feaBordes.setProp("dxfEntity", "Spline"); |
1605 |
feaFondos.setProp("dxfEntity", "Spline"); |
1606 |
if (grp.hasCode(8)) { |
1607 |
//feature.setProp("layer", grp.getDataAsString(8));
|
1608 |
feaBordes.setProp("layer", grp.getDataAsString(8)); |
1609 |
feaFondos.setProp("layer", grp.getDataAsString(8)); |
1610 |
} |
1611 |
if (grp.hasCode(39)) { |
1612 |
Double doub = new Double(grp.getDataAsDouble(39)); |
1613 |
String string = doub.toString();
|
1614 |
//feature.setProp("thickness", string);
|
1615 |
feaBordes.setProp("thickness", string);
|
1616 |
feaFondos.setProp("thickness", string);
|
1617 |
} else {
|
1618 |
Double doub = new Double(0.0); |
1619 |
//feature.setProp("thickness", doub.toString());
|
1620 |
feaBordes.setProp("thickness", doub.toString());
|
1621 |
feaFondos.setProp("thickness", doub.toString());
|
1622 |
} |
1623 |
if (grp.hasCode(62)) { |
1624 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1625 |
String string = integer.toString();
|
1626 |
//feature.setProp("color", string);
|
1627 |
feaBordes.setProp("color", string);
|
1628 |
feaFondos.setProp("color", string);
|
1629 |
feaBordes.setProp("colorByLayer", "false"); |
1630 |
feaFondos.setProp("colorByLayer", "false"); |
1631 |
} else {
|
1632 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
1633 |
int clr = layer.colorNumber;
|
1634 |
Integer integer = new Integer(clr); |
1635 |
String string = integer.toString();
|
1636 |
//feature.setProp("color", string);
|
1637 |
feaBordes.setProp("color", string);
|
1638 |
feaFondos.setProp("color", string);
|
1639 |
feaBordes.setProp("colorByLayer", "true"); |
1640 |
feaFondos.setProp("colorByLayer", "true"); |
1641 |
} |
1642 |
if (grp.hasCode(70)) |
1643 |
flags = grp.getDataAsInt(70);
|
1644 |
if ((flags & 0x01) == 0x01) { |
1645 |
//geometria = new Polygon();
|
1646 |
feaBordes.setGeometry(lineString); |
1647 |
feaFondos.setGeometry(polygon); |
1648 |
isDoubleFeatured = true;
|
1649 |
} else {
|
1650 |
//geometria = new LineString();
|
1651 |
feaBordes.setGeometry(lineString); |
1652 |
isDoubleFeatured = false;
|
1653 |
} |
1654 |
|
1655 |
int j = 0; |
1656 |
double firstX = 0.0; |
1657 |
double firstY = 0.0; |
1658 |
double firstZ = 0.0; |
1659 |
for (int i=0; i<grp.size(); i++) { |
1660 |
g = (DxfGroup) grp.get(i); |
1661 |
if (g.getCode() == 10) { |
1662 |
j++; |
1663 |
x = ((Double) g.getData()).doubleValue();
|
1664 |
} else if (g.getCode() == 20) { |
1665 |
y = ((Double) g.getData()).doubleValue();
|
1666 |
//if (y <= 1.0) throw new Exception("Y == "+y);
|
1667 |
//lineString.add( proj.createPoint( x, y ) );
|
1668 |
//polygon.add( proj.createPoint( x, y ) );
|
1669 |
//geometria.add( proj.createPoint( x, y ) );
|
1670 |
} else if (g.getCode() == 30) { |
1671 |
z = ((Double) g.getData()).doubleValue();
|
1672 |
// OJO --> proj.createPoint no acepta ptos con 3 coordenadas,
|
1673 |
// ni gvSIG en esta fase de desarrollo.
|
1674 |
lineString.add(proj.createPoint(x, y)); |
1675 |
if (isDoubleFeatured) polygon.add( proj.createPoint( x, y ) );
|
1676 |
if (j == 1) { |
1677 |
firstX = x; |
1678 |
firstY = y; |
1679 |
firstZ = z; |
1680 |
} |
1681 |
elev = z; |
1682 |
x = 0.0; y = 0.0; z = 0.0; |
1683 |
} |
1684 |
} |
1685 |
|
1686 |
Double doub = new Double(elev); |
1687 |
String string = doub.toString();
|
1688 |
//feature.setProp("elevation", string);
|
1689 |
feaBordes.setProp("elevation", string);
|
1690 |
feaFondos.setProp("elevation", string);
|
1691 |
|
1692 |
if (isDoubleFeatured) {
|
1693 |
//geometria.add(proj.createPoint(firstX, firstY));
|
1694 |
lineString.add(proj.createPoint(firstX, firstY)); |
1695 |
polygon.add(proj.createPoint(firstX, firstY)); |
1696 |
} |
1697 |
|
1698 |
lastFeaBordes = feaBordes; |
1699 |
if (isDoubleFeatured) lastFeaFondos = feaFondos;
|
1700 |
|
1701 |
// 041130: Rellena las props con los atributos.
|
1702 |
completeAttributes(feaBordes); |
1703 |
completeAttributes(feaFondos); |
1704 |
|
1705 |
//features.add(feature);
|
1706 |
if (addingToBlock == false) { |
1707 |
features.add(feaBordes); |
1708 |
if (isDoubleFeatured) features.add(feaFondos);
|
1709 |
} else {
|
1710 |
//System.out.println("createLwPolyline(): A?adimos una lwpolilinea al bloque " + iterator);
|
1711 |
blk.add(feaBordes); |
1712 |
if (isDoubleFeatured) blk.add(feaFondos);
|
1713 |
} |
1714 |
isDoubleFeatured = false;
|
1715 |
} |
1716 |
public void createAttdef(DxfGroupVector grp) throws Exception { |
1717 |
DxfGroup g = null;
|
1718 |
|
1719 |
String defaultValue = ""; |
1720 |
String tagString = ""; |
1721 |
String textStyleName = ""; |
1722 |
String attribute[] = new String[2]; |
1723 |
boolean tagDefined = false; |
1724 |
boolean defValDefined = false; |
1725 |
|
1726 |
if (grp.hasCode(1)) { |
1727 |
defaultValue = grp.getDataAsString(1);
|
1728 |
attribute[1] = DxfConvTexts.ConvertText(defaultValue);
|
1729 |
defValDefined = true;
|
1730 |
if (tagDefined) attributes.add(attribute);
|
1731 |
} |
1732 |
if (grp.hasCode(2)) { |
1733 |
tagString = grp.getDataAsString(2);
|
1734 |
attribute[0] = DxfConvTexts.ConvertText(tagString);
|
1735 |
tagDefined = true;
|
1736 |
if (defValDefined) attributes.add(attribute);
|
1737 |
} |
1738 |
if (grp.hasCode(7)) { |
1739 |
textStyleName = grp.getDataAsString(7);
|
1740 |
textStyleName = DxfConvTexts.ConvertText(textStyleName); |
1741 |
} |
1742 |
setNewAttributes(); |
1743 |
} |
1744 |
public void createAttrib(DxfGroupVector grp) throws Exception { |
1745 |
double x = 0.0, y = 0.0, z = 0.0, h= 0.0, rot= 0.0; |
1746 |
DxfGroup g = null;
|
1747 |
//Point2D pt1 = null, pt2 = null;
|
1748 |
Point2D pt = null; |
1749 |
Point point = new Point(); |
1750 |
|
1751 |
point.isText = true;
|
1752 |
|
1753 |
String defaultValue = ""; |
1754 |
String tagString = ""; |
1755 |
String textStyleName = ""; |
1756 |
String att[] = new String[2]; |
1757 |
boolean tagDefined = false; |
1758 |
boolean defValDefined = false; |
1759 |
int attributeFlags = 0; |
1760 |
|
1761 |
Feature insFea = lastFeaBordes; |
1762 |
Feature ptFea = lastFeaFondos; |
1763 |
|
1764 |
Feature feature = new Feature();
|
1765 |
|
1766 |
feature.setProp("dxfEntity", "Attrib"); // <-- Es un INSERT con attributes. |
1767 |
if (grp.hasCode(8)) |
1768 |
feature.setProp("layer", grp.getDataAsString(8)); |
1769 |
if (grp.hasCode(39)) { |
1770 |
Double doub = new Double(grp.getDataAsDouble(39)); |
1771 |
String string = doub.toString();
|
1772 |
feature.setProp("thickness", string);
|
1773 |
} else {
|
1774 |
Double doub = new Double(0.0); |
1775 |
feature.setProp("thickness", doub.toString());
|
1776 |
} |
1777 |
if (grp.hasCode(62)) { |
1778 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1779 |
String string = integer.toString();
|
1780 |
feature.setProp("color", string);
|
1781 |
feature.setProp("colorByLayer", "false"); |
1782 |
} else {
|
1783 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
1784 |
int clr = layer.colorNumber;
|
1785 |
Integer integer = new Integer(clr); |
1786 |
String string = integer.toString();
|
1787 |
feature.setProp("color", string);
|
1788 |
feature.setProp("colorByLayer", "true"); |
1789 |
} |
1790 |
|
1791 |
if (grp.hasCode(1)) { |
1792 |
String strAux1 = grp.getDataAsString(1); |
1793 |
strAux1 = DxfConvTexts.ConvertText(strAux1); |
1794 |
defaultValue = strAux1; |
1795 |
att[1] = DxfConvTexts.ConvertText(defaultValue);
|
1796 |
defValDefined = true;
|
1797 |
if (tagDefined) {
|
1798 |
insFea.setProp(att[0], att[1]); |
1799 |
ptFea.setProp(att[0], att[1]); |
1800 |
} |
1801 |
feature.setProp("text", strAux1);
|
1802 |
} |
1803 |
if (grp.hasCode(2)) { |
1804 |
String strAux2 = grp.getDataAsString(2); |
1805 |
strAux2 = DxfConvTexts.ConvertText(strAux2); |
1806 |
tagString = strAux2; |
1807 |
att[0] = DxfConvTexts.ConvertText(tagString);
|
1808 |
tagDefined = true;
|
1809 |
if (defValDefined) {
|
1810 |
insFea.setProp(att[0], att[1]); |
1811 |
ptFea.setProp(att[0], att[1]); |
1812 |
} |
1813 |
} |
1814 |
if (grp.hasCode(7)) { |
1815 |
textStyleName = grp.getDataAsString(7);
|
1816 |
textStyleName = DxfConvTexts.ConvertText(textStyleName); |
1817 |
} |
1818 |
if (grp.hasCode(70)) { |
1819 |
attributeFlags = grp.getDataAsInt(70);
|
1820 |
} |
1821 |
|
1822 |
if (grp.hasCode(40)) { |
1823 |
Double heightD = new Double(grp.getDataAsDouble(40)); |
1824 |
String heightS = heightD.toString();
|
1825 |
feature.setProp("textHeight", heightS);
|
1826 |
} else {
|
1827 |
feature.setProp("textHeight", "20.0"); |
1828 |
} |
1829 |
if (grp.hasCode(50)) { |
1830 |
Double rotD = new Double(grp.getDataAsDouble(50)); |
1831 |
String rotS = rotD.toString();
|
1832 |
feature.setProp("textRotation", rotS);
|
1833 |
} else {
|
1834 |
feature.setProp("textRotation", "0.0"); |
1835 |
} |
1836 |
x = grp.getDataAsDouble(10);
|
1837 |
y = grp.getDataAsDouble(20);
|
1838 |
if (grp.hasCode(30)){ |
1839 |
z = grp.getDataAsDouble(30);
|
1840 |
Double doub = new Double(z); |
1841 |
String string = doub.toString();
|
1842 |
feature.setProp("elevation", string);
|
1843 |
} else {
|
1844 |
Double doub = new Double(0.0); |
1845 |
feature.setProp("elevation", doub.toString());
|
1846 |
} |
1847 |
if (grp.hasCode(210)) |
1848 |
xtruX = grp.getDataAsDouble(210);
|
1849 |
if (grp.hasCode(220)) |
1850 |
xtruY = grp.getDataAsDouble(220);
|
1851 |
if (grp.hasCode(230)) |
1852 |
xtruZ = grp.getDataAsDouble(230);
|
1853 |
Point3D point_in = new Point3D(x, y, z);
|
1854 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ);
|
1855 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru);
|
1856 |
x = point_out.getX(); |
1857 |
y = point_out.getY(); |
1858 |
point.add(new Point2D.Double(x, y)); |
1859 |
feature.setGeometry(point); |
1860 |
|
1861 |
// 041130: Rellena las props con los atributos.
|
1862 |
completeAttributes(feature); |
1863 |
|
1864 |
if (attributeFlags==8) { |
1865 |
if (addingToBlock == false) { |
1866 |
features.add(feature); |
1867 |
} else {
|
1868 |
blk.add(feature); |
1869 |
} |
1870 |
} |
1871 |
} |
1872 |
|
1873 |
public void createBlock(DxfGroupVector grp) throws Exception { |
1874 |
//DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8));
|
1875 |
blk = new FeatureCollection(proj);
|
1876 |
|
1877 |
Point2D basePoint = new Point2D.Double(); |
1878 |
String blockName = ""; |
1879 |
//System.out.println("createBlock(): Creamos nuevo bloque, el bloque " + iterator);
|
1880 |
|
1881 |
addingToBlock = true;
|
1882 |
//System.out.println("createBlock(): A?adimos el bloque " + iterator + " a la lista de bloques");
|
1883 |
blkList.add(iterator, blk); |
1884 |
|
1885 |
//System.out.println("createBlock(): Rellenamos la informacion del bloque " + iterator);
|
1886 |
|
1887 |
if (grp.hasCode(8)) |
1888 |
blk.setProp("layer", grp.getDataAsString(8)); |
1889 |
if (grp.hasCode(62)) { |
1890 |
Integer integer = new Integer(grp.getDataAsInt(62)); |
1891 |
String string = integer.toString();
|
1892 |
blk.setProp("color", string);
|
1893 |
blk.setProp("colorByLayer", "false"); |
1894 |
} else {
|
1895 |
DxfLayer layer = (DxfLayer)layers.getByName(grp.getDataAsString(8));
|
1896 |
int clr = layer.colorNumber;
|
1897 |
Integer integer = new Integer(clr); |
1898 |
String string = integer.toString();
|
1899 |
blk.setProp("color", string);
|
1900 |
blk.setProp("colorByLayer", "true"); |
1901 |
} |
1902 |
|
1903 |
if (grp.hasCode(1)) { |
1904 |
blockName = grp.getDataAsString(1);
|
1905 |
//blk.setBlkName(blockName);
|
1906 |
blk.setProp("blockName", blockName);
|
1907 |
} |
1908 |
if (grp.hasCode(2)) { |
1909 |
blockName = grp.getDataAsString(2);
|
1910 |
//blk.setBlkName(blockName);
|
1911 |
blk.setProp("blockName", blockName);
|
1912 |
} |
1913 |
// 041001: Anulado porque provoca que no se visualizen bloques de la
|
1914 |
// leyenda en m54643.dxf.
|
1915 |
/*if (grp.hasCode(3)) {
|
1916 |
blockName = grp.getDataAsString(3);
|
1917 |
//blk.setBlkName(blockName);
|
1918 |
blk.setProp("blockName", blockName);
|
1919 |
}*/
|
1920 |
if (grp.hasCode(10)) { |
1921 |
//basePoint.setLocation(grp.getDataAsDouble(10), basePoint.getY());
|
1922 |
//blk.setBPoint(basePoint);
|
1923 |
Double basePointX = new Double(grp.getDataAsDouble(10)); |
1924 |
blk.setProp("basePointX", basePointX.toString());
|
1925 |
} |
1926 |
if (grp.hasCode(20)) { |
1927 |
//basePoint.setLocation(basePoint.getX(), grp.getDataAsDouble(20));
|
1928 |
//blk.setBPoint(basePoint);
|
1929 |
Double basePointY = new Double(grp.getDataAsDouble(20)); |
1930 |
blk.setProp("basePointY", basePointY.toString());
|
1931 |
} |
1932 |
if (grp.hasCode(30)) { |
1933 |
//basePoint.setLocation(basePoint.getZ(), grp.getDataAsDouble(30));
|
1934 |
//blk.setBPoint(basePoint);
|
1935 |
Double basePointZ = new Double(grp.getDataAsDouble(30)); |
1936 |
blk.setProp("basePointZ", basePointZ.toString());
|
1937 |
} |
1938 |
if (grp.hasCode(70)) { |
1939 |
//blk.flags = grp.getDataAsInt(70);
|
1940 |
Integer blockFlags = new Integer(grp.getDataAsInt(70)); |
1941 |
blk.setProp("blockFlags", blockFlags.toString());
|
1942 |
// 041103: Hoy por hoy esto no lo utilizamos.
|
1943 |
} |
1944 |
} |
1945 |
|
1946 |
public void endBlk(DxfGroupVector grp) throws Exception { |
1947 |
//DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8));
|
1948 |
setAddingToBlock(false);
|
1949 |
iterator = iterator + 1;
|
1950 |
} |
1951 |
|
1952 |
public void testBlocks() { |
1953 |
//System.out.println("getBlkList() = " + getBlkList());
|
1954 |
Vector blkList = getBlkList();
|
1955 |
FeatureCollection block = null;
|
1956 |
Feature feature = null;
|
1957 |
InsPoint insert = null;
|
1958 |
Point2D point1 = new Point2D.Double(); |
1959 |
Point2D point2 = new Point2D.Double(); |
1960 |
//System.out.println("blkList = " + blkList);
|
1961 |
//System.out.println("blkList.size() = " + blkList.size());
|
1962 |
for (int i=0; i<blkList.size(); i++) { |
1963 |
//System.out.println("compruebaBloques(): Bloque " + i +" de " + blkList.size());
|
1964 |
block = (FeatureCollection) blkList.get(i); |
1965 |
int aux = block.size();
|
1966 |
for (int j=0; j<aux; j++) { |
1967 |
feature = (Feature)block.get(j); |
1968 |
//if (feature.getGeometry() instanceof InsPoint && feature.getProp("isAnInsert") == "true") {
|
1969 |
if (feature.getGeometry() instanceof InsPoint) { |
1970 |
insert = (InsPoint)feature.getGeometry(); |
1971 |
String nomBlock = insert.getBlockName();
|
1972 |
//System.out.println("compruebaBloques(): Bloque = " + i + ", elemento = " + j + ", inserta el bloque = " + nomBlock);
|
1973 |
//System.out.println("compruebaBloques(): insert.get(0) = " + insert.get(0));
|
1974 |
//System.out.println("compruebaBloques(): feature.getProp(rotAngle) = " + insert.getRotAngle());
|
1975 |
//System.out.println("compruebaBloques(): insert.getScaleFactor() = " + insert.getScaleFactor());
|
1976 |
//if (feature.getProp("blockFound") == "false") {
|
1977 |
if (insert.getBlockFound() == false) { |
1978 |
//System.out.println("compruebaBloques(): Ahora se ocupa del DxfInsert " + nomBlock);
|
1979 |
insert.encuentraBloque(nomBlock); |
1980 |
//gestionaInsert(feature);
|
1981 |
//block.add(feature);
|
1982 |
} |
1983 |
|
1984 |
} |
1985 |
} |
1986 |
} |
1987 |
} |
1988 |
|
1989 |
private void gestionaInsert(Feature feature) { |
1990 |
Feature feature2 = null;
|
1991 |
Point point = null; |
1992 |
LineString lineString = null;
|
1993 |
Polygon polygon = null; |
1994 |
InsPoint insert = new InsPoint();
|
1995 |
insert = (InsPoint)feature.getGeometry(); |
1996 |
double bPointX = 0.0; |
1997 |
double bPointY = 0.0; |
1998 |
//if (insert.getBlockFound() == true) {
|
1999 |
bPointX = Double.parseDouble(insert.getBlock().getProp("basePointX")); |
2000 |
bPointY = Double.parseDouble(insert.getBlock().getProp("basePointY")); |
2001 |
//}
|
2002 |
double sFactorX = insert.getScaleFactor().getX();
|
2003 |
double sFactorY = insert.getScaleFactor().getY();
|
2004 |
double rAngleGra = insert.getRotAngle();
|
2005 |
double rAngleRad = rAngleGra*Math.PI/180.0; |
2006 |
InsPoint insert2 = null;
|
2007 |
|
2008 |
for (int i=0; i<insert.getBlock().size(); i++) { |
2009 |
//System.out.println("gestionaInserts: insert.getBlock().features.size() = " + insert.getBlock().size());
|
2010 |
feature2 = (Feature)insert.getBlock().get(i); |
2011 |
|
2012 |
// Para que los elementos dentro del bloque tengan la misma layer
|
2013 |
// y color que el insert al que corresponden.
|
2014 |
// Segun la especificacion del formato DXF de Autodesk, la layer
|
2015 |
// de las entities dentro de un bloque es la del bloque. La
|
2016 |
// layer especifica para estos elementos en la defincion del
|
2017 |
// bloque se ignora.
|
2018 |
//System.out.println("gestionaInsert(): layer = " + feature2.getProp("layer"));
|
2019 |
if ((feature2.getProp("colorByLayer").equals("false") || feature2.getProp("layer").equals("0")) && !feature.getProp("layer").equals("0")) { |
2020 |
feature2.setProp("color", feature.getProp("color")); |
2021 |
} |
2022 |
feature2.setProp("layer", feature.getProp("layer")); |
2023 |
|
2024 |
Point2D point1 = new Point2D.Double(); |
2025 |
Point2D point11 = new Point2D.Double(); |
2026 |
Point2D pointAux = null; |
2027 |
|
2028 |
if (feature2.getGeometry() instanceof InsPoint){ |
2029 |
|
2030 |
//System.out.println("gestionaInsert(): Encuentra bloques dentro de bloques");
|
2031 |
|
2032 |
insert2 = (InsPoint)feature2.getGeometry(); |
2033 |
point1 = insert2.get(0);
|
2034 |
|
2035 |
pointAux = new Point2D.Double(point1.getX() - bPointX, point1.getY() - bPointY); |
2036 |
double laX = insert.get(0).getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
2037 |
double laY = insert.get(0).getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
2038 |
point11.setLocation(laX, laY); |
2039 |
InsPoint insert3 = new InsPoint();
|
2040 |
|
2041 |
insert3.add(point11); |
2042 |
|
2043 |
insert3.setBlkList(insert2.getBlkList()); |
2044 |
insert3.setBlock(insert2.getBlock()); |
2045 |
insert3.setBlockName(insert2.getBlockName()); |
2046 |
insert3.setRotAngle(insert2.getRotAngle()); |
2047 |
Point2D newScale = new Point2D.Double(insert2.getScaleFactor().getX() * sFactorX, insert2.getScaleFactor().getY() * sFactorY); |
2048 |
insert3.setScaleFactor(newScale); |
2049 |
|
2050 |
Feature feature3 = new Feature();
|
2051 |
feature3.setProp("layer", feature2.getProp("layer")); |
2052 |
feature3.setProp("color", feature2.getProp("color")); |
2053 |
feature3.setProp("dxfEntity", feature2.getProp("dxfEntity")); |
2054 |
feature3.setProp("elevation", feature2.getProp("elevation")); |
2055 |
|
2056 |
//041130
|
2057 |
for (int j=0;j<attributes.size();j++) { |
2058 |
String[] att = new String[2]; |
2059 |
att = (String[])attributes.get(j); |
2060 |
feature3.setProp(att[0],feature2.getProp(att[0])); |
2061 |
} |
2062 |
|
2063 |
feature3.setGeometry(insert3); |
2064 |
|
2065 |
gestionaInsert(feature3); |
2066 |
} else if (feature2.getGeometry() instanceof LineString) { |
2067 |
lineString = (LineString)feature2.getGeometry(); |
2068 |
LineString lineString2 = new LineString();
|
2069 |
Point2D[] points = new Point2D[lineString.pointNr()]; |
2070 |
Point2D[] pointss = new Point2D[lineString.pointNr()]; |
2071 |
for (int j=0; j<lineString.pointNr(); j++) { |
2072 |
points[j] = (Point2D)lineString.get(j);
|
2073 |
pointss[j] = new Point2D.Double(); |
2074 |
|
2075 |
pointAux = new Point2D.Double(points[j].getX() - bPointX, points[j].getY() - bPointY); |
2076 |
double laX = insert.get(0).getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
2077 |
double laY = insert.get(0).getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
2078 |
pointss[j].setLocation(laX, laY); |
2079 |
lineString2.add(pointss[j]); |
2080 |
} |
2081 |
|
2082 |
Feature feature3 = new Feature();
|
2083 |
feature3.setProp("layer", feature2.getProp("layer")); |
2084 |
feature3.setProp("color", feature2.getProp("color")); |
2085 |
feature3.setProp("dxfEntity", feature2.getProp("dxfEntity")); |
2086 |
feature3.setProp("elevation", feature2.getProp("elevation")); |
2087 |
feature3.setProp("thickness", feature2.getProp("thickness")); |
2088 |
|
2089 |
//041130
|
2090 |
for (int j=0;j<attributes.size();j++) { |
2091 |
String[] att = new String[2]; |
2092 |
att = (String[])attributes.get(j); |
2093 |
/*System.out.println("gestionaInsert(): att[0] = " + att[0]);
|
2094 |
System.out.println("gestionaInsert(): feature2.getProp(att[0]) = " + feature2.getProp(att[0]));
|
2095 |
System.out.println("gestionaInsert(): feature2.getProp(layer) = " + feature2.getProp("layer"));
|
2096 |
System.out.println("gestionaInsert(): feature2.getProp(color) = " + feature2.getProp("color"));
|
2097 |
System.out.println("gestionaInsert(): feature2.getProp(dxfEntity) = " + feature2.getProp("dxfEntity"));
|
2098 |
System.out.println("gestionaInsert(): feature2.getProp(thickness) = " + feature2.getProp("thickness"));*/
|
2099 |
String str = att[0]; |
2100 |
feature3.setProp(str,feature2.getProp(str)); |
2101 |
} |
2102 |
|
2103 |
feature3.setGeometry(lineString2); |
2104 |
|
2105 |
if (addingToBlock == false) { |
2106 |
features.add(feature3); |
2107 |
} |
2108 |
} else if (feature2.getGeometry() instanceof Polygon) { |
2109 |
polygon = (Polygon)feature2.getGeometry();
|
2110 |
Polygon polygon2 = new Polygon(); |
2111 |
Point2D[] points = new Point2D[polygon.pointNr()]; |
2112 |
Point2D[] pointss = new Point2D[polygon.pointNr()]; |
2113 |
for (int j=0; j<polygon.pointNr(); j++) { |
2114 |
points[j] = (Point2D)polygon.get(j);
|
2115 |
pointss[j] = new Point2D.Double(); |
2116 |
|
2117 |
points[j].setLocation(points[j].getX() - bPointX, points[j].getY() - bPointY); |
2118 |
double laX = insert.get(0).getX() + ((points[j].getX()*sFactorX)*Math.cos(rAngleRad) + (points[j].getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
2119 |
double laY = insert.get(0).getY() + ((points[j].getX()*sFactorX)*Math.sin(rAngleRad) + (points[j].getY()*sFactorY)*Math.cos(rAngleRad)); |
2120 |
pointss[j].setLocation(laX, laY); |
2121 |
polygon2.add(pointss[j]); |
2122 |
} |
2123 |
|
2124 |
Feature feature3 = new Feature();
|
2125 |
feature3.setProp("layer", feature2.getProp("layer")); |
2126 |
feature3.setProp("color", feature2.getProp("color")); |
2127 |
feature3.setProp("dxfEntity", feature2.getProp("dxfEntity")); |
2128 |
feature3.setProp("elevation", feature2.getProp("elevation")); |
2129 |
feature3.setProp("thickness", feature2.getProp("thickness")); |
2130 |
|
2131 |
//041130
|
2132 |
for (int j=0;j<attributes.size();j++) { |
2133 |
String[] att = new String[2]; |
2134 |
att = (String[])attributes.get(j); |
2135 |
feature3.setProp(att[0],feature2.getProp(att[0])); |
2136 |
} |
2137 |
|
2138 |
feature3.setGeometry(polygon2); |
2139 |
|
2140 |
if (addingToBlock == false) { |
2141 |
features.add(feature3); |
2142 |
} |
2143 |
} else if (feature2.getGeometry() instanceof Point) { |
2144 |
point = (Point)feature2.getGeometry();
|
2145 |
point1 = point.get(0);
|
2146 |
|
2147 |
pointAux = new Point2D.Double(point1.getX() - bPointX, point1.getY() - bPointY); |
2148 |
double laX = insert.get(0).getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
2149 |
double laY = insert.get(0).getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
2150 |
point11.setLocation(laX, laY); |
2151 |
Point pointt = new Point(); |
2152 |
pointt.add(point11); |
2153 |
|
2154 |
Feature feature3 = new Feature();
|
2155 |
feature3.setProp("layer", feature2.getProp("layer")); |
2156 |
feature3.setProp("color", feature2.getProp("color")); |
2157 |
feature3.setProp("dxfEntity", feature2.getProp("dxfEntity")); |
2158 |
feature3.setProp("elevation", feature2.getProp("elevation")); |
2159 |
feature3.setProp("thickness", feature2.getProp("thickness")); |
2160 |
if (point.isText) {
|
2161 |
feature3.setProp("text", feature2.getProp("text")); |
2162 |
feature3.setProp("textHeight", feature2.getProp("textHeight")); |
2163 |
double auxR = Double.parseDouble(feature2.getProp("textRotation")); |
2164 |
//System.out.println("auxR = " + auxR);
|
2165 |
auxR = auxR + rAngleGra; |
2166 |
feature3.setProp("textRotation", Double.toString(auxR)); |
2167 |
//System.out.println("gestionaInsert(): feature3.getProp(textRotation) = " + feature3.getProp("textRotation"));
|
2168 |
pointt.isText = true;
|
2169 |
} |
2170 |
|
2171 |
//041130
|
2172 |
for (int j=0;j<attributes.size();j++) { |
2173 |
String[] att = new String[2]; |
2174 |
att = (String[])attributes.get(j); |
2175 |
feature3.setProp(att[0],feature2.getProp(att[0])); |
2176 |
} |
2177 |
|
2178 |
feature3.setGeometry(pointt); |
2179 |
|
2180 |
//if (addingToBlock == false) {
|
2181 |
features.add(feature3); |
2182 |
//}
|
2183 |
} else {
|
2184 |
System.out.println("gestionaInsert(): Encontrado elemento desconocido"); |
2185 |
} |
2186 |
} |
2187 |
} |
2188 |
|
2189 |
private void addFace(int [] face) { |
2190 |
hasFaces = true;
|
2191 |
if (faces == null) |
2192 |
faces = new Vector(); |
2193 |
faces.add(face); |
2194 |
} |
2195 |
|
2196 |
/**
|
2197 |
* Quita los atributos repetidos.
|
2198 |
*/
|
2199 |
public void depureAttributes() { |
2200 |
//String[] att = null;
|
2201 |
/*Set conjunto = new HashSet();
|
2202 |
for (int i=0;i<attributes.size();i++) {
|
2203 |
att = (String[])attributes.get(i);
|
2204 |
String str = att[0];
|
2205 |
conjunto.add(str);
|
2206 |
}
|
2207 |
//conjunto.addAll(attributes);
|
2208 |
Vector atts = new Vector();
|
2209 |
Vector atts2 = new Vector();
|
2210 |
atts.addAll(conjunto);
|
2211 |
for (int i=0;i<atts.size();i++) {
|
2212 |
if (((String[])(attributes.get(i)))[0] == atts.get(i)) {
|
2213 |
atts2.add(i, attributes.get(i));
|
2214 |
}
|
2215 |
}*/
|
2216 |
|
2217 |
String[] lastAtt = new String[2]; |
2218 |
for (int i=0;i<attributes.size();i++) { |
2219 |
String[] att = (String[])attributes.get(i); |
2220 |
for (int j=i+1;j<attributes.size();j++) { |
2221 |
//System.out.println("depureAttributes(): j = " + j);
|
2222 |
String[] st = (String[])attributes.get(j); |
2223 |
String st1 = att[0]; |
2224 |
String st2 = st[0]; |
2225 |
//System.out.println("depureAttributes(): st1 = " + st1);
|
2226 |
//System.out.println("depureAttributes(): st2 = " + st2);
|
2227 |
if (st2.equals(st1)) {
|
2228 |
//System.out.println("depureAttributes(): Borra el st2");
|
2229 |
attributes.remove(j); |
2230 |
} |
2231 |
if (i==attributes.size()-1) { |
2232 |
lastAtt = att; |
2233 |
} |
2234 |
} |
2235 |
} |
2236 |
for (int i=attributes.size()-2;i>=0;i--) { |
2237 |
String[] att = (String[])attributes.get(i); |
2238 |
String st1 = lastAtt[0]; |
2239 |
String st2 = att[0]; |
2240 |
if (st2.equals(st1)) {
|
2241 |
attributes.remove(i); |
2242 |
} |
2243 |
} |
2244 |
|
2245 |
/*String[] attStrs = new String[attributes.size()];
|
2246 |
Vector attribs = new Vector();
|
2247 |
for (int i=0;i<attributes.size();i++) {
|
2248 |
att = (String[])attributes.get(i);
|
2249 |
attStrs[i] = att[0];
|
2250 |
}
|
2251 |
Set attStrsNR = new HashSet();
|
2252 |
for (int i=0;i<attStrs.length;i++) {
|
2253 |
attStrsNR.add(attStrs[i]);
|
2254 |
}
|
2255 |
String[] attStrsNRA = new String[attStrsNR.size()];
|
2256 |
attStrsNR.toArray(attStrsNRA);
|
2257 |
for (int i=0;i<attStrsNR.size();i++) {
|
2258 |
att[0] = attStrsNRA[i];
|
2259 |
attribs.add(att);
|
2260 |
}
|
2261 |
for (int i=0;i<attributes.size();i++) {
|
2262 |
att = (String[])attributes.get(i);
|
2263 |
String[] att2 = new String[2];
|
2264 |
for (int j=0;j<attribs.size();j++) {
|
2265 |
att2 = (String[])attribs.get(j);
|
2266 |
if (att[0].equals(att2[0])) {
|
2267 |
att2[1] = att[1];
|
2268 |
}
|
2269 |
attribs.set(j, att2);
|
2270 |
}
|
2271 |
}
|
2272 |
attributes = attribs;*/
|
2273 |
} |
2274 |
|
2275 |
/**
|
2276 |
* Hace los setProp para los atributos extra.
|
2277 |
* @param feature
|
2278 |
*/
|
2279 |
private void completeAttributes(Feature feature) { |
2280 |
// 041130: Rellena las props con los atributos.
|
2281 |
for (int i=0;i<attributes.size();i++) { |
2282 |
String[] att = new String[2]; |
2283 |
att = (String[])attributes.get(i); |
2284 |
feature.setProp(att[0],att[1]); |
2285 |
} |
2286 |
} |
2287 |
|
2288 |
/**
|
2289 |
* Copia los atributos extra cargados en InsPoint y ya perfectamente definidos a los
|
2290 |
* elementos del bloque al que referencia el punto de insercion.
|
2291 |
* @param insert
|
2292 |
*/
|
2293 |
private void copyAttributes(Feature feaInsert) { |
2294 |
Feature feature = null;
|
2295 |
InsPoint insert = new InsPoint();
|
2296 |
insert = (InsPoint)feaInsert.getGeometry(); |
2297 |
for (int i=0; i<insert.getBlock().size(); i++) { |
2298 |
feature = (Feature)insert.getBlock().get(i); |
2299 |
for (int j=0;j<attributes.size();j++) { |
2300 |
String[] att = new String[2]; |
2301 |
att = (String[])attributes.get(j); |
2302 |
feature.setProp(att[0],feaInsert.getProp(att[0])); |
2303 |
} |
2304 |
} |
2305 |
} |
2306 |
|
2307 |
/**
|
2308 |
* Se ejecuta cuando se declaran nuevos atributos, es decir, tras cada ATTDEF.
|
2309 |
* A?ade estos atributos a las features existentes.
|
2310 |
*/
|
2311 |
private void setNewAttributes() { |
2312 |
for (int i=0;i<features.size();i++) { |
2313 |
Feature fea = new Feature();
|
2314 |
fea = (Feature)features.get(i); |
2315 |
completeAttributes(fea); |
2316 |
} |
2317 |
for (int i=0;i<blkList.size();i++) { |
2318 |
FeatureCollection bloque = new FeatureCollection(proj);
|
2319 |
bloque = (FeatureCollection)blkList.get(i); |
2320 |
for (int j=0;j<bloque.size();j++) { |
2321 |
Feature fea = new Feature();
|
2322 |
fea = (Feature)bloque.get(j); |
2323 |
completeAttributes(fea); |
2324 |
} |
2325 |
} |
2326 |
} |
2327 |
|
2328 |
public Vector getAttributes() { |
2329 |
return attributes;
|
2330 |
} |
2331 |
|
2332 |
/* (non-Javadoc)
|
2333 |
* @see org.cresques.io.DxfFile.EntityFactory#getExtent()
|
2334 |
*/
|
2335 |
public Extent getExtent() {
|
2336 |
Feature feature = new Feature();
|
2337 |
Extent extent = new Extent();
|
2338 |
Iterator iter = features.iterator();
|
2339 |
while (iter.hasNext()) {
|
2340 |
feature = (Feature)iter.next(); |
2341 |
extent.add(feature.getExtent()); |
2342 |
} |
2343 |
return extent;
|
2344 |
} |
2345 |
|
2346 |
public void setProjection(IProjection p) { |
2347 |
proj = p; |
2348 |
} |
2349 |
|
2350 |
/* (non-Javadoc)
|
2351 |
* @see org.cresques.io.DxfFile.EntityFactory#reProject(org.cresques.geo.ReProjection)
|
2352 |
*/
|
2353 |
public void reProject(ICoordTrans rp) { |
2354 |
Feature feature = new Feature();
|
2355 |
Extent extent = new Extent();
|
2356 |
Iterator iter = features.iterator();
|
2357 |
while (iter.hasNext()) {
|
2358 |
feature = (Feature)iter.next(); |
2359 |
((Projected) feature).reProject(rp); |
2360 |
extent.add(feature.getExtent()); |
2361 |
} |
2362 |
setProjection(rp.getPDest()); |
2363 |
} |
2364 |
|
2365 |
/* (non-Javadoc)
|
2366 |
* @see org.cresques.geo.Projected#getProjection()
|
2367 |
*/
|
2368 |
public IProjection getProjection() {
|
2369 |
return proj;
|
2370 |
} |
2371 |
|
2372 |
public IObjList getObjects() { return features;} |
2373 |
|
2374 |
public void draw(Graphics2D g, ViewPortData vp) { |
2375 |
Iterator iter = features.iterator();
|
2376 |
Extent extent; |
2377 |
while (iter.hasNext()) {
|
2378 |
Feature feature = new Feature();
|
2379 |
feature = (Feature)iter.next(); |
2380 |
extent = feature.getExtent(); |
2381 |
if (vp.getExtent().minX()> extent.maxX()) continue; |
2382 |
if (vp.getExtent().minY()> extent.maxY()) continue; |
2383 |
if (vp.getExtent().maxX()< extent.minX()) continue; |
2384 |
if (vp.getExtent().maxY()< extent.minY()) continue; |
2385 |
//if (!feature.layer.frozen)
|
2386 |
feature.draw(g, vp); |
2387 |
} |
2388 |
} |
2389 |
|
2390 |
public static Vector createArc(Point2D coord1, Point2D coord2, double bulge) { |
2391 |
return new DxfCalArcs(coord1, coord2, bulge).getPoints(1); |
2392 |
} |
2393 |
|
2394 |
/* (non-Javadoc)
|
2395 |
* @see org.cresques.io.DxfFile.EntityFactory#getBlkList()
|
2396 |
*/
|
2397 |
public Vector getBlkList() { |
2398 |
return blkList;
|
2399 |
} |
2400 |
|
2401 |
/* (non-Javadoc)
|
2402 |
* @see org.cresques.io.DxfFile.EntityFactory#getDxfEntityList()
|
2403 |
*/
|
2404 |
public DxfEntityList getDxfEntityList() {
|
2405 |
// TODO Auto-generated method stub
|
2406 |
return null; |
2407 |
} |
2408 |
|
2409 |
/* (non-Javadoc)
|
2410 |
* @see org.cresques.io.DxfFile.EntityFactory#getBlk()
|
2411 |
*/
|
2412 |
public DxfBlock getBlk() {
|
2413 |
// TODO Auto-generated method stub
|
2414 |
return null; |
2415 |
} |
2416 |
|
2417 |
/* (non-Javadoc)
|
2418 |
* @see org.cresques.io.DxfFile.EntityFactory#createEllipse(org.cresques.io.DxfGroupVector)
|
2419 |
*/
|
2420 |
public void createEllipse(DxfGroupVector v) throws Exception { |
2421 |
// TODO Auto-generated method stub
|
2422 |
|
2423 |
} |
2424 |
|
2425 |
} |