Marthee commited on
Commit
e84f207
·
verified ·
1 Parent(s): 10825e6

Update dxf__omar3_2.py

Browse files
Files changed (1) hide show
  1. dxf__omar3_2.py +828 -0
dxf__omar3_2.py CHANGED
@@ -83,6 +83,18 @@ from collections import Counter
83
 
84
  from math import isclose
85
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
  """## Notes"""
88
 
@@ -98,7 +110,340 @@ This portion is used to convert vertices read from dxf to pixels in order to acc
98
 
99
 
100
  '''
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
  """PDF to image"""
104
 
@@ -1272,6 +1617,436 @@ def adjustannotations(OutputPdfStage1,text_with_positions):
1272
  return output_pdf_io.read() , annotations_data
1273
 
1274
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1275
 
1276
 
1277
  def mainFunctionDrawImgPdf(datadoc,dxfpath, dxfratio,SearchArray,pdfpath=0,pdfname=0,pdf_content=0):
@@ -1314,6 +2089,17 @@ def mainFunctionDrawImgPdf(datadoc,dxfpath, dxfratio,SearchArray,pdfpath=0,pdfna
1314
 
1315
 
1316
  hatched_areas,Legendarray = get_hatched_areas(datadoc,dxfpath,FinalRatio,rotationangle,SearchArray)
 
 
 
 
 
 
 
 
 
 
 
1317
  allshapes=[]
1318
  # Iterate through each polygon in metric units
1319
  NewColors = []
@@ -1324,6 +2110,9 @@ def mainFunctionDrawImgPdf(datadoc,dxfpath, dxfratio,SearchArray,pdfpath=0,pdfna
1324
  i=0
1325
  flagcolor = 0
1326
  ColorCheck=[]
 
 
 
1327
 
1328
 
1329
  for polygon in hatched_areas:
@@ -1468,6 +2257,18 @@ def mainFunctionDrawImgPdf(datadoc,dxfpath, dxfratio,SearchArray,pdfpath=0,pdfna
1468
 
1469
 
1470
  cv2.drawContours(imgg, [np.array(cntPoints)], -1, ([NewColors[2],NewColors[1],NewColors[0]]), thickness=-1)
 
 
 
 
 
 
 
 
 
 
 
 
1471
 
1472
  annot11 = page2.add_polygon_annot( points=shapeeArea) # 'Polygon'
1473
  annot11.set_border(width=0.2)
@@ -1489,6 +2290,33 @@ def mainFunctionDrawImgPdf(datadoc,dxfpath, dxfratio,SearchArray,pdfpath=0,pdfna
1489
  i += 1
1490
  alpha = 0.8 # Transparency factor.
1491
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1492
  page2.set_rotation(rotationOld)
1493
  Correct_img=flip(imgg)
1494
 
 
83
 
84
  from math import isclose
85
 
86
+ from typing import List, Tuple, Any, Set
87
+ from shapely.geometry import Polygon, MultiPolygon, GeometryCollection
88
+ from shapely.ops import unary_union
89
+
90
+ import random
91
+ import string
92
+ import zlib
93
+ import base64
94
+ import datetime
95
+ import uuid
96
+ from xml.etree.ElementTree import Element, SubElement, tostring, ElementTree
97
+ from xml.dom.minidom import parseString
98
 
99
  """## Notes"""
100
 
 
110
 
111
 
112
  '''
