Skip to content

Commit

Permalink
Better basename options for temporal modules, better title and abstra…
Browse files Browse the repository at this point in the history
…ct support for wps services

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@58766 15284696-431f-4ddb-bdfa-cd5b030d7da7
  • Loading branch information
huhabla committed Jan 22, 2014
1 parent 2109c87 commit 79b9855
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 41 deletions.
37 changes: 26 additions & 11 deletions lib/gis/parser_wps.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,15 @@ void G__wps_print_process_description(void)
else
max = 1;
}


if(opt->label) {
title = opt->label;
}
if (opt->description) {
title = opt->description;
abstract = opt->description;
if(!opt->label)
title = opt->description;
else
abstract = opt->description;
}
if (opt->def) {
value = opt->def;
Expand All @@ -367,12 +372,13 @@ void G__wps_print_process_description(void)
data_type == TYPE_STDS || data_type == TYPE_PLAIN_TEXT)
{
/* 2048 is the maximum size of the map in mega bytes */
wps_print_complex_input(min, max, identifier, title, NULL, 2048, data_type);
wps_print_complex_input(min, max, identifier, title, abstract, 2048, data_type);
}
else
{
/* The keyword array is missused for options, type means the type of the value (integer, float ... )*/
wps_print_literal_input_output(WPS_INPUT, min, max, identifier, title, NULL, type, 0, keywords, num_keywords, value, TYPE_OTHER);
wps_print_literal_input_output(WPS_INPUT, min, max, identifier, title,
abstract, type, 0, keywords, num_keywords, value, TYPE_OTHER);
}
}
opt = opt->next_opt;
Expand Down Expand Up @@ -477,18 +483,27 @@ void G__wps_print_process_description(void)
}
G_free(top);
}
/* Only single module output is supported */
if(is_output == 1 && opt->multiple == NO)
/* Only single module output is supported!! */
if(is_output == 1)
{
if(opt->multiple == YES)
G_warning(_("Multiple outputs are not supported by WPS 1.0.0"));
identifier = opt->key;

if(opt->label) {
title = opt->label;
}
if (opt->description) {
title = opt->description;
abstract = opt->description;
}
if(!opt->label)
title = opt->description;
else
abstract = opt->description;
}

if(data_type == TYPE_RASTER || data_type == TYPE_VECTOR ||
data_type == TYPE_STRDS || data_type == TYPE_STVDS ||
data_type == TYPE_STDS || data_type == TYPE_PLAIN_TEXT) {
wps_print_complex_output(identifier, title, NULL, data_type);
wps_print_complex_output(identifier, title, abstract, data_type);
found_output = 1;
}
}
Expand Down
11 changes: 9 additions & 2 deletions temporal/t.rast.accdetect/t.rast.accdetect.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,14 @@
#% multiple: no
#%end

#%option G_OPT_R_BASE
#%option
#% key: basename
#% type: string
#% label: Base name of the new generated output maps"
#% description: A numerical suffix separated by an underscore will be attached to create a unique identifier
#% required: yes
#% multiple: no
#% gisprompt:
#%end

#%option
Expand Down Expand Up @@ -124,7 +131,7 @@ def main():
input = options["input"]
start = options["start"]
stop = options["stop"]
base = options["base"]
base = options["basename"]
cycle = options["cycle"]
offset = options["offset"]
minimum = options["minimum"]
Expand Down
11 changes: 9 additions & 2 deletions temporal/t.rast.accumulate/t.rast.accumulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,14 @@
#% multiple: no
#%end

#%option G_OPT_R_BASE
#%option
#% key: basename
#% type: string
#% label: Base name of the new generated output maps"
#% description: A numerical suffix separated by an underscore will be attached to create a unique identifier
#% required: yes
#% multiple: no
#% gisprompt:
#%end

#%option
Expand Down Expand Up @@ -141,7 +148,7 @@ def main():
output = options["output"]
start = options["start"]
stop = options["stop"]
base = options["base"]
base = options["basename"]
cycle = options["cycle"]
lower = options["lower"]
upper = options["upper"]
Expand Down
10 changes: 8 additions & 2 deletions temporal/t.rast.aggregate.ds/t.rast.aggregate.ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@
#%option G_OPT_STRDS_OUTPUT
#%end

#%option G_OPT_R_BASE
#%option
#% key: basename
#% type: string
#% label: Base name of the new generated output maps"
#% description: A numerical suffix separated by an underscore will be attached to create a unique identifier
#% required: yes
#% multiple: no
#% gisprompt:
#%end

Expand Down Expand Up @@ -69,7 +75,7 @@ def main():
input = options["input"]
output = options["output"]
sampler = options["sample"]
base = options["base"]
base = options["basename"]
register_null = flags["n"]
method = options["method"]
type = options["type"]
Expand Down
11 changes: 9 additions & 2 deletions temporal/t.rast.aggregate/t.rast.aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@
#%option G_OPT_STRDS_OUTPUT
#%end

#%option G_OPT_R_BASE
#%option
#% key: basename
#% type: string
#% label: Base name of the new generated output maps"
#% description: A numerical suffix separated by an underscore will be attached to create a unique identifier
#% required: yes
#% multiple: no
#% gisprompt:
#%end

