Esempio n. 1
0
        public void TS_ClearNode(String NodeName)
        {
            if (NodeName == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];

            foreach (var item in node_m.InputSlot)
            {
                DeleteLine(item.LineName);
            }
            foreach (var item in node_m.OutputSlot)
            {
                DeleteLine(item.LineName);
            }
            node_v.ClearSlot();
            node_m.InputSlot.Clear();
            node_m.OutputSlot.Clear();
        }
Esempio n. 2
0
        private void NODE_OnNodeClose(String name)
        {
            if (name == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(name))
            {
                return;
            }
            TrickerStarFunctionNodeModel node_m = (TrickerStarFunctionNodeModel)m_FunctionNodeModels[name];
            TrickerStarFunctionNode      node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[name];

            foreach (var item in node_m.InputSlot)
            {
                DeleteLine(item.LineName);
            }
            foreach (var item in node_m.OutputSlot)
            {
                DeleteLine(item.LineName);
            }
            m_FunctionNodeModels.Remove(name);
            m_FunctionNodeViews.Remove(name);
            C_MAIN_CANVAS.Children.Remove(node_v);
            m_SelectedFunctionNodeModels.Clear();
            m_FromSlot = null;
            m_ToSlot   = null;
        }
Esempio n. 3
0
        public void TS_DeleteNode(String NodeName)
        {
            if (NodeName == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];

            foreach (var item in node_m.InputSlot)
            {
                DeleteLine(item.LineName);
            }
            foreach (var item in node_m.OutputSlot)
            {
                DeleteLine(item.LineName);
            }
            m_FunctionNodeModels.Remove(NodeName);
            m_FunctionNodeViews.Remove(NodeName);
            C_MAIN_CANVAS.Children.Remove(node_v);
            m_SelectedFunctionNodeModels.Clear();
            m_FromSlot = null;
            m_ToSlot   = null;
        }
Esempio n. 4
0
        private void Node_PointerReleased(object sender, PointerRoutedEventArgs e)
        {
            m_ActiveElementType = ACTIVE_ELEMENT_TYPE.CANVAS;
            TrickerStarFunctionNode node = sender as TrickerStarFunctionNode;

            m_Pressed = false;
            e.Handled = true;
        }
Esempio n. 5
0
 void UnselectNodes()
 {
     foreach (object node_str in m_SelectedFunctionNodeModels.Keys)
     {
         TrickerStarFunctionNodeModel node_m = (TrickerStarFunctionNodeModel)m_SelectedFunctionNodeModels[node_str];
         TrickerStarFunctionNode      node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[node_str];
         node_v.Select(false);
         Canvas.SetZIndex(node_v, 4);
     }
 }
Esempio n. 6
0
        public void TS_UnselectAllNodes()
        {
            foreach (String node_name in m_SelectedFunctionNodeModels.Keys)
            {
                TrickerStarFunctionNode node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[node_name];

                Canvas.SetZIndex(node_v, 4);
                node_v.Select(false);
            }
            m_SelectedFunctionNodeModels.Clear();
        }
        public PathGeometry  GenPathGeomentry(Model.TrickerStarNodeSoltDetail from, Model.TrickerStarNodeSoltDetail to)
        {
            TrickerStarFunctionNodeModel node_from_m = (TrickerStarFunctionNodeModel)m_FunctionNodeModels[from.NodeName];
            TrickerStarFunctionNodeModel node_to_m   = (TrickerStarFunctionNodeModel)m_FunctionNodeModels[to.NodeName];
            TrickerStarFunctionNode      node_from_v = (TrickerStarFunctionNode)m_FunctionNodeViews[from.NodeName];
            TrickerStarFunctionNode      node_to_v   = (TrickerStarFunctionNode)m_FunctionNodeViews[to.NodeName];

            Point Line_from = new Point(node_from_m.Pos.X, node_from_m.Pos.Y), Line_to = new Point(node_to_m.Pos.X, node_to_m.Pos.Y);

            node_from_v.InvalidateMeasure();
            Line_from.X += node_from_v.ActualWidth;
            Line_from.Y += from.SlotIndex * 48 + 96;
            Line_to.Y   += to.SlotIndex * 48 + 96;
            Line_from.X -= 16;
            Line_to.X   += 16;


            var pathGeometry1 = new PathGeometry();

            var pathFigureCollection1 = new PathFigureCollection();

            var pathFigure1 = new PathFigure();

            pathFigure1.IsClosed = false;

            pathFigure1.StartPoint = new Windows.Foundation.Point(Line_from.X, Line_from.Y);

            pathFigureCollection1.Add(pathFigure1);

            pathGeometry1.Figures = pathFigureCollection1;



            var pathSegmentCollection1 = new PathSegmentCollection();

            var pathSegment1 = new BezierSegment();

            pathSegment1.Point1 = new Point(Line_from.X + 100, Line_from.Y);

            pathSegment1.Point2 = new Point(Line_to.X - 100, Line_to.Y);

            pathSegment1.Point3 = new Point(Line_to.X, Line_to.Y);

            pathSegmentCollection1.Add(pathSegment1);



            pathFigure1.Segments = pathSegmentCollection1;



            return(pathGeometry1);
        }
