1 /****************************************************************************** 2 * Copyright (c) 2016, 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/PointView.hpp> 37 #include <pdal/util/ProgramArgs.hpp> 38 39 namespace pdal 40 { 41 42 class ProgramArgs; 43 44 /** 45 Scaling provides support for transforming X/Y/Z values from double to 46 scaled integers and vice versa. 47 */ 48 class PDAL_DLL Scaling 49 { 50 public: 51 XForm m_xXform; ///< X-dimension transform (scale/offset) 52 XForm m_yXform; ///< Y-dimension transform (scale/offset) 53 XForm m_zXform; ///< Z-dimension transform (scale/offset) 54 Arg *m_xOffArg; 55 Arg *m_yOffArg; 56 Arg *m_zOffArg; 57 Arg *m_xScaleArg; 58 Arg *m_yScaleArg; 59 Arg *m_zScaleArg; 60 61 /** 62 Determine if any of the transformations are non-standard. 63 64 \return Whether any transforms are non-standard. 65 */ nonstandard() const66 bool nonstandard() const 67 { 68 return m_xXform.nonstandard() || m_yXform.nonstandard() || 69 m_zXform.nonstandard(); 70 } 71 72 /** 73 Compute an automatic scale/offset for points in the PointView. 74 75 \param view PointView on which scale should be computed. 76 */ 77 virtual void setAutoXForm(const PointViewSet& pvSet); 78 79 /** 80 Add option/command-line arguments for transform variables. 81 82 \param args Argument set to add to. 83 */ 84 void addArgs(ProgramArgs& args); 85 }; 86 87 } // namespace pdal 88 89