diff --git a/Designing/Main.lua b/Designing/Main.lua index c37aedc..022c7cb 100644 --- a/Designing/Main.lua +++ b/Designing/Main.lua @@ -64,15 +64,15 @@ local SashJointType = WIN_JNT.FULL_V local vSashJoints = { SashJointType, SashJointType, SashJointType, SashJointType} -- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPES.RECT, vFrameJoints, WindowWidth, WindowHeight) - local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPES.CHAMFER_SIDE, vFrameJoints, WindowWidth, WindowHeight, WindowHeight + 500) +-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPES.CHAMFER_SIDE, vFrameJoints, WindowWidth, WindowHeight, WindowHeight + 500) -- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPES.CHAMFER_SIDE, vFrameJoints, WindowWidth, WindowHeight + 500, WindowHeight) -- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPES.ROUND_ARC, vFrameJoints, WindowWidth, WindowHeight) -- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPES.SEGMENTAL_ARC, { FrameJointType, FrameJointType, FrameJointType, FrameJointType}, 1500, 1800, 2200) -- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPES.CHAMFER, { FrameJointType, FrameJointType, FrameJointType, FrameJointType, FrameJointType}, WindowWidth, WindowHeight, WindowHeight + 500) --- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPES.POINTED_ARC, { FrameJointType, FrameJointType, FrameJointType, FrameJointType, FrameJointType}, 900, 1500, 2100) + local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPES.POINTED_ARC, { FrameJointType, FrameJointType, FrameJointType, FrameJointType, FrameJointType}, 900, 1500, 2100) ------------------------ Aggiunta split a griglia ------------------------ - WinCreate.AddGridSplits( nFrameId, WIN_MEASURE.ABSOLUT, { 900, 900}, {500, 500}, false) + WinCreate.AddGridSplits( nFrameId, WIN_MEASURE.ABSOLUT, {100, 300, 100, 300}, {500, 600, 850}, false) -- WinCreate.AddGridSplits( nFrameId, WIN_MEASURE.PERCENTAGE, {0.33, 0.33}, {0.3, 0.3}, true) -- WinCreate.AddGridSplits( nFrameId, WIN_MEASURE.PROPORTIONAL, {2, 1, 1, 1}, {1, 2, 1, 2, 1}, true) diff --git a/Designing/WinLib/WinCreate.lua b/Designing/WinLib/WinCreate.lua index 025e2bc..f756de5 100644 --- a/Designing/WinLib/WinCreate.lua +++ b/Designing/WinLib/WinCreate.lua @@ -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]) diff --git a/Designing/WinOpenProjectFile.lua b/Designing/WinOpenProjectFile.lua index d2a296b..cb6ecb8 100644 --- a/Designing/WinOpenProjectFile.lua +++ b/Designing/WinOpenProjectFile.lua @@ -15,7 +15,7 @@ require( 'EgtBase') _ENV = EgtProtectGlobal() -EgtEnableDebug( false) +EgtEnableDebug( true) -- Imposto direttorio per librerie local sBaseDir = EgtGetSourceDir()