Free Support Forum - aspose.com

Text location for connector shapes

Hi, I’m using Aspose.Diagram for Java, version 18.5

Having an issue with location of text on connection shapes - it is positioned randomly (see resulting .VSDX iteraplan-InformationFlowDiagram-2018-07-06__14_50_08.zip (27.0 KB)
), even when on the stencil master it is
in the middle of connector (StencilTmp.zip (12.0 KB)).
When editing connectors (in .VSDX I have attached) using MS VISIO Home>Editing>Change Shape>ifdConnect it works like expected - text is displayed in the middle of connector.

Have found few similar threads in the forum, but all of suggestions don’t have any effect for me.
Unfortunately in the documentation there are also nothing to watch for.
Do you have new updates on this topic?

@iteraplan

Thanks for contacting support.

Would you please share complete code snippet, which is able to replicate the issue you are mentioning. We will test the scenario in our environment and address it accordingly. Please make sure to test the scenario withAspose.Diagram for Java 18.6, before sharing the code snippet.

@asad.ali, please see attached project: https://drive.google.com/open?id=1yvh2B1xATF-UuSpnGIkEgYEbrZlgCCFy
To check the execution please, select Runner.java as main class and also don’t forget to attach your Aspose.Diagram.lic file to \src\main\resources\templ. Resulting drawing will be added to the project root.

In the result drawing (ifd1.vsdx) text for connector shape is placed randomly for all connectors on the page, but in the master (StencilTmp.vssx) for this shape it is placed in the middle of the shape (by default).
Connector shape is created in Edge.java, line 66. It is used for connecting shapes in IFDDiagram.java, line 72. Its master is declared in IFDDocument.java, line 33.

Please, share your findings or suggest some workarounds for shape text location.

@iteraplan

Thanks for sharing the sample project and adding more details to the scenario.

We have executed the shared project in our environment and were managed to observe the random text position over shape connectors. For further investigation, we have logged this issue as DIAGRAMJAVA-50610 in our issue tracking system. We will look into details of the issue and keep you informed with status of rectification. Please be patient and spare us little time.

We are sorry for the inconvenience.

Dear @asad.ali,
dear @Farhan.Raza,

thank you for your reply. Good to hear that the issue was reproduceable and will be fixed in the future.

In total, we have now found five issues with the library that make the generated VSDX-files pretty much useless for our customers. This means that currently, we are not getting much value out of Aspose.Diagram.

As you have told us before, the next version of the library will be released on the 17th of July. Is there a chance that these fixes will make it into this release? And if not, when is the next release after that planned?
I hope you understand we need information on this, because our customers want to know when the VSDX-export is working properly.

Regards,
Simon Dürr - Product Manager

@iteraplan

Thanks for writing back.

Please note that we do realize significance of the reported issues and your concerns. However, we are afraid that we cannot share any reliable ETA, before an initial investigation is performed against logged issues. We will definitely consider your concerns while investigating your reported issues and as soon as we have some updates regarding investigation progress, we will share with you. Please spare us little time.

We are sorry for the inconvenience.

@iteraplan

The fixes to your reported issues, are expected to be included in 18.8 version of Aspose.Diagram for Java, which will be released in next month. In case of any further updates, we will let you know.

@asad.ali

Thank you for the update. We will wait for 18.8 to be released.

@iteraplan

Thanks for your patience.

We have further investigated the issue and found that there was no connection in the shapes. Please add connection in the shape first by using following code snippet:

