Merge branch 'FF/Ops' into FF/OpsDev

This commit is contained in:
Frank
2024-01-04 15:14:25 +01:00
32 changed files with 1336 additions and 79 deletions

View File

@@ -1893,7 +1893,7 @@ end
--- Add a flight control to the data base.
-- @param #DATABASE self
-- @param Ops.FlightControl#FLIGHTCONTROL flightcontrol
-- @param OPS.FlightControl#FLIGHTCONTROL flightcontrol
function DATABASE:AddFlightControl(flightcontrol)
self:F2( { flightcontrol } )
self.FLIGHTCONTROLS[flightcontrol.airbasename]=flightcontrol
@@ -1902,7 +1902,7 @@ end
--- Get a flight control object from the data base.
-- @param #DATABASE self
-- @param #string airbasename Name of the associated airbase.
-- @return Ops.FlightControl#FLIGHTCONTROL The FLIGHTCONTROL object.s
-- @return OPS.FlightControl#FLIGHTCONTROL The FLIGHTCONTROL object.s
function DATABASE:GetFlightControl(airbasename)
return self.FLIGHTCONTROLS[airbasename]
end

View File

@@ -181,7 +181,7 @@ do -- COORDINATE
-- * @{#COORDINATE.ToStringBR}(): Generates a Bearing & Range text in the format of DDD for DI where DDD is degrees and DI is distance.
-- * @{#COORDINATE.ToStringBRA}(): Generates a Bearing, Range & Altitude text.
-- * @{#COORDINATE.ToStringBRAANATO}(): Generates a Generates a Bearing, Range, Aspect & Altitude text in NATOPS.
-- * @{#COORDINATE.ToStringLL}(): Generates a Latutide & Longitude text.
-- * @{#COORDINATE.ToStringLL}(): Generates a Latitude & Longitude text.
-- * @{#COORDINATE.ToStringLLDMS}(): Generates a Lat, Lon, Degree, Minute, Second text.
-- * @{#COORDINATE.ToStringLLDDM}(): Generates a Lat, Lon, Degree, decimal Minute text.
-- * @{#COORDINATE.ToStringMGRS}(): Generates a MGRS grid coordinate text.
@@ -3088,6 +3088,18 @@ do -- COORDINATE
return coord.LOtoLL( self:GetVec3() )
end
--- Get Latitude & Longitude text.
-- @param #COORDINATE self
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.
-- @return #string LLText
function COORDINATE:ToStringLL( Settings )
local LL_Accuracy = Settings and Settings.LL_Accuracy or _SETTINGS.LL_Accuracy
local lat, lon = coord.LOtoLL( self:GetVec3() )
return string.format('%f', lat) .. ' ' .. string.format('%f', lon)
end
--- Provides a Lat Lon string in Degree Minute Second format.
-- @param #COORDINATE self
-- @param Core.Settings#SETTINGS Settings (optional) The settings. Can be nil, and in this case the default settings are used. If you want to specify your own settings, use the _SETTINGS object.

View File

@@ -455,7 +455,7 @@ do -- SET_BASE
--- Gets a random object from the @{Core.Set#SET_BASE} and derived classes.
-- @param #SET_BASE self
-- @return Core.Base#BASE
-- @return Core.Base#BASE or nil if none found or the SET is empty!
function SET_BASE:GetRandom()
local tablemax = 0
for _,_ind in pairs(self.Index) do
@@ -466,6 +466,23 @@ do -- SET_BASE
self:T3( { RandomItem } )
return RandomItem
end
--- Gets a random object from the @{Core.Set#SET_BASE} and derived classes. A bit slower than @{#SET_BASE.GetRandom}() but tries to ensure you get an object back if the SET is not empty.
-- @param #SET_BASE self
-- @return Core.Base#BASE or nil if the SET is empty!
function SET_BASE:GetRandomSurely()
local tablemax = 0
local sorted = {}
for _,_obj in pairs(self.Set) do
tablemax = tablemax + 1
sorted[tablemax] = _obj
end
--local tablemax = table.maxn(self.Index)
--local RandomItem = self.Set[self.Index[math.random(1,tablemax)]]
local RandomItem = sorted[math.random(1,tablemax)]
self:T3( { RandomItem } )
return RandomItem
end
--- Retrieves the amount of objects in the @{Core.Set#SET_BASE} and derived classes.
-- @param #SET_BASE self
@@ -8215,9 +8232,15 @@ do -- SET_SCENERY
-- @param #SET_SCENERY self
-- @return Core.Point#COORDINATE The center coordinate of all the objects in the set.
function SET_SCENERY:GetCoordinate()
local Coordinate = self:GetRandom():GetCoordinate()
local Coordinate = COORDINATE:New({0,0,0})
local Item = self:GetRandomSurely()
if Item then
Coordinate:GetCoordinate()
end
local x1 = Coordinate.x
local x2 = Coordinate.x
local y1 = Coordinate.y