Revision 2218 branches/CqCMSDvp/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfEntityMaker.java
DxfEntityMaker.java | ||
---|---|---|
13 | 13 |
import org.cresques.px.Extent; |
14 | 14 |
import org.cresques.px.IObjList; |
15 | 15 |
import org.cresques.px.PxObj; |
16 |
import org.cresques.px.gml.InsPoint; |
|
17 |
import org.cresques.px.gml.LineString; |
|
16 | 18 |
|
17 | 19 |
/** |
18 | 20 |
* jmorell: Implementaci?n de la creaci?n de entidades DXF2000. |
... | ... | |
25 | 27 |
DxfBlock blk = null; |
26 | 28 |
DxfTable layers = null; |
27 | 29 |
double bulge = 0.0; |
28 |
|
|
29 | 30 |
double xtruX=0.0, xtruY=0.0, xtruZ=1.0; |
30 |
|
|
31 | 31 |
int polylineFlag = 0; |
32 | 32 |
Point2D firstPt = new Point2D.Double(); |
33 | 33 |
|
34 | 34 |
boolean addingToBlock = false; |
35 | 35 |
int iterator = 0; |
36 |
|
|
36 |
|
|
37 |
// jmorell, 050406: implementaci?n inicial de los ATTRIBS para el piloto ... |
|
38 |
private Vector attributes = null; |
|
39 |
|
|
37 | 40 |
public DxfEntityMaker (IProjection proj) { |
38 | 41 |
this.proj = proj; |
39 | 42 |
layers = new DxfTable(); |
40 | 43 |
entities = new DxfEntityList(proj); |
41 | 44 |
blkList = new Vector(); |
45 |
// jmorell, 050406: implementaci?n inicial de los ATTRIBS para el piloto ... |
|
46 |
attributes = new Vector(); |
|
42 | 47 |
} |
43 | 48 |
|
44 | 49 |
public Vector getBlkList() { return blkList; } |
... | ... | |
117 | 122 |
} |
118 | 123 |
|
119 | 124 |
public void endSeq() throws Exception { |
120 |
DxfPolyline polyline = (DxfPolyline)lastEntity; |
|
121 |
if (polyline.closed) { |
|
122 |
((DxfPolyline) lastEntity).add(firstPt); |
|
123 |
if (!(bulge==0)) { |
|
124 |
int cnt = ((DxfPolyline) lastEntity).pts.size(); |
|
125 |
Vector arc = DxfPolyline.createArc((Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-2)), (Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-1)), bulge); |
|
126 |
((DxfPolyline) lastEntity).pts.remove(cnt-1); |
|
127 |
for (int i=0; i<arc.size(); i++) { |
|
128 |
Point2D pt = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
|
129 |
((DxfPolyline) lastEntity).add(pt); |
|
130 |
if (((DxfPolyline)lastEntity).pts.size() == 1) firstPt = pt; |
|
125 |
if (lastEntity instanceof DxfPolyline) { |
|
126 |
DxfPolyline polyline = (DxfPolyline)lastEntity; |
|
127 |
if (polyline.closed) { |
|
128 |
((DxfPolyline) lastEntity).add(firstPt); |
|
129 |
if (!(bulge==0)) { |
|
130 |
int cnt = ((DxfPolyline) lastEntity).pts.size(); |
|
131 |
Vector arc = DxfPolyline.createArc((Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-2)), (Point2D)(((DxfPolyline) lastEntity).pts.get(cnt-1)), bulge); |
|
132 |
((DxfPolyline) lastEntity).pts.remove(cnt-1); |
|
133 |
for (int i=0; i<arc.size(); i++) { |
|
134 |
Point2D pt = proj.createPoint(((Point2D)arc.get(i)).getX(), ((Point2D)arc.get(i)).getY()); |
|
135 |
((DxfPolyline) lastEntity).add(pt); |
|
136 |
if (((DxfPolyline)lastEntity).pts.size() == 1) firstPt = pt; |
|
137 |
} |
|
138 |
bulge = 0.0; |
|
131 | 139 |
} |
132 |
bulge = 0.0; |
|
133 | 140 |
} |
134 |
} |
|
135 |
// 050315, jmorell: Para leer Polylines estas tb deben tener vector de bulges. |
|
136 |
for (int i=0; i<polyline.pts.size(); i++) { |
|
137 |
polyline.addBulge(new Double(0)); |
|
138 |
} |
|
139 |
((DxfPolyline)lastEntity).addBulge(new Double(bulge)); |
|
140 |
//lastEntity.setHandle(entities.size()+40); |
|
141 |
if (addingToBlock == false) { |
|
142 |
//System.out.println("createPolyline: A?adimos una polilinea a la lista de entidades"); |
|
143 |
entities.add(lastEntity); |
|
141 |
// 050315, jmorell: Para leer Polylines estas tb deben tener vector de bulges. |
|
142 |
for (int i=0; i<((DxfPolyline)lastEntity).pts.size(); i++) { |
|
143 |
// jmorell, 050405: intentando leer DxfPolylines con bulges para el |
|
144 |
// piloto ... |
|
145 |
//polyline.addBulge(new Double(0)); |
|
146 |
((DxfPolyline)lastEntity).addBulge(new Double(0)); |
|
147 |
} |
|
148 |
//System.out.println("DxfEntityMaker.endSeq(): ((DxfPolyline)lastEntity).getBulges().size() = " + ((DxfPolyline)lastEntity).getBulges().size()); |
|
149 |
//((DxfPolyline)lastEntity).addBulge(new Double(bulge)); |
|
150 |
//lastEntity.setHandle(entities.size()+40); |
|
151 |
if (addingToBlock == false) { |
|
152 |
//System.out.println("createPolyline: A?adimos una polilinea a la lista de entidades"); |
|
153 |
entities.add(lastEntity); |
|
154 |
} else { |
|
155 |
//System.out.println("createPolyline: A?adimos una polilinea al bloque " + iterator); |
|
156 |
blk.add(lastEntity); |
|
157 |
//System.out.println("PLINE color="+polyline.getColor()); |
|
158 |
} |
|
159 |
lastEntity = null; |
|
160 |
} else if (lastEntity instanceof DxfInsert) { |
|
161 |
// Se trata de un SEQEND despues de un ATTRIB |
|
162 |
gestionaInsert((DxfInsert)lastEntity, lastEntity.getLayer()); |
|
163 |
if (addingToBlock == false) { |
|
164 |
entities.add(lastEntity); |
|
165 |
} else { |
|
166 |
blk.add(lastEntity); |
|
167 |
} |
|
168 |
lastEntity = null; |
|
144 | 169 |
} else { |
145 |
//System.out.println("createPolyline: A?adimos una polilinea al bloque " + iterator); |
|
146 |
blk.add(lastEntity); |
|
147 |
//System.out.println("PLINE color="+polyline.getColor()); |
|
170 |
// Caso no contemplado |
|
148 | 171 |
} |
149 |
lastEntity = null; |
|
150 | 172 |
xtruX = 0.0; |
151 | 173 |
xtruY = 0.0; |
152 | 174 |
xtruZ = 1.0; |
... | ... | |
354 | 376 |
public void createText(DxfGroupVector grp) throws Exception { |
355 | 377 |
double x = 0.0, y = 0.0, h= 0.0, rot= 0.0; |
356 | 378 |
DxfGroup g = null; |
379 |
//OJO! El segundo punto es opcional ... |
|
357 | 380 |
Point2D pt1 = null, pt2 = null; |
358 | 381 |
String txt = null; |
359 | 382 |
DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8)); |
... | ... | |
363 | 386 |
|
364 | 387 |
x = grp.getDataAsDouble(10); |
365 | 388 |
y = grp.getDataAsDouble(20); |
366 |
entity.setPt1(proj.createPoint(x, y)); |
|
389 |
entity.setPt(proj.createPoint(x, y)); |
|
390 |
//entity.setPt1(proj.createPoint(x, y)); |
|
367 | 391 |
if (grp.hasCode(11)) { |
392 |
entity.setTwoPointsFlag(true); |
|
393 |
entity.setPt1(proj.createPoint(entity.getPt().getX(), entity.getPt().getY())); |
|
368 | 394 |
x = grp.getDataAsDouble(11); |
369 | 395 |
y = grp.getDataAsDouble(21); |
370 | 396 |
entity.setPt2(proj.createPoint(x, y)); |
... | ... | |
606 | 632 |
entity.setHandle(entities.size()+40); |
607 | 633 |
} |
608 | 634 |
// 050223, jmorell: Establecimiento de los par?metros del arco. |
635 |
//System.out.println("DxfEntityMaker.createArc(): pts.length = " + pts.length); |
|
609 | 636 |
entity.setCentralPoint(pts[(pts.length)/2]); |
637 |
//System.out.println("DxfEntityMaker.createArc(): (pts.length)/2 = " + (pts.length/2)); |
|
610 | 638 |
entity.setInit(pts[0]); |
611 | 639 |
entity.setEnd(pts[pts.length-1]); |
640 |
//System.out.println("DxfEntityMaker.createArc(): (pts.length)-1 = " + (pts.length-1)); |
|
612 | 641 |
entity.setCenter(center); |
613 | 642 |
entity.setRadius(r); |
614 | 643 |
entity.setInitAngle(empieza); |
644 |
//System.out.println("DxfEntityMaker.createArc(): empieza = " + empieza); |
|
615 | 645 |
entity.setEndAngle(acaba); |
646 |
//System.out.println("DxfEntityMaker.createArc(): acaba = " + acaba); |
|
616 | 647 |
if (grp.hasCode(62)) { |
617 | 648 |
entity.dxfColor = grp.getDataAsInt(62); |
618 | 649 |
} else { |
... | ... | |
644 | 675 |
|
645 | 676 |
DxfInsert entity = new DxfInsert(proj, layer); |
646 | 677 |
DxfPoint secondEntity = new DxfPoint(proj, layer); |
678 |
// jmorell, 050406: implementaci?n inicial de los ATTRIBS para el piloto ... |
|
679 |
int attributesFollowFlag = 0; |
|
647 | 680 |
|
648 | 681 |
if (grp.hasCode(2)) { |
649 | 682 |
blockName = grp.getDataAsString(2); |
... | ... | |
676 | 709 |
} else { |
677 | 710 |
//entity.dxfColor = 0; |
678 | 711 |
} |
712 |
if (grp.hasCode(66)) { |
|
713 |
attributesFollowFlag = grp.getDataAsInt(66); |
|
714 |
//System.out.println("createInsert: attributesFollowFlag = " + attributesFollowFlag); |
|
715 |
} |
|
679 | 716 |
if (grp.hasCode(210)) |
680 | 717 |
xtruX = grp.getDataAsDouble(210); |
681 | 718 |
if (grp.hasCode(220)) |
... | ... | |
695 | 732 |
entity.setPt(proj.createPoint(x, y)); |
696 | 733 |
secondEntity.setPt(proj.createPoint(x, y)); |
697 | 734 |
|
698 |
gestionaInsert(entity, layer); |
|
735 |
if (entity.getBlockFound()==true && attributesFollowFlag!=1) gestionaInsert(entity, layer);
|
|
699 | 736 |
|
700 | 737 |
//System.out.println("createInsert: entity.getBlockName = " + entity.getBlockName()); |
701 | 738 |
//System.out.println("createInsert: entity.getRotAngle = " + entity.getRotAngle()); |
702 |
|
|
703 |
if (addingToBlock == false) { |
|
704 |
entities.add(secondEntity); |
|
705 |
} else if (addingToBlock == true && entity.blockFound == true) { |
|
706 |
//System.out.println("createArc(): A?adimos un insert al bloque " + iterator); |
|
707 |
blk.add(entity); |
|
739 |
if (attributesFollowFlag==1) { |
|
740 |
//System.out.println("createInsert: Coloca como lastEntity el insert"); |
|
741 |
lastEntity = entity; |
|
742 |
} else { |
|
743 |
if (addingToBlock == false) { |
|
744 |
entities.add(secondEntity); |
|
745 |
} else if (addingToBlock == true && entity.blockFound == true) { |
|
746 |
//System.out.println("createArc(): A?adimos un insert al bloque " + iterator); |
|
747 |
blk.add(entity); |
|
748 |
} |
|
708 | 749 |
} |
709 | 750 |
} |
710 | 751 |
|
... | ... | |
829 | 870 |
blk.setBlkName(blockName); |
830 | 871 |
} |
831 | 872 |
if (grp.hasCode(10)) { |
832 |
basePoint.setLocation(grp.getDataAsDouble(10), basePoint.getY());
|
|
873 |
basePoint = new Point2D.Double(grp.getDataAsDouble(10), basePoint.getY());
|
|
833 | 874 |
blk.setBPoint(basePoint); |
834 | 875 |
} |
835 | 876 |
if (grp.hasCode(20)) { |
836 |
basePoint.setLocation(basePoint.getX(), grp.getDataAsDouble(20));
|
|
877 |
basePoint = new Point2D.Double(basePoint.getX(), grp.getDataAsDouble(20));
|
|
837 | 878 |
blk.setBPoint(basePoint); |
838 | 879 |
} |
839 | 880 |
if (grp.hasCode(30)) { |
... | ... | |
913 | 954 |
DxfPoint dxfPoint = null; |
914 | 955 |
DxfText dxfText = null; |
915 | 956 |
DxfSolid dxfSolid = null; |
957 |
// jmorell, 050406: intentando corregir cosas que salen fuera de sitio ... |
|
958 |
double bPointX = 0.0; |
|
959 |
double bPointY = 0.0; |
|
960 |
//if (entity.getBlockFound() == true) { |
|
961 |
bPointX = entity.block.bPoint.getX(); |
|
962 |
bPointY = entity.block.bPoint.getY(); |
|
963 |
//} |
|
964 |
double sFactorX = entity.getScaleFactor().getX(); |
|
965 |
double sFactorY = entity.getScaleFactor().getY(); |
|
966 |
double rAngleGra = entity.getRotAngle(); |
|
967 |
double rAngleRad = rAngleGra*Math.PI/180.0; |
|
916 | 968 |
for (int i=0; i<entity.block.size(); i++) { |
917 | 969 |
//System.out.println("gestionaInserts: entity.block.blkElements.size() = " + entity.block.blkElements.size()); |
918 | 970 |
dxfEntity = (DxfEntity)entity.block.get(i); |
... | ... | |
921 | 973 |
Point2D point2 = new Point2D.Double(); |
922 | 974 |
Point2D point11 = new Point2D.Double(); |
923 | 975 |
Point2D point22 = new Point2D.Double(); |
976 |
Point2D pointAux = null; |
|
924 | 977 |
if (dxfEntity instanceof DxfLine) { |
925 | 978 |
dxfLine = (DxfLine)dxfEntity; |
926 | 979 |
point1 = dxfLine.getPts()[0]; |
927 |
double laX = entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((point1.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point1.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()); |
|
928 |
double laY = entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((point1.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point1.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY()); |
|
980 |
//double laX = entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((point1.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point1.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()); |
|
981 |
//double laY = entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((point1.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point1.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY()); |
|
982 |
pointAux = new Point2D.Double(point1.getX() - bPointX, point1.getY() - bPointY); |
|
983 |
double laX = entity.pt.getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
|
984 |
double laY = entity.pt.getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
|
929 | 985 |
point11.setLocation(laX, laY); |
930 | 986 |
point2 = dxfLine.getPts()[1]; |
931 |
point22.setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((point2.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point2.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((point2.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point2.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
987 |
pointAux = new Point2D.Double(point2.getX() - bPointX, point2.getY() - bPointY); |
|
988 |
laX = entity.pt.getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
|
989 |
laY = entity.pt.getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
|
990 |
point22.setLocation(laX, laY); |
|
932 | 991 |
DxfLine dxfLinee = new DxfLine(proj, layer, point11, point22); |
933 | 992 |
if (addingToBlock == false) { |
934 | 993 |
entities.add(dxfLinee); |
... | ... | |
936 | 995 |
} else if (dxfEntity instanceof DxfInsert){ |
937 | 996 |
dxfInsert = (DxfInsert)dxfEntity; |
938 | 997 |
point1 = dxfInsert.pt; |
998 |
pointAux = new Point2D.Double(point1.getX() - bPointX, point1.getY() - bPointY); |
|
939 | 999 |
//point11.setLocation(entity.pt.getX() - entity.block.bPoint.getX() + ((point1.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point1.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - entity.block.bPoint.getY() + ((point1.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point1.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
940 |
point11.setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((point1.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point1.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((point1.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point1.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1000 |
//point11.setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((point1.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point1.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((point1.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point1.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1001 |
double laX = entity.pt.getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
|
1002 |
double laY = entity.pt.getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
|
1003 |
point11.setLocation(laX, laY); |
|
941 | 1004 |
DxfInsert dxfInsertt = new DxfInsert(proj, layer); |
942 | 1005 |
|
943 | 1006 |
dxfInsertt.pt = point11; |
... | ... | |
945 | 1008 |
dxfInsertt.blkList = dxfInsert.blkList; |
946 | 1009 |
dxfInsertt.block = dxfInsert.block; |
947 | 1010 |
dxfInsertt.blockName = dxfInsert.blockName; |
1011 |
dxfInsertt.rotAngle = dxfInsert.rotAngle; |
|
948 | 1012 |
dxfInsertt.layer = dxfInsert.layer; |
949 | 1013 |
dxfInsertt.proj = dxfInsert.proj; |
950 |
dxfInsertt.rotAngle = dxfInsert.rotAngle; // * entity.rotAngle;
|
|
951 |
|
|
952 |
dxfInsertt.scaleFactor = new Point2D.Double(dxfInsert.scaleFactor.getX() * entity.scaleFactor.getX(), dxfInsert.scaleFactor.getY() * entity.scaleFactor.getY()); |
|
1014 |
Point2D newScale = new Point2D.Double(dxfInsert.getScaleFactor().getX() * sFactorX, dxfInsert.getScaleFactor().getY() * sFactorY);
|
|
1015 |
dxfInsertt.setScaleFactor(newScale); |
|
1016 |
//dxfInsertt.scaleFactor = new Point2D.Double(dxfInsert.scaleFactor.getX() * entity.scaleFactor.getX(), dxfInsert.scaleFactor.getY() * entity.scaleFactor.getY());
|
|
953 | 1017 |
|
954 | 1018 |
gestionaInsert(dxfInsertt, layer); |
955 | 1019 |
} else if (dxfEntity instanceof DxfPolyline) { |
... | ... | |
962 | 1026 |
points[j] = (Point2D)dxfPolyline.pts.get(j); |
963 | 1027 |
pointss[j] = new Point2D.Double(); |
964 | 1028 |
//pointss[j].setLocation(entity.pt.getX() - entity.block.bPoint.getX() + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - entity.block.bPoint.getY() + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
965 |
pointss[j].setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1029 |
//pointss[j].setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1030 |
pointAux = new Point2D.Double(points[j].getX() - bPointX, points[j].getY() - bPointY); |
|
1031 |
double laX = entity.pt.getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
|
1032 |
double laY = entity.pt.getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
|
1033 |
pointss[j].setLocation(laX, laY); |
|
966 | 1034 |
//pointss[j].setLocation(entity.pt.getX() + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
967 | 1035 |
dxfPolylinee.add(pointss[j]); |
1036 |
// jmorell, 050405: Bulges en Dxfpolyline para el piloto |
|
1037 |
dxfPolylinee.addBulge((Double)dxfPolyline.getBulges().get(j)); |
|
968 | 1038 |
} |
969 | 1039 |
if (addingToBlock == false) entities.add(dxfPolylinee); |
970 | 1040 |
} else if (dxfEntity instanceof DxfArc) { |
... | ... | |
974 | 1044 |
for (int j=0; j<dxfArc.pts.length; j++) { |
975 | 1045 |
points[j] = (Point2D)dxfArc.pts[j]; |
976 | 1046 |
pointss[j] = new Point2D.Double(); |
977 |
//pointss[j].setLocation(entity.pt.getX() - entity.block.bPoint.getX() + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - entity.block.bPoint.getY() + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
978 |
pointss[j].setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
979 |
//pointss[j].setLocation(entity.pt.getX() + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1047 |
pointAux = new Point2D.Double(points[j].getX() - bPointX, points[j].getY() - bPointY); |
|
1048 |
double laX = entity.pt.getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
|
1049 |
double laY = entity.pt.getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
|
1050 |
pointss[j].setLocation(laX, laY); |
|
1051 |
//pointss[j].setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
980 | 1052 |
} |
981 | 1053 |
DxfArc dxfArcc = new DxfArc(proj, layer, pointss); |
982 | 1054 |
// 050315, jmorell: Para que no se pierdan las propiedades en el |
983 | 1055 |
// caso de objetos dentro de bloques. |
984 |
dxfArcc.setCentralPoint(dxfArc.getCentralPoint()); |
|
985 |
dxfArcc.setInit(dxfArc.getInit()); |
|
986 |
dxfArcc.setEnd(dxfArc.getEnd()); |
|
987 |
dxfArcc.setCenter(dxfArc.getCenter()); |
|
988 |
dxfArcc.setRadius(dxfArc.getRadius()); |
|
1056 |
pointAux = new Point2D.Double(dxfArc.getCentralPoint().getX() - bPointX, dxfArc.getCentralPoint().getY() - bPointY); |
|
1057 |
double laX = entity.pt.getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
|
1058 |
double laY = entity.pt.getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
|
1059 |
pointAux.setLocation(laX, laY); |
|
1060 |
dxfArcc.setCentralPoint(pointAux); |
|
1061 |
pointAux = new Point2D.Double(dxfArc.getInit().getX() - bPointX, dxfArc.getInit().getY() - bPointY); |
|
1062 |
laX = entity.pt.getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
|
1063 |
laY = entity.pt.getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
|
1064 |
pointAux.setLocation(laX, laY); |
|
1065 |
dxfArcc.setInit(pointAux); |
|
1066 |
pointAux = new Point2D.Double(dxfArc.getEnd().getX() - bPointX, dxfArc.getEnd().getY() - bPointY); |
|
1067 |
laX = entity.pt.getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
|
1068 |
laY = entity.pt.getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
|
1069 |
pointAux.setLocation(laX, laY); |
|
1070 |
dxfArcc.setEnd(pointAux); |
|
1071 |
pointAux = new Point2D.Double(dxfArc.getCenter().getX() - bPointX, dxfArc.getCenter().getY() - bPointY); |
|
1072 |
laX = entity.pt.getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
|
1073 |
laY = entity.pt.getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
|
1074 |
pointAux.setLocation(laX, laY); |
|
1075 |
dxfArcc.setCenter(pointAux); |
|
1076 |
dxfArcc.setRadius(dxfArc.getRadius()*sFactorX); |
|
1077 |
// TODO ?Como afectan las rotaciones del insert al init y el end angle? |
|
989 | 1078 |
dxfArcc.setInitAngle(dxfArc.getInitAngle()); |
990 | 1079 |
dxfArcc.setEndAngle(dxfArc.getEndAngle()); |
991 | 1080 |
if (addingToBlock == false) entities.add(dxfArcc); |
... | ... | |
996 | 1085 |
for (int j=0; j<dxfCircle.pts.length; j++) { |
997 | 1086 |
points[j] = (Point2D)dxfCircle.pts[j]; |
998 | 1087 |
pointss[j] = new Point2D.Double(); |
999 |
//pointss[j].setLocation(entity.pt.getX() - entity.block.bPoint.getX() + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - entity.block.bPoint.getY() + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1000 |
pointss[j].setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1001 |
//pointss[j].setLocation(entity.pt.getX() + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1088 |
pointAux = new Point2D.Double(points[j].getX() - bPointX, points[j].getY() - bPointY); |
|
1089 |
double laX = entity.pt.getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
|
1090 |
double laY = entity.pt.getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
|
1091 |
pointss[j].setLocation(laX, laY); |
|
1092 |
//pointss[j].setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1002 | 1093 |
} |
1003 | 1094 |
DxfCircle dxfCirclee = new DxfCircle(proj, layer, pointss); |
1004 | 1095 |
// 050315, jmorell: Para que no se pierdan las propiedades en el |
1005 | 1096 |
// caso de objetos dentro de bloques. |
1006 |
dxfCirclee.setCenter(dxfCircle.getCenter()); |
|
1007 |
dxfCirclee.setRadius(dxfCircle.getRadius()); |
|
1097 |
pointAux = new Point2D.Double(dxfCircle.getCenter().getX() - bPointX, dxfCircle.getCenter().getY() - bPointY); |
|
1098 |
double laX = entity.pt.getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
|
1099 |
double laY = entity.pt.getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
|
1100 |
pointAux.setLocation(laX, laY); |
|
1101 |
dxfCirclee.setCenter(pointAux); |
|
1102 |
// Escala en X = escala en Y ... |
|
1103 |
dxfCirclee.setRadius(dxfCircle.getRadius()*sFactorX); |
|
1008 | 1104 |
if (addingToBlock == false) entities.add(dxfCirclee); |
1009 | 1105 |
} else if (dxfEntity instanceof DxfLwPolyline) { |
1010 | 1106 |
dxfLwPolyline = (DxfLwPolyline)dxfEntity; |
... | ... | |
1014 | 1110 |
for (int j=0; j<dxfLwPolyline.pts.size(); j++) { |
1015 | 1111 |
points[j] = (Point2D)dxfLwPolyline.pts.get(j); |
1016 | 1112 |
pointss[j] = new Point2D.Double(); |
1017 |
//pointss[j].setLocation(entity.pt.getX() - entity.block.bPoint.getX() + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - entity.block.bPoint.getY() + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1018 |
pointss[j].setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1019 |
//pointss[j].setLocation(entity.pt.getX() + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1113 |
pointAux = new Point2D.Double(points[j].getX() - bPointX, points[j].getY() - bPointY); |
|
1114 |
double laX = entity.pt.getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
|
1115 |
double laY = entity.pt.getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
|
1116 |
pointss[j].setLocation(laX, laY); |
|
1117 |
//pointss[j].setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1020 | 1118 |
dxfLwPolylinee.add(pointss[j]); |
1119 |
// jmorell, 050405: Bulges en Dxfpolyline para el piloto |
|
1120 |
dxfLwPolylinee.addBulge((Double)dxfPolyline.getBulges().get(j)); |
|
1021 | 1121 |
} |
1022 | 1122 |
if (addingToBlock == false) entities.add(dxfLwPolylinee); |
1023 | 1123 |
} else if (dxfEntity instanceof DxfPoint) { |
1024 | 1124 |
dxfPoint = (DxfPoint)dxfEntity; |
1025 | 1125 |
point1 = dxfPoint.getPt(); |
1026 |
//point11.setLocation(entity.pt.getX() - entity.block.bPoint.getX() + ((point1.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point1.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - entity.block.bPoint.getY() + ((point1.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point1.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1027 |
point11.setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((point1.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point1.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((point1.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point1.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1028 |
//point11.setLocation(entity.pt.getX() + ((point1.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point1.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() + ((point1.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point1.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1126 |
pointAux = new Point2D.Double(point1.getX() - bPointX, point1.getY() - bPointY); |
|
1127 |
double laX = entity.pt.getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
|
1128 |
double laY = entity.pt.getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
|
1129 |
point11.setLocation(laX, laY); |
|
1130 |
//point11.setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((point1.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point1.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((point1.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point1.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1029 | 1131 |
DxfPoint dxfPointt = new DxfPoint(proj, layer); |
1030 | 1132 |
//dxfPointt.pt = point11; |
1031 | 1133 |
dxfPointt.setPt(point11); |
1032 | 1134 |
if (addingToBlock == false) entities.add(dxfPointt); |
1033 | 1135 |
} else if (dxfEntity instanceof DxfText) { |
1034 | 1136 |
dxfText = (DxfText)dxfEntity; |
1035 |
point1 = dxfText.pts[0]; |
|
1036 |
//point11.setLocation(entity.pt.getX() - entity.block.bPoint.getX() + ((point1.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point1.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - entity.block.bPoint.getY() + ((point1.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point1.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1037 |
point11.setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((point1.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point1.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((point1.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point1.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1038 |
//point11.setLocation(entity.pt.getX() + ((point1.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point1.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() + ((point1.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point1.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1039 |
point2 = dxfText.pts[1]; |
|
1040 |
//point22.setLocation(entity.pt.getX() - entity.block.bPoint.getX() + ((point2.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point2.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - entity.block.bPoint.getY() + ((point2.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point2.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1041 |
point22.setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((point2.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point2.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((point2.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point2.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1042 |
//point22.setLocation(entity.pt.getX() + ((point2.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point2.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() + ((point2.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point2.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1043 |
DxfText dxfTextt = new DxfText(proj, layer, dxfText.getText()); |
|
1044 |
dxfTextt.pts[0] = point11; |
|
1045 |
dxfTextt.pts[1] = point22; |
|
1046 |
if (addingToBlock == false) entities.add(dxfTextt); |
|
1137 |
if (dxfText.getTwoPointsFlag()) { |
|
1138 |
point1 = dxfText.pts[0]; |
|
1139 |
pointAux = new Point2D.Double(point1.getX() - bPointX, point1.getY() - bPointY); |
|
1140 |
double laX = entity.pt.getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
|
1141 |
double laY = entity.pt.getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
|
1142 |
point11.setLocation(laX, laY); |
|
1143 |
//point11.setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((point1.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point1.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((point1.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point1.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1144 |
point2 = dxfText.pts[1]; |
|
1145 |
pointAux = new Point2D.Double(point2.getX() - bPointX, point2.getY() - bPointY); |
|
1146 |
laX = entity.pt.getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
|
1147 |
laY = entity.pt.getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
|
1148 |
point22.setLocation(laX, laY); |
|
1149 |
//point22.setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((point2.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point2.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((point2.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point2.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1150 |
DxfText dxfTextt = new DxfText(proj, layer, dxfText.getText()); |
|
1151 |
dxfTextt.pts[0] = point11; |
|
1152 |
dxfTextt.pts[1] = point22; |
|
1153 |
if (addingToBlock == false) entities.add(dxfTextt); |
|
1154 |
} else { |
|
1155 |
point1 = dxfText.getPt(); |
|
1156 |
pointAux = new Point2D.Double(point1.getX() - bPointX, point1.getY() - bPointY); |
|
1157 |
double laX = entity.pt.getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
|
1158 |
double laY = entity.pt.getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
|
1159 |
point11.setLocation(laX, laY); |
|
1160 |
//point11.setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((point1.getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + point1.getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((point1.getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + point1.getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1161 |
DxfText dxfTextt = new DxfText(proj, layer, dxfText.getText()); |
|
1162 |
dxfTextt.setPt(point11); |
|
1163 |
if (addingToBlock == false) entities.add(dxfTextt); |
|
1164 |
} |
|
1047 | 1165 |
} else if (dxfEntity instanceof DxfSolid) { |
1048 | 1166 |
dxfSolid = (DxfSolid)dxfEntity; |
1049 | 1167 |
Point2D[] points = new Point2D[dxfSolid.pts.length]; |
... | ... | |
1051 | 1169 |
for (int j=0; j<dxfSolid.pts.length; j++) { |
1052 | 1170 |
points[j] = (Point2D)dxfSolid.pts[j]; |
1053 | 1171 |
pointss[j] = new Point2D.Double(); |
1054 |
//pointss[j].setLocation(entity.pt.getX() - entity.block.bPoint.getX() + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - entity.block.bPoint.getY() + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1055 |
pointss[j].setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1056 |
//pointss[j].setLocation(entity.pt.getX() + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1172 |
pointAux = new Point2D.Double(points[j].getX() - bPointX, points[j].getY() - bPointY); |
|
1173 |
double laX = entity.pt.getX() + ((pointAux.getX()*sFactorX)*Math.cos(rAngleRad) + (pointAux.getY()*sFactorY)*(-1)*Math.sin(rAngleRad)); |
|
1174 |
double laY = entity.pt.getY() + ((pointAux.getX()*sFactorX)*Math.sin(rAngleRad) + (pointAux.getY()*sFactorY)*Math.cos(rAngleRad)); |
|
1175 |
pointss[j].setLocation(laX, laY); |
|
1176 |
//pointss[j].setLocation(entity.pt.getX() - (entity.block.bPoint.getX() * entity.getScaleFactor().getX()) + ((points[j].getX()*Math.cos((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*(-1)*Math.sin((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getX()), entity.pt.getY() - (entity.block.bPoint.getY() * entity.getScaleFactor().getY()) + ((points[j].getX()*Math.sin((entity.rotAngle*Math.PI)/180.0) + points[j].getY()*Math.cos((entity.rotAngle*Math.PI)/180.0)) * entity.scaleFactor.getY())); |
|
1057 | 1177 |
} |
1058 | 1178 |
DxfSolid dxfSolidd = new DxfSolid(proj, layer, pointss); |
1059 | 1179 |
Point2D aux = dxfSolidd.pts[2]; |
... | ... | |
1066 | 1186 |
} |
1067 | 1187 |
} |
1068 | 1188 |
|
1069 |
/* (non-Javadoc) |
|
1070 |
* @see org.cresques.io.DxfFile.EntityFactory#createAttdef(org.cresques.io.DxfGroupVector) |
|
1071 |
*/ |
|
1072 |
public void createAttdef(DxfGroupVector v) throws Exception { |
|
1073 |
// TODO Auto-generated method stub |
|
1189 |
public void createAttdef(DxfGroupVector grp) throws Exception { |
|
1190 |
DxfGroup g = null; |
|
1074 | 1191 |
|
1192 |
String defaultValue = ""; |
|
1193 |
String tagString = ""; |
|
1194 |
String textStyleName = ""; |
|
1195 |
String attribute[] = new String[2]; |
|
1196 |
boolean tagDefined = false; |
|
1197 |
boolean defValDefined = false; |
|
1198 |
|
|
1199 |
if (grp.hasCode(1)) { |
|
1200 |
defaultValue = grp.getDataAsString(1); |
|
1201 |
attribute[1] = DxfConvTexts.ConvertText(defaultValue); |
|
1202 |
defValDefined = true; |
|
1203 |
if (tagDefined) attributes.add(attribute); |
|
1204 |
} |
|
1205 |
if (grp.hasCode(2)) { |
|
1206 |
tagString = grp.getDataAsString(2); |
|
1207 |
attribute[0] = DxfConvTexts.ConvertText(tagString); |
|
1208 |
tagDefined = true; |
|
1209 |
if (defValDefined) attributes.add(attribute); |
|
1210 |
} |
|
1211 |
if (grp.hasCode(7)) { |
|
1212 |
textStyleName = grp.getDataAsString(7); |
|
1213 |
textStyleName = DxfConvTexts.ConvertText(textStyleName); |
|
1214 |
} |
|
1215 |
// TODO setNewAttributes(); |
|
1075 | 1216 |
} |
1076 |
|
|
1077 |
/* (non-Javadoc) |
|
1078 |
* @see org.cresques.io.DxfFile.EntityFactory#createAttrib(org.cresques.io.DxfGroupVector) |
|
1079 |
*/ |
|
1080 |
public void createAttrib(DxfGroupVector v) throws Exception { |
|
1081 |
// TODO Auto-generated method stub |
|
1217 |
public void createAttrib(DxfGroupVector grp) throws Exception { |
|
1218 |
double x = 0.0, y = 0.0, z = 0.0, h= 0.0, rot= 0.0; |
|
1219 |
DxfGroup g = null; |
|
1220 |
Point2D pt = null; |
|
1082 | 1221 |
|
1222 |
String defaultValue = ""; |
|
1223 |
String tagString = ""; |
|
1224 |
String textStyleName = ""; |
|
1225 |
String att[] = new String[2]; |
|
1226 |
boolean tagDefined = false; |
|
1227 |
boolean defValDefined = false; |
|
1228 |
int attributeFlags = 0; |
|
1229 |
|
|
1230 |
DxfLayer layer = (DxfLayer) layers.getByName(grp.getDataAsString(8)); |
|
1231 |
DxfAttrib entity = new DxfAttrib(proj, layer); |
|
1232 |
|
|
1233 |
if (grp.hasCode(1)) { |
|
1234 |
String strAux1 = grp.getDataAsString(1); |
|
1235 |
strAux1 = DxfConvTexts.ConvertText(strAux1); |
|
1236 |
defaultValue = strAux1; |
|
1237 |
att[1] = DxfConvTexts.ConvertText(defaultValue); |
|
1238 |
defValDefined = true; |
|
1239 |
/*if (tagDefined) { |
|
1240 |
insFea.setProp(att[0], att[1]); |
|
1241 |
ptFea.setProp(att[0], att[1]); |
|
1242 |
} |
|
1243 |
feature.setProp("text", strAux1);*/ |
|
1244 |
} |
|
1245 |
if (grp.hasCode(2)) { |
|
1246 |
String strAux2 = grp.getDataAsString(2); |
|
1247 |
strAux2 = DxfConvTexts.ConvertText(strAux2); |
|
1248 |
tagString = strAux2; |
|
1249 |
att[0] = DxfConvTexts.ConvertText(tagString); |
|
1250 |
tagDefined = true; |
|
1251 |
/*if (defValDefined) { |
|
1252 |
insFea.setProp(att[0], att[1]); |
|
1253 |
ptFea.setProp(att[0], att[1]); |
|
1254 |
}*/ |
|
1255 |
} |
|
1256 |
if (grp.hasCode(7)) { |
|
1257 |
textStyleName = grp.getDataAsString(7); |
|
1258 |
textStyleName = DxfConvTexts.ConvertText(textStyleName); |
|
1259 |
} |
|
1260 |
x = grp.getDataAsDouble(10); |
|
1261 |
y = grp.getDataAsDouble(20); |
|
1262 |
entity.setPt(proj.createPoint(x, y)); |
|
1263 |
if (grp.hasCode(40)) { |
|
1264 |
Double heightD = new Double(grp.getDataAsDouble(40)); |
|
1265 |
String heightS = heightD.toString(); |
|
1266 |
//feature.setProp("textHeight", heightS); |
|
1267 |
} else { |
|
1268 |
//feature.setProp("textHeight", "20.0"); |
|
1269 |
} |
|
1270 |
if (grp.hasCode(50)) { |
|
1271 |
Double rotD = new Double(grp.getDataAsDouble(50)); |
|
1272 |
String rotS = rotD.toString(); |
|
1273 |
//feature.setProp("textRotation", rotS); |
|
1274 |
} else { |
|
1275 |
//feature.setProp("textRotation", "0.0"); |
|
1276 |
} |
|
1277 |
if (grp.hasCode(62)) { |
|
1278 |
entity.dxfColor = grp.getDataAsInt(62); |
|
1279 |
} else { |
|
1280 |
//entity.dxfColor = 0; |
|
1281 |
} |
|
1282 |
if (grp.hasCode(70)) { |
|
1283 |
attributeFlags = grp.getDataAsInt(70); |
|
1284 |
} |
|
1285 |
|
|
1286 |
if (attributeFlags==8) { |
|
1287 |
if (addingToBlock == false) { |
|
1288 |
entities.add(entity); |
|
1289 |
} else { |
|
1290 |
blk.add(entity); |
|
1291 |
} |
|
1292 |
} |
|
1083 | 1293 |
} |
1084 | 1294 |
|
1085 |
/* (non-Javadoc) |
|
1086 |
* @see org.cresques.io.DxfFile.EntityFactory#getAttributes() |
|
1087 |
*/ |
|
1088 | 1295 |
public Vector getAttributes() { |
1089 |
// TODO Auto-generated method stub |
|
1090 |
return null; |
|
1296 |
return attributes; |
|
1091 | 1297 |
} |
1092 | 1298 |
|
1093 | 1299 |
/* (non-Javadoc) |
... | ... | |
1097 | 1303 |
// TODO Auto-generated method stub |
1098 | 1304 |
|
1099 | 1305 |
} |
1306 |
|
|
1307 |
/* (non-Javadoc) |
|
1308 |
* @see org.cresques.io.DxfFile.EntityFactory#isDxf3DFile() |
|
1309 |
*/ |
|
1310 |
public boolean isDxf3DFile() { |
|
1311 |
// TODO Auto-generated method stub |
|
1312 |
return false; |
|
1313 |
} |
|
1100 | 1314 |
|
1101 | 1315 |
} |
Also available in: Unified diff