Пример #1
0
void StGLProjCamera::updateFrustum() {
    // sets top of frustum based on FOVy and near clipping plane
    GLfloat aDYHalf = myIsPersp
                    ? (myZoom * myFrustM.zNear * std::tan(ST_DTR_HALF * myFOVy))
                    : (myZoom * myFrustM.zNear); ///
    // sets right of frustum based on aspect ratio
    GLfloat aDXHalf = myAspect * aDYHalf;
    GLfloat aDXStereoShift = (0.5f * myIOD) * myFrustM.zNear / myZScreen;

    // frustum for left view
    myFrustL.yTop    =  aDYHalf;
    myFrustL.yBottom = -aDYHalf;
    myFrustL.xLeft   = -aDXHalf + aDXStereoShift;
    myFrustL.xRight  =  aDXHalf + aDXStereoShift;
    myFrustL.xTranslation =  0.5f * myIOD; // X translation to cancel parallax
    // frustum for right view
    myFrustR.yTop    =  aDYHalf;
    myFrustR.yBottom = -aDYHalf;
    myFrustR.xLeft   = -aDXHalf - aDXStereoShift;
    myFrustR.xRight  =  aDXHalf - aDXStereoShift;
    myFrustR.xTranslation = -0.5f * myIOD; // X translation to cancel parallax
    // frustum for mono view
    myFrustM.yTop    =  aDYHalf;
    myFrustM.yBottom = -aDYHalf;
    myFrustM.xLeft   = -aDXHalf;
    myFrustM.xRight  =  aDXHalf;
    myFrustM.xTranslation = 0.0f;

    // update current matrix
    setupMatrix();
}
Пример #2
0
ViewPort::ViewPort(QWidget *parent)
    :QFrame(parent)
    ,graphicsView(0)
    ,m_thumb(false)
{
    setFrameStyle(Sunken | StyledPanel);

    graphicsView = new QGraphicsView;
    scene = new QGraphicsScene();
    scene->setBackgroundBrush(QBrush(Qt::gray));
    graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    graphicsView->setRenderHint(QPainter::Antialiasing, false);
    graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
    graphicsView->setOptimizationFlags(QGraphicsView::DontSavePainterState);
    graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
    graphicsView->setScene(scene);

    QHBoxLayout *topLayout = new QHBoxLayout;
    topLayout->addWidget(graphicsView);
    //topLayout->addLayout(zoomSliderLayout, 1, 1);
    setLayout(topLayout);

    connect (scene,SIGNAL(selectionChanged()),
             this,SLOT(onSceneSecletionChnaged()));

    setupMatrix(250);
}
Пример #3
0
void View::resetView()
{
	m_zoomSlider->setValue(250);
	setupMatrix();
	m_graphicsView->ensureVisible(QRectF(0, 0, 0, 0));

	m_resetButton->setEnabled(false);
}
Пример #4
0
void View2D::resetView()
{
    zoomSlider->setValue(250);
    rotateSlider->setValue(0);
    setupMatrix();
    graphicsView->ensureVisible(QRectF(0, 0, 0, 0));

    resetButton->setEnabled(false);
}
Пример #5
0
void StGLProjCamera::setView(const unsigned int theView) {
    switch(theView) {
        case ST_DRAW_LEFT:
            myFrust = &myFrustL;
            break;
        case ST_DRAW_RIGHT:
            myFrust = &myFrustR;
            break;
        case ST_DRAW_MONO:
        default:
            myFrust = &myFrustM;
    }
    // update current matrix
    setupMatrix();
}
Пример #6
0
View::View (MainWindow * mw, const QString & name, QWidget * parent)
	: m_mainWindow(mw)
	, QFrame(parent)
{
	setFrameStyle(Sunken | StyledPanel);
	m_frameSpinBox = new QSpinBox;
	m_graphicsView = new MyGraphicsView(*m_frameSpinBox);
	m_graphicsView->setRenderHint(QPainter::Antialiasing, false);
	m_graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
	m_graphicsView->setOptimizationFlags(QGraphicsView::DontSavePainterState);
	m_graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);

	int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
	QSize iconSize(size, size);

	QToolButton * zoomInIcon = new QToolButton;
	zoomInIcon->setAutoRepeat(true);
	zoomInIcon->setAutoRepeatInterval(33);
	zoomInIcon->setAutoRepeatDelay(0);
	zoomInIcon->setIcon(QPixmap(":/zoomin.png"));
	zoomInIcon->setIconSize(iconSize);
	QToolButton * zoomOutIcon = new QToolButton;
	zoomOutIcon->setAutoRepeat(true);
	zoomOutIcon->setAutoRepeatInterval(33);
	zoomOutIcon->setAutoRepeatDelay(0);
	zoomOutIcon->setIcon(QPixmap(":/zoomout.png"));
	zoomOutIcon->setIconSize(iconSize);
	m_zoomSlider = new QSlider;
	m_zoomSlider->setMinimum(0);
	m_zoomSlider->setMaximum(500);
	m_zoomSlider->setValue(250);
	m_zoomSlider->setTickPosition(QSlider::TicksRight);

	// Zoom slider layout
	QVBoxLayout *zoomSliderLayout = new QVBoxLayout;
	zoomSliderLayout->addWidget(zoomInIcon);
	zoomSliderLayout->addWidget(m_zoomSlider);
	zoomSliderLayout->addWidget(zoomOutIcon);

	m_resetButton = new QToolButton;
	m_resetButton->setText(tr("0"));
	m_resetButton->setEnabled(false);

	// Label layout
	QHBoxLayout *labelLayout = new QHBoxLayout;
	m_label = new QLabel(name);
	m_antialiasButton = new QToolButton;
	m_antialiasButton->setText(tr("Antialiasing"));
	m_antialiasButton->setCheckable(true);
	m_antialiasButton->setChecked(false);
	m_openGlButton = new QToolButton;
	m_openGlButton->setText(tr("OpenGL"));
	m_openGlButton->setCheckable(true);
#ifndef QT_NO_OPENGL
	m_openGlButton->setEnabled(QGLFormat::hasOpenGL());
#else
	m_openGlButton->setEnabled(false);
