Beispiel #1
0
def processElementNodeByDerivation(derivation, elementNode):
	'Process the xml element by derivation.'
	if derivation == None:
		derivation = CopyDerivation(elementNode)
	if derivation.target == None:
		print('Warning, copy could not get target for:')
		print(elementNode)
		return
	del elementNode.attributes['target']
	copyMatrix = matrix.getBranchMatrixSetElementNode(elementNode)
	targetMatrix = matrix.getBranchMatrixSetElementNode(derivation.target)
	targetDictionaryCopy = evaluate.removeIdentifiersFromDictionary(derivation.target.attributes.copy())
	targetDictionaryCopy.update(elementNode.attributes)
	elementNode.attributes = targetDictionaryCopy
	euclidean.removeTrueFromDictionary(elementNode.attributes, 'visible')
	elementNode.localName = derivation.target.localName
	derivation.target.copyXMLChildNodes(elementNode.getIDSuffix(), elementNode)
	elementNode.getXMLProcessor().processElementNode(elementNode)
	if copyMatrix != None and targetMatrix != None:
		elementNode.xmlObject.matrix4X4 = copyMatrix.getSelfTimesOther(targetMatrix.tetragrid)
	if elementNode.xmlObject == None:
		return
	if len(elementNode.xmlObject.getPaths()) > 0:
		lineation.processElementNode(elementNode)
		return
	geometryOutput = elementNode.xmlObject.getGeometryOutput()
	if geometryOutput == None:
		return
	solidMatchingPlugins = solid.getSolidMatchingPlugins(elementNode)
	if len(solidMatchingPlugins) == 0:
		return
	geometryOutput = solid.getGeometryOutputByManipulation(elementNode, geometryOutput)
	elementNode.xmlObject.transformGeometryOutput(geometryOutput)
	lineation.removeChildNodesFromElementObject(elementNode)
	elementNode.getXMLProcessor().convertElementNode(elementNode, geometryOutput)
Beispiel #2
0
def processElementNodeByDerivation(derivation, elementNode):
	'Process the xml element by derivation.'
	if derivation == None:
		derivation = CopyDerivation(elementNode)
	if derivation.target == None:
		print('Warning, copy could not get target for:')
		print(elementNode)
		return
	del elementNode.attributes['target']
	copyMatrix = matrix.getBranchMatrixSetElementNode(elementNode)
	targetMatrix = matrix.getBranchMatrixSetElementNode(derivation.target)
	targetDictionaryCopy = evaluate.removeIdentifiersFromDictionary(derivation.target.attributes.copy())
	targetDictionaryCopy.update(elementNode.attributes)
	elementNode.attributes = targetDictionaryCopy
	euclidean.removeTrueFromDictionary(elementNode.attributes, 'visible')
	elementNode.localName = derivation.target.localName
	derivation.target.copyXMLChildNodes(elementNode.getIDSuffix(), elementNode)
	elementNode.getXMLProcessor().processElementNode(elementNode)
	if copyMatrix != None and targetMatrix != None:
		elementNode.xmlObject.matrix4X4 = copyMatrix.getSelfTimesOther(targetMatrix.tetragrid)
	if elementNode.xmlObject == None:
		return
	if len(elementNode.xmlObject.getPaths()) > 0:
		lineation.processElementNode(elementNode)
		return
	geometryOutput = elementNode.xmlObject.getGeometryOutput()
	if geometryOutput == None:
		return
	solidMatchingPlugins = solid.getSolidMatchingPlugins(elementNode)
	if len(solidMatchingPlugins) == 0:
		return
	geometryOutput = solid.getGeometryOutputByManipulation(elementNode, geometryOutput)
	elementNode.xmlObject.transformGeometryOutput(geometryOutput)
	lineation.removeChildNodesFromElementObject(elementNode)
	elementNode.getXMLProcessor().convertElementNode(elementNode, geometryOutput)
