[Liblas-commits] hg: C# bindings now working, modulo perf issues

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Jan 13 14:21:49 EST 2011


details:   http://hg.liblas.orghg/rev/dd65164dc630
changeset: 2749:dd65164dc630
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Thu Jan 13 09:19:36 2011 -0800
description:
C# bindings now working, modulo perf issues
Subject: hg: fix paths to be relative

details:   http://hg.liblas.orghg/rev/24444f074915
changeset: 2750:24444f074915
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Thu Jan 13 09:26:15 2011 -0800
description:
fix paths to be relative
Subject: hg: pull-merge

details:   http://hg.liblas.orghg/rev/5956e230e539
changeset: 2751:5956e230e539
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Thu Jan 13 11:21:47 2011 -0800
description:
pull-merge

diffstat:

 apps/lasblock.cpp                                  |    2 +-
 apps/lasinfo.cpp                                   |    4 +-
 csharp-new/liblas_swig_cpp/liblas.i                |   86 ++++++++++++-
 csharp-new/liblas_swig_cpp/liblas_swig_cpp.vcxproj |   14 +-
 csharp-new/liblas_swig_test/Program.cs             |  132 +++++++++++---------
 csharp-new/liblas_swig_test/TestHeader.cs          |    2 +-
 csharp-new/liblas_swig_test/TestVariableRecord.cs  |    3 +-
 7 files changed, 166 insertions(+), 77 deletions(-)

diffs (truncated from 506 to 300 lines):

diff -r a6dfd2c975c3 -r 5956e230e539 apps/lasblock.cpp
--- a/apps/lasblock.cpp	Wed Jan 12 13:44:23 2011 -0800
+++ b/apps/lasblock.cpp	Thu Jan 13 11:21:47 2011 -0800
@@ -248,7 +248,7 @@
             ("precision,p", po::value<long>(&precision)->default_value(8), "Number of decimal points to write for each bbox")
             ("stdout", po::value<bool>(&bUseStdout)->zero_tokens()->implicit_value(true), "Output data to stdout")
             ("write-points", po::value<bool>(&tiling)->zero_tokens()->implicit_value(true), "Write .las files for each block instead of an index file")
-            ("compressed,c", po::value<bool>(&bCompressed)->zero_tokens()->implicit_value(true), "Produce .laz compressed data for --write-points tiles")
+            ("compressed", po::value<bool>(&bCompressed)->zero_tokens()->implicit_value(true), "Produce .laz compressed data for --write-points tiles")
 
             ("input,i", po::value< std::string >(), "input LAS file")
             ("output,o", po::value< std::string >(&output)->default_value(""), "The output .kdx file (defaults to input filename + .kdx)")
diff -r a6dfd2c975c3 -r 5956e230e539 apps/lasinfo.cpp
--- a/apps/lasinfo.cpp	Wed Jan 12 13:44:23 2011 -0800
+++ b/apps/lasinfo.cpp	Thu Jan 13 11:21:47 2011 -0800
@@ -243,7 +243,9 @@
             if (check)
                 tree = summary.GetPTree();
             else 
-                tree = header.GetPTree();
+            {
+                tree.add_child("summary.header", header.GetPTree());
+            }
             
             liblas::property_tree::write_xml(std::cout, tree);
             return 0;
diff -r a6dfd2c975c3 -r 5956e230e539 csharp-new/liblas_swig_cpp/liblas.i
--- a/csharp-new/liblas_swig_cpp/liblas.i	Wed Jan 12 13:44:23 2011 -0800
+++ b/csharp-new/liblas_swig_cpp/liblas.i	Thu Jan 13 11:21:47 2011 -0800
@@ -83,9 +83,12 @@
 	typedef signed int int32_t;
 };
 
