#include <tormapwidget.h>
Inheritance diagram for TorMapWidget:
Public Slots | |
void | removeCircuit (quint64 circid) |
void | deselectAll () |
void | clear () |
void | zoomToFit () |
Public Member Functions | |
TorMapWidget (QWidget *parent=0) | |
~TorMapWidget () | |
void | addRouter (QString id, float latitude, float longitude) |
void | addCircuit (quint64 circid, QStringList path) |
void | selectRouter (QString id) |
void | selectCircuit (quint64 circid) |
QSize | minimumSizeHint () const |
Protected Member Functions | |
virtual void | paintImage (QPainter *painter) |
Private Member Functions | |
QPointF | toMapSpace (float latitude, float longitude) |
float | lerp (float input, float *table) |
QRectF | circuitBoundingBox () |
Private Attributes | |
QHash< QString, QPair< QPointF, bool > * > | _routers |
QHash< quint64, QPair< QPainterPath *, bool > * > | _circuits |
Definition at line 39 of file tormapwidget.h.
TorMapWidget::TorMapWidget | ( | QWidget * | parent = 0 |
) |
Default constructor.
Definition at line 77 of file tormapwidget.cpp.
References IMG_WORLD_MAP, and ZImageView::setImage().
TorMapWidget::~TorMapWidget | ( | ) |
void TorMapWidget::addRouter | ( | QString | id, | |
float | latitude, | |||
float | longitude | |||
) |
Plots the given router on the map using the given coordinates.
Definition at line 92 of file tormapwidget.cpp.
References _routers, and toMapSpace().
Referenced by NetViewer::resolved().
void TorMapWidget::addCircuit | ( | quint64 | circid, | |
QStringList | path | |||
) |
Plots the given circuit on the map.
Add the data to the hash of known circuits and plot the circuit on the map
Definition at line 102 of file tormapwidget.cpp.
References _circuits, _routers, and i().
Referenced by NetViewer::addCircuit(), and NetViewer::resolved().
void TorMapWidget::selectRouter | ( | QString | id | ) |
Selects and hightlights a router on the map.
Definition at line 150 of file tormapwidget.cpp.
References _routers.
Referenced by NetViewer::routerSelected().
void TorMapWidget::selectCircuit | ( | quint64 | circid | ) |
Selects and highlights a circuit on the map.
Definition at line 162 of file tormapwidget.cpp.
References _circuits.
Referenced by NetViewer::circuitSelected().
QSize TorMapWidget::minimumSizeHint | ( | ) | const |
Returns the minimum size of the widget
Definition at line 261 of file tormapwidget.cpp.
References MIN_SIZE.
void TorMapWidget::removeCircuit | ( | quint64 | circid | ) | [slot] |
Removes a circuit from the map.
Definition at line 139 of file tormapwidget.cpp.
References _circuits.
void TorMapWidget::deselectAll | ( | ) | [slot] |
Deselects all the highlighted circuits and routers
Definition at line 173 of file tormapwidget.cpp.
References _circuits, and _routers.
Referenced by NetViewer::circuitSelected(), and NetViewer::routerSelected().
void TorMapWidget::clear | ( | ) | [slot] |
Clears the known routers and removes all the data from the map
Definition at line 189 of file tormapwidget.cpp.
References _circuits, and _routers.
Referenced by NetViewer::clear(), and ~TorMapWidget().
void TorMapWidget::zoomToFit | ( | ) | [slot] |
Zooms to fit all currently displayed circuits on the map.
Definition at line 270 of file tormapwidget.cpp.
References circuitBoundingBox(), MAP_HEIGHT, MAP_WIDTH, ZImageView::resetZoomPoint(), and ZImageView::zoom().
void TorMapWidget::paintImage | ( | QPainter * | painter | ) | [protected, virtual] |
Paints the current circuits and streams on the image.
Reimplemented from ZImageView.
Definition at line 205 of file tormapwidget.cpp.
References _circuits, _routers, PEN_CIRCUIT, PEN_ROUTER, and PEN_SELECTED.
QPointF TorMapWidget::toMapSpace | ( | float | latitude, | |
float | longitude | |||
) | [private] |
Converts world space coordinates into map space coordinates
Definition at line 225 of file tormapwidget.cpp.
References lerp(), MAP_HEIGHT, MAP_LEFT, MAP_ORIGIN, MAP_TOP, MAP_WIDTH, pdfe, and plen.
Referenced by addRouter().
float TorMapWidget::lerp | ( | float | input, | |
float * | table | |||
) | [private] |
Linearly interpolates using the values in the projection table
Definition at line 251 of file tormapwidget.cpp.
Referenced by toMapSpace().
QRectF TorMapWidget::circuitBoundingBox | ( | ) | [private] |
Computes a bounding box around all currently displayed circuit paths on the map.
Definition at line 290 of file tormapwidget.cpp.
References _circuits.
Referenced by zoomToFit().
QHash<QString, QPair<QPointF,bool>* > TorMapWidget::_routers [private] |
Stores map locations for tor routers
Definition at line 84 of file tormapwidget.h.
Referenced by addCircuit(), addRouter(), clear(), deselectAll(), paintImage(), and selectRouter().
QHash<quint64, QPair<QPainterPath *,bool>* > TorMapWidget::_circuits [private] |
Stores circuit information
Definition at line 86 of file tormapwidget.h.
Referenced by addCircuit(), circuitBoundingBox(), clear(), deselectAll(), paintImage(), removeCircuit(), and selectCircuit().