@@ -164,8 +164,10 @@ def __init__(self, type_: str, reference_path: str = "#", name: str = ""):
164
164
class Shape (ReferencedObject ):
165
165
""" Shape object. """
166
166
167
- def __init__ (self , type_ : str , reference_path : str = "#" , tooltip : str = None , name : str = "" ):
167
+ def __init__ (self , type_ : str , reference_path : str = "#" , tooltip : str = None , interactive : bool = True ,
168
+ name : str = "" ):
168
169
self .tooltip = tooltip
170
+ self .interactive = interactive
169
171
super ().__init__ (type_ = type_ , reference_path = reference_path , name = name )
170
172
171
173
@@ -459,7 +461,7 @@ class Text(Shape):
459
461
460
462
def __init__ (self , comment : str , position_x : float , position_y : float , text_style : TextStyle = None ,
461
463
text_scaling : bool = None , max_width : float = None , height : float = None , multi_lines : bool = True ,
462
- reference_path : str = "#" , tooltip : str = None , name : str = '' ):
464
+ reference_path : str = "#" , tooltip : str = None , interactive : bool = False , name : str = '' ):
463
465
self .comment = comment
464
466
self .text_style = text_style
465
467
self .position_x = position_x
@@ -468,7 +470,8 @@ def __init__(self, comment: str, position_x: float, position_y: float, text_styl
468
470
self .max_width = max_width
469
471
self .height = height
470
472
self .multi_lines = multi_lines
471
- super ().__init__ (type_ = 'text' , reference_path = reference_path , tooltip = tooltip , name = name )
473
+ super ().__init__ (type_ = 'text' , reference_path = reference_path , tooltip = tooltip , interactive = interactive ,
474
+ name = name )
472
475
473
476
def mpl_plot (self , ax = None , color = 'k' , alpha = 1. , ** kwargs ):
474
477
""" Plots using Matplotlib. """
@@ -491,12 +494,13 @@ class Line2D(Shape):
491
494
"""
492
495
493
496
def __init__ (self , point1 : List [float ], point2 : List [float ], edge_style : EdgeStyle = None ,
494
- reference_path : str = "#" , tooltip : str = None , name : str = '' ):
497
+ reference_path : str = "#" , tooltip : str = None , interactive : bool = True , name : str = '' ):
495
498
self .data = point1 + point2 # Retrocompatibility
496
499
self .point1 = point1
497
500
self .point2 = point2
498
501
self .edge_style = edge_style
499
- super ().__init__ (type_ = 'line2d' , reference_path = reference_path , tooltip = tooltip , name = name )
502
+ super ().__init__ (type_ = 'line2d' , reference_path = reference_path , tooltip = tooltip , interactive = interactive ,
503
+ name = name )
500
504
501
505
def mpl_plot (self , ax = None , edge_style = None , ** kwargs ):
502
506
""" Plots using matplotlib. """
@@ -526,7 +530,7 @@ class LineSegment2D(Shape):
526
530
"""
527
531
528
532
def __init__ (self , point1 : List [float ], point2 : List [float ], edge_style : EdgeStyle = None ,
529
- reference_path : str = "#" , tooltip : str = None , name : str = '' ):
533
+ reference_path : str = "#" , tooltip : str = None , interactive : bool = True , name : str = '' ):
530
534
# Data is used in typescript
531
535
self .data = point1 + point2
532
536
self .point1 = point1
@@ -535,7 +539,8 @@ def __init__(self, point1: List[float], point2: List[float], edge_style: EdgeSty
535
539
if edge_style is None :
536
540
edge_style = EdgeStyle ()
537
541
self .edge_style = edge_style
538
- super ().__init__ (type_ = 'linesegment2d' , reference_path = reference_path , tooltip = tooltip , name = name )
542
+ super ().__init__ (type_ = 'linesegment2d' , reference_path = reference_path , tooltip = tooltip , interactive = interactive ,
543
+ name = name )
539
544
540
545
def bounding_box (self ):
541
546
""" Get 2D bounding box of current LineSegment2D. """
@@ -577,10 +582,11 @@ class Wire(Shape):
577
582
"""
578
583
579
584
def __init__ (self , lines : List [Tuple [float , float ]], edge_style : EdgeStyle = None , tooltip : str = None ,
580
- reference_path : str = "#" , name : str = "" ):
585
+ reference_path : str = "#" , interactive : bool = True , name : str = "" ):
581
586
self .lines = lines
582
587
self .edge_style = edge_style
583
- super ().__init__ (type_ = "wire" , reference_path = reference_path , tooltip = tooltip , name = name )
588
+ super ().__init__ (type_ = "wire" , reference_path = reference_path , tooltip = tooltip , interactive = interactive ,
589
+ name = name )
584
590
585
591
def mpl_plot (self , ax = None , ** kwargs ):
586
592
""" Plots using matplotlib. """
@@ -614,13 +620,15 @@ class Circle2D(Shape):
614
620
"""
615
621
616
622
def __init__ (self , cx : float , cy : float , r : float , edge_style : EdgeStyle = None ,
617
- surface_style : SurfaceStyle = None , tooltip : str = None , reference_path : str = "#" , name : str = '' ):
623
+ surface_style : SurfaceStyle = None , tooltip : str = None , reference_path : str = "#" ,
624
+ interactive : bool = True , name : str = '' ):
618
625
self .edge_style = edge_style
619
626
self .surface_style = surface_style
620
627
self .r = r
621
628
self .cx = cx
622
629
self .cy = cy
623
- super ().__init__ (type_ = 'circle' , reference_path = reference_path , tooltip = tooltip , name = name )
630
+ super ().__init__ (type_ = 'circle' , reference_path = reference_path , tooltip = tooltip , interactive = interactive ,
631
+ name = name )
624
632
625
633
def bounding_box (self ):
626
634
""" Get 2D bounding box of current Circle2D. """
@@ -653,14 +661,16 @@ class Rectangle(Shape):
653
661
""" Class to draw a rectangle. """
654
662
655
663
def __init__ (self , x_coord : float , y_coord : float , width : float , height : float , edge_style : EdgeStyle = None ,
656
- surface_style : SurfaceStyle = None , tooltip : str = None , reference_path : str = "#" , name : str = '' ):
664
+ surface_style : SurfaceStyle = None , tooltip : str = None , reference_path : str = "#" ,
665
+ interactive : bool = True , name : str = '' ):
657
666
self .x_coord = x_coord
658
667
self .y_coord = y_coord
659
668
self .width = width
660
669
self .height = height
661
670
self .surface_style = surface_style
662
671
self .edge_style = edge_style
663
- super ().__init__ (type_ = 'rectangle' , reference_path = reference_path , tooltip = tooltip , name = name )
672
+ super ().__init__ (type_ = 'rectangle' , reference_path = reference_path , tooltip = tooltip , interactive = interactive ,
673
+ name = name )
664
674
665
675
def bounding_box (self ):
666
676
""" Get 2D bounding box of current Circle2D. """
@@ -694,9 +704,9 @@ class RoundRectangle(Rectangle):
694
704
695
705
def __init__ (self , x_coord : float , y_coord : float , width : float , height : float , radius : float = 2 ,
696
706
edge_style : EdgeStyle = None , surface_style : SurfaceStyle = None , tooltip : str = None ,
697
- reference_path : str = "#" , name : str = '' ):
707
+ reference_path : str = "#" , interactive : bool = True , name : str = '' ):
698
708
super ().__init__ (x_coord , y_coord , width , height , edge_style , surface_style , tooltip ,
699
- reference_path = reference_path , name = name )
709
+ reference_path = reference_path , interactive = interactive , name = name )
700
710
self .type_ = "roundrectangle"
701
711
self .radius = radius
702
712
@@ -714,11 +724,12 @@ class Point2D(Shape):
714
724
"""
715
725
716
726
def __init__ (self , cx : float , cy : float , point_style : PointStyle = None , reference_path : str = "#" ,
717
- tooltip : str = None , name : str = '' ):
727
+ tooltip : str = None , interactive : bool = True , name : str = '' ):
718
728
self .cx = cx
719
729
self .cy = cy
720
730
self .point_style = point_style
721
- super ().__init__ (type_ = 'point' , reference_path = reference_path , tooltip = tooltip , name = name )
731
+ super ().__init__ (type_ = 'point' , reference_path = reference_path , tooltip = tooltip ,
732
+ interactive = interactive , name = name )
722
733
723
734
def bounding_box (self ):
724
735
""" Get 2D bounding box of current Circle2D. """
@@ -1145,15 +1156,17 @@ class Arc2D(Shape):
1145
1156
"""
1146
1157
1147
1158
def __init__ (self , cx : float , cy : float , r : float , start_angle : float , end_angle : float , clockwise : bool = None ,
1148
- edge_style : EdgeStyle = None , reference_path : str = "#" , tooltip : str = None , name : str = '' ):
1159
+ edge_style : EdgeStyle = None , reference_path : str = "#" , tooltip : str = None , interactive : bool = True ,
1160
+ name : str = '' ):
1149
1161
self .cx = cx
1150
1162
self .cy = cy
1151
1163
self .r = r
1152
1164
self .start_angle = start_angle
1153
1165
self .end_angle = end_angle
1154
1166
self .clockwise = clockwise
1155
1167
self .edge_style = edge_style
1156
- super ().__init__ (type_ = 'arc' , reference_path = reference_path , tooltip = tooltip , name = name )
1168
+ super ().__init__ (type_ = 'arc' , reference_path = reference_path , tooltip = tooltip , interactive = interactive ,
1169
+ name = name )
1157
1170
1158
1171
def bounding_box (self ):
1159
1172
""" Get 2D bounding box of current Circle2D. """
@@ -1206,12 +1219,14 @@ class Contour2D(Shape):
1206
1219
"""
1207
1220
1208
1221
def __init__ (self , plot_data_primitives : List [Union [Arc2D , LineSegment2D ]], edge_style : EdgeStyle = None ,
1209
- surface_style : SurfaceStyle = None , tooltip : str = None , reference_path : str = "#" , name : str = '' ):
1222
+ surface_style : SurfaceStyle = None , tooltip : str = None , reference_path : str = "#" ,
1223
+ interactive : bool = True , name : str = '' ):
1210
1224
self .plot_data_primitives = plot_data_primitives
1211
1225
self .edge_style = edge_style
1212
1226
self .surface_style = surface_style
1213
1227
self .is_filled = surface_style is not None
1214
- super ().__init__ (type_ = 'contour' , reference_path = reference_path , tooltip = tooltip , name = name )
1228
+ super ().__init__ (type_ = 'contour' , reference_path = reference_path , tooltip = tooltip , interactive = interactive ,
1229
+ name = name )
1215
1230
1216
1231
def bounding_box (self ):
1217
1232
""" Get 2D bounding box of current Contour2D. """
@@ -1264,13 +1279,14 @@ class Label(PlotDataObject):
1264
1279
"""
1265
1280
1266
1281
def __init__ (self , title : str , text_style : TextStyle = None , rectangle_surface_style : SurfaceStyle = None ,
1267
- rectangle_edge_style : EdgeStyle = None , shape : PlotDataObject = None , name : str = '' ):
1282
+ rectangle_edge_style : EdgeStyle = None , shape : PlotDataObject = None , interactive : bool = False ,
1283
+ name : str = '' ):
1268
1284
self .title = title
1269
1285
self .text_style = text_style
1270
1286
self .rectangle_surface_style = rectangle_surface_style
1271
1287
self .rectangle_edge_style = rectangle_edge_style
1272
1288
self .shape = shape
1273
- PlotDataObject .__init__ (self , type_ = 'label' , name = name )
1289
+ PlotDataObject .__init__ (self , type_ = 'label' , interactive = interactive , name = name )
1274
1290
1275
1291
1276
1292
class MultipleLabels (PlotDataObject ):
@@ -1281,9 +1297,9 @@ class MultipleLabels(PlotDataObject):
1281
1297
:type labels: List[Label]
1282
1298
"""
1283
1299
1284
- def __init__ (self , labels : List [Label ], name : str = '' ):
1300
+ def __init__ (self , labels : List [Label ], interactive : bool = False , name : str = '' ):
1285
1301
self .labels = labels
1286
- PlotDataObject .__init__ (self , type_ = 'multiplelabels' , name = name )
1302
+ PlotDataObject .__init__ (self , type_ = 'multiplelabels' , interactive = interactive , name = name )
1287
1303
1288
1304
1289
1305
class PrimitiveGroup (Figure ):
@@ -1301,10 +1317,11 @@ class PrimitiveGroup(Figure):
1301
1317
1302
1318
def __init__ (self , primitives : List [Union [Contour2D , Arc2D , LineSegment2D , Circle2D ,
1303
1319
Line2D , MultipleLabels , Wire , Point2D ]], width : int = 750 ,
1304
- height : int = 400 , attribute_names : List [str ] = None , axis_on : bool = False , name : str = '' ):
1320
+ height : int = 400 , attribute_names : List [str ] = None , axis_on : bool = False , interactive : bool = True ,
1321
+ name : str = '' ):
1305
1322
self .primitives = primitives
1306
1323
self .attribute_names = attribute_names
1307
- super ().__init__ (width = width , height = height , type_ = 'draw' , axis_on = axis_on , name = name )
1324
+ super ().__init__ (width = width , height = height , type_ = 'draw' , axis_on = axis_on , interactive = interactive , name = name )
1308
1325
1309
1326
def mpl_plot (self , ax = None , equal_aspect = True , ** kwargs ):
1310
1327
""" Plots using matplotlib. """
@@ -1363,7 +1380,7 @@ class PrimitiveGroupsContainer(Figure):
1363
1380
def __init__ (self , primitive_groups : List [PrimitiveGroup ], sizes : List [Tuple [float , float ]] = None ,
1364
1381
coords : List [Tuple [float , float ]] = None , associated_elements : List [int ] = None ,
1365
1382
x_variable : str = None , y_variable : str = None , width : int = 750 , height : int = 400 ,
1366
- axis_on : bool = True , name : str = '' ):
1383
+ axis_on : bool = True , interactive : bool = True , name : str = '' ):
1367
1384
for i , value in enumerate (primitive_groups ):
1368
1385
if not isinstance (value , PrimitiveGroup ):
1369
1386
primitive_groups [i ] = PrimitiveGroup (primitives = value )
@@ -1381,7 +1398,8 @@ def __init__(self, primitive_groups: List[PrimitiveGroup], sizes: List[Tuple[flo
1381
1398
if y_variable :
1382
1399
attribute_names .append (y_variable )
1383
1400
self .association ['attribute_names' ] = attribute_names
1384
- super ().__init__ (width = width , height = height , type_ = 'primitivegroupcontainer' , axis_on = axis_on , name = name )
1401
+ super ().__init__ (width = width , height = height , type_ = 'primitivegroupcontainer' , axis_on = axis_on ,
1402
+ interactive = interactive , name = name )
1385
1403
1386
1404
1387
1405
class ParallelPlot (Figure ):
0 commit comments