[Liblas-commits] hg: add LASPoint_SetHeader to C API. Note that this makes a cop...

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Jan 20 13:15:54 EST 2011


details:   http://hg.liblas.orghg/rev/39fbbdf0882b
changeset: 2796:39fbbdf0882b
user:      Howard Butler <hobu.inc at gmail.com>
date:      Thu Jan 20 12:15:41 2011 -0600
description:
add LASPoint_SetHeader to C API.  Note that this makes a copy right now because there's no proper shared_ptr in the C API

diffstat:

 include/liblas/capi/liblas.h |   6 ++++--
 src/c_api.cpp                |  11 +++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 2b07a62223ea -r 39fbbdf0882b include/liblas/capi/liblas.h
--- a/include/liblas/capi/liblas.h	Thu Jan 20 11:14:59 2011 -0600
+++ b/include/liblas/capi/liblas.h	Thu Jan 20 12:15:41 2011 -0600
@@ -503,8 +503,10 @@
 /** Returns a LASHeaderH representing the header for the point
  *  @param hPoint the LASPointH instance
  *  @return a LASHeaderH representing the header for the point
-*/
- LAS_DLL LASHeaderH LASPoint_GetHeader(const LASPointH hPoint);
+*/ 
+LAS_DLL LASHeaderH LASPoint_GetHeader(const LASPointH hPoint);
+
+LAS_DLL void LASPoint_SetHeader( LASPointH hPoint, const LASHeaderH hHeader);
 
 /****************************************************************************/
 /* Header operations                                                        */
diff -r 2b07a62223ea -r 39fbbdf0882b src/c_api.cpp
--- a/src/c_api.cpp	Thu Jan 20 11:14:59 2011 -0600
+++ b/src/c_api.cpp	Thu Jan 20 12:15:41 2011 -0600
@@ -469,6 +469,17 @@
         
 }
 
+LAS_DLL void LASPoint_SetHeader( LASPointH hPoint, const LASHeaderH hHeader) 
+
+{
+    VALIDATE_LAS_POINTER0(hPoint, "LASPoint_SetHeader");
+    VALIDATE_LAS_POINTER0(hHeader, "LASPoint_SetHeader");
+
+    liblas::Point* point = (liblas::Point*)hPoint;
+    liblas::Header* header = (liblas::Header*)hHeader;
+    liblas::HeaderPtr h = liblas::HeaderPtr(new liblas::Header(*header));
+    point->SetHeaderPtr(h);
+}
 
 LAS_DLL void LASPoint_Destroy(LASPointH hPoint) {
     VALIDATE_LAS_POINTER0(hPoint, "LASPoint_Destroy");


More information about the Liblas-commits mailing list