+// BUG: how do I do a rename such that "SWIGTYPE_p_std__istream" can
+// become something like "IStreamHandle"?
 
 namespace liblas
 {
+typedef Header HeaderPtr;
 
 //---------------------------------------------------------------------------
 	
@@ -107,6 +110,7 @@
 {
 public:
     guid(char const* const str);
+    ~guid();
     std::string to_string() const;
 };
 
@@ -141,7 +145,18 @@
 class Point
 {
 public:
-    enum ClassificationType
+	enum DataMemberFlag
+    {
+        eReturnNumber = 1,
+        eNumberOfReturns = 2,
+        eScanDirection = 4,
+        eFlightLineEdge = 8,
+        eClassification = 16,
+        eScanAngleRank = 32,
+        eTime = 64
+    };
+
+	enum ClassificationType
     {
         eCreated = 0,
         eUnclassified,
@@ -159,15 +174,44 @@
         // = 13-31 // reserved for ASPRS Definition
     };
 
+    Point();
+    Point(HeaderPtr header);
+    Point(Point const& other);
+
     double GetX() const;
     double GetY() const;
     double GetZ() const;
-    boost::uint16_t GetIntensity() const;
+    void SetCoordinates(double const& x, double const& y, double const& z);
+    void SetX(double const& value);
+    void SetY(double const& value);
+    void SetZ(double const& value);
+	
+	boost::uint16_t GetIntensity() const;
+    void SetIntensity(boost::uint16_t const& intensity);
+
+    boost::uint8_t GetScanFlags() const;
+    void SetScanFlags(boost::uint8_t const& flags);
+
     boost::uint16_t GetReturnNumber() const;
+    void SetReturnNumber(boost::uint16_t const& num);
+
     boost::uint16_t GetNumberOfReturns() const;
+    void SetNumberOfReturns(boost::uint16_t const& num);
+
+    boost::uint16_t GetScanDirection() const;
+    void SetScanDirection(boost::uint16_t const& dir);
+    
+    boost::uint16_t GetFlightLineEdge() const;
+    void SetFlightLineEdge(boost::uint16_t const& edge);
+
     Classification GetClassification() const;
+    void SetClassification(Classification const& cls);
+
     Color GetColor() const;
+    void SetColor(Color const& value);
+
     double GetTime() const;
+    void SetTime(double const& time);
 };
 
 
@@ -176,7 +220,11 @@
 class VariableRecord
 {
 public:
-    std::string GetUserId(bool pad) const;
+    VariableRecord(); 
+    VariableRecord(VariableRecord const& other);
+    ~VariableRecord();
+	
+	std::string GetUserId(bool pad) const;
     boost::uint16_t GetRecordId() const;
     boost::uint16_t GetRecordLength() const;
     std::string GetDescription(bool pad) const;
@@ -201,6 +249,11 @@
         eOGRWKT = 2
     };
 
+    SpatialReference();
+    ~SpatialReference();
+    SpatialReference(std::vector<VariableRecord> const& vlrs);
+    SpatialReference(SpatialReference const& other);
+
     std::string GetWKT(WKTModeFlag mode_flag, bool pretty) const;
     std::string GetProj4() const;
     std::vector<VariableRecord> GetVLRs() const;
@@ -212,6 +265,7 @@
 class Header
 {
 public:
+    Header();
     Header(Header const& other);
 
     std::string GetFileSignature() const;
@@ -269,11 +323,18 @@
 class Reader
 {
 public:
-    Reader(std::istream& ifs);
-    ~Reader();
+    Reader(std::istream& ifs);
+    Reader(Reader const& other);
+    ~Reader();
 
+	// BUG: GetHeader and GetPoint make new proxy objects at every call.
+	// For perf reasons, it'd be nice to avoid that.
+	// BUG: GetHeader and GetPoint will cause GC issues if the Reader goes
+	// away while you're still using the Point or Header (see 18.6.1 of the
+	// swig manual)
     Header const& GetHeader() const;
     Point const& GetPoint() const;
+
     bool ReadNextPoint();
     bool ReadPointAt(std::size_t n);
     void Reset();
@@ -287,28 +348,41 @@
 {
 public:
     Writer(std::ostream& ofs, Header const& header);
+    Writer(Writer const& other);
+    ~Writer();
+
+	// BUG: see Reader::GetHeader() above
     Header const& GetHeader() const;
+
     bool WritePoint(Point const& point);
+
     //void WriteHeader(Header& header);
     //void SetFilters(std::vector<liblas::FilterPtr> const& filters);
     //void SetTransforms(std::vector<liblas::TransformPtr> const& transforms);
 };
 
+
 //---------------------------------------------------------------------------
-
 
 class ReaderFactory
 {
 public:
+    ReaderFactory();
+    ~ReaderFactory();
     Reader CreateCached(std::istream& stream, boost::uint32_t cache_size);
     Reader CreateWithStream(std::istream& stream);
     static std::istream* FileOpen(std::string const& filename);
     static void FileClose(std::istream*);
 };
 
+
+//---------------------------------------------------------------------------
+
 class WriterFactory
 {
 public:
+    WriterFactory();
+    ~WriterFactory();
     static std::ostream* FileCreate(std::string const& filename);
     static void FileClose(std::ostream*);
 };
diff -r a6dfd2c975c3 -r 5956e230e539 csharp-new/liblas_swig_cpp/liblas_swig_cpp.vcxproj
--- a/csharp-new/liblas_swig_cpp/liblas_swig_cpp.vcxproj	Wed Jan 12 13:44:23 2011 -0800
+++ b/csharp-new/liblas_swig_cpp/liblas_swig_cpp.vcxproj	Thu Jan 13 11:21:47 2011 -0800
@@ -117,14 +117,14 @@
     <ClCompile>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>C:\dev\liblas\include;C:\Program Files %28x86%29\boost\boost_1_44;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\include;C:\Program Files %28x86%29\boost\boost_1_44;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNING;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>%(AdditionalDependencies);c:\dev\liblas\bin\Debug\Debug\liblas.lib</AdditionalDependencies>
+      <AdditionalDependencies>%(AdditionalDependencies);..\..\bin\Debug\Debug\liblas.lib</AdditionalDependencies>
       <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
       <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     </Link>
@@ -133,14 +133,14 @@
     <ClCompile>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>C:\dev\liblas\include;C:\Program Files %28x86%29\boost\boost_1_44;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\include;C:\Program Files %28x86%29\boost\boost_1_44;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNING;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>%(AdditionalDependencies);c:\dev\liblas\bin\Debug\Debug\liblas.lib</AdditionalDependencies>
+      <AdditionalDependencies>%(AdditionalDependencies);..\..\bin\Debug\Debug\liblas.lib</AdditionalDependencies>
       <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
       <AdditionalLibraryDirectories>C:\Program Files (x86)\boost\boost_1_44\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     </Link>
@@ -151,12 +151,13 @@
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>..\..\include;C:\Program Files %28x86%29\boost\boost_1_44;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>%(AdditionalDependencies);c:\dev\liblas\bin\Release\Release\liblas.lib</AdditionalDependencies>
+      <AdditionalDependencies>%(AdditionalDependencies);..\..\liblas\bin\Release\Release\liblas.lib</AdditionalDependencies>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -165,12 +166,13 @@
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>..\..\include;C:\Program Files %28x86%29\boost\boost_1_44;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>%(AdditionalDependencies);c:\dev\liblas\bin\Release\Release\liblas.lib</AdditionalDependencies>
+      <AdditionalDependencies>%(AdditionalDependencies);..\..\liblas\bin\Release\Release\liblas.lib</AdditionalDependencies>
     </Link>
   </ItemDefinitionGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
diff -r a6dfd2c975c3 -r 5956e230e539 csharp-new/liblas_swig_test/Program.cs
--- a/csharp-new/liblas_swig_test/Program.cs	Wed Jan 12 13:44:23 2011 -0800
+++ b/csharp-new/liblas_swig_test/Program.cs	Thu Jan 13 11:21:47 2011 -0800
@@ -45,6 +45,7 @@
 
 using Liblas;
 using System.Diagnostics;
+using System.IO;
 
 namespace swig_test
 {
@@ -78,6 +79,8 @@
          // reader tests for the generated B
          Test_ReadT();
 
+         File.Delete(fileT);
+
          return 0;
       }
 


More information about the Liblas-commits mailing list