Esempio n. 1
0
void Navigator::resizeEvent(QResizeEvent* /*ev*/)
      {
      if (_score) {
            rescale();
            updateViewRect();
            }
      }
Esempio n. 2
0
void Navigator::setScoreView(ScoreView* v)
      {
      if (_cv) {
            disconnect(this, SIGNAL(viewRectMoved(const QRectF&)), _cv, SLOT(setViewRect(const QRectF&)));
            disconnect(_cv, SIGNAL(viewRectChanged()), this, SLOT(updateViewRect()));
            }
      _cv = QPointer<ScoreView>(v);
      if (v) {
            _score  = v->score();
            rescale();
            connect(this, SIGNAL(viewRectMoved(const QRectF&)), v, SLOT(setViewRect(const QRectF&)));
            connect(_cv,  SIGNAL(viewRectChanged()), this, SLOT(updateViewRect()));
            rescale();
            updateViewRect();
            }
      else {
Esempio n. 3
0
	void DocumentDatasViewport::updateObjectsRect()
	{
		if(m_view.isLoading())
			return;

		m_objectsRect = {};
		for(const auto& objRnd : m_view.objectRenderers().getOrdered())
			m_objectsRect |= objRnd->getVisualArea();
		m_onlyObjectsRect = m_objectsRect;

		int nbInputs = 0, nbOutputs = 0;
		for (const auto& data : m_documentDatas.get())
		{
			if (data->isInput())	++nbInputs;
			if (data->isOutput())	++nbOutputs;
		}

		if (nbInputs)
			m_objectsRect.adjust(-(dataMarginW + dataRectSize + tagMargin + tagW), 0, 0, 0);
		if (nbOutputs)
			m_objectsRect.adjust(0, 0, dataMarginW + tagMargin + tagW, 0);

		// Ensure the area is not empty if there is at least one data
		if ((nbInputs || nbOutputs) && !m_objectsRect.height())
			m_objectsRect.setHeight(10.f); 

		updateViewRect();
	}
Esempio n. 4
0
void Navigator::resizeEvent(QResizeEvent* ev)
      {
      if (_score) {
            rescale();
            updateViewRect();
            layoutChanged();
            }
      }
Esempio n. 5
0
	void Viewport::updateObjectsRect()
	{
		if (m_view.isLoading())
			return;

		m_objectsRect = Rect();
		for(const auto& objRnd : m_view.objectRenderers().getOrdered())
			m_objectsRect |= objRnd->getVisualArea();

		updateViewRect();
	}
Esempio n. 6
0
void Navigator::resizeEvent(QResizeEvent* ev)
      {
      if (ev->size().height() == ev->oldSize().height())
            return;
      if (_score) {
            rescale();
            Page* lp = _score->pages().back();
            int w    = int ((lp->x() + lp->width()) * matrix.m11());

            if (w != cachedWidth) {
                  cachedWidth = w;
                  updateViewRect();
                  layoutChanged();
                  }

            }
      else
            recreatePixmap = true;
      }
Esempio n. 7
0
void QImageWidget::updateImage(const cv::Mat& inputImage)
{
    m_String = QString::number(inputImage.cols) + "x" + QString::number(inputImage.rows);

    switch ( inputImage.type() )
    {
        case CV_8UC1:
            cv::cvtColor(inputImage, m_cvMat, CV_GRAY2RGB);
            break;

        case CV_8UC3:
            cv::cvtColor(inputImage, m_cvMat, CV_BGR2RGB);
            break;
    }
    assert(m_cvMat.isContinuous()); // QImage needs the data to be stored continuously in memory
    m_QImage = QImage((const uchar*)m_cvMat.data, m_cvMat.cols, m_cvMat.rows, m_cvMat.cols * 3, QImage::Format_RGB888);  // Assign OpenCV's image buffer to the QImage
    updateViewRect(m_cvMat.rows, m_cvMat.cols);
    update();
}
Esempio n. 8
0
    void Director::updateProjection()
    {
        FZ_ASSERT(OSW::Instance(), "OS Wrapper is not defined.");

        updateViewRect();

        if(!(m_dirtyFlags & kFZDDirty_projection))
            return;
        
        // VIEW PORT
        // The view port must be the display size in pixels.
        // Display size is not equal to the screen size, an application could not use the whole screen.
        fzSize viewPort = getViewPort();
        glViewport(0, 0, viewPort.width, viewPort.height);
        
        
        // PROJECTION
        // The projection must be calculated using the canvas size. No pixels here.
        fzSize canvasSize = getCanvasSize();
        fzOrientation orientation = getOrientation();
        if(orientation == kFZOrientation_LandscapeLeft || orientation == kFZOrientation_LandscapeRight)
            FZ_SWAP(canvasSize.width, canvasSize.height);
        
        
        switch (m_projection) {
            case kFZProjection2D:
            {
                fzMath_mat4OrthoProjection(0, canvasSize.width, 0, canvasSize.height, -1024, 1024, m_transformMV);
                break;
            }
            default:
                FZ_RAISE("Director: Unrecognized projection.");
        }
        
        m_orientationTransform = FZAffineTransformIdentity;
        if(orientation == kFZOrientation_LandscapeLeft) {

            m_orientationTransform.translate(canvasSize.width, 0);
            m_orientationTransform.rotate(FZ_DEGREES_TO_RADIANS(90));
            
            fzMat4 mat;
            fzMath_mat4Multiply(m_transformMV, m_orientationTransform, mat);
            fzMath_mat4Copy(mat, m_transformMV);
            
        }else if(orientation == kFZOrientation_LandscapeRight) {
            m_orientationTransform.translate(0, canvasSize.height);
            m_orientationTransform.rotate(FZ_DEGREES_TO_RADIANS(-90));
            
            fzMat4 mat;
            fzMath_mat4Multiply(m_transformMV, m_orientationTransform, mat);
            fzMath_mat4Copy(mat, m_transformMV);
        }
        m_orientationTransform = m_orientationTransform.getInverse();
        
        m_dirtyFlags &= ~kFZDDirty_projection;

        if(p_runningScene) {
            p_runningScene->updateLayout();
            if(p_hud)
                p_hud->updateLayout();
        }
    }
Esempio n. 9
0
	void Viewport::moveView(const types::Point& delta)
	{
		m_viewDelta -= delta;
		updateViewRect();
	}
Esempio n. 10
0
void QImageWidget::loadQImage(const QString &filename)
{
    m_QImage.load(filename);
    updateViewRect(m_QImage.height(), m_QImage.width());
    update();
}
Esempio n. 11
0
void QImageWidget::resizeEvent(QResizeEvent *)
{
    updateViewRect(m_QImage.height(), m_QImage.width());
    update();
}
Esempio n. 12
0
void UVWidget::resizeGL( int width, int height )
{
	updateViewRect( width, height );
}