How show circle around annotation how in google maps - iphone

I use MKMapView.
How to show circle around annotation how in google maps ( when show current user location).
This circle moving with animation to new location and radius of circle dependent from current zoom level.

The annotations themselves don't have a property for showing a circle but you can use a circle overlay with the same center as the coordinate of the annotation to achieve this effect, just like the image below (from one of my projects).
Note: the property for the center of the circle is called "coordinate", just as for the annotations.
The second part is animating the movement. You achieve this by animating the coordinate property of the circle overlay at the same time as the coordinate property of the annotation. This way they will both move together to the new location.
This question can help you with how to move and animate the position of an annotation. If you need the radius of the circle to change at the same time (e.g. when animating the coordinate) you just use Core Animation to animate it together with the coordinate.
Concerning changing the size depending on the zoom level, Map Kit will always handle this for you automatically with Overlays and Annotations so that they always cover the same area of the map, even as the map resizes. (The second image is the same annotations and overlays as below, just zoomed in on the ones to the left (closer to Stockholm in the first image)).

Related

Move marker/labels within area to avoid clashes with clusters in Leaflet

I've trying to display point data and areas with labels using Leaflet. The point data is in a markerClusterGroup and the points pop in and out of clusters according to zoom. Also on the map are large areas representing national parks and each park has a marker currently drawn using the GeoJson's centre property. At some zoom levels the pins drawn for the point data have labels which stick out to the side and clash with the area shape labels. I'd like to be able to assign the area shape label to the area and have Leaflet draw it anywhere within that shape that doesn't clash with a point data marker. This would also mean that if the user zoomed in far enough that some of the national park area was not visible, the label would still be shown rather than attached to a specific location within the area which might be off screen.
Is this possible?

Permit circle to be resized by not directly moved

I'm working on a project where we need to create Search Rings. These are defined as a lat-long/radius, overlaid on a map of the Continental USA.
The desired implementation is a marker, useful for close positioning of the lat-long (or even updating, via popup + jQuery) with an "attached" circle.
Desired behavior:
when the marker is moved, the circle is dragged with it, and repositions itself with its center coincident with the marker's position (this is completed)
the circle's edge? may be gripped and resized, thus changing its radius.
Current issue: when a L.Circle is marked editable, it's both resizeable and directly movable. This is apparent by the gripper boxes on the outside of the circle together with the box at the center of the circle. How do I disable/hide that center gripper?
As always, thanks in advance.

How to zoom in on map tiles instead of drawing next zoom level

I've been using this code to display OpenCycleMap tiles on my app's mapview, but if I zoom in too far the map tiles will disappear. Since OCM tiles may not exist at close zoom levels (say, 15 or 16 for a certain area), they just don't appear when drawing the maps for a certain zoom level, and the mapview only shows the Google Street map that is underneath the OCM overlay.
Is there a way to edit the code to make the mapview display whichever map tiles are available for an area, but resized for the region that the mapview shows?

iPhone: Properly scaling lines / circle drawn in drawRect

I am drawing custom annotations over an image (circle, arrow etc) in my iPhone app. I allow pinch zooming & drag gestures for these annotations. These annotations are custom made AnnotationView with drawRect drawing circle / line etc.
I am finding issues with zooming
Try 1: The zoom is applied by scale transformation to the AnnotationView. Result: the annotations become blurred.
Try 2: To avoid blurring, I added redrawing with co-ords multiplied by scale factor instead of directly manipulating the transformation. This works without blurring, but, soon the circle etc goes out of the views bounds & is clipped.
I could use a bigger frame (size of full image), but, I am keeping the smaller frame so that I can easily move it back to position when it is dragged out of the window by user's zoom / pan gestures.
Question:
Is there a better way to manage this? I would like to zoom without blurring, while also having the ability to move it back to position if it is dragged out of original image bounds.

ios game make a mask layer effect

I need a 'mask' layer that covers the whole screen, with the center part (a circle) to be transparent. Then I can move the mask layer around using touch. User are only able to see the transparent part in the middle.
I don't think a png file can help because the file need to be very large to cover the whole screen.
So is it possible to do it by coding?
i found this online, but don't know much about openGL. http://www.cocos2d-iphone.org/forum/topic/7921.
it would be great if i can use a CCMaskLayer and input with the radius. i can handle the touch event by my self.
the attached png file is expected result, the center part is transparent. i need this to cover my screen, and only show the middle part. the red part is covered.
I write a CCMaskLayer to do the exactly same thing.
https://github.com/smilingpoplar/CCMaskLayer
You may solve this task with cropped circle texture in two ways:
1) Draw sprite with circle texture in screen center and draw another 4 sprites around (on top, bottom, left and right sides) with small red texture but scaled to cover all screen.
2) (more elegant but harder to implement) Make your mask layer fullscreen but adjust texture coordinates. In details:
set wrap mode to GL_CLAMP_TO_EDGE to your circle texture
adjust texture coordinates of your layer vertices (to do this you need to subclass base CCLayer):
Here v means vertex position and t - texture coordinates. You need to set correct texture coordinates for four corner vertices of layer. For future if you will want to drag circle you will need to add some offset values to texture coordinates.