Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

Add parsing penwidth attribute #3891

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from
Open

Conversation

geminoa
Copy link

@geminoa geminoa commented Mar 27, 2018

This update is for adding 'penwidth' attribute which defines the line width as 'width'. If both are exist, 'penwidth' is used and 'width' is discarded as described in [1].

[1] https://www.graphviz.org/doc/info/attrs.html#d:penwidth

As described in TODO, dotparser.js does not support 'arrowhead'
attribubte of edge.
This update is for adding 'dot' and 'tee'(bar) styles.
To support box arrowhead of graphviz, add Box endpoint class in
EndPoints.js and box attribute in dotparser.js.
To support diamond arrowhead of graphviz, add Diamond endpoint
class in EndPoints.js and diamond attribute in dotparser.js.
To support crow arrowhead of graphviz, add Crow endpoint
class in EndPoints.js and crow attribute in dotparser.js.
To support normal arrowhead of graphviz, add Triangle endpoint
class in EndPoints.js and normal attribute in dotparser.js.
To support curve arrowhead of graphviz, add Curve endpoint
class in EndPoints.js and curve attribute in dotparser.js.
To support inverted curve arrowhead of graphviz, add InvertedCurve
endpoint class in EndPoints.js and icurve attribute in
dotparser.js.
To support vee arrowhead of graphviz, add Vee endpoint class in
EndPoints.js and vee attribute in dotparser.js.
In createEdge(), accessing 'attr' causes an error if the edge has no
attribute and the value is null.
This update fixes bug for accessing null 'attr'.
Add followingn options for 'arrows.to.type'.

* box
* crow
* curve
* diamond
* inv_curve
* triangle
* inv_triangle
* vee
Add arrow types for the example.

'box', 'crow', 'curve', 'inv_curve', 'diamond', 'triangle',
'inv_triangle', 'vee'
Directional arrow has 'dir' attribute for defining direction of
'forward', 'back', 'both' or 'none'.

This update enables to 'dir' attribute. If you define an edge as
'a -> b[arrowhead=normal, dir=both]', arrowheads are depicted both
of source and destination.
This update is for comply with graphviz more strictly. As explained
in [1], graphviz has limitations for combination of arrow[head|tail]
and dir but dotparser.js does not behaviour as same.

[1] https://www.graphviz.org/doc/info/attrs.html#h:undir_note

If attribute list includes 'dir', following cases just be supported.
  1. both or none + arrowhead, arrowtail
  2. forward + arrowhead (arrowtail is not affedted)
  3. back + arrowtail (arrowhead is not affected)

In this update, parsed attributes is pushed 'attr_list' at once and
setValue() is not called in while loop in parseAttributeList().
setValue() is called after while loop ends.
It is because for checking attributes which change the same attribute
of vis. For instance, both of 'arrowhead' and 'dir' (edge style defined
in DOT) make changes for the same 'arrows' attribute in vis. If
setValue() is called from while loop, previous change is overwritten.
To reduce the number of statements of parseAttributeList(), move parsing
'dir' attribute to function parseDirAttribute() because it is going to
reach max-statements limitation of lint.
'penwidth' defines the line width as 'width'. If both are exist,
'penwidth' is used and 'width' is discarded as described in [1].

[1] https://www.graphviz.org/doc/info/attrs.html#d:penwidth
Merge remote-tracking branch 'upstream/develop' into add_penwidth
@micahstubbs
Copy link

@geminoa it looks like this PR also includes all or most of the work in #3888

could you untangle them, or send a fresh PR that contains only the penwidth attribute changes?

@micahstubbs
Copy link

@geminoa, also, could you include an example that uses the new support for the penwidth attribute? thanks!

@geminoa
Copy link
Author

geminoa commented Sep 4, 2018

@micahstubbs , OK, I'll update it.

@micahstubbs
Copy link

@geminoa this might be helpful - here is a view that compares the add_dir branch to the add_penwidth branch

geminoa/vis@add_dir...add_penwidth

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants