visualnode.hh
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef GECODE_GIST_VISUALNODE_HH
00039 #define GECODE_GIST_VISUALNODE_HH
00040
00041 #include <gecode/gist/spacenode.hh>
00042 #include <gecode/kernel.hh>
00043 #include <string>
00044
00045 namespace Gecode { namespace Gist {
00046
00048 class BoundingBox {
00049 public:
00051 int left;
00053 int right;
00055 BoundingBox(int l, int r);
00057 BoundingBox(void) {}
00058 };
00059
00061 class Extent {
00062 public:
00064 int l;
00066 int r;
00068 Extent(void);
00070 Extent(int l0, int r0);
00072 Extent(int width);
00073
00075 void extend(int deltaL, int deltaR);
00077 void move(int delta);
00078 };
00079
00081 class Shape {
00082 private:
00084 int _depth;
00086 Extent shape[1];
00088 Shape(const Shape&);
00090 Shape& operator =(const Shape&);
00092 Shape(void);
00093 public:
00095 static Shape* allocate(int d);
00097 static Shape* allocate(Extent e);
00099 static Shape* allocate(Extent e, const Shape* subShape);
00101 static Shape* allocate(const Shape* subShape);
00102
00103 static void deallocate(Shape*);
00104
00106 static Shape* leaf;
00108 static Shape* hidden;
00109
00111 int depth(void) const;
00113 const Extent& operator [](int i) const;
00115 Extent& operator [](int i);
00117 bool getExtentAtDepth(int depth, Extent& extent);
00119 BoundingBox getBoundingBox(void);
00120 };
00121
00123 class VisualNode : public SpaceNode {
00124 protected:
00126 enum VisualNodeFlags {
00127 DIRTY = SpaceNode::LASTBIT+1,
00128 CHILDRENLAYOUTDONE,
00129 HIDDEN,
00130 MARKED,
00131 ONPATH,
00132 BOOKMARKED
00133 };
00134
00136 Shape* shape;
00138 int offset;
00140 BoundingBox box;
00142 bool containsCoordinateAtDepth(int x, int depth);
00143 public:
00145 VisualNode(void);
00147 VisualNode(Space* root);
00149 ~VisualNode(void);
00150
00152 bool isHidden(void);
00154 void setHidden(bool h);
00156 void setStop(bool h);
00158 void dirtyUp(void);
00160 void layout(void);
00162 int getOffset(void);
00164 void setOffset(int n);
00166 bool isDirty(void);
00168 void setDirty(bool d);
00170 bool childrenLayoutIsDone(void);
00172 void setChildrenLayoutDone(bool d);
00174 bool isMarked(void);
00176 void setMarked(bool m);
00178 bool isBookmarked(void);
00180 void setBookmarked(bool m);
00182 void pathUp(void);
00184 void unPathUp(void);
00186 bool isOnPath(void);
00188 int getPathAlternative(void);
00190 void setOnPath(bool onPath0);
00191
00193 void toggleHidden(void);
00195 void hideFailed(void);
00197 void unhideAll(void);
00199 void toggleStop(void);
00201 void unstopAll(void);
00202
00204 Shape* getShape(void);
00206 void setShape(Shape* s);
00208 void computeShape(VisualNode* root);
00210 void setBoundingBox(BoundingBox b);
00212 BoundingBox getBoundingBox(void);
00214 void changedStatus();
00216 VisualNode* getParent(void);
00218 VisualNode* getChild(int i);
00220 VisualNode* findNode(int x, int y);
00221
00223 std::string toolTip(BestNode* curBest, int c_d, int a_d);
00224
00226 size_t size(void) const;
00227 };
00228
00229 }}
00230
00231 #include <gecode/gist/visualnode.hpp>
00232
00233 #endif
00234
00235