\doxysection{GLWidget.\+hpp}
\hypertarget{GLWidget_8hpp_source}{}\label{GLWidget_8hpp_source}\index{/home/chr/devel/PhD/Environment/pub/PCBEnv/pcbenv/cxx/UI/GLWidget.hpp@{/home/chr/devel/PhD/Environment/pub/PCBEnv/pcbenv/cxx/UI/GLWidget.hpp}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ }
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#ifndef\ GYM\_PCB\_UI\_GLWIDGET\_H}}
\DoxyCodeLine{00003\ \textcolor{preprocessor}{\#define\ GYM\_PCB\_UI\_GLWIDGET\_H}}
\DoxyCodeLine{00004\ }
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ "{}Py.hpp"{}}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include\ <QOpenGLWidget>}}
\DoxyCodeLine{00007\ \textcolor{preprocessor}{\#include\ <QOpenGLFunctions\_4\_3\_Core>}}
\DoxyCodeLine{00008\ \textcolor{preprocessor}{\#include\ <QPainter>}}
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <QElapsedTimer>}}
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#include\ "{}Camera.hpp"{}}}
\DoxyCodeLine{00011\ \textcolor{preprocessor}{\#include\ "{}Shaders.hpp"{}}}
\DoxyCodeLine{00012\ \textcolor{preprocessor}{\#include\ <set>}}
\DoxyCodeLine{00013\ }
\DoxyCodeLine{00014\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classObject}{Object}};}
\DoxyCodeLine{00015\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classComponent}{Component}};}
\DoxyCodeLine{00016\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classPin}{Pin}};}
\DoxyCodeLine{00017\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classNet}{Net}};}
\DoxyCodeLine{00018\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classPCBoard}{PCBoard}};}
\DoxyCodeLine{00019\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classPCBoardMesh}{PCBoardMesh}};}
\DoxyCodeLine{00020\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classNavMesh}{NavMesh}};}
\DoxyCodeLine{00021\ \textcolor{keyword}{namespace\ }ui\ \{}
\DoxyCodeLine{00022\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classui_1_1NavGrid}{NavGrid}};}
\DoxyCodeLine{00023\ \}\ \textcolor{comment}{//\ namespace\ ui}}
\DoxyCodeLine{00024\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classRatsNest}{RatsNest}};}
\DoxyCodeLine{00025\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classRoutePainter}{RoutePainter}};}
\DoxyCodeLine{00026\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classRoutePainterLines}{RoutePainterLines}};}
\DoxyCodeLine{00027\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classTriList}{TriList}};}
\DoxyCodeLine{00028\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classViaPainter}{ViaPainter}};}
\DoxyCodeLine{00029\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classUIApplication}{UIApplication}};}
\DoxyCodeLine{00030\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classUIActions}{UIActions}};}
\DoxyCodeLine{00031\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classWindow}{Window}};}
\DoxyCodeLine{00032\ }
\DoxyCodeLine{00033\ \textcolor{keyword}{class\ }GLWidget\ :\ \textcolor{keyword}{public}\ QOpenGLWidget,\ \textcolor{keyword}{public}\ QOpenGLFunctions\_4\_3\_Core}
\DoxyCodeLine{00034\ \{}
\DoxyCodeLine{00035\ \ \ \ \ Q\_OBJECT}
\DoxyCodeLine{00036\ }
\DoxyCodeLine{00037\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00038\ \ \ \ \ GLWidget(\mbox{\hyperlink{classWindow}{Window}}\ *parent,\ \mbox{\hyperlink{classUIActions}{UIActions}}\ *A);}
\DoxyCodeLine{00039\ \ \ \ \ \string~GLWidget();}
\DoxyCodeLine{00040\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00041\ \ \ \ \ \textcolor{keyword}{static}\ GLWidget\ *createInstance(\mbox{\hyperlink{classWindow}{Window}}\ *,\ \mbox{\hyperlink{classUIActions}{UIActions}}\ *);}
\DoxyCodeLine{00042\ \ \ \ \ \textcolor{keyword}{static}\ \textcolor{keywordtype}{void}\ deleteInstance();}
\DoxyCodeLine{00043\ \ \ \ \ \textcolor{keyword}{static}\ GLWidget\ *getInstance()\ \{\ \textcolor{keywordflow}{return}\ sInstance;\ \}}
\DoxyCodeLine{00044\ }
\DoxyCodeLine{00045\ \ \ \ \ \mbox{\hyperlink{classPCBoard}{PCBoard}}\ *getPCB()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mPCB.get();\ \}}
\DoxyCodeLine{00046\ }
\DoxyCodeLine{00047\ \ \ \ \ \textcolor{keywordtype}{void}\ setPCB(\textcolor{keyword}{const}\ std::shared\_ptr<PCBoard>\&);}
\DoxyCodeLine{00048\ \ \ \ \ \textcolor{keywordtype}{void}\ setBottomView(\textcolor{keywordtype}{bool}\ b);}
\DoxyCodeLine{00049\ \ \ \ \ \textcolor{keywordtype}{void}\ setLayerAlpha(\textcolor{keywordtype}{int}\ z,\ \textcolor{keywordtype}{float}\ a);}
\DoxyCodeLine{00050\ }
\DoxyCodeLine{00051\ \ \ \ \ \textcolor{keywordtype}{void}\ scheduleSnapshot(\textcolor{keyword}{const}\ std::string\ \&savePath)\ \{\ mSnapshotSavePath\ =\ savePath;\ \}}
\DoxyCodeLine{00052\ }
\DoxyCodeLine{00053\ \ \ \ \ \textcolor{keywordtype}{bool}\ areFootprintsShown()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mShowFootprints;\ \}}
\DoxyCodeLine{00054\ \ \ \ \ \textcolor{keywordtype}{bool}\ areGridLinesShown()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mShowGridLines;\ \}}
\DoxyCodeLine{00055\ \ \ \ \ \textcolor{keywordtype}{bool}\ areGridPointsShown()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mShowGridPoints;\ \}}
\DoxyCodeLine{00056\ \ \ \ \ \textcolor{keywordtype}{bool}\ isRatsNestShown()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mShowRatsNest;\ \}}
\DoxyCodeLine{00057\ \ \ \ \ \textcolor{keywordtype}{bool}\ isTriangulationShown()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mShowTriangulation;\ \}}
\DoxyCodeLine{00058\ \ \ \ \ \textcolor{keywordtype}{bool}\ isRatsNestLimited()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mLimitRatsNest;\ \}}
\DoxyCodeLine{00059\ }
\DoxyCodeLine{00060\ \ \ \ \ \textcolor{keywordtype}{void}\ onKeyRelease(QKeyEvent\ *);}
\DoxyCodeLine{00061\ \textcolor{keyword}{public}\ slots:}
\DoxyCodeLine{00062\ \ \ \ \ \textcolor{keywordtype}{void}\ animate();}
\DoxyCodeLine{00063\ \ \ \ \ \textcolor{keywordtype}{void}\ resetZoom();}
\DoxyCodeLine{00064\ \ \ \ \ \textcolor{keywordtype}{void}\ focusOn(\textcolor{keyword}{const}\ \mbox{\hyperlink{classObject}{Object}}\&);}
\DoxyCodeLine{00065\ \ \ \ \ \textcolor{keywordtype}{void}\ showFootprints(\textcolor{keywordtype}{bool}\ b)\ \{\ mShowFootprints\ =\ b;\ \}}
\DoxyCodeLine{00066\ \ \ \ \ \textcolor{keywordtype}{void}\ showGridLines(\textcolor{keywordtype}{bool}\ b)\ \{\ mShowGridLines\ =\ b;\ \}}
\DoxyCodeLine{00067\ \ \ \ \ \textcolor{keywordtype}{void}\ showGridPoints(\textcolor{keywordtype}{bool}\ b);}
\DoxyCodeLine{00068\ \ \ \ \ \textcolor{keywordtype}{void}\ showRatsNest(\textcolor{keywordtype}{bool}\ b)\ \{\ mShowRatsNest\ =\ b;\ \}}
\DoxyCodeLine{00069\ \ \ \ \ \textcolor{keywordtype}{void}\ showTriangulation(\textcolor{keywordtype}{bool}\ b)\ \{\ mShowTriangulation\ =\ b;\ \}}
\DoxyCodeLine{00070\ \ \ \ \ \textcolor{keywordtype}{void}\ showGridAStar(\textcolor{keywordtype}{bool}\ b);}
\DoxyCodeLine{00071\ \ \ \ \ \textcolor{keywordtype}{void}\ setLimitRatsNest(\textcolor{keywordtype}{bool}\ b);}
\DoxyCodeLine{00072\ }
\DoxyCodeLine{00073\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00074\ \ \ \ \ \textcolor{keywordtype}{void}\ initializeGL()\ \textcolor{keyword}{override};}
\DoxyCodeLine{00075\ }
\DoxyCodeLine{00076\ \ \ \ \ \textcolor{keywordtype}{void}\ paintEvent(QPaintEvent\ *)\ \textcolor{keyword}{override};}
\DoxyCodeLine{00077\ \ \ \ \ \textcolor{keywordtype}{void}\ paintGL()\ \textcolor{keyword}{override};}
\DoxyCodeLine{00078\ \ \ \ \ \textcolor{keywordtype}{void}\ paintQt(QPainter\ *,\ QPaintEvent\ *);}
\DoxyCodeLine{00079\ }
\DoxyCodeLine{00080\ \ \ \ \ \textcolor{keywordtype}{void}\ resizeEvent(QResizeEvent\ *)\ \textcolor{keyword}{override};}
\DoxyCodeLine{00081\ \ \ \ \ \textcolor{keywordtype}{void}\ mouseMoveEvent(QMouseEvent\ *)\ \textcolor{keyword}{override};}
\DoxyCodeLine{00082\ \ \ \ \ \textcolor{keywordtype}{void}\ mousePressEvent(QMouseEvent\ *)\ \textcolor{keyword}{override};}
\DoxyCodeLine{00083\ \ \ \ \ \textcolor{keywordtype}{void}\ mouseReleaseEvent(QMouseEvent\ *)\ \textcolor{keyword}{override};}
\DoxyCodeLine{00084\ \ \ \ \ \textcolor{keywordtype}{void}\ wheelEvent(QWheelEvent\ *)\ \textcolor{keyword}{override};}
\DoxyCodeLine{00085\ }
\DoxyCodeLine{00086\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00087\ \ \ \ \ \textcolor{keywordtype}{float}\ m\_dt;}
\DoxyCodeLine{00088\ \ \ \ \ \textcolor{keywordtype}{float}\ m\_FPS\{0\};}
\DoxyCodeLine{00089\ \ \ \ \ QElapsedTimer\ mFrameTimer;}
\DoxyCodeLine{00090\ }
\DoxyCodeLine{00091\ \ \ \ \ \mbox{\hyperlink{classCamera}{Camera}}\ mCamera;}
\DoxyCodeLine{00092\ }
\DoxyCodeLine{00093\ \ \ \ \ uint32\_t\ mDirty\{0\};}
\DoxyCodeLine{00094\ \ \ \ \ uint32\_t\ ackDirtyMask()\ \{\ \textcolor{keyword}{auto}\ m\ =\ mDirty;\ mDirty\ =\ 0;\ \textcolor{keywordflow}{return}\ m;\ \}}
\DoxyCodeLine{00095\ }
\DoxyCodeLine{00096\ \ \ \ \ std::shared\_ptr<PCBoard>\ mPCB;}
\DoxyCodeLine{00097\ \ \ \ \ \mbox{\hyperlink{classShaders}{Shaders}}\ mShaderCache;}
\DoxyCodeLine{00098\ \ \ \ \ std::unique\_ptr<NavMesh>\ mNavMesh;}
\DoxyCodeLine{00099\ \ \ \ \ std::unique\_ptr<ui::NavGrid>\ mNavGrid;}
\DoxyCodeLine{00100\ \ \ \ \ std::unique\_ptr<PCBoardMesh>\ mBoardMain[2];}
\DoxyCodeLine{00101\ \ \ \ \ std::unique\_ptr<PCBoardMesh>\ mBoardPins[2];}
\DoxyCodeLine{00102\ \ \ \ \ std::unique\_ptr<RatsNest>\ mRatsNest;}
\DoxyCodeLine{00103\ \ \ \ \ std::unique\_ptr<RoutePainter>\ mRoutePainter;}
\DoxyCodeLine{00104\ \ \ \ \ std::unique\_ptr<RoutePainter>\ mRoutePainterPreview;}
\DoxyCodeLine{00105\ \ \ \ \ std::unique\_ptr<RoutePainterLines>\ mRoutePainterLines;}
\DoxyCodeLine{00106\ \ \ \ \ std::unique\_ptr<TriList>\ mTriList;}
\DoxyCodeLine{00107\ \ \ \ \ std::unique\_ptr<ViaPainter>\ mViaPainter;}
\DoxyCodeLine{00108\ \ \ \ \ std::unique\_ptr<ViaPainter>\ mViaPainterPreview;}
\DoxyCodeLine{00109\ \ \ \ \ \textcolor{keywordtype}{void}\ resetSceneNodes();}
\DoxyCodeLine{00110\ }
\DoxyCodeLine{00111\ \ \ \ \ uint\ mViewLayer\{0\};}
\DoxyCodeLine{00112\ \ \ \ \ \textcolor{keywordtype}{bool}\ mShowGridPoints\{\textcolor{keyword}{true}\};}
\DoxyCodeLine{00113\ \ \ \ \ \textcolor{keywordtype}{bool}\ mShowGridAStar\{\textcolor{keyword}{false}\};}
\DoxyCodeLine{00114\ \ \ \ \ \textcolor{keywordtype}{bool}\ mShowGridLines\{\textcolor{keyword}{true}\};}
\DoxyCodeLine{00115\ \ \ \ \ \textcolor{keywordtype}{bool}\ mShowFootprints\{\textcolor{keyword}{true}\};}
\DoxyCodeLine{00116\ \ \ \ \ \textcolor{keywordtype}{bool}\ mShowRatsNest\{\textcolor{keyword}{true}\};}
\DoxyCodeLine{00117\ \ \ \ \ \textcolor{keywordtype}{bool}\ mShowTriangulation\{\textcolor{keyword}{true}\};}
\DoxyCodeLine{00118\ \ \ \ \ \textcolor{keywordtype}{bool}\ mBottomView\{\textcolor{keyword}{false}\};}
\DoxyCodeLine{00119\ \ \ \ \ \textcolor{keywordtype}{bool}\ mLimitRatsNest\{\textcolor{keyword}{false}\};}
\DoxyCodeLine{00120\ }
\DoxyCodeLine{00121\ \ \ \ \ \textcolor{keywordtype}{float}\ mFootprintFillAlphaBase\{0.2f\};}
\DoxyCodeLine{00122\ \ \ \ \ \textcolor{keywordtype}{float}\ mFootprintLineAlphaBase\{1.0f\};}
\DoxyCodeLine{00123\ \ \ \ \ \textcolor{keywordtype}{float}\ mPinFillAlphaBase\{0.7f\};}
\DoxyCodeLine{00124\ \ \ \ \ \textcolor{keywordtype}{float}\ mPinLineAlphaBase\{0.0f\};}
\DoxyCodeLine{00125\ }
\DoxyCodeLine{00126\ \ \ \ \ \textcolor{keyword}{struct\ }\{}
\DoxyCodeLine{00127\ \ \ \ \ \ \ \ \ QPoint\ pos;}
\DoxyCodeLine{00128\ \ \ \ \ \ \ \ \ QPoint\ posDown;}
\DoxyCodeLine{00129\ \ \ \ \ \}\ mMouse;}
\DoxyCodeLine{00130\ \ \ \ \ QPointF\ getNormalizedCursorPos()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00131\ \ \ \ \ QPointF\ normalizedPos(\textcolor{keyword}{const}\ QPoint\&)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00132\ \ \ \ \ QPoint\ pixelPos(\textcolor{keyword}{const}\ QPointF\&)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00133\ \ \ \ \ QPoint\ worldPosToPixels(\textcolor{keyword}{const}\ Point\_2\&)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00134\ \ \ \ \ Point\_2\ pixelsToWorldPos(QPoint)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00135\ }
\DoxyCodeLine{00136\ \ \ \ \ \textcolor{keyword}{struct\ }Selection\ \{}
\DoxyCodeLine{00137\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ add(\mbox{\hyperlink{classObject}{Object}}\ *);}
\DoxyCodeLine{00138\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ clearObjects();}
\DoxyCodeLine{00139\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ clear();}
\DoxyCodeLine{00140\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ setHover(\mbox{\hyperlink{classComponent}{Component}}\ *,\ \textcolor{keywordtype}{bool}\ select);}
\DoxyCodeLine{00141\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ setHover(\mbox{\hyperlink{classPin}{Pin}}\ *);}
\DoxyCodeLine{00142\ \ \ \ \ \ \ \ \ QRect\ rect;}
\DoxyCodeLine{00143\ \ \ \ \ \ \ \ \ std::set<Object\ *>\ objects;}
\DoxyCodeLine{00144\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }\{}
\DoxyCodeLine{00145\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classComponent}{Component}}\ *C\{0\};}
\DoxyCodeLine{00146\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classPin}{Pin}}\ *P\{0\};}
\DoxyCodeLine{00147\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classNet}{Net}}\ *N\{0\};}
\DoxyCodeLine{00148\ \ \ \ \ \ \ \ \ \}\ hover;}
\DoxyCodeLine{00149\ \ \ \ \ \}\ mSelection;}
\DoxyCodeLine{00150\ \ \ \ \ uint\ getFirstLayerForSelection()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00151\ \ \ \ \ \mbox{\hyperlink{classObject}{Object}}\ *selectAt(\textcolor{keyword}{const}\ Point\_2\&)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00152\ \ \ \ \ \textcolor{keywordtype}{void}\ updateHoverSelection();}
\DoxyCodeLine{00153\ \ \ \ \ \textcolor{keywordtype}{void}\ updateRectangleSelection(\textcolor{keywordtype}{bool}\ append);}
\DoxyCodeLine{00154\ \ \ \ \ \textcolor{keywordtype}{void}\ clearRectangleSelection();}
\DoxyCodeLine{00155\ }
\DoxyCodeLine{00156\ \ \ \ \ \mbox{\hyperlink{classUIActions}{UIActions}}\ *\textcolor{keyword}{const}\ mActions;}
\DoxyCodeLine{00157\ }
\DoxyCodeLine{00158\ \ \ \ \ \textcolor{keywordtype}{void}\ drawInfo(QPainter\ *);}
\DoxyCodeLine{00159\ \ \ \ \ \textcolor{keywordtype}{void}\ drawCosts(QPainter\ *);}
\DoxyCodeLine{00160\ \ \ \ \ \textcolor{keywordtype}{void}\ highlightSelected(QPainter\&);}
\DoxyCodeLine{00161\ }
\DoxyCodeLine{00162\ \ \ \ \ \textcolor{keywordtype}{void}\ saveSnapshot();}
\DoxyCodeLine{00163\ \ \ \ \ std::string\ mSnapshotSavePath;}
\DoxyCodeLine{00164\ }
\DoxyCodeLine{00165\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00166\ \ \ \ \ \textcolor{keyword}{static}\ GLWidget\ *sInstance;}
\DoxyCodeLine{00167\ \};}
\DoxyCodeLine{00168\ }
\DoxyCodeLine{00169\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ GYM\_PCB\_UI\_GLWIDGET\_H}}

\end{DoxyCode}
