Exemplo 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" />')
Exemplo 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.")
Exemplo 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" />')
Exemplo 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" />')
Exemplo 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" />')
Exemplo 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>')
Exemplo 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" />')
Exemplo 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" />')
Exemplo 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" />')
Exemplo 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" />')
Exemplo 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" />')
Exemplo 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.")
Exemplo 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>')
Exemplo 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" />')
Exemplo 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)