Revert "use more osrm::irange"

This reverts commit d6c6fbfe03.
This commit is contained in:
Dennis Luxen
2014-08-20 15:47:48 +02:00
parent d6c6fbfe03
commit 05b939760c
5 changed files with 74 additions and 87 deletions
+10 -14
View File
@@ -31,7 +31,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../Algorithms/DouglasPeucker.h"
#include "../Algorithms/PolylineCompressor.h"
#include "../DataStructures/PhantomNodes.h"
#include "../DataStructures/Range.h"
#include "../DataStructures/SegmentInformation.h"
#include "../DataStructures/TurnInstructions.h"
#include "../typedefs.h"
@@ -94,7 +93,7 @@ class DescriptionFactory
/** starts at index 1 */
path_description[0].length = 0;
for (const auto i : osrm::irange<std::size_t>(1, path_description.size()))
for (unsigned i = 1; i < path_description.size(); ++i)
{
// move down names by one, q&d hack
path_description[i - 1].name_id = path_description[i].name_id;
@@ -149,7 +148,7 @@ class DescriptionFactory
unsigned segment_duration = 0;
unsigned segment_start_index = 0;
for (const auto i : osrm::irange<std::size_t>(1, path_description.size()))
for (unsigned i = 1; i < path_description.size(); ++i)
{
entireLength += path_description[i].length;
segment_length += path_description[i].length;
@@ -193,20 +192,17 @@ class DescriptionFactory
// fix what needs to be fixed else
unsigned necessary_pieces = 0; // a running index that counts the necessary pieces
if (path_description.size() >= 2)
for (unsigned i = 0; i < path_description.size() - 1 && path_description.size() >= 2; ++i)
{
for (const auto i : osrm::irange<std::size_t>(0, path_description.size() - 1))
if (path_description[i].necessary)
{
if (path_description[i].necessary)
{
++necessary_pieces;
if (path_description[i].is_via_location)
{ //mark the end of a leg
via_indices.push_back(necessary_pieces);
}
const double angle = path_description[i+1].location.GetBearing(path_description[i].location);
path_description[i].bearing = static_cast<unsigned>(angle * 10);
++necessary_pieces;
if (path_description[i].is_via_location)
{ //mark the end of a leg
via_indices.push_back(necessary_pieces);
}
const double angle = path_description[i+1].location.GetBearing(path_description[i].location);
path_description[i].bearing = static_cast<unsigned>(angle * 10);
}
}
via_indices.push_back(necessary_pieces+1);