Root/monav/interfaces/irouter.h

1/*
2Copyright 2010 Christian Vetter veaac.fdirct@gmail.com
3
4This file is part of MoNav.
5
6MoNav is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11MoNav is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with MoNav. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef IROUTER_H
21#define IROUTER_H
22
23#include "utils/config.h"
24#include "utils/coordinates.h"
25#include "interfaces/igpslookup.h"
26#include <QtPlugin>
27#include <QVector>
28
29class IRouter
30{
31public:
32
33    struct Node {
34        Node(){}
35        Node( UnsignedCoordinate coord )
36        {
37            coordinate = coord;
38        }
39
40        UnsignedCoordinate coordinate;
41    };
42
43    struct Edge {
44        Edge(){}
45        Edge( unsigned name_, bool branchingPossible_, unsigned char type_, unsigned short length_, unsigned seconds_ )
46        {
47            name = name_;
48            branchingPossible = branchingPossible_;
49            type = type_;
50            length = length_;
51            seconds = seconds_;
52        }
53        unsigned name : 30; // name ID of the edge
54        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 )
55        unsigned char type; // type ID of the edge
56        unsigned short length; // the amount of path nodes - 1 == amount of edges
57        unsigned seconds;
58    };
59
60    virtual ~IRouter() {}
61
62    virtual QString GetName() = 0;
63    virtual void SetInputDirectory( const QString& dir ) = 0;
64    virtual void ShowSettings() = 0;
65    virtual bool LoadData() = 0;
66    // computes the route between source and target and returns the distance in second
67    virtual bool GetRoute( double* distance, QVector< Node>* pathNodes, QVector< Edge >* pathEdges, const IGPSLookup::Result& source, const IGPSLookup::Result& target ) = 0;
68    // translate a name ID into the corresponding string
69    virtual bool GetName( QString* result, unsigned name ) = 0;
70    // translate a list of name IDs into the corresponding strings
71    virtual bool GetNames( QVector< QString >* result, QVector< unsigned > names ) = 0;
72    // translate a type ID into the corresponding description
73    virtual bool GetType( QString* result, unsigned type ) = 0;
74    // translate a list of type IDs into the corresponding descriptions
75    virtual bool GetTypes( QVector< QString >* result, QVector< unsigned > types ) = 0;
76};
77
78Q_DECLARE_INTERFACE( IRouter, "monav.IRouter/1.1" )
79
80#endif // IROUTER_H
81

Archive Download this file

Branches:
master



interactive