def getBeginGeometryXMLOutput(): "Get the string representation of this object info." output = cStringIO.StringIO() output.write("<?xml version='1.0' ?>\n") xml_writer.addBeginXMLTag({'version': '2010-03-17'}, 0, 'booleangeometry', output) return output
def addXMLSection(self, depth, output): "Add the xml section for this object." xml_writer.addBeginXMLTag({}, depth, 'vertices', output) vertices = self.originalVertices if vertices == None: vertices = self.vertices for vertex in vertices: attributeTable = { 'x': str(vertex.x), 'y': str(vertex.y), 'z': str(vertex.z) } xml_writer.addClosedXMLTag(attributeTable, depth + 1, 'vector3', output) xml_writer.addEndXMLTag(depth, 'vertices', output) xml_writer.addBeginXMLTag({}, depth, 'faces', output) for face in self.faces: attributeTable = {} for vertexIndexIndex in xrange(len(face.vertexIndexes)): vertexIndex = face.vertexIndexes[vertexIndexIndex] attributeTable['vertex' + str(vertexIndexIndex)] = str(vertexIndex) xml_writer.addClosedXMLTag(attributeTable, depth + 1, 'face', output) xml_writer.addEndXMLTag(depth, 'faces', output)
def addXML( self, depth, output ): "Add xml for this object." attributeTable = self.getAttributeTable() attributeTable[ 'id' ] = self.getName() xml_writer.addBeginXMLTag( attributeTable, depth, self.getXMLClassName(), output ) if self.matrix4X4 != None: self.matrix4X4.addXML( depth + 1, output ) self.addXMLSection( depth + 1, output ) xml_writer.addEndXMLTag( depth, self.getXMLClassName(), output )
def addXML(self, depth, output): "Add xml for this object." attributeTable = self.getAttributeTable() attributeTable['id'] = self.getName() xml_writer.addBeginXMLTag(attributeTable, depth, self.getXMLClassName(), output) if self.matrix4X4 != None: self.matrix4X4.addXML(depth + 1, output) self.addXMLSection(depth + 1, output) xml_writer.addEndXMLTag(depth, self.getXMLClassName(), output)
def addXMLSection( self, depth, output ): "Add the xml section for this object." xml_writer.addBeginXMLTag( {}, depth, 'vertices', output ) vertices = self.originalVertices if vertices == None: vertices = self.vertices for vertex in vertices: attributeTable = { 'x' : str( vertex.x ), 'y' : str( vertex.y ), 'z' : str( vertex.z ) } xml_writer.addClosedXMLTag( attributeTable, depth + 1, 'vector3', output ) xml_writer.addEndXMLTag( depth, 'vertices', output ) xml_writer.addBeginXMLTag( {}, depth, 'faces', output ) for face in self.faces: attributeTable = {} for vertexIndexIndex in xrange( len( face.vertexIndexes ) ): vertexIndex = face.vertexIndexes[ vertexIndexIndex ] attributeTable[ 'vertex' + str( vertexIndexIndex ) ] = str( vertexIndex ) xml_writer.addClosedXMLTag( attributeTable, depth + 1, 'face', output ) xml_writer.addEndXMLTag( depth, 'faces', output )
def getBeginGeometryXMLOutput(): "Get the string representation of this object info." output = cStringIO.StringIO() output.write( "<?xml version='1.0' ?>\n" ) xml_writer.addBeginXMLTag( { 'version' : '2010-03-17' }, 0, 'booleangeometry', output ) return output