Beispiel #3
0
 def addXML(self, depth, output):
     'Add xml for this object.'
     attributeCopy = {}
     if self.xmlElement != None:
         attributeCopy = evaluate.getEvaluatedDictionaryByCopyKeys(['paths', 'target', 'vertexes'], self.xmlElement)
     euclidean.removeElementsFromDictionary(attributeCopy, matrix.getKeysM())
     euclidean.removeTrueFromDictionary(attributeCopy, 'visible')
     innerOutput = StringIO.StringIO()
     self.addXMLInnerSection(depth + 1, innerOutput)
     self.addXMLArchivableObjects(depth + 1, innerOutput)
     xml_simple_writer.addBeginEndInnerXMLTag(attributeCopy, depth, innerOutput.getvalue(), self.getXMLLocalName(), output)
Beispiel #4
0
	def addXML(self, depth, output):
		"Add xml for this object."
		attributeCopy = {}
		if self.xmlElement != None:
			attributeCopy = evaluate.getEvaluatedDictionary( [], self.xmlElement )
		euclidean.removeListFromDictionary( attributeCopy, matrix.getMatrixKeys() )
		euclidean.removeTrueFromDictionary( attributeCopy, 'visible')
		innerOutput = cStringIO.StringIO()
		self.addXMLInnerSection( depth + 1, innerOutput )
		self.addXMLArchivableObjects( depth + 1, innerOutput )
		xml_simple_writer.addBeginEndInnerXMLTag( attributeCopy, self.getXMLClassName(), depth, innerOutput.getvalue(), output )
Beispiel #5
0
	def addXML(self, depth, output):
		'Add xml for this object.'
		attributeCopy = {}
		if self.xmlElement != None:
			attributeCopy = evaluate.getEvaluatedDictionaryByCopyKeys(['paths', 'target', 'vertexes'], self.xmlElement)
		euclidean.removeElementsFromDictionary(attributeCopy, matrix.getKeysM())
		euclidean.removeTrueFromDictionary(attributeCopy, 'visible')
		innerOutput = cStringIO.StringIO()
		self.addXMLInnerSection(depth + 1, innerOutput)
		self.addXMLArchivableObjects(depth + 1, innerOutput)
		xml_simple_writer.addBeginEndInnerXMLTag(attributeCopy, self.getXMLClassName(), depth, innerOutput.getvalue(), output)
Beispiel #6
0
def addPathToGroup(derivation, groupDictionaryCopy, path, targetMatrix, totalIndex):
	"""Add path to the array group."""
	for pointIndex, point in enumerate(path):
		arrayElement = derivation.target.getCopy(derivation.xmlElement.getIDSuffix(totalIndex), derivation.xmlElement)
		arrayDictionary = arrayElement.attributeDictionary
		arrayDictionary['visible'] = str(derivation.visible).lower()
		arrayDictionary.update(groupDictionaryCopy)
		euclidean.removeTrueFromDictionary(arrayDictionary, 'visible')
		vertexMatrix = matrix.Matrix(matrix.getTranslateTetragridByTranslation(point))
		zAngle = totalIndex * 50.0
		rotationMatrix = getRotationMatrix(arrayDictionary, derivation, path, point, pointIndex)
		arrayElementMatrix = vertexMatrix.getSelfTimesOther(rotationMatrix.getSelfTimesOther(targetMatrix.tetragrid).tetragrid)
		arrayDictionary.update(arrayElementMatrix.getAttributeDictionary('matrix.'))
		arrayDictionary['_arrayIndex'] = totalIndex
		arrayDictionary['_arrayPoint'] = point
		totalIndex += 1
Beispiel #7
0
def addPathToGroup(derivation, groupDictionaryCopy, path, targetMatrix, totalIndex):
	'Add path to the array group.'
	for pointIndex, point in enumerate(path):
		arrayElement = derivation.target.getCopy(derivation.elementNode.getIDSuffix(totalIndex), derivation.elementNode)
		arrayDictionary = arrayElement.attributes
		arrayDictionary['visible'] = str(derivation.visible).lower()
		arrayDictionary.update(groupDictionaryCopy)
		euclidean.removeTrueFromDictionary(arrayDictionary, 'visible')
		vertexMatrix = matrix.Matrix(matrix.getTranslateTetragridByTranslation(point))
		zAngle = totalIndex * 50.0
		rotationMatrix = getRotationMatrix(arrayDictionary, derivation, path, point, pointIndex)
		arrayElementMatrix = vertexMatrix.getSelfTimesOther(rotationMatrix.getSelfTimesOther(targetMatrix.tetragrid).tetragrid)
		arrayDictionary.update(arrayElementMatrix.getAttributes('matrix.'))
		arrayDictionary['_arrayIndex'] = totalIndex
		arrayDictionary['_arrayPoint'] = point
		totalIndex += 1