#endif

	labelLayout->addWidget(m_label);
	labelLayout->addStretch();
	labelLayout->addWidget(m_antialiasButton);
	labelLayout->addWidget(m_openGlButton);

	QGridLayout *topLayout = new QGridLayout;
	topLayout->addLayout(labelLayout, 0, 0);
	topLayout->addWidget(m_graphicsView, 1, 0);
	topLayout->addLayout(zoomSliderLayout, 1, 1);

	QSlider * m_heightSlider = new QSlider;
	m_heightSlider->setMinimum(0);
	m_heightSlider->setMaximum(400);
	m_heightSlider->setValue(g_heightValue);
	topLayout->addWidget(m_heightSlider, 1, 2);
	//m_heightSlider->setTickPosition(QSlider::TicksRight);
	//
	m_frameSpinBox->setMinimum(0);
	m_frameSpinBox->setValue(0);

	int const max = m_mainWindow->getProfileInfo(0).m_frames.size();
	m_frameSpinBox->setMaximum(max);
	topLayout->addWidget(m_frameSpinBox, 0, 1);

	topLayout->addWidget(m_resetButton, 2, 1);
	setLayout(topLayout);

	connect(m_resetButton, SIGNAL(clicked()), this, SLOT(resetView()));
	connect(m_zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
	connect(m_graphicsView->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setResetButtonEnabled()));
	connect(m_graphicsView->horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setResetButtonEnabled()));
	connect(m_antialiasButton, SIGNAL(toggled(bool)), this, SLOT(toggleAntialiasing()));
	connect(m_openGlButton, SIGNAL(toggled(bool)), this, SLOT(toggleOpenGL()));
	connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn()));
	connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut()));

	connect(m_heightSlider, SIGNAL(valueChanged(int)), this, SLOT(changeHeight(int)));

	setupMatrix();
}
Пример #7
0
void ViewPort::zoomToFullSize()
{
    setupMatrix(250);
    graphicsView->ensureVisible(QRectF(0, 0, 0, 0));
}
Пример #8
0
View::View(const QString &name, QWidget *parent)
    : QFrame(parent)
{


    setFrameStyle(Sunken | StyledPanel);
    graphicsView = new GraphicsView(this);
    graphicsView->setRenderHint(QPainter::Antialiasing, false);
    graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
    graphicsView->setOptimizationFlags(QGraphicsView::DontSavePainterState);
    graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
    graphicsView->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);

    int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
    QSize iconSize(size, size);

    QPushButton *zoomInIcon = new QPushButton;
    zoomInIcon->setAutoRepeat(true);
    zoomInIcon->setAutoRepeatInterval(33);
    zoomInIcon->setAutoRepeatDelay(0);
    zoomInIcon->setIcon(QPixmap(":/zoomin.png"));
    zoomInIcon->setIconSize(QSize(20,20));
    //zoomInIcon->setIconSize(iconSize);
    QPushButton *zoomOutIcon = new QPushButton;
    zoomOutIcon->setAutoRepeat(true);
    zoomOutIcon->setAutoRepeatInterval(33);
    zoomOutIcon->setAutoRepeatDelay(0);
    zoomOutIcon->setIcon(QPixmap(":/zoomout.png"));
    zoomOutIcon->setIconSize(QSize(20,20));
    //zoomOutIcon->setIconSize(iconSize);
    zoomSlider = new QSlider;
    zoomSlider->setMinimum(0);
    zoomSlider->setMaximum(500);
    zoomSlider->setValue(210);
    zoomSlider->setTickPosition(QSlider::TicksRight);

    // Zoom slider layout
    QVBoxLayout *zoomSliderLayout = new QVBoxLayout;
    zoomSliderLayout->addWidget(zoomInIcon);
    zoomSliderLayout->addWidget(zoomSlider);
    zoomSliderLayout->addWidget(zoomOutIcon);

    QToolButton *rotateLeftIcon = new QToolButton;
    rotateLeftIcon->setIcon(QPixmap(":images/tool_curved_icon.png"));
    rotateLeftIcon->setIconSize(iconSize);
    QToolButton *rotateRightIcon = new QToolButton;
    rotateRightIcon->setIcon(QPixmap(":/images/toolcurvedicon32.png"));
    rotateRightIcon->setIconSize(iconSize);
    rotateSlider = new QSlider;
    rotateSlider->setOrientation(Qt::Horizontal);
    rotateSlider->setMinimum(-360);
    rotateSlider->setMaximum(360);
    rotateSlider->setValue(0);
    rotateSlider->setTickPosition(QSlider::TicksBelow);

    // Rotate slider layout
    QHBoxLayout *rotateSliderLayout = new QHBoxLayout;
    rotateSliderLayout->addWidget(rotateLeftIcon);
    rotateSliderLayout->addWidget(rotateSlider);
    rotateSliderLayout->addWidget(rotateRightIcon);

    resetButton = new QPushButton;
    resetButton->setIcon(QPixmap(":/reseticon.png"));
    resetButton->setIconSize(QSize(20,20));
    //resetButton->setText(tr("0"));
    resetButton->setEnabled(false);

    // Label layout
    layoutName = new QLabel("New Layout");

    QHBoxLayout *labelLayout = new QHBoxLayout;
    label = new QLabel(name);
    label2 = new QLabel(tr("Pointer Mode"));
    selectModeButton = new QPushButton;
    selectModeButton->setIcon(QPixmap(":/selecticon.png"));
    selectModeButton->setIconSize(QSize(20,20));
    //selectModeButton->setText(tr("Select"));
    selectModeButton->setCheckable(true);
    selectModeButton->setChecked(true);
    dragModeButton = new QPushButton;
    dragModeButton->setIcon(QPixmap(":/handicon.png"));
    dragModeButton->setIconSize(QSize(20,20));
    //dragModeButton->setMinimumWidth(35);
    //dragModeButton->setMinimumHeight(35);
    //dragModeButton->setText(tr("Drag"));
    dragModeButton->setCheckable(true);
    dragModeButton->setChecked(false);
    antialiasButton = new QToolButton;
    antialiasButton->setText(tr("Antialiasing"));
    antialiasButton->setCheckable(true);
    antialiasButton->setChecked(false);
    openGlButton = new QToolButton;
    openGlButton->setText(tr("OpenGL"));
    openGlButton->setCheckable(true);
