update markers_symbolizer to work with mapnik-geometry (work-in-progress)

This commit is contained in:
artemp 2015-03-05 15:07:23 +01:00
parent 38dc240d6d
commit aa5ae6b843
22 changed files with 114 additions and 82 deletions

View file

@ -93,7 +93,7 @@ public:
unsigned cmd;
double x,y;
clipped.rewind(0);
mapnik::geometry_type geom2(mapnik::geometry_type::types::Polygon);
mapnik::geometry_type geom2(mapnik::new_geometry::geometry_types::Polygon);
while ((cmd = clipped.vertex(&x, &y)) != mapnik::SEG_END) {
geom2.push_vertex(x,y,(mapnik::CommandType)cmd);
}
@ -191,7 +191,7 @@ public:
clipped.rewind(0);
unsigned cmd;
double x,y;
mapnik::geometry_type geom2(mapnik::geometry_type::types::Polygon);
mapnik::geometry_type geom2(mapnik::new_geometry::geometry_types::Polygon);
while ((cmd = clipped.vertex(&x, &y)) != mapnik::SEG_END) {
geom2.push_vertex(x,y,(mapnik::CommandType)cmd);
}
@ -280,7 +280,7 @@ public:
poly_clipper clipped(extent_, va);
unsigned cmd;
double x,y;
mapnik::geometry_type geom2(mapnik::geometry_type::types::Polygon);
mapnik::geometry_type geom2(mapnik::new_geometry::geometry_types::Polygon);
while ((cmd = clipped.vertex(&x, &y)) != mapnik::SEG_END) {
geom2.push_vertex(x,y,(mapnik::CommandType)cmd);
}

View file

@ -27,8 +27,8 @@
#include <mapnik/box2d.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/vertex.hpp>
#include <mapnik/geometry.hpp> // for geometry_type::types (TODO: avoid this interdependence)
//#include <mapnik/geometry.hpp> // for geometry_type::types (TODO: avoid this interdependence)
#include <mapnik/geometry_types.hpp>
// stl
#include <cmath>
#include <vector>
@ -377,6 +377,7 @@ bool centroid(PathType & path, double & x, double & y)
}
// Compute centroid over a set of paths
#if 0
template <typename Iter>
bool centroid_geoms(Iter start, Iter end, double & x, double & y)
{
@ -445,6 +446,8 @@ bool centroid_geoms(Iter start, Iter end, double & x, double & y)
return true;
}
#endif
template <typename PathType>
bool hit_test(PathType & path, double x, double y, double tol)
{
@ -460,7 +463,7 @@ bool hit_test(PathType & path, double x, double y, double tol)
return false;
}
unsigned count = 0;
mapnik::geometry_type::types geom_type = static_cast<mapnik::geometry_type::types>(path.type());
mapnik::new_geometry::geometry_types geom_type = static_cast<mapnik::new_geometry::geometry_types>(path.type());
while (SEG_END != (command = path.vertex(&x1, &y1)))
{
if (command == SEG_CLOSE)
@ -476,7 +479,7 @@ bool hit_test(PathType & path, double x, double y, double tol)
}
switch(geom_type)
{
case mapnik::geometry_type::types::Polygon:
case mapnik::new_geometry::geometry_types::Polygon:
{
if ((((y1 <= y) && (y < y0)) ||
((y0 <= y) && (y < y1))) &&
@ -484,7 +487,7 @@ bool hit_test(PathType & path, double x, double y, double tol)
inside=!inside;
break;
}
case mapnik::geometry_type::types::LineString:
case mapnik::new_geometry::geometry_types::LineString:
{
double distance = point_to_segment_distance(x,y,x0,y0,x1,y1);
if (distance < tol)

View file

@ -27,6 +27,7 @@
#include <mapnik/util/variant.hpp>
#include <mapnik/vertex.hpp>
#include <mapnik/util/noncopyable.hpp>
#include <mapnik/geometry_types.hpp>
#include <algorithm>
#include <vector>
@ -133,6 +134,12 @@ struct point_vertex_adapter
{
first_ = true;
}
inline geometry_types type () const
{
return geometry_types::Point;
}
point const& pt_;
mutable bool first_;
};
@ -168,6 +175,12 @@ struct line_string_vertex_adapter
{
current_index_ = 0;
}
inline geometry_types type () const
{
return geometry_types::LineString;
}
line_string const& line_;
mutable std::size_t current_index_;
const std::size_t end_index_;
@ -221,6 +234,12 @@ struct polygon_vertex_adapter
}
return mapnik::SEG_END;
}
inline geometry_types type () const
{
return geometry_types::Polygon;
}
private:
polygon const& poly_;
mutable std::size_t rings_itr_;

