Revision 370

View differences:

trunk/org.gvsig.gdal2/org.gvsig.gdal2.app/org.gvsig.gdal2.app.ogr.gml/pom.xml
2 2
	<modelVersion>4.0.0</modelVersion>
3 3
	<parent>
4 4
		<groupId>org.gvsig</groupId>
5
		<artifactId>org.gvsig.gdal.app</artifactId>
5
		<artifactId>org.gvsig.gdal2.app</artifactId>
6 6
		<version>2.2.0-SNAPSHOT</version>
7 7
	</parent>
8
	<artifactId>org.gvsig.gdal.app.ogr.gml</artifactId>
8
	<artifactId>org.gvsig.gdal2.app.ogr.gml</artifactId>
9 9

  
10 10

  
11 11
    <properties>
12
    <gvsig.package.info.code>org.gvsig.gdal.app.ogr.gml</gvsig.package.info.code>
12
    <gvsig.package.info.code>org.gvsig.gdal2.app.ogr.gml</gvsig.package.info.code>
13 13
    <gvsig.install.plugin>true</gvsig.install.plugin>
14 14
    <gvsig.package.info.name>Formats: OGR/GML support</gvsig.package.info.name>
15 15
    <gvsig.package.info.categories>Formats,Vector</gvsig.package.info.categories>
......
24 24
		</dependency>
25 25
		<dependency>
26 26
			<groupId>org.gvsig</groupId>
27
			<artifactId>org.gvsig.gdal.prov.gml</artifactId>
27
			<artifactId>org.gvsig.gdal2.prov.gml</artifactId>
28 28
		</dependency>
29 29
	</dependencies>
30 30
</project>
trunk/org.gvsig.gdal2/org.gvsig.gdal2.app/org.gvsig.gdal2.app.ogr.mainplugin/pom.xml
2 2
	<modelVersion>4.0.0</modelVersion>
3 3
	<parent>
4 4
		<groupId>org.gvsig</groupId>
5
		<artifactId>org.gvsig.gdal.app</artifactId>
5
		<artifactId>org.gvsig.gdal2.app</artifactId>
6 6
		<version>2.2.0-SNAPSHOT</version>
7 7
	</parent>
8
	<artifactId>org.gvsig.gdal.app.ogr.mainplugin</artifactId>
8
	<artifactId>org.gvsig.gdal2.app.ogr.mainplugin</artifactId>
9 9

  
10 10
  <properties>
11
    <gvsig.package.info.code>org.gvsig.gdal.app.ogr.mainplugin</gvsig.package.info.code>
11
    <gvsig.package.info.code>org.gvsig.gdal2.app.ogr.mainplugin</gvsig.package.info.code>
12 12
    <gvsig.install.plugin>true</gvsig.install.plugin>
13 13
    <gvsig.package.info.name>Formats: OGR support</gvsig.package.info.name>
14 14
    <gvsig.package.info.categories>Formats,Vector</gvsig.package.info.categories>
......
23 23
		</dependency>
24 24
		<dependency>
25 25
			<groupId>org.gvsig</groupId>
26
			<artifactId>org.gvsig.gdal.prov.ogr</artifactId>
26
			<artifactId>org.gvsig.gdal2.prov.ogr</artifactId>
27 27
		</dependency>
28 28
	</dependencies>
29 29

  
trunk/org.gvsig.gdal2/org.gvsig.gdal2.app/pom.xml
21 21
        <gvsig.package.info.categories>Formats</gvsig.package.info.categories>
22 22
        <gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-gdal/pool/</gvsig.package.info.poolURL>
23 23
        <gvsig.package.info.dependencies />
24
        <gvsig.package.info.javaVM>j1_8</gvsig.package.info.javaVM>
24 25
        <gvsig.package.info.codealias />
25 26
    </properties>
26 27

  
27 28
    <modules>
28 29
      <module>${project.artifactId}.mainplugin</module>
29
        <!--
30
      <module>${project.artifactId}.gpx</module>
31
        -->
32 30
      <module>${project.artifactId}.ogr.gml</module>
33 31
      <module>${project.artifactId}.ogr.mainplugin</module>
32
      <module>${project.artifactId}.raster</module>
34 33
    </modules>
35 34
</project>
trunk/org.gvsig.gdal2/org.gvsig.gdal2.app/org.gvsig.gdal2.app.raster/buildNumber.properties
1
#Fri Oct 23 11:19:38 CEST 2015
2
buildNumber=1
trunk/org.gvsig.gdal2/org.gvsig.gdal2.app/org.gvsig.gdal2.app.raster/src/main/assembly/gvsig-plugin-package.xml
1
<assembly>
2
  <id>gvsig-plugin-package</id>
3
  <formats>
4
    <format>zip</format>
5
  </formats>
6
  <baseDirectory>${project.artifactId}</baseDirectory>
7
  <includeBaseDirectory>true</includeBaseDirectory>
8
  <files>
9
    <file>
10
      <source>target/${project.artifactId}-${project.version}.jar</source>
11
      <outputDirectory>lib</outputDirectory>
12
    </file>
13
    <file>
14
      <source>target/package.info</source>
15
    </file>
16
  </files>
17

  
18
  <fileSets>
19
    <fileSet>
20
      <directory>src/main/resources-plugin</directory>
21
      <outputDirectory>.</outputDirectory>
22
    </fileSet>
23
  </fileSets>
24

  
25
  <dependencySets>
26
    <dependencySet>
27
      <useProjectArtifact>false</useProjectArtifact>
28
      <useTransitiveDependencies>false</useTransitiveDependencies>
29
      <outputDirectory>lib</outputDirectory>
30
      <includes>
31
        <include>org.gvsig:org.gvsig.raster.gdal.provider</include>
32
        <include>org.gvsig:org.gvsig.raster.gdal.provider.legend</include>
33
      </includes>
34
    </dependencySet>
35
  </dependencySets>
36

  
37
</assembly>
trunk/org.gvsig.gdal2/org.gvsig.gdal2.app/org.gvsig.gdal2.app.raster/src/main/java/org/gvsig/raster/gdal/app/mainplugin/RasterGdalExtension.java
1
package org.gvsig.raster.gdal.app.mainplugin;
2

  
3
import org.gvsig.andami.plugins.Extension;
4

  
5
public class RasterGdalExtension extends Extension{
6

  
7
    @Override
8
    public void execute(String arg0) {
9
        // TODO Auto-generated method stub
10

  
11
    }
12

  
13
    @Override
14
    public void initialize() {
15
        // TODO Auto-generated method stub
16

  
17
    }
18

  
19
    @Override
20
    public boolean isEnabled() {
21
        // TODO Auto-generated method stub
22
        return true;
23
    }
24

  
25
    @Override
26
    public boolean isVisible() {
27
        // TODO Auto-generated method stub
28
        return true;
29
    }
30
}
trunk/org.gvsig.gdal2/org.gvsig.gdal2.app/org.gvsig.gdal2.app.raster/src/main/resources-plugin/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<depends plugin-name="org.gvsig.app.mainplugin" />
4
	<depends plugin-name="org.gvsig.raster.app.mainplugin" />
5
	<depends plugin-name="org.gvsig.gdal.app.mainplugin" />
6
	<libraries library-dir="lib" />
7
	<resourceBundle name="text" />
8
	<extensions>
9
		<extension class-name="org.gvsig.raster.gdal.app.mainplugin.RasterGdalExtension"
10
			description="GDAL Raster Provider" active="true" priority="1">
11
		</extension>
12
	</extensions>
13
</plugin-config>
trunk/org.gvsig.gdal2/org.gvsig.gdal2.app/org.gvsig.gdal2.app.raster/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.gdal2.app</artifactId>
6
    <version>2.2.0-SNAPSHOT</version>
