diff options
Diffstat (limited to 'extraplugins/diagram-definition/org.eclipse.papyrus.umldi2dg/transforms/UmlCompartments.qvto')
-rw-r--r-- | extraplugins/diagram-definition/org.eclipse.papyrus.umldi2dg/transforms/UmlCompartments.qvto | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/extraplugins/diagram-definition/org.eclipse.papyrus.umldi2dg/transforms/UmlCompartments.qvto b/extraplugins/diagram-definition/org.eclipse.papyrus.umldi2dg/transforms/UmlCompartments.qvto deleted file mode 100644 index 8539bbd12aa..00000000000 --- a/extraplugins/diagram-definition/org.eclipse.papyrus.umldi2dg/transforms/UmlCompartments.qvto +++ /dev/null @@ -1,129 +0,0 @@ -/** - * Copyright (c) 2014 CEA LIST. - * - * 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: - * CEA LIST - Initial API and implementation - */ -import UmlUtilities; - -modeltype DC uses "http://www.omg.org/spec/DD/20110901/DC"; -modeltype DG uses "http://www.omg.org/spec/DD/20110901/DG"; -modeltype DI uses "http://www.omg.org/spec/DD/20110901/DI"; -modeltype UMLDI uses "http://www.omg.org/spec/UML/20131001/UMLDI"; -modeltype UML uses "http://www.eclipse.org/uml2/4.0.0/UML"; - -library UmlCompartments; - -mapping UML::Activity::compartmentToGraphicalElement(compartment : UMLDI::UmlCompartment) : DG::GraphicalElement { - init { - if not compartment.owningUmlDiagramElement.oclAsType(UMLDI::ClassifierShape).useClassifierNotation and - (compartment.oclIsKindOf(UMLDI::ActivityNodeCompartment) or compartment.oclIsKindOf(UMLDI::OwnedBehaviorCompartment)) then - result := object DG::Group {} - else - result := self.map compartmentToDefault(compartment) - endif; - } -} - -mapping UML::Element::compartmentToGraphicalElement(compartment : UMLDI::UmlCompartment) : DG::GraphicalElement { - init { - if compartment.oclIsKindOf(TemplateParameterCompartment) then - result := self.map templateParameterCompartmentToGraphicalElement(compartment.oclAsType(TemplateParameterCompartment)) - else if compartment.oclIsKindOf(RegionCompartment) then - result := self.map regionCompartmentToGraphicalElement(compartment.oclAsType(RegionCompartment)) - else if compartment.oclIsKindOf(SubpartitionCompartment) then - result := self.map subpartitionCompartmentToGraphicalElement(compartment.oclAsType(SubpartitionCompartment)) - else if compartment.oclIsKindOf(StereotypeCompartment) then - result := self.map stereotypeCompartmentToGraphicalElement(compartment.oclAsType(StereotypeCompartment)) - else - result := self.map compartmentToDefault(compartment) - endif endif endif endif; - } -} - -mapping UML::Element::compartmentToDefault(compartment : UMLDI::UmlCompartment) : DG::GraphicalElement { - init { - if self.hasNoSeparator(compartment) then - result := object DG::Group {} - else - result := compartmentSeparator(compartment) - endif; - } -} - -mapping UML::Element::templateParameterCompartmentToGraphicalElement(compartment : UMLDI::TemplateParameterCompartment) : DG::GraphicalElement { - init { - result := object DG::Rectangle { - bounds := compartment.bounds.clone().oclAsType(DC::Bounds); - _class := "dashed"; - } - } -} - -mapping UML::Element::regionCompartmentToGraphicalElement(compartment : UMLDI::RegionCompartment) : DG::GraphicalElement { - init { - result := if compartment.topUmlDiagramElement->size() > 1 then - compartmentSeparator(compartment) - else - object DG::Group {} - endif; - } -} - -mapping UML::Element::subpartitionCompartmentToGraphicalElement(compartment : UMLDI::SubpartitionCompartment) : DG::GraphicalElement { - init { - result := if compartment.owningUmlDiagramElement.umlModelElement.oclAsType(UML::ActivityPartition).isDimension then - object DG::Group {} - else if compartment.owningUmlDiagramElement.oclAsType(UMLDI::ActivityPartitionShape).isVertical then - compartmentSeparator(compartment) - else - compartmentSeparatorVertical(compartment) - endif endif; - } -} - -mapping UML::Element::stereotypeCompartmentToGraphicalElement(compartment : UMLDI::StereotypeCompartment) : DG::GraphicalElement { - init { - var stereotype := self.oclAsType(UML::Stereotype); - result := object DG::Group { - member += compartmentSeparator(compartment); - member += object DG::Text { - data := replace('', stereotype.name, '«<n>»'); - anchor := DG::TextAnchor::middle; - bounds := compartment.bounds; - }; - }; - } -} - - -query UML::Element::hasNoSeparator(compartment : UMLDI::UmlCompartment) : Boolean { - return compartment.oclIsKindOf(UMLDI::SubvertexCompartment) or - compartment.oclIsKindOf(UMLDI::ParameterCompartment) or - compartment.oclIsKindOf(UMLDI::PreConditionCompartment) or - compartment.oclIsKindOf(UMLDI::PostConditionCompartment) or - compartment.oclIsKindOf(UMLDI::ActivityNodeCompartment) or - compartment.oclIsKindOf(UMLDI::SubfragmentCompartment); -} - -helper compartmentSeparator(compartment : UMLDI::UmlCompartment) : DG::GraphicalElement { - var b := compartment.bounds; - return object DG::Line { - start := object DC::Point { x := b.x; y := b.y; }; - _end := object DC::Point { x := b.x + b.width; y := b.y; }; - } -} - -helper compartmentSeparatorVertical(compartment : UMLDI::UmlCompartment) : DG::GraphicalElement { - var b := compartment.bounds; - return object DG::Line { - start := object DC::Point { x := b.x; y := b.y; }; - _end := object DC::Point { x := b.x; y := b.y + b.height; }; - } -} - |