コード例 #1
0
	def createBoneLine(self, point1, point2, idNr, direction):
		createDiamondMarker(self)
		
		svg_uri = u'http://www.w3.org/2000/svg'
		line = etree.Element('{%s}%s' % (svg_uri,'path'))
		
		line.set('d', 'M%f %fL%f %f' %(point1[0], point1[1], point2[0], point2[1]))
		line.set('vvpType', Types.Bone)
		line.set('body', str(idNr))
		line.set('style', 'fill:none;stroke:#c00044;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:4,2,1,2;stroke-dashoffset:0;marker-start:url(#DiamondMarker);marker-end:url(#DiamondMarker);marker-mid:url(#DiamondMarker)')
		
		line.set('direction', direction)
		
		return line
コード例 #2
0
	def createDistanceJointLine(self, id1, id2, point1, point2):
		createDiamondMarker(self)
		
		svg_uri = u'http://www.w3.org/2000/svg'
		line = etree.Element('{%s}%s' % (svg_uri,'path'))
		
		self.setDistanceJointParams(line)
			
		
		line.set('d', 'M%f %fL%f %f' %(point1[0], point1[1], point2[0], point2[1]))
		line.set('vvpType', JointType.DistanceJoint)
		line.set('body1', str(id1))
		line.set('body2', str(id2))
		line.set('style', 'fill:none;stroke:#000ff0;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#DiamondMarker);marker-end:url(#DiamondMarker);stroke-miterlimit:4;stroke-dasharray:3,3;stroke-dashoffset:0')
		
		
		return line