7
  </parent>
8
  <artifactId>org.gvsig.gdal2.app.raster</artifactId>
9
  <name>${project.artifactId}</name>
10

  
11
 <properties>
12
  <!-- Package info property values -->
13
  <gvsig.package.info.name>Raster Gdal</gvsig.package.info.name>
14
  <gvsig.package.info.description>Provider to GDAL 2.2 Rasters</gvsig.package.info.description>
15
  <gvsig.package.info.categories>Raster</gvsig.package.info.categories>
16
 </properties>
17

  
18
 <dependencies>
19
  <dependency>
20
 <groupId>org.gvsig</groupId>
21
 <artifactId>org.gvsig.andami</artifactId>
22
   <scope>compile</scope>
23
  </dependency>
24
  <dependency>
25
   <groupId>org.gvsig</groupId>
26
   <artifactId>org.gvsig.app.mainplugin</artifactId>
27
   <scope>compile</scope>
28
  </dependency>
29
  <dependency>
30
   <groupId>org.gvsig</groupId>
31
   <artifactId>org.gvsig.tools.lib</artifactId>
32
   <scope>compile</scope>
33
  </dependency>
34
  <dependency>
35
   <groupId>org.gvsig</groupId>
36
   <artifactId>org.gvsig.gdal2.prov.raster</artifactId>
37
   <scope>compile</scope>
38
  </dependency>
39
  <dependency>
40
   <groupId>org.gvsig</groupId>
41
   <artifactId>org.gvsig.gdal2.prov.raster.legend</artifactId>
42
   <scope>compile</scope>
43
  </dependency>
44
<!--
45
  <dependency>
46
    <groupId>org.gvsig</groupId>
47
    <artifactId>org.gvsig.fmap.dal.raster.spi</artifactId>
48
   <scope>compile</scope>
49
  </dependency>
50
  -->
51
 </dependencies>
52

  
53
</project>
trunk/org.gvsig.gdal2/org.gvsig.gdal2.prov/org.gvsig.gdal2.prov.raster.legend/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.raster.gdal.provider.legend.RasterGdalLegendLibrary
trunk/org.gvsig.gdal2/org.gvsig.gdal2.prov/org.gvsig.gdal2.prov.raster.legend/src/main/java/org/gvsig/raster/gdal/provider/legend/RasterGdalGetColorInterpretation.java
1
package org.gvsig.raster.gdal.provider.legend;
2

  
3
import java.awt.Color;
4
import java.util.ArrayList;
5
import java.util.List;
6

  
7
import org.gdal.gdal.Band;
8
import org.gdal.gdal.Dataset;
9
import org.gdal.gdal.gdal;
10

  
11
import org.gvsig.fmap.dal.raster.api.RasterStore;
12
import org.gvsig.raster.gdal.provider.AbstractRasterGdalStoreProvider;
13
import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
14
import org.gvsig.raster.lib.legend.api.RasterLegendManager;
15
import org.gvsig.raster.lib.legend.api.colorinterpretation.ColorInterpretation;
16
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
17
import org.gvsig.raster.lib.legend.api.colortable.colortableclass.ColorTableClass;
18
import org.gvsig.tools.ToolsLocator;
19
import org.gvsig.tools.dynobject.DynClass;
20
import org.gvsig.tools.dynobject.DynMethod;
21
import org.gvsig.tools.dynobject.DynObject;
22
import org.gvsig.tools.dynobject.exception.DynMethodException;
23
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
24

  
25
/**
26
 * @author dmartinezizquierdo
27
 *
28
 */
