00001 #include "shape.h" 00002 00003 bool Line::nodesetToXML( QDomDocument &doc, 00004 QDomElement &elem ) { 00005 QDomElement base = doc.createElement( "NodeSet" ); 00006 elem.appendChild( base ); 00007 00008 for ( unsigned int i=0; i < mNodeSet.size(); i++ ) 00009 mNodeSet[i].toXML( doc, base ); 00010 00011 return true; 00012 } 00013 00014 bool Line::nodesetFromXML( QDomElement &elem ) { 00015 QDomNodeList nodesetlist = 00016 elem.elementsByTagName( "NodeSet" ); 00017 if ( nodesetlist.count() <= 0 ) 00018 return false; 00019 00020 QDomElement base = nodesetlist.item( 0 ).toElement(); 00021 00022 QDomNodeList nset = base.elementsByTagName( "Node" ); 00023 for ( unsigned int i=0; i < nset.count(); i++ ) { 00024 QDomElement e = nset.item( i ).toElement(); 00025 Node node; 00026 node.fromXML( e ); 00027 mNodeSet.push_back( node ); 00028 } 00029 00030 return true; 00031 } 00032 00033 bool Line::fromXML( QDomElement &elem ) { 00034 if ( std::string( "Line" ).compare( (const char*)elem.tagName() ) ) 00035 return false; 00036 00037 nodesetFromXML( elem ); 00038 return true; 00039 } 00040 00041 bool Line::toXML( QDomDocument &doc, 00042 QDomElement &elem, 00043 std::string id ) { 00044 QDomElement base = doc.createElement( "Line" ); 00045 if ( id != "" ) 00046 base.setAttribute( "id", (char*)id.c_str() ); 00047 elem.appendChild( base ); 00048 00049 nodesetToXML( doc, base ); 00050 return true; 00051 } 00052 00053
Home |
Search |
Disclaimers & Privacy |
Contact Us GLIMSView Maintainer: dsoltesz@usgs.gov |