void QgsGeorefToolMovePoint::canvasMoveEvent( QgsMapMouseEvent *e ) { emit pointMoved( e->pos() ); }
CoilItem::CoilItem(SlotItem *fromSlot, SlotItem * toSlot, WindingItem *winding, int _turns, double _x1, double _y1) : KoilItem(winding){ pen = winding->getPen(); normalColor = pen.color().lighter(125); brushColor = normalColor; hoverColor = normalColor.lighter(150); selectedColor = normalColor.darker(200); x1 = _x1; y1 = _y1; slot2 = fromSlot; slot1 = toSlot; // slot1->setL2(negative); // slot2->setL1(positive); slot1->setL2(negative, winding->getPen()); slot2->setL1(positive, winding->getPen()); setFlags( ItemIsSelectable | ItemIsFocusable /*| ItemIsMovable*/); setAcceptHoverEvents ( true ); setZValue(-1); // The coil is behind the slots turns = _turns; // label = new QGraphicsTextItem(this); path = new QPainterPath(); QPointF P1 = slot1->P2(); // recover the outer layer of slot 1 xs1 = P1.x(); ys1 = P1.y(); QPointF P2 = slot2->P1(); // recover the inner layer of slot 2 xs2 = P2.x(); ys2 = P2.y(); width = sqrt((xs2-xs1)*(xs2-xs1)+(ys2-ys1)*(ys2-ys1)); if (x1<0) x1 = -width/2; // set the default values if (y1<0) y1 = -width/2; cp1 = new ControlPointItem(x1,y1,this); connect(cp1,SIGNAL(pointMoved(qreal,qreal)),this,SLOT(cp1Moved(qreal,qreal))); itemChange(ItemSelectedHasChanged, false); center.setX((xs1+xs2)/2); center.setY((ys2+ys1)/2); setPath(); // // move and rotate the coil on the two slots and rotate the label moveBy(center.x(),center.y()); angle = atan2(ys2-ys1,xs2-xs1)*180/pi; setRotation(angle); // //set the default incidence for the coil incidence = _pos; info = tr("Coil with %1 turns").arg(turns); }