Esempio n. 1
0
 def test_orient_rad(self):
     marker = Marker(id='test',
                     orient='3.1415rad',
                     debug=True,
                     profile='full')
     self.assertEqual(marker.tostring(),
                      '<marker id="test" orient="3.1415rad" />')
Esempio n. 2
0
 def test_add_subelement_with_autoid(self):
     marker = Marker(debug=True, profile='full')
     marker.add(Group())
     self.assertTrue(
         re.match(r'^<marker id="id\d+"><g /></marker>$',
                  marker.tostring()),
         "getting an autoid for class Marker failed.")
Esempio n. 3
0
 def test_orient_number(self):
     marker = Marker(id='test', orient=30, debug=True, profile='full')
     self.assertEqual(marker.tostring(), '<marker id="test" orient="30" />')
Esempio n. 4
0
 def test_size(self):
     marker = Marker(id='test', size=(1, 2), debug=True, profile='full')
     self.assertEqual(
         marker.tostring(),
         '<marker id="test" markerHeight="2" markerWidth="1" />')
Esempio n. 5
0
 def test_insert(self):
     marker = Marker(id='test', insert=(1, 2), debug=True, profile='full')
     self.assertEqual(marker.tostring(),
                      '<marker id="test" refX="1" refY="2" />')
Esempio n. 6
0
 def test_add_subelement(self):
     marker = Marker(id='test', debug=True, profile='full')
     marker.add(Group())
     self.assertEqual(marker.tostring(), '<marker id="test"><g /></marker>')
Esempio n. 7
0
 def test_constructor(self):
     marker = Marker(id='test', orient='auto', debug=True, profile='full')
     self.assertEqual(marker.tostring(),
                      '<marker id="test" orient="auto" />')
Esempio n. 8
0
 def test_orient_number(self):
     marker = Marker(id='test', orient=30, debug=True, profile='full')
     self.assertEqual(marker.tostring(), '<marker id="test" orient="30" />')
Esempio n. 9
0
 def test_orient_rad(self):
     marker = Marker(id='test', orient='3.1415rad', debug=True, profile='full')
     self.assertEqual(marker.tostring(), '<marker id="test" orient="3.1415rad" />')
Esempio n. 10
0
 def test_size(self):
     marker = Marker(id='test', size=(1, 2), debug=True, profile='full')
     self.assertEqual(marker.tostring(), '<marker id="test" markerHeight="2" markerWidth="1" />')
Esempio n. 11
0
 def test_insert(self):
     marker = Marker(id='test', insert=(1, 2), debug=True, profile='full')
     self.assertEqual(marker.tostring(), '<marker id="test" refX="1" refY="2" />')
Esempio n. 12
0
 def test_add_subelement_with_autoid(self):
     marker = Marker(debug=True, profile='full')
     marker.add(Group())
     self.assertTrue(
         re.match('^<marker id="id\d+"><g /></marker>$',
                  marker.tostring()), "getting an autoid for class Marker failed.")
Esempio n. 13
0
 def test_add_subelement(self):
     marker = Marker(id='test', debug=True, profile='full')
     marker.add(Group())
     self.assertEqual(marker.tostring(), '<marker id="test"><g /></marker>')
Esempio n. 14
0
 def test_constructor(self):
     marker = Marker(id='test', orient='auto', debug=True, profile='full')
     self.assertEqual(marker.tostring(), '<marker id="test" orient="auto" />')
Esempio n. 15
0
def include_markers(dwg, endpoints):
	from svgwrite.container import Marker
	from svgwrite.shapes    import Circle, Line, Polyline
	arrowhead = Marker(
		insert=(4, 4), size=(4, 8), orient='auto', markerUnits='strokeWidth',
		id='arrowhead'
	)
	arrowhead.add(Polyline([(0, 8), (4, 4), (0, 0)]))
	dwg.defs.add(arrowhead)
	
	#TICKMARK
	tickmark = Marker(
		insert=(0.5, 5), size=(1, 10), orient='auto', markerUnits='strokeWidth',
		id='tickmark'
	)
	tickmark.add(Line((0, 0), (0, 10)))
	dwg.defs.add(tickmark)
	
	if not endpoints:
		return
	
	#DISCONTINUITY
	discontinuity = Marker(
		insert=(3.5, 3.5), size=(7, 7), markerUnits='strokeWidth',
		id='discontinuity'
	)
	discontinuity.add(Circle((3.5, 3.5), 2))
	dwg.defs.add(discontinuity)
	
	#CONTINUITY
	continuity = Marker(
		insert=(3.5, 3.5), size=(7, 7), markerUnits='strokeWidth',
		id='continuity'
	)
	continuity.add(Circle((3.5, 3.5), 2))
	dwg.defs.add(continuity)