#ifndef QT_NO_OPENGL
    openGlButton->setEnabled(QGLFormat::hasOpenGL());
#else
    openGlButton->setEnabled(false);
#endif
    printButton = new QToolButton;
    printButton->setIcon(QIcon(QPixmap(":/fileprint.png")));

    QButtonGroup *pointerModeGroup = new QButtonGroup;
    pointerModeGroup->setExclusive(true);
    pointerModeGroup->addButton(selectModeButton);
    pointerModeGroup->addButton(dragModeButton);

    labelLayout->addWidget(layoutName);
    labelLayout->addWidget(label);
    labelLayout->addStretch();
    //labelLayout->addWidget(label2);
    labelLayout->addWidget(selectModeButton);
    labelLayout->addWidget(dragModeButton);
    labelLayout->addWidget(zoomInIcon);
    labelLayout->addWidget(zoomOutIcon);
    labelLayout->addWidget(resetButton);
    labelLayout->addStretch();
    //labelLayout->addWidget(antialiasButton);
    //labelLayout->addWidget(openGlButton);
    //labelLayout->addWidget(printButton);

    QGridLayout *topLayout = new QGridLayout;
    topLayout->addLayout(labelLayout, 0, 0);
    topLayout->addWidget(graphicsView, 1, 0);
    //topLayout->addLayout(zoomSliderLayout, 1, 1);
    //topLayout->addLayout(rotateSliderLayout, 2, 0);
    //topLayout->addWidget(resetButton, 2, 1);
    setLayout(topLayout);

    connect(resetButton, SIGNAL(clicked()), this, SLOT(resetView()));
    connect(zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
    connect(rotateSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
    connect(graphicsView->verticalScrollBar(), SIGNAL(valueChanged(int)),
            this, SLOT(setResetButtonEnabled()));
    connect(graphicsView->horizontalScrollBar(), SIGNAL(valueChanged(int)),
            this, SLOT(setResetButtonEnabled()));
    connect(selectModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode()));
    connect(dragModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode()));
    //connect(antialiasButton, SIGNAL(toggled(bool)), this, SLOT(toggleAntialiasing()));
    connect(openGlButton, SIGNAL(toggled(bool)), this, SLOT(toggleOpenGL()));
    connect(rotateLeftIcon, SIGNAL(clicked()), this, SLOT(rotateLeft()));
    connect(rotateRightIcon, SIGNAL(clicked()), this, SLOT(rotateRight()));
    connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn()));
    connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut()));
    connect(printButton, SIGNAL(clicked()), this, SLOT(print()));

    setupMatrix();
}
Пример #9
0
void GrDapView::zoomValue(int value)
{
	zoomSlider = value;
	emit setupMatrix();
}
Пример #10
0
SVGView::SVGView(const QString &name, QWidget *parent)
	: QFrame(parent)
{
	setFrameStyle(Sunken | StyledPanel);
    m_graphicsView = new QGraphicsView;
    m_graphicsView->setRenderHint(QPainter::Antialiasing, true);
    m_graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
    m_graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
    int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
    QSize iconSize(size, size);

    m_domDocument = new QDomDocument;

	m_zoom = 1;
	m_rotation = 0;

    QToolButton *zoomInIcon = new QToolButton;
    zoomInIcon->setAutoRepeat(true);
    zoomInIcon->setAutoRepeatInterval(33);
    zoomInIcon->setAutoRepeatDelay(0);
    zoomInIcon->setIcon(QPixmap(":/zoomin.png"));
    zoomInIcon->setIconSize(iconSize);
    QToolButton *zoomOutIcon = new QToolButton;
    zoomOutIcon->setAutoRepeat(true);
    zoomOutIcon->setAutoRepeatInterval(33);
    zoomOutIcon->setAutoRepeatDelay(0);
    zoomOutIcon->setIcon(QPixmap(":/zoomout.png"));
    zoomOutIcon->setIconSize(iconSize);

    QToolButton *rotateLeftIcon = new QToolButton;
    rotateLeftIcon->setIcon(QPixmap(":/rotateleft.png"));
    rotateLeftIcon->setIconSize(iconSize);
    QToolButton *rotateRightIcon = new QToolButton;
    rotateRightIcon->setIcon(QPixmap(":/rotateright.png"));
    rotateRightIcon->setIconSize(iconSize);

    // Label layout
    QHBoxLayout *labelLayout = new QHBoxLayout;
    m_label = new QLabel(name);

	//TODO: put proper icons in here
    m_printButton = new QToolButton;
    m_printButton->setIcon(QIcon(QPixmap(":/resources/images/document-print.png")));
    m_printButton->setText(tr("Print"));
    m_printButton->setToolTip(tr("Print"));

	m_loadPCBXMLButton = new QToolButton;
    m_loadPCBXMLButton->setIcon(QIcon(QPixmap(":/resources/images/applications-accessories.png")));
	m_loadPCBXMLButton->setText(tr("Import XML"));
	m_loadPCBXMLButton->setToolTip(tr("Import XML"));

    labelLayout->addWidget(m_label);
    labelLayout->addStretch();
    labelLayout->addWidget(m_printButton);
    labelLayout->addWidget(m_loadPCBXMLButton);

    QGridLayout *topLayout = new QGridLayout;
    topLayout->addLayout(labelLayout, 0, 0);
    topLayout->addWidget(m_graphicsView, 1, 0);
    setLayout(topLayout);

    connect(rotateLeftIcon, SIGNAL(clicked()), this, SLOT(rotateLeft()));
    connect(rotateRightIcon, SIGNAL(clicked()), this, SLOT(rotateRight()));
    connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn()));
    connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut()));
    connect(m_printButton, SIGNAL(clicked()), this, SLOT(print()));
    connect(m_loadPCBXMLButton, SIGNAL(clicked()), this, SLOT(importPCBXML()));

    setupMatrix();
}
Пример #11
0
matrix_symmetrical<T>::matrix_symmetrical(const size_t aSize)
{
	setupMatrix(aSize, aSize);

	this->initMatrix();
}
Пример #12
0
matrix_symmetrical<T>::matrix_symmetrical()
{
	setupMatrix(1, 1);

	this->initMatrix();
}
Пример #13
0
double UpdateSystem( VoronoiDiagram *voronoiDiagram, double timeStep, double timeDifference){
	
	double time;
	
	//int direction = (int)(myRand()*DIMENSIONS+0.5);
	int direction = ADI_direction; ADI_direction = (ADI_direction+1)%DIMENSIONS;
	
	
	for( time = 0; time+timeStep <= timeDifference; time += timeStep){

#if DIFFUSION_METHODE == EXPLICIT

		//fprintf( stderr, "EXPLICIT\n");
		// Finite Differences: explicit method	
		for( int i=0; i<voronoiDiagram->countVoronoiCells; i++){
			
			voronoiDiagram->voronoiCells[i]->doxygen  = timeStep * (Oxygen_Diffusion  * secondDerivationOxygen(  voronoiDiagram->voronoiCells[i], voronoiDiagram) // diffusion
	#if DIFFUSION_REACTION_SEPARAT == FALSE
			                                          - voronoiDiagram->voronoiCells[i]->oxygen  * GiveMeTheOxygenRate(  voronoiDiagram->voronoiCells[i]) // reaction
	#endif
			                                          );
			voronoiDiagram->voronoiCells[i]->dglucose = timeStep * (Glucose_Diffusion * secondDerivationGlucose( voronoiDiagram->voronoiCells[i], voronoiDiagram) // diffusion
	#if DIFFUSION_REACTION_SEPARAT == FALSE
			                                          - voronoiDiagram->voronoiCells[i]->glucose * GiveMeTheGlucoseRate( voronoiDiagram->voronoiCells[i]) // reaction
	#endif
			                                          );			                                          
		}

#else


	for( int d=0; d<DIMENSIONS; d++){
	//fprintf(stderr, "dir=%i\n", direction);
		// Finite Differences: alternating direction implicit (ADI)
		double weight = 1.;
		
		//int i = 0;
		//int ii = 0;
		//int iii = 0;
		
		for( int iset=0; iset<voronoiDiagram->xN[(d==0?1:0)]/*20*/; iset++){
			for( int iiset=0; iiset<voronoiDiagram->xN[(d<=1?2:1)]/*20*/; iiset++){

				// base index
				int index=0;
				int index_count = 0;
				for( int dd=0; dd<DIMENSIONS; dd++){
					if( dd!=direction){
						if(index_count==0)
							index += (int)( iset*pow( voronoiDiagram->xN[(d==0?1:0)]/*20*/, dd));
						else
							index += (int)( iiset*pow( voronoiDiagram->xN[(d<=1?2:1)]/*20*/, dd));
						index_count++;
					}
				}

				//fprintf(stderr, "setupMatrixADI(o): %i <= (%i,%i)\n", index, iset, iiset);

	#if   DIFFUSION_METHODE == CRANK_NICHOLSON
				setupMatrixCrankNicholson( voronoiDiagram, index, timeStep, 'o', direction);
				//fprintf( stderr, "CRANK_NICHOLSON\n");
	#elif DIFFUSION_METHODE == ADI
				setupMatrixADI( voronoiDiagram, index, timeStep, 'o', direction);
	#elif DIFFUSION_METHODE == IMPLICIT
				//fprintf( stderr, "ADI\n");
				setupMatrix( voronoiDiagram, index, timeStep, 'o', direction);
	#endif
				//setupMatrixADI( voronoiDiagram, index, timeStep, 'o', direction);
				//fprintf(stderr, "solve\n");
				//solveLinearSystemTridiagonalMatrix( A, b, x, voronoiDiagram->xN[d]);
				solveLinearSystem( A, b, x, voronoiDiagram->xN[d]/*20*/);
				for( int i=0; i<voronoiDiagram->xN[d]/*20*/; i++)
	#if DIFFUSION_METHODE == IMPLICIT
					if( d!=0)
						voronoiDiagram->voronoiCells[(int)(index+i*pow( voronoiDiagram->xN[d]/*20*/, direction))]->doxygen += weight*(b[i] - voronoiDiagram->voronoiCells[(int)(index+i*pow( voronoiDiagram->xN[d]/*20*/, direction))]->oxygen);
					else
	#endif
						voronoiDiagram->voronoiCells[(int)(index+i*pow( voronoiDiagram->xN[d]/*20*/, direction))]->doxygen = weight*(b[i] - voronoiDiagram->voronoiCells[(int)(index+i*pow( voronoiDiagram->xN[d]/*20*/, direction))]->oxygen);

				//fprintf(stderr, "setupMatrixADI(g): %i <= (%i,%i)\n", index, iset, iiset);

	#if   DIFFUSION_METHODE == CRANK_NICHOLSON
				setupMatrixCrankNicholson( voronoiDiagram, index, timeStep, 'g', direction);
				//fprintf( stderr, "CRANK_NICHOLSON\n");
	#elif DIFFUSION_METHODE == ADI
				setupMatrixADI( voronoiDiagram, index, timeStep, 'g', direction);
	#elif DIFFUSION_METHODE == IMPLICIT
				//fprintf( stderr, "Implicit\n");
				setupMatrix( voronoiDiagram, index, timeStep, 'g', direction);
	#endif
				//setupMatrixADI( voronoiDiagram, index, timeStep, 'g', direction);
				solveLinearSystem( A, b, x, voronoiDiagram->xN[d]/*20*/);
				//solveLinearSystemTridiagonalMatrix( A, b, x, voronoiDiagram->xN[d]);
				for( int i=0; i<voronoiDiagram->xN[d]/*20*/; i++)
	#if DIFFUSION_METHODE == IMPLICIT
					if( d!=0)
						//add differences
						voronoiDiagram->voronoiCells[(int)(index+i*pow( voronoiDiagram->xN[d]/*20*/, direction))]->dglucose += weight*(b[i] - voronoiDiagram->voronoiCells[(int)(index+i*pow( voronoiDiagram->xN[d]/*20*/, direction))]->glucose);
					else
	#endif
						// set differences
						voronoiDiagram->voronoiCells[(int)(index+i*pow( voronoiDiagram->xN[d]/*20*/, direction))]->dglucose = weight*(b[i] - voronoiDiagram->voronoiCells[(int)(index+i*pow( voronoiDiagram->xN[d]/*20*/, direction))]->glucose);
			}
		}
#endif
		

#if DIFFUSION_METHODE == IMPLICIT
		if(d+1==DIMENSIONS)
#endif
		// update half time step
		{//fprintf(stderr, "update half time step\n");
		for( int i=0; i<voronoiDiagram->countVoronoiCells; i++){
			if( voronoiDiagram->voronoiCells[i]->position[0]>voronoiDiagram->xMin[0]+1
			 && voronoiDiagram->voronoiCells[i]->position[0]<voronoiDiagram->xMax[0]-1 
			 && voronoiDiagram->voronoiCells[i]->position[1]>voronoiDiagram->xMin[1]+1
			 && voronoiDiagram->voronoiCells[i]->position[1]<voronoiDiagram->xMax[1]-1
		#if DIMENSIONS > 2
			 && voronoiDiagram->voronoiCells[i]->position[2]>voronoiDiagram->xMin[2]+1
			 && voronoiDiagram->voronoiCells[i]->position[2]<voronoiDiagram->xMax[2]-1 
		#endif
			){	
				voronoiDiagram->voronoiCells[i]->oxygen  += voronoiDiagram->voronoiCells[i]->doxygen;
				if( voronoiDiagram->voronoiCells[i]->oxygen < 0.) voronoiDiagram->voronoiCells[i]->oxygen = 0.;
				voronoiDiagram->voronoiCells[i]->glucose += voronoiDiagram->voronoiCells[i]->dglucose;
				if( voronoiDiagram->voronoiCells[i]->glucose < 0.) voronoiDiagram->voronoiCells[i]->glucose = 0.;
			}
		}}

		// change direction
		direction = (direction+1)%DIMENSIONS;
	}

#if DIFFUSION_REACTION_SEPARAT == TRUE
	// reaction
	for( int i=0; i<voronoiDiagram->countVoronoiCells; i++){
		if( voronoiDiagram->voronoiCells[i]->position[0]>voronoiDiagram->xMin[0]+1
		 && voronoiDiagram->voronoiCells[i]->position[0]<voronoiDiagram->xMax[0]-1 
		 && voronoiDiagram->voronoiCells[i]->position[1]>voronoiDiagram->xMin[1]+1
		 && voronoiDiagram->voronoiCells[i]->position[1]<voronoiDiagram->xMax[1]-1
	#if DIMENSIONS > 2
		 && voronoiDiagram->voronoiCells[i]->position[2]>voronoiDiagram->xMin[2]+1
		 && voronoiDiagram->voronoiCells[i]->position[2]<voronoiDiagram->xMax[2]-1 
	#endif
		){	
			voronoiDiagram->voronoiCells[i]->oxygen  += - timeStep * voronoiDiagram->voronoiCells[i]->oxygen  * GiveMeTheOxygenRate(  voronoiDiagram->voronoiCells[i]);
			if( voronoiDiagram->voronoiCells[i]->oxygen < 0.) voronoiDiagram->voronoiCells[i]->oxygen = 0.;
			voronoiDiagram->voronoiCells[i]->glucose += - timeStep * voronoiDiagram->voronoiCells[i]->glucose * GiveMeTheGlucoseRate( voronoiDiagram->voronoiCells[i]);
			if( voronoiDiagram->voronoiCells[i]->glucose < 0.) voronoiDiagram->voronoiCells[i]->glucose = 0.;
		}
	}
#endif
#if DIFFUSION_METHODE != EXPLICIT
	}
#endif
	return timeDifference - time;
}
Пример #14
0
bool DXManager::Initialize(
	int screenWidth,
	int screenHeight,
	bool vsync,
	HWND HWnd,
	bool fullscreen,
	float screenDepth,
	float screenNear
	)
{
	HRESULT hr = S_OK;
	m_vsync_enabled = vsync;
	mHWnd = HWnd;
	m_ScreenWidth = screenWidth;
	m_ScreenHeight = screenHeight;
	m_ScreenNear = screenNear;
	m_ScreenDepth = screenDepth;


	hr = initializeDevice(fullscreen);
	if (FAILED(hr))
		return false;

	hr = setupMatrix();
	if (FAILED(hr))
		return false;

	hr = getVideoCardInfo();
	if (FAILED(hr))
		return false;

	hr = initializeDepthBufferDesc();
	if (FAILED(hr))
		return false;

	hr = initializeDepthStencilDesc();
	if (FAILED(hr))
		return false;
	
	hr = initializeAlphaBlendStateDesc();
	if (FAILED(hr))
		return false;
	
	hr = initializeRenderTarget();
	if (FAILED(hr))
		return false;

	hr = initializeRasterState();
	if (FAILED(hr))
		return false;

	// Setta il viewport
	vp.Width = static_cast<float>(m_ScreenWidth);
	vp.Height = static_cast<float>(m_ScreenHeight);
	vp.MinDepth = 0.0f;
	vp.MaxDepth = 1.0f;
	vp.TopLeftX = 0;
	vp.TopLeftY = 0;
	mPd3dDeviceContext->RSSetViewports(1, &vp);

	return true;
}
Пример #15
0
View::View(const QString &name, QWidget *parent)
    : QFrame(parent)
{
    setFrameStyle(Sunken | StyledPanel);
    graphicsView = new GraphicsView(this);
    graphicsView->setRenderHint(QPainter::Antialiasing, true);
    graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
    graphicsView->setOptimizationFlags(QGraphicsView::DontSavePainterState);
    graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
    graphicsView->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);

    int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
    QSize iconSize(size, size);

    QToolButton *zoomInIcon = new QToolButton;
    zoomInIcon->setAutoRepeat(true);
    zoomInIcon->setAutoRepeatInterval(33);
    zoomInIcon->setAutoRepeatDelay(0);
    zoomInIcon->setIcon(QPixmap(":/img/zoomin.png"));
    zoomInIcon->setIconSize(iconSize);
    QToolButton *zoomOutIcon = new QToolButton;
    zoomOutIcon->setAutoRepeat(true);
    zoomOutIcon->setAutoRepeatInterval(33);
    zoomOutIcon->setAutoRepeatDelay(0);
    zoomOutIcon->setIcon(QPixmap(":/img/zoomout.png"));
    zoomOutIcon->setIconSize(iconSize);
    zoomSlider = new QSlider;
    zoomSlider->setMinimum(0);
    zoomSlider->setMaximum(500);
    zoomSlider->setValue(250);
    zoomSlider->setTickPosition(QSlider::TicksRight);

    // Zoom slider layout
    QVBoxLayout *zoomSliderLayout = new QVBoxLayout;
    zoomSliderLayout->addWidget(zoomInIcon);
    zoomSliderLayout->addWidget(zoomSlider);
    zoomSliderLayout->addWidget(zoomOutIcon);

    QToolButton *rotateLeftIcon = new QToolButton;
    rotateLeftIcon->setIcon(QPixmap(":/img/rotateleft.png"));
    rotateLeftIcon->setIconSize(iconSize);
    QToolButton *rotateRightIcon = new QToolButton;
    rotateRightIcon->setIcon(QPixmap(":/img/rotateright.png"));
    rotateRightIcon->setIconSize(iconSize);
    rotateSlider = new QSlider;
    rotateSlider->setOrientation(Qt::Horizontal);
    rotateSlider->setMinimum(-360);
    rotateSlider->setMaximum(360);
    rotateSlider->setValue(0);
    rotateSlider->setTickPosition(QSlider::TicksBelow);

    // Rotate slider layout
    QHBoxLayout *rotateSliderLayout = new QHBoxLayout;
    rotateSliderLayout->addWidget(rotateLeftIcon);
    rotateSliderLayout->addWidget(rotateSlider);
    rotateSliderLayout->addWidget(rotateRightIcon);

    resetButton = new QToolButton;
    resetButton->setText(tr("reset"));
    resetButton->setEnabled(false);

    // Label layout
    QHBoxLayout *labelLayout = new QHBoxLayout;
    label = new QLabel(name);

    printButton = new QToolButton;
    printButton->setIcon(QIcon(QPixmap(":/img/fileprint.png")));

    labelLayout->addWidget(label);
    labelLayout->addStretch();
    labelLayout->addWidget(printButton);

    QGridLayout *topLayout = new QGridLayout;
    topLayout->addLayout(labelLayout, 0, 0);
    topLayout->addWidget(graphicsView, 1, 0);
    topLayout->addLayout(zoomSliderLayout, 1, 1);
    topLayout->addLayout(rotateSliderLayout, 2, 0);
    topLayout->addWidget(resetButton, 2, 1);
    setLayout(topLayout);

    connect(resetButton, SIGNAL(clicked()), this, SLOT(resetView()));
    connect(zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
    connect(rotateSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
    connect(graphicsView->verticalScrollBar(), SIGNAL(valueChanged(int)),
            this, SLOT(setResetButtonEnabled()));
    connect(graphicsView->horizontalScrollBar(), SIGNAL(valueChanged(int)),
            this, SLOT(setResetButtonEnabled()));
    connect(rotateLeftIcon, SIGNAL(clicked()), this, SLOT(rotateLeft()));
    connect(rotateRightIcon, SIGNAL(clicked()), this, SLOT(rotateRight()));
    connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn()));
    connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut()));
    connect(printButton, SIGNAL(clicked()), this, SLOT(print()));

    setupMatrix();
}
Пример #16
0
void GrDapView::rotarValue(int value)
{
	rotateSlider = value;
	emit setupMatrix();
}
Пример #17
0
View::View(const QString &name, QWidget *parent)
    : QFrame(parent)
{
    setFrameStyle(Sunken | StyledPanel);
    graphicsView = new GraphicsView(this);
    graphicsView->setRenderHint(QPainter::Antialiasing, false);
    graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
    graphicsView->setOptimizationFlags(QGraphicsView::DontSavePainterState);
    graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
    graphicsView->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);

    int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
    QSize iconSize(size, size);

    QToolButton *zoomInIcon = new QToolButton;
    zoomInIcon->setAutoRepeat(true);
    zoomInIcon->setAutoRepeatInterval(33);
    zoomInIcon->setAutoRepeatDelay(0);
    zoomInIcon->setIcon(QPixmap(":/zoomin.png"));
    zoomInIcon->setIconSize(iconSize);
    QToolButton *zoomOutIcon = new QToolButton;
    zoomOutIcon->setAutoRepeat(true);
    zoomOutIcon->setAutoRepeatInterval(33);
    zoomOutIcon->setAutoRepeatDelay(0);
    zoomOutIcon->setIcon(QPixmap(":/zoomout.png"));
    zoomOutIcon->setIconSize(iconSize);
    zoomSlider = new QSlider;
    zoomSlider->setMinimum(0);
    zoomSlider->setMaximum(500);
    zoomSlider->setValue(250);
    zoomSlider->setTickPosition(QSlider::TicksRight);

    // Zoom slider layout
    QVBoxLayout *zoomSliderLayout = new QVBoxLayout;
    zoomSliderLayout->addWidget(zoomInIcon);
    zoomSliderLayout->addWidget(zoomSlider);
    zoomSliderLayout->addWidget(zoomOutIcon);

    QToolButton *rotateLeftIcon = new QToolButton;
    rotateLeftIcon->setIcon(QPixmap(":/rotateleft.png"));
    rotateLeftIcon->setIconSize(iconSize);
    QToolButton *rotateRightIcon = new QToolButton;
    rotateRightIcon->setIcon(QPixmap(":/rotateright.png"));
    rotateRightIcon->setIconSize(iconSize);
    rotateSlider = new QSlider;
    rotateSlider->setOrientation(Qt::Horizontal);
    rotateSlider->setMinimum(-360);
    rotateSlider->setMaximum(360);
    rotateSlider->setValue(0);
    rotateSlider->setTickPosition(QSlider::TicksBelow);

    // Rotate slider layout
    QHBoxLayout *rotateSliderLayout = new QHBoxLayout;
    rotateSliderLayout->addWidget(rotateLeftIcon);
    rotateSliderLayout->addWidget(rotateSlider);
    rotateSliderLayout->addWidget(rotateRightIcon);

    resetButton = new QToolButton;
    resetButton->setText(tr("0"));
    resetButton->setEnabled(false);

    // Label layout
    QHBoxLayout *labelLayout = new QHBoxLayout;
    label = new QLabel(name);

    refreshButton = new QToolButton;
    refreshButton->setText(tr("Step Sim"));
    refreshButton->setEnabled(true);

    upButton = new QToolButton;
    upButton->setText(tr("Up"));
    upButton->setEnabled(true);

    downButton = new QToolButton;
    downButton->setText(tr("Down"));
    downButton->setEnabled(true);

    leftButton = new QToolButton;
    leftButton->setText(tr("Left"));
    leftButton->setEnabled(true);

    rightButton = new QToolButton;
    rightButton->setText(tr("Right"));
    rightButton->setEnabled(true);

    label2 = new QLabel(tr("Pointer Mode"));

    selectModeButton = new QToolButton;
    selectModeButton->setText(tr("Select"));
    selectModeButton->setCheckable(true);
    selectModeButton->setChecked(true);

    dragModeButton = new QToolButton;
    dragModeButton->setText(tr("Drag"));
    dragModeButton->setCheckable(true);
    dragModeButton->setChecked(false);

    antialiasButton = new QToolButton;
    antialiasButton->setText(tr("Antialiasing"));
    antialiasButton->setCheckable(true);
    antialiasButton->setChecked(false);

    openGlButton = new QToolButton;
    openGlButton->setText(tr("OpenGL"));
    openGlButton->setCheckable(true);
