Skip to content

Conversation

@tbouffard
Copy link
Member

@tbouffard tbouffard commented Apr 27, 2020

This PR introduces the rendering of the User Task and add an icon based on the person octicons. Please note that this icon may not be the final one and may be replaced in the future.

In addition, the following internals are updated or added as part of this PR:

  • generalize tasks rendering
  • introduce an easy way to render icon whatever its original size (scale factor tooling)
  • integration of a SVG based icon into the lib
  • usage of the mxgraph-svg2shape / svg2xml tools to simplify the SVG icon integration and to collect issue feedbacks

Closes #143

@tbouffard tbouffard added enhancement New feature or request WIP 🚧 Pull request in progress and/or not ready for review. Used in addition to marking it as draft depends on another PR ⚠️ Pull request depending on another one. The depending must be merged first BPMN rendering Something about the way the lib is rendering BPMN elements labels Apr 27, 2020
@tbouffard
Copy link
Member Author

Pior user task rendering
1_pool_3_lanes_timer none_start_and_terminate none_end_event_01_no_user_task_con

New user task rendering
1_pool_3_lanes_timer none_start_and_terminate none_end_event_02_with_user_task_con

@tbouffard tbouffard requested a review from NathalieC April 27, 2020 15:03
@tbouffard
Copy link
Member Author

tbouffard commented Apr 27, 2020

SVG icon transformation notice
Here is my feedbacks about my attempts to convert the person octicons using the svg2xml tool.

I have decided to fork it (see mxgraph-svg2shape) because

  • on Ubuntu, I wasn't able to make it generate files in the right destination folder
  • I didn't get any enough information on error (see below for the error I faced)
  • it was not possible to know if/where (especially because of the destination issue on Ubuntu) the file was generated (no log, nor UI feedbacks)
  • it could only generate xml stencil (that I had to convert into JS/TS code)
  • it used a old fashioned Ant build that make me hard to upgrade mxgraph java lib (it used a 2.1.0.8 version released on 2013-08-05!) and add new libs (to add tests for instance) without manually manage dependencies
  • it doesn't provide a real CLI, the GUI showup every time
  • ..... to long to list everything

I still hope being to contribute some stuffs back to the upstream if it is still supported and accept contributions

Issues faced
Passing the original person.svg to svg2xml, throws an exception (the 'path param' error details are only available in mxgraph-svg2shape)

java.lang.RuntimeException: Unable to get path param from 'a .998 0.998 0 01 -0.998 0.998 H' for index 7
....
java.lang.NumberFormatException: For input string: "H"
	at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054)
	at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
	at java.base/java.lang.Double.parseDouble(Double.java:543)
	at com.mxgraph.svg2xml.Shape2Xml.getPathParam(Shape2Xml.java:1561)

Notice that the original file doesn't display correctly with Ubuntu Images Viewer. Here is what I got

person_ubuntu_viewer

Putting explicit leading 0 (.522 --> 0.522) and spaces between numbers (as suggested in jgraph/svg2xml#2 (comment)) make it goes a step further
For instance

a .998,.998 0 0,1 -.998,.998 1.001
a 0.998 0.998 0 0 1 -0.998 0.998

The Ubuntu Images Viewer correctly displays the icon. mxgraph-svg2shape generated a new kind of error

In the file, we found 'c' command with 12 arguments

  • equivalent to 2 'c' command with 6 arguments
  • svg2xml doesn't like this 12 arguments form, so parsing fail
  • It omits the arguments after the 6th and if a 's' command follows, it is translated into 'c' command
  • 's' has 4 arguments, 'c' has 6 arguments so svg2xml takes the 2 following arguments including a letter, so number parsing fails

Example

c -0.841 -0.62 -0.944 -1.59 -1 -4 0.173 -2.413 1.867 -3 3 -3
s 2.827 0.586 3 3
c -0.056 2.41 -0.159 3.38 -1 4 -0.229 0.59 0 1 0 1

This leads to the following parsing for the line with 's'

c 2.827 0.586 3 3 c -0.056

The 5th argument is a letter, svg2xml tries to parse it as a number, so failure occurs

Splitting the 12 arguments 'c' command into 2 'c' commands with 6 arguments each made svg2xml happy

<path fill-rule="evenodd" d="
		M 12 14.002
		a 0.998 0.998 0 0 1 -0.998 0.998
		H 1.001
		A 1 1 0 0 1 0 13.999
		V 13
		c 0 -2.633 4 -4 4 -4
		s 0.229 -0.409 0 -1
		c -0.841 -0.62 -0.944 -1.59 -1 -4
    	        c 0.173 -2.413 1.867 -3 3 -3
		s 2.827 0.586 3 3
		c -0.056 2.41 -0.159 3.38 -1 4
    	        c -0.229 0.59 0 1 0 1
		s 4 1.367 4 4
		v 1.002
		z"/>

@tbouffard tbouffard marked this pull request as ready for review April 28, 2020 04:27
@tbouffard tbouffard removed the WIP 🚧 Pull request in progress and/or not ready for review. Used in addition to marking it as draft label Apr 28, 2020
@tbouffard tbouffard force-pushed the 143-Render_User_Task branch from 534b637 to 6855607 Compare April 28, 2020 14:06
@tbouffard tbouffard added the rebase needed 💥 Pull request that must be rebased on the latest master commit prior being reviewed or merged label Apr 29, 2020
@tbouffard tbouffard force-pushed the 143-Render_User_Task branch from 6855607 to da38d9e Compare April 29, 2020 08:56
@tbouffard tbouffard removed depends on another PR ⚠️ Pull request depending on another one. The depending must be merged first rebase needed 💥 Pull request that must be rebased on the latest master commit prior being reviewed or merged labels Apr 29, 2020
@tbouffard tbouffard merged commit 90f3ccf into master Apr 29, 2020
@tbouffard tbouffard deleted the 143-Render_User_Task branch April 29, 2020 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BPMN rendering Something about the way the lib is rendering BPMN elements enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Render User task

4 participants