Example #1
0
        protected virtual string GetCrossSectionInfo(ParameterStructure.Component.Component _c)
        {
            if (_c == null)
            {
                return("[]");
            }

            string cs = "[";

            ParameterStructure.Parameter.Parameter p_B = _c.GetFirstParamByName(Parameter.RP_WIDTH);
            ParameterStructure.Parameter.Parameter p_H = _c.GetFirstParamByName(Parameter.RP_HEIGHT);
            ParameterStructure.Parameter.Parameter p_D = _c.GetFirstParamByName(Parameter.RP_DIAMETER);

            if (p_B != null && p_H != null && p_B.ValueCurrent > 0 && p_H.ValueCurrent > 0)
            {
                cs += p_B.ValueCurrent.ToString("F0", FlNwElementVisualization.NR_FORMATTER) + " x "
                      + p_H.ValueCurrent.ToString("F0", FlNwElementVisualization.NR_FORMATTER);
            }

            if (p_D != null && p_D.ValueCurrent > 0)
            {
                cs += "Ø " + p_D.ValueCurrent.ToString("F0", FlNwElementVisualization.NR_FORMATTER);
            }

            cs += "]";

            return(cs);
        }
Example #2
0
        private ParameterStructure.Parameter.Parameter FindParameterToSelect(string _pname)
        {
            if (string.IsNullOrEmpty(_pname))
            {
                return(null);
            }
            if (this.parameters_for_size_transfer == null)
            {
                return(null);
            }

            foreach (object container in this.parameters_for_size_transfer)
            {
                CollectionContainer col_container = container as CollectionContainer;
                if (col_container != null && col_container.Collection != null)
                {
                    foreach (object item in col_container.Collection)
                    {
                        ParameterStructure.Parameter.Parameter p = item as ParameterStructure.Parameter.Parameter;
                        if (p == null)
                        {
                            continue;
                        }

                        if (p.Name == _pname)
                        {
                            return(p);
                        }
                    }
                }
            }

            return(null);
        }
        protected void node_param_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            ParameterStructure.Parameter.Parameter param = sender as ParameterStructure.Parameter.Parameter;
            if (param == null || e == null)
            {
                return;
            }

            if (e.PropertyName == "ValueCurrent" || e.PropertyName == "TextValue")
            {
                this.UpdateContent();
            }
        }
        public ParameterVisualization(CompGraph _parent_canvas, ParameterStructure.Parameter.Parameter _data, double _offset_hrzt, double _offset_vert)
            : base(_parent_canvas, _data,
                   NodeVisualization.NODE_WIDTH_DEFAULT, NodeVisualization.NODE_HEIGHT_SMALL, _offset_hrzt, _offset_vert,
                   NodeVisualization.NODE_COLOR_STROKE_ACTIVE, NodeVisualization.NODE_COLOR_FILL_ACTIVE_3, NodeVisualization.NODE_COLOR_FILL_ACTIVE_2)
        {
            this.Width   = this.node_width;
            this.Height  = this.node_height;
            this.Extents = new BoundingBox()
            {
                UpperLeft  = this.position,
                LowerRight = new Point(this.position.X + this.Width, this.position.Y + this.Height)
            };

            if (this.node_data != null)
            {
                this.node_parameter = this.node_data as ParameterStructure.Parameter.Parameter;
                this.node_parameter.PropertyChanged += node_param_PropertyChanged;
            }
        }
Example #5
0
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            if (container == null)
            {
                return(null);
            }
            FrameworkElement element = container as FrameworkElement;

            if (element == null)
            {
                return(null);
            }

            if (item == null)
            {
                return(element.TryFindResource("DT_Empty") as DataTemplate);
            }

            ParameterStructure.Component.EmptyComponentSlot compslot = new EmptyComponentSlot {
                SlotType = 0, SlotName = string.Empty, SlotDescr = string.Empty
            };
            if (item is ParameterStructure.Component.EmptyComponentSlot)
            {
                compslot = (ParameterStructure.Component.EmptyComponentSlot)item;
            }
            ParameterStructure.Parameter.Parameter parameter = item as ParameterStructure.Parameter.Parameter;

            if (!(string.IsNullOrEmpty(compslot.SlotName)))
            {
                return(element.TryFindResource("ComponentSlotShortInParamList") as DataTemplate);
            }
            else if (parameter != null)
            {
                return(element.TryFindResource("ParamShortInList") as DataTemplate);
            }
            else
            {
                return(null);
            }
        }
Example #6
0
        protected virtual string GetFlowInfo(ParameterStructure.Component.Component _c)
        {
            if (_c == null)
            {
                return("[...]");
            }

            string flow = "[";

            ParameterStructure.Parameter.Parameter p_V = _c.GetFirstParamByName(Parameter.RP_FLOW);
            if (p_V != null)
            {
                flow += Parameter.ValueToString(p_V.ValueCurrent, "F3") + " " + p_V.Unit;
            }

            Parameter p_dP  = _c.GetFirstParamByName(Parameter.RP_PRESS_IN);
            Parameter p_dP2 = _c.GetFirstParamByName(Parameter.RP_PRESS_IN_MAIN);
            Parameter p_dP3 = _c.GetFirstParamByName(Parameter.RP_PRESS_IN_BRANCH);

            if (p_dP != null)
            {
                flow += " " + Parameter.RP_PRESS_IN + ": " + Parameter.ValueToString(p_dP.ValueCurrent, "F2") + " " + p_dP.Unit;
            }
            if (p_dP2 != null)
            {
                flow += " " + Parameter.RP_PRESS_IN_MAIN + ": " + Parameter.ValueToString(p_dP2.ValueCurrent, "F2");
            }
            if (p_dP3 != null)
            {
                flow += " " + Parameter.RP_PRESS_IN_BRANCH + ": " + Parameter.ValueToString(p_dP3.ValueCurrent, "F2");
            }

            flow += "]";

            return(flow);
        }
Example #7
0
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            if (container == null)
            {
                return(null);
            }
            FrameworkElement element = container as FrameworkElement;

            if (element == null)
            {
                return(null);
            }

            if (item == null)
            {
                return(element.TryFindResource("DT_Empty") as DataTemplate);
            }

            ParameterStructure.Component.Component          component = item as ParameterStructure.Component.Component;
            ParameterStructure.Component.EmptyComponentSlot compslot  = new EmptyComponentSlot {
                SlotType = 0, SlotName = string.Empty, SlotDescr = string.Empty
            };
            if (item is ParameterStructure.Component.EmptyComponentSlot)
            {
                compslot = (ParameterStructure.Component.EmptyComponentSlot)item;
            }
            ParameterStructure.Parameter.Parameter            parameter  = item as ParameterStructure.Parameter.Parameter;
            ParameterStructure.Parameter.Calculation          calc       = item as ParameterStructure.Parameter.Calculation;
            ParameterStructure.Geometry.GeometricRelationship geom_rel   = item as ParameterStructure.Geometry.GeometricRelationship;
            ParameterStructure.Geometry.HierarchicalContainer hcontainer = item as ParameterStructure.Geometry.HierarchicalContainer;

            if (component != null)
            {
                if (component.IsHidden)
                {
                    return(element.TryFindResource("ComponentInListHidden") as DataTemplate);
                }
                else
                {
                    return(element.TryFindResource("ComponentWInstancesWoControlsInList") as DataTemplate);
                }
            }
            else if (!(string.IsNullOrEmpty(compslot.SlotName)))
            {
                if (compslot.IsLarge)
                {
                    return(element.TryFindResource("ComponentSlotInParamList") as DataTemplate);
                }
                else
                {
                    return(element.TryFindResource("ComponentSlotInList") as DataTemplate);
                }
            }
            else if (parameter != null)
            {
                return(element.TryFindResource("ParamInListMapping") as DataTemplate);
            }
            else if (calc != null)
            {
                return(element.TryFindResource("CalcInListMapping") as DataTemplate);
            }
            else if (geom_rel != null)
            {
                return(element.TryFindResource("GeomRelationshipInMappingTree") as DataTemplate);
            }
            else if (hcontainer != null)
            {
                return(element.TryFindResource("HierarchicalContainerInList") as DataTemplate);
            }
            else
            {
                return(null);
            }
        }