Generated on Tue Apr 18 10:21:46 2017 for Gecode by doxygen 1.6.3

qtgist.hh

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Guido Tack <tack@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Guido Tack, 2006
00008  *
00009  *  Last modified:
00010  *     $Date: 2013-05-06 09:02:17 +0200 (Mon, 06 May 2013) $ by $Author: tack $
00011  *     $Revision: 13613 $
00012  *
00013  *  This file is part of Gecode, the generic constraint
00014  *  development environment:
00015  *     http://www.gecode.org
00016  *
00017  * Permission is hereby granted, free of charge, to any person obtaining
00018  * a copy of this software and associated documentation files (the
00019  * "Software"), to deal in the Software without restriction, including
00020  * without limitation the rights to use, copy, modify, merge, publish,
00021  * distribute, sublicense, and/or sell copies of the Software, and to
00022  * permit persons to whom the Software is furnished to do so, subject to
00023  * the following conditions:
00024  *
00025  * The above copyright notice and this permission notice shall be
00026  * included in all copies or substantial portions of the Software.
00027  *
00028  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00029  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00030  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00031  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00032  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00033  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00034  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00035  *
00036  */
00037 
00038 #ifndef GECODE_GIST_QTGIST_HH
00039 #define GECODE_GIST_QTGIST_HH
00040 
00041 #include <gecode/gist/treecanvas.hh>
00042 #include <gecode/gist/nodestats.hh>
00043 
00044 /*
00045  * Configure linking
00046  *
00047  */
00048 
00049 #if !defined(GIST_STATIC_LIBS) && \
00050     (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
00051 
00052 #ifdef GECODE_BUILD_GIST
00053 #define GECODE_GIST_EXPORT __declspec( dllexport )
00054 #else
00055 #define GECODE_GIST_EXPORT __declspec( dllimport )
00056 #endif
00057 
00058 #else
00059 
00060 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
00061 #define GECODE_GIST_EXPORT __attribute__ ((visibility("default")))
00062 #else
00063 #define GECODE_GIST_EXPORT
00064 #endif
00065 
00066 #endif
00067 
00068 // Configure auto-linking
00069 #ifndef GECODE_BUILD_GIST
00070 #define GECODE_LIBRARY_NAME "Gist"
00071 #include <gecode/support/auto-link.hpp>
00072 #endif
00073 
00074 namespace Gecode {  namespace Gist {
00075 
00085   class GECODE_GIST_EXPORT Gist : public QWidget {
00086     Q_OBJECT
00087   private:
00089     TreeCanvas* canvas;
00091     QSlider* timeBar;
00093     QMenu* contextMenu;
00095     QAction* nullSolutionInspector;
00097     QMenu* solutionInspectorMenu;
00099     QAction* nullDoubleClickInspector;
00101     QMenu* doubleClickInspectorMenu;
00103     QAction* nullMoveInspector;
00105     QMenu* moveInspectorMenu;
00107     QAction* nullComparator;
00109     QMenu* comparatorMenu;
00111     QAction* nullBookmark;
00113     QMenu* bookmarksMenu;
00115     QMenu* inspectNodeMenu;
00117     QMenu* inspectNodeBeforeFPMenu;
00119     NodeStatInspector* nodeStatInspector;
00120   public:
00122     QAction* inspect;
00124     QAction* inspectBeforeFP;
00126     QAction* stop;
00128     QAction* reset;
00130     QAction* navUp;
00132     QAction* navDown;
00134     QAction* navLeft;
00136     QAction* navRight;
00138     QAction* navRoot;
00140     QAction* navNextSol;
00142     QAction* navPrevSol;
00144     QAction* searchNext;
00146     QAction* searchAll;
00148     QAction* toggleHidden;
00150     QAction* hideFailed;
00152     QAction* unhideAll;
00154     QAction* labelBranches;
00156     QAction* labelPath;
00158     QAction* zoomToFit;
00160     QAction* center;
00162     QAction* exportPDF;
00164     QAction* exportWholeTreePDF;
00166     QAction* print;
00167 
00169     QAction* bookmarkNode;
00171     QAction* compareNode;
00173     QAction* compareNodeBeforeFP;
00175     QAction* setPath;
00177     QAction* inspectPath;
00179     QAction* showNodeStats;
00181     QAction* toggleStop;
00183     QAction* unstopAll;
00184 
00186     QActionGroup* solutionInspectorGroup;
00188     QActionGroup* doubleClickInspectorGroup;
00190     QActionGroup* moveInspectorGroup;
00192     QActionGroup* comparatorGroup;
00194     QActionGroup* bookmarksGroup;
00196     QActionGroup* inspectGroup;
00198     QActionGroup* inspectBeforeFPGroup;
00199   public:
00201     Gist(Space* root, bool bab, QWidget* parent, const Options& opt);
00203     ~Gist(void);
00204 
00206     void addDoubleClickInspector(Inspector* i0);
00208     void addSolutionInspector(Inspector* i0);
00210     void addMoveInspector(Inspector* i0);
00212     void addComparator(Comparator* c0);
00213 
00215     void setAutoHideFailed(bool b);
00217     void setAutoZoom(bool b);
00219     bool getAutoHideFailed(void);
00221     bool getAutoZoom(void);
00223     void setShowCopies(bool b);
00225     bool getShowCopies(void);
00226 
00228     void setRefresh(int i);
00230     void setRefreshPause(int i);
00232     bool getSmoothScrollAndZoom(void);
00234     void setSmoothScrollAndZoom(bool b);
00236     bool getMoveDuringSearch(void);
00238     void setMoveDuringSearch(bool b);
00239 
00241     void setRecompDistances(int c_d, int a_d);
00243     int getCd(void);
00245     int getAd(void);
00246 
00248     bool finish(void);
00249 
00251     void resizeEvent(QResizeEvent*);
00252 
00253   Q_SIGNALS:
00255     void statusChanged(const Statistics&, bool);
00256 
00258     void solution(const Space*);
00259 
00261     void searchFinished(void);
00262 
00263   private Q_SLOTS:
00265     void on_canvas_contextMenu(QContextMenuEvent*);
00267     void on_canvas_statusChanged(VisualNode*, const Statistics&, bool);
00269     void selectDoubleClickInspector(QAction*);
00271     void selectSolutionInspector(QAction*);
00273     void selectMoveInspector(QAction*);
00275     void selectComparator(QAction*);
00277     void selectBookmark(QAction*);
00279     void addBookmark(const QString& id);
00281     void removeBookmark(int idx);
00283     void populateInspectors(void);
00285     void populateBookmarksMenu(void);
00287     void showStats(void);
00289     void inspectWithAction(QAction* a);
00291     void inspectBeforeFPWithAction(QAction* a);
00292   protected:
00294     void addInspector(Inspector* i, QAction*& nas, QAction*& nad,
00295                       QAction*& nam);
00296   };
00297 
00298 }}
00299 
00300 #endif
00301 
00302 // STATISTICS: gist-any