Example #1
0
    // 1.
    void display0()
    {
        ClearAllChange();
        string[] xTimes  = new string[] { "Jan. 2021", "Feb. 2021", "Mar. 2021", "Apr. 2021", "May 2021" };
        string[] xSpaces = new string[] { "ESTIA1", "ESTIA2", "ESTIA3", "ESTIA4", "ESTIA5", "ESTIA6" };

        sbyte[] yData       = new sbyte[] { 12, 18, 25, 10, 20 };
        string  xAxisLegend = "<size=7><line-height=60>";

        for (int i = 0; i < xTimes.Length; i++)
        {
            xAxisLegend += xTimes[i] + "\n";
        }
        string yAxisLegend = "<size=7>";

        for (int i = 0; i < xSpaces.Length; i++)
        {
            yAxisLegend += xSpaces[i] + "<space=38>";
        }

        for (int i = 0; i < expanDialSticks.NbRows; i++)
        {
            for (int j = 0; j < expanDialSticks.NbColumns; j++)
            {
                int   datum = UnityEngine.Random.Range(0, 40);
                float coeff = datum / 40f;
                expanDialSticks[i, j].TargetText  = "<b>" + datum + " MWh</b>";
                expanDialSticks[i, j].TargetColor = new Color(1f - coeff, 1f - coeff, 1f);
                expanDialSticks[i, j].TargetTextureChangeDuration = 1f;

                expanDialSticks[i, j].TargetPosition            = (sbyte)datum;
                expanDialSticks[i, j].TargetShapeChangeDuration = 1f;
            }
        }
        expanDialSticks.triggerTextureChange();
        expanDialSticks.triggerShapeChange();

        /*string legend = "<line-height=1em><voffset=-8><size=32><color=\"green\">•</voffset><size=8><color=\"black\">energy production\n"
         + "<voffset=-8><size=32><color=\"orange\">•</voffset><size=8><color=\"black\">energy storage\n"
         + "<voffset=-8><size=32><color=\"blue\">•</voffset><size=8><color=\"black\">energy consumption\n";*/

        /*string labels = "<size=7><pos=3%>Past month <pos=85%>Next month\n";
         * string direction = "<line-height=10><size=9>◄────────────────────────────────────────────►\n";
         * string titles = "<b><line-height=10><size=10><pos=0%>Data Type<pos=30%>Mode<pos=50%>Time Scale<pos=75%>Space Scale</b>\n";
         * string firstOption = "<line-height=7><size=7><pos=0%><color=#0000FFFF>■ <color=#000000FF>Energy Consumption<pos=30%><alpha=#FF>Time<pos=50%><alpha=#AA>Hours<pos=75%><alpha=#AA>Devices\n";
         * string secondOption = "<line-height=7><size=7><pos=0%><color=#FF9900AA>■ <color=#000000AA>Energy Storage<pos=30%><alpha=#AA>Space<pos=50%><alpha=#AA>Days<pos=75%><alpha=#AA>Rooms\n";
         * string thirdOption = "<line-height=7><size=7><pos=0%><color=#00FF00AA>■ <color=#000000AA>Energy Production<pos=50%><alpha=#FF>Months<pos=75%><alpha=#FF>Buildings ► ESTIA1\n";
         * string legend = labels + direction + titles +  firstOption + secondOption + thirdOption;*/
        expanDialSticks.setLeftBorderText(TextAlignmentOptions.Center, 16, Color.black, xAxisLegend, new Vector3(90f, -90f, 0f));
        expanDialSticks.setBottomBorderText(TextAlignmentOptions.Center, 8, Color.black, yAxisLegend, new Vector3(90f, -90f, 0f));
        //expanDialSticks.setRightBorderText(TextAlignmentOptions.Center, 16, Color.black, legend, new Vector3(90f, 90f, 0f));
    }
Example #2
0
 void calibrate0()
 {
     for (int i = 0; i < expanDialSticks.NbRows; i++)
     {
         for (int j = 0; j < expanDialSticks.NbColumns; j++)
         {
             expanDialSticks[i, j].TargetColor                 = new Color(1f, 1f, 1f);
             expanDialSticks[i, j].TargetPlaneTexture          = "cross";
             expanDialSticks[i, j].TargetTextureChangeDuration = 1f;
         }
     }
     expanDialSticks.triggerTextureChange();
     expanDialSticks.triggerShapeChange();
 }