Esempio n. 8
0
        public String TS_GetSlotValue(String NodeName, int SlotIndex, Model.TrickerStarSlotSide Side)
        {
            if (NodeName == null)
            {
                return("");
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return("");
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];

            return(node_v.GetSlotValue(Side, SlotIndex));
        }
Esempio n. 9
0
        public void TS_SetNodeTitle(String NodeName, String Title)
        {
            if (NodeName == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];

            node_m.NodeTitle = Title;
            node_v.SetNodeTitle(Title);
        }
Esempio n. 10
0
        private void Node_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
            m_ActiveElementType = ACTIVE_ELEMENT_TYPE.NODE;


            if (m_Pressed && m_ActiveElementType == ACTIVE_ELEMENT_TYPE.NODE)
            {
                e.Handled = true;
                var t = this.m_OldTranslation;



                t.X  = (float)(e.GetCurrentPoint(this).Position.X - m_OldPoint.X);
                t.X /= C_MAINSCROLLVIEWER.ZoomFactor;

                t.Y  = (float)(e.GetCurrentPoint(this).Position.Y - m_OldPoint.Y);
                t.Y /= C_MAINSCROLLVIEWER.ZoomFactor;



                m_OldPoint = e.GetCurrentPoint(this).Position;



                m_OldTranslation = t;

                foreach (object node in m_SelectedFunctionNodeModels.Keys)
                {
                    TrickerStarFunctionNodeModel node_m = (TrickerStarFunctionNodeModel)m_SelectedFunctionNodeModels[node];
                    TrickerStarFunctionNode      node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[node];
                    node_v.Translation         = new System.Numerics.Vector3((float)(node_v.Translation.X + t.X), (float)(node_v.Translation.Y + t.Y), node_v.Translation.Z);
                    node_m.Pos.X               = node_v.Translation.X;
                    node_m.Pos.Y               = node_v.Translation.Y;
                    m_FunctionNodeModels[node] = node_m;

                    foreach (var linename_i in node_m.InputSlot)
                    {
                        RefreshLine(linename_i.LineName);
                    }
                    foreach (var linename_o in node_m.OutputSlot)
                    {
                        RefreshLine(linename_o.LineName);
                    }
                }
            }
        }
Esempio n. 11
0
        public Point TS_GetNodePosition(String NodeName)
        {
            if (NodeName == null)
            {
                return(new Point());
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return(new Point());
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];

            node_m.Pos.X = node_v.Translation.X;
            node_m.Pos.Y = node_v.Translation.Y;
            return(node_m.Pos);
        }
Esempio n. 12
0
        public void TS_UnselectNode(String NodeName)
        {
            if (NodeName == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];

            Canvas.SetZIndex(node_v, 4);
            m_SelectedFunctionNodeModels.Remove(node_m.NodeName);
            node_v.Select(false);
        }
Esempio n. 13
0
        public void TS_SetNodePosition(String NodeName, Point pos)
        {
            if (NodeName == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];


            node_v.Translation = new System.Numerics.Vector3((float)(node_v.Translation.X + pos.X), (float)(node_v.Translation.Y + pos.Y), node_v.Translation.Z);
            node_m.Pos.X       = node_v.Translation.X;
            node_m.Pos.Y       = node_v.Translation.Y;
        }
