1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
/*=========================================================================
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.kitware.com/VolViewCopyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "XML/vtkXMLVVApplicationReader.h"
#include "vtkObjectFactory.h"
#include "vtkVVApplication.h"
#include "vtkXMLDataElement.h"
#include "vtkVVWindowBase.h"
#include "XML/vtkXMLVVApplicationWriter.h"
vtkStandardNewMacro(vtkXMLVVApplicationReader);
vtkCxxRevisionMacro(vtkXMLVVApplicationReader, "$Revision: 1.7 $");
//----------------------------------------------------------------------------
const char* vtkXMLVVApplicationReader::GetRootElementName()
{
return "VVApplication";
}
//----------------------------------------------------------------------------
int vtkXMLVVApplicationReader::Parse(vtkXMLDataElement *elem)
{
if (!this->Superclass::Parse(elem))
{
return 0;
}
vtkVVApplication *obj = vtkVVApplication::SafeDownCast(this->Object);
if (!obj)
{
vtkWarningMacro(<< "The VVApplication is not set!");
return 0;
}
// Get Attributes
// Get nested elements
vtkXMLDataElement *nested_elem;
// Windows
nested_elem = elem->FindNestedElementWithName(
vtkXMLVVApplicationWriter::GetWindowsElementName());
if (nested_elem)
{
int idx_w = 0, idx,
nb_nested_elems_w = nested_elem->GetNumberOfNestedElements();
for (idx = 0; idx < nb_nested_elems_w; idx++)
{
vtkXMLDataElement *nested_elem_w = nested_elem->GetNestedElement(idx);
vtkVVWindowBase *win = vtkVVWindowBase::SafeDownCast(
obj->GetNthWindow(idx_w));
if (win)
{
vtkXMLObjectReader *xmlr = win->GetNewXMLReader();
xmlr->Parse(nested_elem_w);
xmlr->Delete();
idx_w++;
}
}
}
return 1;
}
//----------------------------------------------------------------------------
void vtkXMLVVApplicationReader::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
}
|