| /***************************************************************************** |
| * Copyright (c) 2017 CEA LIST and others. |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation |
| *****************************************************************************/ |
| |
| import org.eclipse.papyrus.interoperability.sysml14.sysml.blackboxes.VersioningHelper; |
| import org.eclipse.papyrus.interoperability.sysml14.sysml.SysMLDiagramsConstants; |
| |
| modeltype ecore "strict" uses 'http://www.eclipse.org/emf/2002/Ecore'; |
| modeltype UML "strict" uses 'http://www.eclipse.org/uml2/5.0.0/UML'; |
| modeltype notation "strict" uses 'http://www.eclipse.org/gmf/runtime/1.0.2/notation'; |
| modeltype style "strict" uses 'http://www.eclipse.org/papyrus/infra/gmfdiag/style'; |
| |
| /** |
| * This file provides useful method for SysML diagrams. |
| */ |
| library SysMLDiagramsUtils; |
| |
| |
| mapping notation::Shape::fromSysML11NamedElementDefaultShapeAsClass(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = NAMEDELEMENT_DEFAULTSHAPE and self.element.oclIsKindOf(UML::Class)} { |
| init { |
| result := self; |
| result.children := object OrderedSet(notation::Node){}; |
| } |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := CLASS_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(CLASS_NAME_LABEL_DECORATIONNODE_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(CLASS_FLOATING_LABEL_DECORATIONNODE_SYSML14); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(CLASS_ATTRIBUTE_COMPARTMENT_SYSML14); |
| children += createDefaultBasicCompartement(CLASS_OPERATION_COMPARTMENT_SYSML14); |
| children += createDefaultBasicCompartement(CLASS_NESTEDCLASSIFIER_COMPARTMENT_SYSML14); |
| } else { |
| type := CLASS_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(CLASS_NAME_LABEL_DECORATIONNODE_CN_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(CLASS_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(CLASS_ATTRIBUTE_COMPARTMENT_CN_SYSML14); |
| children += createDefaultBasicCompartement(CLASS_OPERATION_COMPARTMENT_CN_SYSML14); |
| children += createDefaultBasicCompartement(CLASS_NESTEDCLASSIFIER_COMPARTMENT_CN_SYSML14); |
| }; |
| } |
| |
| mapping notation::Shape::fromSysML11NamedElementDefaultShapeAsComponent(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = NAMEDELEMENT_DEFAULTSHAPE and self.element.oclIsKindOf(UML::Component)} { |
| init { |
| result := self; |
| result.children := object OrderedSet(notation::Node){}; |
| } |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := COMPONENT_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(COMPONENT_NAME_LABEL_DECORATIONNODE_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(COMPONENT_FLOATING_LABEL_DECORATIONNODE_SYSML14); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(COMPONENT_ATTRIBUTE_COMPARTMENT_SYSML14); |
| children += createDefaultBasicCompartement(COMPONENT_OPERATION_COMPARTMENT_SYSML14); |
| children += createDefaultBasicCompartement(COMPONENT_NESTEDCLASSIFIER_COMPARTMENT_SYSML14); |
| } else { |
| type := COMPONENT_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(COMPONENT_NAME_LABEL_DECORATIONNODE_CN_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(COMPONENT_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(COMPONENT_ATTRIBUTE_COMPARTMENT_CN_SYSML14); |
| children += createDefaultBasicCompartement(COMPONENT_OPERATION_COMPARTMENT_CN_SYSML14); |
| children += createDefaultBasicCompartement(COMPONENT_NESTEDCLASSIFIER_COMPARTMENT_CN_SYSML14); |
| }; |
| } |
| |
| mapping notation::Shape::fromSysML11NamedElementDefaultShapeAsDataType(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = NAMEDELEMENT_DEFAULTSHAPE and self.element.oclIsKindOf(UML::DataType)} { |
| init { |
| result := self; |
| result.children := object OrderedSet(notation::Node){}; |
| } |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := DATATYPE_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(DATATYPE_NAME_LABEL_DECORATIONNODE_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(DATATYPE_FLOATING_LABEL_DECORATIONNODE_SYSML14); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(DATATYPE_ATTRIBUTE_COMPARTMENT_SYSML14); |
| children += createDefaultBasicCompartement(DATATYPE_OPERATION_COMPARTMENT_SYSML14); |
| } else { |
| type := DATATYPE_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(DATATYPE_NAME_LABEL_DECORATIONNODE_CN_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(DATATYPE_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(DATATYPE_ATTRIBUTE_COMPARTMENT_CN_SYSML14); |
| children += createDefaultBasicCompartement(DATATYPE_OPERATION_COMPARTMENT_CN_SYSML14); |
| }; |
| } |
| |
| mapping notation::Shape::fromSysML11NamedElementDefaultShapeAsDurationObservation(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = NAMEDELEMENT_DEFAULTSHAPE and self.element.oclIsKindOf(UML::DurationObservation)} { |
| init { |
| result := self; |
| result.children := object OrderedSet(notation::Node){}; |
| } |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := DURATIONOBSERVATION_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| var floatingNameLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(DURATIONOBSERVATION_FLOATING_LABEL_DECORATIONNODE_SYSML14); |
| floatingNameLabel.layoutConstraint.oclAsType(notation::Location).x := 25; |
| floatingNameLabel.layoutConstraint.oclAsType(notation::Location).y := 3; |
| children += floatingNameLabel; |
| |
| var stereotypeLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(DURATIONOBSERVATION_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14); |
| stereotypeLabel.layoutConstraint.oclAsType(notation::Location).x := 25; |
| stereotypeLabel.layoutConstraint.oclAsType(notation::Location).y := -10; |
| children += stereotypeLabel; |
| } else { |
| type := DURATIONOBSERVATION_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| var floatingNameLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(DURATIONOBSERVATION_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14); |
| floatingNameLabel.layoutConstraint.oclAsType(notation::Location).x := 25; |
| floatingNameLabel.layoutConstraint.oclAsType(notation::Location).y := 3; |
| children += floatingNameLabel; |
| |
| var stereotypeLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(DURATIONOBSERVATION_STEREOTYPE_LABEL_DECORATIONNODE_CN_SYSML14); |
| stereotypeLabel.layoutConstraint.oclAsType(notation::Location).x := 25; |
| stereotypeLabel.layoutConstraint.oclAsType(notation::Location).y := -10; |
| children += stereotypeLabel; |
| }; |
| } |
| |
| mapping notation::Shape::fromSysML11NamedElementDefaultShapeAsEnumeration(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = NAMEDELEMENT_DEFAULTSHAPE and self.element.oclIsKindOf(UML::Enumeration)} { |
| init { |
| result := self; |
| result.children := object OrderedSet(notation::Node){}; |
| } |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := ENUMERATION_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(ENUMERATION_NAME_LABEL_DECORATIONNODE_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(ENUMERATION_FLOATING_LABEL_DECORATIONNODE_SYSML14); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(ENUMERATION_LITERAL_COMPARTMENT_SYSML14); |
| } else { |
| type := ENUMERATION_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(ENUMERATION_NAME_LABEL_DECORATIONNODE_CN_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(ENUMERATION_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(ENUMERATION_LITERAL_COMPARTMENT_CN_SYSML14); |
| }; |
| } |
| |
| mapping notation::Shape::fromSysML11NamedElementDefaultShapeAsInformationItem(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = NAMEDELEMENT_DEFAULTSHAPE and self.element.oclIsKindOf(UML::InformationItem)} { |
| init { |
| result := self; |
| result.children := object OrderedSet(notation::Node){}; |
| } |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := INFORMATIONITEM_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(INFORMATIONITEM_NAME_LABEL_DECORATIONNODE_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(INFORMATIONITEM_FLOATING_LABEL_DECORATIONNODE_SYSML14); |
| } else { |
| type := INFORMATIONITEM_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(INFORMATIONITEM_NAME_LABEL_DECORATIONNODE_CN_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(INFORMATIONITEM_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14); |
| }; |
| } |
| |
| mapping notation::Shape::fromSysML11NamedElementDefaultShapeAsInterface(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = NAMEDELEMENT_DEFAULTSHAPE and self.element.oclIsKindOf(UML::Interface)} { |
| init { |
| result := self; |
| result.children := object OrderedSet(notation::Node){}; |
| } |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := INTERFACE_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(INTERFACE_NAME_LABEL_DECORATIONNODE_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(INTERFACE_FLOATING_LABEL_DECORATIONNODE_SYSML14); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(INTERFACE_ATTRIBUTE_COMPARTMENT_SYSML14); |
| children += createDefaultBasicCompartement(INTERFACE_OPERATION_COMPARTMENT_SYSML14); |
| children += createDefaultBasicCompartement(INTERFACE_NESTEDCLASSIFIER_COMPARTMENT_SYSML14); |
| } else { |
| type := INTERFACE_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(INTERFACE_NAME_LABEL_DECORATIONNODE_CN_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(INTERFACE_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(INTERFACE_ATTRIBUTE_COMPARTMENT_CN_SYSML14); |
| children += createDefaultBasicCompartement(INTERFACE_OPERATION_COMPARTMENT_CN_SYSML14); |
| children += createDefaultBasicCompartement(INTERFACE_NESTEDCLASSIFIER_COMPARTMENT_CN_SYSML14); |
| }; |
| } |
| |
| mapping notation::Shape::fromSysML11NamedElementDefaultShapeAsInstanceSpecification(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = NAMEDELEMENT_DEFAULTSHAPE and self.element.oclIsKindOf(UML::InstanceSpecification)} { |
| init { |
| result := self; |
| result.children := object OrderedSet(notation::Node){}; |
| } |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := INSTANCESPECIFICATION_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(INSTANCESPECIFICATION_NAME_LABEL_DECORATIONNODE_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(INSTANCESPECIFICATION_FLOATING_LABEL_DECORATIONNODE_SYSML14); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(INSTANCESPECIFICATION_SLOP_COMPARTMENT_SYSML14); |
| } else { |
| type := INSTANCESPECIFICATION_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(INSTANCESPECIFICATION_NAME_LABEL_DECORATIONNODE_CN_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(INSTANCESPECIFICATION_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(INSTANCESPECIFICATION_SLOP_COMPARTMENT_CN_SYSML14); |
| }; |
| } |
| |
| mapping notation::Shape::fromSysML11NamedElementDefaultShapeAsPrimitiveType(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = NAMEDELEMENT_DEFAULTSHAPE and self.element.oclIsKindOf(UML::PrimitiveType)} { |
| init { |
| result := self; |
| result.children := object OrderedSet(notation::Node){}; |
| } |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := PRIMITIVETYPE_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(PRIMITIVETYPE_NAME_LABEL_DECORATIONNODE_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(PRIMITIVETYPE_FLOATING_LABEL_DECORATIONNODE_SYSML14); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(PRIMITIVETYPE_ATTRIBUTE_COMPARTMENT_SYSML14); |
| } else { |
| type := PRIMITIVETYPE_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(PRIMITIVETYPE_NAME_LABEL_DECORATIONNODE_CN_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(PRIMITIVETYPE_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(PRIMITIVETYPE_ATTRIBUTE_COMPARTMENT_CN_SYSML14); |
| }; |
| } |
| |
| mapping notation::Shape::fromSysML11NamedElementDefaultShapeAsSignal(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = NAMEDELEMENT_DEFAULTSHAPE and self.element.oclIsKindOf(UML::Signal)} { |
| init { |
| result := self; |
| result.children := object OrderedSet(notation::Node){}; |
| } |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := SIGNAL_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(SIGNAL_NAME_LABEL_DECORATIONNODE_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(SIGNAL_FLOATING_LABEL_DECORATIONNODE_SYSML14); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(SIGNAL_ATTRIBUTE_COMPARTMENT_SYSML14); |
| } else { |
| type := SIGNAL_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(SIGNAL_NAME_LABEL_DECORATIONNODE_CN_SYSML14); |
| children += createDefaultFloatingNameLabelDecorationNode(SIGNAL_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(SIGNAL_ATTRIBUTE_COMPARTMENT_SYSML14); |
| }; |
| } |
| |
| mapping notation::Shape::fromSysML11NamedElementDefaultShapeAsTimeObservation(parent:notation::View) : notation::Shape when {self.oclIsTypeOf(notation::Shape) and self.type = NAMEDELEMENT_DEFAULTSHAPE and self.element.oclIsKindOf(UML::TimeObservation)} { |
| init { |
| result := self; |
| result.children := object OrderedSet(notation::Node){}; |
| } |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := TIMEOBSERVATION_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| var floatingNameLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(TIMEOBSERVATION_FLOATING_LABEL_DECORATIONNODE_SYSML14); |
| floatingNameLabel.layoutConstraint.oclAsType(notation::Location).x := 25; |
| floatingNameLabel.layoutConstraint.oclAsType(notation::Location).y := 3; |
| children += floatingNameLabel; |
| |
| var stereotypeLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(TIMEOBSERVATION_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14); |
| stereotypeLabel.layoutConstraint.oclAsType(notation::Location).x := 25; |
| stereotypeLabel.layoutConstraint.oclAsType(notation::Location).y := -10; |
| children += stereotypeLabel; |
| } else { |
| type := TIMEOBSERVATION_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| var floatingNameLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(TIMEOBSERVATION_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14); |
| floatingNameLabel.layoutConstraint.oclAsType(notation::Location).x := 25; |
| floatingNameLabel.layoutConstraint.oclAsType(notation::Location).y := 3; |
| children += floatingNameLabel; |
| |
| var stereotypeLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(TIMEOBSERVATION_STEREOTYPE_LABEL_DECORATIONNODE_CN_SYSML14); |
| stereotypeLabel.layoutConstraint.oclAsType(notation::Location).x := 25; |
| stereotypeLabel.layoutConstraint.oclAsType(notation::Location).y := -10; |
| children += stereotypeLabel; |
| }; |
| } |
| |
| mapping notation::Edge::fromSysML11RealizationEdgeAsInterfaceRealization() : notation::Edge when {self.oclIsTypeOf(notation::Connector) and self.type = REALIZATION_EDGE_SYSML14 and self.element.oclIsTypeOf(UML::InterfaceRealization)} { |
| init { |
| result := self; |
| } |
| type := INTERFACEREALIZATION_EDGE_SYSML14; |
| |
| var existingChildren:OrderedSet(notation::Node) := self.children; |
| children := object OrderedSet(notation::Node){}; |
| |
| existingChildren->forEach(existingChild){ |
| if (existingChild.type = REALIZATION_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14) { |
| existingChild.type := INTERFACEREALIZATION_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14; |
| children += existingChild; |
| } elif (existingChild.type = REALIZATION_NAME_LABEL_DECORATIONNODE_SYSML14) { |
| existingChild.type := INTERFACEREALIZATION_NAME_LABEL_DECORATIONNODE_SYSML14; |
| children += existingChild; |
| } |
| }; |
| } |
| |
| mapping notation::Edge::fromSysML11RealizationEdgeAsRealization() : notation::Edge when {self.oclIsTypeOf(notation::Connector) and self.type = REALIZATION_EDGE_SYSML14 and self.element.oclIsKindOf(UML::Realization)} { |
| init { |
| result := self; |
| } |
| type := DEPENDENCY_EDGE_SYSML14; |
| |
| var existingChildren:OrderedSet(notation::Node) := self.children; |
| children := object OrderedSet(notation::Node){}; |
| |
| existingChildren->forEach(existingChild){ |
| if (existingChild.type = REALIZATION_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14) { |
| existingChild.type := DEPENDENCY_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14; |
| children += existingChild; |
| } elif (existingChild.type = REALIZATION_NAME_LABEL_DECORATIONNODE_SYSML14) { |
| existingChild.type := DEPENDENCY_NAME_LABEL_DECORATIONNODE_SYSML14; |
| children += existingChild; |
| } |
| }; |
| } |
| |
| mapping notation::Edge::fromSysML11RealizationEdgeAsSubstitution() : notation::Edge when {self.oclIsTypeOf(notation::Connector) and self.type = REALIZATION_EDGE_SYSML14 and self.element.oclIsTypeOf(UML::Substitution)} { |
| init { |
| result := self; |
| } |
| type := SUBSTITUTION_EDGE_SYSML14; |
| |
| var existingChildren:OrderedSet(notation::Node) := self.children; |
| children := object OrderedSet(notation::Node){}; |
| |
| existingChildren->forEach(existingChild){ |
| if (existingChild.type = REALIZATION_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14) { |
| existingChild.type := SUBSTITUTION_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14; |
| children += existingChild; |
| } elif (existingChild.type = REALIZATION_NAME_LABEL_DECORATIONNODE_SYSML14) { |
| existingChild.type := SUBSTITUTION_NAME_LABEL_DECORATIONNODE_SYSML14; |
| children += existingChild; |
| } |
| }; |
| } |
| |
| mapping notation::Edge::fromSysML11DependencyEdgeAsUsage() : notation::Edge when {self.oclIsTypeOf(notation::Connector) and self.type = DEPENDENCY_EDGE_SYSML14 and self.element.oclIsKindOf(UML::Usage)} { |
| init { |
| result := self; |
| } |
| type := USAGE_EDGE_SYSML14; |
| |
| var existingChildren:OrderedSet(notation::Node) := self.children; |
| children := object OrderedSet(notation::Node){}; |
| |
| existingChildren->forEach(existingChild){ |
| if (existingChild.type = DEPENDENCY_NAME_LABEL_DECORATIONNODE_SYSML14) { |
| existingChild.type := USAGE_NAME_LABEL_DECORATIONNODE_SYSML14; |
| children += existingChild; |
| } elif (existingChild.type = DEPENDENCY_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14) { |
| existingChild.type := USAGE_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14; |
| children += existingChild; |
| } |
| }; |
| } |
| |
| /** |
| * This allows to modify if existing the 'diagram_compatibility_version' value style, or create it if not existing |
| **/ |
| helper setOrCreateCompatibilityVersion(inout diagram:notation::Diagram){ |
| // Search the compatibility version, if not exist, create it |
| var compatibilityVersionStyle:notation::StringValueStyle := diagram.styles->selectByType(notation::StringValueStyle)->any(curr | curr.name=DIAGRAM_COMPATIBILITY_VERSION); |
| if (compatibilityVersionStyle.oclIsUndefined()) { |
| // add style compatibility version style |
| compatibilityVersionStyle := object notation::StringValueStyle { |
| name := DIAGRAM_COMPATIBILITY_VERSION; |
| }; |
| diagram.styles+= compatibilityVersionStyle; |
| }; |
| compatibilityVersionStyle.stringValue := "1.3.0"; |
| } |
| |
| /** |
| * This allows to modify the papyrus view style to add the needed configuration |
| **/ |
| helper addPapyrusDiagramStyleConfiguration(inout diagram:notation::Diagram, in model:UML::Model, in papyrusDiagram:String){ |
| // Search the papyrus diagram style, if not exist, create it |
| var papyrusDiagramStyle:style::PapyrusDiagramStyle := diagram.styles->selectByType(style::PapyrusDiagramStyle)->any(true); |
| if (papyrusDiagramStyle.oclIsUndefined()) { |
| // add the papyrus diagram style |
| papyrusDiagramStyle := object style::PapyrusDiagramStyle{ |
| owner := model.oclAsType(ecore::EObject); |
| }; |
| diagram.styles += papyrusDiagramStyle; |
| }; |
| papyrusDiagramStyle.diagramKindId := papyrusDiagram; |
| } |
| |
| /** |
| * This allows to manage the show title EAnnotation as compartment attribute. |
| **/ |
| helper manageShowTitleEAnnotationAsCompartmentAttribute(inout createdCompartment:notation::Compartment, existingChild:notation::Node) : OrderedSet(ecore::EAnnotation){ |
| var res:OrderedSet(ecore::EAnnotation); |
| // The initial value in Sysml1.1 is set to true |
| createdCompartment.showTitle := true; |
| existingChild.eAnnotations->forEach(eAnnotation){ |
| if (eAnnotation.source = PAPYRUS_CSS_FORCE_VALUE) { |
| var createdEAnnotation:ecore::EAnnotation := eAnnotation; |
| createdEAnnotation.eAnnotations := object OrderedSet(ecore::EAnnotation){}; |
| var foundOtherNeededDetail:Boolean := false; |
| eAnnotation.details->forEach(detail){ |
| if (detail.key = SHOW_TITLE) { |
| createdCompartment.showTitle := fromStringToBoolean(detail.value); |
| } else { |
| createdEAnnotation.details += detail; |
| foundOtherNeededDetail := true; |
| }; |
| }; |
| if (foundOtherNeededDetail) { |
| res += createdEAnnotation; |
| }; |
| } else { |
| res += eAnnotation; |
| }; |
| }; |
| return res; |
| } |
| |
| helper fromStringToBoolean(value:String) : Boolean { |
| if (value = "true") { |
| return true; |
| } else { |
| return false; |
| } |
| } |
| |
| /** |
| * This allows to create the class floating name label decoration node |
| **/ |
| helper createDefaultNameLabelDecorationNode(typeToCreate:String) : notation::DecorationNode { |
| return object notation::DecorationNode{ |
| type := typeToCreate; |
| }; |
| } |
| |
| helper createDefaultNameLabelDecorationNode(typeToCreate:String, visibleValue:String) : notation::DecorationNode { |
| var createdDecorationNode:notation::DecorationNode := createDefaultCompartement(typeToCreate); |
| setPapyrusCSSForceValueVisible(createdDecorationNode, visibleValue); |
| return createdDecorationNode; |
| } |
| |
| /** |
| * This allows to create the class floating name label decoration node |
| **/ |
| helper createDefaultFloatingNameLabelDecorationNode(typeToCreate:String) : notation::DecorationNode { |
| return object notation::DecorationNode{ |
| type := typeToCreate; |
| layoutConstraint := object notation::Location{ |
| y := 5; |
| }; |
| }; |
| } |
| |
| helper createDefaultFloatingNameLabelDecorationNode(typeToCreate:String, visibleValue:String) : notation::DecorationNode { |
| var createdDecorationNode:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(typeToCreate); |
| setPapyrusCSSForceValueVisible(createdDecorationNode, visibleValue); |
| return createdDecorationNode; |
| } |
| |
| helper createDefaultCompartement(typeToCreate:String) : notation::Compartment { |
| return object notation::Compartment{ |
| type := typeToCreate; |
| } |
| } |
| |
| helper createDefaultCompartement(typeToCreate:String, visibleValue:String) : notation::Compartment { |
| var createdCompartment:notation::Compartment := createDefaultCompartement(typeToCreate); |
| setPapyrusCSSForceValueVisible(createdCompartment, visibleValue); |
| return createdCompartment; |
| } |
| |
| helper createDefaultBasicCompartement(typeToCreate:String) : notation::BasicCompartment { |
| return object notation::BasicCompartment{ |
| type := typeToCreate; |
| styles += object notation::TitleStyle{}; |
| styles += object notation::SortingStyle{}; |
| styles += object notation::FilteringStyle{}; |
| layoutConstraint := object notation::Bounds{}; |
| } |
| } |
| |
| helper createDefaultBasicCompartement(typeToCreate:String, visibleValue:String) : notation::BasicCompartment { |
| var createdCompartment:notation::BasicCompartment := createDefaultBasicCompartement(typeToCreate); |
| setPapyrusCSSForceValueVisible(createdCompartment, visibleValue); |
| return createdCompartment; |
| } |
| |
| helper createTitleBasicCompartement(typeToCreate:String) : notation::BasicCompartment { |
| return object notation::BasicCompartment{ |
| type := typeToCreate; |
| styles += object notation::TitleStyle{}; |
| }; |
| } |
| |
| helper createTitleBasicCompartement(typeToCreate:String, visibleValue:String) : notation::BasicCompartment { |
| var createdCompartment:notation::BasicCompartment := createTitleBasicCompartement(typeToCreate); |
| setPapyrusCSSForceValueVisible(createdCompartment, visibleValue); |
| return createdCompartment; |
| } |
| |
| /** |
| * This allows to add the papyrus force value visible to true. |
| **/ |
| helper setPapyrusCSSForceValueVisible(inout compartment:notation::Node, visibleValue:String) { |
| var existPapyrusCSSForceValue:Boolean := false; |
| compartment.eAnnotations->forEach(eAnnotation){ |
| if (eAnnotation.source = PAPYRUS_CSS_FORCE_VALUE) { |
| var createdEAnnotation:ecore::EAnnotation := object ecore::EAnnotation{}; |
| var existVisible:Boolean := false; |
| eAnnotation.details->forEach(detail){ |
| // If the Visible papyrus CSS force value is existing, don't replace it' |
| if (detail.key = VISIBLE) { |
| existVisible := true; |
| }; |
| }; |
| |
| if (not existVisible) { |
| eAnnotation.details += object ecore::EStringToStringMapEntry{ |
| key := VISIBLE; |
| value := visibleValue; |
| }; |
| }; |
| |
| existPapyrusCSSForceValue := true; |
| }; |
| }; |
| |
| if (not existPapyrusCSSForceValue) { |
| compartment.eAnnotations += object ecore::EAnnotation{ |
| source := PAPYRUS_CSS_FORCE_VALUE; |
| details += object ecore::EStringToStringMapEntry{ |
| key := VISIBLE; |
| value := visibleValue; |
| }; |
| }; |
| }; |
| } |
| |
| /** |
| * By Default, the show title is set to true in SysML1.1. |
| * So to manage it in SysML1.4, the showTitle EAnnotation detail must be created if it is not already done. |
| **/ |
| helper setShowTitle(inout compartment:notation::Node, valueShowTitle:Boolean) { |
| if (compartment.oclIsKindOf(notation::TitleStyle)) { |
| var isPapyrusCSSForceValueExist := false; |
| compartment.eAnnotations->forEach(eAnnotation){ |
| if (eAnnotation.source = PAPYRUS_CSS_FORCE_VALUE) { |
| var foundShowTitle:Boolean := false; |
| eAnnotation.details->forEach(detail){ |
| if (detail.key = SHOW_TITLE) { |
| foundShowTitle := true; |
| compartment.oclAsType(notation::TitleStyle).showTitle := fromStringToBoolean(detail.value); |
| }; |
| }; |
| |
| if (not foundShowTitle) { |
| compartment.oclAsType(notation::TitleStyle).showTitle := valueShowTitle; |
| }; |
| isPapyrusCSSForceValueExist := true; |
| }; |
| }; |
| |
| if (not isPapyrusCSSForceValueExist) { |
| compartment.oclAsType(notation::TitleStyle).showTitle := valueShowTitle; |
| }; |
| }; |
| } |
| |
| helper createModelShape(parent:notation::View, modelElement:ecore::EObject) : notation::Shape { |
| return object notation::Shape { |
| element := modelElement; |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| var packageElementCompartment:notation::BasicCompartment; |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := MODEL_SHAPE_SYSML14; |
| children += createDefaultNameLabelDecorationNode(MODEL_NAME_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| packageElementCompartment := createDefaultBasicCompartement(MODEL_PACKAGEDELEMENT_COMPARTMENT_SYSML14, TRUE); |
| } else { |
| type := MODEL_SHAPE_CN_SYSML14; |
| children += createDefaultNameLabelDecorationNode(MODEL_NAME_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| packageElementCompartment := createDefaultBasicCompartement(MODEL_PACKAGEDELEMENT_COMPARTMENT_CN_SYSML14, TRUE); |
| }; |
| packageElementCompartment.styles += object notation::TitleStyle{}; |
| packageElementCompartment.layoutConstraint := object notation::Bounds{}; |
| children += packageElementCompartment; |
| } |
| } |
| |
| helper createClassShape(parent:notation::View, classElement:ecore::EObject) : notation::Shape { |
| return object notation::Shape { |
| element := classElement; |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := CLASS_SHAPE_SYSML14; |
| children += createDefaultNameLabelDecorationNode(CLASS_NAME_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(CLASS_FLOATING_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(CLASS_ATTRIBUTE_COMPARTMENT_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(CLASS_OPERATION_COMPARTMENT_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(CLASS_NESTEDCLASSIFIER_COMPARTMENT_SYSML14, TRUE); |
| } else { |
| type := CLASS_SHAPE_CN_SYSML14; |
| children += createDefaultNameLabelDecorationNode(CLASS_NAME_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(CLASS_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(CLASS_ATTRIBUTE_COMPARTMENT_CN_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(CLASS_OPERATION_COMPARTMENT_CN_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(CLASS_NESTEDCLASSIFIER_COMPARTMENT_CN_SYSML14, TRUE); |
| }; |
| } |
| } |
| |
| helper createConstraintShape(parent:notation::View, classElement:ecore::EObject) : notation::Shape { |
| return object notation::Shape { |
| element := classElement; |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := CONSTRAINTPACKAGEELEMENT_SHAPE_SYSML14; |
| children += createDefaultNameLabelDecorationNode(CONSTRAINT_NAME_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| children += createDefaultNameLabelDecorationNode(CONSTRAINT_BODY_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| } else { |
| type := CONSTRAINTPACKAGEELEMENT_SHAPE_CN_SYSML14; |
| children += createDefaultNameLabelDecorationNode(CONSTRAINT_NAME_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| children += createDefaultNameLabelDecorationNode(CONSTRAINT_BODY_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| }; |
| } |
| } |
| |
| helper createCommentShape(parent:notation::View, classElement:ecore::EObject) : notation::Shape { |
| return object notation::Shape { |
| element := classElement; |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := COMMENT_SHAPE_SYSML14; |
| children += createDefaultNameLabelDecorationNode(COMMENT_BODY_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| } else { |
| type := COMMENT_SHAPE_CN_SYSML14; |
| children += createDefaultNameLabelDecorationNode(COMMENT_BODY_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| }; |
| } |
| } |
| |
| helper createComponentShape(parent:notation::View, classElement:ecore::EObject) : notation::Shape { |
| return object notation::Shape { |
| element := classElement; |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := COMPONENT_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(COMPONENT_NAME_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(COMPONENT_FLOATING_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(COMPONENT_ATTRIBUTE_COMPARTMENT_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(COMPONENT_OPERATION_COMPARTMENT_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(COMPONENT_NESTEDCLASSIFIER_COMPARTMENT_SYSML14, TRUE); |
| } else { |
| type := COMPONENT_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(COMPONENT_NAME_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(COMPONENT_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(COMPONENT_ATTRIBUTE_COMPARTMENT_CN_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(COMPONENT_OPERATION_COMPARTMENT_CN_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(COMPONENT_NESTEDCLASSIFIER_COMPARTMENT_CN_SYSML14, TRUE); |
| }; |
| } |
| } |
| |
| helper createDataTypeShape(parent:notation::View, dataType:ecore::EObject) : notation::Shape { |
| return object notation::Shape { |
| element := dataType; |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := DATATYPE_SHAPE_SYSML14; |
| children += createDefaultNameLabelDecorationNode(DATATYPE_NAME_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(DATATYPE_FLOATING_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(DATATYPE_ATTRIBUTE_COMPARTMENT_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(DATATYPE_OPERATION_COMPARTMENT_SYSML14, TRUE); |
| } else { |
| type := DATATYPE_SHAPE_CN_SYSML14; |
| children += createDefaultNameLabelDecorationNode(DATATYPE_NAME_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(DATATYPE_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(DATATYPE_ATTRIBUTE_COMPARTMENT_CN_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(DATATYPE_OPERATION_COMPARTMENT_CN_SYSML14, TRUE); |
| }; |
| } |
| } |
| |
| helper createDurationObservationShape(parent:notation::View, dataType:ecore::EObject) : notation::Shape { |
| return object notation::Shape { |
| element := dataType; |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| if (not isCN) { |
| type := DURATIONOBSERVATION_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| var floatingNameLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(DURATIONOBSERVATION_FLOATING_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| floatingNameLabel.layoutConstraint.oclAsType(notation::Location).x := 25; |
| floatingNameLabel.layoutConstraint.oclAsType(notation::Location).y := 3; |
| children += floatingNameLabel; |
| |
| var stereotypeLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(DURATIONOBSERVATION_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| stereotypeLabel.layoutConstraint.oclAsType(notation::Location).x := 25; |
| stereotypeLabel.layoutConstraint.oclAsType(notation::Location).y := -10; |
| children += stereotypeLabel; |
| } else { |
| type := DURATIONOBSERVATION_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| var floatingNameLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(DURATIONOBSERVATION_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| floatingNameLabel.layoutConstraint.oclAsType(notation::Location).x := 25; |
| floatingNameLabel.layoutConstraint.oclAsType(notation::Location).y := 3; |
| children += floatingNameLabel; |
| |
| var stereotypeLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(DURATIONOBSERVATION_STEREOTYPE_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| stereotypeLabel.layoutConstraint.oclAsType(notation::Location).x := 25; |
| stereotypeLabel.layoutConstraint.oclAsType(notation::Location).y := -10; |
| children += stereotypeLabel; |
| }; |
| } |
| } |
| |
| helper createEnumerationShape(parent:notation::View, instanceSpecification:ecore::EObject) : notation::Shape { |
| return object notation::Shape { |
| element := instanceSpecification; |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := ENUMERATION_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(ENUMERATION_NAME_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(ENUMERATION_FLOATING_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(ENUMERATION_LITERAL_COMPARTMENT_SYSML14, TRUE); |
| } else { |
| type := ENUMERATION_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(ENUMERATION_NAME_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(ENUMERATION_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(ENUMERATION_LITERAL_COMPARTMENT_CN_SYSML14, TRUE); |
| }; |
| } |
| } |
| |
| helper createInformationItemShape(parent:notation::View, instanceSpecification:ecore::EObject) : notation::Shape { |
| return object notation::Shape { |
| element := instanceSpecification; |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := INFORMATIONITEM_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(INFORMATIONITEM_NAME_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(INFORMATIONITEM_FLOATING_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| } else { |
| type := INFORMATIONITEM_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(INFORMATIONITEM_NAME_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(INFORMATIONITEM_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| }; |
| } |
| } |
| |
| helper createInterfaceShape(parent:notation::View, interfaceElement:ecore::EObject) : notation::Shape { |
| return object notation::Shape { |
| element := interfaceElement; |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := INTERFACE_SHAPE_SYSML14; |
| children += createDefaultNameLabelDecorationNode(INTERFACE_NAME_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(INTERFACE_FLOATING_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(INTERFACE_ATTRIBUTE_COMPARTMENT_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(INTERFACE_OPERATION_COMPARTMENT_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(INTERFACE_NESTEDCLASSIFIER_COMPARTMENT_SYSML14, TRUE); |
| } else { |
| type := INTERFACE_SHAPE_CN_SYSML14; |
| children += createDefaultNameLabelDecorationNode(INTERFACE_NAME_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(INTERFACE_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(INTERFACE_ATTRIBUTE_COMPARTMENT_CN_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(INTERFACE_OPERATION_COMPARTMENT_CN_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(INTERFACE_NESTEDCLASSIFIER_COMPARTMENT_CN_SYSML14, TRUE); |
| }; |
| } |
| } |
| |
| helper createInstanceSpecificationShape(parent:notation::View, instanceSpecification:ecore::EObject) : notation::Shape { |
| return object notation::Shape { |
| element := instanceSpecification; |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := INSTANCESPECIFICATION_SHAPE_SYSML14; |
| children += createDefaultNameLabelDecorationNode(INSTANCESPECIFICATION_NAME_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(INSTANCESPECIFICATION_FLOATING_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(INSTANCESPECIFICATION_SLOP_COMPARTMENT_SYSML14, TRUE); |
| } else { |
| type := INSTANCESPECIFICATION_SHAPE_CN_SYSML14; |
| children += createDefaultNameLabelDecorationNode(INSTANCESPECIFICATION_NAME_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(INSTANCESPECIFICATION_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| children += createDefaultBasicCompartement(INSTANCESPECIFICATION_SLOP_COMPARTMENT_CN_SYSML14, TRUE); |
| }; |
| } |
| } |
| |
| helper createPackageShape(parent:notation::View, packageElement:ecore::EObject) : notation::Shape { |
| return object notation::Shape { |
| element := packageElement; |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := PACKAGE_SHAPE_SYSML14; |
| children += createDefaultNameLabelDecorationNode(PACKAGE_NAME_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| children += createTitleBasicCompartement(PACKAGE_PACKAGEDELEMENT_COMPARTMENT_SYSML14, TRUE); |
| } else { |
| type := PACKAGE_SHAPE_CN_SYSML14; |
| children += createDefaultNameLabelDecorationNode(PACKAGE_NAME_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| children += createTitleBasicCompartement(PACKAGE_PACKAGEDELEMENT_COMPARTMENT_CN_SYSML14, TRUE); |
| }; |
| } |
| } |
| |
| helper createPrimitiveTypeShape(parent:notation::View, packageElement:ecore::EObject) : notation::Shape { |
| return object notation::Shape { |
| element := packageElement; |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := PRIMITIVETYPE_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(PRIMITIVETYPE_NAME_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(PRIMITIVETYPE_FLOATING_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(PRIMITIVETYPE_ATTRIBUTE_COMPARTMENT_SYSML14, TRUE); |
| } else { |
| type := PRIMITIVETYPE_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(PRIMITIVETYPE_NAME_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(PRIMITIVETYPE_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(PRIMITIVETYPE_ATTRIBUTE_COMPARTMENT_CN_SYSML14, TRUE); |
| }; |
| } |
| } |
| |
| helper createSignalShape(parent:notation::View, packageElement:ecore::EObject) : notation::Shape { |
| return object notation::Shape { |
| element := packageElement; |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| type := SIGNAL_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(SIGNAL_NAME_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(SIGNAL_FLOATING_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(SIGNAL_ATTRIBUTE_COMPARTMENT_SYSML14, TRUE); |
| } else { |
| type := SIGNAL_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| children += createDefaultNameLabelDecorationNode(SIGNAL_NAME_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| children += createDefaultFloatingNameLabelDecorationNode(SIGNAL_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| |
| // Create and set the default BasicCompartments |
| children += createDefaultBasicCompartement(SIGNAL_ATTRIBUTE_COMPARTMENT_CN_SYSML14, TRUE); |
| }; |
| } |
| } |
| |
| helper createTimeObservationShape(parent:notation::View, dataType:ecore::EObject) : notation::Shape { |
| return object notation::Shape { |
| element := dataType; |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| if (not isCN) { |
| type := TIMEOBSERVATION_SHAPE_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| var floatingNameLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(TIMEOBSERVATION_FLOATING_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| floatingNameLabel.layoutConstraint.oclAsType(notation::Location).x := 25; |
| floatingNameLabel.layoutConstraint.oclAsType(notation::Location).y := 3; |
| children += floatingNameLabel; |
| |
| var stereotypeLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(TIMEOBSERVATION_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| stereotypeLabel.layoutConstraint.oclAsType(notation::Location).x := 25; |
| stereotypeLabel.layoutConstraint.oclAsType(notation::Location).y := -10; |
| children += stereotypeLabel; |
| } else { |
| type := TIMEOBSERVATION_SHAPE_CN_SYSML14; |
| |
| // Create and set the default DecorationNodes |
| var floatingNameLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(TIMEOBSERVATION_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| floatingNameLabel.layoutConstraint.oclAsType(notation::Location).x := 25; |
| floatingNameLabel.layoutConstraint.oclAsType(notation::Location).y := 3; |
| children += floatingNameLabel; |
| |
| var stereotypeLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(TIMEOBSERVATION_STEREOTYPE_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| stereotypeLabel.layoutConstraint.oclAsType(notation::Location).x := 25; |
| stereotypeLabel.layoutConstraint.oclAsType(notation::Location).y := -10; |
| children += stereotypeLabel; |
| }; |
| } |
| } |
| |
| helper createNamedElementDefaultShape(namedElement:ecore::EObject) : notation::Shape { |
| return object notation::Shape { |
| element := namedElement; |
| type := NAMEDELEMENT_DEFAULTSHAPE; |
| children += createDefaultNameLabelDecorationNode(NAMEDELEMENT_NAME_LABEL_DECORATIONNODE_SYSML14); |
| } |
| } |
| |
| // this allows to create the default association decoration nodes |
| helper createDefaultInformationFlowDecorationNodes(inout connector:notation::Connector) { |
| connector.type := INFORMATIONFLOW_EDGE_SYSML14; |
| var informationFlowConveyedLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(INFORMATIONFLOW_CONVEYED_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| informationFlowConveyedLabel.layoutConstraint.oclAsType(notation::Location).y := 30; |
| connector.children += informationFlowConveyedLabel; |
| |
| var informationFlowStereotypeLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(INFORMATIONFLOW_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| informationFlowStereotypeLabel.layoutConstraint.oclAsType(notation::Location).y := 15; |
| connector.children += informationFlowStereotypeLabel; |
| |
| var informationFlowNameLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(INFORMATIONFLOW_NAME_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| informationFlowNameLabel.layoutConstraint.oclAsType(notation::Location).y := 40; |
| connector.children += informationFlowNameLabel; |
| |
| connector.styles += object notation::FontStyle{}; |
| } |
| |
| // this allows to create the default association decoration nodes |
| helper createDefaultAssociationDecorationNodes(inout connector:notation::Connector) { |
| connector.type := ASSOCIATION_EDGE_SYSML14; |
| |
| var associationStereotypeLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(ASSOCIATION_STEREOTYPE_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| associationStereotypeLabel.layoutConstraint.oclAsType(notation::Location).y := -20; |
| connector.children += associationStereotypeLabel; |
| |
| var associationNameLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(ASSOCIATION_NAME_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| associationNameLabel.layoutConstraint.oclAsType(notation::Location).y := 20; |
| connector.children += associationNameLabel; |
| |
| var sourceRoleLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(ASSOCIATION_SOURCEROLE_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| sourceRoleLabel.layoutConstraint.oclAsType(notation::Location).y := 20; |
| connector.children += sourceRoleLabel; |
| |
| var targetRoleLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(ASSOCIATION_TARGETROLE_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| targetRoleLabel.layoutConstraint.oclAsType(notation::Location).y := -20; |
| connector.children += targetRoleLabel; |
| |
| var associationSourceMultiplicityLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(ASSOCIATION_SOURCEMULTIPLICITY_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| associationSourceMultiplicityLabel.layoutConstraint.oclAsType(notation::Location).y := 20; |
| connector.children += associationSourceMultiplicityLabel; |
| |
| var associationTargetMultiplicityLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(ASSOCIATION_TARGETMULTIPLICITY_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| associationTargetMultiplicityLabel.layoutConstraint.oclAsType(notation::Location).y := -20; |
| connector.children += associationTargetMultiplicityLabel; |
| |
| connector.styles += object notation::FontStyle{}; |
| } |
| |
| // this allows to create the default association class decoration nodes |
| helper createDefaultAssociationClassDecorationNodes(inout connector:notation::Connector) { |
| connector.type := ASSOCIATIONCLASS_EDGE_SYSML14; |
| |
| var associationClassSourceRoleLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(ASSOCIATIONCLASS_SOURCEROLE_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| associationClassSourceRoleLabel.layoutConstraint.oclAsType(notation::Location).y := -20; |
| connector.children += associationClassSourceRoleLabel; |
| |
| var associationClassTargetRoleLabel:notation::DecorationNode := createDefaultFloatingNameLabelDecorationNode(ASSOCIATIONCLASS_TARGETROLE_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| associationClassTargetRoleLabel.layoutConstraint.oclAsType(notation::Location).y := 20; |
| connector.children += associationClassTargetRoleLabel; |
| |
| connector.styles += object notation::FontStyle{}; |
| } |
| |
| helper modifyAssociationClassShape(inout associationClassShape:notation::Shape, parent:notation::View) { |
| var isCN:Boolean := not parent.oclIsTypeOf(notation::Diagram); |
| |
| // If the shape is not in the diagram, this is a Child node |
| if (not isCN) { |
| associationClassShape.type := ASSOCIATIONCLASS_SHAPE_SYSML14; |
| associationClassShape.children += createDefaultNameLabelDecorationNode(ASSOCIATIONCLASS_NAME_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| associationClassShape.children += createDefaultFloatingNameLabelDecorationNode(ASSOCIATIONCLASS_FLOATING_LABEL_DECORATIONNODE_SYSML14, TRUE); |
| associationClassShape.children += createDefaultBasicCompartement(ASSOCIATIONCLASS_ATTRIBUTE_COMPARTMENT_SYSML14, TRUE); |
| associationClassShape.children += createDefaultBasicCompartement(ASSOCIATIONCLASS_OPERATION_COMPARTMENT_SYSML14, TRUE); |
| associationClassShape.children += createDefaultBasicCompartement(ASSOCIATIONCLASS_NESTEDCLASSIFIER_COMPARTMENT_SYSML14, TRUE); |
| } else { |
| associationClassShape.type := ASSOCIATIONCLASS_SHAPE_CN_SYSML14; |
| associationClassShape.children += createDefaultNameLabelDecorationNode(ASSOCIATIONCLASS_NAME_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| associationClassShape.children += createDefaultFloatingNameLabelDecorationNode(ASSOCIATIONCLASS_FLOATING_LABEL_DECORATIONNODE_CN_SYSML14, TRUE); |
| associationClassShape.children += createDefaultBasicCompartement(ASSOCIATIONCLASS_ATTRIBUTE_COMPARTMENT_CN_SYSML14, TRUE); |
| associationClassShape.children += createDefaultBasicCompartement(ASSOCIATIONCLASS_OPERATION_COMPARTMENT_CN_SYSML14, TRUE); |
| associationClassShape.children += createDefaultBasicCompartement(ASSOCIATIONCLASS_NESTEDCLASSIFIER_COMPARTMENT_CN_SYSML14, TRUE); |
| }; |
| } |