I am creating an app that requires new edge end styles. Is there a way to load shapes to be used as edge styles?\nthanks

asked 08 May '11, 11:51

vainolo's gravatar image

accept rate: 30%

After some digging I found that you can draw new edge styles by creating an instance of an mxIMarker and registering the new marker in the mxMarkerRegistry. All of the existing edge "markers" are defined internally in the mxMarkerRegistry.\nFor example I am currently drawing an empty oval, with some copy/change code from the original oval that comes with JGraphx:

mxMarkerRegistry.registerMarker("instrument", new mxIMarker() {\n    @Override public mxPoint paintMarker(mxGraphics2DCanvas canvas, mxCellState state,\n            String type, mxPoint pe, double nx, double ny, double size) {\n        Ellipse2D ellipse = new Ellipse2D.Double(pe.getX()-nx/2-size/2, pe.getY()-ny/2-size/2, size, size);\n    canvas.getGraphics().draw(ellipse);\n    return new mxPoint(-nx, -ny);\n    }\n});\n

while the above code does the trick (sort of), I am really not in favor of programming by coincidence, therefore I would be really glad if the JGraphs developers could provide some information on the meaning of the parameters. For example, pe is the entry point and the return value of the function is used as the connecting point of the edge. But is this really their meaning.\nFurthermore, in the built-in JGraphx edges some multiplication by 1.2 is done. Why is this?\nthanks


answered 08 May '11, 13:04

vainolo's gravatar image

accept rate: 30%

I am also looking for the possibility to draw a custom edge end point and during my search in the forum I found this thread. Was there anything done in the meantime to integrate a custom end point easier then vainolo did? Maybe via the styles and svg-files? I need an endpoint looks like an inverted arrow. See the following graphic:\ncustom edge point inverted arrow


For the implementation via the mxMarkerregistry I didn't know the meaning of the two parameter 'nx' and 'ny'. 'pe' should be the point of the edge, isn't it? Maybe somebody can explain this and where they are from?


answered 14 Nov '11, 23:22

Hardie82's gravatar image

accept rate: 7%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 08 May '11, 11:51

Seen: 2,807 times

Last updated: 14 Nov '11, 23:22