View file

@ -25,7 +25,8 @@
#include <mapnik/color.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/geometry.hpp>
#include <mapnik/geometry_impl.hpp>
#include <mapnik/geometry_type.hpp>
#include <mapnik/geom_util.hpp>
#include <mapnik/symbolizer.hpp>
#include <mapnik/expression_node.hpp>
@ -37,7 +38,9 @@
#include <mapnik/attribute.hpp>
#include <mapnik/box2d.hpp>
#include <mapnik/vertex_converters.hpp>
#include <mapnik/vertex_processor.hpp>
#include <mapnik/label_collision_detector.hpp>
#include <mapnik/renderer_common/apply_vertex_converter.hpp>
// agg
#include "agg_trans_affine.h"
@ -191,16 +194,23 @@ void setup_transform_scaling(agg::trans_affine & tr,
template <typename Converter>
void apply_markers_multi(feature_impl const& feature, attributes const& vars, Converter & converter, symbolizer_base const& sym)
{
// FIXME
/*
std::size_t geom_count = feature.paths().size();
if (geom_count == 1)
using vertex_converter_type = Converter;
using apply_vertex_converter_type = detail::apply_vertex_converter<vertex_converter_type>;
using vertex_processor_type = new_geometry::vertex_processor<apply_vertex_converter_type>;
auto const& geom = feature.get_geometry();
new_geometry::geometry_types type = new_geometry::geometry_type(geom);
if (type == new_geometry::geometry_types::Point
|| new_geometry::geometry_types::LineString
|| new_geometry::geometry_types::Polygon)
{
vertex_adapter va(feature.paths()[0]);
converter.apply(va);
apply_vertex_converter_type apply(converter);
mapnik::util::apply_visitor(vertex_processor_type(apply), geom);
}
else if (geom_count > 1)
else //if (geom_count > 1)
{
#if 0
marker_multi_policy_enum multi_policy = get<marker_multi_policy_enum, keys::markers_multipolicy>(sym, feature, vars);
marker_placement_enum placement = get<marker_placement_enum, keys::markers_placement_type>(sym, feature, vars);
@ -254,8 +264,8 @@ void apply_markers_multi(feature_impl const& feature, attributes const& vars, Co
converter.apply(va);
}
}
#endif
}
*/
}
}

View file

