Skip to content

Commit

Permalink
[2121] Add new closed arrow with vertical bar to diagram arrow styles
Browse files Browse the repository at this point in the history
Bug: #2121
Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
  • Loading branch information
AxelRICHARD committed Jun 29, 2023
1 parent aea8529 commit 5fd6f9f
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 7 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.adoc
Expand Up @@ -59,13 +59,20 @@ Note that in the end, the message list will be the only way to return info in pa
Widgets which define such a help text have a new "?" icon next to their labels; the actual help text is accessible as a tooltip on this icon.
For View-based widgets, this materializes as an AQL `helpExpression`.
The help text can include multiple lines (separated by `\n`), but no text formatting.
:image:doc/images/Widget_Help_Tooltip.png[Example of a help tooltip on a widget]
+
image:doc/images/Widget_Help_Tooltip.png[Example of a help tooltip on a widget]
+
- https://github.com/eclipse-sirius/sirius-components/issues/2048[#2048] [diagram] Add a basic support for the resize. It is possible to reduce the size of a node less than the space needed to display all children.
- https://github.com/eclipse-sirius/sirius-components/issues/2064[#2064] [forms] Make the `IWidgetDescriptor` API more flexible.
- https://github.com/eclipse-sirius/sirius-components/issues/1618[#1618] [view] Split the view metamodel into dedicated subpackages.
- 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
- 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]
+


== v2023.6.0

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expand Up @@ -140,6 +140,7 @@ enum ArrowStyle {
Circle
FillCircle
CrossedCircle
ClosedArrowWithVerticalBar
}

