private static object CompFactoryPropertyCoerceValueCallback(DependencyObject d, object baseValue)
        {
            CompGraph instance = d as CompGraph;

            if (instance != null && instance.CompFactory != null)
            {
                instance.CompFactory.PropertyChanged -= instance.compFactory_PropertyChanged;
            }

            return(baseValue);
        }
        public NodeVisualization(CompGraph _parent_canvas, object _data,
                                 double _width, double _height, double _offset_hrzt, double _offset_vert,
                                 Color _contour, Color _fill_1, Color _fill_2)
        {
            this.parent_canvas        = _parent_canvas;
            this.node_data            = _data;
            this.node_children        = new List <NodeVisualization>();
            this.node_connections_out = new List <Polyline>();
            this.node_connections_in  = new List <Polyline>();
            this.node_references_out  = new List <Polyline>();
            this.node_references_in   = new List <Polyline>();
            this.node_param_calc_out  = new List <Polyline>();
            this.node_param_calc_in   = new List <Polyline>();

            // node_main -> is built after loading
            // text_main -> is built after loading
            this.node_width       = _width;
            this.node_height      = _height;
            this.node_offset_hrzt = _offset_hrzt;
            this.node_offset_vert = _offset_vert;

            this.node_contour              = _contour;
            this.node_contour_thickness    = 1;
            this.node_fill_color_1         = _fill_1;
            this.node_fill_color_1_default = _fill_1;
            this.node_fill_color_2         = _fill_2;
            this.node_fill_color_2_default = _fill_2;

            // cutom display properties
            this.Anchor = new Point(_offset_hrzt, _offset_vert);
            this.IsUserManipulatable  = true;
            this.is_expanded          = false;
            this.to_be_expanded       = false;
            this.to_be_expanded_chain = new List <long>();
            this.is_showing_refs      = false;
            this.is_simple            = false;
            this.vis_state            = NodeVisHighlight.Active;

            // UIControl properties
            //this.Width = this.node_width + NodeVisualization.NODE_WIDTH_SWITCHES * 2;
            //this.Height = this.node_height + NodeVisualization.NODE_WIDTH_SWITCHES;
            this.position = new Point(this.node_offset_hrzt, this.node_offset_vert);
            TranslateTransform transf = new TranslateTransform(this.node_offset_hrzt, this.node_offset_vert);

            this.RenderTransform = transf;

            this.Loaded += NodeVisualization_Loaded;

            // Add to Parent!
            if (this.parent_canvas != null)
            {
                this.parent_canvas.AddChild(this, this.position);
            }
        }
        private static void CompFactoryPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CompGraph instance = d as CompGraph;

            if (instance == null)
            {
                return;
            }

            if (instance.CompFactory != null)
            {
                instance.CompFactory.PropertyChanged += instance.compFactory_PropertyChanged;
                instance.PopulateCanvas();
            }
        }
        public CalculationVisualization(CompGraph _parent_canvas, ParameterStructure.Parameter.Calculation _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_4, NodeVisualization.NODE_COLOR_FILL_ACTIVE_3)
        {
            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_calculation = this.node_data as ParameterStructure.Parameter.Calculation;
                this.node_calculation.PropertyChanged += node_calc_PropertyChanged;
            }
        }
 public NodeVisualization(CompGraph _parent_canvas, object _data, double _offset_hrzt, double _offset_vert)
     : this(_parent_canvas, _data,
            NodeVisualization.NODE_WIDTH_DEFAULT, NodeVisualization.NODE_HEIGHT_DEFAULT, _offset_hrzt, _offset_vert,
            NodeVisualization.NODE_COLOR_STROKE_ACTIVE, NodeVisualization.NODE_COLOR_FILL_ACTIVE_1, NodeVisualization.NODE_COLOR_FILL_ACTIVE_2)
 {
 }