コード例 #1
0
ファイル: simple.cpp プロジェクト: 376473984/pvb
Plot::Plot()
{
    setTitle("A Simple QwtPlot Demonstration");
    insertLegend(new QwtLegend(), QwtPlot::RightLegend);

    // Set axis titles
    setAxisTitle(xBottom, "x -->");
    setAxisTitle(yLeft, "y -->");
    
    // Insert new curves
    QwtPlotCurve *cSin = new QwtPlotCurve("y = sin(x)");
#if QT_VERSION >= 0x040000
    cSin->setRenderHint(QwtPlotItem::RenderAntialiased);
#endif
    cSin->setPen(QPen(Qt::red));
    cSin->attach(this);

    QwtPlotCurve *cCos = new QwtPlotCurve("y = cos(x)");
#if QT_VERSION >= 0x040000
    cCos->setRenderHint(QwtPlotItem::RenderAntialiased);
#endif
    cCos->setPen(QPen(Qt::blue));
    cCos->attach(this);

    // Create sin and cos data
    const int nPoints = 100;
    cSin->setData(SimpleData(::sin, nPoints));
    cCos->setData(SimpleData(::cos, nPoints));

    // Insert markers
    
    //  ...a horizontal line at y = 0...
    QwtPlotMarker *mY = new QwtPlotMarker();
    mY->setLabel(QString::fromLatin1("y = 0"));
    mY->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
    mY->setLineStyle(QwtPlotMarker::HLine);
    mY->setYValue(0.0);
    mY->attach(this);

    //  ...a vertical line at x = 2 * pi
    QwtPlotMarker *mX = new QwtPlotMarker();
    mX->setLabel(QString::fromLatin1("x = 2 pi"));
    mX->setLabelAlignment(Qt::AlignLeft | Qt::AlignBottom);
    mX->setLabelOrientation(Qt::Vertical);
    mX->setLineStyle(QwtPlotMarker::VLine);
    mX->setLinePen(QPen(Qt::black, 0, Qt::DashDotLine));
    mX->setXValue(2.0 * M_PI);
    mX->attach(this);
}
コード例 #2
0
ファイル: Game.cpp プロジェクト: JohnCrash/iRobot
void Game::showOptionsDialog(){
	if( !mUI ){
		mUI.load("Options.layout","Game");
		try{
			if( mUI ){
				SimpleDataUI sdu(mUI["OgreView"],MyGUI::newDelegate(this,&Game::simpleDataChange));
				
				assert(mRoot && mRoot->getRenderSystem());

				mNeedReset = false;

				Ogre::ConfigOptionMap& mp = mRoot->getRenderSystem()->getConfigOptions();
				
				for( Ogre::ConfigOptionMap::iterator i=mp.begin();i!=mp.end();++i ){
					vector<MyGUI::UString> v(i->second.possibleValues.size());
					copy(i->second.possibleValues.begin(),i->second.possibleValues.end(),v.begin());
					sdu.add( i->first,SimpleData(i->first,i->second.currentValue,v) );
				}
				sdu.reLayout(2,5);

				mUI["Cancel"]->eventMouseButtonClick += newDelegate(this, &Game::notifyButtonClick);
				mUI["Apply"]->eventMouseButtonClick += newDelegate(this, &Game::notifyButtonClick);

				MyGUI::ComboBox* pcombo = mUI["shadow"]->castType<MyGUI::ComboBox>(false);
				pcombo->addItem( "None" );
				pcombo->addItem( "Stencil" );
				pcombo->addItem( "Texture" );
				Ogre::ShadowTechnique st = getSceneManager()->getShadowTechnique();
				if( st & Ogre::SHADOWDETAILTYPE_STENCIL )
					pcombo->setIndexSelected(1);
				else if( st & Ogre::SHADOWDETAILTYPE_TEXTURE )
					pcombo->setIndexSelected(2);
				else
					pcombo->setIndexSelected(0);
				pcombo->eventComboChangePosition += newDelegate(this,&Game::notifyComboChange);
				pcombo = mUI["lighting"]->castType<MyGUI::ComboBox>(false);
				pcombo->addItem( "Modulative" );
				pcombo->addItem( "Additive" );
				if( st & Ogre::SHADOWDETAILTYPE_ADDITIVE )
					pcombo->setIndexSelected( 1 );
				else if( st & Ogre::SHADOWDETAILTYPE_MODULATIVE )
					pcombo->setIndexSelected( 0 );
				pcombo->eventComboChangePosition += newDelegate(this,&Game::notifyComboChange);

				mUI->eventWindowButtonPressed += newDelegate(this, &Game::notifyWindowButtonPressed);
			}
		}catch( out_of_range& e ){
			WARNING_LOG(e.what());
		}
	}
}