COIN-OR::LEMON - Graph Library

Changeset 1890:4a583e07d4b8 in lemon-0.x

01/11/06 16:49:06 (18 years ago)
Hegyi Péter

Documentation of NewMapWin?.

2 edited


  • gui/

    r1889 r1890  
    459459  int i=0;
    460   for(;((i<tabnames.size())&&(tabnames[i]!=tabname));i++)
     460  for(;((i<(int)tabnames.size())&&(tabnames[i]!=tabname));i++)
    461461    {
    462462    }
  • gui/new_map_win.h

    r1887 r1890  
    1212#include <stack>
     14///Graphical interface for node/edge map creation.
    1416///This class is responsible for creating a window,
    1517///on which the parameters of a new map can be set.
    1718class NewMapWin : public Gtk::Dialog
     20  ///The \ref NoteBookTab in which the new map has to be placed.
    1921  NoteBookTab & mytab;
     25  ///Struct to be able to evaluate expressions.
     27  ///Initial values of map elements can be given
     28  ///by numbers or by expressions. From expressions
     29  ///we build first a tree. This is the data structure
     30  ///that can store one tree element.
    2231  struct tree_node
    2332  {
     33    ///Character stored in this tree element
    2434    char ch;
     35    ///Left child of tree element.
    2536    tree_node * left_child;
     37    ///Right child of tree element.
    2638    tree_node * right_child;
    2739  };
    29   ///Constructor of NewMapWin creates the widgets shown in NewMapWin.
     41  ///Constructor of NewMapWin.
     43  ///It creates the widgets shown in
     44  ///NewMapWin.
    3045  NewMapWin(const std::string& title, NoteBookTab &, bool itisedge=true, bool edgenode=true);
    32   ///Signal on button is connected to this function,
    33   ///Therefore this function determines whether to
    34   ///call the map/creatort function, and if yes, it
    35   //tells it the attributes.(name, default value)
     47  ///Callback function for OK button. It creates the map.
     49  ///This function determines whether the input is correct:
     50  ///the name of new map must not be already used, the expression
     51  ///that gives tha initial values of map elements has to be valid.
     52  ///If input is correct it creates and registrates the new map
     53  ///to the correct place. (\ref mytab)
    3654  virtual void on_response(int response_id);
     56  ///Close window if Esc key pressed.
    3857  virtual bool closeIfEscapeIsPressed(GdkEventKey*);
    40   ///Function that creates a tree from an appropriately manipulated string
    41   tree_node * weightedString2Tree(std::string, std::vector<unsigned int> &, int);
     59  ///Function that creates a tree from an appropriately manipulated string.
    43   ///Function  that creates a string from a tree by postorder reading.
    44   std::string postOrder(tree_node *);
     61  ///Tree is builded according to priorities of operations in expression given by string.
     62  ///Priorities are indicated in a vector that contains weights for each operation.
     63  ///\param to_tree string to build tree from
     64  ///\param weights weights (priorities)
     65  ///\param offset this function call is recursive. This parameter tells us,
     66  ///with which part of the string do we have to deal with.
     67  tree_node * weightedString2Tree(std::string to_tree, std::vector<unsigned int> & weights, int offset);
    46   std::string string2Polishform(std::string, bool);
     69  ///Function that creates a string from a tree by postorder reading.
    48   bool validVariable(std::string, bool);
     71  ///This is the last step of creating polishform
     72  ///from a given expression string.
     73  ///\param root the root of the tree to read through
     74  std::string postOrder(tree_node * root);
    50   void deleteTree(tree_node *);
     76  ///From the given expression it creates expression given in polish form.
     78  ///First it substitutes variables and numbers in the given expression.
     79  ///The substitutions will be one character long local variables.
     80  ///The substituted-substitution pair is registrated in \ref ch2var.
     81  ///After that it gives weights fo each character in substituted expression.
     82  ///Weights are calculated according to the priority of operations in expression.
     83  ///Then it creates tree (\ref tree_node) from the weighted string. (\ref weightedString2Tree)
     84  ///\param to_polish the string to turn into polish_form
     85  ///\param itisedge do we have to create an edgemap or a nodemap.
     86  ///It is important, because variables are maps and if expression
     87  ///citates a map that does not exists the expression is not valid.
     88  ///But to determine, whether the map exists we have to know where
     89  ///to search for it. And of course for a new edgemap only edgemaps can be serve with values.
     90  std::string string2Polishform(std::string to_polish, bool itisedge);
     92  ///Returns whether a string can be used as value in an expression.
     94  ///The given string has to be either a mapname or a number. If it is a mapname
     95  ///we have to know whether it is an edgemap or a nodemap.
     96  ///\param variable the string about the function has to determine whether it is usable in expressions
     97  ///\param itisedge should the mapname be between edgemaps, or nodemaps
     98  bool validVariable(std::string variable, bool itisedge);
     100  ///Deletes the whole tree created for translating string to polishform.
     102  ///\param root
     103  ///root of the tree
     104  void deleteTree(tree_node * root);
     106  ///Dictionary of substitutions in expression.
     108  ///Variables and numbers are substituted with one character long variables in expressions.
     109  ///This is the dictionary.
    52110  std::map<char, std::string> ch2var;
    54   Gtk::Entry name, default_value;
     112  ///Entry which gives us the name of new map.
     113  Gtk::Entry name;
     115  ///Entry which gives us the initial values of elements of new map.
     117  ///Initial value can be a number or an expression after that the
     118  ///initial value for each map element can be calculated.
     119  Gtk::Entry default_value;
     121  ///GTK Designing object.
    56122  Gtk::Table * table;
     124  ///Information holder in window.
    57125  Gtk::Label * label;
    59   Gtk::RadioButton node, edge;
     127  ///If selected, nodemap will be created.
     128  Gtk::RadioButton node;
     130  ///If selected, edgemap will be created.
     131  Gtk::RadioButton edge;
Note: See TracChangeset for help on using the changeset viewer.