public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Items = new List <string> ()
            {
                "aaron Wood's solid polo",
                "Barry D's suit",
                "Vsevolod Borisov's jeans",
                "Artem Kalachev's solid polo",
                "Bill Good's jeans",
                "Andrey Filyakov's suit",
                "Igor Karpunin's boots",
                "Berry G's hat"
            };

            TableView.DataSource = this;
            TableView.Delegate   = this;

            SetupSearchBar();

            CustomerLabel.Text = LocalizedStrings.GetString(LocalizedStrings.CUSTOMER_LABEL_PLACEHOLDER);
            ScanButton.SetTitle(LocalizedStrings.GetString(LocalizedStrings.SCAN_BUTTON), UIControlState.Normal);
            DiscountTitleLabel.Text = LocalizedStrings.GetString(LocalizedStrings.DISCOUNT_LABEL);
            TaxTitleLabel.Text      = LocalizedStrings.GetString(LocalizedStrings.TAX_LABEL);
            TotalTitleLabel.Text    = LocalizedStrings.GetString(LocalizedStrings.TOTAL_LABEL);

            // TODO: remove default values
            DiscountLabel.Text = USD + "0.0";
            TaxLabel.Text      = USD + "0.0";
            TotalLabel.Text    = USD + "0.0";
        }
Esempio n. 2
0
        public FindMyGearPage()
        {
            AvaloniaXamlLoader.Load(this);

            _scanButton      = this.FindControl <ScanButton>("ScanButton");
            _leftMuteButton  = this.FindControl <MuteButton>("LeftMuteButton");
            _rightMuteButton = this.FindControl <MuteButton>("RightMuteButton");

            _batteryIconLeft  = this.FindControl <Image>("BatteryIconLeft");
            _batteryIconRight = this.FindControl <Image>("BatteryIconRight");
            _iconLeft         = this.FindControl <Image>("LeftIcon");
            _iconRight        = this.FindControl <Image>("RightIcon");

            _warningText      = this.FindControl <Label>("EarbudWarningText");
            _warningContainer = this.FindControl <Grid>("EarbudWarningContainer");

            SPPMessageHandler.Instance.BaseUpdate           += (sender, update) => UpdateDashboard(update);
            SPPMessageHandler.Instance.FindMyGearStopped    += InstanceOnFindMyGearStopped;
            SPPMessageHandler.Instance.FindMyGearMuteUpdate += InstanceOnFindMyGearMuteUpdate;

            EventDispatcher.Instance.EventReceived += OnEventReceived;

            _scanButton.ScanningStatusChanged += ScanButton_OnScanningStatusChanged;
            _leftMuteButton.Toggled           += LeftMuteButton_OnToggled;
            _rightMuteButton.Toggled          += RightMuteButton_OnToggled;
        }
Esempio n. 3
0
 private void runningstate()
 {
     progressLBL.Invoke((MethodInvoker)(() => progressLBL.Visible = true));
     ScanButton.Invoke((MethodInvoker)(() => ScanButton.Enabled = false));
     ScanButton.Invoke((MethodInvoker)(() => ScanButton.Visible = true));
     StopButton.Invoke((MethodInvoker)(() => StopButton.Enabled = true));
     StopButton.Invoke((MethodInvoker)(() => StopButton.Visible = true));
 }
Esempio n. 4
0
        public ScannerPanel()
        {
            InitializeComponent();

            ListViewHelper.EnableDoubleBuffer(FilesList);

            ScanButton.AttachToolTip("Scans selected directory for files that can be xrayed");
        }
Esempio n. 5
0
        protected void Initialize()
        {
            this.Title = "Scanner";

            // configure our scan button
            this._scanButton = new ScanButton();
            this._scanButton.TouchUpInside += (s, e) => {
                if (!Adapter.Current.IsScanning)
                {
                    Adapter.Current.StartScanningForDevices();
                }
                else
                {
                    Adapter.Current.StopScanningForDevices();
                }
            };
            this.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(this._scanButton), false);

            // setup the table
            this._tableSource = new BleDeviceTableSource();
            this._tableSource.DeviceSelected += (object sender, BleDeviceTableSource.DeviceSelectedEventArgs e) => {
                // stop scanning
                new Task(() => {
                    if (Adapter.Current.IsScanning)
                    {
                        Console.WriteLine("Still scanning, stopping the scan and reseting the right button");
                        Adapter.Current.StopScanningForDevices();
                        this._scanButton.SetState(ScanButton.ScanButtonState.Normal);
                    }
                }).Start();

                // show our connecting... overlay
                this._connectingDialog.LabelText = "Connecting to " + e.SelectedDevice.Name;
                this._connectingDialog.Show(true);

                // when the peripheral connects, load our details screen
                Adapter.Current.DeviceConnected += (object s, DeviceConnectionEventArgs connectArgs) => {
                    this._connectingDialog.Hide(false);

                    this._ServiceListScreen = new DeviceDetails.ServiceListScreen();

                    this._ServiceListScreen.ConnectedDevice = connectArgs.Device;

                    this.NavigationController.PushViewController(this._ServiceListScreen, true);
                };

                Adapter.Current.DeviceFailedToConnect += (object s, DeviceConnectionEventArgs connectArgs) => {
                    this._connectingDialog.Hide(false);

                    new UIAlertView("Device Failed to Connect", connectArgs.ErrorMessage, null, "ok. :(", null).Show();
                };

                // try and connect to the peripheral
                Adapter.Current.ConnectToDevice(e.SelectedDevice);
            };
        }
Esempio n. 6
0
 private void defaultstate(bool state)
 {
     exportButton.Invoke((MethodInvoker)(() => exportButton.Visible = true));
     exportButton.Invoke((MethodInvoker)(() => exportButton.Enabled = true));
     progressLBL.Invoke((MethodInvoker)(() => progressLBL.Visible = false));
     progressLBL.Invoke((MethodInvoker)(() => progressLBL.Text = ""));
     progressLBL.Invoke((MethodInvoker)(() => progressLBL.Visible = state));
     ScanButton.Invoke((MethodInvoker)(() => ScanButton.Enabled = true));
     ScanButton.Invoke((MethodInvoker)(() => ScanButton.Visible = true));
     StopButton.Invoke((MethodInvoker)(() => StopButton.Enabled = false));
     StopButton.Invoke((MethodInvoker)(() => StopButton.Visible = false));
 }
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);
    }
Esempio n. 8
0
 private void ScanArduino_DataReceived(object sender, SerialDataReceivedEventArgs e)
 {
     try
     {
         ArduinoMessage += ArduinoSerialPort.ReadExisting();
         ArduinoReadText.Invoke(new MethodInvoker(delegate
         {
             ArduinoReadText.Text += ArduinoMessage;
         }));
         if (ArduinoMessage.Contains("\n"))
         {
             measurementData.Add(Convert.ToInt32(ArduinoMessage));
             ArduinoMessage = "";
             ScanProgress.Invoke(new MethodInvoker(delegate
             {
                 ScanProgress.Value = 1 / scanLength;
             }));
             if (measurementData.Count < scanLength)
             {
                 SDMC1SerialPort.Write("+1\r");
             }
             else
             {
                 SDMC1SerialPort.DataReceived   -= ScanSDMC1_DataReceived;
                 SDMC1SerialPort.DataReceived   += SDMC1SerialPort_DataReceived;
                 ArduinoSerialPort.DataReceived -= ScanArduino_DataReceived;
                 ArduinoSerialPort.DataReceived += ArduinoSerialPort_DataReceived;
                 SDMC1SerialPort.Write("R" + scanStartPosition + "\r");
                 HomeButton.Invoke(new MethodInvoker(delegate
                 {
                     HomeButton.Enabled = true;
                 }));
                 ScanButton.Invoke(new MethodInvoker(delegate
                 {
                     ScanButton.Enabled = true;
                 }));
             }
             moves++;
         }
     }
     catch (Exception error)
     {
         MessageText.Invoke(new MethodInvoker(delegate
         {
             MessageText.Text = error.Message;
         }));
         ArduinoMessage = "";
     }
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // load our layout
            SetContentView(Resource.Layout.ScannerHome);

            // find our controls
            this._listView   = FindViewById <ListView> (Resource.Id.DevicesTable);
            this._scanButton = FindViewById <ScanButton> (Resource.Id.ScanButton);

            // create our list adapter
            this._listAdapter      = new DevicesAdapter(this, BluetoothLEManager.Current.DiscoveredDevices);
            this._listView.Adapter = this._listAdapter;
        }
