Skip to content

Commit

Permalink
Merge pull request #136 from sebastic/spelling-errors
Browse files Browse the repository at this point in the history
Fix spelling errors.
  • Loading branch information
cvvergara committed Aug 10, 2016
2 parents d8eaf22 + 5b56ff0 commit c2d3fab
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions src/Export2DB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,13 +717,13 @@ void Export2DB::process_section(int64_t count, const std::string &ways_columns)
fill_source_target( "__ways_temp" , addSchema( full_table_name("ways_vertices_pgr") ) );


// std::cout << "Inserting new splitted ways to '" << addSchema( full_table_name("ways") ) << "'\n";
// std::cout << "Inserting new split ways to '" << addSchema( full_table_name("ways") ) << "'\n";
std::string insert_into_ways(
" INSERT INTO " + addSchema( full_table_name("ways") ) +
"( " + ways_columns + ", source, target, length_m, cost_s, reverse_cost_s ) "
" (SELECT " + ways_columns + ", source, target, length_m, cost_s, reverse_cost_s FROM __ways_temp); ");
q_result = PQexec(mycon, insert_into_ways.c_str());
// std::cout << " Inserted " << PQcmdTuples(q_result) << " splitted ways\n";
// std::cout << " Inserted " << PQcmdTuples(q_result) << " split ways\n";
std::cout << " Ways inserted: " << count << "\n";
PQclear(q_result);
dropTable("__ways_temp");
Expand Down
44 changes: 22 additions & 22 deletions src/OSMDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ OSMDocument::~OSMDocument() {
ez_mapdelete(m_Nodes);
ez_vectordelete(m_Ways);
ez_vectordelete(m_Relations);
ez_vectordelete(m_SplittedWays);
ez_vectordelete(m_SplitWays);
}
void OSMDocument::AddNode(Node* n) {
m_Nodes[n->id] = n;
Expand All @@ -63,7 +63,7 @@ void OSMDocument::SplitWays() {
std::vector<Way*>::const_iterator it(m_Ways.begin());
std::vector<Way*>::const_iterator last(m_Ways.end());

// splitted ways get a new ID
// split ways get a new ID
long long id = 0;

while (it != last) {
Expand All @@ -80,14 +80,14 @@ void OSMDocument::SplitWays() {
Node* secondNode = 0;
Node* lastNode = 0;

Way* splitted_way = new Way(++id, currentWay->visible,
Way* split_way = new Way(++id, currentWay->visible,
currentWay->osm_id,
currentWay->maxspeed_forward,
currentWay->maxspeed_backward);
splitted_way->name = currentWay->name;
splitted_way->type = currentWay->type;
splitted_way->clss = currentWay->clss;
splitted_way->oneWayType = currentWay->oneWayType;
split_way->name = currentWay->name;
split_way->type = currentWay->type;
split_way->clss = currentWay->clss;
split_way->oneWayType = currentWay->oneWayType;

std::map<std::string, std::string>::iterator it_tag(currentWay->m_Tags.begin());
std::map<std::string, std::string>::iterator last_tag(currentWay->m_Tags.end());
Expand All @@ -99,49 +99,49 @@ void OSMDocument::SplitWays() {
while (it_tag != last_tag) {
std::pair<std::string, std::string> pair = *it_tag++;

splitted_way->AddTag(pair.first, pair.second);
split_way->AddTag(pair.first, pair.second);
}

// GeometryFromText('LINESTRING('||x1||' '||y1||','||x2||' '||y2||')',4326);

splitted_way->geom = "LINESTRING("+ boost::lexical_cast<std::string>(node->lon) + " " + boost::lexical_cast<std::string>(node->lat) +",";
split_way->geom = "LINESTRING("+ boost::lexical_cast<std::string>(node->lon) + " " + boost::lexical_cast<std::string>(node->lat) +",";

splitted_way->AddNodeRef(node);
split_way->AddNodeRef(node);

bool found = false;

if (it_node != last_node) {
while (it_node != last_node && !found) {
splitted_way->AddNodeRef(*it_node);
split_way->AddNodeRef(*it_node);
if ((*it_node)->numsOfUse > 1) {
found = true;
secondNode = *it_node;
splitted_way->AddNodeRef(secondNode);
split_way->AddNodeRef(secondNode);
double length = getLength(node, secondNode);
if (length < 0)
length*=-1;
splitted_way->length+=length;
splitted_way->geom+= boost::lexical_cast<std::string>(secondNode->lon) + " " + boost::lexical_cast<std::string>(secondNode->lat) + ")";
split_way->length+=length;
split_way->geom+= boost::lexical_cast<std::string>(secondNode->lon) + " " + boost::lexical_cast<std::string>(secondNode->lat) + ")";
} else if (backNode == (*it_node)) {
lastNode =*it_node++;
splitted_way->AddNodeRef(lastNode);
split_way->AddNodeRef(lastNode);
double length = getLength(node, lastNode);
if (length < 0)
length*=-1;
splitted_way->length+=length;
splitted_way->geom+= boost::lexical_cast<std::string>(lastNode->lon) + " " + boost::lexical_cast<std::string>(lastNode->lat) + ")";
split_way->length+=length;
split_way->geom+= boost::lexical_cast<std::string>(lastNode->lon) + " " + boost::lexical_cast<std::string>(lastNode->lat) + ")";
} else {
splitted_way->geom+= boost::lexical_cast<std::string>((*it_node)->lon) + " " + boost::lexical_cast<std::string>((*it_node)->lat) + ",";
split_way->geom+= boost::lexical_cast<std::string>((*it_node)->lon) + " " + boost::lexical_cast<std::string>((*it_node)->lat) + ",";
*it_node++;
}
}
}

if (splitted_way->m_NodeRefs.front() != splitted_way->m_NodeRefs.back()) {
m_SplittedWays.push_back(splitted_way);
if (split_way->m_NodeRefs.front() != split_way->m_NodeRefs.back()) {
m_SplitWays.push_back(split_way);
} else {
delete splitted_way;
splitted_way = 0;
delete split_way;
split_way = 0;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/OSMDocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class OSMDocument {
std::map<long long, Node*> m_Nodes;
//! parsed ways
std::vector<Way*> m_Ways;
//! splitted ways
std::vector<Way*> m_SplittedWays;
//! split ways
std::vector<Way*> m_SplitWays;

std::vector<Relation*> m_Relations;

Expand Down
6 changes: 3 additions & 3 deletions src/osm2pgrouting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ int main(int argc, char* argv[]) {
dbConnection.exportClasses(config->m_Types);
//dbConnection.exportRelations(document->m_Relations, config);
dbConnection.exportRelationsWays(document->m_Relations);
dbConnection.exportTags(document->m_SplittedWays, config);
dbConnection.exportWays(document->m_SplittedWays, config);
dbConnection.exportTags(document->m_SplitWays, config);
dbConnection.exportWays(document->m_SplitWays, config);


std::cout << "Creating topology..." << endl;
Expand All @@ -141,7 +141,7 @@ int main(int argc, char* argv[]) {
std::cout << "#########################" << endl;

std::cout << "size of streets: " << document->m_Ways.size() << endl;
std::cout << "size of splitted ways : " << document->m_SplittedWays.size() << endl;
std::cout << "size of split ways : " << document->m_SplitWays.size() << endl;

clock_t end = clock();
double elapsed_secs = double(end - begin) / static_cast<double>(CLOCKS_PER_SEC);
Expand Down

0 comments on commit c2d3fab

Please sign in to comment.