Modificato split a griglia (split principale orizzontale)

This commit is contained in:
Annamaria Sassi
2025-09-26 12:03:38 +02:00
parent bec8487ef4
commit bec9c29b2d
3 changed files with 40 additions and 10 deletions
+36 -6
View File
@@ -276,6 +276,10 @@ function WinCreate.AddSplit( nAreaLayerId, SplitType, MeasureType, nPosition, nP
elseif MeasureType == WIN_MEASURE.PERCENTAGE then
nCalcPosition = b3OutlineLayer:getDimX() * nPosition
end
if nCalcPosition > b3OutlineLayer:getDimX() - GEO.EPS_SMALL then
EgtErase( nTempSplitLayerId)
return
end
nTotSplitId = EgtLine( nTempSplitLayerId, b3OutlineLayer:getMin() + X_AX() * nCalcPosition, b3OutlineLayer:getMin() + X_AX() * nCalcPosition + Y_AX() * b3OutlineLayer:getDimY())
elseif SplitType == WIN_SPLITORIENTATION.HORIZONTAL then
-- creo linea
@@ -310,9 +314,11 @@ function WinCreate.AddSplits( nAreaLayerId, SplitType, MeasureType, PositionList
if nIndex > 1 then
EgtSetInfo( nResArea2, WIN_PRJ_ORIGSPLIT, nAreaLayerId)
end
local nCurrentResArea2 = nResArea2
nResArea1, nResArea2 = WinCreate.AddSplit( nResArea2, SplitType, MeasureType, PositionList[nIndex], nProportion, nSplitType)
if not nResArea2 then
return
table.insert( AreaList, nCurrentResArea2)
break
end
table.insert( AreaList, nResArea1)
if nIndex == #PositionList then
@@ -327,9 +333,11 @@ function WinCreate.AddSplits( nAreaLayerId, SplitType, MeasureType, PositionList
if nIndex > 1 then
EgtSetInfo( nResArea2, WIN_PRJ_ORIGSPLIT, nAreaLayerId)
end
local nCurrentResArea2 = nResArea2
nResArea1, nResArea2 = WinCreate.AddSplit( nResArea2, SplitType, MeasureType, PositionList[nIndex], nProportion - dAddPosition, nSplitType)
if not nResArea2 then
return
table.insert( AreaList, nCurrentResArea2)
break
end
table.insert( AreaList, nResArea1)
if nIndex == #PositionList -1 then
@@ -347,9 +355,11 @@ function WinCreate.AddSplits( nAreaLayerId, SplitType, MeasureType, PositionList
EgtSetInfo( nResArea2, WIN_PRJ_ORIGSPLIT, nAreaLayerId)
sChildAreas = sChildAreas .. nResArea2 .. EgtIf( nIndex < #PositionList, ',', '')
end
local nCurrentResArea2 = nResArea2
nResArea1, nResArea2 = WinCreate.AddSplit( nResArea2, SplitType, MeasureType, EgtIf( nIndex == 1, PositionList[nIndex], PositionList[nIndex] / ( 1 - dAddPosition)), nProportion, nSplitType)
if not nResArea2 then
return
table.insert( AreaList, nCurrentResArea2)
break
end
table.insert( AreaList, nResArea1)
if nIndex == #PositionList then
@@ -376,11 +386,12 @@ function WinCreate.AddGridSplits( nAreaLayerId, MeasureType, PositionListVert, P
nProportionHoriz = nProportionHoriz + PositionListHoriz[i]
end
end
-- recupero contorno area precedente
local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREAOUTLINE)
local b3OutlineLayer = EgtGetBBox( nOutlineLayerId, GDB_BB.STANDARD)
if bStartVertical then
local AreaList = WinCreate.AddSplits( nAreaLayerId, WIN_SPLITORIENTATION.VERTICAL, MeasureType, PositionListVert, nProportionVert, nSplitType)
-- recupero contorno area precedente
local nOutlineLayerId = EgtGetFirstNameInGroup( nAreaLayerId, WIN_AREAOUTLINE)
local b3OutlineLayer = EgtGetBBox( nOutlineLayerId, GDB_BB.STANDARD)
-- calcolo gli split orizzontali
local HorizAbs = {}
local dPositionCum = 0
for i = 1, #PositionListHoriz do
@@ -403,6 +414,25 @@ function WinCreate.AddGridSplits( nAreaLayerId, MeasureType, PositionListVert, P
else
local AreaList = WinCreate.AddSplits( nAreaLayerId, WIN_SPLITORIENTATION.HORIZONTAL, MeasureType, PositionListHoriz, nProportionHoriz, nSplitType)
for i = 1, #AreaList do
-- recupero contorno area corrente
local nCurrentOutlineLayerId = EgtGetFirstNameInGroup( AreaList[i], WIN_AREAOUTLINE)
local b3CurrentOutlineLayer = EgtGetBBox( nCurrentOutlineLayerId, GDB_BB.STANDARD)
local dDiff = b3OutlineLayer:getMin():getX() - b3CurrentOutlineLayer:getMin():getX()
if dDiff < - GEO.EPS_SMALL then
local nFirstIndex = #PositionListVert + 1
for k = 1, #PositionListVert do
if PositionListVert[k] + dDiff > GEO.EPS_SMALL then
PositionListVert[k] = PositionListVert[k] + dDiff
nFirstIndex = k
break
elseif k ~= #PositionListVert then
PositionListVert[k + 1] = PositionListVert[k] + PositionListVert[k + 1]
end
end
for k = 1, nFirstIndex - 1 do
table.remove( PositionListVert, 1)
end
end
local AreaTemp = WinCreate.AddSplits( AreaList[i], WIN_SPLITORIENTATION.VERTICAL, MeasureType, PositionListVert, nProportionVert, nSplitType) or {}
for j = 1, #AreaTemp do
table.insert( AreaResult, AreaTemp[j])