Skip to content

Commit

Permalink
Don't apply extends extent on the shapes inside the Element
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Nov 11, 2020
1 parent 221b299 commit 7f38cd1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
5 changes: 4 additions & 1 deletion OMEdit/OMEditLIB/Annotations/ShapeAnnotation.cpp
Expand Up @@ -673,10 +673,13 @@ void ShapeAnnotation::applyTransformation()
QPointF origin = mOrigin;

// Only apply the extends coordinate extents on the shapes and not on connection, transition etc.
// Don't apply it also on shapes inside Element
// if the extends have some new coordinate extents then use it to scale the shape
LineAnnotation *pLineAnnotation = dynamic_cast<LineAnnotation*>(this);
GraphicsView *pGraphicsView = mpGraphicsView ? mpGraphicsView : mpReferenceShapeAnnotation->getGraphicsView();
if (pGraphicsView && !(pLineAnnotation && pLineAnnotation->getLineType() != LineAnnotation::ShapeType) && mpReferenceShapeAnnotation && mpReferenceShapeAnnotation->getGraphicsView()) {
if (!mpParentComponent && pGraphicsView
&& !(pLineAnnotation && pLineAnnotation->getLineType() != LineAnnotation::ShapeType)
&& mpReferenceShapeAnnotation && mpReferenceShapeAnnotation->getGraphicsView()) {
QList<QPointF> extendsCoOrdinateExtents = getExtentsForInheritedShapeFromIconDiagramMap(pGraphicsView, mpReferenceShapeAnnotation);

qreal left = pGraphicsView->mMergedCoOrdinateSystem.getLeft();
Expand Down
9 changes: 2 additions & 7 deletions OMEdit/OMEditLIB/Element/Element.cpp
Expand Up @@ -590,8 +590,7 @@ bool ElementInfo::isModiferClassRecord(QString modifierName, Element *pElement)
return result;
}

Element::Element(QString name, LibraryTreeItem *pLibraryTreeItem, QString annotation, QPointF position, ElementInfo *pElementInfo,
GraphicsView *pGraphicsView)
Element::Element(QString name, LibraryTreeItem *pLibraryTreeItem, QString annotation, QPointF position, ElementInfo *pElementInfo, GraphicsView *pGraphicsView)
: QGraphicsItem(0), mpReferenceComponent(0), mpParentComponent(0)
{
setZValue(2000);
Expand Down Expand Up @@ -1893,11 +1892,7 @@ void Element::reDrawElement(bool coOrdinateSystemUpdated)
* Basically instead of creating an object of class Element we should store the non scene items in some other class.
*/
mpGraphicsView->removeItem(this);
if (mpGraphicsView->getModelWidget()->getLibraryTreeItem()->getLibraryType() == LibraryTreeItem::Modelica) {
drawModelicaElement();
} else if (mpGraphicsView->getModelWidget()->getLibraryTreeItem()->getLibraryType() == LibraryTreeItem::OMS) {
drawOMSElement();
}
drawElement();
mpGraphicsView->addItem(this);
emitChanged();
updateConnections();
Expand Down
3 changes: 1 addition & 2 deletions OMEdit/OMEditLIB/Element/Element.h
Expand Up @@ -195,8 +195,7 @@ class Element : public QObject, public QGraphicsItem
Extend, /* Inherited Element. */
Port /* Port Element. */
};
Element(QString name, LibraryTreeItem *pLibraryTreeItem, QString annotation, QPointF position, ElementInfo *pElementInfo,
GraphicsView *pGraphicsView);
Element(QString name, LibraryTreeItem *pLibraryTreeItem, QString annotation, QPointF position, ElementInfo *pElementInfo, GraphicsView *pGraphicsView);
Element(LibraryTreeItem *pLibraryTreeItem, Element *pParentElement);
Element(Element *pElement, Element *pParentElement, Element *pRootParentElement);
Element(Element *pElement, GraphicsView *pGraphicsView);
Expand Down

0 comments on commit 7f38cd1

Please sign in to comment.