public Renderer(IForceDirected iForceDirected) : base(iForceDirected)
        {
            Transform  graphHolder = GameObject.FindWithTag("Graph").transform;
            GameObject nodePrefab  = Resources.Load("Node") as GameObject;
            GameObject edgePrefab  = Resources.Load("Edge") as GameObject;

            foreach (Node n in iForceDirected.graph.nodes)
            {
                //GameObject nodeObj = Instantiate(Resources.Load("Node") as GameObject, new Vector3(n.Data.initialPostion.x, n.Data.initialPostion.y, n.Data.initialPostion.z), Quaternion.identity, graphHolder);
                GameObject nodeObj = Instantiate(nodePrefab, graphHolder);
                nodeObj.name = n.Data.label;

                // Passing the value of the underlying node to the 'Interface' between the GameObject and the actual FDG object

                var na = nodeObj.GetComponent <NodeAssociation>();
                na._associatedNode     = n;
                n.associatedNodeObject = na;
                n.Data.gameObject      = nodeObj;
                gameObjects.Add(nodeObj);
            }

            foreach (Edge e in iForceDirected.graph.edges)
            {
                GameObject edgeObj = Instantiate(edgePrefab, graphHolder);
                edgeObj.name = e.Data.label;
                NodeEdge nodeEdge = edgeObj.GetComponent <NodeEdge>();
                nodeEdge.node1 = e.Source.Data.gameObject;
                nodeEdge.node2 = e.Target.Data.gameObject;
                gameObjects.Add(edgeObj);
            }
        }
Exemple #2
0
 public Renderer(IForceDirected iForceDirected, int height, int width)
     : base(iForceDirected)
 {
     Boxes  = new Dictionary <City, GridBox>();
     Lines  = new Dictionary <Connection, GridLine>();
     Height = height;
     Width  = width;
 }
 public AbstractRenderer(IForceDirected iForceDirected)
 {
     forceDirected = iForceDirected;
 }
Exemple #4
0
 public FDRenderer(IForceDirected iForceDirected) : base(iForceDirected)
 {
     // Your initialization to draw
 }
Exemple #5
0
 public FDRenderer(IForceDirected iForceDirected)
     : base(iForceDirected)
 {
     // Your initialization to draw
 }
 public Renderer(ForceDirectedGraphForm iForm, IForceDirected iForceDirected)
     : base(iForceDirected)
 {
     form = iForm;
 }
Exemple #7
0
 public AbstractRenderer(IForceDirected iForceDirected)
 {
     forceDirected = iForceDirected;
 }
 public GraphRenderer(GraphController controller, IForceDirected forceDirected) : base(forceDirected)
 {
     this.controller = controller;
 }
 public Renderer(ForceDirectedGraphForm iForm,IForceDirected iForceDirected)
     : base(iForceDirected)
 {
     form = iForm;
 }