Quintiq file version 2.0
|
#parent: #root
|
Method AutoArrangeNodes (
|
Unit unit,
|
Number maxx,
|
Number maxy
|
)
|
{
|
Description: 'Move nodes into scope'
|
TextBody:
|
[*
|
nodes := construct( Nodes );
|
|
maxgridx := [Number]floor( maxx / ( this.GridPointDistance() ) ); // max of GridX
|
maxgridy := [Number]floor( maxy / ( this.GridPointDistance() ) ); // max of GridY
|
|
nodes := selectset( this,
|
Node,
|
n,
|
true,
|
( n.istype( UnitNode ) and n.astype( UnitNode ).Unit().Parent() = unit )
|
or ( n.istype( StockingPointNode ) and n.astype( StockingPointNode ).StockingPoint_MP().Unit() = unit ) )
|
|
|
traverse( nodes, Elements, node, node.GridX() < 0 // gridX < 0
|
or node.GridX() > maxgridx // gridX > maxgridX
|
or node.GridY() < 0 // gridY < 0
|
or node.GridY() > maxgridy ) // gridY > maxgridX
|
{
|
// Offset GridX
|
if( node.GridX() < 0 )
|
{
|
node.GridX( this.OffsetX() );
|
}
|
else if( node.GridX() > maxgridx )
|
{
|
node.GridX( maxgridx - this.OffsetX() );
|
}
|
// Offset GridY
|
if( node.GridY() < 0 )
|
{
|
node.GridY( this.OffsetY() );
|
}
|
else if( node.GridY() > maxgridy )
|
{
|
node.GridY( maxgridy - this.OffsetY() );
|
}
|
}
|
*]
|
}
|