Revision 69
trunk/libraries/libCq CMS for java.old/src/org/cresques/io/DxfFile.java | ||
---|---|---|
57 | 57 |
public void createSolid(DxfGroupVector v) throws Exception ; |
58 | 58 |
public void createBlock(DxfGroupVector v) throws Exception ; |
59 | 59 |
public void endBlk(DxfGroupVector v) throws Exception ; |
60 |
public void gestionaInsert(DxfInsert entity, DxfLayer layer); |
|
61 |
public DxfBlock getBlk(); |
|
60 | 62 |
public Extent getExtent(); |
61 | 63 |
public Vector getBlkList(); |
62 | 64 |
public DxfEntityList getDxfEntityList(); |
... | ... | |
124 | 126 |
else if (((String) grp.data).compareTo("TABLES") == 0) |
125 | 127 |
readTables(); |
126 | 128 |
else if (((String) grp.data).compareTo("BLOCKS") == 0) |
127 |
//readAnySection(); |
|
128 | 129 |
readBlocks(); |
129 | 130 |
else if (((String) grp.data).compareTo("ENTITIES") == 0) |
130 | 131 |
readEntities(); |
... | ... | |
203 | 204 |
int cntVeces = 0; |
204 | 205 |
DxfGroupVector v = new DxfGroupVector(); |
205 | 206 |
grp = readGrp(); |
206 |
//entityMaker.setAddingToBlock(false); |
|
207 | 207 |
while (true) { |
208 |
//if (grp.equals(0, "ENDSEC")) break; |
|
209 |
/*else*/ if (grp.equals(0, "EOF")) break; |
|
208 |
if (grp.equals(0, "EOF")) break; |
|
210 | 209 |
else if (grp.code == 0) { |
211 | 210 |
if (v.size() > 0) { |
212 | 211 |
String lastEntity = (String) ((DxfGroup) v.get(0)).data; |
... | ... | |
259 | 258 |
DxfGroupVector v = new DxfGroupVector(); |
260 | 259 |
grp = readGrp(); |
261 | 260 |
while (true) { |
262 |
//if (grp.equals(0, "ENDSEC")) break; |
|
263 |
/*else*/ if (grp.equals(0, "EOF")) break; |
|
261 |
if (grp.equals(0, "EOF")) break; |
|
264 | 262 |
else if (grp.code == 0) { |
265 | 263 |
if (v.size() > 0) { |
266 | 264 |
String lastEntity = (String) ((DxfGroup) v.get(0)).data; |
... | ... | |
335 | 333 |
Point2D point2 = new Point2D.Double(); |
336 | 334 |
for (int i=0; i<blkList.size(); i++) { |
337 | 335 |
dxfBlock = (DxfBlock)blkList.get(i); |
338 |
for (int j=0; j<dxfBlock.blkElements.size(); j++) { |
|
336 |
int aux = dxfBlock.blkElements.size(); |
|
337 |
for (int j=0; j<aux; j++) { |
|
338 |
//for (int j=0; j<dxfBlock.blkElements.size(); j++) { |
|
339 | 339 |
dxfEntity = (DxfEntity)dxfBlock.blkElements.get(j); |
340 | 340 |
if (dxfEntity instanceof DxfLine) { |
341 | 341 |
dxfLine = (DxfLine)dxfEntity; |
... | ... | |
349 | 349 |
System.out.println("dxfInsert.pt = " + dxfInsert.pt); |
350 | 350 |
System.out.println("dxfInsert.rotAngle = " + dxfInsert.rotAngle); |
351 | 351 |
System.out.println("dxfInsert.scaleFactor = " + dxfInsert.scaleFactor); |
352 |
|
|
353 |
if (dxfInsert.getBlockFound() == false) { |
|
354 |
boolean aux_bool = dxfInsert.encuentraBloque(nomBlock); |
|
355 |
entityMaker.gestionaInsert(dxfInsert, dxfInsert.getDxfLayer()); |
|
356 |
//DxfBlock blk = new DxfBlock(proj); |
|
357 |
//blk = entityMaker.getBlk(); |
|
358 |
dxfBlock.add(dxfInsert); |
|
359 |
} |
|
360 |
|
|
352 | 361 |
} |
353 | 362 |
} |
354 | 363 |
} |
trunk/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfEntityMaker.java | ||
---|---|---|
399 | 399 |
DxfArc entity = new DxfArc(proj, layer, pts); |
400 | 400 |
if (grp.hasCode(62)) |
401 | 401 |
entity.dxfColor = grp.getDataAsInt(62); |
402 |
System.out.println("createArc(): A?ade un arco a la lista de entidades");
|
|
402 |
System.out.println("createArc(): A?adimos un arco al bloque");
|
|
403 | 403 |
if (addingToBlock == false) { |
404 | 404 |
entities.add(entity); |
405 | 405 |
} else { |
... | ... | |
414 | 414 |
Point2D scaleFactor = new Point2D.Double(1.0, 1.0); |
415 | 415 |
double rotAngle = 0.0; |
416 | 416 |
String blockName = ""; |
417 |
//boolean findFlag = false;
|
|
417 |
//boolean blockFound = false;
|
|
418 | 418 |
|
419 | 419 |
DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8)); |
420 | 420 |
|
... | ... | |
473 | 473 |
|
474 | 474 |
entity.setBlkList(blkList); |
475 | 475 |
|
476 |
//blockFound = entity.encuentraBloque(blockName); |
|
476 | 477 |
entity.encuentraBloque(blockName); |
477 | 478 |
|
478 | 479 |
//gestionaInsert(blk, entity, layer); |
479 | 480 |
gestionaInsert(entity, layer); |
480 | 481 |
|
481 |
if (addingToBlock == false) { |
|
482 |
//entities.add(entity); |
|
483 |
} else { |
|
484 |
System.out.println("createArc(): A?adimos un arco al bloque " + iterator); |
|
482 |
if (addingToBlock == true && entity.blockFound == true) { |
|
483 |
System.out.println("createArc(): A?adimos un insert al bloque " + iterator); |
|
485 | 484 |
blk.add(entity); |
486 | 485 |
} |
487 | 486 |
|
... | ... | |
556 | 555 |
public DxfEntityList getEntities() { return entities;} |
557 | 556 |
public DxfTable getLayers() { return layers;} |
558 | 557 |
|
558 |
public DxfBlock getBlk() { |
|
559 |
return blk; |
|
560 |
} |
|
561 |
|
|
559 | 562 |
//public void gestionaInsert(DxfBlock blk, DxfInsert entity, DxfLayer layer) { |
560 | 563 |
public void gestionaInsert(DxfInsert entity, DxfLayer layer) { |
561 | 564 |
DxfEntity dxfEntity = null; |
... | ... | |
590 | 593 |
point22.setLocation(entity.pt.getX() + ((point2.getX()*Math.cos((entity.rotAngle*Math.PI)/180) + point2.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180)) * entity.scaleFactor.getX()), entity.pt.getY() + ((point2.getX()*Math.sin((entity.rotAngle*Math.PI)/180) + point2.getY()*Math.cos((entity.rotAngle*Math.PI)/180)) * entity.scaleFactor.getY())); |
591 | 594 |
//entity.add(point22); |
592 | 595 |
DxfLine dxfLinee = new DxfLine(proj, layer, point11, point22); |
593 |
entities.add(dxfLinee); |
|
596 |
//entities.add(dxfLinee); |
|
597 |
if (addingToBlock == false) { |
|
598 |
entities.add(dxfLinee); |
|
599 |
} |
|
594 | 600 |
/*if (addingToBlock == false) { |
595 | 601 |
entities.add(dxfLine); |
596 | 602 |
} else { |
... | ... | |
602 | 608 |
|
603 | 609 |
dxfInsert = (DxfInsert)dxfEntity; |
604 | 610 |
point1 = dxfInsert.pt; |
611 |
//point1 = entity.pt; |
|
605 | 612 |
point11.setLocation(entity.pt.getX() + ((point1.getX()*Math.cos((entity.rotAngle*Math.PI)/180) + point1.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180)) * entity.scaleFactor.getX()), entity.pt.getY() + ((point1.getX()*Math.sin((entity.rotAngle*Math.PI)/180) + point1.getY()*Math.cos((entity.rotAngle*Math.PI)/180)) * entity.scaleFactor.getY())); |
606 | 613 |
DxfInsert dxfInsertt = new DxfInsert(proj, layer); |
607 | 614 |
dxfInsertt.pt = point11; |
trunk/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfInsert.java | ||
---|---|---|
31 | 31 |
boolean closed = false; |
32 | 32 |
|
33 | 33 |
//String marca = null; |
34 |
boolean blockFound = false; |
|
34 | 35 |
|
35 | 36 |
public DxfInsert(Projection proj, DxfLayer layer) { |
36 | 37 |
super(proj, layer); |
... | ... | |
45 | 46 |
pts = new Vector(); |
46 | 47 |
} |
47 | 48 |
|
48 |
public DxfBlock encuentraBloque(String blockName) { |
|
49 |
public boolean getBlockFound() { |
|
50 |
return blockFound; |
|
51 |
} |
|
52 |
|
|
53 |
public void setBlockFound(boolean found) { |
|
54 |
blockFound = found; |
|
55 |
} |
|
56 |
|
|
57 |
public boolean encuentraBloque(String blockName) { |
|
49 | 58 |
int i = 0; |
50 |
boolean bloqueEncontrado = false; |
|
51 |
while (i<blkList.size() && bloqueEncontrado == false) { |
|
59 |
//boolean bloqueEncontrado = false; |
|
60 |
//while (i<blkList.size() && bloqueEncontrado == false) { |
|
61 |
while (i<blkList.size() && blockFound == false) { |
|
52 | 62 |
System.out.println("encuentraBloque: ((DxfBlock)blkList.get(i)).getBlkName() = " + ((DxfBlock)blkList.get(i)).getBlkName()); |
53 | 63 |
System.out.println("encuentraBloque: blockName = " + blockName); |
54 | 64 |
if (((DxfBlock)blkList.get(i)).getBlkName().equals(blockName)) { |
55 | 65 |
System.out.println("encuentraBloque: Bloque " + i + " encontrado."); |
56 | 66 |
block = (DxfBlock)blkList.get(i); |
57 |
bloqueEncontrado = true; |
|
67 |
//bloqueEncontrado = true; |
|
68 |
blockFound = true; |
|
69 |
} else { |
|
70 |
System.out.println("encuentraBloque: Bloque " + blockName + " no encontrado"); |
|
71 |
blockFound = false; |
|
58 | 72 |
} |
59 | 73 |
i++; |
60 | 74 |
} |
... | ... | |
86 | 100 |
block.setUserData(datos); |
87 | 101 |
}*/ |
88 | 102 |
|
89 |
return block; |
|
103 |
//return bloqueEncontrado; |
|
104 |
return blockFound; |
|
90 | 105 |
} |
91 | 106 |
|
107 |
public DxfLayer getDxfLayer() { |
|
108 |
return layer; |
|
109 |
} |
|
110 |
|
|
92 | 111 |
public void setBlkList(Vector blkList) { |
93 | 112 |
this.blkList = blkList; |
94 | 113 |
} |
trunk/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfFeatureMaker.java | ||
---|---|---|
953 | 953 |
// TODO Auto-generated method stub |
954 | 954 |
return null; |
955 | 955 |
} |
956 |
|
|
957 |
/* (non-Javadoc) |
|
958 |
* @see org.cresques.io.DxfFile.EntityFactory#gestionaInsert(org.cresques.px.dxf.DxfInsert, org.cresques.px.dxf.DxfLayer) |
|
959 |
*/ |
|
960 |
public void gestionaInsert(DxfInsert entity, DxfLayer layer) { |
|
961 |
// TODO Auto-generated method stub |
|
962 |
|
|
963 |
} |
|
964 |
|
|
965 |
/* (non-Javadoc) |
|
966 |
* @see org.cresques.io.DxfFile.EntityFactory#getBlk() |
|
967 |
*/ |
|
968 |
public DxfBlock getBlk() { |
|
969 |
// TODO Auto-generated method stub |
|
970 |
return null; |
|
971 |
} |
|
956 | 972 |
|
957 | 973 |
} |
Also available in: Unified diff