#%option
Expand Down Expand Up @@ -71,7 +78,7 @@ def main():
output = options["output"]
where = options["where"]
gran = options["granularity"]
base = options["base"]
base = options["basename"]
register_null = flags["n"]
method = options["method"]
sampling = options["sampling"]
Expand Down
7 changes: 4 additions & 3 deletions temporal/t.rast.extract/t.rast.extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
#%end

#%option
#% key: base
#% key: basename
#% type: string
#% description: The base name of the new created raster maps. This name will be extended with a numerical prefix
#% label: Base name of the new generated output maps"
#% description: A numerical suffix separated by an underscore will be attached to create a unique identifier
#% required: no
#% multiple: no
#% gisprompt:
Expand Down Expand Up @@ -74,7 +75,7 @@ def main():
output = options["output"]
where = options["where"]
expression = options["expression"]
base = options["base"]
base = options["basename"]
nprocs = int(options["nprocs"])
register_null = flags["n"]

Expand Down
8 changes: 5 additions & 3 deletions temporal/t.rast.gapfill/t.rast.gapfill.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
#%end

#%option
#% key: base
#% key: basename
#% type: string
#% description: Base name of the interpolated raster maps. This name will be extended with a numerical prefix
#% label: Base name of the new generated output maps"
#% description: A numerical suffix separated by an underscore will be attached to create a unique identifier
#% required: yes
#% multiple: no
#% gisprompt:
#%end

#%option
Expand Down Expand Up @@ -59,7 +61,7 @@ def main():

# Get the options
input = options["input"]
base = options["base"]
base = options["basename"]
where = options["where"]
nprocs = options["nprocs"]

Expand Down
15 changes: 11 additions & 4 deletions temporal/t.rast.import/t.rast.import.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@
#%option G_OPT_STRDS_OUTPUT
#%end

#%option
#% key: basename
#% type: string
#% label: Base name of the new generated output maps"
#% description: A numerical suffix separated by an underscore will be attached to create a unique identifier
#% required: no
#% multiple: no
#% gisprompt:
#%end

#%option G_OPT_M_DIR
#% key: extrdir
#% description: Path to the extraction directory
Expand Down Expand Up @@ -75,9 +85,6 @@
#% description: Override projection (use location's projection)
#%end

#%option G_OPT_R_BASE
#% required: no
#%end

#%flag
#% key: c
Expand All @@ -97,7 +104,7 @@ def main():
title = options["title"]
descr = options["description"]
location = options["location"]
base = options["base"]
base = options["basename"]
set_current_region = flags["r"]
link = flags["l"]
exp = flags["e"]
Expand Down
9 changes: 5 additions & 4 deletions temporal/t.rast.mapcalc/t.rast.mapcalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@
#%end

#%option
#% key: base
#% key: basename
#% type: string
#% description: Base name of the new created raster maps. This name will be extended with a numerical prefix
#% gisprompt: NULL
#% label: Base name of the new generated output maps"
#% description: A numerical suffix separated by an underscore will be attached to create a unique identifier
#% required: yes
#% multiple: no
#% gisprompt:
#%end

#%option
Expand Down Expand Up @@ -81,7 +82,7 @@ def main():
inputs = options["inputs"]
output = options["output"]
expression = options["expression"]
base = options["base"]
base = options["basename"]
method = options["method"]
nprocs = int(options["nprocs"])
register_null = flags["n"]
Expand Down
11 changes: 9 additions & 2 deletions temporal/t.rast.neighbors/t.rast.neighbors.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@
#% answer: average
#%end

#%option G_OPT_R_BASE
#%option
#% key: basename
#% type: string
#% label: Base name of the new generated output maps"
#% description: A numerical suffix separated by an underscore will be attached to create a unique identifier
#% required: yes
#% multiple: no
#% gisprompt:
#%end

#%option
Expand Down Expand Up @@ -81,7 +88,7 @@ def main():
output = options["output"]
where = options["where"]
size = options["size"]
base = options["base"]
base = options["basename"]
register_null = flags["n"]
method = options["method"]
nprocs = options["nprocs"]
Expand Down
8 changes: 5 additions & 3 deletions temporal/t.rast3d.mapcalc/t.rast3d.mapcalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@
#%end

#%option
#% key: base
#% key: basename
#% type: string
#% description: Base name of the new created 3d raster maps. This name will be extended with a numerical prefix
#% label: Base name of the new generated output maps"
#% description: A numerical suffix separated by an underscore will be attached to create a unique identifier
#% required: yes
#% multiple: no
#% gisprompt:
#%end

#%option
Expand Down Expand Up @@ -80,7 +82,7 @@ def main():
inputs = options["inputs"]
output = options["output"]
expression = options["expression"]
base = options["base"]
base = options["basename"]
method = options["method"]
nprocs = int(options["nprocs"])
register_null = flags["n"]
Expand Down
8 changes: 5 additions & 3 deletions temporal/t.vect.extract/t.vect.extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@
#%end

#%option
#% key: base
#% key: basename
#% type: string
#% description: Base name of the new created vector maps
#% label: Base name of the new generated output maps"
#% description: A numerical suffix separated by an underscore will be attached to create a unique identifier
#% required: no
#% multiple: no
#% gisprompt:
#%end

#%option
Expand Down Expand Up @@ -77,7 +79,7 @@ def main():
expression = options["expression"]
layer = options["layer"]
type = options["type"]
base = options["base"]
base = options["basename"]
nprocs = int(options["nprocs"])
register_null = flags["n"]

Expand Down

0 comments on commit 79b9855

Please sign in to comment.