Beispiel #8
0
def processXMLElement(xmlElement):
	'Process the xml element.'
	target = evaluate.getXMLElementByKey('target', xmlElement)
	if target == None:
		print('Warning, copy could not get target.')
		return
	del xmlElement.attributeDictionary['target']
	copyMatrix = matrix.getFromObjectOrXMLElement(xmlElement)
	targetMatrix = matrix.getFromObjectOrXMLElement(target)
	targetDictionaryCopy = target.attributeDictionary.copy()
	euclidean.removeElementsFromDictionary(targetDictionaryCopy, ['id', 'name'])
	targetDictionaryCopy.update(xmlElement.attributeDictionary)
	xmlElement.attributeDictionary = targetDictionaryCopy
	euclidean.removeTrueFromDictionary(xmlElement.attributeDictionary, 'visible')
	xmlElement.className = target.className
	target.copyXMLChildren(xmlElement.getIDSuffix(), xmlElement)
	xmlElement.getXMLProcessor().processXMLElement(xmlElement)
	if copyMatrix != None and targetMatrix != None:
		xmlElement.object.matrix4X4 = copyMatrix.getSelfTimesOther(targetMatrix.tetragrid)
Beispiel #9
0
def processXMLElementByDerivation(derivation, xmlElement):
	"""Process the xml element by derivation."""
	if derivation is None:
		derivation = CopyDerivation(xmlElement)
	if derivation.target is None:
		print('Warning, copy could not get target for:')
		print(xmlElement)
		return
	del xmlElement.attributeDictionary['target']
	copyMatrix = matrix.getBranchMatrixSetXMLElement(xmlElement)
	targetMatrix = matrix.getBranchMatrixSetXMLElement(derivation.target)
	targetDictionaryCopy = derivation.target.attributeDictionary.copy()
	evaluate.removeIdentifiersFromDictionary(targetDictionaryCopy)
	targetDictionaryCopy.update(xmlElement.attributeDictionary)
	xmlElement.attributeDictionary = targetDictionaryCopy
	euclidean.removeTrueFromDictionary(xmlElement.attributeDictionary, 'visible')
	xmlElement.className = derivation.target.className
	derivation.target.copyXMLChildren(xmlElement.getIDSuffix(), xmlElement)
	xmlElement.getXMLProcessor().processXMLElement(xmlElement)
	if copyMatrix is not None and targetMatrix is not None:
		xmlElement.xmlObject.matrix4X4 = copyMatrix.getSelfTimesOther(targetMatrix.tetragrid)
Beispiel #10
0
def processXMLElementByDerivation(derivation, xmlElement):
	'Process the xml element by derivation.'
	if derivation == None:
		derivation = CopyDerivation(xmlElement)
	if derivation.target == None:
		print('Warning, copy could not get target for:')
		print(xmlElement)
		return
	del xmlElement.attributeDictionary['target']
	copyMatrix = matrix.getBranchMatrixSetXMLElement(xmlElement)
	targetMatrix = matrix.getBranchMatrixSetXMLElement(derivation.target)
	targetDictionaryCopy = derivation.target.attributeDictionary.copy()
	evaluate.removeIdentifiersFromDictionary(targetDictionaryCopy)
	targetDictionaryCopy.update(xmlElement.attributeDictionary)
	xmlElement.attributeDictionary = targetDictionaryCopy
	euclidean.removeTrueFromDictionary(xmlElement.attributeDictionary, 'visible')
	xmlElement.localName = derivation.target.localName
	derivation.target.copyXMLChildNodes(xmlElement.getIDSuffix(), xmlElement)
	xmlElement.getXMLProcessor().processXMLElement(xmlElement)
	if copyMatrix != None and targetMatrix != None:
		xmlElement.xmlObject.matrix4X4 = copyMatrix.getSelfTimesOther(targetMatrix.tetragrid)