29
public class RasterGdalGetColorInterpretation implements DynMethod {
30

  
31
    private static Integer code = null;
32

  
33
    static void register(DynClass storeClass) {
34
        if (code != null) {
35
            return;
36
        }
37
        code = ToolsLocator.getDynObjectManager()
38
                .registerDynMethod(storeClass, new RasterGdalGetColorInterpretation());
39

  
40
    }
41

  
42
    @Override
43
    public int getCode() throws DynMethodNotSupportedException {
44
        return code;
45
    }
46

  
47
    @Override
48
    public String getDescription() {
49
        return "Raster GDAL Color Interpretation";
50
    }
51

  
52
    @Override
53
    public String getName() {
54
        return RasterStore.DYNMETHOD_GETCOLORINTERPRETATION_NAME;
55
    }
56

  
57
    @Override
58
    public Object invoke(DynObject self, Object[] args)
59
        throws DynMethodException {
60
        ColorInterpretation colorInterpretation = null;
61

  
62
        AbstractRasterGdalStoreProvider rasterGdalProvider =
63
            (AbstractRasterGdalStoreProvider) self;
64

  
65
        RasterLegendManager legendManager =
66
            RasterLegendLocator.getRasterLegendManager();
67
        Dataset gdalDataSet = rasterGdalProvider.getGdalDataSet();
68

  
69
        String[] bandColorInterpretations =
70
            new String[gdalDataSet.getRasterCount()];
71
        for (int i = 0; i < gdalDataSet.getRasterCount(); i++) {
72
            // Bands begin in 1 instead of 0
73
            int bandNumber = i + 1;
74
            Band gdalBand = gdalDataSet.GetRasterBand(bandNumber);
75
            String bandColorInterpretion =
76
                colorInterpretationFromGdal(gdalBand.GetRasterColorInterpretation());
77
            bandColorInterpretations[i] = bandColorInterpretion;
78
        }
79
        //FIXME:Intenta suponer cual es la forma correcta de interpretar los colores en funcion del numero de bandas
80
        //Seguramente haya que arreglarlo cuando haya GUI para que el usuario pueda especificar la forma correcta.
81
        guessingColorInterpretation(bandColorInterpretations);
82

  
83
        colorInterpretation =
84
            legendManager.createColorInterpretation(bandColorInterpretations);
85

  
86

  
87
        for (int bandNumber = 1; bandNumber <= gdalDataSet.getRasterCount(); bandNumber++) {
88
            //Band in GDAL begins in 1, meanwhile we begin in 0
89
            int indexColorInterpretation=bandNumber-1;
90
            if (ColorInterpretation.PALETTE_BAND.equals(colorInterpretation.get(indexColorInterpretation))) {
91
                ColorTable colorTable = null;
92
                Band gdalBand = gdalDataSet.GetRasterBand(bandNumber);
93
                org.gdal.gdal.ColorTable gdalBandColorTable = gdalBand.GetColorTable();
94
                if (gdalBandColorTable != null) {
95
                    List<ColorTableClass> colorTableClasses = new ArrayList<ColorTableClass>();
96

  
97
                    for (int i = 0; i < gdalBandColorTable.GetCount(); i++) {
98
                        String className = i + "";
99
                        double value = ((byte) i);
100
                        double interpolation = 50.0;
101
                        Color color = gdalBandColorTable.GetColorEntry(i);
102
                        ColorTableClass colorTableClass =
103
                            legendManager.createColorTableClass(className, value, interpolation, color);
104
                        colorTableClasses.add(colorTableClass);
105
                    }
106
                    String colorTableName = rasterGdalProvider.getName() + "_color_table";
107
                    colorTable = legendManager.createColorTable(colorTableName, colorTableClasses, true);
108
                    // FIXME: De momento devolvemos el primero solo.
109
//                    return colorTable;
110
                } else {
111
                    List<ColorTableClass> colorTableClasses = new ArrayList<ColorTableClass>();
112
                    double[] minMax = new double[2];
113
                    gdalBand.ComputeRasterMinMax(minMax);
114
                    Double increment = (minMax[1] - minMax[0]) / 256;
115

  
116
                    for (int i = 0; i < 255; i++) {
117
                        String className = i + "";
118
                        double value = ((minMax[0] + (i * increment)));
119
                        double interpolation = 50.0;
120
                        int intARGB = ((i & 0xFF) << 24) | // alpha
121
                            ((i & 0xFF) << 16) | // red
122
                            ((i & 0xFF) << 8) | // green
123
                            ((i & 0xFF) << 0); // blue
124
                        Color color = new Color(intARGB);
125
                        ColorTableClass colorTableClass =
126
                            legendManager.createColorTableClass(className, value, interpolation, color);
127
                        colorTableClasses.add(colorTableClass);
128
                    }
129
                    String colorTableName = rasterGdalProvider.getName() + "_color_table";
130
                    colorTable = legendManager.createColorTable(colorTableName, colorTableClasses, true);
131
                    // FIXME: De momento devolvemos el primero solo.
132
//                    return colorTable;
133
                }
134
                colorInterpretation.setPalette(colorTable);
135
                colorInterpretation.setPaletteBand(bandNumber);
136
            }
137
        }
138

  
139
        return colorInterpretation;
140
    }
141

  
142
    private void guessingColorInterpretation(String[] bandColorInterpretations){
143
        //FIXME:Intenta suponer cual es la forma correcta de interpretar los colores en funcion del numero de bandas
144
        //Seguramente haya que arreglarlo cuando haya GUI para que el usuario pueda especificar la forma correcta.
145
        if (bandColorInterpretations.length==1){
146
            if (bandColorInterpretations[0].equals(ColorInterpretation.UNDEFINED_BAND)){
147
                bandColorInterpretations[0]=ColorInterpretation.PALETTE_BAND;
148
            }
149
        }
150
        if (bandColorInterpretations.length==3 || bandColorInterpretations.length>4){
151
            if (bandColorInterpretations[0].equals(ColorInterpretation.UNDEFINED_BAND)  ||
152
                bandColorInterpretations[1].equals(ColorInterpretation.UNDEFINED_BAND) ||
153
                bandColorInterpretations[2].equals(ColorInterpretation.UNDEFINED_BAND) ){
154

  
155
                bandColorInterpretations[0]=ColorInterpretation.RED_BAND;
156
                bandColorInterpretations[1]=ColorInterpretation.GREEN_BAND;
157
                bandColorInterpretations[2]=ColorInterpretation.BLUE_BAND;
158
            }
159
        }
160
        if (bandColorInterpretations.length==4){
161
            if (bandColorInterpretations[0].equals(ColorInterpretation.UNDEFINED_BAND)  &&
162
                bandColorInterpretations[1].equals(ColorInterpretation.UNDEFINED_BAND) &&
163
                bandColorInterpretations[2].equals(ColorInterpretation.UNDEFINED_BAND) &&
164
                bandColorInterpretations[3].equals(ColorInterpretation.UNDEFINED_BAND) ){
165

  
166
                bandColorInterpretations[0]=ColorInterpretation.RED_BAND;
167
                bandColorInterpretations[1]=ColorInterpretation.GREEN_BAND;
168
                bandColorInterpretations[2]=ColorInterpretation.BLUE_BAND;
169
                bandColorInterpretations[3]=ColorInterpretation.ALPHA_BAND;
170
            } else if (bandColorInterpretations[0].equals(ColorInterpretation.RED_BAND)  &&
171
                bandColorInterpretations[1].equals(ColorInterpretation.GREEN_BAND) &&
172
                bandColorInterpretations[2].equals(ColorInterpretation.BLUE_BAND) &&
173
                bandColorInterpretations[3].equals(ColorInterpretation.UNDEFINED_BAND) ){
174

  
175
                bandColorInterpretations[3]=ColorInterpretation.ALPHA_BAND;
176

  
177
            }
178
        }
179
    }
180

  
181
    /**
182
     * Obtiene la cadena que representa el tipo de banda de color. Los tipos posibles son:
183
     * <UL>
184
     *  <LI>0 = "Undefined" </LI>
185
     *  <LI>1 = "Gray";</LI>
186
     *  <LI>2 = "Palette";</LI>
187
     *  <LI>3 = "Red";</LI>
188
     *  <LI>4 = "Green";</LI>
189
     *  <LI>5 = "Blue";</LI>
190
     *  <LI>6 = "Alpha";</LI>
191
     *  <LI>7 = "Hue";</LI>
192
     *  <LI>8 = "Saturation";</LI>
193
     *  <LI>9 = "Lightness";</LI>
194
     *  <LI>10 = "Cyan";</LI>
195
     *  <LI>11 = "Magenta";</LI>
196
     *  <LI>12 = "Yellow";</LI>
197
     *  <LI>13 = "Black";</LI>
198
     *  <LI>14 = "YCbCr_Y";</LI>
199
     *  <LI>15 = "YCbCr_Cb";</LI>
200
     *  <LI>16 = "YCbCr_Cr";</LI>
201
     * </UL>
202
     * @return  Cadena con el nombre del tipo de banda de colorn
203
     */
204
    private String colorInterpretationFromGdal(int gdalCode){
205
        String gdalNameCI=gdal.GetColorInterpretationName(gdalCode);
206

  
207
        switch (gdalNameCI) {
208
        case "Undefined" :
209
            return ColorInterpretation.UNDEFINED_BAND;
210
        case "Gray" :
211
            return ColorInterpretation.GRAY_BAND;
212
        case "Palette" :
213
            return ColorInterpretation.PALETTE_BAND;
214
        case "Red" :
215
            return ColorInterpretation.RED_BAND;
216
        case "Green" :
217
            return ColorInterpretation.GREEN_BAND;
218
        case "Blue" :
219
            return ColorInterpretation.BLUE_BAND;
220
        case "Alpha" :
221
            return ColorInterpretation.ALPHA_BAND;
222
        case "Hue" :
223
            return ColorInterpretation.HUE_BAND;
224
        case "Saturation" :
225
            return ColorInterpretation.SATURATION_BAND;
226
        case "Lightness" :
227
            return ColorInterpretation.LIGHTNESS_BAND;
228
        case "Cyan" :
229
            return ColorInterpretation.CYAN_BAND;
230
        case "Magenta" :
231
            return ColorInterpretation.MAGENTA_BAND;
232
        case "Yellow" :
233
            return ColorInterpretation.YELLOW_BAND;
234
        case "Black" :
235
            return ColorInterpretation.BLACK_BAND;
236
        case "YCbCr_Y" :
237
            return ColorInterpretation.YCBCR_Y_BAND;
238
        case "YCbCr_Cb" :
239
            return ColorInterpretation.YCBCR_CB_BAND;
240
        case "YCbCr_Cr" :
241
            return ColorInterpretation.YCBCR_CR_BAND;
242
        default:
243
            return ColorInterpretation.UNDEFINED_BAND;
244
        }
245
    }
246

  
247
    @Override
248
    public Object clone() throws CloneNotSupportedException {
249
        return super.clone();
250
    }
251
}
trunk/org.gvsig.gdal2/org.gvsig.gdal2.prov/org.gvsig.gdal2.prov.raster.legend/src/main/java/org/gvsig/raster/gdal/provider/legend/RasterGdalGetColorTable.java
1
package org.gvsig.raster.gdal.provider.legend;
2

  
3
import java.awt.Color;
4
import java.util.ArrayList;
5
import java.util.List;
6

  
7
import org.gdal.gdal.Band;
8
import org.gdal.gdal.Dataset;
9

  
10
import org.gvsig.fmap.dal.raster.api.RasterStore;
11
import org.gvsig.raster.gdal.provider.AbstractRasterGdalStoreProvider;
12
import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
13
import org.gvsig.raster.lib.legend.api.RasterLegendManager;
14
import org.gvsig.raster.lib.legend.api.colorinterpretation.ColorInterpretation;
15
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
16
import org.gvsig.raster.lib.legend.api.colortable.colortableclass.ColorTableClass;
17
import org.gvsig.tools.ToolsLocator;
18
import org.gvsig.tools.dynobject.DynClass;
19
import org.gvsig.tools.dynobject.DynMethod;
20
import org.gvsig.tools.dynobject.DynObject;
21
import org.gvsig.tools.dynobject.exception.DynMethodException;
22
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
23

  
24
/**
25
 * Dynamic method to add a get Color Table funcionality
26
 * @author dmartinezizquierdo
27
 *
28
 */
