start using dataclasses in some places
This commit is contained in:
parent
2d4d66b6ef
commit
feacd20803
1 changed files with 9 additions and 12 deletions
|
@ -1,5 +1,6 @@
|
||||||
import math
|
import math
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
|
from dataclasses import dataclass
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from shapely.geometry import JOIN_STYLE, box
|
from shapely.geometry import JOIN_STYLE, box
|
||||||
|
@ -7,22 +8,18 @@ from shapely.geometry import JOIN_STYLE, box
|
||||||
from c3nav.mapdata.utils.color import color_to_rgb
|
from c3nav.mapdata.utils.color import color_to_rgb
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True)
|
||||||
class FillAttribs:
|
class FillAttribs:
|
||||||
__slots__ = ('color', 'opacity')
|
color: str
|
||||||
|
opacity: float | None = None
|
||||||
def __init__(self, color, opacity=None):
|
|
||||||
self.color = color
|
|
||||||
self.opacity = opacity
|
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(slots=True)
|
||||||
class StrokeAttribs:
|
class StrokeAttribs:
|
||||||
__slots__ = ('color', 'width', 'min_px', 'opacity')
|
color: str
|
||||||
|
width: float
|
||||||
def __init__(self, color, width, min_px=None, opacity=None):
|
min_px: float | None = None
|
||||||
self.color = color
|
opacity: float | None = None
|
||||||
self.width = width
|
|
||||||
self.min_px = min_px
|
|
||||||
self.opacity = opacity
|
|
||||||
|
|
||||||
|
|
||||||
class RenderEngine(ABC):
|
class RenderEngine(ABC):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue