示例#1
0
        private async Task <AnchorSet> CreateOrUpdateAnchor(string anchorSetId, string anchorId, string mode, string deviceId = null)
        {
            AnchorSet anchorSet = await _anchorSetDatabaseHandler.FindOne(a => a.Id == anchorSetId);

            if (anchorSet == null)
            {
                throw new NoAnchorSetException(anchorSetId);
            }
            if (anchorSet.Anchors == null)
            {
                anchorSet.Anchors = new List <Anchor>();
            }

            Anchor existingAnchor = anchorSet.Anchors.FirstOrDefault(a => a.Id == anchorId);

            if (existingAnchor != null)
            {
                anchorSet.Anchors.Remove(existingAnchor);
            }

            if (mode == VisualizerModes.Virtual)
            {
                Anchor existingVirtualAnchor = anchorSet.Anchors.FirstOrDefault();
                anchorSet.Anchors.Remove(existingVirtualAnchor);
            }

            Anchor anchor = new Anchor()
            {
                Id = anchorId, Mode = mode, DeviceId = deviceId
            };

            anchorSet.Anchors.Add(anchor);
            await _anchorSetDatabaseHandler.ReplaceOneAsync(a => a.Id == anchorSetId, anchorSet);

            return(anchorSet);
        }
示例#2
0
        public async Task <AnchorSet> CreatePhsyicalAnchor(string anchorSetId, string anchorId, string deviceId)
        {
            AnchorSet anchorSet = await CreateOrUpdateAnchor(anchorSetId, anchorId, VisualizerModes.Physical, deviceId);

            return(anchorSet);
        }
示例#3
0
        public async Task <AnchorSet> CreateVirtualAnchor(string anchorSetId, string anchorId)
        {
            AnchorSet anchorSet = await CreateOrUpdateAnchor(anchorSetId, anchorId, VisualizerModes.Virtual);

            return(anchorSet);
        }
        public async Task <AnchorSet> CreatePhysicalAnchor([FromRoute] string anchorSetId, [FromRoute] string anchorId, [FromBody] string deviceId)
        {
            AnchorSet anchorSet = await _anchorSetService.CreatePhsyicalAnchor(anchorSetId, anchorId, deviceId);

            return(anchorSet);
        }
        public async Task <AnchorSet> CreateVirtualAnchor([FromRoute] string anchorSetId, [FromRoute] string anchorId)
        {
            AnchorSet anchorSet = await _anchorSetService.CreateVirtualAnchor(anchorSetId, anchorId);

            return(anchorSet);
        }
        public async Task <AnchorSet> CreateAnchorSet([FromBody] string anchorSetName)
        {
            AnchorSet anchorSet = await _anchorSetService.CreateAnchorSet(anchorSetName);

            return(anchorSet);
        }
        public async Task <AnchorSet> GetPhysicalAnchorSet([FromRoute] string anchorSetId)
        {
            AnchorSet results = await _anchorSetService.GetPhysicalAnchorSet(anchorSetId);

            return(results);
        }