mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-13 17:43:56 +00:00
[WIP] Adding Drawing Cursor Over Time functions
This commit is contained in:
@@ -19,6 +19,24 @@ class CfgFunctions {
|
||||
class send_marker_cot {
|
||||
file = "\armatak\armatak\addons\main\functions\api\fn_send_marker_cot.sqf";
|
||||
};
|
||||
class report_marker {
|
||||
file = "\armatak\armatak\addons\main\functions\api\fn_report_marker.sqf";
|
||||
};
|
||||
class draw_circle {
|
||||
file = "\armatak\armatak\addons\main\functions\api\fn_draw_circle.sqf";
|
||||
};
|
||||
class draw_ellipse {
|
||||
file = "\armatak\armatak\addons\main\functions\api\fn_draw_ellipse.sqf";
|
||||
};
|
||||
class draw_rectangle {
|
||||
file = "\armatak\armatak\addons\main\functions\api\fn_draw_rectangle.sqf";
|
||||
};
|
||||
class draw_polyline {
|
||||
file = "\armatak\armatak\addons\main\functions\api\fn_draw_polyline.sqf";
|
||||
};
|
||||
class draw_tactical_graphic {
|
||||
file = "\armatak\armatak\addons\main\functions\api\fn_draw_tactical_graphic.sqf";
|
||||
};
|
||||
class send_uas_platform_cot {
|
||||
file = "\armatak\armatak\addons\main\functions\api\fn_send_uas_platform_cot.sqf";
|
||||
};
|
||||
|
||||
41
addons/main/functions/api/fn_draw_circle.sqf
Normal file
41
addons/main/functions/api/fn_draw_circle.sqf
Normal file
@@ -0,0 +1,41 @@
|
||||
// function name: armatak_fnc_draw_circle
|
||||
// function author: Valmo
|
||||
// function description: Sends an ATAK Drawing Tools circle CoT.
|
||||
//
|
||||
// Arguments:
|
||||
// 0: Center position or object <ARRAY|OBJECT>
|
||||
// 1: Radius in meters <NUMBER>
|
||||
// 2: Callsign/title <STRING> (default: "ArmaTAK Circle")
|
||||
// 3: Stale time in seconds <NUMBER> (default: 86400)
|
||||
// 4: Stroke color as signed ARGB int <NUMBER> (default: -1)
|
||||
// 5: Fill color as signed ARGB int <NUMBER> (default: -1761607681)
|
||||
// 6: Stroke weight <NUMBER> (default: 3)
|
||||
//
|
||||
// Example:
|
||||
// [player, 300, "Mortar Risk Area"] call armatak_fnc_draw_circle;
|
||||
//
|
||||
// Public: Yes
|
||||
|
||||
params [
|
||||
["_center", objNull, [objNull, []]],
|
||||
["_radius", 100, [0]],
|
||||
["_callsign", "ArmaTAK Circle", [""]],
|
||||
["_staleSeconds", 86400, [0]],
|
||||
["_strokeColor", -1, [0]],
|
||||
["_fillColor", -1761607681, [0]],
|
||||
["_strokeWeight", 3, [0]]
|
||||
];
|
||||
|
||||
[
|
||||
_center,
|
||||
_radius,
|
||||
_radius,
|
||||
360,
|
||||
_callsign,
|
||||
_staleSeconds,
|
||||
_strokeColor,
|
||||
_fillColor,
|
||||
_strokeWeight,
|
||||
"",
|
||||
"u-d-c-c"
|
||||
] call armatak_fnc_draw_ellipse;
|
||||
65
addons/main/functions/api/fn_draw_ellipse.sqf
Normal file
65
addons/main/functions/api/fn_draw_ellipse.sqf
Normal file
@@ -0,0 +1,65 @@
|
||||
// function name: armatak_fnc_draw_ellipse
|
||||
// function author: Valmo
|
||||
// function description: Sends an ATAK Drawing Tools ellipse or circle CoT.
|
||||
//
|
||||
// Arguments:
|
||||
// 0: Center position or object <ARRAY|OBJECT>
|
||||
// 1: Major radius in meters <NUMBER>
|
||||
// 2: Minor radius in meters <NUMBER>
|
||||
// 3: Rotation angle in degrees <NUMBER> (default: 0)
|
||||
// 4: Callsign/title <STRING> (default: "ArmaTAK Ellipse")
|
||||
// 5: Stale time in seconds <NUMBER> (default: 86400)
|
||||
// 6: Stroke color as signed ARGB int <NUMBER> (default: -1)
|
||||
// 7: Fill color as signed ARGB int <NUMBER> (default: -1761607681)
|
||||
// 8: Stroke weight <NUMBER> (default: 3)
|
||||
// 9: MilSym SIDC for tactical overlay <STRING> (default: "")
|
||||
// 10: CoT type <STRING> (default: "u-d-c-e")
|
||||
//
|
||||
// Example:
|
||||
// [screenToWorld [0.5, 0.5], 250, 100, 45, "Support by Fire"] call armatak_fnc_draw_ellipse;
|
||||
//
|
||||
// Public: Yes
|
||||
|
||||
params [
|
||||
["_center", objNull, [objNull, []]],
|
||||
["_major", 100, [0]],
|
||||
["_minor", 50, [0]],
|
||||
["_angle", 0, [0]],
|
||||
["_callsign", "ArmaTAK Ellipse", [""]],
|
||||
["_staleSeconds", 86400, [0]],
|
||||
["_strokeColor", -1, [0]],
|
||||
["_fillColor", -1761607681, [0]],
|
||||
["_strokeWeight", 3, [0]],
|
||||
["_milsym", "", [""]],
|
||||
["_cotType", "u-d-c-e", [""]]
|
||||
];
|
||||
|
||||
private _position = if (_center isEqualType objNull) then {
|
||||
getPos _center
|
||||
} else {
|
||||
_center
|
||||
};
|
||||
|
||||
if ((count _position) < 2) exitWith {""};
|
||||
|
||||
private _altitude = _position param [2, 0, [0]];
|
||||
private _realLocation = [_position select 0, _position select 1, _altitude] call armatak_client_fnc_convertClientLocation;
|
||||
private _uuid = "armatak" callExtension ["uuid", []] select 0;
|
||||
private _payload = [
|
||||
_uuid,
|
||||
_cotType,
|
||||
_realLocation select 0,
|
||||
_realLocation select 1,
|
||||
_realLocation select 2,
|
||||
_major max 1,
|
||||
_minor max 1,
|
||||
_angle,
|
||||
_callsign,
|
||||
_staleSeconds max 1,
|
||||
_strokeColor,
|
||||
_fillColor,
|
||||
_strokeWeight max 1,
|
||||
_milsym
|
||||
];
|
||||
|
||||
"armatak" callExtension ["tcp_socket:draw:ellipse", [_payload]];
|
||||
78
addons/main/functions/api/fn_draw_polyline.sqf
Normal file
78
addons/main/functions/api/fn_draw_polyline.sqf
Normal file
@@ -0,0 +1,78 @@
|
||||
// function name: armatak_fnc_draw_polyline
|
||||
// function author: Valmo
|
||||
// function description: Sends an ATAK Drawing Tools freeform line or polygon CoT.
|
||||
//
|
||||
// Arguments:
|
||||
// 0: Positions or objects <ARRAY>
|
||||
// 1: Callsign/title <STRING> (default: "ArmaTAK Line")
|
||||
// 2: Closed polygon <BOOL> (default: false)
|
||||
// 3: Stale time in seconds <NUMBER> (default: 86400)
|
||||
// 4: Stroke color as signed ARGB int <NUMBER> (default: -1)
|
||||
// 5: Fill color as signed ARGB int <NUMBER> (default: -1761607681)
|
||||
// 6: Stroke weight <NUMBER> (default: 3)
|
||||
// 7: Stroke style <STRING> (default: "solid")
|
||||
// 8: MilSym SIDC for tactical overlay <STRING> (default: "")
|
||||
// 9: CoT type <STRING> (default: "u-d-f")
|
||||
//
|
||||
// Example:
|
||||
// [[pos player, screenToWorld [0.5, 0.5]], "Phase Line Blue"] call armatak_fnc_draw_polyline;
|
||||
//
|
||||
// Public: Yes
|
||||
|
||||
params [
|
||||
["_points", [], [[]]],
|
||||
["_callsign", "ArmaTAK Line", [""]],
|
||||
["_closed", false, [true]],
|
||||
["_staleSeconds", 86400, [0]],
|
||||
["_strokeColor", -1, [0]],
|
||||
["_fillColor", -1761607681, [0]],
|
||||
["_strokeWeight", 3, [0]],
|
||||
["_strokeStyle", "solid", [""]],
|
||||
["_milsym", "", [""]],
|
||||
["_cotType", "u-d-f", [""]]
|
||||
];
|
||||
|
||||
if ((count _points) < 2) exitWith {""};
|
||||
|
||||
private _pointStrings = [];
|
||||
private _center = [];
|
||||
|
||||
{
|
||||
private _position = if (_x isEqualType objNull) then {
|
||||
getPos _x
|
||||
} else {
|
||||
_x
|
||||
};
|
||||
|
||||
if ((count _position) >= 2) then {
|
||||
private _altitude = _position param [2, 0, [0]];
|
||||
private _realLocation = [_position select 0, _position select 1, _altitude] call armatak_client_fnc_convertClientLocation;
|
||||
_pointStrings pushBack format ["%1,%2,%3", _realLocation select 0, _realLocation select 1, _realLocation select 2];
|
||||
|
||||
if (_center isEqualTo []) then {
|
||||
_center = _realLocation;
|
||||
};
|
||||
};
|
||||
} forEach _points;
|
||||
|
||||
if ((count _pointStrings) < 2) exitWith {""};
|
||||
|
||||
private _uuid = "armatak" callExtension ["uuid", []] select 0;
|
||||
private _payload = [
|
||||
_uuid,
|
||||
_cotType,
|
||||
_center select 0,
|
||||
_center select 1,
|
||||
_center select 2,
|
||||
_pointStrings joinString ";",
|
||||
_callsign,
|
||||
_staleSeconds max 1,
|
||||
_strokeColor,
|
||||
_fillColor,
|
||||
_strokeWeight max 1,
|
||||
_strokeStyle,
|
||||
_closed,
|
||||
_milsym
|
||||
];
|
||||
|
||||
"armatak" callExtension ["tcp_socket:draw:free", [_payload]];
|
||||
89
addons/main/functions/api/fn_draw_rectangle.sqf
Normal file
89
addons/main/functions/api/fn_draw_rectangle.sqf
Normal file
@@ -0,0 +1,89 @@
|
||||
// function name: armatak_fnc_draw_rectangle
|
||||
// function author: Valmo
|
||||
// function description: Sends an ATAK Drawing Tools rectangle CoT from an Arma center, width, length, and bearing.
|
||||
//
|
||||
// Arguments:
|
||||
// 0: Center position or object <ARRAY|OBJECT>
|
||||
// 1: Width in meters <NUMBER>
|
||||
// 2: Length in meters <NUMBER>
|
||||
// 3: Bearing in degrees <NUMBER> (default: 0)
|
||||
// 4: Callsign/title <STRING> (default: "ArmaTAK Rectangle")
|
||||
// 5: Stale time in seconds <NUMBER> (default: 86400)
|
||||
// 6: Stroke color as signed ARGB int <NUMBER> (default: -1)
|
||||
// 7: Fill color as signed ARGB int <NUMBER> (default: -1761607681)
|
||||
// 8: Stroke weight <NUMBER> (default: 3)
|
||||
// 9: MilSym SIDC for tactical overlay <STRING> (default: "")
|
||||
//
|
||||
// Example:
|
||||
// [screenToWorld [0.5, 0.5], 200, 500, 30, "Engagement Area"] call armatak_fnc_draw_rectangle;
|
||||
//
|
||||
// Public: Yes
|
||||
|
||||
params [
|
||||
["_center", objNull, [objNull, []]],
|
||||
["_width", 100, [0]],
|
||||
["_length", 100, [0]],
|
||||
["_bearing", 0, [0]],
|
||||
["_callsign", "ArmaTAK Rectangle", [""]],
|
||||
["_staleSeconds", 86400, [0]],
|
||||
["_strokeColor", -1, [0]],
|
||||
["_fillColor", -1761607681, [0]],
|
||||
["_strokeWeight", 3, [0]],
|
||||
["_milsym", "", [""]]
|
||||
];
|
||||
|
||||
private _centerPos = if (_center isEqualType objNull) then {
|
||||
getPos _center
|
||||
} else {
|
||||
_center
|
||||
};
|
||||
|
||||
if ((count _centerPos) < 2) exitWith {""};
|
||||
|
||||
private _altitude = _centerPos param [2, 0, [0]];
|
||||
private _halfWidth = (_width max 1) / 2;
|
||||
private _halfLength = (_length max 1) / 2;
|
||||
private _sin = sin _bearing;
|
||||
private _cos = cos _bearing;
|
||||
private _forward = [_sin, _cos, 0];
|
||||
private _right = [_cos, -_sin, 0];
|
||||
private _offsets = [
|
||||
[(_right vectorMultiply -_halfWidth), (_forward vectorMultiply _halfLength)],
|
||||
[(_right vectorMultiply _halfWidth), (_forward vectorMultiply _halfLength)],
|
||||
[(_right vectorMultiply _halfWidth), (_forward vectorMultiply -_halfLength)],
|
||||
[(_right vectorMultiply -_halfWidth), (_forward vectorMultiply -_halfLength)]
|
||||
];
|
||||
private _points = [];
|
||||
|
||||
{
|
||||
private _offset = (_x select 0) vectorAdd (_x select 1);
|
||||
_points pushBack ([_centerPos select 0, _centerPos select 1, _altitude] vectorAdd _offset);
|
||||
} forEach _offsets;
|
||||
|
||||
private _centerReal = [_centerPos select 0, _centerPos select 1, _altitude] call armatak_client_fnc_convertClientLocation;
|
||||
private _pointStrings = [];
|
||||
|
||||
{
|
||||
private _realLocation = [_x select 0, _x select 1, _x select 2] call armatak_client_fnc_convertClientLocation;
|
||||
_pointStrings pushBack format ["%1,%2,%3", _realLocation select 0, _realLocation select 1, _realLocation select 2];
|
||||
} forEach _points;
|
||||
|
||||
private _uuid = "armatak" callExtension ["uuid", []] select 0;
|
||||
private _payload = [
|
||||
_uuid,
|
||||
"u-d-r",
|
||||
_centerReal select 0,
|
||||
_centerReal select 1,
|
||||
_centerReal select 2,
|
||||
_pointStrings joinString ";",
|
||||
_callsign,
|
||||
_staleSeconds max 1,
|
||||
_strokeColor,
|
||||
_fillColor,
|
||||
_strokeWeight max 1,
|
||||
"solid",
|
||||
false,
|
||||
_milsym
|
||||
];
|
||||
|
||||
"armatak" callExtension ["tcp_socket:draw:rectangle", [_payload]];
|
||||
75
addons/main/functions/api/fn_draw_tactical_graphic.sqf
Normal file
75
addons/main/functions/api/fn_draw_tactical_graphic.sqf
Normal file
@@ -0,0 +1,75 @@
|
||||
// function name: armatak_fnc_draw_tactical_graphic
|
||||
// function author: Valmo
|
||||
// function description: Sends an ATAK Drawing Tools shape with a MilSym tactical graphic overlay.
|
||||
//
|
||||
// Arguments:
|
||||
// 0: Positions or objects <ARRAY>
|
||||
// 1: MilSym SIDC <STRING>
|
||||
// 2: Callsign/title <STRING> (default: "ArmaTAK Tactical Graphic")
|
||||
// 3: Closed polygon <BOOL> (default: false)
|
||||
// 4: Stale time in seconds <NUMBER> (default: 86400)
|
||||
// 5: Stroke color as signed ARGB int <NUMBER> (default: -1)
|
||||
// 6: Fill color as signed ARGB int <NUMBER> (default: -1761607681)
|
||||
// 7: Stroke weight <NUMBER> (default: 3)
|
||||
//
|
||||
// Example:
|
||||
// [[pos player, screenToWorld [0.5, 0.5]], "GFGPOLAGM-----X", "Axis of Advance"] call armatak_fnc_draw_tactical_graphic;
|
||||
//
|
||||
// Public: Yes
|
||||
|
||||
params [
|
||||
["_points", [], [[]]],
|
||||
["_milsym", "", [""]],
|
||||
["_callsign", "ArmaTAK Tactical Graphic", [""]],
|
||||
["_closed", false, [true]],
|
||||
["_staleSeconds", 86400, [0]],
|
||||
["_strokeColor", -1, [0]],
|
||||
["_fillColor", -1761607681, [0]],
|
||||
["_strokeWeight", 3, [0]]
|
||||
];
|
||||
|
||||
if (_milsym isEqualTo "") exitWith {""};
|
||||
if ((count _points) < 2) exitWith {""};
|
||||
|
||||
private _pointStrings = [];
|
||||
private _center = [];
|
||||
|
||||
{
|
||||
private _position = if (_x isEqualType objNull) then {
|
||||
getPos _x
|
||||
} else {
|
||||
_x
|
||||
};
|
||||
|
||||
if ((count _position) >= 2) then {
|
||||
private _altitude = _position param [2, 0, [0]];
|
||||
private _realLocation = [_position select 0, _position select 1, _altitude] call armatak_client_fnc_convertClientLocation;
|
||||
_pointStrings pushBack format ["%1,%2,%3", _realLocation select 0, _realLocation select 1, _realLocation select 2];
|
||||
|
||||
if (_center isEqualTo []) then {
|
||||
_center = _realLocation;
|
||||
};
|
||||
};
|
||||
} forEach _points;
|
||||
|
||||
if ((count _pointStrings) < 2) exitWith {""};
|
||||
|
||||
private _uuid = "armatak" callExtension ["uuid", []] select 0;
|
||||
private _payload = [
|
||||
_uuid,
|
||||
"u-d-f",
|
||||
_center select 0,
|
||||
_center select 1,
|
||||
_center select 2,
|
||||
_pointStrings joinString ";",
|
||||
_callsign,
|
||||
_staleSeconds max 1,
|
||||
_strokeColor,
|
||||
_fillColor,
|
||||
_strokeWeight max 1,
|
||||
"solid",
|
||||
_closed,
|
||||
_milsym
|
||||
];
|
||||
|
||||
"armatak" callExtension ["tcp_socket:draw:vector", [_payload]];
|
||||
Reference in New Issue
Block a user