DataWindow :

- in WinGetAreaProfiles aggiunta gestione degli split.
This commit is contained in:
SaraP
2026-01-28 15:43:21 +01:00
parent 68425bd133
commit b8b10497a7
4 changed files with 131 additions and 25 deletions
+67 -11
View File
@@ -1658,7 +1658,6 @@ local function CalculateOutlineFromAreaOutline( nAreaId)
-- FRAME
if nAreaType == WIN_AREATYPES.FRAME then
-- sistemo le info
local vProfiles = {}
local nAreaOutlineId = EgtGetFirstInGroup( nAreaOutlineLayerId)
while nAreaOutlineId do
local nOutlineId = EgtCopyGlob( nAreaOutlineId, nOutlineLayerId)
@@ -1668,13 +1667,9 @@ local function CalculateOutlineFromAreaOutline( nAreaId)
if EgtGetName( nOutlineId) == WIN_BOTTOM then
CopyInfo( nOutlineId, nAreaId, WIN_BOTTOMRAIL)
end
local sProfile = WIN_FRAME .. '_' .. EgtGetInfo( nOutlineId, WIN_PROFILETYPE)
table.insert( vProfiles, sProfile)
nAreaOutlineId = EgtGetNext( nAreaOutlineId)
end
GetPrevNextOutline( nOutlineLayerId)
-- assegno i profili all'area
EgtSetInfo( nAreaId, WIN_AREA_PROFILES, vProfiles)
-- SPLIT / NULL
elseif nAreaType == WIN_AREATYPES.SPLIT or nAreaType == WIN_AREATYPES.NULL then
@@ -1803,12 +1798,6 @@ local function CalculateOutlineFromAreaOutline( nAreaId)
local vOutlines = TrimOrderedCurves( EgtGetAllInGroup( nOutlineLayerId), 1)
-- assegno prev e next
GetPrevNextOutline( nOutlineLayerId)
-- assegno i profili all'area
local vProfiles = {}
for i = 1, #vOutlines do
vProfiles[i] = WIN_SASH .. '_' .. EgtGetInfo( vOutlines[i], WIN_PROFILETYPE)
end
EgtSetInfo( nAreaId, WIN_AREA_PROFILES, vProfiles)
-- FILL
elseif nAreaType == WIN_AREATYPES.FILL then
@@ -1830,6 +1819,72 @@ local function CalculateAreaOutline( nAreaId)
end
end
---------------------------------------------------------------------
-- funzione che cicla ricorsivamente su aree e sottoaree per assegnare i profili all'area
local function SetAreaProfiles( nAreaId)
local nAreaType = EgtGetInfo( nAreaId, WIN_AREATYPE, 'i')
if nAreaType == WIN_AREATYPES.FRAME or nAreaType == WIN_AREATYPES.SASH then
-- recupero i profili dalle curve di outline
local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_OUTLINE)
local vOutlines = EgtGetAllInGroup( nOutlineLayerId)
local sAreaName = EgtIf( nAreaType == WIN_AREATYPES.FRAME, WIN_FRAME, WIN_SASH)
local vProfiles = {}
for i = 1, #vOutlines do
vProfiles[i] = sAreaName .. '_' .. EgtGetInfo( vOutlines[i], WIN_PROFILETYPE)
end
EgtSetInfo( nAreaId, WIN_AREA_PROFILES, vProfiles)
elseif nAreaType == WIN_AREATYPES.SPLIT then
local nSplitLayerId = EgtGetFirstNameInGroup( nAreaId, WIN_SPLIT)
local nSplitType = EgtGetInfo( nSplitLayerId, WIN_SPLITTYPE, 'i')
if nSplitType ~= WIN_SPLITTYPES.FRENCH then
-- recupero area parent per capire se dentro telaio o anta
local nParentAreaId = EgtGetParent( nAreaId)
local nParentAreaType = EgtGetInfo( nParentAreaId, WIN_AREATYPE, 'i')
while nParentAreaType ~= WIN_AREATYPES.FRAME and nParentAreaType ~= WIN_AREATYPES.SASH do
nParentAreaId = EgtGetParent( nParentAreaId)
nParentAreaType = EgtGetInfo( nParentAreaId, WIN_AREATYPE, 'i')
end
local sAreaName = EgtIf( nParentAreaType == WIN_AREATYPES.FRAME, WIN_FRAME, WIN_SASH)
local vSplitIds = EgtGetAllInGroup( nSplitLayerId)
local bGridSplit = EgtGetInfo( nAreaId, WIN_GRID_SPLIT, 'b') or false
if bGridSplit then
-- recupero i profili distinguendoli per ordine di split
local tabProfiles = {}
for i = 1, #vSplitIds do
local nOrder = EgtGetInfo( vSplitIds[i], WIN_GRIDSPLIT_ORDER, 'i')
local sProfile = sAreaName .. EgtGetInfo( vSplitIds[i], WIN_PROFILETYPE)
if tabProfiles[nOrder+1] then
table.insert( tabProfiles[nOrder+1], sProfile)
else
tabProfiles[nOrder+1] = { sProfile}
end
end
-- salvo in info separate
for i = 1, #tabProfiles do
EgtSetInfo( nAreaId, WIN_AREA_PROFILES .. tostring( i-1), tabProfiles[i])
end
else
-- recupero tutti i profili degli split
local vProfiles = {}
for i = 1, #vSplitIds do
vProfiles[i] = sAreaName .. '_' .. EgtGetInfo( vSplitIds[i], WIN_PROFILETYPE)
end
EgtSetInfo( nAreaId, WIN_AREA_PROFILES, vProfiles)
end
end
end
-- analizzo le sottoaree
local nChildAreaId = EgtGetFirstNameInGroup( nAreaId, WIN_AREA .. '*')
while nChildAreaId do
SetAreaProfiles( nChildAreaId)
nChildAreaId = EgtGetNextName( nChildAreaId, WIN_AREA .. '*')
end
end
----------------------------------------------------------------------------------
@@ -7285,6 +7340,7 @@ function WinCalculate.CreatePartFromArea( nFrameId)
CalculateAreaProfileType( nFrameId)
-- calcolo outline a partire dal base outline
CalculateAreaOutline( nFrameId)
SetAreaProfiles( nFrameId)
-- creo pezzi
s_nSashNbr = 0 -- resetto il numero di ante del progetto
CalculateAreaParts( nFrameId)