[GRASS-SVN] r31533 - in grass/trunk: macosx/app swig swig/python
swig/python/NumPtr swig/python/examples tools
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon May 26 13:07:18 EDT 2008
Author: neteler
Date: 2008-05-26 13:07:18 -0400 (Mon, 26 May 2008)
New Revision: 31533
Added:
grass/trunk/swig/python/python_grass7.i
Removed:
grass/trunk/swig/python/python_grass6.i
Modified:
grass/trunk/macosx/app/Info.plist.in
grass/trunk/swig/python/Makefile.in
grass/trunk/swig/python/NumPtr/README.GRASS
grass/trunk/swig/python/README
grass/trunk/swig/python/examples/m.distance
grass/trunk/swig/python/examples/rasteraccess.py
grass/trunk/swig/python/examples/vectoraccess.py
grass/trunk/swig/python/test.py
grass/trunk/swig/swiglib.dox
grass/trunk/tools/build_html_index.sh
Log:
boosted to GRASS 7 for parallel installation
Modified: grass/trunk/macosx/app/Info.plist.in
===================================================================
--- grass/trunk/macosx/app/Info.plist.in 2008-05-26 16:55:41 UTC (rev 31532)
+++ grass/trunk/macosx/app/Info.plist.in 2008-05-26 17:07:18 UTC (rev 31533)
@@ -11,9 +11,9 @@
<key>CFBundleIconFile</key>
<string>app.icns</string>
<key>CFBundleIdentifier</key>
- <string>org.osgeo.grass6</string>
+ <string>org.osgeo.grass7</string>
<key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
+ <string>7.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Modified: grass/trunk/swig/python/Makefile.in
===================================================================
--- grass/trunk/swig/python/Makefile.in 2008-05-26 16:55:41 UTC (rev 31532)
+++ grass/trunk/swig/python/Makefile.in 2008-05-26 17:07:18 UTC (rev 31533)
@@ -11,24 +11,24 @@
#SUBDIRS = NumPtr
#include $(MODULE_TOPDIR)/include/Make/Dir.make
-default: python_grass6.so
+default: python_grass7.so
clean:
- -rm -f *.o *.so python_grass6_wrap.c python_grass6.pyc python_grass6.py
+ -rm -f *.o *.so python_grass7_wrap.c python_grass7.pyc python_grass7.py
distclean: clean
-rm -f Makefile
-python_grass6_wrap.c: python_grass6.i
+python_grass7_wrap.c: python_grass7.i
$(MAKE) -C interfaces
$(SWIG) -python -shadow $<
-python_grass6_wrap.o: python_grass6_wrap.c
+python_grass7_wrap.o: python_grass7_wrap.c
$(CC) $(CFLAGS) $(INCLUDE_DIRS) $<
-python_grass6.so: python_grass6_wrap.o
- $(LD) $(LDFLAGS) $< -o _python_grass6.so
+python_grass7.so: python_grass7_wrap.o
+ $(LD) $(LDFLAGS) $< -o _python_grass7.so
# doxygen:
DOXNAME=
Modified: grass/trunk/swig/python/NumPtr/README.GRASS
===================================================================
--- grass/trunk/swig/python/NumPtr/README.GRASS 2008-05-26 16:55:41 UTC (rev 31532)
+++ grass/trunk/swig/python/NumPtr/README.GRASS 2008-05-26 17:07:18 UTC (rev 31533)
@@ -24,7 +24,7 @@
How to install:
Copy the fruits of the build into the same place as the GRASS SWIG
- module (_python_grass6.so etc.). for example:
+ module (_python_grass7.so etc.). for example:
cp build/lib.linux-i686-2.4/*NumPtr.* ../
or to some place on your system:
Modified: grass/trunk/swig/python/README
===================================================================
--- grass/trunk/swig/python/README 2008-05-26 16:55:41 UTC (rev 31532)
+++ grass/trunk/swig/python/README 2008-05-26 17:07:18 UTC (rev 31533)
@@ -16,11 +16,11 @@
3. Run make in the swig/python/ directory
-It will create two files, python_grass6.py and _python_grass6.so.
+It will create two files, python_grass7.py and _python_grass7.so.
4. From within GRASS (or a fake grass session) run "python test.py" to
test and to automatically create a byte-compiled version of the module
- (python_grass6.pyc). The .pyc file is platform independent and may be
+ (python_grass7.pyc). The .pyc file is platform independent and may be
safely shared among systems. Even so, it doesn't hurt to rebuild it
ourselves while we still have write permissions and to make sure we
are using an up to date copy. (out of date copies will be ignored)
@@ -31,11 +31,11 @@
How to use it?
--------------
-import python_grass6
+import python_grass7
GRASS functions will be available in this module.
Eg:
- import python_grass6
- mapset=python_grass6.G_mapset()
+ import python_grass7
+ mapset=python_grass7.G_mapset()
print mapset
See examples/m.distance for an example of a working SWIG-Python module.
Modified: grass/trunk/swig/python/examples/m.distance
===================================================================
--- grass/trunk/swig/python/examples/m.distance 2008-05-26 16:55:41 UTC (rev 31532)
+++ grass/trunk/swig/python/examples/m.distance 2008-05-26 17:07:18 UTC (rev 31533)
@@ -54,24 +54,24 @@
#### add your code here ####
# run this before starting python to append module search path:
- # export PYTHONPATH=/usr/src/grass63/swig/python
+ # export PYTHONPATH=/usr/src/grass70/swig/python
# check with "import sys; sys.path"
# or:
- sys.path.append("/usr/src/grass63/swig/python")
- # FIXME: install the g6lib.py bindings in $GISBASE/lib/ ?
- import python_grass6 as g6lib
+ sys.path.append("/usr/src/grass70/swig/python")
+ # FIXME: install the g7lib.py bindings in $GISBASE/lib/ ?
+ import python_grass7 as g7lib
# for passing pointers
import Numeric
import NumPtr
- g6lib.G_gisinit('m.distance')
+ g7lib.G_gisinit('m.distance')
# returns 0 on success
### calc distance ###
- proj_type = g6lib.G_begin_distance_calculations()
+ proj_type = g7lib.G_begin_distance_calculations()
# returns 0 if projection has no metrix (ie. imagery)
# returns 1 if projection is planimetric
# returns 2 if projection is latitude-longitude
@@ -114,8 +114,8 @@
# TODO: for clarity, figure out how to replace "3" with
# the defined LOCATION_LL constant from gis.i
- g6lib.G_scan_easting(coords[0], eastPtr, 3)
- g6lib.G_scan_northing(coords[1], northPtr, 3)
+ g7lib.G_scan_easting(coords[0], eastPtr, 3)
+ g7lib.G_scan_northing(coords[1], northPtr, 3)
x1 = float(easting)
y1 = float(northing)
else:
@@ -129,15 +129,15 @@
for i in range(1, (len(coords) / 2)):
if proj_type == 2:
- g6lib.G_scan_easting (coords[ i*2 + 0 ], eastPtr, 3)
- g6lib.G_scan_northing(coords[ i*2 + 1 ], northPtr, 3)
+ g7lib.G_scan_easting (coords[ i*2 + 0 ], eastPtr, 3)
+ g7lib.G_scan_northing(coords[ i*2 + 1 ], northPtr, 3)
x2 = float(easting)
y2 = float(northing)
else:
x2 = float(coords[ i*2 + 0 ])
y2 = float(coords[ i*2 + 1 ])
- segment_distance = g6lib.G_distance(x1, y1, x2, y2)
+ segment_distance = g7lib.G_distance(x1, y1, x2, y2)
overall_distance += segment_distance
print "segment %d distance is %.2f meters" % (i, segment_distance)
@@ -160,7 +160,7 @@
if len(coords) < 6:
return
- g6lib.G_begin_polygon_area_calculations()
+ g7lib.G_begin_polygon_area_calculations()
# returns 0 if the projection is not measurable (ie. imagery or xy)
# returns 1 if the projection is planimetric (ie. UTM or SP)
# returns 2 if the projection is non-planimetric (ie. latitude-longitude)
@@ -178,7 +178,7 @@
Ys = Numeric.array(y, Numeric.Float64)
Yptr = NumPtr.getpointer(Ys)
- area = g6lib.G_area_of_polygon(Xptr, Yptr, npoints)
+ area = g7lib.G_area_of_polygon(Xptr, Yptr, npoints)
print "AREA: %10.2f square meters" % area
print
@@ -186,9 +186,9 @@
# we don't need this, but just to have a look
if False:
if proj_type == 1:
- g6lib.G_database_units_to_meters_factor()
+ g7lib.G_database_units_to_meters_factor()
# 1.0
- print "Location units are", g6lib.G_database_unit_name(True)
+ print "Location units are", g7lib.G_database_unit_name(True)
#### end of your code ####
Modified: grass/trunk/swig/python/examples/rasteraccess.py
===================================================================
--- grass/trunk/swig/python/examples/rasteraccess.py 2008-05-26 16:55:41 UTC (rev 31532)
+++ grass/trunk/swig/python/examples/rasteraccess.py 2008-05-26 17:07:18 UTC (rev 31533)
@@ -3,7 +3,7 @@
# run within GRASS Spearfish session
import os, sys
-import python_grass6 as g6lib
+import python_grass7 as g7lib
if not os.environ.has_key("GISBASE"):
print "You must be in GRASS GIS to run this program."
@@ -12,17 +12,17 @@
input = 'elevation.dem'
mapset = 'PERMANENT'
-g6lib.G_gisinit('')
-infd = g6lib.G_open_cell_old(input, mapset)
+g7lib.G_gisinit('')
+infd = g7lib.G_open_cell_old(input, mapset)
-cell = g6lib.G_allocate_cell_buf()
+cell = g7lib.G_allocate_cell_buf()
rown=0
while 1:
- myrow = g6lib.G_get_map_row_nomask(infd, cell, rown)
+ myrow = g7lib.G_get_map_row_nomask(infd, cell, rown)
print rown,myrow[0:10]
rown = rown+1
if rown==476:break
-g6lib.G_close_cell(infd)
-g6lib.G_free(cell)
+g7lib.G_close_cell(infd)
+g7lib.G_free(cell)
Modified: grass/trunk/swig/python/examples/vectoraccess.py
===================================================================
--- grass/trunk/swig/python/examples/vectoraccess.py 2008-05-26 16:55:41 UTC (rev 31532)
+++ grass/trunk/swig/python/examples/vectoraccess.py 2008-05-26 17:07:18 UTC (rev 31533)
@@ -3,7 +3,7 @@
# run within GRASS Spearfish session
import os, sys
-import python_grass6 as g6lib
+import python_grass7 as g7lib
if not os.environ.has_key("GISBASE"):
print "You must be in GRASS GIS to run this program."
@@ -17,31 +17,31 @@
mapset = 'PERMANENT'
# initialize
-g6lib.G_gisinit('')
+g7lib.G_gisinit('')
# define map structure
-map = g6lib.Map_info()
+map = g7lib.Map_info()
# define open level (level 2: topology)
-g6lib.Vect_set_open_level (2)
+g7lib.Vect_set_open_level (2)
# open existing map
-g6lib.Vect_open_old(map, input, mapset)
+g7lib.Vect_open_old(map, input, mapset)
# query
print 'Vect map: ', input
-print 'Vect is 3D: ', g6lib.Vect_is_3d (map)
-print 'Vect DB links: ', g6lib.Vect_get_num_dblinks(map)
-print 'Map Scale: 1:', g6lib.Vect_get_scale(map)
+print 'Vect is 3D: ', g7lib.Vect_is_3d (map)
+print 'Vect DB links: ', g7lib.Vect_get_num_dblinks(map)
+print 'Map Scale: 1:', g7lib.Vect_get_scale(map)
# misleading:
-# print 'Number of lines:', g6lib.Vect_get_num_lines(map)
-print 'Number of points: ', g6lib.Vect_get_num_primitives(map,g6lib.GV_POINT)
+# print 'Number of lines:', g7lib.Vect_get_num_lines(map)
+print 'Number of points: ', g7lib.Vect_get_num_primitives(map,g7lib.GV_POINT)
# confusing:
-#print 'Number of lines: ', g6lib.Vect_get_num_primitives(map,g6lib.GV_LINE)
-#print 'Number of areas:', g6lib.Vect_get_num_primitives(map,g6lib.GV_AREA)
-print 'Number of areas:', g6lib.Vect_get_num_areas(map)
+#print 'Number of lines: ', g7lib.Vect_get_num_primitives(map,g7lib.GV_LINE)
+#print 'Number of areas:', g7lib.Vect_get_num_primitives(map,g7lib.GV_AREA)
+print 'Number of areas:', g7lib.Vect_get_num_areas(map)
# close map
-g6lib.Vect_close(map)
+g7lib.Vect_close(map)
## end of the python script
Deleted: grass/trunk/swig/python/python_grass6.i
===================================================================
--- grass/trunk/swig/python/python_grass6.i 2008-05-26 16:55:41 UTC (rev 31532)
+++ grass/trunk/swig/python/python_grass6.i 2008-05-26 17:07:18 UTC (rev 31533)
@@ -1,34 +0,0 @@
-//File : python_grass6.i
-
-%include "carrays.i"
-%array_functions(int, intArray);
-%array_functions(float, floatArray);
-%array_functions(double, doubleArray);
-
-%include "cpointer.i"
-%pointer_functions(int, intp);
-%pointer_functions(float, floatp);
-%pointer_functions(double, doublep);
-
-%module python_grass6
-%{
-#include <stdio.h>
-#include <stdarg.h>
-#include <grass/gis.h>
-#include <grass/gisdefs.h>
-#include <grass/imagery.h>
-#include <grass/imagedefs.h>
-#include <grass/Vect.h>
-#include <grass/vect/dig_structs.h>
-%}
-
-%include "my_typemaps.i"
-%include "renames.i"
-%include "interfaces/gis.i"
-%include "interfaces/gisdefs.i"
-%include "interfaces/imagery.i"
-%include "interfaces/imagedefs.i"
-%include "interfaces/vect.i"
-%include "interfaces/dig_structs.i"
-%include "interfaces/dig_types.i"
-
Copied: grass/trunk/swig/python/python_grass7.i (from rev 31531, grass/trunk/swig/python/python_grass6.i)
===================================================================
--- grass/trunk/swig/python/python_grass7.i (rev 0)
+++ grass/trunk/swig/python/python_grass7.i 2008-05-26 17:07:18 UTC (rev 31533)
@@ -0,0 +1,34 @@
+//File : python_grass7.i
+
+%include "carrays.i"
+%array_functions(int, intArray);
+%array_functions(float, floatArray);
+%array_functions(double, doubleArray);
+
+%include "cpointer.i"
+%pointer_functions(int, intp);
+%pointer_functions(float, floatp);
+%pointer_functions(double, doublep);
+
+%module python_grass7
+%{
+#include <stdio.h>
+#include <stdarg.h>
+#include <grass/gis.h>
+#include <grass/gisdefs.h>
+#include <grass/imagery.h>
+#include <grass/imagedefs.h>
+#include <grass/Vect.h>
+#include <grass/vect/dig_structs.h>
+%}
+
+%include "my_typemaps.i"
+%include "renames.i"
+%include "interfaces/gis.i"
+%include "interfaces/gisdefs.i"
+%include "interfaces/imagery.i"
+%include "interfaces/imagedefs.i"
+%include "interfaces/vect.i"
+%include "interfaces/dig_structs.i"
+%include "interfaces/dig_types.i"
+
Modified: grass/trunk/swig/python/test.py
===================================================================
--- grass/trunk/swig/python/test.py 2008-05-26 16:55:41 UTC (rev 31532)
+++ grass/trunk/swig/python/test.py 2008-05-26 17:07:18 UTC (rev 31533)
@@ -5,7 +5,7 @@
import os, sys
-import python_grass6 as g6lib
+import python_grass7 as g7lib
if not os.environ.has_key("GISBASE"):
print "You must be in GRASS GIS to run this program."
@@ -14,16 +14,16 @@
rname = 'elevation.dem'
mapset = 'PERMANENT'
-g6lib.G_gisinit('')
-g6lib.G_find_cell2(rname,'')
+g7lib.G_gisinit('')
+g7lib.G_find_cell2(rname,'')
print mapset
print 'prints 0 if map was found'
print 'roads:'
-print g6lib.G_raster_map_type('roads',mapset)
+print g7lib.G_raster_map_type('roads',mapset)
print 'elevation.dem:'
-print g6lib.G_raster_map_type(rname,mapset)
+print g7lib.G_raster_map_type(rname,mapset)
Modified: grass/trunk/swig/swiglib.dox
===================================================================
--- grass/trunk/swig/swiglib.dox 2008-05-26 16:55:41 UTC (rev 31532)
+++ grass/trunk/swig/swiglib.dox 2008-05-26 17:07:18 UTC (rev 31533)
@@ -57,7 +57,7 @@
<ul>
<li> in <a href="http://grass.osgeo.org/devel/index.php#software">GRASS SVN</a>
-<li> in the <a href="http://grass.osgeo.org/grass63/source/snapshot/">weekly SVN snapshot</a> (swig/ subdirectory)
+<li> in the <a href="http://grass.osgeo.org/grass70/source/snapshot/">weekly SVN snapshot</a> (swig/ subdirectory)
<li> via <a href="http://trac.osgeo.org/grass/browser/grass">SVN TracBrowser interface</a>
</ul>
Modified: grass/trunk/tools/build_html_index.sh
===================================================================
--- grass/trunk/tools/build_html_index.sh 2008-05-26 16:55:41 UTC (rev 31532)
+++ grass/trunk/tools/build_html_index.sh 2008-05-26 17:07:18 UTC (rev 31533)
@@ -79,9 +79,9 @@
<h3>Quick Introduction</h3>
-<!-- the files grass6.html & helptext.html file live in lib/init/ -->
+<!-- the files grass7.html & helptext.html file live in lib/init/ -->
<ul>
-<li><a href=\"grass6.html\">GRASS startup manual page</a></li>
+<li><a href=\"grass7.html\">GRASS startup manual page</a></li>
<li><a href=\"helptext.html\">How to start with GRASS</a></li>
<li>Introductions
<ul>
More information about the grass-commit
mailing list