Example #1
0
    public void OnExitLoadedPaintingClick()
    {
        mLocalizationThumbnailContainer.gameObject.SetActive(false);

        loadPanel.SetActive(false);
        startPanel.SetActive(true);

        LibPlacenote.Instance.StopSession();
        FeaturesVisualizer.ClearPointcloud();

        onClearAllClick();
    }
Example #2
0
        public void OnResetClick()
        {
            mLoadingPanel.SetActive(false);
            mInitPanel.SetActive(true);

            LibPlacenote.Instance.StopSession();
            FeaturesVisualizer.ClearPointcloud();

            mModelWaving.SetActive(false);
            mModelDancing.SetActive(false);

            statusLabel.text = "Session was reset. Create a new map or re-load an existing map";
        }
        public void OnExitMapClick()
        {
            MessageManager.Instance.ShowMessage("Session was reset. You can start new map or load your map again.");

            //update UI mode
            UIManager.Instance.SetUIMode(UIManager.UIMode.Init);
            InitFacade.Instance.SetUIMode(InitFacade.UIMode.Inititialized);

            LibPlacenote.Instance.StopSession();
            FeaturesVisualizer.ClearPointcloud();

            GetComponent <AnchorManager>().ClearAnchors();
        }
        public void OnExitClick()
        {
            mLabelText.text = "Session was reset. You can start new map or load your map again.";

            mInitPanel.SetActive(true);
            mMapLoadPanel.SetActive(false);
            mMapLoadButtonPanel.SetActive(false);
            mLocalizationThumbnail.gameObject.SetActive(false);

            mLoadedOnce = false;

            LibPlacenote.Instance.StopSession();
            FeaturesVisualizer.ClearPointcloud();

            GetComponent <ContentManager>().ClearNotes();
        }
Example #5
0
 public void onClickEnablePointCloud()
 {
     if (pointCloudOn == false)
     {
         FeaturesVisualizer.EnablePointcloud(new Color(1f, 1f, 1f, 0.2f), new Color(1f, 1f, 1f, 0.8f));
         pointCloudOn = true;
         Debug.Log("Point Cloud On");
     }
     else
     {
         FeaturesVisualizer.DisablePointcloud();
         FeaturesVisualizer.ClearPointcloud();
         pointCloudOn = false;
         Debug.Log("Point Cloud Off");
     }
 }
