Bug 441352 - Add support for polygon-based node shapes (DOT Editor and DOT Graph View)
Summary: Add support for polygon-based node shapes (DOT Editor and DOT Graph View)
Status: RESOLVED FIXED
Alias: None
Product: GEF
Classification: Tools
Component: GEF DOT (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 5.3.1 (2020-09)   Edit
Assignee: gef-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2014-08-07 09:54 EDT by Alexander Nyßen CLA
Modified: 2020-07-25 00:53 EDT (History)
2 users (show)

See Also:


Attachments
Add Xtext editor support for polygon based node shapes (38.16 KB, patch)
2016-04-11 13:28 EDT, Tamas Miklossy CLA
no flags Details | Diff
Add Xtext editor support for polygon/record based node shapes (38.34 KB, patch)
2016-04-12 13:53 EDT, Tamas Miklossy CLA
nyssen: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Nyßen CLA 2014-08-07 09:54:28 EDT
To augment our support for rendering DOT-files, it would be nice if we would support to render the basic shape geometries defined by GraphViz: http://www.graphviz.org/doc/info/shapes.html. 

As JavaFX and our GeometryNode can now be used or rendering, at least the basic shapes will be easy to support in Zest.FX.UI DotGraph. Of course we need to ensure that the DOT-Parser (DOT/DOT.UI) is capable of dealing with the related DOT-language constructs, and that respective properties are defined on the Graph-level.
Comment 1 Alexander Nyßen CLA 2014-12-09 12:59:34 EST
Changed title to indicate that here, only polygon-based shapes are to be supported, whereas support for record-based shapes is handled in bug #454629 and support for html-like labels is addressed in bug #321775. 

Support will have to include proper handling in the DOT editor (syntax highlighting, content assist), which is already capable of parsing a DOT file that contains such shapes, etc. as well as the Graph viewer (rendering support).
Comment 2 Tamas Miklossy CLA 2016-04-09 03:48:20 EDT
The latest stable version of Graphviz 2.38.0 can not render the "cylinder" node shape resulting in mapping this to the supported "box" node shape. 

Console Warning Message:
Errors from dot call: Warning: using box for unknown shape cylinder

Graphviz 2.38.0 was released on 13.04.2014. The feature request "0001867: Database node shape" was implemented later, on 12.02.2016.
http://www.graphviz.org/mantisbt/view.php?id=1867
Comment 3 Tamas Miklossy CLA 2016-04-11 13:28:00 EDT
Created attachment 260865 [details]
Add Xtext editor support for polygon based node shapes

I uploaded a patch with the following improvements:

[441352] Add xtext-editor support for polygon-based node shapes

- Define the dot shape grammar within the DotShape.xtext file and integrate it into the GenerateDot.mwe2 generation workflow.
- Add support for the "distortion", "shape", "sides" and "skew" dot attributes within the DotAttributes.java.
- Extend the DotInterperter to process these attributes.
- Extend the DotJavaValidator to validate these attributes.
- Define a primitive value parser capable of processing int values.
- Add nodeshapes_polygon_based.dot sample file.
- Define corresponding test cases within the DotParserTest/DotValidatorTest classes.

Hereby I confirm that my contribution complies with https://www.eclipse.org/legal/CoO.php.
Comment 4 Alexander Nyßen CLA 2016-04-12 11:27:37 EDT
(In reply to Tamas Miklossy from comment #3)
> Created attachment 260865 [details]
> Add Xtext editor support for polygon based node shapes
> 
> I uploaded a patch with the following improvements:
> 
> [441352] Add xtext-editor support for polygon-based node shapes
> 
> - Define the dot shape grammar within the DotShape.xtext file and integrate
> it into the GenerateDot.mwe2 generation workflow.
> - Add support for the "distortion", "shape", "sides" and "skew" dot
> attributes within the DotAttributes.java.
> - Extend the DotInterperter to process these attributes.
> - Extend the DotJavaValidator to validate these attributes.
> - Define a primitive value parser capable of processing int values.
> - Add nodeshapes_polygon_based.dot sample file.
> - Define corresponding test cases within the DotParserTest/DotValidatorTest
> classes.
> 
> Hereby I confirm that my contribution complies with
> https://www.eclipse.org/legal/CoO.php.

Thanks Tamas. Looks good so far, but I assume we have to disable the validation unless the grammar supports all possible shapes. Otherwise, record-based shapes would be rejected, right? Would you mind to extend the grammar (to include record-based shapes) first, so validation of shape attributes would be fine?
Comment 5 Tamas Miklossy CLA 2016-04-12 13:53:17 EDT
Created attachment 260900 [details]
Add Xtext editor support for polygon/record based node shapes

I extended the Shape.xtext grammar to also accept record-based nodes shapes.
Now, the validator also accepts shape="record" and shape="Mrecord" values.

Hereby I confirm that my contribution complies with https://www.eclipse.org/legal/CoO.php.
Comment 6 Alexander Nyßen CLA 2016-04-13 05:43:24 EDT
Thanks Tamas, I released your patch to origin/master.
Comment 7 Alexander Nyßen CLA 2016-04-13 12:32:34 EDT
I also applied a couple of preparatory steps, so that we can soon exchange the shape of zest nodes to ensure proper visualization of DOT shapes. In detail, I pushed the following changes to origin/master:

- Refactored DynamicAnchor-IComputationStrategy-contract, so that the anchor is now responsible of providing the anchorage reference geometry. Thereby, a specific anchor can be returned to ensure that anchors are properly placed on the outline of the shape, whereas the computation strategy can independently thereof by adjusted to match the connection router.
- Added a specific anchor provider for NodePart, which refers to the outline of the shape.
- Renamed some ZestProperties to correspond to the common conventions.
- Introduced a DotNodePart and corresponding DotContentPartFactory to be able to exchange the dot shape. DotNodePart uses an ellipse as shape, as this corresponds to the Graphviz default.
- Added a specific DotStraightRouter, which similar to the other Dot routers ensures the the start and end point computed by Graphviz dot are set as reference points for the start and end anchors.

What needs to be done next is providing a way to set the shape of a NodePart via ZestProperties, and to add the respective logic to the Dot2ZestAttribute converters. I will take care of this next, so we can then proceed to realize the visualization of the different dot shapes. We might be able to remove the specific DotNodePart again, as soon as this is realized.
Comment 8 Alexander Nyßen CLA 2016-04-14 10:44:59 EDT
I pushed the following changes to origin/master:

- Add support for setting NodePart shape via ZestProperties.
- Enhanced Dot2ZestAttributesConverter to respect rectangle, circle, and diamond shapes.
- Removed specific DotNodePart and ensured NodePart uses padding only when nested children are provided.
Comment 9 Eclipse Genie CLA 2016-07-11 05:16:20 EDT
GitHub Pull Request 1 created by [miklossy]
https://github.com/eclipse/gef/pull/1
Comment 10 Eclipse Genie CLA 2016-07-11 05:28:15 EDT
GitHub Pull Request 2 created by [miklossy]
https://github.com/eclipse/gef/pull/2
Comment 11 Eclipse Genie CLA 2016-07-11 05:53:25 EDT
GitHub Pull Request 3 created by [miklossy]
https://github.com/eclipse/gef/pull/3
Comment 12 Alexander Nyßen CLA 2016-07-11 06:02:48 EDT
(In reply to Eclipse Genie from comment #11)
> GitHub Pull Request 3 created by [miklossy]
> https://github.com/eclipse/gef/pull/3

Merged pull request, also transferring changes into origin/master.
Comment 13 Tamas Miklossy CLA 2016-08-15 14:12:33 EDT
I pushed the following changes to origin/master:

[441352] Implement additional Dot validation rule for style=striped.

- Implement DotJavaValidator rule (@Check) to ensure that the 'striped' node style is used only for rectangularly-shaped nodes ('box', 'rect', 'rectangle' and 'square').
- Implement testInvalidCombinationOfNodeShapeAndStyle DotValidator test cases.
Comment 14 Tamas Miklossy CLA 2018-03-23 05:50:13 EDT
I pushed the following changes to origin/master:

[441352] Add support for polygon-based node shapes to the DOT Graph View

- Extend the Dot2ZestAttributeConverter to convert the 'cds',
'folder', 'hexagon', 'house', 'invhouse', 'invtrapezium', 'larrow',
'lpromoter', 'octagon', 'parallelogram', 'pentagon', 'point', 'rarrow',
'rpromoter', 'septagon', 'star' and 'trapezium' DOT polygon-based node
shapes into corresponding zest nodes.
- Implement corresponding Dot2ZestGraphCopierTests test cases.
Comment 15 Tamas Miklossy CLA 2018-07-15 06:45:09 EDT
I pushed the following changes to origin/master:

[441352] Add support for rendering rounded polygon-based node shapes.

- Modify the Dot2ZestAttributesConverter to also evaluate the dot style
attribute value while determining the JavaFX node to a certain
polygon-based node shape.
- Implement corresponding Dot2ZestGraphCopierTests and
Dot2ZestNodeAttributesConversionTests test cases.
Comment 16 Tamas Miklossy CLA 2018-08-27 13:57:24 EDT
I pushed the following changes to origin/master:

[441352] Add support for rendering the 'none' polygon-based node shape.

- Modify the Dot2ZestAttributesConverter to convert the 'none'
polygon-based node shape to a to a rectangle with no stroke.
- Implement corresponding Dot2ZestNodeAttributesConversionTests test
cases.
Comment 17 Matthias Wienand CLA 2018-08-31 11:19:51 EDT
I pushed the following changes to master:

[441352] Support rendering of "doublecircle" node shape.

 - Create custom DotNodePart for maintenance of additional properties.
 - Provide DOT_PROPERTY_INNER_SHAPE__N property to store a shape that should be drawn on the inside of the regular Zest shape.
 - Provide DOT_PROPERTY_INNER_SHAPE_DISTANCE__N property to store the distance that should be preserved between the regular Zest shape and the additional inner shape.
 - Ensure inner shape is updated and resized correctly via specialized DotNodePart#doRefreshVisual() method.
 - Enhance DotPolygonBasedNodeShapes w.r.t. "doublecircle" shape:
   - Return outer circle shape from the get() method.
   - Return inner circle shape from the new getInner() method.
   - Return inner circle distance from the new getInnerDistance() method.
 - Ensure inner shape and inner distance are assigned when needed within Dot2ZestAttributesConverter.
Comment 18 Tamas Miklossy CLA 2018-08-31 14:06:47 EDT
I pushed the following changes to master:

[441352] Support for rendering 'doubleoctagon' polygon-based node shape.

- Add 'doubleoctagon' polygon-based rendering to the DOT Graph View
(similar implementation to the 'doublecircle' polygon-based node shape
rendering).
- Refactor the 'doublecircle' polygon-based rendering.
- Implement/adapt the corresponding Dot2ZestGraphCopierTests test cases.
Comment 19 Tamas Miklossy CLA 2020-07-25 00:53:26 EDT
I will resolve this as fixed in 5.3.1 (2020-09), since most of the functionality already have been implemented. Further improvements should come in separate Bugzilla tickets.