\doxysection{Nav\+Image.\+hpp}
\hypertarget{NavImage_8hpp_source}{}\label{NavImage_8hpp_source}\index{/home/chr/devel/PhD/Environment/pub/PCBEnv/pcbenv/cxx/NavImage.hpp@{/home/chr/devel/PhD/Environment/pub/PCBEnv/pcbenv/cxx/NavImage.hpp}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#ifndef\ GYM\_PCB\_NAVIMAGE}}
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#define\ GYM\_PCB\_NAVIMAGE}}
\DoxyCodeLine{00003\ }
\DoxyCodeLine{00005\ }
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include\ "{}Rasterizer.hpp"{}}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classPCBoard}{PCBoard}};}
\DoxyCodeLine{00009\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classNavGrid}{NavGrid}};}
\DoxyCodeLine{00010\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classNavPoint}{NavPoint}};}
\DoxyCodeLine{00011\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classPin}{Pin}};}
\DoxyCodeLine{00012\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classConnection}{Connection}};}
\DoxyCodeLine{00013\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classTrack}{Track}};}
\DoxyCodeLine{00014\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classVia}{Via}};}
\DoxyCodeLine{00015\ }
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#define\ NAV\_IMAGE\_NUM\_CHANS\ 8}}
\DoxyCodeLine{00017\ }
\DoxyCodeLine{00018\ \textcolor{preprocessor}{\#define\ NAV\_IMAGE\_CHAN\_TRACK\_T\ \ \ \ 0}}
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#define\ NAV\_IMAGE\_CHAN\_TRACK\_B\ \ \ \ 3}}
\DoxyCodeLine{00020\ \textcolor{preprocessor}{\#define\ NAV\_IMAGE\_CHAN\_TRACK\_M\ \ \ \ 6}}
\DoxyCodeLine{00021\ \textcolor{preprocessor}{\#define\ NAV\_IMAGE\_CHAN\_PIN\_T\ \ \ \ \ \ 1}}
\DoxyCodeLine{00022\ \textcolor{preprocessor}{\#define\ NAV\_IMAGE\_CHAN\_PIN\_B\ \ \ \ \ \ 4}}
\DoxyCodeLine{00023\ \textcolor{preprocessor}{\#define\ NAV\_IMAGE\_CHAN\_RATSNEST\_T\ 2}}
\DoxyCodeLine{00024\ \textcolor{preprocessor}{\#define\ NAV\_IMAGE\_CHAN\_RATSNEST\_B\ 5}}
\DoxyCodeLine{00025\ \textcolor{preprocessor}{\#define\ NAV\_IMAGE\_CHAN\_VIA\ \ \ \ \ \ \ \ 7}}
\DoxyCodeLine{00026\ }
\DoxyCodeLine{00032\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ chan\_t>\ \textcolor{keyword}{struct\ }\mbox{\hyperlink{structNavPixel}{NavPixel}}}
\DoxyCodeLine{00033\ \{}
\DoxyCodeLine{00034\ \ \ \ \ chan\_t\ Chan[NAV\_IMAGE\_NUM\_CHANS];}
\DoxyCodeLine{00035\ \ \ \ \ \textcolor{keywordtype}{void}\ setFloat(\textcolor{keyword}{const}\ \mbox{\hyperlink{structNavPixel}{NavPixel<float>}}\&,\ \textcolor{keywordtype}{float}\ coverage);}
\DoxyCodeLine{00036\ \ \ \ \ \textcolor{keywordtype}{void}\ addPoint(\textcolor{keyword}{const}\ \mbox{\hyperlink{classNavPoint}{NavPoint}}\&,\ \textcolor{keywordtype}{char}\ z,\ chan\_t\ vTB,\ chan\_t\ vM);}
\DoxyCodeLine{00037\ \ \ \ \ \textcolor{keywordtype}{void}\ addPin(\textcolor{keywordtype}{char}\ z,\ chan\_t);}
\DoxyCodeLine{00038\ \ \ \ \ \textcolor{keywordtype}{void}\ addRatsNest(\textcolor{keywordtype}{char}\ z,\ chan\_t);}
\DoxyCodeLine{00039\ \ \ \ \ \textcolor{keywordtype}{void}\ addTrack(\textcolor{keywordtype}{char}\ z,\ chan\_t\ vTB,\ chan\_t\ vM);}
\DoxyCodeLine{00040\ \ \ \ \ \textcolor{keywordtype}{void}\ addVia(chan\_t);}
\DoxyCodeLine{00041\ \ \ \ \ \textcolor{keywordtype}{void}\ zero();}
\DoxyCodeLine{00042\ \ \ \ \ \textcolor{keywordtype}{bool}\ isNonzero()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00043\ \};}
\DoxyCodeLine{00044\ }
\DoxyCodeLine{00047\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ chan\_t>\ \textcolor{keyword}{class\ }NavImage\ :\ \textcolor{keyword}{public}\ UniformGrid25}
\DoxyCodeLine{00048\ \{}
\DoxyCodeLine{00049\ \ \ \ \ \textcolor{keyword}{constexpr}\ \textcolor{keyword}{static}\ \textcolor{keyword}{const}\ chan\_t\ FullCoverage\ =\ std::is\_same\_v<chan\_t,\ float>\ ?\ 1\ :\ 144;}
\DoxyCodeLine{00050\ \textcolor{keyword}{public}:}
\DoxyCodeLine{00051\ \ \ \ \ NavImage(\textcolor{keyword}{const}\ NavImage<chan\_t>\&);}
\DoxyCodeLine{00052\ \ \ \ \ NavImage(\textcolor{keyword}{const}\ \mbox{\hyperlink{classNavGrid}{NavGrid}}\&);}
\DoxyCodeLine{00053\ \ \ \ \ NavImage(uint\ w,\ uint\ h,\ \textcolor{keyword}{const}\ Bbox\_2\&,\ uint\ numLayers);}
\DoxyCodeLine{00054\ \ \ \ \ \string~NavImage();}
\DoxyCodeLine{00055\ \ \ \ \ \textcolor{keywordtype}{size\_t}\ sizeInBytes()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ getNumPoints2D()\ *\ \textcolor{keyword}{sizeof}(\mbox{\hyperlink{structNavPixel}{NavPixel<chan\_t>}});\ \}}
\DoxyCodeLine{00056\ \ \ \ \ \textcolor{keywordtype}{int}\ checkFit(\textcolor{keyword}{const}\ UniformGrid25\&)\ \textcolor{keyword}{const};\ \textcolor{comment}{//\ -\/1/0/1\ for\ </=/>}}
\DoxyCodeLine{00057\ }
\DoxyCodeLine{00058\ \ \ \ \ \mbox{\hyperlink{structNavPixel}{NavPixel<chan\_t>}}\&\ at(uint\ i)\ \{\ \textcolor{keywordflow}{return}\ mData[i];\ \}}
\DoxyCodeLine{00059\ \ \ \ \ \mbox{\hyperlink{structNavPixel}{NavPixel<chan\_t>}}\&\ at(uint\ x,\ uint\ y)\ \{\ \textcolor{keywordflow}{return}\ mData[y\ *\ mSize[0]\ +\ x];\ \}}
\DoxyCodeLine{00060\ \ \ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{structNavPixel}{NavPixel<chan\_t>}}\&\ at(uint\ x,\ uint\ y)\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ mData[y\ *\ mSize[0]\ +\ x];\ \}}
\DoxyCodeLine{00061\ }
\DoxyCodeLine{00063\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classNavImage_a09fa4f3313f80e9f8a2fc589aa069450}{draw1To1}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classNavGrid}{NavGrid}}\&);}
\DoxyCodeLine{00064\ \ \ \ \ \textcolor{keywordtype}{void}\ drawDownscale(\textcolor{keyword}{const}\ \mbox{\hyperlink{classNavGrid}{NavGrid}}\&);}
\DoxyCodeLine{00065\ \ \ \ \ \textcolor{keywordtype}{void}\ drawStatic(\textcolor{keyword}{const}\ \mbox{\hyperlink{classPCBoard}{PCBoard}}\&);}
\DoxyCodeLine{00066\ \ \ \ \ \textcolor{keywordtype}{void}\ drawDynamic(\textcolor{keyword}{const}\ \mbox{\hyperlink{classPCBoard}{PCBoard}}\&);}
\DoxyCodeLine{00067\ \ \ \ \ \textcolor{keywordtype}{void}\ drawRatsNest(\textcolor{keyword}{const}\ \mbox{\hyperlink{classPCBoard}{PCBoard}}\&,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{bool}\ all);}
\DoxyCodeLine{00068\ \ \ \ \ \textcolor{keywordtype}{void}\ draw(\textcolor{keyword}{const}\ \mbox{\hyperlink{classPin}{Pin}}\&);}
\DoxyCodeLine{00069\ \ \ \ \ \textcolor{keywordtype}{void}\ draw(\textcolor{keyword}{const}\ \mbox{\hyperlink{classConnection}{Connection}}\&);}
\DoxyCodeLine{00070\ \ \ \ \ \textcolor{keywordtype}{void}\ draw(\textcolor{keyword}{const}\ \mbox{\hyperlink{classTrack}{Track}}\&);}
\DoxyCodeLine{00071\ \ \ \ \ \textcolor{keywordtype}{void}\ drawRatsNest(\textcolor{keyword}{const}\ \mbox{\hyperlink{classConnection}{Connection}}\&);}
\DoxyCodeLine{00072\ }
\DoxyCodeLine{00073\ \ \ \ \ \textcolor{keyword}{static}\ chan\_t\ getLayerMCoverage(uint\ d);}
\DoxyCodeLine{00074\ }
\DoxyCodeLine{00075\ \ \ \ \ PyObject\ *movePy();\ \textcolor{comment}{//\ transfers\ ownership\ of\ mData\ to\ PyObject}}
\DoxyCodeLine{00076\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00077\ \ \ \ \ \mbox{\hyperlink{structNavPixel}{NavPixel<chan\_t>}}\ *mData;}
\DoxyCodeLine{00078\ \ \ \ \ uint\ mLayerB;}
\DoxyCodeLine{00079\ \ \ \ \ chan\_t\ mLayerMCoverage;\ \textcolor{comment}{//\ e.g.\ (1\ /\ number\ of\ inner\ layers)}}
\DoxyCodeLine{00080\ }
\DoxyCodeLine{00081\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00082\ \ \ \ \ \textcolor{keywordtype}{void}\ allocate();}
\DoxyCodeLine{00083\ \ \ \ \ \textcolor{keywordtype}{char}\ ZLabel(uint\ z)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00084\ }
\DoxyCodeLine{00085\ \ \ \ \ \textcolor{keyword}{static}\ Real\ computeEdgeLen(uint\ w,\ uint\ h,\ \textcolor{keyword}{const}\ Bbox\_2\&);}
\DoxyCodeLine{00086\ }
\DoxyCodeLine{00087\ \ \ \ \ \textcolor{keywordtype}{void}\ draw(\textcolor{keyword}{const}\ \mbox{\hyperlink{classVia}{Via}}\&);}
\DoxyCodeLine{00088\ \ \ \ \ \textcolor{keywordtype}{void}\ drawCopper(\textcolor{keyword}{const}\ \mbox{\hyperlink{classSegment__25}{Segment\_25}}\&);}
\DoxyCodeLine{00089\ \};}
\DoxyCodeLine{00090\ }
\DoxyCodeLine{00091\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ GYM\_PCB\_NAVIMAGE}}

\end{DoxyCode}
