Replies: 5 comments 4 replies
-
HI @rsoika
Yes that is true and is also intended. Sprotty (and as a consequence also GLSP) makes a clear distinction between routing points and anchor points (start & end points). Anchor computation is completely separated from the routing computation and the "routingPoints". Sprotty expects that the "routingPoints" property only contains the actual routing points an no anchors.
Due to a bug we previously also sent the anchorpoints to the server. However, this resulted in duplicated routing points on the client (Start and endpoint are already part of the routing points but are are also recomputed and added during the client side routing). From the top of my head I'm not sure what the best approach would be to retrieve the start and endpoints on the server side. @planger WDYT? |
Beta Was this translation helpful? Give feedback.
-
ok, I will try to follow your thoughts but this no not so easy. You say:
I see this distinction between the computing of AnchorPoints and the route between them, but not in the resulting Sprotty property So this would mean, that the Sprotty route(edge: SRoutableElement): RoutedPoint[] {
if (!edge.source || !edge.target)
return [];
const routedCorners = this.createRoutedCorners(edge);
const sourceRefPoint = routedCorners[0]
|| translatePoint(Bounds.center(edge.target.bounds), edge.target.parent, edge.parent);
const sourceAnchor = this.getTranslatedAnchor(edge.source, sourceRefPoint, edge.parent, edge, edge.sourceAnchorCorrection);
const targetRefPoint = routedCorners[routedCorners.length - 1]
|| translatePoint(Bounds.center(edge.source.bounds), edge.source.parent, edge.parent);
const targetAnchor = this.getTranslatedAnchor(edge.target, targetRefPoint, edge.parent, edge, edge.targetAnchorCorrection);
if (!sourceAnchor || !targetAnchor)
return [];
const routedPoints: RoutedPoint[] = [];
routedPoints.push({ kind: 'source', ...sourceAnchor});
routedCorners.forEach(corner => routedPoints.push(corner));
routedPoints.push({ kind: 'target', ...targetAnchor});
return routedPoints;
} I agree with you, there is a distinction between computing the Anchors and the Route in Sprotty (which is clever), but not in the resulting routing property! If I understand you correctly, then you generally want to pack the first and last point into a new property that does not exist yet? Maybe you're trying to solve a problem that doesn't exist.
I would say, this means the Sprotty router implementation was simply wrong. And to be honest, I haven't yet understood why the Sprotty router is constantly recalculating the routers. Could it be, that the problem lies somewhere else entirely? I really don't want to stop you in such a complex topic, but it seems to me, that you are trying to solve a problem that has nothing to do with GLSP? To make this clear again: A route must start with the start point and end with the end point. That is the essential concept of a route. |
Beta Was this translation helpful? Give feedback.
-
I agree the computed route must have a start and endpoint. However, the You can see that the "routingPoints" property only has the three "segement" routing points (i.e. no start or end). The start and end points are only added to the final route computed by the corresponding edgeRouter.
No that's not true the sprotty edgeRouters behave exactly as I described (see also the example above). The "routingPoints" property does not contain the start and end point instead this points are computed dynamically based on the defined anchors. (This happens in https://github.com/eclipse/sprotty/blob/b0e9d60e9c9ab7d302f84f55eef227828ba7d68c/packages/sprotty/src/features/routing/manhattan-edge-router.ts#L63) To sum up the problem: The routingPoints property of a sprotty edge does not provide the final computed route, it rather serves as an input for the edgeRouter. The final route is currently not persisted in the model. Typically this is not a problem because routing and anchor computation is either done completely on the client side or completely on server side. What you described is a mixed case where you basically want to compute the anchors on the client side and then use them to compute the route on the server side. This is afaik currently not supported hence you would need a workaround for that. |
Beta Was this translation helpful? Give feedback.
-
@tortmayr based on your answer and the example code: You differentiate between
Can you please explain that briefly. How is it possible to implement a router on the server side and is there an impact regarding performance? If I can implement my requirements in this way, I'll be happy to do so. Do you mean I should simply compute the route during the |
Beta Was this translation helpful? Give feedback.
-
@rsoika The route can be calculated using the edge router registry, as done in the calcElementAndRoutingPoints. I general, I do not know why routing points do not consider source point and target points in sprotty but I believe if we want to change that, it should be adapted in sprotty so we do not lose compatibility. However, to provide the information for GLSP, I opened a PR which should address the issue that you are describing. It extends the
Using that information, a server-side |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am hunting a bug for some days now, regarding RoutingPoint information tranferred from the client to the server.
Specifically, I miss the anchor points of the source and target node. Apparently, only the routing points between the start and end point are transmitted. I use the ManhattanRouter. While debugging this router I noticed that all routing points are calculated correctly in sprotty.
Now I came across this GLSP client code (@tortmayr pointed me to this detail some weeks ago #730)
The strange thing is that there is a method call
calcElementAndRoutingPoints
line 239. And in this line there is the following comment:filter duplicate points (same x,y coordinates) and only keep actual routing points (no start or target, no volatile points)
So apparently exactly here is done what has surprised me so much for days. Is it true that you remove the start and end point from the routing list?
On the other hand, this seems to be completely new code that I don't even have in version 1.0.0 (????)
I would like to ask what the desired behavior from your point of view is. Do you really want to remove the start and endpoints from the routing information? As I said, I am extremely confused because I have been analyzing exactly this behaviour for days that seems to be changing right now...
Short message: The start and end point is extremely important to me.
Beta Was this translation helpful? Give feedback.
All reactions