analyzeRule method

void analyzeRule(
  1. Rule rule,
  2. int level
)

Implementation

void analyzeRule(Rule rule, int level) {
  if (debug) print("${' ' * level * 2}Rule $rule");
  for (RenderinstructionNode renderInstruction in rule.renderinstructionNodes) {
    if (debug) print("${' ' * level * 2}--> Node ${renderInstruction.runtimeType} ${renderInstruction.level}");
    addNode(rule);
    if (renderInstruction is RenderinstructionCaption) {
      String? textKey = renderInstruction.textKey?.key;
      if (textKey != null) keys.add(textKey);
    }
  }
  for (RenderinstructionWay renderInstruction in rule.renderinstructionOpenWays) {
    if (debug) print("${' ' * level * 2}--> Open Way ${renderInstruction.runtimeType} ${renderInstruction.level}");
    addOpenWay(rule);
    if (renderInstruction is RenderinstructionCaption) {
      String? textKey = renderInstruction.textKey?.key;
      if (textKey != null) keys.add(textKey);
    } else if (renderInstruction is RenderinstructionPolylineText) {
      String? textKey = renderInstruction.textKey?.key;
      if (textKey != null) keys.add(textKey);
    }
  }
  for (RenderinstructionWay renderInstruction in rule.renderinstructionClosedWays) {
    if (debug) print("${' ' * level * 2}--> Closed Way ${renderInstruction.runtimeType} ${renderInstruction.level}");
    addClosedWay(rule);
    if (renderInstruction is RenderinstructionCaption) {
      String? textKey = renderInstruction.textKey?.key;
      if (textKey != null) keys.add(textKey);
    } else if (renderInstruction is RenderinstructionPolylineText) {
      String? textKey = renderInstruction.textKey?.key;
      if (textKey != null) keys.add(textKey);
    }
  }
  for (Rule subRule in rule.subRules) {
    analyzeRule(subRule, level + 2);
  }
}