Merge branch 'master' of github.com:mapnik/mapnik
This commit is contained in:
commit
3ddd38116c
4 changed files with 297 additions and 296 deletions
|
@ -1330,7 +1330,9 @@ if not preconfigured:
|
|||
py3 = 'True' in os.popen('''%s -c "import sys as s;s.stdout.write(str(s.version_info[0] == 3))"''' % env['PYTHON']).read().strip()
|
||||
|
||||
if py3 and env['BOOST_PYTHON_LIB'] == 'boost_python':
|
||||
env['BOOST_PYTHON_LIB'] = 'boost_python3'
|
||||
env['BOOST_PYTHON_LIB'] = 'boost_python3%s' % env['BOOST_APPEND']
|
||||
elif env['BOOST_PYTHON_LIB'] == 'boost_python':
|
||||
env['BOOST_PYTHON_LIB'] = 'boost_python%s' % env['BOOST_APPEND']
|
||||
|
||||
if not conf.CheckHeader(header='boost/python/detail/config.hpp',language='C++'):
|
||||
color_print(1,'Could not find required header files for boost python')
|
||||
|
|
|
@ -47,9 +47,9 @@ public:
|
|||
typedef path_adapter<VertexContainer> self_type;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
path_adapter(VertexContainer & vertices) : m_vertices(vertices), m_iterator(0) {}
|
||||
//void remove_all() { m_vertices.remove_all(); m_iterator = 0; }
|
||||
//void free_all() { m_vertices.free_all(); m_iterator = 0; }
|
||||
path_adapter(VertexContainer & vertices) : vertices_(vertices), iterator_(0) {}
|
||||
//void remove_all() { vertices_.remove_all(); iterator_ = 0; }
|
||||
//void free_all() { vertices_.free_all(); iterator_ = 0; }
|
||||
|
||||
// Make path functions
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -109,8 +109,8 @@ public:
|
|||
|
||||
// Accessors
|
||||
//--------------------------------------------------------------------
|
||||
const container_type& vertices() const { return m_vertices; }
|
||||
container_type& vertices() { return m_vertices; }
|
||||
const container_type& vertices() const { return vertices_; }
|
||||
container_type& vertices() { return vertices_; }
|
||||
|
||||
unsigned total_vertices() const;
|
||||
|
||||
|
@ -160,7 +160,7 @@ public:
|
|||
vs.rewind(path_id);
|
||||
while(!is_stop(cmd = vs.vertex(&x, &y)))
|
||||
{
|
||||
m_vertices.add_vertex(x, y, cmd);
|
||||
vertices_.add_vertex(x, y, cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ public:
|
|||
if(calc_distance(x, y, x0, y0) > vertex_dist_epsilon)
|
||||
{
|
||||
if(is_move_to(cmd)) cmd = path_cmd_line_to;
|
||||
m_vertices.add_vertex(x, y, cmd);
|
||||
vertices_.add_vertex(x, y, cmd);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -198,12 +198,12 @@ public:
|
|||
{
|
||||
if(is_move_to(cmd)) cmd = path_cmd_line_to;
|
||||
}
|
||||
m_vertices.add_vertex(x, y, cmd);
|
||||
vertices_.add_vertex(x, y, cmd);
|
||||
}
|
||||
}
|
||||
while(!is_stop(cmd = vs.vertex(&x, &y)))
|
||||
{
|
||||
m_vertices.add_vertex(x, y, is_move_to(cmd) ?
|
||||
vertices_.add_vertex(x, y, is_move_to(cmd) ?
|
||||
unsigned(path_cmd_line_to) :
|
||||
cmd);
|
||||
}
|
||||
|
@ -218,16 +218,16 @@ public:
|
|||
template<class Trans>
|
||||
void transform(const Trans& trans, unsigned path_id=0)
|
||||
{
|
||||
unsigned num_ver = m_vertices.total_vertices();
|
||||
unsigned num_ver = vertices_.total_vertices();
|
||||
for(; path_id < num_ver; path_id++)
|
||||
{
|
||||
double x, y;
|
||||
unsigned cmd = m_vertices.vertex(path_id, &x, &y);
|
||||
unsigned cmd = vertices_.vertex(path_id, &x, &y);
|
||||
if(is_stop(cmd)) break;
|
||||
if(is_vertex(cmd))
|
||||
{
|
||||
trans.transform(&x, &y);
|
||||
m_vertices.modify_vertex(path_id, x, y);
|
||||
vertices_.modify_vertex(path_id, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -237,14 +237,14 @@ public:
|
|||
void transform_all_paths(const Trans& trans)
|
||||
{
|
||||
unsigned idx;
|
||||
unsigned num_ver = m_vertices.total_vertices();
|
||||
unsigned num_ver = vertices_.total_vertices();
|
||||
for(idx = 0; idx < num_ver; idx++)
|
||||
{
|
||||
double x, y;
|
||||
if(is_vertex(m_vertices.vertex(idx, &x, &y)))
|
||||
if(is_vertex(vertices_.vertex(idx, &x, &y)))
|
||||
{
|
||||
trans.transform(&x, &y);
|
||||
m_vertices.modify_vertex(idx, x, y);
|
||||
vertices_.modify_vertex(idx, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -255,19 +255,21 @@ private:
|
|||
unsigned perceive_polygon_orientation(unsigned start, unsigned end);
|
||||
void invert_polygon(unsigned start, unsigned end);
|
||||
|
||||
VertexContainer & m_vertices;
|
||||
unsigned m_iterator;
|
||||
VertexContainer & vertices_;
|
||||
unsigned iterator_;
|
||||
double start_x_;
|
||||
double start_y_;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VC>
|
||||
unsigned path_adapter<VC>::start_new_path()
|
||||
{
|
||||
if(!is_stop(m_vertices.last_command()))
|
||||
if(!is_stop(vertices_.last_command()))
|
||||
{
|
||||
m_vertices.add_vertex(0.0, 0.0, path_cmd_stop);
|
||||
vertices_.add_vertex(0.0, 0.0, path_cmd_stop);
|
||||
}
|
||||
return m_vertices.total_vertices();
|
||||
return vertices_.total_vertices();
|
||||
}
|
||||
|
||||
|
||||
|
@ -275,17 +277,12 @@ unsigned path_adapter<VC>::start_new_path()
|
|||
template<class VC>
|
||||
inline void path_adapter<VC>::rel_to_abs(double* x, double* y) const
|
||||
{
|
||||
if(m_vertices.total_vertices())
|
||||
if(vertices_.total_vertices())
|
||||
{
|
||||
double x2;
|
||||
double y2;
|
||||
if(is_vertex(m_vertices.last_vertex(&x2, &y2)))
|
||||
{
|
||||
*x += x2;
|
||||
*y += y2;
|
||||
}
|
||||
else if (!is_stop(m_vertices.last_command()) &&
|
||||
is_vertex(m_vertices.prev_vertex(&x2, &y2)))
|
||||
if(is_vertex(vertices_.last_vertex(&x2, &y2))
|
||||
|| !is_stop(vertices_.last_command()))
|
||||
{
|
||||
*x += x2;
|
||||
*y += y2;
|
||||
|
@ -297,7 +294,9 @@ inline void path_adapter<VC>::rel_to_abs(double* x, double* y) const
|
|||
template<class VC>
|
||||
inline void path_adapter<VC>::move_to(double x, double y)
|
||||
{
|
||||
m_vertices.add_vertex(x, y, path_cmd_move_to);
|
||||
start_x_ = x;
|
||||
start_y_ = y;
|
||||
vertices_.add_vertex(x, y, path_cmd_move_to);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -305,14 +304,14 @@ template<class VC>
|
|||
inline void path_adapter<VC>::move_rel(double dx, double dy)
|
||||
{
|
||||
rel_to_abs(&dx, &dy);
|
||||
m_vertices.add_vertex(dx, dy, path_cmd_move_to);
|
||||
vertices_.add_vertex(dx, dy, path_cmd_move_to);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VC>
|
||||
inline void path_adapter<VC>::line_to(double x, double y)
|
||||
{
|
||||
m_vertices.add_vertex(x, y, path_cmd_line_to);
|
||||
vertices_.add_vertex(x, y, path_cmd_line_to);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -320,14 +319,14 @@ template<class VC>
|
|||
inline void path_adapter<VC>::line_rel(double dx, double dy)
|
||||
{
|
||||
rel_to_abs(&dx, &dy);
|
||||
m_vertices.add_vertex(dx, dy, path_cmd_line_to);
|
||||
vertices_.add_vertex(dx, dy, path_cmd_line_to);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VC>
|
||||
inline void path_adapter<VC>::hline_to(double x)
|
||||
{
|
||||
m_vertices.add_vertex(x, last_y(), path_cmd_line_to);
|
||||
vertices_.add_vertex(x, last_y(), path_cmd_line_to);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -336,14 +335,14 @@ inline void path_adapter<VC>::hline_rel(double dx)
|
|||
{
|
||||
double dy = 0;
|
||||
rel_to_abs(&dx, &dy);
|
||||
m_vertices.add_vertex(dx, dy, path_cmd_line_to);
|
||||
vertices_.add_vertex(dx, dy, path_cmd_line_to);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VC>
|
||||
inline void path_adapter<VC>::vline_to(double y)
|
||||
{
|
||||
m_vertices.add_vertex(last_x(), y, path_cmd_line_to);
|
||||
vertices_.add_vertex(last_x(), y, path_cmd_line_to);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -352,7 +351,7 @@ inline void path_adapter<VC>::vline_rel(double dy)
|
|||
{
|
||||
double dx = 0;
|
||||
rel_to_abs(&dx, &dy);
|
||||
m_vertices.add_vertex(dx, dy, path_cmd_line_to);
|
||||
vertices_.add_vertex(dx, dy, path_cmd_line_to);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -363,12 +362,12 @@ void path_adapter<VC>::arc_to(double rx, double ry,
|
|||
bool sweep_flag,
|
||||
double x, double y)
|
||||
{
|
||||
if(m_vertices.total_vertices() && is_vertex(m_vertices.last_command()))
|
||||
if(vertices_.total_vertices() && is_vertex(vertices_.last_command()))
|
||||
{
|
||||
const double epsilon = 1e-30;
|
||||
double x0 = 0.0;
|
||||
double y0 = 0.0;
|
||||
m_vertices.last_vertex(&x0, &y0);
|
||||
vertices_.last_vertex(&x0, &y0);
|
||||
|
||||
rx = fabs(rx);
|
||||
ry = fabs(ry);
|
||||
|
@ -420,8 +419,8 @@ template<class VC>
|
|||
void path_adapter<VC>::curve3(double x_ctrl, double y_ctrl,
|
||||
double x_to, double y_to)
|
||||
{
|
||||
m_vertices.add_vertex(x_ctrl, y_ctrl, path_cmd_curve3);
|
||||
m_vertices.add_vertex(x_to, y_to, path_cmd_curve3);
|
||||
vertices_.add_vertex(x_ctrl, y_ctrl, path_cmd_curve3);
|
||||
vertices_.add_vertex(x_to, y_to, path_cmd_curve3);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -431,8 +430,8 @@ void path_adapter<VC>::curve3_rel(double dx_ctrl, double dy_ctrl,
|
|||
{
|
||||
rel_to_abs(&dx_ctrl, &dy_ctrl);
|
||||
rel_to_abs(&dx_to, &dy_to);
|
||||
m_vertices.add_vertex(dx_ctrl, dy_ctrl, path_cmd_curve3);
|
||||
m_vertices.add_vertex(dx_to, dy_to, path_cmd_curve3);
|
||||
vertices_.add_vertex(dx_ctrl, dy_ctrl, path_cmd_curve3);
|
||||
vertices_.add_vertex(dx_to, dy_to, path_cmd_curve3);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -441,11 +440,11 @@ void path_adapter<VC>::curve3(double x_to, double y_to)
|
|||
{
|
||||
double x0;
|
||||
double y0;
|
||||
if(is_vertex(m_vertices.last_vertex(&x0, &y0)))
|
||||
if(is_vertex(vertices_.last_vertex(&x0, &y0)))
|
||||
{
|
||||
double x_ctrl;
|
||||
double y_ctrl;
|
||||
unsigned cmd = m_vertices.prev_vertex(&x_ctrl, &y_ctrl);
|
||||
unsigned cmd = vertices_.prev_vertex(&x_ctrl, &y_ctrl);
|
||||
if(is_curve(cmd))
|
||||
{
|
||||
x_ctrl = x0 + x0 - x_ctrl;
|
||||
|
@ -474,9 +473,9 @@ void path_adapter<VC>::curve4(double x_ctrl1, double y_ctrl1,
|
|||
double x_ctrl2, double y_ctrl2,
|
||||
double x_to, double y_to)
|
||||
{
|
||||
m_vertices.add_vertex(x_ctrl1, y_ctrl1, path_cmd_curve4);
|
||||
m_vertices.add_vertex(x_ctrl2, y_ctrl2, path_cmd_curve4);
|
||||
m_vertices.add_vertex(x_to, y_to, path_cmd_curve4);
|
||||
vertices_.add_vertex(x_ctrl1, y_ctrl1, path_cmd_curve4);
|
||||
vertices_.add_vertex(x_ctrl2, y_ctrl2, path_cmd_curve4);
|
||||
vertices_.add_vertex(x_to, y_to, path_cmd_curve4);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -488,9 +487,9 @@ void path_adapter<VC>::curve4_rel(double dx_ctrl1, double dy_ctrl1,
|
|||
rel_to_abs(&dx_ctrl1, &dy_ctrl1);
|
||||
rel_to_abs(&dx_ctrl2, &dy_ctrl2);
|
||||
rel_to_abs(&dx_to, &dy_to);
|
||||
m_vertices.add_vertex(dx_ctrl1, dy_ctrl1, path_cmd_curve4);
|
||||
m_vertices.add_vertex(dx_ctrl2, dy_ctrl2, path_cmd_curve4);
|
||||
m_vertices.add_vertex(dx_to, dy_to, path_cmd_curve4);
|
||||
vertices_.add_vertex(dx_ctrl1, dy_ctrl1, path_cmd_curve4);
|
||||
vertices_.add_vertex(dx_ctrl2, dy_ctrl2, path_cmd_curve4);
|
||||
vertices_.add_vertex(dx_to, dy_to, path_cmd_curve4);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -533,9 +532,9 @@ void path_adapter<VC>::curve4_rel(double dx_ctrl2, double dy_ctrl2,
|
|||
template<class VC>
|
||||
inline void path_adapter<VC>::end_poly(unsigned flags)
|
||||
{
|
||||
if(is_vertex(m_vertices.last_command()))
|
||||
if(is_vertex(vertices_.last_command()))
|
||||
{
|
||||
m_vertices.add_vertex(0.0, 0.0, path_cmd_end_poly | flags);
|
||||
vertices_.add_vertex(start_x_, start_y_, path_cmd_end_poly | flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -550,85 +549,85 @@ inline void path_adapter<VC>::close_polygon(unsigned flags)
|
|||
template<class VC>
|
||||
inline unsigned path_adapter<VC>::total_vertices() const
|
||||
{
|
||||
return m_vertices.total_vertices();
|
||||
return vertices_.total_vertices();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VC>
|
||||
inline unsigned path_adapter<VC>::last_vertex(double* x, double* y) const
|
||||
{
|
||||
return m_vertices.last_vertex(x, y);
|
||||
return vertices_.last_vertex(x, y);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VC>
|
||||
inline unsigned path_adapter<VC>::prev_vertex(double* x, double* y) const
|
||||
{
|
||||
return m_vertices.prev_vertex(x, y);
|
||||
return vertices_.prev_vertex(x, y);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VC>
|
||||
inline double path_adapter<VC>::last_x() const
|
||||
{
|
||||
return m_vertices.last_x();
|
||||
return vertices_.last_x();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VC>
|
||||
inline double path_adapter<VC>::last_y() const
|
||||
{
|
||||
return m_vertices.last_y();
|
||||
return vertices_.last_y();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VC>
|
||||
inline unsigned path_adapter<VC>::vertex(unsigned idx, double* x, double* y) const
|
||||
{
|
||||
return m_vertices.vertex(idx, x, y);
|
||||
return vertices_.vertex(idx, x, y);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VC>
|
||||
inline unsigned path_adapter<VC>::command(unsigned idx) const
|
||||
{
|
||||
return m_vertices.command(idx);
|
||||
return vertices_.command(idx);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VC>
|
||||
void path_adapter<VC>::modify_vertex(unsigned idx, double x, double y)
|
||||
{
|
||||
m_vertices.modify_vertex(idx, x, y);
|
||||
vertices_.modify_vertex(idx, x, y);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VC>
|
||||
void path_adapter<VC>::modify_vertex(unsigned idx, double x, double y, unsigned cmd)
|
||||
{
|
||||
m_vertices.modify_vertex(idx, x, y, cmd);
|
||||
vertices_.modify_vertex(idx, x, y, cmd);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VC>
|
||||
void path_adapter<VC>::modify_command(unsigned idx, unsigned cmd)
|
||||
{
|
||||
m_vertices.modify_command(idx, cmd);
|
||||
vertices_.modify_command(idx, cmd);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VC>
|
||||
inline void path_adapter<VC>::rewind(unsigned path_id)
|
||||
{
|
||||
m_iterator = path_id;
|
||||
iterator_ = path_id;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
template<class VC>
|
||||
inline unsigned path_adapter<VC>::vertex(double* x, double* y)
|
||||
{
|
||||
if(m_iterator >= m_vertices.total_vertices()) return path_cmd_stop;
|
||||
return m_vertices.vertex(m_iterator++, x, y);
|
||||
if(iterator_ >= vertices_.total_vertices()) return path_cmd_stop;
|
||||
return vertices_.vertex(iterator_++, x, y);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -644,8 +643,8 @@ unsigned path_adapter<VC>::perceive_polygon_orientation(unsigned start,
|
|||
for(i = 0; i < np; i++)
|
||||
{
|
||||
double x1, y1, x2, y2;
|
||||
m_vertices.vertex(start + i, &x1, &y1);
|
||||
m_vertices.vertex(start + (i + 1) % np, &x2, &y2);
|
||||
vertices_.vertex(start + i, &x1, &y1);
|
||||
vertices_.vertex(start + (i + 1) % np, &x2, &y2);
|
||||
area += x1 * y2 - y1 * x2;
|
||||
}
|
||||
return (area < 0.0) ? path_flags_cw : path_flags_ccw;
|
||||
|
@ -656,23 +655,23 @@ template<class VC>
|
|||
void path_adapter<VC>::invert_polygon(unsigned start, unsigned end)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned tmp_cmd = m_vertices.command(start);
|
||||
unsigned tmp_cmd = vertices_.command(start);
|
||||
|
||||
--end; // Make "end" inclusive
|
||||
|
||||
// Shift all commands to one position
|
||||
for(i = start; i < end; i++)
|
||||
{
|
||||
m_vertices.modify_command(i, m_vertices.command(i + 1));
|
||||
vertices_.modify_command(i, vertices_.command(i + 1));
|
||||
}
|
||||
|
||||
// Assign starting command to the ending command
|
||||
m_vertices.modify_command(end, tmp_cmd);
|
||||
vertices_.modify_command(end, tmp_cmd);
|
||||
|
||||
// Reverse the polygon
|
||||
while(end > start)
|
||||
{
|
||||
m_vertices.swap_vertices(start++, end--);
|
||||
vertices_.swap_vertices(start++, end--);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -681,18 +680,18 @@ template<class VC>
|
|||
void path_adapter<VC>::invert_polygon(unsigned start)
|
||||
{
|
||||
// Skip all non-vertices at the beginning
|
||||
while(start < m_vertices.total_vertices() &&
|
||||
!is_vertex(m_vertices.command(start))) ++start;
|
||||
while(start < vertices_.total_vertices() &&
|
||||
!is_vertex(vertices_.command(start))) ++start;
|
||||
|
||||
// Skip all insignificant move_to
|
||||
while(start+1 < m_vertices.total_vertices() &&
|
||||
is_move_to(m_vertices.command(start)) &&
|
||||
is_move_to(m_vertices.command(start+1))) ++start;
|
||||
while(start+1 < vertices_.total_vertices() &&
|
||||
is_move_to(vertices_.command(start)) &&
|
||||
is_move_to(vertices_.command(start+1))) ++start;
|
||||
|
||||
// Find the last vertex
|
||||
unsigned end = start + 1;
|
||||
while(end < m_vertices.total_vertices() &&
|
||||
!is_next_poly(m_vertices.command(end))) ++end;
|
||||
while(end < vertices_.total_vertices() &&
|
||||
!is_next_poly(vertices_.command(end))) ++end;
|
||||
|
||||
invert_polygon(start, end);
|
||||
}
|
||||
|
@ -705,18 +704,18 @@ unsigned path_adapter<VC>::arrange_polygon_orientation(unsigned start,
|
|||
if(orientation == path_flags_none) return start;
|
||||
|
||||
// Skip all non-vertices at the beginning
|
||||
while(start < m_vertices.total_vertices() &&
|
||||
!is_vertex(m_vertices.command(start))) ++start;
|
||||
while(start < vertices_.total_vertices() &&
|
||||
!is_vertex(vertices_.command(start))) ++start;
|
||||
|
||||
// Skip all insignificant move_to
|
||||
while(start+1 < m_vertices.total_vertices() &&
|
||||
is_move_to(m_vertices.command(start)) &&
|
||||
is_move_to(m_vertices.command(start+1))) ++start;
|
||||
while(start+1 < vertices_.total_vertices() &&
|
||||
is_move_to(vertices_.command(start)) &&
|
||||
is_move_to(vertices_.command(start+1))) ++start;
|
||||
|
||||
// Find the last vertex
|
||||
unsigned end = start + 1;
|
||||
while(end < m_vertices.total_vertices() &&
|
||||
!is_next_poly(m_vertices.command(end))) ++end;
|
||||
while(end < vertices_.total_vertices() &&
|
||||
!is_next_poly(vertices_.command(end))) ++end;
|
||||
|
||||
if(end - start > 2)
|
||||
{
|
||||
|
@ -725,10 +724,10 @@ unsigned path_adapter<VC>::arrange_polygon_orientation(unsigned start,
|
|||
// Invert polygon, set orientation flag, and skip all end_poly
|
||||
invert_polygon(start, end);
|
||||
unsigned cmd;
|
||||
while(end < m_vertices.total_vertices() &&
|
||||
is_end_poly(cmd = m_vertices.command(end)))
|
||||
while(end < vertices_.total_vertices() &&
|
||||
is_end_poly(cmd = vertices_.command(end)))
|
||||
{
|
||||
m_vertices.modify_command(end++, set_orientation(cmd, orientation));
|
||||
vertices_.modify_command(end++, set_orientation(cmd, orientation));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -742,10 +741,10 @@ unsigned path_adapter<VC>::arrange_orientations(unsigned start,
|
|||
{
|
||||
if(orientation != path_flags_none)
|
||||
{
|
||||
while(start < m_vertices.total_vertices())
|
||||
while(start < vertices_.total_vertices())
|
||||
{
|
||||
start = arrange_polygon_orientation(start, orientation);
|
||||
if(is_stop(m_vertices.command(start)))
|
||||
if(is_stop(vertices_.command(start)))
|
||||
{
|
||||
++start;
|
||||
break;
|
||||
|
@ -762,7 +761,7 @@ void path_adapter<VC>::arrange_orientations_all_paths(path_flags_e orientation)
|
|||
if(orientation != path_flags_none)
|
||||
{
|
||||
unsigned start = 0;
|
||||
while(start < m_vertices.total_vertices())
|
||||
while(start < vertices_.total_vertices())
|
||||
{
|
||||
start = arrange_orientations(start, orientation);
|
||||
}
|
||||
|
@ -775,12 +774,12 @@ void path_adapter<VC>::flip_x(double x1, double x2)
|
|||
{
|
||||
unsigned i;
|
||||
double x, y;
|
||||
for(i = 0; i < m_vertices.total_vertices(); i++)
|
||||
for(i = 0; i < vertices_.total_vertices(); i++)
|
||||
{
|
||||
unsigned cmd = m_vertices.vertex(i, &x, &y);
|
||||
unsigned cmd = vertices_.vertex(i, &x, &y);
|
||||
if(is_vertex(cmd))
|
||||
{
|
||||
m_vertices.modify_vertex(i, x2 - x + x1, y);
|
||||
vertices_.modify_vertex(i, x2 - x + x1, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -791,12 +790,12 @@ void path_adapter<VC>::flip_y(double y1, double y2)
|
|||
{
|
||||
unsigned i;
|
||||
double x, y;
|
||||
for(i = 0; i < m_vertices.total_vertices(); i++)
|
||||
for(i = 0; i < vertices_.total_vertices(); i++)
|
||||
{
|
||||
unsigned cmd = m_vertices.vertex(i, &x, &y);
|
||||
unsigned cmd = vertices_.vertex(i, &x, &y);
|
||||
if(is_vertex(cmd))
|
||||
{
|
||||
m_vertices.modify_vertex(i, x, y2 - y + y1);
|
||||
vertices_.modify_vertex(i, x, y2 - y + y1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -805,17 +804,17 @@ void path_adapter<VC>::flip_y(double y1, double y2)
|
|||
template<class VC>
|
||||
void path_adapter<VC>::translate(double dx, double dy, unsigned path_id)
|
||||
{
|
||||
unsigned num_ver = m_vertices.total_vertices();
|
||||
unsigned num_ver = vertices_.total_vertices();
|
||||
for(; path_id < num_ver; path_id++)
|
||||
{
|
||||
double x, y;
|
||||
unsigned cmd = m_vertices.vertex(path_id, &x, &y);
|
||||
unsigned cmd = vertices_.vertex(path_id, &x, &y);
|
||||
if(is_stop(cmd)) break;
|
||||
if(is_vertex(cmd))
|
||||
{
|
||||
x += dx;
|
||||
y += dy;
|
||||
m_vertices.modify_vertex(path_id, x, y);
|
||||
vertices_.modify_vertex(path_id, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -825,15 +824,15 @@ template<class VC>
|
|||
void path_adapter<VC>::translate_all_paths(double dx, double dy)
|
||||
{
|
||||
unsigned idx;
|
||||
unsigned num_ver = m_vertices.total_vertices();
|
||||
unsigned num_ver = vertices_.total_vertices();
|
||||
for(idx = 0; idx < num_ver; idx++)
|
||||
{
|
||||
double x, y;
|
||||
if(is_vertex(m_vertices.vertex(idx, &x, &y)))
|
||||
if(is_vertex(vertices_.vertex(idx, &x, &y)))
|
||||
{
|
||||
x += dx;
|
||||
y += dy;
|
||||
m_vertices.modify_vertex(idx, x, y);
|
||||
vertices_.modify_vertex(idx, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -847,25 +846,25 @@ public:
|
|||
typedef typename vertex_type::value_type value_type;
|
||||
|
||||
explicit vertex_stl_adapter(Container & vertices)
|
||||
: m_vertices(vertices) {}
|
||||
: vertices_(vertices) {}
|
||||
|
||||
void add_vertex(double x, double y, unsigned cmd)
|
||||
{
|
||||
m_vertices.push_back(vertex_type(value_type(x),
|
||||
vertices_.push_back(vertex_type(value_type(x),
|
||||
value_type(y),
|
||||
int8u(cmd)));
|
||||
}
|
||||
|
||||
void modify_vertex(unsigned idx, double x, double y)
|
||||
{
|
||||
vertex_type& v = m_vertices[idx];
|
||||
vertex_type& v = vertices_[idx];
|
||||
v.x = value_type(x);
|
||||
v.y = value_type(y);
|
||||
}
|
||||
|
||||
void modify_vertex(unsigned idx, double x, double y, unsigned cmd)
|
||||
{
|
||||
vertex_type& v = m_vertices[idx];
|
||||
vertex_type& v = vertices_[idx];
|
||||
v.x = value_type(x);
|
||||
v.y = value_type(y);
|
||||
v.cmd = int8u(cmd);
|
||||
|
@ -873,61 +872,61 @@ public:
|
|||
|
||||
void modify_command(unsigned idx, unsigned cmd)
|
||||
{
|
||||
m_vertices[idx].cmd = int8u(cmd);
|
||||
vertices_[idx].cmd = int8u(cmd);
|
||||
}
|
||||
|
||||
void swap_vertices(unsigned v1, unsigned v2)
|
||||
{
|
||||
vertex_type t = m_vertices[v1];
|
||||
m_vertices[v1] = m_vertices[v2];
|
||||
m_vertices[v2] = t;
|
||||
vertex_type t = vertices_[v1];
|
||||
vertices_[v1] = vertices_[v2];
|
||||
vertices_[v2] = t;
|
||||
}
|
||||
|
||||
unsigned last_command() const
|
||||
{
|
||||
return m_vertices.size() ?
|
||||
m_vertices[m_vertices.size() - 1].cmd :
|
||||
return vertices_.size() ?
|
||||
vertices_[vertices_.size() - 1].cmd :
|
||||
(unsigned)path_cmd_stop;
|
||||
}
|
||||
|
||||
unsigned last_vertex(double* x, double* y) const
|
||||
{
|
||||
if(m_vertices.size() == 0)
|
||||
if(vertices_.size() == 0)
|
||||
{
|
||||
*x = *y = 0.0;
|
||||
return path_cmd_stop;
|
||||
}
|
||||
return vertex(m_vertices.size() - 1, x, y);
|
||||
return vertex(vertices_.size() - 1, x, y);
|
||||
}
|
||||
|
||||
unsigned prev_vertex(double* x, double* y) const
|
||||
{
|
||||
if(m_vertices.size() < 2)
|
||||
if(vertices_.size() < 2)
|
||||
{
|
||||
*x = *y = 0.0;
|
||||
return path_cmd_stop;
|
||||
}
|
||||
return vertex(m_vertices.size() - 2, x, y);
|
||||
return vertex(vertices_.size() - 2, x, y);
|
||||
}
|
||||
|
||||
double last_x() const
|
||||
{
|
||||
return m_vertices.size() ? m_vertices[m_vertices.size() - 1].x : 0.0;
|
||||
return vertices_.size() ? vertices_[vertices_.size() - 1].x : 0.0;
|
||||
}
|
||||
|
||||
double last_y() const
|
||||
{
|
||||
return m_vertices.size() ? m_vertices[m_vertices.size() - 1].y : 0.0;
|
||||
return vertices_.size() ? vertices_[vertices_.size() - 1].y : 0.0;
|
||||
}
|
||||
|
||||
unsigned total_vertices() const
|
||||
{
|
||||
return m_vertices.size();
|
||||
return vertices_.size();
|
||||
}
|
||||
|
||||
unsigned vertex(unsigned idx, double* x, double* y) const
|
||||
{
|
||||
const vertex_type& v = m_vertices[idx];
|
||||
const vertex_type& v = vertices_[idx];
|
||||
*x = v.x;
|
||||
*y = v.y;
|
||||
return v.cmd;
|
||||
|
@ -935,11 +934,11 @@ public:
|
|||
|
||||
unsigned command(unsigned idx) const
|
||||
{
|
||||
return m_vertices[idx].cmd;
|
||||
return vertices_[idx].cmd;
|
||||
}
|
||||
|
||||
private:
|
||||
Container & m_vertices;
|
||||
Container & vertices_;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -314,7 +314,7 @@ public:
|
|||
{
|
||||
// not-supported
|
||||
#ifdef MAPNIK_DEBUG
|
||||
MAPNIK_LOG_WARN(save_map) << typeid(sym).name() << " is not supported" << std::endl;
|
||||
MAPNIK_LOG_WARN(save_map) << typeid(sym).name() << " is not supported";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue