[GRASS-dev] r.mapcalc and g.remove --v/q issues
Jachym Cepicky
jachym.cepicky at centrum.cz
Mon Oct 9 09:29:16 EDT 2006
hi,
was this patch commited to cvs ?
thanks
jachym
On Mon, Oct 09, 2006 at 11:28:05AM +0100, Glynn Clements wrote:
>
> Martin Landa wrote:
>
> > trying to cleanup g.remove module I have prepared the patch. Is it OK
> > for you? Any comments welcomed...
>
> Rather than hard-coding checks for specific entity types:
>
> + if (G_strcasecmp(list[n].alias, "rast") == 0 ) {
> + if ((mapset = G_find_cell2 (old, "")) == NULL) {
> + G_warning(_("Raster map <%s> not found"), old);
> + result = 1;
> + }
> + }
> +
> + if (G_strcasecmp(list[n].alias, "rast3d") == 0 ) {
> + if ((mapset = G_find_grid3 (old, "")) == NULL) {
> + G_warning(_("Raster 3d map <%s> not found"), old);
> + result = 1;
> + }
> + }
>
> I would add a flag which is initially cleared for each entity (map
> etc) and set when an element is actually removed. A warning would be
> generated if the flag is still clear when all of the elements for an
> entity have been processed.
>
> E.g.:
>
> + removed = 0;
> for (i = 0; i < list[n].nelem; i++) {
> switch (G_remove (list[n].element[i], old))
> {
> case -1:
> - G_warning (" %-*s %s", len, list[n].desc[i],_("COULD NOT REMOVE"));
> + G_warning ("%s: %s", list[n].desc[i],_("couldn't be removed"));
> result = 1;
> break;
> case 0:
> - G_message (" %-*s %s", len, list[n].desc[i],_("MISSING"));
> + G_debug (1, "%s: %s", list[n].desc[i],_("missing"));
> break;
> case 1:
> - G_message (" %-*s ", len, list[n].desc[i]);
> + G_debug (1, "%s: %s", list[n].desc[i],_("removed"));
> + removed = 1;
> break;
> }
> }
> +
> + if (!removed)
> + G_warning ("%s: %s", list[n].desc[i],_("nothing removed"));
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>
> _______________________________________________
> grass-dev mailing list
> grass-dev at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev
--
Jachym Cepicky
e-mail: jachym.cepicky at centrum.cz
URL: http://les-ejk.cz
GPG: http://les-ejk.cz/gnupg_public_key/jachym_cepicky-gpg_public_key.asc
-----------------------------------------
OFFICE:
Department of Geoinformation Technologies
Zemedelska 3
613 00, Brno
Czech Republick
e-mail: xcepicky at node.mendelu.cz
URL: http://mapserver.mendelu.cz
Tel.: +420 545 134 514
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20061009/e8b0d144/attachment.bin
More information about the grass-dev
mailing list