void shape_io::read_polyline( shape_file::record_type & record, mapnik::geometry_container & geom) { int num_parts = record.read_ndr_integer(); int num_points = record.read_ndr_integer(); if (num_parts == 1) { std::auto_ptr<geometry_type> line(new geometry_type(mapnik::LineString)); record.skip(4); double x = record.read_double(); double y = record.read_double(); line->move_to(x, y); for (int i = 1; i < num_points; ++i) { x = record.read_double(); y = record.read_double(); line->line_to(x, y); } geom.push_back(line); } else { std::vector<int> parts(num_parts); for (int i = 0; i < num_parts; ++i) { parts[i] = record.read_ndr_integer(); } int start, end; for (int k = 0; k < num_parts; ++k) { std::auto_ptr<geometry_type> line(new geometry_type(mapnik::LineString)); start = parts[k]; if (k == num_parts - 1) { end = num_points; } else { end = parts[k + 1]; } double x = record.read_double(); double y = record.read_double(); line->move_to(x, y); for (int j = start + 1; j < end; ++j) { x = record.read_double(); y = record.read_double(); line->line_to(x, y); } geom.push_back(line); } } }
void shape_io::read_polygon(mapnik::geometry_container & geom) { shape_file::record_type record(reclength_ * 2 - 36); shp_.read_record(record); int num_parts = record.read_ndr_integer(); int num_points = record.read_ndr_integer(); std::vector<int> parts(num_parts); for (int i = 0; i < num_parts; ++i) { parts[i] = record.read_ndr_integer(); } for (int k = 0; k < num_parts; k++) { geometry_type* poly = new geometry_type(mapnik::Polygon); int start = parts[k]; int end; if (k == num_parts - 1) { end = num_points; } else { end = parts[k + 1]; } double x = record.read_double(); double y = record.read_double(); poly->move_to(x, y); for (int j=start+1;j<end;j++) { x = record.read_double(); y = record.read_double(); poly->line_to(x, y); } geom.push_back(poly); } // z-range //double z0=record.read_double(); //double z1=record.read_double(); //for (int i=0;i<num_points;++i) //{ // double z=record.read_double(); //} // m-range //double m0=record.read_double(); //double m1=record.read_double(); //for (int i=0;i<num_points;++i) //{ // double m=record.read_double(); //} }
void shape_io::read_polygon(shape_file::record_type & record, mapnik::geometry_container & geom) { int num_parts = record.read_ndr_integer(); int num_points = record.read_ndr_integer(); std::vector<int> parts(num_parts); for (int i = 0; i < num_parts; ++i) { parts[i] = record.read_ndr_integer(); } for (int k = 0; k < num_parts; ++k) { std::auto_ptr<geometry_type> poly(new geometry_type(mapnik::Polygon)); int start = parts[k]; int end; if (k == num_parts - 1) { end = num_points; } else { end = parts[k + 1]; } double x = record.read_double(); double y = record.read_double(); poly->move_to(x, y); for (int j=start+1;j<end-1;j++) { x = record.read_double(); y = record.read_double(); poly->line_to(x, y); } x = record.read_double(); y = record.read_double(); poly->close(x, y); geom.push_back(poly); } }
void shape_io::read_polyline(mapnik::geometry_container & geom) { shape_file::record_type record(reclength_ * 2 - 36); shp_.read_record(record); int num_parts = record.read_ndr_integer(); int num_points = record.read_ndr_integer(); if (num_parts == 1) { geometry_type* line = new geometry_type(mapnik::LineString); record.skip(4); double x = record.read_double(); double y = record.read_double(); line->move_to(x, y); for (int i = 1; i < num_points; ++i) { x = record.read_double(); y = record.read_double(); line->line_to(x, y); } geom.push_back(line); } else { std::vector<int> parts(num_parts); for (int i = 0; i < num_parts; ++i) { parts[i] = record.read_ndr_integer(); } int start, end; for (int k = 0; k < num_parts; ++k) { geometry_type* line = new geometry_type(mapnik::LineString); start = parts[k]; if (k == num_parts - 1) { end = num_points; } else { end = parts[k + 1]; } double x = record.read_double(); double y = record.read_double(); line->move_to(x, y); for (int j = start + 1; j < end; ++j) { x = record.read_double(); y = record.read_double(); line->line_to(x, y); } geom.push_back(line); } } // z-range //double z0=record.read_double(); //double z1=record.read_double(); //for (int i=0;i<num_points;++i) // { // double z=record.read_double(); // } // m-range //double m0=record.read_double(); //double m1=record.read_double(); //for (int i=0;i<num_points;++i) //{ // double m=record.read_double(); //} }