29
public class RasterGdalGetColorTable implements DynMethod {
30

  
31
    private static Integer code = null;
32

  
33
    static void register(DynClass storeClass) {
34
        if (code != null) {
35
            return;
36
        }
37
        code = ToolsLocator.getDynObjectManager()
38
                .registerDynMethod(storeClass, new RasterGdalGetColorTable());
39

  
40
    }
41

  
42
    @Override
43
    public int getCode() throws DynMethodNotSupportedException {
44
        return code;
45
    }
46

  
47
    @Override
48
    public String getDescription() {
49
        return "Raster GDAL Color Table";
50
    }
51

  
52
    @Override
53
    public String getName() {
54
        return RasterStore.DYNMETHOD_GETCOLORTABLE_NAME;
55
    }
56

  
57
    @Override
58
    public Object invoke(DynObject self, Object[] args)
59
        throws DynMethodException {
60
        ColorTable colorTable = null;
61

  
62

  
63
        try {
64
            AbstractRasterGdalStoreProvider rasterGdalProvider=(AbstractRasterGdalStoreProvider)self;
65
            RasterLegendManager legendManager=RasterLegendLocator.getRasterLegendManager();
66

  
67
            Dataset gdalDataSet = rasterGdalProvider.getGdalDataSet();
68

  
69
            ColorInterpretation colorInterpretation =(ColorInterpretation)rasterGdalProvider.
70
                invokeDynMethod(RasterStore.DYNMETHOD_GETCOLORINTERPRETATION_NAME, null);
71
            for (int bandNumber = 1; bandNumber <= gdalDataSet.getRasterCount(); bandNumber++) {
72
                //Band in GDAL begins in 1, meanwhile we begin in 0
73
                int indexColorInterpretation=bandNumber-1;
74
                if (ColorInterpretation.PALETTE_BAND.equals(colorInterpretation.get(indexColorInterpretation))){
75
                    Band gdalBand=gdalDataSet.GetRasterBand(bandNumber);
76
                    org.gdal.gdal.ColorTable gdalBandColorTable = gdalBand.GetColorTable();
77
                    if (gdalBandColorTable!=null){
78
                        List<ColorTableClass> colorTableClasses=new ArrayList<ColorTableClass>();
79

  
80
                        for (int i=0;i<gdalBandColorTable.GetCount();i++){
81
                            String className=i+"";
82
                            double value=((byte)i);
83
                            double interpolation=50.0;
84
                            Color color=gdalBandColorTable.GetColorEntry(i);
85
                            ColorTableClass colorTableClass = legendManager.createColorTableClass(className, value, interpolation, color);
86
                            colorTableClasses.add(colorTableClass);
87
                        }
88
                        String colorTableName = rasterGdalProvider.getName() + "_color_table";
89
                        colorTable = legendManager.createColorTable(colorTableName,
90
                            colorTableClasses, true);
91
                        //FIXME: De momento devolvemos el primero solo.
92
                        return colorTable;
93
                    }
94
                    else {
95
                        List<ColorTableClass> colorTableClasses=new ArrayList<ColorTableClass>();
96
                        double[] minMax=new double[2];
97
                        gdalBand.ComputeRasterMinMax(minMax);
98
                        Double increment=(minMax[1]-minMax[0])/256;
99

  
100
                        for (int i=0;i<255;i++){
101
                            String className=i+"";
102
                            double value=((minMax[0]+(i*increment)));
103
                            double interpolation=50.0;
104
                            int intARGB = ((i & 0xFF) << 24) | // alpha
105
                                ((i & 0xFF) << 16) | // red
106
                                ((i & 0xFF) << 8) | // green
107
                                ((i & 0xFF) << 0); // blue
108
                            Color color=new Color(intARGB);
109
                            ColorTableClass colorTableClass = legendManager.createColorTableClass(className, value, interpolation, color);
110
                            colorTableClasses.add(colorTableClass);
111
                        }
112
                        String colorTableName = rasterGdalProvider.getName() + "_color_table";
113
                        colorTable = legendManager.createColorTable(colorTableName,
114
                            colorTableClasses, true);
115
                        //FIXME: De momento devolvemos el primero solo.
116
                        return colorTable;
117
                    }
118
                }
119

  
120
            }
121
       } catch (DynMethodNotSupportedException e) {
122
           //FIXME
123
           throw new RuntimeException(e);
124
       }
125
       return null;
126
    }
127

  
128
    @Override
129
    public Object clone() throws CloneNotSupportedException {
130
        return super.clone();
131
    }
132
}
trunk/org.gvsig.gdal2/org.gvsig.gdal2.prov/org.gvsig.gdal2.prov.raster.legend/src/main/java/org/gvsig/raster/gdal/provider/legend/RasterGdalGetLegend.java
1
package org.gvsig.raster.gdal.provider.legend;
2

  
3
import org.gvsig.fmap.dal.raster.api.RasterStore;
4
import org.gvsig.raster.gdal.provider.AbstractRasterGdalStoreProvider;
5
import org.gvsig.raster.lib.legend.api.RasterLegend;
6
import org.gvsig.raster.lib.legend.api.RasterLegendLocator;
7
import org.gvsig.raster.lib.legend.api.RasterLegendManager;
8
import org.gvsig.raster.lib.legend.api.colorinterpretation.ColorInterpretation;
9
import org.gvsig.raster.lib.legend.api.colortable.ColorTable;
10
import org.gvsig.tools.ToolsLocator;
11
import org.gvsig.tools.dynobject.DynClass;
12
import org.gvsig.tools.dynobject.DynMethod;
13
import org.gvsig.tools.dynobject.DynObject;
14
import org.gvsig.tools.dynobject.exception.DynMethodException;
15
import org.gvsig.tools.dynobject.exception.DynMethodNotSupportedException;
16

  
17
/**
18
 * Dynamic method to add a get Legend funcionality
19
 * @author dmartinezizquierdo
20
 *
21
 */
