root / branches / v2_0_0_prep / extensions / extGPE-gvSIG / src / org / gvsig / fmap / dal / store / gpe / model / GPEBBox.java @ 27499
History | View | Annotate | Download (3.15 KB)
1 |
package org.gvsig.fmap.dal.store.gpe.model; |
---|---|
2 |
|
3 |
import java.awt.geom.Rectangle2D; |
4 |
import java.io.IOException; |
5 |
|
6 |
import org.gvsig.gpe.parser.ICoordinateIterator; |
7 |
|
8 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
9 |
*
|
10 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
11 |
*
|
12 |
* This program is free software; you can redistribute it and/or
|
13 |
* modify it under the terms of the GNU General Public License
|
14 |
* as published by the Free Software Foundation; either version 2
|
15 |
* of the License, or (at your option) any later version.
|
16 |
*
|
17 |
* This program is distributed in the hope that it will be useful,
|
18 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20 |
* GNU General Public License for more details.
|
21 |
*
|
22 |
* You should have received a copy of the GNU General Public License
|
23 |
* along with this program; if not, write to the Free Software
|
24 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
25 |
*
|
26 |
* For more information, contact:
|
27 |
*
|
28 |
* Generalitat Valenciana
|
29 |
* Conselleria d'Infraestructures i Transport
|
30 |
* Av. Blasco Ib??ez, 50
|
31 |
* 46010 VALENCIA
|
32 |
* SPAIN
|
33 |
*
|
34 |
* +34 963862235
|
35 |
* gvsig@gva.es
|
36 |
* www.gvsig.gva.es
|
37 |
*
|
38 |
* or
|
39 |
*
|
40 |
* IVER T.I. S.A
|
41 |
* Salamanca 50
|
42 |
* 46005 Valencia
|
43 |
* Spain
|
44 |
*
|
45 |
* +34 963163400
|
46 |
* dac@iver.es
|
47 |
*/
|
48 |
/* CVS MESSAGES:
|
49 |
*
|
50 |
* $Id$
|
51 |
* $Log$
|
52 |
*
|
53 |
*/
|
54 |
/**
|
55 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
56 |
*/
|
57 |
public class GPEBBox { |
58 |
private String id = null; |
59 |
private double[] x; |
60 |
private double[] y; |
61 |
private double[] z; |
62 |
private String srs; |
63 |
|
64 |
public GPEBBox(){
|
65 |
|
66 |
} |
67 |
|
68 |
public GPEBBox(String id, ICoordinateIterator coords, String srs) { |
69 |
super();
|
70 |
this.id = id;
|
71 |
double[] buffer = new double[coords.getDimension()]; |
72 |
this.x = new double[2]; |
73 |
this.y = new double[2]; |
74 |
this.z = new double[2]; |
75 |
try {
|
76 |
if (coords.hasNext()){
|
77 |
coords.next(buffer); |
78 |
x[0] = buffer[0]; |
79 |
y[0] = buffer[1]; |
80 |
if (buffer.length > 2){ |
81 |
z[0] = buffer[2]; |
82 |
} |
83 |
if (coords.hasNext()){
|
84 |
coords.next(buffer); |
85 |
x[1] = buffer[0]; |
86 |
y[1] = buffer[1]; |
87 |
if (buffer.length > 2){ |
88 |
z[1] = buffer[2]; |
89 |
} |
90 |
} |
91 |
} |
92 |
} catch (IOException e) { |
93 |
e.printStackTrace(); |
94 |
} |
95 |
this.srs = srs;
|
96 |
} |
97 |
|
98 |
/**
|
99 |
* @return a rectangle in 2D
|
100 |
*/
|
101 |
public Rectangle2D getBbox2D(){ |
102 |
return new Rectangle2D.Double(x[0],y[0],x[1],y[1]); |
103 |
} |
104 |
|
105 |
/**
|
106 |
* @return the id
|
107 |
*/
|
108 |
public String getId() { |
109 |
return id;
|
110 |
} |
111 |
|
112 |
/**
|
113 |
* @param id the id to set
|
114 |
*/
|
115 |
public void setId(String id) { |
116 |
this.id = id;
|
117 |
} |
118 |
|
119 |
/**
|
120 |
* @return the srs
|
121 |
*/
|
122 |
public String getSrs() { |
123 |
return srs;
|
124 |
} |
125 |
|
126 |
/**
|
127 |
* @param srs the srs to set
|
128 |
*/
|
129 |
public void setSrs(String srs) { |
130 |
this.srs = srs;
|
131 |
} |
132 |
|
133 |
/**
|
134 |
* @return the x
|
135 |
*/
|
136 |
public double[] getX() { |
137 |
return x;
|
138 |
} |
139 |
|
140 |
/**
|
141 |
* @param x the x to set
|
142 |
*/
|
143 |
public void setX(double[] x) { |
144 |
this.x = x;
|
145 |
} |
146 |
/**
|
147 |
* @return the y
|
148 |
*/
|
149 |
public double[] getY() { |
150 |
return y;
|
151 |
} |
152 |
|
153 |
/**
|
154 |
* @param y the y to set
|
155 |
*/
|
156 |
public void setY(double[] y) { |
157 |
this.y = y;
|
158 |
} |
159 |
|
160 |
/**
|
161 |
* @return the z
|
162 |
*/
|
163 |
public double[] getZ() { |
164 |
return z;
|
165 |
} |
166 |
|
167 |
/**
|
168 |
* @param z the z to set
|
169 |
*/
|
170 |
public void setZ(double[] z) { |
171 |
this.z = z;
|
172 |
} |
173 |
} |