TorMapWidget Class Reference

#include <tormapwidget.h>

Inheritance diagram for TorMapWidget:

ZImageView

List of all members.

Public Slots

void removeCircuit (const CircuitId &circid)
void deselectAll ()
void clear ()
void zoomToFit ()
void zoomToRouter (const QString &id)
void zoomToCircuit (const CircuitId &circid)

Public Member Functions

 TorMapWidget (QWidget *parent=0)
 ~TorMapWidget ()
void addRouter (const QString &id, float latitude, float longitude)
void addCircuit (const CircuitId &circid, const QStringList &path)
void selectRouter (const QString &id)
void selectCircuit (const CircuitId &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< CircuitId, QPair
< QPainterPath *, bool > * > 
_circuits


Detailed Description

Definition at line 30 of file tormapwidget.h.


Constructor & Destructor Documentation

TorMapWidget::TorMapWidget ( QWidget *  parent = 0  ) 

Default constructor.

Default constructor

Definition at line 66 of file tormapwidget.cpp.

References IMG_WORLD_MAP, and ZImageView::setImage().

TorMapWidget::~TorMapWidget (  ) 

Destructor.

Destructor

Definition at line 74 of file tormapwidget.cpp.

References clear().


Member Function Documentation

void TorMapWidget::addRouter ( const QString &  id,
float  latitude,
float  longitude 
)

Plots the given router on the map using the given coordinates.

Adds a router to the map.

Definition at line 81 of file tormapwidget.cpp.

References _routers, and toMapSpace().

Referenced by NetViewer::resolved().

void TorMapWidget::addCircuit ( const CircuitId circid,
const QStringList &  path 
)

Plots the given circuit on the map.

Adds a circuit to the map using the given ordered list of router IDs.

Add the data to the hash of known circuits and plot the circuit on the map

Definition at line 94 of file tormapwidget.cpp.

References _circuits, _routers, and i().

Referenced by NetViewer::addCircuit(), and NetViewer::resolved().

void TorMapWidget::selectRouter ( const QString &  id  ) 

Selects and hightlights a router on the map.

Selects and highlights the router on the map.

Definition at line 143 of file tormapwidget.cpp.

References _routers.

Referenced by NetViewer::routerSelected().

void TorMapWidget::selectCircuit ( const CircuitId circid  ) 

Selects and highlights a circuit on the map.

Selects and highlights the circuit with the id circid on the map.

Definition at line 155 of file tormapwidget.cpp.

References _circuits.

Referenced by NetViewer::circuitSelected().

QSize TorMapWidget::minimumSizeHint (  )  const

Returns the minimum size of the widget

Definition at line 254 of file tormapwidget.cpp.

References MIN_SIZE.

void TorMapWidget::removeCircuit ( const CircuitId circid  )  [slot]

Removes a circuit from the map.

Definition at line 131 of file tormapwidget.cpp.

References _circuits.

void TorMapWidget::deselectAll (  )  [slot]

Deselects all the highlighted circuits and routers

Deselects any highlighted routers or circuits

Definition at line 166 of file tormapwidget.cpp.

References _circuits, and _routers.

Referenced by NetViewer::circuitSelected(), NetViewer::routerSelected(), and zoomToRouter().

void TorMapWidget::clear (  )  [slot]

Clears the known routers and removes all the data from the map

Clears the list of routers and removes all the data on the map

Definition at line 182 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.

Zooms to fit all currently displayed circuits on the map. If there are no circuits on the map, the viewport will be returned to its default position (zoomed all the way out and centered).

Definition at line 263 of file tormapwidget.cpp.

References circuitBoundingBox(), MAP_HEIGHT, MAP_WIDTH, ZImageView::resetZoomPoint(), and ZImageView::zoom().

void TorMapWidget::zoomToRouter ( const QString &  id  )  [slot]

Zoom to a particular router on the map.

Zooms in on the router with the given id.

Definition at line 298 of file tormapwidget.cpp.

References _routers, deselectAll(), and ZImageView::zoom().

void TorMapWidget::zoomToCircuit ( const CircuitId circid  )  [slot]

Zoom to the circuit on the map with the given circid.

Definition at line 282 of file tormapwidget.cpp.

References _circuits, MAP_HEIGHT, MAP_WIDTH, and ZImageView::zoom().

void TorMapWidget::paintImage ( QPainter *  painter  )  [protected, virtual]

Paints the current circuits and streams on the image.

Draws the routers and paths onto the map image.

Reimplemented from ZImageView.

Definition at line 198 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 218 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

Linearly interpolates using the values in the Robinson projection table

Definition at line 244 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 313 of file tormapwidget.cpp.

References _circuits.

Referenced by zoomToFit().


Member Data Documentation

QHash<QString, QPair<QPointF,bool>* > TorMapWidget::_routers [private]

Stores map locations for tor routers

Definition at line 79 of file tormapwidget.h.

Referenced by addCircuit(), addRouter(), clear(), deselectAll(), paintImage(), selectRouter(), and zoomToRouter().

QHash<CircuitId, QPair<QPainterPath *,bool>* > TorMapWidget::_circuits [private]

Stores circuit information

Definition at line 81 of file tormapwidget.h.

Referenced by addCircuit(), circuitBoundingBox(), clear(), deselectAll(), paintImage(), removeCircuit(), selectCircuit(), and zoomToCircuit().


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

Generated on Wed Nov 26 21:04:00 2008 for Vidalia by  doxygen 1.5.6