[Liblas-commits] hg: 2 new changesets
liblas-commits at liblas.org
liblas-commits at liblas.org
Wed Jun 30 14:00:45 EDT 2010
changeset ecfe8d357fe6 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=ecfe8d357fe6
summary: support reading minor version [0-3]
changeset abe68fe6a1a4 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=abe68fe6a1a4
summary: finish up implementing FilterI and TransformI, and reimplement reprojection machinery to use TransformI framework #184
diffstat:
include/liblas/detail/reader/point.hpp | 10 --
include/liblas/detail/reader/reader.hpp | 24 ++---
include/liblas/detail/writer/writer.hpp | 13 +--
include/liblas/lasreader.hpp | 19 ++++-
include/liblas/lastransform.hpp | 34 ++++++++
include/liblas/laswriter.hpp | 26 ++++++-
include/liblas/liblas.hpp | 13 +--
python/tests/SRS-GDAL.txt | 2 +-
src/detail/reader/point.cpp | 53 +------------
src/detail/reader/reader.cpp | 124 ++++---------------------------
src/detail/writer/writer.cpp | 82 +--------------------
src/lasreader.cpp | 124 +++++++++++++++++++++++++++----
src/lastransform.cpp | 94 ++++++++++++++++++++++++
src/laswriter.cpp | 110 +++++++++++++++++++++++++++-
test/unit/lasheader_test.cpp | 6 +-
15 files changed, 425 insertions(+), 309 deletions(-)
diffs (truncated from 1180 to 300 lines):
diff -r 77b2979fc354 -r abe68fe6a1a4 include/liblas/detail/reader/point.hpp
--- a/include/liblas/detail/reader/point.hpp Tue Jun 29 14:22:54 2010 -0500
+++ b/include/liblas/detail/reader/point.hpp Wed Jun 30 13:00:33 2010 -0500
@@ -51,11 +51,6 @@
#include <liblas/lasformat.hpp>
-#ifndef HAVE_GDAL
- typedef struct OGRCoordinateTransformationHS *OGRCoordinateTransformationH;
- typedef struct OGRSpatialReferenceHS *OGRSpatialReferenceH;
-#endif
-
// std
#include <iosfwd>
@@ -66,9 +61,6 @@
public:
Point(std::istream& ifs, const liblas::Header& header);
- Point( std::istream& ifs,
- const liblas::Header& header,
- OGRCoordinateTransformationH transform);
virtual ~Point();
std::istream& GetStream() const;
@@ -90,11 +82,9 @@
std::istream& m_ifs;
const liblas::Header& m_header;
liblas::Point m_point;
- OGRCoordinateTransformationH m_transform;
PointFormat m_format;
- void project();
void setup();
void fill(PointRecord& record);
};
diff -r 77b2979fc354 -r abe68fe6a1a4 include/liblas/detail/reader/reader.hpp
--- a/include/liblas/detail/reader/reader.hpp Tue Jun 29 14:22:54 2010 -0500
+++ b/include/liblas/detail/reader/reader.hpp Wed Jun 30 13:00:33 2010 -0500
@@ -51,12 +51,6 @@
#include <iosfwd>
-#ifndef HAVE_GDAL
- typedef struct OGRCoordinateTransformationHS *OGRCoordinateTransformationH;
- typedef struct OGRSpatialReferenceHS *OGRSpatialReferenceH;
-#endif
-
-
namespace liblas { namespace detail {
class ReaderImpl : public ReaderI
@@ -74,9 +68,9 @@
std::istream& GetStream() const;
void Reset(liblas::Header const& header);
- void SetSRS(const SpatialReference& srs, const liblas::Header& header);
- void SetInputSRS(const SpatialReference& srs);
- void SetOutputSRS(const SpatialReference& srs, const liblas::Header& header);
+ // void SetSRS(const SpatialReference& srs, const liblas::Header& header);
+ // void SetInputSRS(const SpatialReference& srs);
+ // void SetOutputSRS(const SpatialReference& srs, const liblas::Header& header);
protected:
void CreateTransform();
@@ -89,11 +83,11 @@
std::istream& m_ifs;
uint32_t m_size;
uint32_t m_current;
- SpatialReference m_out_srs;
- SpatialReference m_in_srs;
- OGRCoordinateTransformationH m_transform;
- OGRSpatialReferenceH m_in_ref;
- OGRSpatialReferenceH m_out_ref;
+ // SpatialReference m_out_srs;
+ // SpatialReference m_in_srs;
+ // OGRCoordinateTransformationH m_transform;
+ // OGRSpatialReferenceH m_in_ref;
+ // OGRSpatialReferenceH m_out_ref;
detail::reader::Point* m_point_reader;
detail::reader::Header* m_header_reader;
@@ -116,7 +110,7 @@
liblas::Header const& ReadHeader();
liblas::Point const& ReadNextPoint(const liblas::Header& header);
liblas::Point const& ReadPointAt(std::size_t n, const liblas::Header& header);
- void SetOutputSRS(const SpatialReference& srs, const liblas::Header& header);
+ // void SetOutputSRS(const SpatialReference& srs, const liblas::Header& header);
void Seek(std::size_t n, const liblas::Header& header);
void Reset(liblas::Header const& header);
diff -r 77b2979fc354 -r abe68fe6a1a4 include/liblas/detail/writer/writer.hpp
--- a/include/liblas/detail/writer/writer.hpp Tue Jun 29 14:22:54 2010 -0500
+++ b/include/liblas/detail/writer/writer.hpp Wed Jun 30 13:00:33 2010 -0500
@@ -64,26 +64,17 @@
std::ostream& GetStream() const;
- void SetInputSRS(const SpatialReference& srs);
- void SetOutputSRS(const SpatialReference& srs, const liblas::Header& header);
-
protected:
PointRecord m_record;
std::ostream& m_ofs;
- SpatialReference m_out_srs;
- SpatialReference m_in_srs;
-
- OGRCoordinateTransformationH m_transform;
- OGRSpatialReferenceH m_in_ref;
- OGRSpatialReferenceH m_out_ref;
-
+
writer::Point* m_point_writer;
writer::Header* m_header_writer;
private:
- void CreateTransform();
+ // void CreateTransform();
liblas::uint32_t m_pointCount;
// block copying operations
diff -r 77b2979fc354 -r abe68fe6a1a4 include/liblas/lasreader.hpp
--- a/include/liblas/lasreader.hpp Tue Jun 29 14:22:54 2010 -0500
+++ b/include/liblas/lasreader.hpp Wed Jun 30 13:00:33 2010 -0500
@@ -50,6 +50,8 @@
#include <liblas/laspoint.hpp>
#include <liblas/lasvariablerecord.hpp>
#include <liblas/lasspatialreference.hpp>
+#include <liblas/lastransform.hpp>
+
// std
@@ -144,8 +146,19 @@
/// keep a point that was read from the file. Filters have *no*
/// effect for reading data at specific locations in the file.
/// They only affect reading ReadNextPoint-style operations
+ /// Filters are applied *before* transforms.
void SetFilters(std::vector<liblas::FilterI*>* filters) {m_filters = filters;}
+ /// Sets transforms to apply to points. Points are transformed in
+ /// place *in the order* of the transform list.
+ /// Filters are applied *before* transforms. If an input/output SRS
+ /// is set on the reader, the reprojection transform will happen *first*
+ /// before any other transforms are applied. This transform is a
+ /// special case. You can define your own reprojection transforms and add
+ /// it to the list, but be sure to not issue a SetOutputSRS to trigger
+ /// the internal transform creation
+ void SetTransforms(std::vector<liblas::TransformI*>* transforms) {m_transforms = transforms;}
+
private:
// Blocked copying operations, declared but not defined.
@@ -164,8 +177,12 @@
bool bCustomHeader;
std::vector<liblas::FilterI*>* m_filters;
+ std::vector<liblas::TransformI*>* m_transforms;
- // std::istream& m_ifs;
+ liblas::TransformI* m_reprojection_transform;
+
+ SpatialReference m_out_srs;
+ SpatialReference m_in_srs;
};
diff -r 77b2979fc354 -r abe68fe6a1a4 include/liblas/lastransform.hpp
--- a/include/liblas/lastransform.hpp Tue Jun 29 14:22:54 2010 -0500
+++ b/include/liblas/lastransform.hpp Wed Jun 30 13:00:33 2010 -0500
@@ -47,13 +47,47 @@
#include <liblas/laspoint.hpp>
#include <liblas/detail/fwd.hpp>
#include <liblas/liblas.hpp>
+#include <liblas/lasspatialreference.hpp>
#include <vector>
namespace liblas
{
+// class TransformI
+// {
+// public:
+//
+// virtual bool transform(Point& point) = 0;
+// virtual ~TransformI() {};
+//
+// };
+#ifndef HAVE_GDAL
+ typedef struct OGRCoordinateTransformationHS *OGRCoordinateTransformationH;
+ typedef struct OGRSpatialReferenceHS *OGRSpatialReferenceH;
+#endif
+
+class ReprojectionTransform: public TransformI
+{
+public:
+
+ ReprojectionTransform(const SpatialReference& inSRS, const SpatialReference& outSRS);
+ bool transform(Point& point);
+
+ ~ReprojectionTransform();
+
+private:
+
+ OGRCoordinateTransformationH m_transform;
+ OGRSpatialReferenceH m_in_ref;
+ OGRSpatialReferenceH m_out_ref;
+
+
+
+ ReprojectionTransform(ReprojectionTransform const& other);
+ ReprojectionTransform& operator=(ReprojectionTransform const& rhs);
+};
} // namespace liblas
diff -r 77b2979fc354 -r abe68fe6a1a4 include/liblas/laswriter.hpp
--- a/include/liblas/laswriter.hpp Tue Jun 29 14:22:54 2010 -0500
+++ b/include/liblas/laswriter.hpp Wed Jun 30 13:00:33 2010 -0500
@@ -45,6 +45,8 @@
#include <liblas/lasversion.hpp>
#include <liblas/lasheader.hpp>
#include <liblas/laspoint.hpp>
+#include <liblas/lastransform.hpp>
+#include <liblas/lasfilter.hpp>
#include <liblas/detail/fwd.hpp>
#include <liblas/liblas.hpp>
@@ -94,6 +96,21 @@
bool SetSRS(const SpatialReference& ref);
bool SetInputSRS(const SpatialReference& ref);
bool SetOutputSRS(const SpatialReference& ref);
+
+ /// Sets filters that are used to determine wither or not to
+ /// keep a point that before we write it
+ /// Filters are applied *before* transforms.
+ void SetFilters(std::vector<liblas::FilterI*>* filters) {m_filters = filters;}
+
+ /// Sets transforms to apply to points. Points are transformed in
+ /// place *in the order* of the transform list.
+ /// Filters are applied *before* transforms. If an input/output SRS
+ /// is set on the writer, the reprojection transform will happen *first*
+ /// before any other transforms are applied. This transform is a
+ /// special case. You can define your own reprojection transforms and add
+ /// it to the list, but be sure to not issue a SetOutputSRS to trigger
+ /// the internal transform creation
+ void SetTransforms(std::vector<liblas::TransformI*>* transforms) {m_transforms = transforms;}
private:
@@ -105,8 +122,15 @@
Header m_header;
detail::PointRecord m_record;
- // std::ostream& m_ofs;
+ std::vector<liblas::FilterI*>* m_filters;
+ std::vector<liblas::TransformI*>* m_transforms;
+
+ liblas::TransformI* m_reprojection_transform;
+
+ SpatialReference m_out_srs;
+ SpatialReference m_in_srs;
+
};
} // namespace liblas
diff -r 77b2979fc354 -r abe68fe6a1a4 include/liblas/liblas.hpp
--- a/include/liblas/liblas.hpp Tue Jun 29 14:22:54 2010 -0500
+++ b/include/liblas/liblas.hpp Wed Jun 30 13:00:33 2010 -0500
@@ -160,8 +160,6 @@
virtual void Seek(std::size_t n, const Header& header) = 0;
virtual void Reset(const Header& header) = 0;
- virtual void SetInputSRS(const SpatialReference& srs) = 0;
- virtual void SetOutputSRS(const SpatialReference& srs, const Header& header) = 0;
virtual std::istream& GetStream() const = 0;
@@ -176,9 +174,6 @@
virtual void UpdateHeader(const Header& header) = 0;
virtual void WritePoint(const Point& point, const Header& header) = 0;
- virtual void SetInputSRS(const SpatialReference& srs) = 0;
- virtual void SetOutputSRS(const SpatialReference& srs, const Header& header) = 0;
-
virtual std::ostream& GetStream() const = 0;
virtual ~WriterI() {};
@@ -207,12 +202,12 @@
FilterI(FilterType t) : m_type(t) {}
- private:
+private:
More information about the Liblas-commits
mailing list