diff --git a/QLop.pro b/QLop.pro --- a/QLop.pro +++ b/QLop.pro @@ -14,7 +14,7 @@ DESTDIR =./bin TARGET = QLop TEMPLATE = app -LIBS+=-lfftw3 +LIBS+=-lfftw3_threads -lfftw3 INCLUDEPATH += src/QCustomPlot \ src src/Cassini \ diff --git a/src/Cassini/cassinidatadownloader.cpp b/src/Cassini/cassinidatadownloader.cpp --- a/src/Cassini/cassinidatadownloader.cpp +++ b/src/Cassini/cassinidatadownloader.cpp @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #include "cassinidatadownloader.h" #include "ui_cassinidatadownloader.h" #include diff --git a/src/Cassini/cassinidatadownloader.h b/src/Cassini/cassinidatadownloader.h --- a/src/Cassini/cassinidatadownloader.h +++ b/src/Cassini/cassinidatadownloader.h @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #ifndef CASSINIDATADOWNLOADER_H #define CASSINIDATADOWNLOADER_H diff --git a/src/Cassini/cassinidatafile.cpp b/src/Cassini/cassinidatafile.cpp --- a/src/Cassini/cassinidatafile.cpp +++ b/src/Cassini/cassinidatafile.cpp @@ -266,7 +266,7 @@ void CassiniDataFile::readFile() //#pragma omp barrier free(fileContent); // } - qDebug()<< lineCnt <<" Points loade in "<< timr.elapsed()<<"ms"; + qDebug()<< lineCnt <<" Points loaded in "<< timr.elapsed()<<"ms"; setlocale(LC_NUMERIC,svglocale); emit dataReady(data); } diff --git a/src/Cassini/cassiniindexfile.cpp b/src/Cassini/cassiniindexfile.cpp --- a/src/Cassini/cassiniindexfile.cpp +++ b/src/Cassini/cassiniindexfile.cpp @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #include "cassiniindexfile.h" #include diff --git a/src/Cassini/cassiniindexfile.h b/src/Cassini/cassiniindexfile.h --- a/src/Cassini/cassiniindexfile.h +++ b/src/Cassini/cassiniindexfile.h @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #ifndef CASSINIINDEXFILE_H #define CASSINIINDEXFILE_H diff --git a/src/Cassini/cassiniindexfileviewer.cpp b/src/Cassini/cassiniindexfileviewer.cpp --- a/src/Cassini/cassiniindexfileviewer.cpp +++ b/src/Cassini/cassiniindexfileviewer.cpp @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #include "cassiniindexfileviewer.h" #include "ui_cassiniindexfileviewer.h" #include diff --git a/src/Cassini/cassiniindexfileviewer.h b/src/Cassini/cassiniindexfileviewer.h --- a/src/Cassini/cassiniindexfileviewer.h +++ b/src/Cassini/cassiniindexfileviewer.h @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #ifndef CASSINIINDEXFILEVIEWER_H #define CASSINIINDEXFILEVIEWER_H diff --git a/src/Cassini/cassinitools.cpp b/src/Cassini/cassinitools.cpp --- a/src/Cassini/cassinitools.cpp +++ b/src/Cassini/cassinitools.cpp @@ -1,8 +1,31 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #include "cassinitools.h" #include #include #include #include +#include CassiniTools* CassiniTools::_self=NULL; QDockWidget* CassiniTools::m_gui=NULL; @@ -39,6 +62,7 @@ CassiniTools::CassiniTools(bool noGUI,QO connect(m_dataFile,SIGNAL(dataReady(QLopDataList)),this,SLOT(dataReady(QLopDataList))); m_serviceName="CassiniTools"; m_noGui=noGUI; + fftw_init_threads(); } CassiniTools::~CassiniTools() @@ -162,10 +186,13 @@ void CassiniTools::export_view_Predefine void CassiniTools::compute_fft_on_view(int PID) { + + QElapsedTimer timr; SocExplorerPlot* plot = QLopPlots::getPlot(PID); if(plot==NULL) return; { + timr.start(); QLopDataList vectors; for(int i=0;igraphCount();i++) { @@ -199,6 +226,7 @@ void CassiniTools::compute_fft_on_view(i { in[i]=in[i]-av; } + fftw_plan_with_nthreads(4); p = fftw_plan_dft_r2c_1d(ch1V->data->count(),in, out,FFTW_ESTIMATE); fftw_execute(p); /* repeat as needed */ fftw_destroy_plan(p); @@ -225,6 +253,7 @@ void CassiniTools::compute_fft_on_view(i plot->rescaleAxis(); plot->replot(); + qDebug()<< ch1V->data->count() <<" Points loaded in "<< timr.elapsed()<<"ms"; } } } diff --git a/src/Cassini/cassinitools.h b/src/Cassini/cassinitools.h --- a/src/Cassini/cassinitools.h +++ b/src/Cassini/cassinitools.h @@ -1,3 +1,24 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ #ifndef CASSINITOOLS_H #define CASSINITOOLS_H diff --git a/src/Cassini/cassinitoolsgui.cpp b/src/Cassini/cassinitoolsgui.cpp --- a/src/Cassini/cassinitoolsgui.cpp +++ b/src/Cassini/cassinitoolsgui.cpp @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #include "cassinitoolsgui.h" #include "ui_cassinitoolsgui.h" #include diff --git a/src/Cassini/cassinitoolsgui.h b/src/Cassini/cassinitoolsgui.h --- a/src/Cassini/cassinitoolsgui.h +++ b/src/Cassini/cassinitoolsgui.h @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #ifndef CASSINITOOLSGUI_H #define CASSINITOOLSGUI_H diff --git a/src/Cassini/expxmldownloader.cpp b/src/Cassini/expxmldownloader.cpp --- a/src/Cassini/expxmldownloader.cpp +++ b/src/Cassini/expxmldownloader.cpp @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #include "expxmldownloader.h" #include #include diff --git a/src/Cassini/expxmldownloader.h b/src/Cassini/expxmldownloader.h --- a/src/Cassini/expxmldownloader.h +++ b/src/Cassini/expxmldownloader.h @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #ifndef EXPXMLDOWNLOADER_H #define EXPXMLDOWNLOADER_H diff --git a/src/Core/Widgets/downloadhistory.cpp b/src/Core/Widgets/downloadhistory.cpp --- a/src/Core/Widgets/downloadhistory.cpp +++ b/src/Core/Widgets/downloadhistory.cpp @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #include "downloadhistory.h" #include "ui_downloadhistory.h" diff --git a/src/Core/Widgets/downloadhistory.h b/src/Core/Widgets/downloadhistory.h --- a/src/Core/Widgets/downloadhistory.h +++ b/src/Core/Widgets/downloadhistory.h @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #ifndef DOWNLOADHISTORY_H #define DOWNLOADHISTORY_H diff --git a/src/Core/Widgets/downloadhistoryelement.cpp b/src/Core/Widgets/downloadhistoryelement.cpp --- a/src/Core/Widgets/downloadhistoryelement.cpp +++ b/src/Core/Widgets/downloadhistoryelement.cpp @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #include "downloadhistoryelement.h" #include "ui_downloadhistoryelement.h" diff --git a/src/Core/Widgets/downloadhistoryelement.h b/src/Core/Widgets/downloadhistoryelement.h --- a/src/Core/Widgets/downloadhistoryelement.h +++ b/src/Core/Widgets/downloadhistoryelement.h @@ -1,3 +1,24 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ #ifndef DOWNLOADHISTORYELEMENT_H #define DOWNLOADHISTORYELEMENT_H diff --git a/src/Core/Widgets/filebrowser.cpp b/src/Core/Widgets/filebrowser.cpp --- a/src/Core/Widgets/filebrowser.cpp +++ b/src/Core/Widgets/filebrowser.cpp @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #include "filebrowser.h" #include "ui_filebrowser.h" #include diff --git a/src/Core/Widgets/filebrowser.h b/src/Core/Widgets/filebrowser.h --- a/src/Core/Widgets/filebrowser.h +++ b/src/Core/Widgets/filebrowser.h @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #ifndef FILEBROWSER_H #define FILEBROWSER_H diff --git a/src/Core/Widgets/filesystemmodel.cpp b/src/Core/Widgets/filesystemmodel.cpp --- a/src/Core/Widgets/filesystemmodel.cpp +++ b/src/Core/Widgets/filesystemmodel.cpp @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #include "filesystemmodel.h" FileSystemModel::FileSystemModel(QObject *parent):QFileSystemModel(parent) { diff --git a/src/Core/Widgets/filesystemmodel.h b/src/Core/Widgets/filesystemmodel.h --- a/src/Core/Widgets/filesystemmodel.h +++ b/src/Core/Widgets/filesystemmodel.h @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #ifndef FILESYSTEMMODEL_H #define FILESYSTEMMODEL_H diff --git a/src/Core/Widgets/qcustomplotvect.cpp b/src/Core/Widgets/qcustomplotvect.cpp --- a/src/Core/Widgets/qcustomplotvect.cpp +++ b/src/Core/Widgets/qcustomplotvect.cpp @@ -1,3 +1,27 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ +/* + * This code is mainly a copy of QCustomPlot's QCPGraph class +*/ #include "qcustomplotvect.h" #include #include diff --git a/src/Core/Widgets/qcustomplotvect.h b/src/Core/Widgets/qcustomplotvect.h --- a/src/Core/Widgets/qcustomplotvect.h +++ b/src/Core/Widgets/qcustomplotvect.h @@ -1,3 +1,27 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ +/* + * This code is mainly a copy of QCustomPlot's QCPGraph class +*/ #ifndef QCUSTOMPLOTVECT_H #define QCUSTOMPLOTVECT_H diff --git a/src/Core/Widgets/qlopplots.cpp b/src/Core/Widgets/qlopplots.cpp --- a/src/Core/Widgets/qlopplots.cpp +++ b/src/Core/Widgets/qlopplots.cpp @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #include "qlopplots.h" #include diff --git a/src/Core/Widgets/qlopplots.h b/src/Core/Widgets/qlopplots.h --- a/src/Core/Widgets/qlopplots.h +++ b/src/Core/Widgets/qlopplots.h @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #ifndef QLOPPLOTS_H #define QLOPPLOTS_H diff --git a/src/Core/abstractfileloader.cpp b/src/Core/abstractfileloader.cpp --- a/src/Core/abstractfileloader.cpp +++ b/src/Core/abstractfileloader.cpp @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #include "abstractfileloader.h" AbstractFileLoader::AbstractFileLoader(QObject *parent) : QThread(parent) diff --git a/src/Core/abstractfileloader.h b/src/Core/abstractfileloader.h --- a/src/Core/abstractfileloader.h +++ b/src/Core/abstractfileloader.h @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #ifndef ABSTRACTFILELOADER_H #define ABSTRACTFILELOADER_H diff --git a/src/Core/filedownloader.cpp b/src/Core/filedownloader.cpp --- a/src/Core/filedownloader.cpp +++ b/src/Core/filedownloader.cpp @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #include "filedownloader.h" #include FileDownloader* FileDownloader::_self=NULL; diff --git a/src/Core/filedownloader.h b/src/Core/filedownloader.h --- a/src/Core/filedownloader.h +++ b/src/Core/filedownloader.h @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #ifndef FILEDOWNLOADER_H #define FILEDOWNLOADER_H diff --git a/src/Core/filedownloadertask.cpp b/src/Core/filedownloadertask.cpp --- a/src/Core/filedownloadertask.cpp +++ b/src/Core/filedownloadertask.cpp @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #include "filedownloadertask.h" FileDownloaderTask::FileDownloaderTask(QNetworkReply *reply, int ID, const QString &fileName, QObject *parent) : QObject(parent) diff --git a/src/Core/filedownloadertask.h b/src/Core/filedownloadertask.h --- a/src/Core/filedownloadertask.h +++ b/src/Core/filedownloadertask.h @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #ifndef FILEDOWNLOADERTASK_H #define FILEDOWNLOADERTASK_H diff --git a/src/Core/qlop.h b/src/Core/qlop.h --- a/src/Core/qlop.h +++ b/src/Core/qlop.h @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #ifndef QLOP #define QLOP #ifdef WIN32 diff --git a/src/Core/qlopdata.cpp b/src/Core/qlopdata.cpp --- a/src/Core/qlopdata.cpp +++ b/src/Core/qlopdata.cpp @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #include "qlopdata.h" QLopData::QLopData(QObject *parent) : QObject(parent) diff --git a/src/Core/qlopdata.h b/src/Core/qlopdata.h --- a/src/Core/qlopdata.h +++ b/src/Core/qlopdata.h @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #ifndef QLOPDATA_H #define QLOPDATA_H diff --git a/src/Core/qlopservice.cpp b/src/Core/qlopservice.cpp --- a/src/Core/qlopservice.cpp +++ b/src/Core/qlopservice.cpp @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #include "qlopservice.h" QLopService::QLopService(QObject *parent) : QObject(parent) diff --git a/src/Core/qlopservice.h b/src/Core/qlopservice.h --- a/src/Core/qlopservice.h +++ b/src/Core/qlopservice.h @@ -1,3 +1,25 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the QLop Software +-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +/*-- Author : Alexis Jeandet +-- Mail : alexis.jeandet@member.fsf.org +----------------------------------------------------------------------------*/ + #ifndef QLOPSERVICE_H #define QLOPSERVICE_H diff --git a/src/SocExplorerPlot.cpp b/src/SocExplorerPlot.cpp --- a/src/SocExplorerPlot.cpp +++ b/src/SocExplorerPlot.cpp @@ -26,35 +26,35 @@ #include SocExplorerPlot::SocExplorerPlot(QWidget *parent) : - QWidget(parent), mRubberBand(new QRubberBand(QRubberBand::Rectangle, this)) + QWidget(parent), mRubberBand(new QRubberBand(QRubberBand::Rectangle, this)) { - this->m_plot = new QCustomPlotVect(this); - this->m_plot->setInteractions(QCP::iRangeDrag | QCP::iSelectAxes | - QCP::iSelectLegend | QCP::iSelectPlottables); - this->m_plot->axisRect()->setRangeDrag(Qt::Horizontal|Qt::Vertical); - this->m_plot->axisRect()->setRangeZoom(Qt::Horizontal|Qt::Vertical); - this->m_mainlayout = new QGridLayout(this); - this->setLayout(this->m_mainlayout); - this->m_mainlayout->addWidget(this->m_plot); - this->setMinimumSize(400,300); - this->setFocusPolicy(Qt::WheelFocus); - this->m_plot->setAttribute(Qt::WA_TransparentForMouseEvents); - this->ctrl_hold = false; - this->shift_hold = false; - this->mouse_hold = false; - this->m_plot->setNoAntialiasingOnDrag(true); - this->show(); - this->m_plot->legend->setVisible(true); + this->m_plot = new QCustomPlotVect(this); + this->m_plot->setInteractions(QCP::iRangeDrag | QCP::iSelectAxes | + QCP::iSelectLegend | QCP::iSelectPlottables); + this->m_plot->axisRect()->setRangeDrag(Qt::Horizontal|Qt::Vertical); + this->m_plot->axisRect()->setRangeZoom(Qt::Horizontal|Qt::Vertical); + this->m_mainlayout = new QGridLayout(this); + this->setLayout(this->m_mainlayout); + this->m_mainlayout->addWidget(this->m_plot); + this->setMinimumSize(400,300); + this->setFocusPolicy(Qt::WheelFocus); + this->m_plot->setAttribute(Qt::WA_TransparentForMouseEvents); + this->ctrl_hold = false; + this->shift_hold = false; + this->mouse_hold = false; + this->m_plot->setNoAntialiasingOnDrag(true); + this->show(); + this->m_plot->legend->setVisible(true); } SocExplorerPlot::~SocExplorerPlot() { - delete mRubberBand; + delete mRubberBand; } void SocExplorerPlot::show() { - QWidget::show(); + QWidget::show(); } void SocExplorerPlot::replot() @@ -99,9 +99,9 @@ QVector *SocExplorerPlot::getVi void SocExplorerPlot::setTitle(QString title) { - Q_UNUSED(title) - //this->m_plot->setTitle(title); - /*! + Q_UNUSED(title) + //this->m_plot->setTitle(title); + /*! @todo Function borcken fixe this! */ this->m_Title = title; @@ -116,7 +116,7 @@ const QString &SocExplorerPlot::title() void SocExplorerPlot::setXaxisLabel(QString label) { - this->m_plot->xAxis->setLabel(label); + this->m_plot->xAxis->setLabel(label); this->repaint(); } @@ -127,7 +127,7 @@ void SocExplorerPlot::setXaxisLog() void SocExplorerPlot::setYaxisLabel(QString label) { - this->m_plot->yAxis->setLabel(label); + this->m_plot->yAxis->setLabel(label); this->repaint(); } @@ -138,48 +138,48 @@ void SocExplorerPlot::setYaxisLog() void SocExplorerPlot::setXaxisRange(double lower, double upper) { - this->m_plot->xAxis->setRange(lower,upper); + this->m_plot->xAxis->setRange(lower,upper); } void SocExplorerPlot::setYaxisRange(double lower, double upper) { - this->m_plot->yAxis->setRange(lower,upper); + this->m_plot->yAxis->setRange(lower,upper); } void SocExplorerPlot::rescaleAxis() { - this->m_plot->rescaleAxes(); - this->m_plot->replot(); + this->m_plot->rescaleAxes(); + this->m_plot->replot(); } void SocExplorerPlot::setLegendFont(QFont font) { - this->m_plot->legend->setFont(font); - this->repaint(); + this->m_plot->legend->setFont(font); + this->repaint(); } void SocExplorerPlot::setLegendSelectedFont(QFont font) { - this->m_plot->legend->setSelectedFont(font); - this->repaint(); + this->m_plot->legend->setSelectedFont(font); + this->repaint(); } void SocExplorerPlot::setAdaptativeSampling(int graphIndex, bool enable) { - this->m_plot->graph(graphIndex)->setAdaptiveSampling(enable); + this->m_plot->graph(graphIndex)->setAdaptiveSampling(enable); } void SocExplorerPlot::setUseFastVector(int graphIndex, bool enable) { // TODO deprecated -// this->m_plot->graph(graphIndex)->setUseFastVectors(enable); + // this->m_plot->graph(graphIndex)->setUseFastVectors(enable); } int SocExplorerPlot::addGraph() { - this->m_plot->addGraph(); - return this->m_plot->graphCount() -1; + this->m_plot->addGraph(); + return this->m_plot->graphCount() -1; } bool SocExplorerPlot::removeGraph(int graphIndex) @@ -194,20 +194,20 @@ int SocExplorerPlot::graphCount() void SocExplorerPlot::removeAllGraphs() { - int graphCount=this->m_plot->graphCount(); - for(int i=0;im_plot->graphCount(); + for(int i=0;im_plot->removeGraph(0); + this->m_plot->removeGraph(0); } } void SocExplorerPlot::setGraphName(int graphIndex,QString name) { - if(graphIndexm_plot->graphCount()) + if(graphIndexm_plot->graphCount()) { - this->m_plot->graph(graphIndex)->setName(name); - } + this->m_plot->graph(graphIndex)->setName(name); + } } const QString &SocExplorerPlot::graphName(int graphIndex) @@ -222,137 +222,137 @@ const QString &SocExplorerPlot::graphNam void SocExplorerPlot::setGraphData(int graphIndex, QList x, QList y) { - if((graphIndexm_plot->graphCount()) && (x.count()==y.count()) && (x.at(0).type()==QVariant::Double)) + if((graphIndexm_plot->graphCount()) && (x.count()==y.count()) && (x.at(0).type()==QVariant::Double)) { - QVector _x(x.count()), _y(y.count()); - for(int i=0;i _x(x.count()), _y(y.count()); + for(int i=0;i(); + /*_x[i] = x.at(i).value(); _y[i] = y.at(i).value();*/ - _x[i] = x.at(i).toDouble(); - _y[i] = y.at(i).toDouble(); + _x[i] = x.at(i).toDouble(); + _y[i] = y.at(i).toDouble(); } - this->m_plot->graph(graphIndex)->setData(_x,_y); + this->m_plot->graph(graphIndex)->setData(_x,_y); } - else + else { - if((graphIndexm_plot->graphCount()) && (x.count()==y.count()) && (x.at(0).type()==QVariant::DateTime)) + if((graphIndexm_plot->graphCount()) && (x.count()==y.count()) && (x.at(0).type()==QVariant::DateTime)) { - QVector _x(x.count()), _y(y.count()); - for(int i=0;i _x(x.count()), _y(y.count()); + for(int i=0;i(); + /*_x[i] = x.at(i).value(); _y[i] = y.at(i).value();*/ - _x[i] = x.at(i).toDateTime().toMSecsSinceEpoch(); - _y[i] = y.at(i).toDouble(); + _x[i] = x.at(i).toDateTime().toMSecsSinceEpoch(); + _y[i] = y.at(i).toDouble(); } - this->m_plot->graph(graphIndex)->setData(_x,_y); - this->m_plot->xAxis->setTickLabelType(QCPAxis::ltDateTime); - this->m_plot->xAxis->setDateTimeFormat("hh:mm:ss.zzz"); + this->m_plot->graph(graphIndex)->setData(_x,_y); + this->m_plot->xAxis->setTickLabelType(QCPAxis::ltDateTime); + this->m_plot->xAxis->setDateTimeFormat("hh:mm:ss.zzz"); } } - this->m_plot->replot(); + this->m_plot->replot(); } void SocExplorerPlot::setGraphData(int graphIndex, QCPDataMap *data, bool copy, bool replot) { - if((graphIndexm_plot->graphCount()))// && (x.at(0).type()==QVariant::Double)) + if((graphIndexm_plot->graphCount()))// && (x.at(0).type()==QVariant::Double)) { - this->m_plot->graph(graphIndex)->setData(data,copy); + this->m_plot->graph(graphIndex)->setData(data,copy); } - if(replot) - this->m_plot->replot(); + if(replot) + this->m_plot->replot(); } void SocExplorerPlot::setGraphData(int graphIndex,QVector *data, bool replot) { - if((graphIndexm_plot->graphCount()))// && (x.at(0).type()==QVariant::Double)) + if((graphIndexm_plot->graphCount()))// && (x.at(0).type()==QVariant::Double)) { - ((QCPGraphVect*)this->m_plot->graph(graphIndex))->setData(data); + ((QCPGraphVect*)this->m_plot->graph(graphIndex))->setData(data); } - if(replot) - this->m_plot->replot(); + if(replot) + this->m_plot->replot(); } void SocExplorerPlot::addGraphData(int graphIndex, QList x, QList y) { - if((graphIndexm_plot->graphCount()) && (x.count()==y.count()))// && (x.at(0).type()==QVariant::Double)) + if((graphIndexm_plot->graphCount()) && (x.count()==y.count()))// && (x.at(0).type()==QVariant::Double)) { - QVector _x(x.count()), _y(y.count()); - for(int i=0;i _x(x.count()), _y(y.count()); + for(int i=0;i(); + /*_x[i] = x.at(i).value(); _y[i] = y.at(i).value();*/ - _x[i] = x.at(i).toDouble(); - _y[i] = y.at(i).toDouble(); + _x[i] = x.at(i).toDouble(); + _y[i] = y.at(i).toDouble(); } - this->m_plot->graph(graphIndex)->addData(_x,_y); + this->m_plot->graph(graphIndex)->addData(_x,_y); } - this->m_plot->replot(); + this->m_plot->replot(); } void SocExplorerPlot::addGraphData(int graphIndex, QVariant x, QVariant y) { - if(graphIndexm_plot->graphCount())// && (x.at(0).type()==QVariant::Double)) + if(graphIndexm_plot->graphCount())// && (x.at(0).type()==QVariant::Double)) { - this->m_plot->graph(graphIndex)->addData(x.toDouble(),y.toDouble()); + this->m_plot->graph(graphIndex)->addData(x.toDouble(),y.toDouble()); } - this->m_plot->replot(); + this->m_plot->replot(); } void SocExplorerPlot::setGraphPen(int graphIndex,QPen pen) { - if(graphIndexm_plot->graphCount()) + if(graphIndexm_plot->graphCount()) { - this->m_plot->graph(graphIndex)->setPen(pen); + this->m_plot->graph(graphIndex)->setPen(pen); } } QPen SocExplorerPlot::getGraphPen(int graphIndex) { - if(graphIndexm_plot->graphCount()) + if(graphIndexm_plot->graphCount()) { - return this->m_plot->graph(graphIndex)->pen(); + return this->m_plot->graph(graphIndex)->pen(); } - return this->m_plot->graph()->pen(); + return this->m_plot->graph()->pen(); } void SocExplorerPlot::setGraphLineStyle(int graphIndex,QString lineStyle) { - if(graphIndexm_plot->graphCount()) + if(graphIndexm_plot->graphCount()) { - if(!lineStyle.compare("none")) + if(!lineStyle.compare("none")) { - this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsNone); - return; + this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsNone); + return; } - if(!lineStyle.compare("line")) + if(!lineStyle.compare("line")) { - this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsLine); - return; + this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsLine); + return; } - if(!lineStyle.compare("stepleft")) + if(!lineStyle.compare("stepleft")) { - this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsStepLeft); - return; + this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsStepLeft); + return; } - if(!lineStyle.compare("stepright")) + if(!lineStyle.compare("stepright")) { - this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsStepRight); - return; + this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsStepRight); + return; } - if(!lineStyle.compare("stepcenter")) + if(!lineStyle.compare("stepcenter")) { - this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsStepCenter); - return; + this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsStepCenter); + return; } - if(!lineStyle.compare("impulse")) + if(!lineStyle.compare("impulse")) { - this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsImpulse); - return; + this->m_plot->graph(graphIndex)->setLineStyle(QCPGraph::lsImpulse); + return; } @@ -361,87 +361,87 @@ void SocExplorerPlot::setGraphLineStyle( void SocExplorerPlot::setGraphScatterStyle(int graphIndex,QString scatterStyle) { - if(graphIndexm_plot->graphCount()) + if(graphIndexm_plot->graphCount()) { - if(!scatterStyle.compare("none")) + if(!scatterStyle.compare("none")) { - this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssNone); - return; + this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssNone); + return; } - if(!scatterStyle.compare("dot")) + if(!scatterStyle.compare("dot")) { - this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssDot); - return; + this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssDot); + return; } - if(!scatterStyle.compare("cross")) + if(!scatterStyle.compare("cross")) { - this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssCross); - return; + this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssCross); + return; } - if(!scatterStyle.compare("plus")) + if(!scatterStyle.compare("plus")) { - this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssPlus); - return; + this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssPlus); + return; } - if(!scatterStyle.compare("circle")) + if(!scatterStyle.compare("circle")) { - this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssCircle); - return; + this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssCircle); + return; } - if(!scatterStyle.compare("disc")) + if(!scatterStyle.compare("disc")) { - this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssDisc); - return; + this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssDisc); + return; } - if(!scatterStyle.compare("square")) + if(!scatterStyle.compare("square")) { - this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssSquare); - return; + this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssSquare); + return; } - if(!scatterStyle.compare("diamond")) + if(!scatterStyle.compare("diamond")) { - this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssDiamond); - return; + this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssDiamond); + return; } - if(!scatterStyle.compare("star")) + if(!scatterStyle.compare("star")) { - this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssStar); - return; + this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssStar); + return; } - if(!scatterStyle.compare("triangle")) + if(!scatterStyle.compare("triangle")) { - this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssTriangle); - return; + this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssTriangle); + return; } - if(!scatterStyle.compare("invertedtriangle")) + if(!scatterStyle.compare("invertedtriangle")) { - this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssTriangleInverted); - return; + this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssTriangleInverted); + return; } - if(!scatterStyle.compare("crosssquare")) + if(!scatterStyle.compare("crosssquare")) { - this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssCrossSquare); - return; + this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssCrossSquare); + return; } - if(!scatterStyle.compare("plussquare")) + if(!scatterStyle.compare("plussquare")) { - this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssPlusSquare); - return; + this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssPlusSquare); + return; } - if(!scatterStyle.compare("crosscircle")) + if(!scatterStyle.compare("crosscircle")) { - this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssCrossCircle); - return; + this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssCrossCircle); + return; } - if(!scatterStyle.compare("pluscircle")) + if(!scatterStyle.compare("pluscircle")) { - this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssPlusCircle); - return; + this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssPlusCircle); + return; } - if(!scatterStyle.compare("peace")) + if(!scatterStyle.compare("peace")) { - this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssPeace); - return; + this->m_plot->graph(graphIndex)->setScatterStyle(QCPScatterStyle::ssPeace); + return; } } @@ -449,12 +449,12 @@ void SocExplorerPlot::setGraphScatterSty void SocExplorerPlot::setXaxisTickLabelType(QCPAxis::LabelType type) { - this->m_plot->xAxis->setTickLabelType(type); + this->m_plot->xAxis->setTickLabelType(type); } void SocExplorerPlot::setXaxisDateTimeFormat(const QString &format) { - this->m_plot->xAxis->setDateTimeFormat(format); + this->m_plot->xAxis->setDateTimeFormat(format); } @@ -463,111 +463,111 @@ void SocExplorerPlot::setXaxisDateTimeFo void SocExplorerPlot::keyPressEvent(QKeyEvent * event) { - switch(event->key()) + switch(event->key()) { case Qt::Key_Control: - this->ctrl_hold = true; - setCursor(Qt::CrossCursor); - break; + this->ctrl_hold = true; + setCursor(Qt::CrossCursor); + break; case Qt::Key_Shift: - this->shift_hold = true; - break; + this->shift_hold = true; + break; case Qt::Key_M: - this->rescaleAxis(); - break; + this->rescaleAxis(); + break; case Qt::Key_Left: - if(!ctrl_hold) + if(!ctrl_hold) { - move(-0.1,Qt::Horizontal); + move(-0.1,Qt::Horizontal); } - else + else { - zoom(2,this->width()/2,Qt::Horizontal); + zoom(2,this->width()/2,Qt::Horizontal); } - break; + break; case Qt::Key_Right: - if(!ctrl_hold) + if(!ctrl_hold) { - move(0.1,Qt::Horizontal); + move(0.1,Qt::Horizontal); } - else + else { - zoom(0.5,this->width()/2,Qt::Horizontal); + zoom(0.5,this->width()/2,Qt::Horizontal); } - break; + break; case Qt::Key_Up: - if(!ctrl_hold) + if(!ctrl_hold) { - move(0.1,Qt::Vertical); + move(0.1,Qt::Vertical); } - else + else { - zoom(0.5,this->height()/2,Qt::Vertical); + zoom(0.5,this->height()/2,Qt::Vertical); } - break; + break; case Qt::Key_Down: - if(!ctrl_hold) + if(!ctrl_hold) { - move(-0.1,Qt::Vertical); + move(-0.1,Qt::Vertical); } - else + else { - zoom(2,this->height()/2,Qt::Vertical); + zoom(2,this->height()/2,Qt::Vertical); } - break; + break; default: - QWidget::keyPressEvent(event); - break; + QWidget::keyPressEvent(event); + break; } } void SocExplorerPlot::keyReleaseEvent(QKeyEvent * event) { - switch(event->key()) + switch(event->key()) { case Qt::Key_Control: - event->accept(); - this->ctrl_hold = false; - break; + event->accept(); + this->ctrl_hold = false; + break; case Qt::Key_Shift: - event->accept(); - this->shift_hold = false; - break; + event->accept(); + this->shift_hold = false; + break; default: - QWidget::keyReleaseEvent(event); - break; + QWidget::keyReleaseEvent(event); + break; } - setCursor(Qt::ArrowCursor); + setCursor(Qt::ArrowCursor); } void SocExplorerPlot::wheelEvent(QWheelEvent * event) { - double factor; - double wheelSteps = event->delta()/120.0; // a single step delta is +/-120 usually - if(ctrl_hold) + double factor; + double wheelSteps = event->delta()/120.0; // a single step delta is +/-120 usually + if(ctrl_hold) { - if (event->orientation()==Qt::Vertical)//mRangeZoom.testFlag(Qt::Vertical)) + if (event->orientation()==Qt::Vertical)//mRangeZoom.testFlag(Qt::Vertical)) { - setCursor(Qt::SizeVerCursor); - factor = pow(this->m_plot->axisRect()->rangeZoomFactor(Qt::Vertical), wheelSteps); - zoom(factor,event->pos().y(),Qt::Vertical); + setCursor(Qt::SizeVerCursor); + factor = pow(this->m_plot->axisRect()->rangeZoomFactor(Qt::Vertical), wheelSteps); + zoom(factor,event->pos().y(),Qt::Vertical); } - QWidget::wheelEvent(event); - return; + QWidget::wheelEvent(event); + return; } - if(shift_hold) + if(shift_hold) { - if (event->orientation()==Qt::Vertical)//mRangeZoom.testFlag(Qt::Vertical)) + if (event->orientation()==Qt::Vertical)//mRangeZoom.testFlag(Qt::Vertical)) { - setCursor(Qt::SizeHorCursor); - factor = pow(this->m_plot->axisRect()->rangeZoomFactor(Qt::Horizontal), wheelSteps); - zoom(factor,event->pos().x(),Qt::Horizontal); + setCursor(Qt::SizeHorCursor); + factor = pow(this->m_plot->axisRect()->rangeZoomFactor(Qt::Horizontal), wheelSteps); + zoom(factor,event->pos().x(),Qt::Horizontal); } - QWidget::wheelEvent(event); - return; + QWidget::wheelEvent(event); + return; } - move(wheelSteps/10,Qt::Horizontal); - QWidget::wheelEvent(event); + move(wheelSteps,Qt::Horizontal); + QWidget::wheelEvent(event); } @@ -575,86 +575,132 @@ void SocExplorerPlot::wheelEvent(QWheelE void SocExplorerPlot::mousePressEvent(QMouseEvent *event) { - if(event->button()==Qt::LeftButton) + if(event->button()==Qt::LeftButton) { - if(ctrl_hold) + if(ctrl_hold) { - setCursor(Qt::CrossCursor); - mOrigin = event->pos(); - mRubberBand->setGeometry(QRect(mOrigin, QSize())); - mRubberBand->show(); + setCursor(Qt::CrossCursor); + mOrigin = event->pos(); + mRubberBand->setGeometry(QRect(mOrigin, QSize())); + mRubberBand->show(); } - else + else { - setCursor(Qt::ClosedHandCursor); - mDragStart = event->pos(); - this->mouse_hold = true; - DragStartHorzRange = this->m_plot->axisRect()->rangeDragAxis(Qt::Horizontal)->range(); - DragStartVertRange = this->m_plot->axisRect()->rangeDragAxis(Qt::Vertical)->range(); + setCursor(Qt::ClosedHandCursor); + mDragStart = event->pos(); + this->mouse_hold = true; + DragStartHorzRange = this->m_plot->axisRect()->rangeDragAxis(Qt::Horizontal)->range(); + DragStartVertRange = this->m_plot->axisRect()->rangeDragAxis(Qt::Vertical)->range(); } } - QWidget::mousePressEvent(event); + QWidget::mousePressEvent(event); } void SocExplorerPlot::mouseReleaseEvent(QMouseEvent *event) { - if(event->button()==Qt::LeftButton) + if(event->button()==Qt::LeftButton) { - this->mouse_hold = false; + this->mouse_hold = false; } - if (mRubberBand->isVisible()) + if (mRubberBand->isVisible()) { - const QRect & zoomRect = mRubberBand->geometry(); - int xp1, yp1, xp2, yp2; - zoomRect.getCoords(&xp1, &yp1, &xp2, &yp2); - double x1 = this->m_plot->xAxis->pixelToCoord(xp1); - double x2 = this->m_plot->xAxis->pixelToCoord(xp2); - double y1 = this->m_plot->yAxis->pixelToCoord(yp1); - double y2 = this->m_plot->yAxis->pixelToCoord(yp2); + const QRect & zoomRect = mRubberBand->geometry(); + int xp1, yp1, xp2, yp2; + zoomRect.getCoords(&xp1, &yp1, &xp2, &yp2); + double x1 = this->m_plot->xAxis->pixelToCoord(xp1); + double x2 = this->m_plot->xAxis->pixelToCoord(xp2); + double y1 = this->m_plot->yAxis->pixelToCoord(yp1); + double y2 = this->m_plot->yAxis->pixelToCoord(yp2); - this->m_plot->xAxis->setRange(x1, x2); - this->m_plot->yAxis->setRange(y1, y2); + this->m_plot->xAxis->setRange(x1, x2); + this->m_plot->yAxis->setRange(y1, y2); - mRubberBand->hide(); - this->m_plot->replot(); + mRubberBand->hide(); + this->m_plot->replot(); } - setCursor(Qt::ArrowCursor); - QWidget::mouseReleaseEvent(event); + setCursor(Qt::ArrowCursor); + QWidget::mouseReleaseEvent(event); } void SocExplorerPlot::zoom(double factor, int center, Qt::Orientation orientation) { - QCPAxis* axis = this->m_plot->axisRect()->rangeZoomAxis(orientation); - axis->scaleRange(factor, axis->pixelToCoord(center)); - this->m_plot->replot(); + QCPAxis* axis = this->m_plot->axisRect()->rangeZoomAxis(orientation); + axis->scaleRange(factor, axis->pixelToCoord(center)); + this->m_plot->replot(); } void SocExplorerPlot::move(double factor, Qt::Orientation orientation) { - QCPAxis* axis = this->m_plot->axisRect()->rangeDragAxis(orientation); - double rg = (axis->range().upper - axis->range().lower)*(factor); - axis->setRange(axis->range().lower+(rg), axis->range().upper+(rg)); - this->m_plot->replot(); + QCPAxis* axis = this->m_plot->axisRect()->rangeDragAxis(orientation); + // double rg = (axis->range().upper - axis->range().lower)*(factor); + // axis->setRange(axis->range().lower+(rg), axis->range().upper+(rg)); + double rg =0.0; + DragStartHorzRange = this->m_plot->axisRect()->rangeDragAxis(Qt::Horizontal)->range(); + DragStartVertRange = this->m_plot->axisRect()->rangeDragAxis(Qt::Vertical)->range(); + if(this->m_plot->xAxis->scaleType() == QCPAxis::stLinear) + { + rg = (axis->range().upper - axis->range().lower)*(factor/10); + axis->setRange(axis->range().lower+(rg), axis->range().upper+(rg)); + } + else if(this->m_plot->xAxis->scaleType() == QCPAxis::stLogarithmic) + { + // rg = (axis->range().upper / axis->range().lower)*(factor/100); + int start,stop; + double diff; + if(factor>0.0) + { + stop =this->width()*factor/10; + start = 2*this->width()*factor/10; + } + if(factor<0.0) + { + factor*=-1.0; + start =this->width()*factor/10; + stop = 2*this->width()*factor/10; + } + diff = axis->pixelToCoord(start) / axis->pixelToCoord(stop); + axis->setRange(this->m_plot->axisRect()->rangeDragAxis(orientation)->range().lower*diff, this->m_plot->axisRect()->rangeDragAxis(orientation)->range().upper*diff); + } + this->m_plot->replot(); } void SocExplorerPlot::mouseMoveEvent(QMouseEvent *event) { - if(mouse_hold) + if(mouse_hold) { - QCPAxis* Haxis = this->m_plot->axisRect()->rangeDragAxis(Qt::Horizontal); - QCPAxis* Vaxis = this->m_plot->axisRect()->rangeDragAxis(Qt::Vertical); - double diff = Haxis->pixelToCoord(mDragStart.x()) - Haxis->pixelToCoord(event->pos().x()); - Haxis->setRange(DragStartHorzRange.lower+diff, DragStartHorzRange.upper+diff); - diff = Vaxis->pixelToCoord(mDragStart.y()) - Vaxis->pixelToCoord(event->pos().y()); - Vaxis->setRange(DragStartVertRange.lower+diff, DragStartVertRange.upper+diff); - this->m_plot->replot(); + QCPAxis* Haxis = this->m_plot->axisRect()->rangeDragAxis(Qt::Horizontal); + QCPAxis* Vaxis = this->m_plot->axisRect()->rangeDragAxis(Qt::Vertical); + // double diff = rangeDragHorzAxis->pixelToCoord(mDragStart.x()) / rangeDragHorzAxis->pixelToCoord(event->pos().x()); + // rangeDragHorzAxis->setRange(mDragStartHorzRange.lower*diff, mDragStartHorzRange.upper*diff); + double diff=0; + if(this->m_plot->xAxis->scaleType() == QCPAxis::stLinear) + { + diff = Haxis->pixelToCoord(mDragStart.x()) - Haxis->pixelToCoord(event->pos().x()); + Haxis->setRange(DragStartHorzRange.lower+diff, DragStartHorzRange.upper+diff); + } + else if(this->m_plot->xAxis->scaleType() == QCPAxis::stLogarithmic) + { + diff = Haxis->pixelToCoord(mDragStart.x()) / Haxis->pixelToCoord(event->pos().x()); + Haxis->setRange(DragStartHorzRange.lower*diff, DragStartHorzRange.upper*diff); + } + if(this->m_plot->yAxis->scaleType() == QCPAxis::stLinear) + { + diff = Vaxis->pixelToCoord(mDragStart.y()) - Vaxis->pixelToCoord(event->pos().y()); + Vaxis->setRange(DragStartVertRange.lower+diff, DragStartVertRange.upper+diff); + } + else if(this->m_plot->yAxis->scaleType() == QCPAxis::stLogarithmic) + { + diff = Vaxis->pixelToCoord(mDragStart.y()) / Vaxis->pixelToCoord(event->pos().y()); + Vaxis->setRange(DragStartVertRange.lower*diff, DragStartVertRange.upper*diff); + } + this->m_plot->replot(); } - if (mRubberBand->isVisible()) + if (mRubberBand->isVisible()) { - mRubberBand->setGeometry(QRect(mOrigin, event->pos()).normalized()); + mRubberBand->setGeometry(QRect(mOrigin, event->pos()).normalized()); } - QWidget::mouseMoveEvent(event); + QWidget::mouseMoveEvent(event); }