Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR] [WIP] remove 'spacing.labelNode', add 'nodeLabels.margin' #621

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

uruuru
Copy link
Contributor

@uruuru uruuru commented May 19, 2020

@le-cds consider this PR a start to the task. I left a couple of TODO cds in the diff wherever I wasn't sure. Maybe you can find time to have a look at them.

Also, are there any other tests apart from looking at several of the elk-models files?

There's one functional change in there as well:

  • retrieve margins using IndividualSpacings

@uruuru uruuru requested a review from le-cds May 19, 2020 19:54
@@ -241,12 +241,10 @@ private static void constrainedInsidePortLabelPlacement(final NodeContext nodeCo
ElkRectangle labelContainerRect = insidePortLabelContainer.getCellRectangle();
double leftBorder = labelContainerRect.x + ElkMath.maxd(
insidePortLabelContainer.getPadding().left,
nodeContext.surroundingPortMargins.left,
nodeContext.nodeLabelSpacing);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this completely here as the code handles ports inside of the node.

@uruuru uruuru self-assigned this May 19, 2020
@uruuru uruuru added alg-layered Affects the ELK Layered algorithm. bug Erroneous behaviour. enhancement An improvement to existing functionality. labels May 19, 2020
@le-cds le-cds changed the title [PR] remove 'spacing.labelNode', add 'nodeLabels.margin' [PR] [WIP] remove 'spacing.labelNode', add 'nodeLabels.margin' Jun 8, 2020
// TODO: maybe leave space for manually placed ports
KVector requiredPortLabelSpace = new KVector(-desiredNodeMargin.left, -desiredNodeMargin.top);

// TODO cds: it's not margin but spacing between pairs of labels, right?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, between multiple labels that all belong to the same graph element.

@@ -185,29 +176,33 @@ private void processNode(final NodeAdapter<?> node, final double labelSpacing) {
}

// End labels of edges connected to the port
// TODO cds: layered calls #excludeEdgeHeadTailLabels, is this ever active?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ELK Layered does its own end label processing in EndLabelPreprocessor and EndLabelPostprocessor. I think this code wasmeant for algorithms that do not implement their own sophisticated end label processing.

if (node.getProperty(CoreOptions.PORT_LABELS_PLACEMENT) == PortLabelPlacement.OUTSIDE) {
for (LabelAdapter<?> label : port.getLabels()) {
requiredPortLabelSpace.x += label.getSize().x + labelSpacing;
requiredPortLabelSpace.y += label.getSize().y + labelSpacing;
// TODO cds: why spacing in both directions? Doesn't it depend on the stacking direction?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this looks wrong.

+ portLabelSpace.x
+ labelSpacing;
+ desiredNodeMargin.right; // TODO cds: I feel this is wrong (same below)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea here was that there's the width of the node, then a bit of space between it and the port labels, then the width of the port labels, and then another bit of space between them and the edge end labels. In fact, this might make the node label margin a little strange, perhaps. It needs to be applied between a node and its port labels, and then again between those and the end labels... Hm...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and outside node labels as well...

@soerendomroes soerendomroes linked an issue Mar 15, 2022 that may be closed by this pull request
@soerendomroes soerendomroes added this to the Release 0.9.0 milestone Mar 21, 2022
@soerendomroes soerendomroes self-assigned this Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alg-layered Affects the ELK Layered algorithm. bug Erroneous behaviour. enhancement An improvement to existing functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace 'spacing.labelNode' with 'nodeLabels.margin'
3 participants