개정판 cd198f3b
Add Shapely-1.6.4.post1-cp36-cp36m-win_amd64.whl
.gitignore | ||
---|---|---|
258 | 258 |
|
259 | 259 |
# Python Tools for Visual Studio (PTVS) |
260 | 260 |
__pycache__/ |
261 |
*.pyc |
|
261 |
*.pyc |
|
262 |
/DTI_PID/DTI_PID/res/lines.svg |
DTI_PID/DTI_PID/XmlGenerator.py | ||
---|---|---|
178 | 178 |
|
179 | 179 |
return tInfoNode |
180 | 180 |
|
181 |
|
|
181 |
''' |
|
182 |
@brief get xml node from linestring |
|
183 |
''' |
|
182 | 184 |
def getImgLineNode(imgLine): |
183 |
sp = imgLine.getStart() |
|
184 |
ep = imgLine.getEnd() |
|
185 |
|
|
186 | 185 |
imgLineNode = Element(IMG_LINE_NODE_NAME) |
187 | 186 |
|
188 | 187 |
ispNode = Element(ISP_NODE_NAME) |
189 |
ispNode.text = str(sp.real)+','+str(sp.imag)
|
|
188 |
ispNode.text = str(imgLine.coords[0][0])+','+str(imgLine.coords[0][1])
|
|
190 | 189 |
|
191 | 190 |
iepNode = Element(IEP_NODE_NAME) |
192 |
iepNode.text = str(ep.real)+','+str(ep.imag)
|
|
191 |
iepNode.text = str(imgLine.coords[1][0])+','+str(imgLine.coords[1][1])
|
|
193 | 192 |
|
194 | 193 |
imgLineNode.append(ispNode) |
195 | 194 |
imgLineNode.append(iepNode) |
DTI_PID/DTI_PID/potrace.py | ||
---|---|---|
54 | 54 |
pathdata = svg.path.parse_path(pathstring) |
55 | 55 |
for segment in pathdata: |
56 | 56 |
if type(segment) is svg.path.Line: |
57 |
imgline = SymbolBase.imgLine(segment.start, segment.end) |
|
58 |
#imgLines.append(imgline.tostring()) |
|
59 |
imgLines.append(imgline) |
|
60 | 57 |
line = LineString([(segment.start.real, segment.start.imag), (segment.end.real, segment.end.imag)]) |
61 | 58 |
imgLines.append(line) |
62 |
#imgLines.append(imgline.tostring()) |
|
63 | 59 |
# up to here |
64 |
return linemerge(imgLines) |
|
65 |
#return imgLines |
|
60 |
return imgLines |
|
66 | 61 |
|
67 |
#if __name__ == '__main__':
|
|
68 |
# execpath = os.path.dirname(os.path.realpath(__file__))
|
|
62 |
if __name__ == '__main__': |
|
63 |
execpath = os.path.dirname(os.path.realpath(__file__)) |
|
69 | 64 |
|
70 |
# imgLines = passpotrace(execpath + '\\res\\UY1-K-2007_P1_300dpi_black.png') |
|
71 |
|
|
72 |
# file = open(execpath + '\\res\\lines.svg', 'w') |
|
73 |
# file.writelines(' '.join(imgLines)) |
|
74 |
# file.close() |
|
75 |
path = sys.argv[1] # 1 argument given is a string for the path of drawing |
|
65 |
path = execpath + '\\res\\UY1-K-2007_P1_300dpi_black.png' |
|
66 |
# path = sys.argv[1] # 1 argument given is a string for the path of drawing |
|
76 | 67 |
imgLines = passpotrace(path) #execpath + '\\res\\UY1-K-2007_P1_300dpi_black.png') |
77 | 68 |
|
78 | 69 |
xmlFilePath = os.path.dirname(path) + '\\' + os.path.basename(path).split('.')[0] + '.xml' |
79 | 70 |
file = open(xmlFilePath, 'w') |
80 |
for multiLine in imgLines: |
|
81 |
#print(str(multiLine)) |
|
82 |
file.write(str(multiLine) + '\n') |
|
71 |
for line in imgLines: |
|
72 |
file.write(str(line) + '\n') |
|
83 | 73 |
file.close() |
내보내기 Unified diff