1
0
mirror of git://projects.qi-hardware.com/nanomap.git synced 2025-04-21 12:27:27 +03:00

add monav plugins from http://code.google.com/p/monav/ and use them to calculate routes

This commit is contained in:
Niels
2010-11-03 21:39:06 +01:00
parent 2d6e62a111
commit e18428cb23
38 changed files with 4889 additions and 57 deletions

View File

@@ -0,0 +1,50 @@
/*
Copyright 2010 Christian Vetter veaac.fdirct@gmail.com
This file is part of MoNav.
MoNav is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
MoNav is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with MoNav. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IADDRESSLOOKUP_H
#define IADDRESSLOOKUP_H
#include "utils/coordinates.h"
#include <QtPlugin>
#include <QVector>
class IAddressLookup
{
public:
virtual ~IAddressLookup() {}
virtual QString GetName() = 0;
virtual void SetInputDirectory( const QString& dir ) = 0;
virtual void ShowSettings() = 0;
virtual bool LoadData() = 0;
// for a given user input's prefix get a list of place name suggestions as well as partial input suggestions
virtual bool GetPlaceSuggestions( const QString& input, int amount, QStringList* suggestions, QStringList* inputSuggestions ) = 0;
// for a given user input's prefix get a list of street name suggestions as well as partial input suggestions
virtual bool GetStreetSuggestions( const QString& input, int amount, QStringList* suggestions, QStringList* inputSuggestions ) = 0;
// for a given place name get a list of places and their coordinates
virtual bool GetPlaceData( QString input, QVector< int >* placeIDs, QVector< UnsignedCoordinate >* placeCoordinates ) = 0;
// selects a place by it's id
virtual bool SelectPlace( int placeID ) = 0;
// uses the selected place to provide street name suggestions and partial input suggestions
virtual bool GetStreetData( QString input, QVector< int >* segmentLength, QVector< UnsignedCoordinate >* coordinates ) = 0;
};
Q_DECLARE_INTERFACE( IAddressLookup, "monav.IAddressLookup/1.1" )
#endif // IADDRESSLOOKUP_H

View File

@@ -0,0 +1,60 @@
/*
Copyright 2010 Christian Vetter veaac.fdirct@gmail.com
This file is part of MoNav.
MoNav is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
MoNav is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with MoNav. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IGPSLOOKUP_H
#define IGPSLOOKUP_H
#include "utils/config.h"
#include "utils/coordinates.h"
#include <QtPlugin>
#include <QVector>
class IGPSLookup
{
public:
struct Result {
// source + target + edgeID uniquely identify an edge
NodeID source;
NodeID target;
unsigned edgeID;
// the nearest point on the edge
UnsignedCoordinate nearestPoint;
// the amount of way coordinates on the way before the nearest point
unsigned previousWayCoordinates;
// the position on the way
double percentage;
// the distance to the nearest point
double distance;
};
virtual ~IGPSLookup() {}
virtual QString GetName() = 0;
virtual void SetInputDirectory( const QString& dir ) = 0;
virtual void ShowSettings() = 0;
virtual bool LoadData() = 0;
// gets the nearest routing edge; a heading penalty can be applied if the way's orientation differs greatly from the current heading.
virtual bool GetNearestEdge( Result* result, const UnsignedCoordinate& coordinate, double radius, bool headingPenalty = 0, double heading = 0 ) = 0;
};
Q_DECLARE_INTERFACE( IGPSLookup, "monav.IGPSLookup/1.1" )
#endif // IGPSLOOKUP_H

View File

@@ -0,0 +1,80 @@
/*
Copyright 2010 Christian Vetter veaac.fdirct@gmail.com
This file is part of MoNav.
MoNav is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
MoNav is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with MoNav. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IROUTER_H
#define IROUTER_H
#include "utils/config.h"
#include "utils/coordinates.h"
#include "interfaces/igpslookup.h"
#include <QtPlugin>
#include <QVector>
class IRouter
{
public:
struct Node {
Node(){}
Node( UnsignedCoordinate coord )
{
coordinate = coord;
}
UnsignedCoordinate coordinate;
};
struct Edge {
Edge(){}
Edge( unsigned name_, bool branchingPossible_, unsigned char type_, unsigned short length_, unsigned seconds_ )
{
name = name_;
branchingPossible = branchingPossible_;
type = type_;
length = length_;
seconds = seconds_;
}
unsigned name : 30; // name ID of the edge
bool branchingPossible : 1; // is there more than one subsequent edge to traverse ( turing around and traversing this edge in the opposite direction does not count )
unsigned char type; // type ID of the edge
unsigned short length; // the amount of path nodes - 1 == amount of edges
unsigned seconds;
};
virtual ~IRouter() {}
virtual QString GetName() = 0;
virtual void SetInputDirectory( const QString& dir ) = 0;
virtual void ShowSettings() = 0;
virtual bool LoadData() = 0;
// computes the route between source and target and returns the distance in second
virtual bool GetRoute( double* distance, QVector< Node>* pathNodes, QVector< Edge >* pathEdges, const IGPSLookup::Result& source, const IGPSLookup::Result& target ) = 0;
// translate a name ID into the corresponding string
virtual bool GetName( QString* result, unsigned name ) = 0;
// translate a list of name IDs into the corresponding strings
virtual bool GetNames( QVector< QString >* result, QVector< unsigned > names ) = 0;
// translate a type ID into the corresponding description
virtual bool GetType( QString* result, unsigned type ) = 0;
// translate a list of type IDs into the corresponding descriptions
virtual bool GetTypes( QVector< QString >* result, QVector< unsigned > types ) = 0;
};
Q_DECLARE_INTERFACE( IRouter, "monav.IRouter/1.1" )
#endif // IROUTER_H