1 /****************************************************************************** 2 * Copyright (c) 2019, Hobu Inc. (info@hobu.co) 3 * 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following 8 * conditions are met: 9 * 10 * * Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * * Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in 14 * the documentation and/or other materials provided 15 * with the distribution. 16 * * Neither the name of Hobu, Inc. nor the names of its contributors 17 * may be used to endorse or promote products derived from this 18 * software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 24 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 30 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 * OF SUCH DAMAGE. 32 ****************************************************************************/ 33 34 #pragma once 35 36 #include <pdal/SpatialReference.hpp> 37 #include <pdal/util/Bounds.hpp> 38 39 namespace pdal 40 { 41 42 class PDAL_DLL SrsBounds : public Bounds 43 { 44 public: SrsBounds()45 SrsBounds() 46 {} 47 48 explicit SrsBounds(const BOX3D& box); 49 explicit SrsBounds(const BOX3D& box, const SpatialReference& srs); 50 explicit SrsBounds(const BOX2D& box); 51 explicit SrsBounds(const BOX2D& box, const SpatialReference& srs); 52 53 void parse(const std::string& s, std::string::size_type& pos); spatialReference()54 SpatialReference spatialReference() 55 { return m_srs; } 56 57 friend PDAL_DLL std::ostream& operator << (std::ostream& out, 58 const SrsBounds& bounds); 59 60 private: 61 SpatialReference m_srs; 62 }; 63 64 namespace Utils 65 { 66 template<> fromString(const std::string & s,SrsBounds & srsBounds)67 inline StatusWithReason fromString(const std::string& s, 68 SrsBounds& srsBounds) 69 { 70 std::string::size_type pos(0); 71 srsBounds.parse(s, pos); 72 return true; 73 } 74 } 75 76 PDAL_DLL std::ostream& operator << (std::ostream& out, const SrsBounds& bounds); 77 78 } // namespace pdal 79 80