mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Added Polygon drawing mode for map background
This commit is contained in:
parent
9c58e73b39
commit
d95912322c
@ -54,6 +54,7 @@ class DisplayOptions:
|
|||||||
sam_ranges = DisplayRule("Ally SAM Threat Range", False)
|
sam_ranges = DisplayRule("Ally SAM Threat Range", False)
|
||||||
enemy_sam_ranges = DisplayRule("Enemy SAM Threat Range", True)
|
enemy_sam_ranges = DisplayRule("Enemy SAM Threat Range", True)
|
||||||
detection_range = DisplayRule("SAM Detection Range", False)
|
detection_range = DisplayRule("SAM Detection Range", False)
|
||||||
|
map_poly = DisplayRule("Map Polygon Debug Mode", False)
|
||||||
waypoint_info = DisplayRule("Waypoint Information", True)
|
waypoint_info = DisplayRule("Waypoint Information", True)
|
||||||
flight_paths = FlightPathOptions()
|
flight_paths = FlightPathOptions()
|
||||||
|
|
||||||
|
|||||||
@ -49,6 +49,7 @@ COLORS: Dict[str, QColor] = {
|
|||||||
"super_red": QColor(227, 32, 0),
|
"super_red": QColor(227, 32, 0),
|
||||||
|
|
||||||
"green": QColor(128, 186, 128),
|
"green": QColor(128, 186, 128),
|
||||||
|
"light_green": QColor(223, 255, 173),
|
||||||
"bright_green": QColor(64, 200, 64),
|
"bright_green": QColor(64, 200, 64),
|
||||||
|
|
||||||
"black": QColor(0, 0, 0),
|
"black": QColor(0, 0, 0),
|
||||||
@ -59,6 +60,10 @@ COLORS: Dict[str, QColor] = {
|
|||||||
"night_overlay": QColor(12, 20, 69),
|
"night_overlay": QColor(12, 20, 69),
|
||||||
"dawn_dust_overlay": QColor(46, 38, 85),
|
"dawn_dust_overlay": QColor(46, 38, 85),
|
||||||
|
|
||||||
|
"grey": QColor(150, 150, 150),
|
||||||
|
"dark_grey": QColor(75, 75, 75),
|
||||||
|
"dark_dark_grey": QColor(48, 48, 48),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CP_SIZE = 12
|
CP_SIZE = 12
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import datetime
|
|||||||
import logging
|
import logging
|
||||||
from typing import List, Optional, Tuple
|
from typing import List, Optional, Tuple
|
||||||
|
|
||||||
from PySide2.QtCore import Qt
|
from PySide2.QtCore import Qt, QPointF
|
||||||
from PySide2.QtGui import QBrush, QColor, QPen, QPixmap, QWheelEvent
|
from PySide2.QtGui import QBrush, QColor, QPen, QPixmap, QWheelEvent, QPolygonF
|
||||||
from PySide2.QtWidgets import (
|
from PySide2.QtWidgets import (
|
||||||
QFrame,
|
QFrame,
|
||||||
QGraphicsItem,
|
QGraphicsItem,
|
||||||
@ -470,6 +470,7 @@ class QLiberationMap(QGraphicsView):
|
|||||||
def addBackground(self):
|
def addBackground(self):
|
||||||
scene = self.scene()
|
scene = self.scene()
|
||||||
|
|
||||||
|
if not DisplayOptions.map_poly:
|
||||||
bg = QPixmap("./resources/" + self.game.theater.overview_image)
|
bg = QPixmap("./resources/" + self.game.theater.overview_image)
|
||||||
scene.addPixmap(bg)
|
scene.addPixmap(bg)
|
||||||
|
|
||||||
@ -490,3 +491,15 @@ class QLiberationMap(QGraphicsView):
|
|||||||
effect = QGraphicsOpacityEffect()
|
effect = QGraphicsOpacityEffect()
|
||||||
effect.setOpacity(0.3)
|
effect.setOpacity(0.3)
|
||||||
overlay.setGraphicsEffect(effect)
|
overlay.setGraphicsEffect(effect)
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Polygon display mode
|
||||||
|
for inclusion_zone in self.game.theater.landmap[0]:
|
||||||
|
poly = QPolygonF([QPointF(*self._transform_point(Point(point[0], point[1]))) for point in inclusion_zone])
|
||||||
|
scene.addPolygon(poly, CONST.COLORS["grey"], CONST.COLORS["dark_grey"])
|
||||||
|
|
||||||
|
for exclusion_zone in self.game.theater.landmap[1]:
|
||||||
|
poly = QPolygonF([QPointF(*self._transform_point(Point(point[0], point[1]))) for point in exclusion_zone])
|
||||||
|
scene.addPolygon(poly, CONST.COLORS["grey"], CONST.COLORS["dark_dark_grey"])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user