示例#1
0
 void read_polygon_xyz(boost::ptr_vector<geometry_type> & paths)
 {
     int num_rings = read_integer();
     if (num_rings > 0)
     {
         std::unique_ptr<geometry_type> poly(new geometry_type(geometry_type::types::Polygon));
         for (int i = 0; i < num_rings; ++i)
         {
             int num_points = read_integer();
             if (num_points > 0)
             {
                 CoordinateArray ar(num_points);
                 read_coords_xyz(ar);
                 poly->move_to(ar[0].x, ar[0].y);
                 for (int j = 1; j < num_points; ++j)
                 {
                     poly->line_to(ar[j].x, ar[j].y);
                 }
                 poly->close_path();
             }
         }
         if (poly->size() > 2) // ignore if polygon has less than 3 vertices
             paths.push_back(poly.release());
     }
 }
示例#2
0
文件: wkb.cpp 项目: rjw57/mapnik
 void read_linestring_xyz(boost::ptr_vector<geometry_type> & paths)
 {
     geometry_type* line = new geometry_type(LineString);
     int num_points = read_integer();
     CoordinateArray ar(num_points);
     read_coords_xyz(ar);
     line->move_to(ar[0].x, ar[0].y);
     for (int i = 1; i < num_points; ++i)
     {
         line->line_to(ar[i].x, ar[i].y);
     }
     paths.push_back(line);
 }
示例#3
0
 void read_linestring_xyz(boost::ptr_vector<geometry_type> & paths)
 {
     int num_points = read_integer();
     if (num_points > 0)
     {
         CoordinateArray ar(num_points);
         read_coords_xyz(ar);
         std::unique_ptr<geometry_type> line(new geometry_type(geometry_type::types::LineString));
         line->move_to(ar[0].x, ar[0].y);
         for (int i = 1; i < num_points; ++i)
         {
             line->line_to(ar[i].x, ar[i].y);
         }
         paths.push_back(line.release());
     }
 }
示例#4
0
文件: wkb.cpp 项目: rjw57/mapnik
 void read_polygon_xyz(boost::ptr_vector<geometry_type> & paths)
 {
     geometry_type* poly = new geometry_type(Polygon);
     int num_rings = read_integer();
     unsigned capacity = 0;
     for (int i = 0; i < num_rings; ++i)
     {
         int num_points = read_integer();
         capacity += num_points;
         CoordinateArray ar(num_points);
         read_coords_xyz(ar);
         poly->move_to(ar[0].x, ar[0].y);
         for (int j = 1; j < num_points; ++j)
         {
             poly->line_to(ar[j].x, ar[j].y);
         }
     }
     paths.push_back(poly);
 }