Skip to content
  • pinter's avatar
    STYLE: Indentation related changes · 4e0a67e3
    pinter authored
    1. vtkMRMLNode::Indent member seemed unused in the core, except from the also unused ROI list node, so the member was removed
    
    2. In WriteXML functions, the increasing indentation was added between the XML attributes, which did not have major effect on the top level, but for example in the scene view section, where indentation was increased, it made the nodes look like this:
    
      <Selection
        id="vtkMRMLSelectionNodeSingleton"    name="Selection"    hideFromEditors="true"    selectable="true"    selected="false"    singletonTag="Singleton"
    
    As the purpose of indentation is to add space in front of the _lines_, adding that space between the XML attributes seems unnecessary. With these changes, the same entry now looks like this:
    
      <Selection
        id="vtkMRMLSelectionNodeSingleton" name="Selection" hideFromEditors="true" selectable="true" selected="false"
    
    History:
    
    In the first implementation of `WriteXML()`, the name of the node (e.g vtkMRMLModelNode.cxx) was explicitly serialized and indented in the function by explicitly using `nIndent`.
    See r40 (COMP: added vtkITK and MRML libs). Code like this was used:
    
        vtkIndent i1(nIndent);
        of << i1 << "<Model";
    
        of << " id='" << this->ID << "'";
        if (this->Name && strcmp(this->Name, ""))
        {
          of << " name='" << this->Name << "'";
        }
        [...]
        if (this->Color && strcmp(this->Color, ""))
        {
          of << " color='" << this->Color << "'";
        }
    
    Then, this approach was reviewed in r133 (ENH: more transform functionality) by systematically calling the base class implementation of WriteXML() function.
    
    Code above was then updated like this:
    
       Superclass::WriteXML(of, nIndent);
       vtkIndent indent(nIndent);
    
       if (this->Color && strcmp(this->Color, ""))
       {
         of << indent << " color='" << this->Color << "'";
       }
    
    This commit simplifies the XML serialization and explicitly mark `indent` parameter as deprecated.
    
    
    git-svn-id: http://svn.slicer.org/Slicer4/trunk@25870 3bd1e089-480b-0410-8dfb-8563597acbee
    4e0a67e3