Пример #1
0
        public override void UpdateNodes <NodePresenter>(UpdateNodeInfo <NodePresenter> updateNodeInfo)
        {
            foreach (var node in updateNodeInfo.Updated)
            {
                var text = _nodeLabels[node.Uid];

                text.transform.localPosition = node.Position + new Vector3(0, -0.1f, 0);
            }
            foreach (var node in updateNodeInfo.Removed)
            {
                _nodes.Remove(node);

                var text = _nodeLabels[node.Uid];
                Destroy(text.gameObject);
                _nodeLabels.Remove(node.Uid);
            }
            foreach (var node in updateNodeInfo.Added)
            {
                _nodes.Add(node);

                var text = GameObject.Instantiate(_nodeLabelPrefab, _nodeLabelCanvas.transform, false);
                text.transform.localPosition = node.Position + new Vector3(0, -0.1f, 0);
                text.text = node.Label;
                _nodeLabels.Add(node.Uid, text);
            }
            RebuildNodes();
            RebuildEdges();
        }
Пример #2
0
 private void GraphView_MouseMove(object sender, Vector3 position, int button)
 {
     if (_interactedNode == null)
     {
         return;
     }
     _interactedNode.Position = this.transform.InverseTransformPoint(position);
     _graphView.UpdateNodes(UpdateNodeInfo <BaseNodePresenter> .UpdateNodes(_interactedNode));
     Node_MouseMove(_interactedNode, button);
 }
Пример #3
0
 private void GraphView_MouseMove(object sender, Vector3 position, int button)
 {
     if (_interactedNode == null)
     {
         return;
     }
     _interactedNode.Position      = position;
     _interactedNode.FirstPosition = position;
     _interactedNode.selected      = true;
     GraphView.UpdateNodes(UpdateNodeInfo <BaseNodePresenter> .UpdateNodes(_interactedNode));
     parentChunkedGraphPresenter.Node_MouseMove(_interactedNode, button);
 }
 private void GraphView_MouseMove(object sender, Vector3 position, int button)
 {
     if (_interactedNode == null)
     {
         return;
     }
     _interactedNode.Position = this.transform.InverseTransformPoint(position);
     //update positions in graph model
     _forceDirected2D.UpdatePositionInteracted(_interactedNode._nodeModel, position / 0.01f);
     _graphView.UpdateNodes(UpdateNodeInfo <BaseNodePresenter> .UpdateNodes(_interactedNode));
     Node_MouseMove(_interactedNode, button);
 }
        //calls the force directed graph object, to calculate the movement, then applies it
        private void CalculateForceAndUpdate(float time)
        {
            _forceDirected2D.Calculate(time);
            //get new positions from model and apply to view
            Dictionary <int, Vector3> positionDict = _forceDirected2D.ApplyCalculation();

            foreach (var pos in positionDict)
            {
                BaseNodePresenter node = IDToNode(pos.Key);
                // if (!(node ==_interactedNode))
                node.Position = pos.Value * 0.01f;
            }
            _graphView.UpdateNodes(UpdateNodeInfo <BaseNodePresenter> .UpdateNodes(_nodePresenters.ToArray()));
        }
Пример #6
0
 public abstract void UpdateGraph <NodePresenter, EdgePresenter>(UpdateNodeInfo <NodePresenter> updateNodeInfo, UpdateEdgeInfo <EdgePresenter> updateEdgeInfo)
     where NodePresenter : BaseNodePresenter
     where EdgePresenter : BaseEdgePresenter;
Пример #7
0
 public abstract void UpdateNodes <NodePresenter>(UpdateNodeInfo <NodePresenter> updateNodeInfo)
     where NodePresenter : BaseNodePresenter;
Пример #8
0
 public override void UpdateGraph <NodePresenter, EdgePresenter>(UpdateNodeInfo <NodePresenter> updateNodeInfo, UpdateEdgeInfo <EdgePresenter> updateEdgeInfo)
 {
     UpdateNodes <NodePresenter>(updateNodeInfo);
     UpdateEdges <EdgePresenter>(updateEdgeInfo);
 }