svn-gvsig-desktop / branches / v02_desarrollo / libraries / libCq CMS for java.old / src / org / cresques / geo / cover / Hoja.java @ 1731
History | View | Annotate | Download (2.42 KB)
1 | 96 | luisw | package org.cresques.geo.cover; |
---|---|---|---|
2 | /*
|
||
3 | * Created on 16-abr-2004
|
||
4 | */
|
||
5 | 1731 | luisw | import java.awt.geom.Point2D; |
6 | import java.io.InputStream; |
||
7 | import java.io.OutputStream; |
||
8 | 96 | luisw | import java.util.Vector; |
9 | |||
10 | import org.cresques.cts.ICoordTrans; |
||
11 | import org.cresques.cts.IProjection; |
||
12 | import org.cresques.geo.Projected; |
||
13 | import org.cresques.px.Extent; |
||
14 | |||
15 | /**
|
||
16 | 210 | luisw | * @author Luis W. Sevilla <sevilla_lui@gva.es>
|
17 | 96 | luisw | */
|
18 | public class Hoja implements Projected { |
||
19 | IProjection proj; |
||
20 | String code = null; |
||
21 | String name = null; |
||
22 | Extent extent = null;
|
||
23 | Point2D tl, tr, bl, br;
|
||
24 | 210 | luisw | public Hoja(IProjection proj, String code, String name) { |
25 | 96 | luisw | this.proj = proj;
|
26 | this.code = code;
|
||
27 | this.name = name;
|
||
28 | tl = tr = bl = br = null;
|
||
29 | } |
||
30 | public Hoja(String cod, Point2D p1, Point2D p2, Point2D p3, Point2D p4, String name) { |
||
31 | code = cod; |
||
32 | tl = p1; tr = p2; bl = p3; br = p4; |
||
33 | if (name != null) this.name = name; |
||
34 | setExtent(); |
||
35 | } |
||
36 | public Hoja(String cod, Point2D [] pt, String name) { |
||
37 | code = cod; |
||
38 | tl = pt[0];
|
||
39 | tr = pt[1];
|
||
40 | br = pt[2];
|
||
41 | bl = pt[3];
|
||
42 | if (name != null) this.name = name; |
||
43 | setExtent(); |
||
44 | } |
||
45 | public Hoja(String cod, Vector pt, String name) { |
||
46 | code = cod; |
||
47 | tl = (Point2D) pt.get(0); |
||
48 | tr = (Point2D) pt.get(1); |
||
49 | br = (Point2D) pt.get(2); |
||
50 | bl = (Point2D) pt.get(3); |
||
51 | if (name != null) this.name = name; |
||
52 | setExtent(); |
||
53 | } |
||
54 | public Hoja(String cod, Hoja h, String name) { |
||
55 | code = cod; |
||
56 | tl = h.tl; |
||
57 | tr = h.tr; |
||
58 | br = h.br; |
||
59 | bl = h.bl; |
||
60 | if (name != null) this.name = name; |
||
61 | setExtent(); |
||
62 | } |
||
63 | |||
64 | public IProjection getProjection() { return proj; } |
||
65 | public void setProjection(IProjection p) { proj = p; } |
||
66 | public void reProject(ICoordTrans rp) { |
||
67 | // TODO metodo reProject pendiente de implementar
|
||
68 | } |
||
69 | |||
70 | public Point2D getTL() { return tl; } |
||
71 | public void setTL(Point2D pt) { tl = pt; extent.add(pt); } |
||
72 | public Point2D getTR() { return tr; } |
||
73 | public void setTR(Point2D pt) { tr = pt; extent.add(pt); } |
||
74 | public Point2D getBL() { return bl; } |
||
75 | public void setBL(Point2D pt) { bl = pt; extent.add(pt); } |
||
76 | public Point2D getBR() { return br; } |
||
77 | public void setBR(Point2D pt) { br = pt; extent.add(pt); } |
||
78 | |||
79 | public Extent getExtent() { return extent; } |
||
80 | private void setExtent() { |
||
81 | extent = new Extent(tl, br);
|
||
82 | extent.add(tr); |
||
83 | extent.add(bl); |
||
84 | } |
||
85 | |||
86 | public String getCode() { return code; } |
||
87 | public String getName() { return name; } |
||
88 | |||
89 | public Point2D[] getVertex() { |
||
90 | Point2D [] v = {tl, tr, br, bl}; |
||
91 | return v;
|
||
92 | } |
||
93 | 1731 | luisw | |
94 | public void toXml(OutputStream os) { |
||
95 | |||
96 | } |
||
97 | |||
98 | public void fromXml(InputStream is) { |
||
99 | |||
100 | } |
||
101 | 96 | luisw | } |
102 |