File: PathFinder.h

package info (click to toggle)
tulip 4.8.0dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 179,264 kB
  • ctags: 64,517
  • sloc: cpp: 600,444; ansic: 36,311; makefile: 22,136; python: 1,304; sh: 946; yacc: 522; xml: 337; pascal: 157; php: 66; lex: 55
file content (148 lines) | stat: -rw-r--r-- 4,195 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/**
 *
 * This file is part of Tulip (www.tulip-software.org)
 *
 * Authors: David Auber and the Tulip development Team
 * from LaBRI, University of Bordeaux
 *
 * Tulip is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation, either version 3
 * of the License, or (at your option) any later version.
 *
 * Tulip 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.
 *
 */

#ifndef PATHFINDER_H_
#define PATHFINDER_H_

#include <tulip/GLInteractor.h>

#include "../../utils/StandardInteractorPriority.h"
#include "PathFinding/PathAlgorithm.h"

#define NO_METRIC "None"
#define DEFAULT_ORIENTATION PathAlgorithm::NonOriented
#define DEFAULT_PATHS_TYPE PathAlgorithm::OneShortest
#define DEFAULT_TOLERANCE 100
#define DEFAULT_TOLERANCE_ACTIVATION false

class QPushButton;

namespace tlp {
class PathFinderComponent;
class PathHighlighter;
class PathFinderConfigurationWidget;

class StringsListSelectionWidget;
class BooleanProperty;

/*@{*/
/** \file
*  \brief PathFinder helps you finding paths between nodes in your graph.
*
* This plug-in offers several possibilities to highlight different kinds of paths between two nodes in a graph.
* You can thus display one or several shortest paths between two selected nodes, or you can even extend to non-shortest paths
* with length limitations.
*/
class PathFinder: public tlp::GLInteractorComposite {
  Q_OBJECT
public:

  PLUGININFORMATION("PathFinder", "Tulip Team", "03/24/2010", "Path finding interactor", "1.0", "Information")

  PathFinder(const tlp::PluginContext *);
  virtual ~PathFinder();
  void construct();
  unsigned int priority() const {
    return tlp::StandardInteractorPriority::PathSelection;
  }
  virtual QWidget *configurationWidget() const;

  /**
   * @return The name of the property used to get the weight values over the edges.
   */
  inline std::string getWeightMetricName() const {
    return weightMetric;
  }

  /**
   * @return true if the user chose not to select only one path
   */
  inline bool isSelectAllPaths() const {
    return selectAllPaths;
  }

  /**
   * @return The edge orientation used when computing the path.
   * @see PathAlgorithm::EdgeOrientation
   */
  inline PathAlgorithm::EdgeOrientation getEdgeOrientation() const {
    return edgeOrientation;
  }

  /**
   * @return the type of path the user wants to select.
   * @see PathAlgorithm::PathType
   */
  inline PathAlgorithm::PathType getPathsType() const {
    return pathsTypes;
  }

  /**
   * @return The length tolerance factor when the user doesn't want only the shortest path.
   */
  double getTolerance();

  /**
   * @return The active path highlighters
   */
  std::vector<std::string> getActiveHighlighters();

  /**
   * @return The inactive path highlighters
   */
  std::vector<std::string> getInactiveHighlighters();

  /**
   * @return All the installed path highlighters
   */
  std::vector<std::string> getHighlighters();

  virtual bool isCompatible(const std::string &viewName) const;

public slots:
  void setSelectAllPaths(bool s);
  void setEdgeOrientation(const QString &orientation);
  void setPathsType(const QString &pathType);
  void setWeightMetric(const QString &metric);
  void setTolerance(int i);
  void activateTolerance(bool activated);
  void configureHighlighterButtonPressed();

private:
  PathFinderComponent *getPathFinderComponent();

  std::string weightMetric;
  bool selectAllPaths;
  PathAlgorithm::EdgeOrientation edgeOrientation;
  PathAlgorithm::PathType pathsTypes;
  bool toleranceActivated;
  double tolerance;

  // Used for GUI interaction.
  std::map<PathAlgorithm::EdgeOrientation, std::string> edgeOrientationLabels;
  std::map<PathAlgorithm::PathType, std::string> pathsTypesLabels;

  // GUI elements.
  PathFinderConfigurationWidget *_configurationWidget;
  tlp::StringsListSelectionWidget *highlightersListWidget;
  QPushButton *configureHighlighterBtn;
};

}
#endif /* PATHFINDER_H_ */