Example #6
0
        // Save a map and upload it to Placenote cloud
        public void OnSaveMapClick()
        {
            // close the mapping panel
            mMappingPanel.SetActive(false);

            mModelWaving.SetActive(false);
            FeaturesVisualizer.ClearPointcloud();

            statusLabel.text = "Saving your scene.";

            LibPlacenote.Instance.SaveMap(
                (mapId) =>
            {
                savedMapID = mapId;
                LibPlacenote.Instance.StopSession();
                GetComponent <FileReadWrite>().WriteMapIDToFile(mapId);
                GetComponent <FileReadWrite>().WriteModelTransformToFile(mModelWaving.transform.position, mModelWaving.transform.rotation);

                statusLabel.text = "Uploading map with ID: " + savedMapID;
            },
                (completed, faulted, percentage) =>
            {
                if (completed)
                {
                    statusLabel.text = "Upload Completed! You can now click Load Map.";

                    // enable the panel to let users load map
                    mInitPanel.SetActive(true);
                }
                else if (faulted)
                {
                    statusLabel.text = "Upload of Map: " + savedMapID + " failed";
                }
                else
                {
                    statusLabel.text = "Upload Progress: " + (percentage * 100).ToString("F2") + "%";
                }
            }
                );
        }
        public void OnSaveMapClick()
        {
            if (!LibPlacenote.Instance.Initialized())
            {
                Debug.Log("SDK not yet initialized");
                return;
            }

            if (!mapQualityThresholdCrossed)
            {
                mLabelText.text = "Map quality is not good enough to save. Scan a small area with many features and try again.";
                return;
            }

            bool         useLocation  = Input.location.status == LocationServiceStatus.Running;
            LocationInfo locationInfo = Input.location.lastData;

            mLabelText.text = "Saving...";

            LibPlacenote.Instance.SaveMap((mapId) =>
            {
                LibPlacenote.Instance.StopSession();
                FeaturesVisualizer.ClearPointcloud();

                mSaveMapId = mapId;

                mMappingPanel.SetActive(false);

                LibPlacenote.MapMetadataSettable metadata = new LibPlacenote.MapMetadataSettable();


                metadata.name = "Note: " + System.DateTime.Now.ToString();

                mLabelText.text = "Saved Map Name: " + metadata.name;

                JObject userdata  = new JObject();
                metadata.userdata = userdata;

                JObject notesList = GetComponent <ContentManager>().Notes2JSON();

                userdata["notesList"] = notesList;
                GetComponent <ContentManager>().ClearNotes();

                if (useLocation)
                {
                    metadata.location           = new LibPlacenote.MapLocation();
                    metadata.location.latitude  = locationInfo.latitude;
                    metadata.location.longitude = locationInfo.longitude;
                    metadata.location.altitude  = locationInfo.altitude;
                }

                LibPlacenote.Instance.SetMetadata(mapId, metadata, (success) =>
                {
                    if (success)
                    {
                        Debug.Log("Meta data successfully saved!");
                    }
                    else
                    {
                        Debug.Log("Meta data failed to save");
                    }
                });
                mCurrMapDetails = metadata;
            }, (completed, faulted, percentage) =>
            {
                if (completed)
                {
                    mLabelText.text = "Upload Complete! You can now click My Maps and choose a map to load.";
                    mInitPanel.SetActive(true);
                }
                else if (faulted)
                {
                    mLabelText.text = "Upload of Map Named: " + mCurrMapDetails.name + "faulted";
                }
                else
                {
                    mLabelText.text = "Uploading Map " + "(" + (percentage * 100.0f).ToString("F2") + " %)";
                }
            });
        }
        //-----------------------ContinuousMappingPanel-------------------------


        public void OnSaveMapClick()
        {
            if (!SanityCheck())
            {
                return;
            }

            if (!mapQualityThresholdCrossed)
            {
                MessageManager.Instance.ShowMessage(string.Format("Map quality is not good enough to save. Scan a small area with many features and try again."));
                return;
            }

            bool         isLocationServiceAvailable = Input.location.status == LocationServiceStatus.Running;
            LocationInfo locationInfo = Input.location.lastData;

            //update UI mode
            UIManager.Instance.SetUIMode(UIManager.UIMode.ContinuousMapping);
            ContinuousMappingFacade.Instance.SetUIMode(ContinuousMappingFacade.UIMode.SavingMap);

            MessageManager.Instance.ShowMessage("Saving...");

            LibPlacenote.Instance.SaveMap((mapId) =>
            {
                LibPlacenote.Instance.StopSession();
                FeaturesVisualizer.ClearPointcloud();

                //continousMappingPanel.SetActive(false); //why again???

                LibPlacenote.MapMetadataSettable metadata = new LibPlacenote.MapMetadataSettable();

                metadata.name = Utilities.GenerateMapId();
                MessageManager.Instance.ShowMessage("Saving map: " + metadata.name);

                JObject userdata  = new JObject();
                metadata.userdata = userdata;

                JObject anchorList = GetComponent <AnchorManager>().AnchorInfoListToJSON();

                userdata[Const.ANCHOR_DATA_JSON_ROOT] = anchorList;
                GetComponent <AnchorManager>().ClearAnchors();

                if (isLocationServiceAvailable)
                {
                    metadata.location           = new LibPlacenote.MapLocation();
                    metadata.location.latitude  = locationInfo.latitude;
                    metadata.location.longitude = locationInfo.longitude;
                    metadata.location.altitude  = locationInfo.altitude;
                }

                LibPlacenote.Instance.SetMetadata(mapId, metadata, (success) =>
                {
                    if (success)
                    {
                        Debug.Log("Meta data successfully saved!");
                    }
                    else
                    {
                        Debug.Log("Meta data failed to save");
                    }
                });
                currMapDetails = metadata;
            }, (completed, faulted, percentage) =>
            {
                if (completed)
                {
                    MessageManager.Instance.ShowMessage("Upload Complete! You can now click My Maps and choose a map to load.");

                    //update UI mode
                    UIManager.Instance.SetUIMode(UIManager.UIMode.Init);
                    InitFacade.Instance.SetUIMode(InitFacade.UIMode.Inititialized);

                    this.lastMapSize = 0;
                    isNewExperience  = true; //reset the new experience mode
                }
                else if (faulted)
                {
                    MessageManager.Instance.ShowMessage(string.Format("Upload of map '{0}' failed", currMapDetails.name));
                }
                else
                {
                    MessageManager.Instance.ShowMessage(string.Format("Uploading map ( {0} %)", (percentage * 100.0f).ToString("F2")));
                }
            });
        }