[GRASS-SVN] r36641 - grass-addons/raster/r.terracost

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Apr 8 17:33:54 EDT 2009


Author: ltoma
Date: 2009-04-08 17:33:54 -0400 (Wed, 08 Apr 2009)
New Revision: 36641

Removed:
   grass-addons/raster/r.terracost/iterator.cc
   grass-addons/raster/r.terracost/iterator.h
Modified:
   grass-addons/raster/r.terracost/config.cc
   grass-addons/raster/r.terracost/main.cc
Log:
deleted iterator.{h,cc} because they are not in use anymore; updated main.cc; 

Modified: grass-addons/raster/r.terracost/config.cc
===================================================================
--- grass-addons/raster/r.terracost/config.cc	2009-04-08 19:12:26 UTC (rev 36640)
+++ grass-addons/raster/r.terracost/config.cc	2009-04-08 21:33:54 UTC (rev 36641)
@@ -26,6 +26,7 @@
 dimension_type nrows = 0;
 dimension_type ncols = 0;
 dimension_type ncolsPad = 0;
+dimension_type nrowsPad = 0;
 dimension_type tsr = 0;
 dimension_type tsc = 0;
 

Deleted: grass-addons/raster/r.terracost/iterator.cc
===================================================================
--- grass-addons/raster/r.terracost/iterator.cc	2009-04-08 19:12:26 UTC (rev 36640)
+++ grass-addons/raster/r.terracost/iterator.cc	2009-04-08 21:33:54 UTC (rev 36641)
@@ -1,66 +0,0 @@
-/* 
-
-   Copyright (C) 2006 Thomas Hazel, Laura Toma, Jan Vahrenhold and
-   Rajiv Wickremesinghe
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-*/
-
-
-
-#include <stdio.h>
-#include "iterator.h"
-
-Iterator::Iterator(Tile* inTile) {
-  iMarker = 0;
-  jMarker = 0;
-  tile = inTile;
-  tileSizeRows = tile->getNumRows();;
-  tileSizeCols = tile->getNumCols();;
-}
-
-Iterator::~Iterator() {
-
-}
-
-
-int
-Iterator::getNext (ijCostSource* out) {
-
-  if (iMarker > tileSizeRows - 1)
-    return 0;
-
-  *out = tile->getComplex(iMarker, jMarker);
-
-  if (iMarker == 0){
-    jMarker++;
-  }
-  else if (iMarker > 0 && iMarker < tileSizeRows-1) {
-    jMarker = jMarker + tileSizeCols-1;
-  }
-
-  else
-    jMarker++;
-
-  if (jMarker >= tileSizeCols) {
-    iMarker++;
-    jMarker = 0;
-  }
-
-  return 1;
-}
-
-void
-Iterator::reset() {
-  iMarker = 0;
-  jMarker = 0;
-}

Deleted: grass-addons/raster/r.terracost/iterator.h
===================================================================
--- grass-addons/raster/r.terracost/iterator.h	2009-04-08 19:12:26 UTC (rev 36640)
+++ grass-addons/raster/r.terracost/iterator.h	2009-04-08 21:33:54 UTC (rev 36641)
@@ -1,46 +0,0 @@
-/* 
-
-   Copyright (C) 2006 Thomas Hazel, Laura Toma, Jan Vahrenhold and
-   Rajiv Wickremesinghe
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-*/
-
-
-#ifndef __ITERATOR_H_
-#define __ITERATOR_H_
-
-#include "input.h"
-#include "tile.h"
-
-
-class Iterator {
-
-  int iMarker;
-  int jMarker;
-
-  int tileSizeRows, tileSizeCols;
-
-  Tile* tile;
-
- public:
-  Iterator(Tile* inTile);
-
-  ~Iterator();
-
-  void reset();
-
-  int getNext(ijCostSource *out);
-
-};
-
-#endif

Modified: grass-addons/raster/r.terracost/main.cc
===================================================================
--- grass-addons/raster/r.terracost/main.cc	2009-04-08 19:12:26 UTC (rev 36640)
+++ grass-addons/raster/r.terracost/main.cc	2009-04-08 21:33:54 UTC (rev 36641)
@@ -18,17 +18,16 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <libgen.h>
 #include <errno.h>
 #include <unistd.h>
 #include <pwd.h>
- 
+  
 extern "C" {
-#include <grass/gis.h>
-#include <grass/glocale.h>
+#include "grass/gis.h"
 }
-#include <grass/iostream/ami.h>
+#include <ami.h>
 
+
 #include "main.h"
 #include "common.h" /* declares the globals */
 #include "sortutils.h"
@@ -117,7 +116,7 @@
   input_cost->type       = TYPE_STRING;
   //input_cost->required   = YES;
   input_cost->gisprompt  = "old,cell,raster" ;
