\hypertarget{classJNIUserInterface}{
\subsection{JNIUserInterface Class Reference}
\label{classJNIUserInterface}\index{JNIUserInterface@{JNIUserInterface}}
}


3B User interface for the Java plugin.  


Inheritance diagram for JNIUserInterface:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=2.000000cm]{classJNIUserInterface}
\end{center}
\end{figure}
\subsubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{classJNIUserInterface_a388ebc4ee208397e54ebf264a14995e7}{JNIUserInterface} (JNIEnv $\ast$env\_\-, jobject jthis)
\item 
virtual void \hyperlink{classJNIUserInterface_aa207d69d5c423a10d39dfb70c9926d66}{per\_\-spot} (int iteration, int pass, int spot\_\-num, int total\_\-spots)
\item 
virtual void \hyperlink{classJNIUserInterface_a2843b91448c81ee316c959ec2533e03e}{per\_\-modification} (int iteration, int spot\_\-num, int total\_\-spots)
\item 
virtual void \hyperlink{classJNIUserInterface_a44380cbf1549abaa4c1c8d956e6f09d4}{per\_\-pass} (int, int, const std::vector$<$ TooN::Vector$<$ 4 $>$ $>$ \&spots)
\item 
virtual void \hyperlink{classJNIUserInterface_aa20f55438c9e697ee3ca15720ddf5ebf}{perhaps\_\-stop} ()
\item 
void \hyperlink{classJNIUserInterface_a1e846dd3733c547479f0fe813f0b2bb2}{send\_\-message} (const string \&s)
\item 
void \hyperlink{classJNIUserInterface_ae5aa1114409b67278acd1fd1a35dfeb2}{fatal} (const string \&s)
\end{DoxyCompactItemize}
\subsubsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
JNIEnv $\ast$ \hyperlink{classJNIUserInterface_a7b1e235aa33953ece4c3bbe7931732e2}{env}
\item 
jobject \hyperlink{classJNIUserInterface_a12f7bacafe0a41e850a1ca8000022dda}{ThreeBRunner\_\-this}
\item 
jmethodID \hyperlink{classJNIUserInterface_a75ec225b9a1ead262846ba6cc5172a42}{send\_\-message\_\-string}
\item 
jmethodID \hyperlink{classJNIUserInterface_af5033370560f571a6f8ccd230c1e88ac}{die}
\item 
jmethodID \hyperlink{classJNIUserInterface_abed4275803ff5165f1142c4a98f0348f}{should\_\-stop}
\item 
jmethodID \hyperlink{classJNIUserInterface_a72fef78d1d5c69b61408cc098a0d6cb4}{send\_\-new\_\-points}
\item 
int \hyperlink{classJNIUserInterface_a4887b5849b2641a6e56d4e2a0192e17d}{passes}
\end{DoxyCompactItemize}


\subsubsection{Detailed Description}
3B User interface for the Java plugin. 

This particular UI ferries various messages between Java and C++ via callbacks and polling. 

Definition at line 52 of file multispot5\_\-jni.cc.



\subsubsection{Constructor \& Destructor Documentation}
\hypertarget{classJNIUserInterface_a388ebc4ee208397e54ebf264a14995e7}{
\index{JNIUserInterface@{JNIUserInterface}!JNIUserInterface@{JNIUserInterface}}
\index{JNIUserInterface@{JNIUserInterface}!JNIUserInterface@{JNIUserInterface}}
\paragraph[{JNIUserInterface}]{\setlength{\rightskip}{0pt plus 5cm}JNIUserInterface::JNIUserInterface (
\begin{DoxyParamCaption}
\item[{JNIEnv $\ast$}]{env\_\-, }
\item[{jobject}]{jthis}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classJNIUserInterface_a388ebc4ee208397e54ebf264a14995e7}


Definition at line 64 of file multispot5\_\-jni.cc.


\begin{DoxyCode}
        :env(env_),ThreeBRunner_this(jthis)
        {
            jclass cls = env->GetObjectClass(jthis);
            
            send_message_string  = env->GetMethodID(cls, "send_message_string", "
      (Ljava/lang/String;)V");
            die  = env->GetMethodID(cls, "die", "(Ljava/lang/String;)V");

            should_stop  = env->GetMethodID(cls, "should_stop", "()Z");

            send_new_points = env->GetMethodID(cls, "send_new_points", "([F)V");

            passes = GV3::get<int>("main.passes");
        }
\end{DoxyCode}


\subsubsection{Member Function Documentation}
\hypertarget{classJNIUserInterface_aa207d69d5c423a10d39dfb70c9926d66}{
\index{JNIUserInterface@{JNIUserInterface}!per\_\-spot@{per\_\-spot}}
\index{per\_\-spot@{per\_\-spot}!JNIUserInterface@{JNIUserInterface}}
\paragraph[{per\_\-spot}]{\setlength{\rightskip}{0pt plus 5cm}virtual void JNIUserInterface::per\_\-spot (
\begin{DoxyParamCaption}
\item[{int}]{iteration, }
\item[{int}]{pass, }
\item[{int}]{spot\_\-num, }
\item[{int}]{total\_\-spots}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}
\label{classJNIUserInterface_aa207d69d5c423a10d39dfb70c9926d66}


This function is called once per spot in each pass. 

The idea is to provide a display along the lines of: Iteration \#1 optimizing \#2\% complete 
\begin{DoxyParams}{Parameters}
{\em iteration} & Iteration number \\
\hline
{\em pass} & Pass number \\
\hline
{\em spot\_\-num} & \hyperlink{classSpot}{Spot} currently being optimized \\
\hline
{\em total\_\-spots} & Total number of spots to be optimized \\
\hline
\end{DoxyParams}


Implements \hyperlink{classUserInterfaceCallback_acdbc412d8d05278d2e6c5cf12f21f576}{UserInterfaceCallback}.



Definition at line 80 of file multispot5\_\-jni.cc.


\begin{DoxyCode}
        {
            send_message(sPrintf("Iteration %i, optimizing  %4i%%", iteration*
      passes+pass, 100 *spot_num / total_spots));
        }
\end{DoxyCode}
\hypertarget{classJNIUserInterface_a2843b91448c81ee316c959ec2533e03e}{
\index{JNIUserInterface@{JNIUserInterface}!per\_\-modification@{per\_\-modification}}
\index{per\_\-modification@{per\_\-modification}!JNIUserInterface@{JNIUserInterface}}
\paragraph[{per\_\-modification}]{\setlength{\rightskip}{0pt plus 5cm}virtual void JNIUserInterface::per\_\-modification (
\begin{DoxyParamCaption}
\item[{int}]{iteration, }
\item[{int}]{spot\_\-num, }
\item[{int}]{total\_\-spots}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}
\label{classJNIUserInterface_a2843b91448c81ee316c959ec2533e03e}


This function is called once per spot in the modification phase. 

The idea is to provide a display along the lines of: Iteration \#1 modifying \#2\% complete 
\begin{DoxyParams}{Parameters}
{\em iteration} & Iteration number \\
\hline
{\em spot\_\-num} & \hyperlink{classSpot}{Spot} currently being optimized \\
\hline
{\em total\_\-spots} & Total number of spots to be optimized \\
\hline
\end{DoxyParams}


Implements \hyperlink{classUserInterfaceCallback_a8ed1388854c9c4253643453e24d0b5ba}{UserInterfaceCallback}.



Definition at line 85 of file multispot5\_\-jni.cc.


\begin{DoxyCode}
        {
            send_message(sPrintf("Iteration %i, modifying  %4i%%", iteration*
      passes+passes-1, 100 *spot_num / total_spots));
        }
\end{DoxyCode}
\hypertarget{classJNIUserInterface_a44380cbf1549abaa4c1c8d956e6f09d4}{
\index{JNIUserInterface@{JNIUserInterface}!per\_\-pass@{per\_\-pass}}
\index{per\_\-pass@{per\_\-pass}!JNIUserInterface@{JNIUserInterface}}
\paragraph[{per\_\-pass}]{\setlength{\rightskip}{0pt plus 5cm}virtual void JNIUserInterface::per\_\-pass (
\begin{DoxyParamCaption}
\item[{int}]{iteration, }
\item[{int}]{pass, }
\item[{const std::vector$<$ TooN::Vector$<$ 4 $>$ $>$ \&}]{spots}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}
\label{classJNIUserInterface_a44380cbf1549abaa4c1c8d956e6f09d4}


This function is called once each time PASS data is outputted. 

It will allow the GUI to build up a reconstruction. 
\begin{DoxyParams}{Parameters}
{\em iteration} & Iteration number \\
\hline
{\em pass} & Pass number \\
\hline
{\em spots} & Data to be reconstructed \\
\hline
\end{DoxyParams}


Implements \hyperlink{classUserInterfaceCallback_ad79f1257532d620c18b63ca3a542c293}{UserInterfaceCallback}.



Definition at line 90 of file multispot5\_\-jni.cc.


\begin{DoxyCode}
        {
            //Copy data into the correct format
            vector<jfloat> pts_data;
            for(unsigned int i=0; i < spots.size(); i++)
            {
                pts_data.push_back(spots[i][2]);
                pts_data.push_back(spots[i][3]);
            }
            
            //Allocate a java array and copy data into it
            jfloatArray pts = env->NewFloatArray(pts_data.size());
            env->SetFloatArrayRegion(pts, 0, pts_data.size(), pts_data.data());
            
            //Make the call...
            jvalue pts_obj;
            pts_obj.l = pts;

            env->CallVoidMethod(ThreeBRunner_this, send_new_points, pts_obj);
            
            //Free the object
            env->DeleteLocalRef(pts);
        }
\end{DoxyCode}
\hypertarget{classJNIUserInterface_aa20f55438c9e697ee3ca15720ddf5ebf}{
\index{JNIUserInterface@{JNIUserInterface}!perhaps\_\-stop@{perhaps\_\-stop}}
\index{perhaps\_\-stop@{perhaps\_\-stop}!JNIUserInterface@{JNIUserInterface}}
\paragraph[{perhaps\_\-stop}]{\setlength{\rightskip}{0pt plus 5cm}virtual void JNIUserInterface::perhaps\_\-stop (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, virtual\mbox{]}}}}
\label{classJNIUserInterface_aa20f55438c9e697ee3ca15720ddf5ebf}


The user wishes to issue a stop instruction to the program (perhaps done via an asynchronus call to an instance of of \hyperlink{classUserInterfaceCallback}{UserInterfaceCallback}). 

This function is called as often as possible and will throw UserIssuedStop when the condition is met. 

Implements \hyperlink{classUserInterfaceCallback_a484ac5257c238077bf8080bc1fd8eebb}{UserInterfaceCallback}.



Definition at line 114 of file multispot5\_\-jni.cc.


\begin{DoxyCode}
        {
            bool stop = env->CallBooleanMethod(ThreeBRunner_this, should_stop);
            if(stop)
                throw UserIssuedStop();
        }
\end{DoxyCode}
\hypertarget{classJNIUserInterface_a1e846dd3733c547479f0fe813f0b2bb2}{
\index{JNIUserInterface@{JNIUserInterface}!send\_\-message@{send\_\-message}}
\index{send\_\-message@{send\_\-message}!JNIUserInterface@{JNIUserInterface}}
\paragraph[{send\_\-message}]{\setlength{\rightskip}{0pt plus 5cm}void JNIUserInterface::send\_\-message (
\begin{DoxyParamCaption}
\item[{const string \&}]{s}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classJNIUserInterface_a1e846dd3733c547479f0fe813f0b2bb2}


Definition at line 122 of file multispot5\_\-jni.cc.



Referenced by Java\_\-ThreeBRunner\_\-call().


\begin{DoxyCode}
        {
            jvalue message_string;
            message_string.l = env->NewStringUTF(s.c_str());
            env->CallVoidMethod(ThreeBRunner_this, send_message_string, message_s
      tring);
            env->DeleteLocalRef(message_string.l);
        }
\end{DoxyCode}
\hypertarget{classJNIUserInterface_ae5aa1114409b67278acd1fd1a35dfeb2}{
\index{JNIUserInterface@{JNIUserInterface}!fatal@{fatal}}
\index{fatal@{fatal}!JNIUserInterface@{JNIUserInterface}}
\paragraph[{fatal}]{\setlength{\rightskip}{0pt plus 5cm}void JNIUserInterface::fatal (
\begin{DoxyParamCaption}
\item[{const string \&}]{s}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline\mbox{]}}}}
\label{classJNIUserInterface_ae5aa1114409b67278acd1fd1a35dfeb2}


Definition at line 130 of file multispot5\_\-jni.cc.



Referenced by Java\_\-ThreeBRunner\_\-call().


\begin{DoxyCode}
        {
            jvalue message_string;
            message_string.l = env->NewStringUTF(s.c_str());
            env->CallVoidMethod(ThreeBRunner_this, die, message_string);
            env->DeleteLocalRef(message_string.l);
        }
\end{DoxyCode}


\subsubsection{Member Data Documentation}
\hypertarget{classJNIUserInterface_a7b1e235aa33953ece4c3bbe7931732e2}{
\index{JNIUserInterface@{JNIUserInterface}!env@{env}}
\index{env@{env}!JNIUserInterface@{JNIUserInterface}}
\paragraph[{env}]{\setlength{\rightskip}{0pt plus 5cm}JNIEnv$\ast$ {\bf JNIUserInterface::env}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classJNIUserInterface_a7b1e235aa33953ece4c3bbe7931732e2}


Definition at line 55 of file multispot5\_\-jni.cc.

\hypertarget{classJNIUserInterface_a12f7bacafe0a41e850a1ca8000022dda}{
\index{JNIUserInterface@{JNIUserInterface}!ThreeBRunner\_\-this@{ThreeBRunner\_\-this}}
\index{ThreeBRunner\_\-this@{ThreeBRunner\_\-this}!JNIUserInterface@{JNIUserInterface}}
\paragraph[{ThreeBRunner\_\-this}]{\setlength{\rightskip}{0pt plus 5cm}jobject {\bf JNIUserInterface::ThreeBRunner\_\-this}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classJNIUserInterface_a12f7bacafe0a41e850a1ca8000022dda}


Definition at line 56 of file multispot5\_\-jni.cc.

\hypertarget{classJNIUserInterface_a75ec225b9a1ead262846ba6cc5172a42}{
\index{JNIUserInterface@{JNIUserInterface}!send\_\-message\_\-string@{send\_\-message\_\-string}}
\index{send\_\-message\_\-string@{send\_\-message\_\-string}!JNIUserInterface@{JNIUserInterface}}
\paragraph[{send\_\-message\_\-string}]{\setlength{\rightskip}{0pt plus 5cm}jmethodID {\bf JNIUserInterface::send\_\-message\_\-string}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classJNIUserInterface_a75ec225b9a1ead262846ba6cc5172a42}


Definition at line 57 of file multispot5\_\-jni.cc.

\hypertarget{classJNIUserInterface_af5033370560f571a6f8ccd230c1e88ac}{
\index{JNIUserInterface@{JNIUserInterface}!die@{die}}
\index{die@{die}!JNIUserInterface@{JNIUserInterface}}
\paragraph[{die}]{\setlength{\rightskip}{0pt plus 5cm}jmethodID {\bf JNIUserInterface::die}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classJNIUserInterface_af5033370560f571a6f8ccd230c1e88ac}


Definition at line 58 of file multispot5\_\-jni.cc.

\hypertarget{classJNIUserInterface_abed4275803ff5165f1142c4a98f0348f}{
\index{JNIUserInterface@{JNIUserInterface}!should\_\-stop@{should\_\-stop}}
\index{should\_\-stop@{should\_\-stop}!JNIUserInterface@{JNIUserInterface}}
\paragraph[{should\_\-stop}]{\setlength{\rightskip}{0pt plus 5cm}jmethodID {\bf JNIUserInterface::should\_\-stop}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classJNIUserInterface_abed4275803ff5165f1142c4a98f0348f}


Definition at line 59 of file multispot5\_\-jni.cc.

\hypertarget{classJNIUserInterface_a72fef78d1d5c69b61408cc098a0d6cb4}{
\index{JNIUserInterface@{JNIUserInterface}!send\_\-new\_\-points@{send\_\-new\_\-points}}
\index{send\_\-new\_\-points@{send\_\-new\_\-points}!JNIUserInterface@{JNIUserInterface}}
\paragraph[{send\_\-new\_\-points}]{\setlength{\rightskip}{0pt plus 5cm}jmethodID {\bf JNIUserInterface::send\_\-new\_\-points}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classJNIUserInterface_a72fef78d1d5c69b61408cc098a0d6cb4}


Definition at line 60 of file multispot5\_\-jni.cc.

\hypertarget{classJNIUserInterface_a4887b5849b2641a6e56d4e2a0192e17d}{
\index{JNIUserInterface@{JNIUserInterface}!passes@{passes}}
\index{passes@{passes}!JNIUserInterface@{JNIUserInterface}}
\paragraph[{passes}]{\setlength{\rightskip}{0pt plus 5cm}int {\bf JNIUserInterface::passes}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{classJNIUserInterface_a4887b5849b2641a6e56d4e2a0192e17d}


Definition at line 61 of file multispot5\_\-jni.cc.



The documentation for this class was generated from the following file:\begin{DoxyCompactItemize}
\item 
\hyperlink{multispot5__jni_8cc}{multispot5\_\-jni.cc}\end{DoxyCompactItemize}
