Button on Graph point in Core-plot? Objective-C - xcode

I'm currently working on a project where I present several circles in a graph, where some circles are dependant others. I have 1 circle which has its origin in (0.0, 0.0), and another circle (let's call them circle1 and circle2) which has its origin on an angle position on circle1. So I calculate the origin position of circle2 by deciding an angle and calculate that angle towards circle1's local graph. By doing this I get an x and y position for a specific angle in the local graph for circle1. On the point (x, y) I then draw circle2.
However, I would like the user to be able to interact with circle2. More precisely I want to be able to change the angle from which circle2 was drawn by adding some sort of slider, which on the user drags in order to change the angle and then redraws the circle2.
Clarification: What I want to do is to add a button to the HostedView and drag it around in the view. Is this possible in Core plot?

You can't add buttons or other views to the Core Plot hosting view. Add it to the hosting view's parent view and position it on top of the hosting view.

Related

MapLibre GL JS with terrain layer: How to pin a horizontal plane to a specific altitude?

I based some code on the "Add a 3D model" example at maplibre.org in order to draw only a horizontal plane on a map which uses setTerrain to add a terrain layer.
My intention is to draw a couple of semitransparent layers at a given heights above sea level and have them intersect with mountains, somewhat similar to contour lines.
In my first test I just created a 1km-wide square at altitude 0.
I am somewhat confused by the behavior, since altitude 0 turns out to be the height of the terrain in the center of the visible map area. When I then drag the map and release the mouse, altitude 0 gets somehow reset again to the new altitude 0 of the terrain at the center, making the plane change its relative altitude.
The following animated GIF illustrates the problem:
The GIF has a mountain range to the right and the elevation is greatly exaggerated, in order to better illustrate the issue.
What do I need to do in order to be able to specify the height of the plane in meters above sea level and have it appear to be fixed at that height when dragging the map?
I think I need to get the height of the terrain at the center and then add/substract it from the plane's z-position in order for it to stay put at the height relative to given landmarks, but I have got no idea on how to do this inside of a custom layer's render function.

How to change axis (x,y,z) position from center to left on three.js object rendering?

I want to move axis from center to left to show objects in the screen.. let me know is it possible to move it.
There are 2 ways to handle this:
Shifting the objects themselves (transformation along whatever axis is necessary)
Having your camera lookAt a position towards the right (giving the illusion of shifting left)
Since you only have your 2 objects, I would just shift them since it's easier to add that when you set their position to begin with

MKMapview fix user at bottom of map

I'm creating a navigation app and want the map to show the users location at the bottom of the map, like in Maps app when routing/navigating. However you can only determine which coordinate to focus on by using the centre coordinate.
Therefore I need to calculate an offset distance and bearing and calculate a coordinate that this represents the central coordinate that will allow the displaying of the users location at the bottom of the map.
This is all complicated by the 3D view where the camera pitch and altitude affects the relationship of distance between the offset coordinate and the users location.
Is there an easier way to do this or does someone know how to calculate this?
Thanks (a lot!)
D

rotate a projection to follow mouse drag

I'm working on a project to generate world map projections and manipulate them. You can see a beta version here : http://ansichtssache-n.ch/en/personas/daVinci
I'm trying to get the drag event correctly interpreted, so that for example when you drag Australia up, it actually moves Australia up and not the center of the projection (causing Australia to move down in a Miller projection).
I've been trying to find the correct rotation angles to apply to the 3 axis as shown here http://bl.ocks.org/mbostock/4282586 .
I can get the x/y position on the canvas from the start and end of the mouse drag, I can get the geo-coordinates of these points too, and I can get the x/y of the current center as well as its geo-coordinates, but honestly I'm stuck now...
Any idea ?
I had a similar problem here Compose two rotations in D3 geo projection?
I came up with a way to compose the trackball rotation with the existing projection rotation so that you get intuitive control regardless of the original globe orientation.

Rotating an NSView and getting its corner points

I am rotating an NSView using:
setFrameRotation:
Which rotates the view around its bottom left corner. What is the best way to rotate a view around its center point?
Also, i want to get the points in the superview of its corners. Using:
view.frame.origin
Just gives me the corner before i rotate it. How would i get the actual points of its corners once it has been rotated?
Thanks in advance, Ben
To get an effective rotation about the center of the frame, you have to translate the frame's origin.
Also, of course view.frame.origin gives the origin before you rotate it. It's also giving you the origin after you rotate it, because the rotation is around the origin. The origin isn't moving. If you do translate the origin to get rotation around the center, you'll then know the new origin.
To get the other corners, you'd use [view convertPoint:pt toView:view.superview], where pt is each of the corners in the view's coordinate system. E.g. NSMakePoint(NSMaxX([view bounds]), NSMinY([view bounds])).
You can actually use this technique to obtain the translation you want. Compute the desired center of the view, or just record the current center if it's where you want it. Then rotate the view. Obtain the new location of the center using -convertPoint:toView:. Then translate the origin by the difference between the new center and the desired center.

Resources