public Arml CreateARMLElements(string prefab, string id, GeoLocation geo, float compass, float viewArc) { createdTrackables = new List <TrackableElement>(); createdViewPoints = new List <ViewPointElement>(); createdSectors = new List <SectorElement>(); createdFeatures = new List <FeatureElement>(); creationTrackable = new TrackableElement(); creationSector = new SectorElement(); creationViewPoint = new ViewPointElement(); creationFeature = new FeatureElement(); SetTrackableElement(id); SetSectorElement(id, creationTrackable, compass, viewArc); SetViePointElement(id, creationSector, geo); SetFeatureElement(id, creationTrackable, prefab); createdTrackables.Add(creationTrackable); createdSectors.Add(creationSector); createdViewPoints.Add(creationViewPoint); createdFeatures.Add(creationFeature); arml = new Arml(); arml.aRElements = new ARElements(); arml.aRElements.Trackables = createdTrackables; arml.aRElements.Sectors = createdSectors; arml.aRElements.ViewPoints = createdViewPoints; arml.aRElements.Features = createdFeatures; createdArmls.Add(arml); return(arml); }
IEnumerator WebLoad() { var www = new WWW(url); yield return(www); arml = ArmlMethods.LoadFromText(www.text); Debug.Log("Arml loaded from url"); }
private void CreateViewpoint(ViewPointElement vpElement, Arml arml) { GameObject viewpointGO = new GameObject(vpElement.name); viewpointGO.transform.SetParent(viewpointsRoot.transform); Viewpoint vp = viewpointGO.AddComponent <Viewpoint>(); if (vpElement.Point != null) { double[] pos = vpElement.Point.ParsePos(); vp.latitude = pos [0]; vp.longitude = pos [1]; } vp.zoneName = vpElement.zoneid; List <SectorElement> spotSectors = GetSectors(vpElement.SectorLinks, arml.aRElements.Sectors); foreach (SectorElement se in spotSectors) { string trackableId = GetTrackableId(se, arml.aRElements.Trackables); vp.CreateViewingSectorAndFindTrackable(se.ArcByCenterPoint.startAngle, se.ArcByCenterPoint.endAngle, trackableId); } ViewPointCreated(this, new EventArg <Viewpoint>(vp)); }
// Generation and linking of trackables and viewpoints in right order. // Viewpoints and trackables are generated as childs of gameobjects "Viewpoints" and "Trackables". public void LoadARElements(Arml arml) { if (arml == null) { Debug.LogWarning("[ARElementsLoader] Arml null, cannot continue."); } else { if (arml.aRElements == null) { Debug.LogWarning("[ARElementsLoader] Arml ar elements null, cannot continue."); } else { trackablesRoot = FindObjectOfType <TrackablesRoot>(); if (trackablesRoot == null) { GameObject rootGO = new GameObject("Trackables"); trackablesRoot = rootGO.AddComponent <TrackablesRoot>(); } arml.aRElements.Trackers.ForEach(t => SetupTracker(t)); arml.aRElements.Trackables.ForEach(t => CreateTrackable(t)); viewpointsRoot = FindObjectOfType <ViewpointsRoot>(); if (viewpointsRoot == null) { GameObject rootGO = new GameObject("ViewPoints"); viewpointsRoot = rootGO.AddComponent <ViewpointsRoot>(); } arml.aRElements.ViewPoints.ForEach(vp => CreateViewpoint(vp, arml)); ARElementsReady(this, EventArgs.Empty); } } }
public void LoadFeaturesFromArml(Arml arml) { if (arml == null) { Debug.LogWarning("[FeatureLoader] Arml null, cannot continue."); } else { if (arml.aRElements == null) { Debug.LogWarning("[FeatureLoader] Arml ar elements null, cannot continue."); } else { FeaturesRoot root = FindObjectOfType <FeaturesRoot> (); if (root == null) { GameObject rootGO = new GameObject("Features"); root = rootGO.AddComponent <FeaturesRoot> (); } foreach (FeatureElement element in arml.aRElements.Features) { GameObject go = new GameObject(element.name); go.transform.SetParent(root.transform); Feature feature = go.AddComponent <Feature>(); feature.featureId = element.id; feature.featureName = element.name; feature.description = element.description.Replace("<br>", "\n"); feature.manipulateVisuals = AutoHandleFeatureVisibility; CreateEntities(feature, element); } AllFeaturesReady(this, EventArgs.Empty); } } }
public void Load() { arml = ArmlMethods.LoadFromFile(Path.Combine(Application.dataPath, local)); Debug.Log("Arml loaded"); }