Exemplo n.º 1
0
 private void AddToDatabase(NRTrackableImage image, IARAnchor anchor)
 {
     if (!_database.ContainsKey(image.GetDataBaseIndex()))
     {
         _database.Add(image.GetDataBaseIndex(), anchor.ID);
     }
 }
Exemplo n.º 2
0
        private void DetectedUpdateAnchor(NRTrackableImage image)
        {
            IARAnchor anchor = GetOrCreateARAnchor(image);

            UpdateAnchorLocation(anchor, image.GetCenterPose());

            OnUpdateAnchorPosition?.Invoke(anchor, CreateEventData(image));
        }
Exemplo n.º 3
0
        private void AddAnchor(IARAnchor anchor)
        {
            if (_database.ContainsKey(anchor.ID))
            {
                return;
            }

            _database.Add(anchor.ID, anchor);
        }
Exemplo n.º 4
0
        private void AddToDatabase(MLMarkerTrackerArgs args, IARAnchor anchor)
        {
            string markerID = GetMarkerID(args);

            if (!_database.ContainsKey(markerID))
            {
                _database.Add(markerID, anchor.ID);
            }
        }
Exemplo n.º 5
0
 private void DetectedAnchor()
 {
     if (int.TryParse(_idStr, out int index))
     {
         IARAnchor anchor = CreateARAnchor();
         string    id     = _markerIDSolver.Solve(index);
         _database.Add(id, anchor);
         FireDetectedEvent(anchor, id);
     }
 }
Exemplo n.º 6
0
        private void DetectedNewAnchor(NRTrackableImage image)
        {
            Debug.Log($"Detected new anchor with id {image.GetDataBaseIndex()}");

            IARAnchor anchor = GetOrCreateARAnchor(image);

            UpdateAnchorLocation(anchor, image.GetCenterPose());

            OnDetectAnchorFirst?.Invoke(anchor, CreateEventData(image));
        }
Exemplo n.º 7
0
        IARAnchor IARAnchorRepository.Create(AnchorID anchorID)
        {
            IARAnchor anchor = Find(anchorID);

            if (anchor == null)
            {
                anchor = _factory.Create(anchorID);
            }

            return(anchor);
        }
Exemplo n.º 8
0
        private void FireDetectedEvent(IARAnchor anchor, string id)
        {
            Debug.Log($"Detected an anchor with {id}");

            SetAnchorLocation(anchor);

            OnDetectAnchorFirst?.Invoke(anchor, new ARMarkerEventData
            {
                ID   = id,
                Name = $"EditorTrackableImage-[{id}]",
            });
        }
Exemplo n.º 9
0
        private void DetectedNewAnchor(MLMarkerTrackerArgs args)
        {
            string markerID = GetMarkerID(args);

            Debug.Log($"Detected new marker [{markerID}]");

            IARAnchor anchor = GetOrCreateARAnchor(args);

            UpdateAnchorLocation(anchor, args.Result.Position, args.Result.Rotation);

            OnDetectAnchorFirst?.Invoke(anchor, CreateEventData(args));
        }
Exemplo n.º 10
0
        private void FireDetectedEvent(IARAnchor anchor)
        {
            SetAnchorLocation(anchor);

            string id = _markerIDSolver.Solve(_index++);

            OnDetectAnchorFirst?.Invoke(anchor, new ARMarkerEventData
            {
                ID   = id,
                Name = $"EditorTrackableImage-[{id}]",
            });
        }
Exemplo n.º 11
0
        private void DetectedUpdatedImage(ARTrackedImage image)
        {
            if (!_database.ContainsKey(image.name))
            {
                return;
            }

            IARAnchor anchor = GetOrCreateARAnchor(image);

            UpdateAnchorLocation(anchor, image.transform);

            OnUpdateAnchorPosition?.Invoke(anchor, CreateEventData(image));
        }
