1 /******************************************************************************
2  *
3  * Project:  PROJ
4  * Purpose:  ISO19111:2019 implementation
5  * Author:   Even Rouault <even dot rouault at spatialys dot com>
6  *
7  ******************************************************************************
8  * Copyright (c) 2018, Even Rouault <even dot rouault at spatialys dot com>
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a
11  * copy of this software and associated documentation files (the "Software"),
12  * to deal in the Software without restriction, including without limitation
13  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  * and/or sell copies of the Software, and to permit persons to whom the
15  * Software is furnished to do so, subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be included
18  * in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  * DEALINGS IN THE SOFTWARE.
27  ****************************************************************************/
28 
29 #ifndef COORDINATEROPERATION_PRIVATE_HPP
30 #define COORDINATEROPERATION_PRIVATE_HPP
31 
32 #include "proj/coordinateoperation.hpp"
33 #include "proj/util.hpp"
34 
35 // ---------------------------------------------------------------------------
36 
37 NS_PROJ_START
38 namespace operation {
39 
40 // ---------------------------------------------------------------------------
41 
42 //! @cond Doxygen_Suppress
43 struct CoordinateOperation::Private {
44     util::optional<std::string> operationVersion_{};
45     std::vector<metadata::PositionalAccuracyNNPtr>
46         coordinateOperationAccuracies_{};
47     std::weak_ptr<crs::CRS> sourceCRSWeak_{};
48     std::weak_ptr<crs::CRS> targetCRSWeak_{};
49     crs::CRSPtr interpolationCRS_{};
50     util::optional<common::DataEpoch> sourceCoordinateEpoch_{};
51     util::optional<common::DataEpoch> targetCoordinateEpoch_{};
52     bool hasBallparkTransformation_ = false;
53     bool use3DHelmert_ = false;
54 
55     // do not set this for a ProjectedCRS.definingConversion
56     struct CRSStrongRef {
57         crs::CRSNNPtr sourceCRS_;
58         crs::CRSNNPtr targetCRS_;
CRSStrongRefoperation::CoordinateOperation::Private::CRSStrongRef59         CRSStrongRef(const crs::CRSNNPtr &sourceCRSIn,
60                      const crs::CRSNNPtr &targetCRSIn)
61             : sourceCRS_(sourceCRSIn), targetCRS_(targetCRSIn) {}
62     };
63     std::unique_ptr<CRSStrongRef> strongRef_{};
64 
65     Private() = default;
Privateoperation::CoordinateOperation::Private66     Private(const Private &other)
67         : operationVersion_(other.operationVersion_),
68           coordinateOperationAccuracies_(other.coordinateOperationAccuracies_),
69           sourceCRSWeak_(other.sourceCRSWeak_),
70           targetCRSWeak_(other.targetCRSWeak_),
71           interpolationCRS_(other.interpolationCRS_),
72           sourceCoordinateEpoch_(other.sourceCoordinateEpoch_),
73           targetCoordinateEpoch_(other.targetCoordinateEpoch_),
74           hasBallparkTransformation_(other.hasBallparkTransformation_),
75           strongRef_(other.strongRef_ ? internal::make_unique<CRSStrongRef>(
76                                             *(other.strongRef_))
77                                       : nullptr) {}
78 
79     Private &operator=(const Private &) = delete;
80 };
81 //! @endcond
82 
83 // ---------------------------------------------------------------------------
84 
85 } // namespace operation
86 NS_PROJ_END
87 
88 #endif // COORDINATEROPERATION_PRIVATE_HPP
89