Revision 9
trunk/libraries/libCq CMS for java.old/src/org/cresques/io/DxfFile.java | ||
---|---|---|
41 | 41 |
int count = 0; |
42 | 42 |
DxfGroup grp = null; |
43 | 43 |
|
44 |
DxfEntityMaker entityMaker = null;
|
|
44 |
EntityFactory entityMaker = null;
|
|
45 | 45 |
|
46 |
public DxfFile(Projection proj, String name, DxfEntityMaker maker) { |
|
46 |
public interface EntityFactory { |
|
47 |
public void createLayer(DxfGroupVector v) throws Exception ; |
|
48 |
public void createPolyline(DxfGroupVector v) throws Exception ; |
|
49 |
public void addVertex(DxfGroupVector v) throws Exception ; |
|
50 |
public void endSeq() throws Exception ; |
|
51 |
public void createLwPolyline(DxfGroupVector v) throws Exception ; |
|
52 |
public void createLine(DxfGroupVector v) throws Exception ; |
|
53 |
public void createText(DxfGroupVector v) throws Exception ; |
|
54 |
public void createSolid(DxfGroupVector v) throws Exception ; |
|
55 |
public void reProject(ReProjection rp); |
|
56 |
}; |
|
57 |
|
|
58 |
public DxfFile(Projection proj, String name, EntityFactory maker) { |
|
47 | 59 |
super(proj); |
48 | 60 |
this.name = name; |
49 | 61 |
entityMaker = maker; |
trunk/libraries/libCq CMS for java.old/src/org/cresques/io/ShpFileHeader.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 14-may-2004 |
|
3 |
* |
|
4 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es> |
|
5 |
*/ |
|
6 |
package org.cresques.io; |
|
7 |
|
|
8 |
|
|
9 |
/* |
|
10 |
* GISToolkit - Geographical Information System Toolkit |
|
11 |
* (C) 2002, Ithaqua Enterprises Inc. |
|
12 |
* |
|
13 |
* This library is free software; you can redistribute it and/or |
|
14 |
* modify it under the terms of the GNU Lesser General Public |
|
15 |
* License as published by the Free Software Foundation; |
|
16 |
* version 2.1 of the License. |
|
17 |
* |
|
18 |
* This library is distributed in the hope that it will be useful, |
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
21 |
* Lesser General Public License for more details. |
|
22 |
* |
|
23 |
* You should have received a copy of the GNU Lesser General Public |
|
24 |
* License along with this library; if not, write to the Free Software |
|
25 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
26 |
* |
|
27 |
*/ |
|
28 |
import java.nio.*; |
|
29 |
|
|
30 |
/** |
|
31 |
* Procesa la cabecera de un .shp |
|
32 |
* |
|
33 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es>* @author administrador |
|
34 |
*/ |
|
35 |
public class ShpFileHeader { |
|
36 |
|
|
37 |
//} |
|
38 |
/** |
|
39 |
* Class to represent the header in the shape file. |
|
40 |
*/ |
|
41 |
//public class ShapeFileHeader { |
|
42 |
/** |
|
43 |
* Shape Type |
|
44 |
* Value Shape Type |
|
45 |
* 0 Null Shape |
|
46 |
* 1 Point |
|
47 |
* 3 PolyLine |
|
48 |
* 5 Polygon |
|
49 |
* 8 MultiPoint |
|
50 |
* 11 PointZ |
|
51 |
* 13 PolyLineZ |
|
52 |
* 15 PolygonZ |
|
53 |
* 18 MultiPointZ |
|
54 |
* 21 PointM |
|
55 |
* 23 PolyLineM |
|
56 |
* 25 PolygonM |
|
57 |
* 28 MultiPointM |
|
58 |
* 31 MultiPatch |
|
59 |
*/ |
|
60 |
|
|
61 |
/* The null shape type, there is no shape for this record. */ |
|
62 |
public static final int SHAPE_NULL = 0; |
|
63 |
public static final int SHAPE_POINT = 1; |
|
64 |
public static final int SHAPE_POLYLINE = 3; |
|
65 |
public static final int SHAPE_POLYGON = 5; |
|
66 |
public static final int SHAPE_MULTIPOINT = 8; |
|
67 |
public static final int SHAPE_POINTZ = 11; |
|
68 |
public static final int SHAPE_POLYLINEZ = 13; |
|
69 |
public static final int SHAPE_POLYGONZ = 15; |
|
70 |
public static final int SHAPE_MULTIPOINTZ = 18; |
|
71 |
public static final int SHAPE_POINTM = 21; |
|
72 |
public static final int SHAPE_POLYLINEM = 23; |
|
73 |
public static final int SHAPE_POLYGONM = 25; |
|
74 |
public static final int SHAPE_MULTIPOINTM = 28; |
|
75 |
public static final int SHAPE_MULTIPATCH = 31; |
|
76 |
|
|
77 |
/**File Code, must be the value 9994*/ |
|
78 |
int myFileCode = 9994; |
|
79 |
|
|
80 |
/** |
|
81 |
* Unused 1; |
|
82 |
*/ |
|
83 |
int myUnused1 = 0; |
|
84 |
|
|
85 |
/** |
|
86 |
* Unused 2; |
|
87 |
*/ |
|
88 |
int myUnused2 = 0; |
|
89 |
|
|
90 |
/** |
|
91 |
* Unused 3; |
|
92 |
*/ |
|
93 |
int myUnused3 = 0; |
|
94 |
|
|
95 |
/** |
|
96 |
* Unused 4; |
|
97 |
*/ |
|
98 |
int myUnused4 = 0; |
|
99 |
|
|
100 |
/** |
|
101 |
* Unused 5; |
|
102 |
*/ |
|
103 |
int myUnused5 = 0; |
|
104 |
|
|
105 |
/**File Length;*/ |
|
106 |
int myFileLength = 0; |
|
107 |
|
|
108 |
/**Version of the file.*/ |
|
109 |
int myVersion = 1000; |
|
110 |
int myShapeType = 0; |
|
111 |
|
|
112 |
/** |
|
113 |
* BoundingBox Xmin |
|
114 |
*/ |
|
115 |
double myXmin = 0; |
|
116 |
|
|
117 |
/** |
|
118 |
* BoundingBox Ymin |
|
119 |
*/ |
|
120 |
double myYmin = 0; |
|
121 |
|
|
122 |
/** |
|
123 |
* BoundingBox Xmax |
|
124 |
*/ |
|
125 |
double myXmax = 0; |
|
126 |
|
|
127 |
/** |
|
128 |
* BoundingBox Ymax |
|
129 |
*/ |
|
130 |
double myYmax = 0; |
|
131 |
|
|
132 |
/** |
|
133 |
* BoundingBox Zmin |
|
134 |
*/ |
|
135 |
double myZmin = 0; |
|
136 |
|
|
137 |
/** |
|
138 |
* BoundingBox Zmax |
|
139 |
*/ |
|
140 |
double myZmax = 0; |
|
141 |
|
|
142 |
/** |
|
143 |
* BoundingBox Zmin |
|
144 |
*/ |
|
145 |
double myMmin = 0; |
|
146 |
|
|
147 |
/** |
|
148 |
* BoundingBox Zmax |
|
149 |
*/ |
|
150 |
double myMmax = 0; |
|
151 |
|
|
152 |
// notify about warnings. |
|
153 |
private boolean myWarning = true; |
|
154 |
|
|
155 |
/** |
|
156 |
* ShapeFileHeader constructor comment. |
|
157 |
*/ |
|
158 |
public ShpFileHeader() { |
|
159 |
super(); |
|
160 |
} |
|
161 |
|
|
162 |
/** Return the file code. */ |
|
163 |
public int getFileCode() { |
|
164 |
return myFileCode; |
|
165 |
} |
|
166 |
|
|
167 |
/** Return the version of the file. */ |
|
168 |
public int getVersion() { |
|
169 |
return myVersion; |
|
170 |
} |
|
171 |
|
|
172 |
/** Get the extents of the shape file. */ |
|
173 |
public java.awt.geom.Rectangle2D.Double getFileExtents() { |
|
174 |
return new java.awt.geom.Rectangle2D.Double(myXmin, myYmin, |
|
175 |
myXmax - myXmin, myYmax - myYmin); |
|
176 |
} |
|
177 |
|
|
178 |
/** Print warnings to system.out. */ |
|
179 |
public void setWarnings(boolean inWarning) { |
|
180 |
myWarning = inWarning; |
|
181 |
} |
|
182 |
|
|
183 |
/** |
|
184 |
* Return the length of the header in 16 bit words.. |
|
185 |
*/ |
|
186 |
public int getHeaderLength() { |
|
187 |
return 50; |
|
188 |
} |
|
189 |
|
|
190 |
/** |
|
191 |
* Return the number of 16 bit words in the shape file as recorded in the header |
|
192 |
*/ |
|
193 |
public int getFileLength() { |
|
194 |
return myFileLength; |
|
195 |
} |
|
196 |
|
|
197 |
/** |
|
198 |
* Read the header from the shape file. |
|
199 |
*/ |
|
200 |
public void readHeader(ByteBuffer in) { |
|
201 |
// the first four bytes are integers |
|
202 |
// in.setLittleEndianMode(false); |
|
203 |
in.order(ByteOrder.BIG_ENDIAN); |
|
204 |
myFileCode = in.getInt(); |
|
205 |
|
|
206 |
if (myFileCode != 9994) { |
|
207 |
warn("File Code = " + myFileCode + " Not equal to 9994"); |
|
208 |
} |
|
209 |
|
|
210 |
// From 4 to 8 are unused. |
|
211 |
myUnused1 = in.getInt(); |
|
212 |
|
|
213 |
// From 8 to 12 are unused. |
|
214 |
myUnused2 = in.getInt(); |
|
215 |
|
|
216 |
// From 12 to 16 are unused. |
|
217 |
myUnused3 = in.getInt(); |
|
218 |
|
|
219 |
// From 16 to 20 are unused. |
|
220 |
myUnused4 = in.getInt(); |
|
221 |
|
|
222 |
// From 20 to 24 are unused. |
|
223 |
myUnused5 = in.getInt(); |
|
224 |
|
|
225 |
// From 24 to 28 are the file length. |
|
226 |
myFileLength = in.getInt(); |
|
227 |
|
|
228 |
// From 28 to 32 are the File Version. |
|
229 |
in.order(ByteOrder.LITTLE_ENDIAN); |
|
230 |
myVersion = in.getInt(); |
|
231 |
|
|
232 |
// From 32 to 36 are the Shape Type. |
|
233 |
myShapeType = in.getInt(); |
|
234 |
|
|
235 |
// From 36 to 44 are Xmin. |
|
236 |
myXmin = in.getDouble(); // Double.longBitsToDouble(in.getLong()); |
|
237 |
|
|
238 |
// From 44 to 52 are Ymin. |
|
239 |
myYmin = in.getDouble(); |
|
240 |
|
|
241 |
// From 52 to 60 are Xmax. |
|
242 |
myXmax = in.getDouble(); |
|
243 |
|
|
244 |
// From 60 to 68 are Ymax. |
|
245 |
myYmax = in.getDouble(); |
|
246 |
|
|
247 |
// From 68 to 76 are Zmin. |
|
248 |
myZmin = in.getDouble(); |
|
249 |
|
|
250 |
// From 76 to 84 are Zmax. |
|
251 |
myZmax = in.getDouble(); |
|
252 |
|
|
253 |
// From 84 to 92 are Mmin. |
|
254 |
myMmin = in.getDouble(); |
|
255 |
|
|
256 |
// From 92 to 100 are Mmax. |
|
257 |
myMmax = in.getDouble(); |
|
258 |
|
|
259 |
// that is all 100 bytes of the header. |
|
260 |
} |
|
261 |
|
|
262 |
private void warn(String inWarn) { |
|
263 |
if (myWarning) { |
|
264 |
System.out.print("WARNING: "); |
|
265 |
System.out.println(inWarn); |
|
266 |
} |
|
267 |
} |
|
268 |
} |
|
0 | 269 |
trunk/libraries/libCq CMS for java.old/src/org/cresques/io/MdtFile.java | ||
---|---|---|
26 | 26 |
import org.cresques.geo.ReProjection; |
27 | 27 |
import org.cresques.px.Extent; |
28 | 28 |
|
29 |
class CoordList extends Vector { |
|
30 |
|
|
31 |
} |
|
32 |
|
|
29 | 33 |
/** |
30 | 34 |
* Soporte para modelos digitales de terreno. |
31 | 35 |
* |
... | ... | |
49 | 53 |
Extent v = null; |
50 | 54 |
|
51 | 55 |
Projection projGeo = null; |
56 |
private Date reloj = new Date(); |
|
52 | 57 |
|
53 | 58 |
/** |
54 | 59 |
* Constructor de la clase MdtFile |
... | ... | |
77 | 82 |
fileSize = ze.getSize(); |
78 | 83 |
|
79 | 84 |
// El primero calcula el tama?o, el segundo la imagen |
80 |
t1 = (new Date()).getTime();
|
|
81 |
load(new InputStreamReader(zFolder.getInputStream(ze))); |
|
82 |
t2 = (new Date()).getTime();
|
|
85 |
t1 = getTime(); |
|
86 |
load2(new InputStreamReader(zFolder.getInputStream(ze)));
|
|
87 |
t2 = getTime(); |
|
83 | 88 |
System.out.println("MDT: primer load: " + (t2-t1)/1000 + " seg."); |
84 |
t1 = (new Date()).getTime();
|
|
85 |
load(new InputStreamReader(zFolder.getInputStream(ze))); |
|
86 |
t2 = (new Date()).getTime();
|
|
89 |
t1 = getTime(); |
|
90 |
load2(new InputStreamReader(zFolder.getInputStream(ze)));
|
|
91 |
t2 = getTime(); |
|
87 | 92 |
System.out.println("MDT: segundo load: " + (t2-t1)/1000 + " seg."); |
88 | 93 |
} else { |
89 | 94 |
File f = new File(name); |
90 | 95 |
fileSize = f.length(); |
91 | 96 |
|
92 | 97 |
// El primero calcula el tama?o, el segundo la imagen |
93 |
t1 = (new Date()).getTime();
|
|
94 |
load(new FileReader(name)); |
|
95 |
t2 = (new Date()).getTime();
|
|
98 |
t1 = getTime(); |
|
99 |
load2(new FileReader(name));
|
|
100 |
t2 = getTime(); |
|
96 | 101 |
System.out.println("MDT: primer load: " + (t2-t1)/1000 + " seg."); |
97 |
t1 = (new Date()).getTime();
|
|
98 |
load(new FileReader(name)); |
|
99 |
t2 = (new Date()).getTime();
|
|
102 |
t1 = getTime(); |
|
103 |
load2(new FileReader(name));
|
|
104 |
t2 = getTime(); |
|
100 | 105 |
System.out.println("MDT: segundo load: " + (t2-t1)/1000 + " seg."); |
101 | 106 |
} |
102 | 107 |
v = new Extent(extent); |
103 | 108 |
return this; |
104 | 109 |
} catch (Exception e) { |
105 |
System.err.println("MDT: ERROR ."+lineCnt+" lineas leidas ("+bytesReaded+"/"+fileSize+") bytes.");
|
|
110 |
System.err.println("MDT: ERROR: "+lineCnt+" lineas leidas ("+bytesReaded+"/"+fileSize+") bytes.");
|
|
106 | 111 |
if (e instanceof java.lang.ArrayIndexOutOfBoundsException) |
107 | 112 |
System.err.println(" row = "+rowAct+", col ="+colAct); |
108 | 113 |
e.printStackTrace(); |
... | ... | |
111 | 116 |
} |
112 | 117 |
|
113 | 118 |
// |
114 |
// /
|
|
115 |
// // Carga antigua. TODO Mejorarla
|
|
116 |
// /
|
|
119 |
/// |
|
120 |
//// Carga antigua. TODO Mejorarla |
|
121 |
/// |
|
117 | 122 |
// |
118 | 123 |
|
119 |
public GeoFile load(Reader fr) throws IOException {
|
|
120 |
lineCnt = 0;
|
|
121 |
if (im == null){
|
|
122 |
System.out.println("MDT: Cargando "+name+" ...");
|
|
123 |
} else
|
|
124 |
System.out.println("MDT: generando imagen ...");
|
|
125 |
fi = new BufferedReader(fr);
|
|
126 |
while ((buf = fi.readLine()) != null) {
|
|
124 |
public GeoFile load(Reader fr) throws IOException { |
|
125 |
lineCnt = 0; |
|
126 |
if (im == null){ |
|
127 |
System.out.println("MDT: Cargando "+name+" ..."); |
|
128 |
} else |
|
129 |
System.out.println("MDT: generando imagen ..."); |
|
130 |
fi = new BufferedReader(fr); |
|
131 |
while ((buf = fi.readLine()) != null) { |
|
127 | 132 |
bytesReaded += buf.length()+1; |
128 | 133 |
parseLine(buf); |
129 | 134 |
lineCnt++; |
130 |
}
|
|
131 |
fi.close();
|
|
132 |
if (im == null) {
|
|
135 |
} |
|
136 |
fi.close(); |
|
137 |
if (im == null) { |
|
133 | 138 |
width = (int) numPt/height; |
134 | 139 |
System.out.println("MDT: '"+name+"' cargado. ("+lineCnt+" l?neas)."); |
135 | 140 |
System.out.println("MDT: Puntos="+numPt+ |
... | ... | |
146 | 151 |
if (paleta == null) |
147 | 152 |
paleta = (new MdtPalette()).createGrayScale((int)minZ, (int) maxZ); |
148 | 153 |
} |
149 |
return this;
|
|
150 |
}
|
|
154 |
return this; |
|
155 |
} |
|
151 | 156 |
|
152 |
public void parseLine(String buf) {
|
|
157 |
public void parseLine(String buf) { |
|
153 | 158 |
// 359.5166 40.0039 787.00 |
154 | 159 |
Point2D pt = null; |
155 | 160 |
GeoPoint gPt = null; |
... | ... | |
187 | 192 |
set(lng, lat, z); |
188 | 193 |
} |
189 | 194 |
} |
190 |
}
|
|
195 |
} |
|
191 | 196 |
|
192 |
public void createImage() {
|
|
197 |
public void createImage() { |
|
193 | 198 |
distX = (extent.width()/(height-1)); distY = (extent.height()/(width-1)); |
194 | 199 |
System.out.println("MDT: extent.size=("+extent.width()+","+extent.height()+")"); |
195 | 200 |
im = new BufferedImage(height, width, BufferedImage.TYPE_3BYTE_BGR); |
196 |
}
|
|
201 |
} |
|
197 | 202 |
|
198 | 203 |
// |
199 | 204 |
/// |
... | ... | |
252 | 257 |
|
253 | 258 |
public void parseLine2(String buf) { |
254 | 259 |
// 359.5166 40.0039 787.00 |
260 |
Point2D pt = null; |
|
261 |
GeoPoint gPt = null; |
|
255 | 262 |
buf = filterWS(buf); |
256 | 263 |
if (buf.length() > 4) { |
257 | 264 |
String [] datos = buf.split(" "); |
... | ... | |
291 | 298 |
} |
292 | 299 |
lastLat = lat; lastLong = lng; |
293 | 300 |
numPt ++; |
294 |
Point2D pt = new Point2D.Double(lng, lat); |
|
301 |
//Point2D pt = new Point2D.Double(lng, lat); |
|
302 |
if (projGeo == null) { |
|
303 |
pt = proj.createPoint(lng, lat); |
|
304 |
} else { |
|
305 |
gPt = (GeoPoint) projGeo.createPoint(lng, lat); |
|
306 |
pt = (ProjPoint) proj.createPoint(0.0, 0.0); |
|
307 |
pt = proj.fromGeo(gPt, (ProjPoint) proj.createPoint(0.0, 0.0)); |
|
308 |
} |
|
295 | 309 |
extent.add(pt); |
296 | 310 |
minZ = Math.min(minZ, z); |
297 | 311 |
maxZ = Math.max(maxZ, z); |
298 | 312 |
//System.out.println(buf+" "+pt); |
299 |
} else |
|
313 |
} else { |
|
314 |
if (projGeo != null) { |
|
315 |
gPt = (GeoPoint) projGeo.createPoint(lng, lat); |
|
316 |
pt = (ProjPoint) proj.createPoint(0.0, 0.0); |
|
317 |
pt = proj.fromGeo(gPt, (ProjPoint) proj.createPoint(0.0, 0.0)); |
|
318 |
lng = pt.getX(); lat = pt.getY(); |
|
319 |
} |
|
300 | 320 |
set(lng, lat, z); |
321 |
} |
|
301 | 322 |
} |
302 | 323 |
} |
303 | 324 |
public void createImage2() { |
... | ... | |
312 | 333 |
} |
313 | 334 |
} |
314 | 335 |
|
336 |
private double getZ(double lng, double lat) { |
|
337 |
double z = 0.0; |
|
338 |
return z; |
|
339 |
} |
|
340 |
|
|
341 |
// |
|
342 |
/// |
|
343 |
//// Continua ... |
|
344 |
/// |
|
345 |
// |
|
315 | 346 |
|
316 | 347 |
private void set(double lng, double lat, double z) { |
317 | 348 |
new Color(0,0,0); |
trunk/libraries/libCq CMS for java.old/src/org/cresques/io/GeoFile.java | ||
---|---|---|
5 | 5 |
*/ |
6 | 6 |
package org.cresques.io; |
7 | 7 |
|
8 |
import java.util.Date; |
|
9 |
|
|
8 | 10 |
import org.cresques.geo.Projected; |
9 | 11 |
import org.cresques.geo.Projection; |
10 | 12 |
import org.cresques.geo.ReProjection; |
... | ... | |
59 | 61 |
} |
60 | 62 |
return str; |
61 | 63 |
} |
64 |
|
|
65 |
protected long getTime() { |
|
66 |
return (new Date()).getTime(); |
|
67 |
} |
|
62 | 68 |
} |
trunk/libraries/libCq CMS for java.old/src/org/cresques/io/ShpFile.java | ||
---|---|---|
6 | 6 |
|
7 | 7 |
package org.cresques.io; |
8 | 8 |
|
9 |
import java.io.FileInputStream; |
|
9 | 10 |
import java.io.FileNotFoundException; |
10 | 11 |
import java.io.FileReader; |
11 | 12 |
import java.io.IOException; |
12 | 13 |
import java.io.InputStream; |
13 | 14 |
import java.io.InputStreamReader; |
14 | 15 |
import java.io.Reader; |
16 |
import java.nio.MappedByteBuffer; |
|
17 |
import java.nio.channels.FileChannel; |
|
15 | 18 |
|
16 | 19 |
import org.cresques.geo.Projection; |
17 | 20 |
import org.cresques.geo.ReProjection; |
18 | 21 |
import org.cresques.px.gml.*; |
19 | 22 |
|
20 |
import com.iver.coput.ShapeFileHeader; |
|
21 |
|
|
22 | 23 |
/** |
23 | 24 |
* Clase de soporte para ficheros .shp de ArcView |
24 | 25 |
* |
... | ... | |
52 | 53 |
try { |
53 | 54 |
if (FileFolder.isUrl(name)) { |
54 | 55 |
ZipFileFolder zFolder = new ZipFileFolder(name); |
55 |
InputStream is = zFolder.getInputStream(name); |
|
56 |
return load(new InputStreamReader(is)); |
|
56 |
return load(zFolder.getInputStream(name)); |
|
57 | 57 |
} else |
58 |
return load(new FileReader(name));
|
|
58 |
return load(new FileInputStream(name));
|
|
59 | 59 |
} catch (FileNotFoundException e) { |
60 | 60 |
e.printStackTrace(); |
61 | 61 |
} catch (IOException ie) { |
... | ... | |
65 | 65 |
return this; |
66 | 66 |
} |
67 | 67 |
|
68 |
public GeoFile load(Reader fr) { |
|
68 |
public int openLayer() { |
|
69 |
try { |
|
70 |
FileInputStream fin = new FileInputStream(m_Path); |
|
71 |
// Open the file and then get a channel from the stream |
|
72 |
FileChannel fc = fin.getChannel(); |
|
73 |
long sz = fc.size(); |
|
74 |
// Get the file's size and then map it into memory |
|
75 |
MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz); |
|
76 |
} |
|
77 |
catch(Exception e) |
|
78 |
{ |
|
79 |
System.err.notify(); |
|
80 |
} |
|
81 |
return 0; |
|
82 |
} |
|
83 |
public GeoFile load(InputStream is) { |
|
69 | 84 |
// create a new header. |
70 |
ShapeFileHeader myHeader = new ShapeFileHeader();
|
|
85 |
ShpFileHeader myHeader = new ShpFileHeader();
|
|
71 | 86 |
|
72 | 87 |
// read the header |
73 | 88 |
myHeader.readHeader(fr); |
trunk/libraries/libCq CMS for java.old/src/org/cresques/io/EcwFile.java | ||
---|---|---|
84 | 84 |
|
85 | 85 |
public EcwFile(String fname) { |
86 | 86 |
super(null); // TODO aqui van las proyecciones |
87 |
fname = DataSource.normalize(fname); |
|
87 | 88 |
extent = new Extent(); |
88 | 89 |
try { |
89 | 90 |
System.err.println("Abriendo "+fname); |
trunk/libraries/libCq CMS for java.old/src/org/cresques/px/dxf/DxfEntityMaker.java | ||
---|---|---|
9 | 9 |
import org.cresques.geo.Projected; |
10 | 10 |
import org.cresques.geo.Projection; |
11 | 11 |
import org.cresques.geo.ReProjection; |
12 |
import org.cresques.io.DxfFile; |
|
12 | 13 |
import org.cresques.io.DxfGroup; |
13 | 14 |
import org.cresques.io.DxfGroupVector; |
14 | 15 |
import org.cresques.px.PxObj; |
... | ... | |
19 | 20 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es> |
20 | 21 |
*/ |
21 | 22 |
|
22 |
public class DxfEntityMaker implements Projected { |
|
23 |
public class DxfEntityMaker implements DxfFile.EntityFactory, Projected {
|
|
23 | 24 |
Projection proj = null; |
24 | 25 |
DxfEntity lastEntity = null; |
25 | 26 |
DxfEntityList entities = null; |
trunk/libraries/libCq CMS for java.old/src/org/cresques/px/Extent.java | ||
---|---|---|
1 | 1 |
package org.cresques.px; |
2 | 2 |
|
3 |
import java.lang.Math; |
|
4 | 3 |
import java.awt.geom.Point2D; |
4 |
import java.awt.geom.Rectangle2D; |
|
5 | 5 |
|
6 | 6 |
import java.text.DecimalFormat; |
7 | 7 |
|
... | ... | |
77 | 77 |
scale[1] = ((float) height)/height(); |
78 | 78 |
return scale; |
79 | 79 |
} |
80 |
|
|
81 |
public Rectangle2D toRectangle2D() { |
|
82 |
return new Rectangle2D.Double(minX(), maxY(), width(), height()); |
|
83 |
} |
|
80 | 84 |
public String toString() { |
81 | 85 |
DecimalFormat format = new DecimalFormat("####.000"); |
82 | 86 |
|
trunk/libraries/libCq CMS for java.old/src/org/cresques/px/PxRaster.java | ||
---|---|---|
3 | 3 |
*/ |
4 | 4 |
package org.cresques.px; |
5 | 5 |
|
6 |
import java.awt.geom.AffineTransform; |
|
7 | 6 |
import java.awt.geom.Point2D; |
8 | 7 |
|
9 | 8 |
import java.awt.Color; |
... | ... | |
99 | 98 |
* @param sz |
100 | 99 |
*/ |
101 | 100 |
|
102 |
void calculateNewView(AffineTransform mat, Extent sz) {
|
|
101 |
void calculateNewView(Extent sz) { |
|
103 | 102 |
double vx = sz.minX(), vy = sz.minY(), vx2 = sz.maxX(), vy2 = sz.maxY(); |
104 | 103 |
if (sz.minX() < extent.minX()) vx = extent.minX(); |
105 | 104 |
if (sz.minY() < extent.minY()) vy = extent.minY(); |
... | ... | |
117 | 116 |
if (vp.getExtent().minY()> extent.maxY()) return; |
118 | 117 |
if (vp.getExtent().maxX()< extent.minX()) return; |
119 | 118 |
if (vp.getExtent().maxY()< extent.minY()) return; |
120 |
calculateNewView(vp.mat, vp.getExtent());
|
|
119 |
calculateNewView(vp.getExtent()); |
|
121 | 120 |
Extent v = geoFile.getView(); |
122 | 121 |
double x = v.minX(); |
123 | 122 |
double y = v.minY(); |
trunk/libraries/libCq CMS for java.old/src/org/cresques/geo/UtmZone.java | ||
---|---|---|
1 | 1 |
package org.cresques.geo; |
2 | 2 |
|
3 |
import java.awt.Color; |
|
4 | 3 |
import java.awt.Graphics2D; |
5 | 4 |
import java.awt.geom.AffineTransform; |
6 | 5 |
import java.awt.geom.Point2D; |
trunk/libraries/libCq CMS for java.old/src/org/cresques/geo/Mercator.java | ||
---|---|---|
5 | 5 |
*/ |
6 | 6 |
package org.cresques.geo; |
7 | 7 |
|
8 |
import java.awt.Color; |
|
9 | 8 |
import java.awt.FontMetrics; |
10 | 9 |
import java.awt.Graphics2D; |
11 | 10 |
import java.awt.geom.AffineTransform; |
trunk/libraries/libCq CMS for java.old/src/org/cresques/geo/Geodetic.java | ||
---|---|---|
1 | 1 |
package org.cresques.geo; |
2 | 2 |
|
3 |
import java.awt.Color; |
|
4 | 3 |
import java.awt.FontMetrics; |
5 | 4 |
import java.awt.Graphics2D; |
6 | 5 |
import java.awt.geom.AffineTransform; |
Also available in: Unified diff