Exemplo n.º 12
0
        private bool TryGetARAnchor(MLMarkerTrackerArgs args, out IARAnchor anchor)
        {
            AnchorID anchorID;
            string   markerID = GetMarkerID(args);

            if (_database.TryGetValue(markerID, out anchorID))
            {
                anchor = _anchorService.Find(anchorID);
                return(true);
            }

            anchor = null;
            return(false);
        }
Exemplo n.º 13
0
        private void DetectedNewImage(ARTrackedImage image)
        {
            if (_database.ContainsKey(image.name))
            {
                return;
            }

            Debug.Log($"Detected new image {image.name}");

            IARAnchor anchor = GetOrCreateARAnchor(image);

            UpdateAnchorLocation(anchor, image.transform);

            OnDetectAnchorFirst?.Invoke(anchor, CreateEventData(image));
        }
Exemplo n.º 14
0
        private IARAnchor GetOrCreateARAnchor(ARTrackedImage image)
        {
            IARAnchor anchor = null;

            AnchorID id;

            if (!_database.TryGetValue(image.name, out id))
            {
                anchor = _anchorService.Find(id);
            }

            if (anchor == null)
            {
                anchor = _anchorService.Create();
                AddIDToDatabase(image.name, anchor.ID);
            }

            return(anchor);
        }
Exemplo n.º 15
0
        private void HandleOnUpdateAnchorPosition(IARAnchor anchor, ARMarkerEventData eventdata)
        {
            if (eventdata.ID != _targetName)
            {
                return;
            }

            if (anchor == null)
            {
                return;
            }

            _hasARAnchor = true;
            _arAnchor    = anchor;

            UpdatePose();

            _markerDetector.OnUpdateAnchorPosition -= HandleOnUpdateAnchorPosition;
        }
Exemplo n.º 16
0
        private IARAnchor GetOrCreateARAnchor(NRTrackableImage image)
        {
            IARAnchor anchor = null;

            AnchorID id;
            int      index = image.GetDataBaseIndex();

            if (!_database.TryGetValue(index, out id))
            {
                anchor = _anchorService.Find(id);
            }

            if (anchor == null)
            {
                anchor = _anchorService.Create();
                AddToDatabase(image, anchor);
            }

            return(anchor);
        }
Exemplo n.º 17
0
 private void HandleDetectAnchorFirst(IARAnchor anchor, ARMarkerEventData eventData)
 {
     AddPCA(anchor.Transform, eventData.ID);
 }
Exemplo n.º 18
0
 private void UpdateAnchorLocation(IARAnchor anchor, Transform target)
 {
     anchor.SetPositionAndRotation(target.position, target.rotation);
 }
Exemplo n.º 19
0
 private void UpdateAnchorLocation(IARAnchor anchor, Pose pose)
 {
     anchor.SetPositionAndRotation(pose.position, pose.rotation);
 }
Exemplo n.º 20
0
 private void UpdateAnchorLocation(IARAnchor anchor, Vector3 position, Quaternion rotation)
 {
     anchor.SetPositionAndRotation(position, rotation);
 }
Exemplo n.º 21
0
 private void SetAnchorLocation(IARAnchor anchor)
 {
     anchor.SetPositionAndRotation(_targetTrans.position, _targetTrans.rotation);
 }
Exemplo n.º 22
0
 private void HandleUpdateAnchorPosition(IARAnchor anchor, ARMarkerEventData eventdata)
 {
     transform.SetPositionAndRotation(anchor.Position, anchor.Rotation);
 }
Exemplo n.º 23
0
 private void HandleDetectAnchorFirst(IARAnchor anchor, ARMarkerEventData eventdata)
 {
     transform.SetPositionAndRotation(anchor.Position, anchor.Rotation);
 }
Exemplo n.º 24
0
 private void SetAnchorLocation(IARAnchor anchor)
 {
     anchor.SetPositionAndRotation(_origin, Quaternion.Euler(_euler));
 }
Exemplo n.º 25
0
        private void DetectedAnchor()
        {
            IARAnchor anchor = CreateARAnchor();

            FireDetectedEvent(anchor);
        }