Exemplo n.º 1
0
StitcherView::StitcherView(QWidget * parent)
  :ImageView(parent)
{
  imageViewPanel()->showSaveButton(true);
  setRenderHints(QPainter::Antialiasing);
  /*  QGraphicsLineItem * centerVerticalIndicator = new QGraphicsLineItem(0,-100000,0,100000);
  QGraphicsLineItem * centerHorizontalIndicator = new QGraphicsLineItem(-100000,0,100000,0);
  centerVerticalIndicator->setZValue(11);
  centerHorizontalIndicator->setZValue(11);
  graphicsScene->addItem(centerVerticalIndicator);
  graphicsScene->addItem(centerHorizontalIndicator);
  QPen pen = centerHorizontalIndicator->pen();  
  pen.setColor(Qt::white);
  pen.setStyle(Qt::SolidLine);
  centerHorizontalIndicator->setPen(pen);
  centerVerticalIndicator->setPen(pen);*/

  /* Solid background */
  setBackgroundBrush(QColor("#26466D"));
  _showIdentifiers = true;
  setBackgroundDraggable(false);
  QGraphicsLineItem * centerVerticalIndicator = new QGraphicsLineItem(0,-100,0,100);
  QGraphicsLineItem * centerHorizontalIndicator = new QGraphicsLineItem(-100,0,100,0);
  centerVerticalIndicator->setZValue(11);
  centerHorizontalIndicator->setZValue(11);
  graphicsScene->addItem(centerVerticalIndicator);
  graphicsScene->addItem(centerHorizontalIndicator);
  QPen pen = centerHorizontalIndicator->pen();  
  pen.setColor(Qt::white);
  pen.setStyle(Qt::SolidLine);
  centerHorizontalIndicator->setPen(pen);
  centerVerticalIndicator->setPen(pen);

}
Exemplo n.º 2
0
void StarView::drawState(HostItem *node)
{
    delete node->stateItem();
    QGraphicsLineItem *newItem = 0;

    unsigned int client = node->client();
    QColor color = client ? hostColor(client) : Qt::green;

    if (node->isCompiling() || node->isActiveClient()) {
        newItem = new QGraphicsLineItem(qRound(node->centerPosX()),
                                        qRound(node->centerPosY()),
                                        qRound(m_schedulerItem->centerPosX()),
                                        qRound(m_schedulerItem->centerPosY()));
        if (node->isCompiling()) {
            newItem->setPen(QPen(color, 0));
            newItem->setZValue(-301);
        } else if (node->isActiveClient()) {
            newItem->setPen(QPen(color, 1, Qt::DashLine));
            newItem->setZValue(-300);
        }
        m_canvas->addItem(newItem);
    }

    node->setStateItem(newItem);
}
Exemplo n.º 3
0
void ProfileGraphicsView::plot_cylinder_pressure()
{
    int i;
    int last_index = -1;
    int lift_pen = FALSE;
    int first_plot = TRUE;

    if (!get_cylinder_pressure_range(&gc))
        return;

    QPointF from, to;
    for (i = 0; i < gc.pi.nr; i++) {
        int mbar;
        struct plot_data *entry = gc.pi.entry + i;

        mbar = GET_PRESSURE(entry);
        if (entry->cylinderindex != last_index) {
            lift_pen = TRUE;
        }
        if (!mbar) {
            lift_pen = TRUE;
            continue;
        }

        QColor c = get_sac_color(entry->sac, dive->sac);

        if (lift_pen) {
            if (!first_plot && entry->cylinderindex == last_index) {
                /* if we have a previous event from the same tank,
                 * draw at least a short line */
                int prev_pr;
                prev_pr = GET_PRESSURE(entry - 1);

                QGraphicsLineItem *item = new QGraphicsLineItem(SCALEGC((entry-1)->sec, prev_pr), SCALEGC(entry->sec, mbar));
                QPen pen(defaultPen);
                pen.setColor(c);
                item->setPen(pen);
                scene()->addItem(item);
            } else {
                first_plot = FALSE;
                from = QPointF(SCALEGC(entry->sec, mbar));
            }
            lift_pen = FALSE;
        } else {
            to = QPointF(SCALEGC(entry->sec, mbar));
            QGraphicsLineItem *item = new QGraphicsLineItem(from.x(), from.y(), to.x(), to.y());
            QPen pen(defaultPen);
            pen.setColor(c);
            item->setPen(pen);
            scene()->addItem(item);
        }

        from = QPointF(SCALEGC(entry->sec, mbar));
        last_index = entry->cylinderindex;
    }
}
Exemplo n.º 4
0
void OGraphicsEllipseItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
	DBG_p("OGraphicsEllipseItem::mouseReleaseEvent\n");
	OGraphicsScene *s = dynamic_cast<OGraphicsScene *>(scene());
	OASSET(s != NULL);
	QList<QGraphicsItem *> il = s->selectedItems();
