@@ -1081,10 +1081,9 @@ void ShapeAnnotation::applyRotation(qreal angle)
10811081 if (angle == 360 ) {
10821082 angle = 0 ;
10831083 }
1084+ Transformation oldTransformation = mTransformation ;
10841085 mTransformation .setRotateAngle (angle);
1085- setTransform (mTransformation .getTransformationMatrix ());
1086- mRotation = angle;
1087- mpGraphicsView->setAddClassAnnotationNeeded (true );
1086+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateShapeCommand (this , oldTransformation, mTransformation , mpGraphicsView));
10881087}
10891088
10901089/* !
@@ -1430,7 +1429,10 @@ void ShapeAnnotation::sendBackward()
14301429 */
14311430void ShapeAnnotation::rotateClockwise ()
14321431{
1433- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new RotateShapeCommand (this , true ));
1432+ qreal oldRotation = StringHandler::getNormalizedAngle (mTransformation .getRotateAngle ());
1433+ qreal rotateIncrement = -90 ;
1434+ qreal angle = oldRotation + rotateIncrement;
1435+ applyRotation (angle);
14341436}
14351437
14361438/* !
@@ -1440,7 +1442,10 @@ void ShapeAnnotation::rotateClockwise()
14401442 */
14411443void ShapeAnnotation::rotateAntiClockwise ()
14421444{
1443- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new RotateShapeCommand (this , false ));
1445+ qreal oldRotation = StringHandler::getNormalizedAngle (mTransformation .getRotateAngle ());
1446+ qreal rotateIncrement = 90 ;
1447+ qreal angle = oldRotation + rotateIncrement;
1448+ applyRotation (angle);
14441449}
14451450
14461451/* !
@@ -1451,8 +1456,9 @@ void ShapeAnnotation::rotateAntiClockwise()
14511456 */
14521457void ShapeAnnotation::moveUp ()
14531458{
1454- qreal y = mpGraphicsView->getCoOrdinateSystem ()->getVerticalGridStep ();
1455- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new MoveShapeKeyCommand (this , 0 , y, mpGraphicsView));
1459+ Transformation oldTransformation = mTransformation ;
1460+ mTransformation .adjustPosition (0 , mpGraphicsView->getCoOrdinateSystem ()->getVerticalGridStep ());
1461+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateShapeCommand (this , oldTransformation, mTransformation , mpGraphicsView));
14561462}
14571463
14581464/* !
@@ -1463,8 +1469,9 @@ void ShapeAnnotation::moveUp()
14631469 */
14641470void ShapeAnnotation::moveShiftUp ()
14651471{
1466- qreal y = mpGraphicsView->getCoOrdinateSystem ()->getVerticalGridStep () * 5 ;
1467- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new MoveShapeKeyCommand (this , 0 , y, mpGraphicsView));
1472+ Transformation oldTransformation = mTransformation ;
1473+ mTransformation .adjustPosition (0 , mpGraphicsView->getCoOrdinateSystem ()->getVerticalGridStep () * 5 );
1474+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateShapeCommand (this , oldTransformation, mTransformation , mpGraphicsView));
14681475}
14691476
14701477/* !
@@ -1475,7 +1482,9 @@ void ShapeAnnotation::moveShiftUp()
14751482 */
14761483void ShapeAnnotation::moveCtrlUp ()
14771484{
1478- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new MoveShapeKeyCommand (this , 0 , 1 , mpGraphicsView));
1485+ Transformation oldTransformation = mTransformation ;
1486+ mTransformation .adjustPosition (0 , 1 );
1487+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateShapeCommand (this , oldTransformation, mTransformation , mpGraphicsView));
14791488}
14801489
14811490/* !
@@ -1486,8 +1495,9 @@ void ShapeAnnotation::moveCtrlUp()
14861495 */
14871496void ShapeAnnotation::moveDown ()
14881497{
1489- qreal y = -mpGraphicsView->getCoOrdinateSystem ()->getVerticalGridStep ();
1490- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new MoveShapeKeyCommand (this , 0 , y, mpGraphicsView));
1498+ Transformation oldTransformation = mTransformation ;
1499+ mTransformation .adjustPosition (0 , -mpGraphicsView->getCoOrdinateSystem ()->getVerticalGridStep ());
1500+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateShapeCommand (this , oldTransformation, mTransformation , mpGraphicsView));
14911501}
14921502
14931503/* !
@@ -1498,8 +1508,9 @@ void ShapeAnnotation::moveDown()
14981508 */
14991509void ShapeAnnotation::moveShiftDown ()
15001510{
1501- qreal y = -(mpGraphicsView->getCoOrdinateSystem ()->getVerticalGridStep () * 5 );
1502- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new MoveShapeKeyCommand (this , 0 , y, mpGraphicsView));
1511+ Transformation oldTransformation = mTransformation ;
1512+ mTransformation .adjustPosition (0 , -(mpGraphicsView->getCoOrdinateSystem ()->getVerticalGridStep () * 5 ));
1513+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateShapeCommand (this , oldTransformation, mTransformation , mpGraphicsView));
15031514}
15041515
15051516/* !
@@ -1510,7 +1521,9 @@ void ShapeAnnotation::moveShiftDown()
15101521 */
15111522void ShapeAnnotation::moveCtrlDown ()
15121523{
1513- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new MoveShapeKeyCommand (this , 0 , -1 , mpGraphicsView));
1524+ Transformation oldTransformation = mTransformation ;
1525+ mTransformation .adjustPosition (0 , -1 );
1526+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateShapeCommand (this , oldTransformation, mTransformation , mpGraphicsView));
15141527}
15151528
15161529/* !
@@ -1521,8 +1534,9 @@ void ShapeAnnotation::moveCtrlDown()
15211534 */
15221535void ShapeAnnotation::moveLeft ()
15231536{
1524- qreal x = -mpGraphicsView->getCoOrdinateSystem ()->getHorizontalGridStep ();
1525- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new MoveShapeKeyCommand (this , x, 0 , mpGraphicsView));
1537+ Transformation oldTransformation = mTransformation ;
1538+ mTransformation .adjustPosition (-mpGraphicsView->getCoOrdinateSystem ()->getHorizontalGridStep (), 0 );
1539+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateShapeCommand (this , oldTransformation, mTransformation , mpGraphicsView));
15261540}
15271541
15281542/* !
@@ -1533,8 +1547,9 @@ void ShapeAnnotation::moveLeft()
15331547 */
15341548void ShapeAnnotation::moveShiftLeft ()
15351549{
1536- qreal x = -(mpGraphicsView->getCoOrdinateSystem ()->getHorizontalGridStep () * 5 );
1537- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new MoveShapeKeyCommand (this , x, 0 , mpGraphicsView));
1550+ Transformation oldTransformation = mTransformation ;
1551+ mTransformation .adjustPosition (-(mpGraphicsView->getCoOrdinateSystem ()->getHorizontalGridStep () * 5 ), 0 );
1552+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateShapeCommand (this , oldTransformation, mTransformation , mpGraphicsView));
15381553}
15391554
15401555/* !
@@ -1545,7 +1560,9 @@ void ShapeAnnotation::moveShiftLeft()
15451560 */
15461561void ShapeAnnotation::moveCtrlLeft ()
15471562{
1548- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new MoveShapeKeyCommand (this , -1 , 0 , mpGraphicsView));
1563+ Transformation oldTransformation = mTransformation ;
1564+ mTransformation .adjustPosition (-1 , 0 );
1565+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateShapeCommand (this , oldTransformation, mTransformation , mpGraphicsView));
15491566}
15501567
15511568/* !
@@ -1556,8 +1573,9 @@ void ShapeAnnotation::moveCtrlLeft()
15561573 */
15571574void ShapeAnnotation::moveRight ()
15581575{
1559- qreal x = mpGraphicsView->getCoOrdinateSystem ()->getHorizontalGridStep ();
1560- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new MoveShapeKeyCommand (this , x, 0 , mpGraphicsView));
1576+ Transformation oldTransformation = mTransformation ;
1577+ mTransformation .adjustPosition (mpGraphicsView->getCoOrdinateSystem ()->getHorizontalGridStep (), 0 );
1578+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateShapeCommand (this , oldTransformation, mTransformation , mpGraphicsView));
15611579}
15621580
15631581/* !
@@ -1568,8 +1586,9 @@ void ShapeAnnotation::moveRight()
15681586 */
15691587void ShapeAnnotation::moveShiftRight ()
15701588{
1571- qreal x = mpGraphicsView->getCoOrdinateSystem ()->getHorizontalGridStep () * 5 ;
1572- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new MoveShapeKeyCommand (this , x, 0 , mpGraphicsView));
1589+ Transformation oldTransformation = mTransformation ;
1590+ mTransformation .adjustPosition (mpGraphicsView->getCoOrdinateSystem ()->getHorizontalGridStep () * 5 , 0 );
1591+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateShapeCommand (this , oldTransformation, mTransformation , mpGraphicsView));
15731592}
15741593
15751594/* !
@@ -1580,7 +1599,9 @@ void ShapeAnnotation::moveShiftRight()
15801599 */
15811600void ShapeAnnotation::moveCtrlRight ()
15821601{
1583- mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new MoveShapeKeyCommand (this , 1 , 0 , mpGraphicsView));
1602+ Transformation oldTransformation = mTransformation ;
1603+ mTransformation .adjustPosition (1 , 0 );
1604+ mpGraphicsView->getModelWidget ()->getUndoStack ()->push (new UpdateShapeCommand (this , oldTransformation, mTransformation , mpGraphicsView));
15841605}
15851606
15861607/* !
0 commit comments