diff --git a/modules/gui/src/plot_viewer/plot_axis_base.cc b/modules/gui/src/plot_viewer/plot_axis_base.cc deleted file mode 100644 index 5bee2b9081889e08bffcb89226d3dab2c013ea6d..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_axis_base.cc +++ /dev/null @@ -1,90 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include "plot_axis_base.hh" - -#include <QWheelEvent> -#include <QMouseEvent> -namespace ost{namespace gui{ - -PlotAxisBase::PlotAxisBase(QWidget * parent): - QWidget(parent), - ticker_(), - global_mouse_pos_() -{ -} - -PlotAxisBase::~PlotAxisBase() -{ -} - -void PlotAxisBase::wheelEvent ( QWheelEvent * e ) -{ - emit zoom(e->delta(),e->pos()); -} -void PlotAxisBase::SetMinimum(Real min) -{ - ticker_.SetMinimum(min); - update(); -} - -void PlotAxisBase::SetMaximum(Real max) -{ - ticker_.SetMaximum(max); - update(); -} - -void PlotAxisBase::SetSeparation(int separation) -{ - ticker_.SetSeparation(separation); - update(); -} -int PlotAxisBase::GetSeparation() -{ - return ticker_.GetSeparation(); - -} - -void PlotAxisBase::SetStart(int start) -{ - ticker_.SetStart(start); -} - -void PlotAxisBase::SetEnd(int end) -{ - ticker_.SetEnd(end); -} - -TickList PlotAxisBase::GetTicks() -{ - return ticker_.GetTicks(); -} - -void PlotAxisBase::mousePressEvent( QMouseEvent * event ) -{ - if(event->button()== Qt::LeftButton){ - global_mouse_pos_=event->globalPos(); - } -} - - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_axis_base.hh b/modules/gui/src/plot_viewer/plot_axis_base.hh deleted file mode 100644 index 61d621219ad928c72b25ef0b17ac375b8540a046..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_axis_base.hh +++ /dev/null @@ -1,59 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOTAXIS_BASE_HH_ -#define PLOTAXIS_BASE_HH_ - -/* - Author: Andreas Schenk -*/ - -#include "plot_ticker.hh" -#include <QWidget> - - -namespace ost { namespace gui { - -class DLLEXPORT_OST_GUI PlotAxisBase: public QWidget -{ - Q_OBJECT -public: - PlotAxisBase(QWidget * parent = 0); - virtual ~PlotAxisBase(); - const static unsigned int AXISWIDTH=60; - void SetMinimum(Real min); - void SetMaximum(Real max); -signals: - void zoom(int delta,QPoint pos); - void translate(Real deltax,Real deltay); -protected: - int GetSeparation(); - void SetSeparation(int separation); - void SetStart(int start); - void SetEnd(int end); - virtual void wheelEvent ( QWheelEvent * e ); - virtual void mousePressEvent ( QMouseEvent * event ); - TickList GetTicks(); - PlotTickerLinear ticker_; - QPoint global_mouse_pos_; -}; - - -}}//ns - -#endif /*PLOTAXIS_BASE_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_axis_horizontal.cc b/modules/gui/src/plot_viewer/plot_axis_horizontal.cc deleted file mode 100644 index 3279221386c7951ba749ca810cf99dab5ca36500..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_axis_horizontal.cc +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include "plot_axis_horizontal.hh" - -#include <QPainter> -#include <QMouseEvent> -namespace ost{namespace gui{ - -PlotAxisHorizontal::PlotAxisHorizontal(QWidget * parent): - PlotAxisBase(parent) -{ - SetStart(AXISWIDTH); - SetSeparation(40); -} - -PlotAxisHorizontal::~PlotAxisHorizontal() -{ -} - -void PlotAxisHorizontal::paintEvent(QPaintEvent* paint_event) -{ - SetEnd(width()); - TickList ticks=GetTicks(); - QPainter painter(this); - painter.setRenderHint(QPainter::Antialiasing); - for(int i=0;i<static_cast<int>(ticks.size());++i){ - if(ticks[i].first<static_cast<int>(AXISWIDTH)){ - continue; - } - painter.drawLine(ticks[i].first,0,ticks[i].first,9); - painter.drawText(QRect(ticks[i].first-GetSeparation()/2,12,GetSeparation(),20),Qt::AlignCenter,QString("%1").arg(ticks[i].second)); - } -} - -void PlotAxisHorizontal::mouseMoveEvent( QMouseEvent * event ) -{ - if(event->buttons() & Qt::LeftButton){ - emit translate(static_cast<Real>(event->globalPos().x()-global_mouse_pos_.x()),0.0); - global_mouse_pos_=event->globalPos(); - } -} - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_axis_horizontal.hh b/modules/gui/src/plot_viewer/plot_axis_horizontal.hh deleted file mode 100644 index 7522695e0bd1a98b58183eaf7a97825c9673b6f1..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_axis_horizontal.hh +++ /dev/null @@ -1,44 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_AXIS_HORIZONTAL_HH_ -#define PLOT_AXIS_HORIZONTAL_HH_ - -/* - Author: Andreas Schenk -*/ - -#include "plot_axis_base.hh" - -namespace ost { namespace gui { - -class DLLEXPORT_OST_GUI PlotAxisHorizontal: public PlotAxisBase -{ -public: - PlotAxisHorizontal(QWidget * parent = 0); - virtual ~PlotAxisHorizontal(); -protected: - virtual void paintEvent(QPaintEvent* paint_event); - virtual void mouseMoveEvent ( QMouseEvent * event ); -}; - -} - -} - -#endif /*PLOT_AXIS_HORIZONTAL_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_axis_vertical.cc b/modules/gui/src/plot_viewer/plot_axis_vertical.cc deleted file mode 100644 index f276953dd1603051b5f701e8c9b0cfb90027943c..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_axis_vertical.cc +++ /dev/null @@ -1,65 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - - -#include "plot_axis_vertical.hh" - -#include <QMouseEvent> -#include <QPainter> -namespace ost{namespace gui{ - -PlotAxisVertical::PlotAxisVertical(QWidget * parent): - PlotAxisBase(parent) -{ - SetStart(AXISWIDTH); - SetSeparation(40); -} - -PlotAxisVertical::~PlotAxisVertical() -{ -} - -void PlotAxisVertical::paintEvent(QPaintEvent* paint_event) -{ - SetEnd(height()); - TickList ticks=GetTicks(); - QPainter painter(this); - painter.setRenderHint(QPainter::Antialiasing); - for(int i=0;i<static_cast<int>(ticks.size());++i){ - Real ypos=height()-ticks[i].first; - if(ticks[i].first<static_cast<int>(AXISWIDTH)){ - continue; - } - painter.drawLine(AXISWIDTH-10,ypos,AXISWIDTH-1,ypos); - painter.drawText(QRect(2,ypos-GetSeparation()/2,AXISWIDTH-14,GetSeparation()),Qt::AlignVCenter,QString("%1").arg(ticks[i].second)); - } -} - -void PlotAxisVertical::mouseMoveEvent( QMouseEvent * event ) -{ - if(event->buttons() & Qt::LeftButton){ - emit translate(0.0,static_cast<Real>(event->globalPos().y()-global_mouse_pos_.y())); - global_mouse_pos_=event->globalPos(); - } -} - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_axis_vertical.hh b/modules/gui/src/plot_viewer/plot_axis_vertical.hh deleted file mode 100644 index e6412b7d0244768cc23395b31179d1c7eb4b43fd..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_axis_vertical.hh +++ /dev/null @@ -1,42 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_AXIS_VERTICAL_HH_ -#define PLOT_AXIS_VERTICAL_HH_ - -/* - Author: Andreas Schenk -*/ - -#include "plot_axis_base.hh" - -namespace ost{namespace gui{ - -class DLLEXPORT_OST_GUI PlotAxisVertical: public PlotAxisBase -{ -public: - PlotAxisVertical(QWidget * parent = 0); - virtual ~PlotAxisVertical(); -protected: - virtual void paintEvent(QPaintEvent* paint_event); - virtual void mouseMoveEvent ( QMouseEvent * event ); -}; - -}}//ns - -#endif /*PLOT_AXIS_VERTICAL_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_data.cc b/modules/gui/src/plot_viewer/plot_data.cc deleted file mode 100644 index 2955482a60b310b16d681dc7b46a25852777a2f8..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_data.cc +++ /dev/null @@ -1,149 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include <limits> -#include <sstream> -#include "plot_data.hh" - -namespace ost{namespace gui{ - -PlotData::PlotData(): - PlotDataBase(), - minx_(std::numeric_limits<Real>().max()), - maxx_(-std::numeric_limits<Real>().max()), - miny_(std::numeric_limits<Real>().max()), - maxy_(-std::numeric_limits<Real>().max()), - pde_vector_() -{ -} - -PlotData::~PlotData() -{ -} - -void PlotData::AddXYQ(Real x, Real y, Real w, const QString& n) -{ - AddXEYEQ(x, 0.0, y, 0.0,w, n); -} -void PlotData::AddXYE(Real x, Real y, Real e, const QString& n) -{ - AddXEYEQ(x, 0.0, y, e,1.0, n); -} -void PlotData::AddXYEQ(Real x, Real y, Real e,Real q, const QString& n) -{ - AddXEYEQ(x, 0.0, y, e,q, n); -} -void PlotData::AddXEYE(Real x, Real ex, Real y, Real ey, const QString& n) -{ - AddXEYEQ(x, ex, y, ey ,1.0, n); -} -void PlotData::AddXY(Real x, Real y, const QString& n) -{ - AddXEYEQ(x, 0, y, 0,1, n); -} - -void PlotData::AddYQ(Real y, Real w, const QString& n) -{ - AddYEQ(y, 0.0,w, n); -} -void PlotData::AddYE(Real y, Real e, const QString& n) -{ - AddYEQ(y, e,1.0, n); -} -void PlotData::AddY(Real y, const QString& n) -{ - AddYEQ(y, 0,1, n); -} - -void PlotData::AddYEQ(Real y, Real ey, Real w, const QString& n) -{ - static int x=0; - AddXEYEQ(x,0,y,ey,w,n); - ++x; -} - -void PlotData::AddXEYEQ(Real x, Real ex, Real y, Real ey, Real q, const QString& n) -{ - pde_vector_.push_back(PlotDataEntry(x, ex, y, ey,q, n)); - minx_=std::min(minx_, x); - maxx_=std::max(maxx_, x); - miny_=std::min(miny_, y); - maxy_=std::max(maxy_, y); -} - -void PlotData::Clear() -{ - pde_vector_.clear(); - minx_=std::numeric_limits<Real>().max(); - maxx_=-std::numeric_limits<Real>().max(); - miny_=std::numeric_limits<Real>().max(); - maxy_=-std::numeric_limits<Real>().max(); -} -Real PlotData::GetMinimumX() -{ - if(minx_>maxx_){ - return 0.0; - }else{ - return minx_; - } -} -Real PlotData::GetMaximumX() -{ - if(minx_>maxx_){ - return 1.0; - }else if(minx_==maxx_){ - return minx_+1.0; - }else{ - return maxx_; - } -} -Real PlotData::GetMinimumY() -{ - if(miny_>maxy_){ - return 0.0; - }else{ - return miny_; - } -} -Real PlotData::GetMaximumY() -{ - if(miny_>maxy_){ - return 1.0; - }else if(miny_==maxy_){ - return miny_+1.0; - }else{ - return maxy_; - } -} - - -PlotDataEntry PlotData::GetPlotDataEntry(unsigned int idx) -{ - return pde_vector_[idx]; -} - -unsigned int PlotData::GetCount() -{ - return pde_vector_.size(); -} - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_data.hh b/modules/gui/src/plot_viewer/plot_data.hh deleted file mode 100644 index 8790d9b063a8066674004710d4d4c90683e829de..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_data.hh +++ /dev/null @@ -1,75 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ - - -#ifndef PLOT_DATA_HH_ -#define PLOT_DATA_HH_ - - -/* - Author: Andreas Schenk -*/ - -#include <vector> -#include <boost/shared_ptr.hpp> -#include <ost/gui/module_config.hh> -#include "plot_data_base.hh" -#include "plot_data_entry.hh" - -namespace ost{namespace gui{ - -class DLLEXPORT_OST_GUI PlotData: public PlotDataBase -{ -public: - PlotData(); - virtual ~PlotData(); - - virtual Real GetMinimumX(); - virtual Real GetMaximumX(); - virtual Real GetMinimumY(); - virtual Real GetMaximumY(); - - void AddXY(Real x, Real y, const QString& info = ""); - void AddXYQ(Real x, Real y, Real Q, const QString& info = ""); - void AddXYEQ(Real x, Real y,Real e, Real q, const QString& info = ""); - void AddXYE(Real x, Real y, Real e, const QString& info = ""); - void AddXEYE(Real x, Real ex, Real y, Real ey, const QString& info = ""); - void AddXEYEQ(Real x, Real ex, Real y, Real ey,Real Q, const QString& info = ""); - void AddY(Real y, const QString& info = ""); - void AddYQ(Real y, Real Q, const QString& info = ""); - void AddYE(Real y, Real e, const QString& info = ""); - void AddYEQ(Real y, Real ey,Real Q, const QString& info = ""); - void Clear(); - - PlotDataEntry GetPlotDataEntry(unsigned int idx); - unsigned int GetCount(); - -protected: - Real minx_; - Real maxx_; - Real miny_; - Real maxy_; - std::vector<PlotDataEntry> pde_vector_; -}; - -typedef boost::shared_ptr<PlotData> PlotDataPtr; - -}}//ns - -#endif /*PLOT_DATA_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_data_base.cc b/modules/gui/src/plot_viewer/plot_data_base.cc deleted file mode 100644 index 1c1474087b122d32e98be05cb55ad2c48bd15c07..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_data_base.cc +++ /dev/null @@ -1,35 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include "plot_data_base.hh" - -namespace ost{namespace gui{ - -PlotDataBase::PlotDataBase() -{ -} - -PlotDataBase::~PlotDataBase() -{ -} - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_data_base.hh b/modules/gui/src/plot_viewer/plot_data_base.hh deleted file mode 100644 index 587daf00411a8a946584203664d343080ff3b2c5..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_data_base.hh +++ /dev/null @@ -1,43 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_DATA_BASE_HH_ -#define PLOT_DATA_BASE_HH_ - -/* - Author: Andreas Schenk -*/ - -#include <boost/shared_ptr.hpp> -#include <ost/gui/module_config.hh> - -namespace ost{namespace gui{ - -class DLLEXPORT_OST_GUI PlotDataBase -{ -public: - PlotDataBase(); - virtual ~PlotDataBase(); -protected: -}; - -typedef boost::shared_ptr<PlotDataBase> PlotDataBasePtr; - -}}//ns - -#endif /*PLOT_DATA_BASE_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_data_entry.hh b/modules/gui/src/plot_viewer/plot_data_entry.hh deleted file mode 100644 index 5fed0c683392c89ce7d476a5f4c9a7ede022f889..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_data_entry.hh +++ /dev/null @@ -1,49 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_DATA_POINT_HH_ -#define PLOT_DATA_POINT_HH_ - - -/* - Author: Andreas Schenk -*/ - -#include <ost/gui/module_config.hh> -#include <QString> - -namespace ost{namespace gui{ - -class DLLEXPORT_OST_GUI PlotDataEntry { -public: - PlotDataEntry(Real x_=0, Real ex_=0, Real y_=0, Real ey_=0, Real q_=1, - const QString& info_ = ""): - x(x_), y(y_), ex(ex_), ey(ey_), q(q_), info(info_) {} - Real x; - Real y; - Real ex; - Real ey; - Real q; - QString info; -}; - - - -}}//ns - -#endif /*PLOT_DATA_POINT_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_data_graphics_item.cc b/modules/gui/src/plot_viewer/plot_data_graphics_item.cc deleted file mode 100644 index 098f06bca2f4ab55048c125821a8695c49ad7742..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_data_graphics_item.cc +++ /dev/null @@ -1,141 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - - -#include <ost/gui/python_shell/python_interpreter.hh> -#include <ost/dyn_cast.hh> -#include "plot_data_info.hh" -#include "plot_graphics_ellipse_item.hh" -#include "plot_graphics_rectangle_item.hh" -#include "plot_graphics_cross_item.hh" -#include "plot_graphics_diagonal_cross_item.hh" -#include "plot_data_graphics_item.hh" - -#include <QtAlgorithms> - -namespace ost{namespace gui{ - -PlotDataGraphicsItem::PlotDataGraphicsItem(const PlotDataInfoPtr& info,const PlotDataPtr& dataptr, QGraphicsItem * parent): - PlotDataGraphicsItemBase(info,parent), - dataptr_(dataptr) -{ -} - -PlotDataGraphicsItem::~PlotDataGraphicsItem() -{ -} - - -void PlotDataGraphicsItem::Redraw() -{ - unsigned int zvalue=0; - qDeleteAll(childItems()); - if(dataptr_->GetCount()==0){ - return; - } - PlotDataInfoPtr infoptr=dyn_cast<PlotDataInfo>(infoptr_); - switch(infoptr->errormode){ - case PlotDataInfo::NONE: - break; - case PlotDataInfo::LINE: - break; - case PlotDataInfo::BOX: - break; - case PlotDataInfo::VECTOR: - break; - default: - break; - } - switch(infoptr->mode){ - case PlotDataInfo::LINES: - case PlotDataInfo::POINTSANDLINES: - //draw lines - { - PlotDataEntry old=dataptr_->GetPlotDataEntry(0); - for (unsigned int i=1;i<dataptr_->GetCount();++i) { - PlotDataEntry pde=dataptr_->GetPlotDataEntry(i); - QGraphicsLineItem* line=new QGraphicsLineItem(old.x,old.y,pde.x,pde.y,this); - line->setZValue(++zvalue); - line->setPen(infoptr->pen); - old=pde; - } - break; - } - case PlotDataInfo::AREA: - case PlotDataInfo::POINTSANDAREA: - //draw area - break; - default: - break; - } - switch(infoptr->mode){ - case PlotDataInfo::POINTS: - case PlotDataInfo::POINTSANDLINES: - case PlotDataInfo::POINTSANDAREA: - //draw points - switch(infoptr->shape){ - case PlotDataInfo::CIRCLE: - for (unsigned int i=0;i<dataptr_->GetCount();++i) { - PlotDataEntry pde=dataptr_->GetPlotDataEntry(i); - PlotGraphicsEllipseItem* ellipse=new PlotGraphicsEllipseItem(pde,infoptr,this); - ellipse->setZValue(++zvalue); - } - break; - case PlotDataInfo::RECTANGLE: - for (unsigned int i=0;i<dataptr_->GetCount();++i) { - PlotDataEntry pde=dataptr_->GetPlotDataEntry(i); - PlotGraphicsRectangleItem* rect=new PlotGraphicsRectangleItem(pde,infoptr,this); - rect->setZValue(++zvalue); - } - break; - case PlotDataInfo::CROSS: - for (unsigned int i=0;i<dataptr_->GetCount();++i) { - PlotDataEntry pde=dataptr_->GetPlotDataEntry(i); - PlotGraphicsCrossItem* cross=new PlotGraphicsCrossItem(pde,infoptr,this); - cross->setZValue(++zvalue); - } - break; - case PlotDataInfo::DIAGONALCROSS: - for (unsigned int i=0;i<dataptr_->GetCount();++i) { - PlotDataEntry pde=dataptr_->GetPlotDataEntry(i); - PlotGraphicsDiagonalCrossItem* diagcross=new PlotGraphicsDiagonalCrossItem(pde,infoptr,this); - diagcross->setZValue(++zvalue); - } - break; - default: - break; - } - break; - default: - break; - } -} - -void PlotDataGraphicsItem::Callback(const PlotDataEntry& pde) -{ - // PlotDataInfoPtr infoptr=dyn_cast<PlotDataInfo>(infoptr_); - // if(infoptr->callback!=boost::python::object()){ - // PythonInterpreter::Instance().CallFunction(infoptr->callback,boost::python::make_tuple(pde.x,pde.y,pde.ex,pde.ey,pde.q,boost::python::str(pde.info.toStdString().c_str()))); - // } -} - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_data_graphics_item.hh b/modules/gui/src/plot_viewer/plot_data_graphics_item.hh deleted file mode 100644 index eda504efe4d547e67865b570b92fd8017968d63d..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_data_graphics_item.hh +++ /dev/null @@ -1,41 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_DATA_GRAPHICS_ITEM_HH_ -#define PLOT_DATA_GRAPHICS_ITEM_HH_ - -#include "plot_data_graphics_item_base.hh" -#include "plot_data.hh" - -namespace ost{namespace gui{ - -class PlotDataGraphicsItem: public PlotDataGraphicsItemBase -{ -public: - PlotDataGraphicsItem (const PlotDataInfoPtr& info,const PlotDataPtr& dataptr, QGraphicsItem * parent = 0 ); - virtual ~PlotDataGraphicsItem(); - void Callback(const PlotDataEntry& pde); - virtual void Redraw(); - -protected: - PlotDataPtr dataptr_; -}; - -}}//ns - -#endif /*PLOT_DATA_GRAPHICS_ITEM_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_data_graphics_item_base.cc b/modules/gui/src/plot_viewer/plot_data_graphics_item_base.cc deleted file mode 100644 index dff5d4bc88ac9bba5493e9a9df956a9e748eb6fe..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_data_graphics_item_base.cc +++ /dev/null @@ -1,78 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include "plot_data_info.hh" -#include "plot_data_graphics_item_base.hh" - -namespace ost{namespace gui{ - -PlotDataGraphicsItemBase::PlotDataGraphicsItemBase(const PlotInfoBasePtr& info, QGraphicsItem * parent): - QObject(), - QGraphicsItem(parent), - infoptr_(info), - dirty_(true) -{ - connect(infoptr_.get(),SIGNAL(visibilityChanged()),this,SLOT(OnVisibilityChange())); - connect(infoptr_.get(),SIGNAL(appearanceChanged()),this,SLOT(OnAppearanceChange())); -} - -PlotDataGraphicsItemBase::~PlotDataGraphicsItemBase() -{ -} - - - -void PlotDataGraphicsItemBase::paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) -{ - -} - -QRectF PlotDataGraphicsItemBase::boundingRect() const -{ - return childrenBoundingRect(); -} - -void PlotDataGraphicsItemBase::Redraw() -{ - dirty_=false; -} -void PlotDataGraphicsItemBase::update ( const QRectF & rect) -{ - if(dirty_){ - dirty_=false; - Redraw(); - } -} -void PlotDataGraphicsItemBase::OnAppearanceChange() -{ - dirty_=true; - update(); -} - -void PlotDataGraphicsItemBase::OnVisibilityChange() -{ - setVisible(infoptr_->visible); - update(); -} - - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_data_graphics_item_base.hh b/modules/gui/src/plot_viewer/plot_data_graphics_item_base.hh deleted file mode 100644 index 0a08efb05e343f283e1d9a5b87b0001d22ddf5be..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_data_graphics_item_base.hh +++ /dev/null @@ -1,56 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_DATA_GRAPHICS_ITEM_BASE_HH_ -#define PLOT_DATA_GRAPHICS_ITEM_BASE_HH_ - -/* - Author: Andreas Schenk -*/ - - -#include <ost/gui/module_config.hh> -#include "plot_info_base.hh" - -#include <QGraphicsItem> -#include <QObject> -namespace ost{namespace gui{ - -class DLLEXPORT_OST_GUI PlotDataGraphicsItemBase: public QObject, public QGraphicsItem -{ - Q_OBJECT -public: - PlotDataGraphicsItemBase(const PlotInfoBasePtr& info,QGraphicsItem * parent = 0); - virtual ~PlotDataGraphicsItemBase(); - virtual void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ); - virtual QRectF boundingRect() const; - virtual void Redraw(); - -public slots: - void OnAppearanceChange(); - void OnVisibilityChange(); - void update ( const QRectF & rect = QRectF() ); - -protected: - PlotInfoBasePtr infoptr_; - bool dirty_; -}; - -}}//ns - -#endif /*PLOT_DATA_GRAPHICS_ITEM_BASE_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_data_info.cc b/modules/gui/src/plot_viewer/plot_data_info.cc deleted file mode 100644 index d4199295226e4f4de7418f763f88a588d8c33d5b..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_data_info.cc +++ /dev/null @@ -1,85 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include "plot_data_info.hh" - -namespace ost{namespace gui{ - -PlotDataInfo::PlotDataInfo(PlotViewerPanel * viewer): - PlotInfoBase(viewer), - shape(CIRCLE), - symbolsize(2), - errormode(NONE), - errorscalex(1), - errorscaley(1), - use_weights(false) -{ - name="Data"; -} - -PlotDataInfo::PlotDataInfo(const PlotDataInfo& pdi): - PlotInfoBase(pdi), - shape(pdi.shape), - symbolsize(pdi.symbolsize), - errormode(pdi.errormode), - errorscalex(pdi.errorscalex), - errorscaley(pdi.errorscaley), - use_weights(pdi.use_weights) -{ -} - -PlotDataInfo& PlotDataInfo::SetSymbol(unsigned int val) -{ - shape=val; - emit appearanceChanged(); - return *this; -} -PlotDataInfo& PlotDataInfo::SetSymbolSize(unsigned int val) -{ - symbolsize=val; - emit appearanceChanged(); - return *this; -} -PlotDataInfo& PlotDataInfo::SetErrorMode(unsigned int val) -{ - errormode=val; - emit appearanceChanged(); - return *this; -} - -PlotDataInfo& PlotDataInfo::SetQuality(bool val) -{ - use_weights=val; - emit appearanceChanged(); - return *this; -} - - - -PlotDataInfo& PlotDataInfo::SetCallback(const boost::python::object& cb) -{ - callback=cb; - return *this; -} - - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_data_info.hh b/modules/gui/src/plot_viewer/plot_data_info.hh deleted file mode 100644 index 5e5f4767a1316a4865724475c3f77b8adee01285..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_data_info.hh +++ /dev/null @@ -1,59 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_DATA_INFO_HH_ -#define PLOT_DATA_INFO_HH_ - - -/* - Author: Andreas Schenk -*/ - -#include <boost/python.hpp> -#include <ost/gui/module_config.hh> -#include <ost/gui/plot_viewer/plot_data_info_fw.hh> -#include <vector> - -#include "plot_info_base.hh" - - -namespace ost{namespace gui{ - -class DLLEXPORT_OST_GUI PlotDataInfo : public PlotInfoBase -{ -public: - PlotDataInfo(PlotViewerPanel * viewer=0); - PlotDataInfo(const PlotDataInfo&); - virtual PlotDataInfo& SetSymbol(unsigned int val); - virtual PlotDataInfo& SetSymbolSize(unsigned int val); - virtual PlotDataInfo& SetErrorMode(unsigned int val); - virtual PlotDataInfo& SetQuality(bool val); - virtual PlotDataInfo& SetCallback(const boost::python::object & callback_); - unsigned int shape; - unsigned int symbolsize; - unsigned int errormode; - Real errorscalex; - Real errorscaley; - bool use_weights; - boost::python::object callback; - -}; - -typedef std::vector<PlotDataInfoPtr> PlotDataInfoVector; -}}//ns -#endif /*PLOT_DATA_INFO_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_data_info_fw.hh b/modules/gui/src/plot_viewer/plot_data_info_fw.hh deleted file mode 100644 index 27f32770d60291b5238e5c0ca0b017911a585316..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_data_info_fw.hh +++ /dev/null @@ -1,35 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_DATA_INFO_FW_HH_ -#define PLOT_DATA_INFO_FW_HH_ - -/* - Author: Andreas Schenk -*/ - -#include <boost/shared_ptr.hpp> - -namespace ost{namespace gui{ - -class PlotDataInfo; - -typedef boost::shared_ptr<PlotDataInfo> PlotDataInfoPtr; - -}}//ns -#endif /*PLOT_DATA_INFO_FW_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_function.cc b/modules/gui/src/plot_viewer/plot_function.cc deleted file mode 100644 index 2b10657a9fc9d8869022f9a79c047b3fd3776965..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_function.cc +++ /dev/null @@ -1,37 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include "plot_function.hh" - -namespace ost{namespace gui{ - -PlotFunction::PlotFunction(): - PlotDataBase() -{ -} - -PlotFunction::~PlotFunction() -{ -} - - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_function.hh b/modules/gui/src/plot_viewer/plot_function.hh deleted file mode 100644 index c61e7e13504f95b270345e5683a1058262c5c701..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_function.hh +++ /dev/null @@ -1,46 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_FUNCTION_HH_ -#define PLOT_FUNCTION_HH_ - -/* - Author: Andreas Schenk -*/ - -#include <boost/shared_ptr.hpp> -#include <ost/gui/module_config.hh> -#include "plot_data_base.hh" - -namespace ost{namespace gui{ - -class DLLEXPORT_OST_GUI PlotFunction: public PlotDataBase -{ -public: - PlotFunction(); - virtual ~PlotFunction(); - virtual Real Func(Real val) const=0; -}; - -typedef boost::shared_ptr<PlotFunction> PlotFunctionPtr; - -}}//ns - - - -#endif /*PLOT_FUNCTION_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_function_graphics_item.cc b/modules/gui/src/plot_viewer/plot_function_graphics_item.cc deleted file mode 100644 index 5c017ea09a995a8c0a6b8351b28c8f57cdb9785f..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_function_graphics_item.cc +++ /dev/null @@ -1,77 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include <ost/dyn_cast.hh> - -#include "plot_data_info.hh" -#include "plot_function_graphics_item.hh" - -namespace ost{namespace gui{ - -PlotFunctionGraphicsItem::PlotFunctionGraphicsItem(const PlotFunctionInfoPtr& info,const PlotFunctionPtr& functionptr, QGraphicsItem * parent): - PlotDataGraphicsItemBase(info,parent), - functionptr_(functionptr) -{ -} - -PlotFunctionGraphicsItem::~PlotFunctionGraphicsItem() -{ -} - - - -void PlotFunctionGraphicsItem::Redraw() -{ - unsigned int zvalue=0; - qDeleteAll(childItems()); - PlotFunctionInfoPtr infoptr=dyn_cast<PlotFunctionInfo>(infoptr_); - switch(infoptr->mode){ - case PlotInfoBase::LINES: - case PlotInfoBase::POINTSANDLINES: - case PlotInfoBase::POINTS: - //draw lines - { - Real xold=infoptr->start; - Real yold=functionptr_->Func(xold); - for (Real x=xold+infoptr->delta;x<=infoptr->end;x+=infoptr->delta) { - Real y=functionptr_->Func(x); - QGraphicsLineItem* line=new QGraphicsLineItem(xold,yold,x,y,this); - line->setZValue(++zvalue); - line->setPen(infoptr->pen); - xold=x; - yold=y; - } - break; - } - case PlotInfoBase::AREA: - case PlotInfoBase::POINTSANDAREA: - //draw area - break; - default: - break; - } -} - - - - -}} diff --git a/modules/gui/src/plot_viewer/plot_function_graphics_item.hh b/modules/gui/src/plot_viewer/plot_function_graphics_item.hh deleted file mode 100644 index 84da4314b12db9038d0fc62cf0e4be3a1993ac45..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_function_graphics_item.hh +++ /dev/null @@ -1,47 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_FUNCTION_GRAPHICS_ITEM_HH_ -#define PLOT_FUNCTION_GRAPHICS_ITEM_HH_ - -/* - Author: Andreas Schenk -*/ - -#include "plot_data_graphics_item_base.hh" -#include "plot_function.hh" -#include "plot_function_info.hh" - -#include <QGraphicsItem> -namespace ost{namespace gui{ - -class DLLEXPORT_OST_GUI PlotFunctionGraphicsItem: public PlotDataGraphicsItemBase -{ -public: - PlotFunctionGraphicsItem (const PlotFunctionInfoPtr& info,const PlotFunctionPtr& functionptr, QGraphicsItem * parent = 0 ); - virtual ~PlotFunctionGraphicsItem(); - virtual void Redraw(); - - -protected: - PlotFunctionPtr functionptr_; -}; - -}} - -#endif /*PLOT_FUNCTION_GRAPHICS_ITEM_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_function_info.cc b/modules/gui/src/plot_viewer/plot_function_info.cc deleted file mode 100644 index e991e0c9cdedba2a6cbf06474a5ff04c89465d12..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_function_info.cc +++ /dev/null @@ -1,50 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include "plot_function_info.hh" -#include "plot_viewer_panel.hh" - -namespace ost{namespace gui{ - -PlotFunctionInfo::PlotFunctionInfo(PlotViewerPanel * viewer): - PlotInfoBase(viewer), - start(0.0), - end(1.0), - delta(1.0) -{ - name="Function"; - connect(viewer,SIGNAL(rangeChanged(Real,Real,Real)),this,SLOT(OnRangeChange(Real,Real,Real))); -} - -PlotFunctionInfo::~PlotFunctionInfo() -{ -} - -void PlotFunctionInfo::OnRangeChange(Real s,Real e,Real d) -{ - start=s; - end=e; - delta=d; - emit appearanceChanged(); -} - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_function_info.hh b/modules/gui/src/plot_viewer/plot_function_info.hh deleted file mode 100644 index 27661bc607f32bf0f3328a9c493d943115ba912f..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_function_info.hh +++ /dev/null @@ -1,48 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_FUNCTION_INFO_HH_ -#define PLOT_FUNCTION_INFO_HH_ - -/* - Author: Andreas Schenk -*/ - -#include <boost/shared_ptr.hpp> -#include "plot_info_base.hh" - -namespace ost{namespace gui{ - -class DLLEXPORT_OST_GUI PlotFunctionInfo: public PlotInfoBase -{ - Q_OBJECT -public: - PlotFunctionInfo(PlotViewerPanel * viewer=0); - virtual ~PlotFunctionInfo(); - Real start; - Real end; - Real delta; -public slots: - void OnRangeChange(Real start,Real end,Real delta); -}; - -typedef boost::shared_ptr<PlotFunctionInfo> PlotFunctionInfoPtr; - -}}//ns - -#endif /*PLOT_FUNCTION_INFO_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_graphics_cross_item.cc b/modules/gui/src/plot_viewer/plot_graphics_cross_item.cc deleted file mode 100644 index 52f70067a58e30715bddbf8524e5a87b66a238a0..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_graphics_cross_item.cc +++ /dev/null @@ -1,76 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include "plot_data_info.hh" -#include "plot_data_graphics_item.hh" -#include "plot_graphics_cross_item.hh" -#include <QCursor> -#include <QToolTip> - -namespace ost {namespace gui { - -PlotGraphicsCrossItem::PlotGraphicsCrossItem(const PlotDataEntry& entry,const PlotDataInfoPtr& info , QGraphicsItem * parent): - QGraphicsPathItem(parent), - pde_(entry) -{ - setPos(pde_.x,pde_.y); - setPen(info->pen); - setBrush(info->brush); - setFlags(QGraphicsItem::ItemIgnoresTransformations); - setAcceptHoverEvents(true); - setCursor(Qt::CrossCursor); - QPainterPath path; - path.moveTo(-static_cast<Real>(info->symbolsize)/2.0, 0.0); - path.lineTo(static_cast<Real>(info->symbolsize)/2.0, 0.0); - path.moveTo(0.0,-static_cast<Real>(info->symbolsize)/2.0); - path.lineTo(0.0,static_cast<Real>(info->symbolsize)/2.0); - setPath(path); -} - -PlotGraphicsCrossItem::~PlotGraphicsCrossItem() -{ - // TODO Auto-generated destructor stub -} - -void PlotGraphicsCrossItem::hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) -{ - QToolTip::showText(event->screenPos(),QString("x: %1\ny: %2\nex: %3\ney: %4\nq: %5\ni: %6") - .arg(pde_.x) - .arg(pde_.y) - .arg(pde_.ex) - .arg(pde_.ey) - .arg(pde_.q) - .arg(pde_.info), - event->widget()); -} - -void PlotGraphicsCrossItem::hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) -{ - QToolTip::showText(event->screenPos(),QString(),event->widget()); -} - -void PlotGraphicsCrossItem::mousePressEvent( QGraphicsSceneMouseEvent * event ) -{ - dynamic_cast<PlotDataGraphicsItem*>(parentItem())->Callback(pde_); -} - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_graphics_cross_item.hh b/modules/gui/src/plot_viewer/plot_graphics_cross_item.hh deleted file mode 100644 index ce89659df2e5a4d22bf0d1f2514415d899b08eb8..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_graphics_cross_item.hh +++ /dev/null @@ -1,48 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_GRAPHICS_CROSS_ITEM_HH_ -#define PLOT_GRAPHICS_CROSS_ITEM_HH_ - -/* - Author: Andreas Schenk -*/ - -#include "plot_data_entry.hh" -#include "plot_data_info_fw.hh" -#include <QGraphicsItem> -#include <QGraphicsSceneHoverEvent> - -namespace ost {namespace gui { - -class DLLEXPORT_OST_GUI PlotGraphicsCrossItem: public QGraphicsPathItem -{ -public: - PlotGraphicsCrossItem(const PlotDataEntry& entry,const PlotDataInfoPtr& info , QGraphicsItem * parent); - virtual ~PlotGraphicsCrossItem(); -protected: - virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ); - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void mousePressEvent ( QGraphicsSceneMouseEvent * event ); - PlotDataEntry pde_; -}; - - -}}//ns - -#endif /* PLOT_GRAPHICS_CROSS_ITEM_HH_ */ diff --git a/modules/gui/src/plot_viewer/plot_graphics_diagonal_cross_item.cc b/modules/gui/src/plot_viewer/plot_graphics_diagonal_cross_item.cc deleted file mode 100644 index a60ded4cecb8e5646f69853c3249972b29f4e75d..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_graphics_diagonal_cross_item.cc +++ /dev/null @@ -1,75 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ -#include "plot_data_info.hh" -#include "plot_data_graphics_item.hh" -#include "plot_graphics_diagonal_cross_item.hh" -#include <QCursor> -#include <QToolTip> - -namespace ost {namespace gui { - -PlotGraphicsDiagonalCrossItem::PlotGraphicsDiagonalCrossItem(const PlotDataEntry& entry,const PlotDataInfoPtr& info , QGraphicsItem * parent): - QGraphicsPathItem(parent), - pde_(entry) -{ - setPos(pde_.x,pde_.y); - setPen(info->pen); - setBrush(info->brush); - setFlags(QGraphicsItem::ItemIgnoresTransformations); - setAcceptHoverEvents(true); - setCursor(Qt::CrossCursor); - QPainterPath path; - path.moveTo(-static_cast<Real>(info->symbolsize)/2.0, -static_cast<Real>(info->symbolsize)/2.0); - path.lineTo(static_cast<Real>(info->symbolsize)/2.0, static_cast<Real>(info->symbolsize)/2.0); - path.moveTo(static_cast<Real>(info->symbolsize)/2.0,-static_cast<Real>(info->symbolsize)/2.0); - path.lineTo(-static_cast<Real>(info->symbolsize)/2.0,static_cast<Real>(info->symbolsize)/2.0); - setPath(path); -} - -PlotGraphicsDiagonalCrossItem::~PlotGraphicsDiagonalCrossItem() -{ - // TODO Auto-generated destructor stub -} - -void PlotGraphicsDiagonalCrossItem::hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) -{ - QToolTip::showText(event->screenPos(),QString("x: %1\ny: %2\nex: %3\ney: %4\nq: %5\ni: %6") - .arg(pde_.x) - .arg(pde_.y) - .arg(pde_.ex) - .arg(pde_.ey) - .arg(pde_.q) - .arg(pde_.info), - event->widget()); -} - -void PlotGraphicsDiagonalCrossItem::hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) -{ - QToolTip::showText(event->screenPos(),QString(),event->widget()); -} - -void PlotGraphicsDiagonalCrossItem::mousePressEvent( QGraphicsSceneMouseEvent * event ) -{ - dynamic_cast<PlotDataGraphicsItem*>(parentItem())->Callback(pde_); -} - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_graphics_diagonal_cross_item.hh b/modules/gui/src/plot_viewer/plot_graphics_diagonal_cross_item.hh deleted file mode 100644 index 4b185b8371df0a91454d3ccabf50405341dba99a..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_graphics_diagonal_cross_item.hh +++ /dev/null @@ -1,48 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_GRAPHICS_DIAGONAL_CROSS_ITEM_HH_ -#define PLOT_GRAPHICS_DIAGONAL_CROSS_ITEM_HH_ - -/* - Author: Andreas Schenk -*/ - -#include "plot_data_entry.hh" -#include "plot_data_info_fw.hh" -#include <QGraphicsItem> -#include <QGraphicsSceneHoverEvent> - -namespace ost {namespace gui { - -class DLLEXPORT_OST_GUI PlotGraphicsDiagonalCrossItem: public QGraphicsPathItem -{ -public: - PlotGraphicsDiagonalCrossItem(const PlotDataEntry& entry,const PlotDataInfoPtr& info , QGraphicsItem * parent); - virtual ~PlotGraphicsDiagonalCrossItem(); -protected: - virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ); - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void mousePressEvent ( QGraphicsSceneMouseEvent * event ); - PlotDataEntry pde_; -}; - - -}}//ns - -#endif /* PLOT_GRAPHICS_DIAGONAL_CROSS_ITEM_HH_ */ diff --git a/modules/gui/src/plot_viewer/plot_graphics_ellipse_item.cc b/modules/gui/src/plot_viewer/plot_graphics_ellipse_item.cc deleted file mode 100644 index abf995841dcb87edac7601614dfa97cf725f4f62..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_graphics_ellipse_item.cc +++ /dev/null @@ -1,70 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include "plot_data_info.hh" -#include "plot_data_graphics_item.hh" -#include "plot_graphics_ellipse_item.hh" -#include <QCursor> -#include <QToolTip> - -namespace ost{namespace gui{ - -PlotGraphicsEllipseItem::PlotGraphicsEllipseItem(const PlotDataEntry& entry,const PlotDataInfoPtr& info , QGraphicsItem * parent): - QGraphicsEllipseItem(-static_cast<Real>(info->symbolsize)/2.0, -static_cast<Real>(info->symbolsize)/2.0, info->symbolsize, info->symbolsize,parent), - pde_(entry) -{ - setPos(pde_.x,pde_.y); - setPen(info->pen); - setBrush(info->brush); - setFlags(QGraphicsItem::ItemIgnoresTransformations); - setAcceptHoverEvents(true); - setCursor(Qt::CrossCursor); -} - -PlotGraphicsEllipseItem::~PlotGraphicsEllipseItem() -{ -} - -void PlotGraphicsEllipseItem::hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) -{ - QToolTip::showText(event->screenPos(),QString("x: %1\ny: %2\nex: %3\ney: %4\nq: %5\ni: %6") - .arg(pde_.x) - .arg(pde_.y) - .arg(pde_.ex) - .arg(pde_.ey) - .arg(pde_.q) - .arg(pde_.info), - event->widget()); -} - -void PlotGraphicsEllipseItem::hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) -{ - QToolTip::showText(event->screenPos(),QString(),event->widget()); -} - -void PlotGraphicsEllipseItem::mousePressEvent( QGraphicsSceneMouseEvent * event ) -{ - dynamic_cast<PlotDataGraphicsItem*>(parentItem())->Callback(pde_); -} - - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_graphics_ellipse_item.hh b/modules/gui/src/plot_viewer/plot_graphics_ellipse_item.hh deleted file mode 100644 index 9aa90807243d3b92601b030af81fcad7a86143a1..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_graphics_ellipse_item.hh +++ /dev/null @@ -1,47 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_GRAPHICS_ELLIPSE_ITEM_HH_ -#define PLOT_GRAPHICS_ELLIPSE_ITEM_HH_ - -/* - Author: Andreas Schenk -*/ - -#include "plot_data_entry.hh" -#include "plot_data_info_fw.hh" -#include <QGraphicsItem> -#include <QGraphicsSceneHoverEvent> - -namespace ost{namespace gui{ - -class DLLEXPORT_OST_GUI PlotGraphicsEllipseItem: public QGraphicsEllipseItem -{ -public: - PlotGraphicsEllipseItem(const PlotDataEntry& entry,const PlotDataInfoPtr& info , QGraphicsItem * parent); - virtual ~PlotGraphicsEllipseItem(); -protected: - virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ); - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void mousePressEvent ( QGraphicsSceneMouseEvent * event ); - PlotDataEntry pde_; -}; - -}}//ns - -#endif /*PLOT_GRAPHICS_ELLIPSE_ITEM_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_graphics_rectangle_item.cc b/modules/gui/src/plot_viewer/plot_graphics_rectangle_item.cc deleted file mode 100644 index 60d1f8f5ecde16887cec93831585a034e03911a5..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_graphics_rectangle_item.cc +++ /dev/null @@ -1,70 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include "plot_data_info.hh" -#include "plot_data_graphics_item.hh" -#include "plot_graphics_rectangle_item.hh" -#include <QCursor> -#include <QToolTip> - -namespace ost {namespace gui { - -PlotGraphicsRectangleItem::PlotGraphicsRectangleItem(const PlotDataEntry& entry,const PlotDataInfoPtr& info , QGraphicsItem * parent): - QGraphicsRectItem(-static_cast<Real>(info->symbolsize)/2.0, -static_cast<Real>(info->symbolsize)/2.0, info->symbolsize, info->symbolsize,parent), - pde_(entry) -{ - setPos(pde_.x,pde_.y); - setPen(info->pen); - setBrush(info->brush); - setFlags(QGraphicsItem::ItemIgnoresTransformations); - setAcceptHoverEvents(true); - setCursor(Qt::CrossCursor); -} - -PlotGraphicsRectangleItem::~PlotGraphicsRectangleItem() -{ - // TODO Auto-generated destructor stub -} - -void PlotGraphicsRectangleItem::hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) -{ - QToolTip::showText(event->screenPos(),QString("x: %1\ny: %2\nex: %3\ney: %4\nq: %5\ni: %6") - .arg(pde_.x) - .arg(pde_.y) - .arg(pde_.ex) - .arg(pde_.ey) - .arg(pde_.q) - .arg(pde_.info), - event->widget()); -} - -void PlotGraphicsRectangleItem::hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) -{ - QToolTip::showText(event->screenPos(),QString(),event->widget()); -} - -void PlotGraphicsRectangleItem::mousePressEvent( QGraphicsSceneMouseEvent * event ) -{ - dynamic_cast<PlotDataGraphicsItem*>(parentItem())->Callback(pde_); -} - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_graphics_rectangle_item.hh b/modules/gui/src/plot_viewer/plot_graphics_rectangle_item.hh deleted file mode 100644 index b0b08eb611ce0f839b17a198c0fdcb2bfa253634..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_graphics_rectangle_item.hh +++ /dev/null @@ -1,47 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOTGRAPHICSRECTANGLEITEM_H_ -#define PLOTGRAPHICSRECTANGLEITEM_H_ - -/* - Author: Andreas Schenk -*/ - -#include "plot_data_entry.hh" -#include "plot_data_info_fw.hh" -#include <QGraphicsRectItem> -#include <QGraphicsSceneHoverEvent> - -namespace ost {namespace gui { - -class DLLEXPORT_OST_GUI PlotGraphicsRectangleItem: public QGraphicsRectItem -{ -public: - PlotGraphicsRectangleItem(const PlotDataEntry& entry,const PlotDataInfoPtr& info , QGraphicsItem * parent); - virtual ~PlotGraphicsRectangleItem(); -protected: - virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ); - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); - virtual void mousePressEvent ( QGraphicsSceneMouseEvent * event ); - PlotDataEntry pde_; -}; - -}}//ns - -#endif /* PLOTGRAPHICSRECTANGLEITEM_H_ */ diff --git a/modules/gui/src/plot_viewer/plot_group.cc b/modules/gui/src/plot_viewer/plot_group.cc deleted file mode 100644 index d3bcfc410d6bff698c0ed840b2b89dbb4b77e40a..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_group.cc +++ /dev/null @@ -1,162 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ -#include <limits> - -#include <ost/dyn_cast.hh> - -#include "plot_group.hh" - -namespace ost{namespace gui{ - -PlotGroup::PlotGroup(): - PlotDataBase(), - ptr_list_() -{ -} - -PlotGroup::~PlotGroup() -{ -} - -void PlotGroup::Add(PlotDataPtr dataptr) -{ - ptr_list_.push_back(dataptr); -} -void PlotGroup::Add(PlotFunctionPtr functionptr) -{ - ptr_list_.push_back(functionptr); -} -void PlotGroup::Add(PlotGroupPtr groupptr) -{ - ptr_list_.push_back(groupptr); -} - -unsigned int PlotGroup::GetSize() -{ - return ptr_list_.size(); -} -PlotDataBasePtr PlotGroup::GetChild(unsigned int index) -{ - return ptr_list_[index]; -} -Real PlotGroup::GetMinimumX() -{ - Real minx=std::numeric_limits<Real>::max(); - unsigned int count=0; - for(unsigned int i=0;i<GetSize();++i){ - PlotDataPtr dataptr=dyn_cast<PlotData>(GetChild(i)); - if(dataptr!=PlotDataPtr()){ - ++count; - minx=std::min<Real>(minx,dataptr->GetMinimumX()); - }else{ - PlotGroupPtr groupptr=dyn_cast<PlotGroup>(GetChild(i)); - if(groupptr!=PlotGroupPtr()){ - ++count; - minx=std::min<Real>(minx,groupptr->GetMinimumX()); - }else{ - //ignore - } - } - } - if(count==0){ - return 0.0; - }else{ - return minx; - } -} -Real PlotGroup::GetMaximumX() -{ - Real maxx=-std::numeric_limits<Real>::max(); - unsigned int count=0; - for(unsigned int i=0;i<GetSize();++i){ - PlotDataPtr dataptr=dyn_cast<PlotData>(GetChild(i)); - if(dataptr!=PlotDataPtr()){ - ++count; - maxx=std::max<Real>(maxx,dataptr->GetMaximumX()); - }else{ - PlotGroupPtr groupptr=dyn_cast<PlotGroup>(GetChild(i)); - if(groupptr!=PlotGroupPtr()){ - ++count; - maxx=std::max<Real>(maxx,groupptr->GetMaximumX()); - }else{ - //ignore - } - } - } - if(count==0){ - return 1.0; - }else{ - return maxx; - } -} -Real PlotGroup::GetMinimumY() -{ - Real miny=std::numeric_limits<Real>::max(); - unsigned int count=0; - for(unsigned int i=0;i<GetSize();++i){ - PlotDataPtr dataptr=dyn_cast<PlotData>(GetChild(i)); - if(dataptr!=PlotDataPtr()){ - ++count; - miny=std::min<Real>(miny,dataptr->GetMinimumY()); - }else{ - PlotGroupPtr groupptr=dyn_cast<PlotGroup>(GetChild(i)); - if(groupptr!=PlotGroupPtr()){ - ++count; - miny=std::min<Real>(miny,groupptr->GetMinimumY()); - }else{ - //ignore - } - } - } - if(count==0){ - return 0.0; - }else{ - return miny; - } -} -Real PlotGroup::GetMaximumY() -{ - Real maxy=-std::numeric_limits<Real>::max(); - unsigned int count=0; - for(unsigned int i=0;i<GetSize();++i){ - PlotDataPtr dataptr=dyn_cast<PlotData>(GetChild(i)); - if(dataptr!=PlotDataPtr()){ - ++count; - maxy=std::max<Real>(maxy,dataptr->GetMaximumY()); - }else{ - PlotGroupPtr groupptr=dyn_cast<PlotGroup>(GetChild(i)); - if(groupptr!=PlotGroupPtr()){ - ++count; - maxy=std::max<Real>(maxy,groupptr->GetMaximumY()); - }else{ - //ignore - } - } - } - if(count==0){ - return 1.0; - }else{ - return maxy; - } -} - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_group.hh b/modules/gui/src/plot_viewer/plot_group.hh deleted file mode 100644 index c2b030145b7a0ec42e614a162b942933fc480560..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_group.hh +++ /dev/null @@ -1,59 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_GROUP_HH_ -#define PLOT_GROUP_HH_ - - -/* - Author: Andreas Schenk -*/ - -#include <vector> -#include <boost/shared_ptr.hpp> -#include "plot_types.hh" -#include "plot_data.hh" -#include "plot_function.hh" - -namespace ost{namespace gui{ - -class PlotGroup; -typedef boost::shared_ptr<PlotGroup> PlotGroupPtr; - -class DLLEXPORT_OST_GUI PlotGroup : public PlotDataBase -{ -public: - PlotGroup(); - virtual ~PlotGroup(); - void Add(PlotDataPtr dataptr); - void Add(PlotFunctionPtr functionptr); - void Add(PlotGroupPtr groupptr); - unsigned int GetSize(); - PlotDataBasePtr GetChild(unsigned int index); - virtual Real GetMinimumX(); - virtual Real GetMaximumX(); - virtual Real GetMinimumY(); - virtual Real GetMaximumY(); -private: - std::vector<PlotDataBasePtr> ptr_list_; -}; - - -}}//ns - -#endif /*PLOT_GROUP_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_group_graphics_item.cc b/modules/gui/src/plot_viewer/plot_group_graphics_item.cc deleted file mode 100644 index 9157f1cbd255b8606e106fc2c9ceabeabd1808b8..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_group_graphics_item.cc +++ /dev/null @@ -1,74 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include <ost/dyn_cast.hh> -#include "plot_data_info.hh" -#include "plot_function_info.hh" -#include "plot_data_graphics_item.hh" -#include "plot_function_graphics_item.hh" -#include "plot_group_graphics_item.hh" - -namespace ost{namespace gui{ - -PlotGroupGraphicsItem::PlotGroupGraphicsItem(const PlotGroupInfoPtr& info,const PlotGroupPtr& groupptr, QGraphicsItem * parent): - PlotDataGraphicsItemBase(info,parent), - groupptr_(groupptr) -{ - for(unsigned int i=0;i<groupptr->GetSize();++i){ - PlotDataPtr dataptr=dyn_cast<PlotData>(groupptr->GetChild(i)); - if(dataptr!=PlotDataPtr()){ - PlotDataInfoPtr plotdatainfoptr(new PlotDataInfo()); - new PlotDataGraphicsItem(plotdatainfoptr,dataptr,this); - info->Add(plotdatainfoptr); - }else{ - PlotFunctionPtr functionptr=dyn_cast<PlotFunction>(groupptr->GetChild(i)); - if(functionptr!=PlotFunctionPtr()){ - PlotFunctionInfoPtr plotfunctioninfoptr(new PlotFunctionInfo()); - new PlotFunctionGraphicsItem(plotfunctioninfoptr,functionptr,this); - info->Add(plotfunctioninfoptr); - }else{ - PlotGroupPtr cgroupptr=dyn_cast<PlotGroup>(groupptr->GetChild(i)); - if(cgroupptr!=PlotGroupPtr()){ - PlotGroupInfoPtr plotgroupinfoptr(new PlotGroupInfo()); - new PlotGroupGraphicsItem(plotgroupinfoptr,groupptr); - info->Add(plotgroupinfoptr); - }else{ - //should never be reached - } - } - } - } -} - -PlotGroupGraphicsItem::~PlotGroupGraphicsItem() -{ -} - -void PlotGroupGraphicsItem::Redraw() -{ - QList<QGraphicsItem *> children=childItems(); - for(int i=0;i<children.size();++i){ - dynamic_cast<PlotDataGraphicsItemBase*>(children[i])->Redraw(); - } -} - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_group_graphics_item.hh b/modules/gui/src/plot_viewer/plot_group_graphics_item.hh deleted file mode 100644 index f1f97d615b7e9f948c1c02e2a42ee2989c727bdf..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_group_graphics_item.hh +++ /dev/null @@ -1,44 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_GROUP_GRAPHICS_ITEM_HH_ -#define PLOT_GROUP_GRAPHICS_ITEM_HH_ - -/* - Author: Andreas Schenk -*/ - -#include "plot_group_info.hh" -#include "plot_group.hh" -#include "plot_data_graphics_item_base.hh" - -namespace ost{namespace gui{ - -class DLLEXPORT_OST_GUI PlotGroupGraphicsItem: public PlotDataGraphicsItemBase -{ -public: - PlotGroupGraphicsItem(const PlotGroupInfoPtr& info,const PlotGroupPtr& groupptr, QGraphicsItem * parent = 0 ); - virtual ~PlotGroupGraphicsItem(); - virtual void Redraw(); -protected: - PlotGroupPtr groupptr_; -}; - -}} - -#endif /*PLOT_GROUP_GRAPHICS_ITEM_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_group_info.cc b/modules/gui/src/plot_viewer/plot_group_info.cc deleted file mode 100644 index 25f799d331023a121708ef4960469bb53185badf..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_group_info.cc +++ /dev/null @@ -1,166 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#include <ost/dyn_cast.hh> - -#include "plot_group_info.hh" -#include "plot_data_info.hh" - -namespace ost{namespace gui{ - -PlotGroupInfo::PlotGroupInfo(PlotViewerPanel * viewer): - PlotInfoBase(viewer), - children_() -{ - name="Group"; -} - -PlotGroupInfo::~PlotGroupInfo() -{ -} - -void PlotGroupInfo::Add(PlotInfoBasePtr info) -{ - children_.push_back(info); -} - -unsigned int PlotGroupInfo:: GetSize() -{ - return children_.size(); -} - -PlotInfoBasePtr PlotGroupInfo::GetChild(unsigned int i) -{ - return children_[i]; -} - -PlotGroupInfo& PlotGroupInfo::SetSymbol(unsigned int val) -{ - for(PlotInfoBasePtrVector::iterator it=children_.begin();it!=children_.end();++it){ - PlotDataInfoPtr infoptr=dyn_cast<PlotDataInfo>(*it); - if(infoptr!=PlotDataInfoPtr()){ - infoptr->SetSymbol(val); - } - } - return *this; -} - -PlotGroupInfo& PlotGroupInfo::SetSymbolSize(unsigned int val) -{ - for(PlotInfoBasePtrVector::iterator it=children_.begin();it!=children_.end();++it){ - PlotDataInfoPtr infoptr=dyn_cast<PlotDataInfo>(*it); - if(infoptr!=PlotDataInfoPtr()){ - infoptr->SetSymbolSize(val); - } - } - return *this; -} - -PlotGroupInfo& PlotGroupInfo::SetErrorMode(unsigned int val) -{ - for(PlotInfoBasePtrVector::iterator it=children_.begin();it!=children_.end();++it){ - PlotDataInfoPtr infoptr=dyn_cast<PlotDataInfo>(*it); - if(infoptr!=PlotDataInfoPtr()){ - infoptr->SetErrorMode(val); - } - } - return *this; -} - -PlotGroupInfo& PlotGroupInfo::SetQuality(bool val) -{ - for(PlotInfoBasePtrVector::iterator it=children_.begin();it!=children_.end();++it){ - PlotDataInfoPtr infoptr=dyn_cast<PlotDataInfo>(*it); - if(infoptr!=PlotDataInfoPtr()){ - infoptr->SetQuality(val); - } - } - return *this; -} - -PlotGroupInfo& PlotGroupInfo::SetCallback(const boost::python::object & callback_) -{ - for(PlotInfoBasePtrVector::iterator it=children_.begin();it!=children_.end();++it){ - PlotDataInfoPtr infoptr=dyn_cast<PlotDataInfo>(*it); - if(infoptr!=PlotDataInfoPtr()){ - infoptr->SetCallback(callback_); - } - } - return *this; -} - - - -PlotGroupInfo& PlotGroupInfo::SetMode(unsigned int val) -{ - for(PlotInfoBasePtrVector::iterator it=children_.begin();it!=children_.end();++it){ - (*it)->SetMode(val); - } - return *this; -} - -PlotGroupInfo& PlotGroupInfo::SetColor(const QColor& color) -{ - for(PlotInfoBasePtrVector::iterator it=children_.begin();it!=children_.end();++it){ - (*it)->SetColor(color); - } - return *this; -} - -PlotGroupInfo& PlotGroupInfo::SetColor(int r, int g, int b) -{ - for(PlotInfoBasePtrVector::iterator it=children_.begin();it!=children_.end();++it){ - (*it)->SetColor(r,g,b); - } - return *this; -} - -PlotGroupInfo& PlotGroupInfo::SetLineColor(int r, int g, int b) -{ - for(PlotInfoBasePtrVector::iterator it=children_.begin();it!=children_.end();++it){ - (*it)->SetLineColor(r,g,b); - } - return *this; -} - -PlotGroupInfo& PlotGroupInfo::SetFillColor(int r, int g, int b) -{ - for(PlotInfoBasePtrVector::iterator it=children_.begin();it!=children_.end();++it){ - (*it)->SetFillColor(r,g,b); - } - return *this; -} - -PlotGroupInfo& PlotGroupInfo::SetLineColor(const QColor& color) -{ - for(PlotInfoBasePtrVector::iterator it=children_.begin();it!=children_.end();++it){ - (*it)->SetLineColor(color); - } - return *this; -} - -PlotGroupInfo& PlotGroupInfo::SetFillColor(const QColor& color) -{ - for(PlotInfoBasePtrVector::iterator it=children_.begin();it!=children_.end();++it){ - (*it)->SetLineColor(color); - } - return *this; -} - - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_group_info.hh b/modules/gui/src/plot_viewer/plot_group_info.hh deleted file mode 100644 index f99c8d5e1d4dd88c1fae06082180970abd2f044b..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_group_info.hh +++ /dev/null @@ -1,61 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_GROUP_INFO_HH_ -#define PLOT_GROUP_INFO_HH_ - -#include <boost/python.hpp> -#include "plot_info_base.hh" -#include <vector> -#include <boost/shared_ptr.hpp> - -namespace ost{namespace gui{ - -class DLLEXPORT_OST_GUI PlotGroupInfo: public PlotInfoBase -{ - typedef std::vector<PlotInfoBasePtr> PlotInfoBasePtrVector; -public: - PlotGroupInfo(PlotViewerPanel * viewer=0); - virtual ~PlotGroupInfo(); - virtual PlotGroupInfo& SetSymbol(unsigned int val); - virtual PlotGroupInfo& SetSymbolSize(unsigned int val); - virtual PlotGroupInfo& SetErrorMode(unsigned int val); - virtual PlotGroupInfo& SetQuality(bool val); - virtual PlotGroupInfo& SetCallback(const boost::python::object & callback_); - - virtual PlotGroupInfo& SetMode(unsigned int val); - virtual PlotGroupInfo& SetColor(const QColor& color); - virtual PlotGroupInfo& SetColor(int r, int g, int b); - virtual PlotGroupInfo& SetLineColor(int r, int g, int b); - virtual PlotGroupInfo& SetFillColor(int r, int g, int b); - virtual PlotGroupInfo& SetLineColor(const QColor& color); - virtual PlotGroupInfo& SetFillColor(const QColor& color); - void Add(PlotInfoBasePtr info); - unsigned int GetSize(); - PlotInfoBasePtr GetChild(unsigned int i); -protected: - PlotInfoBasePtrVector children_; -}; - -typedef boost::shared_ptr<PlotGroupInfo> PlotGroupInfoPtr; - - -}}//ns - - -#endif /*PLOT_GROUP_INFO_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_info_base.cc b/modules/gui/src/plot_viewer/plot_info_base.cc deleted file mode 100644 index aa284a623c524072b8cb448699529e8aa658fd43..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_info_base.cc +++ /dev/null @@ -1,109 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include "plot_info_base.hh" - -namespace ost { namespace gui { - -PlotInfoBase::PlotInfoBase(PlotViewerPanel * viewer): - QObject(), - name(""), - pen(QPen(QColor(0,0,0))), - brush(QBrush(QColor(255,255,255))), - mode(LINE), - visible(true) -{ -} - -PlotInfoBase::PlotInfoBase(const PlotInfoBase& pib): - QObject(), - name(pib.name), - pen(pib.pen), - brush(pib.brush), - mode(pib.mode), - visible(pib.visible) -{ -} - -PlotInfoBase::~PlotInfoBase() -{ -} - - -PlotInfoBase& PlotInfoBase::SetMode(unsigned int val) -{ - mode=val; - emit appearanceChanged(); - return *this; -} - -PlotInfoBase& PlotInfoBase::SetVisible(bool val) -{ - visible=val; - emit visibilityChanged(); - return *this; -} - -PlotInfoBase& PlotInfoBase::SetColor(const QColor& color) -{ - pen.setColor(color); - brush.setColor(color); - emit appearanceChanged(); - return *this; -} - -PlotInfoBase& PlotInfoBase::SetColor(int r, int g, int b) -{ - return SetColor(QColor(r,g,b)); -} - -PlotInfoBase& PlotInfoBase::SetLineColor(int r, int g, int b) -{ - return SetLineColor(QColor(r,g,b)); -} - -PlotInfoBase& PlotInfoBase::SetLineColor(const QColor& color) -{ - pen.setColor(color); - emit appearanceChanged(); - return *this; -} - -PlotInfoBase& PlotInfoBase::SetFillColor(int r, int g, int b) -{ - return SetFillColor(QColor(r,g,b)); -} -PlotInfoBase& PlotInfoBase::SetFillColor(const QColor& color) -{ - brush.setColor(color); - emit appearanceChanged(); - return *this; -} - -PlotInfoBase& PlotInfoBase::SetName(const QString& n) -{ - name=n; - emit nameChanged(); - return *this; -} - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_info_base.hh b/modules/gui/src/plot_viewer/plot_info_base.hh deleted file mode 100644 index 9b40d6ab4ec243067e1e4e2cdd9f7a3437fd131c..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_info_base.hh +++ /dev/null @@ -1,90 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_INFO_BASE_HH_ -#define PLOT_INFO_BASE_HH_ - -/* - Author: Andreas Schenk -*/ - -#include <boost/shared_ptr.hpp> - -#include <ost/gui/module_config.hh> - -#include <QObject> -#include <QColor> -#include <QPen> -#include <QBrush> -namespace ost{namespace gui{ - -//fw decl -class PlotViewerPanel; - -class DLLEXPORT_OST_GUI PlotInfoBase: public QObject -{ - Q_OBJECT -public: - enum modes{ - POINTS, - LINES, - POINTSANDLINES, - AREA, - POINTSANDAREA - }; - enum shapes{ - CIRCLE, - RECTANGLE, - CROSS, - DIAGONALCROSS - }; - enum errormodes{ - NONE, - LINE, - BOX, - VECTOR - }; - PlotInfoBase(PlotViewerPanel * viewer=0); - PlotInfoBase(const PlotInfoBase&); - virtual ~PlotInfoBase(); - - virtual PlotInfoBase& SetName(const QString& n); - virtual PlotInfoBase& SetMode(unsigned int val); - virtual PlotInfoBase& SetVisible(bool val); - virtual PlotInfoBase& SetColor(const QColor& color); - virtual PlotInfoBase& SetColor(int r, int g, int b); - virtual PlotInfoBase& SetLineColor(int r, int g, int b); - virtual PlotInfoBase& SetFillColor(int r, int g, int b); - virtual PlotInfoBase& SetLineColor(const QColor& color); - virtual PlotInfoBase& SetFillColor(const QColor& color); - QString name; - QPen pen; - QBrush brush; - unsigned int mode; - bool visible; - -signals: - void appearanceChanged(); - void visibilityChanged(); - void nameChanged(); -}; -typedef boost::shared_ptr<PlotInfoBase> PlotInfoBasePtr; - -}}//ns - -#endif /*PLOT_INFO_BASE_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_legend_panel.cc b/modules/gui/src/plot_viewer/plot_legend_panel.cc deleted file mode 100644 index e02ae5dce15f25ddd48e3996e42944acefc658ba..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_legend_panel.cc +++ /dev/null @@ -1,100 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include <ost/dyn_cast.hh> -#include "plot_legend_panel.hh" - -#include <QMetaType> -Q_DECLARE_METATYPE(ost::gui::PlotInfoBasePtr) - - -namespace ost{namespace gui{ - - -PlotLegendPanel::PlotLegendPanel(QWidget* parent): - QTreeWidget(parent) -{ - setColumnCount(3); - setHeaderLabels(QStringList() << "Dataset" << "Visible" << "Apprearance"); - connect(this,SIGNAL(itemChanged(QTreeWidgetItem*, int)),this,SLOT(OnItemChanged(QTreeWidgetItem*, int))); -} - -PlotLegendPanel::~PlotLegendPanel() -{ -} - -QTreeWidgetItem* PlotLegendPanel::create_item_(const PlotInfoBasePtr& info) -{ - QTreeWidgetItem* item=new QTreeWidgetItem(QStringList(info->name)); - item->setCheckState(1,Qt::Checked); - item->setData(0,Qt::UserRole,QVariant::fromValue(info)); - return item; -} - -void PlotLegendPanel::AddData(const PlotDataInfoPtr& info) -{ - addTopLevelItem(create_item_(info)); -} - -void PlotLegendPanel::AddFunction(const PlotFunctionInfoPtr& info) -{ - addTopLevelItem(create_item_(info)); -} - -void PlotLegendPanel::AddGroup(const PlotGroupInfoPtr& info) -{ - QTreeWidgetItem* item=create_item_(info); - generate_group_(info,item); - addTopLevelItem(item); -} - -void PlotLegendPanel::generate_group_(const PlotGroupInfoPtr& info, QTreeWidgetItem* parent) -{ - for(unsigned int i=0;i<info->GetSize();++i){ - PlotDataInfoPtr dataptr=dyn_cast<PlotDataInfo>(info->GetChild(i)); - if(dataptr!=PlotDataInfoPtr()){ - parent->addChild(create_item_(dataptr)); - }else{ - PlotFunctionInfoPtr functionptr=dyn_cast<PlotFunctionInfo>(info->GetChild(i)); - if(functionptr!=PlotFunctionInfoPtr()){ - parent->addChild(create_item_(functionptr)); - }else{ - PlotGroupInfoPtr groupptr=dyn_cast<PlotGroupInfo>(info->GetChild(i)); - if(groupptr!=PlotGroupInfoPtr()){ - QTreeWidgetItem* child=create_item_(groupptr); - generate_group_(groupptr,child); - parent->addChild(child); - }else{ - //should never be reached - } - } - } - } -} -void PlotLegendPanel::OnItemChanged(QTreeWidgetItem * item, int column ) -{ - if(column==1){ - item->data(0,Qt::UserRole).value<PlotInfoBasePtr>()->SetVisible(item->checkState(1)); - } -} - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_legend_panel.hh b/modules/gui/src/plot_viewer/plot_legend_panel.hh deleted file mode 100644 index 09c595018f5bfe2ecf5fcf82635013486f0942cb..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_legend_panel.hh +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_LEGEND_PANEL_HH_ -#define PLOT_LEGEND_PANEL_HH_ - -/* - Author: Andreas Schenk -*/ - -#include "plot_data_info.hh" -#include "plot_group_info.hh" -#include "plot_function_info.hh" - -#include <QTreeWidget> -#include <QTreeWidgetItem> -namespace ost{namespace gui{ - -class DLLEXPORT_OST_GUI PlotLegendPanel:public QTreeWidget -{ - Q_OBJECT -public: - PlotLegendPanel(QWidget* parent=0); - virtual ~PlotLegendPanel(); - void AddData(const PlotDataInfoPtr& info); - void AddFunction(const PlotFunctionInfoPtr& info); - void AddGroup(const PlotGroupInfoPtr& info); -public slots: - void OnItemChanged(QTreeWidgetItem * item, int column ); -protected: - void generate_group_(const PlotGroupInfoPtr& info, QTreeWidgetItem* parent); - QTreeWidgetItem* create_item_(const PlotInfoBasePtr& info); -}; - -}}//ns - -#endif /*PLOT_LEGEND_PANEL_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_ticker.cc b/modules/gui/src/plot_viewer/plot_ticker.cc deleted file mode 100644 index 9577e6844d495dc1c06c986b00e3dce3b9d29845..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_ticker.cc +++ /dev/null @@ -1,93 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include <ost/gui/module_config.hh> // for round - -#include <cmath> -#include "plot_ticker.hh" - -PlotTickerBase::PlotTickerBase(): - min_(0.0), - max_(1.0), - start_(0), - end_(100), - separation_(20) -{ -} -PlotTickerBase::PlotTickerBase(Real min,Real max,int start,int end,unsigned int separation): - min_(min), - max_(max), - start_(start), - end_(end), - separation_(separation) -{ -} - -PlotTickerBase::~PlotTickerBase() -{ -} - - -PlotTickerLinear::PlotTickerLinear(): - PlotTickerBase() -{ -} - -PlotTickerLinear::PlotTickerLinear(Real min,Real max,int start,int end,unsigned int separation): - PlotTickerBase(min,max,start,end,separation) -{ -} -PlotTickerLinear::~PlotTickerLinear() -{ -} - -TickList PlotTickerLinear::GetTicks() -{ - TickList result; - Real sampling=static_cast<Real>(end_-start_)/(max_-min_); - int exponent=static_cast<int>(floor(log10( 1.0/sampling ))); - Real prefac=1; - while(1){ - //std::cout << sampling << " " << exponent << std::endl; - int prefacs[]={1,2,5}; - for(int i=0;i<3 && prefac*pow(10.0,exponent)*sampling<separation_;++i){ - prefac=prefacs[i]; - } - if(prefac*pow(10.0,exponent)*sampling>=separation_){ - break; - }else { - prefac=1; - ++exponent; - } - } - Real stepsize=prefac*pow(Real(10.0),static_cast<Real>(exponent)); - Real val=rint(min_/stepsize)*stepsize; - while(val<=max_){ - int pos=static_cast<int>(round(sampling*(val-min_)))+start_; - if(pos>=0){ - result.push_back(Tick(pos,val)); - } - val+=stepsize; - } - return result; -} - diff --git a/modules/gui/src/plot_viewer/plot_ticker.hh b/modules/gui/src/plot_viewer/plot_ticker.hh deleted file mode 100644 index da4e379baa520a11876538a56121f9a98f7440a5..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_ticker.hh +++ /dev/null @@ -1,72 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_TICKER_HH_ -#define PLOT_TICKER_HH_ - -/* - Author: Andreas Schenk -*/ - -#include <vector> -#include <utility> - -#include <ost/gui/module_config.hh> - -#include "plot_ticker_fw.hh" - -typedef std::pair<int,Real> Tick; -typedef std::vector<Tick> TickList; - -class DLLEXPORT_OST_GUI PlotTickerBase -{ -public: - PlotTickerBase(); - PlotTickerBase(Real min,Real max=1.0,int start=0,int end=100,unsigned int separation=20); - virtual ~PlotTickerBase(); - Real GetMinimum(){return min_;} - void SetMinimum(Real min=0.0){min_=min;} - Real GetMaximum(){return max_;} - void SetMaximum(Real max=1.0){max_=max;} - void SetMinMax(Real min=0.0,Real max=1.0){min_=min;max_=max;} - int GetStart(){return start_;} - void SetStart(int start=0){start_=start;} - int GetEnd(){return end_;} - void SetEnd(int end=100){end_=end;} - void SetStartEnd(int start=0,int end=100){start_=start;end_=end;} - unsigned int GetSeparation(){return separation_;} - void SetSeparation(unsigned int separation){separation_=separation;} - virtual TickList GetTicks()=0; -protected: - Real min_; - Real max_; - int start_; - int end_; - unsigned int separation_; -}; - -class DLLEXPORT_OST_GUI PlotTickerLinear: public PlotTickerBase -{ -public: - PlotTickerLinear(); - PlotTickerLinear(Real min,Real max=1.0,int start=0,int end=100,unsigned int separation=20); - virtual ~PlotTickerLinear(); - virtual TickList GetTicks(); -}; - -#endif /*PLOT_TICKER_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_ticker_fw.hh b/modules/gui/src/plot_viewer/plot_ticker_fw.hh deleted file mode 100644 index 46e54a3067b85ccf4cec527e7419dba2c4ce6f5b..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_ticker_fw.hh +++ /dev/null @@ -1,33 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_TICKER_FW_HH_ -#define PLOT_TICKER_FW_HH_ - -/* - Author: Andreas Schenk -*/ - -#include <boost/shared_ptr.hpp> - - -class PlotTickerBase; - -typedef boost::shared_ptr<PlotTickerBase> PlotTickerPtr; - -#endif /*PLOT_TICKER_FW_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_types.hh b/modules/gui/src/plot_viewer/plot_types.hh deleted file mode 100644 index ea773534bc2b870160ab2663e8af5b80d04175d1..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_types.hh +++ /dev/null @@ -1,52 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_TYPES_HH_ -#define PLOT_TYPES_HH_ - - -/* - Author: Andreas Schenk -*/ - -#include <QStandardItem> - - -namespace ost{namespace gui{ - -enum PlotTypes{ - PlotTypeDataPoint=QStandardItem::UserType+1, - PlotTypeData, - PlotTypeFunction, - PlotTypeGroup -}; - -enum PlotItemDataRoles{ - PlotTypeRole=Qt::UserRole+1, - PlotPDERole, - PlotFunctionDataRole, - PlotFunctionMinRole, - PlotFunctionMaxRole, - PlotFunctionStepRole, - PlotSymbolSizeRole, - PlotSymbolRole, - PlotModeRole -}; -}}//ns - -#endif /*PLOT_TYPES_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_viewer.cc b/modules/gui/src/plot_viewer/plot_viewer.cc deleted file mode 100644 index c0d1889df9cc30d024ac73b6e360584ea5af0231..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_viewer.cc +++ /dev/null @@ -1,126 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include <limits> - -#include "plot_viewer.hh" -#include "plot_viewer_panel.hh" -#include "plot_legend_panel.hh" -#include "plot_data_info.hh" -#include "plot_data_graphics_item.hh" -#include "plot_function_graphics_item.hh" -#include "plot_group_graphics_item.hh" - -#include <QHBoxLayout> -#include <QVBoxLayout> -namespace ost { namespace gui { - -PlotViewer::PlotViewer(QWidget* parent,const QString& name): - QWidget(parent), - scene_(), - viewer_(new PlotViewerPanel(&scene_,this)), - legend_(new PlotLegendPanel(this)), - model_(), - ptr_list_() -{ - scene_.setSceneRect(-std::numeric_limits<Real>::max()/2.0,-std::numeric_limits<Real>::max()/2.0,std::numeric_limits<Real>::max(),std::numeric_limits<Real>::max()); - setWindowTitle(name); - QHBoxLayout *hlayout = new QHBoxLayout; - hlayout->addWidget(viewer_,1); - hlayout->addWidget(legend_,0); - setLayout(hlayout); -} - -PlotViewer::~PlotViewer() -{ -} - -PlotDataInfoPtr PlotViewer::Add(PlotDataPtr dataptr, bool fit) -{ - PlotDataInfoPtr infoptr(new PlotDataInfo(viewer_)); - scene_.addItem(new PlotDataGraphicsItem(infoptr,dataptr)); - if(fit){ - viewer_->SetMinMax(dataptr->GetMinimumX(),dataptr->GetMaximumX(),dataptr->GetMinimumY(),dataptr->GetMaximumY()); - } - legend_->AddData(infoptr); - viewer_->update(); - return infoptr; -} - -PlotFunctionInfoPtr PlotViewer::Add(PlotFunctionPtr functionptr) -{ - PlotFunctionInfoPtr infoptr(new PlotFunctionInfo(viewer_)); - scene_.addItem(new PlotFunctionGraphicsItem(infoptr,functionptr)); - legend_->AddFunction(infoptr); - viewer_->update(); - return infoptr; -} -PlotGroupInfoPtr PlotViewer::Add(PlotGroupPtr groupptr,bool fit) -{ - PlotGroupInfoPtr infoptr(new PlotGroupInfo(viewer_)); - scene_.addItem(new PlotGroupGraphicsItem(infoptr,groupptr)); - if(fit){ - viewer_->SetMinMax(groupptr->GetMinimumX(),groupptr->GetMaximumX(),groupptr->GetMinimumY(),groupptr->GetMaximumY()); - } - legend_->AddGroup(infoptr); - viewer_->update(); - return infoptr; -} - -void PlotViewer::SetMinimumX(Real x) -{ - viewer_->SetMinimumX(x); -} -void PlotViewer::SetMaximumX(Real x) -{ - viewer_->SetMaximumX(x); -} -void PlotViewer::SetMinimumY(Real y) -{ - viewer_->SetMinimumY(y); -} -void PlotViewer::SetMaximumY(Real y) -{ - viewer_->SetMaximumY(y); -} -Real PlotViewer::GetMinimumX() const -{ - return viewer_->GetMinimumX(); -} -Real PlotViewer::GetMaximumX() const -{ - return viewer_->GetMaximumX(); -} -Real PlotViewer::GetMinimumY() const -{ - return viewer_->GetMinimumY(); -} -Real PlotViewer::GetMaximumY() const -{ - return viewer_->GetMaximumY(); -} - -void PlotViewer::SetAutofit(bool fit){ - viewer_->SetAutofit(fit); -} - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_viewer.hh b/modules/gui/src/plot_viewer/plot_viewer.hh deleted file mode 100644 index 15c2b25698f5b298cc10a07e10d918c37748ce1b..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_viewer.hh +++ /dev/null @@ -1,74 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_VIEWER_HH_ -#define PLOT_VIEWER_HH_ - -/* - Author: Andreas Schenk -*/ - - - -#include <QStandardItemModel> -#include <QGraphicsScene> -#include <QWidget> -#include <QString> -#include "plot_data.hh" -#include "plot_data_info_fw.hh" -#include "plot_group_info.hh" -#include "plot_function.hh" -#include "plot_group.hh" -#include "plot_function_info.hh" -namespace ost{namespace gui{ - - -//fw decl -class PlotViewerPanel; -class PlotLegendPanel; - - -class DLLEXPORT_OST_GUI PlotViewer: public QWidget -{ - typedef boost::shared_ptr<QStandardItem> QStandardItemPtr; -public: - PlotViewer(QWidget* parent,const QString& name=""); - virtual ~PlotViewer(); - PlotDataInfoPtr Add(PlotDataPtr dataptr, bool fit=false); - PlotFunctionInfoPtr Add(PlotFunctionPtr functionptr); - PlotGroupInfoPtr Add(PlotGroupPtr groupptr, bool fit=false); - void SetMinimumX(Real x); - void SetMaximumX(Real x); - void SetMinimumY(Real y); - void SetMaximumY(Real y); - Real GetMinimumX() const; - Real GetMaximumX() const; - Real GetMinimumY() const; - Real GetMaximumY() const; - void SetAutofit(bool fit=true); -private: - QGraphicsScene scene_; - PlotViewerPanel* viewer_; - PlotLegendPanel* legend_; - QStandardItemModel model_; - std::vector<QStandardItemPtr> ptr_list_; -}; - -}}//ns - -#endif /*PLOT_VIEWER_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_viewer_panel.cc b/modules/gui/src/plot_viewer/plot_viewer_panel.cc deleted file mode 100644 index 3fec69dc2808e5da3b458ec18c31fd2604771188..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_viewer_panel.cc +++ /dev/null @@ -1,251 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Author: Andreas Schenk -*/ - -#include "plot_viewer_panel.hh" -#include "plot_types.hh" -#include "plot_function.hh" -#include <QtGui> - -namespace ost{namespace gui{ - -PlotViewerPanel::PlotViewerPanel(QGraphicsScene * scene, QWidget* parent): - QGraphicsView(scene,parent), - axis_horizontal_(new PlotAxisHorizontal(this)), - axis_vertical_(new PlotAxisVertical(this)), - global_mouse_pos_(), - autofit_(false) -{ - setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setDragMode(QGraphicsView::NoDrag); - setRenderHint(QPainter::Antialiasing,true); - setViewportMargins (PlotAxisBase::AXISWIDTH,0,0,PlotAxisBase::AXISWIDTH); - setTransformationAnchor(QGraphicsView::NoAnchor); - setResizeAnchor(QGraphicsView::NoAnchor); - scale(1.0,-1.0); - connect(axis_horizontal_,SIGNAL(zoom(int,QPoint)),this, SLOT(OnZoomX(int,QPoint))); - connect(axis_vertical_,SIGNAL(zoom(int,QPoint)),this, SLOT(OnZoomY(int,QPoint))); - connect(axis_horizontal_,SIGNAL(translate(Real,Real)),this, SLOT(OnTranslate(Real ,Real))); - connect(axis_vertical_,SIGNAL(translate(Real,Real)),this, SLOT(OnTranslate(Real,Real))); -} - -PlotViewerPanel::~PlotViewerPanel() -{ -} - -void PlotViewerPanel::SetMinMax(Real minx,Real maxx,Real miny, Real maxy) -{ - QRectF scenerect; - scenerect.setCoords(minx,maxy,maxx,miny); - QRect viewrect(0,0,viewport()->width(),viewport()->height()); - setTransform(GetTransform(scenerect,viewrect)); - UpdateAxes(); -} - -void PlotViewerPanel::SetMinimumX(Real x) -{ - if(x<GetMaximumX()){ - QRectF scenerect; - scenerect.setCoords(x,GetMaximumY(),GetMaximumX(),GetMinimumY()); - QRect viewrect(0,0,viewport()->width(),viewport()->height()); - setTransform(GetTransform(scenerect,viewrect)); - UpdateAxes(); - } -} -void PlotViewerPanel::SetMaximumX(Real x) -{ - if(x>GetMinimumX()){ - QRectF scenerect; - scenerect.setCoords(GetMaximumX(),GetMinimumY(),x,GetMinimumY()); - QRect viewrect(0,0,viewport()->width(),viewport()->height()); - setTransform(GetTransform(scenerect,viewrect)); - UpdateAxes(); - } -} -void PlotViewerPanel::SetMinimumY(Real y) -{ - if(y<GetMaximumY()){ - QRectF scenerect; - scenerect.setCoords(GetMinimumX(),GetMaximumY(),GetMaximumX(),y); - QRect viewrect(0,0,viewport()->width(),viewport()->height()); - setTransform(GetTransform(scenerect,viewrect)); - UpdateAxes(); - } -} -void PlotViewerPanel::SetMaximumY(Real y) -{ - if(y>GetMinimumY()){ - QRectF scenerect; - scenerect.setCoords(GetMinimumX(),y,GetMaximumX(),GetMinimumY()); - QRect viewrect(0,0,viewport()->width(),viewport()->height()); - setTransform(GetTransform(scenerect,viewrect)); - UpdateAxes(); - } -} -Real PlotViewerPanel::GetMinimumX() const -{ - return mapToScene(QPoint(0,0)).x(); -} -Real PlotViewerPanel::GetMaximumX() const -{ - return mapToScene(QPoint(viewport()->width(),0)).x(); -} -Real PlotViewerPanel::GetMinimumY() const -{ - return mapToScene(QPoint(0,viewport()->height())).y(); -} -Real PlotViewerPanel::GetMaximumY() const -{ - return mapToScene(QPoint(0,0)).y(); -} - -Real PlotViewerPanel::GetDelta() const -{ - return mapToScene(QPoint(1,0)).x()-mapToScene(QPoint(0,0)).x(); -} - -void PlotViewerPanel::wheelEvent ( QWheelEvent * e ) -{ - QPointF cursorpos=mapToScene(e->pos()); - Real scalefactor=exp(e->delta()/1000.0); - QRectF scenerect; - scenerect.setCoords(cursorpos.x()-(cursorpos.x()-GetMinimumX())/scalefactor, - cursorpos.y()+(GetMaximumY()-cursorpos.y())/scalefactor, - cursorpos.x()+(GetMaximumX()-cursorpos.x())/scalefactor, - cursorpos.y()-(cursorpos.y()-GetMinimumY())/scalefactor); - QRect viewrect(0,0,viewport()->width(),viewport()->height()); - setTransform(GetTransform(scenerect,viewrect)); - UpdateAxes(); -} -void PlotViewerPanel::OnZoomX(int delta,QPoint pos) -{ - QPointF cursorpos=mapToScene(pos+QPoint(-int(PlotAxisBase::AXISWIDTH),0)); - Real scalefactor=exp(delta/1000.0); - QRectF scenerect; - scenerect.setCoords(cursorpos.x()-(cursorpos.x()-GetMinimumX())/scalefactor, - GetMaximumY(), - cursorpos.x()+(GetMaximumX()-cursorpos.x())/scalefactor, - GetMinimumY()); - QRect viewrect(0,0,viewport()->width(),viewport()->height()); - setTransform(GetTransform(scenerect,viewrect)); - UpdateAxes(); -} - -void PlotViewerPanel::OnZoomY(int delta,QPoint pos) -{ - QPointF cursorpos=mapToScene(pos); - Real scalefactor=exp(delta/1000.0); - QRectF scenerect; - scenerect.setCoords(GetMinimumX(), - cursorpos.y()+(GetMaximumY()-cursorpos.y())/scalefactor, - GetMaximumX(), - cursorpos.y()-(cursorpos.y()-GetMinimumY())/scalefactor); - QRect viewrect(0,0,viewport()->width(),viewport()->height()); - setTransform(GetTransform(scenerect,viewrect)); - UpdateAxes(); -} - -void PlotViewerPanel::resizeEvent ( QResizeEvent * event ) -{ - QGraphicsView::resizeEvent(event); - QRect cr=contentsRect(); - axis_horizontal_->setGeometry(QRect(cr.left(), cr.top()+cr.height()-PlotAxisBase::AXISWIDTH,cr.width(), PlotAxisBase::AXISWIDTH)); - axis_vertical_->setGeometry(QRect(cr.left(), cr.top(),PlotAxisBase::AXISWIDTH, cr.height())); - if(autofit_){ - QRectF scenerect; - scenerect.setCoords(GetMinimumX(), - GetMaximumY(), - mapToScene(QPoint(event->oldSize().width(),0)).x(), - mapToScene(QPoint(0,event->oldSize().height())).y()); - QRect viewrect(0,0,viewport()->width(),viewport()->height()); QGraphicsView::resizeEvent(event); - setTransform(GetTransform(scenerect,viewrect)); - }else{ - setTransform(transform().translate(0.0,(event->size().height()-event->oldSize().height())/transform().m22())); - } - UpdateAxes(); -} -void PlotViewerPanel::UpdateAxes() -{ - axis_horizontal_->SetMinimum(GetMinimumX()); - axis_horizontal_->SetMaximum(GetMaximumX()); - axis_vertical_->SetMinimum(GetMinimumY()); - axis_vertical_->SetMaximum(GetMaximumY()); - emit rangeChanged(GetMinimumX(),GetMaximumX(),GetDelta()); -} - -void PlotViewerPanel::scrollContentsBy ( int dx, int dy ) -{ - QGraphicsView::scrollContentsBy(dx,dy); - UpdateAxes(); -} - -void PlotViewerPanel::update() -{ - QGraphicsView::update(); - UpdateAxes(); -} - -void PlotViewerPanel::OnTranslate(Real dx, Real dy) -{ - translate(dx/transform ().m11(),dy/transform ().m22()); - update(); -} - -void PlotViewerPanel::mousePressEvent( QMouseEvent * event ) -{ - if(event->button()== Qt::LeftButton){ - global_mouse_pos_=event->globalPos(); - return; - } - QGraphicsView::mousePressEvent(event); -} -void PlotViewerPanel::mouseMoveEvent( QMouseEvent * event ) -{ - if(event->buttons() & Qt::LeftButton){ - OnTranslate(static_cast<Real>(event->globalPos().x()-global_mouse_pos_.x()),static_cast<Real>(event->globalPos().y()-global_mouse_pos_.y())); - global_mouse_pos_=event->globalPos(); - return; - } - QGraphicsView::mouseMoveEvent(event); -} - -QTransform PlotViewerPanel::GetTransform(QRectF scenerect, QRect viewrect) -{ - qreal vx1,vx2,vy1,vy2; - qreal x1,x2,y1,y2; - scenerect.getCoords(&x1,&y1,&x2,&y2);; - QRectF(viewrect).getCoords(&vx1,&vy1,&vx2,&vy2); - Real sx=(vx2-vx1)/(x2-x1); - Real sy=(vy2-vy1)/(y2-y1); - Real dx=vx1-sx*x1; - Real dy=vy1-sy*y1; - return QTransform(sx,0.0,0.0, - 0.0,sy,0.0, - dx,dy,1.0); -} - -void PlotViewerPanel::SetAutofit(bool fit) -{ - autofit_=fit; -} - -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_viewer_panel.hh b/modules/gui/src/plot_viewer/plot_viewer_panel.hh deleted file mode 100644 index 41753163cafba887ba7174dc99b2bb319df0e840..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_viewer_panel.hh +++ /dev/null @@ -1,76 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_VIEWER_PANEL_HH_ -#define PLOT_VIEWER_PANEL_HH_ - - -/* - Author: Andreas Schenk -*/ - -#include "plot_axis_horizontal.hh" -#include "plot_axis_vertical.hh" -#include <QWidget> -#include <QHash> -#include <QPair> -#include <QGraphicsView> - -namespace ost{namespace gui{ - -class DLLEXPORT_OST_GUI PlotViewerPanel:public QGraphicsView -{ - Q_OBJECT -public: - PlotViewerPanel(QGraphicsScene * scene, QWidget* parent=0); - virtual ~PlotViewerPanel(); - void SetMinimumX(Real x); - void SetMaximumX(Real x); - void SetMinimumY(Real x); - void SetMaximumY(Real x); - void SetMinMax(Real xmin,Real maxx,Real miny, Real maxy); - void SetAutofit(bool fit=true); - Real GetMinimumX() const; - Real GetMaximumX() const; - Real GetMinimumY() const; - Real GetMaximumY() const; - Real GetDelta() const; -public slots: - void OnZoomX(int delta,QPoint pos); - void OnZoomY(int delta,QPoint pos); - void OnTranslate(Real dx, Real dy); - void update(); -signals: - void rangeChanged(Real start, Real end, Real delta); -protected: - virtual void wheelEvent ( QWheelEvent * e ); - virtual void resizeEvent ( QResizeEvent * event ); - virtual void scrollContentsBy ( int dx, int dy ); - virtual void mousePressEvent ( QMouseEvent * event ); - virtual void mouseMoveEvent ( QMouseEvent * event ); - void UpdateAxes(); - QTransform GetTransform(QRectF scenerect, QRect viewrect); - PlotAxisHorizontal* axis_horizontal_; - PlotAxisVertical* axis_vertical_; - QPointF global_mouse_pos_; - bool autofit_; -}; - -}}//ns - -#endif /*PLOT_VIEWER_PANEL_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_viewer_proxy.cc b/modules/gui/src/plot_viewer/plot_viewer_proxy.cc deleted file mode 100644 index 4f926ce7474e87f8766126a72394824caa6adb0f..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_viewer_proxy.cc +++ /dev/null @@ -1,103 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -/* - Authors: Andreas Schenk, Johan Hebert, Ansgar Philippsen -*/ - -#include "plot_viewer.hh" -#include "plot_viewer_proxy.hh" -#include "plot_data_info.hh" - -namespace ost{namespace gui{ - -PlotViewerProxy::PlotViewerProxy(): - viewer_(0) -{ -} -PlotViewerProxy::PlotViewerProxy(PlotViewer* v): - viewer_(v) -{ -} - -PlotViewerProxy::~PlotViewerProxy() -{ -} - - - -void PlotViewerProxy::Release(PlotViewer* v) -{ - if(viewer_==v) { - viewer_=0; - } -} -PlotDataInfoPtr PlotViewerProxy::Add(PlotDataPtr dataptr, bool fit) -{ - if(! viewer_) return PlotDataInfoPtr(new PlotDataInfo()); - return viewer_->Add(dataptr,fit); -} -PlotFunctionInfoPtr PlotViewerProxy::Add(PlotFunctionPtr functionptr) -{ - if(! viewer_) return PlotFunctionInfoPtr(new PlotFunctionInfo()); - return viewer_->Add(functionptr); -} -PlotGroupInfoPtr PlotViewerProxy::Add(PlotGroupPtr groupptr, bool fit) -{ - if(! viewer_) return PlotGroupInfoPtr(new PlotGroupInfo()); - return viewer_->Add(groupptr,fit); -} - -void PlotViewerProxy::SetMinimumX(Real x) -{ - viewer_->SetMinimumX(x); -} -void PlotViewerProxy::SetMaximumX(Real x) -{ - viewer_->SetMaximumX(x); -} -void PlotViewerProxy::SetMinimumY(Real y) -{ - viewer_->SetMinimumY(y); -} -void PlotViewerProxy::SetMaximumY(Real y) -{ - viewer_->SetMaximumY(y); -} -Real PlotViewerProxy::GetMinimumX() const -{ - return viewer_->GetMinimumX(); -} -Real PlotViewerProxy::GetMaximumX() const -{ - return viewer_->GetMaximumX(); -} -Real PlotViewerProxy::GetMinimumY() const -{ - return viewer_->GetMinimumY(); -} -Real PlotViewerProxy::GetMaximumY() const -{ - return viewer_->GetMaximumY(); -} - -void PlotViewerProxy::SetAutofit(bool fit) -{ - viewer_->SetAutofit(fit); -} -}}//ns diff --git a/modules/gui/src/plot_viewer/plot_viewer_proxy.hh b/modules/gui/src/plot_viewer/plot_viewer_proxy.hh deleted file mode 100644 index 3da5b22036454355ee7aa0d39791724ae852fe3a..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_viewer_proxy.hh +++ /dev/null @@ -1,68 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_VEWER_PROXY_HH_ -#define PLOT_VEWER_PROXY_HH_ - -/* - Authors: Andreas Schenk, Johan Hebert, Ansgar Philippsen -*/ - -#include <boost/shared_ptr.hpp> - -#include "plot_viewer_proxy_fw.hh" - -//TODO add forward header to PlotData, etc. and include that -#include "plot_data.hh" -#include "plot_function.hh" -#include "plot_group.hh" -#include "plot_data_info_fw.hh" -#include "plot_function_info.hh" -#include "plot_group_info.hh" - -namespace ost{namespace gui{ - -//fw decl -class PlotViewer; - -class DLLEXPORT_OST_GUI PlotViewerProxy -{ -public: - PlotViewerProxy(); - PlotViewerProxy(PlotViewer* v); - virtual ~PlotViewerProxy(); - void Release(PlotViewer* v); - PlotDataInfoPtr Add(PlotDataPtr dataptr, bool fit=false); - PlotFunctionInfoPtr Add(PlotFunctionPtr functionptr); - PlotGroupInfoPtr Add(PlotGroupPtr groupptr, bool fit=false); - void SetMinimumX(Real x); - void SetMaximumX(Real x); - void SetMinimumY(Real y); - void SetMaximumY(Real y); - Real GetMinimumX() const; - Real GetMaximumX() const; - Real GetMinimumY() const; - Real GetMaximumY() const; - void SetAutofit(bool fit=true); -private: - PlotViewer* viewer_; -}; - -}}//ns - -#endif /*PLOT_VEWER_PROXY_HH_*/ diff --git a/modules/gui/src/plot_viewer/plot_viewer_proxy_fw.hh b/modules/gui/src/plot_viewer/plot_viewer_proxy_fw.hh deleted file mode 100644 index e4ac6c8812b8fe6c3b514fc662e57c7a77842b3a..0000000000000000000000000000000000000000 --- a/modules/gui/src/plot_viewer/plot_viewer_proxy_fw.hh +++ /dev/null @@ -1,37 +0,0 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2010 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library 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 Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef PLOT_VEWER_PROXY_FW_HH_ -#define PLOT_VEWER_PROXY_FW_HH_ - -/* - Author: Ansgar Philippsen -*/ - -#include <boost/shared_ptr.hpp> - -namespace ost { namespace gui { - -class PlotViewerProxy; -class PlotViewer; - -typedef boost::shared_ptr<PlotViewerProxy> PlotViewerProxyPtr; - -}} - -#endif