[GRASS-SVN] r49038 - in grass-addons/vector: . v.out.ply

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Nov 1 09:20:06 EDT 2011


Author: neteler
Date: 2011-11-01 06:20:06 -0700 (Tue, 01 Nov 2011)
New Revision: 49038

Added:
   grass-addons/vector/v.out.ply/
   grass-addons/vector/v.out.ply/Makefile
   grass-addons/vector/v.out.ply/description.html
   grass-addons/vector/v.out.ply/v.out.ply
Log:
new

Added: grass-addons/vector/v.out.ply/Makefile
===================================================================
--- grass-addons/vector/v.out.ply/Makefile	                        (rev 0)
+++ grass-addons/vector/v.out.ply/Makefile	2011-11-01 13:20:06 UTC (rev 49038)
@@ -0,0 +1,7 @@
+MODULE_TOPDIR = ../..
+
+PGM = v.out.ply
+
+include $(MODULE_TOPDIR)/include/Make/Script.make
+
+default: script


Property changes on: grass-addons/vector/v.out.ply/Makefile
___________________________________________________________________
Added: svn:mime-type
   + text/x-makefile
Added: svn:eol-style
   + native

Added: grass-addons/vector/v.out.ply/description.html
===================================================================
--- grass-addons/vector/v.out.ply/description.html	                        (rev 0)
+++ grass-addons/vector/v.out.ply/description.html	2011-11-01 13:20:06 UTC (rev 49038)
@@ -0,0 +1,26 @@
+<h2>DESCRIPTION</h2>
+
+<em>v.out.ply</em> exports vector point clouds from GRASS into a PLY file
+(<a href="http://en.wikipedia.org/wiki/PLY_%28file_format%29">PLY format</a>).
+<br>
+If color definitions are present for each point, they will be exported as well.
+
+<h2>EXAMPLE</h2>
+
+<div class="code"><pre>
+v.out.ply archaeo_pointcloud
+</pre></div>
+
+<h2>SEE ALSO</h2>
+
+<em>
+<a href="v.out.ascii.html">v.out.ascii</a>,
+<a href="v.out.ascii.db.html">v.out.ascii.db</a> (GRASS extension)
+</em>
+
+<h2>AUTHOR</h2>
+
+Markus Neteler<br>
+during his visit at <a href="http://www.topoi.org/">TOPOI Excellence Cluster</a>, FU Berlin, Germany
+
+<p><i>Last changed: $Date$</i>


Property changes on: grass-addons/vector/v.out.ply/description.html
___________________________________________________________________
Added: svn:mime-type
   + text/html
Added: svn:keywords
   + Author Date Id
Added: svn:eol-style
   + native

Added: grass-addons/vector/v.out.ply/v.out.ply
===================================================================
--- grass-addons/vector/v.out.ply/v.out.ply	                        (rev 0)
+++ grass-addons/vector/v.out.ply/v.out.ply	2011-11-01 13:20:06 UTC (rev 49038)
@@ -0,0 +1,113 @@
+#!/bin/sh
+
+############################################################################
+#
+# MODULE:       v.in.ply
+#
+# AUTHOR(S):    Markus Neteler
+#
+# PURPOSE:      Imports PLY file as a GRASS vector map
+#               http://en.wikipedia.org/wiki/PLY_%28file_format%29
+#               If RGB colors are present in the PLY file, automatically
+#               a GRASSRGB column is created and populated with RRR:GGG:BBB
+#
+# COPYRIGHT:    (c) 2011 Markus Neteler, GRASS Development Team
+#
+#               This program is free software under the GNU General Public
+#               License (>=v2). Read the file COPYING that comes with GRASS
+#               for details.
+#
+#############################################################################
+
+#%Module
+#%  description: Export a vector map as PLY file.
+#%  keywords: vector, export
+#%End
+#%option
+#% key: vect
+#% type: string
+#% gisprompt: old,vector,vector
+#% description: Name for input vector map
+#% required : yes
+#%end
+#%option
+#% key: file
+#% type: string
+#% description: PLY file
+#% gisprompt: new_file,file,input
+#% required : no
+#%end
+
+if  [ -z "$GISBASE" ] ; then
+    echo "You must be in GRASS GIS to run this program." >&2
+ exit 1
+fi
+
+# save command line
+if [ "$1" != "@ARGS_PARSED@" ] ; then
+    CMDLINE=`basename "$0"`
+    for arg in "$@" ; do
+        CMDLINE="$CMDLINE \"$arg\""
+    done
+    export CMDLINE
+    exec g.parser "$0" "$@"
+fi
+
+PROG=`basename "$0"`
+
+#### check if we have awk
+if [ ! -x "`which awk`" ] ; then
+    g.message -e "awk required, please install awk or gawk first"
+    exit 1
+fi
+
+# setting environment, so that awk works properly in all languages
+unset LC_ALL
+LC_NUMERIC=C
+export LC_NUMERIC
+
+MAP="$GIS_OPT_VECT"
+
+if [ -n "$GIS_OPT_FILE" ] ; then
+    OUT="$GIS_OPT_FILE"
+else
+    OUT=$GIS_OPT_VECT.ply
+fi
+
+eval `v.info -t $MAP`
+POINTS=$points
+
+echo "Exporting $POINTS points..."
+
+echo "ply
+format ascii 1.0
+comment VCGLIB generated
+element vertex $POINTS
+property float x
+property float y
+property float z
+property uchar red
+property uchar green
+property uchar blue
+property uchar alpha
+element face 0
+property list uchar int vertex_indices
+end_header" > $OUT
+
+
+v.info -c $MAP | grep GRASSRGB > /dev/null
+if [ $? -eq 1 ] ; then
+   v.out.ascii $MAP | tr '|' ' ' | tr ':' ' ' >> $OUT
+else
+   # g.extension v.out.ascii.db
+   if [ ! -x "`which v.out.ascii.db`" ] ; then
+      g.message -e "v.out.ascii.db required, please install first with 'g.extension v.out.ascii.db'"
+      exit 1
+   fi
+   v.out.ascii.db $MAP columns=GRASSRGB,alpha | cut -d'|' -f2-6 | tr '|' ' ' | tr ':' ' ' >> $OUT
+fi
+
+# write cmd history:
+v.support "$MAP" cmdhist="${CMDLINE}"
+
+exit 0


Property changes on: grass-addons/vector/v.out.ply/v.out.ply
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/x-sh
Added: svn:eol-style
   + native



More information about the grass-commit mailing list