Skip to content

Commit 072f200

Browse files
committed
variable zstack options
1 parent 50cbead commit 072f200

File tree

12 files changed

+51
-28
lines changed

12 files changed

+51
-28
lines changed

src/compas/artists/primitiveartist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class PrimitiveArtist(Artist):
3333
default_color = (0, 0, 0)
3434

3535
def __init__(self, primitive, color=None, **kwargs):
36-
super(PrimitiveArtist, self).__init__(**kwargs)
36+
super(PrimitiveArtist, self).__init__()
3737
self._primitive = None
3838
self._color = None
3939
self.primitive = primitive

src/compas_plotters/artists/circleartist.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
class CircleArtist(PlotterArtist, PrimitiveArtist):
1616
"""Artist for COMPAS circles."""
1717

18-
zorder: int = 1000
19-
2018
def __init__(self,
2119
circle: Circle,
2220
linewidth: float = 1.0,
@@ -25,6 +23,7 @@ def __init__(self,
2523
edgecolor: Color = (0, 0, 0),
2624
fill: bool = True,
2725
alpha: float = 1.0,
26+
zorder: int = 1000,
2827
**kwargs: Any):
2928

3029
super().__init__(primitive=circle, **kwargs)
@@ -36,6 +35,7 @@ def __init__(self,
3635
self.edgecolor = edgecolor
3736
self.fill = fill
3837
self.alpha = alpha
38+
self.zorder = zorder
3939

4040
@property
4141
def circle(self):

src/compas_plotters/artists/ellipseartist.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
class EllipseArtist(PlotterArtist, PrimitiveArtist):
1616
"""Artist for COMPAS ellipses."""
1717

18-
zorder: int = 1000
19-
2018
def __init__(self,
2119
ellipse: Ellipse,
2220
linewidth: float = 1.0,
@@ -25,6 +23,7 @@ def __init__(self,
2523
edgecolor: Color = (0, 0, 0),
2624
fill: bool = True,
2725
alpha: float = 1.0,
26+
zorder: int = 1000,
2827
**kwargs: Any):
2928

3029
super().__init__(primitive=ellipse, **kwargs)
@@ -36,6 +35,7 @@ def __init__(self,
3635
self.edgecolor = edgecolor
3736
self.fill = fill
3837
self.alpha = alpha
38+
self.zorder = zorder
3939

4040
@property
4141
def ellipse(self):

src/compas_plotters/artists/lineartist.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@
1616
class LineArtist(PlotterArtist, PrimitiveArtist):
1717
"""Artist for COMPAS lines."""
1818

19-
zorder: int = 1000
20-
2119
def __init__(self,
2220
line: Line,
2321
draw_points: bool = False,
2422
draw_as_segment: bool = False,
2523
linewidth: float = 1.0,
2624
linestyle: Literal['solid', 'dotted', 'dashed', 'dashdot'] = 'solid',
2725
color: Color = (0, 0, 0),
26+
zorder: int = 1000,
2827
**kwargs: Any):
2928

3029
super().__init__(primitive=line, **kwargs)
@@ -38,6 +37,7 @@ def __init__(self,
3837
self.linewidth = linewidth
3938
self.linestyle = linestyle
4039
self.color = color
40+
self.zorder = zorder
4141

4242
@property
4343
def line(self):

src/compas_plotters/artists/meshartist.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ class MeshArtist(PlotterArtist, MeshArtist):
5959
zorder_faces : int
6060
"""
6161

62-
zorder_faces: int = 1000
63-
zorder_edges: int = 2000
64-
zorder_vertices: int = 3000
65-
6662
def __init__(self,
6763
mesh: Mesh,
6864
vertices: Optional[List[int]] = None,
@@ -77,6 +73,7 @@ def __init__(self,
7773
show_faces: bool = True,
7874
vertexsize: int = 5,
7975
sizepolicy: Literal['relative', 'absolute'] = 'relative',
76+
zorder: int = 1000,
8077
**kwargs: Any):
8178

8279
super().__init__(mesh=mesh, **kwargs)
@@ -94,6 +91,7 @@ def __init__(self,
9491
self.show_vertices = show_vertices
9592
self.show_edges = show_edges
9693
self.show_faces = show_faces
94+
self.zorder = zorder
9795

9896
@property
9997
def vertex_size(self):
@@ -111,6 +109,18 @@ def vertex_size(self, vertexsize):
111109
elif isinstance(vertexsize, (int, float)):
112110
self._vertex_size = {vertex: vertexsize / factor for vertex in self.mesh.vertices()}
113111

112+
@property
113+
def zorder_faces(self):
114+
return self.zorder + 10
115+
116+
@property
117+
def zorder_edges(self):
118+
return self.zorder + 20
119+
120+
@property
121+
def zorder_vertices(self):
122+
return self.zorder + 30
123+
114124
@property
115125
def item(self):
116126
"""Mesh: Alias for ``~MeshArtist.mesh``"""

src/compas_plotters/artists/networkartist.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ class NetworkArtist(PlotterArtist):
5353
zorder_edges : int
5454
"""
5555

56-
zorder_edges: int = 2000
57-
zorder_nodes: int = 3000
58-
5956
def __init__(self,
6057
network: Network,
6158
nodes: Optional[List[int]] = None,
@@ -67,6 +64,7 @@ def __init__(self,
6764
show_edges: bool = True,
6865
nodesize: int = 5,
6966
sizepolicy: Literal['relative', 'absolute'] = 'relative',
67+
zorder: int = 2000,
7068
**kwargs):
7169

7270
super().__init__(network=network, **kwargs)
@@ -79,8 +77,16 @@ def __init__(self,
7977
self.edge_width = edgewidth
8078
self.show_nodes = show_nodes
8179
self.show_edges = show_edges
82-
8380
self.sizepolicy = sizepolicy
81+
self.zorder = zorder
82+
83+
@property
84+
def zorder_edges(self):
85+
return self.zorder
86+
87+
@property
88+
def zorder_nodes(self):
89+
return self.zorder + 10
8490

8591
@property
8692
def item(self):

src/compas_plotters/artists/pointartist.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
class PointArtist(PlotterArtist, PrimitiveArtist):
1616
"""Artist for COMPAS points."""
1717

18-
zorder: int = 9000
19-
2018
def __init__(self,
2119
point: Point,
2220
size: int = 5,
2321
facecolor: Color = (1.0, 1.0, 1.0),
2422
edgecolor: Color = (0, 0, 0),
23+
zorder: int = 9000,
2524
**kwargs: Any):
2625

2726
super().__init__(primitive=point, **kwargs)
@@ -31,6 +30,7 @@ def __init__(self,
3130
self.size = size
3231
self.facecolor = facecolor
3332
self.edgecolor = edgecolor
33+
self.zorder = zorder
3434

3535
@property
3636
def point(self):

src/compas_plotters/artists/polygonartist.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
class PolygonArtist(PlotterArtist, PrimitiveArtist):
1616
"""Artist for COMPAS polygons."""
1717

18-
zorder: int = 1000
19-
2018
def __init__(self,
2119
polygon: Polygon,
2220
linewidth: float = 1.0,
@@ -25,6 +23,7 @@ def __init__(self,
2523
edgecolor: Color = (0, 0, 0),
2624
fill: bool = True,
2725
alpha: float = 1.0,
26+
zorder: int = 1000,
2827
**kwargs: Any):
2928

3029
super().__init__(primitive=polygon, **kwargs)
@@ -36,6 +35,7 @@ def __init__(self,
3635
self.edgecolor = edgecolor
3736
self.fill = fill
3837
self.alpha = alpha
38+
self.zorder = zorder
3939

4040
@property
4141
def polygon(self):

src/compas_plotters/artists/polylineartist.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@
1515
class PolylineArtist(PlotterArtist, PrimitiveArtist):
1616
"""Artist for COMPAS polylines."""
1717

18-
zorder: int = 1000
19-
2018
def __init__(self,
2119
polyline: Polyline,
2220
draw_points: bool = True,
2321
linewidth: float = 1.0,
2422
linestyle: Literal['solid', 'dotted', 'dashed', 'dashdot'] = 'solid',
2523
color: Color = (0, 0, 0),
24+
zorder: int = 1000,
2625
**kwargs: Any):
2726

2827
super().__init__(primitive=polyline, **kwargs)
@@ -33,6 +32,7 @@ def __init__(self,
3332
self.linewidth = linewidth
3433
self.linestyle = linestyle
3534
self.color = color
35+
self.zorder = zorder
3636

3737
@property
3838
def polyline(self):

src/compas_plotters/artists/segmentartist.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@
1515
class SegmentArtist(PlotterArtist, PrimitiveArtist):
1616
"""Artist for drawing COMPAS lines as segments."""
1717

18-
zorder: int = 2000
19-
2018
def __init__(self,
2119
line: Line,
2220
draw_points: bool = False,
2321
linewidth: float = 2.0,
2422
linestyle: Literal['solid', 'dotted', 'dashed', 'dashdot'] = 'solid',
2523
color: Color = (0.0, 0.0, 0.0),
24+
zorder: int = 2000,
2625
**kwargs: Any):
2726

2827
super().__init__(primitive=line, **kwargs)
@@ -34,6 +33,7 @@ def __init__(self,
3433
self.linestyle = linestyle
3534
self.linewidth = linewidth
3635
self.color = color
36+
self.zorder = zorder
3737

3838
@property
3939
def line(self):

0 commit comments

Comments
 (0)