| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b223124 commit a063df4
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,7 +42,6 @@ | |||
| 42 | 42 | #include <mapnik/debug.hpp> | |
| 43 | 43 | #include <mapnik/grid/grid_renderer.hpp> | |
| 44 | 44 | #include <mapnik/grid/grid.hpp> | |
| 45 | - #include <mapnik/grid/grid_util.hpp> | ||
| 46 | 45 | #include <mapnik/grid/grid_view.hpp> | |
| 47 | 46 | #include <mapnik/value_error.hpp> | |
| 48 | 47 | #include <mapnik/feature.hpp> | |
@@ -180,65 +179,6 @@ void grid2utf(T const& grid_type, | |||
| 180 | 179 | } | |
| 181 | 180 | } | |
| 182 | 181 | ||
| 183 | - | ||
| 184 | - template <typename T> | ||
| 185 | - void grid2utf2(T const& grid_type, | ||
| 186 | - boost::python::list& l, | ||
| 187 | - std::vector<typename T::lookup_type>& key_order, | ||
| 188 | - unsigned int resolution) | ||
| 189 | - { | ||
| 190 | - using keys_type = std::map< typename T::lookup_type, typename T::value_type>; | ||
| 191 | - using keys_iterator = typename keys_type::iterator; | ||
| 192 | - | ||
| 193 | - typename T::data_type const& data = grid_type.data(); | ||
| 194 | - typename T::feature_key_type const& feature_keys = grid_type.get_feature_keys(); | ||
| 195 | - typename T::feature_key_type::const_iterator feature_pos; | ||
| 196 | - | ||
| 197 | - keys_type keys; | ||
| 198 | - // start counting at utf8 codepoint 32, aka space character | ||
| 199 | - uint16_t codepoint = 32; | ||
| 200 | - | ||
| 201 | - mapnik::grid::data_type target(data.width()/resolution,data.height()/resolution); | ||
| 202 | - mapnik::scale_grid(target,grid_type.data(),0.0,0.0); | ||
| 203 | - | ||
| 204 | - std::size_t array_size = target.width(); | ||
| 205 | - for (std::size_t y = 0; y < target.height(); ++y) | ||
| 206 | - { | ||
| 207 | - uint16_t idx = 0; | ||
| 208 | - const std::unique_ptr<Py_UNICODE[]> line(new Py_UNICODE[array_size]); | ||
| 209 | - mapnik::grid::value_type * row = target.get_row(y); | ||
| 210 | - for (std::size_t x = 0; x < target.width(); ++x) | ||
| 211 | - { | ||
| 212 | - feature_pos = feature_keys.find(row[x]); | ||
| 213 | - if (feature_pos != feature_keys.end()) | ||
| 214 | - { | ||
| 215 | - mapnik::grid::lookup_type val = feature_pos->second; | ||
| 216 | - keys_iterator key_pos = keys.find(val); | ||
| 217 | - if (key_pos == keys.end()) | ||
| 218 | - { | ||
| 219 | - // Create a new entry for this key. Skip the codepoints that | ||
| 220 | - // can't be encoded directly in JSON. | ||
| 221 | - if (codepoint == 34) ++codepoint; // Skip " | ||
| 222 | - else if (codepoint == 92) ++codepoint; // Skip backslash | ||
| 223 | - keys[val] = codepoint; | ||
| 224 | - key_order.push_back(val); | ||
| 225 | - line[idx++] = static_cast<Py_UNICODE>(codepoint); | ||
| 226 | - ++codepoint; | ||
| 227 | - } | ||
| 228 | - else | ||
| 229 | - { | ||
| 230 | - line[idx++] = static_cast<Py_UNICODE>(key_pos->second); | ||
| 231 | - } | ||
| 232 | - } | ||
| 233 | - // else, shouldn't get here... | ||
| 234 | - } | ||
| 235 | - l.append(boost::python::object( | ||
| 236 | - boost::python::handle<>( | ||
| 237 | - PyUnicode_FromUnicode(line.get(), array_size)))); | ||
| 238 | - } | ||
| 239 | - } | ||
| 240 | - | ||
| 241 | - | ||
| 242 | 182 | template <typename T> | |
| 243 | 183 | void write_features(T const& grid_type, | |
| 244 | 184 | boost::python::dict& feature_data, | |
@@ -298,12 +238,9 @@ void grid_encode_utf(T const& grid_type, | |||
| 298 | 238 | boost::python::list l; | |
| 299 | 239 | std::vector<typename T::lookup_type> key_order; | |
| 300 | 240 | ||
| 301 | - if (resolution != 1) { | ||
| 302 | - // resample on the fly - faster, less accurate | ||
| 241 | + if (resolution != 1) | ||
| 242 | + { | ||
| 303 | 243 | mapnik::grid2utf<T>(grid_type,l,key_order,resolution); | |
| 304 | - | ||
| 305 | - // resample first - slower, more accurate | ||
| 306 | - //mapnik::grid2utf2<T>(grid_type,l,key_order,resolution); | ||
| 307 | 244 | } | |
| 308 | 245 | else | |
| 309 | 246 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,13 +45,6 @@ void grid2utf(T const& grid_type, | |||
| 45 | 45 | unsigned int resolution); | |
| 46 | 46 | ||
| 47 | 47 | ||
| 48 | - template <typename T> | ||
| 49 | - void grid2utf2(T const& grid_type, | ||
| 50 | - boost::python::list& l, | ||
| 51 | - std::vector<typename T::lookup_type>& key_order, | ||
| 52 | - unsigned int resolution); | ||
| 53 | - | ||
| 54 | - | ||
| 55 | 48 | template <typename T> | |
| 56 | 49 | void write_features(T const& grid_type, | |
| 57 | 50 | boost::python::dict& feature_data, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments