Revision 83
trunk/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfPolyline.java | ||
---|---|---|
30 | 30 |
public class DxfPolyline extends DxfEntity { |
31 | 31 |
final static Color baseColor = new Color(69, 106, 121); |
32 | 32 |
Vector pts = null; |
33 |
Vector faces = null; |
|
33 | 34 |
GeneralPath gp = null; |
34 | 35 |
int flags = 0; |
35 | 36 |
boolean closed = false; |
37 |
boolean hasFaces = false; |
|
36 | 38 |
|
37 | 39 |
public DxfPolyline(Projection proj, DxfLayer layer) { |
38 | 40 |
super(proj, layer); |
... | ... | |
45 | 47 |
extent.add(pt); |
46 | 48 |
} |
47 | 49 |
|
50 |
public void addFace(int [] face) { |
|
51 |
hasFaces = true; |
|
52 |
if (faces == null) |
|
53 |
faces = new Vector(); |
|
54 |
faces.add(face); |
|
55 |
} |
|
56 |
|
|
48 | 57 |
private Color color = baseColor; //Color(255,214,132,255); |
49 | 58 |
|
50 | 59 |
public Color c() {return color;} |
... | ... | |
76 | 85 |
color = AcadColor.getColor(dxfColor); |
77 | 86 |
newGP(vp); |
78 | 87 |
if (closed) { |
79 |
g.setColor(new Color(color.getRed(), color.getBlue(), color.getGreen(), 0x80));
|
|
88 |
g.setColor(new Color(color.getRed(), color.getBlue(), color.getGreen(), 0x20));
|
|
80 | 89 |
g.fill(gp); |
81 | 90 |
} |
82 | 91 |
g.setColor(color); |
... | ... | |
89 | 98 |
gp = new GeneralPath(); |
90 | 99 |
Point2D pt0 = null, pt=null, pt1=null; |
91 | 100 |
Point2D.Double ptTmp = new Point2D.Double(0.0, 0.0); |
92 |
Iterator iter = pts.iterator(); |
|
93 |
while (iter.hasNext()) { |
|
94 |
pt1 = (Point2D) iter.next(); |
|
95 |
vp.mat.transform(pt1, ptTmp); |
|
96 |
if (pt0 == null) { |
|
97 |
pt0 = ptTmp; |
|
98 |
gp.moveTo((float)ptTmp.getX(), (float)ptTmp.getY()); |
|
99 |
} else { |
|
100 |
gp.lineTo((float)ptTmp.getX(), (float)ptTmp.getY()); |
|
101 |
if (! hasFaces) { |
|
102 |
Iterator iter = pts.iterator(); |
|
103 |
while (iter.hasNext()) { |
|
104 |
pt1 = (Point2D) iter.next(); |
|
105 |
vp.mat.transform(pt1, ptTmp); |
|
106 |
if (pt0 == null) { |
|
107 |
pt0 = ptTmp; |
|
108 |
gp.moveTo((float)ptTmp.getX(), (float)ptTmp.getY()); |
|
109 |
} else { |
|
110 |
gp.lineTo((float)ptTmp.getX(), (float)ptTmp.getY()); |
|
111 |
} |
|
101 | 112 |
} |
113 |
if (closed) { |
|
114 |
gp.closePath(); |
|
115 |
} |
|
116 |
} else { |
|
117 |
System.out.println("POLYLINE: caras=" +faces.size()+", puntos="+ pts.size()); |
|
118 |
int [] face; |
|
119 |
int i0, i1; |
|
120 |
Iterator iter = faces.iterator(); |
|
121 |
while (iter.hasNext()) { |
|
122 |
face = (int []) iter.next(); |
|
123 |
|
|
124 |
i0 = face[3]; |
|
125 |
for (int i=0; i<4; i++) { |
|
126 |
i1 = face[i]; |
|
127 |
if (i0 > 0) { |
|
128 |
pt0 = (Point2D) pts.get(i0-1); |
|
129 |
vp.mat.transform(pt0, ptTmp); |
|
130 |
gp.moveTo((float)ptTmp.getX(), (float)ptTmp.getY()); |
|
131 |
pt1 = (Point2D) pts.get(Math.abs(i1)-1); |
|
132 |
vp.mat.transform(pt1, ptTmp); |
|
133 |
gp.lineTo((float)ptTmp.getX(), (float)ptTmp.getY()); |
|
134 |
} |
|
135 |
i0 = i1; |
|
136 |
} |
|
137 |
} |
|
102 | 138 |
} |
103 |
if (closed) { |
|
104 |
gp.closePath(); |
|
105 |
} |
|
106 | 139 |
} |
107 | 140 |
|
108 | 141 |
/** |
trunk/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfEntityMaker.java | ||
---|---|---|
11 | 11 |
import org.cresques.io.DxfGroupVector; |
12 | 12 |
import org.cresques.px.Extent; |
13 | 13 |
import org.cresques.px.PxObj; |
14 |
import org.cresques.px.gml.Feature; |
|
15 |
import org.cresques.px.gml.InsPoint; |
|
14 |
//import org.cresques.px.gml.Feature; |
|
16 | 15 |
|
17 | 16 |
public class DxfEntityMaker implements DxfFile.EntityFactory, Projected { |
18 | 17 |
Projection proj = null; |
... | ... | |
92 | 91 |
xtruY = grp.getDataAsDouble(220); |
93 | 92 |
if (grp.hasCode(230)) |
94 | 93 |
xtruZ = grp.getDataAsDouble(230); |
94 |
|
|
95 | 95 |
if ((entity.flags & 0x01) == 0x01) { |
96 | 96 |
entity.closed = true; |
97 | 97 |
} |
... | ... | |
114 | 114 |
} |
115 | 115 |
} |
116 | 116 |
if (addingToBlock == false) { |
117 |
System.out.println("createPolyline: A?adimos una polilinea a la lista de entidades"); |
|
117 |
//System.out.println("createPolyline: A?adimos una polilinea a la lista de entidades");
|
|
118 | 118 |
entities.add(lastEntity); |
119 | 119 |
} else { |
120 |
System.out.println("createPolyline: A?adimos una polilinea al bloque " + iterator); |
|
120 |
//System.out.println("createPolyline: A?adimos una polilinea al bloque " + iterator);
|
|
121 | 121 |
blk.add(lastEntity); |
122 | 122 |
} |
123 | 123 |
lastEntity = null; |
... | ... | |
128 | 128 |
} |
129 | 129 |
public void addVertex(DxfGroupVector grp) throws Exception { |
130 | 130 |
double x = 0.0, y = 0.0, z = 0.0; |
131 |
|
|
131 |
int flags = 0; |
|
132 |
x = grp.getDataAsDouble(10); |
|
133 |
y = grp.getDataAsDouble(20); |
|
134 |
if (grp.hasCode(30)) z = grp.getDataAsDouble(30); |
|
135 |
if (grp.hasCode(70)) { |
|
136 |
flags = grp.getDataAsInt(70); |
|
137 |
} |
|
138 |
//bulge = 0.0; |
|
132 | 139 |
if (bulge == 0.0) { |
133 |
x = grp.getDataAsDouble(10); |
|
134 |
y = grp.getDataAsDouble(20); |
|
135 |
if (grp.hasCode(30)) z = grp.getDataAsDouble(30); |
|
136 | 140 |
if (grp.hasCode(42)) { |
137 | 141 |
bulge = grp.getDataAsDouble(42); |
138 | 142 |
//bulge = 0.0; |
... | ... | |
140 | 144 |
Point3D point_in = new Point3D(x, y, z); |
141 | 145 |
Point3D xtru = new Point3D(xtruX, xtruY, xtruZ); |
142 | 146 |
Point2D point_out = DxfCalXtru.CalculateXtru(point_in, xtru); |
143 |
x = point_out.getX(); |
|
144 |
y = point_out.getY(); |
|
145 |
Point2D pt = proj.createPoint( x, y); |
|
146 |
((DxfPolyline) lastEntity).add(pt); |
|
147 |
if (((DxfPolyline)lastEntity).pts.size() == 1) firstPt = pt; |
|
147 |
if ((flags & 0x80) == 0x80 && (flags & 0x40) == 0) { |
|
148 |
int [] face = {0,0,0,0}; |
|
149 |
face[0] = grp.getDataAsInt(71); |
|
150 |
face[1] = grp.getDataAsInt(72); |
|
151 |
face[2] = grp.getDataAsInt(73); |
|
152 |
face[3] = grp.getDataAsInt(74); |
|
153 |
((DxfPolyline) lastEntity).addFace(face); |
|
154 |
} else { |
|
155 |
x = point_out.getX(); |
|
156 |
y = point_out.getY(); |
|
157 |
Point2D pt = proj.createPoint( x, y); |
|
158 |
((DxfPolyline) lastEntity).add(pt); |
|
159 |
if (((DxfPolyline)lastEntity).pts.size() == 1) firstPt = pt; |
|
160 |
} |
|
148 | 161 |
} else if (bulge > 0.0) { |
149 | 162 |
double bulge_aux = 0.0; |
150 |
x = grp.getDataAsDouble(10); |
|
151 |
y = grp.getDataAsDouble(20); |
|
152 |
if (grp.hasCode(30)) z = grp.getDataAsDouble(30); |
|
153 | 163 |
if (grp.hasCode(42)) { |
154 | 164 |
bulge_aux = grp.getDataAsDouble(42); |
155 | 165 |
} else { bulge_aux = 0.0; } |
... | ... | |
172 | 182 |
bulge = bulge_aux; |
173 | 183 |
} else { //si el bulge es menor que cero. |
174 | 184 |
double bulge_aux = 0.0; |
175 |
x = grp.getDataAsDouble(10); |
|
176 |
y = grp.getDataAsDouble(20); |
|
177 |
if (grp.hasCode(30)) z = grp.getDataAsDouble(30); |
|
178 | 185 |
if (grp.hasCode(42)) { |
179 | 186 |
bulge_aux = grp.getDataAsDouble(42); // * (-1.0); |
180 | 187 |
} else { bulge_aux = 0.0; } |
... | ... | |
197 | 204 |
bulge = bulge_aux; |
198 | 205 |
} |
199 | 206 |
} |
207 |
|
|
200 | 208 |
public void createLwPolyline(DxfGroupVector grp) throws Exception { |
201 | 209 |
double x = 0.0, y = 0.0, elev=0.0; |
202 | 210 |
DxfGroup g = null; |
... | ... | |
223 | 231 |
} |
224 | 232 |
if (grp.hasCode(70)) |
225 | 233 |
entity.flags = grp.getDataAsInt(70); |
234 |
if ((entity.flags & 0x01) == 0x01) { |
|
235 |
entity.closed = true; |
|
236 |
} |
|
226 | 237 |
if (addingToBlock == false) { |
227 | 238 |
entities.add(entity); |
228 | 239 |
} else { |
229 |
System.out.println("createLwPolyline(): A?adimos una lwpolilinea al bloque " + iterator); |
|
240 |
//System.out.println("createLwPolyline(): A?adimos una lwpolilinea al bloque " + iterator);
|
|
230 | 241 |
blk.add(entity); |
231 | 242 |
} |
232 | 243 |
} |
... | ... | |
264 | 275 |
//entity.dxfColor = 0; |
265 | 276 |
} |
266 | 277 |
if (addingToBlock == false) { |
267 |
System.out.println("createLine(): A?adimos una linea a la lista de entidades"); |
|
278 |
//System.out.println("createLine(): A?adimos una linea a la lista de entidades");
|
|
268 | 279 |
entities.add(entity); |
269 | 280 |
} else { |
270 |
System.out.println("createLine(): A?adimos una linea al bloque " + iterator); |
|
281 |
//System.out.println("createLine(): A?adimos una linea al bloque " + iterator);
|
|
271 | 282 |
blk.add(entity); |
272 | 283 |
} |
273 | 284 |
} |
... | ... | |
302 | 313 |
if (addingToBlock == false) { |
303 | 314 |
entities.add(entity); |
304 | 315 |
} else { |
305 |
System.out.println("createText(): A?adimos un text al bloque " + iterator); |
|
316 |
//System.out.println("createText(): A?adimos un text al bloque " + iterator);
|
|
306 | 317 |
blk.add(entity); |
307 | 318 |
} |
308 | 319 |
} |
... | ... | |
337 | 348 |
if (addingToBlock == false) { |
338 | 349 |
entities.add(entity); |
339 | 350 |
} else { |
340 |
System.out.println("createPoint(): A?adimos un punto al bloque " + iterator); |
|
351 |
//System.out.println("createPoint(): A?adimos un punto al bloque " + iterator);
|
|
341 | 352 |
blk.add(entity); |
342 | 353 |
} |
343 | 354 |
} |
... | ... | |
380 | 391 |
//entity.dxfColor = 0; |
381 | 392 |
} |
382 | 393 |
if (addingToBlock == false) { |
383 |
System.out.println("createCircle(): A?ade un circulo a la lista de entidades"); |
|
394 |
//System.out.println("createCircle(): A?ade un circulo a la lista de entidades");
|
|
384 | 395 |
entities.add(entity); |
385 | 396 |
} else { |
386 |
System.out.println("createCircle(): A?adimos un circulo al bloque " + iterator); |
|
397 |
//System.out.println("createCircle(): A?adimos un circulo al bloque " + iterator);
|
|
387 | 398 |
blk.add(entity); |
388 | 399 |
} |
389 | 400 |
} |
... | ... | |
450 | 461 |
} else { |
451 | 462 |
//entity.dxfColor = 0; |
452 | 463 |
} |
453 |
System.out.println("createArc(): A?adimos un arco al bloque"); |
|
464 |
//System.out.println("createArc(): A?adimos un arco al bloque");
|
|
454 | 465 |
if (addingToBlock == false) { |
455 | 466 |
entities.add(entity); |
456 | 467 |
} else { |
457 |
System.out.println("createArc(): A?adimos un arco al bloque " + iterator); |
|
468 |
//System.out.println("createArc(): A?adimos un arco al bloque " + iterator);
|
|
458 | 469 |
blk.add(entity); |
459 | 470 |
} |
460 | 471 |
} |
... | ... | |
527 | 538 |
entities.add(secondEntity); |
528 | 539 |
} |
529 | 540 |
if (addingToBlock == true && entity.blockFound == true) { |
530 |
System.out.println("createArc(): A?adimos un insert al bloque " + iterator); |
|
541 |
//System.out.println("createArc(): A?adimos un insert al bloque " + iterator);
|
|
531 | 542 |
blk.add(entity); |
532 | 543 |
} |
533 | 544 |
} |
... | ... | |
842 | 853 |
} |
843 | 854 |
} |
844 | 855 |
|
845 |
/* (non-Javadoc) |
|
846 |
* @see org.cresques.io.DxfFile.EntityFactory#getDxfEntityList() |
|
847 |
*/ |
|
848 |
public DxfEntityList getDxfEntityList() { |
|
849 |
// TODO Auto-generated method stub |
|
850 |
return null; |
|
851 |
} |
|
852 |
|
|
853 |
/* (non-Javadoc) |
|
854 |
* @see org.cresques.io.DxfFile.EntityFactory#gestionaInsert(org.cresques.px.gml.InsPoint) |
|
855 |
*/ |
|
856 |
public void gestionaInsert(Feature feature) { |
|
857 |
// TODO Auto-generated method stub |
|
858 |
|
|
859 |
} |
|
860 |
|
|
861 | 856 |
} |
trunk/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfCircle.java | ||
---|---|---|
60 | 60 |
} |
61 | 61 |
|
62 | 62 |
public void draw(Graphics2D g, ViewPort vp) { |
63 |
System.out.println("Va a pintar un circle"); |
|
63 |
//System.out.println("Va a pintar un circle");
|
|
64 | 64 |
Color color = null; |
65 | 65 |
if (dxfColor == AcadColor.BYLAYER) |
66 | 66 |
//g.setColor(layer.getColor()); |
trunk/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfArc.java | ||
---|---|---|
60 | 60 |
} |
61 | 61 |
|
62 | 62 |
public void draw(Graphics2D g, ViewPort vp) { |
63 |
System.out.println("Va a pintar un arc"); |
|
63 |
//System.out.println("Va a pintar un arc");
|
|
64 | 64 |
|
65 | 65 |
Color color = null; |
66 | 66 |
|
trunk/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfSolid.java | ||
---|---|---|
61 | 61 |
} |
62 | 62 |
setProjection(rp.getPDest()); |
63 | 63 |
} |
64 |
|
|
64 |
|
|
65 | 65 |
public void draw(Graphics2D g, ViewPort vp) { |
66 | 66 |
System.out.println("Va a pintar un solid"); |
67 | 67 |
Color color = null; |
trunk/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfText.java | ||
---|---|---|
34 | 34 |
|
35 | 35 |
public DxfText(Projection proj, DxfLayer layer, String txt) { |
36 | 36 |
super(proj, layer); |
37 |
System.out.println("Dxf: TEXT '"+txt+"'."); |
|
37 |
//System.out.println("Dxf: TEXT '"+txt+"'.");
|
|
38 | 38 |
extent = new Extent(); |
39 | 39 |
text = txt; |
40 | 40 |
pts = new Point2D[2]; |
trunk/libraries/libCq CMS for java.old/src/org/cresques/px/PxContour.java | ||
---|---|---|
5 | 5 |
import java.awt.Graphics2D; |
6 | 6 |
import java.awt.FontMetrics; |
7 | 7 |
|
8 |
import java.awt.geom.AffineTransform; |
|
9 | 8 |
import java.awt.geom.Point2D; |
10 | 9 |
|
11 | 10 |
import org.cresques.geo.Hoja; |
Also available in: Unified diff