//	extractItemsByType(&il, ClassInfo::OConfNode);
	extractItemsByTypes(&il, ClassInfo::OConfNode, ClassInfo::OLogpoolNode);
	DBG_p("il.size()=%d\n", il.size());
	if (il.size() == 2) {
		OAbstractNode *no1 = dynamic_cast<OAbstractNode*>(il[0]);
		OAbstractNode *no2 = dynamic_cast<OAbstractNode*>(il[1]);
		if (no1 == NULL || no2 == NULL) return;
		OGraphicsEllipseItem *el1 = no1->getSelectedPoint();
		OGraphicsEllipseItem *el2 = no2->getSelectedPoint();
		if (OAbstractNode::connect(no1, el1, no2, el2)) {
			QPointF e_size = QPointF(ELLIPSE_SIZE / 2, ELLIPSE_SIZE / 2);
			QLineF lf(el1->getAbsolutePos() + e_size, el2->getAbsolutePos() + e_size);
			QGraphicsLineItem *gli = new QGraphicsLineItem(lf);
//			gli->setFlag(QGraphicsItem::ItemIsSelectable);
			el1->setLine(gli);
			el2->setLine(gli);
			QPen p;
			p.setColor(ELLIPSE_DEFAULT_COLOR);
			p.setCapStyle(Qt::RoundCap);
			p.setWidth(5);
			gli->setPen(p);
			s->addItem(gli);
		}
		el1->unselect();
		el2->unselect();
		s->clearSelection();
	}
}
Exemplo n.º 5
0
void Wall::ShowStructure(QGraphicsScene *c) {

  Vector offset = Cell::Offset();
  double factor = Cell::Factor();

  Vector startpoint ( ((offset.x+n1->x)*factor),((offset.y+n1->y)*factor)),
    endpoint (((offset.x+n2->x)*factor),((offset.y+n2->y)*factor));

  Vector linevec = endpoint - startpoint;
  Vector midline = startpoint + linevec/2.;
  Vector perpvec = linevec.Normalised().Perp2D();
  Vector textpos1 = midline + 100 * perpvec;
  Vector textpos2 = midline - 100 * perpvec;

  QGraphicsLineItem *line = new QGraphicsLineItem(0,c);

  line->setPen( QPen(QColor(par.arrowcolor),2) );
  line->setLine(startpoint.x, startpoint.y, endpoint.x, endpoint.y );
  line->setZValue(10);
  line->show();

  QGraphicsSimpleTextItem *text1 = new QGraphicsSimpleTextItem( QString("%1").arg(c2->Index()),0,c);
  QGraphicsSimpleTextItem *text2 = new QGraphicsSimpleTextItem( QString("%1").arg(c1->Index()),0,c);

  text1 -> setPos( textpos1.x, textpos1.y );
  text2 -> setPos( textpos2.x, textpos2.y );
  text1->setZValue(20); text2->setZValue(20);

  text1->setFont( QFont( "Helvetica", par.nodenumsize, QFont::Bold) );
  text2->setFont( QFont( "Helvetica", par.nodenumsize, QFont::Bold) );

  text1->setPen ( QColor(par.textcolor) );
  text2->setPen ( text1->pen() );
  text1->show(); text2->show();
}
Exemplo n.º 6
0
void Axis::buildAxis()
{
    m_color.setCosmetic(true);
    const int nbValues = (m_max - m_min) / m_interval + 1;
    m_layer = new QGraphicsItemGroup();

    for(int i = 0; i < nbValues; ++i)
    {
        QGraphicsLineItem* tick = new QGraphicsLineItem(0, 0, 0, 0);
        tick->setCacheMode( QGraphicsItem::DeviceCoordinateCache );
        tick->setPen( m_color );

        m_ticks.push_back( tick );
        m_layer->addToGroup( tick );
    }

    m_line = new QGraphicsLineItem();
    m_line->setCacheMode( QGraphicsItem::DeviceCoordinateCache );
    m_line->setPen( m_color );

    if( m_showLine )
    {
        m_layer->addToGroup( m_line );
    }

    // Adjust the layer's position and zValue depending on the associated axis
    m_layer->setPos( m_xAxis->getOrigin(), m_yAxis->getOrigin() );
    m_layer->setZValue( m_zValue );

    // Add to the scene the unique item which gather the whole set of rectangle graphic items:
    this->getScene2DRender()->getScene()->addItem( m_layer );
}
Exemplo n.º 7
0
void PlayArea::init() {
    setLayout(QString("res/layout.xml"));
    QPen p(QColor(255, 255, 255, 255));
    QBrush b(QColor(0, 120, 80, 155));
    field = new QGraphicsRectItem(0, 0, 1280, 720);
    scene->addItem(field);
    field->setBrush(b);
    field->setPen(p);
    QGraphicsLineItem* line = new QGraphicsLineItem(320, 0, 320, 720, field);
    line->setPen(p);
    Card testCard = DatabaseAccessor::getCardById(1);
    scale = (((float) getPlayerStack("LrigZone")->getHeight()) / ((float) testCard.getPixmap()->height()));
    qDebug() << getPlayerStack("LrigZone")->getHeight() << scale << testCard.getPixmap()->height();
    QString pstack;
    QString ostack;
    for (int i = 0; i < 12; i++) {
        pstack = PlayArea::stackNames[i];
        ostack = PlayArea::stackNames[11 - i];
        testCard = DatabaseAccessor::getCardById((qrand() % 760) + 1);
        InPlayCard c(testCard);
        Stack* zone = getPlayerStack(pstack);
        zone->getVector()->push_back(c);
        repaint(zone);
        InPlayCard c2(testCard);
        c2.faceDown();
        c2.setRotated(true);
        zone = getOpponentStack(ostack);
        zone->getVector()->push_back(c2);
        repaint(zone);
    }
}
Exemplo n.º 8
0
void ProfileGraphicsView::plot_temperature_profile()
{
    int last = 0;

    if (!setup_temperature_limits(&gc))
        return;

    QPointF from;
    QPointF to;
    QColor color = getColor(TEMP_PLOT);

    for (int i = 0; i < gc.pi.nr; i++) {
        struct plot_data *entry = gc.pi.entry + i;
        int mkelvin = entry->temperature;
        int sec = entry->sec;
        if (!mkelvin) {
            if (!last)
                continue;
            mkelvin = last;
        }
        if (last) {
            to = QPointF(SCALEGC(sec, mkelvin));
            QGraphicsLineItem *item = new QGraphicsLineItem(from.x(), from.y(), to.x(), to.y());
            QPen pen(defaultPen);
            pen.setColor(color);
            item->setPen(pen);
            scene()->addItem(item);
            from = to;
        } else {
            from = QPointF(SCALEGC(sec, mkelvin));
        }
        last = mkelvin;
    }
}
Exemplo n.º 9
0
void MelodyNoteGlyphItem::setLedgerLinesItems(int count)
{
    if (m_ledgerLines.count() == count)
        return;

    if (m_ledgerLines.count() < count) {
        QPen linePen = ledgerLinePen();

        while (m_ledgerLines.count() < count) {
            QGraphicsLineItem *newLedgerLine = new QGraphicsLineItem(this);
            newLedgerLine->setPen(linePen);
            newLedgerLine->setVisible(false);
            m_ledgerLines.append(newLedgerLine);
        }
    }

    if (m_ledgerLines.count() > count) {
        while (m_ledgerLines.count() > count) {
            QGraphicsLineItem *ledgerLine = m_ledgerLines.takeLast();
            if (ledgerLine != 0) {
                ledgerLine->setParentItem(0);
                delete ledgerLine;
            }
        }
    }
}
Exemplo n.º 10
0
void GraphicsScene::drawEdge(QPointF &lastPos, QPointF &pos, QPoint &ids)
{
    QGraphicsLineItem *edge = new QGraphicsLineItem(lastPos.x() + (cidadeWidth / 2.0),lastPos.y() + (cidadeHeigth / 2.0), pos.x() + (cidadeWidth / 2.0),pos.y() + (cidadeHeigth / 2.0));
    edge->setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
    edge->setData(1, 3);
    edge->setData(2, ids);
    this->addItem(edge);
}
Exemplo n.º 11
0
void Main::addLine()
{
    QGraphicsLineItem* i = canvas.addLine(QLineF( qrand()%int(canvas.width()), qrand()%int(canvas.height()),
                                                  qrand()%int(canvas.width()), qrand()%int(canvas.height()) ));
    i->setFlag(QGraphicsItem::ItemIsMovable);
    i->setPen( QPen(QColor(qrand()%32*8,qrand()%32*8,qrand()%32*8), 6) );
    i->setZValue(qrand()%256);
}
Exemplo n.º 12
0
QGraphicsItemGroup* Document::grid()
{
  QGraphicsItemGroup *group = new QGraphicsItemGroup();
  group->setZValue(-1.0);

  QPen gridPen(QBrush(QColor("#DDDDDD")), 0.0);
  QPen gridPenDec(QBrush(QColor("#AAAAAA")), 0.0);
  QPen *activePen;
  double margin;

  for (int i = 0; i < size_.height() + 1; ++i) {
    if (i % 10 == 0) {
      margin = 10.0;
      activePen = &gridPenDec;
    } else {
      margin = 5.0;
      activePen = &gridPen;
    }

    QGraphicsLineItem *line = new QGraphicsLineItem(-margin,
                                                    10.0 * i,
                                                    10.0 * size_.width() + margin,
                                                    10.0 * i,
                                                    group);
    line->setPen(*activePen);
  }

  for (int i = 0; i < size_.width() + 1; ++i) {
    if (i % 10 == 0) {
      margin = 10.0;
      activePen = &gridPenDec;
    } else {
      margin = 5.0;
      activePen = &gridPen;
    }

    QGraphicsLineItem *line = new QGraphicsLineItem(10.0 * i,
                                                    -margin,
                                                    10.0 * i,
                                                    10.0 * size_.height() + margin,
                                                    group);
    line->setPen(*activePen);
  }

  return group;
}
void subObservationVisualiserBase::constructStandardLines(const observation& subObs)
{
    assert(standardLinesItem);
    const vertexState* state = subObs.getState();
    const context::inputGraph& graph = contextObj.getGraph();
    const std::vector<context::vertexPosition>& vertexPositions = contextObj.getVertexPositions();

    QPen blackPen(QColor("black"));
    blackPen.setWidthF(pointSize/10);

    QPen redPen(QColor("red"));
    redPen.setWidthF(pointSize/10);

    QVector<qreal> dashPattern;
    dashPattern.push_back(8);
    dashPattern.push_back(8);

    QPen dashedBlackPen(QColor("black"));
    dashedBlackPen.setDashPattern(dashPattern);

    QPen dashedRedPen(QColor("red"));
    dashedRedPen.setDashPattern(dashPattern);

    context::inputGraph::edge_iterator start, end;
    boost::tie(start, end) = boost::edges(graph);

    while(start != end)
    {
        context::vertexPosition sourcePosition = vertexPositions[start->m_source], targetPosition = vertexPositions[start->m_target];
        QGraphicsLineItem* newItem = new QGraphicsLineItem(sourcePosition.first, sourcePosition.second, targetPosition.first, targetPosition.second, standardLinesItem);
        if(state[start->m_source].state == FIXED_ON && state[start->m_target].state == FIXED_ON)
        {
            newItem->setPen(blackPen);
        }
        else if(state[start->m_source].state == FIXED_OFF || state[start->m_target].state == FIXED_OFF)
        {
            newItem->setPen(dashedBlackPen);
        }
        else
        {
            newItem->setPen(redPen);
        }
        start++;
    }
}
Exemplo n.º 14
0
void TileScene::ToggleGrid(bool show)
{
    if(show == false)
    {
        gridLines->hide();
        return;
    }

    if(gridLines)
    {
        delete gridLines;
        gridLines = new QGraphicsItemGroup;
    }

    QPen pen(Qt::DashLine);
    pen.setColor(QColor(Qt::gray));

    QGraphicsLineItem *tempLine;

    int tileW = tileController->GetTileWidth();
    int tileH = tileController->GetTileHeight();
    int mapH = tileController->GetCurrentLayerHeight();
    int mapW = tileController->GetCurrentLayerWidth();

    //loop for the height of the map, draw horizontal lines
    for(int i = 1; i < mapH; i++)
    {
        tempLine = new QGraphicsLineItem(0, (i * tileH), (mapW * tileW), (i * tileH));
        tempLine->setPen(pen);
        gridLines->addToGroup(tempLine);
    }

    //loop for the width of the map, draw vertical lines
    for(int j = 1; j < mapW; j++)
    {
        tempLine = new QGraphicsLineItem((j * tileW), 0, (j * tileW), (mapH * tileH));
        tempLine->setPen(pen);
        gridLines->addToGroup(tempLine);
    }

    addItem(gridLines);

    gridLines->setZValue(99);
    gridLines->show();
}
Exemplo n.º 15
0
void ProfileGraphicsView::plot_add_line(int sec, double val, QColor c, QPointF &from)
{
    QPointF to = QPointF(SCALEGC(sec, val));
    QGraphicsLineItem *item = new QGraphicsLineItem(from.x(), from.y(), to.x(), to.y());
    QPen pen(defaultPen);
    pen.setColor(c);
    item->setPen(pen);
    scene()->addItem(item);
    from = to;
}
Exemplo n.º 16
0
void GameBoardScene::drawLine(int index, const QColor &colour)
{
	QGraphicsLineItem* line = new QGraphicsLineItem(lineFromIndex(index));
	line->setZValue(10);
	line->setPen(QPen(QBrush(colour), 2.5));
	addItem(line);	//draw new line
	lineList[index] = true;	//keep this table in sync
	indicatorLine->hide();
	update(line->boundingRect());
}
Exemplo n.º 17
0
void main_menu::
set_line(double a, double b, double c, double d)
{
        a = m_gscene->width()  / 2 - a;
        b = m_gscene->height() / 2 - b;
        c = m_gscene->width()  / 2 - c;
        d = m_gscene->height() / 2 - d;
        QGraphicsLineItem* l = new QGraphicsLineItem(a, b, c, d);
        l->setPen(QPen(QColor(m_style->get_button_def_color())));
        m_ggroup->addToGroup(l);
}
Exemplo n.º 18
0
SEXP qt_qgraphicsLineItem(SEXP x1, SEXP y1, SEXP x2, SEXP y2, 
			  SEXP pars)
{
    double 
	px1 = asReal(x1), py1 = asReal(y1),
	px2 = asReal(x2), py2 = asReal(y2);
    QGraphicsLineItem *item = 
	new QGraphicsLineItem(px1, py1, px2, py2, 0);
    item->setPen(asQPen(pars));
    return wrapQGraphicsItem(item);
}
Exemplo n.º 19
0
void HistogramView::draw( QSize sz )
{
    QGraphicsScene *sc = scene();
    assert(sc);

    m_xRatio = 1.0 * ( sz.width() - 4*m_Border ) / ( m_maxX - m_minX );
    m_yRatio = 1.0 * ( sz.height() - 2*m_Border ) / ( m_maxY - m_minY );

    // eleimino la vecchia scena
    if (m_histogramItems != NULL)
    {
        sc->removeItem(m_histogramItems);
        delete m_histogramItems;
        m_histogramItems = NULL;
    }
    m_histogramItems = new QGraphicsItemGroup;

    // inizio i disegni
    addAxis( sz );

    //texts on axes
    //addText( m_minY, QPointF( 0, PosY(m_minY,sz) ) );
    //addText( m_maxY, QPointF( 0, PosY(m_maxY,sz) ) );

    addGridLine( 0, H, sz );

    int nlines = 5;
    for (int i=0; i<nlines; i++)
        addGridLine(  AutoRound( m_minY + (m_maxY-m_minY)*i/nlines  ), H, sz );

    //vertical line histogram from zero
    const float y2 = PosY (0, sz);
    for (auto ih: m_histo)
    {
        const float x1 = PosX (ih.first);
        const float y1 = PosY (ih.second, sz);
        if (y1 != 0)
        {
            QGraphicsLineItem *pt = new QGraphicsLineItem( QLineF(x1, y2, x1, y1) );
            pt->setPen(m_measurePen);
            m_histogramItems->addToGroup(pt);
        }
    }

    sc->addItem(m_histogramItems);

    //update scene rectangle.
    QRectF rectSc = m_histogramItems->boundingRect();
    scene()->setSceneRect(rectSc);

    setRenderHint(QPainter::HighQualityAntialiasing, true);

    //assert(scene()->sceneRect() == sceneRect());
}
Exemplo n.º 20
0
void ItemConnection::CreateConnection()
{	// create lines to draw connections
	QPen pen(Qt::red, 2, Qt::SolidLine);
	QGraphicsLineItem* line;
	for (int i = 0; i < 4 ; ++i)
	{
		line = new QGraphicsLineItem(this, scene());
		line->setPen(pen);
		line->setZValue(1.0);
		mChildrens.push_back(line);
	}
}
Exemplo n.º 21
0
void TextFormulaNode::RenderCaret(const int pos, const int anchor)
{
	QRectF r = GetDocumentPosBounds(pos);
	
	QGraphicsItemGroup* g = wnd->caret->caretShape;
	
	qDeleteAll(g->childItems());
	g->childItems().clear();
	
	QGraphicsLineItem* i = new QGraphicsLineItem(r.left(), r.top(), r.left(), r.bottom(), g);
	i->setPen(QPen("red"));
	g->addToGroup(i);
}
Exemplo n.º 22
0
void Canvas::setSceneRect(qreal x, qreal y, qreal w, qreal h)
{
    currentScene->setSceneRect(x, y, w, h);

    qreal borderWidth = 0.5;
    QPen borderPen(QBrush(Qt::black), borderWidth);
    borderPen.setCapStyle(Qt::SquareCap);
    borderPen.setJoinStyle(Qt::MiterJoin);

    qreal shadowWidth = 5;
    QPen shadowPen(QBrush(Qt::lightGray), shadowWidth);
    shadowPen.setCapStyle(Qt::SquareCap);
    shadowPen.setJoinStyle(Qt::MiterJoin);

    QGraphicsItemGroup * group = new QGraphicsItemGroup;

    QGraphicsLineItem * shadowRight =
            new QGraphicsLineItem(x + w + (shadowWidth - borderWidth) / 2,
                                  y + shadowWidth,
                                  x + w + (shadowWidth - borderWidth) / 2,
                                  y + h + shadowWidth / 2);
    shadowRight->setPen(shadowPen);

    QGraphicsLineItem * shadowBottom =
            new QGraphicsLineItem(x + shadowWidth,
                                  y + h + (shadowWidth - borderWidth) / 2,
                                  x + w + shadowWidth / 2,
                                  y + h + (shadowWidth - borderWidth) / 2);
    shadowBottom->setPen(shadowPen);

    QGraphicsRectItem * rect = new QGraphicsRectItem(x, y, w, h);
    rect->setPen(borderPen);

    group->addToGroup(shadowRight);
    group->addToGroup(shadowBottom);
    group->addToGroup(rect);

    currentScene->addItem(group);
}
Exemplo n.º 23
0
void NetworkGraphics::updateSelection(QList<NetNode*> nodes){
	QList<GraphicNetCloud*> selectedClouds = getClouds(nodes);
	QList<GraphicNetCloud*> allClouds = cloudMap.values();

	for(int i=0; i<allClouds.size(); i++){
		GraphicNetCloud* cloud = allClouds[i];

		if(selectedClouds.size() == 0){
			cloud->setOpacity(1.0);
		}
		else{
			if(selectedClouds.contains(cloud)){
				cloud->setOpacity(1.0);

			}
			else{
				cloud->setOpacity(0.3);
			}
		}
	}


	QPen linkPen = QPen();
	linkPen.setColor(Qt::gray);
	linkPen.setWidth(2);

	QList<QGraphicsLineItem*> links = linkMap.values();
	for(int i=0; i<links.size(); i++){
		if(links[i] != NULL){
			links[i]->setPen(linkPen);
		}
	}

	if(selectedClouds.size() > 0){
		QPen linkPen = QPen();
		linkPen.setColor(Qt::yellow);
		linkPen.setWidth(4);

		for(int i=0; i<nodes.size(); i++){
			QList<NetLink*> links = nodes[i]->getLinks();

			for(int j=0; j<links.size(); j++){
				QGraphicsLineItem* line = linkMap[links[j]];

				if(line != NULL){
					line->setPen(linkPen);
				}
			}
		}
	}
}
Exemplo n.º 24
0
void StitcherView::drawConstraintFit(geometrically_constrained_system *gc){
  for(int i = 0;i<gc->n_constraints;i++){
    GeometryConstraintType type = gc->constraints[i].type;
    double fit = gc->constraints[i].best_fit;    
    if(type == RadialLineConstraint){
      qreal x1,x2,y1,y2;
      qreal scale = 10000;
      x1 = cos(fit)*scale;

      y1 = sin(fit)*scale;
      x2 = -x1;
      y2 = -y1;
      QGraphicsLineItem * item = new QGraphicsLineItem(x1,y1,x2,y2);
      QPen p = item->pen();
      p.setStyle(Qt::DashLine);
      QVector<qreal> dashes;
      dashes << 25 << 15;
      p.setDashPattern(dashes);
      p.setColor(Qt::white);
      item->setPen(p);
      item->setZValue(10000);
      scene()->addItem(item);
      constraintFit.append(item);
    }else if(type == CircleConstraint){
      double radius = fit;
      QGraphicsEllipseItem * item = new QGraphicsEllipseItem(-radius,-radius,2*radius,2*radius);
      QPen p = item->pen();
      p.setStyle(Qt::DashLine);
      QVector<qreal> dashes;
      dashes << 25 << 15;
      p.setDashPattern(dashes);
      p.setColor(Qt::white);
      item->setPen(p);
      item->setZValue(10000);
      scene()->addItem(item);
      constraintFit.append(item);
    }
    sp_vector ** cp_g = control_point_list_to_global(gc->constraints[i].points,gc->constraints[i].n_points);
    QColor color = QColor::fromHsvF(1.0/3+(double)i/gc->n_constraints,1,1,1);
    for(int j = 0;j<gc->constraints[i].n_points;j++){
      QGraphicsEllipseItem * point = new QGraphicsEllipseItem(-4,-4,8,8);
      point->setZValue(10001);
      point->setPos(sp_vector_get(cp_g[j],0),sp_vector_get(cp_g[j],1));
      point->setPen(QPen(color, 2));
      point->setFlags(point->flags() | QGraphicsItem::ItemIgnoresTransformations);
      scene()->addItem(point);
      constraintFit.append(point);
    }
  }
}
Exemplo n.º 25
0
QGraphicsLineItem * Plugin::lineItem(const QStringList &tokList)
{
	QStringList tmpList;
	int tokIdx;

	tokIdx = tokList.indexOf(QRegExp("x1=" REGEXP_FLOAT));
	// error, regexp not found
	if (tokIdx == -1) {
		setErrorCmdStr("x1", "line", "0-9[.0-9]");
		return 0;
	}

	tmpList = tokList.at(tokIdx).split('=');
	qreal x1 = tmpList.at(1).toDouble();

	tokIdx = tokList.indexOf(QRegExp("y1=" REGEXP_FLOAT));
	// error, regexp not found
	if (tokIdx == -1) {
		setErrorCmdStr("y1", "line", "0-9[.0-9]");
		return 0;
	}

	tmpList = tokList.at(tokIdx).split('=');
	qreal y1 = tmpList.at(1).toDouble();

	tokIdx = tokList.indexOf(QRegExp("x2=" REGEXP_FLOAT));
	// error, regexp not found
	if (tokIdx == -1) {
		setErrorCmdStr("x2", "line", "0-9[.0-9]");
		return 0;
	}

	tmpList = tokList.at(tokIdx).split('=');
	qreal x2 = tmpList.at(1).toDouble();

	tokIdx = tokList.indexOf(QRegExp("y2=" REGEXP_FLOAT));
	// error, regexp not found
	if (tokIdx == -1) {
		setErrorCmdStr("y2", "line", "0-9[.0-9]");
		return 0;
	}

	tmpList = tokList.at(tokIdx).split('=');
	qreal y2 = tmpList.at(1).toDouble();

	QGraphicsLineItem *lineItem = new QGraphicsLineItem(x1, y1, x2, y2);
	lineItem->setPen(m_curPen);

	return lineItem;
}
Exemplo n.º 26
0
// Plugin Interface
void
dmz::QtPluginGraph::update_plugin_state (
    const PluginStateEnum State,
    const UInt32 Level) {

    if (State == PluginStateInit) {

        QColor white (1.0f, 1.0f, 1.0f, 1.0f);
        QPen pen (white);
        QGraphicsLineItem *spacer = new QGraphicsLineItem (0.0f, 0.0f, -40.0f, 0.0f);
        spacer->setPen (pen);
        spacer->setZValue (-1.0f);
        _scene->addItem (spacer);

        spacer = new QGraphicsLineItem (0.0f, -_barHeight, 0.0f, -(_barHeight + 20.0f));
        spacer->setPen (pen);
        spacer->setZValue (-1.0f);
        _scene->addItem (spacer);

        _xAxis = new QGraphicsLineItem (0.0f, 0.0f, _barWidth + _spaceWidth, 0.0f);
        _xAxis->setZValue (1.0);
        _scene->addItem (_xAxis);

        _yAxis = new QGraphicsLineItem (0.0f, 0.0f, 0.0f, -_barHeight);
        _yAxis->setZValue (1.0);
        _scene->addItem (_yAxis);
    }
    else if (State == PluginStateStart) {

    }
    else if (State == PluginStateStop) {

    }
    else if (State == PluginStateShutdown) {

    }
}
Exemplo n.º 27
0
QGraphicsLineItem *GalaGV::makeLineItem(const QString &cords1, const QString &cords2, QColor color)
{
    QStringList cord1 = cords1.split('/');
    qreal x1 = cord1.at(0).toFloat();
    qreal z1 = -1*cord1.at(2).toFloat();

    QStringList cord2 = cords2.split('/');
    qreal x2 = cord2.at(0).toFloat();
    qreal z2 = -1*cord2.at(2).toFloat();

    QGraphicsLineItem *item = new QGraphicsLineItem(QLineF(x1,z1,x2,z2));
    item->setPen(QPen(color));
    return item;

}
Exemplo n.º 28
0
void GraphicsScene::createLine(Ball *b)
{

    QLine line( b->getStartPoint()->x(),
                b->getStartPoint()->y(),
                b->getEndPoint()->x(),
                b->getEndPoint()->y()
               );

    QPen pen( b->pen().brush(), 3, Qt::SolidLine);

    QGraphicsLineItem* lineItem = new QGraphicsLineItem( line );
    lineItem->setPen( pen );
    lineItemCollection.insert( lineItem );
    addItem( lineItem );
}
Exemplo n.º 29
0
ParticipantInfoDialog::ParticipantInfoDialog(Participant* participant, QWidget* parent, bool showRemove)
        : PopupDialog( parent ), m_participant(participant)
{
    setMinimumWidth(400);
    setMinimumHeight(160);
    this->setSizeGripEnabled(false);

    QGraphicsPixmapItem* image = new QGraphicsPixmapItem( participant->pixmap().scaled(80, 80, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), widget() );
    image->setPos( 8, 8 );
    QGraphicsLineItem* line = new QGraphicsLineItem( widget() );
    line->setPen( QPen( QColor( 100, 100, 100 ) ) );
    line->setLine( 8, 110, width() - 2 * 8, 110 );
    int buttonRight = width() - 10;
    QPushButton* button = new QPushButton();
    button->setText(tr("New Wave"));
    QGraphicsProxyWidget* item = scene()->addWidget(button);
    item->setParentItem( widget() );
    item->setPos( buttonRight - item->preferredWidth(), height() - 10 - item->preferredHeight() );
    buttonRight -= item->preferredWidth() + 10;

    //Adds remove button if parent is a waveview
    if (showRemove)
    {
        QPushButton* removeFromWaveButton = new QPushButton();
        removeFromWaveButton->setText(tr("Remove"));
        QGraphicsProxyWidget* removeItem = scene()->addWidget(removeFromWaveButton);
        removeItem->setParentItem( widget() );
        removeItem->setPos( buttonRight - removeItem->preferredWidth(), height() - 10 - removeItem->preferredHeight() );
        buttonRight -= removeItem->preferredWidth() + 10;
        connect( removeFromWaveButton, SIGNAL(clicked()),SLOT(removeParticipant()));
    }

    QPushButton* button2 = new QPushButton();
    button2->setText(tr("Close"));
    QGraphicsProxyWidget* item2 = scene()->addWidget(button2);
    item2->setParentItem( widget() );
    item2->setPos( buttonRight - item2->preferredWidth(), height() - 10 - item2->preferredHeight() );
    QGraphicsTextItem* text = new QGraphicsTextItem( participant->name(), widget() );
    text->setPos( 110, 10 );
    text->setFont( QFont( "Arial", 18, QFont::Bold ) );
    text = new QGraphicsTextItem( tr("Address") + ": " + participant->address(), widget() );
    text->setPos( 110, 50 );
    text->setFont( QFont( "Arial", 11 ) );

    connect( button, SIGNAL(clicked()), SLOT(newWave()));
    connect( button2, SIGNAL(clicked()), SLOT(close()));
}
Exemplo n.º 30
0
GanttMachine::GanttMachine(const QString &id, QGraphicsItem *parent) :
    QGraphicsItem(parent),
    m_id(id),
    m_cMax(0)
{   
    QGraphicsTextItem* text = new QGraphicsTextItem(m_id, this);
    text->setPos(0, GanttChart::machineHeight/2);
    text->setFont(QFont("Arial", 12, QFont::Normal, false));


    QGraphicsLineItem* line = new QGraphicsLineItem(GanttChart::machineHorizontalOffset, 0, GanttChart::machineHorizontalOffset, GanttChart::machineHeight, this);
    QPen pen(Qt::black, 2, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
    line->setPen(pen);

    m_arrow = new Arrow(this);
    m_arrow->setPen(pen);
}