-  input_cost->description= _("Input cost grid");
+  input_cost->description= "Input cost grid" ;
 
   /* source point raster */
   struct Option *source_grid;
@@ -125,8 +124,8 @@
   source_grid->key        = "start_raster";
   source_grid->type       = TYPE_STRING;
   //source_grid->required   = YES;
-  source_grid->gisprompt  = _("Raster of source points");
-  source_grid->description= _("Input raster of source points");
+  source_grid->gisprompt  = "raster of source points" ;
+  source_grid->description= "Input raster of source points";
 
   /* output direction  grid */
   struct Option *output_cost;
@@ -135,7 +134,7 @@
   output_cost->type       = TYPE_STRING;
   //output_cost->required   = YES;
   output_cost->gisprompt  = "new,cell,raster" ;
-  output_cost->description= _("Output distance grid");
+  output_cost->description= "Output distance grid";
 
   /* main memory */
   struct Option *mem;
@@ -143,8 +142,8 @@
   mem->key         = "memory";
   mem->type        = TYPE_INTEGER;
   mem->required    = NO;
-  mem->answer      = G_store("400"); /* 400MB default value */
-  mem->description = _("Main memory size (in MB)");
+  mem->answer      = "400"; /* 400MB default value */
+  mem->description = "Main memory size (in MB)";
 
   /* temporary STREAM path */
   struct Option *streamdir;
@@ -152,10 +151,10 @@
   streamdir->key        = "STREAM_DIR";
   streamdir->type       = TYPE_STRING;
   streamdir->required   = NO;
-  streamdir->answer     = G_store(dirname(G_tempfile()));;
-  streamdir->description= _("Directory to hold temporary files (they can be large)");
+  streamdir->answer     = "/var/tmp";
+  streamdir->description= "Location of temporary STREAMs";
 
-  /* temporary VTMPDIR path */
+  /* temporary STREAM path */
   struct Option *vtmpdir;
   vtmpdir = G_define_option() ;
   vtmpdir->key        = VTMPDIR;
@@ -169,25 +168,26 @@
 	sprintf(vtmpdirbuf, "/var/tmp/%d", getuid());
   }
   vtmpdir->answer     = strdup(vtmpdirbuf);	// leak
-  vtmpdir->description= _("Location of intermediate STREAMs");
+  vtmpdir->description= "Location of intermediate STREAMs";
 
-  struct Flag *help_f;  // needed??
+  struct Flag *help_f;
   help_f = G_define_flag();
   help_f->key         = 'h' ; 
-  help_f->description  = _("Help");
+  help_f->description  = "Help";
 
   /* verbose flag */
   struct Flag *quiet;
   quiet = G_define_flag() ;
   quiet->key         = 'q' ;
-  quiet->description = _("Quiet");
+  quiet->description = "Quiet (suppress messages)" ;
+  /* quiet->answer = 'n'; */
 
 
   /* save ascii grid flag */
   struct Flag *ascii; 
   ascii = G_define_flag() ;
   ascii->key         = 's' ;
-  ascii->description = _("Save output to ASCII file \"DIST_GRID\"") ;
+  ascii->description = "Save output to ascii file "DIST_GRID"" ;
   /* quiet->answer = 'n'; */
 
   struct Flag *debug_f;
@@ -198,37 +198,37 @@
   struct Flag *info_f;
   info_f = G_define_flag();
   info_f->key         = 'i' ; 
-  info_f->description  = _("Info (prints useful information and exits)");
+  info_f->description  = "Info (prints useful information and exits)";
 
   /* Run step0 only flag */
   struct Flag *step0;
   step0 = G_define_flag();
   step0->key         = '0' ; 
-  step0->description  = _("Step 0 only (-h for info)");
+  step0->description  = "Step 0 only (-h for info)";
   /* step0->answer = 'n'; */
 
   /* Run step 1 only flag*/
   struct Flag *step1;
   step1 = G_define_flag() ;
   step1->key         = '1' ;
-  step1->description = _("Step 1 only (-h for info)");
+  step1->description = "Step 1 only (-h for info)" ;
   /* step1->answer = 'n'; */
 
   /* Run step 2 and 3 only flags */
   struct Flag *step2;
   step2 = G_define_flag();
   step2->key         = '2' ; 
-  step2->description  = _("Step 2 only (-h for info)");
+  step2->description  = "Step 2 only (-h for info)";
 
   struct Flag *step3;
   step3 = G_define_flag();
   step3->key         = '3' ; 
-  step3->description  = _("Step 3 only (-h for info)");
+  step3->description  = "Step 3 only (-h for info)";
   
   struct Flag *step4;
   step4 = G_define_flag();
   step4->key         = '4' ; 
-  step4->description  = _("Step 4 only (-h for info)");
+  step4->description  = "Step 4 only (-h for info)";
 
   /* Number of tiles; used in conjunction with step0 flag */  
   struct Option *numtiles;
