# Path: src/compat2qgis.py
# def getCanvasDestinationCrs(iface):
#     def __init__(self, src_crs, dst_crs):
#     def setDestinationCrs(self, dst_crs):
# def getOpenFileName(parent, caption, filedir, search_filter):
#     def __init__(self, id, type):
#     def fromEpsgId(id):
# class QgsCoordinateTransform(core.QgsCoordinateTransform):
# class QgsCoordinateReferenceSystem(core.QgsCoordinateReferenceSystem):


from qgis.PyQt.QtGui import QColor
from qgis.gui import QgsRubberBand
from qgis.core import QgsRectangle
from qgis.utils import iface
from .compat2qgis import QGisGeometryType, getCanvasDestinationCrs, QgsCoordinateTransform, QgsCoordinateReferenceSystem

class RubberBandResultRenderer():

    def __init__(self):
        self.iface = iface

        self.srs_wgs84 = QgsCoordinateReferenceSystem.fromEpsgId(4326)
        self.transform_decorator = QgsCoordinateTransform(self.srs_wgs84, self.srs_wgs84)

        self.rb = QgsRubberBand(self.iface.mapCanvas(), QGisGeometryType.Point)
        self.rb.setColor(QColor('magenta'))
        self.rb.setIconSize(12)

        self.features_rb = QgsRubberBand(self.iface.mapCanvas(), QGisGeometryType.Point)
        magenta_transp = QColor('#3388ff')
        magenta_transp.setAlpha(120)
        self.features_rb.setColor(magenta_transp)
        self.features_rb.setIconSize(12)
        self.features_rb.setWidth(2)

    def show_point(self, point, center=False):
        #check srs
        if self.need_transform():
            point = self.transform_point(point)

        self.rb.addPoint(point)
        if center:
            self.center_to_point(point)

    def clear(self):

# Path: src/compat2qgis.py
# def getCanvasDestinationCrs(iface):
#     def __init__(self, src_crs, dst_crs):
#     def setDestinationCrs(self, dst_crs):
# def getOpenFileName(parent, caption, filedir, search_filter):
#     def __init__(self, id, type):
#     def fromEpsgId(id):
# class QgsCoordinateTransform(core.QgsCoordinateTransform):
# class QgsCoordinateReferenceSystem(core.QgsCoordinateReferenceSystem):


# Path: src/rb_result_renderer.py
from qgis.PyQt.QtGui import QColor
from qgis.gui import QgsRubberBand
from qgis.core import QgsRectangle
from qgis.utils import iface
from .compat2qgis import QGisGeometryType, getCanvasDestinationCrs, QgsCoordinateTransform, QgsCoordinateReferenceSystem


class RubberBandResultRenderer():

    def __init__(self):
        self.iface = iface

        self.srs_wgs84 = QgsCoordinateReferenceSystem.fromEpsgId(4326)
        self.transform_decorator = QgsCoordinateTransform(self.srs_wgs84, self.srs_wgs84)

        self.rb = QgsRubberBand(self.iface.mapCanvas(), QGisGeometryType.Point)
        self.rb.setColor(QColor('magenta'))
        self.rb.setIconSize(12)

        self.features_rb = QgsRubberBand(self.iface.mapCanvas(), QGisGeometryType.Point)
        magenta_transp = QColor('#3388ff')
        magenta_transp.setAlpha(120)
        self.features_rb.setColor(magenta_transp)
        self.features_rb.setIconSize(12)
        self.features_rb.setWidth(2)

    def show_point(self, point, center=False):
        #check srs
        if self.need_transform():
            point = self.transform_point(point)

        self.rb.addPoint(point)
        if center:
            self.center_to_point(point)

    def clear(self):

        self.rb.reset(QGisGeometryType.Point)