![]()  | 
![]() ![]() ![]() ![]()  | 
![]()  | 
BOOST_GEOMETRY_REGISTER_LINESTRINGBoost , Chapter 1. Geometry , Macro's for adaption
  
  
   | 
||||||||||
| 
                     Имя  | 
                     Описание  | 
|---|---|
Линия  | линейный тип должен быть зарегистрирован  | 
            #include <boost/geometry/geometries/register/linestring.hpp>
Показать использование BOOST_GEOMETRY_REGISTER_LINESTRING
#include <iostream> #include <boost/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/register/linestring.hpp> typedef boost::geometry::model::d2::point_xy<double> point_2d; BOOST_GEOMETRY_REGISTER_LINESTRING(std::vector<point_2d>) int main() { // Normal usage of std:: std::vector<point_2d> line; line.push_back(point_2d(1, 1)); line.push_back(point_2d(2, 2)); line.push_back(point_2d(3, 1)); // Usage of Boost.Geometry's length and wkt functions std::cout << "Length: " << boost::geometry::length(line) << std::endl; std::cout << "WKT: " << boost::geometry::wkt(line) << std::endl; return 0; }
Результат:
Length: 2.82843 WKT: LINESTRING(1 1,2 2,3 1)
Статья BOOST_GEOMETRY_REGISTER_LINESTRING раздела Chapter 1. Geometry Macro's for adaption может быть полезна для разработчиков на c++ и boost.
:: Главная :: Macro's for adaption ::
реклама  |