Revision 6659
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.lib/org.gvsig.raster.tools.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.raster.tools.lib.impl.DefaultRasterToolsLibrary |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.lib/org.gvsig.raster.tools.lib.impl/src/main/java/org/gvsig/raster/tools/lib/impl/DefaultRasterClip.java | ||
---|---|---|
1 |
package org.gvsig.raster.tools.lib.impl; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.util.List; |
|
5 |
|
|
6 |
import org.cresques.cts.ICoordTrans; |
|
7 |
|
|
8 |
import org.gvsig.fmap.dal.exception.DataException; |
|
9 |
import org.gvsig.fmap.dal.raster.api.BandDescriptor; |
|
10 |
import org.gvsig.fmap.dal.raster.api.BandQuery; |
|
11 |
import org.gvsig.fmap.dal.raster.api.RasterQuery; |
|
12 |
import org.gvsig.fmap.dal.raster.api.RasterSet; |
|
13 |
import org.gvsig.fmap.dal.raster.api.RasterStore; |
|
14 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
15 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
16 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
17 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
|
18 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
19 |
import org.gvsig.fmap.mapcontext.raster.api.RasterLayer; |
|
20 |
import org.gvsig.raster.lib.buffer.api.Buffer; |
|
21 |
import org.gvsig.raster.lib.buffer.api.exceptions.BufferException; |
|
22 |
import org.gvsig.raster.tools.lib.api.RasterClip; |
|
23 |
import org.gvsig.raster.tools.lib.api.exceptions.ClipException; |
|
24 |
import org.gvsig.tools.locator.LocatorException; |
|
25 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
26 |
|
|
27 |
|
|
28 |
/** |
|
29 |
* @author fdiaz |
|
30 |
* |
|
31 |
*/ |
|
32 |
public class DefaultRasterClip implements RasterClip { |
|
33 |
|
|
34 |
private RasterLayer layer; |
|
35 |
private Envelope envelope; |
|
36 |
private double pixelSizeX; |
|
37 |
private int interpolationMethod; |
|
38 |
private List<Integer> bands; |
|
39 |
private String layerNamePrefix; |
|
40 |
private boolean createOneLayerPerBand; |
|
41 |
private boolean saveToNewRasterFile; |
|
42 |
private File folder; |
|
43 |
private double pixelSizeY; |
|
44 |
private int columns; |
|
45 |
private int rows; |
|
46 |
|
|
47 |
|
|
48 |
/** |
|
49 |
* @param layer |
|
50 |
* @param envelope |
|
51 |
* @param pixelSizeX |
|
52 |
* @param pixelSizeY |
|
53 |
* @param columns |
|
54 |
* @param rows |
|
55 |
* @param interpolationMethod |
|
56 |
* @param bands |
|
57 |
* @param layerNamePrefix |
|
58 |
* @param createOneLayerPerBand |
|
59 |
*/ |
|
60 |
public DefaultRasterClip(RasterLayer layer, Envelope envelope, double pixelSizeX, double pixelSizeY, int columns, int rows, int interpolationMethod, |
|
61 |
List<Integer> bands, String layerNamePrefix, boolean createOneLayerPerBand) { |
|
62 |
this.layer = layer; |
|
63 |
this.envelope = envelope; |
|
64 |
this.pixelSizeX = pixelSizeX; |
|
65 |
this.pixelSizeY = pixelSizeY; |
|
66 |
this.columns = columns; |
|
67 |
this.rows = rows; |
|
68 |
this.interpolationMethod = interpolationMethod; |
|
69 |
this.bands = bands; |
|
70 |
this.layerNamePrefix = layerNamePrefix; |
|
71 |
this.createOneLayerPerBand = createOneLayerPerBand; |
|
72 |
this.saveToNewRasterFile = false; |
|
73 |
this.folder = null; |
|
74 |
|
|
75 |
} |
|
76 |
|
|
77 |
/** |
|
78 |
* @param layer |
|
79 |
* @param envelope |
|
80 |
* @param pixelSizeX |
|
81 |
* @param pixelSizeY |
|
82 |
* @param columns |
|
83 |
* @param rows |
|
84 |
* @param interpolationMethod |
|
85 |
* @param bands |
|
86 |
* @param layerNamePrefix |
|
87 |
* @param createOneLayerPerBand |
|
88 |
* @param saveToNewRasterFile |
|
89 |
* @param folder |
|
90 |
*/ |
|
91 |
public DefaultRasterClip(RasterLayer layer, Envelope envelope, double pixelSizeX, double pixelSizeY, int columns, int rows, int interpolationMethod, |
|
92 |
List<Integer> bands, String layerNamePrefix, boolean createOneLayerPerBand, boolean saveToNewRasterFile, File folder) { |
|
93 |
|
|
94 |
this(layer, envelope, pixelSizeX, pixelSizeY, columns, rows, interpolationMethod, |
|
95 |
bands, layerNamePrefix, createOneLayerPerBand); |
|
96 |
this.saveToNewRasterFile = saveToNewRasterFile; |
|
97 |
this.folder = folder; |
|
98 |
} |
|
99 |
|
|
100 |
/** |
|
101 |
* @return the layer |
|
102 |
*/ |
|
103 |
public RasterLayer getLayer() { |
|
104 |
return layer; |
|
105 |
} |
|
106 |
|
|
107 |
/** |
|
108 |
* @param layer the layer to set |
|
109 |
*/ |
|
110 |
public void setLayer(RasterLayer layer) { |
|
111 |
this.layer = layer; |
|
112 |
} |
|
113 |
|
|
114 |
@Override |
|
115 |
public void execute(SimpleTaskStatus taskStatus) throws ClipException { |
|
116 |
MapContext mapContext = this.layer.getMapContext(); |
|
117 |
MapContextManager mapContextManager = MapContextLocator.getMapContextManager(); |
|
118 |
ICoordTrans ct = layer.getCoordTrans(); |
|
119 |
|
|
120 |
Envelope reprojectedEnvelope = this.getEnvelope(); |
|
121 |
if (ct != null) { |
|
122 |
try { |
|
123 |
reprojectedEnvelope = (Envelope) reprojectedEnvelope.clone(); |
|
124 |
reprojectedEnvelope = reprojectedEnvelope.convert(ct.getInverted()); |
|
125 |
} catch (CloneNotSupportedException e) { |
|
126 |
throw new ClipException("Can't reproyect the envelope to layer's coordinate reference", e); |
|
127 |
} |
|
128 |
} |
|
129 |
|
|
130 |
double pixelSize = this.getPixelSize() * reprojectedEnvelope.getLength(0) / this.getEnvelope().getLength(0); |
|
131 |
|
|
132 |
RasterQuery rasterQuery = layer.createRasterQuery(); |
|
133 |
rasterQuery.setPixelSize(pixelSize); |
|
134 |
rasterQuery.setClip(reprojectedEnvelope); |
|
135 |
|
|
136 |
RasterStore rasterStore = layer.getRasterStore(); |
|
137 |
for (Integer bandNumber : bands) { |
|
138 |
rasterStore.createBandQuery(bandNumber); |
|
139 |
rasterQuery.addBand(rasterStore.createBandQuery(bandNumber)); |
|
140 |
} |
|
141 |
|
|
142 |
RasterSet rasterSet = null; |
|
143 |
try { |
|
144 |
rasterSet = rasterStore.getRasterSet(rasterQuery); |
|
145 |
} catch (DataException e) { |
|
146 |
throw new ClipException("Can't create the raster clip.", e); |
|
147 |
} |
|
148 |
|
|
149 |
Buffer converted = rasterSet; //.convert(ct.getInverted(), taskStatus); |
|
150 |
if(ct!=null){ |
|
151 |
try { |
|
152 |
converted = rasterSet.convert(ct.getInverted(), taskStatus); |
|
153 |
} catch (BufferException e) { |
|
154 |
throw new ClipException("Can't convert buffer from '"+ct.getPDest().getAbrev()+"' to '"+ct.getPOrig().getAbrev()+"'.", e); |
|
155 |
} |
|
156 |
} |
|
157 |
Buffer interpolated = converted; |
|
158 |
if(converted.getColumns() != this.columns || converted.getRows() != this.rows){ |
|
159 |
try { |
|
160 |
interpolated = converted.createInterpolated(this.rows, this.columns, interpolationMethod, taskStatus); |
|
161 |
} catch (LocatorException | BufferException e) { |
|
162 |
throw new ClipException("Can't interpolate buffer.", e); |
|
163 |
} |
|
164 |
} |
|
165 |
|
|
166 |
// |
|
167 |
// |
|
168 |
// |
|
169 |
// String layerName = layerNamePrefix; |
|
170 |
// int counter = 1; |
|
171 |
// FLayer newLayer = mapContext.getLayers().getLayer(layerName); |
|
172 |
// while (newLayer!=null){ |
|
173 |
// layerName = layerName+"_"+counter; |
|
174 |
// newLayer = mapContext.getLayers().getLayer(layerName); |
|
175 |
// } |
|
176 |
// newLayer = mapContextManager.createLayer(layerName, store); |
|
177 |
|
|
178 |
|
|
179 |
|
|
180 |
} |
|
181 |
|
|
182 |
@Override |
|
183 |
public void setEnvelope(Envelope envelope) { |
|
184 |
this.envelope = envelope; |
|
185 |
} |
|
186 |
|
|
187 |
@Override |
|
188 |
public Envelope getEnvelope() { |
|
189 |
return this.envelope; |
|
190 |
} |
|
191 |
|
|
192 |
@Override |
|
193 |
public void setPixelSize(double pixelSize) { |
|
194 |
this.pixelSizeX = pixelSize; |
|
195 |
} |
|
196 |
|
|
197 |
@Override |
|
198 |
public double getPixelSize() { |
|
199 |
return this.pixelSizeX; |
|
200 |
} |
|
201 |
|
|
202 |
@Override |
|
203 |
public void setInterpolationMethod(int interpolationMethod) { |
|
204 |
this.interpolationMethod = interpolationMethod; |
|
205 |
} |
|
206 |
|
|
207 |
@Override |
|
208 |
public int getInterpolationMethod() { |
|
209 |
return this.interpolationMethod; |
|
210 |
} |
|
211 |
|
|
212 |
@Override |
|
213 |
public void setBands(List<Integer> bands) { |
|
214 |
this.bands = bands; |
|
215 |
} |
|
216 |
|
|
217 |
@Override |
|
218 |
public List<Integer> getBands() { |
|
219 |
return this.bands; |
|
220 |
} |
|
221 |
|
|
222 |
@Override |
|
223 |
public void setLayerNamePrefix(String layerNamePrefix) { |
|
224 |
this.layerNamePrefix = layerNamePrefix; |
|
225 |
} |
|
226 |
|
|
227 |
@Override |
|
228 |
public String getLayerNamePrefix() { |
|
229 |
return this.layerNamePrefix; |
|
230 |
} |
|
231 |
|
|
232 |
@Override |
|
233 |
public void setCreateOneLayerPerBand(boolean createOneLayerPerBand) { |
|
234 |
this.createOneLayerPerBand = createOneLayerPerBand; |
|
235 |
} |
|
236 |
|
|
237 |
@Override |
|
238 |
public boolean isCreateOneLayerPerBand() { |
|
239 |
return this.createOneLayerPerBand; |
|
240 |
} |
|
241 |
|
|
242 |
@Override |
|
243 |
public void setFolder(File folder) { |
|
244 |
this.folder = folder; |
|
245 |
} |
|
246 |
|
|
247 |
@Override |
|
248 |
public File getFolder() { |
|
249 |
return this.folder; |
|
250 |
} |
|
251 |
|
|
252 |
@Override |
|
253 |
public void setSaveToNewRasterFile(boolean saveToNewRasterFile) { |
|
254 |
this.saveToNewRasterFile = saveToNewRasterFile; |
|
255 |
} |
|
256 |
|
|
257 |
@Override |
|
258 |
public boolean isSaveToNewRasterFile() { |
|
259 |
return this.saveToNewRasterFile; |
|
260 |
} |
|
261 |
|
|
262 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.lib/org.gvsig.raster.tools.lib.impl/src/main/java/org/gvsig/raster/tools/lib/impl/DefaultRasterToolsManager.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2017 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.raster.tools.lib.impl; |
|
24 |
|
|
25 |
import java.io.File; |
|
26 |
import java.util.List; |
|
27 |
|
|
28 |
import org.gvsig.fmap.dal.raster.api.BandDescriptor; |
|
29 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
30 |
import org.gvsig.fmap.mapcontext.raster.api.RasterLayer; |
|
31 |
import org.gvsig.raster.tools.lib.api.RasterClip; |
|
32 |
import org.gvsig.raster.tools.lib.api.RasterToolsManager; |
|
33 |
import org.gvsig.tools.dynobject.DynObject; |
|
34 |
import org.gvsig.tools.service.Service; |
|
35 |
import org.gvsig.tools.service.ServiceException; |
|
36 |
|
|
37 |
/** |
|
38 |
* @author fdiaz |
|
39 |
* |
|
40 |
*/ |
|
41 |
public class DefaultRasterToolsManager implements RasterToolsManager { |
|
42 |
|
|
43 |
@Override |
|
44 |
public DynObject createServiceParameters(String serviceName) throws ServiceException { |
|
45 |
return null; |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public Service getService(DynObject parameters) throws ServiceException { |
|
50 |
return null; |
|
51 |
} |
|
52 |
|
|
53 |
@Override |
|
54 |
public RasterClip createRasterClip(RasterLayer layer, Envelope envelope, double pixelSizeX, double pixelSizeY, int columns, int rows, int interpolationMethod, |
|
55 |
List<Integer> bands, String layerNamePrefix, boolean createOneLayerPerBand) { |
|
56 |
|
|
57 |
return new DefaultRasterClip(layer, envelope, pixelSizeX, pixelSizeY, columns, rows, interpolationMethod, bands, layerNamePrefix, |
|
58 |
createOneLayerPerBand); |
|
59 |
} |
|
60 |
|
|
61 |
@Override |
|
62 |
public RasterClip createRasterClip(RasterLayer layer, Envelope envelope, double pixelSizeX, double pixelSizeY, int columns, int rows, int interpolationMethod, |
|
63 |
List<Integer> bands, String layerNamePrefix, boolean createOneLayerPerBand, boolean saveToNewRasterFile, |
|
64 |
File folder) { |
|
65 |
|
|
66 |
return new DefaultRasterClip(layer, envelope, pixelSizeX, pixelSizeY, columns, rows, interpolationMethod, bands, layerNamePrefix, |
|
67 |
createOneLayerPerBand, saveToNewRasterFile, folder); |
|
68 |
} |
|
69 |
|
|
70 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.lib/org.gvsig.raster.tools.lib.impl/src/main/java/org/gvsig/raster/tools/lib/impl/DefaultRasterToolsLibrary.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2017 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.raster.tools.lib.impl; |
|
24 |
|
|
25 |
import org.gvsig.raster.tools.lib.api.RasterToolsLibrary; |
|
26 |
import org.gvsig.raster.tools.lib.api.RasterToolsLocator; |
|
27 |
import org.gvsig.tools.library.LibraryException; |
|
28 |
|
|
29 |
|
|
30 |
/** |
|
31 |
* @author fdiaz |
|
32 |
* |
|
33 |
*/ |
|
34 |
public class DefaultRasterToolsLibrary extends RasterToolsLibrary{ |
|
35 |
|
|
36 |
|
|
37 |
@Override |
|
38 |
public void doRegistration() { |
|
39 |
registerAsImplementationOf(RasterToolsLibrary.class); |
|
40 |
} |
|
41 |
|
|
42 |
@Override |
|
43 |
protected void doInitialize() throws LibraryException { |
|
44 |
RasterToolsLocator |
|
45 |
.registerManager(DefaultRasterToolsManager.class); |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
protected void doPostInitialize() throws LibraryException { |
|
50 |
} |
|
51 |
|
|
52 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.lib/org.gvsig.raster.tools.lib.impl/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.raster.tools.lib</artifactId> |
|
6 |
<version>2.4.1-SNAPSHOT</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.raster.tools.lib.impl</artifactId> |
|
9 |
<name>org.gvsig.raster.tools.lib.impl</name> |
|
10 |
<description>Library Implementation of raster tools of gvSIG</description> |
|
11 |
<dependencies> |
|
12 |
<dependency> |
|
13 |
<groupId>org.gvsig</groupId> |
|
14 |
<artifactId>org.gvsig.raster.tools.lib.api</artifactId> |
|
15 |
</dependency> |
|
16 |
<dependency> |
|
17 |
<groupId>org.gvsig</groupId> |
|
18 |
<artifactId>org.gvsig.fmap.mapcontext.api</artifactId> |
|
19 |
</dependency> |
|
20 |
</dependencies> |
|
21 |
</project> |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.lib/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.raster.tools</artifactId> |
|
7 |
<version>2.4.1-SNAPSHOT</version> |
|
8 |
</parent> |
|
9 |
<artifactId>org.gvsig.raster.tools.lib</artifactId> |
|
10 |
<packaging>pom</packaging> |
|
11 |
<name>org.gvsig.raster.tools.lib</name> |
|
12 |
<description>Library for raster tools of gvSIG</description> |
|
13 |
<modules> |
|
14 |
<module>org.gvsig.raster.tools.lib.api</module> |
|
15 |
<module>org.gvsig.raster.tools.lib.impl</module> |
|
16 |
</modules> |
|
17 |
</project> |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.lib/org.gvsig.raster.tools.lib.api/src/main/java/org/gvsig/raster/tools/lib/api/RasterToolsManager.java | ||
---|---|---|
1 |
package org.gvsig.raster.tools.lib.api; |
|
2 |
/* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright ? 2007-2017 gvSIG Association |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
import java.io.File; |
|
27 |
import java.util.List; |
|
28 |
|
|
29 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
30 |
import org.gvsig.fmap.mapcontext.raster.api.RasterLayer; |
|
31 |
import org.gvsig.tools.service.Manager; |
|
32 |
|
|
33 |
|
|
34 |
/** |
|
35 |
* |
|
36 |
* @see RasterToolsManager |
|
37 |
* @author gvSIG team |
|
38 |
* @version $Id$ |
|
39 |
*/ |
|
40 |
public interface RasterToolsManager extends Manager{ |
|
41 |
|
|
42 |
|
|
43 |
/** |
|
44 |
* @param layer |
|
45 |
* @param envelope |
|
46 |
* @param pixelSizeX |
|
47 |
* @param pixelSizeY |
|
48 |
* @param columns |
|
49 |
* @param rows |
|
50 |
* @param interpolationMethod |
|
51 |
* @param bands |
|
52 |
* @param layerNamePrefix |
|
53 |
* @param createOneLayerPerBand |
|
54 |
* |
|
55 |
* @return Raster clip process |
|
56 |
*/ |
|
57 |
RasterClip createRasterClip(RasterLayer layer, Envelope envelope, double pixelSizeX, double pixelSizeY, int columns, int rows, int interpolationMethod, |
|
58 |
List<Integer> bands, String layerNamePrefix, boolean createOneLayerPerBand); |
|
59 |
|
|
60 |
/** |
|
61 |
* |
|
62 |
* @param layer |
|
63 |
* @param envelope |
|
64 |
* @param pixelSizeX |
|
65 |
* @param pixelSizeY |
|
66 |
* @param columns |
|
67 |
* @param rows |
|
68 |
* @param interpolationMethod |
|
69 |
* @param bands |
|
70 |
* @param layerNamePrefix |
|
71 |
* @param createOneLayerPerBand |
|
72 |
* @param saveToNewRasterFile |
|
73 |
* @param folder |
|
74 |
* |
|
75 |
* @return Raster clip process |
|
76 |
*/ |
|
77 |
RasterClip createRasterClip(RasterLayer layer, Envelope envelope, double pixelSizeX, double pixelSizeY, int columns, int rows, int interpolationMethod, |
|
78 |
List<Integer> bands, String layerNamePrefix, boolean createOneLayerPerBand, boolean saveToNewRasterFile, |
|
79 |
File folder); |
|
80 |
|
|
81 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.lib/org.gvsig.raster.tools.lib.api/src/main/java/org/gvsig/raster/tools/lib/api/exceptions/RasterToolException.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright ? 2007-2014 gvSIG Association |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.raster.tools.lib.api.exceptions; |
|
25 |
|
|
26 |
|
|
27 |
import org.gvsig.tools.exception.BaseException; |
|
28 |
|
|
29 |
/** |
|
30 |
* |
|
31 |
* @author gvSIG team. |
|
32 |
* |
|
33 |
*/ |
|
34 |
public class RasterToolException extends BaseException { |
|
35 |
|
|
36 |
/** |
|
37 |
* |
|
38 |
*/ |
|
39 |
private static final long serialVersionUID = -1043709801185809443L; |
|
40 |
|
|
41 |
private static final String MESSAGE = |
|
42 |
"An error has been produced in the Raster Tools library"; |
|
43 |
|
|
44 |
private static final String KEY = "_RasterToolException"; |
|
45 |
|
|
46 |
/** |
|
47 |
* Constructor to be used in rare cases, usually you must create a new child |
|
48 |
* exception class for each case. |
|
49 |
* <strong>Don't use this constructor in child classes.</strong> |
|
50 |
*/ |
|
51 |
public RasterToolException() { |
|
52 |
super(MESSAGE, KEY, serialVersionUID); |
|
53 |
} |
|
54 |
|
|
55 |
/** |
|
56 |
* Constructor to be used in rare cases, usually you must create a new child |
|
57 |
* exception class for each case. |
|
58 |
* <p> |
|
59 |
* <strong>Don't use this constructor in child classes.</strong> |
|
60 |
* </p> |
|
61 |
* |
|
62 |
* @param cause |
|
63 |
* the original cause of the exception |
|
64 |
*/ |
|
65 |
public RasterToolException(Exception cause) { |
|
66 |
super(MESSAGE, cause, KEY, serialVersionUID); |
|
67 |
} |
|
68 |
|
|
69 |
/** |
|
70 |
* @see BaseException#BaseException(String, String, long). |
|
71 |
* @param message |
|
72 |
* the default messageFormat to describe the exception |
|
73 |
* @param key |
|
74 |
* the key to use to search a localized messageFormnata |
|
75 |
* @param code |
|
76 |
* the unique code to identify the exception |
|
77 |
*/ |
|
78 |
protected RasterToolException(String message, String key, long code) { |
|
79 |
super(message, key, code); |
|
80 |
} |
|
81 |
|
|
82 |
/** |
|
83 |
* @see BaseException#BaseException(String, Throwable, String, long). |
|
84 |
* @param message |
|
85 |
* the default messageFormat to describe the exception |
|
86 |
* @param cause |
|
87 |
* the original cause of the exception |
|
88 |
* @param key |
|
89 |
* the key to use to search a localized messageFormnata |
|
90 |
* @param code |
|
91 |
* the unique code to identify the exception |
|
92 |
*/ |
|
93 |
protected RasterToolException(String message, Throwable cause, |
|
94 |
String key, long code) { |
|
95 |
super(message, cause, key, code); |
|
96 |
} |
|
97 |
|
|
98 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.lib/org.gvsig.raster.tools.lib.api/src/main/java/org/gvsig/raster/tools/lib/api/exceptions/RasterToolGettingParametersException.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright ? 2007-2014 gvSIG Association |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
package org.gvsig.raster.tools.lib.api.exceptions; |
|
26 |
|
|
27 |
public class RasterToolGettingParametersException extends RasterToolException { |
|
28 |
|
|
29 |
/** |
|
30 |
* |
|
31 |
*/ |
|
32 |
private static final long serialVersionUID = -8514929957628779240L; |
|
33 |
|
|
34 |
private static final String MESSAGE = |
|
35 |
"An error has been produced getting tool parameters."; |
|
36 |
|
|
37 |
private static final String KEY = "_RasterToolGettingParametersException"; |
|
38 |
|
|
39 |
public RasterToolGettingParametersException(Throwable ex) { |
|
40 |
super(MESSAGE, ex, KEY, serialVersionUID); |
|
41 |
} |
|
42 |
|
|
43 |
public RasterToolGettingParametersException(String message, Throwable ex) { |
|
44 |
super(message, ex, KEY, serialVersionUID); |
|
45 |
} |
|
46 |
|
|
47 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.lib/org.gvsig.raster.tools.lib.api/src/main/java/org/gvsig/raster/tools/lib/api/exceptions/ClipException.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright ? 2007-2014 gvSIG Association |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
package org.gvsig.raster.tools.lib.api.exceptions; |
|
26 |
|
|
27 |
/** |
|
28 |
* @author fdiaz |
|
29 |
* |
|
30 |
*/ |
|
31 |
public class ClipException extends RasterToolException { |
|
32 |
|
|
33 |
/** |
|
34 |
* |
|
35 |
*/ |
|
36 |
private static final long serialVersionUID = -929801507323507752L; |
|
37 |
|
|
38 |
private static final String MESSAGE = |
|
39 |
"Error clipping raster."; |
|
40 |
|
|
41 |
private static final String KEY = "_ClipException"; |
|
42 |
|
|
43 |
/** |
|
44 |
* @param ex |
|
45 |
*/ |
|
46 |
public ClipException(Throwable ex) { |
|
47 |
super(MESSAGE, ex, KEY, serialVersionUID); |
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* @param message |
|
52 |
* @param ex |
|
53 |
*/ |
|
54 |
public ClipException(String message, Throwable ex) { |
|
55 |
super(message, ex, KEY, serialVersionUID); |
|
56 |
} |
|
57 |
|
|
58 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.lib/org.gvsig.raster.tools.lib.api/src/main/java/org/gvsig/raster/tools/lib/api/exceptions/RasterToolCreatingPanelException.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright ? 2007-2014 gvSIG Association |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
package org.gvsig.raster.tools.lib.api.exceptions; |
|
26 |
|
|
27 |
public class RasterToolCreatingPanelException extends RasterToolException { |
|
28 |
|
|
29 |
/** |
|
30 |
* |
|
31 |
*/ |
|
32 |
private static final long serialVersionUID = 5229972836427176144L; |
|
33 |
|
|
34 |
private static final String MESSAGE = |
|
35 |
"One or more of required parameters are empty."; |
|
36 |
|
|
37 |
private static final String KEY = "_RasterToolNeededParameterException"; |
|
38 |
|
|
39 |
public RasterToolCreatingPanelException(Throwable ex) { |
|
40 |
super(MESSAGE, ex, KEY, serialVersionUID); |
|
41 |
} |
|
42 |
|
|
43 |
public RasterToolCreatingPanelException(String message, Throwable ex) { |
|
44 |
super(message, ex, KEY, serialVersionUID); |
|
45 |
} |
|
46 |
|
|
47 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.lib/org.gvsig.raster.tools.lib.api/src/main/java/org/gvsig/raster/tools/lib/api/RasterToolsLocator.java | ||
---|---|---|
1 |
package org.gvsig.raster.tools.lib.api; |
|
2 |
/* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright ? 2007-2017 gvSIG Association |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
import org.gvsig.tools.locator.BaseLocator; |
|
27 |
|
|
28 |
/** |
|
29 |
* This locator is the entry point for the Publish swing library, |
|
30 |
* |
|
31 |
* @author gvSIG team |
|
32 |
* @version $Id$ |
|
33 |
*/ |
|
34 |
public class RasterToolsLocator extends BaseLocator { |
|
35 |
|
|
36 |
/** |
|
37 |
* Chart swing manager name. |
|
38 |
*/ |
|
39 |
public static final String MANAGER_NAME = |
|
40 |
"Raster.tools.manager"; |
|
41 |
|
|
42 |
/** |
|
43 |
* Chart swing manager description. |
|
44 |
*/ |
|
45 |
public static final String MANAGER_DESCRIPTION = |
|
46 |
"Library of Raster Tools plugin"; |
|
47 |
|
|
48 |
private static final String LOCATOR_NAME = "Raster.tools.locator"; |
|
49 |
|
|
50 |
/** |
|
51 |
* Unique instance. |
|
52 |
*/ |
|
53 |
private static final RasterToolsLocator INSTANCE = |
|
54 |
new RasterToolsLocator(); |
|
55 |
|
|
56 |
/** |
|
57 |
* Return the singleton instance. |
|
58 |
* |
|
59 |
* @return the singleton instance |
|
60 |
*/ |
|
61 |
public static RasterToolsLocator getInstance() { |
|
62 |
return INSTANCE; |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* Return the Locator's name |
|
67 |
* |
|
68 |
* @return a String with the Locator's name |
|
69 |
*/ |
|
70 |
public final String getLocatorName() { |
|
71 |
return LOCATOR_NAME; |
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* Registers the Class implementing the PersistenceManager interface. |
|
76 |
* |
|
77 |
* @param clazz |
|
78 |
* implementing the PersistenceManager interface |
|
79 |
*/ |
|
80 |
public static void registerManager( |
|
81 |
Class<? extends RasterToolsManager> clazz) { |
|
82 |
getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, |
|
83 |
clazz); |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* Gets the instance of the {@link ScriptingUIManager} registered. |
|
88 |
* |
|
89 |
* @return {@link ScriptingUIManager} |
|
90 |
*/ |
|
91 |
public static RasterToolsManager getManager() { |
|
92 |
return (RasterToolsManager) getInstance() |
|
93 |
.get(MANAGER_NAME); |
|
94 |
} |
|
95 |
|
|
96 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.lib/org.gvsig.raster.tools.lib.api/src/main/java/org/gvsig/raster/tools/lib/api/RasterToolsLibrary.java | ||
---|---|---|
1 |
package org.gvsig.raster.tools.lib.api; |
|
2 |
/* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright ? 2007-2017 gvSIG Association |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
import org.gvsig.raster.lib.buffer.api.BufferLibrary; |
|
27 |
import org.gvsig.tools.library.AbstractLibrary; |
|
28 |
import org.gvsig.tools.library.LibraryException; |
|
29 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
30 |
|
|
31 |
|
|
32 |
/** |
|
33 |
* @author fdiaz |
|
34 |
* |
|
35 |
*/ |
|
36 |
public class RasterToolsLibrary extends AbstractLibrary{ |
|
37 |
|
|
38 |
@Override |
|
39 |
public void doRegistration() { |
|
40 |
registerAsAPI(RasterToolsLibrary.class); |
|
41 |
this.require(BufferLibrary.class); |
|
42 |
// this.require(BufferLibrary.class); |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
protected void doInitialize() throws LibraryException { |
|
47 |
} |
|
48 |
|
|
49 |
@Override |
|
50 |
protected void doPostInitialize() throws LibraryException { |
|
51 |
// Validate there is any implementation registered. |
|
52 |
RasterToolsManager manager = |
|
53 |
RasterToolsLocator.getManager(); |
|
54 |
if (manager == null) { |
|
55 |
throw new ReferenceNotRegisteredException( |
|
56 |
RasterToolsLocator.MANAGER_NAME, |
|
57 |
RasterToolsLocator.getInstance()); |
|
58 |
} |
|
59 |
} |
|
60 |
|
|
61 |
|
|
62 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.lib/org.gvsig.raster.tools.lib.api/src/main/java/org/gvsig/raster/tools/lib/api/RasterClip.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2017 gvSIG Association |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
18 |
* MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.raster.tools.lib.api; |
|
24 |
|
|
25 |
import java.io.File; |
|
26 |
import java.util.List; |
|
27 |
|
|
28 |
import org.gvsig.fmap.dal.raster.api.BandDescriptor; |
|
29 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
30 |
import org.gvsig.raster.tools.lib.api.exceptions.ClipException; |
|
31 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
32 |
|
|
33 |
|
|
34 |
/** |
|
35 |
* @author fdiaz |
|
36 |
* |
|
37 |
*/ |
|
38 |
public interface RasterClip { |
|
39 |
|
|
40 |
/** |
|
41 |
* @param taskStatus |
|
42 |
* @throws ClipException |
|
43 |
*/ |
|
44 |
public void execute(SimpleTaskStatus taskStatus) throws ClipException; |
|
45 |
|
|
46 |
/** |
|
47 |
* @param envelope |
|
48 |
*/ |
|
49 |
public void setEnvelope(Envelope envelope); |
|
50 |
|
|
51 |
/** |
|
52 |
* @return envelope |
|
53 |
*/ |
|
54 |
public Envelope getEnvelope(); |
|
55 |
|
|
56 |
/** |
|
57 |
* @param pixelSize |
|
58 |
*/ |
|
59 |
public void setPixelSize(double pixelSize); |
|
60 |
|
|
61 |
/** |
|
62 |
* @return pixel size |
|
63 |
*/ |
|
64 |
public double getPixelSize(); |
|
65 |
|
|
66 |
/** |
|
67 |
* @param interpolationMethod |
|
68 |
*/ |
|
69 |
public void setInterpolationMethod(int interpolationMethod); |
|
70 |
|
|
71 |
/** |
|
72 |
* @return |
|
73 |
*/ |
|
74 |
public int getInterpolationMethod(); |
|
75 |
|
|
76 |
/** |
|
77 |
* @param bands |
|
78 |
*/ |
|
79 |
public void setBands(List<Integer> bands); |
|
80 |
|
|
81 |
/** |
|
82 |
* @return |
|
83 |
*/ |
|
84 |
public List<Integer> getBands(); |
|
85 |
|
|
86 |
/** |
|
87 |
* @param layerNamePrefix |
|
88 |
*/ |
|
89 |
public void setLayerNamePrefix(String layerNamePrefix); |
|
90 |
|
|
91 |
/** |
|
92 |
* @return layer name prefix |
|
93 |
*/ |
|
94 |
public String getLayerNamePrefix(); |
|
95 |
|
|
96 |
/** |
|
97 |
* @param createOneLayerPerBand |
|
98 |
*/ |
|
99 |
public void setCreateOneLayerPerBand(boolean createOneLayerPerBand); |
|
100 |
|
|
101 |
/** |
|
102 |
* @return true if will create one layer per band |
|
103 |
*/ |
|
104 |
public boolean isCreateOneLayerPerBand(); |
|
105 |
|
|
106 |
/** |
|
107 |
* @param folder |
|
108 |
*/ |
|
109 |
public void setFolder(File folder); |
|
110 |
|
|
111 |
/** |
|
112 |
* @return The folder where will be created the new raster file |
|
113 |
*/ |
|
114 |
public File getFolder(); |
|
115 |
|
|
116 |
/** |
|
117 |
* @param saveToNewRasterFile |
|
118 |
*/ |
|
119 |
public void setSaveToNewRasterFile(boolean saveToNewRasterFile); |
|
120 |
|
|
121 |
/** |
|
122 |
* @return true if will creates a new raster file |
|
123 |
*/ |
|
124 |
public boolean isSaveToNewRasterFile(); |
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
|
130 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.lib/org.gvsig.raster.tools.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.raster.tools.lib.api.RasterToolsLibrary |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.lib/org.gvsig.raster.tools.lib.api/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.raster.tools.lib</artifactId> |
|
6 |
<version>2.4.1-SNAPSHOT</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.raster.tools.lib.api</artifactId> |
|
9 |
<name>org.gvsig.raster.tools.lib.api</name> |
|
10 |
<description>API for library of raster tools of gvSIG</description> |
|
11 |
<dependencies> |
|
12 |
<dependency> |
|
13 |
<groupId>org.gvsig</groupId> |
|
14 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
15 |
</dependency> |
|
16 |
<dependency> |
|
17 |
<groupId>org.gvsig</groupId> |
|
18 |
<artifactId>org.gvsig.fmap.mapcontext.raster.api</artifactId> |
|
19 |
</dependency> |
|
20 |
<dependency> |
|
21 |
<groupId>org.gvsig</groupId> |
|
22 |
<artifactId>org.gvsig.fmap.dal.raster.api</artifactId> |
|
23 |
</dependency> |
|
24 |
</dependencies> |
|
25 |
|
|
26 |
</project> |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.swing/org.gvsig.raster.tools.swing.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.raster.tools.swing.api.RasterToolsSwingLibrary |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.swing/org.gvsig.raster.tools.swing.api/src/main/java/org/gvsig/raster/tools/swing/api/RasterToolsSwingLocator.java | ||
---|---|---|
1 |
package org.gvsig.raster.tools.swing.api; |
|
2 |
/* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright ? 2007-2017 gvSIG Association |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
import org.gvsig.tools.locator.BaseLocator; |
|
27 |
|
|
28 |
/** |
|
29 |
* This locator is the entry point for the Publish swing library, |
|
30 |
* |
|
31 |
* @author gvSIG team |
|
32 |
* @version $Id$ |
|
33 |
*/ |
|
34 |
public class RasterToolsSwingLocator extends BaseLocator { |
|
35 |
|
|
36 |
/** |
|
37 |
* Chart swing manager name. |
|
38 |
*/ |
|
39 |
public static final String SWING_MANAGER_NAME = |
|
40 |
"Raster.tools.swing.manager"; |
|
41 |
|
|
42 |
/** |
|
43 |
* Chart swing manager description. |
|
44 |
*/ |
|
45 |
public static final String SWING_MANAGER_DESCRIPTION = |
|
46 |
"UIManager of Raster Tools plugin"; |
|
47 |
|
|
48 |
private static final String LOCATOR_NAME = "Raster.tools.swing.locator"; |
|
49 |
|
|
50 |
/** |
|
51 |
* Unique instance. |
|
52 |
*/ |
|
53 |
private static final RasterToolsSwingLocator INSTANCE = |
|
54 |
new RasterToolsSwingLocator(); |
|
55 |
|
|
56 |
/** |
|
57 |
* Return the singleton instance. |
|
58 |
* |
|
59 |
* @return the singleton instance |
|
60 |
*/ |
|
61 |
public static RasterToolsSwingLocator getInstance() { |
|
62 |
return INSTANCE; |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* Return the Locator's name |
|
67 |
* |
|
68 |
* @return a String with the Locator's name |
|
69 |
*/ |
|
70 |
public final String getLocatorName() { |
|
71 |
return LOCATOR_NAME; |
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* Registers the Class implementing the PersistenceManager interface. |
|
76 |
* |
|
77 |
* @param clazz |
|
78 |
* implementing the PersistenceManager interface |
|
79 |
*/ |
|
80 |
public static void registerSwingManager( |
|
81 |
Class<? extends RasterToolsSwingManager> clazz) { |
|
82 |
getInstance().register(SWING_MANAGER_NAME, SWING_MANAGER_DESCRIPTION, |
|
83 |
clazz); |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* Gets the instance of the {@link ScriptingUIManager} registered. |
|
88 |
* |
|
89 |
* @return {@link ScriptingUIManager} |
|
90 |
*/ |
|
91 |
public static RasterToolsSwingManager getSwingManager() { |
|
92 |
return (RasterToolsSwingManager) getInstance() |
|
93 |
.get(SWING_MANAGER_NAME); |
|
94 |
} |
|
95 |
|
|
96 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.swing/org.gvsig.raster.tools.swing.api/src/main/java/org/gvsig/raster/tools/swing/api/RasterToolsSwingLibrary.java | ||
---|---|---|
1 |
package org.gvsig.raster.tools.swing.api; |
|
2 |
/* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright ? 2007-2017 gvSIG Association |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
import org.gvsig.tools.library.AbstractLibrary; |
|
27 |
import org.gvsig.tools.library.LibraryException; |
|
28 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
29 |
|
|
30 |
|
|
31 |
/** |
|
32 |
* @author fdiaz |
|
33 |
* |
|
34 |
*/ |
|
35 |
public class RasterToolsSwingLibrary extends AbstractLibrary{ |
|
36 |
|
|
37 |
@Override |
|
38 |
public void doRegistration() { |
|
39 |
registerAsAPI(RasterToolsSwingLibrary.class); |
|
40 |
// this.require(RasterLibrary.class); |
|
41 |
// this.require(BufferLibrary.class); |
|
42 |
} |
|
43 |
|
|
44 |
@Override |
|
45 |
protected void doInitialize() throws LibraryException { |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
protected void doPostInitialize() throws LibraryException { |
|
50 |
// Validate there is any implementation registered. |
|
51 |
RasterToolsSwingManager manager = |
|
52 |
RasterToolsSwingLocator.getSwingManager(); |
|
53 |
if (manager == null) { |
|
54 |
throw new ReferenceNotRegisteredException( |
|
55 |
RasterToolsSwingLocator.SWING_MANAGER_NAME, |
|
56 |
RasterToolsSwingLocator.getInstance()); |
|
57 |
} |
|
58 |
} |
|
59 |
|
|
60 |
|
|
61 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.swing/org.gvsig.raster.tools.swing.api/src/main/java/org/gvsig/raster/tools/swing/api/RasterToolsSwingManager.java | ||
---|---|---|
1 |
package org.gvsig.raster.tools.swing.api; |
|
2 |
/* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright ? 2007-2017 gvSIG Association |
|
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 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
|
|
25 |
|
|
26 |
import org.gvsig.fmap.mapcontext.raster.api.RasterLayer; |
|
27 |
import org.gvsig.fmap.mapcontrol.MapControl; |
|
28 |
import org.gvsig.raster.tools.lib.api.exceptions.RasterToolCreatingPanelException; |
|
29 |
import org.gvsig.tools.service.Manager; |
|
30 |
|
|
31 |
|
|
32 |
/** |
|
33 |
* |
|
34 |
* @see RasterToolsSwingManager |
|
35 |
* @author gvSIG team |
|
36 |
* @version $Id$ |
|
37 |
*/ |
|
38 |
public interface RasterToolsSwingManager extends Manager{ |
|
39 |
|
|
40 |
|
|
41 |
/** |
|
42 |
* @param layer |
|
43 |
* @param mapControl |
|
44 |
* @return |
|
45 |
* @throws RasterToolCreatingPanelException |
|
46 |
*/ |
|
47 |
ClipPanel createClipPanel(RasterLayer layer, MapControl mapControl) throws RasterToolCreatingPanelException; |
|
48 |
|
|
49 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.swing/org.gvsig.raster.tools.swing.api/src/main/java/org/gvsig/raster/tools/swing/api/ClipPanel.java | ||
---|---|---|
1 |
package org.gvsig.raster.tools.swing.api; |
|
2 |
|
|
3 |
import java.awt.event.ActionListener; |
|
4 |
|
|
5 |
import org.gvsig.raster.tools.lib.api.exceptions.RasterToolGettingParametersException; |
|
6 |
import org.gvsig.raster.tools.lib.api.exceptions.RasterToolCreatingPanelException; |
|
7 |
import org.gvsig.tools.swing.api.Component; |
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
/** |
|
12 |
* @author fdiaz |
|
13 |
* |
|
14 |
*/ |
|
15 |
public interface ClipPanel extends Component { |
|
16 |
|
|
17 |
// /** |
|
18 |
// * @param layer |
|
19 |
// */ |
|
20 |
// public void fetch(FLayer layer); |
|
21 |
|
|
22 |
// /** |
|
23 |
// * @param layer |
|
24 |
// */ |
|
25 |
// public void set(FLayer layer); |
|
26 |
|
|
27 |
|
|
28 |
public boolean isCanceled(); |
|
29 |
|
|
30 |
// public void addActionListener(ActionListener listener); |
|
31 |
// |
|
32 |
// public void removeActionListener(ActionListener listener); |
|
33 |
|
|
34 |
} |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.swing/org.gvsig.raster.tools.swing.api/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.raster.tools.swing</artifactId> |
|
6 |
<version>2.4.1-SNAPSHOT</version> |
|
7 |
</parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.raster.tools.swing.api</artifactId> |
|
10 |
<version>2.4.1-SNAPSHOT</version> |
|
11 |
<name>org.gvsig.raster.tools.swing.api</name> |
|
12 |
<description>GUI's API of raster tools of gvSIG</description> |
|
13 |
<dependencies> |
|
14 |
<dependency> |
|
15 |
<groupId>org.gvsig</groupId> |
|
16 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
17 |
</dependency> |
|
18 |
<dependency> |
|
19 |
<groupId>org.gvsig</groupId> |
|
20 |
<artifactId>org.gvsig.fmap.mapcontext.raster.api</artifactId> |
|
21 |
</dependency> |
|
22 |
<dependency> |
|
23 |
<groupId>org.gvsig</groupId> |
|
24 |
<artifactId>org.gvsig.raster.tools.lib.api</artifactId> |
|
25 |
</dependency> |
|
26 |
<dependency> |
|
27 |
<groupId>org.gvsig</groupId> |
|
28 |
<artifactId>org.gvsig.fmap.control</artifactId> |
|
29 |
</dependency> |
|
30 |
</dependencies> |
|
31 |
</project> |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.swing/org.gvsig.raster.tools.swing.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.raster.tools.swing.impl.DefaultRasterToolsSwingLibrary |
org.gvsig.raster/branches/org.gvsig.raster.2.4/org.gvsig.raster.tools/org.gvsig.raster.tools.swing/org.gvsig.raster.tools.swing.impl/src/main/java/org/gvsig/raster/tools/swing/impl/clip/ClipPanelView.java | ||
---|---|---|
1 |
package org.gvsig.raster.tools.swing.impl.clip; |
|
2 |
|
|
3 |
import com.jeta.forms.components.separator.TitledSeparator; |
|
4 |
import com.jgoodies.forms.layout.CellConstraints; |
|
5 |
import com.jgoodies.forms.layout.FormLayout; |
|
6 |
import java.awt.BorderLayout; |
|
7 |
import java.awt.ComponentOrientation; |
|
8 |
import java.awt.Container; |
|
9 |
import java.awt.Dimension; |
|
10 |
import javax.swing.Box; |
|
11 |
import javax.swing.ButtonGroup; |
|
12 |
import javax.swing.ImageIcon; |
|
13 |
import javax.swing.JButton; |
|
14 |
import javax.swing.JCheckBox; |
|
15 |
import javax.swing.JComboBox; |
|
16 |
import javax.swing.JFormattedTextField; |
|
17 |
import javax.swing.JFrame; |
|
18 |
import javax.swing.JLabel; |
|
19 |
import javax.swing.JPanel; |
|
20 |
import javax.swing.JRadioButton; |
|
21 |
import javax.swing.JScrollPane; |
|
22 |
import javax.swing.JTabbedPane; |
|
23 |
import javax.swing.JTable; |
|
24 |
import javax.swing.JTextField; |
|
25 |
|
|
26 |
|
|
27 |
public class ClipPanelView extends JPanel |
|
28 |
{ |
|
29 |
JTabbedPane tabClip = new JTabbedPane(); |
Also available in: Unified diff