/// <summary> /// Called when an anchor is found /// </summary> private void OnAnchorLocated(object sender, AnchorLocatedEventArgs e) { if (e.Status == LocateAnchorStatus.AlreadyTracked) { // Nothing to do since we've already rendered any anchors we've located. } else if (e.Status == LocateAnchorStatus.Located) { var anchor = e.Anchor; var model = new AnchorModel { CloudAnchor = anchor, LocalAnchor = anchor.LocalAnchor }; this.anchorVisuals[anchor.Identifier] = model; this.sceneView.Session.AddAnchor(anchor.LocalAnchor); var modelNode = LoadModel(); if (modelNode != null) { modelNode.Position = model.LocalAnchor.Transform.ToPosition(); this.sceneView.Scene.RootNode.AddChildNode(modelNode); } } }
protected XMLShapeModel(PartManager manager, WsDrPart part, AnchorModel startAnchor, AnchorModel endAnchor) { Manager = manager; TwoCellAnchor = new CT_TwoCellAnchor(); CT_Marker from = new CT_Marker { Col = startAnchor.Column, ColOff = "0", Row = startAnchor.Row, RowOff = "0" }; CT_Marker to = new CT_Marker { Col = endAnchor.Column, ColOff = "0", Row = endAnchor.Row, RowOff = "0" }; TwoCellAnchor.From = from; TwoCellAnchor.To = to; ((CT_Drawing)part.Root).TwoCellAnchor.Add(TwoCellAnchor); _startPosition = startAnchor; _endPosition = endAnchor; }
/// <summary> /// Creates 3D model with the specified anchors /// </summary> private AnchorModel CreateModel(AnchorNode localAnchor, CloudSpatialAnchor cloudAnchor) { var anchorModel = new AnchorModel { LocalAnchor = localAnchor, CloudAnchor = cloudAnchor }; localAnchor.SetParent(arFragment.ArSceneView.Scene); var model = new TransformableNode(arFragment.TransformationSystem); model.SetParent(localAnchor); model.Renderable = this.modelRenderable; model.Select(); return(anchorModel); }
public async Task <AnchorResponseModel> Index(AnchorModel input) { var db = ARDirect.Instance; var response = new AnchorResponseModel(); ClientSessionDM session = await db.Query <ClientSessionDM>().Where("clientSessionGuid={0}", input.sessionid).LoadSingleAsync(); if (session == null) { response.GenerateError("Sesija ne postoji"); return(response); } ClientDM client = await db.Query <ClientDM>().Where("clientid={0}", session.clientid).LoadSingleAsync(); AnchorDM anchor = new AnchorDM() { clientid = session.clientid, clientsessionid = session.clientSessionID, sessionid = input.anchorid, noteText = input.noteText, lat = input.lat, lng = input.lng }; await anchor.InsertAsync(); AndroidSocketManager.Current.Send(FitAR.Sockets.Models.AndroidSocketMessage.Construct("text", "green", new FitAR.Sockets.Models.AndroidSocketTextMessage() { text = $"Korisnik '{client.username}' je postavio poruku '{input.noteText}'." })); DashboardSocketHandler.Current?.SendToAll(new DashboardModel() { Function = DashboardModel.FunctionTypes.notifyInverse, RequireReload = false, Text = $"Korisnik '{client.username}' je postavio poruku '{input.noteText}'." });; return(response); }
/// <summary> /// Places a model on a point /// </summary> public void PlaceModel(object transform) { if (this.Mode == SpatialAnchorsMode.AddAnchors && this.Status == SpatialAnchorStatus.Iddle) { var matrix = (NMatrix4)transform; this.localAnchor = new ARAnchor(matrix); var model = new AnchorModel { CloudAnchor = null, LocalAnchor = this.localAnchor }; this.anchorVisuals[string.Empty] = model; var modelNode = LoadModel(); if (modelNode != null) { modelNode.Position = model.LocalAnchor.Transform.ToPosition(); this.sceneView.Scene.RootNode.AddChildNode(modelNode); this.Status = SpatialAnchorStatus.Scanning; } } }
internal Anchor(AnchorModel model) { mModel = model; }
public IPictureShapeModel CreatePicture(string uniqueId, string extension, Stream pictureStream, AnchorModel startPosition, AnchorModel endPosition) { XMLPictureShapeModel xMLPictureShapeModel = new XMLPictureShapeModel(_manager, _drawing, _manager.GetPartByLocation(_drawingrel.RelatedPart), startPosition, endPosition, NextId); _pictures.Add(xMLPictureShapeModel); Relationship relationship = _manager.AddImageToTree(uniqueId, pictureStream, extension, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", "xl/media/image{0}." + extension, _drawingrel.RelatedPart, ContentTypeAction.Default); xMLPictureShapeModel.RelId = relationship.RelationshipId; return(xMLPictureShapeModel); }
public Anchor(AnchorModel model) { this.mModel = model; }
public XMLPictureShapeModel(PartManager manager, WsDrPart part, XmlPart parent, AnchorModel startAnchor, AnchorModel endAnchor, uint uniqueId) : base(manager, part, startAnchor, endAnchor) { this._parent = parent; base.TwoCellAnchor.Choice_0 = CT_TwoCellAnchor.ChoiceBucket_0.pic; base.TwoCellAnchor.ClientData = new CT_AnchorClientData(); this.Picture.NvPicPr = new CT_PictureNonVisual(); this.Picture.NvPicPr.CNvPicPr = new CT_NonVisualPictureProperties(); this.Picture.NvPicPr.CNvPr = new CT_NonVisualDrawingProps(); this.Picture.NvPicPr.CNvPr.Id_Attr = uniqueId; this.Picture.NvPicPr.CNvPr.Name_Attr = "Picture " + uniqueId; this.Picture.BlipFill = new CT_BlipFillProperties(); this.Picture.BlipFill.Blip = new CT_Blip(); this.Picture.BlipFill.Blip.Cstate_Attr = ST_BlipCompression.print; this.Picture.BlipFill.Choice_0 = CT_BlipFillProperties.ChoiceBucket_0.stretch; this.Picture.BlipFill.Stretch = new CT_StretchInfoProperties(); this.Picture.BlipFill.Stretch.FillRect = new CT_RelativeRect(); this.Picture.SpPr.Choice_0 = CT_ShapeProperties.ChoiceBucket_0.prstGeom; this.Picture.SpPr.PrstGeom = new CT_PresetGeometry2D(); this.Picture.SpPr.PrstGeom.Prst_Attr = ST_ShapeType.rect; this.Picture.SpPr.PrstGeom.AvLst = new CT_GeomGuideList(); }