# File lib/edi4r/diagrams.rb, line 439
    def level
      depth = @coord_stack.length+1
      return 0 if depth == 1 and node.maxrep == 1 and node.required? and not is_tnode? # Special Level 0 case
      depth # Else: Level is depth of segment group stack + 1 (1 if no SG)
    end