Aggiunto gestione Split Grid
This commit is contained in:
+20
-15
@@ -44,7 +44,7 @@ local WindowHeight = 2000
|
||||
|
||||
local WindowTree
|
||||
|
||||
local sProfilePath = 'c:\\EgtData\\EgwWindowLua\\Profiles\\Profilo78 - Offset.nge'
|
||||
local sProfilePath = 'C:\\EgtData\\EgtWindowMaker\\Profiles\\Profilo78.nge'
|
||||
|
||||
------------------------------------------- ************** -------------------------------------------
|
||||
|
||||
@@ -63,13 +63,18 @@ local vFrameJoints = { FrameJointType, FrameJointType, FrameJointType, FrameJoin
|
||||
local SashJointType = WIN_JNT.FULL_V
|
||||
local vSashJoints = { SashJointType, SashJointType, SashJointType, SashJointType}
|
||||
|
||||
local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.RECT, vFrameJoints, WindowWidth, WindowHeight)
|
||||
-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.CHAMFER_SIDE, vFrameJoints, WindowWidth, WindowHeight, WindowHeight + 500)
|
||||
-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.CHAMFER_SIDE, vFrameJoints, WindowWidth, WindowHeight + 500, WindowHeight)
|
||||
-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.ROUND_ARC, vFrameJoints, WindowWidth, WindowHeight)
|
||||
-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.SEGMENTAL_ARC, { FrameJointType, FrameJointType, FrameJointType, FrameJointType}, 1500, 1800, 2200)
|
||||
-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.CHAMFER, { FrameJointType, FrameJointType, FrameJointType, FrameJointType, FrameJointType}, WindowWidth, WindowHeight, WindowHeight + 500)
|
||||
-- local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.POINTED_ARC, { FrameJointType, FrameJointType, FrameJointType, FrameJointType, FrameJointType}, 900, 1500, 2100)
|
||||
-- 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 + 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)
|
||||
|
||||
------------------------ Aggiunta split a griglia ------------------------
|
||||
-- WinCreate.AddGridSplits( nFrameId, WIN_MEASURE.ABSOLUT, {900, 900}, {500, 500, 500, 600, 150, 150}, true, 1)
|
||||
WinCreate.AddGridSplits( nFrameId, WIN_MEASURE.PERCENTAGE, {0.33, 0.33}, {0.3, 0.3}, true, 1)
|
||||
-- WinCreate.AddGridSplits( nFrameId, WIN_MEASURE.PROPORTIONAL, {1, 1, 1}, {1, 1, 1}, true, 1)
|
||||
|
||||
------------------------ Cambi profilo ------------------------
|
||||
-- vetro/anta
|
||||
@@ -142,11 +147,11 @@ local nFrameId = WinCreate.CreateFrame( WIN_FRAME_TYPE.RECT, vFrameJoints, Windo
|
||||
------------------------ Alzante Scorrevole ------------------------
|
||||
|
||||
-- anta mobile a sx
|
||||
local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1, WIN_SPLITTYPES.FRENCH)
|
||||
local nSash1 = WinCreate.AddSash( vAreas[1], vSashJoints, WIN_SASHTYPES.SLIDE_MOVABLE)
|
||||
local nSash2 = WinCreate.AddSash( vAreas[2], vSashJoints, WIN_SASHTYPES.SLIDE_FIXED)
|
||||
WinCreate.AddFill( nSash1, WIN_FILLTYPES.GLASS)
|
||||
WinCreate.AddFill( nSash2, WIN_FILLTYPES.GLASS)
|
||||
-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1, WIN_SPLITTYPES.FRENCH)
|
||||
-- local nSash1 = WinCreate.AddSash( vAreas[1], vSashJoints, WIN_SASHTYPES.SLIDE_MOVABLE)
|
||||
-- local nSash2 = WinCreate.AddSash( vAreas[2], vSashJoints, WIN_SASHTYPES.SLIDE_FIXED)
|
||||
-- WinCreate.AddFill( nSash1, WIN_FILLTYPES.GLASS)
|
||||
-- WinCreate.AddFill( nSash2, WIN_FILLTYPES.GLASS)
|
||||
|
||||
-- anta mobile a dx
|
||||
-- local vAreas = WinCreate.AddSplits( nFrameId, WIN_SPLITORIENTATION.VERTICAL, WIN_MEASURE.PERCENTAGE, { 0.5}, 1, WIN_SPLITTYPES.FRENCH)
|
||||
@@ -684,10 +689,10 @@ WinCreate.AddFill( nSash2, WIN_FILLTYPES.GLASS)
|
||||
-- WinCreate.AddHardware( nFrameId, '000545')
|
||||
|
||||
-- imposto se calcolare i solidi o meno
|
||||
WinCalculate.SetCalcSolid( true)
|
||||
-- WinCalculate.SetCalcSolid( true)
|
||||
|
||||
-- creo i pezzi
|
||||
WinCalculate.CreatePartFromArea( nFrameId)
|
||||
-- WinCalculate.CreatePartFromArea( nFrameId)
|
||||
-- WinCalculate.AddHardware( nFrameId)
|
||||
|
||||
-- tronchetti
|
||||
|
||||
@@ -287,6 +287,10 @@ function WinCreate.AddSplit( nAreaLayerId, SplitType, MeasureType, nPosition, nP
|
||||
elseif MeasureType == WIN_MEASURE.PERCENTAGE then
|
||||
nCalcPosition = b3OutlineLayer:getDimY() * nPosition
|
||||
end
|
||||
if nCalcPosition > b3OutlineLayer:getDimY() - GEO.EPS_SMALL then
|
||||
EgtErase( nTempSplitLayerId)
|
||||
return
|
||||
end
|
||||
nTotSplitId = EgtLine( nTempSplitLayerId, b3OutlineLayer:getMin() + Y_AX() * nCalcPosition, b3OutlineLayer:getMin() + Y_AX() * nCalcPosition + X_AX() * b3OutlineLayer:getDimX())
|
||||
end
|
||||
-- calcolo split
|
||||
@@ -307,6 +311,9 @@ function WinCreate.AddSplits( nAreaLayerId, SplitType, MeasureType, PositionList
|
||||
EgtSetInfo( nResArea2, WIN_PRJ_ORIGSPLIT, nAreaLayerId)
|
||||
end
|
||||
nResArea1, nResArea2 = WinCreate.AddSplit( nResArea2, SplitType, MeasureType, PositionList[nIndex], nProportion, nSplitType)
|
||||
if not nResArea2 then
|
||||
return
|
||||
end
|
||||
table.insert( AreaList, nResArea1)
|
||||
if nIndex == #PositionList then
|
||||
table.insert( AreaList, nResArea2)
|
||||
@@ -321,6 +328,9 @@ function WinCreate.AddSplits( nAreaLayerId, SplitType, MeasureType, PositionList
|
||||
EgtSetInfo( nResArea2, WIN_PRJ_ORIGSPLIT, nAreaLayerId)
|
||||
end
|
||||
nResArea1, nResArea2 = WinCreate.AddSplit( nResArea2, SplitType, MeasureType, PositionList[nIndex], nProportion - dAddPosition, nSplitType)
|
||||
if not nResArea2 then
|
||||
return
|
||||
end
|
||||
table.insert( AreaList, nResArea1)
|
||||
if nIndex == #PositionList then
|
||||
table.insert( AreaList, nResArea2)
|
||||
@@ -338,6 +348,9 @@ function WinCreate.AddSplits( nAreaLayerId, SplitType, MeasureType, PositionList
|
||||
sChildAreas = sChildAreas .. nResArea2 .. EgtIf( nIndex < #PositionList, ',', '')
|
||||
end
|
||||
nResArea1, nResArea2 = WinCreate.AddSplit( nResArea2, SplitType, MeasureType, EgtIf( nIndex == 1, PositionList[nIndex], PositionList[nIndex] / ( 1 - dAddPosition)), nProportion, nSplitType)
|
||||
if not nResArea2 then
|
||||
return
|
||||
end
|
||||
table.insert( AreaList, nResArea1)
|
||||
if nIndex == #PositionList then
|
||||
table.insert( AreaList, nResArea2)
|
||||
@@ -349,6 +362,59 @@ function WinCreate.AddSplits( nAreaLayerId, SplitType, MeasureType, PositionList
|
||||
return AreaList
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
-- funzione che crea tagli split grid
|
||||
function WinCreate.AddGridSplits( nAreaLayerId, MeasureType, PositionListVert, PositionListHoriz, bStartVertical, nSplitType)
|
||||
local AreaResult = {}
|
||||
if bStartVertical then
|
||||
local nProportionVert = 0
|
||||
if MeasureType == WIN_MEASURE.PROPORTIONAL then
|
||||
for i = 1, # PositionListVert do
|
||||
nProportionVert = nProportionVert + PositionListVert[i]
|
||||
end
|
||||
end
|
||||
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)
|
||||
local HorizAbs = {}
|
||||
local dPositionCum = 0
|
||||
local nProportionHoriz = 0
|
||||
if MeasureType == WIN_MEASURE.PROPORTIONAL then
|
||||
for i = 1, # PositionListHoriz do
|
||||
nProportionHoriz = nProportionHoriz + PositionListHoriz[i]
|
||||
end
|
||||
end
|
||||
for i = 1, #PositionListHoriz do
|
||||
if MeasureType == WIN_MEASURE.ABSOLUT then
|
||||
HorizAbs[i] = PositionListHoriz[i]
|
||||
elseif MeasureType == WIN_MEASURE.PROPORTIONAL then
|
||||
HorizAbs[i] = b3OutlineLayer:getDimY() / ( nProportion - dPositionCum) * PositionListHoriz[i]
|
||||
dPositionCum = dPositionCum + PositionListHoriz[i]
|
||||
elseif MeasureType == WIN_MEASURE.PERCENTAGE then
|
||||
-- PositionCum = dPositionCum + PositionListHoriz[i]
|
||||
-- HorizAbs[i] = b3OutlineLayer:getDimY() * dPositionCum
|
||||
HorizAbs[i] = b3OutlineLayer:getDimY() * PositionListHoriz[i]
|
||||
end
|
||||
end
|
||||
for i = 1, #AreaList do
|
||||
local AreaTemp = WinCreate.AddSplits( AreaList[i], WIN_SPLITORIENTATION.HORIZONTAL, WIN_MEASURE.ABSOLUT, HorizAbs, nProportion, nSplitType) or {}
|
||||
for j = 1, #AreaTemp do
|
||||
table.insert( AreaResult, AreaTemp[j])
|
||||
end
|
||||
end
|
||||
else
|
||||
local AreaList = WinCreate.AddSplits( nAreaLayerId, WIN_SPLITORIENTATION.HORIZONTAL, MeasureType, PositionListHoriz, nProportion, nSplitType)
|
||||
for i = 1, #AreaList do
|
||||
local AreaTemp = WinCreate.AddSplits( AreaList[i], WIN_SPLITORIENTATION.VERTICAL, MeasureType, PositionListVert, nProportion, nSplitType) or {}
|
||||
for j = 1, #AreaTemp do
|
||||
table.insert( AreaResult, AreaTemp[j])
|
||||
end
|
||||
end
|
||||
end
|
||||
return AreaResult
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
-- funzione che assegna il nome alla curva di split nella sottoarea in base alla sua direzione
|
||||
local function SetSplitName( nSplitId)
|
||||
|
||||
@@ -185,6 +185,42 @@ local function WinCreate_AddSplits()
|
||||
end
|
||||
_G.WinCreate_AddSplits = WinCreate_AddSplits
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
local function WinCreate_AddGridSplits()
|
||||
local AreaIndex = 1
|
||||
while WDG['AREAID' .. AreaIndex] do
|
||||
WDG['AREAID' .. AreaIndex] = nil
|
||||
AreaIndex = AreaIndex + 1
|
||||
end
|
||||
local PositionListVert = {}
|
||||
local PositionIndex = 1
|
||||
while WDG['POSITION_VERT' .. PositionIndex] do
|
||||
table.insert( PositionListVert, WDG['POSITION' .. PositionIndex])
|
||||
PositionIndex = PositionIndex + 1
|
||||
end
|
||||
local PositionListHoriz = {}
|
||||
PositionIndex = 1
|
||||
while WDG['POSITION_HORIZ' .. PositionIndex] do
|
||||
table.insert( PositionListHoriz, WDG['POSITION' .. PositionIndex])
|
||||
PositionIndex = PositionIndex + 1
|
||||
end
|
||||
local AreaList = WinCreate.AddGridSplits(WDG.AREAID, WDG.MEASURETYPE, PositionListVert, PositionListHoriz, WDG.STARTVERTICAL, WDG.SPLITTYPE)
|
||||
for AreaIndex = 1, #AreaList do
|
||||
WDG['AREAID' .. AreaIndex] = AreaList[ AreaIndex]
|
||||
end
|
||||
PositionIndex = 1
|
||||
while WDG['POSITION_VERT' .. PositionIndex] do
|
||||
WDG['POSITION_VERT' .. PositionIndex] = nil
|
||||
PositionIndex = PositionIndex + 1
|
||||
end
|
||||
PositionIndex = 1
|
||||
while WDG['POSITION_HORIZ' .. PositionIndex] do
|
||||
WDG['POSITION_HORIZ' .. PositionIndex] = nil
|
||||
PositionIndex = PositionIndex + 1
|
||||
end
|
||||
end
|
||||
_G.WinCreate_AddGridSplits = WinCreate_AddGridSplits
|
||||
|
||||
----------------------------------------------------------------------------------
|
||||
local function WinCalculate_SetCalcSolid()
|
||||
WinCalculate.SetCalcSolid( WDG.VALUE)
|
||||
|
||||
Reference in New Issue
Block a user