00001 /* 00002 * This file is part of ACADO Toolkit. 00003 * 00004 * ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. 00005 * Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau, 00006 * Milan Vukov, Rien Quirynen, KU Leuven. 00007 * Developed within the Optimization in Engineering Center (OPTEC) 00008 * under supervision of Moritz Diehl. All rights reserved. 00009 * 00010 * ACADO Toolkit is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 3 of the License, or (at your option) any later version. 00014 * 00015 * ACADO Toolkit is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with ACADO Toolkit; if not, write to the Free Software 00022 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00023 * 00024 */ 00025 00026 00034 #ifndef ACADO_TOOLKIT_ACADO_2_GNUPLOT_HPP 00035 #define ACADO_TOOLKIT_ACADO_2_GNUPLOT_HPP 00036 00037 00038 #include <acado/user_interaction/plot_window.hpp> 00039 00040 00041 BEGIN_NAMESPACE_ACADO 00042 00043 00058 class GnuplotWindow : public PlotWindow 00059 { 00060 00061 // PUBLIC FUNCTIONS: 00062 // ----------------- 00063 00064 public: 00065 00067 GnuplotWindow( ); 00068 00073 GnuplotWindow( PlotFrequency _frequency 00074 ); 00075 00080 GnuplotWindow( const GnuplotWindow& arg 00081 ); 00082 00084 virtual ~GnuplotWindow( ); 00085 00090 GnuplotWindow& operator=( const GnuplotWindow& arg 00091 ); 00092 00093 00099 virtual PlotWindow* clone( ) const; 00100 00101 00107 virtual returnValue init( ); 00108 00109 00119 virtual returnValue replot( PlotFrequency _frequency = PLOT_IN_ANY_CASE 00120 ); 00121 00122 00128 returnValue waitForMouseEvents( ); 00129 00138 BooleanType getMouseEvent( double& mouseX, 00139 double& mouseY 00140 ); 00141 00150 returnValue waitForMouseEvent( double& mouseX, 00151 double& mouseY 00152 ); 00153 00154 00155 00156 // PROTECTED FUNCTIONS: 00157 // -------------------- 00158 00159 protected: 00167 returnValue sendDataToGnuplot( ); 00168 00169 00177 returnValue getPlotModeString( PlotMode plotMode, 00178 std::string& plotModeString 00179 ) const; 00180 00188 returnValue getPlotStyleString( VariableType _type, 00189 std::string& plotStyleString 00190 ) const; 00191 00199 returnValue obtainPlotDataString( VariablesGrid& _dataGrid, 00200 std::string& _plotDataString 00201 ) const; 00202 00203 00204 00205 // PROTECTED DATA MEMBERS: 00206 // ----------------------- 00207 00208 protected: 00209 00210 FILE* gnuPipe; 00212 BooleanType mouseEvent; 00214 static int counter; 00215 }; 00216 00217 00218 CLOSE_NAMESPACE_ACADO 00219 00220 00221 #endif // ACADO_TOOLKIT_ACADO_2_GNUPLOT_HPP 00222 00223 /* 00224 * end of file 00225 */ 00226