Good day!
I want to report two issues at once because they are detected at one operation applied to the generated scheme.
First I draw a simple scheme with three shapes - one “switch chassis” and two “ports”. This code snippet was used in the “shape rotation problem” ticket. Aspose_GenerateWithAdd.zip (717 Bytes)
This complex shape is copied and pasted to the stencil file CustomStencils.vssx with the name “Switch”. CustomStencils.zip (10.7 KB)
Then I make my main project. Here is the code: Aspose_ConnectOldAndNewShapesAndGroup.zip (1.5 KB)
Here I proceed with several operations:
- - Insert the “Switch” master shape from the custom stencil and paste an actual copy of it.
- - Ungroup it.
- - Get access to Port2 shape and read its actual coordinates.
- - Draw a line from the Port2 shape end and place a connection point on its edge.
- - Draw rectangle shapes “Switch 2” and “Port 3”.
- - Draw a line from the Port3 shape end and place a connection point on its edge.
- - Connect two line shapes with their custom created connection points.
- - Group two shape arrays - each consists of switch chassic shape and its assotiated shapes - “port” rectangles and extension lines.
Execute the code and you will see the perfect result in the generated document: “ports” are nicely connected and you can drag and drop complex shapes changing their positions on the layout.
Problems arrive when you try to ungroup any of the two complex shapes. Ideally you do not want to ungroup anything as the solution is perfect. But actually in schemes with many shapes on layout some shapes loose coordinates and must be dragged on place manually. This buggy situation is not easy to reproduce with a test snippet code. I will do it later in another topic.
About current issues. Try to manually ungroup Switch 2 supershape. You will see that the connection line lost its connection point. It happens only with hand-added connection points. You can change the code a little and make connection not to the line but to the Port3 rectangle factory-built connection point (connection Id = 3). After ungroup connection retains.
Then go to Switch 1 and ungroup it. Chassis and port shapes of Switch 2 was not drawn in the current project but imported from a stencil. So they have slightly different nature in difference with Port 3. After you commit ungroup you will see the same connection loss as with Switch 2 port. But also there is one more trouble: port rectangles loose their border lines and I see no way to bring them back. Switch chassis rectangle does not loose borders because it has been initially created with DrawRectangle method not with AddShape like port shapes.
Please, try to resolve these two issues!
At the end I have a feature request. Normally after we add a shape we want to know the ID of it in order to get access to this shape. It is done automatically with AddShape method as it returns the ID as long type. But when we work with a complex grouped shape (for instance, imported from a stencil) we usually need to ungroup it first. And here comes a difficulty as we can not detect the IDs of the newborn shapes. We usually can relatively easily get the first shape Id. It will be the next number of the added complex shape (which is ungrouped and removed). But getting the last shape ID is more difficult. In my applied code snippet I just manually counted shapes because they are few in this example. In production project I use a workaround: I add a single shape (can be anything) and read its ID. Then I delete this temporary shape and calculate the last ID of the ungrouped shapes. The result comes from “temp shape ID - 1”. This workaround works but seems unpleasant and weird.
ShapeCollection class has the property “Count” but we can not use it because we must also mean deleted objects quantity which usually is unknown.
This inconvenience could be solved by adding the new property “LastAddedShapeId” (or something with more beautiful name) for ShapeCollection class. This would return the last added on certain page shape ID. What do you think? I suppose this would not be difficult to add this feature to your solution.
@Viktor1983
After an initial testing, I am able to reproduce the issue as you mentioned by using your template file.
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): DIAGRAMNET-53186
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.
@Viktor1983
Please use the following code to set the y-coordinate of the every connection, as it is a default value otherwise.
Then give it a try again,the connection should work fine.
Connection _port2ConnectionOnEdge = new Connection();
_port2ConnectionOnEdge.IX = 0;
_port2ConnectionOnEdge.X.Ufe.F = "Width*1";
_port2ConnectionOnEdge.Y.Value = 0; //set the y-coordinate
Thanks.
Goo day!
I added this settings in both CPs and I did not see any improvement. It is all the same: the connecting line gets unplugged from the connection point when the shape with this connection point gets ungrouped.
@Viktor1983
Thank you for your feedback.
I apologize for the oversight. We missed the information about “ungroup.” When the shape is ungrouped, the connection will be removed. We will continue to investigate this issue.
The issues you have found earlier (filed as DIAGRAMNET-53187) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou
Hi, Philip!
As I see the last update fixed the second problem - shape borders do not disappear after ungroup now. The first problem “connection loss after ungroup” still remains. Is it still under resolution process?
@Viktor1983
We are still addressing the issue of ‘connection loss after ungroup,’ which is related to grouping and ungrouping of connection shapes.
We plan to resolved this issue in next diagram version.
Thanks.
The issues you have found earlier (filed as DIAGRAMNET-53186) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou
Hi, Philip!
The remaining reported issue has been solved with 23.9.0. Connections remain after ungroup. Now it is correct. But now something broke for straight lines.
In my test snippet I changed the right side single port to 4 ports connected with a breakout cable.
Launch the project with 23.8.0 and you will see the correct layout. Then launch it with 23.9.0 and you will see something went wrong. And when you ungroup the complex shape you will see that lines erroneously changed length. Please, resolve it!
Aspose_ConnectWithBreakout.zip (2.6 KB)
@Viktor1983
Thank you for providing the code snippet. I’m sorry, but it seems to be missing some classes such as EthernetPort and FullSiteModel, making it impossible for us to run it. Could you please create a standalone console application that is runnable as a project, zip the project, and share it with us? We will review it as soon as possible.
Thanks.
Philip,
I’m sorry, I did a copypaste from a wrong source file. This is the right one.
Aspose_ConnectWithBreakout.zip (1.6 KB)
@Viktor1983
Thank you for providing the code snippet.
After an initial testing, I am able to reproduce the issue as you mentioned by using the template file.
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): DIAGRAMNET-53208
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.
The issues you have found earlier (filed as DIAGRAMNET-53208) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou
Hi, @philip.zhou!
Finally I managed to check it.
Now in the diagram generated by the last provided snippet code everything seems to be alright at the first glance. But it is not quite true. When testing on my production code I have found one issue I have not noticed before.
Aspose_ConnectThirdSwitch_20_11.zip (2.0 KB)
See this new snippet. The scheme here is supplemented with the third switch located beneath the first switch and connecting upwards. Ungroup this new switch and you will see that the connection point of the the port21’s extension line somehow moved to the other end from the original place. It seems that the line’s connection point transfer happened when the line was united in its group because I see it when I manually move the line out of the grouped shape. No matter to where the connection point was placed initially, but after adding the line to a group this CP is always moved to the “second point” of the line.
Please, resolve it. Thank you.
@Viktor1983
Thanks for the template code.We will evaluate your issue further.
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): DIAGRAMNET-53230
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.
The issues you have found earlier (filed as DIAGRAMNET-53230) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou