@@ -401,7 +401,7 @@ QRectF Element::boundingRect() const
401401 } else if (isPort ()) {
402402 ExtentAnnotation extent;
403403 if (mpModelComponent) {
404- if (mpModelComponent->getModel ()-> isConnector () && (mpGraphicsView->isDiagramView ()) && canUseDiagramAnnotation ()) {
404+ if (mpModelComponent->isConnector () && (mpGraphicsView->isDiagramView ()) && canUseDiagramAnnotation ()) {
405405 mpModelComponent->getAnnotation ()->getPlacementAnnotation ().getTransformation ().getExtent ();
406406 } else {
407407 mpModelComponent->getAnnotation ()->getPlacementAnnotation ().getIconTransformation ().getExtent ();
@@ -557,7 +557,7 @@ ModelInstance::CoordinateSystem Element::getCoordinateSystem() const
557557{
558558 ModelInstance::CoordinateSystem coordinateSystem;
559559 if (mpModelComponent && mpModel) {
560- if (mpModelComponent->getModel ()-> isConnector () && (mpGraphicsView->isDiagramView ()) && canUseDiagramAnnotation ()) {
560+ if (mpModelComponent->isConnector () && (mpGraphicsView->isDiagramView ()) && canUseDiagramAnnotation ()) {
561561 coordinateSystem = mpModel->getAnnotation ()->getDiagramAnnotation ()->mMergedCoordinateSystem ;
562562 } else {
563563 coordinateSystem = mpModel->getAnnotation ()->getIconAnnotation ()->mMergedCoordinateSystem ;
@@ -626,7 +626,7 @@ QString Element::getPlacementAnnotation(bool ModelicaSyntax)
626626 placementAnnotationString.append (QString (" visible=%1," ).arg (mTransformation .getVisible ().toQString ()));
627627 }
628628 }
629- if ((mpLibraryTreeItem && mpLibraryTreeItem->isConnector ()) || (mpModelComponent && mpModelComponent->getModel ()-> isConnector ())) {
629+ if ((mpLibraryTreeItem && mpLibraryTreeItem->isConnector ()) || (mpModelComponent && mpModelComponent->isConnector ())) {
630630 if (mpGraphicsView->isIconView ()) {
631631 // first get the component from diagram view and get the transformations
632632 Element *pElement = mpGraphicsView->getModelWidget ()->getDiagramGraphicsView ()->getElementObject (getName ());
@@ -692,7 +692,7 @@ QString Element::getOMCPlacementAnnotation(QPointF position)
692692 if (mTransformation .isValid ()) {
693693 placementAnnotationString.append (mTransformation .getVisible () ? " true" : " false" );
694694 }
695- if ((mpLibraryTreeItem && mpLibraryTreeItem->isConnector ()) || (mpModelComponent && mpModelComponent->getModel ()-> isConnector ())) {
695+ if ((mpLibraryTreeItem && mpLibraryTreeItem->isConnector ()) || (mpModelComponent && mpModelComponent->isConnector ())) {
696696 if (mpGraphicsView->isIconView ()) {
697697 // first get the component from diagram view and get the transformations
698698 Element *pElement;
@@ -746,6 +746,16 @@ QString Element::getTransformationExtent()
746746 return transformationExtent;
747747}
748748
749+ /* !
750+ * \brief Element::isConnector
751+ * Returns true if the Element class is connector.
752+ * \return
753+ */
754+ bool Element::isConnector () const
755+ {
756+ return mpModel && mpModel->isConnector ();
757+ }
758+
749759/* !
750760 * \brief Element::isExpandableConnector
751761 * Returns true if the Element class is expandable connector.
@@ -891,7 +901,7 @@ void Element::createClassElements()
891901 foreach (auto pElement, elements) {
892902 if (pElement->isComponent ()) {
893903 auto pComponent = dynamic_cast <ModelInstance::Component*>(pElement);
894- if (pComponent->isPublic () && pComponent->getModel () && pComponent-> getModel ()-> isConnector ()) {
904+ if (pComponent->isPublic () && pComponent->isConnector ()) {
895905 mElementsList .append (new Element (pComponent, this , getRootParentElement ()));
896906 }
897907 }
@@ -1617,11 +1627,11 @@ void Element::createClassShapes()
16171627 // Always use the IconMap here. Only IconMap makes sense for drawing icons of Element.
16181628 if (!(pExtendModel && !pExtendModel->getIconDiagramMapPrimitivesVisible (true ))) {
16191629 /* issue #12074
1620- * Use mpModelComponent->getModel()-> isConnector() here instead of mpModel->isConnector()
1630+ * Use mpModelComponent->isConnector() here instead of mpModel->isConnector()
16211631 * So when called for extends we use the top level element restriction.
16221632 * We use the same mpModelComponent for top level and extends elements. See Element constructor above for extends element type.
16231633 */
1624- if (mpModelComponent && mpModelComponent->getModel ()-> isConnector () && mpGraphicsView->isDiagramView () && canUseDiagramAnnotation ()) {
1634+ if (mpModelComponent && mpModelComponent->isConnector () && mpGraphicsView->isDiagramView () && canUseDiagramAnnotation ()) {
16251635 shapes = mpModel->getAnnotation ()->getDiagramAnnotation ()->getGraphics ();
16261636 } else {
16271637 shapes = mpModel->getAnnotation ()->getIconAnnotation ()->getGraphics ();
0 commit comments