"""
Dieses Skript enthält die Einstellungen von Matplotlib-Canvas und wird in das Hauptskript importiert.
"""

import sys
import matplotlib
matplotlib.use('Qt5Agg')
from Classes import Verschneidung, Werkzeug
import json
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg, NavigationToolbar2QT as NavigationToolbar
from matplotlib.figure import Figure


class MplCanvas(FigureCanvasQTAgg):

    def __init__(self, parent=None, width: int = 5, height: int = 4, dpi:int = 100) -> None:
        """Create a Canvas for a plot with three dimensions"""
        fig = Figure(figsize=(width, height), dpi=dpi)
        # 2D Plot:
        # self.axes = fig.add_subplot(111)

        # 3D Plot:
        #self.axes = fig.add_subplot(projection="3d")
        self.axes = fig.add_subplot(projection="3d", proj_type='ortho')
        self.axes.use_sticky_edges = False
        self.axes.margins(x=1, y=1, z=1)
        super(MplCanvas, self).__init__(fig)

class TwoDim_MplCanvas(FigureCanvasQTAgg):

    def __init__(self, parent=None, width: int = 5, height: int = 4, dpi:int = 100) -> None:
        """Create a Canvas for a plot with two dimensions"""
        fig = Figure(figsize=(width, height), dpi=dpi)
        # 2D Plot:
        self.axes = fig.add_subplot(111)

        super().__init__(fig)

class Polar_MplCanvas(FigureCanvasQTAgg):

    def __init__(self, parent = None, width: int = 5, height: int = 4, dpi:int = 100) -> None:
        """Create a Canvas for a plot with polar coordinates"""
        fig = Figure(figsize=(width, height), dpi=dpi)

        #Polar Plot:
        self.axes = fig.add_subplot(projection="polar")

        super().__init__(fig)