Merge remote-tracking branch 'sasha/master'

# Conflicts:
#	scenes/pribor-sch3/pribor-sch3.tscn
This commit is contained in:
MaD_CaT
2024-01-24 14:07:46 +03:00
17 changed files with 288 additions and 256 deletions

View File

@@ -21,7 +21,7 @@ boot_splash/use_filter=false
config/icon="res://data/icon.png"
config/map_bcs=Vector3(0.5, 1.5, 0.3)
config/map_tile_size=256
config/map_minimum_zoom=3
config/map_minimum_zoom=5
config/map_maximum_zoom=19
config/map_server_addr="https://b.tile.openstreetmap.org"
interfer/resend_timeout=1000.0

View File

@@ -5,42 +5,70 @@
[sub_resource type="StyleBoxEmpty" id="1"]
[sub_resource type="StyleBoxEmpty" id="6"]
[sub_resource type="StyleBoxEmpty" id="2"]
[sub_resource type="StyleBoxEmpty" id="3"]
[sub_resource type="StyleBoxEmpty" id="5"]
[sub_resource type="StyleBoxEmpty" id="4"]
[sub_resource type="Shader" id="Shader_2bftm"]
code = "shader_type canvas_item;
uniform vec4 color_gap = vec4(0.0, 0.0, 0.0, 0.0);
uniform vec4 color_stripe = vec4(0.3, 0.3, 0.3, 0.7);
uniform float divisions = 50.0; // increase for more stripe density
uniform float stripe_bias = 2.0; // 1.0 means no stripes; 2.0 means stripes and gaps are equal size
uniform float speed = 0.01;
uniform float angle = 0.7854; // in radians
#include \"res://shaders/tools.gdshaderinc\"
const vec2 center = vec2(0.125, 0.125);
const float sharpness = 300.0;
uniform float rotation = 0.0;
uniform vec4 color = vec4(1.0, 1.0, 1.0, 1.0);
uniform float width = 1.0;
uniform float speed = 1.0;
uniform bool disabled = false;
void fragment()
void vertex()
{
float w = cos(angle) * UV.x + sin(angle) * UV.y - speed * TIME;
if ((floor(mod(w * divisions, stripe_bias)) < 0.0001) && disabled)
{
COLOR = color_gap;
}
else
{
COLOR = color_stripe;
}
rotate_vec2(UV, rotation, center);
}
void fragment()
{
COLOR = color;
if (disabled)
{
float ds = 1.0 / sharpness;
float tx = float(int(TIME * 1000.0 * speed) % 10000) / 1000.0 * center.x + center.x;
COLOR.a = 0.0;
for (float x = -2.0; x < 2.0; x += 0.03)
{
float v0 = smoothstep(0.0, 1.0, (tx - UV.x + x) * sharpness + width);
float v1 = smoothstep(0.0, 1.0, (UV.x - tx - x) * sharpness + width);
float v2 = smooth_px(length(UV.x - center.x), center.x * 2.0 - ds, ds);
vec2 uv = UV;
rotate_vec2(uv, -rotation, center);
float v3 = smoothstep(0.0, 1.0, (uv.x - center.x / 5.0) * sharpness);
float v4 = smoothstep(0.0, 1.0, (uv.y - center.y / 5.0) * sharpness);
float v5 = smoothstep(0.0, 1.0, (center.x * 2.0 - center.x / 5.0 - uv.x) * sharpness);
float v6 = smoothstep(0.0, 1.0, (center.y * 2.0 - center.y / 5.0 - uv.y) * sharpness);
COLOR.a += v0 * v1 * v2 * v3 * v4 * v5 * v6;
}
COLOR.a *= color.a;
}
}
"
[sub_resource type="ShaderMaterial" id="ShaderMaterial_hhdyc"]
resource_local_to_scene = true
shader = SubResource("Shader_2bftm")
shader_parameter/color_gap = Vector4(1, 1, 1, 0.3)
shader_parameter/color_stripe = Vector4(0, 0, 1, 0)
shader_parameter/divisions = 50.0
shader_parameter/stripe_bias = 2.0
shader_parameter/speed = 0.0
shader_parameter/angle = 0.7854
shader_parameter/rotation = 45.0
shader_parameter/color = Vector4(1, 1, 1, 0.2)
shader_parameter/width = 2.0
shader_parameter/speed = 1.0
shader_parameter/disabled = false
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_6nup5"]
@@ -61,16 +89,6 @@ extends Sprite2D
get: return material.get('shader_parameter/disabled')
"
[sub_resource type="StyleBoxEmpty" id="6"]
[sub_resource type="StyleBoxEmpty" id="2"]
[sub_resource type="StyleBoxEmpty" id="3"]
[sub_resource type="StyleBoxEmpty" id="5"]
[sub_resource type="StyleBoxEmpty" id="4"]
[node name="container" type="PanelContainer"]
offset_right = 30.0
offset_bottom = 30.0
@@ -79,6 +97,7 @@ script = ExtResource("1_ui6sg")
toggle_mode = true
[node name="state" type="NinePatchRect" parent="."]
modulate = Color(1, 1, 1, 0.25)
layout_mode = 2
texture = ExtResource("2_0cn5u")
patch_margin_left = 10
@@ -88,14 +107,6 @@ patch_margin_bottom = 10
axis_stretch_horizontal = 2
axis_stretch_vertical = 2
[node name="back" type="Sprite2D" parent="."]
material = SubResource("ShaderMaterial_hhdyc")
scale = Vector2(30, 30)
texture = SubResource("PlaceholderTexture2D_6nup5")
centered = false
script = SubResource("GDScript_uyl5d")
speed = 0.0
[node name="button" type="Button" parent="."]
layout_mode = 2
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
@@ -108,6 +119,14 @@ theme_override_styles/focus = SubResource("4")
toggle_mode = true
clip_text = true
[node name="back" type="Sprite2D" parent="."]
material = SubResource("ShaderMaterial_hhdyc")
scale = Vector2(30, 30)
texture = SubResource("PlaceholderTexture2D_6nup5")
centered = false
script = SubResource("GDScript_uyl5d")
speed = 1.0
[connection signal="resized" from="." to="." method="_on_resized"]
[connection signal="visibility_changed" from="back" to="back" method="_on_visibility_changed"]
[connection signal="toggled" from="button" to="." method="_on_button_toggled"]
[connection signal="visibility_changed" from="back" to="back" method="_on_visibility_changed"]