#ifndef QT_NO_OPENGL
    openGlButton->setEnabled(QGLFormat::hasOpenGL());
#else
    openGlButton->setEnabled(false);
#endif
    printButton = new QToolButton;
    printButton->setIcon(QIcon(QPixmap(":/fileprint.png")));

    //A container for the PointerMode switcher buttons.
    QButtonGroup *pointerModeGroup = new QButtonGroup;
    pointerModeGroup->setExclusive(true);
    pointerModeGroup->addButton(selectModeButton);
    pointerModeGroup->addButton(dragModeButton);

    //The button Layout
    labelLayout->addWidget(label);
    labelLayout->addWidget(refreshButton);

    //Temporary buttons!
    labelLayout->addWidget(upButton);
    labelLayout->addWidget(downButton);
    labelLayout->addWidget(leftButton);
    labelLayout->addWidget(rightButton);
    //Back to business.

    labelLayout->addStretch();
    labelLayout->addWidget(label2);
    labelLayout->addWidget(selectModeButton);
    labelLayout->addWidget(dragModeButton);
    labelLayout->addStretch();
    labelLayout->addWidget(antialiasButton);
    labelLayout->addWidget(openGlButton);
    labelLayout->addWidget(printButton);

    //Generating layout for entire window
    QGridLayout *topLayout = new QGridLayout;
    topLayout->addLayout(labelLayout, 0, 0);
    topLayout->addWidget(graphicsView, 1, 0);
    topLayout->addLayout(zoomSliderLayout, 1, 1);
    topLayout->addLayout(rotateSliderLayout, 2, 0);
    topLayout->addWidget(resetButton, 2, 1);
    setLayout(topLayout);

    //Connect Socket to signal.
    connect(resetButton, SIGNAL(clicked()), this, SLOT(resetView()));
    connect(zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
    connect(rotateSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
    connect(graphicsView->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setResetButtonEnabled()));
    connect(graphicsView->horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setResetButtonEnabled()));
    connect(selectModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode()));
    connect(dragModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode()));
    connect(antialiasButton, SIGNAL(toggled(bool)), this, SLOT(toggleAntialiasing()));
    connect(openGlButton, SIGNAL(toggled(bool)), this, SLOT(toggleOpenGL()));
    connect(rotateLeftIcon, SIGNAL(clicked()), this, SLOT(rotateLeft()));
    connect(rotateRightIcon, SIGNAL(clicked()), this, SLOT(rotateRight()));
    connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn()));
    connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut()));
    connect(printButton, SIGNAL(clicked()), this, SLOT(print()));

    setupMatrix();
}
Пример #18
0
void GrDapView::setZoomOut(int level)
{
	zoomSlider = zoomSlider - level;
	emit setupMatrix();
}
Пример #19
0
View::View(const QString &name, QWidget *parent)
    : QFrame(parent)
{
    setFrameStyle(Sunken | StyledPanel);
    graphicsView = new GraphicsView(this);
    graphicsView->setRenderHint(QPainter::Antialiasing, false);
    graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
    graphicsView->setOptimizationFlags(QGraphicsView::DontSavePainterState);
    graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
    graphicsView->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);

    int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
    QSize iconSize(size, size);

    QToolButton *zoomInIcon = new QToolButton;
    zoomInIcon->setAutoRepeat(true);
    zoomInIcon->setAutoRepeatInterval(33);
    zoomInIcon->setAutoRepeatDelay(0);
    zoomInIcon->setIcon(QPixmap(":/zoomin.png"));
    zoomInIcon->setIconSize(iconSize);
    QToolButton *zoomOutIcon = new QToolButton;
    zoomOutIcon->setAutoRepeat(true);
    zoomOutIcon->setAutoRepeatInterval(33);
    zoomOutIcon->setAutoRepeatDelay(0);
    zoomOutIcon->setIcon(QPixmap(":/zoomout.png"));
    zoomOutIcon->setIconSize(iconSize);
    zoomSlider = new QSlider;
    zoomSlider->setMinimum(0);
    zoomSlider->setMaximum(500);
    zoomSlider->setValue(250);
    zoomSlider->setTickPosition(QSlider::TicksRight);

    // Zoom slider layout
    QVBoxLayout *zoomSliderLayout = new QVBoxLayout;
    zoomSliderLayout->addWidget(zoomInIcon);
    zoomSliderLayout->addWidget(zoomSlider);
    zoomSliderLayout->addWidget(zoomOutIcon);

    QToolButton *rotateLeftIcon = new QToolButton;
    rotateLeftIcon->setIcon(QPixmap(":/rotateleft.png"));
    rotateLeftIcon->setIconSize(iconSize);
    QToolButton *rotateRightIcon = new QToolButton;
    rotateRightIcon->setIcon(QPixmap(":/rotateright.png"));
    rotateRightIcon->setIconSize(iconSize);
    rotateSlider = new QSlider;
    rotateSlider->setOrientation(Qt::Horizontal);
    rotateSlider->setMinimum(-360);
    rotateSlider->setMaximum(360);
    rotateSlider->setValue(0);
    rotateSlider->setTickPosition(QSlider::TicksBelow);

    // Rotate slider layout
    QHBoxLayout *rotateSliderLayout = new QHBoxLayout;
    rotateSliderLayout->addWidget(rotateLeftIcon);
    rotateSliderLayout->addWidget(rotateSlider);
    rotateSliderLayout->addWidget(rotateRightIcon);

    resetButton = new QToolButton;
    resetButton->setText(tr("0"));
    resetButton->setEnabled(false);


    // Label layout
    QHBoxLayout *labelLayout = new QHBoxLayout;
    label = new QLabel(name);
    label2 = new QLabel(tr("Pointer Mode"));
    selectModeButton = new QToolButton;
    //selectModeButton->setText(tr("Select"));
    selectModeButton->setIcon(QPixmap(":/choose.png"));
    selectModeButton->setIconSize(iconSize);
    selectModeButton->setCheckable(true);
    selectModeButton->setChecked(true);
    dragModeButton = new QToolButton;
    //dragModeButton->setText(tr("Drag"));
    dragModeButton->setIcon(QPixmap(":/Press-and-Drag.png"));
    dragModeButton ->setIconSize(iconSize);
    dragModeButton->setCheckable(true);
    dragModeButton->setChecked(false);
    Btn_Pathfinding = new QToolButton;
    //Btn_Pathfinding ->setText(tr("PathFinding"));
    Btn_Pathfinding ->setIcon(QPixmap(":/pathfinding.png"));
    Btn_Pathfinding ->setIconSize(iconSize);
    Btn_Pathfinding ->setEnabled(true);
    InputDataBtn = new QToolButton;
    //InputDataBtn ->setText(tr("InputData"));
    InputDataBtn->setIcon(QPixmap(":/inputdata.png"));
    InputDataBtn->setIconSize(iconSize);
    InputDataBtn ->setEnabled(true);

    //Scene choose
    label3 = new QLabel(tr("HelpPoint Number"));
    combobox = new QComboBox;
    combobox-> addItem("1");
    combobox-> addItem("2");
    combobox-> addItem("3");

    //scene_check = new QToolButton;
    //scene_check -> setText(tr("Scene_test"));
    //scene_check -> setEnabled(true);

    //EditWindow
    EditWindow = new QTextEdit;
    EditWindow ->setStyleSheet("QTextEdit{background:darkGray}");
    EditWindow->setReadOnly(true);



