/*! * \brief BitmapAnnotation::duplicate * Duplicates the shape. */ void BitmapAnnotation::duplicate() { BitmapAnnotation *pBitmapAnnotation = new BitmapAnnotation(mClassFileName, "", mpGraphicsView); pBitmapAnnotation->updateShape(this); QPointF gridStep(mpGraphicsView->mCoOrdinateSystem.getHorizontalGridStep() * 5, mpGraphicsView->mCoOrdinateSystem.getVerticalGridStep() * 5); pBitmapAnnotation->setOrigin(mOrigin + gridStep); pBitmapAnnotation->initializeTransformation(); pBitmapAnnotation->drawCornerItems(); pBitmapAnnotation->setCornerItemsActiveOrPassive(); pBitmapAnnotation->update(); mpGraphicsView->getModelWidget()->getUndoStack()->push(new AddShapeCommand(pBitmapAnnotation)); mpGraphicsView->getModelWidget()->getLibraryTreeItem()->emitShapeAdded(pBitmapAnnotation, mpGraphicsView); setSelected(false); pBitmapAnnotation->setSelected(true); }
void BitmapAnnotation::duplicate() { BitmapAnnotation *pBitmapAnnotation = new BitmapAnnotation(mClassFileName, "", false, mpGraphicsView); QPointF gridStep(mpGraphicsView->getCoOrdinateSystem()->getHorizontalGridStep(), mpGraphicsView->getCoOrdinateSystem()->getVerticalGridStep()); pBitmapAnnotation->setOrigin(mOrigin + gridStep); pBitmapAnnotation->setRotationAngle(mRotation); pBitmapAnnotation->initializeTransformation(); pBitmapAnnotation->setExtents(getExtents()); pBitmapAnnotation->setFileName(getFileName()); pBitmapAnnotation->setImageSource(getImageSource()); pBitmapAnnotation->setImage(getImage()); pBitmapAnnotation->drawCornerItems(); pBitmapAnnotation->setCornerItemsPassive(); pBitmapAnnotation->update(); mpGraphicsView->addClassAnnotation(); mpGraphicsView->setCanAddClassAnnotation(true); }