Quintiq file version 2.0
|
#parent: #root
|
Method SynchronizePaths (JSON jsondata)
|
{
|
TextBody:
|
[*
|
old := selectset( this, Paths, path, true );
|
new := construct( Lib3DS_Paths );
|
|
pathiddata := guard( jsondata.Get( 'paths.path.id' ), null( JSON, owning ) );
|
pathtypedata := guard( jsondata.Get( 'paths.path.type' ), null( JSON, owning ) );
|
pathvaluedata := guard( jsondata.Get( 'paths.path.value' ), null( JSON, owning ) );
|
pathroledata := guard( jsondata.Get( 'paths.path.attribute[RoleSemantics]' ), null( JSON, owning ) );
|
|
if( not isnull( pathiddata ) ) // ensure that there is path
|
{
|
// array mode
|
if( guard( pathiddata.IsArray(), false )
|
and guard( pathtypedata.IsArray(), false )
|
and guard( pathvaluedata.IsArray(), false )
|
and guard( pathroledata.IsArray(), false ) )
|
{
|
for( i := 0; i < pathtypedata.Size(); i++ )
|
{
|
path := Lib3DS_Path::FindOrCreate( this, pathiddata.Get( i ).GetString() );
|
path.Type( guard( pathtypedata.Get( i ).GetString(), '' ) );
|
path.RoleSemantics( guard( pathroledata.Get( i ).GetString(), '' ) );
|
path.SynchronizePathElements( pathvaluedata.Get( i ).GetString() );
|
new.Add( path );
|
}
|
}
|
else // non array mode
|
{
|
path := Lib3DS_Path::FindOrCreate( this, pathiddata.GetString() );
|
path.Type( guard( pathtypedata.GetString(), '' ) );
|
path.RoleSemantics( guard( pathroledata.GetString(), '' ) );
|
path.SynchronizePathElements( pathvaluedata.GetString() );
|
new.Add( path );
|
}
|
}
|
|
deleted := old.Difference( new );
|
Lib3DS_Path::Delete( deleted );
|
*]
|
InterfaceProperties { Accessibility: 'Module' }
|
}
|