Esempio n. 1
0
void TabWidget::hideEvent(QHideEvent* e)
{
  QTabWidget::hideEvent(e);

  if (0) qDebug("TabWidget %s: Hide", name());
  checkVisibility();
}
Esempio n. 2
0
void Constellation::drawName(StelPainter& sPainter, ConstellationMgr::ConstellationDisplayStyle style) const
{
	if (!nameFader.getInterstate())
		return;

	if (checkVisibility())
	{
		QString name;
		switch (style)
		{
			case ConstellationMgr::constellationsTranslated:
				name=nameI18;
				break;
			case ConstellationMgr::constellationsNative:
				name=nativeName;
				break;
			case ConstellationMgr::constellationsEnglish:
				name=englishName;
				break;
			case ConstellationMgr::constellationsAbbreviated:
				name=(abbreviation.startsWith('.') ? "" : abbreviation);
				break;
			Q_ASSERT(0);
		}

		sPainter.setColor(labelColor[0], labelColor[1], labelColor[2], nameFader.getInterstate());
		sPainter.drawText(XYname[0], XYname[1], name, 0., -sPainter.getFontMetrics().width(name)/2, 0, false);
	}
}
Esempio n. 3
0
void TabWidget::showEvent(QShowEvent* e)
{
  QTabWidget::showEvent(e);

  if (0) qDebug("TabWidget %s: Show", objectName().toLatin1().constData());
  checkVisibility();
}
Esempio n. 4
0
void TabWidget::moveEvent(QMoveEvent* e)
{
  QTabWidget::moveEvent(e);

  if (0) qDebug("TabWidget %s: Move", name());
  checkVisibility();
}
Esempio n. 5
0
void TabWidget::moveEvent(QMoveEvent* e)
{
  QTabWidget::moveEvent(e);

  if (0) qDebug("TabWidget %s: Move", objectName().toLatin1().constData());
  checkVisibility();
}
Esempio n. 6
0
void TabWidget::showEvent(QShowEvent* e)
{
  QTabWidget::showEvent(e);

  if (0) qDebug("TabWidget %s: Show", name());
  checkVisibility();
}
Esempio n. 7
0
void TabWidget::resizeEvent(QResizeEvent *e)
{
  QTabWidget::resizeEvent(e);
  if (0) qDebug("TabWidget %s:\n  Resize from (%d/%d) to (%d/%d)",
		objectName().toLatin1().constData(),
                e->oldSize().width(), e->oldSize().height(),
                e->size().width(), e->size().height());
  checkVisibility();
}
Esempio n. 8
0
HandgripItem::HandgripItem(QObject *parentObject, QGraphicsItem *parentItem, int id, int type)
    : QObject(parentObject),
    QGraphicsPathItem(parentItem),
    m_opacityAnimation( new QPropertyAnimation(this, "opacity", this) ),
    m_moving(false),
    m_id(id),
    m_type(type)
{
    setAcceptHoverEvents(true);
    setFlag(QGraphicsItem::ItemIgnoresTransformations,true);

    QRadialGradient radialGrad(0,0,sizeMark,0,0);

    radialGrad.setColorAt( 0.0, QColor(200, 255, 255) );
    if (m_type == ROTATOR)
    {
        radialGrad.setColorAt( 0.0, QColor(255, 50, 0) );
        radialGrad.setColorAt( 1.0, QColor(255, 190, 0) );
    }
    else
    {
        radialGrad.setColorAt( 0.0, QColor(200, 255, 255) );
        radialGrad.setColorAt( 1.0, QColor(31, 197, 193) );
    }

    QBrush b(radialGrad);
    b.setStyle(Qt::RadialGradientPattern);

    QRectF r(0, 0, sizeMark, sizeMark);
    r.moveCenter( QPoint(0, 0) );
    QPainterPath p;
    p.addRoundedRect(r, cornerSize, cornerSize);

    setPath(p);
    setBrush(b);
    setPen( QPen(Qt::black) );

    QPen p2(Qt::red, 1);
    p2.setCosmetic(true);
    m_outerRing.setParentItem(this);
    m_outerRing.setRect( r.adjusted(-sizeMark / 2, -sizeMark / 2, sizeMark / 2, sizeMark / 2) );
    m_outerRing.setPen(p2 );
    m_outerRing.hide();

    // in order to
    connect( m_opacityAnimation,SIGNAL( finished () ),this,SLOT( checkVisibility() ) );

    // select a correct cursor from type
    if (m_type == TRANSLATOR_XY)
        QGraphicsItem::setCursor( QCursor(Qt::SizeAllCursor ) );
    else if (m_type == TRANSLATOR_Y)
        QGraphicsItem::setCursor( QCursor(Qt::SizeVerCursor ) );
    else if (m_type == TRANSLATOR_X)
        QGraphicsItem::setCursor( QCursor(Qt::SizeHorCursor ) );
    else
        QGraphicsItem::setCursor( QCursor( QPixmap(":/editor/editor/cursor_rotate.png") ) );
}
Esempio n. 9
0
void TabWidget::resizeEvent(QResizeEvent *e)
{
  QTabWidget::resizeEvent(e);
  if (0) qDebug("TabWidget %s:\n  Resize from (%d/%d) to (%d/%d)",
                name(),
                e->oldSize().width(), e->oldSize().height(),
                e->size().width(), e->size().height());
  checkVisibility();
}
void ConsoleWidgetCollection::onDockWidgetVisibilityChanged(bool val)
{
	if (!this->isVisible())
	{
//		std::cout << "ignore remove - parent hidden" << std::endl;
		return;
	}

	QTimer::singleShot(0, this, SLOT(checkVisibility()));
}
Esempio n. 11
0
void LocationQuest::areaEntered(const QGeoPositionInfo &update) {
    // The area has been entered.
    qDebug("jest tam gdzie powinno");

    nearLocation_ = true;

    checkVisibility();




}
Esempio n. 12
0
void Constellation::drawArtOptim(StelPainter& sPainter, const SphericalRegion& region) const
{
	if (checkVisibility())
	{
		const float intensity = artFader.getInterstate();
		if (artTexture && intensity && region.intersects(boundingCap))
		{
			sPainter.setColor(intensity,intensity,intensity);

			// The texture is not fully loaded
			if (artTexture->bind()==false)
				return;

			sPainter.drawStelVertexArray(artPolygon);
		}
	}
}
Esempio n. 13
0
void Constellation::drawOptim(StelPainter& sPainter, const StelCore* core, const SphericalCap& viewportHalfspace) const
{
	if (lineFader.getInterstate()<=0.0001f)
		return;

	if (checkVisibility())
	{
		sPainter.setColor(lineColor[0], lineColor[1], lineColor[2], lineFader.getInterstate());

		Vec3d star1;
		Vec3d star2;
		for (unsigned int i=0;i<numberOfSegments;++i)
		{
			star1=asterism[2*i]->getJ2000EquatorialPos(core);
			star2=asterism[2*i+1]->getJ2000EquatorialPos(core);
			star1.normalize();
			star2.normalize();			
			sPainter.drawGreatCircleArc(star1, star2, &viewportHalfspace);			
		}
	}
}
Esempio n. 14
0
bool SilhouetteExtractor::checkSilhouetteEdge(int i1, int j1, int i2, int j2)
{
    int imax = terrain_->width()-1;
    int jmax = terrain_->height()-1;

    int tri1;
    int tri2;

    Eigen::Vector3f point1(i1, j1, terrain_->getAltitude(i1, j1));
    Eigen::Vector3f point2(i2, j2, terrain_->getAltitude(i2, j2));

    Eigen::Vector3f mid = (point1+point2)/2.0;

    if (i1 == i2)
    {
        if (i1 == 0) return false;
        tri1 = 2*(j1*imax + i1-1) + 1;
        tri2 = 2*(j1*imax + i1);
    } else if (j1 == j2)
    {
        if (j1 == 0) return false;
        tri1 = 2*((j1-1)*imax + i1);
        tri2 = 2*(j1*imax + i1) + 1;
    } else if (i1 == (i2-1) && j1 == (j2-1))
    {
        if (j1 == 0) return false;
        tri1 = 2*(j1*imax + i1);
        tri2 = 2*(j1*imax + i1) + 1;
    } else
        return false;

    if (front_facing_per_tri_[tri1] == kInvisible || front_facing_per_tri_[tri2] == kInvisible)
        return false;
    if (front_facing_per_tri_[tri1] == front_facing_per_tri_[tri2])
        return false;

    if (checkVisibility(mid))
        return true;
    return false;
}
Esempio n. 15
0
void ChatLog::insertChatlineAtBottom(ChatLine::Ptr l)
{
    if (!l.get())
        return;

    bool stickToBtm = stickToBottom();

    //insert
    l->setRow(lines.size());
    l->addToScene(scene);
    lines.append(l);

    //partial refresh
    layout(lines.last()->getRow(), lines.size(), useableWidth());
    updateSceneRect();

    if (stickToBtm)
        scrollToBottom();

    checkVisibility();
    updateTypingNotification();
}
Esempio n. 16
0
void ChatLog::onWorkerTimeout()
{
    // Fairly arbitrary but
    // large values will make the UI unresponsive
    const int stepSize = 50;

    layout(workerLastIndex, workerLastIndex+stepSize, useableWidth());
    workerLastIndex += stepSize;

    // done?
    if (workerLastIndex >= lines.size())
    {
        workerTimer->stop();

        // switch back to the scene containing the chat messages
        setScene(scene);

        // make sure everything gets updated
        updateSceneRect();
        checkVisibility();
        updateTypingNotification();
        updateMultiSelectionRect();

        // scroll
        if (workerStb)
            scrollToBottom();
        else
            scrollToLine(workerAnchorLine);

        // don't keep a Ptr to the anchor line
        workerAnchorLine = ChatLine::Ptr();

        // hidden during busy screen
        verticalScrollBar()->show();
    }
}
Esempio n. 17
0
void ChatLog::scrollContentsBy(int dx, int dy)
{
    QGraphicsView::scrollContentsBy(dx, dy);
    checkVisibility();
}
Esempio n. 18
0
void SilhouetteExtractor::computeVisibleFrontFacingStatus()
{
    int terrain_width = terrain_->width();
    int terrain_height = terrain_->height();

    delete front_facing_;
    front_facing_ = new FacingMode [(terrain_width-1)*(terrain_height-1)];

    bool use_intersections = true ;

    if (!use_intersections)
    {
        setupPixelBuffer();
        pixelbuffer_->makeCurrent();
        glEnable(GL_DEPTH_TEST);
        glEnable(GL_LIGHT0);
        glEnable(GL_LIGHTING);
        GLfloat lightpos[] = {.5, 1., 1., 0.};
        glLightfv(GL_LIGHT0, GL_POSITION, lightpos);

        glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        drawTerrain();
        updateMatrices();

        saveBuffer("test_dpth.png");
        pixelbuffer_->makeCurrent();
    }

    double begin = omp_get_wtime();

    int i = 0;
#pragma omp parallel for private(i)
    for (int j = 0; j < terrain_->height()-1; ++j)
        for (i = 0; i < terrain_->width()-1; ++i)
        {
            front_facing_[j*(terrain_width-1)+i] = kInvisible;

            Eigen::Vector3f center = getFaceCentroid(i, j);
            Eigen::Vector3f projector = center - camera_info_.position;
            //projector = camera_info_.direction;

            float theta = acos(camera_info_.direction.normalized().dot(projector.normalized()));
            if (theta > camera_info_.fov_in_rads/2)
                continue;

            front_facing_[j*(terrain_width-1)+i] = kBackFacing;

            if (terrain_->getGridNormal(i, j).dot(projector) <= -FLT_EPSILON)
            {
                if (use_intersections)
                {
                    if (checkVisibility(center))
                        front_facing_[j*(terrain_width-1)+i] = kFrontFacing;
                } else
                {
                    Eigen::Vector3d window_coords;
                    gluProject(center[0], center[1], center[2],
                               modelview_matrix_, projection_matrix_, viewport_,
                               &window_coords[0], &window_coords[1], &window_coords[2]);

                    if (window_coords[0] < 0 || window_coords[1] < 0 || window_coords[0] >= width() || window_coords[1] >= height())
                        continue;
                    float depth = 0.0;
                    glReadPixels(window_coords[0], window_coords[1], 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);

                    if (std::abs(depth-window_coords[2]) < 1e-3)
                        front_facing_[j*(terrain_width-1)+i] = kFrontFacing;
                }
            }
        }

    double end = omp_get_wtime();
    double elapsed_secs = double(end - begin);
    fprintf(stdout, "Elapsed time for checking front/back facing: %.2f secs\n", elapsed_secs);
    fprintf(stdout, "Num of threads: %d threads\n", omp_get_thread_num());
    fflush(stdout);

    if (pixelbuffer_)
    {
        pixelbuffer_->doneCurrent();
        cleanupPixelBuffer();
    }
}
Esempio n. 19
0
Vector2f Projector::clipLineVec( SkyPoint *p1, SkyPoint *p2 ) const
{
    /* ASSUMES p1 was not clipped but p2 was.
     * Return the QPoint that barely clips in the line twixt p1 and p2.
     */
    //TODO: iteration = ceil( 0.5*log2( w^2 + h^2) )??
    //      also possibly rewrite this
    //     --hdevalence
    int iteration = 15;          // For "perfect" clipping:
    // 2^interations should be >= max pixels/line
    bool isVisible = true;       // so we start at midpoint
    SkyPoint mid;
    Vector2f oMid;
    double x, y, z, dx, dy, dz, ra, dec;
    int newx, newy, oldx, oldy;
    oldx = oldy = -10000;        // any old value that is not the first omid

    toXYZ( p1, &x, &y, &z );
    // -jbb printf("\np1: %6.4f %6.4f %6.4f\n", x, y, z);

    toXYZ( p2, &dx, &dy, &dz );

    // -jbb printf("p2: %6.4f %6.4f %6.4f\n", dx, dy, dz);
    dx -= x;
    dy -= y;
    dz -= z;
    // Successive approximation to point on line that just clips.
    while(iteration-- > 0) {
        dx *= .5;
        dy *= .5;
        dz *= .5;
        if ( ! isVisible ) {              // move back toward visible p1
            x -= dx;
            y -= dy;
            z -= dz;
        }
        else {                        // move out toward clipped p2
            x += dx;
            y += dy;
            z += dz;
        }

        // -jbb printf("  : %6.4f %6.4f %6.4f\n", x, y, z);
        // [x, y, z] => [ra, dec]
        ra = atan2( y, x );
        dec = asin( z / sqrt(x*x + y*y + z*z) );

        mid = SkyPoint( ra * 12. / dms::PI, dec * 180. / dms::PI );
        mid.EquatorialToHorizontal( m_data->lst(), m_data->geo()->lat() );

        oMid = toScreenVec( &mid, false, &isVisible );
        //AND the result with checkVisibility to clip things going below horizon
        isVisible &= checkVisibility(&mid);
        newx = (int) oMid.x();
        newy = (int) oMid.y();

        // -jbb printf("new x/y: %4d %4d", newx, newy);
        if ( (oldx == newx) && (oldy == newy) ) {
            break;
        }
        oldx = newx;
        oldy = newy;
    }
    return  oMid;
}
Esempio n. 20
0
void CharmWindow::showEvent( QShowEvent* e )
{
    checkVisibility();
    QMainWindow::showEvent( e );
}
Esempio n. 21
0
void CharmWindow::hideEvent( QHideEvent* e )
{
    checkVisibility();
    QMainWindow::hideEvent( e );
}