Scenery::Scenery(const Simulation::VelocityMap *m, QGraphicsItem *parent) : QGraphicsItem(parent) { QSize size = m->get_size(); int x, y; for (x = 0; x < size.width(); x++) { for (y = 0; y < size.height(); y++) { ArrowItem *i = new ArrowItem(this); i->limitLength(0.5); i->setPos(x, y); i->setVel(m->Get_Velocity_At(x, y)/5); } } }
void RelationStarter::addArrow(const QString &id, ArrowItem::Shaft shaft, ArrowItem::Head endHead, ArrowItem::Head startHead) { QMT_CHECK(!id.isEmpty()); prepareGeometryChange(); ArrowItem *arrow = new ArrowItem(this); arrow->setArrowSize(10.0); arrow->setDiamondSize(15.0); arrow->setShaft(shaft); arrow->setStartHead(startHead); arrow->setEndHead(endHead); arrow->setPoints(QList<QPointF>() << QPointF(0.0, 10.0) << QPointF(15.0, 0.0)); arrow->setPos(6.0, m_arrows.size() * 20.0 + 8.0); arrow->update(m_diagramSceneModel->styleController()->relationStarterStyle()); m_arrows.append(arrow); m_arrowIds.insert(arrow, id); setRect(0.0, 0.0, 26.0, m_arrows.size() * 20.0 + 6.0); }