| 55 | ] |
| 56 | |
| 57 | def __init__(self, location=None, layout="horizontal", **kwargs): |
| 58 | super().__init__() |
| 59 | for key in ("width", "height", "left", "top", "position"): |
| 60 | assert key not in kwargs, f"Argument {key} cannot be used with DualMap." |
| 61 | if layout not in ("horizontal", "vertical"): |
| 62 | raise ValueError( |
| 63 | f"Undefined option for argument `layout`: {layout}. " |
| 64 | "Use either 'horizontal' or 'vertical'." |
| 65 | ) |
| 66 | width = "50%" if layout == "horizontal" else "100%" |
| 67 | height = "100%" if layout == "horizontal" else "50%" |
| 68 | self.m1 = Map( |
| 69 | location=location, |
| 70 | width=width, |
| 71 | height=height, |
| 72 | left="0%", |
| 73 | top="0%", |
| 74 | position="absolute", |
| 75 | **kwargs, |
| 76 | ) |
| 77 | self.m2 = Map( |
| 78 | location=location, |
| 79 | width=width, |
| 80 | height=height, |
| 81 | left="50%" if layout == "horizontal" else "0%", |
| 82 | top="0%" if layout == "horizontal" else "50%", |
| 83 | position="absolute", |
| 84 | **kwargs, |
| 85 | ) |
| 86 | figure = Figure() |
| 87 | figure.add_child(self.m1) |
| 88 | figure.add_child(self.m2) |
| 89 | # Important: add self to Figure last. |
| 90 | figure.add_child(self) |
| 91 | self.children_for_m2 = [] |
| 92 | self.children_for_m2_copied = [] # list with ids |
| 93 | |
| 94 | def _repr_html_(self, **kwargs): |
| 95 | """Displays the HTML Map in a Jupyter notebook.""" |