Esempio n. 10
0
        protected void Initialize()
        {
            this.Title = "Scanner";

            // configure our scan button
            this._scanButton = new ScanButton();
            this._scanButton.TouchUpInside += (s, e) => {
                if (!BluetoothLEManager.Current.IsScanning)
                {
                    BluetoothLEManager.Current.BeginScanningForDevices();
                }
                else
                {
                    BluetoothLEManager.Current.StopScanningForDevices();
                }
            };
            this.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(this._scanButton), false);

            // setup the table
            this._tableSource = new BleDeviceTableSource();
            this._tableSource.PeripheralSelected += (object sender, BleDeviceTableSource.PeripheralSelectedEventArgs e) => {
                // stop scanning
                new Task(() => {
                    if (BluetoothLEManager.Current.IsScanning)
                    {
                        Console.WriteLine("Still scanning, stopping the scan and reseting the right button");
                        BluetoothLEManager.Current.StopScanningForDevices();
                        this._scanButton.SetState(ScanButton.ScanButtonState.Normal);
                    }
                }).Start();

                // show our connecting... overlay
                this._connectingDialog.LabelText = "Connecting to " + e.SelectedPeripheral.Name;
                this._connectingDialog.Show(true);

                // when the peripheral connects, load our details screen
                BluetoothLEManager.Current.DeviceConnected += (object s, CBPeripheralEventArgs periphE) => {
                    this._connectingDialog.Hide(false);

                    this._detailsScreen = this.Storyboard.InstantiateViewController("DeviceDetailsScreen") as DeviceDetails.DeviceDetailsScreen;
                    this._detailsScreen.ConnectedPeripheral = periphE.Peripheral;
                    this.NavigationController.PushViewController(this._detailsScreen, true);
                };

                // try and connect to the peripheral
                BluetoothLEManager.Current.CentralBleManager.ConnectPeripheral(e.SelectedPeripheral, new PeripheralConnectionOptions());
            };
        }
Esempio n. 11
0
 public void OpenSingleProduct(string name)
 {
     foreach (var prod in listOfProducts)
     {
         if (prod.name == name)
         {
             SingleProductTest.GetComponent <Text>().text     = prod.description;
             SingleProductCost.GetComponent <Text>().text     = prod.cost;
             SingleProductImage.GetComponent <Image>().sprite = prod.sprite;
             SingleProductName.GetComponent <Text>().text     = prod.name;
             SingleProductSize.GetComponent <Text>().text     = $"{prod.height} * {prod.width} * {prod.distance}";
             ScanButton.GetComponent <Button>().onClick.AddListener(delegate { OpenArScene(prod.scene); });
         }
     }
     MainObj.active   = false;
     SingleObj.active = true;
 }
Esempio n. 12
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // load our layout
            SetContentView(Resource.Layout.ScannerHome);

            // find our controls
            this._listView   = FindViewById <ListView> (Resource.Id.DevicesListView);
            this._scanButton = FindViewById <ScanButton> (Resource.Id.ScanButton);

            // create our list adapter
            this._listAdapter      = new DevicesAdapter(this, App.Current.BleAdapter.DiscoveredDevices);
            this._listView.Adapter = this._listAdapter;

            this.WireupLocalHandlers();
        }
Esempio n. 13
0
        private void Localize()
        {
            Text = LText.ScanAllFMsBox.TitleText;

            ScanAllFMsForLabel.Text      = LText.ScanAllFMsBox.ScanAllFMsFor;
            TitleCheckBox.Text           = LText.ScanAllFMsBox.Title;
            AuthorCheckBox.Text          = LText.ScanAllFMsBox.Author;
            GameCheckBox.Text            = LText.ScanAllFMsBox.Game;
            CustomResourcesCheckBox.Text = LText.ScanAllFMsBox.CustomResources;
            SizeCheckBox.Text            = LText.ScanAllFMsBox.Size;
            ReleaseDateCheckBox.Text     = LText.ScanAllFMsBox.ReleaseDate;
            TagsCheckBox.Text            = LText.ScanAllFMsBox.Tags;

            SelectAllButton.SetTextAutoSize(LText.Global.SelectAll);
            SelectNoneButton.SetTextAutoSize(LText.Global.SelectNone);

            ScanButton.SetTextAutoSize(LText.ScanAllFMsBox.Scan, ScanButton.Width);
            Cancel_Button.SetTextAutoSize(LText.Global.Cancel, Cancel_Button.Width);
        }
