author | deba |
Wed, 11 May 2005 17:36:25 +0000 | |
changeset 1413 | 3f45d58969d4 |
permissions | -rw-r--r-- |
ladanyi@1412 | 1 |
// -*- C++ -*- // |
ladanyi@1412 | 2 |
|
ladanyi@1412 | 3 |
#ifndef GRAPH_DISPLAYER_CANVAS_H |
ladanyi@1412 | 4 |
#define GRAPH_DISPLAYER_CANVAS_H |
ladanyi@1412 | 5 |
|
ladanyi@1412 | 6 |
#include <all_include.h> |
ladanyi@1412 | 7 |
#include <mapstorage.h> |
ladanyi@1412 | 8 |
#include <libgnomecanvasmm.h> |
ladanyi@1412 | 9 |
#include <libgnomecanvasmm/polygon.h> |
ladanyi@1412 | 10 |
|
ladanyi@1412 | 11 |
class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA |
ladanyi@1412 | 12 |
{ |
ladanyi@1412 | 13 |
typedef Gnome::Canvas::CanvasAA Parent; |
ladanyi@1412 | 14 |
|
ladanyi@1412 | 15 |
public: |
ladanyi@1412 | 16 |
GraphDisplayerCanvas(Graph &, CoordinatesMap &, MapStorage &); |
ladanyi@1412 | 17 |
virtual ~GraphDisplayerCanvas(); |
ladanyi@1412 | 18 |
|
ladanyi@1412 | 19 |
int changeLineWidth (std::string mapname); |
ladanyi@1412 | 20 |
int changeColor (std::string mapname); |
ladanyi@1412 | 21 |
int changeText (std::string mapname); |
ladanyi@1412 | 22 |
int rezoom(); |
ladanyi@1412 | 23 |
|
ladanyi@1412 | 24 |
protected: |
ladanyi@1412 | 25 |
|
ladanyi@1412 | 26 |
virtual bool on_expose_event(GdkEventExpose *); |
ladanyi@1412 | 27 |
|
ladanyi@1412 | 28 |
private: |
ladanyi@1412 | 29 |
|
ladanyi@1412 | 30 |
///Event handler function that handles dragging nodes of displayed_graph |
ladanyi@1412 | 31 |
bool event_handler(GdkEvent* e, Node n); |
ladanyi@1412 | 32 |
|
ladanyi@1412 | 33 |
///The graph, on which we work |
ladanyi@1412 | 34 |
Graph g; |
ladanyi@1412 | 35 |
///Map of nodes of planefigure |
ladanyi@1412 | 36 |
Graph::NodeMap<Gnome::Canvas::Ellipse *> nodesmap; |
ladanyi@1412 | 37 |
///Map of edges of planefigure |
ladanyi@1412 | 38 |
Graph::EdgeMap<Gnome::Canvas::Line *> edgesmap; |
ladanyi@1412 | 39 |
|
ladanyi@1412 | 40 |
///Map of texts to write on edges |
ladanyi@1412 | 41 |
Graph::EdgeMap<Gnome::Canvas::Text *> edgetextmap; |
ladanyi@1412 | 42 |
|
ladanyi@1412 | 43 |
///Group of graphical elements of displayed_graph |
ladanyi@1412 | 44 |
Gnome::Canvas::Group displayed_graph; |
ladanyi@1412 | 45 |
|
ladanyi@1412 | 46 |
///Here we store the maps that can be displayed through properties. |
ladanyi@1412 | 47 |
MapStorage mapstorage; |
ladanyi@1412 | 48 |
|
ladanyi@1412 | 49 |
///Indicates whether the button of mouse is pressed or not |
ladanyi@1412 | 50 |
bool isbutton; |
ladanyi@1412 | 51 |
|
ladanyi@1412 | 52 |
///At this location was the mousebutton pressed. |
ladanyi@1412 | 53 |
///It helps to calculate the distance of dragging. |
ladanyi@1412 | 54 |
double clicked_x, clicked_y; |
ladanyi@1412 | 55 |
|
ladanyi@1412 | 56 |
///Remembers which Gnome::Canvas::Item was pressed. |
ladanyi@1412 | 57 |
///this variable is needed, because |
ladanyi@1412 | 58 |
///1. we cannot query the item at he cursor as fast as it could not cause a Segmentation Fault |
ladanyi@1412 | 59 |
///2. we would like to handle only ony item per movement, therefore quering it is not a working solution |
ladanyi@1412 | 60 |
Gnome::Canvas::Item * active_item; |
ladanyi@1412 | 61 |
|
ladanyi@1412 | 62 |
|
ladanyi@1412 | 63 |
}; |
ladanyi@1412 | 64 |
|
ladanyi@1412 | 65 |
#endif //GRAPH_DISPLAYER_CANVAS_H |