22
public class RasterGdalGetLegend implements DynMethod {
23

  
24
    private static Integer code = null;
25

  
26

  
27
    static void register(DynClass storeClass) {
28
        if (code != null) {
29
            return;
30
        }
31
        code = ToolsLocator.getDynObjectManager()
32
                .registerDynMethod(storeClass, new RasterGdalGetLegend());
33

  
34
    }
35

  
36
    @Override
37
    public int getCode() throws DynMethodNotSupportedException {
38
        return code;
39
    }
40

  
41
    @Override
42
    public String getDescription() {
43
        return "Raster GDAL Legend";
44
    }
45

  
46
    @Override
47
    public String getName() {
48
        return RasterStore.DYNMETHOD_GETLEGEND_NAME;
49
    }
50

  
51
    @Override
52
    public Object invoke(DynObject self, Object[] args)
53
            throws DynMethodException {
54
        try {
55
             AbstractRasterGdalStoreProvider rasterGdalProvider=(AbstractRasterGdalStoreProvider)self;
56
             RasterLegendManager legendManager=RasterLegendLocator.getRasterLegendManager();
57

  
58
             ColorInterpretation colorInterpretation =(ColorInterpretation)rasterGdalProvider.
59
                 invokeDynMethod(RasterStore.DYNMETHOD_GETCOLORINTERPRETATION_NAME, null);
60

  
61
             RasterLegend legend= legendManager.createLegend(colorInterpretation);
62
//             if ( !( colorInterpretation.isBGR() || colorInterpretation.isRGB() || colorInterpretation.isRGBA() ) ){
63
//                 ColorTable colorTable=(ColorTable)rasterGdalProvider.
64
//                     invokeDynMethod(RasterStore.DYNMETHOD_GETCOLORTABLE_NAME, null);
65
//                 legend.setColorTable(colorTable);
66
//             }
67

  
68
             return legend;
69

  
70
        } catch (DynMethodNotSupportedException e) {
71
            //FIXME
72
            throw new RuntimeException(e);
73
        }
74
    }
75

  
76
    @Override
77
    public Object clone() throws CloneNotSupportedException {
78
        return super.clone();
79
    }
80
}
trunk/org.gvsig.gdal2/org.gvsig.gdal2.prov/org.gvsig.gdal2.prov.raster.legend/src/main/java/org/gvsig/raster/gdal/provider/legend/RasterGdalLegendLibrary.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
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 IVER T.I. S.A.   {{Task}}
26
*/
27

  
28
/**
29
 *
30
 */
31
package org.gvsig.raster.gdal.provider.legend;
32

  
33
import org.gvsig.fmap.dal.DALLibrary;
34
import org.gvsig.metadata.MetadataLibrary;
35
import org.gvsig.metadata.MetadataLocator;
36
import org.gvsig.raster.gdal.provider.RasterGdalLibrary;
37
import org.gvsig.raster.gdal.provider.AbstractFileRasterGdalStoreProvider;
38
import org.gvsig.raster.gdal.provider.AbstractRasterGdalStoreProvider;
39
import org.gvsig.tools.dynobject.DynClass;
40
import org.gvsig.tools.library.AbstractLibrary;
41
import org.gvsig.tools.library.LibraryException;
42

  
43
/**
44
 * @author dmartinez
45
 *
46
 */
47
public class RasterGdalLegendLibrary extends AbstractLibrary {
48

  
49
    @Override
50
    public void doRegistration() {
51
        registerAsServiceOf(DALLibrary.class);
52
        require(RasterGdalLibrary.class);
53
        require(MetadataLibrary.class);
54
        require(DALLibrary.class);
55
    }
56

  
57
	@Override
58
	protected void doInitialize() throws LibraryException {
59
	}
60

  
61
	@Override
62
	protected void doPostInitialize() throws LibraryException {
63
		DynClass metadataDefinition = (DynClass) MetadataLocator.getMetadataManager()
64
			.getDefinition(AbstractRasterGdalStoreProvider.METADATA_DEFINITION_NAME);
65
		RasterGdalGetLegend.register(metadataDefinition);
66
		RasterGdalGetColorInterpretation.register(metadataDefinition);
67
	}
68
}
trunk/org.gvsig.gdal2/org.gvsig.gdal2.prov/org.gvsig.gdal2.prov.raster.legend/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
 <modelVersion>4.0.0</modelVersion>
4
 <parent>
5
  <groupId>org.gvsig</groupId>
6
  <artifactId>org.gvsig.gdal2.prov</artifactId>
7
  <version>2.2.0-SNAPSHOT</version>
8
 </parent>
9
 <artifactId>org.gvsig.gdal2.prov.raster.legend</artifactId>
10
 <name>${project.artifactId}</name>
11
 <description>Legend provider for raster gdal</description>
12

  
13
 <dependencies>
14
<!--
15
  <dependency>
16
   <groupId>org.gvsig</groupId>
17
   <artifactId>org.gvsig.raster.gdal.provider</artifactId>
18
   <scope>compile</scope>
19
  </dependency>
20
  -->
21
  <dependency>
22
   <groupId>org.gvsig</groupId>
23
   <artifactId>org.gvsig.raster.lib.legend.api</artifactId>
24
   <scope>compile</scope>
25
  </dependency>
26
 </dependencies>
27
</project>
trunk/org.gvsig.gdal2/org.gvsig.gdal2.prov/org.gvsig.gdal2.prov.gml/pom.xml
1 1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
	<modelVersion>4.0.0</modelVersion>
3
	<parent>
4
		<groupId>org.gvsig</groupId>
5
		<artifactId>org.gvsig.gdal2.prov</artifactId>
6
    <version>2.2.0-SNAPSHOT</version>
7
	</parent>
8
	<artifactId>org.gvsig.gdal2.prov.gml</artifactId>
9
  <name>${project.artifactId}</name>
2
    <modelVersion>4.0.0</modelVersion>
3
    <parent>
4
        <groupId>org.gvsig</groupId>
5
        <artifactId>org.gvsig.gdal2.prov</artifactId>
6
        <version>2.2.0-SNAPSHOT</version>
7
    </parent>
8
    <artifactId>org.gvsig.gdal2.prov.gml</artifactId>
9
    <name>${project.artifactId}</name>
10 10

  
11
	<dependencies>
12
		<dependency>
13
			<groupId>org.gvsig</groupId>
14
			<artifactId>org.gvsig.gdal2.prov.ogr</artifactId>
15
      <scope>compile</scope>
16
    </dependency>
17
		<dependency>
18
			<groupId>org.gdal</groupId>
19
			<artifactId>gdal</artifactId>
20
      <scope>compile</scope>
21
    </dependency>
22
	</dependencies>
11
    <dependencies>
12
        <dependency>
13
            <groupId>org.gvsig</groupId>
14
            <artifactId>org.gvsig.gdal2.prov.ogr</artifactId>
15
            <scope>compile</scope>
16
        </dependency>
17
        <dependency>
18
            <groupId>org.gdal</groupId>
19
            <artifactId>gdal</artifactId>
20
            <scope>compile</scope>
21
        </dependency>
22
    </dependencies>
