Exemplo n.º 1
0
    public static GraphNodeType CreateInstance(GameObject go, DateTime time, string host, Vector3 pos, GameObject miniGo, bool act = false, int num = 3)
    {
        GraphNodeType inst = CreateInstance <GraphNodeType>();

        inst.Init(go, time, host, pos, act, num);
        return(inst);
    }
Exemplo n.º 2
0
    private GraphNodeType[] CreateNodes()
    {
        GraphNodeType[] node = new GraphNodeType[GetConnections.Count];
        int             i    = 0;

        foreach (Dictionary <string, string> pair in GetConnections)
        {
            // get neat splunk data
            DateTime time;
            string   host;
            GetUsefulInfo(pair, out time, out host);
            float x;
            float y;
            GetPoints(i, out x, out y);
            GraphNodeType newNodeType = GraphNodeType.CreateInstance(Node_Prefab, time, host, new Vector3(x, y, 2), MiniNodePrefab);


            // make new nodes children of ParentObject (should be NodeManager game object)
            newNodeType.getObject().transform.parent = Parent_Object.transform;
            newNodeType.setPosition(new Vector3(x, y, 2));

            node[i++] = newNodeType;
        }
        return(node);
    }
Exemplo n.º 3
0
        public GraphNode(int x, int y, GraphNodeType type)
        {
            this.x    = x;
            this.y    = y;
            this.type = type;

            pos = new Vector2(x, y);
        }
Exemplo n.º 4
0
 public GraphNode(float x2, float y2, float renderScale) : this()
 {
     nodeType         = GraphNodeType.STANDART;
     this.x           = x2;
     this.y           = y2;
     this.renderScale = renderScale;
     this.color       = Color.yellow;
     this.G           = 0;
 }
Exemplo n.º 5
0
 private int TypeToInt(GraphNodeType type)
 {
     if (type == GraphNodeType.OPEN)
     {
         return(0);
     }
     else
     {
         return(1);
     }
 }
Exemplo n.º 6
0
    private GraphNodeType GenerateProc(Vector3 createPos, string user, string process_name, int pid)
    {
        GraphNodeType newProc = InstProc(createPos, DateTime.Today, user);

        newProc.setProcessName(process_name);
        newProc.setProcessId(pid);

        newProc.InitSubNodes(new string[] { "User: "******"Process Name: " + process_name, "PID: " + pid.ToString() }, subNodePrefab);
        newProc.getObject().name = "process_" + pid.ToString();
        nodeCount++;
        return(newProc);
    }
Exemplo n.º 7
0
    public void NewProc(Vector3 createPos, string user, string process_name, int pid)
    {
        ///<summary>This function creates a new host on set coordinates, as well as a link between it and the root.</summary>
        ///
        //

        GraphNodeType newNode = GenerateProc(createPos, user, process_name, pid);
        GameObject    nodeObj = newNode.getObject();

        nodes.Add(newNode);
        nodeObj.transform.parent = this.transform;

        CreateLink(nodeObj, nodeObj.GetComponent <NodePhysX>().root);

        //print("Created new process named " + newNode.name);
    }
Exemplo n.º 8
0
    public void NewConn(Vector3 createPos, DateTime time, string process, string remoteAddress)
    {
        ///<summary>This function creates a new host on set coordinates, as well as a link between it and the root.</summary>
        ///
        // "Standard" overload
        GraphNodeType newNode = GenerateConn(createPos, time, process, remoteAddress);
        GameObject    nodeObj = newNode.getObject();

        nodes.Add(newNode);

        // Hierarchy maintenance - make this new node a child of the GraphController
        nodeObj.transform.parent = this.transform;

        CreateLink(nodeObj, nodeObj.GetComponent <NodePhysX>().root);

        //print("Created new host named " + newNode.name);
    }
Exemplo n.º 9
0
 public GraphNode(List <string> poeList, float renderScale) : this(100, 100, renderScale)
 {
     this.poeList = poeList;
     nodeType     = GraphNodeType.POE;
     setPOEPosition();
     foreach (string poe in poeList)
     {
         try
         {
             shapeCreator.getPOEs()[poe].setChildNode(this.getThisId());
         }
         catch (NullReferenceException nex)
         {
             Debug.Log("Can`t set child POE node");
         }
     }
 }
Exemplo n.º 10
0
    public GraphNodeType GenerateConn(Vector3 createPos, DateTime time, string process, string remoteAddress)
    {
        GraphNodeType nodeCreated = null;

        nodeCreated = InstHost(createPos, time, process);
        nodeCreated.setRemoteAddress(remoteAddress);
        // @TODO make this more then just example flavor
        // @TODO: labels should come from dictionary keys
        nodeCreated.InitSubNodes(new string[] { "Connection Time: " + nodeCreated.getTime().ToString(), "User: "******"Dest IP: " + nodeCreated.getRemoteAddress() }, subNodePrefab);

        if (nodeCreated != null)
        {
            nodeCreated.getObject().name = "host" + process;
            nodeCount++;
        }

        return(nodeCreated);
    }
Exemplo n.º 11
0
    // Use this for initialization
    void Start()
    {
        GraphManager    = GameObject.Find("GraphManager");
        graphController = GraphManager.GetComponent <GraphController>();
        standard        = Shader.Find("Transparent/Diffuse");
        originRender    = GetComponent <Renderer>();
        originMat       = originRender.material;
        originTag       = gameObject.tag;
        //print("Orginal tag for " + name + " is " + originTag);

        // store the GraphNodeType for this object
        foreach (GraphNodeType gnt in graphController.Nodes)
        {
            if (GameObject.ReferenceEquals(this.gameObject, gnt.getObject()))
            {
                gntME = gnt;
            }
        }
    }
Exemplo n.º 12
0
    public void UpdateGraphNodeType()
    {
        var numberOfNeighbours = 0;

        if (this.up != null)
        {
            numberOfNeighbours++;
        }
        if (this.down != null)
        {
            numberOfNeighbours++;
        }
        if (this.left != null)
        {
            numberOfNeighbours++;
        }
        if (this.right != null)
        {
            numberOfNeighbours++;
        }

        switch (numberOfNeighbours)
        {
        case 1:
            this.type = GraphNodeType.Hole;
            break;

        case 2:
            this.type = GraphNodeType.Curve;
            break;

        case 3:
            this.type = GraphNodeType.Junction;
            break;

        case 4:
            this.type = GraphNodeType.Open;
            break;
        }
    }
Exemplo n.º 13
0
    public GraphNodeType UpdateGraphNodeType(int hits, bool isFirstOrLast)
    {
        switch (hits)
        {
        case 0:
            if (isFirstOrLast)
            {
                this.type = GraphNodeType.Hole;
            }
            else
            {
                this.type = GraphNodeType.Straight;
            }
            break;

        case 1:
            if (isFirstOrLast)
            {
                this.type = GraphNodeType.Curve;
            }
            else
            {
                this.type = GraphNodeType.Junction;
            }
            break;

        case 2:
            if (isFirstOrLast)
            {
                this.type = GraphNodeType.Junction;
            }
            else
            {
                this.type = GraphNodeType.Open;
            }
            break;
        }
        return(this.type);
    }
Exemplo n.º 14
0
 public GraphNodeType InstProc(Vector3 createPos, DateTime metaTime, string hostname)
 {
     return(GraphNodeType.CreateInstance(procPrefab, metaTime, hostname, createPos, subNodePrefab));
 }