root / trunk / libraries / libCq CMS for java.old / src / org / cresques / px / dxf / DxfPoint.java @ 95
History | View | Annotate | Download (1.7 KB)
1 |
/*
|
---|---|
2 |
* Created on 09-may-2004
|
3 |
*
|
4 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es>
|
5 |
*/
|
6 |
package org.cresques.px.dxf; |
7 |
|
8 |
import java.awt.Graphics2D; |
9 |
import java.awt.geom.Point2D; |
10 |
|
11 |
import org.cresques.cts.ICoordTrans; |
12 |
import org.cresques.cts.IProjection; |
13 |
import org.cresques.geo.ViewPortData; |
14 |
import org.cresques.px.Extent; |
15 |
|
16 |
/**
|
17 |
* Entidad TEXT de AutoCAD
|
18 |
*
|
19 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es>* @author administrador
|
20 |
*/
|
21 |
public class DxfPoint extends DxfEntity { |
22 |
|
23 |
Point2D pt;
|
24 |
|
25 |
public DxfPoint(IProjection proj, DxfLayer layer) {
|
26 |
super(proj, layer);
|
27 |
extent = new Extent();
|
28 |
pt = new Point2D.Double(); |
29 |
} |
30 |
|
31 |
public void setPt(Point2D pt) { |
32 |
this.pt = pt;
|
33 |
extent.add(pt); |
34 |
} |
35 |
|
36 |
public void reProject(ICoordTrans rp) { |
37 |
Point2D savePt = pt;
|
38 |
|
39 |
pt = new Point2D.Double(); |
40 |
extent = new Extent();
|
41 |
Point2D ptDest = null; |
42 |
ptDest = rp.getPDest().createPoint(0.0,0.0); |
43 |
if (savePt == null) |
44 |
ptDest = null;
|
45 |
else {
|
46 |
ptDest = rp.convert((Point2D) savePt, ptDest);
|
47 |
extent.add(ptDest); |
48 |
} |
49 |
pt = ptDest; |
50 |
setProjection(rp.getPDest()); |
51 |
} |
52 |
|
53 |
public void draw(Graphics2D g, ViewPortData vp) { |
54 |
//AffineTransform msave=g.getTransform();
|
55 |
//g.setTransform(vp.mat);
|
56 |
if (dxfColor == AcadColor.BYLAYER)
|
57 |
g.setColor(layer.getColor()); |
58 |
else
|
59 |
g.setColor(AcadColor.getColor(dxfColor)); |
60 |
Point2D ptT = new Point2D.Double(0, 0); |
61 |
vp.mat.transform(ptT, ptT); |
62 |
ptT.setLocation(pt.getX(), pt.getY()); |
63 |
vp.mat.transform(ptT, ptT); |
64 |
g.drawLine((int) ptT.getX(), (int)ptT.getY(), (int) ptT.getX(), (int)ptT.getY()); |
65 |
//g.setTransform(msave);
|
66 |
} |
67 |
|
68 |
/* (non-Javadoc)
|
69 |
* @see org.cresques.px.dxf.DxfEntity#toDxfFileString()
|
70 |
*/
|
71 |
public String toDxfString() { |
72 |
// TODO Auto-generated method stub
|
73 |
return ""; |
74 |
} |
75 |
} |