23 23

  
24 24
</project>
trunk/org.gvsig.gdal2/org.gvsig.gdal2.prov/org.gvsig.gdal2.prov.raster/src/test/java/org/gvsig/raster/gdal/provider/RasterGdalStoreProviderTest.java
1
package org.gvsig.raster.gdal.provider;
2

  
3
import java.io.File;
4
import java.net.URL;
5

  
6
import org.cresques.cts.IProjection;
7

  
8
import org.gvsig.fmap.crs.CRSFactory;
9
import org.gvsig.fmap.dal.DALLocator;
10
import org.gvsig.fmap.dal.DataManager;
11
import org.gvsig.fmap.dal.DataServerExplorer;
12
import org.gvsig.fmap.dal.DataServerExplorerParameters;
13
import org.gvsig.fmap.dal.raster.api.NewRasterStoreParameters;
14
import org.gvsig.fmap.dal.raster.api.RasterStore;
15
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
16
import org.gvsig.fmap.dal.spi.DALSPILocator;
17
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
18
import org.gvsig.raster.lib.buffer.api.Buffer;
19
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
20

  
21
public class RasterGdalStoreProviderTest extends AbstractLibraryAutoInitTestCase {
22

  
23
    @Override
24
    protected void doSetUp() throws Exception {
25

  
26

  
27
    }
28

  
29
    /**
30
     * Tries to copy an store into a new one using gdal provider
31
     * @throws Exception
32
     */
33
    public void testGdalCopyStore() throws Exception{
34
        IProjection projection = CRSFactory.getCRS("EPSG:23030");
35
        final URL url = this.getClass().getResource("/pathcv.png");
36
        //The store is created using the PNG provider
37
        String openingProviderName="PNG";
38
        File openedFile=new File(url.toURI());
39
        //The store is copied using the GTiff provider
40
        String storingProviderName="GTiff";
41
        String extension="tif";
42
        File destFile=new File(openedFile.getParentFile(), "copiedFile."+extension);
43

  
44
        DataManager dataManager = DALLocator.getDataManager();
45
        try {
46
            //Opening the store
47
            RasterGdalStoreProviderFactory gdalFactory=
48
                (RasterGdalStoreProviderFactory)dataManager.getStoreProviderFactory(openingProviderName);
49
            RasterGdalFileStoreParameters openParams = (RasterGdalFileStoreParameters)gdalFactory.createParameters();
50
            openParams.setFile(openedFile);
51
            openParams.setCRS(projection);
52

  
53
            RasterStore store=null;
54
            store = (RasterStore) dataManager.openStore(openingProviderName,openParams);
55
            assertNotNull(store);
56

  
57
            //The store is opened and must be copied
58
            DataManagerProviderServices manager=DALSPILocator.getDataManagerProviderServices();
59
            DataServerExplorerParameters eparams = manager.createServerExplorerParameters("FilesystemExplorer");
60
            eparams.setDynValue("initialpath","/");
61
            DataServerExplorer serverExplorer= manager.createServerExplorer(eparams);
62

  
63
            NewRasterStoreParameters newStoreParams =(NewRasterStoreParameters) serverExplorer.getAddParameters(storingProviderName);
64
            if (newStoreParams instanceof FilesystemStoreParameters) {
65
                ((FilesystemStoreParameters) newStoreParams).setFile(destFile);
66
            }
67
            if (newStoreParams instanceof NewRasterStoreParameters) {
68
                Buffer buffer = store.getRasterSet().clip(store.getEnvelope());
69
                ((NewRasterStoreParameters) newStoreParams).setBuffer(buffer);
70
            }
71
            if (newStoreParams.hasDynValue("compress")) {
72
                newStoreParams.setDynValue("compress", "NONE");
73
            }
74
            if (newStoreParams.hasDynValue("tfw")) {
75
                newStoreParams.setDynValue("tfw", true);
76
            }
77
            if (newStoreParams.hasDynValue("photometric")) {
78
                newStoreParams.setDynValue("photometric", "RGB");
79
            }
80

  
81

  
82
            if (newStoreParams.isValid() ) {
83
                serverExplorer.add(storingProviderName, newStoreParams, true);
84
            }
85
            assert(destFile.exists());
86

  
87
        }catch (Exception e){
88
            fail("Exception happened: "+e.getMessage());
89
        }finally{
90
            if (destFile!=null && destFile.exists()){
91
                destFile.delete();
92
            }
93
        }
94

  
95
    }
96

  
97
}
trunk/org.gvsig.gdal2/org.gvsig.gdal2.prov/org.gvsig.gdal2.prov.raster/src/main/resources/org/gvsig/raster/gdal/provider/RasterGdalParameters.xml
1
<?xml version="1.0"?>
2
<definitions>
3
  <version>1.0.0</version>
4
  <classes>
5

  
6
    <!-- Parent Classes -->
7
    <class name="RasterGdalStoreParameters">
8
       <extends>
9
        <class namespace="dal" name="ProviderParameters"/>
10
      </extends>
11
      <description>Store the parameters need to open a non-file gdal</description>
12
      <fields>
13
        <field name="crs" type="crs" mandatory="true" group="Basic">
14
          <description>The coordinate reference system used in this file</description>
15
        </field>
16
        <field name="wldParams" type="object" mandatory="false" group="Basic" classOfValue="java.util.List">
17
          <description>Info given by a wld file with geolocation</description>
18
        </field>
19
      </fields>
20
    </class>
21

  
22
    <class name="RasterGdalFileStoreParameters">
23
       <extends>
24
        <class name="RasterGdalStoreParameters"/>
25
      </extends>
26
      <description>Store the parameters need to open a gdal file</description>
27
      <fields>
28
        <field name="file" type="file" mandatory="true" group="Basic">
29
          <description>Raster Gdal file</description>
30
        </field>
31
      </fields>
32
    </class>
33

  
34
    <!-- Non-file classes -->
35
     <class name="RasterGdalStoreParameters_PostGISRaster">
36
      <extends>
37
        <class name="RasterGdalStoreParameters"/>
38
      </extends>
39
      <description>Store the parameters need to open a raster using PostGISRaster driver</description>
40
      <fields>
41
        <field name="subdataset" type="integer" mandatory="false" group="OpenOptions">
42
          <description>Raster subdataset</description>
43
        </field>
44
        <field name="host" type="string" mandatory="true" group="OpenOptions">
45
          <description>Database host where the raster can be found</description>
46
        </field>
47
        <field name="dbname" type="string" mandatory="true" group="OpenOptions">
48
          <description>Database name where the raster can be found</description>
49
        </field>
50
        <field name="table" type="string" mandatory="true" group="OpenOptions">
51
          <description>Database table where the raster can be found</description>
52
        </field>
53
        <field name="schema" type="string" mandatory="false" group="OpenOptions">
54
          <description>Database schema where the raster can be found</description>
55
        </field>
56
        <field name="user" type="string" mandatory="false" group="OpenOptions">
57
          <description>User for the Database where the raster can be found</description>
58
        </field>
59
        <field name="password" type="string" mandatory="false" group="OpenOptions">
60
          <description>Password for the user</description>
61
        </field>
62
        <field name="port" type="integer" mandatory="false" group="OpenOptions">
63
          <description>Port number for the Database where the raster can be found</description>
64
        </field>
65
      </fields>
66
    </class>
67

  
68
    <class name="RasterGdalStoreParameters_WCS">
69
      <extends>
70
        <class name="RasterGdalStoreParameters"/>
71
      </extends>
72
      <description>Store the parameters need to open a raster using WCS driver</description>
73
      <fields>
74
        <field name="subdataset" type="integer" mandatory="false" group="OpenOptions">
75
          <description>Raster subdataset</description>
76
        </field>
77
        <field name="url" type="url" mandatory="true" group="OpenOptions">
78
          <description>URL to access the raster</description>
79
        </field>
80
        <field name="coverage" type="string" mandatory="true" group="OpenOptions">
81
          <description>Coverage name</description>
82
        </field>
83
      </fields>
84
    </class>
85

  
86
    <class name="RasterGdalStoreParameters_WMS">
87
      <extends>
88
        <class name="RasterGdalStoreParameters"/>
89
      </extends>
90
      <description>Store the parameters need to open a raster using WMS driver</description>
91
      <fields>
92
        <field name="subdataset" type="integer" mandatory="false" group="OpenOptions">
93
          <description>Raster subdataset</description>
94
        </field>
95
      </fields>
96
    </class>
97

  
98

  
99
    <!-- File Classes -->
100

  
101
    <class name="RasterGdalFileStoreParameters_GTiff">
102
      <tags>
103
        <valueItem name="validExtensions" value="tif,tiff"/>
104
        <valueItem name="wldExtension" value="tfw"/>
105
      </tags>
106
      <extends>
107
        <class name="RasterGdalFileStoreParameters"/>
108
      </extends>
109
      <description>Store the parameters need to open a gdal file using GTiff driver</description>
110
      <fields>
111
        <field name="subdataset" type="integer" mandatory="false" group="OpenOptions">
112
          <description>Raster subdataset</description>
113
        </field>
114
      </fields>
115
    </class>
