Ejemplo n.º 1
0
    private void SaveButton()
    {
        // Create a list to hold new dataValues
        List <string> newDataInputList = new List <string>();

        // Get list of values from newData InputFields
        foreach (GameObject dataInput in GameObject.FindGameObjectsWithTag("PCPNewDataInputField"))
        {
            newDataInputList.Add(dataInput.GetComponent <TMP_InputField>().text);
            dataInput.GetComponent <TMP_InputField>().text = null;
        }
        ;

        // Get & Set kValue InputField and weighted Toggle for KNN
        KNN.kValue      = Convert.ToInt32(GameObject.FindGameObjectWithTag("PCPkValue").GetComponent <TMP_InputField>().text);
        KNN.trueOrFalse = GameObject.FindGameObjectWithTag("PCPWeighted").GetComponent <Toggle>().isOn;

        // Run Cancel() to clear and hide the NewData Panel after the values have been stored
        CancelButton();
        // Add the new data
        NewDataPoint.AddDataPoint(newDataInputList);

        ColorManager.Blink(KNN.kPoints, pointList);

        // Target the last DataBall (column4) within the newly added instance
        GameObject newBall = (GameObject)pointList.Last()["DataBall4"] as GameObject;

        TargetingScript.selectedTarget = newBall;
        TargetingScript.colorOff       = TargetingScript.selectedTarget.GetComponent <Renderer>().material.color;
        TargetingScript.selectedTarget.GetComponent <Renderer>().material.color = Color.white;
        TargetingScript.selectedTarget.transform.localScale += new Vector3(+0.01f, +0.01f, +0.01f);
    }
Ejemplo n.º 2
0
 private void Update()
 {
     if (KNN.KNNMode && KNN.KNNMove)
     {
         NewDataPoint.ChangeDataPoint();
         KNN.KNNMove = false;
     }
 }
Ejemplo n.º 3
0
        private void GeneratePoints()
        {
            while (true)
            {
                var phi = rnd.NextDouble() * 2 * Math.PI;
                var x   = rnd.NextDouble() * 0.1 + Math.Sin(phi);
                var y   = rnd.NextDouble() * 0.1 + Math.Cos(phi);

                Thread.Sleep(200);

                if (NewDataPoint != null)
                {
                    NewDataPoint.Invoke(x, y);
                }
            }
        }
Ejemplo n.º 4
0
    private void SaveInput()
    {
        CancelInvoke("SaveCheck");
        dataPoint.Clear();

        foreach (InputField data in newDataWindow.GetComponentsInChildren <InputField>())
        {
            dataPoint.Add(data.text);
            data.text = null;
        }

        kValue = k.GetComponent <InputField>().text;

        if (Convert.ToInt32(kValue) < 1)
        {
            kValue = "1";
        }

        if (Convert.ToInt32(kValue) > CSVläsare.pointList.Count())
        {
            kValue = CSVläsare.pointList.Count().ToString();
        }

        if (weighted.GetComponent <Toggle>().isOn == true)
        {
            weightedOrNot = true;
        }
        else
        {
            weightedOrNot = false;
        }

        newDataList.SetActive(false);

        foreach (Transform child in newDataWindow.transform)
        {
            Destroy(child.gameObject);
        }

        KUpdate.text = k.text;

        KNN.kValue      = Convert.ToInt32(kValue);
        KNN.trueOrFalse = weightedOrNot;

        NewDataPoint.AddDataPoint(dataPoint);
    }
Ejemplo n.º 5
0
    public void UpdateK()
    {
        string kValue = KUpdate.GetComponent <InputField>().text;

        if (Convert.ToInt32(kValue) < 1)
        {
            kValue = "1";
        }

        if (Convert.ToInt32(kValue) > CSVläsare.pointList.Count())
        {
            kValue = CSVläsare.pointList.Count().ToString();
        }

        KNN.kValue = Convert.ToInt32(kValue);

        NewDataPoint.ChangeDataPoint();
    }
Ejemplo n.º 6
0
    // Update is called once per frame
    private void Update()
    {
        // Codeblock for EditPosition
        if (TargetingScript.selectedTarget != null)
        {
            EditPanel.SetActive(true);
            ChangePanelColumnText.text = TargetingScript.selectedTarget.GetComponent <StoreIndexInDataBall>().TargetFeature;
            Denormalize();
        }
        else
        {
            EditPanel.SetActive(false);
        }

        // Codeblock for KNN
        if (KNN.KNNMode && KNN.KNNMove)
        {
            NewDataPoint.ChangeDataPoint();
            KNN.KNNMove = false;
        }
    }
Ejemplo n.º 7
0
 protected Task OnNewDataPoint(MarketDataFrame dataPoint)
 {
     return(Task.Run(() => NewDataPoint?.Invoke(this, dataPoint)));
 }