Revision 2779
org.gvsig.raster/tags/v2.2.3/gvprjutils | ||
---|---|---|
1 |
#/bin/sh |
|
2 |
|
|
3 |
#---------------------- |
|
4 |
#Configuration section |
|
5 |
#---------------------- |
|
6 |
|
|
7 |
GVSIG_VERSION=2.1.0 |
|
8 |
FIX_VERSION=SNAPSHOT |
|
9 |
RELEASE=testing |
|
10 |
PACKAGE_PREFIX=gvSIG-desktop |
|
11 |
LIB_PKG=depman.tgz |
|
12 |
|
|
13 |
PACKAGE_DIRECTORY=/tmp |
|
14 |
USER= |
|
15 |
PASS= |
|
16 |
|
|
17 |
#Distribution groups |
|
18 |
#------------------- |
|
19 |
|
|
20 |
#GROUP 0 (CORE) |
|
21 |
PROJECTS[0]="org.gvsig.raster.cache |
|
22 |
org.gvsig.raster |
|
23 |
org.gvsig.raster.gdal |
|
24 |
org.gvsig.raster.tilecache |
|
25 |
org.gvsig.raster.tools" |
|
26 |
REPO_NAME[0]="Raster" #Repository of packages |
|
27 |
URL_REPO[0]="https://devel.gvsig.org/download/projects/${REPO_NAME[0]}/pool/" |
|
28 |
URL_SVN[0]="https://devel.gvsig.org/svn/gvsig-raster/" |
|
29 |
PATH_TICKET[0]="/tmp/ticket-raster.txt" |
|
30 |
PLUGINS[0]="org.gvsig.raster/org.gvsig.raster.mainplugin |
|
31 |
org.gvsig.raster.tilecache/org.gvsig.raster.tilecache.app |
|
32 |
org.gvsig.raster.tools/org.gvsig.raster.tools.app.basic |
|
33 |
org.gvsig.raster.gdal/org.gvsig.raster.gdal.app" |
|
34 |
ARCH_DEP[0]="org.gvsig.raster/org.gvsig.raster.mainplugin |
|
35 |
org.gvsig.raster.gdal/org.gvsig.raster.gdal.app" #Architecture dependent plugins |
|
36 |
|
|
37 |
#GROUP 1 (PLUGINS) |
|
38 |
PROJECTS[1]="org.gvsig.raster.multifile |
|
39 |
org.gvsig.raster.reproject |
|
40 |
org.gvsig.raster.principalcomponents" |
|
41 |
REPO_NAME[1]="Raster" |
|
42 |
URL_REPO[1]="https://devel.gvsig.org/download/projects/${REPO_NAME[1]}/pool/" |
|
43 |
URL_SVN[1]="https://devel.gvsig.org/svn/gvsig-raster/" |
|
44 |
PATH_TICKET[1]="/tmp/ticket-raster.txt" |
|
45 |
PLUGINS[1]="org.gvsig.raster.multifile/org.gvsig.raster.multifile.app.multifileclient |
|
46 |
org.gvsig.raster.reproject/org.gvsig.raster.reproject.app.reprojectclient |
|
47 |
org.gvsig.raster.principalcomponents/org.gvsig.raster.principalcomponents.app.principalcomponentsclient" |
|
48 |
ARCH_DEP[1]="" |
|
49 |
|
|
50 |
#GROUP 2 (FORMATS) |
|
51 |
PROJECTS[2]="org.gvsig.raster.ermapper |
|
52 |
org.gvsig.raster.lizardtech |
|
53 |
org.gvsig.raster.netcdf" |
|
54 |
REPO_NAME[2]="Raster" |
|
55 |
URL_REPO[2]="https://devel.gvsig.org/download/projects/${REPO_NAME[2]}/pool/" |
|
56 |
URL_SVN[2]="https://devel.gvsig.org/svn/gvsig-raster/" |
|
57 |
PATH_TICKET[2]="/tmp/ticket-raster.txt" |
|
58 |
PLUGINS[2]="org.gvsig.raster.netcdf/org.gvsig.raster.netcdf.app.netcdfclient |
|
59 |
org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.app |
|
60 |
org.gvsig.raster.lizardtech/org.gvsig.raster.lizardtech.app" |
|
61 |
ARCH_DEP[2]="org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.app |
|
62 |
org.gvsig.raster.lizardtech/org.gvsig.raster.lizardtech.app" |
|
63 |
|
|
64 |
#GROUP 3 (REMOTE) |
|
65 |
PROJECTS[3]="org.gvsig.raster.wmts |
|
66 |
org.gvsig.raster.wms |
|
67 |
org.gvsig.raster.wcs |
|
68 |
org.gvsig.raster.postgis" |
|
69 |
REPO_NAME[3]="Raster" |
|
70 |
URL_REPO[3]="https://devel.gvsig.org/download/projects/${REPO_NAME[3]}/pool/" |
|
71 |
URL_SVN[3]="https://devel.gvsig.org/svn/gvsig-raster/" |
|
72 |
PATH_TICKET[3]="/tmp/ticket-raster.txt" |
|
73 |
PLUGINS[3]="org.gvsig.raster.wmts/org.gvsig.raster.wmts.app.wmtsclient |
|
74 |
org.gvsig.raster.wms/org.gvsig.raster.wms.app.wmsclient |
|
75 |
org.gvsig.raster.wcs/org.gvsig.raster.wcs.app.wcsclient |
|
76 |
org.gvsig.raster.postgis/org.gvsig.raster.postgis.app.postgisrasterclient" |
|
77 |
ARCH_DEP[3]="" |
|
78 |
|
|
79 |
#GROUP 4 (GEOREFERENCING) |
|
80 |
PROJECTS[4]="org.gvsig.raster.georeferencing" |
|
81 |
REPO_NAME[4]="Raster" |
|
82 |
URL_REPO[4]="https://devel.gvsig.org/download/projects/${REPO_NAME[4]}/pool/" |
|
83 |
URL_SVN[4]="https://devel.gvsig.org/svn/gvsig-georeferencing/" |
|
84 |
PATH_TICKET[4]="/tmp/ticket-raster.txt" |
|
85 |
PLUGINS[4]="org.gvsig.raster.georeferencing/org.gvsig.raster.georeferencing.app.georeferencingclient" |
|
86 |
ARCH_DEP[4]="" |
|
87 |
|
|
88 |
#GROUP 5 (OSM) |
|
89 |
PROJECTS[5]="org.gvsig.raster.osm" |
|
90 |
REPO_NAME[5]="Raster" |
|
91 |
URL_REPO[5]="https://devel.gvsig.org/download/projects/${REPO_NAME[5]}/pool/" |
|
92 |
URL_SVN[5]="https://devel.gvsig.org/svn/gvsig-osm/" |
|
93 |
PATH_TICKET[5]="/tmp/ticket-raster.txt" |
|
94 |
PLUGINS[5]="org.gvsig.raster.osm/org.gvsig.raster.osm.app.osmclient" |
|
95 |
ARCH_DEP[5]="" |
|
96 |
|
|
97 |
#GROUP 6 (GEOPROCESS) |
|
98 |
PROJECTS[6]="org.gvsig.geoprocess" |
|
99 |
REPO_NAME[6]="gvsig-geoprocess" |
|
100 |
URL_REPO[6]="https://devel.gvsig.org/download/projects/${REPO_NAME[6]}/pool/" |
|
101 |
URL_SVN[6]="https://devel.gvsig.org/svn/gvsig-geoprocess/" |
|
102 |
PATH_TICKET[6]="/tmp/ticket-geoprocess.txt" |
|
103 |
PLUGINS[6]="org.gvsig.geoprocess/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.algorithm |
|
104 |
org.gvsig.geoprocess/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.mainplugin |
|
105 |
org.gvsig.geoprocess/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.sextante |
|
106 |
org.gvsig.geoprocess/org.gvsig.geoprocess.app/org.gvsig.geoprocess.app.tool" |
|
107 |
ARCH_DEP[6]="" |
|
108 |
|
|
109 |
#Platforms supported (Add a new block for a new architecture) |
|
110 |
#------------------------------------------------------------- |
|
111 |
|
|
112 |
ARCH="i386" |
|
113 |
TYPE="dynamic" |
|
114 |
|
|
115 |
PLATFORM[0]="linux" |
|
116 |
COMPILER[0]="gcc4" |
|
117 |
DISTRIBUTION[0]="all" |
|
118 |
CLASSIFIER[0]=${PLATFORM[0]}"-"${DISTRIBUTION[0]}"-"${COMPILER[0]}"-"$ARCH"-"$TYPE |
|
119 |
|
|
120 |
PLATFORM[1]="win" |
|
121 |
COMPILER[1]="vs8" |
|
122 |
DISTRIBUTION[1]="nt" |
|
123 |
CLASSIFIER[1]=${PLATFORM[1]}"-"${DISTRIBUTION[1]}"-"${COMPILER[1]}"-"$ARCH"-"$TYPE |
|
124 |
|
|
125 |
#------------------------- |
|
126 |
#End configuration section |
|
127 |
#------------------------- |
|
128 |
|
|
129 |
ALL_PROJECTS=${PROJECTS[*]} |
|
130 |
ALL_PLUGINS=${PLUGINS[*]} |
|
131 |
ARCH_DEP_PLUGINS=${ARCH_DEP[*]} |
|
132 |
|
|
133 |
for k in `seq 1 ${#PLATFORM[@]}` |
|
134 |
do |
|
135 |
let "i=k-1"; |
|
136 |
INSTALL_PARAMS[$i]="install -Dnative-platform="${PLATFORM[$i]}" -Dnative-compiler="${COMPILER[$i]}" -Dnative-arch="$ARCH" -Dnative-distribution="${DISTRIBUTION[$i]}" -Dlibrary-type="$TYPE" -Dnative-classifier="${CLASSIFIER[$i]}" -Dnative_classifier="${CLASSIFIER[$i]}" -Dmaven.test.skip -Dmaven.javadoc.skip=true -Danimal.sniffer.skip=true -Dlicense.skip=true" |
|
137 |
done |
|
138 |
|
|
139 |
if [ $1 != "-changeversion" ] ; then |
|
140 |
PACKAGE_TO_BUILD=$2 |
|
141 |
|
|
142 |
if [ "$PACKAGE_TO_BUILD" != "" ]; then |
|
143 |
if [ -n $PACKAGE_TO_BUILD -a $PACKAGE_TO_BUILD -ge ${#PROJECTS[@]} ]; then |
|
144 |
t=${#PROJECTS[@]} |
|
145 |
let "t=t-1" |
|
146 |
echo "Number of package to build wrong. Maximum "$t |
|
147 |
exit |
|
148 |
fi |
|
149 |
fi |
|
150 |
|
|
151 |
if [ -z $PACKAGE_TO_BUILD ]; then #Si PACKAGE_TO_BUILD es null |
|
152 |
PROJECTS_TO_BUILD=$ALL_PROJECTS |
|
153 |
else |
|
154 |
PROJECTS_TO_BUILD=${PROJECTS[$PACKAGE_TO_BUILD]} |
|
155 |
fi |
|
156 |
|
|
157 |
if [ -z $PACKAGE_TO_BUILD ]; then |
|
158 |
PLUGINS_TO_BUILD=$ALL_PLUGINS |
|
159 |
else |
|
160 |
PLUGINS_TO_BUILD=${PLUGINS[$PACKAGE_TO_BUILD]} |
|
161 |
fi |
|
162 |
|
|
163 |
if [ -z $PACKAGE_TO_BUILD ]; then |
|
164 |
PLUGINS_ARCH_DEP_TO_BUILD=$ARCH_DEP_PLUGINS |
|
165 |
else |
|
166 |
PLUGINS_ARCH_DEP_TO_BUILD=${ARCH_DEP[$PACKAGE_TO_BUILD]} |
|
167 |
fi |
|
168 |
fi |
|
169 |
|
|
170 |
#------------------------------------------------- |
|
171 |
# HELP |
|
172 |
#------------------------------------------------- |
|
173 |
|
|
174 |
if [ "$1" = "--help" ] ; then |
|
175 |
echo "Usage: First parameter:" |
|
176 |
echo " -all (clean, update, buildnumber, install, tags, commit, ticket, upload)" |
|
177 |
echo " -clean" |
|
178 |
echo " -update" |
|
179 |
echo " -buildnumber" |
|
180 |
echo " -install" |
|
181 |
echo " -upload: Upload to the repository" |
|
182 |
echo " -tags: Create tags tagdate_date_hour" |
|
183 |
echo " -commit: Commit the build number" |
|
184 |
echo " -ticket: Build a file with the URL for the package index" |
|
185 |
echo " Second parameter:" |
|
186 |
echo " -number: Number of group to build the package or empty to build all" |
|
187 |
echo "" |
|
188 |
echo "Other utils:" |
|
189 |
echo " -changeversion <old_version> <new_version>:Change the parent pom version (org.gvsig.desktop) of all projects" |
|
190 |
echo " -eclipse: mvn eclipse:eclipse" |
|
191 |
echo " -basicinstall: mvn install without copy and decompress depman" |
|
192 |
echo " -installplugins: install plugins" |
|
193 |
echo "" |
|
194 |
echo "To build a new package" |
|
195 |
echo "----------------------------" |
|
196 |
echo " Advisable to use: cpulimit -e java -l 50 -b " |
|
197 |
echo " 1 - Check and update variables" |
|
198 |
echo " 2 - Ejecutar ./gvprjutils -clean to clean projects" |
|
199 |
echo " 3 - Ejecutar ./gvprjutils -update to update projects" |
|
200 |
echo " 4 - Ejecutar ./gvprjutils -buildnumber to update the build numbers" |
|
201 |
echo " 5 - Ejecutar ./gvprjutils -install to install in ~/.gvsig-devel.properties and package" |
|
202 |
echo " 6 - (Check the instalation and the packages that have been built)" |
|
203 |
echo " 7 - Ejecutar ./gvprjutils -upload to upload to URL_REPO (Run with the console maximized)" |
|
204 |
echo " 8 - Ejecutar ./gvprjutils -commit to upload the buildnumber" |
|
205 |
echo " 9 - Ejecutar ./gvprjutils -tags to create tags in URL_SVN" |
|
206 |
echo " 10 - Ejecutar ./gvprjutils -ticket to create the file with the URLs of the indexes" |
|
207 |
echo "" |
|
208 |
echo "Examples:" |
|
209 |
echo "---------" |
|
210 |
echo " gvprjutils -clean 5 : Cleans the group 5" |
|
211 |
echo " gvprjutils -all : Build all projects and upload to the server" |
|
212 |
echo " gvprjutils -changeversion 2.0.16-SNAPSHOT 2.0.17-SNAPSHOT : change the number version of the parent" |
|
213 |
exit |
|
214 |
fi |
|
215 |
|
|
216 |
|
|
217 |
#------------------------------------------------- |
|
218 |
# CLEAN |
|
219 |
#------------------------------------------------- |
|
220 |
|
|
221 |
clean() { |
|
222 |
echo "***********************************" |
|
223 |
echo "Clean" |
|
224 |
echo "***********************************" |
|
225 |
|
|
226 |
for i in $PROJECTS_TO_BUILD |
|
227 |
do |
|
228 |
cd $i |
|
229 |
echo "-----------------" |
|
230 |
echo "Cambiando a"....$i |
|
231 |
echo "Ejecutando clean" |
|
232 |
mvn clean |
|
233 |
cd .. |
|
234 |
done |
|
235 |
} |
|
236 |
|
|
237 |
#------------------------------------------------- |
|
238 |
# UPDATE |
|
239 |
#------------------------------------------------- |
|
240 |
|
|
241 |
update() { |
|
242 |
for i in $PROJECTS_TO_BUILD |
|
243 |
do |
|
244 |
cd $i |
|
245 |
echo "-----------------" |
|
246 |
echo "Cambiando a"....$i |
|
247 |
echo "Ejecutando svn update " |
|
248 |
svn update; |
|
249 |
cd .. |
|
250 |
done |
|
251 |
} |
|
252 |
|
|
253 |
#------------------------------------------------- |
|
254 |
# BUILDNUMBER |
|
255 |
# Increase the build number for all plugins |
|
256 |
#------------------------------------------------- |
|
257 |
|
|
258 |
increaseBuildNumber() { |
|
259 |
DIR_BASE=`pwd` |
|
260 |
for i in $PLUGINS_TO_BUILD |
|
261 |
do |
|
262 |
if [ -d $i ]; then |
|
263 |
cd $i |
|
264 |
if [ -f buildNumber.properties ]; then |
|
265 |
CURRENT_VER=`cat buildNumber.properties | grep "buildNumber=" | cut -d'=' -f2` |
|
266 |
NEXT_VER=$CURRENT_VER |
|
267 |
let "NEXT_VER=NEXT_VER+1"; |
|
268 |
echo "Changin buildNumber "$CURRENT_VER" by "$NEXT_VER" IN "$i |
|
269 |
(cat buildNumber.properties | sed -e "s/buildNumber=${CURRENT_VER}/buildNumber=${NEXT_VER}/g") > tmp |
|
270 |
rm buildNumber.properties |
|
271 |
mv tmp buildNumber.properties |
|
272 |
fi |
|
273 |
fi |
|
274 |
cd $DIR_BASE |
|
275 |
done |
|
276 |
} |
|
277 |
|
|
278 |
#------------------------------------------------- |
|
279 |
# Copy to $PACKAGE_DIRECTORY |
|
280 |
#------------------------------------------------- |
|
281 |
|
|
282 |
copyToPackageFolder() { |
|
283 |
DIR_BASE=`pwd` |
|
284 |
for i in $PLUGINS_TO_BUILD |
|
285 |
do |
|
286 |
cd $i/target |
|
287 |
echo "-----------------" |
|
288 |
echo "Cambiando a"....$i/target |
|
289 |
echo "Copiando "$i" a "$PACKAGE_DIRECTORY |
|
290 |
COUNT_SLASHES=`grep -o "\/" <<< "$i" | wc -l` #Count the number of slashes in the path |
|
291 |
if [ $COUNT_SLASHES -eq 1 ]; then |
|
292 |
pad=`echo $i | cut -d/ -f2` |
|
293 |
fi |
|
294 |
if [ $COUNT_SLASHES -eq 2 ]; then |
|
295 |
pad=`echo $i | cut -d/ -f3` |
|
296 |
fi |
|
297 |
mkdir $PACKAGE_DIRECTORY/$pad |
|
298 |
rename 's/\.zip$//' *.gvspkg.zip #Elimina los .zip si los gvspkg están como .zip |
|
299 |
cp $PACKAGE_PREFIX* $PACKAGE_DIRECTORY/$pad |
|
300 |
cd $DIR_BASE |
|
301 |
done |
|
302 |
|
|
303 |
} |
|
304 |
|
|
305 |
#------------------------------------------------- |
|
306 |
# Install plugins |
|
307 |
#------------------------------------------------- |
|
308 |
|
|
309 |
installPlugins() { |
|
310 |
echo "***********************************" |
|
311 |
echo "Install" |
|
312 |
echo "***********************************" |
|
313 |
|
|
314 |
DIR_BASE=`pwd` |
|
315 |
|
|
316 |
for i in $PLUGINS |
|
317 |
do |
|
318 |
cd $i |
|
319 |
echo "-----------------" |
|
320 |
echo "Cambiando a"....$i |
|
321 |
|
|
322 |
echo "Ejecutando mvn "${INSTALL_PARAMS[0]} |
|
323 |
mvn ${INSTALL_PARAMS[0]}; |
|
324 |
|
|
325 |
cd $DIR_BASE |
|
326 |
done |
|
327 |
} |
|
328 |
|
|
329 |
#------------------------------------------------- |
|
330 |
# Install libraries and package plugins |
|
331 |
#------------------------------------------------- |
|
332 |
|
|
333 |
installAndPackage() { |
|
334 |
echo "***********************************" |
|
335 |
echo "Install" |
|
336 |
echo "***********************************" |
|
337 |
|
|
338 |
DIR_BASE=`pwd` |
|
339 |
|
|
340 |
#------Install and Package--------- |
|
341 |
|
|
342 |
for i in $PROJECTS_TO_BUILD |
|
343 |
do |
|
344 |
cd $i |
|
345 |
echo "-----------------" |
|
346 |
echo "Cambiando a"....$i |
|
347 |
echo "Ejecutando mvn "${INSTALL_PARAMS[0]} |
|
348 |
mvn ${INSTALL_PARAMS[0]}; |
|
349 |
cd .. |
|
350 |
done |
|
351 |
|
|
352 |
|
|
353 |
for i in $PLUGINS_ARCH_DEP_TO_BUILD #Plugins architecture dependent |
|
354 |
do |
|
355 |
dir=`cut -d/ -f1 <<<$i` |
|
356 |
cd $dir |
|
357 |
echo "-----------------" |
|
358 |
echo "Cambiando a"....$dir |
|
359 |
|
|
360 |
for k in `seq 2 ${#INSTALL_PARAMS[@]}` |
|
361 |
do |
|
362 |
let "j=k-1"; |
|
363 |
echo "Ejecutando mvn "$j ${INSTALL_PARAMS[$j]} |
|
364 |
mvn ${INSTALL_PARAMS[$j]}; |
|
365 |
done |
|
366 |
|
|
367 |
cd $DIR_BASE |
|
368 |
done |
|
369 |
} |
|
370 |
|
|
371 |
#------------------------------------------------- |
|
372 |
# Unpack deman |
|
373 |
#------------------------------------------------- |
|
374 |
|
|
375 |
unpackDepman( ) { |
|
376 |
if [ "$PLUGINS_ARCH_DEP_TO_BUILD" != "" ]; then #Si no hay plugins dependientes de la arquitectura no descomprimimos el depman |
|
377 |
if [ -f $HOME"/"$LIB_PKG ]; then |
|
378 |
CURRENT_DIR=`pwd` |
|
379 |
cd $HOME |
|
380 |
tar -xzvf $LIB_PKG |
|
381 |
cd $CURRENT_DIR |
|
382 |
else |
|
383 |
echo "Error: No existe "$HOME"/"$LIB_PKG"!!!!" |
|
384 |
exit |
|
385 |
fi |
|
386 |
fi |
|
387 |
} |
|
388 |
|
|
389 |
|
|
390 |
#---------------------------------------------------------- |
|
391 |
#Gets the number of the version reading it from the pom.xml |
|
392 |
#---------------------------------------------------------- |
|
393 |
|
|
394 |
loadPluginVersion( ) { |
|
395 |
CURRENT_DIR=`pwd` |
|
396 |
VERSION_COUNTER=0 |
|
397 |
for k in `seq 1 ${#PLUGINS[@]}` |
|
398 |
do |
|
399 |
let "i=k-1"; |
|
400 |
for j in ${PLUGINS[$i]} |
|
401 |
do |
|
402 |
if [ -d $j ]; then |
|
403 |
cd $j |
|
404 |
if [ -f pom.xml ]; then |
|
405 |
exec<pom.xml |
|
406 |
while read line |
|
407 |
do |
|
408 |
if test "${line#*<version>}" != "$line" ; then #La linea contiene el tag <version> |
|
409 |
NEW_VN=`sed -e "s/<version>//g" <<< $line` |
|
410 |
NEW_VN=`sed -e "s/<\/version>//g" <<< $NEW_VN` |
|
411 |
PLUGIN_VERSIONS[$VERSION_COUNTER]=${PLUGIN_VERSIONS[$VERSION_COUNTER]}" "$NEW_VN |
|
412 |
let "VERSION_COUNTER=VERSION_COUNTER+1" |
|
413 |
break |
|
414 |
fi |
|
415 |
done |
|
416 |
fi |
|
417 |
cd $CURRENT_DIR |
|
418 |
fi |
|
419 |
done |
|
420 |
done |
|
421 |
} |
|
422 |
|
|
423 |
#------------------------------------------------- |
|
424 |
#Loads the array of build numbers |
|
425 |
#------------------------------------------------- |
|
426 |
|
|
427 |
loadBuildNumber() { |
|
428 |
CURRENT_DIR=`pwd` |
|
429 |
BN_COUNTER=0 |
|
430 |
for k in `seq 1 ${#PLUGINS[@]}` |
|
431 |
do |
|
432 |
let "i=k-1"; |
|
433 |
for j in ${PLUGINS[$i]} |
|
434 |
do |
|
435 |
if [ -d $j ]; then |
|
436 |
cd $j |
|
437 |
if [ -f buildNumber.properties ]; then |
|
438 |
NEW_BN=`cat buildNumber.properties | grep "buildNumber=" | cut -d'=' -f2` |
|
439 |
BN[$BN_COUNTER]=${BN[$BN_COUNTER]}" "$NEW_BN |
|
440 |
let "BN_COUNTER=BN_COUNTER+1" |
|
441 |
fi |
|
442 |
cd $CURRENT_DIR |
|
443 |
fi |
|
444 |
done |
|
445 |
done |
|
446 |
} |
|
447 |
|
|
448 |
#------------------------------------------------- |
|
449 |
#COMMIT CHANGES (BUILD NUMBERS) |
|
450 |
#------------------------------------------------- |
|
451 |
|
|
452 |
commit() { |
|
453 |
CURRENT_DIR=`pwd` |
|
454 |
for i in $PROJECTS_TO_BUILD |
|
455 |
do |
|
456 |
cd $i |
|
457 |
echo "-----------------" |
|
458 |
echo "Cambiando a"....$i |
|
459 |
echo "Ejecutando svn commit " |
|
460 |
svn commit * -m "New build number"; |
|
461 |
cd $CURRENT_DIR |
|
462 |
done |
|
463 |
} |
|
464 |
|
|
465 |
#------------------------------------------------- |
|
466 |
# REVERT CHANGES (SOLO TEST) |
|
467 |
#------------------------------------------------- |
|
468 |
if [ "$1" = "-revert" ] ; then |
|
469 |
for i in $PROJECTS_TO_BUILD |
|
470 |
do |
|
471 |
cd $i |
|
472 |
echo "-----------------" |
|
473 |
echo "Cambiando a"....$i |
|
474 |
echo "Ejecutando svn update " |
|
475 |
svn revert --recursive . |
|
476 |
cd .. |
|
477 |
done |
|
478 |
fi |
|
479 |
|
|
480 |
#------------------------------------------------- |
|
481 |
# TICKET |
|
482 |
#------------------------------------------------- |
|
483 |
|
|
484 |
ticketGeneration() { |
|
485 |
for k in `seq 1 ${#PATH_TICKET[@]}` |
|
486 |
do |
|
487 |
let "i=k-1"; |
|
488 |
rm ${PATH_TICKET[$i]} 2> /dev/null |
|
489 |
done |
|
490 |
|
|
491 |
for k in `seq 1 ${#URL_REPO[@]}` |
|
492 |
do |
|
493 |
let "i=k-1"; |
|
494 |
POS_INSIDE_PLUGINS=1 #Position of the plugin inside PLUGINS |
|
495 |
for j in ${PLUGINS[$i]} |
|
496 |
do |
|
497 |
#Si se ha seleccionado algún grupo en concreto solo se añadirá este al fichero (-n está definido) |
|
498 |
if [ "$PACKAGE_TO_BUILD" != "" ]; then |
|
499 |
if [ -n $PACKAGE_TO_BUILD -a $i -ne $PACKAGE_TO_BUILD ] ; then |
|
500 |
break |
|
501 |
fi |
|
502 |
fi |
|
503 |
|
|
504 |
COUNT_SLASHES=`grep -o "\/" <<< "$j" | wc -l` #Count the number of slashes in the path |
|
505 |
if [ $COUNT_SLASHES -eq 1 ]; then |
|
506 |
package=`echo $j | cut -d/ -f2` |
|
507 |
fi |
|
508 |
if [ $COUNT_SLASHES -eq 2 ]; then |
|
509 |
package=`echo $j | cut -d/ -f3` |
|
510 |
fi |
|
511 |
|
|
512 |
PLUGIN_VER=`cut -d' ' -f$POS_INSIDE_PLUGINS <<< ${PLUGIN_VERSIONS[$i]}` |
|
513 |
PLUGIN_BN=`cut -d' ' -f$POS_INSIDE_PLUGINS <<< ${BN[$i]}` |
|
514 |
|
|
515 |
if test "${ARCH_DEP_PLUGINS#*$j}" != "$ARCH_DEP_PLUGINS" |
|
516 |
then |
|
517 |
echo "${URL_REPO[$i]}$package/gvSIG-desktop-$GVSIG_VERSION-$package-$PLUGIN_VER-$PLUGIN_BN-$RELEASE-lin-x86-j1_5.gvspki" >> ${PATH_TICKET[$i]} |
|
518 |
echo "" >> ${PATH_TICKET[$i]} |
|
519 |
echo "${URL_REPO[$i]}$package/gvSIG-desktop-$GVSIG_VERSION-$package-$PLUGIN_VER-$PLUGIN_BN-$RELEASE-win-x86-j1_5.gvspki" >> ${PATH_TICKET[$i]} |
|
520 |
else |
|
521 |
echo "${URL_REPO[$i]}$package/gvSIG-desktop-$GVSIG_VERSION-$package-$PLUGIN_VER-$PLUGIN_BN-$RELEASE-all-all-j1_5.gvspki" >> ${PATH_TICKET[$i]} |
|
522 |
fi |
|
523 |
|
|
524 |
echo "" >> ${PATH_TICKET[$i]} |
|
525 |
let "POS_INSIDE_PLUGINS=POS_INSIDE_PLUGINS+1"; |
|
526 |
done |
|
527 |
done |
|
528 |
} |
|
529 |
|
|
530 |
#------------------------------------------------- |
|
531 |
# TAGS |
|
532 |
#------------------------------------------------- |
|
533 |
|
|
534 |
tagsGeneration() { |
|
535 |
echo "***********************************" |
|
536 |
echo "Creating tags" |
|
537 |
echo "***********************************" |
|
538 |
|
|
539 |
tag=`date +%d%m%Y_%H_%M` |
|
540 |
|
|
541 |
for k in `seq 1 ${#URL_SVN[@]}` |
|
542 |
do |
|
543 |
let "i=k-1"; |
|
544 |
for j in ${PROJECTS[$i]} |
|
545 |
do |
|
546 |
#Si se ha seleccionado algún grupo en concreto solo se hará el tag de estos proyectos |
|
547 |
if [ "$PACKAGE_TO_BUILD" != "" ]; then |
|
548 |
if [ -n $PACKAGE_TO_BUILD -a $i -ne $PACKAGE_TO_BUILD ] ; then |
|
549 |
break |
|
550 |
fi |
|
551 |
fi |
|
552 |
|
|
553 |
#echo "svn copy ${URL_SVN[$i]}$j/trunk ${URL_SVN[$i]}$j/tags/tagdate_$tag -m \"Tag build $tag\"" |
|
554 |
svn copy ${URL_SVN[$i]}$j/trunk ${URL_SVN[$i]}$j/tags/tagdate_$tag -m "Tag build $tag" |
|
555 |
done |
|
556 |
done |
|
557 |
} |
|
558 |
|
|
559 |
#------------------------------------------------- |
|
560 |
# CHANGE THE PROJECT VERSION |
|
561 |
# Change the version of the pom parent in a project |
|
562 |
#------------------------------------------------- |
|
563 |
|
|
564 |
changeProjectVersion() { |
|
565 |
CURRENT_DIR=`pwd` |
|
566 |
if [ -z $1 ] ; then |
|
567 |
echo "Current version number not defined" |
|
568 |
exit |
|
569 |
fi |
|
570 |
|
|
571 |
if [ -z $2 ] ; then |
|
572 |
echo "Next version number not defined" |
|
573 |
exit |
|
574 |
fi |
|
575 |
|
|
576 |
for i in `ls` |
|
577 |
do |
|
578 |
if [[ "$i" == org.gvsig.* ]] ; then |
|
579 |
echo $i |
|
580 |
cd $i |
|
581 |
(cat pom.xml | sed -e "s/<version>$1<\/version>/<version>$2<\/version>/") > tmp |
|
582 |
rm pom.xml |
|
583 |
mv tmp pom.xml |
|
584 |
cd $CURRENT_DIR |
|
585 |
fi |
|
586 |
done |
|
587 |
} |
|
588 |
|
|
589 |
#------------------------------------------------- |
|
590 |
# ECLIPSE .project |
|
591 |
#------------------------------------------------- |
|
592 |
|
|
593 |
eclipse() { |
|
594 |
echo "***********************************" |
|
595 |
echo "Eclipse:eclipse" |
|
596 |
echo "***********************************" |
|
597 |
|
|
598 |
DIR_BASE=`pwd` |
|
599 |
|
|
600 |
for i in $PROJECTS_TO_BUILD |
|
601 |
do |
|
602 |
cd $i |
|
603 |
echo "-----------------" |
|
604 |
echo "Cambiando a"....$i |
|
605 |
echo "Ejecutando mvn eclipse:eclipse" |
|
606 |
mvn eclipse:eclipse; |
|
607 |
cd .. |
|
608 |
done |
|
609 |
} |
|
610 |
|
|
611 |
|
|
612 |
|
|
613 |
#------------------------------------------------- |
|
614 |
# COMMANDS |
|
615 |
#------------------------------------------------- |
|
616 |
|
|
617 |
if [ "$1" = "-all" ] ; then |
|
618 |
clean |
|
619 |
update |
|
620 |
increaseBuildnumber |
|
621 |
unpackDepman |
|
622 |
installAndPackage |
|
623 |
copyToPackageFolder |
|
624 |
commit |
|
625 |
tagsGeneration |
|
626 |
loadBuildNumber |
|
627 |
loadPluginVersion |
|
628 |
ticketGeneration |
|
629 |
fi |
|
630 |
|
|
631 |
if [ "$1" = "-basicinstall" ] ; then |
|
632 |
installAndPackage |
|
633 |
fi |
|
634 |
|
|
635 |
if [ "$1" = "-installplugins" ] ; then |
|
636 |
installPlugins |
|
637 |
fi |
|
638 |
|
|
639 |
if [ "$1" = "-install" ] ; then |
|
640 |
unpackDepman |
|
641 |
installAndPackage |
|
642 |
copyToPackageFolder |
|
643 |
fi |
|
644 |
|
|
645 |
if [ "$1" = "-clean" ] ; then |
|
646 |
clean |
|
647 |
fi |
|
648 |
|
|
649 |
if [ "$1" = "-update" ] ; then |
|
650 |
update |
|
651 |
fi |
|
652 |
|
|
653 |
if [ "$1" = "-buildnumber" ] ; then |
|
654 |
increaseBuildNumber |
|
655 |
fi |
|
656 |
|
|
657 |
if [ "$1" = "-commit" ] ; then |
|
658 |
commit |
|
659 |
fi |
|
660 |
|
|
661 |
if [ "$1" = "-ticket" ] ; then |
|
662 |
loadBuildNumber |
|
663 |
loadPluginVersion |
|
664 |
ticketGeneration |
|
665 |
fi |
|
666 |
|
|
667 |
if [ "$1" = "-tags" ] ; then |
|
668 |
tagsGeneration |
|
669 |
fi |
|
670 |
|
|
671 |
if [ "$1" = "-changeversion" ] ; then |
|
672 |
changeProjectVersion $2 $3 |
|
673 |
fi |
|
674 |
|
|
675 |
if [ "$1" = "-eclipse" ] ; then |
|
676 |
eclipse |
|
677 |
fi |
|
678 |
|
|
679 |
if [ "$1" != "-upload" -a "$1" != "-all" ] ; then |
|
680 |
exit |
|
681 |
fi |
|
682 |
|
|
683 |
#------------------------------------------------- |
|
684 |
# UPLOAD |
|
685 |
#------------------------------------------------- |
|
686 |
|
|
687 |
echo "***********************************" |
|
688 |
echo "Uploading" |
|
689 |
echo "***********************************" |
|
690 |
|
|
691 |
CURRENT_DIRECTORY=`pwd`; |
|
692 |
echo "Cambiando a..."$PACKAGE_DIRECTORY |
|
693 |
cd $PACKAGE_DIRECTORY |
|
694 |
|
|
695 |
|
|
696 |
for k in `seq 1 ${#URL_REPO[@]}` |
|
697 |
do |
|
698 |
let "i=k-1"; |
|
699 |
|
|
700 |
for j in ${PLUGINS[$i]} |
|
701 |
do |
|
702 |
|
|
703 |
#Si se ha seleccionado algún grupo en concreto solo se subiran los paquetes de este grupo |
|
704 |
if [ "$PACKAGE_TO_BUILD" != "" ]; then |
|
705 |
if [ -n $PACKAGE_TO_BUILD -a $i -ne $PACKAGE_TO_BUILD ] ; then |
|
706 |
break |
|
707 |
fi |
|
708 |
fi |
|
709 |
|
|
710 |
PKG_DIR=`echo $j | cut -d/ -f3` |
|
711 |
if [ "$PKG_DIR" == "" ] ; then |
|
712 |
PKG_DIR=`echo $j | cut -d/ -f2` |
|
713 |
fi |
|
714 |
|
|
715 |
expect <<EOD |
|
716 |
set timeout -1 |
|
717 |
spawn cadaver ${URL_REPO[$i]} |
|
718 |
expect (y/n) |
|
719 |
send y\r |
|
720 |
expect dav:/download/projects/${REPO_NAME[$i]}/pool/> |
|
721 |
send "cd $PKG_DIR\r" |
|
722 |
expect $PKG_DIR/> |
|
723 |
send "lcd $PKG_DIR\r" |
|
724 |
expect $PKG_DIR/> |
|
725 |
send "mput *.gvspki\r" |
|
726 |
expect "Nombre de usuario:" |
|
727 |
send $USER\r |
|
728 |
expect "Contraseña:" |
|
729 |
send $PASS\r |
|
730 |
expect $PKG_DIR/> |
|
731 |
send "mput *.gvspkg\r" |
|
732 |
expect $PKG_DIR/> |
|
733 |
send quit\r |
|
734 |
expect "cerrada." |
|
735 |
EOD |
|
736 |
|
|
737 |
done |
|
738 |
done |
|
739 |
|
|
740 |
cd $CURRENT_DIRECTORY |
|
0 | 741 |
org.gvsig.raster/tags/v2.2.3/org.gvsig.raster.algorithm/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<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/maven-v4_0_0.xsd"> |
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<artifactId>org.gvsig.raster.algorithm</artifactId> |
|
5 |
<packaging>jar</packaging> |
|
6 |
<name>org.gvsig.raster.algorithm</name> |
|
7 |
<parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.raster</artifactId> |
|
10 |
<version>2.2.3</version> |
|
11 |
</parent> |
|
12 |
<dependencies> |
|
13 |
<dependency> |
|
14 |
<groupId>org.gvsig</groupId> |
|
15 |
<artifactId>org.gvsig.raster.lib.api</artifactId> |
|
16 |
<scope>compile</scope> |
|
17 |
</dependency> |
|
18 |
<dependency> |
|
19 |
<groupId>org.gvsig</groupId> |
|
20 |
<artifactId>org.gvsig.raster.lib.impl</artifactId> |
|
21 |
<scope>compile</scope> |
|
22 |
</dependency> |
|
23 |
<dependency> |
|
24 |
<groupId>org.gvsig</groupId> |
|
25 |
<artifactId>org.gvsig.raster.swing.api</artifactId> |
|
26 |
<scope>compile</scope> |
|
27 |
</dependency> |
|
28 |
<dependency> |
|
29 |
<groupId>org.gvsig</groupId> |
|
30 |
<artifactId>org.gvsig.raster.swing.impl</artifactId> |
|
31 |
<scope>runtime</scope> |
|
32 |
</dependency> |
|
33 |
<dependency> |
|
34 |
<groupId>org.gvsig</groupId> |
|
35 |
<artifactId>org.gvsig.metadata.lib.basic.impl</artifactId> |
|
36 |
<scope>runtime</scope> |
|
37 |
</dependency> |
|
38 |
<dependency> |
|
39 |
<groupId>org.gvsig</groupId> |
|
40 |
<artifactId>org.gvsig.metadata.swing.basic.impl</artifactId> |
|
41 |
<scope>runtime</scope> |
|
42 |
</dependency> |
|
43 |
<dependency> |
|
44 |
<groupId>org.gvsig</groupId> |
|
45 |
<artifactId>org.gvsig.raster.cache.lib.api</artifactId> |
|
46 |
<scope>compile</scope> |
|
47 |
</dependency> |
|
48 |
<dependency> |
|
49 |
<groupId>org.gvsig</groupId> |
|
50 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
51 |
<scope>compile</scope> |
|
52 |
</dependency> |
|
53 |
<dependency> |
|
54 |
<groupId>org.gvsig</groupId> |
|
55 |
<artifactId>org.gvsig.i18n</artifactId> |
|
56 |
<scope>compile</scope> |
|
57 |
</dependency> |
|
58 |
<dependency> |
|
59 |
<groupId>org.gvsig</groupId> |
|
60 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
61 |
<scope>compile</scope> |
|
62 |
</dependency> |
|
63 |
<dependency> |
|
64 |
<groupId>org.gvsig</groupId> |
|
65 |
<artifactId>org.gvsig.projection.cresques.impl</artifactId> |
|
66 |
<scope>runtime</scope> |
|
67 |
</dependency> |
|
68 |
<dependency> |
|
69 |
<groupId>org.gvsig</groupId> |
|
70 |
<artifactId>org.gvsig.compat.api</artifactId> |
|
71 |
<scope>compile</scope> |
|
72 |
</dependency> |
|
73 |
<dependency> |
|
74 |
<groupId>org.gvsig</groupId> |
|
75 |
<artifactId>org.gvsig.compat.se</artifactId> |
|
76 |
<scope>compile</scope> |
|
77 |
</dependency> |
|
78 |
<dependency> |
|
79 |
<groupId>org.gvsig</groupId> |
|
80 |
<artifactId>org.gvsig.fmap.dal.api</artifactId> |
|
81 |
<scope>compile</scope> |
|
82 |
</dependency> |
|
83 |
<dependency> |
|
84 |
<groupId>org.gvsig</groupId> |
|
85 |
<artifactId>org.gvsig.fmap.dal.impl</artifactId> |
|
86 |
<scope>compile</scope> |
|
87 |
</dependency> |
|
88 |
<dependency> |
|
89 |
<groupId>org.gvsig</groupId> |
|
90 |
<artifactId>org.gvsig.fmap.dal.file.lib</artifactId> |
|
91 |
<scope>compile</scope> |
|
92 |
</dependency> |
|
93 |
<dependency> |
|
94 |
<groupId>org.gvsig</groupId> |
|
95 |
<artifactId>org.gvsig.fmap.dal.spi</artifactId> |
|
96 |
<scope>compile</scope> |
|
97 |
</dependency> |
|
98 |
<dependency> |
|
99 |
<groupId>org.gvsig</groupId> |
|
100 |
<artifactId>org.gvsig.fmap.geometry.api</artifactId> |
|
101 |
<scope>compile</scope> |
|
102 |
</dependency> |
|
103 |
<dependency> |
|
104 |
<groupId>org.gvsig</groupId> |
|
105 |
<artifactId>org.gvsig.fmap.geometry.impl</artifactId> |
|
106 |
<scope>runtime</scope> |
|
107 |
</dependency> |
|
108 |
<dependency> |
|
109 |
<groupId>org.gvsig</groupId> |
|
110 |
<artifactId>org.gvsig.fmap.geometry.operation</artifactId> |
|
111 |
<scope>runtime</scope> |
|
112 |
</dependency> |
|
113 |
</dependencies> |
|
114 |
<properties> |
|
115 |
<build-dir>${basedir}/../../build</build-dir> |
|
116 |
</properties> |
|
117 |
</project> |
|
0 | 118 |
org.gvsig.raster/tags/v2.2.3/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/RasterBaseAlgorithmManager.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.algorithm; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.coverage.RasterManager; |
|
25 |
import org.gvsig.raster.algorithm.process.ProcessException; |
|
26 |
import org.gvsig.raster.algorithm.process.DataProcess; |
|
27 |
import org.gvsig.tools.ToolsLocator; |
|
28 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
29 |
import org.gvsig.tools.extensionpoint.ExtensionPointManager; |
|
30 |
|
|
31 |
/** |
|
32 |
* Default {@link RasterManager} implementation. |
|
33 |
* |
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
35 |
* @version $Id$ |
|
36 |
*/ |
|
37 |
public class RasterBaseAlgorithmManager { |
|
38 |
private static RasterBaseAlgorithmManager internalInstance = new RasterBaseAlgorithmManager(); |
|
39 |
|
|
40 |
/** |
|
41 |
* Gets an instance of this object for internal use. |
|
42 |
* @return DefaultRasterManager |
|
43 |
*/ |
|
44 |
public static RasterBaseAlgorithmManager getInstance() { |
|
45 |
return internalInstance; |
|
46 |
} |
|
47 |
|
|
48 |
/** |
|
49 |
* Returns a new instance of a process. |
|
50 |
* @param processLabel |
|
51 |
* Label to identify the process |
|
52 |
* @return |
|
53 |
*/ |
|
54 |
public DataProcess createRasterTask(String processLabel) throws ProcessException { |
|
55 |
ExtensionPointManager extensionPoints = ToolsLocator.getExtensionPointManager(); |
|
56 |
ExtensionPoint point = extensionPoints.add(RasterBaseAlgorithmLibrary.REGISTER_PROCESS_LABEL); |
|
57 |
try { |
|
58 |
DataProcess process = (DataProcess)point.create(processLabel); |
|
59 |
process.setName(processLabel); |
|
60 |
return process; |
|
61 |
} catch (InstantiationException e) { |
|
62 |
throw new ProcessException("", e); |
|
63 |
} catch (IllegalAccessException e) { |
|
64 |
throw new ProcessException("", e); |
|
65 |
} |
|
66 |
} |
|
67 |
|
|
68 |
} |
|
0 | 69 |
org.gvsig.raster/tags/v2.2.3/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/util/Operation.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.algorithm.util; |
|
23 |
|
|
24 |
/** |
|
25 |
* Interface for operations |
|
26 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
27 |
*/ |
|
28 |
public interface Operation { |
|
29 |
public boolean compare(double a, double b); |
|
30 |
|
|
31 |
public void invoke(); |
|
32 |
} |
|
0 | 33 |
org.gvsig.raster/tags/v2.2.3/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/util/AbstractOperation.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.algorithm.util; |
|
23 |
|
|
24 |
/** |
|
25 |
* Interface for operations |
|
26 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
27 |
*/ |
|
28 |
public abstract class AbstractOperation implements Operation { |
|
29 |
public boolean compare(double a, double b) { |
|
30 |
return false; |
|
31 |
} |
|
32 |
|
|
33 |
public void invoke() { |
|
34 |
//do nothing |
|
35 |
} |
|
36 |
} |
|
0 | 37 |
org.gvsig.raster/tags/v2.2.3/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/util/Interpolation.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.algorithm.util; |
|
23 |
|
|
24 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
25 |
import org.gvsig.fmap.dal.coverage.dataset.Buffer; |
|
26 |
import org.gvsig.fmap.dal.coverage.datastruct.NoData; |
|
27 |
|
|
28 |
/** |
|
29 |
* Calculates a pixel value using a interpolation method |
|
30 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
31 |
* @author Victor Olaya |
|
32 |
*/ |
|
33 |
public class Interpolation { |
|
34 |
private Buffer buffer = null; |
|
35 |
private double nodata = 0; |
|
36 |
|
|
37 |
public Interpolation(Buffer buf) { |
|
38 |
this.buffer = buf; |
|
39 |
NoData nodata = RasterLocator.getManager().getDataStructFactory().createDefaultNoData( |
|
40 |
1, Buffer.TYPE_DOUBLE); |
|
41 |
this.nodata = nodata.getValue().doubleValue(); |
|
42 |
} |
|
43 |
|
|
44 |
private double[] getKernel(int x, int y, int band) { |
|
45 |
if(buffer.getDataType() == Buffer.TYPE_BYTE) { |
|
46 |
return getKernelByte(x, y, band); |
|
47 |
} |
|
48 |
if(buffer.getDataType() == Buffer.TYPE_DOUBLE) { |
|
49 |
return getKernelByte(x, y, band); |
|
50 |
} |
|
51 |
if(buffer.getDataType() == Buffer.TYPE_FLOAT) { |
|
52 |
return getKernelByte(x, y, band); |
|
53 |
} |
|
54 |
if(buffer.getDataType() == Buffer.TYPE_SHORT) { |
|
55 |
return getKernelByte(x, y, band); |
|
56 |
} |
|
57 |
if(buffer.getDataType() == Buffer.TYPE_INT) { |
|
58 |
return getKernelByte(x, y, band); |
|
59 |
} |
|
60 |
return null; |
|
61 |
} |
|
62 |
|
|
63 |
public double getNearestNeighbour(double x, double y, int band) { |
|
64 |
int dy = (int)Math.round(y); |
|
65 |
int dx = (int)Math.round(x); |
|
66 |
dy = dy < buffer.getHeight() ? dy : buffer.getHeight() - 1; |
|
67 |
dx = dx < buffer.getWidth() ? dx : buffer.getWidth() - 1; |
|
68 |
if(buffer.getDataType() == Buffer.TYPE_BYTE) { |
|
69 |
return (double)buffer.getElemByte(dy, dx, band); |
|
70 |
} |
|
71 |
if(buffer.getDataType() == Buffer.TYPE_DOUBLE) { |
|
72 |
return (double)buffer.getElemDouble(dy, dx, band); |
|
73 |
} |
|
74 |
if(buffer.getDataType() == Buffer.TYPE_FLOAT) { |
|
75 |
return (double)buffer.getElemFloat(dy, dx, band); |
|
76 |
} |
|
77 |
if(buffer.getDataType() == Buffer.TYPE_SHORT) { |
|
78 |
return (double)buffer.getElemShort(dy, dx, band); |
|
79 |
} |
|
80 |
if(buffer.getDataType() == Buffer.TYPE_INT) { |
|
81 |
return (double)buffer.getElemInt(dy, dx, band); |
|
82 |
} |
|
83 |
return nodata; |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* Calcula los valores N y Z para el m?todo bilinear y obtiene el valor del pixel como |
|
88 |
* Z / N |
|
89 |
* @param dx distancia en X desde el centro del pixel hasta el punto. Es un valor entre 0 y 1 |
|
90 |
* @param dy distancia en Y desde el centro del pixel hasta el punto. Es un valor entre 0 y 1 |
|
91 |
* @param kernel valor del pixel y alrededor |
|
92 |
* @return valor del pixel |
|
93 |
*/ |
|
94 |
public double getBilinearValue(double x, double y, int band) { |
|
95 |
double[] kernel = getKernel((int)x, (int)y, band); |
|
96 |
double dx = x - ((int) x); |
|
97 |
double dy = y - ((int) y); |
|
98 |
|
|
99 |
double z = 0.0, n = 0.0, d; |
|
100 |
d = (1.0 - dx) * (1.0 - dy); |
|
101 |
z += d * kernel[0]; |
|
102 |
n += d; |
|
103 |
|
|
104 |
d = dx * (1.0 - dy); |
|
105 |
z += d * kernel[1]; |
|
106 |
n += d; |
|
107 |
|
|
108 |
d = (1.0 - dx) * dy; |
|
109 |
z += d * kernel[2]; |
|
110 |
n += d; |
|
111 |
|
|
112 |
d = dx * dy; |
|
113 |
z += d * kernel[3]; |
|
114 |
n += d; |
|
115 |
|
|
116 |
double b = 0; |
|
117 |
if(n > 0.0) |
|
118 |
b = (z / n); |
|
119 |
return b; |
|
120 |
} |
|
121 |
|
|
122 |
/** |
|
123 |
* Calcula los valores N y Z para el m?todo de distancia inversa y calcula el valor del |
|
124 |
* pixel como Z / N. |
|
125 |
* @param dx distancia en X desde el centro del pixel hasta el punto. Es un valor entre 0 y 1 |
|
126 |
* @param dy distancia en Y desde el centro del pixel hasta el punto. Es un valor entre 0 y 1 |
|
127 |
* @param kernel valor del pixel y alrededor |
|
128 |
* @return valor del pixel |
|
129 |
*/ |
|
130 |
public double getInverseDistance(double x, double y, int band) { |
|
131 |
double[] kernel = getKernel((int)x, (int)y, band); |
|
132 |
double dx = x - ((int) x); |
|
133 |
double dy = y - ((int) y); |
|
134 |
|
|
135 |
double z = 0.0, n = 0.0, d; |
|
136 |
d = 1.0 / Math.sqrt(dx * dx + dy * dy); |
|
137 |
z += d * kernel[0]; |
|
138 |
n += d; |
|
139 |
|
|
140 |
d = 1.0 / Math.sqrt((1.0 - dx) * ( 1.0 - dx) + dy * dy); |
|
141 |
z += d * kernel[1]; |
|
142 |
n += d; |
|
143 |
|
|
144 |
d = 1.0 / Math.sqrt(dx*dx + (1.0-dy)*(1.0-dy)); |
|
145 |
z += d * kernel[2]; |
|
146 |
n += d; |
|
147 |
|
|
148 |
d = 1.0 / Math.sqrt((1.0 - dx) *( 1.0 - dx) + (1.0 - dy) * (1.0 - dy)); |
|
149 |
z += d * kernel[3]; |
|
150 |
n += d; |
|
151 |
|
|
152 |
double b = 0; |
|
153 |
if(n > 0.0) |
|
154 |
b = (z / n); |
|
155 |
return b; |
|
156 |
} |
|
157 |
|
|
158 |
/** |
|
159 |
* Obtiene un kernel de cuatro elemento que corresponden a los pixeles (x, y), (x + 1, y), |
|
160 |
* (x, y + 1), (x + 1, y + 1). Si los pixeles x + 1 o y + 1 se salen del raster de origen |
|
161 |
* se tomar? x e y. |
|
162 |
* @param x Coordenada X del pixel inicial |
|
163 |
* @param y Coordenada Y del pixel inicial |
|
164 |
* @param band N?mero de banda. |
|
165 |
* @return Kernel solicitado en forma de array. |
|
166 |
*/ |
|
167 |
private double[] getKernelByte(int x, int y, int band) { |
|
168 |
double[] d = new double[4]; |
|
169 |
d[0] = (buffer.getElemByte(y, x, band) & 0xff); |
|
170 |
int nextX = ((x + 1) >= buffer.getWidth()) ? x : (x + 1); |
|
171 |
int nextY = ((y + 1) >= buffer.getHeight()) ? y : (y + 1); |
|
172 |
d[1] = (buffer.getElemByte(y, nextX, band) & 0xff); |
|
173 |
d[2] = (buffer.getElemByte(nextY, x, band) & 0xff); |
|
174 |
d[3] = (buffer.getElemByte(nextY, nextX, band) & 0xff); |
|
175 |
return d; |
|
176 |
} |
|
177 |
|
|
178 |
/** |
|
179 |
* Obtiene un kernel de cuatro elemento que corresponden a los pixeles (x, y), (x + 1, y), |
|
180 |
* (x, y + 1), (x + 1, y + 1). Si los pixeles x + 1 o y + 1 se salen del raster de origen |
|
181 |
* se tomar? x e y. |
|
182 |
* @param x Coordenada X del pixel inicial |
|
183 |
* @param y Coordenada Y del pixel inicial |
|
184 |
* @param band N?mero de banda. |
|
185 |
* @return Kernel solicitado en forma de array. |
|
186 |
*/ |
|
187 |
@SuppressWarnings("unused") |
|
188 |
private double[] getKernelShort(int x, int y, int band) { |
|
189 |
double[] d = new double[4]; |
|
190 |
d[0] = (buffer.getElemShort(y, x, band) & 0xffff); |
|
191 |
int nextX = ((x + 1) >= buffer.getWidth()) ? x : (x + 1); |
|
192 |
int nextY = ((y + 1) >= buffer.getHeight()) ? y : (y + 1); |
|
193 |
d[1] = (buffer.getElemShort(y, nextX, band) & 0xffff); |
|
194 |
d[2] = (buffer.getElemShort(nextY, x, band) & 0xffff); |
|
195 |
d[3] = (buffer.getElemShort(nextY, nextX, band) & 0xffff); |
|
196 |
return d; |
|
197 |
} |
|
198 |
|
|
199 |
/** |
|
200 |
* Obtiene un kernel de cuatro elemento que corresponden a los pixeles (x, y), (x + 1, y), |
|
201 |
* (x, y + 1), (x + 1, y + 1). Si los pixeles x + 1 o y + 1 se salen del raster de origen |
|
202 |
* se tomar? x e y. |
|
203 |
* @param x Coordenada X del pixel inicial |
|
204 |
* @param y Coordenada Y del pixel inicial |
|
205 |
* @param band N?mero de banda. |
|
206 |
* @return Kernel solicitado en forma de array. |
|
207 |
*/ |
|
208 |
@SuppressWarnings("unused") |
|
209 |
private double[] getKernelInt(int x, int y, int band) { |
|
210 |
double[] d = new double[4]; |
|
211 |
d[0] = (buffer.getElemInt(y, x, band) & 0xffffffff); |
|
212 |
int nextX = ((x + 1) >= buffer.getWidth()) ? x : (x + 1); |
|
213 |
int nextY = ((y + 1) >= buffer.getHeight()) ? y : (y + 1); |
|
214 |
d[1] = (buffer.getElemInt(y, nextX, band) & 0xffffffff); |
|
215 |
d[2] = (buffer.getElemInt(nextY, x, band) & 0xffffffff); |
|
216 |
d[3] = (buffer.getElemInt(nextY, nextX, band) & 0xffffffff); |
|
217 |
return d; |
|
218 |
} |
|
219 |
|
|
220 |
/** |
|
221 |
* Obtiene un kernel de cuatro elemento que corresponden a los pixeles (x, y), (x + 1, y), |
|
222 |
* (x, y + 1), (x + 1, y + 1). Si los pixeles x + 1 o y + 1 se salen del raster de origen |
|
223 |
* se tomar? x e y. |
|
224 |
* @param x Coordenada X del pixel inicial |
|
225 |
* @param y Coordenada Y del pixel inicial |
|
226 |
* @param band N?mero de banda. |
|
227 |
* @return Kernel solicitado en forma de array. |
|
228 |
*/ |
|
229 |
@SuppressWarnings("unused") |
|
230 |
private double[] getKernelFloat(int x, int y, int band) { |
|
231 |
double[] d = new double[4]; |
|
232 |
d[0] = buffer.getElemFloat(y, x, band); |
|
233 |
int nextX = ((x + 1) >= buffer.getWidth()) ? x : (x + 1); |
|
234 |
int nextY = ((y + 1) >= buffer.getHeight()) ? y : (y + 1); |
|
235 |
d[1] = buffer.getElemFloat(y, nextX, band); |
|
236 |
d[2] = buffer.getElemFloat(nextY, x, band); |
|
237 |
d[3] = buffer.getElemFloat(nextY, nextX, band); |
|
238 |
return d; |
|
239 |
} |
|
240 |
|
|
241 |
/** |
|
242 |
* Obtiene un kernel de cuatro elemento que corresponden a los pixeles (x, y), (x + 1, y), |
|
243 |
* (x, y + 1), (x + 1, y + 1). Si los pixeles x + 1 o y + 1 se salen del raster de origen |
|
244 |
* se tomar? x e y. |
|
245 |
* @param x Coordenada X del pixel inicial |
|
246 |
* @param y Coordenada Y del pixel inicial |
|
247 |
* @param band N?mero de banda. |
|
248 |
* @return Kernel solicitado en forma de array. |
|
249 |
*/ |
|
250 |
@SuppressWarnings("unused") |
|
251 |
private double[] getKernelDouble(int x, int y, int band) { |
|
252 |
double[] d = new double[4]; |
|
253 |
d[0] = buffer.getElemDouble(y, x, band); |
|
254 |
int nextX = ((x + 1) >= buffer.getWidth()) ? x : (x + 1); |
|
255 |
int nextY = ((y + 1) >= buffer.getHeight()) ? y : (y + 1); |
|
256 |
d[1] = buffer.getElemDouble(y, nextX, band); |
|
257 |
d[2] = buffer.getElemDouble(nextY, x, band); |
|
258 |
d[3] = buffer.getElemDouble(nextY, nextX, band); |
|
259 |
return d; |
|
260 |
} |
|
261 |
} |
|
0 | 262 |
org.gvsig.raster/tags/v2.2.3/org.gvsig.raster.algorithm/src/main/java/org/gvsig/raster/algorithm/process/DataProcess.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
package org.gvsig.raster.algorithm.process; |
|
23 |
|
|
24 |
import java.util.HashMap; |
|
25 |
import java.util.Hashtable; |
|
26 |
|
|
27 |
import javax.swing.SwingUtilities; |
|
28 |
|
|
29 |
import org.gvsig.fmap.dal.coverage.RasterLocator; |
|
30 |
import org.gvsig.fmap.dal.coverage.exception.ProcessInterruptedException; |
|
31 |
import org.gvsig.fmap.dal.coverage.process.CancelEvent; |
|
32 |
import org.gvsig.fmap.dal.coverage.process.TaskEventManager; |
|
33 |
import org.gvsig.raster.algorithm.gui.IIncrementable; |
|
34 |
import org.gvsig.raster.algorithm.gui.IncrementableEvent; |
|
35 |
import org.gvsig.raster.algorithm.gui.IncrementableListener; |
|
36 |
import org.gvsig.raster.algorithm.gui.IncrementableTask; |
|
37 |
import org.gvsig.raster.swing.basepanel.IButtonsPanel; |
|
38 |
import org.gvsig.tools.dispose.Disposable; |
|
39 |
import org.slf4j.Logger; |
|
40 |
import org.slf4j.LoggerFactory; |
|
41 |
/** |
|
42 |
* Clase base de todos los procesos raster. En ella se genstionan todas las |
|
43 |
* funciones comunes como incremento de la tarea, gesti�n de eventos a la tarea, |
|
44 |
* par�metros de la tarea, etc ... |
|
45 |
* |
|
46 |
* 18/12/2007 |
|
47 |
* @author Nacho Brodin nachobrodin@gmail.com |
|
48 |
*/ |
|
49 |
public abstract class DataProcess extends ProcessParamsManagement implements IIncrementable, IncrementableListener, Runnable, Disposable { |
|
50 |
protected IncrementableTask incrementableTask = null; |
|
51 |
protected volatile Thread blinker = null; |
|
52 |
protected TaskEventManager taskEventManager = null; |
|
53 |
protected IProcessActions externalActions = null; |
|
54 |
protected Hashtable<String, Object> |
|
55 |
taskParams = new Hashtable<String, Object>(); |
|
56 |
|
|
57 |
|
|
58 |
private String log = ""; |
|
59 |
private String lastLine = ""; |
|
60 |
private long time = 0; |
|
61 |
private boolean progressActive = true; |
|
62 |
private IProcessActions queueActions = null; |
|
63 |
protected Logger logger = LoggerFactory.getLogger(DataProcess.class.toString()); |
|
64 |
private int percent = 0; |
|
65 |
private String processName = null; |
|
66 |
|
|
67 |
//*************************************************** |
|
68 |
//Task control |
|
69 |
//*************************************************** |
|
70 |
|
|
71 |
/** |
|
72 |
* Builds the window <code>IncrementableTask</code> to show |
|
73 |
* the increment of the task. |
|
74 |
*/ |
|
75 |
public IncrementableTask getIncrementableTask() { |
|
76 |
if (incrementableTask == null) { |
|
77 |
incrementableTask = new IncrementableTask(this); |
|
78 |
incrementableTask.addIncrementableListener(this); |
|
79 |
} |
|
80 |
return incrementableTask; |
|
81 |
} |
|
82 |
|
|
83 |
/** |
|
84 |
* Sets the button to cancel the task |
|
85 |
*/ |
|
86 |
public void setCancelable(boolean enabled) { |
|
87 |
getIncrementableTask().getButtonsPanel().setEnabled(IButtonsPanel.BUTTON_CANCEL, enabled); |
|
88 |
} |
|
89 |
|
|
90 |
/** |
|
91 |
* Show the increment of this task <code>IncrementableTask</code> |
|
92 |
*/ |
|
93 |
public void showIncrementableWindow() { |
|
94 |
if (progressActive) { |
|
95 |
getIncrementableTask().showWindow(); |
|
96 |
getIncrementableTask().start(); |
|
97 |
} |
|
98 |
} |
|
99 |
|
|
100 |
/** |
|
101 |
* Starts the process. It will call the run method |
|
102 |
*/ |
|
103 |
public void start() { |
|
104 |
showIncrementableWindow(); |
|
105 |
if(blinker == null) |
|
106 |
blinker = new Thread(this); |
|
107 |
blinker.start(); |
|
108 |
} |
|
109 |
|
|
110 |
/** |
|
111 |
* A specific task will load parameters using this initialization. |
|
112 |
*/ |
|
113 |
public abstract void init(); |
|
114 |
|
|
115 |
/** |
|
116 |
* This call will be implemented by a specific process. It will do the actions to carry out |
|
117 |
* the task |
|
118 |
* @throws InterruptedException |
|
119 |
*/ |
|
120 |
public abstract void process() throws ProcessInterruptedException, ProcessException; |
|
121 |
|
|
122 |
/** |
|
123 |
* Gets the result of the process. All processes will have a parameter PROCESS that it is |
|
124 |
* the own process. It is useful to get the process name or other data. |
|
125 |
* |
|
126 |
* This result of the process is sent to the method "end" in <code>IProcessActions</code> when the task |
|
127 |
* is thrown in a thread or is recovered by the user when the task is thrown sequentially. |
|
128 |
* |
|
129 |
* @return Result of the task |
|
130 |
*/ |
|
131 |
public HashMap<String, Object> getResult() { |
|
132 |
outputParameters.put("PROCESS", this); |
|
133 |
outputParameters.put(TIME, getTime()); |
|
134 |
outputParameters.put(PROCESS_NAME, getName()); |
|
135 |
return outputParameters; |
|
136 |
} |
|
137 |
|
|
138 |
/** |
|
139 |
* Adds a output from the process in runtime |
|
140 |
* @param key |
|
141 |
* @param value |
|
142 |
*/ |
|
143 |
protected void addOutputValue(String key, Object value) { |
|
144 |
outputParameters.put(key, value); |
|
145 |
} |
|
146 |
|
|
147 |
/** |
|
148 |
* Sequential execution of this task |
|
149 |
* @throws ProcessException |
|
150 |
*/ |
|
151 |
public void execute() throws ProcessInterruptedException, ProcessException { |
|
152 |
taskEventManager = RasterLocator.getManager().createRasterTask(this); |
|
153 |
loadGlobalParameters(); |
|
154 |
init(); |
|
155 |
process(); |
|
156 |
|
|
157 |
//Sets in the output the result of the process |
|
158 |
SwingUtilities.invokeLater(new Runnable() { |
|
159 |
public void run() { |
|
160 |
if (externalActions != null) { |
|
161 |
externalActions.end(getResult()); |
|
162 |
} |
|
163 |
} |
|
164 |
}); |
|
165 |
} |
|
166 |
|
|
167 |
/** |
|
168 |
* This method will be executed by the Thread. It will have the global actions for |
|
169 |
* any task and it will call to the <code>execute</code> function. |
|
170 |
*/ |
|
171 |
public void run() { |
|
172 |
long t1 = new java.util.Date().getTime(); |
|
173 |
|
|
174 |
try { |
|
175 |
execute(); |
|
176 |
} catch (ProcessInterruptedException e) { |
Also available in: Unified diff