Exemplo n.º 1
0
void ResidueParamView::draw( Canvas& v, const Allocation& a )
{
    if( !d_show )
        return;
    Canvas& c = v;
    ViewAreaMdl* area = getViewArea();
    Twips y;
    QString str;
    DisPar val;
    if( d_resi )
    {
        Root::SymbolSet ss = d_resi->getAllDisPar();
        Root::SymbolSet::const_iterator pos;
        for( pos = ss.begin(); pos != ss.end(); ++pos )
        {
            val = d_resi->getDisPar( (*pos) );
            if( val.isValid() )
            {
                y = area->toTwip( val.d_mean + val.d_dev, a.getTop(), DimY );
                c.drawLine( a.getLeft(), y, a.getRight(), y, d_clr );
                str.sprintf( "+ %s", (*pos).data() );
                QFont f;
                f.setPointSize( s_pointSize / TwipsPerPoint );
                c.drawText( a.getLeft(), y, str, &f, d_clr );

                y = area->toTwip( val.d_mean - val.d_dev, a.getTop(), DimY  );
                c.drawLine( a.getLeft(), y, a.getRight(), y, d_clr );
                str.sprintf( "- %s", (*pos).data() );
                c.drawText( a.getLeft(), y, str, &f, d_clr );
            }
        }
    } else if( d_type )
    {
        const ResidueType::AtomMap& ss = d_type->getAtoms();
        ResidueType::AtomMap::const_iterator pos;
        for( pos = ss.begin(); pos != ss.end(); ++pos )
        {
            val = (*pos).second->getDisPar();
            if( val.isValid() )
            {
                y = area->toTwip( val.d_mean + val.d_dev, a.getTop(), DimY );
                c.drawLine( a.getLeft(), y, a.getRight(), y, d_clr );
                str.sprintf( "+ %s", (*pos).first.data() );
                QFont f;
                f.setPointSize( s_pointSize / TwipsPerPoint );
                c.drawText( a.getLeft(), y, str, &f, d_clr );

                y = area->toTwip( val.d_mean - val.d_dev, a.getTop(), DimY  );
                c.drawLine( a.getLeft(), y, a.getRight(), y, d_clr );
                str.sprintf( "- %s", (*pos).first.data() );
                c.drawText( a.getLeft(), y, str, &f, d_clr );
            }
        }
    }
}
Exemplo n.º 2
0
	void draw(Canvas & c, const Allocation & a)
	{
		Lexi::Twips x = a.getLeft() + a.getWidth() / 10;
		c.drawLine( x, a.getTop(), x, a.getBottom(), g_color );	
		Lexi::Twips y = a.getTop() + a.getHeight() / 10;
		c.drawLine( x, y, a.getRight(), y, g_color );	
	}
