-
Notifications
You must be signed in to change notification settings - Fork 2
/
tryouts.py
93 lines (85 loc) · 2.41 KB
/
tryouts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import os
import sys, traceback
import json
from qgis.core import *
import qgis.utils
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
paths_to_shapes_array = {
"Cross2" : {"paths" : [
[
[
-0.5,
0.5
],
[
0.5,
-0.5
]
],
[
[
-0.5,
-0.5
],
[
0.5,
0.5
]
]
]},
"Line" : {"paths" : [
[
[
3,
0
],
[
-3,
0
]
]
]
}
}
# Tester: Add a layer with at least 3 categories and symbols with lines
# Change the line symbols cap style to the different options to get the style number
layer = iface.activeLayer()
cat = layer.renderer().categories()
for c in cat:
#print(c.label())
sym = c.symbol()
cnt = sym.symbolLayerCount()
i = 0
while i < cnt:
sl = sym.symbolLayer(i)
try:
#print(sl.properties())
# print(sl.penJoinStyle())
# print(QgsSymbolLayerUtils.encodePenJoinStyle(sl.penJoinStyle()))
# print(sl.penCapStyle())
# print(QgsSymbolLayerUtils.encodePenCapStyle(sl.penCapStyle()))
#print(sl.__class__.__name__)
classType = sl.__class__.__name__
if "Marker" in classType:
print(sl.__class__.__name__)
print("marker number " + str(i))
print(c.label())
print(sl.properties())
print(sl.subSymbol().symbolLayer(0))
marker = sl.subSymbol().symbolLayer(0)
if 'SimpleMarker' in marker.__class__.__name__:
print(marker.properties())
print(marker.prepareMarkerPath(marker.shape()))
print(marker.shape())
print(marker.availableShapes())
new_poly = QPolygonF()
#print(marker.shapeToPolygon(marker.shape(), new_poly))
#shapeToPolygon
#print(marker.layerType())
#print(sl.svgFilePath())
#print(sl.getDataDefinedProperty(21))
except Exception:
print("no cap")
print(traceback.format_exc().splitlines())
i = i+1