DataWindow :
- in WinGetAreaProfiles aggiunta gestione degli split.
This commit is contained in:
@@ -44,12 +44,14 @@ WIN_SASH_SHAPES = {
|
||||
}
|
||||
|
||||
-- direzioni di split
|
||||
WIN_SPLIT_DIR = 'SplitOrientation'
|
||||
WIN_SPLITORIENTATION = {
|
||||
VERTICAL = 1,
|
||||
HORIZONTAL = 2,
|
||||
}
|
||||
|
||||
-- tipi di misure
|
||||
WIN_MEASURE_TYPE = 'MeasureType'
|
||||
WIN_MEASURE = {
|
||||
ABSOLUTE = 1,
|
||||
PROPORTIONAL = 2,
|
||||
@@ -194,7 +196,12 @@ WIN_SLIDE_WINDOW = 'SlideWindow'
|
||||
WIN_SASH_NBR = 'SashNbr'
|
||||
WIN_AREA_NBR = 'AreaNbr'
|
||||
WIN_AREA_PROFILES = 'AreaProfiles'
|
||||
|
||||
WIN_MEASURE_VALUE = 'MeasureValue'
|
||||
WIN_GRIDSPLIT_ORDER = 'GridSplitOrder'
|
||||
WIN_SPLIT_POSITION = 'SplitPosition'
|
||||
WIN_SPLIT_REF_DIM = 'SplitRefDim'
|
||||
WIN_SPLIT_OFFS = 'SplitOffs'
|
||||
WIN_GRID_SPLIT = 'GridSplit'
|
||||
|
||||
-- PROFILI
|
||||
WIN_PROFILE = 'Profile'
|
||||
@@ -213,6 +220,7 @@ WIN_FILL_RAIL = 'Fill_Rail'
|
||||
WIN_FRAME_SPLIT = 'Frame_Split'
|
||||
WIN_SASH_VERTICAL = 'Sash_Vertical'
|
||||
WIN_SASH_HORIZONTAL = 'Sash_Horizontal'
|
||||
WIN_MIXED = 'Mixed'
|
||||
WIN_MIXED_BOTTOM = 'Mixed_Bottom'
|
||||
WIN_MIXED_TOP = 'Mixed_Top'
|
||||
WIN_MIXED_SPLIT = 'Mixed_Split'
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -400,7 +400,7 @@ end
|
||||
-- funzione che assegna il nome alla curva di split nella sottoarea in base alla sua direzione
|
||||
local function SetSplitName( nSplitId)
|
||||
|
||||
local vtMedia = ( ( EgtEV( nSplitId) - EgtSV( nSplitId)) / 2)
|
||||
local vtMedia = ( ( EgtEV( nSplitId) + EgtSV( nSplitId)) / 2)
|
||||
if not vtMedia:normalize() then
|
||||
vtMedia = EgtSV( nSplitId)
|
||||
end
|
||||
@@ -642,6 +642,7 @@ local function CalcSplitCurves( nLayerId, b3OutlineLayer, b3Limit, nSplitType, v
|
||||
if nSplitCrv then
|
||||
EgtSetName( nSplitCrv, WIN_SPLIT)
|
||||
table.insert( vSplitCurves, nSplitCrv)
|
||||
EgtSetInfo( nSplitCrv, WIN_SPLIT_POSITION, dPosition)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -657,6 +658,9 @@ function WinCreate.AddSplits( nParentAreaId, nSplitType, vMeasureTypes, vValues,
|
||||
return
|
||||
end
|
||||
|
||||
local nParentOutlineLayerId = EgtGetFirstNameInGroup( nParentAreaId, WIN_AREAOUTLINE)
|
||||
local b3OutlineLayer = EgtGetBBox( nParentOutlineLayerId, GDB_BB.STANDARD)
|
||||
|
||||
-- creo area di split
|
||||
local nAreaId = EgtGroup( nParentAreaId)
|
||||
EgtSetInfo( nAreaId, WIN_AREATYPE, WIN_AREATYPES.SPLIT)
|
||||
@@ -664,7 +668,11 @@ function WinCreate.AddSplits( nParentAreaId, nSplitType, vMeasureTypes, vValues,
|
||||
if nAreaNbr then
|
||||
EgtSetInfo( nAreaId, WIN_AREA_NBR, nAreaNbr)
|
||||
end
|
||||
|
||||
EgtSetInfo( nAreaId, WIN_SPLIT_DIR, nSplitType)
|
||||
EgtSetInfo( nAreaId, WIN_MEASURE_TYPE, vMeasureTypes)
|
||||
EgtSetInfo( nAreaId, WIN_MEASURE_VALUE, vValues)
|
||||
EgtSetInfo( nAreaId, WIN_SPLIT_REF_DIM, EgtIf( nSplitType == WIN_SPLITORIENTATION.VERTICAL, b3OutlineLayer:getDimX(), b3OutlineLayer:getDimY()))
|
||||
|
||||
-- creo layer per split
|
||||
local nSplitLayerId = EgtGroup( nAreaId)
|
||||
EgtSetName( nSplitLayerId, WIN_BASESPLIT)
|
||||
@@ -674,8 +682,6 @@ function WinCreate.AddSplits( nParentAreaId, nSplitType, vMeasureTypes, vValues,
|
||||
end
|
||||
|
||||
-- creo le curve di split
|
||||
local nParentOutlineLayerId = EgtGetFirstNameInGroup( nParentAreaId, WIN_AREAOUTLINE)
|
||||
local b3OutlineLayer = EgtGetBBox( nParentOutlineLayerId, GDB_BB.STANDARD)
|
||||
local vSplitCurves = CalcSplitCurves( nSplitLayerId, b3OutlineLayer, b3OutlineLayer, nSplitType, vMeasureTypes, vValues)
|
||||
|
||||
-- se non ci sono curve valide cancello tutto ed esco
|
||||
@@ -710,6 +716,7 @@ function WinCreate.AddGridSplits( nParentAreaId, vVertMeasureTypes, vVertValues,
|
||||
if nAreaNbr then
|
||||
EgtSetInfo( nAreaId, WIN_AREA_NBR, nAreaNbr)
|
||||
end
|
||||
EgtSetInfo( nAreaId, WIN_GRID_SPLIT, true)
|
||||
|
||||
-- copio il contorno dall'area parent e setto opportune corrispondenze sou/child
|
||||
local nOutlineLayerId = CopyParentOutline( nAreaId, nParentAreaId)
|
||||
@@ -734,11 +741,20 @@ function WinCreate.AddGridSplits( nParentAreaId, vVertMeasureTypes, vVertValues,
|
||||
nMainSplitOrientation = WIN_SPLITORIENTATION.HORIZONTAL
|
||||
vOtherTypes = vVertMeasureTypes
|
||||
vOtherValues = vVertValues
|
||||
nOtherSplitOrientation = WIN_SPLITORIENTATION.VERTICAL
|
||||
nOtherSplitOrientation = WIN_SPLITORIENTATION.VERTICAL
|
||||
end
|
||||
|
||||
|
||||
-- salvo i dati dello split principale nell'area principale, i dati dello split secondario verranno salvati nelle aree virtuali
|
||||
EgtSetInfo( nAreaId, WIN_SPLIT_DIR, nMainSplitOrientation)
|
||||
EgtSetInfo( nAreaId, WIN_MEASURE_TYPE, vMainTypes)
|
||||
EgtSetInfo( nAreaId, WIN_MEASURE_VALUE, vMainValues)
|
||||
EgtSetInfo( nAreaId, WIN_SPLIT_REF_DIM, EgtIf( nMainSplitOrientation == WIN_SPLITORIENTATION.VERTICAL, b3OutlineLayer:getDimX(), b3OutlineLayer:getDimY()))
|
||||
|
||||
-- calcolo la suddivisione nella direzione principale
|
||||
local vMainSplit = CalcSplitCurves( nSplitLayerId, b3OutlineLayer, b3OutlineLayer, nMainSplitOrientation, vMainTypes, vMainValues)
|
||||
for i = 1, #vMainSplit do
|
||||
EgtSetInfo( vMainSplit[i], WIN_GRIDSPLIT_ORDER, 0)
|
||||
end
|
||||
local vMainAreas = CreateAreasFromSplits( nAreaId, vMainSplit)
|
||||
|
||||
-- per ogni area della direzione principale calcolo la suddivisione nella direzione secondaria
|
||||
@@ -750,6 +766,10 @@ function WinCreate.AddGridSplits( nParentAreaId, vVertMeasureTypes, vVertValues,
|
||||
-- calcolo gli split nella direzione secondaria
|
||||
local vOtherSplit = CalcSplitCurves( nSplitLayerId, b3OutlineLayer, b3Limit, nOtherSplitOrientation, vOtherTypes, vOtherValues)
|
||||
if #vOtherSplit > 0 then
|
||||
for j = 1, #vOtherSplit do
|
||||
EgtSetInfo( vOtherSplit[j], WIN_GRIDSPLIT_ORDER, tostring( i))
|
||||
end
|
||||
-- calcolo le aree generate dagli split secondari
|
||||
local vNewAreas = CreateAreasFromSplits( vMainAreas[i], vOtherSplit)
|
||||
AreaResult = EgtJoinTables( AreaResult, vNewAreas)
|
||||
end
|
||||
@@ -760,9 +780,14 @@ function WinCreate.AddGridSplits( nParentAreaId, vVertMeasureTypes, vVertValues,
|
||||
EgtRelocateGlob( AreaResult[i], nAreaId)
|
||||
EgtSetName( AreaResult[i], WIN_AREA .. EgtNumToString( i))
|
||||
end
|
||||
-- le aree dello split principale diventano aree virtuali ausiliarie per i conti
|
||||
-- le aree generate dallo split principale diventano aree virtuali ausiliarie per i conti
|
||||
-- riporto come info quelle legate allo split secondario
|
||||
for i = 1, #vMainAreas do
|
||||
EgtSetName( vMainAreas[i], WIN_VIRTUAL_AREA)
|
||||
EgtSetInfo( vMainAreas[i], WIN_SPLIT_DIR, nOtherSplitOrientation)
|
||||
EgtSetInfo( vMainAreas[i], WIN_MEASURE_TYPE, vOtherTypes)
|
||||
EgtSetInfo( vMainAreas[i], WIN_MEASURE_VALUE, vOtherValues)
|
||||
EgtSetInfo( vMainAreas[i], WIN_SPLIT_REF_DIM, EgtIf( nOtherSplitOrientation == WIN_SPLITORIENTATION.VERTICAL, b3OutlineLayer:getDimX(), b3OutlineLayer:getDimY()))
|
||||
end
|
||||
|
||||
return AreaResult
|
||||
|
||||
@@ -493,7 +493,7 @@ _G.WinGetSashShape = WinGetSashShape
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
local function WinGetAreaProfiles()
|
||||
-- restituisce una lista dove ogni elemento è una tabella con le seguenti chiavi : GroupId = AREANBR corrispondente, SashId = eventuale sashnbr ( se telaio -1),
|
||||
-- restituisce una lista dove ogni elemento è una tabella con le seguenti chiavi : GroupId = AREANBR corrispondente, EntId = sottoentità ( e.g. anta, area di split a griglia),
|
||||
-- Profiles = lista dei profili dei pezzi di quell'area
|
||||
|
||||
-- recupero gli id geometrici delle aree richieste
|
||||
@@ -506,22 +506,39 @@ local function WinGetAreaProfiles()
|
||||
if vAreaIds[i] ~= GDB_ID.NULL then
|
||||
local nAreaType = EgtGetInfo( vAreaIds[i], WIN_AREATYPE, 'i')
|
||||
if nAreaType == WIN_AREATYPES.FRAME then
|
||||
table.insert( tabProfiles, { GroupId = vAreaNbrs[i], SashId = -1, Profiles = EgtGetInfo( vAreaIds[i], WIN_AREA_PROFILES, 'vs')})
|
||||
table.insert( tabProfiles, { GroupId = vAreaNbrs[i], EntId = -1, Profiles = EgtGetInfo( vAreaIds[i], WIN_AREA_PROFILES, 'vs')})
|
||||
|
||||
elseif nAreaType == WIN_AREATYPES.SASH then
|
||||
table.insert( tabProfiles, { GroupId = vAreaNbrs[i], SashId = 1, Profiles = EgtGetInfo( vAreaIds[i], WIN_AREA_PROFILES, 'vs')})
|
||||
table.insert( tabProfiles, { GroupId = vAreaNbrs[i], EntId = 1, Profiles = EgtGetInfo( vAreaIds[i], WIN_AREA_PROFILES, 'vs')})
|
||||
|
||||
elseif nAreaType == WIN_AREATYPES.SPLIT then
|
||||
local nSplitLayId = EgtGetFirstNameInGroup( vAreaIds[i], WIN_SPLIT)
|
||||
local nSplitType = EgtGetInfo( nSplitLayId, WIN_SPLITTYPE, 'i')
|
||||
-- se french split devo recuperare le ante che definisce
|
||||
if nSplitType == WIN_SPLITTYPES.FRENCH then
|
||||
-- se french split devo recuperare le ante che definisce
|
||||
local vSashes = EgtGetNameInGroup( vAreaIds[i], WIN_AREA .. '*')
|
||||
for j = 1, #vSashes do
|
||||
local nSashId = EgtGetInfo( vSashes[j], WIN_SASH_NBR, 'i')
|
||||
table.insert( tabProfiles, { GroupId = vAreaNbrs[i], SashId = nSashId, Profiles = EgtGetInfo( vSashes[j], WIN_AREA_PROFILES, 'vs')})
|
||||
table.insert( tabProfiles, { GroupId = vAreaNbrs[i], EntId = nSashId, Profiles = EgtGetInfo( vSashes[j], WIN_AREA_PROFILES, 'vs')})
|
||||
end
|
||||
|
||||
-- se split standard recupero i profili
|
||||
else
|
||||
local bGridSplit = EgtGetInfo( vAreaIds[i], WIN_GRID_SPLIT, 'b') or false
|
||||
if bGridSplit then
|
||||
-- distinguo per ordine di split
|
||||
local nOrder = 0
|
||||
local vProfiles = EgtGetInfo( vAreaIds[i], WIN_AREA_PROFILES .. tostring( nOrder), 'vs')
|
||||
while vProfiles do
|
||||
table.insert( tabProfiles, { GroupId = vAreaNbrs[i], EntId = nOrder, Profiles = vProfiles})
|
||||
nOrder = nOrder + 1
|
||||
vProfiles = EgtGetInfo( vAreaIds[i], WIN_AREA_PROFILES .. tostring( nOrder), 'vs')
|
||||
end
|
||||
else
|
||||
table.insert( tabProfiles, { GroupId = vAreaNbrs[i], EntId = -1, Profiles = EgtGetInfo( vAreaIds[i], WIN_AREA_PROFILES, 'vs')})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
WDG['AREAPROFILES'] = tabProfiles
|
||||
|
||||
Reference in New Issue
Block a user