X value for connectorRule's endShapeConnection returning as -1.7976931348623157E308


This is somewhat a continuation of (or at least related to) Trevor’s thread over here: How to get connection point of a line on a shape

The long and short of it is that we’re trying to attach connectors to their correct locations on shapes, using Diagram for Java. We are now utilizing the connectorRule referenced in the patch notes for 22.11, and are successfully getting the connection points on the originating shape, as well as on the left and right faces of the receiving shape, which is excellent.

We have noticed issues when attaching to the top and bottom faces, which we have narrowed down to incorrect X values received when performing:


We are getting -1.7976931348623157E308 as the result, instead of the expected coordinate of approximately 0.25, which our error checking replaces with zero, and we end up with the connection point set in the corner instead of the correct point along the face. The Y value of the endShapeConnection, and both the X and Y of the startShapeConnection, appear to behave correctly.

I have attached a simple visio diagram that reproduces this issue in our code. Here is an abbreviated sample of the code flow:

private static Point2D.Double getConnectionPoint(Connection connection)
   Point2D.Double connectorPoint;
   if (connection != null)
      double connectorStartX = connection.getX().getValue();
      connectorStartX = connectorStartX == -Double.MAX_VALUE ? 0.0 : connectorStartX;
      double connectorStartY = connection.getY().getValue();
      connectorStartY = connectorStartY == -Double.MAX_VALUE ? 0.0 : connectorStartY;
      connectorPoint = new Point2D.Double(connectorStartX, connectorStartY);
      connectorPoint = new Point2D.Double(0.0, 0.0);
   return connectorPoint;

private static void addLine(Shape connectorShape) throws Exception
   ConnectorRule connectorRule = connectorShape.getConnectorRule();

   Connection startConnection = connectorRule.getStartShapeConnection();
   Connection endConnection = connectorRule.getEndShapeConnection();

   Point2D.Double startPoint = getConnectionPoint(startConnection);
   Point2D.Double endPoint = getConnectionPoint(endConnection);

Running the addLine function above results in (approximately) the following values:
startPoint = [0.246, 0.787]
endPoint = [0.0, 1.063]

Because we are connecting to the top face, we then look at the X value of the endPoint, we get 0 instead of the expected value (which should be around 0.25)

We would greatly appreciate any help and insights you can provide.

Avery Norris

VisioDiagramForAsposeSupport.zip (143.9 KB)

Thanks for the template vsdx file.
After an initial testing, I am able to reproduce the issue as you mentioned by using your template file.
I found X value for connectorRule’s endShapeConnection returning a default value.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): DIAGRAMJAVA-51157

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

1 Like

The issues you have found earlier (filed as DIAGRAMJAVA-51157) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou

1 Like