Personal tools
You are here: Home Forum Install & build GUI build error in /Plot2d with qwt-5.0.2

GUI build error in /Plot2d with qwt-5.0.2

Up to Install & build
  • GUI build error in /Plot2d with qwt-5.0.2

    Posted by Danail Nedyalkov at December 09. 2007
    I have the following error with the  Plot2d_ViewFrame.cxx/h files:
    ../Plot2d_ViewFrame.h:195: error: 'QwtSymbol' has not been declared
    ../Plot2d_ViewFrame.h:195: error: expected ',' or '...' before '&' token
    ../Plot2d_ViewFrame.h:213: error: expected ',' or '...' before '::' token
    ../Plot2d_ViewFrame.h:213: warning: ISO C++ forbids declaration of 'QwtSymbol' with no type
    ../Plot2d_ViewFrame.cxx: In constructor 'Plot2d_ViewFrame::Plot2d_ViewFrame(QWidget*, const QString&;)':
    ../Plot2d_ViewFrame.cxx:199: error: 'QwtDiMap' was not declared in this scope
    ../Plot2d_ViewFrame.cxx:199: error: expected `;' before 'xMap'
    ../Plot2d_ViewFrame.cxx:200: error: expected `;' before 'yMap'
    ../Plot2d_ViewFrame.cxx:201: error: 'xMap' was not declared in this scope
    ../Plot2d_ViewFrame.cxx:202: error: 'yMap' was not declared in this scope
    ../Plot2d_ViewFrame.cxx:205: error: expected `;' before 'yMap2'
    ../Plot2d_ViewFrame.cxx:206: error: 'yMap2' was not declared in this scope
    ../Plot2d_ViewFrame.cxx: In member function 'QString Plot2d_ViewFrame::getInfo(const QPoint&;)':
    ../Plot2d_ViewFrame.cxx:391: error: 'class Plot2d_Plot2d' has no member named 'axisScale'
    ../Plot2d_ViewFrame.cxx:392: error: invalid use of undefined type 'const struct QwtScaleDiv'
    /usr/include/qwt/qwt_plot_item.h:24: error: forward declaration of 'const struct QwtScaleDiv'
    ../Plot2d_ViewFrame.cxx:393: error: invalid use of undefined type 'const struct QwtScaleDiv'
    /usr/include/qwt/qwt_plot_item.h:24: error: forward declaration of 'const struct QwtScaleDiv'
    ../Plot2d_ViewFrame.cxx:402: error: invalid use of undefined type 'const struct QwtScaleDiv'
    /usr/include/qwt/qwt_plot_item.h:24: error: forward declaration of 'const struct QwtScaleDiv'
    ../Plot2d_ViewFrame.cxx:403: error: invalid use of undefined type 'const struct QwtScaleDiv'
    /usr/include/qwt/qwt_plot_item.h:24: error: forward declaration of 'const struct QwtScaleDiv'
    ../Plot2d_ViewFrame.cxx:412: error: 'class Plot2d_Plot2d' has no member named 'axisScale'
    ../Plot2d_ViewFrame.cxx:413: error: invalid use of undefined type 'const struct QwtScaleDiv'
    /usr/include/qwt/qwt_plot_item.h:24: error: forward declaration of 'const struct QwtScaleDiv'
    ../Plot2d_ViewFrame.cxx:414: error: invalid use of undefined type 'const struct QwtScaleDiv'
    /usr/include/qwt/qwt_plot_item.h:24: error: forward declaration of 'const struct QwtScaleDiv'
    ../Plot2d_ViewFrame.cxx:423: error: invalid use of undefined type 'const struct QwtScaleDiv'
    /usr/include/qwt/qwt_plot_item.h:24: error: forward declaration of 'const struct QwtScaleDiv'
    ../Plot2d_ViewFrame.cxx:424: error: invalid use of undefined type 'const struct QwtScaleDiv'
    /usr/include/qwt/qwt_plot_item.h:24: error: forward declaration of 'const struct QwtScaleDiv'
    ../Plot2d_ViewFrame.cxx:446: error: 'class Plot2d_Plot2d' has no member named 'axisScale'
    ../Plot2d_ViewFrame.cxx:447: error: invalid use of undefined type 'const struct QwtScaleDiv'
    /usr/include/qwt/qwt_plot_item.h:24: error: forward declaration of 'const struct QwtScaleDiv'
    ../Plot2d_ViewFrame.cxx:448: error: invalid use of undefined type 'const struct QwtScaleDiv'
    /usr/include/qwt/qwt_plot_item.h:24: error: forward declaration of 'const struct QwtScaleDiv'
    ../Plot2d_ViewFrame.cxx:457: error: invalid use of undefined type 'const struct QwtScaleDiv'
    /usr/include/qwt/qwt_plot_item.h:24: error: forward declaration of 'const struct QwtScaleDiv'
    ../Plot2d_ViewFrame.cxx:458: error: invalid use of undefined type 'const struct QwtScaleDiv'
    /usr/include/qwt/qwt_plot_item.h:24: error: forward declaration of 'const struct QwtScaleDiv'
    ../Plot2d_ViewFrame.cxx: At global scope:
    ../Plot2d_ViewFrame.cxx:482: error: 'QwtSymbol' has not been declared
    ../Plot2d_ViewFrame.cxx:482: error: expected initializer before 'plot2qwtMarker'
    Note that I have deleted the whole path to Plot2d to make the output clearer, my build directory is not the source one.
    As far as I can see, the problem is with the following three types:
    - QwtSymbol
    - QwtDiMap
    - QwtScaleDiv*
    I have qwt-5.0.2, which is the default qwt version for Salome?
    I will further investigate this types in the header files to see what isn't right.
    • Re: GUI build error in /Plot2d with qwt-5.0.2

      Posted by Danail Nedyalkov at December 10. 2007
      Just want to add what I found out: it seems that the new qwt-5.x misses some classes like QwtDiMap, QwtCurve and so on... Adding some missing header files in Plot2d_ViewFrame wasn't a big deal, but I have to figure out how the classes have been transformed from qwt-4.2.0 to qwt-5.0.2.
      If someone is working on this and has achieved some progress - an advice will be appreciated.
      • Re: GUI build error in /Plot2d with qwt-5.0.2

        Posted by Daniel Tourde - Caelae.se at January 08. 2008
        Danail Nedyalkov wrote:
        Just want to add what I found out: it seems that the new qwt-5.x misses some classes like QwtDiMap, QwtCurve and so on... Adding some missing header files in Plot2d_ViewFrame wasn't a big deal, but I have to figure out how the classes have been transformed from qwt-4.2.0 to qwt-5.0.2.
        If someone is working on this and has achieved some progress - an advice will be appreciated.

        If you made any progress on that, I would be interested as well. I ran into the same problem. Daniel
        • Re: GUI build error in /Plot2d with qwt-5.0.2

          Posted by Danail Nedyalkov at January 29. 2008
          Yes, I made a progress:
          I'm trying to rewrite the code and did almost 2/3 of it so far. It's a really painful task, because qwt 5 has major differences - for example the curves are no more keys of the plot, but objects, the pointers of which are attached to the plot. And that makes allmost every function in the Plot2d files useless. There are new classes as a substitute of many old ones and so on... I was convinced, that I will port the code, but now I'm not sure if I can do it on my own. If you or someone else wants to help - please, be my guest!
          I wanted to keep all the old varibles names in order to avoid problems with the rest of the code. However this is not possible in some cases.
          Here is the code so far:

          // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
          //
          // 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 2.1 of the License.
          //
          // 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
          //
          // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
          //
          #include "Plot2d_ViewFrame.h"

          #include "Plot2d_Prs.h"
          #include "Plot2d_Curve.h"
          #include "Plot2d_FitDataDlg.h"
          #include "Plot2d_ViewWindow.h"
          #include "Plot2d_SetupViewDlg.h"
          #include "Plot2d_ToolTip.h"

          #include "SUIT_Tools.h"
          #include "SUIT_Session.h"
          #include "SUIT_MessageBox.h"
          #include "SUIT_ResourceMgr.h"
          #include "SUIT_Application.h"

          #include "qapplication.h"
          #include
          #include
          #include
          #include
          #include
          #include
          #include
          #include
          #include
          #include

          #include
          #include
          #include
          #include
          #include
          #include
          #include
          #include

          #include

          #define DEFAULT_LINE_WIDTH     0     // (default) line width
          #define DEFAULT_MARKER_SIZE    9     // default marker size
          #define MIN_RECT_SIZE          11    // min sensibility area size

          #define FITALL_EVENT           ( QEvent::User + 9999 )

          const char* imageZoomCursor[] = {
          "32 32 3 1",
          ". c None",
          "a c #000000",
          "# c #ffffff",
          "................................",
          "................................",
          ".#######........................",
          "..aaaaaaa.......................",
          "................................",
          ".............#####..............",
          "...........##.aaaa##............",
          "..........#.aa.....a#...........",
          ".........#.a.........#..........",
          ".........#a..........#a.........",
          "........#.a...........#.........",
          "........#a............#a........",
          "........#a............#a........",
          "........#a............#a........",
          "........#a............#a........",
          ".........#...........#.a........",
          ".........#a..........#a.........",
          ".........##.........#.a.........",
          "........#####.....##.a..........",
          ".......###aaa#####.aa...........",
          "......###aa...aaaaa.......#.....",
          ".....###aa................#a....",
          "....###aa.................#a....",
          "...###aa...............#######..",
          "....#aa.................aa#aaaa.",
          ".....a....................#a....",
          "..........................#a....",
          "...........................a....",
          "................................",
          "................................",
          "................................",
          "................................"};

          const char* imageCrossCursor[] = {
            "32 32 3 1",
            ". c None",
            "a c #000000",
            "# c #ffffff",
            "................................",
            "................................",
            "................................",
            "................................",
            "................................",
            "................................",
            "................................",
            "...............#................",
            "...............#a...............",
            "...............#a...............",
            "...............#a...............",
            "...............#a...............",
            "...............#a...............",
            "...............#a...............",
            "...............#a...............",
            ".......#################........",
            "........aaaaaaa#aaaaaaaaa.......",
            "...............#a...............",
            "...............#a...............",
            "...............#a...............",
            "...............#a...............",
            "...............#a...............",
            "...............#a...............",
            "...............#a...............",
            "................a...............",
            "................................",
            "................................",
            "................................",
            "................................",
            "................................",
            "................................",
            "................................"};
           

          /*!
            Constructor
          */
          Plot2d_ViewFrame::Plot2d_ViewFrame( QWidget* parent, const QString& title )
               : QWidget (parent, title, 0),
                 myOperation( NoOpId ),
                 myCurveType( 1 ),
                 myShowLegend( true ), myLegendPos( 1 ),
                 myMarkerSize( DEFAULT_MARKER_SIZE ),
                 myTitle( "" ), myXTitle( "" ), myYTitle( "" ), myY2Title( "" ),
                 myBackground( white ),
                 myTitleEnabled( true ), myXTitleEnabled( true ),
                 myYTitleEnabled( true ), myY2TitleEnabled (true),
                 myXGridMajorEnabled( true ), myYGridMajorEnabled( true ), myY2GridMajorEnabled( true ),
                 myXGridMinorEnabled( false ), myYGridMinorEnabled( false ), myY2GridMinorEnabled( false ),
                 myXGridMaxMajor( 8 ), myYGridMaxMajor( 8 ), myY2GridMaxMajor( 8 ),
                 myXGridMaxMinor( 5 ), myYGridMaxMinor( 5 ), myY2GridMaxMinor( 5 ),
                 myXMode( 0 ), myYMode( 0 ), mySecondY( false )
          {
            /* Plot 2d View */
            QVBoxLayout* aLayout = new QVBoxLayout( this );
            myPlot = new Plot2d_Plot2d( this );
            new Plot2d_ToolTip( this, myPlot );

            aLayout->addWidget( myPlot );

          //  createActions();

            connect( myPlot, SIGNAL( plotMouseMoved( const QMouseEvent& ) ),
               this,   SLOT( plotMouseMoved( const QMouseEvent& ) ) );
            connect( myPlot, SIGNAL( plotMousePressed( const QMouseEvent& ) ),
               this,   SLOT( plotMousePressed( const QMouseEvent& ) ) );
            connect( myPlot, SIGNAL( plotMouseReleased( const QMouseEvent& ) ),
               this,   SLOT( plotMouseReleased( const QMouseEvent& ) ) );
            //connect( myPlot, SIGNAL( legendClicked( long ) ),
            //   this,   SLOT( onLegendClicked( long ) ) );

            /* Initial Setup - get from the preferences */
            readPreferences();

            myPlot->setMargin( 5 );
            setCurveType( myCurveType, false );
            setXGrid( myXGridMajorEnabled, myXGridMaxMajor, myXGridMinorEnabled, myXGridMaxMinor, false );
            setYGrid( myYGridMajorEnabled, myYGridMaxMajor, myYGridMinorEnabled, myYGridMaxMinor,
                      myY2GridMajorEnabled, myY2GridMaxMajor, myY2GridMinorEnabled, myY2GridMaxMinor, false );

            setTitle( myTitleEnabled,  myTitle,  MainTitle, false );
            setTitle( myXTitleEnabled, myXTitle, XTitle, false );
            setTitle( myYTitleEnabled, myYTitle, YTitle, false );

            if (mySecondY)
              setTitle( myY2TitleEnabled, myY2Title, Y2Title, false );
            setHorScaleMode( myXMode, false );
            setVerScaleMode( myYMode, false );
            setBackgroundColor( myBackground );
            setLegendPos( myLegendPos );
            showLegend( myShowLegend, false );
            myPlot->replot();

            if ( parent ) {
              resize( (int)(0.8 * parent->width()), (int)(0.8 * parent->height()) );
            }
            QwtScaleMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
            QwtScaleMap yMap = myPlot->canvasMap( QwtPlot::yLeft );
            myXDistance = xMap.p2() - xMap.p1();
            myYDistance = yMap.p2() - yMap.p1();
            myYDistance2 = 0;
            if (mySecondY) {
              QwtScaleMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
              myYDistance2 = yMap2.p2() - yMap2.p1();
            }
          }
          /*!
            Destructor
          */
          Plot2d_ViewFrame::~Plot2d_ViewFrame()
          {
          }
          /*!
            Gets window's central widget
          */
          QWidget* Plot2d_ViewFrame::getViewWidget()
          {
            return (QWidget*)myPlot;
          }
          /*!
            Actually this method just re-displays all curves which are presented in the viewer
          */
          void Plot2d_ViewFrame::DisplayAll()
          {
            QList clist;
            getCurves( clist );
            for ( int i = 0; i < (int)clist.count(); i++ ) {
              updateCurve( clist.at( i ), false );
            }
            myPlot->replot();
          }
          /*!
             Removes all curves from the view
          */
          void Plot2d_ViewFrame::EraseAll()
          {
            myPlot->clear();
            myCurves.clear();
            myPlot->replot();
          }
          /*!
            Redraws viewframe contents
          */
          void Plot2d_ViewFrame::Repaint()
          {
            myPlot->replot();
          }
          /*!
            Display presentation
          */
          void Plot2d_ViewFrame::Display( const Plot2d_Prs* prs )
          {
            if ( !prs || prs->IsNull() )
              return;

            if (prs->isSecondY()) {
              myPlot->enableAxis(QwtPlot::yRight, true);
              mySecondY = true;
            }
            else {
              myPlot->enableAxis(QwtPlot::yRight, false);
              mySecondY = false;
            }

            // display all curves from presentation
            curveList aCurves = prs->getCurves();
            displayCurves( aCurves );
            setXGrid( myXGridMajorEnabled, myXGridMaxMajor, myXGridMinorEnabled, myXGridMaxMinor, true );
            setYGrid( myYGridMajorEnabled, myYGridMaxMajor, myYGridMinorEnabled, myYGridMaxMinor,
                      myY2GridMajorEnabled, myY2GridMaxMajor, myY2GridMinorEnabled, myY2GridMaxMinor, true );
          }

          /*!
            Erase presentation
          */
          void Plot2d_ViewFrame::Erase( const Plot2d_Prs* prs, const bool )
          {
            if ( !prs || prs->IsNull() )
              return;

            // erase all curves from presentation
            curveList aCurves = prs->getCurves();
            eraseCurves( aCurves );
          }

          /*!
            Sets title
          */
          void Plot2d_ViewFrame::setTitle( const QString& title )
          {
            setTitle( myTitleEnabled, title, MainTitle, true );
          }

          /*!
            Reads Plot2d view settings from the preferences
          */
          void Plot2d_ViewFrame::readPreferences()
          {
            SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();

            myCurveType = resMgr->integerValue( "Plot2d", "CurveType", myCurveType );
            setCurveType( resMgr->integerValue( "Plot2d", "CurveType", myCurveType ) );

            myShowLegend = resMgr->booleanValue( "Plot2d", "ShowLegend", myShowLegend );
            myLegendPos = resMgr->integerValue( "Plot2d", "LegendPos", myLegendPos );
            myMarkerSize = resMgr->integerValue( "Plot2d", "MarkerSize", myMarkerSize );
            myBackground = resMgr->colorValue( "Plot2d", "Background", myBackground );

            myTitleEnabled = resMgr->booleanValue( "Plot2d", "ShowTitle", myTitleEnabled );
            myXTitleEnabled = resMgr->booleanValue( "Plot2d", "ShowHorTitle", myXTitleEnabled );
            myYTitleEnabled = resMgr->booleanValue( "Plot2d", "ShowVerLeftTitle", myYTitleEnabled );
            myY2TitleEnabled = resMgr->booleanValue( "Plot2d", "ShowVerRightTitle", myY2TitleEnabled );

            myXGridMajorEnabled = resMgr->booleanValue( "Plot2d", "EnableHorMajorGrid", myXGridMajorEnabled );
            myYGridMajorEnabled = resMgr->booleanValue( "Plot2d", "EnableVerMajorGrid", myYGridMajorEnabled );
            myY2GridMajorEnabled = resMgr->booleanValue( "Plot2d", "EnableRightVerMajorGrid", myY2GridMajorEnabled );

            myXGridMinorEnabled = resMgr->booleanValue( "Plot2d", "EnableHorMinorGrid", myXGridMinorEnabled );
            myYGridMinorEnabled = resMgr->booleanValue( "Plot2d", "EnableVerMinorGrid", myYGridMinorEnabled );
            myY2GridMinorEnabled = resMgr->booleanValue( "Plot2d", "EnableRightVerMinorGrid", myY2GridMinorEnabled );

            myXGridMaxMajor = resMgr->integerValue( "Plot2d", "HorMajorGridMax", myXGridMaxMajor );
            myYGridMaxMajor = resMgr->integerValue( "Plot2d", "VerMajorGridMax", myYGridMaxMajor );
            if ( mySecondY )
              myY2GridMaxMajor = resMgr->integerValue( "Plot2d", "VerMajorRightGridMax", myY2GridMaxMajor );

            myXGridMaxMinor = resMgr->integerValue( "Plot2d", "HorMinorGridMax", myXGridMaxMinor );
            myYGridMaxMinor = resMgr->integerValue( "Plot2d", "VerMinorGridMax", myYGridMaxMinor );
            if ( mySecondY )
              myY2GridMaxMinor = resMgr->integerValue( "Plot2d", "VerMinorGridMax", myY2GridMaxMinor );

            myXMode = resMgr->integerValue( "Plot2d", "HorScaleMode", myXMode );
            myXMode = QMAX( 0, QMIN( 1, myXMode ) );

            myYMode = resMgr->integerValue( "Plot2d", "VerScaleMode", myYMode );
            myYMode = QMAX( 0, QMIN( 1, myYMode ) );
          }

          /*!
            Writes Plot2d view settings to the preferences
          */
          void Plot2d_ViewFrame::writePreferences()
          {
            SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();

            resMgr->setValue( "Plot2d", "CurveType", myCurveType );
            resMgr->setValue( "Plot2d", "ShowLegend", myShowLegend );
            resMgr->setValue( "Plot2d", "LegendPos", myLegendPos );
            resMgr->setValue( "Plot2d", "MarkerSize", myMarkerSize );
            resMgr->setValue( "Plot2d", "Background", myBackground );
            resMgr->setValue( "Plot2d", "ShowTitle", myTitleEnabled );
            resMgr->setValue( "Plot2d", "ShowHorTitle", myXTitleEnabled );
            resMgr->setValue( "Plot2d", "ShowVerLeftTitle", myYTitleEnabled );
            if ( mySecondY )
              resMgr->setValue( "Plot2d", "ShowVerRightTitle", myY2TitleEnabled );

            resMgr->setValue( "Plot2d", "EnableHorMajorGrid", myXGridMajorEnabled );
            resMgr->setValue( "Plot2d", "EnableVerMajorGrid", myYGridMajorEnabled );
            resMgr->setValue( "Plot2d", "EnableHorMinorGrid", myXGridMinorEnabled );
            resMgr->setValue( "Plot2d", "EnableVerMinorGrid", myYGridMinorEnabled );

            resMgr->setValue( "Plot2d", "HorMajorGridMax", myXGridMaxMajor );
            resMgr->setValue( "Plot2d", "VerMajorGridMax", myYGridMaxMajor );

            resMgr->setValue( "Plot2d", "HorMinorGridMax", myXGridMaxMinor );
            resMgr->setValue( "Plot2d", "VerMinorGridMax", myYGridMaxMinor );

            resMgr->setValue( "Plot2d", "HorScaleMode", myXMode );

            if ( mySecondY )
            {
              resMgr->setValue( "Plot2d", "EnableRightVerMajorGrid", myY2GridMajorEnabled );
              resMgr->setValue( "Plot2d", "EnableRightVerMinorGrid", myY2GridMinorEnabled );
              resMgr->setValue( "Plot2d", "VerRightMajorGridMax", myY2GridMaxMajor );
              resMgr->setValue( "Plot2d", "VerRightMinorGridMax", myY2GridMaxMinor );
            }

            resMgr->setValue( "Plot2d", "VerScaleMode", myYMode );
          }

          /*!
            Prints mouse cursor coordinates into string
          */
          QString Plot2d_ViewFrame::getInfo( const QPoint& pnt )
          {
            int i;
            bool xFound = false, yFound = false;
            double xCoord, yCoord;
            const QwtScaleDiv* aXscale = myPlot->axisScaleDiv( QwtPlot::xBottom );
            const QwtValueList &ticks = aXscale->ticks( QwtScaleDiv::MajorTick );
            for ( i = 0; i < ticks.count(); i++ ) {
              double majXmark = ticks[i];
              int xmark = myPlot->transform( QwtPlot::xBottom, majXmark );
              if ( xmark-2 == pnt.x() ) {
                xCoord = majXmark;
                xFound = true;
                break;
              }
            }
            if ( !xFound ) {
              &ticks = aXscale->ticks( QwtScaleDiv::MinorTick );
              for ( i = 0; i < ticks.count(); i++ ) {
                double minXmark = ticks[i];
                int xmark = myPlot->transform( QwtPlot::xBottom, minXmark );
                if ( xmark-2 == pnt.x() ) {
                  xCoord = minXmark;
                  xFound = true;
                  break;
                }
              }
            } 
            const QwtScaleDiv* aYscale = myPlot->axisScale( QwtPlot::yLeft );
            &ticks = aYscale->ticks( QwtScaleDiv::MajorTick );
            for ( i = 0; i < ticks.count(); i++ ) {
              double majYmark = ticks[i];
              int ymark = myPlot->transform( QwtPlot::yLeft, majYmark );
              if ( ymark-2 == pnt.y() ) {
                yCoord = majYmark;
                yFound = true;
                break;
              }
            }
            if ( !yFound ) {
              &ticks = aYscale->ticks( QwtScaleDiv::MinorTick );
              for ( i = 0; i < ticks.count(); i++ ) {
                double minYmark = tick[i];
                int ymark = myPlot->transform( QwtPlot::yLeft, minYmark );
                if ( ymark-2 == pnt.y() ) {
                  yCoord = minYmark;
                  yFound = true;
                  break;
                }
              }
            } 

            QString strX = QString::number( xFound ? xCoord : myPlot->invTransform( QwtPlot::xBottom, pnt.x() ) ).stripWhiteSpace();
            if ( strX == "-0" )
              strX = "0";
            QString strY = QString::number( yFound ? yCoord : myPlot->invTransform( QwtPlot::yLeft, pnt.y() ) ).stripWhiteSpace();
            if ( strY == "-0" )
              strY = "0";
            QString info = "";

            if (mySecondY) {
              bool yFound2 = false;
              double yCoord2;

              const QwtScaleDiv* aYscale2 = myPlot->axisScale( QwtPlot::yRight );
              &ticks = aYscale2->ticks( QwtScaleDiv::MajorTick );
              for ( i = 0; i < ticks.count(); i++ ) {
                double majYmark = ticks[i];
                int ymark = myPlot->transform( QwtPlot::yRight, majYmark );
                if ( ymark-2 == pnt.y() ) {
                  yCoord2 = majYmark;
                  yFound2 = true;
                  break;
                }
              }
              if ( !yFound2 ) {
                &ticks = aYscale2->ticks( QwtScaleDiv::MinorTick );
                for ( i = 0; i < ticks.count(); i++ ) {
                  double minYmark = ticks[i];
                  int ymark = myPlot->transform( QwtPlot::yRight, minYmark );
                  if ( ymark-2 == pnt.y() ) {
                    yCoord2 = minYmark;
                    yFound2 = true;
                    break;
                  }
                }
              }
              QString strY2 = QString::number( yFound2 ? yCoord2 :
                                myPlot->invTransform( QwtPlot::yRight, pnt.y() ) ).stripWhiteSpace();
              if ( strY2 == "-0" )
              strY2 = "0";
              info = tr("INF_COORDINATES_SOME_Y";).arg( strX ).arg( strY ).arg( strY2 );
            }
            else
              info = tr("INF_COORDINATES";).arg( strX ).arg( strY );

            return info;
          }

          /*!
            Converts Plot2d_Curve's marker style to Qwt marker style [ static ]
          */
          static QwtSymbol::Style plot2qwtMarker( Plot2d_Curve::MarkerType m )
          {
            QwtSymbol::Style ms = QwtSymbol::NoSymbol; 
            switch ( m ) {
            case Plot2d_Curve::Circle:
              ms = QwtSymbol::Ellipse;   break;
            case Plot2d_Curve::Rectangle:
              ms = QwtSymbol::Rect;      break;
            case Plot2d_Curve::Diamond:
              ms = QwtSymbol::Diamond;   break;
            case Plot2d_Curve::DTriangle:
              ms = QwtSymbol::DTriangle; break;
            case Plot2d_Curve::UTriangle:
              ms = QwtSymbol::UTriangle; break;
            case Plot2d_Curve::LTriangle: // Qwt confuses LTriangle and RTriangle :(((
              ms = QwtSymbol::RTriangle; break;
            case Plot2d_Curve::RTriangle: // Qwt confuses LTriangle and RTriangle :(((
              ms = QwtSymbol::LTriangle; break;
            case Plot2d_Curve::Cross:
              ms = QwtSymbol::Cross;     break;
            case Plot2d_Curve::XCross:
              ms = QwtSymbol::XCross;    break;
            case Plot2d_Curve::None:
            default:
              ms = QwtSymbol::NoSymbol;      break;
            }
            return ms;
          }

          /*!
            Converts Qwt marker style to Plot2d_Curve's marker style [ static ]
          */
          static Plot2d_Curve::MarkerType qwt2plotMarker( QwtSymbol::Style m )
          {
            Plot2d_Curve::MarkerType ms = Plot2d_Curve::None; 
            switch ( m ) {
            case QwtSymbol::Ellipse:
              ms = Plot2d_Curve::Circle;    break;
            case QwtSymbol::Rect:
              ms = Plot2d_Curve::Rectangle; break;
            case QwtSymbol::Diamond:
              ms = Plot2d_Curve::Diamond;   break;
            case QwtSymbol::DTriangle:
              ms = Plot2d_Curve::DTriangle; break;
            case QwtSymbol::UTriangle:
              ms = Plot2d_Curve::UTriangle; break;
            case QwtSymbol::RTriangle: // Qwt confuses LTriangle and RTriangle :(((
              ms = Plot2d_Curve::LTriangle; break;
            case QwtSymbol::LTriangle: // Qwt confuses LTriangle and RTriangle :(((
              ms = Plot2d_Curve::RTriangle; break;
            case QwtSymbol::Cross:
              ms = Plot2d_Curve::Cross;     break;
            case QwtSymbol::XCross:
              ms = Plot2d_Curve::XCross;    break;
            case QwtSymbol::NoSymbol:
            default:
              ms = Plot2d_Curve::None;      break;
            }
            return ms;
          }

          /*!
            Converts Plot2d_Curve's line style to Qwt line style [ static ]
          */
          static Qt::PenStyle plot2qwtLine( Plot2d_Curve::LineType p )
          {
            Qt::PenStyle ps = Qt::NoPen;
            switch ( p ) {
            case Plot2d_Curve::Solid:
              ps = Qt::SolidLine;      break;
            case Plot2d_Curve::Dash:
              ps = Qt::DashLine;       break;
            case Plot2d_Curve::Dot:
              ps = Qt::DotLine;        break;
            case Plot2d_Curve::DashDot:
              ps = Qt::DashDotLine;    break;
            case Plot2d_Curve::DashDotDot:
              ps = Qt::DashDotDotLine; break;
            case Plot2d_Curve::NoPen:
            default:
              ps = Qt::NoPen;          break;
            }
            return ps;
          }

          /*!
            Converts Qwt line style to Plot2d_Curve's line style [ static ]
          */
          static Plot2d_Curve::LineType qwt2plotLine( Qt::PenStyle p )
          {
            Plot2d_Curve::LineType ps = Plot2d_Curve::NoPen;
            switch ( p ) {
            case Qt::SolidLine:
              ps = Plot2d_Curve::Solid;      break;
            case Qt::DashLine:
              ps = Plot2d_Curve::Dash;       break;
            case Qt::DotLine:
              ps = Plot2d_Curve::Dot;        break;
            case Qt::DashDotLine:
              ps = Plot2d_Curve::DashDot;    break;
            case Qt::DashDotDotLine:
              ps = Plot2d_Curve::DashDotDot; break;
            case Qt::NoPen:
            default:
              ps = Plot2d_Curve::NoPen;      break;
            }
            return ps;
          }

          /*!
            Adds curve into view
          */
          void Plot2d_ViewFrame::displayCurve( Plot2d_Curve* curve, bool update )
          {
            if ( !curve )
              return;

            // san -- Protection against QwtPlotCurve bug in Qwt 0.4.x:
            // it crashes if switched to X/Y logarithmic mode, when one or more points have
            // non-positive X/Y coordinate
            if ( myXMode && curve->getMinX() <= 0. )
              setHorScaleMode( 0, false );
            if ( myYMode && curve->getMinY() <= 0. )
              setVerScaleMode( 0, false );

            if ( hasCurve( curve ) ) {
              updateCurve( curve, update );
            }
            else {
              QwtPlotCurve *curveKey = new QwtPlotCurve( curve->getVerTitle() );
              curveKey->setYAxis( curve->getYAxis() );
              curveKey->attach( myPlot );

              myCurves.insert( curveKey, curve );
              if ( curve->isAutoAssign() ) {
                QwtSymbol::Style typeMarker;
                QColor           color;
                Qt::PenStyle     typeLine;
                myPlot->getNextMarker( typeMarker, color, typeLine );
                curveKey->setPen( QPen( color, DEFAULT_LINE_WIDTH, typeLine ) );
                curveKey->setSymbol( QwtSymbol( typeMarker,
                         QBrush( color ),
                         QPen( color ),
                         QSize( myMarkerSize, myMarkerSize ) ) );
                curve->setColor( color );
                curve->setLine( qwt2plotLine( typeLine ) );
                curve->setMarker( qwt2plotMarker( typeMarker ) );
              }
              else {
                Qt::PenStyle     ps = plot2qwtLine( curve->getLine() );
                QwtSymbol::Style ms = plot2qwtMarker( curve->getMarker() );
                curveKey->setPen( QPen( curve->getColor(), curve->getLineWidth(), ps ) );
                curveKey->setSymbol( QwtSymbol( ms,
                         QBrush( curve->getColor() ),
                         QPen( curve->getColor() ),
                         QSize( myMarkerSize, myMarkerSize ) ) );
              }
              if ( myCurveType == 0 )
                curveKey->setStyle( QwtPlotCurve::NoCurve );
              else if ( myCurveType == 1 )
                curveKey->setStyle( QwtPlotCurve::Lines );
              else if ( myCurveType == 2 )
                curveKey->setStyle( QwtPlotCurve:Sticks );
              curveKey->setData( curve->horData(), curve->verData(), curve->nbPoints() );
            }
            updateTitles();
            if ( update )
              myPlot->replot();
          }

          /*!
            Adds curves into view
          */
          void Plot2d_ViewFrame::displayCurves( const curveList& curves, bool update )
          {
            myPlot->setUpdatesEnabled( false );
            QPtrListIterator it(curves);
            Plot2d_Curve* aCurve;
            while( (aCurve = it.current()) ) {
              displayCurve( aCurve, false );
              ++it;
            }

            fitAll();
            myPlot->setUpdatesEnabled( true );
            if ( update )
              myPlot->replot();
          }

          /*!
            Erases curve
          */
          void Plot2d_ViewFrame::eraseCurve( Plot2d_Curve* curve, bool update )
          {
            if ( !curve )
              return;
            int curveKey = hasCurve( curve );
            if ( curveKey ) {
              QwtPlotCurve *curveKey = new QwtPlotCurve( curve->getVerTitle() );
              curveKey->detach( myPlot );
              myCurves.remove( curveKey );
              updateTitles();
              if ( update )
                myPlot->replot();
            }
          }

          /*!
            Erases curves
          */
          void Plot2d_ViewFrame::eraseCurves( const curveList& curves, bool update )
          {
            QPtrListIterator it(curves);
            Plot2d_Curve* aCurve;
            while( (aCurve = it.current()) ) {
              eraseCurve( aCurve, false );
              ++it;
            }
          //  fitAll();
            if ( update )
              myPlot->replot();
          }

          /*!
            Updates curves attributes
          */
          void Plot2d_ViewFrame::updateCurve( Plot2d_Curve* curve, bool update )
          {
            if ( !curve )
              return;
            int curveKey = hasCurve( curve );
            if ( curveKey ) {
              QwtPlotCurve *curveKey = new QwtPlotCurve( curve->getVerTitle() );
              if ( !curve->isAutoAssign() ) {
                Qt::PenStyle     ps = plot2qwtLine( curve->getLine() );
                QwtSymbol::Style ms = plot2qwtMarker( curve->getMarker() );
                curveKey->setPen( QPen( curve->getColor(), curve->getLineWidth(), ps ) );
                curveKey->setSymbol( QwtSymbol( ms,
                         QBrush( curve->getColor() ),
                         QPen( curve->getColor() ),
                         QSize( myMarkerSize, myMarkerSize ) ) );
                curveKey->setData( curve->horData(), curve->verData(), curve->nbPoints() );
              }
              curveKey->setTitle( curve->getVerTitle() );
              curveKey->show();
              if ( update )
                myPlot->replot();
            }
          }

          /*!
            Returns curve key if is is displayed in the viewer and 0 otherwise
          */
          int Plot2d_ViewFrame::hasCurve( Plot2d_Curve* curve )
          {
            QIntDictIterator it( myCurves );
            for ( ; it.current(); ++it ) {
              if ( it.current() == curve )
                return it.currentKey();
            }
            return 0;
          }

          /*!
            Gets lsit of displayed curves
          */
          int Plot2d_ViewFrame::getCurves( QList& clist )
          {
            clist.clear();
            clist.setAutoDelete( false );
            QIntDictIterator it( myCurves );
            for ( ; it.current(); ++it ) {
              clist.append( it.current() );
            }
            return clist.count();
          }

          /*!
            Returns true if the curve is visible
          */
          bool Plot2d_ViewFrame::isVisible( Plot2d_Curve* curve )
          {
            if(curve) {
              int key = hasCurve( curve );
              if ( key )
                QwtPlotCurve *curveKey = new QwtPlotCurve( curve->getVerTitle() );
                return curveKey->isVisible();
            }
            return false;
          }

          /*!
            update legend
          */
          void Plot2d_ViewFrame::updateLegend( const Plot2d_Prs* prs )
          {
            if ( !prs || prs->IsNull() )
              return;
            curveList aCurves = prs->getCurves();

            QPtrListIterator it(aCurves);
            Plot2d_Curve* aCurve;
            while( (aCurve = it.current()) ) {
              int curveKey = hasCurve( aCurve );
              if ( curveKey )
                // useless, left only temporary
                QwtPlotCurve *curveKey = new QwtPlotCurve( aCurve->getVerTitle() );
                curveKey->setTitle( aCurve->getVerTitle() );
              ++it;
            }
          }

          /*!
            Fits the view to see all data
          */
          void Plot2d_ViewFrame::fitAll()
          {
            // Postpone fitAll operation until QwtPlot geometry
            // has been fully defined
            if ( !myPlot->polished() ){
              QApplication::postEvent( this, new QCustomEvent( FITALL_EVENT ) );
              return;
            }

            QwtScaleMap xMap1 = myPlot->canvasMap( QwtPlot::xBottom );

            myPlot->setAxisAutoScale( QwtPlot::yLeft );
            myPlot->setAxisAutoScale( QwtPlot::xBottom );
            myPlot->replot();

            // for existing grid
            QwtScaleMap xMap = myPlot->canvasMap( QwtPlot::xBottom );
            QwtScaleMap yMap = myPlot->canvasMap( QwtPlot::yLeft );

            myPlot->setAxisScale( QwtPlot::xBottom,
                myPlot->invTransform( QwtPlot::xBottom, xMap.p1() ),
                myPlot->invTransform( QwtPlot::xBottom, xMap.p2() ) );
            myPlot->setAxisScale( QwtPlot::yLeft,
                myPlot->invTransform( QwtPlot::yLeft, yMap.p1() ),
                myPlot->invTransform( QwtPlot::yLeft, yMap.p2() ) );

            if (mySecondY) {
              myPlot->setAxisAutoScale( QwtPlot::yRight );
              myPlot->replot();
              QwtScaleMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
              myPlot->setAxisScale( QwtPlot::yRight,
                  myPlot->invTransform( QwtPlot::yRight, yMap2.p1() ),
                  myPlot->invTransform( QwtPlot::yRight, yMap2.p2() ) );
            }
            myPlot->replot();
          }

          /*!
            Fits the view to rectangle area (pixels)
          */
          void Plot2d_ViewFrame::fitArea( const QRect& area )
          {
            QRect rect = area.normalize();
            if ( rect.width() < MIN_RECT_SIZE ) {
              rect.setWidth( MIN_RECT_SIZE );
              rect.setLeft( rect.left() - MIN_RECT_SIZE/2 );
            }
            if ( rect.height() < MIN_RECT_SIZE ) {
              rect.setHeight( MIN_RECT_SIZE );
              rect.setTop( rect.top() - MIN_RECT_SIZE/2 );
            }
            myPlot->setAxisScale( QwtPlot::yLeft,
                      myPlot->invTransform( QwtPlot::yLeft, rect.top() ),
                      myPlot->invTransform( QwtPlot::yLeft, rect.bottom() ) );
            if (mySecondY)
              myPlot->setAxisScale( QwtPlot::yRight,
                      myPlot->invTransform( QwtPlot::yRight, rect.top() ),
                      myPlot->invTransform( QwtPlot::yRight, rect.bottom() ) );
            myPlot->setAxisScale( QwtPlot::xBottom,
                      myPlot->invTransform( QwtPlot::xBottom, rect.left() ),
                      myPlot->invTransform( QwtPlot::xBottom, rect.right() ) );
            myPlot->replot();
          }

          /*!
            "Fit Data" command for TUI interface
          */
          void Plot2d_ViewFrame::fitData(const int mode,
                             const double xMin, const double xMax,
                             const double yMin, const double yMax,
                             double y2Min, double y2Max)
          {
            if ( mode == 0 || mode == 2 ) {
              myPlot->setAxisScale( QwtPlot::yLeft, yMax, yMin );
              if (mySecondY)
                myPlot->setAxisScale( QwtPlot::yRight, y2Max, y2Min );
            }
            if ( mode == 0 || mode == 1 )
              myPlot->setAxisScale( QwtPlot::xBottom, xMin, xMax );
            myPlot->replot();
          }

          /*!
            Gets current fit ranges for view frame
          */
          void Plot2d_ViewFrame::getFitRanges(double& xMin,double& xMax,
                              double& yMin, double& yMax,
                              double& y2Min, double& y2Max)
          {
            int ixMin = myPlot->canvasMap( QwtPlot::xBottom ).p1();
            int ixMax = myPlot->canvasMap( QwtPlot::xBottom ).p2();
            int iyMin = myPlot->canvasMap( QwtPlot::yLeft ).p1();
            int iyMax = myPlot->canvasMap( QwtPlot::yLeft ).p2();
            xMin = myPlot->invTransform(QwtPlot::xBottom, ixMin);
            xMax = myPlot->invTransform(QwtPlot::xBottom, ixMax);
            yMin = myPlot->invTransform(QwtPlot::yLeft, iyMin);
            yMax = myPlot->invTransform(QwtPlot::yLeft, iyMax);
            y2Min = 0;
            y2Max = 0;
            if (mySecondY) {
              int iyMin = myPlot->canvasMap( QwtPlot::yRight ).p1();
              int iyMax = myPlot->canvasMap( QwtPlot::yRight ).p2();
              y2Min = myPlot->invTransform(QwtPlot::yRight, iyMin);
              y2Max = myPlot->invTransform(QwtPlot::yRight, iyMax);
            }
          }

          /*!
            Tests if it is necessary to start operation on mouse action
          */
          int Plot2d_ViewFrame::testOperation( const QMouseEvent& me )
          {
            int btn = me.button() | me.state();
            const int zoomBtn = ControlButton | LeftButton;
            const int panBtn  = ControlButton | MidButton;
            const int fitBtn  = ControlButton | RightButton;

            switch (btn)
            {
            case zoomBtn:
              {
                QPixmap zoomPixmap (imageZoomCursor);
                QCursor zoomCursor (zoomPixmap);
                myPlot->canvas()->setCursor( zoomCursor );
                return ZoomId;
              }
            case panBtn:
              myPlot->canvas()->setCursor( QCursor( Qt::SizeAllCursor ) );
              return PanId;
            case fitBtn:
              myPlot->canvas()->setCursor( QCursor( Qt::PointingHandCursor ) );
              return FitAreaId;
            default :
              return NoOpId;
            }
          }

          /*!
            "Settings" toolbar action slot
          */
          void Plot2d_ViewFrame::onSettings()
          {
          #ifdef TEST_AUTOASSIGN
            typedef QMap IList;
            typedef QMap SList;
            IList mars, lins;
            SList cols;
            cols[ "red-min" ]   = 1000;
            cols[ "red-max" ]   = -1;
            cols[ "green-min" ] = 1000;
            cols[ "green-max" ] = -1;
            cols[ "blue-min" ]  = 1000;
            cols[ "blue-max" ]  = -1;
            for ( unsigned i = 0; i < 10000; i++ ) {
              QwtSymbol::Style typeMarker;
              QColor           color;
              Qt::PenStyle     typeLine;
              myPlot->getNextMarker( typeMarker, color, typeLine );
              if ( mars.contains(typeMarker) )
                mars[ typeMarker ] = mars[ typeMarker ]+1;
              else
                mars[ typeMarker ] = 0;
              if ( lins.contains(typeLine) )
                lins[ typeLine ] = lins[ typeLine ]+1;
              else
                lins[ typeLine ] = 0;
              if ( cols[ "red-max" ] < color.red() )
                cols[ "red-max" ] = color.red();
              if ( cols[ "red-min" ] > color.red() )
                cols[ "red-min" ] = color.red();
              if ( cols[ "green-max" ] < color.green() )
                cols[ "green-max" ] = color.green();
              if ( cols[ "green-min" ] > color.green() )
                cols[ "green-min" ] = color.green();
              if ( cols[ "blue-max" ] < color.blue() )
                cols[ "blue-max" ] = color.blue();
              if ( cols[ "blue-min" ] > color.blue() )
                cols[ "blue-min" ] = color.blue();
            }
          #endif
           
            Plot2d_SetupViewDlg* dlg = new Plot2d_SetupViewDlg( this, true, mySecondY );
            dlg->setMainTitle( myTitleEnabled, myTitle );
            dlg->setXTitle( myXTitleEnabled, myXTitle );
            dlg->setYTitle( myYTitleEnabled, myYTitle );
            if (mySecondY)
              dlg->setY2Title( myY2TitleEnabled, myY2Title );
            dlg->setCurveType( myCurveType );
            dlg->setLegend( myShowLegend, myLegendPos );
            dlg->setMarkerSize( myMarkerSize );
            dlg->setBackgroundColor( myBackground );
            dlg->setScaleMode(myXMode, myYMode);
            //
            dlg->setMajorGrid( myXGridMajorEnabled, myPlot->axisMaxMajor( QwtPlot::xBottom ),
                   myYGridMajorEnabled, myPlot->axisMaxMajor( QwtPlot::yLeft ),
                   myY2GridMajorEnabled, myPlot->axisMaxMajor( QwtPlot::yRight ) );
            dlg->setMinorGrid( myXGridMinorEnabled, myPlot->axisMaxMinor( QwtPlot::xBottom ),
                   myYGridMinorEnabled, myPlot->axisMaxMinor( QwtPlot::yLeft ),
                   myY2GridMinorEnabled, myPlot->axisMaxMinor( QwtPlot::yRight ) );
            if ( dlg->exec() == QDialog::Accepted ) {
              // horizontal axis title
              setTitle( dlg->isXTitleEnabled(), dlg->getXTitle(), XTitle, false );
              // vertical left axis title
              setTitle( dlg->isYTitleEnabled(), dlg->getYTitle(), YTitle, false );
              if (mySecondY) // vertical right axis title
                setTitle( dlg->isY2TitleEnabled(), dlg->getY2Title(), Y2Title, false );

              // main title
              setTitle( dlg->isMainTitleEnabled(), dlg->getMainTitle(), MainTitle, true );
              // curve type
              if ( myCurveType != dlg->getCurveType() ) {
                setCurveType( dlg->getCurveType(), false );
              }
              // legend
              if ( myShowLegend != dlg->isLegendEnabled() ) {
                showLegend( dlg->isLegendEnabled(), false );
              }
              if ( myLegendPos != dlg->getLegendPos() ) {
                setLegendPos( dlg->getLegendPos() );
              }
              // marker size
              if ( myMarkerSize != dlg->getMarkerSize() ) {
                setMarkerSize( dlg->getMarkerSize(), false );
              }
              // background color
              if ( myBackground != dlg->getBackgroundColor() ) {
                setBackgroundColor( dlg->getBackgroundColor() );
              }
              // grid
              bool aXGridMajorEnabled, aXGridMinorEnabled, aYGridMajorEnabled, aYGridMinorEnabled,
                   aY2GridMajorEnabled, aY2GridMinorEnabled;
              int  aXGridMaxMajor, aXGridMaxMinor, aYGridMaxMajor, aYGridMaxMinor,
                   aY2GridMaxMajor, aY2GridMaxMinor;
              dlg->getMajorGrid( aXGridMajorEnabled, aXGridMaxMajor, aYGridMajorEnabled, aYGridMaxMajor,
                                 aY2GridMajorEnabled, aY2GridMaxMajor);
              dlg->getMinorGrid( aXGridMinorEnabled, aXGridMaxMinor, aYGridMinorEnabled, aYGridMaxMinor,
                                 aY2GridMinorEnabled, aY2GridMaxMinor);
              setXGrid( aXGridMajorEnabled, aXGridMaxMajor, aXGridMinorEnabled, aXGridMaxMinor, false );
              setYGrid( aYGridMajorEnabled, aYGridMaxMajor, aYGridMinorEnabled, aYGridMaxMinor,
                        aY2GridMajorEnabled, aY2GridMaxMajor, aY2GridMinorEnabled, aY2GridMaxMinor, false );
              if ( myXMode != dlg->getXScaleMode() ) {
                setHorScaleMode( dlg->getXScaleMode() );
              }
              if ( myYMode != dlg->getYScaleMode() ) {
                setVerScaleMode( dlg->getYScaleMode() );
              }
              // update view
              myPlot->replot();
              // update preferences
              if ( dlg->isSetAsDefault() )
                writePreferences();
            }
            delete dlg;
          }

          /*!
            "Fit Data" command slot
          */
          void Plot2d_ViewFrame::onFitData()
          {
            Plot2d_FitDataDlg* dlg = new Plot2d_FitDataDlg( this, mySecondY );
            double xMin,xMax,yMin,yMax,y2Min,y2Max;
            getFitRanges(xMin,xMax,yMin,yMax,y2Min,y2Max);
           
            dlg->setRange( xMin, xMax, yMin, yMax, y2Min, y2Max );
            if ( dlg->exec() == QDialog::Accepted ) {
              int mode = dlg->getRange( xMin, xMax, yMin, yMax, y2Min, y2Max );
              fitData(mode,xMin,xMax,yMin,yMax,y2Min,y2Max);
            }
            delete dlg;
          }

          /*!
            Change background color
          */
          void Plot2d_ViewFrame::onChangeBackground()
          {
            QColor selColor = QColorDialog::getColor ( backgroundColor(), this );   
            if ( selColor.isValid() ) {
              setBackgroundColor( selColor );
            }
          }

          /*!
            Sets curve type
          */
          void Plot2d_ViewFrame::setCurveType( int curveType, bool update )
          {
            myCurveType = curveType;
            //QArray keys = myPlot->curveKeys();
            QList clist;
            getCurves( clist );

            QPtrListIterator it(aCurves);
            Plot2d_Curve* aCurve;
            while( (aCurve = it.current()) ) {
              int curveKey = hasCurve( aCurve );
              if ( curveKey )
              {
                QwtPlotCurve *curveKey = new QwtPlotCurve( aCurve->getVerTitle() );
                if ( myCurveType == 0 )
                  curveKey->setStyle( QwtPlotCurve::NoCurve );
                else if ( myCurveType == 1 )
                  curveKey->setStyle( QwtPlotCurve::Lines );
                else if ( myCurveType == 2 )
                  curveKey->setStyle( QwtPlotCurve:Sticks );
              }
              ++it;
            }
            if ( update )
              myPlot->replot();
            emit vpCurveChanged();
          }

          /*!
            Sets curve title
            \param curveKey - curve id
            \param title - new title
          */
          void Plot2d_ViewFrame::setCurveTitle( QString curvetitle, const QString& title )
          {
            if(myPlot)
            {
                  QwtPlotCurve *aCurve = new QwtPlotCurve( curvetitle );
              aCurve->setTitle( title );
            }
          }  

          /*!
            Shows/hides legend
          */
          void Plot2d_ViewFrame::showLegend( bool show, bool update )
          {
            myShowLegend = show;
            myPlot->setAutoLegend( myShowLegend );
            myPlot->enableLegend( myShowLegend );
            if ( update )
              myPlot->replot();
          }

          /*!
            Sets legend position : 0 - left, 1 - right, 2 - top, 3 - bottom
          */
          void Plot2d_ViewFrame::setLegendPos( int pos )
          {
            myLegendPos = pos;
            switch( pos ) {
            case 0:
              myPlot->LegendPosition( LeftLegend );
              break;
            case 1:
              myPlot->LegendPosition ( RightLegend );
              break;
            case 2:
              myPlot->LegendPosition ( TopLegend );
              break;
            case 3:
              myPlot->LegendPosition ( BottomLegend );
              break;
            }
          }

          • Re: GUI build error in /Plot2d with qwt-5.0.2

            Posted by Danail Nedyalkov at January 29. 2008
            P.S.: A major rewrite of Plot2d will be the best decision, I think. qwt-5 is actually much easier to handle than qwt-4. Under a major rewrite I mean also substituting the function's parameters and returns.
            But will this affect only Plot2d or also some other components of the GUI module?
            Are there other components in the modules which use qwt?
            Is there an ongoing update to qwt-5 or will the next release stick with qwt-4?
            • Re: GUI build error in /Plot2d with qwt-5.0.2

              Posted by Andrea Florio at January 02. 2009
              same issue here.. any fix?
Powered by Ploneboard
Document Actions