Example #3
0
 void AllDown(float duration)
 {
     for (int i = 0; i < expanDialSticks.NbRows; i++)
     {
         for (int j = 0; j < expanDialSticks.NbColumns; j++)
         {
             //expanDialSticks.modelMatrix[i, j].TargetColor = Color.white;
             //expanDialSticks.modelMatrix[i, j].TargetTextureChangeDuration = duration;
             expanDialSticks.modelMatrix[i, j].TargetPosition            = 0;
             expanDialSticks.modelMatrix[i, j].TargetShapeChangeDuration = duration;
         }
     }
     expanDialSticks.triggerTextureChange();
     expanDialSticks.triggerShapeChange();
 }
Example #4
0
 private void HandleConnected(object sender, MqttConnectionEventArgs e)
 {
     Debug.Log("Application connected.");
     connected = true;
     ViewFromDataSet();
     expanDialSticks.triggerTextureChange();
     expanDialSticks.triggerShapeChange();
 }
Example #5
0
    void OnGUI()
    {
        // Make a text field that modifies stringToEdit.
        float midX            = Screen.width / 2.0f;
        float midY            = Screen.height / 2.0f;
        float componentHeight = 20;
        float componentWidth  = 50;

        stringCameraX = GUI.TextField(new Rect(midX - 100, 50, 50, componentHeight), stringCameraX, 25);
        stringCameraY = GUI.TextField(new Rect(midX - 50, 50, 50, componentHeight), stringCameraY, 25);
        stringCameraZ = GUI.TextField(new Rect(midX, 50, 50, componentHeight), stringCameraZ, 25);


        if (GUI.Button(new Rect(midX + 50, 50, componentWidth, componentHeight), "CAMERA"))
        {
            float cameraX = float.Parse(stringCameraX);
            float cameraY = float.Parse(stringCameraY);
            float cameraZ = float.Parse(stringCameraZ);
            SARCameraPrefab.transform.position = new Vector3(cameraX, cameraY, cameraZ);
        }

        int index    = 0;
        int position = 0;

        stringIndex    = GUI.TextField(new Rect(midX - 25, 25, 50, componentHeight), stringIndex, 25);
        stringPosition = GUI.TextField(new Rect(midX + 25, 25, 50, componentHeight), stringPosition, 25);

        if (GUI.Button(new Rect(midX + 75, 25, componentWidth, componentHeight), "SEND"))
        {
            index    = int.Parse(stringIndex);
            position = int.Parse(stringPosition);
            Debug.Log(index + " " + position);
            int row    = (int)(index / (float)expanDialSticks.NbColumns);
            int column = index % expanDialSticks.NbColumns;
            Debug.Log(row + " " + column);
            expanDialSticks.modelMatrix[row, column].TargetPosition            = (sbyte)position;
            expanDialSticks.modelMatrix[row, column].TargetShapeChangeDuration = 2f;
            expanDialSticks.triggerShapeChange();
        }
        if (GUI.Button(new Rect(midX + 150, 25, componentWidth, componentHeight), "CROSS"))
        {
            for (int i = 0; i < expanDialSticks.NbRows; i++)
            {
                for (int j = 0; j < expanDialSticks.NbColumns; j++)
                {
                    expanDialSticks.modelMatrix[i, j].TargetColor = Color.red;
                    expanDialSticks.modelMatrix[i, j].TargetTextureChangeDuration        = 0.1f;
                    expanDialSticks.modelMatrix[i, j].TargetProjectorFrontTexture        = "cross-reverse";
                    expanDialSticks.modelMatrix[i, j].TargetProjectorFrontColor          = Color.white;
                    expanDialSticks.modelMatrix[i, j].TargetProjectorFrontRotation       = 90f;
                    expanDialSticks.modelMatrix[i, j].TargetProjectorFrontSize           = 0.02f;
                    expanDialSticks.modelMatrix[i, j].TargetProjectorFrontChangeDuration = 0.1f;
                }
            }
            expanDialSticks.triggerProjectorChange();
            expanDialSticks.triggerTextureChange();
        }
    }
