Koordinatengitter eingefügt, Rahmenbreiten einheitlich auf 0,5mm gesetzt
This commit is contained in:
@@ -28,6 +28,9 @@ QgsCoordinateTransform: Type[Any]
|
||||
QgsCoordinateReferenceSystem: Type[Any]
|
||||
QgsPrintLayout: Type[Any]
|
||||
QgsLayoutItemMap: Type[Any]
|
||||
QgsLayoutItemMapGrid: Type[Any]
|
||||
QgsTextFormat: Type[Any]
|
||||
QgsTextBackgroundSettings: Type[Any]
|
||||
QgsLayoutItemLabel: Type[Any]
|
||||
QgsLayoutItemLegend: Type[Any]
|
||||
QgsLayoutPoint: Type[Any]
|
||||
@@ -35,6 +38,25 @@ QgsLayoutSize: Type[Any]
|
||||
QgsUnitTypes: Type[Any]
|
||||
QgsLayoutItem: Type[Any]
|
||||
|
||||
MAP_GRID_STYLE_MARKERS: Any = None
|
||||
MAP_GRID_STYLE_FRAME_ANNOTATIONS: Any = None
|
||||
MAP_GRID_FRAME_STYLE_INTERIOR_TICKS: Any = None
|
||||
MAP_GRID_UNIT_MAP_UNIT: Any = None
|
||||
MAP_GRID_ANNOTATION_FORMAT_DECIMAL: Any = None
|
||||
MAP_GRID_ANNOTATION_DISPLAY_HIDE_ALL: Any = None
|
||||
MAP_GRID_ANNOTATION_DISPLAY_SHOW_ALL: Any = None
|
||||
MAP_GRID_ANNOTATION_DISPLAY_SHOW_X: Any = None
|
||||
MAP_GRID_ANNOTATION_DISPLAY_SHOW_Y: Any = None
|
||||
MAP_GRID_BORDER_LEFT: Any = None
|
||||
MAP_GRID_BORDER_RIGHT: Any = None
|
||||
MAP_GRID_BORDER_TOP: Any = None
|
||||
MAP_GRID_BORDER_BOTTOM: Any = None
|
||||
MAP_GRID_ANNOTATION_POSITION_INSIDE_FRAME: Any = None
|
||||
TEXT_BACKGROUND_SHAPE_RECTANGLE: Any = None
|
||||
TEXT_BACKGROUND_SIZE_BUFFER: Any = None
|
||||
TEXT_RENDER_UNIT_MILLIMETERS: Any = None
|
||||
TEXT_RENDER_UNIT_POINTS: Any = None
|
||||
|
||||
QGIS_AVAILABLE = False
|
||||
|
||||
# ---------------------------------------------------------
|
||||
@@ -58,6 +80,9 @@ try:
|
||||
QgsCoordinateReferenceSystem as _QgsCoordinateReferenceSystem,
|
||||
QgsPrintLayout as _QgsPrintLayout,
|
||||
QgsLayoutItemMap as _QgsLayoutItemMap,
|
||||
QgsLayoutItemMapGrid as _QgsLayoutItemMapGrid,
|
||||
QgsTextFormat as _QgsTextFormat,
|
||||
QgsTextBackgroundSettings as _QgsTextBackgroundSettings,
|
||||
QgsLayoutItemLabel as _QgsLayoutItemLabel,
|
||||
QgsLayoutItemLegend as _QgsLayoutItemLegend,
|
||||
QgsLayoutPoint as _QgsLayoutPoint,
|
||||
@@ -81,6 +106,9 @@ try:
|
||||
QgsCoordinateReferenceSystem = _QgsCoordinateReferenceSystem
|
||||
QgsPrintLayout = _QgsPrintLayout
|
||||
QgsLayoutItemMap = _QgsLayoutItemMap
|
||||
QgsLayoutItemMapGrid = _QgsLayoutItemMapGrid
|
||||
QgsTextFormat = _QgsTextFormat
|
||||
QgsTextBackgroundSettings = _QgsTextBackgroundSettings
|
||||
QgsLayoutItemLabel = _QgsLayoutItemLabel
|
||||
QgsLayoutItemLegend = _QgsLayoutItemLegend
|
||||
QgsLayoutPoint = _QgsLayoutPoint
|
||||
@@ -88,6 +116,98 @@ try:
|
||||
QgsUnitTypes = _QgsUnitTypes
|
||||
QgsLayoutItem = _QgsLayoutItem
|
||||
|
||||
def _resolve_qgis_enum(*paths: tuple[Any, ...]) -> Any:
|
||||
for path in paths:
|
||||
value: Any = path[0]
|
||||
ok = True
|
||||
for name in path[1:]:
|
||||
value = getattr(value, name, None)
|
||||
if value is None:
|
||||
ok = False
|
||||
break
|
||||
if ok:
|
||||
return value
|
||||
return None
|
||||
|
||||
MAP_GRID_STYLE_MARKERS = _resolve_qgis_enum(
|
||||
(_Qgis, "MapGridStyle", "Markers"),
|
||||
(_QgsLayoutItemMapGrid, "Markers"),
|
||||
)
|
||||
MAP_GRID_STYLE_FRAME_ANNOTATIONS = _resolve_qgis_enum(
|
||||
(_Qgis, "MapGridStyle", "FrameAndAnnotationsOnly"),
|
||||
(_QgsLayoutItemMapGrid, "FrameAndAnnotationsOnly"),
|
||||
(_Qgis, "MapGridStyle", "FrameAnnotations"),
|
||||
(_QgsLayoutItemMapGrid, "FrameAnnotations"),
|
||||
)
|
||||
MAP_GRID_FRAME_STYLE_INTERIOR_TICKS = _resolve_qgis_enum(
|
||||
(_Qgis, "MapGridFrameStyle", "InteriorTicks"),
|
||||
(_QgsLayoutItemMapGrid, "InteriorTicks"),
|
||||
)
|
||||
MAP_GRID_UNIT_MAP_UNIT = _resolve_qgis_enum(
|
||||
(_Qgis, "MapGridUnit", "MapUnits"),
|
||||
(_QgsLayoutItemMapGrid, "MapUnits"),
|
||||
(_Qgis, "MapGridUnit", "MapUnit"),
|
||||
(_QgsLayoutItemMapGrid, "MapUnit"),
|
||||
)
|
||||
MAP_GRID_ANNOTATION_FORMAT_DECIMAL = _resolve_qgis_enum(
|
||||
(_Qgis, "MapGridAnnotationFormat", "Decimal"),
|
||||
(_QgsLayoutItemMapGrid, "Decimal"),
|
||||
)
|
||||
MAP_GRID_ANNOTATION_DISPLAY_HIDE_ALL = _resolve_qgis_enum(
|
||||
(_Qgis, "MapGridComponentVisibility", "HideAll"),
|
||||
(_QgsLayoutItemMapGrid, "HideAll"),
|
||||
)
|
||||
MAP_GRID_ANNOTATION_DISPLAY_SHOW_ALL = _resolve_qgis_enum(
|
||||
(_Qgis, "MapGridComponentVisibility", "ShowAll"),
|
||||
(_QgsLayoutItemMapGrid, "ShowAll"),
|
||||
)
|
||||
MAP_GRID_ANNOTATION_DISPLAY_SHOW_X = _resolve_qgis_enum(
|
||||
(_Qgis, "MapGridComponentVisibility", "LongitudeOnly"),
|
||||
(_QgsLayoutItemMapGrid, "LongitudeOnly"),
|
||||
(_Qgis, "MapGridComponentVisibility", "ShowLongitudeOnly"),
|
||||
(_QgsLayoutItemMapGrid, "ShowLongitudeOnly"),
|
||||
)
|
||||
MAP_GRID_ANNOTATION_DISPLAY_SHOW_Y = _resolve_qgis_enum(
|
||||
(_Qgis, "MapGridComponentVisibility", "LatitudeOnly"),
|
||||
(_QgsLayoutItemMapGrid, "LatitudeOnly"),
|
||||
(_Qgis, "MapGridComponentVisibility", "ShowLatitudeOnly"),
|
||||
(_QgsLayoutItemMapGrid, "ShowLatitudeOnly"),
|
||||
)
|
||||
MAP_GRID_BORDER_LEFT = _resolve_qgis_enum(
|
||||
(_Qgis, "MapGridBorderSide", "Left"),
|
||||
(_QgsLayoutItemMapGrid, "Left"),
|
||||
)
|
||||
MAP_GRID_BORDER_RIGHT = _resolve_qgis_enum(
|
||||
(_Qgis, "MapGridBorderSide", "Right"),
|
||||
(_QgsLayoutItemMapGrid, "Right"),
|
||||
)
|
||||
MAP_GRID_BORDER_TOP = _resolve_qgis_enum(
|
||||
(_Qgis, "MapGridBorderSide", "Top"),
|
||||
(_QgsLayoutItemMapGrid, "Top"),
|
||||
)
|
||||
MAP_GRID_BORDER_BOTTOM = _resolve_qgis_enum(
|
||||
(_Qgis, "MapGridBorderSide", "Bottom"),
|
||||
(_QgsLayoutItemMapGrid, "Bottom"),
|
||||
)
|
||||
MAP_GRID_ANNOTATION_POSITION_INSIDE_FRAME = _resolve_qgis_enum(
|
||||
(_Qgis, "MapGridAnnotationPosition", "InsideMapFrame"),
|
||||
(_QgsLayoutItemMapGrid, "InsideMapFrame"),
|
||||
)
|
||||
TEXT_BACKGROUND_SHAPE_RECTANGLE = _resolve_qgis_enum(
|
||||
(_QgsTextBackgroundSettings, "ShapeRectangle"),
|
||||
)
|
||||
TEXT_BACKGROUND_SIZE_BUFFER = _resolve_qgis_enum(
|
||||
(_QgsTextBackgroundSettings, "SizeBuffer"),
|
||||
)
|
||||
TEXT_RENDER_UNIT_MILLIMETERS = _resolve_qgis_enum(
|
||||
(_Qgis, "RenderUnit", "Millimeters"),
|
||||
(_QgsUnitTypes, "RenderMillimeters"),
|
||||
)
|
||||
TEXT_RENDER_UNIT_POINTS = _resolve_qgis_enum(
|
||||
(_Qgis, "RenderUnit", "Points"),
|
||||
(_QgsUnitTypes, "RenderPoints"),
|
||||
)
|
||||
|
||||
QGIS_AVAILABLE = True
|
||||
|
||||
# ---------------------------------------------------------
|
||||
@@ -208,6 +328,7 @@ except Exception:
|
||||
self.follow_visibility_preset = False
|
||||
self.follow_visibility_preset_name = ""
|
||||
self.keep_layer_set = False
|
||||
self._grids = _MockQgsLayoutItemMapGridStack(self)
|
||||
|
||||
def setId(self, item_id: str) -> None:
|
||||
self.item_id = item_id
|
||||
@@ -233,6 +354,154 @@ except Exception:
|
||||
def setKeepLayerSet(self, enabled: bool) -> None:
|
||||
self.keep_layer_set = enabled
|
||||
|
||||
def grids(self):
|
||||
return self._grids
|
||||
|
||||
def updateBoundingRect(self) -> None:
|
||||
pass
|
||||
|
||||
def refresh(self) -> None:
|
||||
pass
|
||||
|
||||
class _MockQgsLayoutItemMapGrid:
|
||||
Markers = "Markers"
|
||||
FrameAndAnnotationsOnly = "FrameAndAnnotationsOnly"
|
||||
InteriorTicks = "InteriorTicks"
|
||||
MapUnits = "MapUnits"
|
||||
Decimal = "Decimal"
|
||||
HideAll = "HideAll"
|
||||
ShowAll = "ShowAll"
|
||||
LongitudeOnly = "LongitudeOnly"
|
||||
LatitudeOnly = "LatitudeOnly"
|
||||
Left = "Left"
|
||||
Right = "Right"
|
||||
Top = "Top"
|
||||
Bottom = "Bottom"
|
||||
InsideMapFrame = "InsideMapFrame"
|
||||
|
||||
def __init__(self, name: str, map_item: Any):
|
||||
self.name = name
|
||||
self.map_item = map_item
|
||||
self.enabled = False
|
||||
self.style = None
|
||||
self.units = None
|
||||
self.interval_x = None
|
||||
self.interval_y = None
|
||||
self.annotation_enabled = False
|
||||
self.annotation_format = None
|
||||
self.annotation_precision = None
|
||||
self.annotation_display: dict[Any, Any] = {}
|
||||
self.annotation_position: dict[Any, Any] = {}
|
||||
self.frame_style = None
|
||||
self.annotation_text_format = None
|
||||
|
||||
def setEnabled(self, enabled: bool) -> None:
|
||||
self.enabled = enabled
|
||||
|
||||
def setStyle(self, style: Any) -> None:
|
||||
self.style = style
|
||||
|
||||
def setUnits(self, units: Any) -> None:
|
||||
self.units = units
|
||||
|
||||
def setIntervalX(self, interval: float) -> None:
|
||||
self.interval_x = interval
|
||||
|
||||
def setIntervalY(self, interval: float) -> None:
|
||||
self.interval_y = interval
|
||||
|
||||
def setAnnotationEnabled(self, enabled: bool) -> None:
|
||||
self.annotation_enabled = enabled
|
||||
|
||||
def setAnnotationFormat(self, annotation_format: Any) -> None:
|
||||
self.annotation_format = annotation_format
|
||||
|
||||
def setAnnotationPrecision(self, precision: int) -> None:
|
||||
self.annotation_precision = precision
|
||||
|
||||
def setAnnotationDisplay(self, display: Any, border: Any) -> None:
|
||||
self.annotation_display[border] = display
|
||||
|
||||
def setAnnotationPosition(self, position: Any, border: Any) -> None:
|
||||
self.annotation_position[border] = position
|
||||
|
||||
def setFrameStyle(self, frame_style: Any) -> None:
|
||||
self.frame_style = frame_style
|
||||
|
||||
def setAnnotationTextFormat(self, annotation_text_format: Any) -> None:
|
||||
self.annotation_text_format = annotation_text_format
|
||||
|
||||
class _MockQgsTextBackgroundSettings:
|
||||
ShapeRectangle = "ShapeRectangle"
|
||||
SizeBuffer = "SizeBuffer"
|
||||
|
||||
def __init__(self):
|
||||
self.enabled = False
|
||||
self.shape_type = None
|
||||
self.size_type = None
|
||||
self.size = None
|
||||
self.size_unit = None
|
||||
self.offset = None
|
||||
self.offset_unit = None
|
||||
self.fill_color = None
|
||||
|
||||
def setEnabled(self, enabled: bool) -> None:
|
||||
self.enabled = enabled
|
||||
|
||||
def setType(self, shape_type: Any) -> None:
|
||||
self.shape_type = shape_type
|
||||
|
||||
def setSizeType(self, size_type: Any) -> None:
|
||||
self.size_type = size_type
|
||||
|
||||
def setSize(self, size: Any) -> None:
|
||||
self.size = size
|
||||
|
||||
def setSizeUnit(self, unit: Any) -> None:
|
||||
self.size_unit = unit
|
||||
|
||||
def setOffset(self, offset: Any) -> None:
|
||||
self.offset = offset
|
||||
|
||||
def setOffsetUnit(self, unit: Any) -> None:
|
||||
self.offset_unit = unit
|
||||
|
||||
def setFillColor(self, color: Any) -> None:
|
||||
self.fill_color = color
|
||||
|
||||
class _MockQgsTextFormat:
|
||||
def __init__(self):
|
||||
self.font = None
|
||||
self.size = None
|
||||
self.size_unit = None
|
||||
self.background = None
|
||||
|
||||
def setFont(self, font: Any) -> None:
|
||||
self.font = font
|
||||
|
||||
def setSize(self, size: float) -> None:
|
||||
self.size = size
|
||||
|
||||
def setSizeUnit(self, unit: Any) -> None:
|
||||
self.size_unit = unit
|
||||
|
||||
def setBackground(self, background: Any) -> None:
|
||||
self.background = background
|
||||
|
||||
class _MockQgsLayoutItemMapGridStack:
|
||||
def __init__(self, map_item: Any):
|
||||
self.map_item = map_item
|
||||
self._grids: list[_MockQgsLayoutItemMapGrid] = []
|
||||
|
||||
def addGrid(self, grid: Any) -> None:
|
||||
self._grids.append(grid)
|
||||
|
||||
def removeGrid(self, grid_id: str) -> None:
|
||||
self._grids = [grid for grid in self._grids if getattr(grid, "name", "") != grid_id]
|
||||
|
||||
def asList(self) -> list[Any]:
|
||||
return list(self._grids)
|
||||
|
||||
class _MockQgsLayoutItemLabel:
|
||||
ModeHtml = 1
|
||||
|
||||
@@ -338,6 +607,9 @@ except Exception:
|
||||
|
||||
QgsPrintLayout = _MockQgsPrintLayout
|
||||
QgsLayoutItemMap = _MockQgsLayoutItemMap
|
||||
QgsLayoutItemMapGrid = _MockQgsLayoutItemMapGrid
|
||||
QgsTextFormat = _MockQgsTextFormat
|
||||
QgsTextBackgroundSettings = _MockQgsTextBackgroundSettings
|
||||
QgsLayoutItemLabel = _MockQgsLayoutItemLabel
|
||||
QgsLayoutItemLegend = _MockQgsLayoutItemLegend
|
||||
QgsLayoutPoint = _MockQgsLayoutPoint
|
||||
@@ -345,6 +617,25 @@ except Exception:
|
||||
QgsUnitTypes = _MockQgsUnitTypes
|
||||
QgsLayoutItem = _MockQgsLayoutItem
|
||||
|
||||
MAP_GRID_STYLE_MARKERS = _MockQgsLayoutItemMapGrid.Markers
|
||||
MAP_GRID_STYLE_FRAME_ANNOTATIONS = _MockQgsLayoutItemMapGrid.FrameAndAnnotationsOnly
|
||||
MAP_GRID_FRAME_STYLE_INTERIOR_TICKS = _MockQgsLayoutItemMapGrid.InteriorTicks
|
||||
MAP_GRID_UNIT_MAP_UNIT = _MockQgsLayoutItemMapGrid.MapUnits
|
||||
MAP_GRID_ANNOTATION_FORMAT_DECIMAL = _MockQgsLayoutItemMapGrid.Decimal
|
||||
MAP_GRID_ANNOTATION_DISPLAY_HIDE_ALL = _MockQgsLayoutItemMapGrid.HideAll
|
||||
MAP_GRID_ANNOTATION_DISPLAY_SHOW_ALL = _MockQgsLayoutItemMapGrid.ShowAll
|
||||
MAP_GRID_ANNOTATION_DISPLAY_SHOW_X = _MockQgsLayoutItemMapGrid.LongitudeOnly
|
||||
MAP_GRID_ANNOTATION_DISPLAY_SHOW_Y = _MockQgsLayoutItemMapGrid.LatitudeOnly
|
||||
MAP_GRID_BORDER_LEFT = _MockQgsLayoutItemMapGrid.Left
|
||||
MAP_GRID_BORDER_RIGHT = _MockQgsLayoutItemMapGrid.Right
|
||||
MAP_GRID_BORDER_TOP = _MockQgsLayoutItemMapGrid.Top
|
||||
MAP_GRID_BORDER_BOTTOM = _MockQgsLayoutItemMapGrid.Bottom
|
||||
MAP_GRID_ANNOTATION_POSITION_INSIDE_FRAME = _MockQgsLayoutItemMapGrid.InsideMapFrame
|
||||
TEXT_BACKGROUND_SHAPE_RECTANGLE = _MockQgsTextBackgroundSettings.ShapeRectangle
|
||||
TEXT_BACKGROUND_SIZE_BUFFER = _MockQgsTextBackgroundSettings.SizeBuffer
|
||||
TEXT_RENDER_UNIT_MILLIMETERS = "Millimeters"
|
||||
TEXT_RENDER_UNIT_POINTS = "Points"
|
||||
|
||||
class _MockQgsFeature:
|
||||
def __init__(self):
|
||||
self._geometry = None
|
||||
|
||||
Reference in New Issue
Block a user