Skip to content

Commit 731f687

Browse files
committed
CSAR reader contributed by CARIS (not yet working)
1 parent e72b1bf commit 731f687

20 files changed

+1734
-0
lines changed

CMakeLists.txt

+16
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,22 @@ if(WITH_MRSID)
413413
endif()
414414
endif()
415415

416+
417+
# CARIS/BDB support - optional, default=OFF
418+
set(WITH_CARIS FALSE CACHE BOOL "Choose if CARIS/BDB support should be built")
419+
if(WITH_CARIS)
420+
set(CARIS_FOUND 1)
421+
# set(MRSID_ROOT "/Users/hobu/installs/mrsid/Lidar_DSDK" CACHE STRING "Root directory of MrSID install")
422+
# find_package(MrSID)
423+
# if(MRSID_FOUND)
424+
# set(CMAKE_REQUIRED_LIBRARIES ${MRSID_LIBRARY})
425+
# include_directories(${MRSID_INCLUDE_DIR})
426+
# add_definitions(-DHAVE_MRSID=1)
427+
set(PDAL_HAVE_CARIS 1)
428+
# endif()
429+
endif()
430+
431+
416432
# Points2Grid
417433
# Points2Grid support - optional, default=OFF
418434
set(WITH_P2G FALSE CACHE BOOL "Choose if Points2Grid support should be built")

config.bat

+6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ rem set PDAL_EMBED_BOOST=OFF
2525
rem set BOOST_DIR=c:\utils\boost_1_49_0
2626
set BOOST_DIR=%PDAL_DIR%\boost
2727

28+
:: CARIS
29+
set CARIS_ENABLED=ON
30+
set CARIS_INCLUDE_DIR=%CARIS_DIR%\include
31+
set CARIS_LIBRARY=%CARIS_DIR%\caris.lib
32+
2833
:: GDAL
2934
set GDAL_ENABLED=ON
3035
set GDAL_INCLUDE_DIR=%OSGEO4W_DIR%\apps\gdal-dev\include
@@ -83,6 +88,7 @@ if %USERDOMAIN% == PDC set FREEGLUT_ENABLED=ON
8388