Example #6
0
 void RandomColor()
 {
     for (int i = 0; i < expanDialSticks.NbRows; i++)
     {
         for (int j = 0; j < expanDialSticks.NbColumns; j++)
         {
             if (expanDialSticks.viewMatrix[i, j].TargetTextureChangeDuration <= 0f)                 // if previous texture change is finished
             {
                 Color randomColor    = Random.ColorHSV(0f, 1f, 0f, 1f, 0.5f, 1f);
                 float randomDuration = Random.Range(0.25f, 5f);
                 expanDialSticks.modelMatrix[i, j].TargetColor = randomColor;
                 expanDialSticks.modelMatrix[i, j].TargetTextureChangeDuration = randomDuration;
             }
             else
             {
                 expanDialSticks.modelMatrix[i, j].TargetTextureChangeDuration = expanDialSticks.viewMatrix[i, j].TargetTextureChangeDuration;
             }
         }
     }
     expanDialSticks.triggerTextureChange();
 }
Example #7
0
    void Update()
    {
        // check if ExpanDialSticks is connected
        if (connected)
        {
            if (Input.GetKey("escape") || (currentIndex > expanDialSticks.NbRows * expanDialSticks.NbColumns - 1))
            {
                Quit();
            }

            if (Input.GetKeyDown("i"))
            {
                for (int i = 0; i < expanDialSticks.NbRows; i++)
                {
                    for (int j = 0; j < expanDialSticks.NbColumns; j++)
                    {
                        expanDialSticks.modelMatrix[i, j].TargetColor = Color.red;
                        expanDialSticks.modelMatrix[i, j].TargetTextureChangeDuration   = 0.1f;
                        expanDialSticks.modelMatrix[i, j].TargetProjectorTexture        = "cross-reverse";
                        expanDialSticks.modelMatrix[i, j].TargetProjectorColor          = Color.white;
                        expanDialSticks.modelMatrix[i, j].TargetProjectorRotation       = 90f;
                        expanDialSticks.modelMatrix[i, j].TargetProjectorSize           = 2f;
                        expanDialSticks.modelMatrix[i, j].TargetProjectorChangeDuration = 0.1f;
                    }
                }
                expanDialSticks.triggerProjectorChange();
                expanDialSticks.triggerTextureChange();
            }

            if (Input.GetKeyDown("n"))
            {
                int i = currentIndex / expanDialSticks.NbColumns;                // int i = 4;
                int j = currentIndex % expanDialSticks.NbColumns;                // int j = 3;

                expanDialSticks.modelMatrix[i, j].TargetPosition            = 30;
                expanDialSticks.modelMatrix[i, j].TargetShapeChangeDuration = 1f;
                expanDialSticks.triggerShapeChange();
                currentIndex++;
                Debug.Log(i + " " + j + " " + 30);
            }
        }
    }
    // Rover Control

    void displayRoverControlStart()
    {
        ClearAllChange();
        // Pitch/Roll/Yaw/Throlle/On/Pull/push
        // Button on/off
        expanDialSticks[4, 5].TargetText     = "Start";
        expanDialSticks[4, 5].TargetColor    = new Color(0f, 1f, 0f);
        expanDialSticks[4, 5].TargetTextSize = 2f;
        expanDialSticks[4, 5].TargetTextureChangeDuration = 1f;
        expanDialSticks[4, 5].TargetPosition            = 5;
        expanDialSticks[4, 5].TargetShapeChangeDuration = 1f;
        expanDialSticks.triggerTextureChange();
        expanDialSticks.triggerShapeChange();
        string legend = "Starting the rover with a button.";

        expanDialSticks.setLeftBorderText(TextAlignmentOptions.Center, LEGEND_SIZE, Color.black, legend, new Vector3(90f, 0f, 0f));
        expanDialSticks.setRightBorderText(TextAlignmentOptions.Center, LEGEND_SIZE, Color.black, legend, new Vector3(90f, 180f, 0f));
    }