113
+ AllhatchesCodes= {
114
+ 'Brick':'<</Length 172/Type/Pattern/PatternType 1/PaintType 1/TilingType 1/Resources<<>>/Matrix[1 0 0 1 0 0]/BBox[0 0 18 18]/XStep 18/YStep 18>>\nstream\n{fillcolor} rg 0 0 18 18 re f {strokecolor} RG 1 w -1 18 m 19.00001 18 l 9 18 m 9 9 l -1 9 m 19.00001 9 l 0 9 m 0 0 l -1 0 m 19.00001 0 l 18 0 m 18 9 l S \nendstream'
115
+ ,
116
+ 'DiagonalBrick': '''<</Length 138
117
+ /Type/Pattern/PatternType 1/PaintType 1/TilingType 1
118
+ /Resources <<>>
119
+ /Matrix [1 0 0 1 0 0]
120
+ /BBox [0 0 18 18]
121
+ /XStep 18/YStep 18>>stream
122
+ {fillcolor} rg 0 0 18 18 re f {strokecolor} RG 1 w -1 -1 m 19.00001 19.00001 l 9 9 m 0 18 l -1 17 m 1 19.00001 l 17 -1 m 19.00001 1 l S
123
+ endstream'''
124
+ ,
125
+ 'Horizontal':'''<</Length 113
126
+ /Type/Pattern/PatternType 1/PaintType 1/TilingType 1
127
+ /Resources<<>>
128
+ /Matrix[1 0 0 1 0 0]
129
+ /BBox[0 0 18 18]
130
+ /XStep 18/YStep 18>>\nstream\n
131
+ {fillcolor} rg 0 0 18 18 re f {strokecolor} RG 1 w -1 13.5 m 19.00001 13.5 l -1 4.5 m 19.00001 4.5 l S
132
+ endstream'''
133
+ ,
134
+ 'Vertical':'''<</Length 97
135
+ /Type/Pattern/PatternType 1/PaintType 1/TilingType 1
136
+ /Resources<<>>
137
+ /Matrix[1 0 0 1 0 0]
138
+ /BBox[0 0 18 18]
139
+ /XStep 18/YStep 18>>\nstream\n
140
+ {fillcolor} rg 0 0 18 18 re f {strokecolor} RG 1 w 4.5 19.00001 m 4.5 -1 l 13.5 19.00001 m 13.5 -1 l S
141
+ endstream'''
142
+ ,
143
+ 'DiagonalDown':'''<</Length 133
144
+ /Type/Pattern/PatternType 1/PaintType 1/TilingType 1
145
+ /Resources<<>>/Matrix[1 0 0 1 0 0]
146
+ /BBox[0 0 18 18]/XStep 18/YStep 18>>\nstream\n
147
+ {fillcolor} rg 0 0 18 18 re f {strokecolor} RG 1 w -1 19.00001 m 19.00001 -1 l -1 1 m 1 -1 l 17 19.00001 m 19.00001 17 l S
148
+ endstream'''
149
+ ,
150
+ 'DiagonalUp':'''<</Length 125
151
+ /Type/Pattern/PatternType 1/PaintType 1/TilingType 1
152
+ /Resources<<>>/Matrix[1 0 0 1 0 0]
153
+ /BBox[0 0 18 18]/XStep 18/YStep 18>>\nstream\n
154
+ {fillcolor} rg 0 0 18 18 re f {strokecolor} RG 1 w -1 17 m 1 19.00001 l -1 -1 m 19.00001 19.00001 l 17 -1 m 19.00001 1 l S
155
+ endstream'''
156
+ ,
157
+ 'Grid':'''<</Length 163
158
+ /Type/Pattern/PatternType 1/PaintType 1/TilingType 1
159
+ /Resources<<>>/Matrix[1 0 0 1 0 0]
160
+ /BBox[0 0 18 18]/XStep 18/YStep 18>>\nstream\n
161
+ {fillcolor} rg 0 0 18 18 re f {strokecolor} RG 1 w 4.5 19.00001 m 4.5 -1 l 13.5 19.00001 m 13.5 -1 l -1 13.5 m 19.00001 13.5 l -1 4.5 m 19.00001 4.5 l S
162
+ endstream'''
163
+ ,
164
+ 'Weave':'''<</Length 260
165
+ /Type/Pattern/PatternType 1/PaintType 1/TilingType 1
166
+ /Resources<<>>/Matrix[1 0 0 1 0 0]
167
+ /BBox[0 0 18 18]/XStep 18/YStep 18>>\nstream\n
168
+ {fillcolor} rg 0 0 18 18 re f {strokecolor} RG 1 w -1 19.00001 m 4.5 13.5 l -1 7.999999 m 10 19.00001 l 7.999999 19.00001 m 19.00001 7.999999 l 17 19.00001 m 19.00001 17 l -1 -1 m 13.5 13.5 l 4.5 4.5 m 10 -1 l 9 9 m 19.00001 -1 l 18 9 m 13.5 4.5 l S
169
+ endstream'''
170
+ ,
171
+ '10Dots':'''<</Length 6765/Type/Pattern/PatternType 1/PaintType 1/TilingType 1/Resources<<>>
172
+ /Matrix[1 0 0 1 0 0]/BBox[0 0 18 18]/XStep 18/YStep 18>>\nstream\n
173
+ {fillcolor} rg 0 0 18 18 re f {strokecolor} RG 1 w 0 -0.5 m 0.2761424 -0.5 0.5 -0.2761424 0.5 0 c 0.5 0.2761424 0.2761424 0.5 0 0.5 c -0.2761424 0.5 -0.5 0.2761424 -0.5 0 c -0.5 -0.2761424 -0.2761424 -0.5 0 -0.5 c h 0 4 m 0.2761424 4 0.5 4.223857 0.5 4.5 c 0.5 4.776143 0.2761424 5 0 5 c -0.2761424 5 -0.5 4.776143 -0.5 4.5 c -0.5 4.223857 -0.2761424 4 0 4 c h 0 8.5 m 0.2761424 8.5 0.5 8.723858 0.5 9 c 0.5 9.276142 0.2761424 9.5 0 9.5 c -0.2761424 9.5 -0.5 9.276142 -0.5 9 c -0.5 8.723858 -0.2761424 8.5 0 8.5 c h 0 13 m 0.2761424 13 0.5 13.22386 0.5 13.5 c 0.5 13.77614 0.2761424 14 0 14 c -0.2761424 14 -0.5 13.77614 -0.5 13.5 c -0.5 13.22386 -0.2761424 13 0 13 c h 0 17.5 m 0.2761424 17.5 0.5 17.72386 0.5 18 c 0.5 18.27614 0.2761424 18.5 0 18.5 c -0.2761424 18.5 -0.5 18.27614 -0.5 18 c -0.5 17.72386 -0.2761424 17.5 0 17.5 c h 4.5 -0.5 m 4.776143 -0.5 5 -0.2761424 5 0 c 5 0.2761424 4.776143 0.5 4.5 0.5 c 4.223857 0.5 4 0.2761424 4 0 c 4 -0.2761424 4.223857 -0.5 4.5 -0.5 c h 4.5 4 m 4.776143 4 5 4.223857 5 4.5 c 5 4.776143 4.776143 5 4.5 5 c 4.223857 5 4 4.776143 4 4.5 c 4 4.223857 4.223857 4 4.5 4 c h 4.5 8.5 m 4.776143 8.5 5 8.723858 5 9 c 5 9.276142 4.776143 9.5 4.5 9.5 c 4.223857 9.5 4 9.276142 4 9 c 4 8.723858 4.223857 8.5 4.5 8.5 c h 4.5 13 m 4.776143 13 5 13.22386 5 13.5 c 5 13.77614 4.776143 14 4.5 14 c 4.223857 14 4 13.77614 4 13.5 c 4 13.22386 4.223857 13 4.5 13 c h 4.5 17.5 m 4.776143 17.5 5 17.72386 5 18 c 5 18.27614 4.776143 18.5 4.5 18.5 c 4.223857 18.5 4 18.27614 4 18 c 4 17.72386 4.223857 17.5 4.5 17.5 c h 9 -0.5 m 9.276142 -0.5 9.5 -0.2761424 9.5 0 c 9.5 0.2761424 9.276142 0.5 9 0.5 c 8.723858 0.5 8.5 0.2761424 8.5 0 c 8.5 -0.2761424 8.723858 -0.5 9 -0.5 c h 9 4 m 9.276142 4 9.5 4.223857 9.5 4.5 c 9.5 4.776143 9.276142 5 9 5 c 8.723858 5 8.5 4.776143 8.5 4.5 c 8.5 4.223857 8.723858 4 9 4 c h 9 8.5 m 9.276142 8.5 9.5 8.723858 9.5 9 c 9.5 9.276142 9.276142 9.5 9 9.5 c 8.723858 9.5 8.5 9.276142 8.5 9 c 8.5 8.723858 8.723858 8.5 9 8.5 c h 9 13 m 9.276142 13 9.5 13.22386 9.5 13.5 c 9.5 13.77614 9.276142 14 9 14 c 8.723858 14 8.5 13.77614 8.5 13.5 c 8.5 13.22386 8.723858 13 9 13 c h 9 17.5 m 9.276142 17.5 9.5 17.72386 9.5 18 c 9.5 18.27614 9.276142 18.5 9 18.5 c 8.723858 18.5 8.5 18.27614 8.5 18 c 8.5 17.72386 8.723858 17.5 9 17.5 c h 13.5 -0.5 m 13.77614 -0.5 14 -0.2761424 14 0 c 14 0.2761424 13.77614 0.5 13.5 0.5 c 13.22386 0.5 13 0.2761424 13 0 c 13 -0.2761424 13.22386 -0.5 13.5 -0.5 c h 13.5 4 m 13.77614 4 14 4.223857 14 4.5 c 14 4.776143 13.77614 5 13.5 5 c 13.22386 5 13 4.776143 13 4.5 c 13 4.223857 13.22386 4 13.5 4 c h 13.5 8.5 m 13.77614 8.5 14 8.723858 14 9 c 14 9.276142 13.77614 9.5 13.5 9.5 c 13.22386 9.5 13 9.276142 13 9 c 13 8.723858 13.22386 8.5 13.5 8.5 c h 13.5 13 m 13.77614 13 14 13.22386 14 13.5 c 14 13.77614 13.77614 14 13.5 14 c 13.22386 14 13 13.77614 13 13.5 c 13 13.22386 13.22386 13 13.5 13 c h 13.5 17.5 m 13.77614 17.5 14 17.72386 14 18 c 14 18.27614 13.77614 18.5 13.5 18.5 c 13.22386 18.5 13 18.27614 13 18 c 13 17.72386 13.22386 17.5 13.5 17.5 c h 18 -0.5 m 18.27614 -0.5 18.5 -0.2761424 18.5 0 c 18.5 0.2761424 18.27614 0.5 18 0.5 c 17.72386 0.5 17.5 0.2761424 17.5 0 c 17.5 -0.2761424 17.72386 -0.5 18 -0.5 c h 18 4 m 18.27614 4 18.5 4.223857 18.5 4.5 c 18.5 4.776143 18.27614 5 18 5 c 17.72386 5 17.5 4.776143 17.5 4.5 c 17.5 4.223857 17.72386 4 18 4 c h 18 8.5 m 18.27614 8.5 18.5 8.723858 18.5 9 c 18.5 9.276142 18.27614 9.5 18 9.5 c 17.72386 9.5 17.5 9.276142 17.5 9 c 17.5 8.723858 17.72386 8.5 18 8.5 c h 18 13 m 18.27614 13 18.5 13.22386 18.5 13.5 c 18.5 13.77614 18.27614 14 18 14 c 17.72386 14 17.5 13.77614 17.5 13.5 c 17.5 13.22386 17.72386 13 18 13 c h 18 17.5 m 18.27614 17.5 18.5 17.72386 18.5 18 c 18.5 18.27614 18.27614 18.5 18 18.5 c 17.72386 18.5 17.5 18.27614 17.5 18 c 17.5 17.72386 17.72386 17.5 18 17.5 c h 2.25 1.75 m 2.526142 1.75 2.75 1.973858 2.75 2.25 c 2.75 2.526142 2.526142 2.75 2.25 2.75 c 1.973858 2.75 1.75 2.526142 1.75 2.25 c 1.75 1.973858 1.973858 1.75 2.25 1.75 c h 2.25 6.25 m 2.526142 6.25 2.75 6.473857 2.75 6.75 c 2.75 7.026143 2.526142 7.25 2.25 7.25 c 1.973858 7.25 1.75 7.026143 1.75 6.75 c 1.75 6.473857 1.973858 6.25 2.25 6.25 c h 2.25 10.75 m 2.526142 10.75 2.75 10.97386 2.75 11.25 c 2.75 11.52614 2.526142 11.75 2.25 11.75 c 1.973858 11.75 1.75 11.52614 1.75 11.25 c 1.75 10.97386 1.973858 10.75 2.25 10.75 c h 2.25 15.25 m 2.526142 15.25 2.75 15.47386 2.75 15.75 c 2.75 16.02614 2.526142 16.25 2.25 16.25 c 1.973858 16.25 1.75 16.02614 1.75 15.75 c 1.75 15.47386 1.973858 15.25 2.25 15.25 c h 6.75 1.75 m 7.026143 1.75 7.25 1.973858 7.25 2.25 c 7.25 2.526142 7.026143 2.75 6.75 2.75 c 6.473857 2.75 6.25 2.526142 6.25 2.25 c 6.25 1.973858 6.473857 1.75 6.75 1.75 c h 6.75 6.25 m 7.026143 6.25 7.25 6.473857 7.25 6.75 c 7.25 7.026143 7.026143 7.25 6.75 7.25 c 6.473857 7.25 6.25 7.026143 6.25 6.75 c 6.25 6.473857 6.473857 6.25 6.75 6.25 c h 6.75 10.75 m 7.026143 10.75 7.25 10.97386 7.25 11.25 c 7.25 11.52614 7.026143 11.75 6.75 11.75 c 6.473857 11.75 6.25 11.52614 6.25 11.25 c 6.25 10.97386 6.473857 10.75 6.75 10.75 c h 6.75 15.25 m 7.026143 15.25 7.25 15.47386 7.25 15.75 c 7.25 16.02614 7.026143 16.25 6.75 16.25 c 6.473857 16.25 6.25 16.02614 6.25 15.75 c 6.25 15.47386 6.473857 15.25 6.75 15.25 c h 11.25 1.75 m 11.52614 1.75 11.75 1.973858 11.75 2.25 c 11.75 2.526142 11.52614 2.75 11.25 2.75 c 10.97386 2.75 10.75 2.526142 10.75 2.25 c 10.75 1.973858 10.97386 1.75 11.25 1.75 c h 11.25 6.25 m 11.52614 6.25 11.75 6.473857 11.75 6.75 c 11.75 7.026143 11.52614 7.25 11.25 7.25 c 10.97386 7.25 10.75 7.026143 10.75 6.75 c 10.75 6.473857 10.97386 6.25 11.25 6.25 c h 11.25 10.75 m 11.52614 10.75 11.75 10.97386 11.75 11.25 c 11.75 11.52614 11.52614 11.75 11.25 11.75 c 10.97386 11.75 10.75 11.52614 10.75 11.25 c 10.75 10.97386 10.97386 10.75 11.25 10.75 c h 11.25 15.25 m 11.52614 15.25 11.75 15.47386 11.75 15.75 c 11.75 16.02614 11.52614 16.25 11.25 16.25 c 10.97386 16.25 10.75 16.02614 10.75 15.75 c 10.75 15.47386 10.97386 15.25 11.25 15.25 c h 15.75 1.75 m 16.02614 1.75 16.25 1.973858 16.25 2.25 c 16.25 2.526142 16.02614 2.75 15.75 2.75 c 15.47386 2.75 15.25 2.526142 15.25 2.25 c 15.25 1.973858 15.47386 1.75 15.75 1.75 c h 15.75 6.25 m 16.02614 6.25 16.25 6.473857 16.25 6.75 c 16.25 7.026143 16.02614 7.25 15.75 7.25 c 15.47386 7.25 15.25 7.026143 15.25 6.75 c 15.25 6.473857 15.47386 6.25 15.75 6.25 c h 15.75 10.75 m 16.02614 10.75 16.25 10.97386 16.25 11.25 c 16.25 11.52614 16.02614 11.75 15.75 11.75 c 15.47386 11.75 15.25 11.52614 15.25 11.25 c 15.25 10.97386 15.47386 10.75 15.75 10.75 c h 15.75 15.25 m 16.02614 15.25 16.25 15.47386 16.25 15.75 c 16.25 16.02614 16.02614 16.25 15.75 16.25 c 15.47386 16.25 15.25 16.02614 15.25 15.75 c 15.25 15.47386 15.47386 15.25 15.75 15.25 c h
174
+ {strokecolor} rg f
175
+ endstream'''
176
+ ,
177
+ '20Dots':'''<</Length 13441/Type/Pattern/PatternType 1/PaintType 1/TilingType 1/Resources<<>>
178
+ /Matrix[1 0 0 1 0 0]/BBox[0 0 18 18]/XStep 18/YStep 18>>\nstream\n
179
+ {fillcolor} rg 0 0 18 18 re f {strokecolor} RG 1 w 0 -0.5 m 0.2761424 -0.5 0.5 -0.2761424 0.5 0 c 0.5 0.2761424 0.2761424 0.5 0 0.5 c -0.2761424 0.5 -0.5 0.2761424 -0.5 0 c -0.5 -0.2761424 -0.2761424 -0.5 0 -0.5 c h 0 2.500001 m 0.2761424 2.500001 0.5 2.723858 0.5 3.000001 c 0.5 3.276143 0.2761424 3.500001 0 3.500001 c -0.2761424 3.500001 -0.5 3.276143 -0.5 3.000001 c -0.5 2.723858 -0.2761424 2.500001 0 2.500001 c h 0 5.5 m 0.2761424 5.5 0.5 5.723857 0.5 6 c 0.5 6.276142 0.2761424 6.5 0 6.5 c -0.2761424 6.5 -0.5 6.276142 -0.5 6 c -0.5 5.723857 -0.2761424 5.5 0 5.5 c h 0 8.5 m 0.2761424 8.5 0.5 8.723858 0.5 9 c 0.5 9.276142 0.2761424 9.5 0 9.5 c -0.2761424 9.5 -0.5 9.276142 -0.5 9 c -0.5 8.723858 -0.2761424 8.5 0 8.5 c h 0 11.5 m 0.2761424 11.5 0.5 11.72386 0.5 12 c 0.5 12.27614 0.2761424 12.5 0 12.5 c -0.2761424 12.5 -0.5 12.27614 -0.5 12 c -0.5 11.72386 -0.2761424 11.5 0 11.5 c h 0 14.5 m 0.2761424 14.5 0.5 14.72386 0.5 15 c 0.5 15.27614 0.2761424 15.5 0 15.5 c -0.2761424 15.5 -0.5 15.27614 -0.5 15 c -0.5 14.72386 -0.2761424 14.5 0 14.5 c h 0 17.5 m 0.2761424 17.5 0.5 17.72386 0.5 18 c 0.5 18.27614 0.2761424 18.5 0 18.5 c -0.2761424 18.5 -0.5 18.27614 -0.5 18 c -0.5 17.72386 -0.2761424 17.5 0 17.5 c h 3.000001 -0.5 m 3.276143 -0.5 3.500001 -0.2761424 3.500001 0 c 3.500001 0.2761424 3.276143 0.5 3.000001 0.5 c 2.723858 0.5 2.500001 0.2761424 2.500001 0 c 2.500001 -0.2761424 2.723858 -0.5 3.000001 -0.5 c h 3.000001 2.500001 m 3.276143 2.500001 3.500001 2.723858 3.500001 3.000001 c 3.500001 3.276143 3.276143 3.500001 3.000001 3.500001 c 2.723858 3.500001 2.500001 3.276143 2.500001 3.000001 c 2.500001 2.723858 2.723858 2.500001 3.000001 2.500001 c h 3.000001 5.5 m 3.276143 5.5 3.500001 5.723857 3.500001 6 c 3.500001 6.276142 3.276143 6.5 3.000001 6.5 c 2.723858 6.5 2.500001 6.276142 2.500001 6 c 2.500001 5.723857 2.723858 5.5 3.000001 5.5 c h 3.000001 8.5 m 3.276143 8.5 3.500001 8.723858 3.500001 9 c 3.500001 9.276142 3.276143 9.5 3.000001 9.5 c 2.723858 9.5 2.500001 9.276142 2.500001 9 c 2.500001 8.723858 2.723858 8.5 3.000001 8.5 c h 3.000001 11.5 m 3.276143 11.5 3.500001 11.72386 3.500001 12 c 3.500001 12.27614 3.276143 12.5 3.000001 12.5 c 2.723858 12.5 2.500001 12.27614 2.500001 12 c 2.500001 11.72386 2.723858 11.5 3.000001 11.5 c h 3.000001 14.5 m 3.276143 14.5 3.500001 14.72386 3.500001 15 c 3.500001 15.27614 3.276143 15.5 3.000001 15.5 c 2.723858 15.5 2.500001 15.27614 2.500001 15 c 2.500001 14.72386 2.723858 14.5 3.000001 14.5 c h 3.000001 17.5 m 3.276143 17.5 3.500001 17.72386 3.500001 18 c 3.500001 18.27614 3.276143 18.5 3.000001 18.5 c 2.723858 18.5 2.500001 18.27614 2.500001 18 c 2.500001 17.72386 2.723858 17.5 3.000001 17.5 c h 6 -0.5 m 6.276142 -0.5 6.5 -0.2761424 6.5 0 c 6.5 0.2761424 6.276142 0.5 6 0.5 c 5.723857 0.5 5.5 0.2761424 5.5 0 c 5.5 -0.2761424 5.723857 -0.5 6 -0.5 c h 6 2.500001 m 6.276142 2.500001 6.5 2.723858 6.5 3.000001 c 6.5 3.276143 6.276142 3.500001 6 3.500001 c 5.723857 3.500001 5.5 3.276143 5.5 3.000001 c 5.5 2.723858 5.723857 2.500001 6 2.500001 c h 6 5.5 m 6.276142 5.5 6.5 5.723857 6.5 6 c 6.5 6.276142 6.276142 6.5 6 6.5 c 5.723857 6.5 5.5 6.276142 5.5 6 c 5.5 5.723857 5.723857 5.5 6 5.5 c h 6 8.5 m 6.276142 8.5 6.5 8.723858 6.5 9 c 6.5 9.276142 6.276142 9.5 6 9.5 c 5.723857 9.5 5.5 9.276142 5.5 9 c 5.5 8.723858 5.723857 8.5 6 8.5 c h 6 11.5 m 6.276142 11.5 6.5 11.72386 6.5 12 c 6.5 12.27614 6.276142 12.5 6 12.5 c 5.723857 12.5 5.5 12.27614 5.5 12 c 5.5 11.72386 5.723857 11.5 6 11.5 c h 6 14.5 m 6.276142 14.5 6.5 14.72386 6.5 15 c 6.5 15.27614 6.276142 15.5 6 15.5 c 5.723857 15.5 5.5 15.27614 5.5 15 c 5.5 14.72386 5.723857 14.5 6 14.5 c h 6 17.5 m 6.276142 17.5 6.5 17.72386 6.5 18 c 6.5 18.27614 6.276142 18.5 6 18.5 c 5.723857 18.5 5.5 18.27614 5.5 18 c 5.5 17.72386 5.723857 17.5 6 17.5 c h 9 -0.5 m 9.276142 -0.5 9.5 -0.2761424 9.5 0 c 9.5 0.2761424 9.276142 0.5 9 0.5 c 8.723858 0.5 8.5 0.2761424 8.5 0 c 8.5 -0.2761424 8.723858 -0.5 9 -0.5 c h 9 2.500001 m 9.276142 2.500001 9.5 2.723858 9.5 3.000001 c 9.5 3.276143 9.276142 3.500001 9 3.500001 c 8.723858 3.500001 8.5 3.276143 8.5 3.000001 c 8.5 2.723858 8.723858 2.500001 9 2.500001 c h 9 5.5 m 9.276142 5.5 9.5 5.723857 9.5 6 c 9.5 6.276142 9.276142 6.5 9 6.5 c 8.723858 6.5 8.5 6.276142 8.5 6 c 8.5 5.723857 8.723858 5.5 9 5.5 c h 9 8.5 m 9.276142 8.5 9.5 8.723858 9.5 9 c 9.5 9.276142 9.276142 9.5 9 9.5 c 8.723858 9.5 8.5 9.276142 8.5 9 c 8.5 8.723858 8.723858 8.5 9 8.5 c h 9 11.5 m 9.276142 11.5 9.5 11.72386 9.5 12 c 9.5 12.27614 9.276142 12.5 9 12.5 c 8.723858 12.5 8.5 12.27614 8.5 12 c 8.5 11.72386 8.723858 11.5 9 11.5 c h 9 14.5 m 9.276142 14.5 9.5 14.72386 9.5 15 c 9.5 15.27614 9.276142 15.5 9 15.5 c 8.723858 15.5 8.5 15.27614 8.5 15 c 8.5 14.72386 8.723858 14.5 9 14.5 c h 9 17.5 m 9.276142 17.5 9.5 17.72386 9.5 18 c 9.5 18.27614 9.276142 18.5 9 18.5 c 8.723858 18.5 8.5 18.27614 8.5 18 c 8.5 17.72386 8.723858 17.5 9 17.5 c h 12 -0.5 m 12.27614 -0.5 12.5 -0.2761424 12.5 0 c 12.5 0.2761424 12.27614 0.5 12 0.5 c 11.72386 0.5 11.5 0.2761424 11.5 0 c 11.5 -0.2761424 11.72386 -0.5 12 -0.5 c h 12 2.500001 m 12.27614 2.500001 12.5 2.723858 12.5 3.000001 c 12.5 3.276143 12.27614 3.500001 12 3.500001 c 11.72386 3.500001 11.5 3.276143 11.5 3.000001 c 11.5 2.723858 11.72386 2.500001 12 2.500001 c h 12 5.5 m 12.27614 5.5 12.5 5.723857 12.5 6 c 12.5 6.276142 12.27614 6.5 12 6.5 c 11.72386 6.5 11.5 6.276142 11.5 6 c 11.5 5.723857 11.72386 5.5 12 5.5 c h 12 8.5 m 12.27614 8.5 12.5 8.723858 12.5 9 c 12.5 9.276142 12.27614 9.5 12 9.5 c 11.72386 9.5 11.5 9.276142 11.5 9 c 11.5 8.723858 11.72386 8.5 12 8.5 c h 12 11.5 m 12.27614 11.5 12.5 11.72386 12.5 12 c 12.5 12.27614 12.27614 12.5 12 12.5 c 11.72386 12.5 11.5 12.27614 11.5 12 c 11.5 11.72386 11.72386 11.5 12 11.5 c h 12 14.5 m 12.27614 14.5 12.5 14.72386 12.5 15 c 12.5 15.27614 12.27614 15.5 12 15.5 c 11.72386 15.5 11.5 15.27614 11.5 15 c 11.5 14.72386 11.72386 14.5 12 14.5 c h 12 17.5 m 12.27614 17.5 12.5 17.72386 12.5 18 c 12.5 18.27614 12.27614 18.5 12 18.5 c 11.72386 18.5 11.5 18.27614 11.5 18 c 11.5 17.72386 11.72386 17.5 12 17.5 c h 15 -0.5 m 15.27614 -0.5 15.5 -0.2761424 15.5 0 c 15.5 0.2761424 15.27614 0.5 15 0.5 c 14.72386 0.5 14.5 0.2761424 14.5 0 c 14.5 -0.2761424 14.72386 -0.5 15 -0.5 c h 15 2.500001 m 15.27614 2.500001 15.5 2.723858 15.5 3.000001 c 15.5 3.276143 15.27614 3.500001 15 3.500001 c 14.72386 3.500001 14.5 3.276143 14.5 3.000001 c 14.5 2.723858 14.72386 2.500001 15 2.500001 c h 15 5.5 m 15.27614 5.5 15.5 5.723857 15.5 6 c 15.5 6.276142 15.27614 6.5 15 6.5 c 14.72386 6.5 14.5 6.276142 14.5 6 c 14.5 5.723857 14.72386 5.5 15 5.5 c h 15 8.5 m 15.27614 8.5 15.5 8.723858 15.5 9 c 15.5 9.276142 15.27614 9.5 15 9.5 c 14.72386 9.5 14.5 9.276142 14.5 9 c 14.5 8.723858 14.72386 8.5 15 8.5 c h 15 11.5 m 15.27614 11.5 15.5 11.72386 15.5 12 c 15.5 12.27614 15.27614 12.5 15 12.5 c 14.72386 12.5 14.5 12.27614 14.5 12 c 14.5 11.72386 14.72386 11.5 15 11.5 c h 15 14.5 m 15.27614 14.5 15.5 14.72386 15.5 15 c 15.5 15.27614 15.27614 15.5 15 15.5 c 14.72386 15.5 14.5 15.27614 14.5 15 c 14.5 14.72386 14.72386 14.5 15 14.5 c h 15 17.5 m 15.27614 17.5 15.5 17.72386 15.5 18 c 15.5 18.27614 15.27614 18.5 15 18.5 c 14.72386 18.5 14.5 18.27614 14.5 18 c 14.5 17.72386 14.72386 17.5 15 17.5 c h 18 -0.5 m 18.27614 -0.5 18.5 -0.2761424 18.5 0 c 18.5 0.2761424 18.27614 0.5 18 0.5 c 17.72386 0.5 17.5 0.2761424 17.5 0 c 17.5 -0.2761424 17.72386 -0.5 18 -0.5 c h 18 2.500001 m 18.27614 2.500001 18.5 2.723858 18.5 3.000001 c 18.5 3.276143 18.27614 3.500001 18 3.500001 c 17.72386 3.500001 17.5 3.276143 17.5 3.000001 c 17.5 2.723858 17.72386 2.500001 18 2.500001 c h 18 5.5 m 18.27614 5.5 18.5 5.723857 18.5 6 c 18.5 6.276142 18.27614 6.5 18 6.5 c 17.72386 6.5 17.5 6.276142 17.5 6 c 17.5 5.723857 17.72386 5.5 18 5.5 c h 18 8.5 m 18.27614 8.5 18.5 8.723858 18.5 9 c 18.5 9.276142 18.27614 9.5 18 9.5 c 17.72386 9.5 17.5 9.276142 17.5 9 c 17.5 8.723858 17.72386 8.5 18 8.5 c h 18 11.5 m 18.27614 11.5 18.5 11.72386 18.5 12 c 18.5 12.27614 18.27614 12.5 18 12.5 c 17.72386 12.5 17.5 12.27614 17.5 12 c 17.5 11.72386 17.72386 11.5 18 11.5 c h 18 14.5 m 18.27614 14.5 18.5 14.72386 18.5 15 c 18.5 15.27614 18.27614 15.5 18 15.5 c 17.72386 15.5 17.5 15.27614 17.5 15 c 17.5 14.72386 17.72386 14.5 18 14.5 c h 18 17.5 m 18.27614 17.5 18.5 17.72386 18.5 18 c 18.5 18.27614 18.27614 18.5 18 18.5 c 17.72386 18.5 17.5 18.27614 17.5 18 c 17.5 17.72386 17.72386 17.5 18 17.5 c h 1.5 1 m 1.776143 1 2 1.223858 2 1.5 c 2 1.776143 1.776143 2 1.5 2 c 1.223858 2 1 1.776143 1 1.5 c 1 1.223858 1.223858 1 1.5 1 c h 1.5 4 m 1.776143 4 2 4.223857 2 4.5 c 2 4.776143 1.776143 5 1.5 5 c 1.223858 5 1 4.776143 1 4.5 c 1 4.223857 1.223858 4 1.5 4 c h 1.5 7 m 1.776143 7 2 7.223858 2 7.5 c 2 7.776143 1.776143 8 1.5 8 c 1.223858 8 1 7.776143 1 7.5 c 1 7.223858 1.223858 7 1.5 7 c h 1.5 10 m 1.776143 10 2 10.22386 2 10.5 c 2 10.77614 1.776143 11 1.5 11 c 1.223858 11 1 10.77614 1 10.5 c 1 10.22386 1.223858 10 1.5 10 c h 1.5 13 m 1.776143 13 2 13.22386 2 13.5 c 2 13.77614 1.776143 14 1.5 14 c 1.223858 14 1 13.77614 1 13.5 c 1 13.22386 1.223858 13 1.5 13 c h 1.5 16 m 1.776143 16 2 16.22386 2 16.5 c 2 16.77614 1.776143 17 1.5 17 c 1.223858 17 1 16.77614 1 16.5 c 1 16.22386 1.223858 16 1.5 16 c h 4.5 1 m 4.776143 1 5 1.223858 5 1.5 c 5 1.776143 4.776143 2 4.5 2 c 4.223857 2 4 1.776143 4 1.5 c 4 1.223858 4.223857 1 4.5 1 c h 4.5 4 m 4.776143 4 5 4.223857 5 4.5 c 5 4.776143 4.776143 5 4.5 5 c 4.223857 5 4 4.776143 4 4.5 c 4 4.223857 4.223857 4 4.5 4 c h 4.5 7 m 4.776143 7 5 7.223858 5 7.5 c 5 7.776143 4.776143 8 4.5 8 c 4.223857 8 4 7.776143 4 7.5 c 4 7.223858 4.223857 7 4.5 7 c h 4.5 10 m 4.776143 10 5 10.22386 5 10.5 c 5 10.77614 4.776143 11 4.5 11 c 4.223857 11 4 10.77614 4 10.5 c 4 10.22386 4.223857 10 4.5 10 c h 4.5 13 m 4.776143 13 5 13.22386 5 13.5 c 5 13.77614 4.776143 14 4.5 14 c 4.223857 14 4 13.77614 4 13.5 c 4 13.22386 4.223857 13 4.5 13 c h 4.5 16 m 4.776143 16 5 16.22386 5 16.5 c 5 16.77614 4.776143 17 4.5 17 c 4.223857 17 4 16.77614 4 16.5 c 4 16.22386 4.223857 16 4.5 16 c h 7.5 1 m 7.776143 1 8 1.223858 8 1.5 c 8 1.776143 7.776143 2 7.5 2 c 7.223858 2 7 1.776143 7 1.5 c 7 1.223858 7.223858 1 7.5 1 c h 7.5 4 m 7.776143 4 8 4.223857 8 4.5 c 8 4.776143 7.776143 5 7.5 5 c 7.223858 5 7 4.776143 7 4.5 c 7 4.223857 7.223858 4 7.5 4 c h 7.5 7 m 7.776143 7 8 7.223858 8 7.5 c 8 7.776143 7.776143 8 7.5 8 c 7.223858 8 7 7.776143 7 7.5 c 7 7.223858 7.223858 7 7.5 7 c h 7.5 10 m 7.776143 10 8 10.22386 8 10.5 c 8 10.77614 7.776143 11 7.5 11 c 7.223858 11 7 10.77614 7 10.5 c 7 10.22386 7.223858 10 7.5 10 c h 7.5 13 m 7.776143 13 8 13.22386 8 13.5 c 8 13.77614 7.776143 14 7.5 14 c 7.223858 14 7 13.77614 7 13.5 c 7 13.22386 7.223858 13 7.5 13 c h 7.5 16 m 7.776143 16 8 16.22386 8 16.5 c 8 16.77614 7.776143 17 7.5 17 c 7.223858 17 7 16.77614 7 16.5 c 7 16.22386 7.223858 16 7.5 16 c h 10.5 1 m 10.77614 1 11 1.223858 11 1.5 c 11 1.776143 10.77614 2 10.5 2 c 10.22386 2 10 1.776143 10 1.5 c 10 1.223858 10.22386 1 10.5 1 c h 10.5 4 m 10.77614 4 11 4.223857 11 4.5 c 11 4.776143 10.77614 5 10.5 5 c 10.22386 5 10 4.776143 10 4.5 c 10 4.223857 10.22386 4 10.5 4 c h 10.5 7 m 10.77614 7 11 7.223858 11 7.5 c 11 7.776143 10.77614 8 10.5 8 c 10.22386 8 10 7.776143 10 7.5 c 10 7.223858 10.22386 7 10.5 7 c h 10.5 10 m 10.77614 10 11 10.22386 11 10.5 c 11 10.77614 10.77614 11 10.5 11 c 10.22386 11 10 10.77614 10 10.5 c 10 10.22386 10.22386 10 10.5 10 c h 10.5 13 m 10.77614 13 11 13.22386 11 13.5 c 11 13.77614 10.77614 14 10.5 14 c 10.22386 14 10 13.77614 10 13.5 c 10 13.22386 10.22386 13 10.5 13 c h 10.5 16 m 10.77614 16 11 16.22386 11 16.5 c 11 16.77614 10.77614 17 10.5 17 c 10.22386 17 10 16.77614 10 16.5 c 10 16.22386 10.22386 16 10.5 16 c h 13.5 1 m 13.77614 1 14 1.223858 14 1.5 c 14 1.776143 13.77614 2 13.5 2 c 13.22386 2 13 1.776143 13 1.5 c 13 1.223858 13.22386 1 13.5 1 c h 13.5 4 m 13.77614 4 14 4.223857 14 4.5 c 14 4.776143 13.77614 5 13.5 5 c 13.22386 5 13 4.776143 13 4.5 c 13 4.223857 13.22386 4 13.5 4 c h 13.5 7 m 13.77614 7 14 7.223858 14 7.5 c 14 7.776143 13.77614 8 13.5 8 c 13.22386 8 13 7.776143 13 7.5 c 13 7.223858 13.22386 7 13.5 7 c h 13.5 10 m 13.77614 10 14 10.22386 14 10.5 c 14 10.77614 13.77614 11 13.5 11 c 13.22386 11 13 10.77614 13 10.5 c 13 10.22386 13.22386 10 13.5 10 c h 13.5 13 m 13.77614 13 14 13.22386 14 13.5 c 14 13.77614 13.77614 14 13.5 14 c 13.22386 14 13 13.77614 13 13.5 c 13 13.22386 13.22386 13 13.5 13 c h 13.5 16 m 13.77614 16 14 16.22386 14 16.5 c 14 16.77614 13.77614 17 13.5 17 c 13.22386 17 13 16.77614 13 16.5 c 13 16.22386 13.22386 16 13.5 16 c h 16.5 1 m 16.77614 1 17 1.223858 17 1.5 c 17 1.776143 16.77614 2 16.5 2 c 16.22386 2 16 1.776143 16 1.5 c 16 1.223858 16.22386 1 16.5 1 c h 16.5 4 m 16.77614 4 17 4.223857 17 4.5 c 17 4.776143 16.77614 5 16.5 5 c 16.22386 5 16 4.776143 16 4.5 c 16 4.223857 16.22386 4 16.5 4 c h 16.5 7 m 16.77614 7 17 7.223858 17 7.5 c 17 7.776143 16.77614 8 16.5 8 c 16.22386 8 16 7.776143 16 7.5 c 16 7.223858 16.22386 7 16.5 7 c h 16.5 10 m 16.77614 10 17 10.22386 17 10.5 c 17 10.77614 16.77614 11 16.5 11 c 16.22386 11 16 10.77614 16 10.5 c 16 10.22386 16.22386 10 16.5 10 c h 16.5 13 m 16.77614 13 17 13.22386 17 13.5 c 17 13.77614 16.77614 14 16.5 14 c 16.22386 14 16 13.77614 16 13.5 c 16 13.22386 16.22386 13 16.5 13 c h 16.5 16 m 16.77614 16 17 16.22386 17 16.5 c 17 16.77614 16.77614 17 16.5 17 c 16.22386 17 16 16.77614 16 16.5 c 16 16.22386 16.22386 16 16.5 16 c h
180
+ {strokecolor} rg f
181
+ endstream'''
182
+ ,
183
+ '30Dots':'''<</Length 25547/Type/Pattern/PatternType 1/PaintType 1/TilingType 1/Resources<<>>
184
+ /Matrix[1 0 0 1 0 0]/BBox[0 0 18 18]/XStep 18/YStep 18>>\nstream\n
185
+ {fillcolor} rg 0 0 18 18 re f {strokecolor} RG
186
+ 1 w 0 -0.5 m 0.2761424 -0.5 0.5 -0.2761424 0.5 0 c 0.5 0.2761424 0.2761424 0.5 0 0.5 c -0.2761424 0.5 -0.5 0.2761424 -0.5 0 c -0.5 -0.2761424 -0.2761424 -0.5 0 -0.5 c h 0 2.071428 m 0.2761424 2.071428 0.5 2.295285 0.5 2.571428 c 0.5 2.84757 0.2761424 3.071428 0 3.071428 c -0.2761424 3.071428 -0.5 2.84757 -0.5 2.571428 c -0.5 2.295285 -0.2761424 2.071428 0 2.071428 c h 0 4.642858 m 0.2761424 4.642858 0.5 4.866715 0.5 5.142858 c 0.5 5.419 0.2761424 5.642858 0 5.642858 c -0.2761424 5.642858 -0.5 5.419 -0.5 5.142858 c -0.5 4.866715 -0.2761424 4.642858 0 4.642858 c h 0 7.214287 m 0.2761424 7.214287 0.5 7.438144 0.5 7.714287 c 0.5 7.990429 0.2761424 8.214287 0 8.214287 c -0.2761424 8.214287 -0.5 7.990429 -0.5 7.714287 c -0.5 7.438144 -0.2761424 7.214287 0 7.214287 c h 0 9.785715 m 0.2761424 9.785715 0.5 10.00957 0.5 10.28572 c 0.5 10.56186 0.2761424 10.78572 0 10.78572 c -0.2761424 10.78572 -0.5 10.56186 -0.5 10.28572 c -0.5 10.00957 -0.2761424 9.785715 0 9.785715 c h 0 12.35714 m 0.2761424 12.35714 0.5 12.581 0.5 12.85714 c 0.5 13.13328 0.2761424 13.35714 0 13.35714 c -0.2761424 13.35714 -0.5 13.13328 -0.5 12.85714 c -0.5 12.581 -0.2761424 12.35714 0 12.35714 c h 0 14.92857 m 0.2761424 14.92857 0.5 15.15243 0.5 15.42857 c 0.5 15.70471 0.2761424 15.92857 0 15.92857 c -0.2761424 15.92857 -0.5 15.70471 -0.5 15.42857 c -0.5 15.15243 -0.2761424 14.92857 0 14.92857 c h 0 17.5 m 0.2761424 17.5 0.5 17.72386 0.5 18 c 0.5 18.27614 0.2761424 18.5 0 18.5 c -0.2761424 18.5 -0.5 18.27614 -0.5 18 c -0.5 17.72386 -0.2761424 17.5 0 17.5 c h 2.571428 -0.5 m 2.84757 -0.5 3.071428 -0.2761424 3.071428 0 c 3.071428 0.2761424 2.84757 0.5 2.571428 0.5 c 2.295285 0.5 2.071428 0.2761424 2.071428 0 c 2.071428 -0.2761424 2.295285 -0.5 2.571428 -0.5 c h 2.571428 2.071428 m 2.84757 2.071428 3.071428 2.295285 3.071428 2.571428 c 3.071428 2.84757 2.84757 3.071428 2.571428 3.071428 c 2.295285 3.071428 2.071428 2.84757 2.071428 2.571428 c 2.071428 2.295285 2.295285 2.071428 2.571428 2.071428 c h 2.571428 4.642858 m 2.84757 4.642858 3.071428 4.866715 3.071428 5.142858 c 3.071428 5.419 2.84757 5.642858 2.571428 5.642858 c 2.295285 5.642858 2.071428 5.419 2.071428 5.142858 c 2.071428 4.866715 2.295285 4.642858 2.571428 4.642858 c h 2.571428 7.214287 m 2.84757 7.214287 3.071428 7.438144 3.071428 7.714287 c 3.071428 7.990429 2.84757 8.214287 2.571428 8.214287 c 2.295285 8.214287 2.071428 7.990429 2.071428 7.714287 c 2.071428 7.438144 2.295285 7.214287 2.571428 7.214287 c h 2.571428 9.785715 m 2.84757 9.785715 3.071428 10.00957 3.071428 10.28572 c 3.071428 10.56186 2.84757 10.78572 2.571428 10.78572 c 2.295285 10.78572 2.071428 10.56186 2.071428 10.28572 c 2.071428 10.00957 2.295285 9.785715 2.571428 9.785715 c h 2.571428 12.35714 m 2.84757 12.35714 3.071428 12.581 3.071428 12.85714 c 3.071428 13.13328 2.84757 13.35714 2.571428 13.35714 c 2.295285 13.35714 2.071428 13.13328 2.071428 12.85714 c 2.071428 12.581 2.295285 12.35714 2.571428 12.35714 c h 2.571428 14.92857 m 2.84757 14.92857 3.071428 15.15243 3.071428 15.42857 c 3.071428 15.70471 2.84757 15.92857 2.571428 15.92857 c 2.295285 15.92857 2.071428 15.70471 2.071428 15.42857 c 2.071428 15.15243 2.295285 14.92857 2.571428 14.92857 c h 2.571428 17.5 m 2.84757 17.5 3.071428 17.72386 3.071428 18 c 3.071428 18.27614 2.84757 18.5 2.571428 18.5 c 2.295285 18.5 2.071428 18.27614 2.071428 18 c 2.071428 17.72386 2.295285 17.5 2.571428 17.5 c h 5.142858 -0.5 m 5.419 -0.5 5.642858 -0.2761424 5.642858 0 c 5.642858 0.2761424 5.419 0.5 5.142858 0.5 c 4.866715 0.5 4.642858 0.2761424 4.642858 0 c 4.642858 -0.2761424 4.866715 -0.5 5.142858 -0.5 c h 5.142858 2.071428 m 5.419 2.071428 5.642858 2.295285 5.642858 2.571428 c 5.642858 2.84757 5.419 3.071428 5.142858 3.071428 c 4.866715 3.071428 4.642858 2.84757 4.642858 2.571428 c 4.642858 2.295285 4.866715 2.071428 5.142858 2.071428 c h 5.142858 4.642858 m 5.419 4.642858 5.642858 4.866715 5.642858 5.142858 c 5.642858 5.419 5.419 5.642858 5.142858 5.642858 c 4.866715 5.642858 4.642858 5.419 4.642858 5.142858 c 4.642858 4.866715 4.866715 4.642858 5.142858 4.642858 c h 5.142858 7.214287 m 5.419 7.214287 5.642858 7.438144 5.642858 7.714287 c 5.642858 7.990429 5.419 8.214287 5.142858 8.214287 c 4.866715 8.214287 4.642858 7.990429 4.642858 7.714287 c 4.642858 7.438144 4.866715 7.214287 5.142858 7.214287 c h 5.142858 9.785715 m 5.419 9.785715 5.642858 10.00957 5.642858 10.28572 c 5.642858 10.56186 5.419 10.78572 5.142858 10.78572 c 4.866715 10.78572 4.642858 10.56186 4.642858 10.28572 c 4.642858 10.00957 4.866715 9.785715 5.142858 9.785715 c h 5.142858 12.35714 m 5.419 12.35714 5.642858 12.581 5.642858 12.85714 c 5.642858 13.13328 5.419 13.35714 5.142858 13.35714 c 4.866715 13.35714 4.642858 13.13328 4.642858 12.85714 c 4.642858 12.581 4.866715 12.35714 5.142858 12.35714 c h 5.142858 14.92857 m 5.419 14.92857 5.642858 15.15243 5.642858 15.42857 c 5.642858 15.70471 5.419 15.92857 5.142858 15.92857 c 4.866715 15.92857 4.642858 15.70471 4.642858 15.42857 c 4.642858 15.15243 4.866715 14.92857 5.142858 14.92857 c h 5.142858 17.5 m 5.419 17.5 5.642858 17.72386 5.642858 18 c 5.642858 18.27614 5.419 18.5 5.142858 18.5 c 4.866715 18.5 4.642858 18.27614 4.642858 18 c 4.642858 17.72386 4.866715 17.5 5.142858 17.5 c h 7.714287 -0.5 m 7.990429 -0.5 8.214287 -0.2761424 8.214287 0 c 8.214287 0.2761424 7.990429 0.5 7.714287 0.5 c 7.438144 0.5 7.214287 0.2761424 7.214287 0 c 7.214287 -0.2761424 7.438144 -0.5 7.714287 -0.5 c h 7.714287 2.071428 m 7.990429 2.071428 8.214287 2.295285 8.214287 2.571428 c 8.214287 2.84757 7.990429 3.071428 7.714287 3.071428 c 7.438144 3.071428 7.214287 2.84757 7.214287 2.571428 c 7.214287 2.295285 7.438144 2.071428 7.714287 2.071428 c h 7.714287 4.642858 m 7.990429 4.642858 8.214287 4.866715 8.214287 5.142858 c 8.214287 5.419 7.990429 5.642858 7.714287 5.642858 c 7.438144 5.642858 7.214287 5.419 7.214287 5.142858 c 7.214287 4.866715 7.438144 4.642858 7.714287 4.642858 c h 7.714287 7.214287 m 7.990429 7.214287 8.214287 7.438144 8.214287 7.714287 c 8.214287 7.990429 7.990429 8.214287 7.714287 8.214287 c 7.438144 8.214287 7.214287 7.990429 7.214287 7.714287 c 7.214287 7.438144 7.438144 7.214287 7.714287 7.214287 c h 7.714287 9.785715 m 7.990429 9.785715 8.214287 10.00957 8.214287 10.28572 c 8.214287 10.56186 7.990429 10.78572 7.714287 10.78572 c 7.438144 10.78572 7.214287 10.56186 7.214287 10.28572 c 7.214287 10.00957 7.438144 9.785715 7.714287 9.785715 c h 7.714287 12.35714 m 7.990429 12.35714 8.214287 12.581 8.214287 12.85714 c 8.214287 13.13328 7.990429 13.35714 7.714287 13.35714 c 7.438144 13.35714 7.214287 13.13328 7.214287 12.85714 c 7.214287 12.581 7.438144 12.35714 7.714287 12.35714 c h 7.714287 14.92857 m 7.990429 14.92857 8.214287 15.15243 8.214287 15.42857 c 8.214287 15.70471 7.990429 15.92857 7.714287 15.92857 c 7.438144 15.92857 7.214287 15.70471 7.214287 15.42857 c 7.214287 15.15243 7.438144 14.92857 7.714287 14.92857 c h 7.714287 17.5 m 7.990429 17.5 8.214287 17.72386 8.214287 18 c 8.214287 18.27614 7.990429 18.5 7.714287 18.5 c 7.438144 18.5 7.214287 18.27614 7.214287 18 c 7.214287 17.72386 7.438144 17.5 7.714287 17.5 c h 10.28572 -0.5 m 10.56186 -0.5 10.78572 -0.2761424 10.78572 0 c 10.78572 0.2761424 10.56186 0.5 10.28572 0.5 c 10.00957 0.5 9.785715 0.2761424 9.785715 0 c 9.785715 -0.2761424 10.00957 -0.5 10.28572 -0.5 c h 10.28572 2.071428 m 10.56186 2.071428 10.78572 2.295285 10.78572 2.571428 c 10.78572 2.84757 10.56186 3.071428 10.28572 3.071428 c 10.00957 3.071428 9.785715 2.84757 9.785715 2.571428 c 9.785715 2.295285 10.00957 2.071428 10.28572 2.071428 c h 10.28572 4.642858 m 10.56186 4.642858 10.78572 4.866715 10.78572 5.142858 c 10.78572 5.419 10.56186 5.642858 10.28572 5.642858 c 10.00957 5.642858 9.785715 5.419 9.785715 5.142858 c 9.785715 4.866715 10.00957 4.642858 10.28572 4.642858 c h 10.28572 7.214287 m 10.56186 7.214287 10.78572 7.438144 10.78572 7.714287 c 10.78572 7.990429 10.56186 8.214287 10.28572 8.214287 c 10.00957 8.214287 9.785715 7.990429 9.785715 7.714287 c 9.785715 7.438144 10.00957 7.214287 10.28572 7.214287 c h 10.28572 9.785715 m 10.56186 9.785715 10.78572 10.00957 10.78572 10.28572 c 10.78572 10.56186 10.56186 10.78572 10.28572 10.78572 c 10.00957 10.78572 9.785715 10.56186 9.785715 10.28572 c 9.785715 10.00957 10.00957 9.785715 10.28572 9.785715 c h 10.28572 12.35714 m 10.56186 12.35714 10.78572 12.581 10.78572 12.85714 c 10.78572 13.13328 10.56186 13.35714 10.28572 13.35714 c 10.00957 13.35714 9.785715 13.13328 9.785715 12.85714 c 9.785715 12.581 10.00957 12.35714 10.28572 12.35714 c h 10.28572 14.92857 m 10.56186 14.92857 10.78572 15.15243 10.78572 15.42857 c 10.78572 15.70471 10.56186 15.92857 10.28572 15.92857 c 10.00957 15.92857 9.785715 15.70471 9.785715 15.42857 c 9.785715 15.15243 10.00957 14.92857 10.28572 14.92857 c h 10.28572 17.5 m 10.56186 17.5 10.78572 17.72386 10.78572 18 c 10.78572 18.27614 10.56186 18.5 10.28572 18.5 c 10.00957 18.5 9.785715 18.27614 9.785715 18 c 9.785715 17.72386 10.00957 17.5 10.28572 17.5 c h 12.85714 -0.5 m 13.13328 -0.5 13.35714 -0.2761424 13.35714 0 c 13.35714 0.2761424 13.13328 0.5 12.85714 0.5 c 12.581 0.5 12.35714 0.2761424 12.35714 0 c 12.35714 -0.2761424 12.581 -0.5 12.85714 -0.5 c h 12.85714 2.071428 m 13.13328 2.071428 13.35714 2.295285 13.35714 2.571428 c 13.35714 2.84757 13.13328 3.071428 12.85714 3.071428 c 12.581 3.071428 12.35714 2.84757 12.35714 2.571428 c 12.35714 2.295285 12.581 2.071428 12.85714 2.071428 c h 12.85714 4.642858 m 13.13328 4.642858 13.35714 4.866715 13.35714 5.142858 c 13.35714 5.419 13.13328 5.642858 12.85714 5.642858 c 12.581 5.642858 12.35714 5.419 12.35714 5.142858 c 12.35714 4.866715 12.581 4.642858 12.85714 4.642858 c h 12.85714 7.214287 m 13.13328 7.214287 13.35714 7.438144 13.35714 7.714287 c 13.35714 7.990429 13.13328 8.214287 12.85714 8.214287 c 12.581 8.214287 12.35714 7.990429 12.35714 7.714287 c 12.35714 7.438144 12.581 7.214287 12.85714 7.214287 c h 12.85714 9.785715 m 13.13328 9.785715 13.35714 10.00957 13.35714 10.28572 c 13.35714 10.56186 13.13328 10.78572 12.85714 10.78572 c 12.581 10.78572 12.35714 10.56186 12.35714 10.28572 c 12.35714 10.00957 12.581 9.785715 12.85714 9.785715 c h 12.85714 12.35714 m 13.13328 12.35714 13.35714 12.581 13.35714 12.85714 c 13.35714 13.13328 13.13328 13.35714 12.85714 13.35714 c 12.581 13.35714 12.35714 13.13328 12.35714 12.85714 c 12.35714 12.581 12.581 12.35714 12.85714 12.35714 c h 12.85714 14.92857 m 13.13328 14.92857 13.35714 15.15243 13.35714 15.42857 c 13.35714 15.70471 13.13328 15.92857 12.85714 15.92857 c 12.581 15.92857 12.35714 15.70471 12.35714 15.42857 c 12.35714 15.15243 12.581 14.92857 12.85714 14.92857 c h 12.85714 17.5 m 13.13328 17.5 13.35714 17.72386 13.35714 18 c 13.35714 18.27614 13.13328 18.5 12.85714 18.5 c 12.581 18.5 12.35714 18.27614 12.35714 18 c 12.35714 17.72386 12.581 17.5 12.85714 17.5 c h 15.42857 -0.5 m 15.70471 -0.5 15.92857 -0.2761424 15.92857 0 c 15.92857 0.2761424 15.70471 0.5 15.42857 0.5 c 15.15243 0.5 14.92857 0.2761424 14.92857 0 c 14.92857 -0.2761424 15.15243 -0.5 15.42857 -0.5 c h 15.42857 2.071428 m 15.70471 2.071428 15.92857 2.295285 15.92857 2.571428 c 15.92857 2.84757 15.70471 3.071428 15.42857 3.071428 c 15.15243 3.071428 14.92857 2.84757 14.92857 2.571428 c 14.92857 2.295285 15.15243 2.071428 15.42857 2.071428 c h 15.42857 4.642858 m 15.70471 4.642858 15.92857 4.866715 15.92857 5.142858 c 15.92857 5.419 15.70471 5.642858 15.42857 5.642858 c 15.15243 5.642858 14.92857 5.419 14.92857 5.142858 c 14.92857 4.866715 15.15243 4.642858 15.42857 4.642858 c h 15.42857 7.214287 m 15.70471 7.214287 15.92857 7.438144 15.92857 7.714287 c 15.92857 7.990429 15.70471 8.214287 15.42857 8.214287 c 15.15243 8.214287 14.92857 7.990429 14.92857 7.714287 c 14.92857 7.438144 15.15243 7.214287 15.42857 7.214287 c h 15.42857 9.785715 m 15.70471 9.785715 15.92857 10.00957 15.92857 10.28572 c 15.92857 10.56186 15.70471 10.78572 15.42857 10.78572 c 15.15243 10.78572 14.92857 10.56186 14.92857 10.28572 c 14.92857 10.00957 15.15243 9.785715 15.42857 9.785715 c h 15.42857 12.35714 m 15.70471 12.35714 15.92857 12.581 15.92857 12.85714 c 15.92857 13.13328 15.70471 13.35714 15.42857 13.35714 c 15.15243 13.35714 14.92857 13.13328 14.92857 12.85714 c 14.92857 12.581 15.15243 12.35714 15.42857 12.35714 c h 15.42857 14.92857 m 15.70471 14.92857 15.92857 15.15243 15.92857 15.42857 c 15.92857 15.70471 15.70471 15.92857 15.42857 15.92857 c 15.15243 15.92857 14.92857 15.70471 14.92857 15.42857 c 14.92857 15.15243 15.15243 14.92857 15.42857 14.92857 c h 15.42857 17.5 m 15.70471 17.5 15.92857 17.72386 15.92857 18 c 15.92857 18.27614 15.70471 18.5 15.42857 18.5 c 15.15243 18.5 14.92857 18.27614 14.92857 18 c 14.92857 17.72386 15.15243 17.5 15.42857 17.5 c h 18 -0.5 m 18.27614 -0.5 18.5 -0.2761424 18.5 0 c 18.5 0.2761424 18.27614 0.5 18 0.5 c 17.72386 0.5 17.5 0.2761424 17.5 0 c 17.5 -0.2761424 17.72386 -0.5 18 -0.5 c h 18 2.071428 m 18.27614 2.071428 18.5 2.295285 18.5 2.571428 c 18.5 2.84757 18.27614 3.071428 18 3.071428 c 17.72386 3.071428 17.5 2.84757 17.5 2.571428 c 17.5 2.295285 17.72386 2.071428 18 2.071428 c h 18 4.642858 m 18.27614 4.642858 18.5 4.866715 18.5 5.142858 c 18.5 5.419 18.27614 5.642858 18 5.642858 c 17.72386 5.642858 17.5 5.419 17.5 5.142858 c 17.5 4.866715 17.72386 4.642858 18 4.642858 c h 18 7.214287 m 18.27614 7.214287 18.5 7.438144 18.5 7.714287 c 18.5 7.990429 18.27614 8.214287 18 8.214287 c 17.72386 8.214287 17.5 7.990429 17.5 7.714287 c 17.5 7.438144 17.72386 7.214287 18 7.214287 c h 18 9.785715 m 18.27614 9.785715 18.5 10.00957 18.5 10.28572 c 18.5 10.56186 18.27614 10.78572 18 10.78572 c 17.72386 10.78572 17.5 10.56186 17.5 10.28572 c 17.5 10.00957 17.72386 9.785715 18 9.785715 c h 18 12.35714 m 18.27614 12.35714 18.5 12.581 18.5 12.85714 c 18.5 13.13328 18.27614 13.35714 18 13.35714 c 17.72386 13.35714 17.5 13.13328 17.5 12.85714 c 17.5 12.581 17.72386 12.35714 18 12.35714 c h 18 14.92857 m 18.27614 14.92857 18.5 15.15243 18.5 15.42857 c 18.5 15.70471 18.27614 15.92857 18 15.92857 c 17.72386 15.92857 17.5 15.70471 17.5 15.42857 c 17.5 15.15243 17.72386 14.92857 18 14.92857 c h 18 17.5 m 18.27614 17.5 18.5 17.72386 18.5 18 c 18.5 18.27614 18.27614 18.5 18 18.5 c 17.72386 18.5 17.5 18.27614 17.5 18 c 17.5 17.72386 17.72386 17.5 18 17.5 c h 1.285714 0.7857141 m 1.561857 0.7857141 1.785714 1.009572 1.785714 1.285714 c 1.785714 1.561857 1.561857 1.785714 1.285714 1.785714 c 1.009572 1.785714 0.7857141 1.561857 0.7857141 1.285714 c 0.7857141 1.009572 1.009572 0.7857141 1.285714 0.7857141 c h 1.285714 3.357143 m 1.561857 3.357143 1.785714 3.581 1.785714 3.857143 c 1.785714 4.133285 1.561857 4.357142 1.285714 4.357142 c 1.009572 4.357142 0.7857141 4.133285 0.7857141 3.857143 c 0.7857141 3.581 1.009572 3.357143 1.285714 3.357143 c h 1.285714 5.928572 m 1.561857 5.928572 1.785714 6.15243 1.785714 6.428572 c 1.785714 6.704715 1.561857 6.928572 1.285714 6.928572 c 1.009572 6.928572 0.7857141 6.704715 0.7857141 6.428572 c 0.7857141 6.15243 1.009572 5.928572 1.285714 5.928572 c h 1.285714 8.5 m 1.561857 8.5 1.785714 8.723858 1.785714 9 c 1.785714 9.276142 1.561857 9.5 1.285714 9.5 c 1.009572 9.5 0.7857141 9.276142 0.7857141 9 c 0.7857141 8.723858 1.009572 8.5 1.285714 8.5 c h 1.285714 11.07143 m 1.561857 11.07143 1.785714 11.29529 1.785714 11.57143 c 1.785714 11.84757 1.561857 12.07143 1.285714 12.07143 c 1.009572 12.07143 0.7857141 11.84757 0.7857141 11.57143 c 0.7857141 11.29529 1.009572 11.07143 1.285714 11.07143 c h 1.285714 13.64286 m 1.561857 13.64286 1.785714 13.86672 1.785714 14.14286 c 1.785714 14.419 1.561857 14.64286 1.285714 14.64286 c 1.009572 14.64286 0.7857141 14.419 0.7857141 14.14286 c 0.7857141 13.86672 1.009572 13.64286 1.285714 13.64286 c h 1.285714 16.21429 m 1.561857 16.21429 1.785714 16.43814 1.785714 16.71429 c 1.785714 16.99043 1.561857 17.21429 1.285714 17.21429 c 1.009572 17.21429 0.7857141 16.99043 0.7857141 16.71429 c 0.7857141 16.43814 1.009572 16.21429 1.285714 16.21429 c h 3.857143 0.7857141 m 4.133285 0.7857141 4.357142 1.009572 4.357142 1.285714 c 4.357142 1.561857 4.133285 1.785714 3.857143 1.785714 c 3.581 1.785714 3.357143 1.561857 3.357143 1.285714 c 3.357143 1.009572 3.581 0.7857141 3.857143 0.7857141 c h 3.857143 3.357143 m 4.133285 3.357143 4.357142 3.581 4.357142 3.857143 c 4.357142 4.133285 4.133285 4.357142 3.857143 4.357142 c 3.581 4.357142 3.357143 4.133285 3.357143 3.857143 c 3.357143 3.581 3.581 3.357143 3.857143 3.357143 c h 3.857143 5.928572 m 4.133285 5.928572 4.357142 6.15243 4.357142 6.428572 c 4.357142 6.704715 4.133285 6.928572 3.857143 6.928572 c 3.581 6.928572 3.357143 6.704715 3.357143 6.428572 c 3.357143 6.15243 3.581 5.928572 3.857143 5.928572 c h 3.857143 8.5 m 4.133285 8.5 4.357142 8.723858 4.357142 9 c 4.357142 9.276142 4.133285 9.5 3.857143 9.5 c 3.581 9.5 3.357143 9.276142 3.357143 9 c 3.357143 8.723858 3.581 8.5 3.857143 8.5 c h 3.857143 11.07143 m 4.133285 11.07143 4.357142 11.29529 4.357142 11.57143 c 4.357142 11.84757 4.133285 12.07143 3.857143 12.07143 c 3.581 12.07143 3.357143 11.84757 3.357143 11.57143 c 3.357143 11.29529 3.581 11.07143 3.857143 11.07143 c h 3.857143 13.64286 m 4.133285 13.64286 4.357142 13.86672 4.357142 14.14286 c 4.357142 14.419 4.133285 14.64286 3.857143 14.64286 c 3.581 14.64286 3.357143 14.419 3.357143 14.14286 c 3.357143 13.86672 3.581 13.64286 3.857143 13.64286 c h 3.857143 16.21429 m 4.133285 16.21429 4.357142 16.43814 4.357142 16.71429 c 4.357142 16.99043 4.133285 17.21429 3.857143 17.21429 c 3.581 17.21429 3.357143 16.99043 3.357143 16.71429 c 3.357143 16.43814 3.581 16.21429 3.857143 16.21429 c h 6.428572 0.7857141 m 6.704715 0.7857141 6.928572 1.009572 6.928572 1.285714 c 6.928572 1.561857 6.704715 1.785714 6.428572 1.785714 c 6.15243 1.785714 5.928572 1.561857 5.928572 1.285714 c 5.928572 1.009572 6.15243 0.7857141 6.428572 0.7857141 c h 6.428572 3.357143 m 6.704715 3.357143 6.928572 3.581 6.928572 3.857143 c 6.928572 4.133285 6.704715 4.357142 6.428572 4.357142 c 6.15243 4.357142 5.928572 4.133285 5.928572 3.857143 c 5.928572 3.581 6.15243 3.357143 6.428572 3.357143 c h 6.428572 5.928572 m 6.704715 5.928572 6.928572 6.15243 6.928572 6.428572 c 6.928572 6.704715 6.704715 6.928572 6.428572 6.928572 c 6.15243 6.928572 5.928572 6.704715 5.928572 6.428572 c 5.928572 6.15243 6.15243 5.928572 6.428572 5.928572 c h 6.428572 8.5 m 6.704715 8.5 6.928572 8.723858 6.928572 9 c 6.928572 9.276142 6.704715 9.5 6.428572 9.5 c 6.15243 9.5 5.928572 9.276142 5.928572 9 c 5.928572 8.723858 6.15243 8.5 6.428572 8.5 c h 6.428572 11.07143 m 6.704715 11.07143 6.928572 11.29529 6.928572 11.57143 c 6.928572 11.84757 6.704715 12.07143 6.428572 12.07143 c 6.15243 12.07143 5.928572 11.84757 5.928572 11.57143 c 5.928572 11.29529 6.15243 11.07143 6.428572 11.07143 c h 6.428572 13.64286 m 6.704715 13.64286 6.928572 13.86672 6.928572 14.14286 c 6.928572 14.419 6.704715 14.64286 6.428572 14.64286 c 6.15243 14.64286 5.928572 14.419 5.928572 14.14286 c 5.928572 13.86672 6.15243 13.64286 6.428572 13.64286 c h 6.428572 16.21429 m 6.704715 16.21429 6.928572 16.43814 6.928572 16.71429 c 6.928572 16.99043 6.704715 17.21429 6.428572 17.21429 c 6.15243 17.21429 5.928572 16.99043 5.928572 16.71429 c 5.928572 16.43814 6.15243 16.21429 6.428572 16.21429 c h 9 0.7857141 m 9.276142 0.7857141 9.5 1.009572 9.5 1.285714 c 9.5 1.561857 9.276142 1.785714 9 1.785714 c 8.723858 1.785714 8.5 1.561857 8.5 1.285714 c 8.5 1.009572 8.723858 0.7857141 9 0.7857141 c h 9 3.357143 m 9.276142 3.357143 9.5 3.581 9.5 3.857143 c 9.5 4.133285 9.276142 4.357142 9 4.357142 c 8.723858 4.357142 8.5 4.133285 8.5 3.857143 c 8.5 3.581 8.723858 3.357143 9 3.357143 c h 9 5.928572 m 9.276142 5.928572 9.5 6.15243 9.5 6.428572 c 9.5 6.704715 9.276142 6.928572 9 6.928572 c 8.723858 6.928572 8.5 6.704715 8.5 6.428572 c 8.5 6.15243 8.723858 5.928572 9 5.928572 c h 9 8.5 m 9.276142 8.5 9.5 8.723858 9.5 9 c 9.5 9.276142 9.276142 9.5 9 9.5 c 8.723858 9.5 8.5 9.276142 8.5 9 c 8.5 8.723858 8.723858 8.5 9 8.5 c h 9 11.07143 m 9.276142 11.07143 9.5
187
+ 11.29529 9.5 11.57143 c 9.5 11.84757 9.276142 12.07143 9 12.07143 c 8.723858 12.07143 8.5 11.84757 8.5 11.57143 c 8.5 11.29529 8.723858 11.07143 9 11.07143 c h 9 13.64286 m 9.276142 13.64286 9.5 13.86672 9.5 14.14286 c 9.5 14.419 9.276142 14.64286 9 14.64286 c 8.723858 14.64286 8.5 14.419 8.5 14.14286 c 8.5 13.86672 8.723858 13.64286 9 13.64286 c h 9 16.21429 m 9.276142 16.21429 9.5 16.43814 9.5 16.71429 c 9.5 16.99043 9.276142 17.21429 9 17.21429 c 8.723858 17.21429 8.5 16.99043 8.5 16.71429 c 8.5 16.43814 8.723858 16.21429 9 16.21429 c h 11.57143 0.7857141 m 11.84757 0.7857141 12.07143 1.009572 12.07143 1.285714 c 12.07143 1.561857 11.84757 1.785714 11.57143 1.785714 c 11.29529 1.785714 11.07143 1.561857 11.07143 1.285714 c 11.07143 1.009572 11.29529 0.7857141 11.57143 0.7857141 c h 11.57143 3.357143 m 11.84757 3.357143 12.07143 3.581 12.07143 3.857143 c 12.07143 4.133285 11.84757 4.357142 11.57143 4.357142 c 11.29529 4.357142 11.07143 4.133285 11.07143 3.857143 c 11.07143 3.581 11.29529 3.357143 11.57143 3.357143 c h 11.57143 5.928572 m 11.84757 5.928572 12.07143 6.15243 12.07143 6.428572 c 12.07143 6.704715 11.84757 6.928572 11.57143 6.928572 c 11.29529 6.928572 11.07143 6.704715 11.07143 6.428572 c 11.07143 6.15243 11.29529 5.928572 11.57143 5.928572 c h 11.57143 8.5 m 11.84757 8.5 12.07143 8.723858 12.07143 9 c 12.07143 9.276142 11.84757 9.5 11.57143 9.5 c 11.29529 9.5 11.07143 9.276142 11.07143 9 c 11.07143 8.723858 11.29529 8.5 11.57143 8.5 c h 11.57143 11.07143 m 11.84757 11.07143 12.07143 11.29529 12.07143 11.57143 c 12.07143 11.84757 11.84757 12.07143 11.57143 12.07143 c 11.29529 12.07143 11.07143 11.84757 11.07143 11.57143 c 11.07143 11.29529 11.29529 11.07143 11.57143 11.07143 c h 11.57143 13.64286 m 11.84757 13.64286 12.07143 13.86672 12.07143 14.14286 c 12.07143 14.419 11.84757 14.64286 11.57143 14.64286 c 11.29529 14.64286 11.07143 14.419 11.07143 14.14286 c 11.07143 13.86672 11.29529 13.64286 11.57143 13.64286 c h 11.57143 16.21429 m 11.84757 16.21429 12.07143 16.43814 12.07143 16.71429 c 12.07143 16.99043 11.84757 17.21429 11.57143 17.21429 c 11.29529 17.21429 11.07143 16.99043 11.07143 16.71429 c 11.07143 16.43814 11.29529 16.21429 11.57143 16.21429 c h 14.14286 0.7857141 m 14.419 0.7857141 14.64286 1.009572 14.64286 1.285714 c 14.64286 1.561857 14.419 1.785714 14.14286 1.785714 c 13.86672 1.785714 13.64286 1.561857 13.64286 1.285714 c 13.64286 1.009572 13.86672 0.7857141 14.14286 0.7857141 c h 14.14286 3.357143 m 14.419 3.357143 14.64286 3.581 14.64286 3.857143 c 14.64286 4.133285 14.419 4.357142 14.14286 4.357142 c 13.86672 4.357142 13.64286 4.133285 13.64286 3.857143 c 13.64286 3.581 13.86672 3.357143 14.14286 3.357143 c h 14.14286 5.928572 m 14.419 5.928572 14.64286 6.15243 14.64286 6.428572 c 14.64286 6.704715 14.419 6.928572 14.14286 6.928572 c 13.86672 6.928572 13.64286 6.704715 13.64286 6.428572 c 13.64286 6.15243 13.86672 5.928572 14.14286 5.928572 c h 14.14286 8.5 m 14.419 8.5 14.64286 8.723858 14.64286 9 c 14.64286 9.276142 14.419 9.5 14.14286 9.5 c 13.86672 9.5 13.64286 9.276142 13.64286 9 c 13.64286 8.723858 13.86672 8.5 14.14286 8.5 c h 14.14286 11.07143 m 14.419 11.07143 14.64286 11.29529 14.64286 11.57143 c 14.64286 11.84757 14.419 12.07143 14.14286 12.07143 c 13.86672 12.07143 13.64286 11.84757 13.64286 11.57143 c 13.64286 11.29529 13.86672 11.07143 14.14286 11.07143 c h 14.14286 13.64286 m 14.419 13.64286 14.64286 13.86672 14.64286 14.14286 c 14.64286 14.419 14.419 14.64286 14.14286 14.64286 c 13.86672 14.64286 13.64286 14.419 13.64286 14.14286 c 13.64286 13.86672 13.86672 13.64286 14.14286 13.64286 c h 14.14286 16.21429 m 14.419 16.21429 14.64286 16.43814 14.64286 16.71429 c 14.64286 16.99043 14.419 17.21429 14.14286 17.21429 c 13.86672 17.21429 13.64286 16.99043 13.64286 16.71429 c 13.64286 16.43814 13.86672 16.21429 14.14286 16.21429 c h 16.71429 0.7857141 m 16.99043 0.7857141 17.21429 1.009572 17.21429 1.285714 c 17.21429 1.561857 16.99043 1.785714 16.71429 1.785714 c 16.43814 1.785714 16.21429 1.561857 16.21429 1.285714 c 16.21429 1.009572 16.43814 0.7857141 16.71429 0.7857141 c h 16.71429 3.357143 m 16.99043 3.357143 17.21429 3.581 17.21429 3.857143 c 17.21429 4.133285 16.99043 4.357142 16.71429 4.357142 c 16.43814 4.357142 16.21429 4.133285 16.21429 3.857143 c 16.21429 3.581 16.43814 3.357143 16.71429 3.357143 c h 16.71429 5.928572 m 16.99043 5.928572 17.21429 6.15243 17.21429 6.428572 c 17.21429 6.704715 16.99043 6.928572 16.71429 6.928572 c 16.43814 6.928572 16.21429 6.704715 16.21429 6.428572 c 16.21429 6.15243 16.43814 5.928572 16.71429 5.928572 c h 16.71429 8.5 m 16.99043 8.5 17.21429 8.723858 17.21429 9 c 17.21429 9.276142 16.99043 9.5 16.71429 9.5 c 16.43814 9.5 16.21429 9.276142 16.21429 9 c 16.21429 8.723858 16.43814 8.5 16.71429 8.5 c h 16.71429 11.07143 m 16.99043 11.07143 17.21429 11.29529 17.21429 11.57143 c 17.21429 11.84757 16.99043 12.07143 16.71429 12.07143 c 16.43814 12.07143 16.21429 11.84757 16.21429 11.57143 c 16.21429 11.29529 16.43814 11.07143 16.71429 11.07143 c h 16.71429 13.64286 m 16.99043 13.64286 17.21429 13.86672 17.21429 14.14286 c 17.21429 14.419 16.99043 14.64286 16.71429 14.64286 c 16.43814 14.64286 16.21429 14.419 16.21429 14.14286 c 16.21429 13.86672 16.43814 13.64286 16.71429 13.64286 c h 16.71429 16.21429 m 16.99043 16.21429 17.21429 16.43814 17.21429 16.71429 c 17.21429 16.99043 16.99043 17.21429 16.71429 17.21429 c 16.43814 17.21429 16.21429 16.99043 16.21429 16.71429 c 16.21429 16.43814 16.43814 16.21429 16.71429 16.21429 c h
188
+ {strokecolor} rg f
189
+ endstream'''
190
+ }
191
 
