Commit af8bd09f authored by Jérémy Lacoche's avatar Jérémy Lacoche
Browse files

try to fix reload graph with sync method

parent b4eb7e01
Loading
Loading
Loading
Loading
+31 −38
Original line number Diff line number Diff line
@@ -305,9 +305,8 @@ namespace ETSI.ARF.WorldStorage.UI

        public void PaintWorldStorage()
        {
            WorldAnchorRequest.GetWorldAnchorsAsync(worldStorageServer, (response) =>
            {
                List<WorldAnchor> worldAnchors = response.result;

            List<WorldAnchor> worldAnchors = WorldAnchorRequest.GetWorldAnchorsSync(worldStorageServer);
            foreach (WorldAnchor worldAnchor in worldAnchors)
            {
                var waNode = new ARFNodeWorldAnchor(worldAnchor);
@@ -318,11 +317,8 @@ namespace ETSI.ARF.WorldStorage.UI

                AddElement(waNode);
            }
            });

            TrackableRequest.GetTrackablesAsync(worldStorageServer, (response) =>
            {
                List<Trackable> trackables = response.result;
            List<Trackable> trackables = TrackableRequest.GetTrackablesSync(worldStorageServer);
            foreach (Trackable trackable in trackables)
            {
                var tracknode = new ARFNodeTrackable(trackable);
@@ -333,21 +329,18 @@ namespace ETSI.ARF.WorldStorage.UI

                AddElement(tracknode);
            }
            });

            WorldLinkRequest.GetWorldLinksAsync(worldStorageServer, (response) =>
            {
                List<WorldLink> worldLinks = response.result;
            List<WorldLink> worldLinks = WorldLinkRequest.GetWorldLinksSync(worldStorageServer);
            foreach (WorldLink worldLink in worldLinks)
            {
                Debug.Log("ports");
                var portPair = GetPortsFromWorldLink(worldLink);
                Debug.Log("edge " + (portPair.Key == null)+   "  " + (portPair.Value == null));
                ARFEdgeLink edge = portPair.Key.ConnectTo<ARFEdgeLink>(portPair.Value);
                edge.worldLink = worldLink;
                edge.GUID = worldLink.UUID.ToString();

                AddElement(edge);
            }
            });
        }

        internal ARFNodeTrackable CreateTrackableNode(Trackable track, float posX, float posY)
@@ -479,14 +472,14 @@ namespace ETSI.ARF.WorldStorage.UI
        }

        //
        // Rsum:
        // Rsum:
        //     Calculate the rectangle size and position to fit all elements in graph.
        //
        // Paramtres:
        // Paramtres:
        //   container:
        //     This should be the view container.
        //
        // Retourne:
        // Retourne:
        //     The calculated rectangle.
        public override Rect CalculateRectToFitAll(VisualElement container)
        {
+33 −39
Original line number Diff line number Diff line
@@ -240,10 +240,9 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
            worldStorageUser = user;

            instance.nodePositions = new Dictionary<string, Rect>();
            TrackableRequest.GetTrackablesAsync(worldStorageServer, (response) =>
            {
                List<Trackable> list = response.result;
                foreach (Trackable track in list)

            List<Trackable> listT = TrackableRequest.GetTrackablesSync(worldStorageServer);
            foreach (Trackable track in listT)
            {
                if (track.KeyvalueTags.ContainsKey("unityAuthoringPosX") && track.KeyvalueTags.ContainsKey("unityAuthoringPosY"))
                {
@@ -258,12 +257,10 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
                    instance.nodePositions[track.UUID.ToString()] = trackPos;
                }
            }
            });

            WorldAnchorRequest.GetWorldAnchorsAsync(worldStorageServer, (response) =>
            {
                List<WorldAnchor> list = response.result;
                foreach (WorldAnchor wa in list)
            List<WorldAnchor> listA = WorldAnchorRequest.GetWorldAnchorsSync(worldStorageServer);
            Debug.Log("Anchors " +listA.Count);
            foreach (WorldAnchor wa in listA)
            {
                if (wa.KeyvalueTags.ContainsKey("unityAuthoringPosX") && wa.KeyvalueTags.ContainsKey("unityAuthoringPosY"))
                {
@@ -278,17 +275,14 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
                    instance.nodePositions[wa.UUID.ToString()] = trackPos;
                }
            }
            });


            instance.linkIds = new List<string>();
            WorldLinkRequest.GetWorldLinksAsync(worldStorageServer, (response) =>
            {
                List<WorldLink> list = response.result;
                foreach (WorldLink link in list)
            List<WorldLink> listWL = WorldLinkRequest.GetWorldLinksSync(worldStorageServer);
            foreach (WorldLink link in listWL)
            {
                instance.linkIds.Add(link.UUID.ToString());
            }
            });

            instance.elemsToRemove = new Dictionary<string, Type>();
            instance.elemsToUpdate = new List<string>();
Compare cebe3c24 to 5e91e323
Original line number Diff line number Diff line
Subproject commit cebe3c24911db848f91ced30955be6bca4974a71
Subproject commit 5e91e32387700c0c852878e84c2098af794d2ac7