Vidalia  0.3.1
Public Slots | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
TorMapImageView Class Reference

#include <TorMapImageView.h>

Inheritance diagram for TorMapImageView:
ZImageView

Public Slots

void removeCircuit (const CircuitId &circid)
 
void deselectAll ()
 
void clear ()
 
void zoomToFit ()
 
void zoomToRouter (const QString &id)
 
void zoomToCircuit (const CircuitId &circid)
 
- Public Slots inherited from ZImageView
void resetZoomPoint ()
 
void zoom (float pct)
 
void zoom (QPoint zoomAt, float pct)
 
void zoomIn ()
 
void zoomOut ()
 

Public Member Functions

 TorMapImageView (QWidget *parent=0)
 
 ~TorMapImageView ()
 
void addRouter (const RouterDescriptor &desc, const GeoIpRecord &geoip)
 
void addCircuit (const CircuitId &circid, const QStringList &path)
 
void selectRouter (const QString &id)
 
void selectCircuit (const CircuitId &circid)
 
QSize minimumSizeHint () const
 
- Public Member Functions inherited from ZImageView
 ZImageView (QWidget *parent=0)
 
void setImage (QImage &pixmap)
 

Protected Member Functions

virtual void paintImage (QPainter *painter)
 
- Protected Member Functions inherited from ZImageView
virtual void paintEvent (QPaintEvent *)
 
virtual void mousePressEvent (QMouseEvent *e)
 
virtual void mouseReleaseEvent (QMouseEvent *e)
 
virtual void mouseMoveEvent (QMouseEvent *e)
 
virtual void mouseDoubleClickEvent (QMouseEvent *e)
 
virtual void wheelEvent (QWheelEvent *e)
 
void updateViewport (int screendx=0, int screendy=0)
 
void drawScaledImage ()
 

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 31 of file TorMapImageView.h.

Constructor & Destructor Documentation

TorMapImageView::TorMapImageView ( QWidget *  parent = 0)

Default constructor.

Default constructor

Definition at line 72 of file TorMapImageView.cpp.

References IMG_WORLD_MAP, and ZImageView::setImage().

TorMapImageView::~TorMapImageView ( )

Destructor.

Destructor

Definition at line 80 of file TorMapImageView.cpp.

References clear().

Member Function Documentation

void TorMapImageView::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 101 of file TorMapImageView.cpp.

References _circuits, _routers, and i().

Referenced by NetViewer::addCircuit().

void TorMapImageView::addRouter ( const RouterDescriptor desc,
const GeoIpRecord geoip 
)

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

Adds a router to the map.

Definition at line 87 of file TorMapImageView.cpp.

References _routers, RouterDescriptor::id(), GeoIpRecord::latitude(), GeoIpRecord::longitude(), and toMapSpace().

Referenced by NetViewer::addRouter().

QRectF TorMapImageView::circuitBoundingBox ( )
private

Computes a bounding box around all currently displayed circuit paths on the map.

Definition at line 320 of file TorMapImageView.cpp.

References _circuits.

Referenced by zoomToFit().

void TorMapImageView::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 189 of file TorMapImageView.cpp.

References _circuits, and _routers.

Referenced by NetViewer::clear(), and ~TorMapImageView().

void TorMapImageView::deselectAll ( )
slot

Deselects all the highlighted circuits and routers

Deselects any highlighted routers or circuits

Definition at line 173 of file TorMapImageView.cpp.

References _circuits, and _routers.

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

float TorMapImageView::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 251 of file TorMapImageView.cpp.

Referenced by toMapSpace().

QSize TorMapImageView::minimumSizeHint ( ) const

Returns the minimum size of the widget

Definition at line 261 of file TorMapImageView.cpp.

References MIN_SIZE.

void TorMapImageView::paintImage ( QPainter *  painter)
protectedvirtual

Paints the current circuits and streams on the image.

Draws the routers and paths onto the map image.

Reimplemented from ZImageView.

Definition at line 205 of file TorMapImageView.cpp.

References _circuits, _routers, PEN_CIRCUIT, PEN_ROUTER, and PEN_SELECTED.

void TorMapImageView::removeCircuit ( const CircuitId circid)
slot

Removes a circuit from the map.

Definition at line 138 of file TorMapImageView.cpp.

References _circuits.

void TorMapImageView::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 162 of file TorMapImageView.cpp.

References _circuits.

Referenced by NetViewer::circuitSelected().

void TorMapImageView::selectRouter ( const QString &  id)

Selects and hightlights a router on the map.

Selects and highlights the router on the map.

Definition at line 150 of file TorMapImageView.cpp.

References _routers.

Referenced by NetViewer::routerSelected().

QPointF TorMapImageView::toMapSpace ( float  latitude,
float  longitude 
)
private

Converts world space coordinates into map space coordinates

Definition at line 225 of file TorMapImageView.cpp.

References lerp(), MAP_HEIGHT, MAP_LEFT, MAP_ORIGIN, MAP_TOP, MAP_WIDTH, pdfe, and plen.

Referenced by addRouter().

void TorMapImageView::zoomToCircuit ( const CircuitId circid)
slot

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

Definition at line 289 of file TorMapImageView.cpp.

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

void TorMapImageView::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 270 of file TorMapImageView.cpp.

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

void TorMapImageView::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 305 of file TorMapImageView.cpp.

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

Member Data Documentation

QHash<CircuitId, QPair<QPainterPath *,bool>* > TorMapImageView::_circuits
private

Stores circuit information

Definition at line 82 of file TorMapImageView.h.

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

QHash<QString, QPair<QPointF,bool>* > TorMapImageView::_routers
private

Stores map locations for tor routers

Definition at line 80 of file TorMapImageView.h.

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


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