Skip to content

Commit

Permalink
[2132] Add new closed arrow with dots to diagram arrow styles
Browse files Browse the repository at this point in the history
Bug: #2132
Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
  • Loading branch information
AxelRICHARD committed Jun 30, 2023
1 parent 35cb381 commit 587d2e3
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 6 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,18 @@ image:doc/images/Widget_Help_Tooltip.png[Example of a help tooltip on a widget]
- https://github.com/eclipse-sirius/sirius-components/issues/2083[#2083] [diagram] Add support for edge markers
- https://github.com/eclipse-sirius/sirius-components/issues/2086[#2086] [diagram] Add a panel with the default diagram actions
- https://github.com/eclipse-sirius/sirius-components/issues/2087[#2087] [diagram] Add support for snap to grid
<<<<<<< Upstream, based on origin/master
- https://github.com/eclipse-sirius/sirius-components/issues/2115[#2115] [form] Add the possibility to choose the label position on checkbox widget.
Note that the default position changes from top to end. +
before : image:doc/screenshots/checkboxLabelPlacementBefore.png[checkboxLabelPlacementTop] after : image:doc/screenshots/checkboxLabelPlacementAfter.png[checkboxLabelPlacementEnd]
=======
- https://github.com/eclipse-sirius/sirius-components/issues/2121[#2121] [diagram] Add new closed arrow with vertical bar to diagram arrow styles
+
image:doc/images/Diagram_closed_arrow_with_vertical_bar.png[closed arrow with vertical bar]
+
- https://github.com/eclipse-sirius/sirius-components/issues/2132[#2132] [diagram] Add new closed arrow with dots to diagram arrow styles
+
image:doc/images/Diagram_closed_arrow_with_dots.png[closed arrow with dots]
+

>>>>>>> e98d973 [2121] Add new closed arrow with vertical bar to diagram arrow styles

== v2023.6.0

Expand Down
Binary file added doc/images/Diagram_closed_arrow_with_dots.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ enum ArrowStyle {
FillCircle
CrossedCircle
ClosedArrowWithVerticalBar
ClosedArrowWithDots
}