8489
rem if EXIST CMakeCache.txt del CMakeCache.txt
8590
cmake -G %GENERATOR% ^
91+
-DWITH_CARIS=%CARIS_ENABLED% ^
8692
-DWITH_GDAL=%GDAL_ENABLED% ^
8793
-DWITH_GEOTIFF=%GEOTIFF_ENABLED% ^
8894
-DWITH_ORACLE=%ORACLE_ENABLED% ^
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/************************************************************************
2+
* Copyright (c) 2012, CARIS
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
* * Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* * Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
* * Neither the name of CARIS nor the names of its contributors may be
13+
* used to endorse or promote products derived from this software without
14+
* specific prior written permission.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
17+
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18+
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
19+
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
20+
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
************************************************************************/
28+
#ifndef INCLUDED_DRIVERS_CSAR_CLOUDITERATOR_HPP
29+
#define INCLUDED_DRIVERS_CSAR_CLOUDITERATOR_HPP
30+
31+
#include "config.h"
32+
#include "caris/caris_pc_wrapper.h"
33+
#include "CloudReader.hpp"
34+
35+
#ifdef _MSC_VER
36+
# pragma warning(push, 3)
37+
# pragma warning(disable : DISABLED_3RDPARTY_WARNINGS)
38+
#endif
39+
40+
#include <pdal/ReaderIterator.hpp>
41+
42+
#ifdef _MSC_VER
43+
# pragma warning(pop)
44+
#endif
45+
46+
namespace csar {
47+
48+
//! Sequential iterator for CloudReader
49+
class CloudIterator : public pdal::ReaderSequentialIterator
50+
{
51+
public:
52+
CloudIterator(
53+
CloudReader const& in_reader,
54+
pdal::PointBuffer & in_buffer);
55+
virtual ~CloudIterator();
56+
57+
protected:
58+
virtual boost::uint32_t readBufferImpl(pdal::PointBuffer& io_buffer);
59+
virtual boost::uint64_t skipImpl(boost::uint64_t in_pointNum);
60+
virtual bool atEndImpl() const;
61+
62+
private:
63+
void throwIfItrError() const;
64+
65+
private:
66+
caris_itr * m_itr;
67+
std::map<pdal::dimension::id, CloudReader::DimInfo> m_dimInfo;
68+
int32_t m_currentOffset;
69+
};
70+
71+
} // namespace
72+
73+
#endif
+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
/************************************************************************
2+
* Copyright (c) 2012, CARIS
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
* * Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* * Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
* * Neither the name of CARIS nor the names of its contributors may be
13+
* used to endorse or promote products derived from this software without
14+
* specific prior written permission.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
17+
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18+
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
19+
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
20+
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
************************************************************************/
28+
#ifndef INCLUDED_DRIVERS_CSAR_CLOUDREADER_HPP
29+
#define INCLUDED_DRIVERS_CSAR_CLOUDREADER_HPP
30+
31+
#include "config.h"
32+
33+
#include "caris/caris_pc_wrapper.h"
34+
35+
#ifdef _MSC_VER
36+
# pragma warning(push, 3)
37+
# pragma warning(disable : DISABLED_3RDPARTY_WARNINGS)
38+
#endif
39+
40+
#include <pdal/StageBase.hpp>
41+
#include <pdal/Stage.hpp>
42+
#include <pdal/Reader.hpp>
43+
44+
#ifdef _MSC_VER
45+
# pragma warning(pop)
46+
#endif
47+
48+
namespace csar {
49+
50+
//! Base Reader implementaion of CARIS Clouds
51+
class CloudReader : public pdal::Reader
52+
{
53+
public:
54+
55+
explicit CloudReader(const pdal::Options& options);
56+
virtual ~CloudReader();
57+
58+
59+
virtual void initialize();
60+
61+
virtual bool supportsIterator(pdal::StageIteratorType in_type) const;
62+
63+
virtual pdal::StageSequentialIterator* createSequentialIterator(pdal::PointBuffer& in_buffer) const;
64+
65+
//! Info for mapping between pdal and caris dimensions
66+
struct DimInfo
67+
{
68+
DimInfo()
69+
: dimIndex(), tupleIndex(), dimension()
70+
{}
71+
DimInfo(int in_dimIndex, int in_tupleIndex, caris_dimension const* in_dimension)
72+
: dimIndex(in_dimIndex), tupleIndex(in_tupleIndex), dimension(in_dimension)
73+
{}
74+
75+
//! index of the dimension in the related caris_cloud
76+
int dimIndex;
77+
//! the tuple index of the caris_dimension to be mapped to pdal
78+
int tupleIndex;
79+
//! related dimension
80+
caris_dimension const* dimension;
81+
};
82+
83+
std::map<pdal::dimension::id, DimInfo> const& getDimInfo() const;
84+
caris_cloud * getCarisCloud() const;
85+
86+
protected:
87+
virtual std::string getURI() const = 0;
88+
89+
private:
90+
caris_cloud * m_cloud;
91+
std::map<pdal::dimension::id, DimInfo> m_dimInfo;
92+
};
93+
94+
//************************************************************************
95+
//! info for mapping from pdal to caris dimensions
96+
/*!
97+
\return
98+
\li info for mapping from pdal to caris dimensions
99+
*/
100+
//************************************************************************
101+
inline
102+
std::map<pdal::dimension::id, CloudReader::DimInfo> const& CloudReader::getDimInfo() const
103+
{
104+
return m_dimInfo;
105+
}
106+
107+
//************************************************************************
108+
//! get underlying caris_cloud
109+
/*!
110+
\return
111+
\li underlying caris_cloud
112+
*/
113+
//************************************************************************
114+
inline
115+
caris_cloud * CloudReader::getCarisCloud() const
116+
{
117+
return m_cloud;
118+
}
119+
120+
} // namespace
121+
122+
#endif

pdal_defines.h.in

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
/*
2525
* availability of 3rd-party libraries
2626
*/
27+
#cmakedefine PDAL_HAVE_CARIS
2728
#cmakedefine PDAL_HAVE_GEOS
2829
#cmakedefine PDAL_HAVE_GDAL
2930
#cmakedefine PDAL_HAVE_FLANN

