Beispiel #1
0
    /// <summary>
    /// Wrapper method to trigger the Activation Toggle using Leap Motion interaction.
    /// </summary>
    private void vrlmTriggerActivationToggle()
    {
        bool hasBeenActivated = tdrcInterface.triggerActivationToggle();

        // if this 3D Radar Chart has been activated: link this 3D Radar Chart to the user's Leap Motion hand menus
        if (hasBeenActivated)
        {
            // update reference to Time Slice GameObject
            ibTimeSliceGO = tdrcInterface.interact_timeSliceGO.GetComponent <InteractionBehaviour>();

            // find GameObject instance holding the user's Leap Motion Hand Menu components
            GameObject vrlmAttachmentControllerGO = GameObject.Find(cnfgVRLM_LeapMotionAttachmentGameObjectName);

            // set Hand Menu references and update them
            if (vrlmAttachmentControllerGO != null)
            {
                timeSliceMovementHandMenu = vrlmAttachmentControllerGO.GetComponent <VRLMTimeSliceMovementHandMenu>();
                if (timeSliceMovementHandMenu != null)
                {
                    timeSliceMovementHandMenu.setTDRCInterface(tdrcInterface);
                    timeSliceMovementHandMenu.updateTimeLabel(tdrcInterface.freqPolyManager.getFrequencyPointListForCurrentlySelectedTimeIndex()[0].time);
                    timeSliceMovementHandMenu.updateButtonSprites();
                }

                timeRangeSelectionHandMenu = vrlmAttachmentControllerGO.GetComponent <VRLMTimeRangeSelectionHandMenu>();
                if (timeRangeSelectionHandMenu != null)
                {
                    timeRangeSelectionHandMenu.setTDRCInterface(tdrcInterface);
                }
            }

            // find GameObject instance holding the user's Leap Motion Time Range Selection Two-Hand Pinch component
            GameObject vrlmTimeRangeSelectionTwoHandPinchGO = GameObject.Find(cnfgVRLM_LeapMotionTimeRangeSelectionTwoHandPinchGameObjectName);

            // set reference and update
            if (vrlmTimeRangeSelectionTwoHandPinchGO != null)
            {
                timeRangeSelectionTwoHandPinch = vrlmTimeRangeSelectionTwoHandPinchGO.GetComponent <VRLMTimeRangeSelectionTwoHandPinch>();
                if (timeRangeSelectionTwoHandPinch != null)
                {
                    timeRangeSelectionTwoHandPinch.setTDRCInterface(tdrcInterface);
                }
            }
        }
    }
Beispiel #2
0
    /// <summary>
    /// General update routine.
    /// </summary>
    private void Update()
    {
        // KEYBOARD INTERACTION for demonstration purposes
        //

        // Q - init and load data
        if (Input.GetKeyDown(KeyCode.Q))
        {
            Debug.Log("Q pressed");

            // only instantiate if not already existing
            if (demo_TDRCInterface == null && mainCamera != null)
            {
                // instantiate new TDRCInterface GameObject (attached as a Child to the GameObject this demo script is attached to) and get reference to ThreeDimRadarChartInterface component
                demo_TDRCInterface      = Instantiate(Resources.Load(demo_TDRCInterfacePrefab) as GameObject, this.transform).GetComponent <ThreeDimRadarChartInterface>();
                demo_TDRCInterface.name = "TDRCInterface_1";

                // AFTER instantiation _AND_ BEFORE INITIALIZATION: do additional custom configurations to the ThreeDimRadarChartInterface, e.g., set data source and data source color coding properties, configure data transformation related values (normalization, scaling), etc.
                // Note: Default configuration possible beforehand by editing the Prefab directly in the Resources directory using the Unity Inspector. (Recommendation: If done so, create a copy of the original Prefab for save keeping of original configuration.)
                //
                // Some configuration examples:
                //demo_TDRCInterface.dataSourceLocalFilePath = "3D_Radar_Chart-resources/data/sample_data-3dtimevis";
                //demo_TDRCInterface.isDataLoadedFromServer = false;
                //demo_TDRCInterface.cnfg2d_isFrequencyPolygonVisualizationNormalized = true;
                //demo_TDRCInterface.cnfg2d_frequencyPolygonMinimumDataValueForNormalization = 1;     // based on Resources/3D_Radar_Chart-resources/data/sample_data-3dtimevis
                //demo_TDRCInterface.cnfg2d_frequencyPolygonMaximumDataValueForNormalization = 36;    // based on Resources/3D_Radar_Chart-resources/data/sample_data-3dtimevis
                //demo_TDRCInterface.cnfg2d_frequencyPolygonNormalizationScaleFactor = 10.0f;
                //demo_TDRCInterface.cnfg2d_frequencyPolygonDataValueScaling = TDRCFrequencyPolygon.DataValueScaling.Linear;
                //demo_TDRCInterface.cnfg2d_linearScaleFactor = 0.25f;
                // ...

                // configuration for VR and Leap Motion
                if (demo_isEnabledForLeapMotionVRUsage)
                {
                    demo_TDRCInterface.cnfgVRLM_isEnabled = true;
                }
                else
                {
                    demo_TDRCInterface.cnfgVRLM_isEnabled = false;
                }

                // initialize 3D Radar Chart
                demo_TDRCInterface.initWithCameraAndPosition(mainCamera, demo_TDRCPosition);
            }
        }

        // if 3D Radar Chart has been set up
        if (demo_TDRCInterface != null)
        {
            // A - toggle activation state
            if (Input.GetKeyDown(KeyCode.A))
            {
                Debug.Log("A pressed");
                demo_TDRCInterface.triggerActivationToggle();
            }

            // RIGHT / LEFT ARROW KEY - manual rotation of the Rotation Handle
            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                Debug.Log("RIGHT Arrow pressed");
                demo_TDRCInterface.interact_rotationHandle.rotateRight(demo_TDRCInterface.cnfgRotHndl_manualRotationEulerAngle);
            }
            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                Debug.Log("LEFT Arrow pressed");
                demo_TDRCInterface.interact_rotationHandle.rotateLeft(demo_TDRCInterface.cnfgRotHndl_manualRotationEulerAngle);
            }

            // UP / DOWN ARROW KEY - move Time Slice up and down by one index along the time-series axis
            if (Input.GetKeyDown(KeyCode.UpArrow))
            {
                Debug.Log("UP Arrow pressed");
                demo_TDRCInterface.timeSliceMoveUpOneIndex();
            }
            if (Input.GetKeyDown(KeyCode.DownArrow))
            {
                Debug.Log("DOWN Arrow pressed");
                demo_TDRCInterface.timeSliceMoveDownOneIndex();
            }

            // S - iterate through Time Range Selection states
            if (Input.GetKeyDown(KeyCode.S))
            {
                Debug.Log("S pressed");
                demo_TDRCInterface.timeRangeSelector.iterateTimeRangeSelectionState();
            }
        }
    }