I have lots of custom annotations and polylines on map, and it becomes a huge mess when i zoom out. Is there any way to hide them? I'm not familiar with MapKit, so only solution that i figured out is to create event on changing zoom level and re-add annotations whose zoom limit(it will be custom annotation property) is higher or equal to the current, but i'm afraid that it will be slow. Is there any other way?
I think, you should group your points in map. When you zoom in make ungroup, zoom out - group.
resources:
http://five.agency/having-fun-with-ios-map-kit-grouping-annotations/
https://github.com/choefele/CCHMapClusterController
https://github.com/yinkou/OCMapView
Related
I tried
:controls="false" on vl-map
The buttons disappear but you can still zoom with trackpad or mouse and move the map
then I tried setting min-view and max-view on vl-view but this has no effect on zoom
then I set the extent on vl-view and that partially works: I cannot move the map but can still zoom
How do you make the map completely static ?
Though i'm not familiar with the Vue-library, Several of the interactions you mention are derived from the "interaction" module, and not the "controls" module. See for example:
https://openlayers.org/en/latest/apidoc/module-ol_interaction_DragRotateAndZoom-DragRotateAndZoom.html
https://openlayers.org/en/latest/apidoc/module-ol_interaction_MouseWheelZoom-MouseWheelZoom.html
I would check if it's possible to remove these interactions the way you removed the controls. Alternatively you can call your map object and use removeInteraction(interaction):
https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html#removeInteraction
Is there a way to resize a QGraphicsItem to a fixed size?
I know it can be done with scale(float, float), but that seems like a bad direction to go when wanting to resize the item with mouse event. Is there a way to change the boundingRect() so that the Item will then fit the new size?
Thanks
May be too late.
But probably my code at Github PGraphicsItem.py helps you.
I derived my own GraphicsItem class from QtGui.QGraphicsItem.
There I set the size/scale in the paint method which you need to override.
The scaling factors I get from PGraphicsView.py where I subclassed QtGui.QGraphicsView. It holds a method wheelEvent which calculates scaling factors from mouse wheel increments.
EDIT:
In the PGraphicsView.py its the method adjustMarkerSize that recalculates the items to a fixed pixel size.
I do not no if that fits exactly to the question.
I'm struggling to get all of my entries showing in my chart. Here's what it looks like
PinchZoom is enabled, but I can't zoom out anymore.
Is there some way to programmatically zoom out more, or to set the bounds of the view?
Check the documentation of the YAxis.
There are a lot of ways to extend the range of the axis. However I am pretty sure something is wrong with your setup.
I'm trying to understand how autolayout works under XCode6, but there's a lot of mysterious things that runs away from my mind. Autolayout and constraints philosofy can be very hard to learn, but I realized that life can be easier using these tools...
For your information, I need to build a chat view with a table (the messages) and a view containing a text field (the send message pane) nested in a UIView that is again nested in a UIScrollView, so I can shift up the scroll view as the keyboard appears under the textfield.
I read a lot of tutorials and watched a lot of video until I found the useful tutorial Using UIScrollView with Auto Layout in iOS. There's a Xcode project in Github of what the tutorial explains, too.
In his tutorial, Mike Woelmer tells that
One of the big pain points with the old way of setting up a
UIScrollView was communicating the content size to the scroll view. It
was fairly straightforward to calculate your content size if the
content in the UIScrollView was an image. But it was not as easy if
your scroll view included a mixed bag of buttons, labels, custom
views, and text fields. Lengthy code adjustments were needed to
reflect constant changes in device rotations and phone size
differences.
So Mike explains the way to adapt the UIView, using placeholder and forcing the view inside the scrollview to fits the device's screen, creating in viewDidLoad some NSLayoutConstraint:
The solution is to look outside the scroll view and attach a
constraint to the view controller’s main view. This cannot be done in
interface builder, so we will have to write some code. Interface
builder is still complaining, though, so we have to add a placeholder
width constraint to make it happy.
I tried to use parts of the code of the tutorial for my project, but I cannot get a working view controller for my needs (I always get errors). Which is the best approach to do this? Am I on the right road?
Last but not least, I'm italian, so pardon for my english. If something is not clear enough, please leave me a comment.
Basically you have to set both alignment and size constraints in order for Autolayout to take care of the rest for you. If you don't provide enough information you get warning. If you provide conflicting information you get errors.
You need basically to provide enough information for Autolayout to calculate the UIView frame property (i.e., x-position, y-position, width, height).
For example, by providing the distance constraints from the top, right, bottom, and left edges, Autolayout has enough information to draw that UIView's frame rectangle. But you could also provide just the distance constraints from the top and left edges and then provide a size and height constraint.
You can also configure the key constraints you need and then click 'resolve auto layout issues' and choose 'add missing constraints' though sometimes it doesn't give you what you want. It is better to understand that how Autolayout accomplishes what I described above.
If you mess up, it's usually easier to clear all the constraints and start over. Do it a few times and you'll get the hang of it.
I'm working on Map application that needs to work like original MapView on iOS.
I need to rotate mapview according to compass heading value. I tried MTLocation example also I also tried this answer But my results is not good.
Please see the screen shot.
When I rotate mapview according to heading value Map is rotating but as you can see on screen tiles is missing.
How can I solve this display problem ?
Regards
- Fatih
Hy,
I'm the author of MTLocation. Thanks for using it by the way!
For this to work you have to make sure, that your MKMapView is a subview of your ViewController's view (and not the view itself). Then you have to increase the frame of your mapView with a simple Pytaghoras - calculation: the width and height must be at least as big as the diagonal: sqrt(visibleWidth[320]^2 + visibleHeight[480-88]^2) = 506.
So that means
mapView = [[MKMapView alloc] initWithFrame:CGRectMake(-100,-100,520,520)];
Hope that helped, please consider upvoting if it fixed your problem.
You can consider using a bigger frame for the MKMapView object. It should probably be a square with each side equal to the length of the device's diagonal. The problem with this approach is that there are regions of this object that the user won't see but we process information like views for annotations related to that region anyway. Other properties like visibleMapRect would be least helpful.
Another alternative would be to be zoom in by scaling the MKMapView object on rotation. But this might make the map blurry (untested). You could zoom out on the region displayed in the map but it could lead to frequent refreshes. You can look at a middle ground where you don't zoom out until the map is rotated over a certain angle. You can also look at using two views where one of the views is off screen and updated so that it can replace the view after a certain amount of rotation so that it feels seamless.
I am working towards making my own maps application in iPhone. I want my maps to rotate as the user turns. I tried setUserTrackingMode available in iOS 5, but due to some reason it doesn't work. So I decided to take help of MTLocation framework here.
Till now I have done the following.
created a new project and copied all .m and .h files in that.
Import MapKit.h and MTLocation.h.
In Viewcontroller.h, defined property for mapView (should I define a property for locateMeItem).
In ViewDidLoad, paste the code given at the end of the page here.
I get a few errors:
Can't see the locateMe button when created programatically.
Undefined property headingEnabled.
myCustomSelector has no effect.
self.toolbar- toolbar is not a instance of ViewController.
I have tried a code at gist[dot]github[dot]com/1373050 too, but I get similar errors.
Can anybody explain a detailed procedure of this.