@ -25,6 +25,7 @@
#include <mapnik/markers_placements/point.hpp>
#include <mapnik/geom_util.hpp>
#include <mapnik/geometry_types.hpp>
namespace mapnik {
@ -48,12 +49,12 @@ public:
return false;
}
if (this->locator_.type() == mapnik::geometry_type::types::Point)
if (this->locator_.type() == new_geometry::geometry_types::Point)
{
return markers_point_placement<Locator, Detector>::get_point(x, y, angle, ignore_placement);
}
if (this->locator_.type() == mapnik::geometry_type::types::LineString)
if (this->locator_.type() == new_geometry::geometry_types::LineString)
{
if (!label::middle_point(this->locator_, x, y))
{

View file

@ -27,6 +27,7 @@
#include <mapnik/view_transform.hpp>
#include <mapnik/vertex_cache.hpp>
#include <mapnik/tolerance_iterator.hpp>
#include <mapnik/geometry_types.hpp>
namespace mapnik {
@ -67,7 +68,7 @@ public:
return false;
}
if (this->locator_.type() == mapnik::geometry_type::types::Point)
if (this->locator_.type() == new_geometry::geometry_types::Point)
{
return markers_point_placement<Locator, Detector>::get_point(x, y, angle, ignore_placement);
}

View file

@ -24,6 +24,7 @@
#define MAPNIK_MARKERS_PLACEMENTS_POINT_HPP
#include <mapnik/geom_util.hpp>
#include <mapnik/geometry_types.hpp>
#include "agg_basics.h"
#include "agg_trans_affine.h"
@ -76,7 +77,7 @@ public:
return false;
}
if (locator_.type() == mapnik::geometry_type::types::LineString)
if (locator_.type() == new_geometry::geometry_types::LineString)
{
if (!label::middle_point(locator_, x, y))
{

View file

@ -47,7 +47,7 @@ public:
return false;
}
if (this->locator_.type() == mapnik::geometry_type::types::Point)
if (this->locator_.type() == mapnik::new_geometry::geometry_types::Point)
{
return markers_point_placement<Locator, Detector>::get_point(x, y, angle, ignore_placement);
}

View file

@ -29,6 +29,7 @@
#include <mapnik/vertex_converters.hpp>
#include <mapnik/marker_cache.hpp>
#include <mapnik/marker_helpers.hpp>
#include <mapnik/geometry_type.hpp>
namespace mapnik {
@ -114,16 +115,15 @@ struct render_marker_symbolizer_visitor
feature_,
common_.vars_,
common_.scale_factor_);
#if 0 // FIXME
if (clip && feature_.paths().size() > 0) // optional clip (default: true)
if (clip) // optional clip (default: true)
{
geometry_type::types type = feature_.paths()[0].type();
if (type == geometry_type::types::Polygon)
new_geometry::geometry_types type = new_geometry::geometry_type(feature_.get_geometry());
if (type == new_geometry::geometry_types::Polygon)
converter.template set<clip_poly_tag>();
else if (type == geometry_type::types::LineString)
else if (type == new_geometry::geometry_types::LineString)
converter.template set<clip_line_tag>();
}
#endif
converter.template set<transform_tag>(); //always transform
if (std::fabs(offset) > 0.0) converter.template set<offset_transform_tag>(); // parallel offset
converter.template set<affine_transform_tag>(); // optional affine transform
@ -168,16 +168,15 @@ struct render_marker_symbolizer_visitor
feature_,
common_.vars_,
common_.scale_factor_);
#if 0 // FIXME
if (clip && feature_.paths().size() > 0) // optional clip (default: true)
if (clip) // optional clip (default: true)
{
geometry_type::types type = feature_.paths()[0].type();
if (type == geometry_type::types::Polygon)
new_geometry::geometry_types type = new_geometry::geometry_type(feature_.get_geometry());
if (type == new_geometry::geometry_types::Polygon)
converter.template set<clip_poly_tag>();
else if (type == geometry_type::types::LineString)
else if (type == new_geometry::geometry_types::LineString)
converter.template set<clip_line_tag>();
}
#endif
converter.template set<transform_tag>(); //always transform
if (std::fabs(offset) > 0.0) converter.template set<offset_transform_tag>(); // parallel offset
converter.template set<affine_transform_tag>(); // optional affine transform

View file

@ -27,6 +27,7 @@
// mapnik
#include <mapnik/global.hpp>
#include <mapnik/geometry.hpp> // for container stuff
#include <mapnik/geometry_impl.hpp>
#include <mapnik/view_transform.hpp> // for container stuff
#include <mapnik/transform_path_adapter.hpp>
#include <mapnik/util/path_iterator.hpp>

View file

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

View file

@ -139,7 +139,7 @@ wkb_buffer_ptr to_point_wkb( GeometryType const& g, wkbByteOrder byte_order)
wkb_buffer_ptr wkb = std::make_unique<wkb_buffer>(size);
wkb_stream ss(wkb->buffer(), wkb->size());
ss.write(reinterpret_cast<char*>(&byte_order),1);
int type = static_cast<int>(mapnik::geometry_type::types::Point);
int type = static_cast<int>(mapnik::new_geometry::geometry_types::Point);
write(ss,type,4,byte_order);
double x = 0;
double y = 0;
@ -159,7 +159,7 @@ wkb_buffer_ptr to_line_string_wkb( GeometryType const& g, wkbByteOrder byte_orde
wkb_buffer_ptr wkb = std::make_unique<wkb_buffer>(size);
wkb_stream ss(wkb->buffer(), wkb->size());
ss.write(reinterpret_cast<char*>(&byte_order),1);
int type = static_cast<int>(mapnik::geometry_type::types::LineString);
int type = static_cast<int>(mapnik::new_geometry::geometry_types::LineString);
write(ss,type,4,byte_order);
write(ss,num_points,4,byte_order);
double x = 0;
@ -209,7 +209,7 @@ wkb_buffer_ptr to_polygon_wkb( GeometryType const& g, wkbByteOrder byte_order)
wkb_buffer_ptr wkb = std::make_unique<wkb_buffer>(size);
wkb_stream ss(wkb->buffer(), wkb->size());
ss.write(reinterpret_cast<char*>(&byte_order),1);
int type = static_cast<int>(mapnik::geometry_type::types::Polygon);
int type = static_cast<int>(mapnik::new_geometry::geometry_types::Polygon);
write(ss,type,4,byte_order);
write(ss,num_rings,4,byte_order);
@ -235,13 +235,13 @@ wkb_buffer_ptr to_wkb(GeometryType const& g, wkbByteOrder byte_order )
vertex_adapter va(g);
switch (va.type())
{
case mapnik::geometry_type::types::Point:
case mapnik::new_geometry::geometry_types::Point:
wkb = to_point_wkb(va, byte_order);
break;
case mapnik::geometry_type::types::LineString:
case mapnik::new_geometry::geometry_types::LineString:
wkb = to_line_string_wkb(va, byte_order);
break;
case mapnik::geometry_type::types::Polygon:
case mapnik::new_geometry::geometry_types::Polygon:
wkb = to_polygon_wkb(va, byte_order);
break;
default:

View file

@ -20,7 +20,7 @@
*
*****************************************************************************/
#include <mapnik/geometry.hpp>
#include <mapnik/geometry_impl.hpp>
#include <mapnik/wkt/wkt_generator_grammar.hpp>
#include <mapnik/util/path_iterator.hpp>
#include <mapnik/util/container_adapter.hpp>
@ -67,20 +67,20 @@ wkt_generator<OutputIterator, Geometry>::wkt_generator(bool single)
wkt = point | linestring | polygon
;
point = &uint_(mapnik::geometry_type::types::Point)[_1 = _type(_val)]
point = &uint_(mapnik::new_geometry::geometry_types::Point)[_1 = _type(_val)]
<< kstring[ phoenix::if_ (single) [_1 = "Point("]
.else_[_1 = "("]]
<< point_coord [_1 = _first(_val)] << lit(')')
;
linestring = &uint_(mapnik::geometry_type::types::LineString)[_1 = _type(_val)]
linestring = &uint_(mapnik::new_geometry::geometry_types::LineString)[_1 = _type(_val)]
<< kstring[ phoenix::if_ (single) [_1 = "LineString("]
.else_[_1 = "("]]
<< coords
<< lit(')')
;
polygon = &uint_(mapnik::geometry_type::types::Polygon)[_1 = _type(_val)]
polygon = &uint_(mapnik::new_geometry::geometry_types::Polygon)[_1 = _type(_val)]
<< kstring[ phoenix::if_ (single) [_1 = "Polygon("]
.else_[_1 = "("]]
<< coords2
@ -121,9 +121,9 @@ wkt_multi_generator<OutputIterator, GeometryContainer>::wkt_multi_generator()
boost::spirit::karma::_a_type _a;
geometry_types.add
(mapnik::geometry_type::types::Point,"Point")
(mapnik::geometry_type::types::LineString,"LineString")
(mapnik::geometry_type::types::Polygon,"Polygon")
(mapnik::new_geometry::geometry_types::Point,"Point")
(mapnik::new_geometry::geometry_types::LineString,"LineString")
(mapnik::new_geometry::geometry_types::Polygon,"Polygon")
;
wkt = eps(phoenix::at_c<1>(_a))[_a = _multi_type(_val)]

View file

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

View file

@ -614,7 +614,7 @@ feature_ptr gdal_featureset::get_feature_at_point(mapnik::coord2d const& pt)
{
// construct feature
feature_ptr feature = feature_factory::create(ctx_,1);
std::unique_ptr<geometry_type> point = std::make_unique<geometry_type>(mapnik::geometry_type::types::Point);
std::unique_ptr<geometry_type> point = std::make_unique<geometry_type>(mapnik::new_geometry::geometry_types::Point);
point->move_to(pt.x, pt.y);
feature->add_geometry(point.release());
feature->put_new("value",value);

View file

@ -260,7 +260,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
SDOPointType* sdopoint = geom->getSdo_point();
if (sdopoint && ! sdopoint->isNull())
{
std::unique_ptr<geometry_type> point = std::make_unique<geometry_type>(mapnik::geometry_type::types::Point);
std::unique_ptr<geometry_type> point = std::make_unique<geometry_type>(mapnik::new_geometry::geometry_types::Point);
point->move_to(sdopoint->getX(), sdopoint->getY());
feature->add_geometry(point.release());
}
@ -273,7 +273,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
const bool is_single_geom = true;
const bool is_point_type = false;
convert_ordinates(feature,
mapnik::geometry_type::types::LineString,
mapnik::new_geometry::geometry_types::LineString,
elem_info,
ordinates,
dimensions,
@ -289,7 +289,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
const bool is_single_geom = true;
const bool is_point_type = false;
convert_ordinates(feature,
mapnik::geometry_type::types::Polygon,
mapnik::new_geometry::geometry_types::Polygon,
elem_info,
ordinates,
dimensions,
@ -305,7 +305,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
const bool is_single_geom = false;
const bool is_point_type = true;
convert_ordinates(feature,
mapnik::geometry_type::types::Point,
mapnik::new_geometry::geometry_types::Point,
elem_info,
ordinates,
dimensions,
@ -322,7 +322,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
const bool is_point_type = false;
convert_ordinates(feature,
mapnik::geometry_type::types::LineString,
mapnik::new_geometry::geometry_types::LineString,
elem_info,
ordinates,
dimensions,
@ -339,7 +339,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
const bool is_point_type = false;
convert_ordinates(feature,
mapnik::geometry_type::types::Polygon,
mapnik::new_geometry::geometry_types::Polygon,
elem_info,
ordinates,
dimensions,
@ -357,7 +357,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature)
const bool is_point_type = false;
convert_ordinates(feature,
mapnik::geometry_type::types::Polygon,
mapnik::new_geometry::geometry_types::Polygon,
elem_info,
ordinates,
dimensions,
@ -405,20 +405,20 @@ 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::geometry_type::types gtype = mapnik::geometry_type::types::Point;
mapnik::geometry_type::types gtype = mapnik::new_geometry::geometry_types::Point;
switch (etype)
{
case SDO_ETYPE_POINT:
if (interp == SDO_INTERPRETATION_POINT) {}
if (interp > SDO_INTERPRETATION_POINT) {}
gtype = mapnik::geometry_type::types::Point;
gtype = mapnik::new_geometry::geometry_types::Point;
break;
case SDO_ETYPE_LINESTRING:
if (interp == SDO_INTERPRETATION_STRAIGHT) {}
if (interp == SDO_INTERPRETATION_CIRCULAR) {}
gtype = mapnik::geometry_type::types::LineString;
gtype = mapnik::new_geometry::geometry_types::LineString;
break;
case SDO_ETYPE_POLYGON:
@ -427,7 +427,7 @@ void occi_featureset::convert_ordinates(mapnik::feature_ptr feature,
if (interp == SDO_INTERPRETATION_CIRCULAR) {}
if (interp == SDO_INTERPRETATION_RECTANGLE) {}
if (interp == SDO_INTERPRETATION_CIRCLE) {}
gtype = mapnik::geometry_type::types::Polygon;
gtype = mapnik::new_geometry::geometry_types::Polygon;
break;
case SDO_ETYPE_COMPOUND_LINESTRING:
@ -435,7 +435,7 @@ void occi_featureset::convert_ordinates(mapnik::feature_ptr feature,
case SDO_ETYPE_COMPOUND_POLYGON_INTERIOR:
// interp = next ETYPE to consider
is_linear_element = false;
gtype = mapnik::geometry_type::types::Polygon;
gtype = mapnik::new_geometry::geometry_types::Polygon;
break;
case SDO_ETYPE_UNKNOWN: // unknown

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::geometry_type::types::Point));
std::unique_ptr<geometry_type> point(new geometry_type(mapnik::new_geometry::geometry_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::geometry_type::types::LineString));
std::unique_ptr<geometry_type> line(new geometry_type(mapnik::new_geometry::geometry_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::geometry_type::types::Polygon));
std::unique_ptr<geometry_type> poly(new geometry_type(mapnik::new_geometry::geometry_types::Polygon));
poly->move_to(exterior->getX(0), exterior->getY(0));
for (int i = 1; i < num_points; ++i)

View file

@ -64,7 +64,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;
std::unique_ptr<geometry_type> point = std::make_unique<geometry_type>(mapnik::geometry_type::types::Point);
std::unique_ptr<geometry_type> point = std::make_unique<geometry_type>(mapnik::new_geometry::geometry_types::Point);
point->move_to(lon, lat);
feature->add_geometry(point.release());
}
@ -82,10 +82,10 @@ feature_ptr osm_featureset<filterT>::next()
if (!cur_item) return feature_ptr();
feature = feature_factory::create(ctx_, cur_item->id);
mapnik::geometry_type::types geom_type = mapnik::geometry_type::types::LineString;
mapnik::geometry_type::types geom_type = mapnik::new_geometry::geometry_types::LineString;
if (static_cast<osm_way*>(cur_item)->is_polygon())
{
geom_type = mapnik::geometry_type::types::Polygon;
geom_type = mapnik::new_geometry::geometry_types::Polygon;
}
std::unique_ptr<geometry_type> geom = std::make_unique<geometry_type>(geom_type);

View file

@ -45,9 +45,6 @@
#include "agg_renderer_outline_aa.h"
#include "agg_rasterizer_outline_aa.h"
// boost
// stl
#include <string>
#include <cmath>

View file

@ -49,7 +49,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);
auto pt = std::make_unique<mapnik::geometry_type>(mapnik::geometry_type::types::Point);
auto pt = std::make_unique<mapnik::geometry_type>(mapnik::new_geometry::geometry_types::Point);
pt->move_to(128,128);
feature->add_geometry(pt.release());

View file

@ -56,7 +56,7 @@ boost::optional<std::string> linestring_bbox_clipping(mapnik::box2d<double> bbox
line_symbolizer sym;
view_transform t(bbox.width(),bbox.height(), bbox);
mapnik::geometry_container output_paths;
output_geometry_backend backend(output_paths, mapnik::geometry_type::types::LineString);
output_geometry_backend backend(output_paths, mapnik::new_geometry::geometry_types::LineString);
mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>();
mapnik::feature_impl f(ctx,0);
@ -99,7 +99,7 @@ boost::optional<std::string> polygon_bbox_clipping(mapnik::box2d<double> bbox,
polygon_symbolizer sym;
view_transform t(bbox.width(),bbox.height(), bbox);
mapnik::geometry_container output_paths;
output_geometry_backend backend(output_paths, mapnik::geometry_type::types::Polygon);
output_geometry_backend backend(output_paths, mapnik::new_geometry::geometry_types::Polygon);
mapnik::context_ptr ctx = std::make_shared<mapnik::context_type>();
mapnik::feature_impl f(ctx,0);
@ -163,7 +163,7 @@ int main(int argc, char** argv)
// below is ideal, but not current result
//BOOST_TEST_EQ(*result,std::string("Polygon((50 50,150 50,150 150,50 150,50 50))"));
}
{
std::string wkt_in("Polygon((60 60,140 60,140 160,60 140,60 60))");
boost::optional<std::string> result = polygon_bbox_clipping(mapnik::box2d<double>(50,50,150,150),wkt_in);
@ -186,7 +186,7 @@ int main(int argc, char** argv)
BOOST_TEST_EQ(*result, std::string("Polygon((50 50,50 100,75 150,125 150,150 100,150 50))"));
//BOOST_TEST_EQ(*result,std::string("Polygon((50 50,50 100,75 150,125 150,150 100,150 50,50 50))"));
}
}
catch (std::exception const & ex)
{

View file

@ -19,7 +19,7 @@ int main(int argc, char** argv)
// reused these for simplicity
double x,y;
mapnik::geometry_type pt(mapnik::geometry_type::types::Point);
mapnik::geometry_type pt(mapnik::new_geometry::geometry_types::Point);
// single point
pt.move_to(10,10);
{
@ -37,7 +37,7 @@ int main(int argc, char** argv)
BOOST_TEST_EQ( y, 15 );
}
// line with two verticies
mapnik::geometry_type line(mapnik::geometry_type::types::LineString);
mapnik::geometry_type line(mapnik::new_geometry::geometry_types::LineString);
line.move_to(0,0);
line.line_to(50,50);
mapnik::vertex_adapter va(line);
@ -50,7 +50,7 @@ int main(int argc, char** argv)
// hit tests
{
mapnik::geometry_type pt_hit(mapnik::geometry_type::types::Point);
mapnik::geometry_type pt_hit(mapnik::new_geometry::geometry_types::Point);
pt_hit.move_to(10,10);
mapnik::vertex_adapter va(pt_hit);
BOOST_TEST( mapnik::label::hit_test(va, 10, 10, 0.1) );
@ -58,7 +58,7 @@ int main(int argc, char** argv)
BOOST_TEST( mapnik::label::hit_test(va, 9, 9, 1.5) );
}
{
mapnik::geometry_type line_hit(mapnik::geometry_type::types::LineString);
mapnik::geometry_type line_hit(mapnik::new_geometry::geometry_types::LineString);
line_hit.move_to(0,0);
line_hit.line_to(50,50);
mapnik::vertex_adapter va(line_hit);