Revision 19421
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.raster.gdal.io.DefaultGdalIOLibrary |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/util/DefaultCRSUtils.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.util; |
|
23 |
|
|
24 |
import org.cresques.cts.ICRSFactory; |
|
25 |
import org.cresques.cts.IProjection; |
|
26 |
import org.gdal.osr.SpatialReference; |
|
27 |
|
|
28 |
import org.gvsig.fmap.crs.CRSFactory; |
|
29 |
import org.gvsig.fmap.dal.coverage.util.CRSUtils; |
|
30 |
|
|
31 |
/** |
|
32 |
* Esta clase se encarga de hacer la conversion entre Wkt e IProjection. |
|
33 |
* |
|
34 |
* El uso se hace mediante dos llamadas estaticas que son: |
|
35 |
* convertIProjectionToWkt y |
|
36 |
* convertWktToIProjection. |
|
37 |
* |
|
38 |
* Antes de usarlos, hay que saber si tenemos acceso a gvSIG e intentar coger el |
|
39 |
* factory desde all?. |
|
40 |
* Ya que su uso consume tiempo y espacio de memoria y es preferible |
|
41 |
* reaprovechar ese objeto ya |
|
42 |
* creado. Esto se hace con setCRSFactory. |
|
43 |
* |
|
44 |
* En caso de no asignarse el ya existente, el crear? uno interno y lo dejara en |
|
45 |
* una variable estatica. |
|
46 |
* |
|
47 |
* @version 11/07/2008 |
|
48 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es) |
|
49 |
*/ |
|
50 |
public class DefaultCRSUtils implements CRSUtils { |
|
51 |
|
|
52 |
private ICRSFactory factory = null; |
|
53 |
|
|
54 |
public void setCRSFactory(ICRSFactory factory) { |
|
55 |
this.factory = factory; |
|
56 |
} |
|
57 |
|
|
58 |
/** |
|
59 |
* Devuelve el CRSFactory asignado desde fuera o creado desde dentro, todo |
|
60 |
* depende de como se haya |
|
61 |
* usado. |
|
62 |
* |
|
63 |
* @param code |
|
64 |
* @return |
|
65 |
*/ |
|
66 |
private IProjection getCRS(String code) { |
|
67 |
if (factory == null) |
|
68 |
factory = CRSFactory.getCRSFactory(); // new ProjectionPool(); |
|
69 |
return factory.get(code); |
|
70 |
} |
|
71 |
|
|
72 |
public IProjection convertWktToIProjection(String wkt) { |
|
73 |
if (wkt == null || wkt.equals("")) |
|
74 |
return null; |
|
75 |
|
|
76 |
String code = null; |
|
77 |
String name = null; |
|
78 |
|
|
79 |
SpatialReference oSRSSource = new SpatialReference(); |
|
80 |
|
|
81 |
oSRSSource.ImportFromWkt(wkt); |
|
82 |
|
|
83 |
code = oSRSSource.GetAuthorityCode("PROJCS"); |
|
84 |
if (code == null) |
|
85 |
code = oSRSSource.GetAuthorityCode("GEOGCS"); |
|
86 |
name = oSRSSource.GetAuthorityName("PROJCS"); |
|
87 |
if (name == null) |
|
88 |
name = oSRSSource.GetAuthorityName("GEOGCS"); |
|
89 |
try { |
|
90 |
if (name != null && code != null) |
|
91 |
return getCRS(name + ":" + code); |
|
92 |
} catch (NumberFormatException ex) { |
|
93 |
return null; |
|
94 |
} |
|
95 |
|
|
96 |
return null; |
|
97 |
} |
|
98 |
|
|
99 |
public String convertIProjectionToWkt(IProjection projection) { |
|
100 |
if (projection == null) |
|
101 |
return null; |
|
102 |
return projection.export(ICRSFactory.FORMAT_WKT); |
|
103 |
} |
|
104 |
} |
|
0 | 105 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/overview/GdalOverviewBuilder.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.overview; |
|
23 |
|
|
24 |
import org.gvsig.addo.BuildingOverviewsException; |
|
25 |
import org.gvsig.addo.IOverviewIncrement; |
|
26 |
import org.gvsig.addo.Jaddo; |
|
27 |
import org.gvsig.addo.WritingException; |
|
28 |
import org.gvsig.fmap.dal.coverage.exception.OverviewException; |
|
29 |
import org.gvsig.fmap.dal.coverage.process.BaseIncrementableTask; |
|
30 |
import org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder; |
|
31 |
|
|
32 |
/** |
|
33 |
* Servicios ofrecidos por el proceso de construcci?n de overviews. Esta |
|
34 |
* implementaci?n usa gdal para construir las overviews. |
|
35 |
* |
|
36 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
37 |
*/ |
|
38 |
public class GdalOverviewBuilder implements OverviewBuilder { |
|
39 |
private Jaddo build = new Jaddo(); |
|
40 |
private int value = 0; |
|
41 |
|
|
42 |
/** |
|
43 |
* Bindings between an IOverviewIncrement and a BaseIncrementableTask |
|
44 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
45 |
*/ |
|
46 |
class ProcessBinding implements IOverviewIncrement { |
|
47 |
private BaseIncrementableTask task = null; |
|
48 |
|
|
49 |
public ProcessBinding(BaseIncrementableTask task) { |
|
50 |
this.task = task; |
|
51 |
} |
|
52 |
|
|
53 |
public int getPercent() { |
|
54 |
return task.getPercent(); |
|
55 |
} |
|
56 |
|
|
57 |
public void setPercent(int value) { |
|
58 |
task.setPercent(value); |
|
59 |
} |
|
60 |
} |
|
61 |
|
|
62 |
/* |
|
63 |
* (non-Javadoc) |
|
64 |
* @see org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder#buildOverviews(int, java.lang.String, int[]) |
|
65 |
*/ |
|
66 |
public void buildOverviews(int resamplingAlg, String file, int[] overviews) |
|
67 |
throws OverviewException { |
|
68 |
try { |
|
69 |
build.buildOverviews(resamplingAlg, file, overviews); |
|
70 |
} catch (BuildingOverviewsException e) { |
|
71 |
throw new OverviewException("Error building overviews", e); |
|
72 |
} catch (WritingException e) { |
|
73 |
throw new OverviewException("Error writing overviews", e); |
|
74 |
} |
|
75 |
} |
|
76 |
|
|
77 |
/* |
|
78 |
* (non-Javadoc) |
|
79 |
* @see org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder#getPercent() |
|
80 |
*/ |
|
81 |
public int getPercent() { |
|
82 |
return value; |
|
83 |
} |
|
84 |
|
|
85 |
/* |
|
86 |
* (non-Javadoc) |
|
87 |
* @see org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder#setIncrementListener(org.gvsig.addo.IOverviewIncrement) |
|
88 |
*/ |
|
89 |
public void setIncrementListener(BaseIncrementableTask incr) { |
|
90 |
build.setIncrementListener(new ProcessBinding(incr)); |
|
91 |
} |
|
92 |
|
|
93 |
/* |
|
94 |
* (non-Javadoc) |
|
95 |
* @see org.gvsig.fmap.dal.coverage.process.overview.OverviewBuilder#setPercent(int) |
|
96 |
*/ |
|
97 |
public void setPercent(int value) { |
|
98 |
this.value = value; |
|
99 |
} |
|
100 |
} |
|
0 | 101 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalDataParameters.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
package org.gvsig.raster.gdal.io; |
|
24 |
|
|
25 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
26 |
import org.gvsig.raster.impl.store.AbstractRasterFileDataParameters; |
|
27 |
import org.gvsig.tools.ToolsLocator; |
|
28 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
|
29 |
import org.gvsig.tools.dynobject.DynStruct; |
|
30 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
31 |
|
|
32 |
/** |
|
33 |
* Parameters for the Gdal provider |
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
35 |
*/ |
|
36 |
public class GdalDataParameters extends AbstractRasterFileDataParameters { |
|
37 |
|
|
38 |
public GdalDataParameters() { |
|
39 |
initialize(); |
|
40 |
} |
|
41 |
|
|
42 |
protected void initialize() { |
|
43 |
this.delegatedDynObject = (DelegatedDynObject) ToolsLocator |
|
44 |
.getDynObjectManager().createDynObject( |
|
45 |
registerDynClass()); |
|
46 |
} |
|
47 |
|
|
48 |
public String getDataStoreName() { |
|
49 |
return GdalProvider.NAME; |
|
50 |
} |
|
51 |
|
|
52 |
public String getDescription() { |
|
53 |
return GdalProvider.DESCRIPTION; |
|
54 |
} |
|
55 |
|
|
56 |
public static DynStruct registerDynClass() { |
|
57 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
58 |
DynStruct definition = manager.getDefinition("GdalDataParameters_Persistent"); |
|
59 |
if( definition == null ) { |
|
60 |
definition = manager.addDefinition( |
|
61 |
GdalDataParameters.class, |
|
62 |
"GdalDataParameters_Persistent", |
|
63 |
"GdalDataParameters Persistent", |
|
64 |
null, |
|
65 |
null |
|
66 |
); |
|
67 |
AbstractRasterFileDataParameters.registerDynClass(definition); |
|
68 |
} |
|
69 |
return definition; |
|
70 |
} |
|
71 |
|
|
72 |
@Override |
|
73 |
public boolean isTheSameStore(DataStoreParameters dsp) { |
|
74 |
return this.equals(dsp); |
|
75 |
} |
|
76 |
} |
|
0 | 77 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/DefaultGdalIOLibrary.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.io; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.DALFileLibrary; |
|
25 |
import org.gvsig.fmap.dal.DALLibrary; |
|
26 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
27 |
import org.gvsig.raster.gdal.overview.GdalOverviewBuilder; |
|
28 |
import org.gvsig.raster.gdal.util.DefaultCRSUtils; |
|
29 |
import org.gvsig.raster.impl.store.AbstractNewRasterStoreParameters; |
|
30 |
import org.gvsig.tools.ToolsLibrary; |
|
31 |
import org.gvsig.tools.library.AbstractLibrary; |
|
32 |
import org.gvsig.tools.library.Library; |
|
33 |
import org.gvsig.tools.library.LibraryException; |
|
34 |
/** |
|
35 |
* |
|
36 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
37 |
*/ |
|
38 |
public class DefaultGdalIOLibrary extends AbstractLibrary { |
|
39 |
|
|
40 |
public DefaultGdalIOLibrary() { |
|
41 |
super(DefaultGdalIOLibrary.class,Library.TYPE.IMPL); |
|
42 |
require(ToolsLibrary.class); |
|
43 |
require(DALLibrary.class); |
|
44 |
require(DALFileLibrary.class); |
|
45 |
} |
|
46 |
|
|
47 |
@Override |
|
48 |
protected void doInitialize() throws LibraryException { |
|
49 |
//RasterLibrary.wakeUp(); |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
53 |
protected void doPostInitialize() throws LibraryException { |
|
54 |
//AbstractRasterFileDataParameters.registerDynClass(); |
|
55 |
AbstractNewRasterStoreParameters.registerDynClass(); |
|
56 |
|
|
57 |
// Registro de los drivers de lectura |
|
58 |
GdalProvider.register(); |
|
59 |
|
|
60 |
// Registro de los drivers de escritura |
|
61 |
GdalWriter.register(); |
|
62 |
JpegWriter.register(); |
|
63 |
PngWriter.register(); |
|
64 |
GdalDataParameters.registerDynClass(); |
|
65 |
|
|
66 |
//Register GdalOverviewBuilder |
|
67 |
RasterLocator.getManager().getProviderServices().registerOverviewBuilderImplementation( |
|
68 |
"GDAL", |
|
69 |
new GdalOverviewBuilder()); |
|
70 |
|
|
71 |
//Register CRSUtils |
|
72 |
RasterLocator.getManager().getProviderServices().registerCRSUtilImplementation( |
|
73 |
new DefaultCRSUtils()); |
|
74 |
} |
|
75 |
} |
|
0 | 76 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/IDRISIFeatures.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.io.features; |
|
23 |
|
|
24 |
import org.gvsig.raster.gdal.io.GdalProvider; |
|
25 |
import org.gvsig.raster.gdal.io.GdalWriter; |
|
26 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
27 |
/** |
|
28 |
* Caracteristicas del formato RST de IDRISI para escritura. |
|
29 |
* Soporta tipos de datos enteros en 8, 16 y 32 bits y coma flotante en 32 bits |
|
30 |
* Genera un fichero RDC con la descripci?n de la imagen |
|
31 |
* |
|
32 |
* @version 04/06/2007 |
|
33 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
34 |
*/ |
|
35 |
public class IDRISIFeatures extends WriteFileFormatFeatures { |
|
36 |
|
|
37 |
public IDRISIFeatures() { |
|
38 |
super(GdalProvider.FORMAT_RST, "rst", new int[] { -1 }, new int[] { 0, 1, 2, 3, 4 }, GdalWriter.class); |
|
39 |
} |
|
40 |
|
|
41 |
/** |
|
42 |
* Carga los par?metros de este driver. |
|
43 |
*/ |
|
44 |
public void loadParams() { |
|
45 |
super.loadParams(); |
|
46 |
} |
|
47 |
} |
|
0 | 48 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PngFeatures.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.io.features; |
|
23 |
|
|
24 |
import org.gvsig.raster.gdal.io.PngWriter; |
|
25 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
26 |
/** |
|
27 |
* Caracteristicas del formato Png para escritura. |
|
28 |
* La georreferenciaci?n puede hacerse mediante un fichero .wld. |
|
29 |
* |
|
30 |
* @version 14/12/2007 |
|
31 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
32 |
*/ |
|
33 |
public class PngFeatures extends WriteFileFormatFeatures { |
|
34 |
|
|
35 |
public PngFeatures() { |
|
36 |
super("Png", "png", new int[] { 4 }, null, PngWriter.class); |
|
37 |
} |
|
38 |
|
|
39 |
/** |
|
40 |
* Carga los par?metros de este driver. |
|
41 |
*/ |
|
42 |
public void loadParams() { |
|
43 |
super.loadParams(); |
|
44 |
} |
|
45 |
} |
|
0 | 46 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/RMFFeatures.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.io.features; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.coverage.datastruct.Params; |
|
25 |
import org.gvsig.raster.gdal.io.GdalProvider; |
|
26 |
import org.gvsig.raster.gdal.io.GdalWriter; |
|
27 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
28 |
/** |
|
29 |
* Caracteristicas del formato Raster Matrix Format |
|
30 |
* Soporta tipos de datos enteros en 16 bits y coma flotante en 64 bits. |
|
31 |
* ?Ojo! en la documentaci?n de gdal pone 32 bits en flotante pero no se lo traga. |
|
32 |
* |
|
33 |
* @version 04/06/2007 |
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
35 |
*/ |
|
36 |
public class RMFFeatures extends WriteFileFormatFeatures { |
|
37 |
|
|
38 |
public RMFFeatures() { |
|
39 |
super(GdalProvider.FORMAT_RMF, "rmf", new int[]{-1}, new int[]{0, 1, 3, 5}, GdalWriter.class); |
|
40 |
} |
|
41 |
|
|
42 |
/** |
|
43 |
* Carga los par?metros de este driver. |
|
44 |
*/ |
|
45 |
public void loadParams() { |
|
46 |
super.loadParams(); |
|
47 |
|
|
48 |
driverParams.setParam("Mtw", |
|
49 |
new Integer(1), |
|
50 |
Params.CHOICE, |
|
51 |
new String[]{"ON", "OFF"}); |
|
52 |
driverParams.setParam("Tile Width", |
|
53 |
new Integer(3), |
|
54 |
Params.CHOICE, |
|
55 |
new String[]{"32", "64", "128", "256", "512"}); |
|
56 |
driverParams.setParam("Tile Height", |
|
57 |
new Integer(3), |
|
58 |
Params.CHOICE, |
|
59 |
new String[]{"32", "64", "128", "256", "512"}); |
|
60 |
} |
|
61 |
} |
|
0 | 62 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/ILWIS_MprFeatures.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.io.features; |
|
23 |
|
|
24 |
import org.gvsig.raster.gdal.io.GdalProvider; |
|
25 |
import org.gvsig.raster.gdal.io.GdalWriter; |
|
26 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
27 |
/** |
|
28 |
* Caracteristicas del formato ILWIS para escritura. |
|
29 |
* Soporta tipos de datos enteros en 8, 16 y 32 bits y coma flotante en 32 y 64 bits |
|
30 |
* Genera un fichero .mpl con la informaci?n de contenido (ficheros), un fichero .grf con la |
|
31 |
* georreferenciaci?n, y dos ficheros por banda. Un .mpr con la informaci?n referente a los |
|
32 |
* datos de la banda y un .mp# con los datos de la banda |
|
33 |
* |
|
34 |
* @version 04/06/2007 |
|
35 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
36 |
*/ |
|
37 |
public class ILWIS_MprFeatures extends WriteFileFormatFeatures { |
|
38 |
|
|
39 |
public ILWIS_MprFeatures() { |
|
40 |
super(GdalProvider.FORMAT_ILWIS, "mpl", new int[] { -1 }, new int[] { 0, 1, 2, 3, 4, 5 }, GdalWriter.class); |
|
41 |
} |
|
42 |
|
|
43 |
/** |
|
44 |
* Carga los par?metros de este driver. |
|
45 |
*/ |
|
46 |
public void loadParams() { |
|
47 |
super.loadParams(); |
|
48 |
} |
|
49 |
} |
|
0 | 50 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/JpegFeatures.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.io.features; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.coverage.datastruct.Params; |
|
25 |
import org.gvsig.raster.gdal.io.JpegWriter; |
|
26 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
27 |
/** |
|
28 |
* Caracteristicas del formato Jpeg para escritura. |
|
29 |
* Soporta escritura de imagenes 1 banda (monocromo) o 3 (RGB) en 8 bits. |
|
30 |
* La georreferenciaci?n puede hacerse mediante un fichero .wld. |
|
31 |
* |
|
32 |
* @version 04/06/2007 |
|
33 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
34 |
* |
|
35 |
*/ |
|
36 |
public class JpegFeatures extends WriteFileFormatFeatures { |
|
37 |
|
|
38 |
public JpegFeatures() { |
|
39 |
super("Jpeg", "jpg", new int[]{3}, null, JpegWriter.class); |
|
40 |
} |
|
41 |
|
|
42 |
/** |
|
43 |
* Carga los par?metros de este driver. |
|
44 |
*/ |
|
45 |
public void loadParams() { |
|
46 |
super.loadParams(); |
|
47 |
|
|
48 |
driverParams.setParam("quality", |
|
49 |
new Integer(16), |
|
50 |
Params.SLIDER, |
|
51 |
new String[]{ "10", "100", "16", "5", "30"}); //min, max, valor defecto, intervalo peque?o, intervalo grande; |
|
52 |
|
|
53 |
driverParams.setParam("progressive", |
|
54 |
new Boolean("false"), |
|
55 |
Params.CHECK, |
|
56 |
null); |
|
57 |
} |
|
58 |
} |
|
0 | 59 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PNM_PpmFeatures.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.io.features; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.coverage.datastruct.Params; |
|
25 |
import org.gvsig.raster.gdal.io.GdalProvider; |
|
26 |
import org.gvsig.raster.gdal.io.GdalWriter; |
|
27 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
28 |
/** |
|
29 |
* Caracteristicas del formato PNM para escritura. |
|
30 |
* Esta clase soporta solo ficheros ppm. Estos son solo los PNM en |
|
31 |
* RGB |
|
32 |
* |
|
33 |
* @version 04/06/2007 |
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
35 |
*/ |
|
36 |
public class PNM_PpmFeatures extends WriteFileFormatFeatures { |
|
37 |
|
|
38 |
public PNM_PpmFeatures() { |
|
39 |
super(GdalProvider.FORMAT_PNM, "pgm", new int[] { 3 }, null, GdalWriter.class); |
|
40 |
} |
|
41 |
|
|
42 |
/** |
|
43 |
* Carga los par?metros de este driver. |
|
44 |
*/ |
|
45 |
public void loadParams() { |
|
46 |
super.loadParams(); |
|
47 |
|
|
48 |
driverParams.setParam("tfw", new Boolean("true"), Params.CHECK, null); |
|
49 |
} |
|
50 |
} |
|
0 | 51 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/Jpeg2000Features.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.io.features; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.coverage.datastruct.Params; |
|
25 |
import org.gvsig.raster.gdal.io.GdalProvider; |
|
26 |
import org.gvsig.raster.gdal.io.GdalWriter; |
|
27 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
28 |
/** |
|
29 |
* Caracteristicas del formato Jpeg2000 para escritura. |
|
30 |
* Soporta escritura de imagenes 1 banda (monocromo) o 3 (RGB) en 8 bits. |
|
31 |
* La georreferenciaci?n puede hacerse mediante un fichero .wld. |
|
32 |
* |
|
33 |
* @version 26/08/2013 |
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
35 |
* |
|
36 |
*/ |
|
37 |
public class Jpeg2000Features extends WriteFileFormatFeatures { |
|
38 |
|
|
39 |
public Jpeg2000Features() { |
|
40 |
super(GdalProvider.FORMAT_JP2, "jp2", new int[]{3}, null, GdalWriter.class); |
|
41 |
} |
|
42 |
|
|
43 |
/** |
|
44 |
* Carga los par?metros de este driver. |
|
45 |
*/ |
|
46 |
public void loadParams() { |
|
47 |
super.loadParams(); |
|
48 |
|
|
49 |
driverParams.setParam("quality", |
|
50 |
new Integer(16), |
|
51 |
Params.SLIDER, |
|
52 |
new String[]{ "10", "100", "16", "5", "30"}); //min, max, valor defecto, intervalo peque?o, intervalo grande; |
|
53 |
|
|
54 |
driverParams.setParam("progressive", |
|
55 |
new Boolean("false"), |
|
56 |
Params.CHECK, |
|
57 |
null); |
|
58 |
} |
|
59 |
} |
|
0 | 60 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PAuxFeatures.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.io.features; |
|
23 |
|
|
24 |
import org.gvsig.raster.gdal.io.GdalProvider; |
|
25 |
import org.gvsig.raster.gdal.io.GdalWriter; |
|
26 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
27 |
/** |
|
28 |
* Caracteristicas del formato PAux para escritura. |
|
29 |
* Soporta tipo de datos enteros de 8 y 16 bits y reales de 32 bits. |
|
30 |
* La georreferenciaci?n y la proyecci?n son ignoradas. |
|
31 |
* |
|
32 |
* @version 04/06/2007 |
|
33 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
34 |
*/ |
|
35 |
public class PAuxFeatures extends WriteFileFormatFeatures { |
|
36 |
|
|
37 |
public PAuxFeatures() { |
|
38 |
super(GdalProvider.FORMAT_PAUX, "aux", new int[] { 3 }, null, GdalWriter.class); |
|
39 |
} |
|
40 |
|
|
41 |
/** |
|
42 |
* Carga los par?metros de este driver. |
|
43 |
*/ |
|
44 |
public void loadParams() { |
|
45 |
super.loadParams(); |
|
46 |
} |
|
47 |
} |
|
0 | 48 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/PNM_PgmFeatures.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.io.features; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.coverage.datastruct.Params; |
|
25 |
import org.gvsig.raster.gdal.io.GdalProvider; |
|
26 |
import org.gvsig.raster.gdal.io.GdalWriter; |
|
27 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
28 |
/** |
|
29 |
* Caracteristicas del formato PNM para escritura. |
|
30 |
* Esta clase soporta solo ficheros pgm. Estos son solo los PNM en |
|
31 |
* escala de grises |
|
32 |
* |
|
33 |
* @version 04/06/2007 |
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
35 |
*/ |
|
36 |
public class PNM_PgmFeatures extends WriteFileFormatFeatures { |
|
37 |
|
|
38 |
public PNM_PgmFeatures() { |
|
39 |
super(GdalProvider.FORMAT_PNM, "pgm", new int[] { 1 }, null, GdalWriter.class); |
|
40 |
} |
|
41 |
|
|
42 |
/** |
|
43 |
* Carga los par?metros de este driver. |
|
44 |
*/ |
|
45 |
public void loadParams() { |
|
46 |
super.loadParams(); |
|
47 |
|
|
48 |
driverParams.setParam("tfw", new Boolean("true"), Params.CHECK, null); |
|
49 |
} |
|
50 |
} |
|
0 | 51 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/BMPFeatures.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.io.features; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.coverage.datastruct.Params; |
|
25 |
import org.gvsig.raster.gdal.io.GdalProvider; |
|
26 |
import org.gvsig.raster.gdal.io.GdalWriter; |
|
27 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
28 |
/** |
|
29 |
* Caracteristicas del formato BMP para escritura. |
|
30 |
* Soporta escritura de imagenes 1 banda (monocromo) o 3 (RGB) en 8 bits. |
|
31 |
* La georreferenciaci?n puede hacerse mediante un fichero .wld. |
|
32 |
* |
|
33 |
* @version 04/06/2007 |
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
35 |
*/ |
|
36 |
public class BMPFeatures extends WriteFileFormatFeatures { |
|
37 |
|
|
38 |
public BMPFeatures() { |
|
39 |
super(GdalProvider.FORMAT_BMP, "bmp", new int[] { 3 }, null, GdalWriter.class); |
|
40 |
} |
|
41 |
|
|
42 |
/** |
|
43 |
* Carga los par?metros de este driver. |
|
44 |
*/ |
|
45 |
public void loadParams() { |
|
46 |
super.loadParams(); |
|
47 |
driverParams.setParam("tfw", new Boolean("true"), Params.CHECK, null); |
|
48 |
} |
|
49 |
} |
|
0 | 50 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/HFAFeatures.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.io.features; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.coverage.datastruct.Params; |
|
25 |
import org.gvsig.raster.gdal.io.GdalProvider; |
|
26 |
import org.gvsig.raster.gdal.io.GdalWriter; |
|
27 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
28 |
/** |
|
29 |
* Caracteristicas del formato HFA (.img) de Erdas para escritura. |
|
30 |
* Soporta enteros de 8, 16 y 32 bits y datos en coma flotante de 32 y 64 bits |
|
31 |
* con cualquier n?mero de bandas. |
|
32 |
* |
|
33 |
* @version 04/06/2007 |
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
35 |
*/ |
|
36 |
//TODO: Mirar si se pueden generar con piramides |
|
37 |
public class HFAFeatures extends WriteFileFormatFeatures { |
|
38 |
|
|
39 |
public HFAFeatures() { |
|
40 |
super(GdalProvider.FORMAT_HFA, "img", new int[] { -1 }, new int[] { 0, 1, 2, 3, 4, 5 }, GdalWriter.class); |
|
41 |
} |
|
42 |
|
|
43 |
/** |
|
44 |
* Carga los par?metros de este driver. |
|
45 |
*/ |
|
46 |
public void loadParams() { |
|
47 |
super.loadParams(); |
|
48 |
|
|
49 |
driverParams.setParam("rrd", |
|
50 |
new Integer(1), |
|
51 |
Params.CHOICE, |
|
52 |
new String[]{ "YES", "NO"}); |
|
53 |
|
|
54 |
driverParams.setParam("compress", |
|
55 |
new Integer(1), |
|
56 |
Params.CHOICE, |
|
57 |
new String[]{"YES", "NO"}); |
|
58 |
} |
|
59 |
} |
|
0 | 60 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/features/GTiffFeatures.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.io.features; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.coverage.datastruct.Params; |
|
25 |
import org.gvsig.raster.gdal.io.GdalProvider; |
|
26 |
import org.gvsig.raster.gdal.io.GdalWriter; |
|
27 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
28 |
|
|
29 |
/** |
|
30 |
* Caracteristicas del formato GeoTiff para escritura. |
|
31 |
* |
|
32 |
* @version 04/06/2007 |
|
33 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
34 |
*/ |
|
35 |
public class GTiffFeatures extends WriteFileFormatFeatures { |
|
36 |
|
|
37 |
public GTiffFeatures() { |
|
38 |
super(GdalProvider.FORMAT_GTiff, "tif", new int[] { -1 }, new int[] { 0, 1, 2, 3, 4, 5 }, GdalWriter.class); |
|
39 |
} |
|
40 |
|
|
41 |
/** |
|
42 |
* Carga los par?metros de este driver. |
|
43 |
*/ |
|
44 |
public void loadParams() { |
|
45 |
super.loadParams(); |
|
46 |
driverParams.setParam( |
|
47 |
"photometric", |
|
48 |
new Integer(3), |
|
49 |
Params.CHOICE, |
|
50 |
new String[]{"YCBR", "MINISBLACK", "MINISWHITE", "RGB", "CMYK", "CIELAB", "ICCLAB", "ITULAB", "CBCR"}); |
|
51 |
driverParams.setParam( |
|
52 |
"interleave", |
|
53 |
new Integer(0), |
|
54 |
Params.CHOICE, |
|
55 |
new String[]{ "BAND", "PIXEL"}); |
|
56 |
driverParams.setParam( |
|
57 |
"compression", |
|
58 |
new Integer(3), |
|
59 |
Params.CHOICE, |
|
60 |
new String[]{"LZW", "PACKBITS", "DEFLATE", "NONE"}); |
|
61 |
driverParams.setParam("tfw", new Boolean("false"), Params.CHECK, null); |
|
62 |
} |
|
63 |
} |
|
0 | 64 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/PngWriter.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.io; |
|
23 |
|
|
24 |
import java.awt.geom.AffineTransform; |
|
25 |
import java.io.File; |
|
26 |
import java.io.IOException; |
|
27 |
|
|
28 |
import org.cresques.cts.IProjection; |
|
29 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
30 |
import org.gvsig.fmap.dal.coverage.datastruct.Params; |
|
31 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
|
32 |
import org.gvsig.fmap.dal.coverage.store.DataServerWriter; |
|
33 |
import org.gvsig.jgdal.GdalDataset; |
|
34 |
import org.gvsig.jgdal.GdalDriver; |
|
35 |
import org.gvsig.jgdal.GdalException; |
|
36 |
import org.gvsig.raster.gdal.io.features.PngFeatures; |
|
37 |
import org.gvsig.raster.impl.store.WriteFileFormatFeatures; |
|
38 |
import org.gvsig.raster.impl.store.writer.DefaultRasterWriter; |
|
39 |
import org.gvsig.raster.util.DefaultProviderServices; |
|
40 |
import org.gvsig.tools.ToolsLocator; |
|
41 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
42 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
|
43 |
/** |
|
44 |
* Driver para la escritura de Png. |
|
45 |
* Este driver utiliza GdalWriter para salvar Png. |
|
46 |
* La escritura de un png no es posible utilizando un servidor de datos |
|
47 |
* como el que usan los drivers comunes por lo que ser? necesario salvar antes |
|
48 |
* a Tif con el driver de Gdal para posteriormente convertir la imagen completa |
|
49 |
* a png. El problema que tiene es el mismo del jpg y es que el dataset solo soporta la |
|
50 |
* escritura rw y no rw+. |
|
51 |
* |
|
52 |
* @version 22/07/2008 |
|
53 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
54 |
*/ |
|
55 |
public class PngWriter extends DefaultRasterWriter { |
|
56 |
|
|
57 |
// Datos de registro de drivers |
|
58 |
public static void register() { |
|
59 |
DefaultProviderServices pInfo = (DefaultProviderServices)RasterLocator.getManager().getProviderServices(); |
|
60 |
ExtensionPointManager extensionPoints =ToolsLocator.getExtensionPointManager(); |
|
61 |
ExtensionPoint point=extensionPoints.get("RasterWriter"); |
|
62 |
point.append("png", "", PngWriter.class); |
|
63 |
pInfo.getFileFeature().put("png", new PngFeatures()); |
|
64 |
} |
|
65 |
|
|
66 |
private GdalWriter gdalWriter = null; |
|
67 |
private String outTif = null; |
|
68 |
private String outPng = null; |
|
69 |
|
|
70 |
/** |
|
71 |
* Carga los par?metros de este driver. |
|
72 |
*/ |
|
73 |
public void loadParams(String ident) { |
|
74 |
WriteFileFormatFeatures wfff = (WriteFileFormatFeatures) pInfo.getFileFeature().get(ident); |
|
75 |
wfff.loadParams(); |
|
76 |
driverParams = wfff.getParams(); |
|
77 |
} |
|
78 |
|
|
79 |
/* |
|
80 |
* (non-Javadoc) |
|
81 |
* @see org.gvsig.fmap.dal.coverage.store.RasterWriter#getProviderName() |
|
82 |
*/ |
|
83 |
public String getProviderName() { |
|
84 |
return GdalProvider.NAME; |
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* Constructor para la obtenci?n de par?metros del driver |
|
89 |
* @param drvType Tipo de driver |
|
90 |
*/ |
|
91 |
public PngWriter(String fileName) { |
|
92 |
ident = fileUtil.getExtensionFromFileName(fileName); |
|
93 |
driver = ((WriteFileFormatFeatures) pInfo.getFileFeature().get(ident)).getDriverName(); |
|
94 |
gdalWriter = new GdalWriter(fileName); |
|
95 |
|
|
96 |
loadParams(ident); |
|
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* Constructor para salvar datos servidos por el cliente |
|
101 |
* @param dataWriter Objeto servidor de datos para el driver de escritura |
|
102 |
* @param outSizeX N?mero de pixels en X de la imagen de salida |
|
103 |
* @param outSizeY N?mero de pixels en Y de la imagen de salida |
|
104 |
* @param outFilename Fichero de salida |
|
105 |
* @param extentMaxX Posici?n en X m?xima del extent |
|
106 |
* @param extentMinX Posici?n en X m?nima del extent |
|
107 |
* @param extentMaxY Posici?n en Y m?xima del extent |
|
108 |
* @param extentMinY Posici?n en Y m?nima del extent |
|
109 |
* @param nBands N?mero de bandas |
|
110 |
* @param drvType Tipo de driver |
|
111 |
* @throws GdalException |
|
112 |
* @throws IOException |
|
113 |
*/ |
|
114 |
public PngWriter(DataServerWriter dataWriter, |
|
115 |
String outFileName, |
|
116 |
Integer nBands, |
|
117 |
AffineTransform at, |
|
118 |
Integer outSizeX, |
|
119 |
Integer outSizeY, |
|
120 |
Integer dataType, |
|
121 |
Params params, |
|
122 |
IProjection proj, |
|
123 |
Boolean geo)throws GdalException, IOException { |
|
124 |
ident = fileUtil.getExtensionFromFileName(outFileName); |
|
125 |
driver = ((WriteFileFormatFeatures) pInfo.getFileFeature().get(ident)).getDriverName(); |
|
126 |
outPng = outFileName; |
|
127 |
outTif = outFileName.substring(0, outFileName.lastIndexOf(".")); |
|
128 |
outTif += ".tif"; |
|
129 |
this.at = at; |
|
130 |
|
|
131 |
gdalWriter = new GdalWriter(dataWriter, outTif, nBands, at, outSizeX, outSizeY, dataType, params, proj, geo); |
|
132 |
if (params == null) |
|
133 |
loadParams(ident); |
|
134 |
else |
|
135 |
this.driverParams = params; |
|
136 |
} |
|
137 |
|
|
138 |
/** |
|
139 |
* Asigna el tipo de driver con el que se salvar? la imagen |
|
140 |
* @param drvType Tipo de driver |
|
141 |
*/ |
|
142 |
public void setDriverType(String drvType) { |
|
143 |
gdalWriter.setDriverType(drvType); |
|
144 |
} |
|
145 |
|
|
146 |
/** |
|
147 |
* Realiza la funci?n de compresi?n a partir de un GeoRasterFile. |
|
148 |
* @throws IOException |
|
149 |
*/ |
|
150 |
public void fileWrite() throws IOException, ProcessInterruptedException { |
|
151 |
gdalWriter.fileWrite(); |
|
152 |
} |
|
153 |
|
|
154 |
/** |
|
155 |
* Realiza una copia en el formato especificado. |
|
156 |
* @throws IOException |
|
157 |
*/ |
|
158 |
public static void createCopy(GdalDriver driverDst, String dst, String src, |
|
159 |
boolean bstrict, String[] params) throws IOException, GdalException { |
|
160 |
GdalWriter.createCopy(driverDst, dst, src, bstrict, params); |
|
161 |
} |
|
162 |
|
|
163 |
/** |
|
164 |
* Realiza la escritura de datos con los datos que le pasa el cliente. |
|
165 |
* @throws IOException |
|
166 |
*/ |
|
167 |
public void dataWrite() throws IOException, ProcessInterruptedException { |
|
168 |
if(colorInterp != null) |
|
169 |
gdalWriter.setColorBandsInterpretation(colorInterp.getValues()); |
|
170 |
gdalWriter.dataWrite(); |
|
171 |
if (gdalWriter.isWrite()) { |
|
172 |
gdalWriter.writeClose(); |
|
173 |
if (outTif != null) { |
|
174 |
GdalDriver driver = null; |
|
175 |
try { |
|
176 |
driver = GdalDataset.getDriverByName("PNG"); |
|
177 |
GdalWriter.createCopy(driver, outPng, outTif, false, gdalWriter.gdalParamsFromRasterParams(driverParams)); |
|
178 |
} catch (GdalException exc) { |
|
179 |
throw new IOException("No se ha podido obtener el driver."); |
|
180 |
} |
|
181 |
File file = new File(outTif); |
|
182 |
file.delete(); |
|
183 |
} |
|
184 |
} |
|
185 |
} |
|
186 |
|
|
187 |
/** |
|
188 |
* Cancela el salvado de datos. |
|
189 |
*/ |
|
190 |
public void writeCancel() { |
|
191 |
gdalWriter.setWrite(false); |
|
192 |
} |
|
193 |
|
|
194 |
/* |
|
195 |
* (non-Javadoc) |
|
196 |
* @see org.gvsig.raster.dataset.GeoRasterWriter#setParams(org.gvsig.raster.dataset.Params) |
|
197 |
*/ |
|
198 |
public void setParams(Params params) { |
|
199 |
driverParams = params; |
|
200 |
if (gdalWriter != null) |
|
201 |
gdalWriter.setParams(params); |
|
202 |
} |
|
203 |
|
|
204 |
/** |
|
205 |
* Cierra el compresor ecw. |
|
206 |
* @throws GdalException |
|
207 |
*/ |
|
208 |
public void writeClose() { |
|
209 |
// El close del tif se hizo en dataWrite |
|
210 |
} |
|
211 |
|
|
212 |
public void setWkt(String wkt) {} |
|
213 |
} |
|
0 | 214 |
org.gvsig.raster.gdal/tags/org.gvsig.raster.gdal-2.2.216/org.gvsig.raster.gdal.io/src/main/java/org/gvsig/raster/gdal/io/GdalDataSource.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
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., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.gdal.io; |
|
23 |
|
|
24 |
import java.awt.Color; |
|
25 |
import java.awt.Rectangle; |
|
26 |
import java.awt.geom.AffineTransform; |
|
27 |
import java.awt.geom.NoninvertibleTransformException; |
|
28 |
import java.awt.geom.Point2D; |
|
29 |
import java.io.IOException; |
|
30 |
import java.util.ArrayList; |
|
31 |
import java.util.List; |
|
32 |
|
|
33 |
import org.gdal.gdal.gdal; |
|
34 |
import org.gdal.ogr.ogr; |
|
35 |
import org.slf4j.Logger; |
|
36 |
import org.slf4j.LoggerFactory; |
|
37 |
|
|
38 |
import org.gvsig.fmap.dal.coverage.RasterLibrary; |
|
39 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
40 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
|
41 |
import org.gvsig.fmap.dal.coverage.datastruct.BandList; |
|
42 |
import org.gvsig.fmap.dal.coverage.datastruct.ColorItem; |
|
43 |
import org.gvsig.fmap.dal.coverage.datastruct.Extent; |
|
44 |
import org.gvsig.fmap.dal.coverage.datastruct.NoData; |
|
45 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
|
46 |
import org.gvsig.fmap.dal.coverage.store.props.ColorInterpretation; |
|
47 |
import org.gvsig.fmap.dal.coverage.store.props.ColorTable; |
|
48 |
import org.gvsig.fmap.dal.coverage.util.FileUtils; |
|
49 |
import org.gvsig.jgdal.GdalBuffer; |
|
50 |
import org.gvsig.jgdal.GdalColorEntry; |
|
51 |
import org.gvsig.jgdal.GdalColorTable; |
|
52 |
import org.gvsig.jgdal.GdalDataset; |
|
53 |
import org.gvsig.jgdal.GdalException; |
|
54 |
import org.gvsig.jgdal.GdalRasterBand; |
|
55 |
import org.gvsig.jgdal.GeoTransform; |
|
56 |
import org.gvsig.jgdal.GeoTransform.GeoTransformException; |
|
57 |
import org.gvsig.raster.impl.datastruct.ColorItemImpl; |
|
58 |
import org.gvsig.raster.impl.datastruct.DefaultNoData; |
|
59 |
import org.gvsig.raster.impl.datastruct.ExtentImpl; |
|
60 |
import org.gvsig.raster.impl.process.RasterTask; |
|
61 |
import org.gvsig.raster.impl.process.RasterTaskQueue; |
|
62 |
import org.gvsig.raster.impl.store.properties.DataStoreColorInterpretation; |
|
63 |
import org.gvsig.raster.impl.store.properties.DataStoreColorTable; |
|
64 |
import org.gvsig.raster.impl.store.properties.DataStoreMetadata; |
|
65 |
import org.gvsig.raster.impl.store.properties.DataStoreTransparency; |
|
66 |
import org.gvsig.tools.dispose.Disposable; |
|
67 |
import org.gvsig.tools.task.TaskStatus; |
|
68 |
/** |
|
69 |
* Soporte 'nativo' para ficheros desde GDAL. |
|
70 |
*/ |
|
71 |
public class GdalDataSource extends GdalDataset implements Disposable { |
|
72 |
private String fileName = null; |
|
73 |
private String shortName = ""; |
|
74 |
public GeoTransform trans = null; |
|
75 |
public int width = 0, height = 0; |
|
76 |
public double originX = 0D, originY = 0D; |
|
77 |
public String version = ""; |
|
78 |
protected int rBandNr = 1, gBandNr = 2, bBandNr = 3, aBandNr = 4; |
|
79 |
private int[] dataType = null; |
|
80 |
DataStoreMetadata metadata = null; |
|
81 |
protected boolean georeferenced = true; |
|
82 |
|
|
83 |
private static final Logger logger = LoggerFactory.getLogger(GdalDataSource.class); |
|
84 |
|
|
85 |
/** |
|
86 |
* Vectores que contiene los desplazamientos de un pixel cuando hay supersampling. |
|
87 |
* , es decir el n?mero de pixels de pantalla que tiene un pixel de imagen. Como todos |
|
88 |
* los pixeles no tienen el mismo ancho y alto ha de meterse en un array y no puede ser |
|
89 |
* una variable. Adem?s hay que tener en cuenta que el primer y ?ltimo pixel son de |
|
90 |
* distinto tama?o que el resto. |
|
91 |
*/ |
|
92 |
public int[] stepArrayX = null; |
|
93 |
public int[] stepArrayY = null; |
|
94 |
protected GdalRasterBand[] gdalBands = null; |
|
95 |
private double lastReadLine = -1; |
|
96 |
private int overviewWidth = -1; |
|
97 |
private int overviewHeight = -1; |
Also available in: Unified diff