core::RestrictedLineF::RestrictedLineF(const QPointF &p1, const QPointF &p2, Constrain lc)
//	QLineF(p1, p2)
{
//    Q_INIT_RESOURCE(core_media);
	lineConstrain = lc;
	setP1(p1);
	setP2(p2);
}
core::RestrictedLineF::RestrictedLineF(qreal x1, qreal y1, qreal x2, qreal y2, Constrain lc)
//	QLineF(x1, x2, y1, y2)
{
//    Q_INIT_RESOURCE(core_media);
	lineConstrain = lc;
	setP1(QPointF(x1, y1));
	setP2(QPointF(x2, y2));
}
    /**
     * @brief Relation::recalculateLine
     */
    void Relation::recalculateLine()
    {
        QPolygonF fromRect(m_From->mapToScene(m_From->frameRect()));
        QPolygonF toRect(m_To->mapToScene(m_To->frameRect()));
        setVisible(fromRect.intersected(toRect).isEmpty());

        if (isVisible()) {
            setP1(intersection(fromRect, QLineF(m_From->pos(), line().p2())));
            setP2(intersection(toRect, QLineF(line().p1(), m_To->pos())));
        }
    }
Beispiel #4
0
void main(void)
{
	uint16_t color = BLUE;

    //P1 config data to be OR'ed with the current state
    //of each reg
    uint8_t p1dir = 0b00000001;
    uint8_t p1ren = 0b00010010;
    uint8_t p1out = 0b00010010;

    //P2 config data to be OR'ed with the current state
    //of each reg
    uint8_t p2dir = BIT0|BIT1|BIT2;
    uint8_t p2ren = 0b00000000;
	uint8_t p2out = 0b00000000;

    setup(SETUP);
    setP2(p2dir,p2ren,p2out);
    setP1(p1dir,p1ren,p1out);
    setP3P4P5P6P7P8P9P20();

    int previousState = 0;
    enum STATE state= RS;

    while(true)
      {
    	int currentState = myDebounce(SW2, 50);
    	int latched = 0;
    	if (currentState > previousState)
    	{
    		latched = 1;
    		state ^= 1;
    	}
    	if (latched == 1)
    	{
    		switch (state)
    		{
    		case RS:
    			P2OUT = 0;
    			P1OUT = 0;
    			P1OUT = 0b00010010;
    			break;
    		case S:
    			P2OUT ^= color;
    			break;
    		}
    	}
    	previousState = currentState;
      }
}
Beispiel #5
0
bool Line::sceneEvent(QEvent *event)
{
	switch (event->type()) {
	case FreeSCH::KnobMovedEventType: {
		KnobMovedEvent *e = static_cast<KnobMovedEvent *>(event);
		if (Knob::StartPoint == e->index)
			setP1(e->loc);
		else
			setP2(e->loc);
		return true;
	}
	default:
		break;
	}
	return QGraphicsLineItem::sceneEvent(event);
}
void MidiMessage::setData(uchar aCommand, uchar aP1, uchar aP2, uchar aP3) {
   setCommand(aCommand);
   setP1(aP1);
   setP2(aP2);
   setP3(aP3);
}