Fixes a translation bug
This commit is contained in:
		
							parent
							
								
									1f7ddc865f
								
							
						
					
					
						commit
						4f78634994
					
				| @ -256,7 +256,7 @@ public: | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| //		std::cout << "[debug] " << candidates.size() << " start candidates" << std::endl;
 |         //		std::cout << "[debug] " << candidates.size() << " start candidates" << std::endl;
 | ||||||
|         _Coordinate tmp; |         _Coordinate tmp; | ||||||
|         double dist = numeric_limits<double>::max(); |         double dist = numeric_limits<double>::max(); | ||||||
|         timestamp = get_timestamp(); |         timestamp = get_timestamp(); | ||||||
| @ -264,7 +264,7 @@ public: | |||||||
|             double r = 0.; |             double r = 0.; | ||||||
|             double tmpDist = ComputeDistance(startCoord, it->startCoord, it->targetCoord, tmp, &r); |             double tmpDist = ComputeDistance(startCoord, it->startCoord, it->targetCoord, tmp, &r); | ||||||
|             if(tmpDist < dist) { |             if(tmpDist < dist) { | ||||||
| //			    std::cout << "[debug] start distance " << (it - candidates.begin()) << " " << tmpDist << std::endl;
 |                 //			    std::cout << "[debug] start distance " << (it - candidates.begin()) << " " << tmpDist << std::endl;
 | ||||||
|                 routingStarts->startNode1 = it->start; |                 routingStarts->startNode1 = it->start; | ||||||
|                 routingStarts->startNode2 = it->target; |                 routingStarts->startNode2 = it->target; | ||||||
|                 routingStarts->startRatio = r; |                 routingStarts->startRatio = r; | ||||||
| @ -283,7 +283,7 @@ public: | |||||||
|                 GetContentsOfFileBucket(fileIndex+i+j, candidates); |                 GetContentsOfFileBucket(fileIndex+i+j, candidates); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| //        std::cout << "[debug] " << candidates.size() << " target candidates" << std::endl;
 |         //        std::cout << "[debug] " << candidates.size() << " target candidates" << std::endl;
 | ||||||
|         dist = numeric_limits<double>::max(); |         dist = numeric_limits<double>::max(); | ||||||
|         timestamp = get_timestamp(); |         timestamp = get_timestamp(); | ||||||
|         for(std::vector<_Edge>::iterator it = candidates.begin(); it != candidates.end(); it++) |         for(std::vector<_Edge>::iterator it = candidates.begin(); it != candidates.end(); it++) | ||||||
| @ -292,7 +292,7 @@ public: | |||||||
|             double tmpDist = ComputeDistance(targetCoord, it->startCoord, it->targetCoord, tmp, &r); |             double tmpDist = ComputeDistance(targetCoord, it->startCoord, it->targetCoord, tmp, &r); | ||||||
|             if(tmpDist < dist) |             if(tmpDist < dist) | ||||||
|             { |             { | ||||||
| //			    std::cout << "[debug] target distance " << (it - candidates.begin()) << " " << tmpDist << std::endl;
 |                 //			    std::cout << "[debug] target distance " << (it - candidates.begin()) << " " << tmpDist << std::endl;
 | ||||||
|                 routingStarts->targetNode1 = it->start; |                 routingStarts->targetNode1 = it->start; | ||||||
|                 routingStarts->targetNode2 = it->target; |                 routingStarts->targetNode2 = it->target; | ||||||
|                 routingStarts->targetRatio = r; |                 routingStarts->targetRatio = r; | ||||||
| @ -328,7 +328,9 @@ public: | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     void FindNearestPointOnEdge(const _Coordinate& inputCoordinate, _Coordinate& outputCoordinate) { |     void FindNearestPointOnEdge(const _Coordinate& inputCoordinate, _Coordinate& outputCoordinate) { | ||||||
|         unsigned fileIndex = GetFileIndexForLatLon(100000*(lat2y(static_cast<double>(inputCoordinate.lat)/100000.)), inputCoordinate.lon); |         _Coordinate startCoord(100000*(lat2y(static_cast<double>(inputCoordinate.lat)/100000.)), inputCoordinate.lon); | ||||||
|  |         unsigned fileIndex = GetFileIndexForLatLon(startCoord.lat, startCoord.lon); | ||||||
|  | 
 | ||||||
|         std::vector<_Edge> candidates; |         std::vector<_Edge> candidates; | ||||||
|         for(int j = -32768; j < (32768+1); j+=32768) { |         for(int j = -32768; j < (32768+1); j+=32768) { | ||||||
|             for(int i = -1; i < 2; i++) { |             for(int i = -1; i < 2; i++) { | ||||||
| @ -339,7 +341,7 @@ public: | |||||||
|         double dist = numeric_limits<double>::max(); |         double dist = numeric_limits<double>::max(); | ||||||
|         for(std::vector<_Edge>::iterator it = candidates.begin(); it != candidates.end(); it++) { |         for(std::vector<_Edge>::iterator it = candidates.begin(); it != candidates.end(); it++) { | ||||||
|             double r = 0.; |             double r = 0.; | ||||||
|              double tmpDist = ComputeDistance(inputCoordinate, it->startCoord, it->targetCoord, tmp, &r); |             double tmpDist = ComputeDistance(startCoord, it->startCoord, it->targetCoord, tmp, &r); | ||||||
|             if(tmpDist < dist) { |             if(tmpDist < dist) { | ||||||
|                 dist = tmpDist; |                 dist = tmpDist; | ||||||
|                 outputCoordinate.lat = round(100000*(y2lat(static_cast<double>(tmp.lat)/100000.))); |                 outputCoordinate.lat = round(100000*(y2lat(static_cast<double>(tmp.lat)/100000.))); | ||||||
| @ -503,10 +505,10 @@ private: | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     void GetContentsOfFileBucket(const unsigned fileIndex, std::vector<_Edge>& result) { |     void GetContentsOfFileBucket(const unsigned fileIndex, std::vector<_Edge>& result) { | ||||||
| //		unsigned threadID = threadLookup.Find(boost_thread_id_hash(boost::this_thread::get_id()));
 |         //		unsigned threadID = threadLookup.Find(boost_thread_id_hash(boost::this_thread::get_id()));
 | ||||||
|         unsigned ramIndex = GetRAMIndexFromFileIndex(fileIndex); |         unsigned ramIndex = GetRAMIndexFromFileIndex(fileIndex); | ||||||
|         unsigned startIndexInFile = ramIndexTable[ramIndex]; |         unsigned startIndexInFile = ramIndexTable[ramIndex]; | ||||||
| //		ifstream indexInFile( indexFileStreams[threadID]->stream );
 |         //		ifstream indexInFile( indexFileStreams[threadID]->stream );
 | ||||||
|         if(startIndexInFile == UINT_MAX){ |         if(startIndexInFile == UINT_MAX){ | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user