From d76006ef543fca01d489dde825197d94932db54b Mon Sep 17 00:00:00 2001 From: Johannes Mey <johannes.mey@tu-dresden.de> Date: Wed, 5 Oct 2022 18:12:31 +0200 Subject: [PATCH] only show the last five selections --- src/main/jastadd/common/Tracing.jadd | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/jastadd/common/Tracing.jadd b/src/main/jastadd/common/Tracing.jadd index bce1ccb..115846d 100644 --- a/src/main/jastadd/common/Tracing.jadd +++ b/src/main/jastadd/common/Tracing.jadd @@ -37,15 +37,31 @@ aspect Tracing { de.tudresden.inf.st.jastadd.dumpAst.ast.Dumper.read(world) .setNameMethod(o -> o == null ? "null" : o.getClass().getSimpleName()) .setBackgroundColorMethod(n -> (n == highlightNode ? highlightColor : DEFAULT_COLOR)) - .includeTokensWhen((node, tokenName, value) -> !tokenName.matches("Q.") && !tokenName.equals("TimeStamp")) // FIXME remove domain-specific code + .includeTokensWhen((node, tokenName, value) -> !tokenName.matches("Q.") && !tokenName.equals("TimeStamp") && !tokenName.startsWith("_ragconnect_")) // FIXME remove domain-specific code .includeAttributeWhen((node, attributeName, isNTA, value) -> isNTA) - .<ASTNode>includeChildWhen((parentNode, childNode, contextName) -> !((contextName.equals("Pose") || contextName.equals("Robot")) && childNode.inDemonstrationTable())) + .<ASTNode>includeChildWhen((parentNode, childNode, contextName) -> { + if (contextName.equals("DemonstrationTable")) { + return false; + } else if ("Selection".equals(contextName) && childNode instanceof Selection && parentNode instanceof RobotWorld) { + Selection s = (Selection) childNode; + RobotWorld w = (RobotWorld) parentNode; + int LAST_X_SELECTIONS = 5; + for (int i = w.getNumSelection() - 1; i > 0 && i > w.getNumSelection() - 1 - LAST_X_SELECTIONS; i--) { + if (w.getSelection(i) == childNode) { + return true; + } + } + return false; + } else { + return true; + } + }) .<ASTNode>includeRelationsWhen((sourceNode, targetNode, roleName) -> !roleName.equals("AttachedRobot") && !(sourceNode != null && sourceNode.inDemonstrationTable()) && !(targetNode != null && targetNode.inDemonstrationTable())) // !sourceNode.inDemonstrationTable() .dumpAsSVG(svgPath); } catch (java.io.IOException e) { e.printStackTrace(); } - de.tudresden.inf.st.mg.ImmersiveSortingController.getInstance().publish(now, 0, step, svgPath, "context"); + de.tudresden.inf.st.mg.common.Webserver.getInstance().publish(now, 0, step, svgPath, "context"); } } -- GitLab