minor syntax cleanups to markers placement - no functional change
This commit is contained in:
parent
eb8b2552ef
commit
038159385b
1 changed files with 15 additions and 13 deletions
|
@ -74,12 +74,12 @@ public:
|
|||
allow_overlap_(allow_overlap),
|
||||
marker_width_((size_ * tr_).width()),
|
||||
done_(false),
|
||||
last_x(.0),
|
||||
last_y(.0),
|
||||
next_x(.0),
|
||||
next_y(.0),
|
||||
error_(.0),
|
||||
spacing_left_(.0),
|
||||
last_x(0.0),
|
||||
last_y(0.0),
|
||||
next_x(0.0),
|
||||
next_y(0.0),
|
||||
error_(0.0),
|
||||
spacing_left_(0.0),
|
||||
marker_nr_(0)
|
||||
{
|
||||
if (spacing >= 0)
|
||||
|
@ -104,7 +104,7 @@ public:
|
|||
done_ = agg::is_stop(locator_.vertex(&next_x, &next_y));
|
||||
last_x = next_x;
|
||||
last_y = next_y; // Force request of new segment
|
||||
error_ = 0;
|
||||
error_ = 0.0;
|
||||
marker_nr_ = 0;
|
||||
}
|
||||
|
||||
|
@ -133,9 +133,10 @@ public:
|
|||
error = 0: Perfect position.
|
||||
error < 0: Marker too near to the beginning of the path.
|
||||
*/
|
||||
if (marker_nr_++ == 0)
|
||||
if (marker_nr_ == 0)
|
||||
{
|
||||
//First marker
|
||||
marker_nr_++;
|
||||
spacing_left_ = spacing_ / 2;
|
||||
}
|
||||
else
|
||||
|
@ -143,7 +144,8 @@ public:
|
|||
spacing_left_ = spacing_;
|
||||
}
|
||||
spacing_left_ -= error_;
|
||||
error_ = 0;
|
||||
error_ = 0.0;
|
||||
double max_err_allowed = max_error_ * spacing_;
|
||||
//Loop exits when a position is found or when no more segments are available
|
||||
while (true)
|
||||
{
|
||||
|
@ -153,15 +155,15 @@ public:
|
|||
set_spacing_left(marker_width_/2); //Only moves forward
|
||||
}
|
||||
//Error for this marker is too large. Skip to the next position.
|
||||
if (abs(error_) > max_error_ * spacing_)
|
||||
if (abs(error_) > max_err_allowed)
|
||||
{
|
||||
if (error_ > spacing_)
|
||||
{
|
||||
error_ = 0; //Avoid moving backwards
|
||||
MAPNIK_LOG_WARN(markers_placement) << "Extremely large error in markers_placement. Please file a bug report.";
|
||||
MAPNIK_LOG_WARN(markers_placement) << "Extremely large error (" << error_ << ") in markers_placement. Please file a bug report.";
|
||||
error_ = 0.0; //Avoid moving backwards
|
||||
}
|
||||
spacing_left_ += spacing_ - error_;
|
||||
error_ = 0;
|
||||
error_ = 0.0;
|
||||
}
|
||||
double dx = next_x - last_x;
|
||||
double dy = next_y - last_y;
|
||||
|
|
Loading…
Reference in a new issue