Преглед на файлове

adj_cellhd.c, rd_cellhd.c, get_cellhd.c moved back to gislib

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@38005 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa преди 16 години
родител
ревизия
8827c8f5c5
променени са 9 файла, в които са добавени 76 реда и са изтрити 28 реда
  1. 0 8
      include/Rast.h
  2. 8 0
      include/gisdefs.h
  3. 8 8
      lib/raster/adj_cellhd.c
  4. 1 1
      lib/gis/align_window.c
  5. 2 2
      lib/gis/get_window.c
  6. 7 7
      lib/raster/rd_cellhd.c
  7. 1 1
      lib/gis/set_window.c
  8. 48 0
      lib/raster/Makefile
  9. 1 1
      lib/raster/get_cellhd.c

+ 0 - 8
include/Rast.h

@@ -4,10 +4,6 @@
 
 /* --- ANSI prototypes for the lib/raster functions --- */
 
-/* adj_cellhd.c */
-const char *Rast_adjust_Cell_head(struct Cell_head *, int, int);
-const char *Rast_adjust_Cell_head3(struct Cell_head *, int, int, int);
-
 /* alloc_cell.c */
 size_t Rast_raster_size(RASTER_MAP_TYPE);
 CELL *Rast_allocate_cell_buf(void);
@@ -513,10 +509,6 @@ int Rast__raster_misc_read_line(const char *, const char *, const char *,
 			     char *);
 int Rast__raster_misc_write_line(const char *, const char *, const char *);
 
-/* rd_cellhd.c */
-char *Rast__read_Cell_head(FILE *, struct Cell_head *, int);
-char *Rast__read_Cell_head_array(char **, struct Cell_head *, int);
-
 /* reclass.c */
 int Rast_is_reclass(const char *, const char *, char *, char *);
 int Rast_is_reclassed_to(const char *, const char *, int *, char ***);

+ 8 - 0
include/gisdefs.h

@@ -46,6 +46,10 @@
 
 #include <sys/types.h>
 
+/* adj_cellhd.c */
+const char *G_adjust_Cell_head(struct Cell_head *, int, int);
+const char *G_adjust_Cell_head3(struct Cell_head *, int, int, int);
+
 /* align_window.c */
 const char *G_align_window(struct Cell_head *, const struct Cell_head *);
 
@@ -506,6 +510,10 @@ double G_meridional_radius_of_curvature(double, double, double);
 double G_transverse_radius_of_curvature(double, double, double);
 double G_radius_of_conformal_tangent_sphere(double, double, double);
 
+/* rd_cellhd.c */
+char *G__read_Cell_head(FILE *, struct Cell_head *, int);
+char *G__read_Cell_head_array(char **, struct Cell_head *, int);
+
 /* remove.c */
 int G_remove(const char *, const char *);
 int G_remove_misc(const char *, const char *, const char *);

+ 8 - 8
lib/raster/adj_cellhd.c

@@ -38,7 +38,7 @@
  * \return NULL on success
  * \return localized text string on error
  */