116

  
117
    <class name="RasterGdalFileStoreParameters_JPEG">
118
      <tags>
119
        <valueItem name="validExtensions" value="jpg,jpeg"/>
120
        <valueItem name="wldExtension" value="jpgw"/>
121
      </tags>
122
      <extends>
123
        <class name="RasterGdalFileStoreParameters"/>
124
      </extends>
125
      <description>Store the parameters need to open a jpeg file using JPEG driver</description>
126
      <fields>
127
      </fields>
128
    </class>
129

  
130
    <class name="RasterGdalFileStoreParameters_ILWIS">
131
      <tags>
132
        <valueItem name="validExtensions" value="mpr,mpl"/>
133
      </tags>
134
      <extends>
135
        <class name="RasterGdalFileStoreParameters"/>
136
      </extends>
137
      <description>Store the parameters need to open files using ILWIS driver</description>
138
      <fields>
139
      </fields>
140
    </class>
141

  
142
    <class name="RasterGdalFileStoreParameters_PNM">
143
      <tags>
144
        <valueItem name="validExtensions" value="pgm,ppm"/>
145
      </tags>
146
      <extends>
147
        <class name="RasterGdalFileStoreParameters"/>
148
      </extends>
149
      <description>Store the parameters need to open files using PNM driver</description>
150
      <fields>
151
      </fields>
152
    </class>
153

  
154
    <class name="RasterGdalFileStoreParameters_RMF">
155
      <tags>
156
        <valueItem name="validExtensions" value="rmf"/>
157
      </tags>
158
      <extends>
159
        <class name="RasterGdalFileStoreParameters"/>
160
      </extends>
161
      <description>Store the parameters need to open files using RMF driver</description>
162
      <fields>
163
      </fields>
164
    </class>
165

  
166
    <class name="RasterGdalFileStoreParameters_PDF">
167
      <extends>
168
        <class name="RasterGdalFileStoreParameters"/>
169
      </extends>
170
      <description>Store the parameters need to open a gdal file using PDF driver</description>
171
      <fields>
172
        <field name="subdataset" type="string" mandatory="false" group="OpenOptions">
173
          <description>Raster subdataset</description>
174
        </field>
175
      </fields>
176
    </class>
177

  
178
    <class name="RasterGdalFileStoreParameters_NITF">
179
      <extends>
180
        <class name="RasterGdalFileStoreParameters"/>
181
      </extends>
182
      <description>Store the parameters need to open a gdal file using NITF driver</description>
183
      <fields>
184
        <field name="subdataset" type="integer" mandatory="false" group="OpenOptions">
185
          <description>Raster subdataset</description>
186
        </field>
187
      </fields>
188
    </class>
189

  
190
    <class name="RasterGdalFileStoreParameters_RPFTOC">
191
      <extends>
192
        <class name="RasterGdalFileStoreParameters"/>
193
      </extends>
194
      <description>Store the parameters need to open a gdal file using RPFTOC driver</description>
195
      <fields>
196
        <field name="subdataset" type="integer" mandatory="false" group="OpenOptions">
197
          <description>Raster subdataset</description>
198
        </field>
199
      </fields>
200
    </class>
201

  
202
    <class name="RasterGdalFileStoreParameters_ECRGTOC">
203
      <extends>
204
        <class name="RasterGdalFileStoreParameters"/>
205
      </extends>
206
      <description>Store the parameters need to open a gdal file using ECRGTOC driver</description>
207
      <fields>
208
        <field name="subdataset" type="integer" mandatory="false" group="OpenOptions">
209
          <description>Raster subdataset</description>
210
        </field>
211
      </fields>
212
    </class>
213

  
214
    <class name="RasterGdalFileStoreParameters_OGDI">
215
      <extends>
216
        <class name="RasterGdalFileStoreParameters"/>
217
      </extends>
218
      <description>Store the parameters need to open a gdal file using OGDI driver</description>
219
      <fields>
220
        <field name="subdataset" type="integer" mandatory="false" group="OpenOptions">
221
          <description>Raster subdataset</description>
222
        </field>
223
      </fields>
224
    </class>
225

  
226
    <class name="RasterGdalFileStoreParameters_RS2">
227
      <extends>
228
        <class name="RasterGdalFileStoreParameters"/>
229
      </extends>
230
      <description>Store the parameters need to open a gdal file using RS2 driver</description>
231
      <fields>
232
        <field name="subdataset" type="integer" mandatory="false" group="OpenOptions">
233
          <description>Raster subdataset</description>
234
        </field>
235
      </fields>
236
    </class>
237

  
238
    <class name="RasterGdalFileStoreParameters_netCDF">
239
      <extends>
240
        <class name="RasterGdalFileStoreParameters"/>
241
      </extends>
242
      <description>Store the parameters need to open a gdal file using netCDF driver</description>
243
      <fields>
244
        <field name="subdataset" type="integer" mandatory="false" group="OpenOptions">
245
          <description>Raster subdataset</description>
246
        </field>
247
      </fields>
248
    </class>
249

  
250
    <class name="RasterGdalFileStoreParameters_HDF4">
251
      <extends>
252
        <class name="RasterGdalFileStoreParameters"/>
253
      </extends>
254
      <description>Store the parameters need to open a gdal file using HDF4 driver</description>
255
      <fields>
256
        <field name="subdataset" type="integer" mandatory="false" group="OpenOptions">
257
          <description>Raster subdataset</description>
258
        </field>
259
      </fields>
260
    </class>
261

  
262
    <class name="RasterGdalFileStoreParameters_L1B">
263
      <extends>
264
        <class name="RasterGdalFileStoreParameters"/>
265
      </extends>
266
      <description>Store the parameters need to open a gdal file using L1B driver</description>
267
      <fields>
268
        <field name="subdataset" type="integer" mandatory="false" group="OpenOptions">
269
          <description>Raster subdataset</description>
270
        </field>
271
      </fields>
272
    </class>
273

  
274
    <class name="RasterGdalFileStoreParameters_NTv2">
275
      <extends>
276
        <class name="RasterGdalFileStoreParameters"/>
277
      </extends>
278
      <description>Store the parameters need to open a gdal file using NTv2 driver</description>
279
      <fields>
280
        <field name="subdataset" type="integer" mandatory="false" group="OpenOptions">
281
          <description>Raster subdataset</description>
282
        </field>
283
      </fields>
284
    </class>
285

  
286
    <class name="RasterGdalFileStoreParameters_HDF5">
287
      <extends>
288
        <class name="RasterGdalFileStoreParameters"/>
289
      </extends>
290
      <description>Store the parameters need to open a gdal file using HDF5 driver</description>
291
      <fields>
292
        <field name="subdataset" type="integer" mandatory="false" group="OpenOptions">
293
          <description>Raster subdataset</description>
294
        </field>
295
      </fields>
296
    </class>
297

  
298
    <class name="RasterGdalFileStoreParameters_ADRG">
299
      <extends>
300
        <class name="RasterGdalFileStoreParameters"/>
301
      </extends>
302
      <description>Store the parameters need to open a gdal file using ADRG driver</description>
303
      <fields>
304
        <field name="subdataset" type="integer" mandatory="false" group="OpenOptions">
305
          <description>Raster subdataset</description>
306
        </field>
307
      </fields>
308
    </class>
309

  
310
    <class name="RasterGdalFileStoreParameters_SRP">
311
      <extends>
312
        <class name="RasterGdalFileStoreParameters"/>
313
      </extends>
314
      <description>Store the parameters need to open a gdal file using SRP driver</description>
315
      <fields>
316
        <field name="subdataset" type="integer" mandatory="false" group="OpenOptions">
