Revision 10645
branches/v10/libraries/libCq_CMS_praster/.cvsignore | ||
---|---|---|
1 |
doc-files |
|
2 |
cms.jar |
|
3 |
Thumbs.db |
|
4 |
bin |
branches/v10/libraries/libCq_CMS_praster/build.xml | ||
---|---|---|
9 | 9 |
<property name="dist" location="dist"/> |
10 | 10 |
<property name="jar" value="cms"/> |
11 | 11 |
<property name="targetDir" location="../libFMap/lib"/> |
12 |
<property name="extPiloto" location="../extgvSIGPiloto-Raster/lib"/> |
|
12 | 13 |
<property name="compile-classpath" value="${lib}/geoapi-2.0.jar:${lib}/geojava.jar:${lib}/geotiff-jai.jar:${lib}/gt2-legacy.jar:${lib}/gt2-main.jar:${lib}/jecw-0.0.1.jar:${lib}/jecwcompress-0.1.0.jar:${lib}/jgdal-0.1.0.jar:${lib}/jmgeoraster.jar:${lib}/jmrsid-0.0.2.jar:${lib}/jogr.jar:${lib}/kxml2.jar:${lib}/tar.jar" /> |
13 | 14 |
|
14 | 15 |
<target name="init"> |
... | ... | |
29 | 30 |
<copy todir="${dist}"> |
30 | 31 |
<fileset dir="./lib" includes="*.jar"/> |
31 | 32 |
</copy> |
32 |
<!--<copy todir="${targetDir1}/"> |
|
33 |
<fileset dir="${dist}" includes="**/**"/> |
|
34 |
</copy> |
|
35 |
<copy todir="${targetDir2}/"> |
|
36 |
<fileset dir="${dist}" includes="${jar}.jar"/> |
|
37 |
</copy> --> |
|
33 |
<copy todir="${extPiloto}" overwrite="yes"> |
|
34 |
<fileset dir="${dist}" includes="${jar}.jar" /> |
|
35 |
</copy> |
|
38 | 36 |
<move todir="${targetDir}/"> |
39 | 37 |
<fileset dir="${dist}" includes="**/**"/> |
40 | 38 |
</move> |
... | ... | |
60 | 58 |
<copy todir="."> |
61 | 59 |
<fileset dir="${dist}" includes="${jar}.jar"/> |
62 | 60 |
</copy> |
61 |
<copy todir="${extPiloto}" overwrite="yes"> |
|
62 |
<fileset dir="${dist}" includes="${jar}.jar" /> |
|
63 |
</copy> |
|
63 | 64 |
<move todir="${targetDir}/"> |
64 | 65 |
<fileset dir="${dist}" includes="**/**"/> |
65 | 66 |
</move> |
branches/v10/libraries/libCq_CMS_praster/src-test/org/cresques/io/data/TestWriterBuffer.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 9-ago-2006 |
|
3 |
* |
|
4 |
* To change the template for this generated file go to |
|
5 |
* Window>Preferences>Java>Code Generation>Code and Comments |
|
6 |
*/ |
|
7 |
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana |
|
8 |
* |
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
10 |
* |
|
11 |
* This program is free software; you can redistribute it and/or |
|
12 |
* modify it under the terms of the GNU General Public License |
|
13 |
* as published by the Free Software Foundation; either version 2 |
|
14 |
* of the License, or (at your option) any later version. |
|
15 |
* |
|
16 |
* This program is distributed in the hope that it will be useful, |
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 |
* GNU General Public License for more details. |
|
20 |
* |
|
21 |
* You should have received a copy of the GNU General Public License |
|
22 |
* along with this program; if not, write to the Free Software |
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
24 |
*/ |
|
25 |
package org.cresques.io.data; |
|
26 |
|
|
27 |
import java.io.IOException; |
|
28 |
|
|
29 |
import junit.framework.TestCase; |
|
30 |
|
|
31 |
import org.cresques.io.GdalWriter; |
|
32 |
import org.cresques.io.GeoRasterFile; |
|
33 |
import org.cresques.io.GeoRasterWriter; |
|
34 |
import org.cresques.io.IDataWriter; |
|
35 |
import org.cresques.px.Extent; |
|
36 |
|
|
37 |
/** |
|
38 |
* Este test prueba el acceso a datos a traves de un grid |
|
39 |
* @author Nacho Brodin (brodin_ign@gva.es) |
|
40 |
* |
|
41 |
*/ |
|
42 |
public class TestWriterBuffer extends TestCase{ |
|
43 |
|
|
44 |
private String origPath = "/home/imagenes/03AUG23153350-M2AS-000000122423_01_P001-BROWSE.jpg"; |
|
45 |
private String dstPath = "/tmp/test1.tif"; |
|
46 |
|
|
47 |
private GeoRasterFile f1 = null; |
|
48 |
|
|
49 |
|
|
50 |
public void setUp() { |
|
51 |
System.out.println("TestWriterBuffer running..." + GdalWriter.class); |
|
52 |
f1 = GeoRasterFile.openFile(null, origPath); |
|
53 |
} |
|
54 |
|
|
55 |
public void testStack(){ |
|
56 |
Grid grid = new Grid(f1); |
|
57 |
grid.addDrawableBands(new int[]{0, 1, 2}); |
|
58 |
grid.setAreaOfInterest(0, 0, f1.getWidth() - 1, f1.getHeight() - 1); |
|
59 |
RasterBuf rb = grid.getRasterBuf(); |
|
60 |
try { |
|
61 |
rb.save(dstPath, f1.getExtent()); |
|
62 |
} catch (IOException e) { |
|
63 |
e.printStackTrace(); |
|
64 |
} |
|
65 |
} |
|
66 |
|
|
67 |
} |
|
0 | 68 |
branches/v10/libraries/libCq_CMS_praster/src-test/org/cresques/io/data/TestDataSourceWithResampling.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2006 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
package org.cresques.io.data; |
|
20 |
|
|
21 |
import junit.framework.TestCase; |
|
22 |
|
|
23 |
import org.cresques.io.GeoRasterFile; |
|
24 |
|
|
25 |
|
|
26 |
/* |
|
27 |
* TODO: TEST: Implementar para ECW y MrSID |
|
28 |
*/ |
|
29 |
/** |
|
30 |
* Este test prueba el acceso a datos a traves de un DataSource con resampleo. |
|
31 |
* Este resampleo es el gestionado por la librer?a y el usado por el renderizado. |
|
32 |
* No se elige m?todo de resampleo, simplemente se le pasa un buffer de distinto |
|
33 |
* tama?o que los datos a visualizar. |
|
34 |
* @author Nacho Brodin (brodin_ign@gva.es) |
|
35 |
* |
|
36 |
*/ |
|
37 |
public class TestDataSourceWithResampling extends TestCase{ |
|
38 |
|
|
39 |
private String baseDir = "/home/nacho/images/"; |
|
40 |
private String path1 = baseDir + "p198r033_7t20010601_z31_nn10.tif"; |
|
41 |
private String path2 = baseDir + "p198r033_7t20010601_z31_nn20.tif"; |
|
42 |
private String path3 = baseDir + "p198r033_7t20010601_z31_nn30.tif"; |
|
43 |
private String path4 = baseDir + "03AUG23153350-M2AS-000000122423_01_P001-BROWSE.jpg"; |
|
44 |
private String path5 = baseDir + "q101866.sid"; |
|
45 |
private String path6 = baseDir + "CastilloEcwETRS89.ecw"; |
|
46 |
|
|
47 |
|
|
48 |
private GeoRasterFile f1 = null; |
|
49 |
private GeoRasterFile f2 = null; |
|
50 |
private GeoRasterFile f3 = null; |
|
51 |
private GeoRasterFile f4 = null; |
|
52 |
private GeoRasterFile f5 = null; |
|
53 |
private GeoRasterFile f6 = null; |
|
54 |
|
|
55 |
/** |
|
56 |
* Casos de uso |
|
57 |
* 0: Lectura de datos a partir de coordenadas reales resampleado la librer?a en un buffer |
|
58 |
* m?s peque?o que el volumen de datos le?do. Para 03AUG23153350-M2AS-000000122423_01_P001-BROWSE.jpg |
|
59 |
* 1: Lectura de datos a partir de coordenadas reales para un dataset formado por multiples ficheros. |
|
60 |
* El test aplica un resampleo sobre un buffer de tama?o de datos menor al n?mero de pixels real. |
|
61 |
*/ |
|
62 |
public int test = 1; |
|
63 |
|
|
64 |
private Grid ds = null; |
|
65 |
|
|
66 |
public void setUp() { |
|
67 |
System.out.println("TestDataSourceWithResampling running..." + System.getProperty("user.dir")); |
|
68 |
} |
|
69 |
|
|
70 |
public void testStack(){ |
|
71 |
int[] drawableBands = {0, 1, 2}; |
|
72 |
int bufW = 80; |
|
73 |
int bufH = 60; |
|
74 |
|
|
75 |
switch(test){ |
|
76 |
case 0: f4 = GeoRasterFile.openFile(null, path4); |
|
77 |
ds = new Grid(f4); |
|
78 |
ds.addDrawableBands(drawableBands); |
|
79 |
ds.setAreaOfInterest(644850.0, 4923162.0, 646938.0, 4925250.0, bufW, bufH); |
|
80 |
break; |
|
81 |
case 1: f1 = GeoRasterFile.openFile(null, path1); |
|
82 |
f2 = GeoRasterFile.openFile(null, path2); |
|
83 |
f3 = GeoRasterFile.openFile(null, path3); |
|
84 |
ds = new Grid(f1); |
|
85 |
ds.addFile(f2); |
|
86 |
ds.addFile(f3); |
|
87 |
int[] db = {0, 1, 2}; |
|
88 |
ds.addDrawableBands(db); |
|
89 |
ds.setAreaOfInterest(214498.0, 4335815.0, 261874.0, 4371347.0, bufW, bufH); |
|
90 |
break; |
|
91 |
} |
|
92 |
|
|
93 |
|
|
94 |
RasterBuf raster = ds.getRasterBuf(); |
|
95 |
for(int line = 0; line < bufH; line++){ |
|
96 |
for(int col = 0; col < bufW; col++) |
|
97 |
System.out.print(raster.getElemByte(line, col, 0)+" "); |
|
98 |
System.out.println(); |
|
99 |
} |
|
100 |
} |
|
101 |
|
|
102 |
} |
|
0 | 103 |
branches/v10/libraries/libCq_CMS_praster/src-test/org/cresques/io/data/TestDataSourceWithNoData.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 19-jul-2006 |
|
3 |
* |
|
4 |
* To change the template for this generated file go to |
|
5 |
* Window>Preferences>Java>Code Generation>Code and Comments |
|
6 |
*/ |
|
7 |
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana |
|
8 |
* |
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
10 |
* |
|
11 |
* This program is free software; you can redistribute it and/or |
|
12 |
* modify it under the terms of the GNU General Public License |
|
13 |
* as published by the Free Software Foundation; either version 2 |
|
14 |
* of the License, or (at your option) any later version. |
|
15 |
* |
|
16 |
* This program is distributed in the hope that it will be useful, |
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 |
* GNU General Public License for more details. |
|
20 |
* |
|
21 |
* You should have received a copy of the GNU General Public License |
|
22 |
* along with this program; if not, write to the Free Software |
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
24 |
*/ |
|
25 |
package org.cresques.io.data; |
|
26 |
|
|
27 |
import junit.framework.TestCase; |
|
28 |
|
|
29 |
import org.cresques.io.GeoRasterFile; |
|
30 |
|
|
31 |
/** |
|
32 |
* Este test prueba la gesti?n de multifichero de la clase GeoRasterMultiFile |
|
33 |
* y que incorpora un Grid, as? como la gesti?n de bandas que tiene BandList |
|
34 |
* y que incorpora GeoRasterMultiFile. |
|
35 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
36 |
* |
|
37 |
*/ |
|
38 |
public class TestDataSourceWithNoData extends TestCase{ |
|
39 |
|
|
40 |
private String baseDir = "./test-images/"; |
|
41 |
private String path1 = baseDir + "miniRaster25x24.tif"; |
|
42 |
|
|
43 |
private GeoRasterFile f1 = null; |
|
44 |
|
|
45 |
private Grid g = null; |
|
46 |
|
|
47 |
public void setUp() { |
|
48 |
System.out.println("TestDataSourceWithNoData running..."); |
|
49 |
f1 = GeoRasterFile.openFile(null, path1); |
|
50 |
|
|
51 |
} |
|
52 |
|
|
53 |
public void testStack(){ |
|
54 |
int[] drawableBands = {0, 1, 2}; |
|
55 |
g = new Grid(f1); |
|
56 |
g.addDrawableBands(drawableBands); |
|
57 |
//El par?metro false indica que no se ajuste el extent al raster sino que se rellene con NoData los huecos |
|
58 |
g.setAreaOfInterestWithNoData(645800.0, 4923870.0, 70, 70.0); |
|
59 |
|
|
60 |
RasterBuf raster = g.getRasterBuf(); |
|
61 |
for(int line = 0; line < raster.getHeight(); line++){ |
|
62 |
for(int col = 0; col < raster.getWidth(); col++) |
|
63 |
System.out.print("("+raster.getElemByte(line, col, 0)+" "+raster.getElemByte(line, col, 1)+" "+raster.getElemByte(line, col, 2)+")"); |
|
64 |
System.out.println(); |
|
65 |
} |
|
66 |
} |
|
67 |
|
|
68 |
} |
|
0 | 69 |
branches/v10/libraries/libCq_CMS_praster/src/org/cresques/geo/Mercator.java | ||
---|---|---|
33 | 33 |
import java.awt.Graphics2D; |
34 | 34 |
import java.awt.geom.AffineTransform; |
35 | 35 |
import java.awt.geom.Point2D; |
36 |
import java.awt.geom.Rectangle2D; |
|
36 | 37 |
|
37 | 38 |
import java.util.TreeMap; |
38 | 39 |
|
... | ... | |
348 | 349 |
fromGeo(pt2, ppt2); |
349 | 350 |
|
350 | 351 |
//scale = ppt2.getX()-ppt1.getX(); |
351 |
double scale = (((maxX - minX) / (ppt2.getX() - ppt1.getX())) *
|
|
352 |
double scale = (((maxX - minX) / (ppt2.getX() - ppt1.getX())) * |
|
352 | 353 |
//scale = ((extent.maxX()-extent.minX())/ getWidth());// * |
353 | 354 |
(dpi / 2.54 * 100.0 * 1852.0 * 60.0)) / width; |
354 | 355 |
|
... | ... | |
359 | 360 |
// TODO Auto-generated method stub |
360 | 361 |
return null; |
361 | 362 |
} |
363 |
|
|
364 |
public Rectangle2D getExtent(Rectangle2D extent, double scale, double wImage, double hImage, double changeUnits, double dpi) { |
|
365 |
Projection prj = Geodetic.getProjection((Ellipsoid) getDatum()); |
|
366 |
GeoPoint pt1 = (GeoPoint) prj.createPoint(1.0, 0.0); |
|
367 |
GeoPoint pt2 = (GeoPoint) prj.createPoint(2.0, 0.0); |
|
368 |
ProjPoint ppt1 = (ProjPoint) createPoint(0.0, 0.0); |
|
369 |
ProjPoint ppt2 = (ProjPoint) createPoint(0.0, 0.0); |
|
370 |
fromGeo(pt1, ppt1); |
|
371 |
fromGeo(pt2, ppt2); |
|
372 |
double w =0; |
|
373 |
double h =0; |
|
374 |
double wExtent =0; |
|
375 |
double hExtent =0; |
|
376 |
w = ((wImage / dpi) * 2.54); |
|
377 |
h = ((hImage / dpi) * 2.54); |
|
378 |
wExtent =((w*scale)/ (ppt2.getX() - ppt1.getX()))/ (changeUnits*1852.0*60.0); |
|
379 |
hExtent =((h*scale)/ (ppt2.getX() - ppt1.getX()))/ (changeUnits*1852.0*60.0); |
|
380 |
double xExtent = extent.getCenterX() - wExtent/2; |
|
381 |
double yExtent = extent.getCenterY() - hExtent/2; |
|
382 |
Rectangle2D rec=new Rectangle2D.Double(xExtent,yExtent,wExtent,hExtent); |
|
383 |
return rec; |
|
384 |
} |
|
362 | 385 |
} |
branches/v10/libraries/libCq_CMS_praster/src/org/cresques/geo/Gauss.java | ||
---|---|---|
32 | 32 |
import java.awt.Graphics2D; |
33 | 33 |
import java.awt.geom.AffineTransform; |
34 | 34 |
import java.awt.geom.Point2D; |
35 |
import java.awt.geom.Rectangle2D; |
|
35 | 36 |
|
36 | 37 |
|
37 | 38 |
/** |
... | ... | |
126 | 127 |
// TODO Auto-generated method stub |
127 | 128 |
return null; |
128 | 129 |
} |
130 |
|
|
131 |
public Rectangle2D getExtent(Rectangle2D extent, double scale, double wImage, double hImage, double changeUnits, double dpi) { |
|
132 |
// TODO Auto-generated method stub |
|
133 |
return null; |
|
134 |
} |
|
129 | 135 |
} |
branches/v10/libraries/libCq_CMS_praster/src/org/cresques/geo/Geodetic.java | ||
---|---|---|
34 | 34 |
import java.awt.geom.AffineTransform; |
35 | 35 |
import java.awt.geom.NoninvertibleTransformException; |
36 | 36 |
import java.awt.geom.Point2D; |
37 |
import java.awt.geom.Rectangle2D; |
|
37 | 38 |
|
38 | 39 |
import java.util.TreeMap; |
39 | 40 |
|
... | ... | |
279 | 280 |
*/ |
280 | 281 |
public double getScale(double minX, double maxX, double width, double dpi) { |
281 | 282 |
double scale = ((maxX - minX) * // grados |
282 |
|
|
283 |
|
|
283 | 284 |
// 1852.0 metros x minuto de meridiano |
284 | 285 |
(dpi / 2.54 * 100.0 * 1852.0 * 60.0)) / // px / metro |
285 | 286 |
width; // pixels |
... | ... | |
291 | 292 |
// TODO Auto-generated method stub |
292 | 293 |
return null; |
293 | 294 |
} |
295 |
|
|
296 |
public Rectangle2D getExtent(Rectangle2D extent, double scale, double wImage, double hImage, double changeUnits, double dpi) { |
|
297 |
double w =0; |
|
298 |
double h =0; |
|
299 |
double wExtent =0; |
|
300 |
double hExtent =0; |
|
301 |
w = ((wImage / dpi) * 2.54); |
|
302 |
h = ((hImage / dpi) * 2.54); |
|
303 |
wExtent =(w*scale)/ (changeUnits*1852.0*60.0); |
|
304 |
hExtent =(h*scale)/ (changeUnits*1852.0*60.0); |
|
305 |
double xExtent = extent.getCenterX() - wExtent/2; |
|
306 |
double yExtent = extent.getCenterY() - hExtent/2; |
|
307 |
Rectangle2D rec=new Rectangle2D.Double(xExtent,yExtent,wExtent,hExtent); |
|
308 |
return rec; |
|
309 |
} |
|
294 | 310 |
} |
branches/v10/libraries/libCq_CMS_praster/src/org/cresques/geo/CCLambert.java | ||
---|---|---|
32 | 32 |
import java.awt.Graphics2D; |
33 | 33 |
import java.awt.geom.AffineTransform; |
34 | 34 |
import java.awt.geom.Point2D; |
35 |
import java.awt.geom.Rectangle2D; |
|
35 | 36 |
|
36 | 37 |
|
37 | 38 |
/** |
... | ... | |
126 | 127 |
// TODO Auto-generated method stub |
127 | 128 |
return -1D; |
128 | 129 |
} |
130 |
|
|
131 |
public Rectangle2D getExtent(Rectangle2D extent, double scale, double wImage, double hImage, double changeUnits, double dpi) { |
|
132 |
return null; |
|
133 |
} |
|
129 | 134 |
} |
branches/v10/libraries/libCq_CMS_praster/src/org/cresques/geo/cover/Coverage.java | ||
---|---|---|
172 | 172 |
prj = (Projection) Projection.getProjectionByName(proj.getDatum(), |
173 | 173 |
files[i][2]); |
174 | 174 |
} else if (proj instanceof CoordSys) { |
175 |
prj = ProjectionPool.get(files[i][2]);
|
|
175 |
prj = new ProjectionPool().get(files[i][2]);
|
|
176 | 176 |
} |
177 | 177 |
} |
178 | 178 |
|
... | ... | |
248 | 248 |
layer1 = minuteo[1]; |
249 | 249 |
} |
250 | 250 |
|
251 |
Enumeration enum = hojas.keys(); |
|
251 |
Enumeration enumeration = hojas.keys();
|
|
252 | 252 |
String hName; |
253 | 253 |
String hCode; |
254 | 254 |
Hoja h; |
255 | 255 |
Object obj = null; |
256 | 256 |
|
257 |
while (enum.hasMoreElements()) { |
|
258 |
hName = (String) enum.nextElement(); |
|
257 |
while (enumeration.hasMoreElements()) {
|
|
258 |
hName = (String) enumeration.nextElement();
|
|
259 | 259 |
|
260 | 260 |
try { |
261 | 261 |
obj = hojas.get(hName); |
... | ... | |
326 | 326 |
layer.setColor(color); |
327 | 327 |
layer.setFillColor(fillColor); |
328 | 328 |
|
329 |
Enumeration enum = hojas.keys(); |
|
329 |
Enumeration enumeration = hojas.keys();
|
|
330 | 330 |
String hName; |
331 | 331 |
String hCode; |
332 | 332 |
Hoja h; |
333 | 333 |
Object obj = null; |
334 | 334 |
|
335 |
while (enum.hasMoreElements()) { |
|
336 |
hName = (String) enum.nextElement(); |
|
335 |
while (enumeration.hasMoreElements()) {
|
|
336 |
hName = (String) enumeration.nextElement();
|
|
337 | 337 |
obj = hojas.get(hName); |
338 | 338 |
|
339 | 339 |
if (obj.getClass() == String.class) { |
branches/v10/libraries/libCq_CMS_praster/src/org/cresques/geo/UtmZone.java | ||
---|---|---|
36 | 36 |
import java.awt.Graphics2D; |
37 | 37 |
import java.awt.geom.AffineTransform; |
38 | 38 |
import java.awt.geom.Point2D; |
39 |
import java.awt.geom.Rectangle2D; |
|
39 | 40 |
|
40 | 41 |
|
41 | 42 |
public class UtmZone extends Projection { |
... | ... | |
377 | 378 |
// TODO Auto-generated method stub |
378 | 379 |
return null; |
379 | 380 |
} |
381 |
|
|
382 |
public Rectangle2D getExtent(Rectangle2D extent, double scale, double wImage, double hImage, double changeUnits, double dpi) { |
|
383 |
double w =0; |
|
384 |
double h =0; |
|
385 |
double wExtent =0; |
|
386 |
double hExtent =0; |
|
387 |
w = ((wImage / dpi) * 2.54); |
|
388 |
h = ((hImage / dpi) * 2.54); |
|
389 |
wExtent =w * scale/ changeUnits; |
|
390 |
hExtent =h * scale/ changeUnits; |
|
391 |
double xExtent = extent.getCenterX() - wExtent/2; |
|
392 |
double yExtent = extent.getCenterY() - hExtent/2; |
|
393 |
Rectangle2D rec=new Rectangle2D.Double(xExtent,yExtent,wExtent,hExtent); |
|
394 |
return rec; |
|
395 |
} |
|
380 | 396 |
} |
branches/v10/libraries/libCq_CMS_praster/src/org/cresques/ui/cts/CSSelectionDialogPanel.java | ||
---|---|---|
24 | 24 |
package org.cresques.ui.cts; |
25 | 25 |
|
26 | 26 |
import org.cresques.cts.ProjectionPool; |
27 |
import org.cresques.i18n.Messages; |
|
27 | 28 |
|
28 | 29 |
import org.cresques.ui.DefaultDialogPanel; |
29 | 30 |
import org.cresques.ui.cts.CSSelectionPanel; |
... | ... | |
58 | 59 |
|
59 | 60 |
protected JPanel getContentPanel() { |
60 | 61 |
if (contentPane == null) { |
61 |
contentPane = new CSSelectionPanel("Sistema de referencia"); |
|
62 |
//contentPane = new CSSelectionPanel("Sistema de referencia"); |
|
63 |
contentPane = new CSSelectionPanel(Messages.getText("reference_system")); |
|
62 | 64 |
contentPane.setBounds(14, 12, 280, 163); |
63 | 65 |
|
64 |
((CSSelectionPanel) contentPane).setProjection(ProjectionPool.get("EPSG:32619"));
|
|
66 |
((CSSelectionPanel) contentPane).setProjection(new ProjectionPool().get("EPSG:32619"));
|
|
65 | 67 |
} |
66 | 68 |
|
67 | 69 |
return contentPane; |
branches/v10/libraries/libCq_CMS_praster/src/org/cresques/ui/cts/CSSelectionPanel.java | ||
---|---|---|
24 | 24 |
package org.cresques.ui.cts; |
25 | 25 |
|
26 | 26 |
import org.cresques.cts.IProjection; |
27 |
|
|
27 |
import org.cresques.i18n.Messages; |
|
28 | 28 |
import org.cresques.ui.LoadableComboBox; |
29 | 29 |
|
30 | 30 |
import javax.swing.JLabel; |
... | ... | |
59 | 59 |
super(); |
60 | 60 |
|
61 | 61 |
if (tit == null) { |
62 |
tit = "Sistema de referencia"; |
|
62 |
//tit = "Sistema de referencia"; |
|
63 |
//TODO: add com.iver.andami.PluginServices to this project |
|
64 |
//change all the labels from fix text got from the internationalitation |
|
65 |
tit = Messages.getText("reference_system"); |
|
66 |
if (tit == null) tit="Reference System"; |
|
63 | 67 |
} |
64 | 68 |
|
65 | 69 |
this.tit = tit; |
... | ... | |
80 | 84 |
javax.swing.BorderFactory.createEmptyBorder(5,5,5,5)); */ |
81 | 85 |
setBorder(javax.swing.BorderFactory.createCompoundBorder(null, |
82 | 86 |
javax.swing.BorderFactory.createTitledBorder(null, |
83 |
"Sistema de Referencia",
|
|
87 |
Messages.getText("reference_system"),
|
|
84 | 88 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
85 | 89 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, |
86 | 90 |
null, |
... | ... | |
88 | 92 |
|
89 | 93 |
jLabel = new JLabel(); |
90 | 94 |
jLabel.setBounds(15, 15, 77, 23); |
91 |
jLabel.setText("Datum :");
|
|
95 |
jLabel.setText(Messages.getText("datum") + ":");
|
|
92 | 96 |
add(jLabel, null); |
93 | 97 |
add(getDatumComboBox(), null); |
94 | 98 |
|
95 | 99 |
jLabel1 = new JLabel(); |
96 | 100 |
jLabel1.setBounds(15, 60, 77, 23); |
97 |
jLabel1.setText("Proyecci?n :");
|
|
101 |
jLabel1.setText(Messages.getText("projection") + ":");
|
|
98 | 102 |
add(jLabel1, null); |
99 | 103 |
add(getProjComboBox(), null); |
100 | 104 |
|
101 | 105 |
jLabel2 = new JLabel(); |
102 | 106 |
jLabel2.setBounds(15, 105, 77, 23); |
103 |
jLabel2.setText("Huso :");
|
|
107 |
jLabel2.setText(Messages.getText("zone") + ":");
|
|
104 | 108 |
add(jLabel2, null); |
105 | 109 |
add(getHuseComboBox(), null); |
106 | 110 |
|
... | ... | |
110 | 114 |
public void setModel(CSSelectionModel model) { |
111 | 115 |
this.model = model; |
112 | 116 |
|
113 |
getHuseComboBox().loadData(model.getHuseList());
|
|
117 |
getHuseComboBox().loadData(model.getZoneList());
|
|
114 | 118 |
getDatumComboBox().loadData(model.getDatumList()); |
115 | 119 |
getProjComboBox().loadData(model.getProjectionList()); |
116 | 120 |
} |
... | ... | |
134 | 138 |
public void setProjection(IProjection proj) { |
135 | 139 |
model.setProjection(proj); |
136 | 140 |
|
137 |
if (model.getSelectedDatum() >= 0) { |
|
138 |
setDatumComboBoxEnabled(true); |
|
139 |
getDatumComboBox().setSelectedIndex(model.getSelectedDatum()); |
|
140 |
} else { |
|
141 |
setDatumComboBoxEnabled(false); |
|
142 |
getDatumComboBox().setSelectedIndex(0); |
|
143 |
} |
|
141 |
setDatumComboBoxEnabled(true); |
|
142 |
getDatumComboBox().setSelectedIndex(model.getSelectedDatum()); |
|
143 |
|
|
144 |
getProjComboBox().removeAllItems(); |
|
145 |
getProjComboBox().loadData(model.getProjectionList()); |
|
144 | 146 |
|
147 |
model.setProjection(proj); |
|
145 | 148 |
getProjComboBox().setSelectedIndex(model.getSelectedProj()); |
149 |
model.setProjection(proj); |
|
150 |
|
|
151 |
if (model.getSelectedZone() >= 0) { |
|
152 |
setHuseComboBoxEnabled(true); |
|
153 |
getHuseComboBox().removeAllItems(); |
|
154 |
getHuseComboBox().loadData(model.getZoneList()); |
|
146 | 155 |
|
147 |
if (model.getSelectedHuse() >= 0) { |
|
148 |
setHuseComboBoxEnabled(true); |
|
149 |
getHuseComboBox().setSelectedIndex(model.getSelectedHuse()); |
|
156 |
model.setProjection(proj); |
|
157 |
getHuseComboBox().setSelectedIndex(model.getSelectedZone()); |
|
150 | 158 |
} else { |
151 | 159 |
setHuseComboBoxEnabled(false); |
152 | 160 |
getHuseComboBox().setSelectedIndex(0); |
... | ... | |
167 | 175 |
datumComboBox.addItemListener(new java.awt.event.ItemListener() { |
168 | 176 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
169 | 177 |
model.setSelectedDatum(e.getItem()); |
178 |
getProjComboBox().removeAllItems(); |
|
179 |
getProjComboBox().loadData(model.getProjectionList()); |
|
170 | 180 |
} |
171 | 181 |
}); |
172 | 182 |
} |
... | ... | |
189 | 199 |
|
190 | 200 |
if (model.getSelectedProjType() == CSSelectionModel.TRANSVERSAL) { |
191 | 201 |
setHuseComboBoxEnabled(true); |
202 |
getHuseComboBox().removeAllItems(); |
|
203 |
getHuseComboBox().loadData(model.getZoneList()); |
|
204 |
|
|
192 | 205 |
} else { |
193 | 206 |
setHuseComboBoxEnabled(false); |
194 | 207 |
} |
195 | 208 |
|
196 |
if (model.getSelectedProjType() == CSSelectionModel.NONE) { |
|
197 |
setDatumComboBoxEnabled(false); |
|
198 |
} else { |
|
199 |
setDatumComboBoxEnabled(true); |
|
200 |
} |
|
209 |
// if (model.getSelectedProjType() == CSSelectionModel.NONE) {
|
|
210 |
// setDatumComboBoxEnabled(false);
|
|
211 |
// } else {
|
|
212 |
// setDatumComboBoxEnabled(true);
|
|
213 |
// }
|
|
201 | 214 |
} |
202 | 215 |
}); |
203 | 216 |
} |
... | ... | |
216 | 229 |
huseComboBox.setBounds(14, 125, 250, 23); |
217 | 230 |
huseComboBox.addItemListener(new java.awt.event.ItemListener() { |
218 | 231 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
219 |
model.setSelectedHuse(e.getItem());
|
|
232 |
model.setSelectedZone(e.getItem());
|
|
220 | 233 |
} |
221 | 234 |
}); |
222 | 235 |
} |
branches/v10/libraries/libCq_CMS_praster/src/org/cresques/ui/cts/CSSelectionModel.java | ||
---|---|---|
35 | 35 |
public static int GEODETIC = 0x02; |
36 | 36 |
public static int TRANSVERSAL = 0x03; |
37 | 37 |
public String[] datumList = { |
38 |
"WGS 84", "European 1950", "Datum 73", |
|
39 |
"North American Datum 1927", |
|
40 |
"North American Datum 1983", |
|
41 |
"La Canoa" /*, |
|
42 |
"Nouvelle Triangulation Francaise", |
|
43 |
*/ |
|
44 |
}; |
|
45 |
private String[] projList = { |
|
46 |
"Geodesica", |
|
47 |
"(UTM) Universal Transversal Mercator", |
|
48 |
"Datum 73 / Modified Portuguese Grid", |
|
49 |
"WGS 84 / LCC Canada", |
|
50 |
"NAD83 / NRCan LCC Canada" |
|
51 |
}; |
|
52 |
private int[] projType = { GEODETIC, TRANSVERSAL, NONE, NONE, NONE }; |
|
53 |
private String[] huseList = { }; |
|
38 |
"WGS 84", "European 1950", "Datum 73", |
|
39 |
"North American Datum 1927", |
|
40 |
"North American Datum 1983", |
|
41 |
"La Canoa", |
|
42 |
"NTF (Paris)", |
|
43 |
"ETRS 89", |
|
44 |
"Moon (IAU 2000)", |
|
45 |
"Mars (IAU 2000)", |
|
46 |
"Campo_Inchauspe", |
|
47 |
"RGF93" |
|
48 |
}; |
|
49 |
/*private String[] projList = { |
|
50 |
"Geodesica", |
|
51 |
"(UTM) Universal Transversal Mercator", |
|
52 |
"Datum 73 / Modified Portuguese Grid", |
|
53 |
"WGS 84 / LCC Canada", |
|
54 |
"NAD83 / NRCan LCC Canada", |
|
55 |
"Lambert Etendu", |
|
56 |
"RGF93 / Lambert-93", |
|
57 |
"WGS 84 / Mercator", |
|
58 |
"Campo Inchauspe / Zonas 1-7" |
|
59 |
};*/ |
|
60 |
private String[][] projList = { |
|
61 |
{"Geodesica", "(UTM) Universal Transversal Mercator", |
|
62 |
"LCC Canada", "Mercator"}, // WGS84 |
|
63 |
{"Geodesica", "(UTM) Universal Transversal Mercator"}, // ED50 |
|
64 |
{"Geodesica", "Modified Portuguese Grid"}, //Datum 73 |
|
65 |
{"Geodesica", "(UTM) Universal Transversal Mercator"}, // NAD27 |
|
66 |
{"Geodesica", "(UTM) Universal Transversal Mercator", "NRCan LCC Canada"}, // NAD83 |
|
67 |
{"Geodesica", "(UTM) Universal Transversal Mercator"}, // La Canoa |
|
68 |
{"Geodesica", "Lambert Etendu"}, // NTF (Paris) |
|
69 |
{"Geodesica", "(UTM) Universal Transversal Mercator"}, // ETRS89 |
|
70 |
{"Geodesica"}, // Moon |
|
71 |
{"Geodesica"}, // Mars |
|
72 |
{"Geodesica", "Zonas 1-7"}, // CampoInchauspe |
|
73 |
{"Geodesica", "Lambert-93"} // RFG93 |
|
74 |
}; |
|
75 |
|
|
76 |
private int[][] projType = { |
|
77 |
{GEODETIC, TRANSVERSAL, NONE, NONE}, |
|
78 |
{GEODETIC, TRANSVERSAL}, |
|
79 |
{GEODETIC, NONE}, |
|
80 |
{GEODETIC, TRANSVERSAL}, |
|
81 |
{GEODETIC, TRANSVERSAL, NONE}, |
|
82 |
{GEODETIC, TRANSVERSAL}, |
|
83 |
{GEODETIC, NONE}, |
|
84 |
{GEODETIC, TRANSVERSAL}, |
|
85 |
{GEODETIC}, |
|
86 |
{GEODETIC}, |
|
87 |
{GEODETIC, TRANSVERSAL}, |
|
88 |
{GEODETIC, NONE} |
|
89 |
}; |
|
90 |
|
|
91 |
private int [][] zoneRange = { |
|
92 |
{1,60}, |
|
93 |
{1,60}, |
|
94 |
{0,0}, |
|
95 |
{3,23}, |
|
96 |
{3,23}, |
|
97 |
{18,21}, |
|
98 |
{0,0}, |
|
99 |
{28,38}, |
|
100 |
{0,0}, |
|
101 |
{0,0}, |
|
102 |
{1,7}, |
|
103 |
{0,0} |
|
104 |
}; |
|
105 |
private String[] zoneList = { }; |
|
54 | 106 |
private int selectedDatum = 0; |
55 | 107 |
private int selectedProj = 0; |
56 |
private int selectedHuse = 0;
|
|
108 |
private int selectedZone = 0;
|
|
57 | 109 |
|
58 | 110 |
/** |
59 | 111 |
* |
60 | 112 |
*/ |
61 | 113 |
public CSSelectionModel() { |
62 | 114 |
super(); |
63 |
huseList = new String[60];
|
|
115 |
zoneList = new String[60];
|
|
64 | 116 |
|
65 | 117 |
for (int i = 1; i <= 60; i++) |
66 |
huseList[i - 1] = "Huso " + Integer.toString(i);
|
|
118 |
zoneList[i - 1] = "Huso " + Integer.toString(i);
|
|
67 | 119 |
} |
120 |
|
|
68 | 121 |
|
69 | 122 |
public String[] getDatumList() { |
70 | 123 |
return datumList; |
71 | 124 |
} |
72 | 125 |
|
73 | 126 |
public String[] getProjectionList() { |
74 |
return projList; |
|
127 |
return projList[getSelectedDatum()];
|
|
75 | 128 |
} |
76 | 129 |
|
77 |
public String[] getHuseList() { |
|
78 |
return huseList; |
|
130 |
public String[] getZoneList() { |
|
131 |
int [] r = zoneRange[getSelectedDatum()]; |
|
132 |
return getZoneList(r[0],r[1]); |
|
79 | 133 |
} |
80 | 134 |
|
135 |
public String[] getZoneList(int from, int to) { |
|
136 |
zoneList = new String[to-from+1]; |
|
137 |
|
|
138 |
for (int i = from; i <= to; i++) |
|
139 |
zoneList[i - from] = "Huso " + Integer.toString(i); |
|
140 |
return zoneList; |
|
141 |
} |
|
81 | 142 |
public void setSelectedDatum(int opNr) { |
82 | 143 |
selectedDatum = opNr; |
83 | 144 |
} |
... | ... | |
88 | 149 |
for (int i = 0; i < list.length; i++) |
89 | 150 |
if (list[i].compareTo((String) item) == 0) { |
90 | 151 |
selectedDatum = i; |
152 |
break; |
|
91 | 153 |
} |
92 | 154 |
} |
93 | 155 |
|
... | ... | |
100 | 162 |
} |
101 | 163 |
|
102 | 164 |
public void setSelectedProj(Object item) { |
103 |
String[] list = projList; |
|
165 |
String[] list = projList[getSelectedDatum()];
|
|
104 | 166 |
|
105 | 167 |
for (int i = 0; i < list.length; i++) |
106 | 168 |
if (list[i].compareTo((String) item) == 0) { |
107 | 169 |
selectedProj = i; |
170 |
break; |
|
108 | 171 |
} |
109 | 172 |
} |
110 | 173 |
|
... | ... | |
113 | 176 |
} |
114 | 177 |
|
115 | 178 |
public int getSelectedProjType() { |
116 |
return projType[selectedProj]; |
|
179 |
return projType[getSelectedDatum()][selectedProj];
|
|
117 | 180 |
} |
118 | 181 |
|
119 |
public void setSelectedHuse(int opNr) {
|
|
120 |
selectedHuse = opNr;
|
|
182 |
public void setSelectedZone(int opNr) {
|
|
183 |
selectedZone = opNr;
|
|
121 | 184 |
} |
122 | 185 |
|
123 |
public void setSelectedHuse(Object item) {
|
|
124 |
String[] list = huseList;
|
|
186 |
public void setSelectedZone(Object item) {
|
|
187 |
String[] list = zoneList;
|
|
125 | 188 |
|
126 | 189 |
for (int i = 0; i < list.length; i++) |
127 | 190 |
if (list[i].compareTo((String) item) == 0) { |
128 |
selectedHuse = i; |
|
191 |
selectedZone = i; |
|
192 |
break; |
|
129 | 193 |
} |
130 | 194 |
} |
131 | 195 |
|
132 |
public int getSelectedHuse() {
|
|
133 |
return selectedHuse;
|
|
196 |
public int getSelectedZone() {
|
|
197 |
return selectedZone;
|
|
134 | 198 |
} |
135 | 199 |
|
136 | 200 |
public void setProjection(IProjection proj) { |
137 | 201 |
String key = proj.getAbrev(); |
138 |
key = key.substring(key.length() - 5); |
|
202 |
// Para usos posteriores. |
|
203 |
// String db = key.split(":")[0]; |
|
204 |
key = key.split(":")[1]; |
|
139 | 205 |
|
140 |
if (key.endsWith(":4326")) { |
|
206 |
setSelectedProj(0); |
|
207 |
setSelectedZone(-1); |
|
208 |
|
|
209 |
if (key.endsWith("4326")) { |
|
141 | 210 |
setSelectedDatum(0); |
142 |
setSelectedProj(0); |
|
143 |
setSelectedHuse(-1); |
|
144 |
} else if (key.endsWith(":4230")) { |
|
211 |
} else if (key.endsWith("4230")) { |
|
145 | 212 |
setSelectedDatum(1); |
146 |
setSelectedProj(0); |
|
147 |
setSelectedHuse(-1); |
|
148 |
} else if (key.endsWith(":4267")) { |
|
213 |
} else if (key.endsWith("4274")) { |
|
149 | 214 |
setSelectedDatum(2); |
150 |
setSelectedProj(0); |
|
151 |
setSelectedHuse(-1); |
|
152 |
} else if (key.endsWith(":4269")) { |
|
215 |
} else if (key.endsWith("4267")) { |
|
153 | 216 |
setSelectedDatum(3); |
154 |
setSelectedProj(0);
|
|
155 |
setSelectedHuse(-1);
|
|
156 |
} else if (key.endsWith(":4247")) {
|
|
217 |
} else if (key.endsWith("4269")) {
|
|
218 |
setSelectedDatum(4);
|
|
219 |
} else if (key.endsWith("4247")) { |
|
157 | 220 |
setSelectedDatum(5); |
158 |
setSelectedProj(0); |
|
159 |
setSelectedHuse(-1); |
|
221 |
} else if (key.endsWith("4807")) { |
|
222 |
setSelectedDatum(6); |
|
223 |
} else if (key.endsWith("4258")) { |
|
224 |
setSelectedDatum(7); |
|
225 |
} else if (key.endsWith("30100")) { |
|
226 |
setSelectedDatum(8); |
|
227 |
} else if (key.endsWith("49900")) { |
|
228 |
setSelectedDatum(9); |
|
229 |
} else if (key.endsWith("4221")) { |
|
230 |
setSelectedDatum(10); |
|
231 |
} else if (key.endsWith("4171")) { |
|
232 |
setSelectedDatum(11); |
|
160 | 233 |
} else if (key.startsWith("326")) { |
161 | 234 |
setSelectedDatum(0); |
162 | 235 |
setSelectedProj(1); |
163 |
setSelectedHuse(Integer.parseInt(key.substring(3)) - 1);
|
|
236 |
setSelectedZone("Huso "+ Integer.parseInt(key.substring(3)));
|
|
164 | 237 |
} else if (key.startsWith("230")) { |
165 | 238 |
setSelectedDatum(1); |
166 | 239 |
setSelectedProj(1); |
167 |
setSelectedHuse(Integer.parseInt(key.substring(3)) - 1);
|
|
240 |
setSelectedZone("Huso "+ Integer.parseInt(key.substring(3)));
|
|
168 | 241 |
} else if (key.startsWith("267")) { |
169 |
setSelectedDatum(2);
|
|
242 |
setSelectedDatum(3);
|
|
170 | 243 |
setSelectedProj(1); |
171 |
setSelectedHuse(Integer.parseInt(key.substring(3)) - 1);
|
|
244 |
setSelectedZone("Huso "+ Integer.parseInt(key.substring(3)));
|
|
172 | 245 |
} else if (key.startsWith("269")) { |
173 |
setSelectedDatum(3);
|
|
246 |
setSelectedDatum(4);
|
|
174 | 247 |
setSelectedProj(1); |
175 |
setSelectedHuse(Integer.parseInt(key.substring(3)) - 1);
|
|
248 |
setSelectedZone("Huso "+ Integer.parseInt(key.substring(3)));
|
|
176 | 249 |
} else if (key.startsWith("247")) { |
177 |
setSelectedDatum(3);
|
|
250 |
setSelectedDatum(5);
|
|
178 | 251 |
setSelectedProj(1); |
179 |
setSelectedHuse(Integer.parseInt(key.substring(3)) - 1); |
|
180 |
} else if (key.startsWith("27492")) { // Datum 73 / Modified Portuguese Grid |
|
181 |
setSelectedDatum(-1); |
|
252 |
setSelectedZone("Huso "+ Integer.parseInt(key.substring(3))); |
|
253 |
} else if (key.startsWith("258")) { |
|
254 |
setSelectedDatum(7); |
|
255 |
setSelectedProj(1); |
|
256 |
setSelectedZone("Huso "+ Integer.parseInt(key.substring(3))); |
|
257 |
} else if (key.startsWith("221")) { |
|
258 |
setSelectedDatum(10); |
|
259 |
setSelectedProj(1); |
|
260 |
setSelectedZone("Huso "+ Integer.parseInt(key.substring(4))); |
|
261 |
} else if (key.endsWith("27492")) { // Datum 73 / Modified Portuguese Grid |
|
262 |
setSelectedDatum(2); |
|
263 |
setSelectedProj(1); |
|
264 |
setSelectedZone(-1); |
|
265 |
} else if (key.endsWith("42101")) { // WGS 84 / LCC Canada |
|
266 |
setSelectedDatum(0); |
|
182 | 267 |
setSelectedProj(2); |
183 |
setSelectedHuse(-1);
|
|
184 |
} else if (key.startsWith("42101")) { // WGS 84 / LCC Canada
|
|
185 |
setSelectedDatum(-1);
|
|
268 |
setSelectedZone(-1);
|
|
269 |
} else if (key.endsWith("9804")) { // WGS 84 / Mercator
|
|
270 |
setSelectedDatum(0);
|
|
186 | 271 |
setSelectedProj(3); |
187 |
setSelectedHuse(-1); |
|
188 |
} else if (key.startsWith("42304")) { // NAD83 / / LCC Canada |
|
189 |
setSelectedDatum(-1); |
|
190 |
setSelectedProj(4); |
|
191 |
setSelectedHuse(-1); |
|
192 |
} else { |
|
272 |
setSelectedZone(-1); |
|
273 |
} else if (key.endsWith("30100")) { // Moon |
|
274 |
setSelectedDatum(8); |
|
275 |
setSelectedProj(0); |
|
276 |
setSelectedZone(-1); |
|
277 |
} else if (key.endsWith("49900")) { // Mars |
|
278 |
setSelectedDatum(9); |
|
279 |
setSelectedProj(0); |
|
280 |
setSelectedZone(-1); |
|
281 |
} else if (key.endsWith("42304")) { // NAD83 / / LCC Canada |
|
282 |
setSelectedDatum(4); |
|
283 |
setSelectedProj(2); |
|
284 |
setSelectedZone(-1); |
|
285 |
} else if (key.endsWith("27582")) { // NTFParis / / Lambert Etendu |
|
286 |
setSelectedDatum(6); |
|
287 |
setSelectedProj(1); |
|
288 |
setSelectedZone(-1); |
|
289 |
} else if (key.equals("2154")) { // RGF93 / / Lambert 93 |
|
290 |
setSelectedDatum(11); |
|
291 |
setSelectedProj(1); |
|
292 |
setSelectedZone(-1); |
|
293 |
} else { |
|
193 | 294 |
System.err.println("CAGADA EN EL PARSING DE LA PROYECCION: " + key); |
194 | 295 |
} |
195 | 296 |
} |
196 | 297 |
|
197 | 298 |
public IProjection getProjection() { |
198 |
if (selectedProj == 2) { |
|
199 |
return ProjectionPool.get("EPSG:27492"); |
|
200 |
} else if (selectedProj == 3) { |
|
201 |
return ProjectionPool.get("EPSG:42101"); |
|
202 |
} else if (selectedProj == 4) { |
|
203 |
return ProjectionPool.get("EPSG:42304"); |
|
204 |
} |
|
205 |
|
|
206 | 299 |
IProjection proj = null; |
207 | 300 |
String datum = "326"; |
208 | 301 |
|
209 | 302 |
if (selectedDatum == 0) { |
210 | 303 |
datum = "326"; |
304 |
if (selectedProj == 0) |
|
305 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
306 |
else if (selectedProj == 1) { |
|
307 |
String zone = Integer.toString(selectedZone + 1); |
|
308 |
if (selectedZone < 9) zone = "0" + zone; |
|
309 |
return new ProjectionPool().get("EPSG:" + datum + zone); |
|
310 |
} else if (selectedProj == 2) |
|
311 |
return new ProjectionPool().get("EPSG:42101"); |
|
312 |
else if (selectedProj == 3) |
|
313 |
return new ProjectionPool().get("EPSG:9804"); |
|
314 |
|
|
211 | 315 |
} else if (selectedDatum == 1) { |
212 | 316 |
datum = "230"; |
213 |
} else if (selectedDatum == 2) { |
|
317 |
if (selectedProj == 0) |
|
318 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
319 |
else if (selectedProj == 1) { |
|
320 |
String zone = Integer.toString(selectedZone + 1); |
|
321 |
if (selectedZone < 9) zone = "0" + zone; |
|
322 |
return new ProjectionPool().get("EPSG:" + datum + zone); |
|
323 |
} |
|
324 |
|
|
325 |
} else if (selectedDatum == 2) { // Lisboa 73 |
|
326 |
datum = "274"; |
|
327 |
if (selectedProj == 0) |
|
328 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
329 |
else if (selectedProj == 1) |
|
330 |
return new ProjectionPool().get("EPSG:"+datum+"92"); |
|
331 |
|
|
332 |
} else if (selectedDatum == 3) { |
|
214 | 333 |
datum = "267"; |
215 |
} else if (selectedDatum == 3) { |
|
334 |
if (selectedProj == 0) |
|
335 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
336 |
else if (selectedProj == 1) { |
|
337 |
String zone = Integer.toString(selectedZone + 3); |
|
338 |
if (selectedZone+3 <= 9) zone = "0" + zone; |
|
339 |
return new ProjectionPool().get("EPSG:" + datum + zone); |
|
340 |
} |
|
341 |
|
|
342 |
} else if (selectedDatum == 4) { |
|
216 | 343 |
datum = "269"; |
344 |
if (selectedProj == 0) |
|
345 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
346 |
else if (selectedProj == 1) { |
|
347 |
String zone = Integer.toString(selectedZone + 3); |
|
348 |
if (selectedZone+3 <= 9) zone = "0" + zone; |
|
349 |
return new ProjectionPool().get("EPSG:" + datum + zone); |
|
350 |
} else if (selectedProj == 2) |
|
351 |
return new ProjectionPool().get("EPSG:42304"); |
|
352 |
|
|
217 | 353 |
} else if (selectedDatum == 5) { |
218 | 354 |
datum = "247"; |
355 |
if (selectedProj == 0) |
|
356 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
357 |
else if (selectedProj == 1) { |
|
358 |
String zone = Integer.toString(selectedZone + 18); |
|
359 |
return new ProjectionPool().get("EPSG:" + datum + zone); |
|
360 |
} |
|
361 |
|
|
362 |
} else if (selectedDatum == 6) { |
|
363 |
datum = "807"; |
|
364 |
if (selectedProj == 0) |
|
365 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
366 |
else if (selectedProj == 1) |
|
367 |
return new ProjectionPool().get("EPSG:27582"); |
|
368 |
|
|
369 |
} else if (selectedDatum == 7) { |
|
370 |
datum = "258"; |
|
371 |
if (selectedProj == 0) |
|
372 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
373 |
else if (selectedProj == 1) { |
|
374 |
String zone = Integer.toString(selectedZone + 28); |
|
375 |
return new ProjectionPool().get("EPSG:" + datum + zone); |
|
376 |
} |
|
377 |
|
|
378 |
} else if (selectedDatum == 8) { |
|
379 |
datum = "30100"; |
|
380 |
return new ProjectionPool().get("IAU2000:" + datum); |
|
381 |
|
|
382 |
} else if (selectedDatum == 9) { |
|
383 |
datum = "49900"; |
|
384 |
return new ProjectionPool().get("IAU2000:" + datum); |
|
385 |
|
|
386 |
} else if (selectedDatum == 10) { |
|
387 |
datum = "221"; |
|
388 |
if (selectedProj == 0) |
|
389 |
return new ProjectionPool().get("EPSG:4"+datum); |
|
390 |
else if (selectedProj == 1) { |
|
391 |
String zone = Integer.toString(selectedZone + 1); |
|
392 |
return new ProjectionPool().get("EPSG:" + datum + "9"+ zone); |
|
393 |
} |
|
394 |
|
|
395 |
} else if (selectedDatum == 11) { |
|
396 |
if (selectedProj == 0) |
|
397 |
return new ProjectionPool().get("EPSG:4171"); |
|
398 |
else if (selectedProj == 1) |
|
399 |
return new ProjectionPool().get("EPSG:2154"); |
|
219 | 400 |
} |
220 | 401 |
|
402 |
if (selectedProj == 2) { |
|
403 |
return new ProjectionPool().get("EPSG:27492"); |
|
404 |
} else if (selectedProj == 3) { |
|
405 |
return new ProjectionPool().get("EPSG:42101"); |
|
406 |
} else if (selectedProj == 4) { |
|
407 |
return new ProjectionPool().get("EPSG:42304"); |
|
408 |
} else if (selectedProj == 5) { |
|
409 |
return new ProjectionPool().get("EPSG:27582"); |
|
410 |
} else if (selectedProj == 6) { |
|
411 |
return new ProjectionPool().get("EPSG:2154"); |
|
412 |
} else if (selectedProj == 7) { |
|
413 |
return new ProjectionPool().get("EPSG:9804"); |
|
414 |
} else if (selectedProj == 8) { |
|
415 |
datum = "221"; |
|
416 |
String zone = "9"; |
|
417 |
//if (selectedDatum == 10) { |
|
418 |
if (selectedZone < 1) { |
|
419 |
zone += "1"; |
|
420 |
} else if (selectedZone > 7) { |
|
421 |
zone += "7"; |
|
422 |
} else |
|
423 |
zone += (selectedZone+1)+""; |
|
424 |
// } |
|
425 |
return new ProjectionPool().get("EPSG:" + datum + zone); |
|
426 |
} |
|
427 |
|
|
428 |
|
|
221 | 429 |
if (selectedProj == 0) { |
222 |
return ProjectionPool.get("EPSG:4" + datum);
|
|
430 |
return new ProjectionPool().get("EPSG:4" + datum);
|
|
223 | 431 |
} else if (selectedProj == 1) { |
224 |
String huse = Integer.toString(selectedHuse + 1);
|
|
432 |
String Zone = Integer.toString(selectedZone + 1);
|
|
225 | 433 |
|
226 |
if (selectedHuse < 9) {
|
|
227 |
huse = "0" + huse;
|
|
434 |
if (selectedZone < 9) {
|
|
435 |
Zone = "0" + Zone;
|
|
228 | 436 |
} |
229 | 437 |
|
230 | 438 |
if ((selectedDatum == 2) || (selectedDatum == 3)) { |
231 |
if (selectedHuse < 3) {
|
|
232 |
huse = "03";
|
|
439 |
if (selectedZone < 3) {
|
|
440 |
Zone = "03";
|
|
233 | 441 |
} |
234 | 442 |
|
235 |
if (selectedHuse > 23) {
|
|
236 |
huse = "23";
|
|
443 |
if (selectedZone > 23) {
|
|
444 |
Zone = "23";
|
|
237 | 445 |
} |
238 | 446 |
} |
239 | 447 |
|
240 |
if (selectedDatum == 53) {
|
|
241 |
if (selectedHuse < 18) {
|
|
242 |
huse = "18";
|
|
448 |
if (selectedDatum == 5) { |
|
449 |
if (selectedZone < 18) {
|
|
450 |
Zone = "18";
|
|
243 | 451 |
} |
244 | 452 |
|
245 |
if (selectedHuse > 22) {
|
|
246 |
huse = "22";
|
|
453 |
if (selectedZone > 22) {
|
|
454 |
Zone = "22";
|
|
247 | 455 |
} |
248 | 456 |
} |
249 | 457 |
|
250 |
return ProjectionPool.get("EPSG:" + datum + huse); |
|
251 |
} |
|
458 |
if (selectedDatum == 7) { |
|
459 |
if (selectedZone < 28) { |
|
460 |
Zone = "28"; |
|
461 |
} |
|
252 | 462 |
|
463 |
if (selectedZone > 38) { |
|
464 |
Zone = "38"; |
|
465 |
} |
|
466 |
} |
|
467 |
return new ProjectionPool().get("EPSG:" + datum + Zone); |
|
468 |
} |
|
469 |
|
|
253 | 470 |
return proj; |
254 | 471 |
} |
255 | 472 |
} |
branches/v10/libraries/libCq_CMS_praster/src/org/cresques/ui/DefaultTabPanel.java | ||
---|---|---|
92 | 92 |
public void componentResized(ComponentEvent e) { |
93 | 93 |
if(e.getSource() == this){ |
94 | 94 |
super.componentResized(e); |
95 |
//int difWidth = this.getSize().width - cWidth; |
|
96 |
//int difHeight = this.getSize().height - cHeight; |
|
97 | 95 |
this.tabbedPane.setSize(this.tabbedPane.getSize().width + difWidth, this.tabbedPane.getSize().height + difHeight); |
98 | 96 |
this.setLocation(0,0); |
99 | 97 |
|
... | ... | |
102 | 100 |
} |
103 | 101 |
|
104 | 102 |
public void stateChanged(ChangeEvent ev) { |
105 |
//this.tabbedPane.setSize(this.tabbedPane.getSize().width + difWidth, this.tabbedPane.getSize().height + difHeight); |
|
106 |
//System.out.println("X: " + this.tabbedPane.getSize().width + " Y: " + this.tabbedPane.getSize().height); |
|
107 | 103 |
|
108 |
if (ev.getSource().getClass().toString().endsWith("JTabbedPane")) { |
|
104 |
/*if (ev.getSource().getClass().toString().endsWith("JTabbedPane")) {
|
|
109 | 105 |
if (((JTabbedPane)ev.getSource()).getSelectedIndex() == 1){ |
110 | 106 |
super.resizeWindow(); |
111 | 107 |
this.tabbedPane.setSize(this.tabbedPane.getSize().width + difWidth, this.tabbedPane.getSize().height + difHeight); |
112 | 108 |
this.setLocation(0,0); |
113 | 109 |
} |
114 |
} |
|
110 |
}*/
|
|
115 | 111 |
} |
116 | 112 |
} // @jve:decl-index=0:visual-constraint="13,18" |
branches/v10/libraries/libCq_CMS_praster/src/org/cresques/ui/raster/listener/PalettePanelListener.java | ||
---|---|---|
78 | 78 |
control = panel.getPTable().getControl(); |
79 | 79 |
|
80 | 80 |
panel.getBSave().addActionListener(this); |
81 |
panel.getBSaveAs().addActionListener(this); |
|
81 | 82 |
panel.getBAccept().addActionListener(this); |
82 | 83 |
panel.getBApply().addActionListener(this); |
83 | 84 |
panel.getBCancel().addActionListener(this); |
... | ... | |
110 | 111 |
*/ |
111 | 112 |
public void actionPerformed(ActionEvent e) { |
112 | 113 |
|
113 |
//Bot?n de salvar tabla
|
|
114 |
if(e.getSource() == panel.getBSave()){ |
|
114 |
//Bot?n salvar como
|
|
115 |
if(e.getSource() == panel.getBSaveAs()){
|
|
115 | 116 |
if (nameChooser == null) |
116 | 117 |
nameChooser = new NameChooserDialog(panel, this); |
117 | 118 |
else |
118 | 119 |
nameChooser.init(); |
119 | 120 |
} |
120 | 121 |
|
122 |
//Bot?n de salvar tabla |
|
123 |
if(e.getSource() == panel.getBSave()){ |
|
124 |
if(panel.getCbList().getSelectedIndex() != 0){ //Ya existe. Hay que sustituir la que hay |
|
125 |
replacePalette(panel.getPalettesPath(), panel.getCbList().getSelectedItem().toString()); |
|
126 |
}else{ //No hay nombre seleccionado -> se comporta como salvar como |
|
127 |
if (nameChooser == null) |
|
128 |
nameChooser = new NameChooserDialog(panel, this); |
|
129 |
else |
|
130 |
nameChooser.init(); |
|
131 |
} |
|
132 |
} |
|
133 |
|
|
121 | 134 |
//Bot?n de nueva fila |
122 | 135 |
if(e.getSource() == control.getBNew()) |
123 | 136 |
try { |
... | ... | |
313 | 326 |
palettes.delete(); |
314 | 327 |
tmp.renameTo(palettes); |
315 | 328 |
} catch (FileNotFoundException e) { |
316 |
// TODO Auto-generated catch block |
|
317 | 329 |
e.printStackTrace(); |
318 | 330 |
}catch (IOException e) { |
319 |
// TODO Auto-generated catch block |
|
320 | 331 |
e.printStackTrace(); |
321 | 332 |
} |
322 | 333 |
} |
323 | 334 |
|
335 |
|
|
324 | 336 |
/** |
337 |
* Sustituye la paleta que hay en la tabla al fichero xml de paletas conel nombre especificado. |
|
338 |
* |
|
339 |
* @param palettesPath Camino al fichero de paletas predefinidas. |
|
340 |
* @param paletteName Nombre de paleta a sustituir |
|
341 |
* |
|
342 |
*/ |
|
343 |
public void replacePalette(String palettesPath, String paletteName){ |
|
344 |
|
|
345 |
File tmp = new File(palettesPath.substring(0,palettesPath.lastIndexOf(File.separator)+1)+"palettes.tmp"); |
|
346 |
File palettes = new File(palettesPath); |
|
347 |
|
|
348 |
try { |
|
349 |
if (!tmp.exists()) |
|
350 |
tmp.createNewFile(); |
|
351 |
|
|
352 |
Reader reader = new FileReader(palettesPath); |
|
353 |
BufferedReader bReader = new BufferedReader(reader); |
|
354 |
|
|
355 |
Writer writer = new FileWriter(palettesPath.substring(0,palettesPath.lastIndexOf(File.separator)+1)+"palettes.tmp"); |
|
356 |
BufferedWriter bWriter = new BufferedWriter(writer); |
|
357 |
|
|
358 |
String line = bReader.readLine(); |
|
359 |
boolean write = true; |
|
360 |
while (line != null){ |
|
361 |
|
|
362 |
if (line.indexOf("<palette name=\""+paletteName+"\"") >= 0) |
|
363 |
write = false; |
|
364 |
|
|
365 |
if(write){ |
|
366 |
bWriter.write(line); |
|
367 |
bWriter.newLine(); |
|
368 |
}else{ |
|
369 |
bWriter.write(createXmlStringFromTable(paletteName)); |
|
370 |
bWriter.newLine(); |
|
371 |
while ((line.indexOf("</palette>") < 0) && (line != null)) |
|
372 |
line = bReader.readLine(); |
|
373 |
write = true; |
|
374 |
} |
|
375 |
|
|
376 |
line = bReader.readLine(); |
|
377 |
} |
|
378 |
|
|
379 |
bReader.close(); |
|
380 |
bWriter.close(); |
|
381 |
|
|
382 |
palettes.delete(); |
|
383 |
tmp.renameTo(palettes); |
|
384 |
} catch (FileNotFoundException e) { |
|
385 |
e.printStackTrace(); |
|
386 |
}catch (IOException e) { |
|
387 |
e.printStackTrace(); |
|
388 |
} |
|
389 |
} |
|
390 |
|
|
391 |
/** |
|
325 | 392 |
* Crea un String con el bloque XML correspondiente a la paleta que hay en la tabla. |
326 | 393 |
* |
327 | 394 |
* @param palettesPath Camino al fichero de paletas predefinidas. |
branches/v10/libraries/libCq_CMS_praster/src/org/cresques/ui/raster/BandSetupPanel.java | ||
---|---|---|
62 | 62 |
public class BandSetupPanel extends JPanel implements TableModelListener, |
63 | 63 |
KeyListener, |
64 | 64 |
ActionListener, |
65 |
ComponentListener { |
|
65 |
ComponentListener, |
|
66 |
IResize{ |
|
66 | 67 |
final private static long serialVersionUID = -3370601314380922368L; |
67 | 68 |
|
68 | 69 |
/** |
70 |
* Variables para la asignaci?n de tama?o de los componentes del panel. |
|
71 |
*/ |
|
72 |
private int wComp = 445, hComp = 239; |
|
73 |
private int wFileList = wComp, hFileList = (int)Math.round(hComp * 0.46); |
|
74 |
private int wBand = wFileList, hBand = hComp - hFileList - 20; |
|
75 |
|
|
76 |
/** |
|
69 | 77 |
* Asigna la banda del rojo |
70 | 78 |
*/ |
71 | 79 |
public static final int RED_BAND = GeoRasterFile.RED_BAND; |
... | ... | |
109 | 117 |
* @return void |
110 | 118 |
*/ |
111 | 119 |
void initialize() { |
112 |
this.setPreferredSize(new Dimension(sizeX, sizeY));
|
|
120 |
//this.setPreferredSize(new Dimension(wComp, hComp));
|
|
113 | 121 |
this.setLayout(null); |
114 | 122 |
this.setLocation(0, 0); |
115 |
this.setSize(445, 239); |
|
116 | 123 |
this.add(getFileList(), null); |
117 | 124 |
this.add(getRGBBandAssignPane(), null); |
118 | 125 |
getFileList().getJComboBox().addKeyListener(this); |
119 | 126 |
getFileList().getJComboBox().addActionListener(this); |
120 | 127 |
this.addComponentListener(this); |
128 |
this.setComponentSize(wComp, hComp); |
|
121 | 129 |
} |
122 | 130 |
|
123 | 131 |
/** |
... | ... | |
318 | 326 |
public FileList getFileList() { |
319 | 327 |
if (fileList == null) { |
320 | 328 |
fileList = new FileList(); |
321 |
fileList.setBounds(9, 9, 428, 110);
|
|
329 |
//fileList.setBounds(9, 9, wFileList, hFileList);
|
|
322 | 330 |
} |
323 | 331 |
|
324 | 332 |
return fileList; |
... | ... | |
332 | 340 |
private JScrollPane getRGBBandAssignPane() { |
333 | 341 |
if (rgbBandAssignPane == null) { |
334 | 342 |
rgbBandAssignPane = new JScrollPane(getRGBTable()); |
335 |
rgbBandAssignPane.setBounds(10, 123, 427, 104);
|
|
343 |
//rgbBandAssignPane.setBounds(10, 123, wBand, hBand);
|
|
336 | 344 |
|
337 | 345 |
TableColumn column = null; |
338 | 346 |
|
... | ... | |
622 | 630 |
|
623 | 631 |
} |
624 | 632 |
|
633 |
|
|
634 |
public void setComponentSize(int w, int h){ |
|
635 |
wComp = w; hComp = h; |
|
636 |
wFileList = wComp - 18; hFileList = (int)Math.round(hComp * 0.46); |
|
637 |
wBand = wFileList; hBand = hComp - hFileList - 20; |
|
638 |
|
|
639 |
this.setPreferredSize(new Dimension(wComp, hComp)); |
|
640 |
this.setSize(wComp, hComp); |
|
641 |
rgbBandAssignPane.setBounds(10, hFileList + 12, wBand, hBand); |
|
642 |
fileList.setBounds(9, 9, wFileList, hFileList); |
|
643 |
|
|
644 |
} |
|
645 |
|
|
646 |
|
|
647 |
|
|
625 | 648 |
public void componentHidden(ComponentEvent e) { |
626 | 649 |
// TODO Auto-generated method stub |
627 | 650 |
|
... | ... | |
635 | 658 |
* Redimensiona el panel cuando se redimensiona el contenedor de ?ste |
636 | 659 |
*/ |
637 | 660 |
public void componentResized(ComponentEvent e) { |
638 |
if(e.getSource() == this){ |
|
661 |
/*if(e.getSource() == this){
|
|
639 | 662 |
int nWidth = this.getSize().width; |
640 | 663 |
int nHeight = this.getSize().height; |
641 | 664 |
int difWidth = nWidth - 445; |
... | ... | |
643 | 666 |
this.fileList.setResize(difWidth, difHeight); |
644 | 667 |
this.rgbBandAssignPane.setBounds(10, 123 + difHeight/2, 427 + difWidth, 104 + difHeight/2); |
645 | 668 |
|
646 |
} |
|
669 |
}*/
|
|
647 | 670 |
|
648 | 671 |
} |
649 | 672 |
|
branches/v10/libraries/libCq_CMS_praster/src/org/cresques/ui/raster/IResize.java | ||
---|---|---|
1 |
package org.cresques.ui.raster; |
|
2 |
|
|
3 |
/** |
|
4 |
* Interfaz que implementan los paneles dentro del dialogo de propiedades |
|
5 |
* de raster para m?todos de redimensi?n de los paneles. |
|
6 |
* @author Miguel ?ngel Querol Carratal? <querol_mig@gva.es> |
|
7 |
* |
|
8 |
*/ |
|
9 |
public interface IResize { |
|
10 |
|
|
11 |
public void setComponentSize(int w, int h); |
|
12 |
|
|
13 |
} |
|
0 | 14 |
Also available in: Unified diff