@@ -236,8 +236,8 @@
   numtiles->key = "numtiles";
   numtiles->type       = TYPE_INTEGER;
   numtiles->required   = NO;
-  numtiles->description= _("Number of tiles (-h for info)");
-  numtiles->answer     = G_store("-1");
+  numtiles->description= "Number of tiles (-h for info)";
+  numtiles->answer     = "-1";
 
   /* Stem name for stream outputs; used in conjunction with step0 flag */  
   struct Option *s0out;
@@ -245,24 +245,24 @@
   s0out->key = S0OUT;
   s0out->type       = TYPE_STRING;
   s0out->required   = NO;
-  s0out->description= _("Stream name stem for step 0 output");
-  s0out->answer     = G_store(S0OUT_ANS);
+  s0out->description= "Stream name stem for step 0 output";
+  s0out->answer     = S0OUT_ANS;
 
 //   struct Option *s1in;
 //   s1in = G_define_option() ;
 //   s1in->key = "s1in";
 //   s1in->type       = TYPE_STRING;
 //   s1in->required   = NO;
-//   s1in->description= _("Stream name stem for step 0 output");
-//   s1in->answer     = G_store("s1in");
+//   s1in->description= "Stream name stem for step 0 output";
+//   s1in->answer     = "s1in";
 
   struct Option *s0bnd;
   s0bnd = G_define_option() ;
   s0bnd->key = S0BND;
   s0bnd->type       = TYPE_STRING;
   s0bnd->required   = NO;
-  s0bnd->description= _("Stream name for boundary data structure");
-  s0bnd->answer     = G_store(S0BND_ANS);
+  s0bnd->description= "Stream name for boundary data structure";
+  s0bnd->answer     = S0BND_ANS;
 
   /* Name for config file output */  
   struct Option *s1out;
@@ -270,8 +270,8 @@
   s1out->key = S1OUT;
   s1out->type       = TYPE_STRING;
   s1out->required   = NO;
-  s1out->description= _("Output file for step 1");
-  s1out->answer     = G_store(S1OUT_ANS);
+  s1out->description= "Output file for step 1";
+  s1out->answer     = S1OUT_ANS;
 
   /* Name for config file output */  
   struct Option *s2bout;
@@ -279,8 +279,8 @@
   s2bout->key = S2BOUT;
   s2bout->type       = TYPE_STRING;
   s2bout->required   = NO;
-  s2bout->description= _("Output file for source to boundary stream");
-  s2bout->answer     = G_store(S2BOUT_ANS);
+  s2bout->description= "Output file for source to boundary stream";
+  s2bout->answer     = S2BOUT_ANS;
 
   /* Name for config file output */  
   struct Option *config;
@@ -288,8 +288,8 @@
   config->key = CONFIG;
   config->type       = TYPE_STRING;
   config->required   = NO;
-  config->description= _("Name for config file");
-  config->answer     = G_store(CONFIG_ANS);
+  config->description= "Name for config file";
+  config->answer     = CONFIG_ANS;
 
  /* Name for config file output */  
   struct Option *phaseBnd;
@@ -297,8 +297,8 @@
   phaseBnd->key = PHASE2BND;
   phaseBnd->type       = TYPE_STRING;
   phaseBnd->required   = NO;
-  phaseBnd->description= _("Name for phase2Bnd file");
-  phaseBnd->answer     = G_store(PHASE2BND_ANS);
+  phaseBnd->description= "Name for phase2Bnd file";
+  phaseBnd->answer     = PHASE2BND_ANS;
 
 
   /* stats file */
@@ -307,21 +307,21 @@
   stats_opt->key = "stats";
   stats_opt->type       = TYPE_STRING;
   stats_opt->required   = NO;
-  stats_opt->description= _("Stats file");
-  stats_opt->answer     = G_store(STATS_ANS);
+  stats_opt->description= "Stats file";
+  stats_opt->answer     = STATS_ANS;
 
   struct Option *tilesAreSorted;
   tilesAreSorted =  G_define_option();
   tilesAreSorted->key         = "tilesAreSorted" ; 
   tilesAreSorted->type       = TYPE_STRING;
   tilesAreSorted->required   = NO;
-  tilesAreSorted->description  = _("Tiles are sorted (used in grid version) (yes/no)");
-  tilesAreSorted->answer = G_store("no");
+  tilesAreSorted->description  = "Tiles are sorted (used in grid version) (y/n)";
+  tilesAreSorted->answer = "no";
 
 
   /* ************************* */
   if (G_parser(argc, argv)) {
-    exit (EXIT_FAILURE);
+    exit (-1);
   }
   
   assert(opt);
@@ -369,7 +369,7 @@
   if(help_f->answer) {
 	G_usage();
 	printf(description);
-	exit(EXIT_SUCCESS);
+	exit(0);
   }
 
 



More information about the grass-commit mailing list