192
+ HatchStyleTemplates={
193
+ 'Brick' :'/PatternName(Brick)', #BBObjPtr
194
+ 'DiagonalBrick':'/PatternName(Diagonal Brick)',
195
+ 'Horizontal':'/PatternName(Horizontal)',
196
+ 'Vertical':'/PatternName(Vertical)',
197
+ 'DiagonalDown':'/PatternName(Diagonal Down)',
198
+ 'DiagonalUp':'/PatternName(Diagonal Up)',
199
+ 'Grid':'/PatternName(Grid)',
200
+ 'Weave':'/PatternName(Weave)',
201
+ '10Dots':'/PatternName(10% Dots)',
202
+ '20Dots':'/PatternName(20% Dots)',
203
+ '30Dots':'/PatternName(30% Dots)'
204
+ }
205
+
206
+ def calculate_bounding_rect(vertices):
207
+ xs = [pt[0] for pt in vertices]
208
+ ys = [pt[1] for pt in vertices]
209
+ min_x = min(xs)
210
+ max_x = max(xs)
211
+ min_y = min(ys)
212
+ max_y = max(ys)
213
+ return [min_x, min_y, max_x, max_y]
214
+ def generate_annotation_xml_block(vertices, area_text, author, custom_data: dict, column_order: list, index: int,
215
+ type_internal: str = 'Bluebeam.PDF.Annotations.AnnotationMeasureArea',
216
+ subject: str = 'Area Measurement',
217
+ label: str = '',opacity:str='',
218
+ color:str='', linestyle:str='',
219
+ hatchstyle:str='',hatchLinescolor:str='',
220
+ bb_objptrMeas:str=''):
221
+ now = datetime.datetime.utcnow()
222
+ mod_date = now.strftime("D:%Y%m%d%H%M%S+00'00'")
223
+ creation_date = now.isoformat() + 'Z'
224
+ id_str = "fitz-" + uuid.uuid4().hex[:4].upper()
225
+
226
+ vert_str = ' '.join([f'{x:.4f}' for point in vertices for x in point])
227
+ ordered_column_values = [f'({custom_data.get(col, "")})' for col in column_order]
228
+ bsi_column_data = ''.join(ordered_column_values)
229
+ meastype=''
230
+ if subject.startswith('Area'):
231
+ meastype='129'
232
+ polygonpolylineDimension='/PolygonDimension'
233
+ polygonpolyline='/Polygon'
234
+ elif subject.startswith('Perimeter'):
235
+ meastype='130'
236
+ polygonpolylineDimension='/PolyLineDimension'
237
+ polygonpolyline='/PolyLine'
238
+ rectvertices=calculate_bounding_rect(vertices)
239
+
240
+ raw_text = f'''<<
241
+ /DS(font: Helvetica 12pt; text-align:center; line-height:13.8pt; color:#FF0000)
242
+ /Cap false
243
+ /AlignOnSegment true
244
+ /MeasurementTypes {meastype}
245
+ /SlopeType 1
246
+ /PitchRun 12
247
+ /IT
248
+ {polygonpolylineDimension}
249
+ /Vertices[{vert_str}]
250
+ /IC[{color}]
251
+ /Pattern/{hatchstyle}/PatternColor[{hatchLinescolor}]
252
+ /FillOpacity {opacity}
253
+ /T({author})
254
+ /CA {opacity}
255
+ /RC(<?xml version="1.0"?><body xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:contentType="text/html" xfa:APIVersion="BluebeamPDFRevu:2018" xfa:spec="2.2.0" style="font:Helvetica 12pt; text-align:center; line-height:13.8pt; color:#FF0000" xmlns="http://www.w3.org/1999/xhtml"><p>{area_text}</p></body>)
256
+ /Label({label})
257
+ /Subj({subject})
258
+ /Measure/BBObjPtr_{bb_objptrMeas}
259
+ /BSIColumnData[{bsi_column_data}]
260
+ /NM({id_str})
261
+ /Subtype/{polygonpolyline}
262
+ /Rect[{rectvertices[0]} {rectvertices[1]} {rectvertices[2]} {rectvertices[3]}]
263
+ /Contents({area_text})
264
+ /F 4
265
+ /C[{color}]
266
+ /BS{linestyle}
267
+ /M({mod_date})
268
+ >>'''.encode('utf-8')
269
+
270
+ compressed = zlib.compress(raw_text)
271
+ base64_raw = base64.b16encode(compressed).lower().decode()
272
+
273
+ annotation = Element('Annotation')
274
+ SubElement(annotation, 'Page').text = '1'
275
+ SubElement(annotation, 'Contents').text = area_text
276
+ SubElement(annotation, 'ModDate').text = creation_date
277
+ SubElement(annotation, 'Color').text = '#B7B7E8'
278
+ SubElement(annotation, 'Type').text = 'Polygon'
279
+ SubElement(annotation, 'ID').text = id_str
280
+ SubElement(annotation, 'TypeInternal').text = type_internal
281
+ SubElement(annotation, 'Raw').text = base64_raw
282
+ SubElement(annotation, 'Index').text = str(index)
283
+
284
+ custom = SubElement(annotation, 'Custom')
285
+ for key, value in custom_data.items():
286
+ SubElement(custom, key).text = value
287
+
288
+ SubElement(annotation, 'Subject').text = subject
289
+ SubElement(annotation, 'CreationDate').text = creation_date
290
+ SubElement(annotation, 'Author').text = author
291
+ SubElement(annotation, 'Label').text = label
292
+
293
+ return annotation
294
+
295
+ def generate_bb_objptr():
296
+ return ''.join(random.choices(string.ascii_uppercase, k=16))
297
+
298
+ def compresslikeBBRaw(textToCompress):
299
+ decompressedX = textToCompress.encode('utf-8')
300
+ print(decompressedX)
301
+ recompressedX = zlib.compress(decompressedX)
302
+ print(recompressedX.hex())
303
+ return recompressedX.hex()
304
+
305
+ def setBrickHatch(fillcolor,strokecolor):
306
+ # resourceid='789cf30b0877f2f40cf30f758ff48e0a0df3040029f004fd'
307
+ randombb_objptr=generate_bb_objptr()
308
+ resourceid=compresslikeBBRaw(randombb_objptr)
309
+ compressedRaw=compresslikeBBRaw(AllhatchesCodes['Brick'].format(fillcolor=fillcolor, strokecolor=strokecolor))
310
+ return 'BBObjPtr_'+randombb_objptr+HatchStyleTemplates['Brick'],compressedRaw, resourceid
311
+
312
+ def setDiagonalBrickHatch(fillcolor,strokecolor):
313
+ # resourceid='789c0b0d8cf47274f60d0df28a740ef4f4f3020029ab04da'
314
+ randombb_objptr=generate_bb_objptr()
315
+ resourceid=compresslikeBBRaw(randombb_objptr)
316
+ compressedRaw=compresslikeBBRaw(AllhatchesCodes['DiagonalBrick'].format(fillcolor=fillcolor, strokecolor=strokecolor))
317
+ return 'BBObjPtr_'+randombb_objptr+HatchStyleTemplates['DiagonalBrick'],compressedRaw,resourceid
318
+
319
+ def setHorizontalHatch(fillcolor,strokecolor):
320
+ # resourceid='789cf3720b76f6f072f173f58cf071f209f00000273604a3'
321
+ randombb_objptr=generate_bb_objptr()
322
+ resourceid=compresslikeBBRaw(randombb_objptr)
323
+ compressedRaw=compresslikeBBRaw(AllhatchesCodes['Horizontal'].format(fillcolor=fillcolor, strokecolor=strokecolor))
324
+ return 'BBObjPtr_'+randombb_objptr+HatchStyleTemplates['Horizontal'],compressedRaw,resourceid
325
+
326
+ def setVerticalHatch(fillcolor,strokecolor):
327
+ # resourceid='789cf30d080ef4f609088b74740ff0890a7607002a1904f0'
328
+ randombb_objptr=generate_bb_objptr()
329
+ resourceid=compresslikeBBRaw(randombb_objptr)
330
+ compressedRaw=compresslikeBBRaw(AllhatchesCodes['Vertical'].format(fillcolor=fillcolor, strokecolor=strokecolor))
331
+ return 'BBObjPtr_'+randombb_objptr+HatchStyleTemplates['Vertical'],compressedRaw,resourceid
332
+
333
+ def setDiagonalDownHatch(fillcolor,strokecolor):
334
+ # resourceid='789cf3f28b74f477f7770b0c7675f68f74f60300288f04c3'
335
+ randombb_objptr=generate_bb_objptr()
336
+ resourceid=compresslikeBBRaw(randombb_objptr)
337
+ compressedRaw=compresslikeBBRaw(AllhatchesCodes['DiagonalDown'].format(fillcolor=fillcolor, strokecolor=strokecolor))
338
+ return 'BBObjPtr_'+randombb_objptr+HatchStyleTemplates['DiagonalDown'],compressedRaw,resourceid
339
+
340
+ def setDiagonalUpHatch(fillcolor,strokecolor):
341
+ # resourceid='789c0b8a70f30df4f70b09f40cf6f108757606002a2304dc'
342
+ randombb_objptr=generate_bb_objptr()
343
+ resourceid=compresslikeBBRaw(randombb_objptr)
344
+ compressedRaw=compresslikeBBRaw(AllhatchesCodes['DiagonalUp'].format(fillcolor=fillcolor, strokecolor=strokecolor))
345
+ return 'BBObjPtr_'+randombb_objptr+HatchStyleTemplates['DiagonalUp'],compressedRaw,resourceid
346
+
347
+ def setGridHatch(fillcolor,strokecolor):
348
+ # resourceid='789c730b71738e0a760cf3758972f370740a0300286b04ba'
349
+ randombb_objptr=generate_bb_objptr()
350
+ resourceid=compresslikeBBRaw(randombb_objptr)
351
+ compressedRaw=compresslikeBBRaw(AllhatchesCodes['Grid'].format(fillcolor=fillcolor, strokecolor=strokecolor))
352
+ return 'BBObjPtr_'+randombb_objptr+HatchStyleTemplates['Grid'],compressedRaw,resourceid
353
+
354
+ def setWeaveHatch(fillcolor,strokecolor):
355
+ # resourceid='789cf30af775f2f1f776720d8972740c8af40500285c04c6'
356
+ randombb_objptr=generate_bb_objptr()
357
+ resourceid=compresslikeBBRaw(randombb_objptr)
358
+ compressedRaw=compresslikeBBRaw(AllhatchesCodes['Weave'].format(fillcolor=fillcolor, strokecolor=strokecolor))
359
+ return 'BBObjPtr_'+randombb_objptr+HatchStyleTemplates['Weave'],compressedRaw,resourceid
360
+
361
+ def set10DotsHatch(fillcolor,strokecolor):
362
+ # resourceid='789cf3740f71f6770d0e8c0a0f76f50e0df00600291c04e4'
363
+ randombb_objptr=generate_bb_objptr()
364
+ resourceid=compresslikeBBRaw(randombb_objptr)
365
+ compressedRaw=compresslikeBBRaw(AllhatchesCodes['10Dots'].format(fillcolor=fillcolor, strokecolor=strokecolor))
366
+ return 'BBObjPtr_'+randombb_objptr+HatchStyleTemplates['10Dots'],compressedRaw,resourceid
367
+
368
+ def set20DotsHatch(fillcolor,strokecolor):
369
+ # resourceid='789c738f0cf70bf5f0f0770a0df471760df7000029b004d5'
370
+ randombb_objptr=generate_bb_objptr()
371
+ resourceid=compresslikeBBRaw(randombb_objptr)
372
+ compressedRaw=compresslikeBBRaw(AllhatchesCodes['20Dots'].format(fillcolor=fillcolor, strokecolor=strokecolor))
373
+ return 'BBObjPtr_'+randombb_objptr+HatchStyleTemplates['20Dots'],compressedRaw,resourceid
374
+
375
+ def set30DotsHatch(fillcolor,strokecolor):
376
+ # resourceid='789cf38c747789f4f68a8c0cf2f6f2f676f2070029b104dc'
377
+ randombb_objptr=generate_bb_objptr()
378
+ resourceid=compresslikeBBRaw(randombb_objptr)
379
+ compressedRaw=compresslikeBBRaw(AllhatchesCodes['30Dots'].format(fillcolor=fillcolor, strokecolor=strokecolor))
380
+ return 'BBObjPtr_'+randombb_objptr+HatchStyleTemplates['30Dots'],compressedRaw,resourceid
381
+
382
+ def save_multiple_annotations_bax(annotations, output_path, column_order,pdfWidth,pdfHeight):
383
+ """
384
+ annotations: list of dicts, each with:
385
+ - vertices: list of [x, y]
386
+ - text: str (label/tooltip)
387
+ - author: str
388
+ - custom_data: dict of custom field values
389
+ - type_internal: str (e.g., Bluebeam.PDF.Annotations.AnnotationMeasurePerimeter)
390
+ - subject: str (e.g., Perimeter Measurement)
391
+ """
392
+ globalhatches=[]
393
+ scales=[]
394
+ doc = Element('Document', Version='1')
395
+ ########## Subelement1 - page ################
396
+ page = SubElement(doc, 'Page', Index='0')
397
+ SubElement(page, 'Label').text = '1'
398
+ SubElement(page, 'Width').text = str(pdfWidth)
399
+ SubElement(page, 'Height').text = str(pdfHeight)
400
+
401
+ for i, ann in enumerate(annotations):
402
+
403
+ bb_objptrMeas=generate_bb_objptr()
404
+ resourceidComp=compresslikeBBRaw(bb_objptrMeas)
405
+ scales.append(resourceidComp)
406
+
407
+ hatchstyle_key = ann.get('hatchstyle') # e.g., 'Brick'
408
+ if hatchstyle_key not in globalhatches and hatchstyle_key:
409
+ globalhatches.append([hatchstyle_key[2],hatchstyle_key[1]]) # id, raw
410
+ hatchstyle=hatchstyle_key[0]
411
+ else:
412
+ hatchstyle='none'
413
+
414
+ annotation_xml = generate_annotation_xml_block(
415
+ vertices=ann['vertices'],
416
+ area_text=ann['text'],
417
+ author=ann['author'],
418
+ custom_data=ann['custom_data'],
419
+ column_order=column_order,
420
+ index=i,
421
+ bb_objptrMeas=bb_objptrMeas,
422
+ type_internal=ann.get('type_internal', 'Bluebeam.PDF.Annotations.AnnotationMeasureArea'),
423
+ subject=ann.get('subject', 'Area Measurement'),
424
+ label=ann.get('label', 'label1'),
425
+ opacity=ann.get('opacity', ''),
426
+ color=ann.get('color', ''),
427
+ linestyle=ann.get('linestyle', ''),
428
+ hatchstyle=hatchstyle,
429
+ hatchLinescolor=ann.get('hatchLinescolor',''),
430
+ )
431
+ page.append(annotation_xml)
432
+ ################# Subelement 2 - Global resources############
433
+ GlobalResources = SubElement(doc, 'GlobalResources')
434
+ for hatch in globalhatches:
435
+ Resource = SubElement(GlobalResources, 'Resource')
436
+ SubElement(Resource, 'ID').text = hatch[0]
437
+ SubElement(Resource, 'Raw').text = hatch[1]
438
+ for scale in scales:
439
+ Resource = SubElement(GlobalResources, 'Resource')
440
+ SubElement(Resource, 'ID').text = scale
441
+ SubElement(Resource, 'Raw').text = '789c85d04f0b82401005f0af3247bd34a35176b085503c55847f22a80e2a4b7858ad7537e8dba7951ea2a5e330efc783e7fb983eae1c373c6fb5e498e842f577bcc6d872a014b00407848d87e310dd6a5170193552e40a33abfb0540139ace5ccff316188243844962d98c9d3134b297eba2f4255626d1dee06d3e200a4149cd47989ae0c99dd32fb8ebe0a8f7265dea3fb5b9bc7095d5950a9aface655b3575bf070d8b30f604438f6873'
442
+ pretty_xml = parseString(tostring(doc)).toprettyxml(indent=" ")
443
+ with open(output_path, 'w', encoding='utf-8') as f:
444
+ f.write(pretty_xml)
445
+
446
+ print(f" Saved {len(annotations)} annotations to {output_path}")
447
 