def processElementNodeByDerivation(derivation, elementNode):
	'Process the xml element by derivation.'
	if derivation == None:
		derivation = CopyDerivation(elementNode)
	if derivation.target == None:
		print('Warning, copy could not get target for:')
		print(elementNode)
		return
	del elementNode.attributes['target']
	copyMatrix = matrix.getBranchMatrixSetElementNode(elementNode)
	targetMatrix = matrix.getBranchMatrixSetElementNode(derivation.target)
	targetDictionaryCopy = derivation.target.attributes.copy()
	evaluate.removeIdentifiersFromDictionary(targetDictionaryCopy)
	targetDictionaryCopy.update(elementNode.attributes)
	elementNode.attributes = targetDictionaryCopy
	euclidean.removeTrueFromDictionary(elementNode.attributes, 'visible')
	elementNode.localName = derivation.target.localName
	derivation.target.copyXMLChildNodes(elementNode.getIDSuffix(), elementNode)
	elementNode.getXMLProcessor().processElementNode(elementNode)
	if copyMatrix != None and targetMatrix != None:
		elementNode.xmlObject.matrix4X4 = copyMatrix.getSelfTimesOther(targetMatrix.tetragrid)
Beispiel #12
0
def processElementNodeByDerivation(derivation, elementNode):
    'Process the xml element by derivation.'
    if derivation == None:
        derivation = CopyDerivation(elementNode)
    if derivation.target == None:
        print('Warning, copy could not get target for:')
        print(elementNode)
        return
    del elementNode.attributes['target']
    copyMatrix = matrix.getBranchMatrixSetElementNode(elementNode)
    targetMatrix = matrix.getBranchMatrixSetElementNode(derivation.target)
    targetDictionaryCopy = derivation.target.attributes.copy()
    evaluate.removeIdentifiersFromDictionary(targetDictionaryCopy)
    targetDictionaryCopy.update(elementNode.attributes)
    elementNode.attributes = targetDictionaryCopy
    euclidean.removeTrueFromDictionary(elementNode.attributes, 'visible')
    elementNode.localName = derivation.target.localName
    derivation.target.copyXMLChildNodes(elementNode.getIDSuffix(), elementNode)
    elementNode.getXMLProcessor().processElementNode(elementNode)
    if copyMatrix != None and targetMatrix != None:
        elementNode.xmlObject.matrix4X4 = copyMatrix.getSelfTimesOther(
            targetMatrix.tetragrid)
Beispiel #13
0
def processXMLElement(xmlElement):
    'Process the xml element.'
    target = evaluate.getXMLElementByKey('target', xmlElement)
    if target == None:
        print('Warning, copy could not get target.')
        return
    del xmlElement.attributeDictionary['target']
    copyMatrix = matrix.getFromObjectOrXMLElement(xmlElement)
    targetMatrix = matrix.getFromObjectOrXMLElement(target)
    targetDictionaryCopy = target.attributeDictionary.copy()
    euclidean.removeElementsFromDictionary(targetDictionaryCopy,
                                           ['id', 'name'])
    targetDictionaryCopy.update(xmlElement.attributeDictionary)
    xmlElement.attributeDictionary = targetDictionaryCopy
    euclidean.removeTrueFromDictionary(xmlElement.attributeDictionary,
                                       'visible')
    xmlElement.className = target.className
    target.copyXMLChildren(xmlElement.getIDSuffix(), xmlElement)
    xmlElement.getXMLProcessor().processXMLElement(xmlElement)
    if copyMatrix != None and targetMatrix != None:
        xmlElement.object.matrix4X4 = copyMatrix.getSelfTimesOther(
            targetMatrix.tetragrid)