type Ratio {
Expand Down
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2022 Obeo.
* Copyright (c) 2019, 2023 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand All @@ -18,5 +18,5 @@
* @author hmarchadour
*/
public enum ArrowStyle {
None, OutputArrow, InputArrow, OutputClosedArrow, InputClosedArrow, OutputFillClosedArrow, InputFillClosedArrow, Diamond, FillDiamond, InputArrowWithDiamond, InputArrowWithFillDiamond, Circle, FillCircle, CrossedCircle,
None, OutputArrow, InputArrow, OutputClosedArrow, InputClosedArrow, OutputFillClosedArrow, InputFillClosedArrow, Diamond, FillDiamond, InputArrowWithDiamond, InputArrowWithFillDiamond, Circle, FillCircle, CrossedCircle, ClosedArrowWithVerticalBar
}
Expand Up @@ -258,6 +258,7 @@ export enum GQLArrowStyle {
Circle = 'Circle',
FillCircle = 'FillCircle',
CrossedCircle = 'CrossedCircle',
ClosedArrowWithVerticalBar = 'ClosedArrowWithVerticalBar',
}

export interface GQLDeleteFromDiagramVariables {
Expand Down
Expand Up @@ -128,6 +128,7 @@ export enum ArrowStyle {
Circle = 'Circle',
FillCircle = 'FillCircle',
CrossedCircle = 'CrossedCircle',
ClosedArrowWithVerticalBar = 'ClosedArrowWithVerticalBar',
}

/**
Expand Down
Expand Up @@ -151,6 +151,7 @@ export class EdgeView extends PolylineEdgeView {
const offsetArrowPath = `m ${(5 + strokeWidth) * 2} 0 L ${(5 + strokeWidth) * 2 + (5 + strokeWidth)} ${
-3.5 - strokeWidth
} M ${(5 + strokeWidth) * 2} 0 L ${(5 + strokeWidth) * 2 + (5 + strokeWidth)} ${3.5 + strokeWidth}`;
const basicParallelLinePath = `m 0 0 m ${-1.5 - strokeWidth * 2} ${0 - strokeWidth} V ${3.5 + strokeWidth * 2}`;

let styleObjectCopy = { ...styleObject };

Expand Down Expand Up @@ -187,6 +188,13 @@ export class EdgeView extends PolylineEdgeView {
arrow = this.buildFillCircleArrow(p1, p2, styleObjectCopy, strokeWidth);
} else if (arrowStyle === 'CrossedCircle') {
arrow = this.buildCrossedCircleArrow(p1, p2, styleObjectCopy, strokeWidth);
} else if (arrowStyle === 'ClosedArrowWithVerticalBar') {
arrow = this.buildClosedArrowWithVerticalBar(
basicArrowPath + 'z ' + basicParallelLinePath,
p1,
p2,
styleObjectCopy
);
}

return [arrow];
Expand Down Expand Up @@ -279,6 +287,16 @@ export class EdgeView extends PolylineEdgeView {
return this.buildArrowPath(path, offsetX, offsetY, styleObject, rotationAngle, rotationX, rotationY);
}

buildClosedArrowWithVerticalBar(path: string, p1: Point, p2: Point, styleObject) {
styleObject.fill = '#ffffff';
const offsetX = p2.x;
const offsetY = p2.y;
const rotationAngle = toDegrees(angle(p1, p2));
const rotationX = p2.x;
const rotationY = p2.y;
return this.buildArrowPath(path, offsetX, offsetY, styleObject, rotationAngle, rotationX, rotationY);
}

buildInputArrowWithFillDiamond(path: string, p1: Point, p2: Point, styleObject, strokeWidth: number) {
const offsetX = p2.x + strokeWidth;
const offsetY = p2.y;
Expand Down
Expand Up @@ -69,15 +69,15 @@ public ResourceLocator getPluginResourceLocator() {
public static Implementation getPlugin() {
return plugin;
}

@Override
protected Object doGetImage(String key) throws IOException {
URL url = new URL(this.getBaseURL() + "icons/" + key + extensionFor(key));
InputStream inputStream = url.openStream();
inputStream.close();
return url;
}

/**
* Computes the file extension to be used with the key to specify an image resource.
*
Expand Down
Expand Up @@ -144,6 +144,7 @@ _UI_ArrowStyle_InputArrowWithFillDiamond_literal = InputArrowWithFillDiamond
_UI_ArrowStyle_Circle_literal = Circle
_UI_ArrowStyle_FillCircle_literal = FillCircle
_UI_ArrowStyle_CrossedCircle_literal = CrossedCircle
_UI_ArrowStyle_ClosedArrowWithVerticalBar_literal = ClosedArrowWithVerticalBar
_UI_LayoutDirection_Column_literal = Column
_UI_LineStyle_Solid_literal = Solid
_UI_LineStyle_Dash_literal = Dash
Expand Down
Expand Up @@ -151,7 +151,16 @@ public enum ArrowStyle implements Enumerator {
* @generated
* @ordered
*/
CROSSED_CIRCLE(13, "CrossedCircle", "CrossedCircle");
CROSSED_CIRCLE(13, "CrossedCircle", "CrossedCircle"),
/**
* The '<em><b>Closed Arrow With Vertical Bar</b></em>' literal object. <!-- begin-user-doc --> <!-- end-user-doc
* -->
*
* @see #CLOSED_ARROW_WITH_VERTICAL_BAR_VALUE
* @generated
* @ordered
*/
CLOSED_ARROW_WITH_VERTICAL_BAR(14, "ClosedArrowWithVerticalBar", "ClosedArrowWithVerticalBar");

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

/**
* The '<em><b>Closed Arrow With Vertical Bar</b></em>' literal value. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #CLOSED_ARROW_WITH_VERTICAL_BAR
* @model name="ClosedArrowWithVerticalBar"
* @generated
* @ordered
*/
public static final int CLOSED_ARROW_WITH_VERTICAL_BAR_VALUE = 14;

/**
* 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, };
DIAMOND, FILL_DIAMOND, INPUT_ARROW_WITH_DIAMOND, INPUT_ARROW_WITH_FILL_DIAMOND, CIRCLE, FILL_CIRCLE, CROSSED_CIRCLE, CLOSED_ARROW_WITH_VERTICAL_BAR, };

/**
* A public read-only list of all the '<em><b>Arrow Style</b></em>' enumerators. <!-- begin-user-doc --> <!--
Expand Down Expand Up @@ -386,6 +405,8 @@ public static ArrowStyle get(int value) {
return FILL_CIRCLE;
case CROSSED_CIRCLE_VALUE:
return CROSSED_CIRCLE;
case CLOSED_ARROW_WITH_VERTICAL_BAR_VALUE:
return CLOSED_ARROW_WITH_VERTICAL_BAR;
}
return null;
}
Expand Down
Expand Up @@ -1913,6 +1913,7 @@ public void initializePackageContents() {
this.addEEnumLiteral(this.arrowStyleEEnum, ArrowStyle.CIRCLE);
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.initEEnum(this.layoutDirectionEEnum, LayoutDirection.class, "LayoutDirection");
this.addEEnumLiteral(this.layoutDirectionEEnum, LayoutDirection.COLUMN);
Expand Down
Expand Up @@ -16,6 +16,7 @@
<eLiterals name="Circle" value="11" literal="Circle"/>
<eLiterals name="FillCircle" value="12" literal="FillCircle"/>
<eLiterals name="CrossedCircle" value="13" literal="CrossedCircle"/>
<eLiterals name="ClosedArrowWithVerticalBar" value="14"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="LayoutDirection">
<eLiterals name="Column" literal="Column"/>
Expand Down
Expand Up @@ -29,6 +29,7 @@
<genEnumLiterals ecoreEnumLiteral="diagram.ecore#//ArrowStyle/Circle"/>
<genEnumLiterals ecoreEnumLiteral="diagram.ecore#//ArrowStyle/FillCircle"/>
<genEnumLiterals ecoreEnumLiteral="diagram.ecore#//ArrowStyle/CrossedCircle"/>
<genEnumLiterals ecoreEnumLiteral="diagram.ecore#//ArrowStyle/ClosedArrowWithVerticalBar"/>
</genEnums>
<genEnums typeSafeEnumCompatible="false" ecoreEnum="diagram.ecore#//LayoutDirection">
<genEnumLiterals ecoreEnumLiteral="diagram.ecore#//LayoutDirection/Column"/>
Expand Down

0 comments on commit 5fd6f9f

Please sign in to comment.