448
  """PDF to image"""
449
 
 
1617
  return output_pdf_io.read() , annotations_data
1618
 
1619
 
1620
+ def _order_points_monotonic(points, eps=1e-9):
1621
+ """
1622
+ Order a list of (x,y) points along their main axis (PCA),
1623
+ then refine ordering by greedy nearest-neighbor but never stepping
1624
+ backward along the principal-axis projection (monotonic).
1625
+ Returns ordered list of (x,y).
1626
+ """
1627
+ if not points:
1628
+ return []
1629
+ if len(points) <= 2:
1630
+ return list(points)
1631
+
1632
+ pts = np.array(points, dtype=float) # shape (n,2)
1633
+ mean = pts.mean(axis=0)
1634
+ centered = pts - mean
1635
+
1636
+ # PCA via SVD
1637
+ try:
1638
+ _, _, vt = np.linalg.svd(centered, full_matrices=False)
1639
+ principal = vt[0] # principal axis direction (unit-ish)
1640
+ except Exception:
1641
+ # fallback to simple x or y sort if SVD fails
1642
+ return sorted(points, key=lambda p: (p[0], p[1]))
1643
+
1644
+ # projection scalars along principal axis
1645
+ proj = centered.dot(principal) # length n array
1646
+
1647
+ # sort indices by projection (ascending)
1648
+ idxs = list(np.argsort(proj))
1649
+ proj_sorted = proj[idxs]
1650
+
1651
+ # greedy monotonic walk: start from first index (smallest projection)
1652
+ ordered = []
1653
+ remaining = set(idxs)
1654
+ curr_idx = idxs[0]
1655
+ ordered.append(tuple(pts[curr_idx].tolist()))
1656
+ remaining.remove(curr_idx)
1657
+
1658
+ while remaining:
1659
+ # candidates that do not go backwards along projection
1660
+ cand = [i for i in remaining if proj[i] >= proj[curr_idx] - eps]
1661
+ if not cand:
1662
+ # if none, pick nearest among remaining (rare)
1663
+ cand = list(remaining)
1664
+
1665
+ # choose candidate with minimum Euclidean distance to current point
1666
+ curr_pt = pts[curr_idx]
1667
+ best = min(cand, key=lambda i: np.hypot(*(pts[i] - curr_pt)))
1668
+ ordered.append(tuple(pts[best].tolist()))
1669
+ remaining.remove(best)
1670
+ curr_idx = best
1671
+
1672
+ return ordered
1673
+
1674
+
1675
+ def find_nearby_vertices(shapes, distance_threshold=0.5):
1676
+ """
1677
+ shapes: list structured as [ vertices_list, area, perimeter, color_tuple ]
1678
+ where vertices_list is [(x,y), ...]
1679
+ distance_threshold: maximum absolute difference in x and y to consider two vertices 'close'
1680
+
1681
+ Returns:
1682
+ intersections: [ [ [(x,y), ...] ], ... ]
1683
+ grouped_shapes: list of grouped shapes (each group is a merged list of shape indices)
1684
+ """
1685
+ intersections = []
1686
+ grouped_shapes = [] # new array to collect shape groups
1687
+ used = set()
1688
+
1689
+ n = len(shapes)
1690
+ for i in range(n):
1691
+ for j in range(i + 1, n):
1692
+ shape1 = shapes[i]
1693
+ shape2 = shapes[j]
1694
+
1695
+ # Skip if same or invalid color
1696
+ if (
1697
+ shape1[3] == shape2[3] or
1698
+ shape1[3] in [(0,0,0), (255,255,255)] or
1699
+ shape2[3] in [(0,0,0), (255,255,255)]
1700
+ ):
1701
+ continue
1702
+
1703
+ verts1 = list(shape1[0])
1704
+ verts2 = list(shape2[0])
1705
+ if len(verts1) > 1 and verts1[0] == verts1[-1]:
1706
+ verts1 = verts1[:-1]
1707
+ if len(verts2) > 1 and verts2[0] == verts2[-1]:
1708
+ verts2 = verts2[:-1]
1709
+
1710
+ close_points = []
1711
+ for (x1, y1) in verts1:
1712
+ for (x2, y2) in verts2:
1713
+ if abs(x1 - x2) <= distance_threshold and abs(y1 - y2) <= distance_threshold:
1714
+ p = (float(x2), float(y2))
1715
+ if p not in close_points:
1716
+ close_points.append(p)
1717
+
1718
+ if close_points:
1719
+ # Order + dedup (optional)
1720
+ ordered = _order_points_monotonic(close_points)
1721
+ dedup = []
1722
+ for pt in ordered:
1723
+ if not dedup or (abs(pt[0]-dedup[-1][0])>1e-6 or abs(pt[1]-dedup[-1][1])>1e-6):
1724
+ dedup.append(pt)
1725
+
1726
+ if len(dedup) >= 2:
1727
+ intersections.append([dedup])
1728
+
1729
+ # ---- new: group these two shapes together ----
1730
+ group = {i, j}
1731
+ # merge if overlapping with existing groups
1732
+ merged = False
1733
+ for g in grouped_shapes:
1734
+ if not group.isdisjoint(g):
1735
+ g.update(group)
1736
+ merged = True
1737
+ break
1738
+ if not merged:
1739
+ grouped_shapes.append(group)
1740
+
1741
+ # Convert grouped indices into grouped shapes
1742
+ grouped_shapes_final = []
1743
+ for g in grouped_shapes:
1744
+ merged_verts = []
1745
+ colors = set()
1746
+ for idx in g:
1747
+ merged_verts.extend(shapes[idx][0])
1748
+ colors.add(shapes[idx][3])
1749
+ grouped_shapes_final.append([merged_verts, None, None, list(colors)])
1750
+
1751
+ return intersections, grouped_shapes_final
1752
+
1753
+ def process_polygons(polygons, imgg, dxfratio, rotationangle, derotationMatrix, rotationOld, width, height):
1754
+ processed_shapes = []
1755
+
1756
+ for polygon in polygons:
1757
+ cntPoints = []
1758
+ cntPoints1 = []
1759
+ shapeePerimeter = []
1760
+ shapeeArea = []
1761
+ Text_Detected = 0
1762
+
1763
+ blackImgShapes = np.zeros(imgg.shape[:2], dtype="uint8")
1764
+ blackImgShapes = cv2.cvtColor(blackImgShapes, cv2.COLOR_GRAY2BGR)
1765
+
1766
+ # Handle nested or flat structure
1767
+ vertices = polygon
1768
+ print("vertices = ", vertices)
1769
+
1770
+ for vertex in vertices:
1771
+ for pt in vertex:
1772
+ x = pt[0] * dxfratio
1773
+ y = pt[1] * dxfratio
1774
+ if rotationangle == 0 and y < 0:
1775
+ y = -y
1776
+ cntPoints.append([int(x), int(y)])
1777
+ cntPoints1.append([x, y])
1778
+
1779
+ # Draw contour (for mask/image purposes)
1780
+ cv2.drawContours(blackImgShapes, [np.array(cntPoints)], -1, (255, 255, 255), thickness=-1)
1781
+
1782
+ # Build perimeter points after derotation
1783
+ for px, py in cntPoints1:
1784
+ p = fitz.Point(px, py) * derotationMatrix
1785
+ shapeePerimeter.append([p[0], p[1]])
1786
+
1787
+ # Apply flip and rotation to this polygon only
1788
+ shapeePerimeter = np.flip(np.array(shapeePerimeter), 1).tolist()
1789
+ shapeePerimeter = rotate_polygon(shapeePerimeter, rotationangle, rotationOld, width, height)
1790
+
1791
+ # Append in [[polygon_points]] format
1792
+ processed_shapes.append(shapeePerimeter)
1793
+
1794
+ return processed_shapes
1795
+
1796
+
1797
+ def process_grouped_shapes(grouped_shapes, imgg, dxfratio, rotationangle, derotationMatrix, rotationOld, width, height):
1798
+ """
1799
+ Processes grouped shapes (merged polygons).
1800
+
1801
+ grouped_shapes: list of [vertices_list, None, None, colors_list]
1802
+ Returns: list of [coords, area, perimeter, color]
1803
+ """
1804
+ processed_shapes = []
1805
+
1806
+ for group in grouped_shapes:
1807
+ merged_vertices = group[0] # all vertices from the group
1808
+ colors = group[3] # list of colors (can pick the first or merge info)
1809
+
1810
+ cntPoints = []
1811
+ cntPoints1 = []
1812
+ shapeePerimeter = []
1813
+
1814
+ blackImgShapes = np.zeros(imgg.shape[:2], dtype="uint8")
1815
+ blackImgShapes = cv2.cvtColor(blackImgShapes, cv2.COLOR_GRAY2BGR)
1816
+
1817
+ for pt in merged_vertices:
1818
+ x = pt[0] * dxfratio
1819
+ y = pt[1] * dxfratio
1820
+ if rotationangle == 0 and y < 0:
1821
+ y = -y
1822
+ cntPoints.append([int(x), int(y)])
1823
+ cntPoints1.append([x, y])
1824
+
1825
+ if not cntPoints:
1826
+ continue
1827
+
1828
+ # Draw contour for area/perimeter
1829
+ contour_np = np.array(cntPoints, dtype=np.int32)
1830
+ cv2.drawContours(blackImgShapes, [contour_np], -1, (255, 255, 255), thickness=-1)
1831
+
1832
+ area = cv2.contourArea(contour_np)
1833
+ perimeter = cv2.arcLength(contour_np, True)
1834
+
1835
+ # Apply derotation + transform
1836
+ for px, py in cntPoints1:
1837
+ p = fitz.Point(px, py) * derotationMatrix
1838
+ shapeePerimeter.append([p[0], p[1]])
1839
+
1840
+ # Flip + rotate polygon
1841
+ shapeePerimeter = np.flip(np.array(shapeePerimeter), 1).tolist()
1842
+ shapeePerimeter = rotate_polygon(shapeePerimeter, rotationangle, rotationOld, width, height)
1843
+
1844
+ # Pack result in full structure
1845
+ processed_shapes.append([shapeePerimeter, area, perimeter, colors[0] if colors else (0,0,0)])
1846
+
1847
+ return processed_shapes
1848
+
1849
+ class DSU:
1850
+ def __init__(self, n: int):
1851
+ self.p = list(range(n))
1852
+ self.r = [0]*n
1853
+ def find(self, x: int) -> int:
1854
+ while self.p[x] != x:
1855
+ self.p[x] = self.p[self.p[x]]
1856
+ x = self.p[x]
1857
+ return x
1858
+ def union(self, a: int, b: int):
1859
+ ra, rb = self.find(a), self.find(b)
1860
+ if ra == rb: return
1861
+ if self.r[ra] < self.r[rb]:
1862
+ self.p[ra] = rb
1863
+ elif self.r[ra] > self.r[rb]:
1864
+ self.p[rb] = ra
1865
+ else:
1866
+ self.p[rb] = ra
1867
+ self.r[ra] += 1
1868
+
1869
+ # ---------- small helpers ----------
1870
+ def _ensure_vertices_list(verts_any) -> List[Tuple[float, float]]:
1871
+ """Accept [(x,y), ...] or [[(x,y), ...]] and return a flat list of (x,y) floats."""
1872
+ if verts_any and isinstance(verts_any[0], (list, tuple)) and len(verts_any) == 1 \
1873
+ and verts_any[0] and isinstance(verts_any[0][0], (list, tuple)):
1874
+ verts_any = verts_any[0]
1875
+ return [(float(x), float(y)) for (x, y) in verts_any]
1876
+
1877
+ def _bbox(verts):
1878
+ xs = [p[0] for p in verts]; ys = [p[1] for p in verts]
1879
+ return (min(xs), min(ys), max(xs), max(ys))
1880
+
1881
+ def _boxes_manhattan_gap(b1, b2):
1882
+ minx1, miny1, maxx1, maxy1 = b1
1883
+ minx2, miny2, maxx2, maxy2 = b2
1884
+ dx = max(0.0, max(minx1 - maxx2, minx2 - maxx1))
1885
+ dy = max(0.0, max(miny1 - maxy2, miny2 - maxy1))
1886
+ return dx, dy
1887
+
1888
+ def _shapes_quick_close(verts1, verts2, axis_threshold):
1889
+ """Quick AABB gate then vertex-vertex proximity check (axis threshold)."""
1890
+ b1 = _bbox(verts1); b2 = _bbox(verts2)
1891
+ dx_box, dy_box = _boxes_manhattan_gap(b1, b2)
1892
+ if dx_box > axis_threshold or dy_box > axis_threshold:
1893
+ return False
1894
+ for (x1,y1) in verts1:
1895
+ for (x2,y2) in verts2:
1896
+ if abs(x1 - x2) <= axis_threshold and abs(y1 - y2) <= axis_threshold:
1897
+ return True
1898
+ return False
1899
+
1900
+ # --------------------------
1901
+ # 1) Gather groups and produce unioned polygons
1902
+ # --------------------------
1903
+ def gather_and_union_groups(
1904
+ hatched_areas: List[Any],
1905
+ axis_threshold: float = 0.5,
1906
+ require_diff_color: bool = True,
1907
+ skip_colors: Set[Tuple[int,int,int]] = None,
1908
+ ) -> List[Tuple[List[Tuple[float,float]], float, float, Tuple[int,int,int]]]:
1909
+ """
1910
+ Group shapes that are close (chain merging), then UNITE the original polygons of each group.
1911
+ Returns list of (coords, area, perimeter, color) where coords is the outer boundary of each polygon
1912
+ produced by the union (for MultiPolygon each part is appended as a separate result).
1913
+ - hatched_areas items: [ vertices, area, perimeter, color ]
1914
+ """
1915
+ if skip_colors is None:
1916
+ skip_colors = set()
1917
+
1918
+ # collect valid polygon geometries and metadata
1919
+ polys = []
1920
+ colors = []
1921
+ areas = []
1922
+ perims = []
1923
+ for item in hatched_areas:
1924
+ if not item or len(item) < 4:
1925
+ continue
1926
+ verts_any, area, perim, color = item[0], item[1], item[2], item[3]
1927
+ if color in skip_colors:
1928
+ continue
1929
+ verts = _ensure_vertices_list(verts_any)
1930
+ if len(verts) < 3:
1931
+ continue
1932
+ try:
1933
+ poly = Polygon(verts)
1934
+ if not poly.is_valid or poly.is_empty:
1935
+ # try fix by buffering 0
1936
+ poly = poly.buffer(0)
1937
+ if poly.is_empty:
1938
+ continue
1939
+ polys.append(poly)
1940
+ colors.append(tuple(color))
1941
+ areas.append(float(area) if isinstance(area, (int,float)) else poly.area)
1942
+ perims.append(float(perim) if isinstance(perim, (int,float)) else poly.length)
1943
+ except Exception:
1944
+ continue
1945
+
1946
+ m = len(polys)
1947
+ if m == 0:
1948
+ return []
1949
+
1950
+ # group indices using DSU with chain merging
1951
+ dsu = DSU(m)
1952
+ for i in range(m):
1953
+ for j in range(i+1, m):
1954
+ if require_diff_color and colors[i] == colors[j]:
1955
+ continue
1956
+ verts_i = list(polys[i].exterior.coords)
1957
+ verts_j = list(polys[j].exterior.coords)
1958
+ if _shapes_quick_close(verts_i, verts_j, axis_threshold):
1959
+ dsu.union(i, j)
1960
+
1961
+ # collect components
1962
+ comp = {}
1963
+ for i in range(m):
1964
+ r = dsu.find(i)
1965
+ comp.setdefault(r, []).append(i)
1966
+
1967
+ results = []
1968
+ for root, members in comp.items():
1969
+ group_polys = [polys[k] for k in members]
1970
+ try:
1971
+ unioned = unary_union(group_polys)
1972
+ except Exception:
1973
+ # fallback: union iteratively
1974
+ u = group_polys[0]
1975
+ for p in group_polys[1:]:
1976
+ u = u.union(p)
1977
+ unioned = u
1978
+
1979
+ # unioned might be Polygon, MultiPolygon, GeometryCollection
1980
+ def _handle_polygon(polygon_geom, rep_color):
1981
+ coords = [(float(x), float(y)) for x,y in polygon_geom.exterior.coords]
1982
+ area = polygon_geom.area
1983
+ perim = polygon_geom.length
1984
+ results.append((coords, area, perim, rep_color))
1985
+
1986
+ # choose representative color: first member's color
1987
+ rep_color = colors[members[0]] if members else (0,0,0)
1988
+
1989
+ if isinstance(unioned, Polygon):
1990
+ _handle_polygon(unioned, rep_color)
1991
+ elif isinstance(unioned, MultiPolygon) or isinstance(unioned, GeometryCollection):
1992
+ # GeometryCollection may have polygons inside
1993
+ for geom in getattr(unioned, "geoms", []):
1994
+ if isinstance(geom, Polygon):
1995
+ _handle_polygon(geom, rep_color)
1996
+ else:
1997
+ # unexpected geometry — skip
1998
+ continue
1999
+
2000
+ return results
2001
+
2002
+ # --------------------------
2003
+ # 2) process_grouped_shapes -> produce processed list ready for drawing
2004
+ # --------------------------
2005
+ def process_grouped_shapes(
2006
+ grouped_polys: List[Tuple[List[Tuple[float,float]], float, float, Tuple[int,int,int]]],
2007
+ imgg, dxfratio, rotationangle, derotationMatrix, rotationOld, width, height
2008
+ ) -> List[Tuple[List[Tuple[float,float]], float, float, Tuple[int,int,int]]]:
2009
+ """
2010
+ For each grouped polygon (coords, area, perim, color), scale, derotate, rotate and return
2011
+ processed polygon in same (coords, area, perim, color) format, coords as list of [x,y] floats.
2012
+ """
2013
+ processed = []
2014
+ for coords, area, perim, color in grouped_polys:
2015
+ if not coords:
2016
+ continue
2017
+
2018
+ cntPoints = []
2019
+ cntPoints1 = []
2020
+ # convert/scaling
2021
+ for (x,y) in coords:
2022
+ xs = x * dxfratio
2023
+ ys = y * dxfratio
2024
+ if rotationangle == 0 and ys < 0:
2025
+ ys = -ys
2026
+ cntPoints.append([int(xs), int(ys)])
2027
+ cntPoints1.append([xs, ys])
2028
+
2029
+ if not cntPoints1:
2030
+ continue
2031
+
2032
+ # build derotated perimeter points
2033
+ shapeePerimeter = []
2034
+ for px, py in cntPoints1:
2035
+ p = fitz.Point(px, py) * derotationMatrix
2036
+ shapeePerimeter.append([p[0], p[1]])
2037
+
2038
+ # flip and rotate (use your rotate_polygon)
2039
+ shapeePerimeter = np.flip(np.array(shapeePerimeter), 1).tolist()
2040
+ shapeePerimeter = rotate_polygon(shapeePerimeter, rotationangle, rotationOld, width, height)
2041
+
2042
+ # ensure type and length
2043
+ final_coords = [(float(x), float(y)) for x,y in shapeePerimeter]
2044
+ if len(final_coords) < 3:
2045
+ continue
2046
+
2047
+ processed.append((final_coords, area, perim, color))
2048
+
2049
+ return processed
2050
 
