mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
#DATABASE
* Read color, fill color from drawing data
This commit is contained in:
parent
92e03522db
commit
53f89fd42c
@ -489,8 +489,30 @@ do -- Zones and Pathlines
|
||||
-- Create new polygon zone.
|
||||
local Zone=ZONE_POLYGON:NewFromPointsArray(ZoneName, points)
|
||||
|
||||
--Zone.DrawID = objectID
|
||||
|
||||
-- Set color.
|
||||
Zone:SetColor({1, 0, 0}, 0.15)
|
||||
Zone:SetFillColor({1, 0, 0}, 0.15)
|
||||
|
||||
if objectData.colorString then
|
||||
-- eg colorString = 0xff0000ff
|
||||
local color = string.gsub(objectData.colorString,"^0x","")
|
||||
local r = tonumber(string.sub(color,1,2),16)/255
|
||||
local g = tonumber(string.sub(color,3,4),16)/255
|
||||
local b = tonumber(string.sub(color,5,6),16)/255
|
||||
local a = tonumber(string.sub(color,7,8),16)/255
|
||||
Zone:SetColor({r, g, b}, a)
|
||||
end
|
||||
if objectData.fillColorString then
|
||||
-- eg fillColorString = 0xff00004b
|
||||
local color = string.gsub(objectData.colorString,"^0x","")
|
||||
local r = tonumber(string.sub(color,1,2),16)/255
|
||||
local g = tonumber(string.sub(color,3,4),16)/255
|
||||
local b = tonumber(string.sub(color,5,6),16)/255
|
||||
local a = tonumber(string.sub(color,7,8),16)/255
|
||||
Zone:SetFillColor({r, g, b}, a)
|
||||
end
|
||||
|
||||
-- Store in DB.
|
||||
self.ZONENAMES[ZoneName] = ZoneName
|
||||
@ -533,6 +555,25 @@ do -- Zones and Pathlines
|
||||
-- Set color.
|
||||
Zone:SetColor({1, 0, 0}, 0.15)
|
||||
|
||||
if objectData.colorString then
|
||||
-- eg colorString = 0xff0000ff
|
||||
local color = string.gsub(objectData.colorString,"^0x","")
|
||||
local r = tonumber(string.sub(color,1,2),16)/255
|
||||
local g = tonumber(string.sub(color,3,4),16)/255
|
||||
local b = tonumber(string.sub(color,5,6),16)/255
|
||||
local a = tonumber(string.sub(color,7,8),16)/255
|
||||
Zone:SetColor({r, g, b}, a)
|
||||
end
|
||||
if objectData.fillColorString then
|
||||
-- eg fillColorString = 0xff00004b
|
||||
local color = string.gsub(objectData.colorString,"^0x","")
|
||||
local r = tonumber(string.sub(color,1,2),16)/255
|
||||
local g = tonumber(string.sub(color,3,4),16)/255
|
||||
local b = tonumber(string.sub(color,5,6),16)/255
|
||||
local a = tonumber(string.sub(color,7,8),16)/255
|
||||
Zone:SetFillColor({r, g, b}, a)
|
||||
end
|
||||
|
||||
-- Store in DB.
|
||||
self.ZONENAMES[ZoneName] = ZoneName
|
||||
|
||||
@ -756,7 +797,7 @@ end -- cargo
|
||||
|
||||
--- Finds a CLIENT based on the ClientName.
|
||||
-- @param #DATABASE self
|
||||
-- @param #string ClientName
|
||||
-- @param #string ClientName - Note this is the UNIT name of the client!
|
||||
-- @return Wrapper.Client#CLIENT The found CLIENT.
|
||||
function DATABASE:FindClient( ClientName )
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user