317
          <description>Raster subdataset</description>
318
        </field>
319
      </fields>
320
    </class>
321

  
322
    <class name="RasterGdalFileStoreParameters_Rasterlite">
323
      <extends>
324
        <class name="RasterGdalFileStoreParameters"/>
325
      </extends>
326
      <description>Store the parameters need to open a gdal file using Rasterlite driver</description>
327
      <fields>
328
        <field name="subdataset" type="integer" mandatory="false" group="OpenOptions">
329
          <description>Raster subdataset</description>
330
        </field>
331
      </fields>
332
    </class>
333

  
334
  </classes>
335
</definitions>
trunk/org.gvsig.gdal2/org.gvsig.gdal2.prov/org.gvsig.gdal2.prov.raster/src/main/resources/org/gvsig/raster/gdal/provider/NewRasterGdalStoreParameters.xml
1
<?xml version="1.0"?>
2
<definitions>
3
  <version>1.0.0</version>
4
  <classes>
5

  
6
    <class namespace="dal" name="NewRasterGdalStoreParameters">
7
      <extends>
8
        <class namespace="dal" name="ProviderParameters" />
9
      </extends>
10
      <description>Store the parameters needed to create a new gdal file
11
      </description>
12
      <fields>
13
        <field name="file" type="file" mandatory="true" group="Basic">
14
          <description>Raster Gdal file to be created</description>
15
        </field>
16
        <field name="crs" type="crs" mandatory="false" group="Basic">
17
          <description>The coordinate reference system used in this file</description>
18
        </field>
19
      </fields>
20
    </class>
21

  
22
    <class namespace="dal" name="NewRasterGdalStoreParameters_GTiff">
23
      <tags>
24
        <valueItem name="wldExtension" value="tfw" />
25
      </tags>
26
      <extends>
27
        <class namespace="dal" name="NewRasterGdalStoreParameters" />
28
      </extends>
29
      <description>Store the parameters needed to create a new gdal file using
30
        GTiff driver
31
      </description>
32
      <fields>
33
        <field name="compress" type="string" mandatory="false" group="CreateOptions" defaultValue="">
34
          <description>Property given to GTiff driver to indicate compress type
35
          </description>
36
          <tags>
37
            <valueItem name="dynform.translateEmptyToNull" value="true"/>
38
          </tags>
39

  
40
          <availableValues>
41
            <value label="NONE">NONE</value>
42
            <value label="LZW">LZW</value>
43
            <value label="PACKBITS">PACKBITS</value>
44
            <value label="JPEG">JPEG</value>
45
            <value label="CCITTRLE">CCITTRLE</value>
46
            <value label="CCITTFAX3">CCITTFAX3</value>
47
            <value label="CCITTFAX4">CCITTFAX4</value>
48
            <value label="DEFLATE">DEFLATE</value>
49
            <value label="LZMA">LZMA</value>
50
            <value label=""></value>
51

  
52
          </availableValues>
53
        </field>
54
        <field name="predictor" type="integer" mandatory="false" group="CreateOptions">
55
          <description>Predictor Type</description>
56
        </field>
57
        <field name="jpeg_quality" type="integer" mandatory="false"
58
          group="CreateOptions" minValue="1" maxValue="100" defaultValue="75">
59
          <description>JPEG quality</description>
60
        </field>
61
        <field name="zlevel" type="integer" mandatory="false" group="CreateOptions"
62
          minValue="1" maxValue="9" defaultValue="6">
63
          <description>DEFLATE compression level 1-9 </description>
64
        </field>
65
        <field name="lzma_preset" type="integer" mandatory="false" group="CreateOptions"
66
          minValue="0" maxValue="9" defaultValue="6">
67
          <description>LZMA compression level 0(fast)-9(slow)</description>
68
        </field>
69
        <field name="nbits" type="integer" mandatory="false" minValue="1"
70
          maxValue="31" group="CreateOptions">
71
          <description>BITS for sub-byte files (1-7), sub-uint16 (9-15),
72
            sub-uint32 (17-31)</description>
73
        </field>
74
        <field name="interleave" type="string" mandatory="false" group="CreateOptions"
75
          defaultValue="PIXEL">
76
          <description>Property given to GTiff driver to indicate interleave
77
          </description>
78
          <availableValues>
79
            <value label="BAND">BAND</value>
80
            <value label="PIXEL">PIXEL</value>
81
          </availableValues>
82
        </field>
83
        <field name="tiled" type="boolean" mandatory="false" group="CreateOptions">
84
          <description>Switch to tiled format</description>
85
        </field>
86
        <field name="tfw" type="boolean" mandatory="false" group="CreateOptions">
87
          <description>Write out world file</description>
88
        </field>
89
        <field name="rpb" type="boolean" mandatory="false" group="CreateOptions">
90
          <description>Write out .RPB (RPC) file</description>
91
        </field>
92
        <field name="blockxsize" type="integer" mandatory="false" group="CreateOptions">
93
          <description>Tile Width</description>
94
        </field>
95
        <field name="blockysize" type="integer" mandatory="false" group="CreateOptions">
96
          <description>Tile/Strip Height</description>
97
        </field>
98
        <field name="photometric" type="string" mandatory="false" group="CreateOptions"
99
          defaultValue="">
100
          <description>Property given to GTiff driver to indicate photometric
101
          </description>
102
          <tags>
103
            <valueItem name="dynform.translateEmptyToNull" value="true" />
104
          </tags>
105

  
106
          <availableValues>
107
            <value label="MINISBLACK">MINISBLACK</value>
108
            <value label="MINISWHITE">MINISWHITE</value>
109
            <value label="PALETTE">PALETTE</value>
110
            <value label="RGB">RGB</value>
111
            <value label="CMYK">CMYK</value>
112
            <value label="YCBCR">YCBCR</value>
113
            <value label="CIELAB">CIELAB</value>
114
            <value label="ICCLAB">ICCLAB</value>
115
            <value label="ITULAB">ITULAB</value>
116
            <value label=""></value>
117

  
118
          </availableValues>
119
        </field>
120
        <field name="sparse_ok" type="boolean" mandatory="false" group="CreateOptions"
121
          defaultValue="false">
122
          <description>Can newly created files have missing blocks?
123
          </description>
124
        </field>
125
        <field name="alpha" type="string" mandatory="false" group="CreateOptions"
126
          defaultValue="">
127
          <description>Mark first extrasample as being alpha</description>
128
          <tags>
129
            <valueItem name="dynform.translateEmptyToNull" value="true" />
130
          </tags>
131

  
132
          <availableValues>
133
            <value label="NON-PREMULTIPLIED">NON-PREMULTIPLIED</value>
134
            <value label="PREMULTIPLIED">PREMULTIPLIED</value>
135
            <value label="UNSPECIFIED">UNSPECIFIED</value>
136
            <value label=""></value>
137

  
138
          </availableValues>
139
        </field>
140
        <field name="profile" type="string" mandatory="false" group="CreateOptions"
141
          defaultValue="GDALGeoTIFF">
142
          <description>Mark first extrasample as being alpha</description>
143
          <availableValues>
144
            <value label="GDALGeoTIFF">GDALGeoTIFF</value>
145
            <value label="GeoTIFF">GeoTIFF</value>
146
            <value label="BASELINE">BASELINE</value>
147
          </availableValues>
148
        </field>
149
        <field name="pixeltype" type="string" mandatory="false" group="CreateOptions"
150
          defaultValue="">
151
          <description>Property given to GTiff driver to indicate pixel type
152
          </description>
153
          <tags>
154
            <valueItem name="dynform.translateEmptyToNull" value="true" />
155
          </tags>
156

  
157
          <availableValues>
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff