Fréchet View  1.6.0
A Tool for Exploring Fréchet Distance Algorithms
frechet::view::ControlPanel Class Reference

Detailed Description

Control Panel.

Contains controls for modifying epsilon, and for running algorithms.

Author
Peter Schäfer

Definition at line 23 of file controlpanel.h.

#include <controlpanel.h>

Inherits QWidget.

Public Slots

void lockInput (bool)
 not used anymore... More...
 
void onEdit ()
 called after the user has edited the value of epsilon. Triggers epsilonChanged(), which in turn triggers a number of update operations. More...
 
void onSlider (int value)
 called when the user moves the slider control for epsilon. Triggers epsilonChanged(), which in turn triggers a number of update operations. More...
 
void onAlgorithmChanged (int algorithm)
 called when the user selects a algorithm panel. Calls on FrechetViewApplication to update the current algorithm. More...
 
void onGreedyButton ()
 called when the user clicks the "Show" button in the "greedy" section. Triggers showGreedyResult(), which in turn triggers an update to the Free-Space diagram. More...
 
void onBFButton ()
 called when the user clicks the "Show" button in the "brute-force" section. Triggers showOptimalResult(), which in turn triggers an update to the Free-Space diagram. More...
 
void setEpsilon (double eps, bool notify)
 updates the value of epsilon More...
 
void setEpsilonWithoutNotify (double eps)
 update the value of epsilon without raising signals More...
 
void setEpsilonWithNotify (double eps)
 update the value of epsilon and raise signals More...
 
void setEpsilonMax (double eps_max)
 update the maximum value of epsilon; adjusts the slider control More...
 
void updateResults ()
 update the k-Frechet panel to show the latest results of the k-Frechet algorithm More...
 
void clearResults ()
 reset the k-Frechet panel More...
 
void updatePolyResult ()
 update the "Polygon" pabel to show the lastest results of the poly-algorithm More...
 
void onShowBounds (bool)
 called when the user clicks the "Show Bounds" button More...
 
void onCurveFinished (bool)
 called when the curve algorithm finishes; update the "curve" panel to show latest results More...
 

Signals

void epsilonChanged (double eps)
 raised when the value of epsilon changes (e.g. when the user operates the slider control). This signal triggers a number of subsequent actions (e.g. updating the free-space diagram). More...
 
void showGreedyResult ()
 raised when the user clicks the "Show" button in the k-Frechet panel. Updates the free-space diagram to show the results of the "greedy" algorithm. More...
 
void showOptimalResult ()
 raised when the user clicks the "Show" button in the k-Frechet panel. Updates the free-space diagram to show the results of the "brute force" algorithm. More...
 
void hideResult ()
 raised when the user clicks the "Hide" button in the k-Frechet panel. Resets the free-space diagram to default. More...
 

Public Member Functions

 ControlPanel (QWidget *parent=0)
 default constructor More...
 
double getEpsilon ()
 
void saveSettings (QSettings &settings, QString group)
 store settings to application preferences More...
 
void restoreSettings (QSettings &settings, QString group)
 load settings from application preferences More...
 

Protected Member Functions

void wheelEvent (QWheelEvent *) override
 
void keyPressEvent (QKeyEvent *event) override
 

Properties

double epsilon
 

Private Member Functions

void updateGreedyResult (const k::kAlgorithm::Greedy &kalg)
 update results of the k-Frechet greedy algorithm More...
 
void updateGreedyResult (k::kAlgorithm::Result k1, k::kAlgorithm::Result k2)
 update results of the k-Frechet greedy algorithm More...
 
void updateOptimalResult (const k::kAlgorithm::BruteForce &bfres)
 update results of the k-Frechet brute-force algorithm More...
 
void updateOptimalResult (k::kAlgorithm::Result kres)
 update results of the k-Frechet brute-force algorithm More...
 
QString toString (double x)
 format a number for display, with appropriate locale More...
 
double toDouble (QString text)
 parse a number input More...
 
int toSliderValue (double x)
 map an epsilon value to a slider location More...
 
double fromSliderValue (int i)
 map a slider location to a value of epsilon More...
 
void showIcon (QLabel *label, int status)
 show a status icon in the control panel More...
 
void setIcon (QLabel *label, QString text, QString tooltip="")
 show a status icon in the control panel More...
 

Private Attributes

double eps
 the current value of epsilon More...
 
QLocale locale
 locale used for number formatting More...
 
QDoubleValidator * epsValidator
 validator for epsilon input More...
 
double eps_step
 step size for epsilon slider control More...
 
Ui::ControlPanel ui
 UI elements (auto-generated by Qt) More...
 
QLabel * movieLabel
 label that display the rotating icon More...
 
bool curve_was_ok
 latest result of the decision algorithm for curves More...
 

Static Private Attributes

static const int DECIMALS = 8
 number of decimals in the epsilon control More...
 
static QMovie * loaderMovie = nullptr
 displays a rotatin icon (during a long-running algorithm) More...
 
static QString POLY_STATUS []
 texts to display for algorithm results More...
 

Constructor & Destructor Documentation

◆ ControlPanel()

ControlPanel::ControlPanel ( QWidget *  parent = 0)

default constructor

Parameters
parentparent widget (optional)

Definition at line 18 of file controlpanel.cpp.

Member Function Documentation

◆ clearResults

void ControlPanel::clearResults ( )
slot

reset the k-Frechet panel

Definition at line 305 of file controlpanel.cpp.

◆ epsilonChanged

void frechet::view::ControlPanel::epsilonChanged ( double  eps)
signal

raised when the value of epsilon changes (e.g. when the user operates the slider control). This signal triggers a number of subsequent actions (e.g. updating the free-space diagram).

Parameters
epsnew value of epsilon

◆ fromSliderValue()

double ControlPanel::fromSliderValue ( int  i)
private

map a slider location to a value of epsilon

Parameters
islider location
Returns
epsilon value

Definition at line 118 of file controlpanel.cpp.

◆ getEpsilon()

double frechet::view::ControlPanel::getEpsilon ( )
inline
Returns
the current value of epsilon

Definition at line 36 of file controlpanel.h.

◆ hideResult

void frechet::view::ControlPanel::hideResult ( )
signal

raised when the user clicks the "Hide" button in the k-Frechet panel. Resets the free-space diagram to default.

◆ keyPressEvent()

void ControlPanel::keyPressEvent ( QKeyEvent *  event)
overrideprotected

Definition at line 538 of file controlpanel.cpp.

◆ lockInput

void frechet::view::ControlPanel::lockInput ( bool  )
inlineslot

not used anymore...

Definition at line 79 of file controlpanel.h.

◆ onAlgorithmChanged

void ControlPanel::onAlgorithmChanged ( int  algorithm)
slot

called when the user selects a algorithm panel. Calls on FrechetViewApplication to update the current algorithm.

Parameters
algorithm

Definition at line 442 of file controlpanel.cpp.

◆ onBFButton

void ControlPanel::onBFButton ( )
slot

called when the user clicks the "Show" button in the "brute-force" section. Triggers showOptimalResult(), which in turn triggers an update to the Free-Space diagram.

Definition at line 466 of file controlpanel.cpp.

◆ onCurveFinished

void ControlPanel::onCurveFinished ( bool  ok)
slot

called when the curve algorithm finishes; update the "curve" panel to show latest results

Definition at line 418 of file controlpanel.cpp.

◆ onEdit

void ControlPanel::onEdit ( )
slot

called after the user has edited the value of epsilon. Triggers epsilonChanged(), which in turn triggers a number of update operations.

Definition at line 436 of file controlpanel.cpp.

◆ onGreedyButton

void ControlPanel::onGreedyButton ( )
slot

called when the user clicks the "Show" button in the "greedy" section. Triggers showGreedyResult(), which in turn triggers an update to the Free-Space diagram.

Definition at line 453 of file controlpanel.cpp.

◆ onShowBounds

void ControlPanel::onShowBounds ( bool  )
slot

called when the user clicks the "Show Bounds" button

Definition at line 408 of file controlpanel.cpp.

◆ onSlider

void ControlPanel::onSlider ( int  value)
slot

called when the user moves the slider control for epsilon. Triggers epsilonChanged(), which in turn triggers a number of update operations.

Parameters
valuenew value of epsilon

Definition at line 449 of file controlpanel.cpp.

◆ restoreSettings()

void ControlPanel::restoreSettings ( QSettings &  settings,
QString  group 
)

load settings from application preferences

Parameters
settingsapplication preferences
groupsection where to store settings

Definition at line 68 of file controlpanel.cpp.

◆ saveSettings()

void ControlPanel::saveSettings ( QSettings &  settings,
QString  group 
)

store settings to application preferences

Parameters
settingsapplication preferences
groupsection where to store settings

Definition at line 57 of file controlpanel.cpp.

◆ setEpsilon

void ControlPanel::setEpsilon ( double  eps,
bool  notify 
)
slot

updates the value of epsilon

Parameters
epsnew value of epsilon
notifyif true, raise signals to update other parts of the GUI. if false, update silently.

Definition at line 81 of file controlpanel.cpp.

◆ setEpsilonMax

void ControlPanel::setEpsilonMax ( double  eps_max)
slot

update the maximum value of epsilon; adjusts the slider control

Parameters
eps_maxmaximum value for epsilon

Definition at line 123 of file controlpanel.cpp.

◆ setEpsilonWithNotify

void frechet::view::ControlPanel::setEpsilonWithNotify ( double  eps)
inlineslot

update the value of epsilon and raise signals

Parameters
epsnew value of epsilon

Definition at line 126 of file controlpanel.h.

◆ setEpsilonWithoutNotify

void frechet::view::ControlPanel::setEpsilonWithoutNotify ( double  eps)
inlineslot

update the value of epsilon without raising signals

Parameters
epsnew value of epsilon

Definition at line 121 of file controlpanel.h.

◆ setIcon()

void ControlPanel::setIcon ( QLabel *  label,
QString  text,
QString  tooltip = "" 
)
private

show a status icon in the control panel

Parameters
labelwidget that contains the icon
textstatus text
tooltiptooltip (mouse over) text

Definition at line 525 of file controlpanel.cpp.

◆ showGreedyResult

void frechet::view::ControlPanel::showGreedyResult ( )
signal

raised when the user clicks the "Show" button in the k-Frechet panel. Updates the free-space diagram to show the results of the "greedy" algorithm.

◆ showIcon()

void ControlPanel::showIcon ( QLabel *  label,
int  status 
)
private

show a status icon in the control panel

Parameters
labelwidget that contains the icon
statusalgorithm status
See also
kAlgorith::Result

Definition at line 497 of file controlpanel.cpp.

◆ showOptimalResult

void frechet::view::ControlPanel::showOptimalResult ( )
signal

raised when the user clicks the "Show" button in the k-Frechet panel. Updates the free-space diagram to show the results of the "brute force" algorithm.

◆ toDouble()

double ControlPanel::toDouble ( QString  text)
private

parse a number input

Parameters
textstring input
Returns
a number

Definition at line 106 of file controlpanel.cpp.

◆ toSliderValue()

int ControlPanel::toSliderValue ( double  x)
private

map an epsilon value to a slider location

Parameters
xa number
Returns
location on slider

Definition at line 113 of file controlpanel.cpp.

◆ toString()

QString ControlPanel::toString ( double  x)
private

format a number for display, with appropriate locale

Parameters
xa number
Returns
string representation

Definition at line 97 of file controlpanel.cpp.

◆ updateGreedyResult() [1/2]

void frechet::view::ControlPanel::updateGreedyResult ( const k::kAlgorithm::Greedy kalg)
private

update results of the k-Frechet greedy algorithm

Parameters
kalgresults of the greedy algorithm

◆ updateGreedyResult() [2/2]

void frechet::view::ControlPanel::updateGreedyResult ( k::kAlgorithm::Result  k1,
k::kAlgorithm::Result  k2 
)
private

update results of the k-Frechet greedy algorithm

Parameters
k1results of the greedy algorithm
k2results of the greedy algorithm

◆ updateOptimalResult() [1/2]

void frechet::view::ControlPanel::updateOptimalResult ( const k::kAlgorithm::BruteForce bfres)
private

update results of the k-Frechet brute-force algorithm

Parameters
bfresresults of the brute-force algorithm

◆ updateOptimalResult() [2/2]

void frechet::view::ControlPanel::updateOptimalResult ( k::kAlgorithm::Result  kres)
private

update results of the k-Frechet brute-force algorithm

Parameters
kresresults of the brute-force algorithm

◆ updatePolyResult

void ControlPanel::updatePolyResult ( )
slot

update the "Polygon" pabel to show the lastest results of the poly-algorithm

Definition at line 327 of file controlpanel.cpp.

◆ updateResults

void ControlPanel::updateResults ( )
slot

update the k-Frechet panel to show the latest results of the k-Frechet algorithm

Definition at line 156 of file controlpanel.cpp.

◆ wheelEvent()

void ControlPanel::wheelEvent ( QWheelEvent *  wh)
overrideprotected

Definition at line 532 of file controlpanel.cpp.

Member Data Documentation

◆ curve_was_ok

bool frechet::view::ControlPanel::curve_was_ok
private

latest result of the decision algorithm for curves

Definition at line 217 of file controlpanel.h.

◆ DECIMALS

const int ControlPanel::DECIMALS = 8
staticprivate

number of decimals in the epsilon control

Definition at line 165 of file controlpanel.h.

◆ eps

double frechet::view::ControlPanel::eps
private

the current value of epsilon

Definition at line 168 of file controlpanel.h.

◆ eps_step

double frechet::view::ControlPanel::eps_step
private

step size for epsilon slider control

Definition at line 174 of file controlpanel.h.

◆ epsValidator

QDoubleValidator* frechet::view::ControlPanel::epsValidator
private

validator for epsilon input

Definition at line 172 of file controlpanel.h.

◆ loaderMovie

QMovie * ControlPanel::loaderMovie = nullptr
staticprivate

displays a rotatin icon (during a long-running algorithm)

Definition at line 213 of file controlpanel.h.

◆ locale

QLocale frechet::view::ControlPanel::locale
private

locale used for number formatting

Definition at line 170 of file controlpanel.h.

◆ movieLabel

QLabel* frechet::view::ControlPanel::movieLabel
private

label that display the rotating icon

Definition at line 215 of file controlpanel.h.

◆ POLY_STATUS

QString ControlPanel::POLY_STATUS
staticprivate
Initial value:
= {
"OK", "no solution",
"NOT_SET_UP",
"",
"P is empty", "Q is empty",
"P is not closed", "Q is not closed",
"P is not simple", "Q is not simple",
"P_NOT_COUNTER_CLOCKWISE", "Q_NOT_COUNTER_CLOCKWISE",
"P is convex", "Q is convex"
}

texts to display for algorithm results

Definition at line 220 of file controlpanel.h.

◆ ui

Ui::ControlPanel frechet::view::ControlPanel::ui
private

UI elements (auto-generated by Qt)

Definition at line 177 of file controlpanel.h.

Property Documentation

◆ epsilon

double frechet::view::ControlPanel::epsilon
readwrite

Definition at line 26 of file controlpanel.h.


The documentation for this class was generated from the following files: