3 // This file was modified by Oracle on 2018, 2019.
4 // Modifications copyright (c) 2018, 2019, Oracle and/or its affiliates.
5 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_GEOMETRY_SRS_PROJECTIONS_GRIDS_HPP
12 #define BOOST_GEOMETRY_SRS_PROJECTIONS_GRIDS_HPP
15 #include <boost/geometry/srs/projections/impl/pj_gridinfo.hpp>
20 namespace boost { namespace geometry
24 namespace projections { namespace detail
29 struct shared_grids_tag {};
32 }} // namespace projections::detail
40 std::size_t size() const
42 return gridinfo.size();
47 return gridinfo.empty();
50 typedef projections::detail::grids_tag tag;
52 projections::detail::pj_gridinfo gridinfo;
55 struct ifstream_policy
57 typedef std::ifstream stream_type;
59 static inline void open(stream_type & is, std::string const& gridname)
61 is.open(gridname.c_str(), std::ios::binary);
67 typename StreamPolicy = srs::ifstream_policy,
68 typename Grids = grids
72 typedef StreamPolicy stream_policy_type;
73 typedef Grids grids_type;
78 explicit grids_storage(stream_policy_type const& policy)
79 : stream_policy(policy)
82 stream_policy_type stream_policy;
87 template <typename GridsStorage = grids_storage<> >
88 class projection_grids
91 projection_grids(GridsStorage & storage)
92 : m_storage_ptr(boost::addressof(storage))
95 typedef GridsStorage grids_storage_type;
97 GridsStorage & grids_storage() const
99 return *m_storage_ptr;
103 GridsStorage * const m_storage_ptr;
106 std::vector<std::size_t> hindexes;
110 template <typename GridsStorage = grids_storage<> >
111 struct transformation_grids
113 explicit transformation_grids(GridsStorage & storage)
118 projection_grids<GridsStorage> src_grids;
119 projection_grids<GridsStorage> dst_grids;
126 struct empty_grids_storage {};
127 struct empty_projection_grids {};
129 } // namespace detail
133 struct transformation_grids<detail::empty_grids_storage>
135 detail::empty_projection_grids src_grids;
136 detail::empty_projection_grids dst_grids;
140 }}} // namespace boost::geometry::srs
143 #endif // BOOST_GEOMETRY_SRS_PROJECTIONS_GRIDS_HPP