2051
 
2052
  def mainFunctionDrawImgPdf(datadoc,dxfpath, dxfratio,SearchArray,pdfpath=0,pdfname=0,pdf_content=0):
 
2089
 
2090
 
2091
  hatched_areas,Legendarray = get_hatched_areas(datadoc,dxfpath,FinalRatio,rotationangle,SearchArray)
2092
+
2093
+ nearby,grouped_shapes_final=find_nearby_vertices(hatched_areas)
2094
+ processed_intersections = process_polygons(nearby, img, dxfratio, rotationangle, derotationMatrix,rotationOld,width,height)
2095
+
2096
+ groups = gather_and_union_groups(hatched_areas, axis_threshold=0.5,
2097
+ require_diff_color=True,
2098
+ skip_colors={(0,0,0),(255,255,255)})
2099
+
2100
+ processed_grouped_shapes = process_grouped_shapes(groups,
2101
+ imgg, dxfratio, rotationangle, derotationMatrix, rotationOld, width, height)
2102
+
2103
  allshapes=[]
2104
  # Iterate through each polygon in metric units
2105
  NewColors = []
 
2110
  i=0
2111
  flagcolor = 0
2112
  ColorCheck=[]
2113
+
2114
+ XMLArea = []
2115
+ XMLPerimeter = []
2116
 
