| 266 | } // namespace |
| 267 | |
| 268 | BOOST_PYTHON_MODULE(pygen) |
| 269 | { |
| 270 | bp::scope().attr("__version__") = PYBINDINGS_VERSION; |
| 271 | |
| 272 | { |
| 273 | bp::scope geometryNamespace = bp::class_<GeometryNamespace>("geometry"); |
| 274 | |
| 275 | bp::class_<m2::PointD>("PointD", bp::init<double, double>()) |
| 276 | .def_readwrite("x", &m2::PointD::x) |
| 277 | .def_readwrite("y", &m2::PointD::y) |
| 278 | .def("__repr__", static_cast<std::string (*)(m2::PointD const &)>(m2::DebugPrint)); |
| 279 | |
| 280 | bp::class_<m2::TriangleD>("TriangleD", bp::init<m2::PointD, m2::PointD, m2::PointD>()) |
| 281 | .def("x", &m2::TriangleD::p1, bp::return_value_policy<bp::copy_const_reference>()) |
| 282 | .def("y", &m2::TriangleD::p2, bp::return_value_policy<bp::copy_const_reference>()) |
| 283 | .def("z", &m2::TriangleD::p3, bp::return_value_policy<bp::copy_const_reference>()) |
| 284 | .def("__repr__", static_cast<std::string (*)(m2::TriangleD const &)>(m2::DebugPrint)); |
| 285 | |
| 286 | bp::class_<m2::RectD>("RectD", bp::init<double, double, double, double>()) |
| 287 | .def(bp::init<m2::PointD, m2::PointD>()) |
| 288 | .add_property("min_x", &m2::RectD::minX, &m2::RectD::setMinX) |
| 289 | .add_property("min_y", &m2::RectD::minY, &m2::RectD::setMinY) |
| 290 | .add_property("max_x", &m2::RectD::maxX, &m2::RectD::setMaxX) |
| 291 | .add_property("max_y", &m2::RectD::maxY, &m2::RectD::setMaxY) |
| 292 | .add_property("right_top", &m2::RectD::RightTop, |
| 293 | +[](m2::RectD & self, m2::RectD const & p) |
| 294 | { |
| 295 | self.setMaxX(p.maxX()); |
| 296 | self.setMaxY(p.maxY()); |
| 297 | }) |
| 298 | .add_property("left_bottom", &m2::RectD::LeftBottom, |
| 299 | +[](m2::RectD & self, m2::RectD const & p) |
| 300 | { |
| 301 | self.setMinX(p.minX()); |
| 302 | self.setMinY(p.minY()); |
| 303 | }).def("__repr__", static_cast<std::string (*)(m2::RectD const &)>(m2::DebugPrint)); |
| 304 | } |
| 305 | { |
| 306 | bp::scope mwmNamespace = bp::class_<MwmNamespace>("mwm"); |
| 307 | |
| 308 | bp::enum_<GeomType>("GeomType") |
| 309 | .value("undefined", GeomType::Undefined) |
| 310 | .value("point", GeomType::Point) |
| 311 | .value("line", GeomType::Line) |
| 312 | .value("area", GeomType::Area); |
| 313 | |
| 314 | bp::enum_<DataHeader::MapType>("MapType") |
| 315 | .value("world", DataHeader::MapType::World) |
| 316 | .value("worldCoasts", DataHeader::MapType::WorldCoasts) |
| 317 | .value("country", DataHeader::MapType::Country); |
| 318 | |
| 319 | bp::class_<FilesContainerR::TagInfo>("SectionInfo", bp::no_init) |
| 320 | .def_readwrite("tag", &FilesContainerR::TagInfo::m_tag) |
| 321 | .def_readwrite("offset", &FilesContainerR::TagInfo::m_offset) |
| 322 | .def_readwrite("size", &FilesContainerR::TagInfo::m_size) |
| 323 | .def("__repr__", static_cast<std::string (*)(FilesContainerR::TagInfo const &)>(DebugPrint)); |
| 324 | |
| 325 | bp::class_<version::MwmVersion>("MwmVersion", bp::no_init) |
nothing calls this directly
no test coverage detected