LocationToViewportPoint issue - geolocation

I have an issue with this where LocationToViewportPoint for Bing Maps is calculating based on current viewport of the map as opposed to calculating the target viewport point.
The reason is because if the user is panning/zooming the map, this method will return inconsistent results.
I've tried reflecting this method but to no avail, does anyone have any more insight on how to solve this problem?

Solved this:
What I had to do was turn off the AnimationLevel for (panning/zooming) and explicitly SetView to the target bounding rectangle and then performed whatever calculations I needed to calculate the Map's new center point.
I then changed the AnimationLevel back on and then setting the new Map's center point for the map to zoom/pan to.
Apparently the LocationToViewportPoint had a dependency on AnimationLevel and "current" view.

Related

ARKit + Core location - points are not fixed on the same places

I'm working on developing iOS AR application using ARKit + Core location. And the points which are displayed on the map using coordinates move from place to place when I go. But I need they are displayed on the same place.
Here you can see the example of what I mean:
https://drive.google.com/file/d/1DQkTJFc9aChtGrgPJSziZVMgJYXyH9Da/view?usp=sharing
Could you help to handle with this issue? How can I have fixed places for points using coordinates? Any ideas?
Thanks.
Looks like you attach objects to planes. However, when you move the ARKit extends the existing planes. As a result if you put points, for example, at the center of the plane, then the center is always updated. You need to recalculate the coordinates of the point and place objects correctly.
The alternative is not to add objects to planes (or in relation to them). If you need to "put" object on a plane, then the best way is to wait, until the plane will be directed enough (it will not change his direction significantly if you will move), then select a point on the plane where you want to put your object, then convert this point coordinate to global coordinates (as a result if plane will change his size the coordinate you have will not be changed at all), and finally put object in root (or another object that it's not related to the plane).

tracking camera's position and rotation

I have allowsCameraControl property set to true. I need my camera to tell me what it's position and rotation is, while I move it around with pinch and pan gestures so I can later update my camera to that position. Is there some function that is called every rendering moment so I can put println: statement in it? The other option I could think was to set a didSet statement at camera's position and rotation property but I have no idea how to do that if I'm not the one defining the property in the first place.
Found a way around it using custom buttons(moveLeft,moveRight,rotateLeft etc..) to move the camera(and report current position) around 3D space. Works great. Can't tell if mnuages's suggestion works, but it looks allright.
you can use delegation methods such as SCNSceneRendererDelegate's -renderer:didRenderScene:atTime: and you can access the "free" camera by using the view's pointOfView.

Simple algorithm for annotations request from server on map

What is a good enough method of knowing when to go out to the server and request for annotations?
i.e. knowing when the area on the screen was not yet exposed by the user?
If I have a LAT1,LON1 LAT2,LON2 specifying the screen boundaries, or maybe the screen's center as LAT,LON, how can I know that the surface the user has moved to has never been exposed or even just a part of it?
Weird, but I can't find ideas online, Any methods would be welcome!
Thanks!
store a set of MKMapRect objects that the map showed in a NSMutableSet maybe -- you then have all the areas that were visible previously. (combine rects when it makes sense to keep the set reasonable)
when you get a new MKMapRect (after a scroll or zoom of the map view -- the delegate is informed here) see if the new visibleMapRect lies within an old one or just intersects or is not inside the rect at all
an MKMapRect can be treated almost like a CGRect :)

Graph should not be move if not zoomed

I am using core plot to draw graph. Graph moves always whether it is zoomed or not. But I want like it should not move until it is zoomed. In zooming state we should allow panning(moving left/right) to see the whole graph.Any help would be appreciated.
I can think of several ways to do this:
Disable user interaction when zoomed out. Enable it when the user zooms in.
Set the globalXRange and globalYRange on the plot space. The plot won't scroll outside these ranges no matter how far out you zoom.
Use a plot space delegate. Implement the -plotSpace:willChangePlotRangeTo:forCoordinate: delegate method. If the proposed range is outside the desired scrolling range, modify the range to your preferred range before returning it.

What does body.GetPosition,body.GetWorldCenter stand for in Box2D?

Recently I have a new project that uses Box2D as physics engine. And I am having some trouble with the body's position.
I want to draw images on the sprite, so I just use body.GetPosition as image's position. But I found that body.GetPosition returns the same value as body.GetWorldCenter, and I just wondering that I did something wrong.
I use box2d flash 2.1a in my project. And I currently subtract this position with half-width and half-height to walk around. Also, can you tell me if there is some way to solve my problem or draw the image in the correct positon in Box2D.
Thank you.
update
so sorry to post before read manual.
after RTM I got that body has two points,first is origin point and the second is center of mass ,so a regular shape's world center is always the same as it's origin point. sorry to post is.
Have you set the image in the userdata for the body? Your getting the body's position but you need to have a function that runs each world tick that can set the images position to the new location. Box2d is just numbers defining a simulation. Those numbers are constantly updating so the image needs to have position set each time there is a game tick. Hope this helps

Resources