Esempio n. 14
0
        private void WriteText(string value)
        {
            if (ScanTextBox.IsFocused)
            {
                ScanButton.Focus();
            }

            if (Settings.Settings.SimulateKeyPress)
            {
                // use simulator for actual keypress events
                InputSimulator simulator = new InputSimulator();
                foreach (char c in value.ToCharArray())
                {
                    simulator.Keyboard.TextEntry(c);
                }
            }

            if (Settings.Settings.UseCopyPaste)
            {
                // use copy and paste, cause its faster and writes FNC1-Char which SendKeys does not
                Clipboard.SetText(value);
                SendKeys.SendWait("^{v}");
            }
        }
Esempio n. 15
0
 void ReleaseDesignerOutlets()
 {
     if (CustomerLabel != null)
     {
         CustomerLabel.Dispose();
         CustomerLabel = null;
     }
     if (DiscountLabel != null)
     {
         DiscountLabel.Dispose();
         DiscountLabel = null;
     }
     if (DiscountTitleLabel != null)
     {
         DiscountTitleLabel.Dispose();
         DiscountTitleLabel = null;
     }
     if (PauseButton != null)
     {
         PauseButton.Dispose();
         PauseButton = null;
     }
     if (ScanButton != null)
     {
         ScanButton.Dispose();
         ScanButton = null;
     }
     if (SearchBarContainerView != null)
     {
         SearchBarContainerView.Dispose();
         SearchBarContainerView = null;
     }
     if (TableView != null)
     {
         TableView.Dispose();
         TableView = null;
     }
     if (TaxLabel != null)
     {
         TaxLabel.Dispose();
         TaxLabel = null;
     }
     if (TaxTitleLabel != null)
     {
         TaxTitleLabel.Dispose();
         TaxTitleLabel = null;
     }
     if (TotalLabel != null)
     {
         TotalLabel.Dispose();
         TotalLabel = null;
     }
     if (TotalTitleLabel != null)
     {
         TotalTitleLabel.Dispose();
         TotalTitleLabel = null;
     }
     if (TrashButton != null)
     {
         TrashButton.Dispose();
         TrashButton = null;
     }
 }
Esempio n. 16
0
        void ReleaseDesignerOutlets()
        {
            if (EngineLabel != null)
            {
                EngineLabel.Dispose();
                EngineLabel = null;
            }

            if (LocationTextField != null)
            {
                LocationTextField.Dispose();
                LocationTextField = null;
            }

            if (MapMoveCheckbox != null)
            {
                MapMoveCheckbox.Dispose();
                MapMoveCheckbox = null;
            }

            if (NotificationCheckbox != null)
            {
                NotificationCheckbox.Dispose();
                NotificationCheckbox = null;
            }

            if (OpenGameFolderButton != null)
            {
                OpenGameFolderButton.Dispose();
                OpenGameFolderButton = null;
            }

            if (OpenReplayCheckbox != null)
            {
                OpenReplayCheckbox.Dispose();
                OpenReplayCheckbox = null;
            }

            if (PassLabel != null)
            {
                PassLabel.Dispose();
                PassLabel = null;
            }

            if (PassProgress != null)
            {
                PassProgress.Dispose();
                PassProgress = null;
            }

            if (PassTable != null)
            {
                PassTable.Dispose();
                PassTable = null;
            }

            if (RepairButton != null)
            {
                RepairButton.Dispose();
                RepairButton = null;
            }

            if (ReplayOpenCheckbox != null)
            {
                ReplayOpenCheckbox.Dispose();
                ReplayOpenCheckbox = null;
            }

            if (ReportButton != null)
            {
                ReportButton.Dispose();
                ReportButton = null;
            }

            if (ScanButton != null)
            {
                ScanButton.Dispose();
                ScanButton = null;
            }

            if (SkinMoveCheckbox != null)
            {
                SkinMoveCheckbox.Dispose();
                SkinMoveCheckbox = null;
            }

            if (UpdateButton != null)
            {
                UpdateButton.Dispose();
                UpdateButton = null;
            }

            if (UpdateProgress != null)
            {
                UpdateProgress.Dispose();
                UpdateProgress = null;
            }
        }
