|
| 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 |
0 commit comments