svn-gvsig-desktop / branches / CqCMSDvp / libraries / libCq CMS for java.old / src / org / cresques / geo / cover / Hoja.java @ 2312
History | View | Annotate | Download (3.26 KB)
1 |
/*
|
---|---|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications.
|
3 |
*
|
4 |
* Copyright (C) 2004-5.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
19 |
*
|
20 |
* For more information, contact:
|
21 |
*
|
22 |
* cresques@gmail.com
|
23 |
*/
|
24 |
package org.cresques.geo.cover; |
25 |
|
26 |
import java.awt.geom.Point2D; |
27 |
import java.io.InputStream; |
28 |
import java.io.OutputStream; |
29 |
import java.util.Vector; |
30 |
|
31 |
import org.cresques.cts.ICoordTrans; |
32 |
import org.cresques.cts.IProjection; |
33 |
import org.cresques.geo.Projected; |
34 |
import org.cresques.px.Extent; |
35 |
|
36 |
/**
|
37 |
* @author Luis W. Sevilla <sevilla_lui@gva.es>
|
38 |
*/
|
39 |
public class Hoja implements Projected { |
40 |
IProjection proj; |
41 |
String code = null; |
42 |
String name = null; |
43 |
Extent extent = null;
|
44 |
Point2D tl, tr, bl, br;
|
45 |
public Hoja(IProjection proj, String code, String name) { |
46 |
this.proj = proj;
|
47 |
this.code = code;
|
48 |
this.name = name;
|
49 |
tl = tr = bl = br = null;
|
50 |
} |
51 |
public Hoja(String cod, Point2D p1, Point2D p2, Point2D p3, Point2D p4, String name) { |
52 |
code = cod; |
53 |
tl = p1; tr = p2; bl = p3; br = p4; |
54 |
if (name != null) this.name = name; |
55 |
setExtent(); |
56 |
} |
57 |
public Hoja(String cod, Point2D [] pt, String name) { |
58 |
code = cod; |
59 |
tl = pt[0];
|
60 |
tr = pt[1];
|
61 |
br = pt[2];
|
62 |
bl = pt[3];
|
63 |
if (name != null) this.name = name; |
64 |
setExtent(); |
65 |
} |
66 |
public Hoja(String cod, Vector pt, String name) { |
67 |
code = cod; |
68 |
tl = (Point2D) pt.get(0); |
69 |
tr = (Point2D) pt.get(1); |
70 |
br = (Point2D) pt.get(2); |
71 |
bl = (Point2D) pt.get(3); |
72 |
if (name != null) this.name = name; |
73 |
setExtent(); |
74 |
} |
75 |
public Hoja(String cod, Hoja h, String name) { |
76 |
code = cod; |
77 |
tl = h.tl; |
78 |
tr = h.tr; |
79 |
br = h.br; |
80 |
bl = h.bl; |
81 |
if (name != null) this.name = name; |
82 |
setExtent(); |
83 |
} |
84 |
|
85 |
public IProjection getProjection() { return proj; } |
86 |
public void setProjection(IProjection p) { proj = p; } |
87 |
public void reProject(ICoordTrans rp) { |
88 |
// TODO metodo reProject pendiente de implementar
|
89 |
} |
90 |
|
91 |
public Point2D getTL() { return tl; } |
92 |
public void setTL(Point2D pt) { tl = pt; extent.add(pt); } |
93 |
public Point2D getTR() { return tr; } |
94 |
public void setTR(Point2D pt) { tr = pt; extent.add(pt); } |
95 |
public Point2D getBL() { return bl; } |
96 |
public void setBL(Point2D pt) { bl = pt; extent.add(pt); } |
97 |
public Point2D getBR() { return br; } |
98 |
public void setBR(Point2D pt) { br = pt; extent.add(pt); } |
99 |
|
100 |
public Extent getExtent() { return extent; } |
101 |
private void setExtent() { |
102 |
extent = new Extent(tl, br);
|
103 |
extent.add(tr); |
104 |
extent.add(bl); |
105 |
} |
106 |
|
107 |
public String getCode() { return code; } |
108 |
public String getName() { return name; } |
109 |
|
110 |
public Point2D[] getVertex() { |
111 |
Point2D [] v = {tl, tr, br, bl}; |
112 |
return v;
|
113 |
} |
114 |
|
115 |
public void toXml(OutputStream os) { |
116 |
|
117 |
} |
118 |
|
119 |
public void fromXml(InputStream is) { |
120 |
|
121 |
} |
122 |
} |
123 |
|
124 |
|