#ifndef QT_NO_OPENGL
    //openGlButton->setEnabled(QGLFormat::hasOpenGL());
#else
    openGlButton->setEnabled(false);
#endif
    //printButton = new QToolButton;
    //printButton->setIcon(QIcon(QPixmap(":/fileprint.png")));

    QButtonGroup *pointerModeGroup = new QButtonGroup;
    pointerModeGroup->setExclusive(true);
    pointerModeGroup->addButton(selectModeButton);
    pointerModeGroup->addButton(dragModeButton);

    labelLayout->addWidget(label);
   //labelLayout->addStretch();
    labelLayout->addWidget(InputDataBtn);
    //labelLayout->addStretch();
    labelLayout->addWidget(Btn_Pathfinding);
    labelLayout->addStretch();
    labelLayout->addWidget(label2);
    labelLayout->addWidget(selectModeButton);
    labelLayout->addWidget(dragModeButton);
    labelLayout->addStretch();
    labelLayout->addWidget(label3);
    labelLayout->addWidget(combobox);

    QGridLayout *topLayout = new QGridLayout;
    topLayout->addLayout(labelLayout, 0, 0);
    topLayout->addWidget(graphicsView, 1, 0);
    topLayout->addLayout(zoomSliderLayout, 1, 1);
    topLayout->addWidget(EditWindow,1,2);
    topLayout->addLayout(rotateSliderLayout, 2, 0);
    topLayout->addWidget(resetButton, 2, 1);
    setLayout(topLayout);

    connect(resetButton, SIGNAL(clicked()), this, SLOT(resetView()));
    connect(zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
    connect(rotateSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
    connect(graphicsView->verticalScrollBar(), SIGNAL(valueChanged(int)),
            this, SLOT(setResetButtonEnabled()));
    connect(graphicsView->horizontalScrollBar(), SIGNAL(valueChanged(int)),
            this, SLOT(setResetButtonEnabled()));
    connect(selectModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode()));
    connect(dragModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode()));
    //connect(antialiasButton, SIGNAL(toggled(bool)), this, SLOT(toggleAntialiasing()));
    //connect(openGlButton, SIGNAL(toggled(bool)), this, SLOT(toggleOpenGL()));
    connect(rotateLeftIcon, SIGNAL(clicked()), this, SLOT(rotateLeft()));
    connect(rotateRightIcon, SIGNAL(clicked()), this, SLOT(rotateRight()));
    connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn()));
    connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut()));
    //connect(scene_check, SIGNAL(clicked()), this, SLOT(BtnsetScene()));


    setupMatrix();

    my_serialport = new QSerialPort;
    my_serialport->setPortName("COM3");
    my_serialport->open(QIODevice::ReadWrite);
    my_serialport->setBaudRate(38400);
    my_serialport->setDataBits(QSerialPort::Data8);
    my_serialport->setParity(QSerialPort::NoParity);
    my_serialport->setFlowControl(QSerialPort::NoFlowControl);
    connect(my_serialport,SIGNAL(readyRead()),this,SLOT(my_readuart()));

}