src/CMakeLists.txt

+31
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,35 @@ if (MRSID_FOUND)
189189
endif()
190190

191191

192+
#
193+
# drivers/caris
194+
#
195+
set(PDAL_CARIS_PATH drivers/caris)
196+
set(PDAL_CARIS_HEADERS ${PDAL_HEADERS_DIR}/${PDAL_CARIS_PATH})
197+
set(PDAL_CARIS_SRC ${PROJECT_SOURCE_DIR}/src/${PDAL_CARIS_PATH})
198+
199+
set(PDAL_DRIVERS_CARIS_HPP
200+
${PDAL_CARIS_HEADERS}/CloudReader.hpp
201+
${PDAL_CARIS_HEADERS}/CloudIterator.hpp
202+
${PDAL_CARIS_SRC}/Utils.hpp
203+
${PDAL_CARIS_SRC}/config.h
204+
${PDAL_CARIS_SRC}/caris/caris_pc_wrapper.h
205+
)
206+
207+
set (PDAL_DRIVERS_CARIS_CPP
208+
${PDAL_CARIS_SRC}/CloudReader.cpp
209+
${PDAL_CARIS_SRC}/CloudIterator.cpp
210+
${PDAL_CARIS_SRC}/pdal_csar.cpp
211+
${PDAL_CARIS_SRC}/Utils.cpp
212+
${PDAL_CARIS_SRC}/caris/caris_pc_wrapper.c
213+
)
214+
215+
if (CARIS_FOUND)
216+
list (APPEND PDAL_CPP ${PDAL_DRIVERS_CARIS_CPP} )
217+
list (APPEND PDAL_HPP ${PDAL_DRIVERS_CARIS_HPP} )
218+
endif()
219+
220+
192221
#
193222
# drivers/oci
194223
#
@@ -470,6 +499,7 @@ source_group("CMake Files" FILES CMakeLists.txt)
470499
source_group("Header Files" FILES ${PDAL_BASE_HPP})
471500
source_group("Header Files\\config" FILES ${PDAL_CONFIG_HPP})
472501
source_group("Header Files\\drivers\\faux" FILES ${PDAL_DRIVERS_FAUX_HPP})
502+
source_group("Header Files\\drivers\\caris" FILES ${PDAL_DRIVERS_CARIS_HPP})
473503
source_group("Header Files\\drivers\\las" FILES ${PDAL_DRIVERS_LAS_HPP})
474504
source_group("Header Files\\drivers\\nitf" FILES ${PDAL_DRIVERS_NITF_HPP})
475505
source_group("Header Files\\drivers\\oci" FILES ${PDAL_DRIVERS_OCI_HPP})
@@ -483,6 +513,7 @@ source_group("Header Files\\plang" FILES ${PDAL_PLANG_HPP})
483513
source_group("Source Files" FILES ${PDAL_BASE_CPP})
484514
source_group("Source Files\\config" FILES ${PDAL_CONFIG_CPP})
485515
source_group("Source Files\\drivers\\faux" FILES ${PDAL_DRIVERS_FAUX_CPP})
516+
source_group("Source Files\\drivers\\caris" FILES ${PDAL_DRIVERS_CARIS_CPP})
486517
source_group("Source Files\\drivers\\las" FILES ${PDAL_DRIVERS_LAS_CPP})
487518
source_group("Source Files\\drivers\\nitf" FILES ${PDAL_DRIVERS_NITF_CPP})
488519
source_group("Source Files\\drivers\\oci" FILES ${PDAL_DRIVERS_OCI_CPP})

src/drivers/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ add_subdirectory(faux)
1111
add_subdirectory(las)
1212
add_subdirectory(liblas)
1313

14+
if(CARIS_FOUND)
15+
add_subdirectory(caris)
16+
endif()
17+
1418
if(MRSID_FOUND)
1519
add_subdirectory(mrsid)
1620
endif()

0 commit comments

Comments
 (0)