Hi,

Attached you will find an example Visio file. The following code is in Java.

When getting the vertexes on a line, incorrect coordinates are given. Here is some example code for the given example Visio file:

// Hard coded values for simplicity

Shape topLeftLine = vsdxDiagram.getPages().get(0).getShapes().get(1);

Shape centerLine = vsdxDiagram.getPages().get(0).getShapes().get(2);

Shape topRightLine = vsdxDiagram.getPages().get(0).getShapes().get(3);

CoordinateCollection topLeftCoordinateCollection = topLeftLine.getGeoms().get(0).getCoordinateCol();

CoordinateCollection centerCoordinateCollection = centerLine.getGeoms().get(0).getCoordinateCol();

CoordinateCollection topRightCoordinateCollection = topRightLine.getGeoms().get(0).getCoordinateCol();

System.out.println("Top Left Line MoveTo x value: " + topLeftCoordinateCollection.getMoveToCol().get(0).getX().getValue());

System.out.println("Top Left Line LineTo x value: " + topLeftCoordinateCollection.getLineToCol().get(0).getX().getValue());

System.out.println("Center Line MoveTo x value: " + centerCoordinateCollection.getMoveToCol().get(0).getX().getValue());

System.out.println("Center Line LineTo x value: " + centerCoordinateCollection.getLineToCol().get(0).getX().getValue());

System.out.println("Top Right Line MoveTo x value: " + topRightCoordinateCollection.getMoveToCol().get(0).getX().getValue());

System.out.println("Top Right Line LineTo x value: " + topRightCoordinateCollection.getLineToCol().get(0).getX().getValue());

Output:

Top Left Line MoveTo x value: -1.7976931348623157E308

Top Left Line LineTo x value: 0.0

Center Line MoveTo x value: 0.125

Center Line LineTo x value: 0.125

Top Right Line MoveTo x value: -1.7976931348623157E308

Top Right Line LineTo x value: 0.0

Expected:

Top Left Line MoveTo x value: value < 0.125

Top Left Line LineTo x value: value < 0.125

Center Line MoveTo x value: 0.125

Center Line LineTo x value: 0.125

Top Right Line MoveTo x value: value > 0.125

Top Right Line LineTo x value: value > 0.125

It appears as though the x values when lines are connected to the Top/Bottom of the shape are incorrect and the y values when the lines are connected to the Left/Right of the shape are incorrect.

Lines_Example.zip (47.3 KB)

@trevor.hensel

Please try to use this sample code:

Geom geom = shape.getInheritGeoms().get(0); //Get the geoms inherit from the shape’s master.

Thanks.

That doesn’t appear to work, here is the result:

Top Left Line MoveTo x value: -1.7976931348623157E308

Top Left Line LineTo x value: 0.0

Center Line MoveTo x value: 0.125

Center Line LineTo x value: 0.125

Top Right Line MoveTo x value: -1.7976931348623157E308

Top Right Line LineTo x value: 0.0

Inherit Top Left Line MoveTo x value: 0.0

Inherit Top Left Line LineTo x value: 0.0

Inherit Center Line MoveTo x value: 0.125

Inherit Center Line LineTo x value: 0.125

Inherit Top Right Line MoveTo x value: 0.0

Inherit Top Right Line LineTo x value: 0.0

@trevor.hensel

Top Left Line is the shape with id of 24. There are two lines(lineto) in its geometry,not only one lineto.

The same for the other two shapes.

Please to check it with this sample code:

Page page = diagram.getPages().get(0);

Shape shape = page.getShapes().getShape(24);

Geom geom = shape.getInheritGeoms().get(0);

int count = geom.getCoordinateCol().getCount();

for(int j = 0;j< geom.getCoordinateCol().getCount();j++)

{

Coordinate c = geom.getCoordinateCol().get(j);

if (c instanceof MoveTo)

{

System.out.println(“moveto”);

System.out.println(((MoveTo)c).getX().getValue());

System.out.println(((MoveTo)c).getY().getValue());

}

else if (c instanceof LineTo)

{

System.out.println(“lineto”);

System.out.println(((LineTo)c).getX().getValue());

System.out.println(((LineTo)c).getY().getValue());

}

}

The result:

moveto

0.0

0.0

lineto

0.0

0.578125

lineto

-0.625

0.578125

Thanks.

Thank you for the reply and your help Philip. I think there might be a misunderstanding of what I’m saying / asking for.

What I’m trying to say is that both the x values of the first MoveTo and LineTo of the top left and top right shapes are the same. The issue with this is, at least from my perspective, is that they shouldn’t be the same. If the x values are the same that would mean the top left and top right line start at the same place on the shape face.

This is my current problem that I’m trying to solve. Which is: I’m trying to find where on a side of a shape the line is connected to. So for this specific example I would expect something like:

Inherit Top Left Line MoveTo x value: 0.0

Inherit Top Left Line LineTo x value: 0.0

Inherit Center Line MoveTo x value: 0.125

Inherit Center Line LineTo x value: 0.125

Inherit Top Right Line MoveTo x value: 0.25

Inherit Top Right Line LineTo x value: 0.25

From this I can tell the top left line is connected to the left side of the north face of the shape, top center to center, and top right to right.

@trevor.hensel

The x value and y value of the geometry in the shape are relative coordinates relative to the shape, so if the x value in each shape is the same, but because the position of the shape is different, the specific position of the line is different.

If moveto’s x and lineto’s x are the same, it’s a vertical line, and if their y’s are the same, it’s a parallel line.

We will provide an api in 22.11 to get the shape id linked on the connector and the shape’s connection.

Thanks.

Ahh I see. Will the 22.11 update include where on the face the line is connected to or just if it is Top/Bottom/Left/Right? If not is there a way to request this feature?

@trevor.hensel

We will return the connection object, which contains all the information of the connection including its coordinates, and the connection is not necessarily in the Top/Bottom/Left/Right of the shape.

Thanks.