View File

@@ -52,7 +52,6 @@ func is_toggle_mode(): return $button.is_toggle_mode()
func _on_resized() -> void: $back.scale = size
func _enter_tree() -> void:
$back.scale = size
save_modulate = modulate

View File

@@ -1,5 +1,7 @@
extends Sprite2D
func _ready() -> void: signaller.connect('map_mode_changed', Callable(self, 'set_view_mode'))
func sv(val: float) -> float: return val / ($строб.scale.x / 2.0) * 0.125
func set_strob_visible(val: bool): $строб.visible = val

View File

@@ -1,11 +1,9 @@
[gd_scene load_steps=8 format=3 uid="uid://dnuexoef2nnv5"]
[gd_scene load_steps=6 format=3 uid="uid://dnuexoef2nnv5"]
[ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/element_h.tscn" id="2_lpj3d"]
[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/element_v.tscn" id="3_2shxq"]
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="4_i1no5"]
[ext_resource type="Texture2D" uid="uid://dnreyfh3cd1k2" path="res://data/состояние-исправности-1.png" id="5_n0aaa"]
[ext_resource type="Texture2D" uid="uid://c6nve6f8sfyj2" path="res://data/состояние-исправности-0.png" id="6_sj3be"]
[ext_resource type="Texture2D" uid="uid://c6booa8753u5t" path="res://data/состояние-исправности-2.png" id="7_rhdhp"]
[ext_resource type="PackedScene" uid="uid://dyjtmfm4u58mu" path="res://scenes/контроль/indicator_h.tscn" id="8_q1orh"]
[node name="pribor_prd_n_1" type="Control"]
@@ -779,67 +777,10 @@ offset_bottom = 233.0
scale = Vector2(0.1, 0.1)
texture = ExtResource("5_n0aaa")
[node name="txr_legend0" type="TextureRect" parent="."]
layout_mode = 0
offset_left = 223.0
offset_top = 925.0
offset_right = 447.0
offset_bottom = 1149.0
scale = Vector2(0.1, 0.1)
texture = ExtResource("6_sj3be")
[node name="lbl_legend0" type="Label" parent="."]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 0
offset_left = 251.0
offset_top = 925.0
offset_right = 407.0
offset_bottom = 945.0
theme_override_font_sizes/font_size = 17
text = "Ожидание результата"
[node name="lbl_legend1" type="Label" parent="."]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 0
offset_left = 56.0
offset_top = 925.0
offset_right = 129.0
offset_bottom = 945.0
theme_override_font_sizes/font_size = 17
text = "Исправно"
[node name="txr_legend1" type="TextureRect" parent="."]
layout_mode = 0
offset_left = 32.0
offset_top = 925.0
offset_right = 256.0
offset_bottom = 1149.0
scale = Vector2(0.1, 0.1)
texture = ExtResource("5_n0aaa")
[node name="txr_legend2" type="TextureRect" parent="."]
layout_mode = 0
offset_left = 480.0
offset_top = 925.0
offset_right = 704.0
offset_bottom = 1149.0
scale = Vector2(0.1, 0.1)
texture = ExtResource("7_rhdhp")
[node name="lbl_legend2" type="Label" parent="."]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 0
offset_left = 508.0
offset_top = 925.0
offset_right = 664.0
offset_bottom = 945.0
theme_override_font_sizes/font_size = 17
text = "Сбой"
[node name="lbl_header" type="Label" parent="."]
layout_mode = 0
offset_top = 195.0
offset_right = 860.0
offset_right = 875.0
offset_bottom = 221.0
theme_override_font_sizes/font_size = 22
text = "Контроль исправности прибора ПРД-Н1"
@@ -849,9 +790,8 @@ vertical_alignment = 1
[node name="lbl_dev_warning" type="Label" parent="."]
self_modulate = Color(0.835294, 0.141176, 0.286275, 1)
layout_mode = 0
offset_left = 145.0
offset_top = 910.0
offset_right = 520.0
offset_right = 875.0
offset_bottom = 929.0
text = "** Позиционные обозначения требуют уточнения **"
horizontal_alignment = 1

View File

@@ -18,95 +18,79 @@ patch_margin_top = 16
patch_margin_right = 16
patch_margin_bottom = 16
[node name="ref_A1" parent="ref_G1" instance=ExtResource("2_bp8jp")]
offset_left = 77.0
offset_top = 345.0
offset_right = 234.0
offset_bottom = 800.0
[node name="ref_A1" parent="." instance=ExtResource("2_bp8jp")]
offset_left = 175.0
offset_top = 529.0
offset_right = 332.0
offset_bottom = 984.0
self_size = Vector2i(157, 455)
fname = "МАА150-1С27"
rname = "A1"
state = 1
[node name="ref_A2" parent="ref_G1" instance=ExtResource("2_bp8jp")]
offset_left = 398.0
offset_top = 347.0
offset_right = 533.0
offset_bottom = 804.0
[node name="ref_A2" parent="." instance=ExtResource("2_bp8jp")]
offset_left = 496.0
offset_top = 531.0
offset_right = 631.0
offset_bottom = 988.0
self_size = Vector2i(135, 457)
fname = "МАА150-1С27"
rname = "A2"
state = 1
[node name="ref_A3" parent="ref_G1" instance=ExtResource("2_bp8jp")]
offset_left = 279.0
offset_top = 347.0
offset_right = 370.0
offset_bottom = 801.0
[node name="ref_A3" parent="." instance=ExtResource("2_bp8jp")]
offset_left = 377.0
offset_top = 531.0
offset_right = 468.0
offset_bottom = 985.0
self_size = Vector2i(91, 454)
fname = "МАА150-1С27"
rname = "A2"
state = 1
[node name="lbl_legend1" type="Label" parent="ref_G1"]
[node name="lbl_legend1" type="Label" parent="."]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 0
offset_left = 32.0
offset_top = 880.0
offset_right = 105.0
offset_bottom = 900.0
offset_left = 130.0
offset_top = 1064.0
offset_right = 203.0
offset_bottom = 1084.0
theme_override_font_sizes/font_size = 17
text = "Исправно"
[node name="txr_legend0" type="TextureRect" parent="ref_G1"]
layout_mode = 0
offset_left = 204.0
offset_top = 880.0
offset_right = 428.0
offset_bottom = 1104.0
[node name="txr_legend0" type="TextureRect" parent="."]
offset_left = 302.0
offset_top = 1064.0
offset_right = 526.0
offset_bottom = 1288.0
scale = Vector2(0.1, 0.1)
texture = ExtResource("3_vvbft")
[node name="lbl_legend0" type="Label" parent="ref_G1"]
[node name="lbl_legend0" type="Label" parent="."]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 0
offset_left = 232.0
offset_top = 880.0
offset_right = 388.0
offset_bottom = 900.0
offset_left = 330.0
offset_top = 1064.0
offset_right = 486.0
offset_bottom = 1084.0
theme_override_font_sizes/font_size = 17
text = "Ожидание результата"
[node name="txr_legend2" type="TextureRect" parent="ref_G1"]
layout_mode = 0
offset_left = 461.0
offset_top = 880.0
offset_right = 685.0
offset_bottom = 1104.0
[node name="txr_legend2" type="TextureRect" parent="."]
offset_left = 559.0
offset_top = 1064.0
offset_right = 783.0
offset_bottom = 1288.0
scale = Vector2(0.1, 0.1)
texture = ExtResource("4_ly6ja")
[node name="lbl_legend2" type="Label" parent="ref_G1"]
[node name="lbl_legend2" type="Label" parent="."]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 0
offset_left = 489.0
offset_top = 880.0
offset_right = 645.0
offset_bottom = 900.0
offset_left = 587.0
offset_top = 1064.0
offset_right = 743.0
offset_bottom = 1084.0
theme_override_font_sizes/font_size = 17
text = "Сбой"
[node name="Label" type="Label" parent="ref_G1"]
self_modulate = Color(0.835294, 0.141176, 0.286275, 1)
layout_mode = 0
offset_left = 146.0
offset_top = 855.0
offset_right = 521.0
offset_bottom = 874.0
text = "** Позиционные обозначения требуют уточнения **"
horizontal_alignment = 1
vertical_alignment = 1
[node name="lbl_header" type="Label" parent="."]
offset_left = 10.0
offset_top = 156.0
@@ -116,3 +100,13 @@ theme_override_font_sizes/font_size = 22
text = "Контроль исправности прибора Щ3"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Label" type="Label" parent="."]
self_modulate = Color(0.835294, 0.141176, 0.286275, 1)
offset_left = 244.0
offset_top = 1039.0
offset_right = 619.0
offset_bottom = 1058.0
text = "** Позиционные обозначения требуют уточнения **"
horizontal_alignment = 1
vertical_alignment = 1

View File

@@ -11,7 +11,7 @@ enum TASK_STATE {
## Координаты для проверок [lng, lat]
var TEST_DATA: = {
const TEST_DATA: = {
'Калиниград': [ 20.51095, 54.70649 ],
'Москва': [ 37.6156, 55.7522 ],
'Нью-Йорк': [ -74.006, 40.7143 ],
@@ -29,30 +29,41 @@ var TEST_DATA: = {
'Море' : [ 19.4, 54.91 ] }
var map_image: Image ## Изображение с картой
var map_tile_state: TASK_STATE ## Текущее состояние конечного автомата плитки
var map_bcs: Vector3 ## Яркость, контраст насыщенность
var map_server_addr: String ## Адрес сервера изображений карт в проекции Меркатора
var map_tile_stack: Array ## Стек для хранения плиток карты
var map_request: HTTPRequest ## Обработчик запросов http
var map_zoom: int ## Уровень детализации карты
var map_rects: Array[Rect2i] ## Занятые плиткой области изображения карты
var map_tile: Rect2i ## Область одной плитки: [x-координата области, y-координата области, x-индекс плитки, y-индекс плитки]
var prev_tiles_dic = {} ##
const MAP_MODES: = {
0: 'application/config/map_image_size_rto',
1: 'application/config/map_image_size_rls' }
const MAP_RELATIVE_RADIUSES: = {
0: 0.39,
1: 0.466
}
var map_image: Image ## Изображение с картой
var map_tile_state: TASK_STATE ## Текущее состояние конечного автомата плитки
var map_bcs: Vector3 ## Яркость, контраст насыщенность
var map_server_addr: String ## Адрес сервера изображений карт в проекции Меркатора
var map_tile_format: String ##
var map_tile_stack: Array ## Стек для хранения плиток карты
var map_request: HTTPRequest ## Обработчик запросов http
var map_zoom: int ## Уровень детализации карты
var map_tile: Rect2i ## Область одной плитки: [x-координата области, y-координата области, x-индекс плитки, y-индекс плитки]
var map_mode: int ## Режим карты: 0 - приоритет РТО, 1 - приоритет РЛС
var prev_tiles_dic: Dictionary ##
var lnglat: Array ## Текущие координаты
var root_rect: Rect2i
func _ready():
lnglat = TEST_DATA['Таганрог']
map_tile_state = TASK_STATE.DONE
map_request = HTTPRequest.new()
add_child(map_request)
map_request.request_completed.connect(self._map_request_completed)
map_bcs = ProjectSettings.get_setting('application/config/map_bcs', Vector3(1.0, 1.0, 1.0))
map_server_addr = ProjectSettings.get_setting('application/config/map_server_addr')
map_tile_format = ProjectSettings.get_setting('application/config/map_tile_format', '%s/%d/%d/%d.png')
var map_image_size = ProjectSettings.get_setting(MAP_MODES[0], Vector2i(512, 512))
var map_tile_size = ProjectSettings.get_setting('application/config/map_tile_size', 256)
map_image = Image.create(map_image_size.x, map_image_size.y, true, Image.FORMAT_RGB8)
@@ -65,11 +76,12 @@ func _ready():
func _on_map_mode_changed(mode: int) -> void:
var map_image_size = ProjectSettings.get_setting(MAP_MODES[mode])
material.set('shader_parameter/radius', MAP_RELATIVE_RADIUSES[mode])
map_image.fill(Color(0, 0, 0, 0))
map_image.resize(map_image_size.x, map_image_size.y)
map_tile_state = TASK_STATE.DONE
var ll = TEST_DATA['Хельсинки']
var tile: = mercator.create_tile(ll[0], ll[1], map_zoom)
map_mode = mode
var tile: = mercator.create_tile(lnglat[0], lnglat[1], map_zoom)
map_tile_stack.clear()
map_tile_stack.append(tile)
prev_tiles_dic.clear()
@@ -87,18 +99,12 @@ func _on_zoom_changed(zoom: int):
if map_tile_stack.size() != 0:
return
map_zoom = zoom
var ll = TEST_DATA['Хельсинки']
var tile: = mercator.create_tile(ll[0], ll[1], zoom)
var tile: = mercator.create_tile(lnglat[0], lnglat[1], zoom)
map_tile_stack.clear()
map_tile_stack.append(tile)
prev_tiles_dic.clear()
func request_tile(tile: mercator.Tile, server_addr: String, tile_format: String = '%s/%d/%d/%d.png') -> Error:
var tile_addr: = tile_format % [server_addr, tile.z, tile.x , tile.y]
return map_request.request(tile_addr)
func img_tile_to_map_image(image: Image, dst_pos: Vector2i):
image.adjust_bcs(map_bcs.x, map_bcs.y, map_bcs.z)
map_image.blit_rect(image, map_tile, dst_pos)
@@ -107,15 +113,16 @@ func img_tile_to_map_image(image: Image, dst_pos: Vector2i):
func _process(_delta: float):
if (map_tile_state == TASK_STATE.DONE) and map_tile_stack.size():
var tile: mercator.Tile = map_tile_stack[-1]
if request_tile(tile, map_server_addr) == OK:
var tile_addr: = map_tile_format % [map_server_addr, tile.z, tile.x , tile.y]
var rc = map_request.request(tile_addr)
if rc == OK:
map_tile_state = TASK_STATE.WAIT
else:
log.error('%s: Невозможно сформировать запрос HTTP' % self)
map_tile_state = TASK_STATE.ERROR
elif map_tile_state == TASK_STATE.CHECK:
var root_rect: Rect2i = map_rects[0]
var root_tile: = mercator.Tile.new(root_rect.size.x, root_rect.size.y, map_zoom)
var neighbors_tiles = mercator.get_perimetr_tiles(root_tile, (map_image.get_size().x / map_tile.size.x) / 1) # = mercator.neighbors(root_tile)
var neighbors_tiles = mercator.get_perimetr_tiles(root_tile, (map_image.get_size().x / map_tile.size.x) / 2)
var neighbors_tiles_dic = {}
for tile in neighbors_tiles:
neighbors_tiles_dic[[tile.x, tile.y]] = false
@@ -149,22 +156,18 @@ func _map_request_completed(result, response_code, headers, data):
if tile.is_root:
# Отображение корневой плитки
map_image.fill(Color(0, 0, 0, 0))
map_rects.clear() # Очистить список занятых областей изображения карты
var bounds: = mercator.bounds(tile)
var lng_c = (bounds.east + bounds.west) / 2.0
var lat_c = (bounds.north + bounds.south) / 2.0
var sx: float = float(map_tile.size.x) / (bounds.east - bounds.west) * (lng_c - tile.lng) + map_tile.size.x / 2 # Cмещение в пискселях центра плитки от заданной точки по горизонтали.
var sy: float = float(map_tile.size.y) / (bounds.north - bounds.south) * (lat_c - tile.lat) - map_tile.size.y / 2 # Cмещение в пискселях центра плитки от заданной точки по вертикали.
var dst_pos: Vector2i = Vector2i(sx, -sy)
var sx: float = float(map_tile.size.x) / (bounds.east - bounds.west) * (lng_c - tile.lng) + map_tile.size.x / 2.0 # Cмещение в пискселях центра плитки от заданной точки по горизонтали.
var sy: float = float(map_tile.size.y) / (bounds.north - bounds.south) * (lat_c - tile.lat) - map_tile.size.y / 2.0 # Cмещение в пискселях центра плитки от заданной точки по вертикали.
var dst_pos: Vector2i = Vector2i(sx, -sy) + map_tile.size * map_mode
img_tile_to_map_image(img_tile, dst_pos)
map_rects.append(Rect2i(dst_pos.x, dst_pos.y, tile.x, tile.y))
root_rect = Rect2i(dst_pos.x, dst_pos.y, tile.x, tile.y)
else:
# Отображение соседних плиток
var root_rect: Rect2i = map_rects[0] # Получить корневую плитку
var dx: int = tile.x - root_rect.size.x # Вычислить смещение дочерней плитки относительно корневой
var dy: int = tile.y - root_rect.size.y
var dst_pos: Vector2i = root_rect.position + Vector2i(dx, dy) * map_tile.size
var delta: = Vector2i(tile.x - root_rect.size.x, tile.y - root_rect.size.y)
var dst_pos: Vector2i = root_rect.position + delta * map_tile.size
img_tile_to_map_image(img_tile, dst_pos)
map_rects.append(Rect2i(dst_pos.x, dst_pos.y, tile.x, tile.y))
mark_image_center(map_image)
texture = ImageTexture.create_from_image(map_image)

View File

@@ -6,7 +6,7 @@
[sub_resource type="ShaderMaterial" id="ShaderMaterial_pmqvj"]
resource_local_to_scene = true
shader = ExtResource("1_tsdui")
shader_parameter/radius = 0.4
shader_parameter/radius = 0.39
[node name="tilemap" type="Sprite2D"]
material = SubResource("ShaderMaterial_pmqvj")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://lwmw4egynmd1"]
[gd_scene load_steps=10 format=3 uid="uid://lwmw4egynmd1"]
[ext_resource type="Script" path="res://scenes/контроль/контроль.gd" id="1_x5d6w"]
[ext_resource type="Texture2D" uid="uid://bar8k5qef7kch" path="res://data/УФ.png" id="2_0nvm1"]
@@ -6,6 +6,9 @@
[ext_resource type="Texture2D" uid="uid://b4isaggma6q3" path="res://data/Грани22.png" id="4_l0nc7"]
[ext_resource type="Texture2D" uid="uid://d2jxmtd6n5jd1" path="res://data/Щ3.png" id="5_kvnex"]
[ext_resource type="Texture2D" uid="uid://bos68thpqqvn" path="res://data/ПРД.png" id="6_i1yfn"]
[ext_resource type="Texture2D" uid="uid://c6nve6f8sfyj2" path="res://data/состояние-исправности-0.png" id="7_6j01w"]
[ext_resource type="Texture2D" uid="uid://dnreyfh3cd1k2" path="res://data/состояние-исправности-1.png" id="8_isjua"]
[ext_resource type="Texture2D" uid="uid://c6booa8753u5t" path="res://data/состояние-исправности-2.png" id="9_ll0vs"]
[node name="Контроль" type="Panel"]
anchors_preset = 15
@@ -235,3 +238,60 @@ stretch_mode = 4
[node name="pribor_sch" type="Panel" parent="."]
layout_mode = 0
[node name="txr_legend0" type="TextureRect" parent="."]
layout_mode = 0
offset_left = 1199.0
offset_top = 961.0
offset_right = 1423.0
offset_bottom = 1185.0
scale = Vector2(0.1, 0.1)
texture = ExtResource("7_6j01w")
[node name="lbl_legend0" type="Label" parent="."]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 0
offset_left = 1227.0
offset_top = 961.0
offset_right = 1383.0
offset_bottom = 981.0
theme_override_font_sizes/font_size = 17
text = "Ожидание результата"
[node name="lbl_legend1" type="Label" parent="."]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 0
offset_left = 1032.0
offset_top = 961.0
offset_right = 1105.0
offset_bottom = 981.0
theme_override_font_sizes/font_size = 17
text = "Исправно"
[node name="txr_legend1" type="TextureRect" parent="."]
layout_mode = 0
offset_left = 1008.0
offset_top = 961.0
offset_right = 1232.0
offset_bottom = 1185.0
scale = Vector2(0.1, 0.1)
texture = ExtResource("8_isjua")
[node name="txr_legend2" type="TextureRect" parent="."]
layout_mode = 0
offset_left = 1456.0
offset_top = 961.0
offset_right = 1680.0
offset_bottom = 1185.0
scale = Vector2(0.1, 0.1)
texture = ExtResource("9_ll0vs")
[node name="lbl_legend2" type="Label" parent="."]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 0
offset_left = 1484.0
offset_top = 961.0
offset_right = 1640.0
offset_bottom = 981.0
theme_override_font_sizes/font_size = 17
text = "Сбой"

View File

@@ -45,15 +45,16 @@ enum DragFSM {
}
func on_button_view_toggled(toggled: bool):
$canvas.set_view_mode(int(toggled))
signaller.emit_signal('map_mode_changed', int(toggled))
## Обработчик сигнала изменения списка целей
func on_threats_resized(threats: Dictionary): $count_all_pad/count_all.text = '%02d' % threats.size()
func on_threat_selected(th, ecm_btns): on_rto_threat_sel(th.id, ecm_btns)
func on_button_view_toggled(toggled: bool): signaller.emit_signal('map_mode_changed', int(toggled))
##
func _enter_tree() -> void:
var timer1 = Timer.new()
@@ -74,24 +75,24 @@ func _exit_tree() -> void:
func _ready():
min_zoom = ProjectSettings.get_setting('application/config/map_minimum_zoom', 5)
max_zoom = ProjectSettings.get_setting('application/config/map_maximum_zoom', 19)
drag_fsm = DragFSM.OFF
$btn_zoom.set_meta('zoom', min_zoom - 1)
$btn_strob.button_connect('pressed', Callable(self, 'on_button_strobe_pressed'))
$btn_view.button_connect('toggled', Callable(self, 'on_button_view_toggled'))
drag_fsm = DragFSM.OFF
var nodes: Array = get_tree().get_nodes_in_group('группа-режим-помехи')
nodes.any(func(btn): btn.button_connect('pressed', Callable(self, 'on_button_pressed').bind(btn, nodes)))
threats.connect('threat_new', Callable(self, 'on_threat_new'))
threats.connect('threat_lost', Callable(self, 'on_threat_lost'))
threats.connect('threats_resized', Callable(self, 'on_threats_resized'))
threats.connect('threat_update', Callable(self, 'on_threat_update'))
signaller.connect('zoom_complete', Callable(self, '_on_zoom_complete'))
signaller.connect('rto_threat_sel', Callable(self, 'on_rto_threat_sel').bind(nodes))
threats.connect('threat_new', Callable(self, 'on_threat_new'))
threats.connect('threat_lost', Callable(self, 'on_threat_lost'))
threats.connect('threats_resized', Callable(self, 'on_threats_resized'))
threats.connect('threat_update', Callable(self, 'on_threat_update'))
signaller.connect('zoom_complete', Callable(self, '_on_zoom_complete'))
signaller.connect('rto_threat_sel', Callable(self, 'on_rto_threat_sel').bind(nodes))
signaller.connect('rto_threat_unsel', Callable(self, 'on_rto_threat_unsel').bind(nodes))
signaller.connect('threat_selected', Callable(self, 'on_threat_selected').bind(nodes))
signaller.connect('threat_selected', Callable(self, 'on_threat_selected').bind(nodes))
signaller.connect('interfer_selected', Callable(self, 'on_interfer_selected').bind(nodes))
signaller.connect('interfer_new', Callable(self, 'on_interfer_new'))
signaller.connect('interfer_off_all', Callable(self, 'interfer_off_all'))
interfer.connect('interfer_update', Callable(self, 'on_interfer_new'))
signaller.connect('interfer_new', Callable(self, 'on_interfer_new'))
signaller.connect('interfer_off_all', Callable(self, 'interfer_off_all'))
interfer.connect('interfer_update', Callable(self, 'on_interfer_new'))
func on_enter_tree() -> void:
call_deferred('_on_btn_scale_pressed')
@@ -180,10 +181,6 @@ func on_rto_threat_unsel(th_id, ecm_btns):
btn.set_disabled(true)
func on_threat_selected(th, ecm_btns):
on_rto_threat_sel(th.id, ecm_btns)
## Обработчик нажатия кнопки "Строб". Управляет отображением строба
func on_button_strobe_pressed() -> void:
drag_fsm = DragFSM.IDLE if $btn_strob.is_pressed() else DragFSM.OFF

View File

@@ -131,7 +131,7 @@ offset_left = 952.0
offset_top = 1038.0
offset_right = 1104.0
offset_bottom = 1056.0
metadata/zoom = 2
metadata/zoom = 4
[node name="canvas" parent="." instance=ExtResource("11_b6su4")]

View File

@@ -1,10 +1,12 @@
extends Node
## Веб-утилиты для работы с меркаторскими XYZ-плитками.
## Утилиты для работы с меркаторовскими XYZ-плитками.
const R2D: = 180.0 / PI
const RE: = 6378137.0 ## Радиус Земли в метрах
const CE: = 2.0 * PI * RE ## Длина окружности Земли в метрах
const RE: = 6378137.0 ## Радиус Земли экваториальный в метрах
const RP: = 6356752.31424518 ## Радиус Земли полярный в метрах
const CE: = 2.0 * PI * RE ## Длина окружности Земли в метрах по экватору
const CP: = 2.0 * PI * RP ## Длина окружности Земли в метрах через полюсы
const EPSILON: = 1e-14
const LL_EPSILON: = 1e-11
const MAX_ZOOM: = 20
@@ -27,21 +29,21 @@ class Tile:
func _to_string() -> String: return '[%d, %d, %d]' % [self.x, self.y, self.z]
func _init(x0: int = 0, y0: int = 0, z0: int = 0, is_root0: bool = true):
self.x = x0
self.y = y0
self.z = z0
self.is_root = is_root0
x = x0
y = y0
z = z0
is_root = is_root0
func is_valid() -> bool:
if (self.z >= 0) and (self.z < MAX_ZOOM):
var mz: int = 2 ** self.z
return (self.x >= 0) and (self.x < mz) \
and (self.y >= 0) and (self.y < mz)
if (z >= 0) and (z < MAX_ZOOM):
var mz: int = 2 ** z
return (x >= 0) and (x < mz) \
and (y >= 0) and (y < mz)
return false
func _bound_index(index: int) -> int:
var mi: int = 2 ** self.z
var mi: int = 2 ** z
if index < 0:
index *= -1
index %= mi
@@ -51,8 +53,8 @@ class Tile:
return index
func fix_xy():
self.x = _bound_index(self.x)
self.y = _bound_index(self.y)
x = _bound_index(x)
y = _bound_index(y)
## Пара долготы и широты.
@@ -112,9 +114,28 @@ func radians(v: float) -> float: return (v * PI) / 180.0
func rshift(val: int, n: int) -> int: return (val % 0x100000000) >> n
# Возвращает арксинус гиперболический от значения [param val]
func asinh(val: float): return log(val + sqrt(val * val + 1.0))
# Преобразует [param lon] в градусах восточной долготы, [param lat] в градусах
# северной долготы, [param alt] высоты в метрах в фиксированные координаты (x, y, z) Земли.
func lnglat_to_ecef(lng: float, lat: float, alt: float = 0.0) -> Array:
alt += (RE + RP) / 2.0
var latrad: float = radians(lat)
var lonrad: float = radians(lng)
var coslat: float = cos(latrad)
var sinlat: float = sin(latrad)
var coslon: float = cos(lonrad)
var sinlon: float = sin(lonrad)
var term1: float = (RE * coslat) / tools.hypot(RE * coslat, RP * sinlat)
var term2: float = alt * coslat + term1;
var x: float = coslon * term2
var y: float = sinlon * term2
var z: float = alt * sinlat + (RP * sinlat) / tools.hypot(RE * coslat, RP * sinlat)
return [x, y, z]
func find_up_left(tiles: Array):
var x = 0
var y = 0
@@ -128,26 +149,25 @@ func find_up_left(tiles: Array):
## Lon./lat. to tile numbers
func deg2num(lat: float, lon: float, zoom: int):
lat = radians(lat)
func deg2num(lng: float, lat: float, zoom: int):
var n: = float(1 << zoom)
var xtile: = int((lon + 180.0) / 360.0 * n)
var ytile: = int((1.0 - asinh(tan(lat)) / PI) / 2.0 * n)
var xtile: = int((lng + 180.0) / 360.0 * n)
var ytile: = int((1.0 - asinh(tan(radians(lat))) / PI) / 2.0 * n)
return [xtile, ytile]
## Tile numbers to lon./lat.
func num2deg(xtile: int, ytile: int, zoom: int):
func num2deg(x: int, y: int, zoom: int):
var n: = float(1 << zoom)
var lon: = float(xtile) / n * 360.0 - 180.0
var lat: = atan(sinh(PI * (1.0 - 2.0 * float(ytile) / n)))
return [degrees(lat), lon]
var lng: = float(x) / n * 360.0 - 180.0
var lat: = atan(sinh(PI * (1.0 - 2.0 * float(y) / n)))
return [lng, degrees(lat)]
## Расстояние по горизонтали в метрах, представленное одним пикселем
## [paramn lat] - Широта, градусы.[br]
## [paramn zoom] - Уровень детализации.[br]
## [paramn size] - Размер плитки в пикселях.[br]
## [param lat] - Широта, градусы.[br]
## [param zoom] - Уровень детализации.[br]
## [param size] - Размер плитки в пикселях.[br]
func dist_per_pixel(lat: float, zoom: int, size: int = 256) -> float:
return (CE / float(size)) * cos(radians(lat)) / float(2 ** zoom)
@@ -253,7 +273,7 @@ func ul2(tile: Tile) -> Array[float]:
var lon_deg = tile.x / z2 * 360.0 - 180.0
var lat_rad = atan(sinh(PI * (1 - 2 * tile.y / z2)))
var lat_deg = degrees(lat_rad)
return [lat_deg, lon_deg]
return [lon_deg, lat_deg]
## Возвращает граничную область плитки.[br]

View File

@@ -65,7 +65,7 @@ void sector(inout vec4 c, vec2 uv, vec2 center, float a, float da, float r0, flo
void antenas(inout vec4 c, vec2 uv, vec2 p0, int cnt, float r0, float r1, vec4 c0, vec4 c1)
{
float da = 180.0f / float(cnt);
float da = 180.0 / float(cnt);
for (int i = -cnt; i <= cnt; i ++)
{
float v = float(i & 1);
@@ -85,7 +85,7 @@ void fragment()
{
ivec2 isz = textureSize(TEXTURE, 0);
vec2 uv = UV * vec2(float(isz.x), float(isz.y)); // координаты текущей точки в пикселях
COLOR = vec4(0, 0, 0, 0.0); //texture(TEXTURE, UV); // Цвет текущей точки
COLOR = vec4(0, 0, 0, 0); //texture(TEXTURE, UV); // Цвет текущей точки
// Сетка антенн
antenas(COLOR, uv, pc0, ant_band_count_0, ant_band_r0_0[mode], ant_band_r1_0[mode], color1, color0);

View File

@@ -1,6 +1,6 @@
shader_type canvas_item;
#include "tools.gdshaderinc"
#include "res://shaders/tools.gdshaderinc"
/* Закрашенная окружность */
uniform vec4 color: source_color = vec4(1, 1, 1, 1);

View File

@@ -1,6 +1,6 @@
shader_type canvas_item;
#include "tools.gdshaderinc"
#include "res://shaders/tools.gdshaderinc"
/* Закрашенный сектор окружности ограниченный угловым сектором и радиусами */

View File

@@ -1,6 +1,6 @@
shader_type canvas_item;
#include "tools.gdshaderinc"
#include "res://shaders/tools.gdshaderinc"
/* Рисует текстуру по маске в форме окружности */
@@ -11,4 +11,3 @@ void fragment()
{
COLOR.a *= smooth_px(length(UV - center), radius, DS);
}

View File

@@ -1,4 +1,7 @@
shader_type canvas_item;
#include "res://shaders/tools.gdshaderinc"
uniform vec4 ColorFig:source_color;
uniform vec2 point_1;
uniform vec2 point_2;
@@ -14,10 +17,6 @@ const float DSS = 0.002525;
const float radius = 0.125;
uniform float speed: hint_range(0.0, 1024.0) = 0.0;
float smooth_px(float r, float R, float dss)
{
return 1.0 - smoothstep(R - dss, R + dss, r);
}
float line(vec2 p1, vec2 p2, float width, vec2 uv)
{