Example #1
0
/*!
 * \brief TextAnnotation::duplicate
 * Creates a duplicate of this object.
 */
void TextAnnotation::duplicate()
{
  TextAnnotation *pTextAnnotation = new TextAnnotation("", false, mpGraphicsView);
  QPointF gridStep(mpGraphicsView->getCoOrdinateSystem()->getHorizontalGridStep(),
                   mpGraphicsView->getCoOrdinateSystem()->getVerticalGridStep());
  pTextAnnotation->setOrigin(mOrigin + gridStep);
  pTextAnnotation->setRotationAngle(mRotation);
  pTextAnnotation->initializeTransformation();
  pTextAnnotation->setLineColor(getLineColor());
  pTextAnnotation->setFillColor(getFillColor());
  pTextAnnotation->setLinePattern(getLinePattern());
  pTextAnnotation->setFillPattern(getFillPattern());
  pTextAnnotation->setLineThickness(getLineThickness());
  pTextAnnotation->setExtents(getExtents());
  pTextAnnotation->setTextString(getTextString());
  pTextAnnotation->setFontSize(getFontSize());
  pTextAnnotation->setFontName(getFontName());
  pTextAnnotation->setTextStyles(getTextStyles());
  pTextAnnotation->setTextHorizontalAlignment(getTextHorizontalAlignment());
  pTextAnnotation->drawCornerItems();
  pTextAnnotation->setCornerItemsPassive();
  pTextAnnotation->update();
  mpGraphicsView->addClassAnnotation();
  mpGraphicsView->setCanAddClassAnnotation(true);
}
/*!
 * \brief RectangleAnnotation::duplicate
 * Duplicates the shape.
 */
void RectangleAnnotation::duplicate()
{
  RectangleAnnotation *pRectangleAnnotation = new RectangleAnnotation("", mpGraphicsView);
  pRectangleAnnotation->updateShape(this);
  QPointF gridStep(mpGraphicsView->mCoOrdinateSystem.getHorizontalGridStep() * 5,
                   mpGraphicsView->mCoOrdinateSystem.getVerticalGridStep() * 5);
  pRectangleAnnotation->setOrigin(mOrigin + gridStep);
  pRectangleAnnotation->initializeTransformation();
  pRectangleAnnotation->drawCornerItems();
  pRectangleAnnotation->setCornerItemsActiveOrPassive();
  pRectangleAnnotation->update();
  mpGraphicsView->getModelWidget()->getUndoStack()->push(new AddShapeCommand(pRectangleAnnotation));
  mpGraphicsView->getModelWidget()->getLibraryTreeItem()->emitShapeAdded(pRectangleAnnotation, mpGraphicsView);
  setSelected(false);
  pRectangleAnnotation->setSelected(true);
}
Example #3
0
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);
}
Example #4
0
void RectangleAnnotation::duplicate()
{
  RectangleAnnotation *pRectangleAnnotation = new RectangleAnnotation("", false, mpGraphicsView);
  QPointF gridStep(mpGraphicsView->getCoOrdinateSystem()->getHorizontalGridStep(),
                   mpGraphicsView->getCoOrdinateSystem()->getVerticalGridStep());
  pRectangleAnnotation->setOrigin(mOrigin + gridStep);
  pRectangleAnnotation->setRotationAngle(mRotation);
  pRectangleAnnotation->initializeTransformation();
  pRectangleAnnotation->setLineColor(getLineColor());
  pRectangleAnnotation->setFillColor(getFillColor());
  pRectangleAnnotation->setLinePattern(getLinePattern());
  pRectangleAnnotation->setFillPattern(getFillPattern());
  pRectangleAnnotation->setLineThickness(getLineThickness());
  pRectangleAnnotation->setBorderPattern(getBorderPattern());
  pRectangleAnnotation->setExtents(getExtents());
  pRectangleAnnotation->setRadius(getRadius());
  pRectangleAnnotation->drawCornerItems();
  pRectangleAnnotation->setCornerItemsPassive();
  pRectangleAnnotation->update();
  mpGraphicsView->addClassAnnotation();
  mpGraphicsView->setCanAddClassAnnotation(true);
}