Esempio n. 14
0
        public void TS_AddSlot(String NodeName, Model.TrickerStarSlotType typename, String slotname, Model.TrickerStarSlotSide side)
        {
            if (NodeName == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];

            if (side == TrickerStarSlotSide.INPUT)
            {
                node_v.AddInpusStack(typename, slotname);
                //node_v.AddInputLabel(typename,placeholder);
                node_m.InputSlot.Add(new TrickerStarNodeSoltDetail()
                {
                    NodeName  = node_v.m_NodeName,
                    SlotIndex = node_m.InputSlot.Count,
                    SlotSide  = TrickerStarSlotSide.INPUT,
                    SlotName  = slotname,
                    SlotType  = typename,
                });
            }
            if (side == TrickerStarSlotSide.OUTPUT)
            {
                node_v.AddOutpusStack(typename, slotname);
                // node_v.AddOutputLabel(typename,placeholder);
                node_m.OutputSlot.Add(new TrickerStarNodeSoltDetail()
                {
                    NodeName  = node_v.m_NodeName,
                    SlotIndex = node_m.OutputSlot.Count,
                    SlotSide  = TrickerStarSlotSide.OUTPUT,
                    SlotName  = slotname,
                    SlotType  = typename,
                });
            }
            m_FunctionNodeModels[NodeName] = node_m;
            m_FunctionNodeViews[NodeName]  = node_v;
        }
Esempio n. 15
0
        public void TS_SetSlotValue(String NodeName, int SlotIndex, Model.TrickerStarSlotSide Side, String value)
        {
            if (value == null)
            {
                return;
            }
            if (NodeName == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];

            node_v.SetSlotValue(Side, SlotIndex, value);
            return;
        }
Esempio n. 16
0
        public void TS_FocusNode(String NodeName)
        {
            if (NodeName == null)
            {
                return;
            }
            if (!m_FunctionNodeModels.ContainsKey(NodeName))
            {
                return;
            }
            Model.TrickerStarFunctionNodeModel node_m = (Model.TrickerStarFunctionNodeModel)m_FunctionNodeModels[NodeName];
            TrickerStarFunctionNode            node_v = (TrickerStarFunctionNode)m_FunctionNodeViews[NodeName];


            Point offset = new Point(0, 0);

            offset.X = node_v.Translation.X - C_MAINSCROLLVIEWER.ActualWidth / 2;
            offset.Y = node_v.Translation.Y - C_MAINSCROLLVIEWER.ActualHeight / 2;
            C_MAINSCROLLVIEWER.ChangeView(offset.X, offset.Y, 1);
        }
Esempio n. 17
0
        public void TS_AddNode(String NodeName)
        {
            Model.TrickerStarFunctionNodeModel node_m = new Model.TrickerStarFunctionNodeModel();
            node_m.NodeName = NodeName;

            TrickerStarFunctionNode node_v = new TrickerStarFunctionNode();

            Canvas.SetZIndex(node_v, 999);
            node_v.m_NodeName  = NodeName;
            node_v.DataContext = node_m;
            node_v.SetNodeTitle(node_m.NodeName);
            C_MAIN_CANVAS.Children.Add(node_v);
            node_v.PointerPressed     += Node_PointerPressed;
            node_v.PointerReleased    += Node_PointerReleased;
            node_v.PointerMoved       += Node_PointerMoved;
            node_v.OnSlotClicked      += NODE_OnSlotClicked;
            node_v.OnNodeClose        += NODE_OnNodeClose;
            node_v.OnSlotValueChanged += NODE_OnSlotValueChanged;
            m_FunctionNodeViews.Add(NodeName, node_v);
            m_FunctionNodeModels.Add(NodeName, node_m);
        }
Esempio n. 18
0
        private void Node_PointerPressed(object sender, PointerRoutedEventArgs e)
        {
            if (m_ShiftPressed == false)
            {
                UnselectNodes();
                m_SelectedFunctionNodeModels.Clear();
            }
            m_Pressed  = true;
            m_OldPoint = e.GetCurrentPoint(this).Position;

            m_OldTranslation.X = C_MAINSCROLLVIEWER.HorizontalOffset;
            m_OldTranslation.Y = C_MAINSCROLLVIEWER.VerticalOffset;

            m_ActiveElementType = ACTIVE_ELEMENT_TYPE.NODE;
            TrickerStarFunctionNode node = sender as TrickerStarFunctionNode;

            Canvas.SetZIndex(node, 5);
            Model.TrickerStarFunctionNodeModel node_m = node.DataContext as TrickerStarFunctionNodeModel;
            m_SelectedFunctionNodeModels[node_m.NodeName] = node_m;
            node.Select(true);
            e.Handled = true;
        }