Ejemplo n.º 1
0
    /// <summary>
    /// Loads data asynchronously. This method is called via LoadData(string artefactIdentifier) to hide the asynchronous
    /// implementation from the caller as the implementation is not relevant to existing client code.
    ///
    /// In many cases, this function will run all-at-once; the function need only yield in the case where data has yet to
    /// be loaded from disk or over the network
    /// </summary>
    /// <param name="artefactIdentifier">The identifier of the artefact to load</param>
    private IEnumerator LoadDataAsync(string artefactIdentifier)
    {
        Debug.Log("ContextPanel_InfoController.LoadDataAsync");

        InfoMode.SwitchMode("info");

        artefactId = artefactIdentifier;

        // If the DublinCoreReader has not been populated with data by some preceding operation, populate it now
        if (!DublinCoreReader.HasXml())
        {
            Debug.Log("Populateding DublinCoreReader");
            UnityWebRequest www = UnityWebRequest.Get(Paths.ArtefactMetadata);

            yield return(www.Send());

            if (www.isError)
            {
                Debug.Log("There was an error downloading artefact information: " + www.error);
            }
            else
            {
                DublinCoreReader.LoadXmlFromText(www.downloadHandler.text);
            }
        }

        Dictionary <string, Dictionary <string, string[]> > data = DublinCoreReader.GetArtefactWithIdentifier(artefactIdentifier);

        ArtefactInfoLoad(data);
        ContextInfoLoad(data);
        ObjectInfoLoad(data);
        MediaInfoLoad(data);
        MeshInfoLoad(data);
    }
Ejemplo n.º 2
0
        public void DownloadXmlFile()
        {
            WWW www = new WWW(url);

            while (!www.isDone)
            {
            }
            DublinCoreReader.LoadXmlFromText(www.text);
        }
Ejemplo n.º 3
0
    /// <summary>
    /// Asynchronous, private implementation for the public-facing ImportArtefacts(...) method. Allows the caller to
    /// ignore any implementation details (i.e. they do not need to call StartCoroutine, etc.
    ///
    /// Checks to see if the DublinCoreReader has data available, otherwise it downloads it in a non-blocking fashion.
    ///
    /// When data is present, it is used to import meshes, textures, and metadata, and instantiate objects
    /// </summary>
    /// <param name="collectId">Collection identifier.</param>
    IEnumerator DownloadArtefactXmlAndImportArtefacts(string collectId)
    {
        if (!DublinCoreReader.HasXml())
        {
            UnityWebRequest www = UnityWebRequest.Get(Paths.ArtefactMetadata);              //Paths.Remote + "/Metadata/Vertice_ArtefactInformation.xml"
            yield return(www.Send());

            if (www.isError)
            {
                // TODO: Echo the error condition to the user
                Debug.Log("Couldn't download XML file" + www.error);
            }
            else
            {
                DublinCoreReader.LoadXmlFromText(www.downloadHandler.text);
                Debug.Log("Downloaded some XML");
            }
        }
        GetIdentifiers(collectId);
    }
    /// <summary>
    /// Provides a backing for GetAttributes(string browseType) that can load data in to the DublinCoreReader asynchronously in the case
    /// where the DCReader has yet to be populated with data
    /// </summary>
    /// <param name="browseType">The field to browse on</param>
    private IEnumerator GetAttributesAsync(string browseType)
    {
        // If the DublinCoreReader has not been populated with data by some preceding operation, populate it now
        if (!DublinCoreReader.HasXml())
        {
            Debug.Log("Populating DublinCoreReader");
            UnityWebRequest www = UnityWebRequest.Get(Paths.ArtefactMetadata);             //Paths.Remote + "/Metadata/Vertice_ArtefactInformation.xml"

            yield return(www.Send());

            if (www.isError)
            {
                Debug.Log("There was an error downloading artefact information: " + www.error);
            }
            else
            {
                DublinCoreReader.LoadXmlFromText(www.downloadHandler.text);
            }
        }
        BrowseMode(browseType);
    }
Ejemplo n.º 5
0
    /// <summary>
    /// Provides a backing for LoadMedia() that can load data in to the DublinCoreReader asynchronously in the case
    /// where the DCReader has yet to be populated with data
    /// </summary>
    IEnumerator LoadMediaAsync()
    {
        // If the DublinCoreReader has not been
        if (!DublinCoreReader.HasXml())
        {
            UnityWebRequest www = UnityWebRequest.Get(Paths.ArtefactMetadata);              //Paths.Remote + "/Metadata/Vertice_ArtefactInformation.xml"
            yield return(www.Send());

            if (www.isError)
            {
                // TODO: Echo the error condition to the user
                Debug.Log("Couldn't download XML file" + www.error);
            }
            else
            {
                DublinCoreReader.LoadXmlFromText(www.downloadHandler.text);
                Debug.Log("Downloaded some XML");
            }
        }
        CheckToggles();
    }