| 117 | } |
| 118 | |
| 119 | bool RectCoversPolyline(IRoadGraph::PointWithAltitudeVec const & junctions, m2::RectD const & rect) |
| 120 | { |
| 121 | if (junctions.empty()) |
| 122 | return false; |
| 123 | |
| 124 | if (junctions.size() == 1) |
| 125 | return rect.IsPointInside(junctions.front().GetPoint()); |
| 126 | |
| 127 | for (auto const & junction : junctions) |
| 128 | if (rect.IsPointInside(junction.GetPoint())) |
| 129 | return true; |
| 130 | |
| 131 | // No point of polyline |junctions| lays inside |rect| but may be segments of the polyline |
| 132 | // cross |rect| borders. |
| 133 | for (size_t i = 1; i < junctions.size(); ++i) |
| 134 | { |
| 135 | m2::Segment2D const polylineSegment(junctions[i - 1].GetPoint(), junctions[i].GetPoint()); |
| 136 | if (SegmentCrossesRect(polylineSegment, rect)) |
| 137 | return true; |
| 138 | } |
| 139 | |
| 140 | return false; |
| 141 | } |
| 142 | |
| 143 | bool CheckGraphConnectivity(Segment const & start, bool isOutgoing, bool useRoutingOptions, size_t limit, |
| 144 | WorldGraph & graph, set<Segment> & marked) |