[Liblas-commits] hg: move old summary stuff out of the C API header
and into its ...
liblas-commits at liblas.org
liblas-commits at liblas.org
Tue Jan 18 12:24:29 EST 2011
details: http://hg.liblas.orghg/rev/185d9a70c1d5
changeset: 2777:185d9a70c1d5
user: Howard Butler <hobu.inc at gmail.com>
date: Tue Jan 18 11:23:59 2011 -0600
description:
move old summary stuff out of the C API header and into its own private header
Subject: hg: add methods for getting and setting raw data on the point along with fetching the point's header reference
details: http://hg.liblas.orghg/rev/a8d635156691
changeset: 2778:a8d635156691
user: Howard Butler <hobu.inc at gmail.com>
date: Tue Jan 18 11:24:20 2011 -0600
description:
add methods for getting and setting raw data on the point along with fetching the point's header reference
diffstat:
apps/las2las-old.c | 2 +
apps/lascommon.c | 5 ++
apps/lascommon.h | 37 +++++++++++++++
apps/lasinfo-old.c | 2 +
apps/lasmerge.c | 1 +
include/liblas/capi/liblas.h | 102 ++++++++++++++++++++++++++----------------
src/c_api.cpp | 88 +++++++++++++++++++++++++++++++++++++
7 files changed, 198 insertions(+), 39 deletions(-)
diffs (truncated from 371 to 300 lines):
diff -r 77d092db4f1a -r a8d635156691 apps/las2las-old.c
--- a/apps/las2las-old.c Tue Jan 18 10:58:47 2011 -0600
+++ b/apps/las2las-old.c Tue Jan 18 11:24:20 2011 -0600
@@ -12,6 +12,8 @@
**************************************************************************/
#include "liblas.h"
+#include "lascommon.h"
+
/* std */
#include <assert.h>
#include <time.h>
diff -r 77d092db4f1a -r a8d635156691 apps/lascommon.c
--- a/apps/lascommon.c Tue Jan 18 10:58:47 2011 -0600
+++ b/apps/lascommon.c Tue Jan 18 11:24:20 2011 -0600
@@ -1,3 +1,5 @@
+
+
/* liblas */
#include <liblas.h>
#ifdef HAVE_LIBGEOTIFF
@@ -9,6 +11,9 @@
#include <stdlib.h>
#include <string.h>
+#include "lascommon.h"
+
+
static const char * LASPointClassification [] = {
"Created, never classified",
"Unclassified",
diff -r 77d092db4f1a -r a8d635156691 apps/lascommon.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/lascommon.h Tue Jan 18 11:24:20 2011 -0600
@@ -0,0 +1,37 @@
+
+
+#ifndef LASCOMMON_H_INCLUDED
+#define LASCOMMON_H_INCLUDED
+
+
+/**
+ * \todo to be documented
+ */
+typedef struct {
+
+ double t;
+ double x, y, z;
+ unsigned short intensity;
+ unsigned char cls;
+ char scan_angle;
+ unsigned char user_data;
+ unsigned short retnum;
+ unsigned short numret;
+ unsigned short scandir;
+ unsigned short fedge;
+ unsigned short red;
+ unsigned short green;
+ unsigned short blue;
+ long rgpsum;
+ int number_of_point_records;
+ int number_of_points_by_return[8];
+ int number_of_returns_of_given_pulse[8];
+ int classification[32];
+ int classification_synthetic;
+ int classification_keypoint;
+ int classification_withheld;
+ LASPointH pmax;
+ LASPointH pmin;
+} LASPointSummary;
+
+#endif
\ No newline at end of file
diff -r 77d092db4f1a -r a8d635156691 apps/lasinfo-old.c
--- a/apps/lasinfo-old.c Tue Jan 18 10:58:47 2011 -0600
+++ b/apps/lasinfo-old.c Tue Jan 18 11:24:20 2011 -0600
@@ -28,6 +28,8 @@
#include <cpl_string.h>
#endif
+#include "lascommon.h"
+
LASPointSummary* SummarizePoints(LASReaderH reader);
void print_point_summary(FILE *file, LASPointSummary* summary, LASHeaderH header);
void print_header(FILE *file, LASHeaderH header, const char* file_name, int bSkipVLR, int bWKT);
diff -r 77d092db4f1a -r a8d635156691 apps/lasmerge.c
--- a/apps/lasmerge.c Tue Jan 18 10:58:47 2011 -0600
+++ b/apps/lasmerge.c Tue Jan 18 11:24:20 2011 -0600
@@ -18,6 +18,7 @@
#include <string.h>
#include "liblas.h"
+#include "lascommon.h"
LASPointSummary* SummarizePoints(LASReaderH reader);
void print_point_summary(FILE *file, LASPointSummary* summary, LASHeaderH header);
diff -r 77d092db4f1a -r a8d635156691 include/liblas/capi/liblas.h
--- a/include/liblas/capi/liblas.h Tue Jan 18 10:58:47 2011 -0600
+++ b/include/liblas/capi/liblas.h Tue Jan 18 11:24:20 2011 -0600
@@ -78,35 +78,6 @@
LE_Fatal = 4
} LASError;
-/**
- * \todo to be documented
- */
-typedef struct {
-
- double t;
- double x, y, z;
- unsigned short intensity;
- unsigned char cls;
- char scan_angle;
- unsigned char user_data;
- unsigned short retnum;
- unsigned short numret;
- unsigned short scandir;
- unsigned short fedge;
- unsigned short red;
- unsigned short green;
- unsigned short blue;
- long rgpsum;
- int number_of_point_records;
- int number_of_points_by_return[8];
- int number_of_returns_of_given_pulse[8];
- int classification[32];
- int classification_synthetic;
- int classification_keypoint;
- int classification_withheld;
- LASPointH pmax;
- LASPointH pmin;
-} LASPointSummary;
/** Returns the version string for this library.
@@ -241,28 +212,45 @@
/* Point operations */
/****************************************************************************/
-/** Returns the X value for the point. This value is not scaled or offset
- * by any header values and stands on its own. If you need points to have
- * a scale and/or offset applied, this must be done in conjunction with the
+/** Returns the X value for the point. This value is scaled by any header
+ * information that is present for the point. Use GetRawX if you want unscaled
+ * data.
* header values after the value is read.
* @param hPoint the opaque pointer to the LASPointH instance
* @return the X value for the LASPointH
*/
LAS_DLL double LASPoint_GetX(const LASPointH hPoint);
-/** Sets the X value for the point. This value must be scaled or offset
- * by any header values before being set.
+/** Sets the X value for the point. This value is scaled by any header
+ * information that is present for the point. Use SetRawX if you want unscaled
+ * data.
* @param hPoint the opaque pointer to the LASPointH instance
* @param value the double value to set for the X value of the point
* @return an error number if an error occured during the setting of the point.
*/
LAS_DLL LASError LASPoint_SetX(LASPointH hPoint, double value);
-/** Returns the Y value for the point. This value is not scaled or offset
+/** Returns the raw X value for the point. This value is not scaled or offset
* by any header values and stands on its own. If you need points to have
* a scale and/or offset applied, this must be done in conjunction with the
* header values after the value is read.
* @param hPoint the opaque pointer to the LASPointH instance
+ * @return the raw(unscaled) X value for the LASPointH
+*/
+LAS_DLL long LASPoint_GetRawX(const LASPointH hPoint);
+
+/** Sets the raw X value for the point. This value will be scaled and offset
+ * by any header values to get interpreted values (double GetX())
+ * @param hPoint the opaque pointer to the LASPointH instance
+ * @param value the double value to set for the raw X value of the point
+ * @return an error number if an error occured during the setting of the point.
+*/
+LAS_DLL LASError LASPoint_SetRawX(LASPointH hPoint, long value);
+
+/** Gets the Y value for the point. This value is scaled by any header
+ * information that is present for the point. Use SetRawY if you want unscaled
+ * data.
+ * @param hPoint the opaque pointer to the LASPointH instance
* @return the Y value for the LASPointH
*/
LAS_DLL double LASPoint_GetY(const LASPointH hPoint);
@@ -275,10 +263,24 @@
*/
LAS_DLL LASError LASPoint_SetY(LASPointH hPoint, double value);
-/** Returns the Z value for the point. This value is not scaled or offset
- * by any header values and stands on its own. If you need points to have
- * a scale and/or offset applied, this must be done in conjunction with the
- * header values after the value is read.
+/** Gets the raw Y value for the point. This value will be scaled and offset
+ * by any header values to get interpreted values (double GetY())
+ * @param hPoint the opaque pointer to the LASPointH instance
+ * @return the raw(unscaled) Y value for the LASPointH
+*/
+LAS_DLL long LASPoint_GetRawY(const LASPointH hPoint);
+
+/** Sets the raw Y value for the point. This value will be scaled and offset
+ * by any header values to get interpreted values (double GetY())
+ * @param hPoint the opaque pointer to the LASPointH instance
+ * @param value the double value to set for the raw Y value of the point
+ * @return an error number if an error occured during the setting of the point.
+*/
+LAS_DLL LASError LASPoint_SetRawY(LASPointH hPoint, long value);
+
+/** Gets the Z value for the point. This value is scaled by any header
+ * information that is present for the point. Use SetRawZ if you want unscaled
+ * data.
* @param hPoint the opaque pointer to the LASPointH instance
* @return the Z value for the LASPointH
*/
@@ -292,6 +294,22 @@
*/
LAS_DLL LASError LASPoint_SetZ(LASPointH hPoint, double value);
+/** Gets the raw Z value for the point. This value will be scaled and offset
+ * by any header values to get interpreted values (double GetZ())
+ * @param hPoint the opaque pointer to the LASPointH instance
+ * @return the raw(unscaled) Z value for the LASPointH
+*/
+LAS_DLL long LASPoint_GetRawZ(const LASPointH hPoint);
+
+/** Sets the raw Z value for the point. This value will be scaled and offset
+ * by any header values to get interpreted values (double GetZ())
+ * @param hPoint the opaque pointer to the LASPointH instance
+ * @param value the double value to set for the raw Z value of the point
+ * @return an error number if an error occured during the setting of the point.
+*/
+LAS_DLL LASError LASPoint_SetRawZ(LASPointH hPoint, long value);
+
+
/** Returns the intensity value for the point. This value is the pulse return
* magnitude, it is optional, and it is LiDAR system specific.
* @return the intensity value for the point.
@@ -481,6 +499,12 @@
*/
LAS_DLL void LASPoint_Destroy(LASPointH hPoint);
+/** 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);
+
/****************************************************************************/
/* Header operations */
/****************************************************************************/
diff -r 77d092db4f1a -r a8d635156691 src/c_api.cpp
--- a/src/c_api.cpp Tue Jan 18 10:58:47 2011 -0600
+++ b/src/c_api.cpp Tue Jan 18 11:24:20 2011 -0600
@@ -442,6 +442,23 @@
return (LASPointH) new liblas::Point(*((liblas::Point*) hPoint));
}
+LAS_DLL LASHeaderH LASPoint_GetHeader(const LASPointH hPoint)
+{
+ VALIDATE_LAS_POINTER1(hPoint , "LASPoint_GetHeader", NULL);
+
+ liblas::Point const& p= *((liblas::Point*) hPoint);
+ liblas::HeaderPtr h = p.GetHeaderPtr();
+ if (h.get())
+ {
+ return (LASHeaderH) new liblas::Header( *h.get() );
+ } else
+ {
+ return (LASHeaderH) new liblas::Header((liblas::DefaultHeader::get()));
+ }
+
+}
+
+
LAS_DLL void LASPoint_Destroy(LASPointH hPoint) {
VALIDATE_LAS_POINTER0(hPoint, "LASPoint_Destroy");
delete (liblas::Point*) hPoint;
@@ -472,6 +489,30 @@
}
+LAS_DLL boost::int32_t LASPoint_GetRawX(const LASPointH hPoint) {
+
+ VALIDATE_LAS_POINTER1(hPoint, "LASPoint_GetRawX", 0.0);
+
+ boost::int32_t value = ((liblas::Point*) hPoint)->GetRawX();
+ return value;
+}
+
+LAS_DLL LASErrorEnum LASPoint_SetRawX(LASPointH hPoint, boost::int32_t value) {
+
+ VALIDATE_LAS_POINTER1(hPoint, "LASPoint_SetRawX", LE_Failure);
+
+ try {
+ ((liblas::Point*) hPoint)->SetRawX(value);
+ } catch (std::exception const& e)
+ {
+ LASError_PushError(LE_Failure, e.what(), "LASPoint_SetRawX");
More information about the Liblas-commits
mailing list