+ geometry::types Exterior/Interior polygon loops

This commit is contained in:
artemp 2013-09-03 12:15:31 +01:00
parent 4ea16b596e
commit d4b9a48cb1
31 changed files with 152 additions and 144 deletions

View file

@ -270,10 +270,10 @@ void export_geometry()
{
using namespace boost::python;
enum_<mapnik::eGeomType>("GeometryType")
.value("Point",mapnik::Point)
.value("LineString",mapnik::LineString)
.value("Polygon",mapnik::Polygon)
enum_<mapnik::geometry_type::types>("GeometryType")
.value("Point",mapnik::geometry_type::types::Point)
.value("LineString",mapnik::geometry_type::types::LineString)
.value("Polygon",mapnik::geometry_type::types::Polygon)
;
#if BOOST_VERSION >= 104700

View file

@ -34,25 +34,29 @@
namespace mapnik {
enum eGeomType {
Unknown = 0,
Point = 1,
LineString = 2,
Polygon = 3
};
template <typename T, template <typename> class Container=vertex_vector>
class geometry : private mapnik::noncopyable
{
public:
static const std::uint8_t geometry_bits = 7;
enum types : std::uint8_t
{
Unknown = 0x00,
Point = 0x01,
LineString = 0x02,
Polygon = 0x03,
PolygonExterior = Polygon,
PolygonInterior = Polygon | ( 1 << geometry_bits)
};
typedef T coord_type;
typedef Container<coord_type> container_type;
typedef typename container_type::value_type value_type;
typedef typename container_type::size_type size_type;
private:
container_type cont_;
eGeomType type_;
mutable unsigned itr_;
types type_;
mutable size_type itr_;
public:
geometry()
@ -60,17 +64,22 @@ public:
itr_(0)
{}
explicit geometry(eGeomType type)
explicit geometry(types type)
: type_(type),
itr_(0)
{}
eGeomType type() const
types type() const
{
return type_;
return static_cast<types>(type_ & types::Polygon);
}
void set_type(eGeomType type)
bool interior() const
{
return static_cast<bool>(type_ >> geometry_bits);
}
void set_type(types type)
{
type_ = type;
}
@ -91,7 +100,7 @@ public:
double x = 0;
double y = 0;
rewind(0);
for (unsigned i=0; i < size(); ++i)
for (size_type i = 0; i < size(); ++i)
{
unsigned cmd = vertex(&x,&y);
if (cmd == SEG_CLOSE) continue;

View file

@ -79,11 +79,11 @@ struct raster_markers_rasterizer_dispatch_grid
marker_placement_e placement_method = sym_.get_marker_placement();
box2d<double> bbox_(0,0, src_.width(),src_.height());
if (placement_method != MARKER_LINE_PLACEMENT ||
path.type() == Point)
path.type() == geometry_type::types::Point)
{
double x = 0;
double y = 0;
if (path.type() == LineString)
if (path.type() == geometry_type::types::LineString)
{
if (!label::middle_point(path, x, y))
return;
@ -216,11 +216,11 @@ struct vector_markers_rasterizer_dispatch_grid
{
marker_placement_e placement_method = sym_.get_marker_placement();
if (placement_method != MARKER_LINE_PLACEMENT ||
path.type() == Point)
path.type() == geometry_type::types::Point)
{
double x = 0;
double y = 0;
if (path.type() == LineString)
if (path.type() == geometry_type::types::LineString)
{
if (!label::middle_point(path, x, y))
return;
@ -294,4 +294,3 @@ private:
}
#endif

View file

@ -202,17 +202,17 @@ struct geometry_generator_grammar :
coordinates = point | linestring | polygon
;
point = &uint_(mapnik::Point)[_1 = _type(_val)]
point = &uint_(mapnik::geometry_type::types::Point)[_1 = _type(_val)]
<< point_coord [_1 = _first(_val)]
;
linestring = &uint_(mapnik::LineString)[_1 = _type(_val)]
linestring = &uint_(mapnik::geometry_type::types::LineString)[_1 = _type(_val)]
<< lit('[')
<< coords
<< lit(']')
;
polygon = &uint_(mapnik::Polygon)[_1 = _type(_val)]
polygon = &uint_(mapnik::geometry_type::types::Polygon)[_1 = _type(_val)]
<< lit('[')
<< coords2
<< lit("]]")
@ -280,12 +280,12 @@ struct multi_geometry_generator_grammar :
using boost::spirit::karma::string;
geometry_types.add
(mapnik::Point,"\"Point\"")
(mapnik::LineString,"\"LineString\"")
(mapnik::Polygon,"\"Polygon\"")
(mapnik::Point + 3,"\"MultiPoint\"")
(mapnik::LineString + 3,"\"MultiLineString\"")
(mapnik::Polygon + 3,"\"MultiPolygon\"")
(mapnik::geometry_type::types::Point,"\"Point\"")
(mapnik::geometry_type::types::LineString,"\"LineString\"")
(mapnik::geometry_type::types::Polygon,"\"Polygon\"")
(mapnik::geometry_type::types::Point + 3,"\"MultiPoint\"")
(mapnik::geometry_type::types::LineString + 3,"\"MultiLineString\"")
(mapnik::geometry_type::types::Polygon + 3,"\"MultiPolygon\"")
;
start %= ( eps(phoenix::at_c<1>(_a))[_a = _multi_type(_val)]

View file

@ -94,11 +94,11 @@ struct vector_markers_rasterizer_dispatch
marker_placement_e placement_method = sym_.get_marker_placement();
if (placement_method != MARKER_LINE_PLACEMENT ||
path.type() == Point)
path.type() == mapnik::geometry_type::types::Point)
{
double x = 0;
double y = 0;
if (path.type() == LineString)
if (path.type() == mapnik::geometry_type::types::LineString)
{
if (!label::middle_point(path, x, y))
return;
@ -206,11 +206,11 @@ struct raster_markers_rasterizer_dispatch
box2d<double> bbox_(0,0, src_.width(),src_.height());
if (placement_method != MARKER_LINE_PLACEMENT ||
path.type() == Point)
path.type() == mapnik::geometry_type::types::Point)
{
double x = 0;
double y = 0;
if (path.type() == LineString)
if (path.type() == mapnik::geometry_type::types::LineString)
{
if (!label::middle_point(path, x, y))
return;
@ -477,7 +477,7 @@ void apply_markers_multi(feature_impl & feature, Converter& converter, markers_s
double x, y;
if (label::centroid_geoms(feature.paths().begin(), feature.paths().end(), x, y))
{
geometry_type pt(Point);
geometry_type pt(geometry_type::types::Point);
pt.move_to(x, y);
// unset any clipping since we're now dealing with a point
converter.template unset<clip_poly_tag>();

View file

@ -41,7 +41,7 @@ struct symbolizer_hash
// specialisation for polygon_symbolizer
static std::size_t value(polygon_symbolizer const& sym)
{
std::size_t seed = Polygon;
std::size_t seed = geometry_type::types::Polygon;
boost::hash_combine(seed, sym.get_fill().rgba());
boost::hash_combine(seed, sym.get_opacity());
return seed;
@ -50,7 +50,7 @@ struct symbolizer_hash
// specialisation for line_symbolizer
static std::size_t value(line_symbolizer const& sym)
{
std::size_t seed = LineString;
std::size_t seed = geometry_type::types::LineString;
boost::hash_combine(seed, sym.get_stroke().get_color().rgba());
boost::hash_combine(seed, sym.get_stroke().get_width());
boost::hash_combine(seed, sym.get_stroke().get_opacity());

View file

@ -171,7 +171,7 @@ namespace mapnik { namespace util {
svg = point | linestring | polygon
;
point = &uint_(mapnik::Point)[_1 = _type(_val)]
point = &uint_(mapnik::geometry_type::types::Point)[_1 = _type(_val)]
<< svg_point [_1 = _first(_val)]
;
@ -181,11 +181,11 @@ namespace mapnik { namespace util {
<< lit('\"')
;
linestring = &uint_(mapnik::LineString)[_1 = _type(_val)]
linestring = &uint_(mapnik::geometry_type::types::LineString)[_1 = _type(_val)]
<< lit("d=\"") << svg_path << lit("\"")
;
polygon = &uint_(mapnik::Polygon)[_1 = _type(_val)]
polygon = &uint_(mapnik::geometry_type::types::Polygon)[_1 = _type(_val)]
<< lit("d=\"") << svg_path << lit("\"")
;

View file

@ -143,7 +143,7 @@ wkb_buffer_ptr to_point_wkb( GeometryType const& g, wkbByteOrder byte_order)
wkb_buffer_ptr wkb(new wkb_buffer(size));
wkb_stream ss(wkb->buffer(), wkb->size());
ss.write(reinterpret_cast<char*>(&byte_order),1);
int type = static_cast<int>(mapnik::Point);
int type = static_cast<int>(mapnik::geometry_type::types::Point);
write(ss,type,4,byte_order);
double x = 0;
double y = 0;
@ -163,7 +163,7 @@ wkb_buffer_ptr to_line_string_wkb( GeometryType const& g, wkbByteOrder byte_orde
wkb_buffer_ptr wkb(new wkb_buffer(size));
wkb_stream ss(wkb->buffer(), wkb->size());
ss.write(reinterpret_cast<char*>(&byte_order),1);
int type = static_cast<int>(mapnik::LineString);
int type = static_cast<int>(mapnik::geometry_type::types::LineString);
write(ss,type,4,byte_order);
write(ss,num_points,4,byte_order);
double x = 0;
@ -211,7 +211,7 @@ wkb_buffer_ptr to_polygon_wkb( GeometryType const& g, wkbByteOrder byte_order)
wkb_buffer_ptr wkb(new wkb_buffer(size));
wkb_stream ss(wkb->buffer(), wkb->size());
ss.write(reinterpret_cast<char*>(&byte_order),1);
int type = static_cast<int>(mapnik::Polygon);
int type = static_cast<int>(mapnik::geometry_type::types::Polygon);
write(ss,type,4,byte_order);
write(ss,num_rings,4,byte_order);
@ -237,13 +237,13 @@ wkb_buffer_ptr to_wkb(GeometryType const& g, wkbByteOrder byte_order )
switch (g.type())
{
case mapnik::Point:
case mapnik::geometry_type::types::Point:
wkb = to_point_wkb(g, byte_order);
break;
case mapnik::LineString:
case mapnik::geometry_type::types::LineString:
wkb = to_line_string_wkb(g, byte_order);
break;
case mapnik::Polygon:
case mapnik::geometry_type::types::Polygon:
wkb = to_polygon_wkb(g, byte_order);
break;
default:

View file

@ -55,12 +55,12 @@ public:
// required for iterators support
typedef boost::tuple<unsigned,coord_type,coord_type> value_type;
typedef std::size_t size_type;
typedef std::uint8_t command_size;
private:
unsigned num_blocks_;
unsigned max_blocks_;
coord_type** vertices_;
unsigned char** commands_;
command_size** commands_;
size_type pos_;
public:
@ -90,7 +90,7 @@ public:
return pos_;
}
void push_back (coord_type x,coord_type y,unsigned command)
void push_back (coord_type x,coord_type y,command_size command)
{
unsigned block = pos_ >> block_shift;
if (block >= num_blocks_)
@ -98,9 +98,9 @@ public:
allocate_block(block);
}
coord_type* vertex = vertices_[block] + ((pos_ & block_mask) << 1);
unsigned char* cmd= commands_[block] + (pos_ & block_mask);
command_size* cmd= commands_[block] + (pos_ & block_mask);
*cmd = static_cast<unsigned char>(command);
*cmd = static_cast<command_size>(command);
*vertex++ = x;
*vertex = y;
++pos_;
@ -130,11 +130,11 @@ private:
{
coord_type** new_vertices =
static_cast<coord_type**>(::operator new (sizeof(coord_type*)*((max_blocks_ + grow_by) * 2)));
unsigned char** new_commands = (unsigned char**)(new_vertices + max_blocks_ + grow_by);
command_size** new_commands = (command_size**)(new_vertices + max_blocks_ + grow_by);
if (vertices_)
{
std::memcpy(new_vertices,vertices_,max_blocks_ * sizeof(coord_type*));
std::memcpy(new_commands,commands_,max_blocks_ * sizeof(unsigned char*));
std::memcpy(new_commands,commands_,max_blocks_ * sizeof(command_size*));
::operator delete(vertices_);
}
vertices_ = new_vertices;
@ -144,7 +144,7 @@ private:
vertices_[block] = static_cast<coord_type*>
(::operator new(sizeof(coord_type)*(block_size * 2 + block_size / (sizeof(coord_type)))));
commands_[block] = (unsigned char*)(vertices_[block] + block_size*2);
commands_[block] = (command_size*)(vertices_[block] + block_size*2);
++num_blocks_;
}
};

View file

@ -97,7 +97,7 @@ struct wkt_grammar : qi::grammar<Iterator, boost::ptr_vector<mapnik::geometry_t
;
// <point tagged text> ::= point <point text>
point_tagged_text = no_case[lit("POINT")] [ _a = new_<geometry_type>(Point) ]
point_tagged_text = no_case[lit("POINT")] [ _a = new_<geometry_type>(geometry_type::types::Point) ]
>> ( point_text(_a) [push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false])
;
@ -108,7 +108,7 @@ struct wkt_grammar : qi::grammar<Iterator, boost::ptr_vector<mapnik::geometry_t
;
// <linestring tagged text> ::= linestring <linestring text>
linestring_tagged_text = no_case[lit("LINESTRING")] [ _a = new_<geometry_type>(LineString) ]
linestring_tagged_text = no_case[lit("LINESTRING")] [ _a = new_<geometry_type>(geometry_type::types::LineString) ]
>> (linestring_text(_a)[push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false])
;
@ -118,7 +118,7 @@ struct wkt_grammar : qi::grammar<Iterator, boost::ptr_vector<mapnik::geometry_t
;
// <polygon tagged text> ::= polygon <polygon text>
polygon_tagged_text = no_case[lit("POLYGON")] [ _a = new_<geometry_type>(Polygon) ]
polygon_tagged_text = no_case[lit("POLYGON")] [ _a = new_<geometry_type>(geometry_type::types::Polygon) ]
>> ( polygon_text(_a)[push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false])
;
@ -134,7 +134,7 @@ struct wkt_grammar : qi::grammar<Iterator, boost::ptr_vector<mapnik::geometry_t
// <multipoint text> ::= <empty set> | <left paren> <point text> {<comma> <point text>}* <right paren>
multipoint_text = (lit('(')
>> ((eps[_a = new_<geometry_type>(Point)]
>> ((eps[_a = new_<geometry_type>(geometry_type::types::Point)]
>> (point_text(_a) | empty_set) [push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false]) % lit(','))
>> lit(')')) | empty_set
@ -146,7 +146,7 @@ struct wkt_grammar : qi::grammar<Iterator, boost::ptr_vector<mapnik::geometry_t
// <multilinestring text> ::= <empty set> | <left paren> <linestring text> {<comma> <linestring text>}* <right paren>
multilinestring_text = (lit('(')
>> ((eps[_a = new_<geometry_type>(LineString)]
>> ((eps[_a = new_<geometry_type>(geometry_type::types::LineString)]
>> ( points(_a)[push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false]))
% lit(','))
@ -159,7 +159,7 @@ struct wkt_grammar : qi::grammar<Iterator, boost::ptr_vector<mapnik::geometry_t
// <multipolygon text> ::= <empty set> | <left paren> <polygon text> {<comma> <polygon text>}* <right paren>
multipolygon_text = (lit('(')
>> ((eps[_a = new_<geometry_type>(Polygon)]
>> ((eps[_a = new_<geometry_type>(geometry_type::types::Polygon)]
>> ( polygon_text(_a)[push_back(_val,_a)]
| eps[cleanup_(_a)][_pass = false]))
% lit(','))

View file

@ -773,7 +773,7 @@ void csv_datasource::parse_csv(T & stream,
{
if (parsed_x && parsed_y)
{
mapnik::geometry_type * pt = new mapnik::geometry_type(mapnik::Point);
mapnik::geometry_type * pt = new mapnik::geometry_type(mapnik::geometry_type::types::Point);
pt->move_to(x,y);
feature->add_geometry(pt);
features_.push_back(feature);

View file

@ -523,7 +523,7 @@ feature_ptr gdal_featureset::get_feature_at_point(mapnik::coord2d const& pt)
{
// construct feature
feature_ptr feature = feature_factory::create(ctx_,1);
geometry_type * point = new geometry_type(mapnik::Point);
geometry_type * point = new geometry_type(mapnik::geometry_type::types::Point);
point->move_to(pt.x, pt.y);
feature->add_geometry(point);
feature->put("value",value);

View file

@ -377,7 +377,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
}
void occi_featureset::convert_ordinates(mapnik::feature_ptr feature,
const mapnik::eGeomType& geom_type,
const mapnik::geometry::types& geom_type,
const std::vector<Number>& elem_info,
const std::vector<Number>& ordinates,
const int dimensions,
@ -404,7 +404,7 @@ void occi_featureset::convert_ordinates(mapnik::feature_ptr feature,
int next_interp = elem_info[i + 2];
bool is_linear_element = true;
bool is_unknown_etype = false;
mapnik::eGeomType gtype = mapnik::Point;
mapnik::geometry::types gtype = mapnik::Point;
switch (etype)
{

View file

@ -55,7 +55,7 @@ public:
private:
void convert_geometry (SDOGeometry* geom, mapnik::feature_ptr feature);
void convert_ordinates (mapnik::feature_ptr feature,
const mapnik::eGeomType& geom_type,
const mapnik::geometry::types& geom_type,
const std::vector<oracle::occi::Number>& elem_info,
const std::vector<oracle::occi::Number>& ordinates,
const int dimensions,

View file

@ -79,7 +79,7 @@ void ogr_converter::convert_geometry(OGRGeometry* geom, feature_ptr feature)
void ogr_converter::convert_point(OGRPoint* geom, feature_ptr feature)
{
std::unique_ptr<geometry_type> point(new geometry_type(mapnik::Point));
std::unique_ptr<geometry_type> point(new geometry_type(mapnik::geometry_type::types::Point));
point->move_to(geom->getX(), geom->getY());
feature->paths().push_back(point.release());
}
@ -87,7 +87,7 @@ void ogr_converter::convert_point(OGRPoint* geom, feature_ptr feature)
void ogr_converter::convert_linestring(OGRLineString* geom, feature_ptr feature)
{
int num_points = geom->getNumPoints();
std::unique_ptr<geometry_type> line(new geometry_type(mapnik::LineString));
std::unique_ptr<geometry_type> line(new geometry_type(mapnik::geometry_type::types::LineString));
line->move_to(geom->getX(0), geom->getY(0));
for (int i = 1; i < num_points; ++i)
{
@ -108,7 +108,7 @@ void ogr_converter::convert_polygon(OGRPolygon* geom, feature_ptr feature)
capacity += interior->getNumPoints();
}
std::unique_ptr<geometry_type> poly(new geometry_type(mapnik::Polygon));
std::unique_ptr<geometry_type> poly(new geometry_type(mapnik::geometry_type::types::Polygon));
poly->move_to(exterior->getX(0), exterior->getY(0));
for (int i = 1; i < num_points; ++i)

View file

@ -65,7 +65,7 @@ feature_ptr osm_featureset<filterT>::next()
feature = feature_factory::create(ctx_, cur_item->id);
double lat = static_cast<osm_node*>(cur_item)->lat;
double lon = static_cast<osm_node*>(cur_item)->lon;
geometry_type* point = new geometry_type(mapnik::Point);
geometry_type* point = new geometry_type(mapnik::geometry_type::types::Point);
point->move_to(lon, lat);
feature->add_geometry(point);
}
@ -86,11 +86,11 @@ feature_ptr osm_featureset<filterT>::next()
geometry_type* geom;
if (static_cast<osm_way*>(cur_item)->is_polygon())
{
geom = new geometry_type(mapnik::Polygon);
geom = new geometry_type(mapnik::geometry_type::types::Polygon);
}
else
{
geom = new geometry_type(mapnik::LineString);
geom = new geometry_type(mapnik::geometry_type::types::LineString);
}
geom->move_to(static_cast<osm_way*>(cur_item)->nodes[0]->lon,

View file

@ -89,7 +89,7 @@ feature_ptr shape_featureset<filterT>::next()
double y = record.read_double();
if (!filter_.pass(mapnik::box2d<double>(x,y,x,y)))
continue;
std::unique_ptr<geometry_type> point(new geometry_type(mapnik::Point));
std::unique_ptr<geometry_type> point(new geometry_type(mapnik::geometry_type::types::Point));
point->move_to(x, y);
feature->paths().push_back(point.release());
break;
@ -105,7 +105,7 @@ feature_ptr shape_featureset<filterT>::next()
{
double x = record.read_double();
double y = record.read_double();
std::unique_ptr<geometry_type> point(new geometry_type(mapnik::Point));
std::unique_ptr<geometry_type> point(new geometry_type(mapnik::geometry_type::types::Point));
point->move_to(x, y);
feature->paths().push_back(point.release());
}

View file

@ -101,7 +101,7 @@ feature_ptr shape_index_featureset<filterT>::next()
{
double x = record.read_double();
double y = record.read_double();
std::unique_ptr<geometry_type> point(new geometry_type(mapnik::Point));
std::unique_ptr<geometry_type> point(new geometry_type(mapnik::geometry_type::types::Point));
point->move_to(x, y);
feature->paths().push_back(point.release());
break;
@ -117,7 +117,7 @@ feature_ptr shape_index_featureset<filterT>::next()
{
double x = record.read_double();
double y = record.read_double();
std::unique_ptr<geometry_type> point(new geometry_type(mapnik::Point));
std::unique_ptr<geometry_type> point(new geometry_type(mapnik::geometry_type::types::Point));
point->move_to(x, y);
feature->paths().push_back(point.release());
}

View file

@ -96,7 +96,7 @@ void shape_io::read_polyline( shape_file::record_type & record, mapnik::geometry
int num_points = record.read_ndr_integer();
if (num_parts == 1)
{
std::unique_ptr<geometry_type> line(new geometry_type(mapnik::LineString));
std::unique_ptr<geometry_type> line(new geometry_type(mapnik::geometry_type::types::LineString));
record.skip(4);
double x = record.read_double();
double y = record.read_double();
@ -120,7 +120,7 @@ void shape_io::read_polyline( shape_file::record_type & record, mapnik::geometry
int start, end;
for (int k = 0; k < num_parts; ++k)
{
std::unique_ptr<geometry_type> line(new geometry_type(mapnik::LineString));
std::unique_ptr<geometry_type> line(new geometry_type(mapnik::geometry_type::types::LineString));
start = parts[k];
if (k == num_parts - 1)
{
@ -159,7 +159,7 @@ void shape_io::read_polygon(shape_file::record_type & record, mapnik::geometry_c
for (int k = 0; k < num_parts; ++k)
{
std::unique_ptr<geometry_type> poly(new geometry_type(mapnik::Polygon));
std::unique_ptr<geometry_type> poly(new geometry_type(mapnik::geometry_type::types::Polygon));
int start = parts[k];
int end;
if (k == num_parts - 1)

View file

@ -91,8 +91,8 @@ void agg_renderer<T>::process(building_symbolizer const& sym,
geometry_type const& geom = feature.get_geometry(i);
if (geom.size() > 2)
{
boost::scoped_ptr<geometry_type> frame(new geometry_type(LineString));
boost::scoped_ptr<geometry_type> roof(new geometry_type(Polygon));
boost::scoped_ptr<geometry_type> frame(new geometry_type(geometry_type::types::LineString));
boost::scoped_ptr<geometry_type> roof(new geometry_type(geometry_type::types::Polygon));
std::deque<segment_t> face_segments;
double x0 = 0;
double y0 = 0;
@ -124,7 +124,7 @@ void agg_renderer<T>::process(building_symbolizer const& sym,
for (; itr!=end; ++itr)
{
boost::scoped_ptr<geometry_type> faces(new geometry_type(Polygon));
boost::scoped_ptr<geometry_type> faces(new geometry_type(geometry_type::types::Polygon));
faces->move_to(itr->get<0>(),itr->get<1>());
faces->line_to(itr->get<2>(),itr->get<3>());
faces->line_to(itr->get<2>(),itr->get<3>() + height);

View file

@ -142,8 +142,8 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
converter(query_extent_, rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_);
if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true)
{
eGeomType type = feature.paths()[0].type();
if (type == Polygon)
geometry_type::types type = feature.paths()[0].type();
if (type == geometry_type::types::Polygon)
converter.template set<clip_poly_tag>();
// line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426
//else if (type == LineString)
@ -182,8 +182,8 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
converter(query_extent_, rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_);
if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true)
{
eGeomType type = feature.paths()[0].type();
if (type == Polygon)
geometry_type::types type = feature.paths()[0].type();
if (type == geometry_type::types::Polygon)
converter.template set<clip_poly_tag>();
// line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426
//else if (type == LineString)
@ -220,13 +220,13 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true)
{
eGeomType type = feature.paths()[0].type();
if (type == Polygon)
geometry_type::types type = feature.paths()[0].type();
if (type == geometry_type::types::Polygon)
converter.template set<clip_poly_tag>();
// line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426
//else if (type == LineString)
//else if (type == geometry_type::types::LineString)
// converter.template set<clip_line_tag>();
// don't clip if type==Point
// don't clip if type==geometry_type::types::Point
}
converter.template set<transform_tag>(); //always transform
if (sym.smooth() > 0.0) converter.template set<smooth_tag>(); // optional smooth converter

View file

@ -360,8 +360,8 @@ void cairo_renderer_base::process(building_symbolizer const& sym,
if (geom.size() > 2)
{
boost::scoped_ptr<geometry_type> frame(new geometry_type(LineString));
boost::scoped_ptr<geometry_type> roof(new geometry_type(Polygon));
boost::scoped_ptr<geometry_type> frame(new geometry_type(geometry_type::types::LineString));
boost::scoped_ptr<geometry_type> roof(new geometry_type(geometry_type::types::Polygon));
std::deque<segment_t> face_segments;
double x0 = 0;
double y0 = 0;
@ -392,7 +392,7 @@ void cairo_renderer_base::process(building_symbolizer const& sym,
std::deque<segment_t>::const_iterator end=face_segments.end();
for (; itr != end; ++itr)
{
boost::scoped_ptr<geometry_type> faces(new geometry_type(Polygon));
boost::scoped_ptr<geometry_type> faces(new geometry_type(geometry_type::types::Polygon));
faces->move_to(itr->get<0>(), itr->get<1>());
faces->line_to(itr->get<2>(), itr->get<3>());
faces->line_to(itr->get<2>(), itr->get<3>() + height);
@ -987,11 +987,11 @@ struct markers_dispatch
marker_placement_e placement_method = sym_.get_marker_placement();
if (placement_method != MARKER_LINE_PLACEMENT ||
path.type() == Point)
path.type() == geometry_type::types::Point)
{
double x = 0;
double y = 0;
if (path.type() == LineString)
if (path.type() == geometry_type::types::LineString)
{
if (!label::middle_point(path, x, y))
return;
@ -1076,11 +1076,11 @@ struct markers_dispatch_2
marker_placement_e placement_method = sym_.get_marker_placement();
if (placement_method != MARKER_LINE_PLACEMENT ||
path.type() == Point)
path.type() == geometry_type::types::Point)
{
double x = 0;
double y = 0;
if (path.type() == LineString)
if (path.type() == geometry_type::types::LineString)
{
if (!label::middle_point(path, x, y))
return;
@ -1200,13 +1200,13 @@ void cairo_renderer_base::process(markers_symbolizer const& sym,
if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true)
{
eGeomType type = feature.paths()[0].type();
if (type == Polygon)
geometry_type::types type = feature.paths()[0].type();
if (type == geometry_type::types::Polygon)
converter.set<clip_poly_tag>();
// line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426
//else if (type == LineString)
//else if (type == geometry_type::types::LineString)
// converter.template set<clip_line_tag>();
// don't clip if type==Point
// don't clip if type==geometry_type::types::Point
}
converter.set<transform_tag>(); //always transform
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
@ -1225,13 +1225,13 @@ void cairo_renderer_base::process(markers_symbolizer const& sym,
if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true)
{
eGeomType type = feature.paths()[0].type();
if (type == Polygon)
geometry_type::types type = feature.paths()[0].type();
if (type == geometry_type::types::Polygon)
converter.set<clip_poly_tag>();
// line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426
//else if (type == LineString)
//else if (type == geometry_type::types::LineString)
// converter.template set<clip_line_tag>();
// don't clip if type==Point
// don't clip if type==geometry_type::types::Point
}
converter.set<transform_tag>(); //always transform
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter
@ -1255,13 +1255,13 @@ void cairo_renderer_base::process(markers_symbolizer const& sym,
if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true)
{
eGeomType type = feature.paths()[0].type();
if (type == Polygon)
geometry_type::types type = feature.paths()[0].type();
if (type == geometry_type::types::Polygon)
converter.set<clip_poly_tag>();
// line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426
//else if (type == LineString)
//else if (type == geometry_type::types::LineString)
// converter.template set<clip_line_tag>();
// don't clip if type==Point
// don't clip if type==geometry_type::types::Point
}
converter.set<transform_tag>(); //always transform
if (sym.smooth() > 0.0) converter.set<smooth_tag>(); // optional smooth converter

View file

@ -78,8 +78,8 @@ void grid_renderer<T>::process(building_symbolizer const& sym,
geometry_type & geom = feature.get_geometry(i);
if (geom.size() > 2)
{
boost::scoped_ptr<geometry_type> frame(new geometry_type(LineString));
boost::scoped_ptr<geometry_type> roof(new geometry_type(Polygon));
boost::scoped_ptr<geometry_type> frame(new geometry_type(geometry_type::types::LineString));
boost::scoped_ptr<geometry_type> roof(new geometry_type(geometry_type::types::Polygon));
std::deque<segment_t> face_segments;
double x0(0);
double y0(0);
@ -106,7 +106,7 @@ void grid_renderer<T>::process(building_symbolizer const& sym,
std::deque<segment_t>::const_iterator itr=face_segments.begin();
for (;itr!=face_segments.end();++itr)
{
boost::scoped_ptr<geometry_type> faces(new geometry_type(Polygon));
boost::scoped_ptr<geometry_type> faces(new geometry_type(geometry_type::types::Polygon));
faces->move_to(itr->get<0>(),itr->get<1>());
faces->line_to(itr->get<2>(),itr->get<3>());
faces->line_to(itr->get<2>(),itr->get<3>() + height);

View file

@ -150,8 +150,8 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
converter(query_extent_, rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_);
if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true)
{
eGeomType type = feature.paths()[0].type();
if (type == Polygon)
geometry_type::types type = feature.paths()[0].type();
if (type == geometry_type::types::Polygon)
converter.template set<clip_poly_tag>();
// line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426
//else if (type == LineString)
@ -192,8 +192,8 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
converter(query_extent_, rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_);
if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true)
{
eGeomType type = feature.paths()[0].type();
if (type == Polygon)
geometry_type::types type = feature.paths()[0].type();
if (type == geometry_type::types::Polygon)
converter.template set<clip_poly_tag>();
// line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426
//else if (type == LineString)
@ -237,8 +237,8 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
converter(query_extent_, rasterizer_dispatch, sym,t_,prj_trans,tr,scale_factor_);
if (sym.clip() && feature.paths().size() > 0) // optional clip (default: true)
{
eGeomType type = feature.paths()[0].type();
if (type == Polygon)
geometry_type::types type = feature.paths()[0].type();
if (type == geometry_type::types::Polygon)
converter.template set<clip_poly_tag>();
// line clipping disabled due to https://github.com/mapnik/mapnik/issues/1426
//else if (type == LineString)

View file

@ -107,16 +107,16 @@ geometry_grammar<Iterator>::geometry_grammar()
| (eps(_r2 == 6) > multipolygon_coordinates(_r1))
;
point_coordinates = eps[ _a = new_<geometry_type>(Point) ]
point_coordinates = eps[ _a = new_<geometry_type>(geometry_type::types::Point) ]
> ( point(SEG_MOVETO,_a) [push_back(_r1,_a)] | eps[cleanup_(_a)][_pass = false] )
;
linestring_coordinates = eps[ _a = new_<geometry_type>(LineString)]
linestring_coordinates = eps[ _a = new_<geometry_type>(geometry_type::types::LineString)]
> -(points(_a) [push_back(_r1,_a)]
| eps[cleanup_(_a)][_pass = false])
;
polygon_coordinates = eps[ _a = new_<geometry_type>(Polygon) ]
polygon_coordinates = eps[ _a = new_<geometry_type>(geometry_type::types::Polygon) ]
> ((lit('[')
> -(points(_a)[close_path_(_a)] % lit(','))
> lit(']')) [push_back(_r1,_a)]

View file

@ -219,8 +219,8 @@ void text_symbolizer_helper<FaceManagerT, DetectorT>::initialize_geometries()
// don't bother with empty geometries
if (geom.size() == 0) continue;
eGeomType type = geom.type();
if (type == Polygon)
geometry_type::types type = geom.type();
if (type == geometry_type::types::Polygon)
{
largest_box_only = sym_.largest_bbox_only();
if (sym_.get_minimum_path_length() > 0)
@ -284,7 +284,7 @@ void text_symbolizer_helper<FaceManagerT, DetectorT>::initialize_points()
// https://github.com/mapnik/mapnik/issues/1423
bool success = false;
// https://github.com/mapnik/mapnik/issues/1350
if (geom.type() == LineString)
if (geom.type() == geometry_type::types::LineString)
{
success = label::middle_point(geom, label_x,label_y);
}

View file

@ -250,7 +250,7 @@ private:
{
double x = read_double();
double y = read_double();
std::unique_ptr<geometry_type> pt(new geometry_type(Point));
std::unique_ptr<geometry_type> pt(new geometry_type(geometry_type::types::Point));
pt->move_to(x, y);
paths.push_back(pt.release());
}
@ -269,7 +269,7 @@ private:
{
double x = read_double();
double y = read_double();
std::unique_ptr<geometry_type> pt(new geometry_type(Point));
std::unique_ptr<geometry_type> pt(new geometry_type(geometry_type::types::Point));
pos_ += 8; // double z = read_double();
pt->move_to(x, y);
paths.push_back(pt.release());
@ -292,7 +292,7 @@ private:
{
CoordinateArray ar(num_points);
read_coords(ar);
std::unique_ptr<geometry_type> line(new geometry_type(LineString));
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)
{
@ -319,7 +319,7 @@ private:
{
CoordinateArray ar(num_points);
read_coords_xyz(ar);
std::unique_ptr<geometry_type> line(new geometry_type(LineString));
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)
{
@ -345,7 +345,7 @@ private:
int num_rings = read_integer();
if (num_rings > 0)
{
std::unique_ptr<geometry_type> poly(new geometry_type(Polygon));
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();
@ -381,7 +381,7 @@ private:
int num_rings = read_integer();
if (num_rings > 0)
{
std::unique_ptr<geometry_type> poly(new geometry_type(Polygon));
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();

View file

@ -72,20 +72,20 @@ wkt_generator<OutputIterator, Geometry>::wkt_generator(bool single)
wkt = point | linestring | polygon
;
point = &uint_(mapnik::Point)[_1 = _type(_val)]
point = &uint_(mapnik::geometry_type::types::Point)[_1 = _type(_val)]
<< string[ phoenix::if_ (single) [_1 = "Point("]
.else_[_1 = "("]]
<< point_coord [_1 = _first(_val)] << lit(')')
;
linestring = &uint_(mapnik::LineString)[_1 = _type(_val)]
linestring = &uint_(mapnik::geometry_type::types::LineString)[_1 = _type(_val)]
<< string[ phoenix::if_ (single) [_1 = "LineString("]
.else_[_1 = "("]]
<< coords
<< lit(')')
;
polygon = &uint_(mapnik::Polygon)[_1 = _type(_val)]
polygon = &uint_(mapnik::geometry_type::types::Polygon)[_1 = _type(_val)]
<< string[ phoenix::if_ (single) [_1 = "Polygon("]
.else_[_1 = "("]]
<< coords2
@ -126,9 +126,9 @@ wkt_multi_generator<OutputIterator, GeometryContainer>::wkt_multi_generator()
using boost::spirit::karma::_a;
geometry_types.add
(mapnik::Point,"Point")
(mapnik::LineString,"LineString")
(mapnik::Polygon,"Polygon")
(mapnik::geometry_type::types::Point,"Point")
(mapnik::geometry_type::types::LineString,"LineString")
(mapnik::geometry_type::types::Polygon,"Polygon")
;
wkt = eps(phoenix::at_c<1>(_a))[_a = _multi_type(_val)]

View file

@ -43,7 +43,7 @@ int main(int argc, char** argv)
mapnik::transcoder tr("utf-8");
mapnik::value_unicode_string ustr = tr.transcode("hello world!");
feature->put("name",ustr);
mapnik::geometry_type * pt = new mapnik::geometry_type(mapnik::Point);
mapnik::geometry_type * pt = new mapnik::geometry_type(mapnik::geometry_type::types::Point);
pt->move_to(128,128);
feature->add_geometry(pt);
boost::shared_ptr<mapnik::memory_datasource> ds = boost::make_shared<mapnik::memory_datasource>();

View file

@ -23,7 +23,7 @@
struct output_geometry_backend
{
output_geometry_backend(boost::ptr_vector<mapnik::geometry_type> & paths, mapnik::eGeomType type)
output_geometry_backend(boost::ptr_vector<mapnik::geometry_type> & paths, mapnik::geometry_type::types type)
: paths_(paths),
type_(type) {}
@ -42,7 +42,7 @@ struct output_geometry_backend
paths_.push_back(geom_ptr.release());
}
boost::ptr_vector<mapnik::geometry_type> & paths_;
mapnik::eGeomType type_;
mapnik::geometry_type::types type_;
};
boost::optional<std::string> linestring_bbox_clipping(mapnik::box2d<double> bbox,
@ -56,7 +56,7 @@ boost::optional<std::string> linestring_bbox_clipping(mapnik::box2d<double> bbox
line_symbolizer sym;
CoordTransform t(bbox.width(),bbox.height(), bbox);
boost::ptr_vector<mapnik::geometry_type> output_paths;
output_geometry_backend backend(output_paths, mapnik::LineString);
output_geometry_backend backend(output_paths, mapnik::geometry_type::types::LineString);
typedef boost::mpl::vector<clip_line_tag> conv_types;
vertex_converter<box2d<double>, output_geometry_backend, line_symbolizer,
@ -96,7 +96,7 @@ boost::optional<std::string> polygon_bbox_clipping(mapnik::box2d<double> bbox,
polygon_symbolizer sym;
CoordTransform t(bbox.width(),bbox.height(), bbox);
boost::ptr_vector<mapnik::geometry_type> output_paths;
output_geometry_backend backend(output_paths, mapnik::Polygon);
output_geometry_backend backend(output_paths, mapnik::geometry_type::types::Polygon);
typedef boost::mpl::vector<clip_poly_tag> conv_types;
vertex_converter<box2d<double>, output_geometry_backend, polygon_symbolizer,

View file

@ -19,7 +19,7 @@ int main(int argc, char** argv)
double x,y;
// single point
mapnik::geometry_type pt(mapnik::Point);
mapnik::geometry_type pt(mapnik::geometry_type::types::Point);
pt.move_to(10,10);
BOOST_TEST( mapnik::label::centroid(pt, x, y) );
BOOST_TEST( x == 10 );
@ -32,7 +32,7 @@ int main(int argc, char** argv)
BOOST_TEST_EQ( y, 15 );
// line with two verticies
mapnik::geometry_type line(mapnik::LineString);
mapnik::geometry_type line(mapnik::geometry_type::types::LineString);
line.move_to(0,0);
line.move_to(50,50);
BOOST_TEST( mapnik::label::centroid(line, x, y) );