In working through a previous posting on orthogonal constraints I think I may need to raise a bug with orthogonal edge handling when the source side is constrained.


When I set the source side constraint using STYLE-EXIT-X and STYLE-EXIT-Y (again both appear to be required) then the fixed constraint source side is correctly set at the base of the soruce vertex, but the line is no longer horizontal.


Like this: alt text and this following resize: alt text


It appears (to me) that the position of the target side (with the diamond) is being deduced as horizontal to the source position before the source constraint is applied i.e. the default mid point of the source.


Code is:

Object parent = graph.getDefaultParent();\n\ngraph.getModel().beginUpdate();\ntry\n{\n        mxStylesheet stylesheet = graph.getStylesheet();\n        mxGraphView view = graph.getView();\n\n        Map<String, Object> vertx = new HashMap<>();\n        vertx.put(mxConstants.STYLE_ROUNDED, true);\n        vertx.put(mxConstants.STYLE_ORTHOGONAL, false);\n        vertx.put(mxConstants.STYLE_EDGE, mxConstants.EDGESTYLE_SIDETOSIDE);\n        vertx.put(mxConstants.STYLE_SHAPE, "label");\n        vertx.put(mxConstants.STYLE_VERTICAL_ALIGN, mxConstants.ALIGN_TOP);\n        vertx.put(mxConstants.STYLE_FILLCOLOR, "#D9DB91");\n        vertx.put(mxConstants.STYLE_STROKECOLOR, "black"); \n        vertx.put(mxConstants.STYLE_FONTCOLOR, "black");\n        stylesheet.putCellStyle("THREAD", vertx);\n\n        mxCell v1 = (mxCell) graph.insertVertex(parent, null, "thread1", \n                       120, 120, 10, 180, "THREAD"); \n        mxCell v2 = (mxCell)graph.insertVertex(parent, null, "thread2", \n                       220, 130, 10, 100, "THREAD");\n\n        Map<String, Object> edge2 = new HashMap<>();\n        edge2.put(mxConstants.STYLE_ORTHOGONAL, true);\n        edge2.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_CONNECTOR);\n        edge2.put(mxConstants.STYLE_ENDARROW, mxConstants.ARROW_DIAMOND);\n        edge2.put(mxConstants.STYLE_STROKECOLOR, "black"); \n        edge2.put(mxConstants.STYLE_FONTCOLOR, "blue");\n        edge2.put(mxConstants.STYLE_EXIT_X, "0");   // both these lines\n        edge2.put(mxConstants.STYLE_EXIT_Y, "1");   // "1" as bottom of source\n        stylesheet.putCellStyle("RESPONSE", edge2);\n\n        mxCell erp = (mxCell)graph.insertEdge(parent, null, "response", \n                      v2, v1, "RESPONSE");\n}\nfinally\n{\n        graph.getModel().endUpdate();\n}\n

asked 11 Apr '12, 10:36

dazed's gravatar image

accept rate: 0%

I think I may have a work-around (or stumbled across the solution). That is to use "EDGESTYLE-TOPTOBOTTOM" on the edge rather than not setting any edge style or setting "EDGESTYLE-ORTHOGONAL" (which was my first thought).

When I use EDGESTYLE-ORTHOGONAL then the edge actually appears as an Elbow style path.

Observation: I can no longer upload pictures to show this behaviour - as my "Karma" is too low (not > 60) - uh?!

Code is:

   Map<String, Object> edge2 = new HashMap<>();
   edge2.put(mxConstants.STYLE_ORTHOGONAL, true);
   edge2.put(mxConstants.STYLE_EDGE, mxConstants.EDGESTYLE_TOPTOBOTTOM);
   edge2.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_CONNECTOR);
   edge2.put(mxConstants.STYLE_ENDARROW, mxConstants.ARROW_DIAMOND);
   edge2.put(mxConstants.STYLE_STROKECOLOR, "black"); 
   edge2.put(mxConstants.STYLE_FONTCOLOR, "blue");
   edge2.put(mxConstants.STYLE_DASHED, true);                                        
   edge2.put(mxConstants.STYLE_EXIT_X, "0.5");
   edge2.put(mxConstants.STYLE_EXIT_Y, "1");
   stylesheet.putCellStyle("RESPONSE", edge2);

   mxCell erp = (mxCell)graph.insertEdge(parent, null, "response", 
         v2, v1, "RESPONSE");

answered 12 Apr '12, 12:41

dazed's gravatar image

accept rate: 0%

edited 12 Apr '12, 12:42

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]( "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: 11 Apr '12, 10:36

Seen: 1,526 times

Last updated: 12 Apr '12, 12:42