-const char *Rast_adjust_Cell_head(struct Cell_head *cellhd, int row_flag, int col_flag)
+const char *G_adjust_Cell_head(struct Cell_head *cellhd, int row_flag, int col_flag)
 {
     if (!row_flag) {
 	if (cellhd->ns_res <= 0)
@@ -65,7 +65,7 @@ const char *Rast_adjust_Cell_head(struct Cell_head *cellhd, int row_flag, int co
 	epsilon_ns = 1. / cellhd->rows * 0.001;
 	epsilon_ew = .000001;	/* epsilon_ew calculation doesn't work due to cellhd->cols update/global wraparound below */
 
-	G_debug(3, "Rast_adjust_Cell_head: epsilon_ns: %g, epsilon_ew: %g",
+	G_debug(3, "G_adjust_Cell_head: epsilon_ns: %g, epsilon_ew: %g",
 		epsilon_ns, epsilon_ew);
 
 	/* TODO: once working, change below G_warning to G_debug */
@@ -97,7 +97,7 @@ const char *Rast_adjust_Cell_head(struct Cell_head *cellhd, int row_flag, int co
 	/* DISABLED: this breaks global wrap-around */
 
 	G_debug(3,
-		"Rast_adjust_Cell_head()  cellhd->west: %f, devi: %g, eps: %g",
+		"G_adjust_Cell_head()  cellhd->west: %f, devi: %g, eps: %g",
 		cellhd->west, cellhd->west + 180.0, epsilon_ew);
 
 	if ((cellhd->west < -180.0) && ((cellhd->west + 180.0) < epsilon_ew)
@@ -108,7 +108,7 @@ const char *Rast_adjust_Cell_head(struct Cell_head *cellhd, int row_flag, int co
 	}
 
 	G_debug(3,
-		"Rast_adjust_Cell_head()  cellhd->east: %f, devi: %g, eps: %g",
+		"G_adjust_Cell_head()  cellhd->east: %f, devi: %g, eps: %g",
 		cellhd->east, cellhd->east - 180.0, epsilon_ew);
 
 	if ((cellhd->east > 180.0) && ((cellhd->east - 180.0) > epsilon_ew)
@@ -188,7 +188,7 @@ const char *Rast_adjust_Cell_head(struct Cell_head *cellhd, int row_flag, int co
  * \return NULL on success
  * \return localized text string on error
  */
-const char *Rast_adjust_Cell_head3(struct Cell_head *cellhd, int row_flag,
+const char *G_adjust_Cell_head3(struct Cell_head *cellhd, int row_flag,
 				int col_flag, int depth_flag)
 {
     if (!row_flag) {
@@ -232,7 +232,7 @@ const char *Rast_adjust_Cell_head3(struct Cell_head *cellhd, int row_flag,
 	epsilon_ns = 1. / cellhd->rows * 0.001;
 	epsilon_ew = .000001;	/* epsilon_ew calculation doesn't work due to cellhd->cols update/global wraparound below */
 
-	G_debug(3, "Rast_adjust_Cell_head: epsilon_ns: %g, epsilon_ew: %g",
+	G_debug(3, "G_adjust_Cell_head: epsilon_ns: %g, epsilon_ew: %g",
 		epsilon_ns, epsilon_ew);
 
 	/* TODO: once working, change below G_warning to G_debug */
@@ -264,7 +264,7 @@ const char *Rast_adjust_Cell_head3(struct Cell_head *cellhd, int row_flag,
 	/* DISABLED: this breaks global wrap-around */
 
 	G_debug(3,
-		"Rast_adjust_Cell_head3() cellhd->west: %f, devi: %g, eps: %g",
+		"G_adjust_Cell_head3() cellhd->west: %f, devi: %g, eps: %g",
 		cellhd->west, cellhd->west + 180.0, epsilon_ew);
 
 	if ((cellhd->west < -180.0) && ((cellhd->west + 180.0) < epsilon_ew)
@@ -275,7 +275,7 @@ const char *Rast_adjust_Cell_head3(struct Cell_head *cellhd, int row_flag,
 	}
 
 	G_debug(3,
-		"Rast_adjust_Cell_head3() cellhd->east: %f, devi: %g, eps: %g",
+		"G_adjust_Cell_head3() cellhd->east: %f, devi: %g, eps: %g",
 		cellhd->east, cellhd->east - 180.0, epsilon_ew);
 
 	if ((cellhd->east > 180.0) && ((cellhd->east - 180.0) > epsilon_ew)

+ 1 - 1
lib/gis/align_window.c

@@ -71,5 +71,5 @@ const char *G_align_window(struct Cell_head *window, const struct Cell_head *ref
 		window->east -= window->ew_res;
     }
 
-    return Rast_adjust_Cell_head(window, 0, 0);
+    return G_adjust_Cell_head(window, 0, 0);
 }

+ 2 - 2
lib/gis/get_window.c

@@ -59,7 +59,7 @@ void G_get_window(struct Cell_head *window)
 
     if (regvar) {
 	char **tokens = G_tokenize(regvar, ";");
-	err = Rast__read_Cell_head_array(tokens, &st->dbwindow, 0);
+	err = G__read_Cell_head_array(tokens, &st->dbwindow, 0);
 	G_free_tokens(tokens);
     }
     else {
@@ -128,7 +128,7 @@ char *G__get_window(struct Cell_head *window,
     if (!fp)
 	return G_store(_("is not set"));
 
-    err = Rast__read_Cell_head(fp, window, 0);
+    err = G__read_Cell_head(fp, window, 0);
     fclose(fp);
 
     if (err) {

+ 7 - 7
lib/raster/rd_cellhd.c

@@ -39,16 +39,16 @@ static char *error(const char *, int);
 #define SET(x) flags|=(1<<x)
 #define TEST(x) (flags&(1<<x))
 
-char *Rast__read_Cell_head_array(char **array,
+char *G__read_Cell_head_array(char **array,
 			      struct Cell_head *cellhd, int is_cellhd);
 
-char *Rast__read_Cell_head(FILE * fd, struct Cell_head *cellhd, int is_cellhd)
+char *G__read_Cell_head(FILE * fd, struct Cell_head *cellhd, int is_cellhd)
 {
     int count;
     char *result, **array;
     char buf[1024];
 
-    G_debug(2, "Rast__read_Cell_head");
+    G_debug(2, "G__read_Cell_head");
 
     /* Count lines */
     count = 0;
@@ -65,7 +65,7 @@ char *Rast__read_Cell_head(FILE * fd, struct Cell_head *cellhd, int is_cellhd)
 	count++;
     }
 
-    result = Rast__read_Cell_head_array(array, cellhd, is_cellhd);
+    result = G__read_Cell_head_array(array, cellhd, is_cellhd);
 
     count = 0;
     while (array[count]) {
@@ -78,7 +78,7 @@ char *Rast__read_Cell_head(FILE * fd, struct Cell_head *cellhd, int is_cellhd)
 }
 
 /* Read window from NULL terminated array of strings */
-char *Rast__read_Cell_head_array(char **array,
+char *G__read_Cell_head_array(char **array,
 			      struct Cell_head *cellhd, int is_cellhd)
 {
     char *buf;
@@ -88,7 +88,7 @@ char *Rast__read_Cell_head_array(char **array,
     int flags;
     const char *err;
 
-    G_debug(2, "Rast__read_Cell_head_array");
+    G_debug(2, "G__read_Cell_head_array");
 
     flags = 0;
 
@@ -379,7 +379,7 @@ char *Rast__read_Cell_head_array(char **array,
     }
 
     /* Adjust and complete the cell header  */
-    if ((err = Rast_adjust_Cell_head(cellhd, TEST(F_ROWS), TEST(F_COLS))))
+    if ((err = G_adjust_Cell_head(cellhd, TEST(F_ROWS), TEST(F_COLS))))
 	ERROR(err, 0);
 
 

+ 1 - 1
lib/gis/set_window.c

@@ -53,7 +53,7 @@ int G_set_window(struct Cell_head *window)
        window = &twindow;
      */
 
-    if ((err = Rast_adjust_Cell_head(window, 0, 0))) {
+    if ((err = G_adjust_Cell_head(window, 0, 0))) {
 	G_warning("G_set_window(): %s", err);
 	return -1;
     }

+ 48 - 0
lib/raster/Makefile

@@ -0,0 +1,48 @@
+MODULE_TOPDIR = ../..
+
+GDAL_LINK = $(USE_GDAL)
+GDAL_DYNAMIC = 1
+
+LIB_NAME = $(RASTR_LIBNAME)
+EXTRA_LIBS = $(XDRLIB) $(SOCKLIB) $(DATETIMELIB) $(PTHREADLIBPATH) \
+	$(PTHREADLIB) $(INTLLIB) $(MATHLIB) $(GISLIB)
+EXTRA_INC = $(ZLIBINCPATH) $(PTHREADINCPATH)
+
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+include $(MODULE_TOPDIR)/include/Make/Lib.make
+include $(MODULE_TOPDIR)/include/Make/Doxygen.make
+
+#compile if LFS Large File Support present:
+ifneq ($(USE_LARGEFILES),)
+	EXTRA_CFLAGS = -D_FILE_OFFSET_BITS=64
+endif
+
+ifneq ($(GDAL_LINK),)
+EXTRA_CFLAGS += -DGDAL_LINK=1
+EXTRA_INC += $(PROJINC) $(GDALCFLAGS)
+
+ifneq ($(GDAL_DYNAMIC),)
+EXTRA_CFLAGS += -DGDAL_DYNAMIC=1
+ifneq ($(MINGW),)
+EXTRA_LIBS += -lkernel32
+else
+EXTRA_LIBS += $(DLLIB)
+endif
+else
+EXTRA_LIBS += $(GDALLIBS)
+endif
+
+endif
+
+default: lib
+
+DOXNAME = rasterlib
+
+$(OBJDIR)/auto_mask.o: G.h
+$(OBJDIR)/closecell.o: G.h
+$(OBJDIR)/format.o: G.h
+$(OBJDIR)/get_row.o: G.h
+$(OBJDIR)/get_window.o: G.h
+$(OBJDIR)/maskfd.o: G.h
+$(OBJDIR)/opencell.o: G.h
+$(OBJDIR)/put_row.o: G.h

+ 1 - 1
lib/raster/get_cellhd.c

@@ -90,7 +90,7 @@ int Rast_get_cellhd(const char *name, const char *mapset,
 	}
     }
 
-    Rast__read_Cell_head(fd, cellhd, 1);
+    G__read_Cell_head(fd, cellhd, 1);
     fclose(fd);
 
     return 0;