Skip to content

Commit 1d9c0c9

Browse files
authored
Use the containing GraphicsView for evaluation (#13993)
#13992
1 parent 3e0df16 commit 1d9c0c9

File tree

9 files changed

+21
-19
lines changed

9 files changed

+21
-19
lines changed

OMEdit/OMEditLIB/Annotations/BitmapAnnotation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void BitmapAnnotation::parseShapeAnnotation(QString annotation)
154154

155155
void BitmapAnnotation::parseShapeAnnotation()
156156
{
157-
GraphicsView *pGraphicsView = getGraphicsView();
157+
GraphicsView *pGraphicsView = getContainingGraphicsView();
158158
GraphicItem::parseShapeAnnotation(mpBitmap, pGraphicsView);
159159

160160
mExtent = mpBitmap->getExtent();

OMEdit/OMEditLIB/Annotations/EllipseAnnotation.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ void EllipseAnnotation::parseShapeAnnotation(QString annotation)
102102

103103
void EllipseAnnotation::parseShapeAnnotation()
104104
{
105-
GraphicsView *pGraphicsView = getGraphicsView();
105+
GraphicsView *pGraphicsView = getContainingGraphicsView();
106+
GraphicItem::parseShapeAnnotation(mpEllipse, pGraphicsView);
106107
FilledShape::parseShapeAnnotation(mpEllipse, pGraphicsView);
107108

108109
mExtent = mpEllipse->getExtent();

OMEdit/OMEditLIB/Annotations/LineAnnotation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ void LineAnnotation::parseShapeAnnotation(QString annotation)
576576

577577
void LineAnnotation::parseShapeAnnotation()
578578
{
579-
GraphicsView *pGraphicsView = getGraphicsView();
579+
GraphicsView *pGraphicsView = getContainingGraphicsView();
580580
GraphicItem::parseShapeAnnotation(mpLine, pGraphicsView);
581581

582582
mPoints = mpLine->getPoints();

OMEdit/OMEditLIB/Annotations/PolygonAnnotation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void PolygonAnnotation::parseShapeAnnotation(QString annotation)
130130

131131
void PolygonAnnotation::parseShapeAnnotation()
132132
{
133-
GraphicsView *pGraphicsView = getGraphicsView();
133+
GraphicsView *pGraphicsView = getContainingGraphicsView();
134134
GraphicItem::parseShapeAnnotation(mpPolygon, pGraphicsView);
135135
FilledShape::parseShapeAnnotation(mpPolygon, pGraphicsView);
136136

OMEdit/OMEditLIB/Annotations/RectangleAnnotation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ void RectangleAnnotation::parseShapeAnnotation(QString annotation)
153153

154154
void RectangleAnnotation::parseShapeAnnotation()
155155
{
156-
GraphicsView *pGraphicsView = getGraphicsView();
156+
GraphicsView *pGraphicsView = getContainingGraphicsView();
157157
GraphicItem::parseShapeAnnotation(mpRectangle, pGraphicsView);
158158
FilledShape::parseShapeAnnotation(mpRectangle, pGraphicsView);
159159

OMEdit/OMEditLIB/Annotations/ShapeAnnotation.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -771,11 +771,11 @@ void ShapeAnnotation::setOriginItemPos(const QPointF point)
771771
}
772772

773773
/*!
774-
* \brief ShapeAnnotation::getGraphicsView
775-
* Returns the GraphicsView of shape.
774+
* \brief ShapeAnnotation::getContainingGraphicsView
775+
* Returns the GraphicsView of shape where is contained.
776776
* \return
777777
*/
778-
GraphicsView *ShapeAnnotation::getGraphicsView()
778+
GraphicsView *ShapeAnnotation::getContainingGraphicsView()
779779
{
780780
if (mpGraphicsView) {
781781
return mpGraphicsView;
@@ -1078,7 +1078,7 @@ void ShapeAnnotation::updateDynamicSelect(double time)
10781078
if ((mpGraphicsView && mpGraphicsView->isVisualizationView())
10791079
|| (mpParentComponent && mpParentComponent->getGraphicsView() && mpParentComponent->getGraphicsView()->isVisualizationView())) {
10801080
bool updated = false;
1081-
GraphicsView *pGraphicsView = getGraphicsView();
1081+
GraphicsView *pGraphicsView = getContainingGraphicsView();
10821082

10831083
updated |= mVisible.update(time, pGraphicsView->getModelWidget()->getModelInstance());
10841084
updated |= mOrigin.update(time, pGraphicsView->getModelWidget()->getModelInstance());

OMEdit/OMEditLIB/Annotations/ShapeAnnotation.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ class ShapeAnnotation : public QObject, public QGraphicsItem, public GraphicItem
157157
virtual void replaceExtent(const int index, const QPointF point);
158158
void updateExtent(const int index, const QPointF point);
159159
void setOriginItemPos(const QPointF point);
160-
GraphicsView* getGraphicsView();
160+
GraphicsView* getGraphicsView() {return mpGraphicsView;}
161+
GraphicsView* getContainingGraphicsView();
161162
Element* getParentComponent() const {return mpParentComponent;}
162163
OriginItem* getOriginItem() {return mpOriginItem;}
163164
void setPoints(QVector<QPointF> points) {mPoints = points;}

OMEdit/OMEditLIB/Annotations/TextAnnotation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ void TextAnnotation::parseShapeAnnotation(QString annotation)
252252

253253
void TextAnnotation::parseShapeAnnotation()
254254
{
255-
GraphicsView *pGraphicsView = getGraphicsView();
255+
GraphicsView *pGraphicsView = getContainingGraphicsView();
256256
GraphicItem::parseShapeAnnotation(mpText, pGraphicsView);
257257
FilledShape::parseShapeAnnotation(mpText, pGraphicsView);
258258

OMEdit/OMEditLIB/Element/Transformation.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,14 @@ void Transformation::parseTransformation(const ModelInstance::PlacementAnnotatio
159159

160160
// transformation
161161
mVisible = placementAnnotation.getVisible();
162-
mVisible.evaluate(mpComponent ? mpComponent->getGraphicsView()->getModelWidget()->getModelInstance() : nullptr);
162+
mVisible.evaluate(mpComponent ? mpComponent->getGraphicsView()->getModelWidget()->getModelInstance() : placementAnnotation.getParentModel());
163163
ModelInstance::Transformation transformation = placementAnnotation.getTransformation();
164164
mOriginDiagram = transformation.getOrigin();
165-
mOriginDiagram.evaluate(mpComponent ? mpComponent->getGraphicsView()->getModelWidget()->getModelInstance() : nullptr);
165+
mOriginDiagram.evaluate(mpComponent ? mpComponent->getGraphicsView()->getModelWidget()->getModelInstance() : placementAnnotation.getParentModel());
166166
mExtentDiagram = transformation.getExtent();
167-
mExtentDiagram.evaluate(mpComponent ? mpComponent->getGraphicsView()->getModelWidget()->getModelInstance() : nullptr);
167+
mExtentDiagram.evaluate(mpComponent ? mpComponent->getGraphicsView()->getModelWidget()->getModelInstance() : placementAnnotation.getParentModel());
168168
mRotateAngleDiagram = transformation.getRotation();
169-
mRotateAngleDiagram.evaluate(mpComponent ? mpComponent->getGraphicsView()->getModelWidget()->getModelInstance() : nullptr);
169+
mRotateAngleDiagram.evaluate(mpComponent ? mpComponent->getGraphicsView()->getModelWidget()->getModelInstance() : placementAnnotation.getParentModel());
170170
// map values from element coordinate system to DiagramMap extent
171171
if (pExtend && pExtend->getIconDiagramMapHasExtent(false)) {
172172
ExtentAnnotation extendsCoOrdinateExtents = pExtend->getIconDiagramMapExtent(false);
@@ -202,14 +202,14 @@ void Transformation::parseTransformation(const ModelInstance::PlacementAnnotatio
202202
}
203203
// icon transformation
204204
mVisibleIcon = placementAnnotation.getIconVisible();
205-
mVisibleIcon.evaluate(mpComponent ? mpComponent->getGraphicsView()->getModelWidget()->getModelInstance() : nullptr);
205+
mVisibleIcon.evaluate(mpComponent ? mpComponent->getGraphicsView()->getModelWidget()->getModelInstance() : placementAnnotation.getParentModel());
206206
ModelInstance::Transformation iconTransformation = placementAnnotation.getIconTransformation();
207207
mOriginIcon = iconTransformation.getOrigin();
208-
mOriginIcon.evaluate(mpComponent ? mpComponent->getGraphicsView()->getModelWidget()->getModelInstance() : nullptr);
208+
mOriginIcon.evaluate(mpComponent ? mpComponent->getGraphicsView()->getModelWidget()->getModelInstance() : placementAnnotation.getParentModel());
209209
mExtentIcon = iconTransformation.getExtent();
210-
mExtentIcon.evaluate(mpComponent ? mpComponent->getGraphicsView()->getModelWidget()->getModelInstance() : nullptr);
210+
mExtentIcon.evaluate(mpComponent ? mpComponent->getGraphicsView()->getModelWidget()->getModelInstance() : placementAnnotation.getParentModel());
211211
mRotateAngleIcon = iconTransformation.getRotation();
212-
mRotateAngleIcon.evaluate(mpComponent ? mpComponent->getGraphicsView()->getModelWidget()->getModelInstance() : nullptr);
212+
mRotateAngleIcon.evaluate(mpComponent ? mpComponent->getGraphicsView()->getModelWidget()->getModelInstance() : placementAnnotation.getParentModel());
213213
// map values from element coordinate system to IconMap extent.
214214
if (pExtend && pExtend->getIconDiagramMapHasExtent(true)) {
215215
ExtentAnnotation extendsCoOrdinateExtents = pExtend->getIconDiagramMapExtent(true);

0 commit comments

Comments
 (0)