type Ratio {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
* @author hmarchadour
*/
public enum ArrowStyle {
None, OutputArrow, InputArrow, OutputClosedArrow, InputClosedArrow, OutputFillClosedArrow, InputFillClosedArrow, Diamond, FillDiamond, InputArrowWithDiamond, InputArrowWithFillDiamond, Circle, FillCircle, CrossedCircle, ClosedArrowWithVerticalBar
None, OutputArrow, InputArrow, OutputClosedArrow, InputClosedArrow, OutputFillClosedArrow, InputFillClosedArrow, Diamond, FillDiamond, InputArrowWithDiamond, InputArrowWithFillDiamond, Circle, FillCircle, CrossedCircle, ClosedArrowWithVerticalBar, ClosedArrowWithDots
}
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ export enum GQLArrowStyle {
FillCircle = 'FillCircle',
CrossedCircle = 'CrossedCircle',
ClosedArrowWithVerticalBar = 'ClosedArrowWithVerticalBar',
ClosedArrowWithDots = 'ClosedArrowWithDots',
}

export interface GQLDeleteFromDiagramVariables {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export enum ArrowStyle {
FillCircle = 'FillCircle',
CrossedCircle = 'CrossedCircle',
ClosedArrowWithVerticalBar = 'ClosedArrowWithVerticalBar',
ClosedArrowWithDots = 'ClosedArrowWithDots',
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ export class EdgeView extends PolylineEdgeView {
p2,
styleObjectCopy
);
} else if (arrowStyle === 'ClosedArrowWithDots') {
arrow = this.buildClosedArrowWithDots(basicArrowPath + 'z', p1, p2, styleObjectCopy, strokeWidth);
}

return [arrow];
Expand Down Expand Up @@ -346,6 +348,45 @@ export class EdgeView extends PolylineEdgeView {
);
}

buildClosedArrowWithDots(path: string, p1: Point, p2: Point, styleObject, strokeWidth: number) {
const pathStyle = { ...styleObject };
pathStyle.fill = '#ffffff';
const translateX = p2.x;
const translateY = p2.y;
const rotationAngle = toDegrees(angle(p1, p2));
const rotationX = p2.x;
const rotationY = p2.y;
let rotation = '';
if (rotationAngle !== undefined) {
if (rotationX !== undefined && rotationY !== undefined) {
rotation = `rotate(${rotationAngle} ${rotationX} ${rotationY})`;
} else {
rotation = `rotate(${rotationAngle})`;
}

const transform = `${rotation} translate(${translateX} ${translateY})`;
return (
<g>
<path class-edge={true} class-arrow={true} d={path} transform={transform} style={pathStyle} />
<circle
transform={transform}
cx={-7.5 - strokeWidth * 2}
cy={-2.5 - strokeWidth}
r={strokeWidth * 0.75}
style={styleObject}
/>
<circle
transform={transform}
cx={-7.5 - strokeWidth * 2}
cy={2.5 + strokeWidth}
r={strokeWidth * 0.75}
style={styleObject}
/>
</g>
);
}
}

buildArrowPath(
path: string,
translateX: number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ _UI_ArrowStyle_Circle_literal = Circle
_UI_ArrowStyle_FillCircle_literal = FillCircle
_UI_ArrowStyle_CrossedCircle_literal = CrossedCircle
_UI_ArrowStyle_ClosedArrowWithVerticalBar_literal = ClosedArrowWithVerticalBar
_UI_ArrowStyle_ClosedArrowWithDots_literal = ClosedArrowWithDots
_UI_LayoutDirection_Column_literal = Column
_UI_LineStyle_Solid_literal = Solid
_UI_LineStyle_Dash_literal = Dash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,15 @@ public enum ArrowStyle implements Enumerator {
* @generated
* @ordered
*/
CLOSED_ARROW_WITH_VERTICAL_BAR(14, "ClosedArrowWithVerticalBar", "ClosedArrowWithVerticalBar");
CLOSED_ARROW_WITH_VERTICAL_BAR(14, "ClosedArrowWithVerticalBar", "ClosedArrowWithVerticalBar"),
/**
* The '<em><b>Closed Arrow With Dots</b></em>' literal object. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #CLOSED_ARROW_WITH_DOTS_VALUE
* @generated
* @ordered
*/
CLOSED_ARROW_WITH_DOTS(15, "ClosedArrowWithDots", "ClosedArrowWithDots");

/**
* The '<em><b>None</b></em>' literal value. <!-- begin-user-doc --> <!-- end-user-doc -->
Expand Down Expand Up @@ -312,13 +320,23 @@ public enum ArrowStyle implements Enumerator {
*/
public static final int CLOSED_ARROW_WITH_VERTICAL_BAR_VALUE = 14;

/**
* The '<em><b>Closed Arrow With Dots</b></em>' literal value. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #CLOSED_ARROW_WITH_DOTS
* @model name="ClosedArrowWithDots"
* @generated
* @ordered
*/
public static final int CLOSED_ARROW_WITH_DOTS_VALUE = 15;

/**
* An array of all the '<em><b>Arrow Style</b></em>' enumerators. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
private static final ArrowStyle[] VALUES_ARRAY = new ArrowStyle[] { NONE, OUTPUT_ARROW, INPUT_ARROW, OUTPUT_CLOSED_ARROW, INPUT_CLOSED_ARROW, OUTPUT_FILL_CLOSED_ARROW, INPUT_FILL_CLOSED_ARROW,
DIAMOND, FILL_DIAMOND, INPUT_ARROW_WITH_DIAMOND, INPUT_ARROW_WITH_FILL_DIAMOND, CIRCLE, FILL_CIRCLE, CROSSED_CIRCLE, CLOSED_ARROW_WITH_VERTICAL_BAR, };
DIAMOND, FILL_DIAMOND, INPUT_ARROW_WITH_DIAMOND, INPUT_ARROW_WITH_FILL_DIAMOND, CIRCLE, FILL_CIRCLE, CROSSED_CIRCLE, CLOSED_ARROW_WITH_VERTICAL_BAR, CLOSED_ARROW_WITH_DOTS, };

/**
* A public read-only list of all the '<em><b>Arrow Style</b></em>' enumerators. <!-- begin-user-doc --> <!--
Expand Down Expand Up @@ -407,6 +425,8 @@ public static ArrowStyle get(int value) {
return CROSSED_CIRCLE;
case CLOSED_ARROW_WITH_VERTICAL_BAR_VALUE:
return CLOSED_ARROW_WITH_VERTICAL_BAR;
case CLOSED_ARROW_WITH_DOTS_VALUE:
return CLOSED_ARROW_WITH_DOTS;
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1914,6 +1914,7 @@ public void initializePackageContents() {
this.addEEnumLiteral(this.arrowStyleEEnum, ArrowStyle.FILL_CIRCLE);
this.addEEnumLiteral(this.arrowStyleEEnum, ArrowStyle.CROSSED_CIRCLE);
this.addEEnumLiteral(this.arrowStyleEEnum, ArrowStyle.CLOSED_ARROW_WITH_VERTICAL_BAR);
this.addEEnumLiteral(this.arrowStyleEEnum, ArrowStyle.CLOSED_ARROW_WITH_DOTS);

this.initEEnum(this.layoutDirectionEEnum, LayoutDirection.class, "LayoutDirection");
this.addEEnumLiteral(this.layoutDirectionEEnum, LayoutDirection.COLUMN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<eLiterals name="FillCircle" value="12" literal="FillCircle"/>
<eLiterals name="CrossedCircle" value="13" literal="CrossedCircle"/>
<eLiterals name="ClosedArrowWithVerticalBar" value="14" literal="ClosedArrowWithVerticalBar"/>
<eLiterals name="ClosedArrowWithDots" value="15" literal="ClosedArrowWithDots"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="LayoutDirection">
<eLiterals name="Column" literal="Column"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<genEnumLiterals ecoreEnumLiteral="diagram.ecore#//ArrowStyle/FillCircle"/>
<genEnumLiterals ecoreEnumLiteral="diagram.ecore#//ArrowStyle/CrossedCircle"/>
<genEnumLiterals ecoreEnumLiteral="diagram.ecore#//ArrowStyle/ClosedArrowWithVerticalBar"/>
<genEnumLiterals ecoreEnumLiteral="diagram.ecore#//ArrowStyle/ClosedArrowWithDots"/>
</genEnums>
<genEnums typeSafeEnumCompatible="false" ecoreEnum="diagram.ecore#//LayoutDirection">
<genEnumLiterals ecoreEnumLiteral="diagram.ecore#//LayoutDirection/Column"/>
Expand Down

0 comments on commit 587d2e3

Please sign in to comment.