private void addConnections(Shape shape) 
  { 
      Connection top = new Connection(); 
      top.getX().setValue(shape.getXForm().getWidth().getValue()/2); 
      top.getY().setValue(0); 
       
      Connection bottom = new Connection(); 
      bottom.getX().setValue(shape.getXForm().getWidth().getValue()/2); 
      bottom.getY().setValue(shape.getXForm().getHeight().getValue()); 
       
      Connection left = new Connection(); 
      left.getX().setValue(0); 
      left.getY().setValue(shape.getXForm().getHeight().getValue()/2); 
       
      Connection right = new Connection(); 
      right.getX().setValue(shape.getXForm().getWidth().getValue()); 
      right.getY().setValue(shape.getXForm().getHeight().getValue()/2); 
       
       
      shape.getConnections().add(top); 
      shape.getConnections().add(bottom); 
       
      shape.getConnections().add(left); 
      shape.getConnections().add(right); 
  } 
  @Override 
  public Object createVisio(IFDVisioContext ctx) throws Exception { 
    AffineTransform tr = ctx.getParentTransform(); 
    AffineTransform dt = new AffineTransform(); 
    dt.concatenate(tr); 
    double xCentr = (getPosition().getX() + getRectangle().getCenterX()); 
    double yCentr = (getPosition().getY() + getRectangle().getCenterY()); 
    dt.translate(xCentr, -yCentr); 
    double translateX = dt.getTranslateX(); 
    double translateY = dt.getTranslateY(); 
    long diagramShapeId = ctx.getCurrentPage().addShape(translateX, translateY, ctx.getMasterNodeName()); 

    Shape diagramShape = ctx.getCurrentPage().getShapes().getShape(diagramShapeId); 
    diagramShape.setWidth(getRectangle().getWidth() / IteraplanVisioUtils.VISIO_SCALE); 
    diagramShape.setHeight(getRectangle().getHeight() / IteraplanVisioUtils.VISIO_SCALE); 

    diagramShape.getText().getValue().clear(); 
    diagramShape.getText().getValue().add(new Txt("DiagramShapes")); 
     
    List<Shape> group = new ArrayList<Shape>(); 
    group.add(diagramShape); 
    for (Node node : nodes) { 
      Shape nodeShape = (Shape) node.createVisio(ctx); 
      nodesShape.put(node.getId(), nodeShape); 
      nodeShape.refreshData(); 
      group.add(nodeShape); 
    } 

    for (Edge edge : edges) { 
      Shape edgeShape = (Shape) edge.createVisio(ctx); 

      Shape from = nodesShape.get(edge.getFromNode()); 
      Shape to = nodesShape.get(edge.getToNode()); 
      addConnections(from); 
      addConnections(to); 
      ctx.getCurrentPage().connectShapesViaConnector(from.getID(), IteraplanVisioUtils.getConnectionPointPlace(from, to), 
              to.getID(), IteraplanVisioUtils.getConnectionPointPlace(to, from), edgeShape.getID()); 
      group.add(edgeShape); 
    } 
     
    diagramShape.refreshData(); 
    return diagramShape; 
  } 

In case you still face any issue, please feel free to let us know.

@asad.ali, thanks for replying. Unfortunately, applying your code snippet to SandBox project (which I have attached) didn’t help to fix text locations for connectors. The issue, described in my previous message is still reproduced.

@iteraplan

Thanks for your response.

We have updated the information of logged ticket accordingly and status of the ticket is still open. We will let you know in case of further updates regarding investigation. Please spare us little time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as DIAGRAMJAVA-50610) have been fixed in this update. This message was posted using BugNotificationTool from <a href=“https://#{request.env[“HTTPS_HOST”]}”>Downloads module by Farhan.Raza

Hi there, now in version 18.9, mostly in cases where connector is displayed vertically, connector shape text is still displayed not in the middle: image.png (19.4 KB)

Attaching sandbox project with reproduce scenario (run Runner.java and open resulting Visio drawing in root folder): https://drive.google.com/open?id=1bXDCddgqeaFnn2QhgFakLGNTh0e3x7oi

P.S: license should be attached to \src\main\resources\templ\

@iteraplan

Thanks for contacting support.

We have observed the issue while running your project and logged it as DIAGRAMJAVA-50623 in our issue tracking system. We will investigate it further and keep you posted in case of updates regarding its resolution. Please spare us little time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as DIAGRAMJAVA-50623) have been fixed in Aspose.Diagram for Java 18.10.