public void TestWriteCollectionData_ManyCollectionsManyArtefacts() { // Test the typical use case for the CollectionWriter CreateTwoCollectionsWithTwoArtefacts(); CollectionReader.LoadXmlFromFile(Paths.CollectionMetadata); for (int i = 0; i < 2; i++) { Dictionary <string, string[]> collectionMetadata = CollectionReader.GetCollectionMetadataWithIdentifier(String.Format("TEST-COLLECTION-0{0}", i)); Assert.That(collectionMetadata ["title"] [0] == "Test Title"); Assert.That(collectionMetadata ["title"] [1] == "A second title"); Assert.That(collectionMetadata ["creator"] [0] == "Test Creator"); Assert.That(collectionMetadata ["creator"] [1] == "A co-creator"); Assert.That(collectionMetadata ["date"] [0] == "2016-10-20"); for (int j = 0; j < 2; j++) { Dictionary <string, Dictionary <string, float> > transformData = CollectionReader.GetTransformForArtefactWithIdentifierInCollection(String.Format("TEST-COLLECTION-0{0}", i), String.Format("TEST-ARTEFACT-0{0}", j)); Assert.That(transformData ["position"] ["x"] == Vector3.one.x); Assert.That(transformData ["position"] ["y"] == Vector3.one.y); Assert.That(transformData ["position"] ["z"] == Vector3.one.z); Assert.That(transformData ["rotation"] ["x"] == Quaternion.identity.x); Assert.That(transformData ["rotation"] ["y"] == Quaternion.identity.y); Assert.That(transformData ["rotation"] ["z"] == Quaternion.identity.z); Assert.That(transformData ["rotation"] ["w"] == Quaternion.identity.w); Assert.That(transformData ["scale"] ["x"] == Vector3.one.x); Assert.That(transformData ["scale"] ["y"] == Vector3.one.y); Assert.That(transformData ["scale"] ["z"] == Vector3.one.z); } } }
public void GetCollectionMetadataWithIdentifier() { string[] collectionIdentifiers = CollectionReader.GetIdentifiersForCollections(); Dictionary <string, string[]> collectionMetadata = CollectionReader.GetCollectionMetadataWithIdentifier(collectionIdentifiers [0]); Assert.That(collectionMetadata ["identifier"] [0] == collectionIdentifiers [0]); Assert.That(collectionMetadata ["title"][0] == "Photogrammetry Test Scans"); Assert.That(collectionMetadata ["creator"][0] == "Ryan Achten"); Assert.That(collectionMetadata ["date"][0] == "29/11/2015"); Assert.That(collectionMetadata ["description"][0] == "A museum is distinguished by a collection of often unique objects that forms the core of its activities for exhibitions, education, research, etc."); Assert.That(collectionMetadata ["subject"][0] == "Photogrammetry"); Assert.That(collectionMetadata ["coverage"] [0] == "Evan's Bay"); Assert.That(collectionMetadata ["coverage"] [1] == "Basin Reserve"); Assert.That(collectionMetadata ["extent"] [0] == "5"); }
private void InstantCollectButton(string collectID) { GameObject curCollectButton = Instantiate(collectButtonPrefab, instantParent) as GameObject; curCollectButton.GetComponent <RectTransform>().localScale = new Vector3(1f, 1f, 1f); Dictionary <string, string[]> data = CollectionReader.GetCollectionMetadataWithIdentifier(collectID); // Debug.Log("****Debug Test****"); // foreach (KeyValuePair<string, string[]> kvp in data) { // Debug.Log("Data key: " + kvp.Key); // for (int i = 0; i < kvp.Value.Length; i++) { // Debug.Log(kvp.Key +": " + kvp.Value[i]); // } // } string[] collectData = new string[5]; try { collectData[0] = data["title"][0]; //grabs first title for collection button } catch (System.Exception ex) { collectData[0] = ""; } try { collectData[1] = collectID; // collectData[1] = data["Identifier"][0]; //grabs first title for collection button } catch (System.Exception ex) { collectData[1] = ""; } try { collectData[2] = data["creator"][0]; //grabs first title for collection button } catch (System.Exception ex) { collectData[2] = ""; } try { collectData[3] = data["date"][0]; //grabs first title for collection button } catch (System.Exception ex) { collectData[3] = ""; } try { collectData[4] = data["description"][0]; //grabs first title for collection button } catch (System.Exception ex) { collectData[4] = ""; } curCollectButton.GetComponent <Collect_LoadCollectButtonInfo>().LoadInfo(collectData); }
static public void LoadXmlData(string collectionId) { Dictionary <string, string[]> data = new Dictionary <string, string[]>(); data = new Dictionary <string, string[]>(); data = CollectionReader.GetCollectionMetadataWithIdentifier(collectionId); CollectionTitle = CreateStructList("title", data); CollectionIdentifier = collectionId; CollectionCreator = CreateStructList("creator", data); CollectionContributor = CreateStructList("contributor", data); CollectionDate = CreateStructList("date", data); CollectionCoverage = CreateStructList("coverage", data); CollectionSubject = CreateStructList("subject", data); try { CollectionDescription = data["description"][0]; } catch (KeyNotFoundException e) { CollectionDescription = ""; } }
private void InstantCollectButton(string collectID) { GameObject curCollectButton = Instantiate(collectButtonPrefab, instantParent) as GameObject; curCollectButton.GetComponent <RectTransform>().localScale = new Vector3(1f, 1f, 1f); Dictionary <string, string[]> data = CollectionReader.GetCollectionMetadataWithIdentifier(collectID); string[] collectData = new string[5]; try { collectData[0] = data["title"][0]; //grabs first title for collection button } catch (System.Exception ex) { collectData[0] = ""; } try { collectData[1] = data["identifier"][0]; //grabs first title for collection button } catch (System.Exception ex) { collectData[1] = ""; } try { collectData[2] = data["creator"][0]; //grabs first title for collection button } catch (System.Exception ex) { collectData[2] = ""; } try { collectData[3] = data["date"][0]; //grabs first title for collection button } catch (System.Exception ex) { collectData[3] = ""; } try { collectData[4] = data["description"][0]; //grabs first title for collection button } catch (System.Exception ex) { collectData[4] = ""; } curCollectButton.GetComponent <Browse_AddToCollectButtonInfo>().LoadInfo(collectData); }
public void TestOverwriteCollection() { CreateTwoCollectionsWithTwoArtefacts(); Dictionary <string, string[]> descriptiveData = new Dictionary <string, string[]>(); Dictionary <string, VerticeTransform> structuralData = new Dictionary <string, VerticeTransform>(); descriptiveData.Add("title", new string[] { "Test Overwrite" }); descriptiveData.Add("creator", new string[] { "Test Creator Overwrite" }); descriptiveData.Add("date", new string[] { "2016-10-26" }); structuralData.Add("TEST-ARTEFACT-03", new VerticeTransform(Vector3.one, Quaternion.identity, Vector3.one)); CollectionWriter.WriteCollectionWithIdentifer("TEST-COLLECTION-00", descriptiveData, structuralData); CollectionReader.LoadXmlFromFile(Paths.CollectionMetadata); Dictionary <string, string[]> collectionMetadata = CollectionReader.GetCollectionMetadataWithIdentifier("TEST-COLLECTION-00"); Assert.That(collectionMetadata ["title"] [0] == "Test Overwrite"); Assert.That(collectionMetadata ["creator"] [0] == "Test Creator Overwrite"); Assert.That(collectionMetadata ["date"] [0] == "2016-10-26"); Dictionary <string, Dictionary <string, float> > transformData = CollectionReader.GetTransformForArtefactWithIdentifierInCollection("TEST-COLLECTION-00", "TEST-ARTEFACT-03"); Assert.That(transformData ["position"] ["x"] == Vector3.one.x); Assert.That(transformData ["position"] ["y"] == Vector3.one.y); Assert.That(transformData ["position"] ["z"] == Vector3.one.z); Assert.That(transformData ["rotation"] ["x"] == Quaternion.identity.x); Assert.That(transformData ["rotation"] ["y"] == Quaternion.identity.y); Assert.That(transformData ["rotation"] ["z"] == Quaternion.identity.z); Assert.That(transformData ["rotation"] ["w"] == Quaternion.identity.w); Assert.That(transformData ["scale"] ["x"] == Vector3.one.x); Assert.That(transformData ["scale"] ["y"] == Vector3.one.y); Assert.That(transformData ["scale"] ["z"] == Vector3.one.z); }
public void TestWriteCollectionData_OneToOne() { // Test that a collection whose descriptive elements are non-repeating write correctly Dictionary <string, string[]> descriptiveData = new Dictionary <string, string[]>(); Dictionary <string, VerticeTransform> structuralData = new Dictionary <string, VerticeTransform>(); descriptiveData.Add("title", new string[] { "Test Title" }); descriptiveData.Add("creator", new string[] { "Test Creator" }); descriptiveData.Add("date", new string[] { "2016-10-20" }); structuralData.Add("TEST-ARTEFACT-01", new VerticeTransform(Vector3.one, Quaternion.identity, Vector3.one)); CollectionWriter.WriteCollectionWithIdentifer("TEST-COLLECTION-01", descriptiveData, structuralData); CollectionReader.LoadXmlFromFile(Paths.CollectionMetadata); Dictionary <string, string[]> collectionMetadata = CollectionReader.GetCollectionMetadataWithIdentifier("TEST-COLLECTION-01"); Dictionary <string, Dictionary <string, float> > transformData = CollectionReader.GetTransformForArtefactWithIdentifierInCollection("TEST-COLLECTION-01", "TEST-ARTEFACT-01"); Assert.That(collectionMetadata ["title"] [0] == "Test Title"); Assert.That(collectionMetadata ["creator"] [0] == "Test Creator"); Assert.That(collectionMetadata ["date"] [0] == "2016-10-20"); Assert.That(transformData ["position"] ["x"] == Vector3.one.x); Assert.That(transformData ["position"] ["y"] == Vector3.one.y); Assert.That(transformData ["position"] ["z"] == Vector3.one.z); Assert.That(transformData ["rotation"] ["x"] == Quaternion.identity.x); Assert.That(transformData ["rotation"] ["y"] == Quaternion.identity.y); Assert.That(transformData ["rotation"] ["z"] == Quaternion.identity.z); Assert.That(transformData ["rotation"] ["w"] == Quaternion.identity.w); Assert.That(transformData ["scale"] ["x"] == Vector3.one.x); Assert.That(transformData ["scale"] ["y"] == Vector3.one.y); Assert.That(transformData ["scale"] ["z"] == Vector3.one.z); }