COIN-OR::LEMON - Graph Library

Changeset 1819:fd82adfbe905 in lemon-0.x


Ignore:
Timestamp:
11/21/05 13:07:05 (14 years ago)
Author:
Hegyi Péter
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2368
Message:

Reorganizing.

Location:
gui
Files:
2 deleted
9 edited
2 moved

Legend:

Unmodified
Added
Removed
  • gui/Makefile.am

    r1731 r1819  
    1616        graph_displayer_canvas.h \
    1717        graph-displayer.cc \
     18        gdc-broken_edge.cc \
    1819        main_win.cc \
    1920        main_win.h \
     
    2223        map_win.cc \
    2324        map_win.h \
    24         broken_edge.cc \
    25         broken_edge.h \
     25        mw-mapselector.cc \
    2626        new_map_win.cc \
    2727        new_map_win.h \
    2828        xymap.h \
    29         icons/guipixbufs.h\
    30         mapselector.h\
    31         mapselector.cc
     29        icons/guipixbufs.h
    3230
    3331
  • gui/gdc-broken_edge.cc

    r1714 r1819  
    1 #include "broken_edge.h"
     1#include "graph_displayer_canvas.h"
    22#include <cmath>
    33
    4 BrokenEdge::BrokenEdge(Gnome::Canvas::Group & g, Gnome::Canvas::Points p, GraphDisplayerCanvas & gc) : Line(g), gdc(gc), isbutton(false)
     4GraphDisplayerCanvas::BrokenEdge::BrokenEdge(Gnome::Canvas::Group & g, Gnome::Canvas::Points p, GraphDisplayerCanvas & gc) : Line(g), gdc(gc), isbutton(false)
    55{
    66  my_points=new Gnome::Art::Point[3];
     
    88  arrow=new Gnome::Canvas::Polygon(g);
    99  *arrow << Gnome::Canvas::Properties::fill_color("red");
    10   arrow->signal_event().connect(sigc::mem_fun(*this, &BrokenEdge::edgeFormerEventHandler));
     10  arrow->signal_event().connect(sigc::mem_fun(*this, &GraphDisplayerCanvas::BrokenEdge::edgeFormerEventHandler));
    1111  arrow->lower_to_bottom();
    1212  setPoints(p);
    1313}
    1414
    15 BrokenEdge::~BrokenEdge()
     15GraphDisplayerCanvas::BrokenEdge::~BrokenEdge()
    1616{
    1717  if(arrow)delete(arrow);
    1818}
    1919
    20 void BrokenEdge::setPoints(Gnome::Canvas::Points p, bool move)
     20void GraphDisplayerCanvas::BrokenEdge::setPoints(Gnome::Canvas::Points p, bool move)
    2121{
    2222  bool set_arrow=false;
     
    156156}
    157157
    158 bool BrokenEdge::edgeFormerEventHandler(GdkEvent* e)
     158bool GraphDisplayerCanvas::BrokenEdge::edgeFormerEventHandler(GdkEvent* e)
    159159{
    160160  switch(e->type)
     
    208208}
    209209
    210 xy<double> BrokenEdge::getArrowPos()
     210xy<double> GraphDisplayerCanvas::BrokenEdge::getArrowPos()
    211211{
    212212  xy<double> ret_val(my_points[1].get_x(),my_points[1].get_y());
  • gui/graph_displayer_canvas-edge.cc

    r1731 r1819  
    11#include "graph_displayer_canvas.h"
    2 #include "broken_edge.h"
    32#include <cmath>
    43
  • gui/graph_displayer_canvas-event.cc

    r1777 r1819  
    11#include "graph_displayer_canvas.h"
    2 #include "broken_edge.h"
    32#include <cmath>
    43
  • gui/graph_displayer_canvas-node.cc

    r1731 r1819  
    11#include "graph_displayer_canvas.h"
    2 #include "broken_edge.h"
    32#include <cmath>
    43
  • gui/graph_displayer_canvas-zoom.cc

    r1777 r1819  
    11#include "graph_displayer_canvas.h"
    2 #include "broken_edge.h"
    32#include <cmath>
    43
  • gui/graph_displayer_canvas.cc

    r1648 r1819  
    11#include "graph_displayer_canvas.h"
    2 #include "broken_edge.h"
    32#include <cmath>
    43
  • gui/graph_displayer_canvas.h

    r1814 r1819  
    88#include "all_include.h"
    99#include "mapstorage.h"
    10 #include "broken_edge.h"
    1110#include "map_win.h"
    1211#include <libgnomecanvasmm.h>
    1312#include <libgnomecanvasmm/polygon.h>
     13#include <lemon/xy.h>
    1414
    1515///This class is the canvas, on which the graph can be drawn.
    1616class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA
    1717{
     18  class BrokenEdge : public Gnome::Canvas::Line
     19  {
     20    GraphDisplayerCanvas & gdc;
     21    Gnome::Canvas::Polygon * arrow;
     22    Gnome::Art::Point * my_points;
     23
     24
     25    ///Indicates whether the button of mouse is pressed or not
     26    bool isbutton;
     27
     28    ///At this location was the mousebutton pressed.
     29    ///It helps to calculate the distance of dragging.
     30    double clicked_x, clicked_y;
     31
     32    ///event handler for forming edges
     33    bool edgeFormerEventHandler(GdkEvent*);
     34  public:
     35    BrokenEdge(Gnome::Canvas::Group &, Gnome::Canvas::Points, GraphDisplayerCanvas &);
     36    ~BrokenEdge();
     37    void setPoints(Gnome::Canvas::Points, bool move=false);
     38    xy<double> getArrowPos();
     39  };
    1840  typedef Gnome::Canvas::CanvasAA Parent;
    1941
  • gui/map_win.h

    r1733 r1819  
    1010#include "mapstorage.h"
    1111#include "new_map_win.h"
    12 #include "mapselector.h"
    1312#include <libgnomecanvasmm.h>
    1413#include <libgnomecanvasmm/polygon.h>
     
    1918class MapWin : public Gtk::Window
    2019{
     20
     21  class MapSelector : public Gtk::HBox
     22  {
     23  protected:
     24    GraphDisplayerCanvas & gdc;
     25    ///The \ref MapStorage in which the visualizable maps are stored
     26    MapStorage & ms;
     27    NewMapWin & nmw;
     28
     29    int id;
     30
     31    bool itisedge;
     32
     33    bool default_state;
     34
     35    bool set_new_map;
     36
     37    Gtk::ComboBoxText cbt;
     38
     39    Gtk::Button * newbut, * defbut;
     40
     41    Gtk::HBox hbox;
     42
     43    Gtk::Label * label;
     44
     45    Node node_to_update;
     46    Edge edge_to_update;
     47
     48
     49  public:
     50
     51    MapSelector(GraphDisplayerCanvas &, MapStorage &, NewMapWin &, int, bool);
     52
     53    void update_list();
     54
     55    ///If a radiobutton is clicked, this function determines
     56    ///which button was that and after that calls the
     57    ///appropriate function of the \ref GraphDisplayerCanvas
     58    ///to change the visible values of that attribute.
     59    virtual void comboChanged();
     60
     61    virtual void new_but_pressed();
     62
     63    virtual void reset();
     64
     65    virtual void update(Node node);
     66    virtual void update(Edge edge);
     67
     68    Glib::ustring get_active_text();
     69    void set_active_text(Glib::ustring);
     70    void append_text(Glib::ustring);
     71  };
     72
     73
     74
    2175protected:
    2276  ///The \ref GraphDisplayerCanvas on which the graph will be drawn.
  • gui/mw-mapselector.cc

    r1737 r1819  
    1 #include "mapselector.h"
    2 
    3 MapSelector::MapSelector(GraphDisplayerCanvas & grdispc, MapStorage & mapst, NewMapWin & newmapw, int identifier, bool edge):gdc(grdispc),ms(mapst),nmw(newmapw),id(identifier),itisedge(edge),default_state(true),set_new_map(false),node_to_update(INVALID),edge_to_update(INVALID)
     1#include "map_win.h"
     2
     3MapWin::MapSelector::MapSelector(GraphDisplayerCanvas & grdispc, MapStorage & mapst, NewMapWin & newmapw, int identifier, bool edge):gdc(grdispc),ms(mapst),nmw(newmapw),id(identifier),itisedge(edge),default_state(true),set_new_map(false),node_to_update(INVALID),edge_to_update(INVALID)
    44{
    55  update_list();
     
    1010  cbt.signal_changed().connect
    1111    (
    12      sigc::mem_fun((*this), &MapSelector::comboChanged),
     12     sigc::mem_fun((*this), &MapWin::MapSelector::comboChanged),
    1313     false
    1414     );
     
    3030  defbut->signal_pressed().connect
    3131    (
    32      sigc::mem_fun(*this, &MapSelector::reset)
     32     sigc::mem_fun(*this, &MapWin::MapSelector::reset)
    3333     );
    3434
     
    3737  newbut->signal_pressed().connect
    3838    (
    39      sigc::mem_fun(*this, &MapSelector::new_but_pressed)
     39     sigc::mem_fun(*this, &MapWin::MapSelector::new_but_pressed)
    4040     );
    4141
     
    4848}
    4949
    50 void MapSelector::new_but_pressed()
     50void MapWin::MapSelector::new_but_pressed()
    5151{
    5252  set_new_map=true;
     
    5454}
    5555
    56 void MapSelector::update_list()
     56void MapWin::MapSelector::update_list()
    5757{
    5858  cbt.clear();
     
    7676}
    7777
    78 void MapSelector::comboChanged()
     78void MapWin::MapSelector::comboChanged()
    7979{
    8080  if(cbt.get_active_row_number()!=0)
     
    134134}
    135135
    136 void MapSelector::reset()
     136void MapWin::MapSelector::reset()
    137137{
    138138  default_state=true;
     
    177177}
    178178
    179 void MapSelector::update(Node node)
     179void MapWin::MapSelector::update(Node node)
    180180{
    181181  node_to_update=node;
     
    191191}
    192192
    193 void MapSelector::update(Edge edge)
     193void MapWin::MapSelector::update(Edge edge)
    194194{
    195195  edge_to_update=edge;
     
    205205}
    206206
    207 Glib::ustring MapSelector::get_active_text()
     207Glib::ustring MapWin::MapSelector::get_active_text()
    208208{
    209209  return cbt.get_active_text();
    210210}
    211211
    212 void MapSelector::set_active_text(Glib::ustring text)
     212void MapWin::MapSelector::set_active_text(Glib::ustring text)
    213213{
    214214  cbt.set_active_text(text);
    215215}
    216216
    217 void MapSelector::append_text(Glib::ustring text)
     217void MapWin::MapSelector::append_text(Glib::ustring text)
    218218{
    219219  cbt.append_text(text);
  • gui/new_map_win.cc

    r1814 r1819  
    319319      unsigned int pr=10000;
    320320      bool prevmult=false;
    321       unsigned int prev_change;
    322       unsigned int prev_br=10000;
     321      unsigned int prev_change=pr;
     322      unsigned int prev_br=pr;
    323323      int counter=0;
    324324      std::string comm_nobr="";
     
    393393NewMapWin::tree_node * NewMapWin::weightedString2Tree(std::string to_tree, std::vector<unsigned int> & p, int offset)
    394394{
    395   int min=p[offset];
     395  unsigned int min=p[offset];
    396396  int minplace=0;
    397397  for(int i=0;i<(int)to_tree.size();i++)
Note: See TracChangeset for help on using the changeset viewer.