Esempio n. 17
0
        private void HomeSDMC1_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            int StartPosition = -1;
            int EndPosition   = -1;

            try
            {
                SDMC1Message += SDMC1SerialPort.ReadExisting();
                if (SDMC1Message.Contains("\r"))
                {
                    //if it says it just moved, check the limit switches
                    if (SDMC1Message.Contains("-1"))
                    {
                        SDMC1Message = "";
                        SDMC1SerialPort.Write("]\r");
                    }
                    //if it reports the limit switch, check if it's home, if not move
                    else if (SDMC1Message.Contains("]"))
                    {
                        // get only the numeric part of the input by starting at the first character, looking for the first digit, then looking for the first non-digit after that
                        for (int i = 0; i < SDMC1Message.Length; i++)
                        {
                            if (Char.IsDigit(SDMC1Message[i]))
                            {
                                StartPosition = i - 1;
                                break;
                            }
                        }
                        for (int i = StartPosition + 1; i < SDMC1Message.Length; i++)
                        {
                            if (!Char.IsDigit(SDMC1Message[i]))
                            {
                                EndPosition = i - 1;
                                break;
                            }
                        }
                        if (StartPosition > 0 && EndPosition > 0)
                        {
                            SDMC1Message = SDMC1Message.Substring(StartPosition, EndPosition);
                        }
                        else if (StartPosition > 0)
                        {
                            SDMC1Message = SDMC1Message.Substring(StartPosition);
                        }


                        Boolean home = (Convert.ToInt32(SDMC1Message) & 128) > 0;
                        if (!home && moves < homeDistance)
                        {
                            SDMC1SerialPort.Write("-1\r");
                            moves++;
                        }
                        else
                        {
                            if (moves > homeDistance - 1)
                            {
                                MessageText.Invoke(new MethodInvoker(delegate {
                                    MessageText.Text = "Over allowed home distance";
                                }));
                            }
                            SDMC1SerialPort.DataReceived -= HomeSDMC1_DataReceived;
                            SDMC1SerialPort.DataReceived += SDMC1SerialPort_DataReceived;
                            HomeButton.Invoke(new MethodInvoker(delegate {
                                HomeButton.Enabled = true;
                            }));
                            ScanButton.Invoke(new MethodInvoker(delegate {
                                ScanButton.Enabled = true;
                            }));
                            SDMC1SerialPort.Write("O0\r");
                        }
                        SDMC1Message = "";
                    }
                }
            }
            catch (Exception error)
            {
                SDMC1SerialPort.DataReceived -= HomeSDMC1_DataReceived;
                SDMC1SerialPort.DataReceived += SDMC1SerialPort_DataReceived;
                MessageText.Invoke(new MethodInvoker(delegate {
                    MessageText.Text = error.Message + " home 2 " + StartPosition + ", " + EndPosition;
                }));
                SDMC1Message = "";
            }
        }
