/// <summary> /// <para>For calculating with the parameter slots in instances w/o affecting the component and its parameters.</para> /// <para>Performed recursively in case the sub-components contain calculations themselves.</para> /// </summary> /// <param name="_container"></param> internal void ExecuteCalculationChainWoArtefacts(FlNetElement _container) { if (_container == null) { return; } GeometricRelationship instance = this.R2GInstances.FirstOrDefault(x => x.InstanceNWElementID == _container.ID); if (instance == null) { return; } // populate the parameter values if (instance.InstanceParamValues == null || instance.InstanceParamValues.Count == 0) { this.UpdateInstanceIn(_container, new Point(0, 0), false); } // recursion this.ExecuteCalculationChainForInstance(instance); // result transfer params -> size, if necessary instance.ApplySizeTransferSettings(); }
internal GeometricRelationship UpdateInstanceIn(FlNetElement _container, Point _offset, bool _reset) { if (_container == null) { return(null); } GeometricRelationship gr = this.R2GInstances.FirstOrDefault(x => x.InstanceNWElementID == _container.ID); if (gr == null) { return(null); } if (gr.InstanceNWElementID != _container.ID) { return(null); } // assemble parameters to pass to the instance Dictionary <string, double> param_slots = this.ExtractParameterValues(); // size is a special case !!! param_slots[Parameter.Parameter.RP_HEIGHT_MIN] = gr.InstanceSize[0]; param_slots[Parameter.Parameter.RP_WIDTH_MIN] = gr.InstanceSize[1]; param_slots[Parameter.Parameter.RP_LENGTH_MIN] = gr.InstanceSize[2]; param_slots[Parameter.Parameter.RP_HEIGHT_MAX] = gr.InstanceSize[3]; param_slots[Parameter.Parameter.RP_WIDTH_MAX] = gr.InstanceSize[4]; param_slots[Parameter.Parameter.RP_LENGTH_MAX] = gr.InstanceSize[5]; // controlled reset if (gr.InstanceParamValues == null) { gr.InstanceParamValues = param_slots; return(gr); } if (_reset) { gr.InstanceParamValues = param_slots; gr.UpdatePositionFrom(_container, _offset, Component.SCALE_PIXEL_TO_M); return(gr); } else { foreach (var entry in param_slots) { if (!(gr.InstanceParamValues.ContainsKey(entry.Key))) { gr.InstanceParamValues.Add(entry.Key, entry.Value); } } gr.ApplySizeTransferSettings(); } return(gr); }