Green Dots in wrong place with created connector

When I create a connector between two shapes using:

			visioPage.connectShapesViaConnectorIndex(
					fromId,fromAnchorIndex, 
					toId, toAnchorIndex, 
					arcShapeId);

And I open the VISIO file and select the connector, The start and end green circles are in the wrong place:

image.png (22.7 KB)

I have added a number of connector points to each shapes.
image.png (22.6 KB)

What do I have to adjust on the Connector Shape to have those anchor points in the right place?

Once I manipulate the chart, the points move to the locations I hoped for.

image.png (15.8 KB)

I want the file to open with the green connector anchors in the correct place.

Here is the vsdx file:
diagram.zip (99.7 KB)

@Thinian

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-51093

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.

Does that mean it is a bug?

@Thinian
Please share the code for adding connector lines, as we are experiencing different results when using the following code to add connector lines and connect shape connection points, as shown in the attachment.
Thanks.
51093output.zip (89.1 KB)

.
Diagram diagram = new Diagram(“diagram.vsdx”);
Page page = diagram.getPages().get(0);
long id = page.addShape(1, 1, “Dynamic connector”);
page.connectShapesViaConnectorIndex(10, 14, 15, 6, id);
diagram.save( “51093output.vsdx”, SaveFileFormat.VSDX);

I create and connect the arc like I think you do. And I connect it to the shape using Connectors that I created with this routine:

static void addAllControlPoints(String nodeId, Shape textShape, boolean bottomUp, boolean extend, boolean extendDown) throws Exception {
		Connection conn;
		String nodeCenter = "Width*0.5" ; 
		double pixelOffDown = 0 ;
		double pixelOffUp = 0 ;
		if(extend) {
			if(extendDown) {
				
				pixelOffDown = VisioGenerator.scale * 50;
			} else {
				
				pixelOffUp = VisioGenerator.scale * 40;
			}
		}

		for(int anchor = 0 ; anchor < MAX_PRIMARY_IN; anchor++) {
			String anchorPosition = nodeCenter + "+" +  anchor * ANCHOR_GAP ;
			String anchorName = anchorName(nodeId,PRIMARY_IN_PREFIX,anchor) ;
			conn = makeAnchorPoint(textShape, anchorName, anchorPosition, "Height" + "+" + pixelOffUp);
		}
		for(int anchor = 0 ; anchor < MAX_PRIMARY_OUT; anchor++) {
			String anchorPosition = nodeCenter + "+" +  anchor * ANCHOR_GAP ;
			String anchorName = anchorName(nodeId,PRIMARY_OUT_PREFIX,anchor) ;
			conn = makeAnchorPoint(textShape, anchorName, anchorPosition, "" + -pixelOffDown);
		}
		for(int anchor = 0 ; anchor < MAX_SECONDARY_IN; anchor++) {
			String anchorPosition = nodeCenter + "-" +  anchor * ANCHOR_GAP ;
			makeAnchorPoint(textShape,anchorName(nodeId,SECONDARY_IN_PREFIX,anchor), anchorPosition, "Height" + "+" + pixelOffUp);			
		}
		for(int anchor = 0 ; anchor < MAX_SECONDARY_OUT; anchor++) {
			String anchorPosition = nodeCenter + "-" +  anchor * ANCHOR_GAP ;
			makeAnchorPoint(textShape,anchorName(nodeId,SECONDARY_OUT_PREFIX,anchor), anchorPosition, "" + -pixelOffDown);			
		}
		DBO(DB_ANCHORS_TRACE, ()->"anchorIndex:" + ModelDebug.dumpMap(anchorIndex));
		textShape.refreshData();
	}
	private static Connection makeAnchorPoint(Shape shape, String name, String xPositionString, String yPositionString) {
		Connection connection1 = new Connection();
		connection1.setName(name);
		connection1.getX().getUfe().setF(xPositionString);
		connection1.getY().getUfe().setF(yPositionString);
		int ix = shape.getConnections().add(connection1);
		connection1.setIX(ix);
		anchorIndex.put(name, ix);
		return connection1;
		
	}

I create the connector like this, looking up the correct connector for each arc.

                                Shape arcShape = new Shape();
				arcShape.setName(connectionData.getId() + "-" + pageIndex);
				long arcShapeId = visioPage.addShape(arcShape, CONNECTOR.getStencilName());
				arcShape.bringToFront();			
				Shape fromNodeShape = shapeSource.getShape(idMapping.get(fromNodeId));
				Shape fromNodeTextShape = shapeSource.getShape(idMapping.get(fromNodeId)).getShapes().getShape(fromNodeId + "-TEXT");
				Shape toNodeTextShape = shapeSource.getShape(idMapping.get(toNodeId)).getShapes().getShape(toNodeId + "-TEXT");
				long fromId = fromNodeTextShape.getID() ;
				long toId = toNodeTextShape.getID() ;
				int fromAnchorIndex;
				int toAnchorIndex ;
				//These tow indexes are looked up from a list of Connectors, the I ADDED!
				fromAnchorIndex = getAnchorIndex(fromNodeId, connectionData,CONNECTION_IN) ;
				toAnchorIndex = getAnchorIndex(toNodeId, connectionData,CONNECTION_OUT) ;
				visioPage.connectShapesViaConnectorIndex(
						fromId,fromAnchorIndex, 
						toId, toAnchorIndex, 
						arcShapeId);
				visioPage.glueShapes(fromNodeShape, fromAnchorIndex, toNodeTextShape);
				fromNodeTextShape.refreshData();
				toNodeTextShape.refreshData();
				arcShape.refreshData();
                markOriginalLineForDeletion(arcShape);

Then I remove the original Geoms:

	public static Point2D markOriginalLineForDeletion(Shape arcShape) {
		Point2D end = null ;
		for(int i = 0; i < arcShape.getGeoms().get(0).getCoordinateCol().getLineToCol().getCount(); i++) {
			LineTo lineToDelete = arcShape.getGeoms().get(0).getCoordinateCol().getLineToCol().get(i);
			end = new Point2D.Double(lineToDelete.getX().getValue(),lineToDelete.getY().getValue());
			lineToDelete.setDel(BOOL.TRUE);
		};
		return end ;
	}

Then I add the individual line segments where they are suppose to be in the chart created by our tool

	public static void addLineTos(Shape arcShape, List<Point2D> arcPoints, boolean dbArcInteresting) {
		arcPoints.stream().forEach(point->{
			LineTo lineToVertice = new LineTo();
			lineToVertice.getX().setValue(point.getX());
			lineToVertice.getY().setValue(point.getY());
			arcShape.getGeoms().get(0).getCoordinateCol().add(lineToVertice);			
		});
	}

If I call arcShape.refreshNode() at this point, the resulting arc loses my line segments! So I call it before I modify the Geoms.

Here is an elaborate example:
diagram.zip (198.3 KB)

An interesting (and annoying) feature is that when I open one of these produced files in VISIO, and then I close it without changing it, it still asks me if I want to save the document. As well, as I think I said before, if I make a change like the orientation or page size, it does a redraw of the connectors, adding the little jumpers, and reseting the green dots to where I want them.

I hope this is enough information. The payment has just gone through to you for a full support license which I expect very soon. I have a lot more questions :slight_smile:

@Thinian
We will look further into it.
Thanks.