Esempio n. 18
0
    //The function that saves the thumbnail, mission and metadata called from saveandgotoplanselection
    IEnumerator RenderTexture()
    {
        ButtonBack.SetActive(false);
        ButtonNext.SetActive(false);
        topInfoPanel.SetActive(false);
        DownInfoPanel.SetActive(false);
        otherPanel.SetActive(false);
        infoPanel.SetActive(false);
        ScanButton.SetActive(false);

        GameObject Helper = this.gameObject;

        //Assign the bounding box to the file
        MissionManager.modelBoundingBox = new Vector3(maxX, maxY, maxZ);
        //All this comments used to take a photo at the pointcloud, but for a reason unknown, it didn't center the image correctly to take the photo. TODO fix that


        // Vector3 auxPosition = Camera.main.transform.position;
        //
        // Camera.main.transform.parent.position = Vector3.zero;
        // Camera.main.transform.parent.rotation = Quaternion.Euler(0,0,0);
        // Camera.main.transform.localPosition = new Vector3(drone.transform.position.x, drone.transform.position.y + maxY * 3, drone.transform.position.z);
        // float fieldOfVIewHelper = Camera.main.fieldOfView;
        // float futureFOV = 2.0f * Mathf.Atan((Camera.main.transform.localPosition.y - (drone.transform.position.y - maxY)) * 0.5f / Vector3.Distance(Camera.main.transform.localPosition, drone.transform.position)) * Mathf.Rad2Deg;
        // futureFOV = Mathf.Clamp(futureFOV + 10.0f, 1.0f, 179.0f);
        // if (float.IsNaN(futureFOV))
        // {
        //     Camera.main.fieldOfView = 40;
        //     Camera.main.transform.localPosition = new Vector3(drone.transform.position.x, drone.transform.position.y * 3, drone.transform.position.z);
        // }
        // else
        // {
        //     Camera.main.fieldOfView = futureFOV;
        // }
        // Camera.main.transform.LookAt(drone.transform);
        // yield return new WaitForSeconds(1.0f);
        // Resolution auxResolution = Screen.currentResolution;
        // Screen.SetResolution(256, 256, true);
        // yield return new WaitForSeconds(1.0f);
        // yield return new WaitForEndOfFrame();
        // Camera.main.targetTexture = modelRenderer;
        //
        // Texture2D texture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);
        // UnityEngine.Debug.Log("CamPos: " + Camera.main.transform.position);
        // UnityEngine.Debug.Log("CamRot: " + Camera.main.transform.rotation.eulerAngles);
        // UnityEngine.Debug.Log("Drone: " + drone.transform.position);
        // UnityEngine.Debug.Log("Fov: " + futureFOV);
        // Camera.main.Render();
        // texture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
        // texture.Apply();
        // byte[] bytes = texture.EncodeToPNG();

        // save the image
        //Remember to create directories if they don't exist
        if (!System.IO.Directory.Exists(Application.persistentDataPath + "/PersistentData/Thumbnails"))
        {
            System.IO.Directory.CreateDirectory(Application.persistentDataPath + "/PersistentData/Thumbnails");
        }
        //Create the thumbnail from a jpg that we have. TODO change to a render of the PC
        File.WriteAllBytes(Application.persistentDataPath + "/PersistentData/Thumbnails/" + MissionManager.guid + ".jpeg.thumbnail", pointCloudThumbnail.texture.EncodeToPNG());
        //DestroyObject(texture);
        // Camera.main.targetTexture.Release();
        // Camera.main.targetTexture = null;
        // Screen.SetResolution(auxResolution.width, auxResolution.height, true);
        // Camera.main.fieldOfView = fieldOfVIewHelper;
        // Camera.main.transform.position = auxPosition;
        //string jsonPointCloud = JsonUtility.ToJson(savedPointCloud);

        //CreatePlan(jsonPointCloud);


        bool canBuild = true;


        //UnityEngine.Debug.Log("Creating pointCloud scene");

        if (canBuild)
        {
            Matrix4x4 mat = Matrix4x4.identity;


            if (!System.IO.Directory.Exists(Application.persistentDataPath + "/PersistentData"))
            {
                System.IO.Directory.CreateDirectory(Application.persistentDataPath + "/PersistentData");
            }

            if (!System.IO.Directory.Exists(Application.persistentDataPath + "/PersistentData/Maps"))
            {
                System.IO.Directory.CreateDirectory(Application.persistentDataPath + "/PersistentData/Maps");
            }

            //UnityEngine.Debug.Log("Creating Map: " + Application.persistentDataPath + "/PersistentData/Maps/" + MissionManager.guid + ".dae.map");
            //File.Create(Application.persistentDataPath + "/PersistentData/Maps/" + MissionManager.guid + ".dae.map").Close();
            //File.WriteAllText(Application.persistentDataPath + "/PersistentData/Maps/" + MissionManager.guid + ".dae.map", jsonPointCloud, System.Text.Encoding.ASCII);
            //Need to set loading bigger, in the middle and to rotate it in the next while loop inside this function
            Loading.SetActive(true);
            yield return(new WaitForEndOfFrame());

            if (!System.IO.Directory.Exists(Application.persistentDataPath + "/PersistentData/Thumbnails"))
            {
                System.IO.Directory.CreateDirectory(Application.persistentDataPath + "/PersistentData/Thumbnails");
            }



            MapMetadata MapMetadata = new MapMetadata(MissionManager.guid, "MapMetadata_" + MissionManager.guid, "ImportedLocation_", MapMetadata.MapType.PointCloud);
            //MapMetadata.MapPath = Application.persistentDataPath + "/PersistentData/Maps/" + MissionManager.guid + ".dpl.map";
            MapMetadata.BoundingBox = new Vector3(maxX, maxY, maxZ);
            MapMetadata.Location    = location;
            MapMetadata.Name        = mapName;
            MapMetadata.Byte_Size   = (ulong)fileSize;
            string metadataJson = JsonUtility.ToJson(MapMetadata);

            if (!System.IO.Directory.Exists(Application.persistentDataPath + "/PersistentData/Missions"))
            {
                System.IO.Directory.CreateDirectory(Application.persistentDataPath + "/PersistentData/Missions");
            }

            System.IO.File.WriteAllText(Application.persistentDataPath + "/PersistentData/Missions/" + MapMetadata.Guid + ".json.metadata", metadataJson);
            yield return(new WaitForEndOfFrame());

            Map map = new Map();
            map.Guid = MissionManager.guid;
            //Pozyx is in milimiters, need to convert to that
            map.unityToAnchors       = Matrix4x4.identity;
            mat.m00                 *= 1000;
            mat.m11                 *= 1000;
            mat.m22                 *= 1000;
            map.unityToAnchors       = mat;
            MissionManager.invMatrix = Matrix4x4.Inverse(mat);
            string mapJson = JsonUtility.ToJson(map);
            System.IO.File.WriteAllText(Application.persistentDataPath + "/PersistentData/Missions/" + map.Guid + ".json.mission", mapJson);


            //yield return new WaitForEndOfFrame();



            //SceneManager.LoadScene("PlanSelection");
            //guid = System.Guid.NewGuid().ToString();
            //Map m = new Map();
            //MapMetadata MapMetadata = new MapMetadata(guid, "MapMetadata_" + guid.Split('-')[0], "EmptyLocation_", MapMetadata.MapType.EmptyBox);
            //MapMetadata.BoxScale = new Vector3(width / 10, height / 10, depth / 10);
            //MapMetadata.BoundingBox = new Vector3(width, height, depth);
            //string json = JsonUtility.ToJson(MapMetadata);
            //
            //if (!System.IO.Directory.Exists(Application.persistentDataPath + "/PersistentData"))
            //    System.IO.Directory.CreateDirectory(Application.persistentDataPath + "/PersistentData");
            //
            //if (!System.IO.Directory.Exists(Application.persistentDataPath + "/PersistentData/Missions"))
            //    System.IO.Directory.CreateDirectory(Application.persistentDataPath + "/PersistentData/Missions");
            //
            //System.IO.File.WriteAllText(Application.persistentDataPath + "/PersistentData/Missions/" + MapMetadata.Name + ".json", json);
        }
        //This is for the app that clicked the done button. It exits here and won't enter more than once.
        PlanSelectionManager.uploadMapMetadata = true;
        clientUnity.client.SendCommand((byte)Modules.PLAN_LIBRARIAN_MODULE, (byte)PlanLibrarianCommandType.PLAN_LIB_REQUEST_LIBRARY_PATH);
        done = false;
        MapperModule.state = MapperModule.MapperState.IDLE;
        SceneManager.LoadScene("General");



        // Screen.SetResolution(auxResolution.width, auxResolution.height, true);
    }
Esempio n. 19
0
 /// <summary>
 /// Initializes the scan button.
 /// </summary>
 void InitializeScanButton()
 {
     ScanButton.SetTitle("Scan", UIControlState.Normal);
     ScanButton.SetTitle("Scanning...", UIControlState.Disabled);
 }