// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
-// This file was modified by Oracle on 2017.
-// Modifications copyright (c) 2017, Oracle and/or its affiliates.
+// This file was modified by Oracle on 2017, 2019.
+// Modifications copyright (c) 2017, 2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Use, modification and distribution is subject to the Boost Software License,
#include <boost/shared_ptr.hpp>
#include <boost/geometry/srs/projections/dpar.hpp>
-#include <boost/geometry/srs/projections/factory_key.hpp>
#include <boost/geometry/srs/projections/proj4.hpp>
#include <boost/geometry/srs/projections/impl/factory_entry.hpp>
#include <boost/geometry/srs/projections/proj/aea.hpp>
namespace detail
{
+template <typename Params>
+struct factory_key
+{
+ BOOST_MPL_ASSERT_MSG((false), INVALID_PARAMETERS_TYPE, (Params));
+};
+
+template <>
+struct factory_key<srs::detail::proj4_parameters>
+{
+ typedef std::string type;
+ template <typename ProjParams>
+ static type const& get(ProjParams const& par)
+ {
+ return par.id.name;
+ }
+ static const char* get(const char* name, srs::dpar::value_proj id)
+ {
+ return name;
+ }
+};
+
+template <typename T>
+struct factory_key<srs::dpar::parameters<T> >
+{
+ typedef srs::dpar::value_proj type;
+ template <typename ProjParams>
+ static type const& get(ProjParams const& par)
+ {
+ return par.id.id;
+ }
+ static srs::dpar::value_proj get(const char* name, srs::dpar::value_proj id)
+ {
+ return id;
+ }
+};
+
+
template <typename Params, typename CT, typename ProjParams>
class factory
{
ProjParams
> entry_base;
- typedef typename factory_key_util<Params>::type key_type;
+ typedef factory_key<Params> key;
+ typedef typename key::type key_type;
typedef boost::shared_ptr<entry_base> entry_ptr;
typedef std::map<key_type, entry_ptr> entries_map;
detail::wink2_init(*this);
}
- void add_to_factory(key_type const& key, entry_base* entry)
+ void add_to_factory(const char* name, srs::dpar::value_proj id, entry_base* entry)
{
// The pointer has to be owned before std::map::operator[] in case it thrown an exception.
entry_ptr ptr(entry);
- m_entries[key] = ptr;
+ m_entries[key::get(name, id)] = ptr;
}
- detail::base_v<CT, ProjParams>* create_new(Params const& params, ProjParams const& proj_par) const
+ detail::dynamic_wrapper_b<CT, ProjParams>* create_new(Params const& params, ProjParams const& proj_par) const
{
- typename factory_key_util<Params>::type key = factory_key_util<Params>::get(proj_par);
- typename entries_map::const_iterator it = m_entries.find(key);
+ typedef typename entries_map::const_iterator const_iterator;
+ const_iterator it = m_entries.find(key::get(proj_par));
if (it != m_entries.end())
{
return it->second->create_new(params, proj_par);
};
template <typename T>
-inline detail::base_v<T, projections::parameters<T> >*
+inline detail::dynamic_wrapper_b<T, projections::parameters<T> >*
create_new(srs::detail::proj4_parameters const& params,
projections::parameters<T> const& parameters)
{
}
template <typename T>
-inline detail::base_v<T, projections::parameters<T> >*
+inline detail::dynamic_wrapper_b<T, projections::parameters<T> >*
create_new(srs::dpar::parameters<T> const& params,
projections::parameters<T> const& parameters)
{