Selecting object in WorldScaleARexample - mapbox

I am working on an AR app in Unity and want to display information of an object. To display said information, the user has to be able to click/select that object.
I cannot find the line of code that creates the objects.
I have tried to use a snippet of the ARTabletopKit that handles the user's input to select an object.
If I am correct, the problem is that I cannot use the DebugCanvas-GameObject of the WorldScaleAR example as it does not contain any of the actual game objects.
As far as I can see the objects are created and placed here:
unityTile.Initialize(_map, tileId, _map.WorldRelativeScale, _map.AbsoluteZoom, _map.LoadingTexture);
PlaceTile(tileId, unityTile, _map);
At last I expect the method EventSystem.current.IsPointerOverGameObject() to return true.
Cheers!

You'll need to add a [GameObjectModifier][1] to handle the onClick. You can configure the modifiers to be added at runtime on the game objects in the Map Features area of the AbstractMap.cs script.
I would take a look at how it's implemented on the Data Explorer example.

Related

Extrapolate Coordinates form Leaflet map

I'm planning a climbing trip and I wanted to retrieve the climbing locations from a leaflet map.
I thought I could use chromedriver and selenium to get the information I wanted but I'm having difficulty scanning through all markers since I can't understand where all the informations are stored.
Could someone guide me through how I could get the information? (also without using selenium)
The map in question is: https://www.climbingsardinia.com/topos/maps/
Thank you in advance.
in that page you will see a global variable called cttm_markers, it contains all markers informations and relative coordinates.
For example, cttm_markers[0][[0].additionalData.title evaluates "M.te Arci – Trebina Longa".Further, cttm_markers[0][[0]._latlng is an object {lat,lng} that contains coordinates.
Try to open console and paste this: JSON.stringify(cttm_markers[0].map(c=>({title:c.additionalData.title,latlng:c._latlng}))), it will print a json.
One way to do it is to get some information on one of the markers and use this to search the request reponses made by the page (you can do this in the debug tools, usually opened with F12). One of the markers for example reveals the location "Grighini". The base request redirects to (in my case) https://www.climbingsardinia.com/topos/maps/?doing_wp_cron=1651158093.0027918815612792968750
Searching the response, reveals that in line 1908 there's the string "Grighini". This line contains a serialized JSON array, containing the markers.

Azure Spatial Anchors - How to save and get anchors

I tried the azure-spatial-anchor-demo-package and it worked fine for me. Now I wanted to use azure in my project. In my current understanding, the coordinates of the anchor are stored. More precise information about whether it is a 3D object, and what it looks like, is not stored. If I'm wrong about this, please correct me.
Lets say I have 3 different objects: a car, house and tree.
All of them are anchors, which I instantiate in my scene. My current procedure is as follows:
_anchorModul.StartAzureSession();
I instantiate a car, house and tree and call for each of them CreateAzureAnchor();:
InstantiatedGo = Instantiate(GoToInstantiate, GetCurrentHitPosition(), Quaternion.FromToRotation(Vector3.back, _gazeProvider.HitInfo.normal)) as GameObject;
_anchorModul.CreateAzureAnchor(InstantiatedGo);
In the method CreateAzureAnchor() I set the type of my object via localCloudAnchor.AppProperties.Add("type", theObject.GetComponent<SomeClass>().Type);.
After that I save the anchors to disk via _anchorModul.SaveAzureAnchorIdToDisk();
But now I want to restart my application and get the objects at the right position. The right order should be:
Restart the application.
Get Azure Anchor from Disk
Start Azure Session
Find Azure Anchor
My Question: How do I get the found anchors, so I can access the properties I set and instantiate the related properties on my three objects?
My Specs:
Unity 2019.2.15
MRTK 2.2
AzureSpatialAnchors.unitypackage
MRTK.HoloLens2.Unity.Tutorials.Assets.AzureSpatialAnchors.2.2.0.0.unitypackage
MRTK.HoloLens2.Unity.Tutorials.Assets.GettingStarted.2.2.0.1.unitypackage
You need to make a request to the Azure service to locate an anchor using at least one of the ids saved. You can either send an array of ids or send one and ask for the nearby anchors.

Stable ID's in fiori launchpad

I am using a FlexColumnLayout for my app.
In the mid column I need to access a controll of the begin column of the FlexColumnLayout. Here is the problem:
Since it is a different view I cannot use
this.getView().byId("myId")
My first solution was to use stable ID's, by giving the views (XML) IDs.
Like that I could use:
sap.ui.getCore().byId("application---viewId--myId")
At first it worked just fine, but now that I integrated my app into the fiori launchpad the first part of the stable ID (the part before "viewId") changed and when I transport into productive it will change again.
Is there a way to access the mid column controls without sap.ui.getCore().byId?
Or is there a way to load the first part dynamically so I don't need to change my IDs when tranporting?
Sadly I don't know how to reproduce a Launchpad for testing purposes, but for those who want to test their ideas about my problem, my FlexColumnLayout is build just like in the DemoApp: https://sapui5.hana.ondemand.com/#/entity/sap.f.FlexibleColumnLayout
Ok guys i found a solution:
this.getView().getParent().getParent()
returns the FlexColumnLayout. This has a method called "getBeginColumnPages", which returns an array of the views representing the begin column. Now that i can access the view in which my control is found, i can access it with the sap.ui.core.mvc.View.byId() method.
Now I have
this.getView().getParent().getParent().getMidColumnPages()[0].byId("myId")
Since the doulbe .getParent() doesn't seem to be ideal, please post a better solution if you know one : D
You have to use createId() function, this will return the complete ID of your control.
this.byId(this.createId("myid"));

Can I return the tag and routine name?

I am working on a code "maintenance" idea where I would like to populate a global when routines are accessed and by who. I can pull the current routine name using $t(+0) or $ZNAME, but what about the current tag and/or line offset? Is there a way so I can put a standard line in the routines I want to track?
Rob, you can get these information from $STACK.
If you call your own tracking function, you get the calling stack info like this:
W $STACK($STACK(-1)-1,"PLACE")
zExecute+2^%Studio.General.1 +1
Take a look at the Caché ObjectScript Reference for $STACK for detailed description and examples.
Rob!
Maybe you just turn on Audit? It gathers logs for different users activities in InterSystems Caché database. See the documentation on Caché Audit.
Also, see this solution which will help you to examine analytics in DeepSee regarding Audit entries.
You can find the routine that's calling your label, by the following ClassMethod.
write ##class(%SYSTEM.Process).CallingRoutine()
As well as the database which is calling your label.
write ##class(%SYSTEM.Process).CallingDatabase()

How do I use IPTC/EXIF metadata to categorise photos?

Many photo viewing and editing applications allow you to examine and change EXIF and IPTC data in JPEG and other image files. For example, I can see things like shutter speed, aperture and orientation in the picture files that come off my Canon A430. There are many, many name/value pairs in all this metadata. But...
What do I do if I want to store some data that doesn't have a build-in field name. Let's say I'm photographing an athletics competition and I want to tag every photo with the competitor's bib number. Can I create a "bib_number" field and assign it a values of "0001", "5478", "8124" etc, and then search for all photos with bib_number="5478"?
I've spent a few hours searching and the best I can come up with is to put this custom information in the "keywords" field but this isn't quite what I'm after. With this socution I'd have to craft a query like "keywords contains bib_number_5478" whereas what I want it "bib_number is 5478".
So do the EXIF and/or IPTC standards allow addtional user-defined field names?
Thanks
Kev
It can be used for that, but it really shouldn't: it's meant to be user-editable and so isn't a safe place to put critical metadata. Using an XMP sidecar is better for this kind of thing: in XMP, any field added that a given app does not understand is, according to the standard, supposed to be ignored by that app and not destroyed.
I don't know if there are applications to do this but by the standards described for JPEG files there is a field called Comments where you can assign values that could act like tags.
C# code:
using System.Windows.Media.Imaging;
using System.IO;
...
FileStream fs = new FileStream(#"<img_path>", FileMode.Open, FileAccess.ReadWrite);
BitmapMetadata bmd = (BitmapMetadata)BitmapFrame.Create(fs).Metadata;
bmd.Comment = "Some Comment Here";
also if you are looking for an application that already has this functionality built into it, then might i recommend Irfan View (open pic, go to Image menu, click on Comments button).
Hope this helps.