2117
 
2118
  for polygon in hatched_areas:
 
2257
 
2258
 
2259
  cv2.drawContours(imgg, [np.array(cntPoints)], -1, ([NewColors[2],NewColors[1],NewColors[0]]), thickness=-1)
2260
+
2261
+ vertices_area = [
2262
+ [[float(x), float(y)] for x, y in shapeeArea], # vertices
2263
+ str(polygon[1]),NewColors # area
2264
+ ]
2265
+ XMLArea.append(vertices_area)
2266
+
2267
+ vertices_Perimeter = [
2268
+ [[float(x), float(y)] for x, y in shapeePerimeter], # vertices
2269
+ str(polygon[1]),NewColors # area
2270
+ ]
2271
+ XMLPerimeter.append(vertices_Perimeter)
2272
 
2273
  annot11 = page2.add_polygon_annot( points=shapeeArea) # 'Polygon'
2274
  annot11.set_border(width=0.2)
 
2290
  i += 1
2291
  alpha = 0.8 # Transparency factor.
2292
 
2293
+ for shapes in processed_intersections:
2294
+ annot13 = page2.add_polyline_annot(points=shapes) # 'Polygon'
2295
+ annot13.set_border(width=0.8)
2296
+ annot13.set_colors(stroke=(0,0,1))
2297
+ annot13.set_info(content='Perimeter='+str(1)+' m',subject='Perimeter Measurement', title="Trim Measurement")
2298
+ # annot12.set_intent("PolygonPerimeter")
2299
+ # annot12.set_name("PerimeterAnnot")
2300
+ # annot12.info["IT"] = "PolygonPerimeter"
2301
+ annot13.set_opacity(0.7)
2302
+ # annot.set_line_ends(fitz.PDF_ANNOT_LE_DIAMOND, fitz.PDF_ANNOT_LE_CIRCLE)
2303
+ annot13.update()
2304
+
2305
+ for coords, area, perimeter, color in processed_grouped_shapes:
2306
+
2307
+ if len(coords) < 3:
2308
+ continue
2309
+
2310
+ annot14 = page2.add_polyline_annot(points=coords)
2311
+ annot14.set_border(width=0.8)
2312
+ # annot13.set_colors(fill=(1, 0, 0))
2313
+ annot14.set_colors(stroke=(int(color[0])/255,int(color[1])/255,int(color[2])/255))
2314
+ annot14.set_info(content='Perimeter='+str(1)+' m',subject='Perimeter Measurement', title="Skirting Measurement")
2315
+ annot14.set_opacity(0.7)
2316
+ annot14.update()
2317
+
2318
+
2319
+
2320
  page2.set_rotation(rotationOld)
2321
  Correct_img=flip(imgg)
2322