booldijkstraAlgorithm(constQList<T>elements,intstartIndex,intendIndex,QList<T>&elementPath,std::function<double(constT&,constT&)>distance)// don't seperate parameters with new lines or documentation will break
booldijkstraAlgorithm(constQList<T>&elements,intstartIndex,intendIndex,QList<T>&elementPath,std::function<double(constT&,constT&)>distance)// don't seperate parameters with new lines or documentation will break
{
{
if(elements.isEmpty()||startIndex<0
if(elements.isEmpty()||startIndex<0
||startIndex>=elements.size()||endIndex<0
||startIndex>=elements.size()||endIndex<0
||endIndex>=elements.size()){
||endIndex>=elements.size()){
returnfalse;
returnfalse;
}
}
qWarning("optitools");
// Each element of type T gets stuff into a Node
// Each element of type T gets stuff into a Node
/// @param distance is the distance between the Node and it's predecessor
/// @param distance is the distance between the Node and it's predecessor
* Returns \c true if \a line and \a area intersect with each other at least once.bool WimaArea::intersects(const QGCMapPolyline &line, const WimaArea &area, QList<QGeoCoordinate> &intersectionList, QList<QPair<int, int>> &neighbourList)
* Stores the intersection points in \a intersectionList.
* Stores the indices of the closest two \a area vetices for each of coorespoinding intersection points in \a neighbourList.
*
* For example if an intersection point is found between the first and the second vertex of the \a area the intersection point will
* be stored in \a intersectionList and the indices 1 and 2 will be stored in \a neighbourList.
* \a neighbourList has entries of type \c {QPair<int, int>}, where \c{pair.first} would contain 1 and \c{pair.second} would contain 2, when
* relating to the above example.
*
* \sa QPair, QList
*/
boolWimaArea::intersects(constQGCMapPolyline&line,constWimaArea&area,QList<QGeoCoordinate>&intersectionList,QList<QPair<int,int>>&neighbourList)// don't seperate parameters with new lines or documentation will break
{
intersectionList.clear();
neighbourList.clear();
if(line.count()==2&&area.count()>=3){// are line a proper line and poly a proper poly?other,
// Asseble a line form each tow consecutive polygon vertices and check whether it intersects with line
* Calculates the shortest path (inside \a area) between \a start and \a end.
* The \l {Dijkstra Algorithm} is used to find the shorest path.
* Stores the result inside \a dijkstraPath when sucessfull.
* Stores error messages in \a errorString.
* Returns \c true if successful, \c false else.
*
* \sa QList
*/
boolWimaArea::dijkstraPath(constQGeoCoordinate&start,constQGeoCoordinate&end,constWimaArea&area,QList<QGeoCoordinate>&dijkstraPath,QString&errorString)// don't seperate parameters with new lines or documentation will break
{
if(isSelfIntersecting(area)){
errorString.append("Area is self intersecting and thus not a simple polygon. Only simple polygons allowed.\n");
returnfalse;
}
// Each QGeoCoordinate gets stuff into a Node
/// @param distance is the distance between the Node and it's predecessor