Exemplo n.º 3
0
void SpinLineView2::draw( Canvas& v, const Allocation& a )
{
	Canvas& c = v;
	ViewAreaMdl* area = getViewArea();
	SpinSpace::Iterator pos, _end = d_model->end();
	SpinSpace::Element e;
	Twips y, x;
	char buf[ 16 ];
	for( pos = d_model->begin(); pos != _end; ++pos )
	{
		d_model->fetch( pos, e );
		if( !e.isGhost() )
		{
			y = area->toTwip( e.d_point[DimY]->getShift( d_model->getSpec() ), 
				a.getTop(), DimY );
			c.drawLine( a.getLeft(), y, a.getRight(), y, d_clr );
			e.d_point[DimY]->getLabel().format( buf, sizeof(buf) );
			QFont f;
			f.setPointSize( s_ps / TwipsPerPoint );
			c.drawText( a.getLeft(), y, buf, &f, d_clr );
			if( d_verti )
			{
				x = area->toTwip( e.d_point[DimX]->getShift( d_model->getSpec() ), 
					a.getLeft(), DimX );
				c.drawLine( x, a.getTop(), x, a.getBottom(), d_clr );
				e.d_point[DimX]->getLabel().format( buf, sizeof(buf) );
				c.drawText( x + g_w, a.getBottom() - g_w, buf, &f, d_clr );
			}
		}
	}
}
Exemplo n.º 4
0
	void execute()
	{
		Allocation rect;
		getAllocation( rect );
		try
		{
			Allocation a = d_model->getAllocation();
			Viewport* v = getHandler()->getViewport();
			assert( v );
			Viewport::pushCursor( Viewport::CurWait );
			if( rect.getWidth() != 0 && rect.getHeight() != 0 )
			{
				v->captureDamage();

				PpmRange rx, ry;
				rx.first = d_model->toPpm( rect.getLeft(), a.getLeft(), DimX );
				rx.second = d_model->toPpm( rect.getRight(), a.getLeft(), DimX );
				ry.first = d_model->toPpm( rect.getTop(), a.getTop(), DimY );
				ry.second = d_model->toPpm( rect.getBottom(), a.getTop(), DimY );
				d_target->setRange( rx, ry );
				v->commitDamage();
			}else
			{
				d_target->centerPoint( d_model->toPpm( rect.getLeft(), a.getLeft(), DimX ),
					d_model->toPpm( rect.getTop(), a.getTop(), DimY ) );
			}
			v->damageAll();
			Viewport::popCursor();
		}catch( ... )
		{
			qDebug( "Exception in _OverviewCmd" );
		}
		Command::execute();
	}
Exemplo n.º 5
0
	void execute()
	{
		Allocation rect;
		getAllocation( rect );
		if( rect.getWidth() != 0 && rect.getHeight() != 0 )
		{
			Allocation a = d_model->getAllocation();
			Viewport* p = getController()->getViewport();
			assert( p );
			p->pushCursor( Viewport::CurWait );
			p->captureDamage();
			if( d_do[ DimY ] && d_model->inUse( DimY ) && 
				d_do[ DimX ] && d_model->inUse( DimX )  )
			{
				PpmRange rx;
				rx.first = d_model->toPpm( rect.getLeft(), a.getLeft(), DimX );
				rx.second = d_model->toPpm( rect.getRight(), a.getLeft(), DimX );
				
				PpmRange ry;
				ry.first = d_model->toPpm( rect.getTop(), a.getTop(), DimY );
				ry.second = d_model->toPpm( rect.getBottom(), a.getTop(), DimY );

				d_model->setRange( rx, ry );

			}else if( d_do[ DimX ] && d_model->inUse( DimX ) )
			{
				PpmRange rx;
				rx.first = d_model->toPpm( rect.getLeft(), a.getLeft(), DimX );
				rx.second = d_model->toPpm( rect.getRight(), a.getLeft(), DimX );

				d_model->setRange( DimX, rx );

			}else if( d_do[ DimY ] && d_model->inUse( DimY ) )
			{
				PpmRange ry;
				ry.first = d_model->toPpm( rect.getTop(), a.getTop(), DimY );
				ry.second = d_model->toPpm( rect.getBottom(), a.getTop(), DimY );

				d_model->setRange( DimY, ry );

			}
			p->commitDamage();
			p->popCursor();
			d_model->redraw(p);
		}
		Command::execute();
	}
Exemplo n.º 6
0
	void execute()
	{
		Allocation r;
		getAllocation( r );
		ViewAreaMdl* mdl = d_view->getBuf()->getViewArea();
		Allocation a = mdl->getAllocation();
		PpmCube c;
		c.assign( 2, PpmRange() );
		c[ DimX ].first = mdl->toPpm( r.getLeft(), a.getLeft(), DimX );
		c[ DimX ].second = mdl->toPpm( r.getRight(), a.getLeft(), DimX );
		c[ DimY ].first = mdl->toPpm( r.getTop(), a.getTop(), DimY );
		c[ DimY ].second = mdl->toPpm( r.getBottom(), a.getTop(), DimY );
		d_view->selectPeak( c );
		notifySelection( d_view );
		Command::execute();
	}