When we display a Map control on Windows Phone 8, and we display a MapRoute, is there any way to auto set the zoom level so the full route first?
To auto-zoom the map in c# with a list of coordinates (instead of a route), you can auto-generate a view by using the following:
//Adjust zoom
LocationRectangle lr =
LocationRectangle.CreateBoundingRectangle(myGeoCoordinate, incidentGeoCoordinate, [and more]);
myMap.SetView(lr);
If you have "Route" instead of "MapRoute", you can use "BoundingBox".
yourMapControl.SetView(route.BoundingBox)
There's no way to say "zoom to include points A,B & X,Y" but if you know these you could calculate the distance between them and the center point between those outlying points and then center on that point and then set a zoom level which will include the whole area.
Related
Using svg-pan-zoom utility, I want to register the zoom and pan values every time is changes (using onPan() and onZoom()) and use these saved values to pan and zoom my SVG to the same position (using pan() and zoom()).
I works fine if the zoom level is not changed, however, if zoom level is changed, I have a gap between the wanted position of the svg and the real one.
You can see this problem in that fiddle: first, zoom in, then press the Pan button.
I would like my svg to keep its current location.
I have read other posts on stackoverflow about similar situations (I guess I should use data from getSizes()) but I'm still unable to make it work.
Any advice?
OK, I got the solution, which is quite obvious.
While zooming, I need to apply a zoom factor to the saved pan.
onZoom: function(zoom) {
ratio = zoom/currentZoom;
currentZoom = zoom;
currentPan = {
x: currentPan.x*ratio,
y: currentPan.y*ratio
}
}
See full code here
I have had a lot of difficulty trying to get a map pin to display consistently well on polygons that have their heights extruded. In my app, I am extruding heights of buildings based on an arbitrary value.
Later, upon selecting them, I add a billboard supplied with a custom image of a map pin.
//Get position of selected entity and add billboard at same position
var mPos = pCoords.positions[0];
var selectedPin = viewer.entities.add({
name : 'selBoutique',
position : mPos,
billboard : {
image : './img/marker.png',
verticalOrigin : Cesium.VerticalOrigin.BOTTOM,
eyeOffset: new Cesium.Cartesian3(0, 4, 0)
}
});
I am setting the vertical origin to bottom, in order to keep its display consistent, and have been experimenting with offset in order to find a setting which works well for buildings of various heights in 3D view.
Are there any other factors I should be considering when trying to achieve a position for these pins which is never blocked by buildings of differing heights? I attempted to set the value of the offset dynamically based on the building's height. Perhaps I will play with this some more in the meantime.
Screenshots:
Modify the pin's actual position by the height of the building. Essentially, position the pin at the center of the roof of the building, not the ground floor of it. Then, turn off the eyeOffset, but keep your VerticalOrigin.BOTTOM setting.
This is with reference to Map tiling using quadtree.
Client will give (highest zoom level, row, column)
Could you please let me know how to find the next lower 5 levels tile coordinates
(zoom level, row, column )??
If you are working with row, col and zoom level you can easily determine the tiles in the next zoom level. When a zoom level changes a single tile is broken up into 4 tiles. If the zoom level increases by one then there are twice as many tile rows and columns. So to get the 4 tiles that a tile broke up into you can easily calculate this as this:
tile1: row*2, col*2
tile2: row*2+1, col*2
tile3: row*2, col*2+1
tile4: row*2+1, col*2+1
We would also know that the zoom level = zoom+1. Using this information you can then calculate the quadkey values for each tile using the code documented here: http://msdn.microsoft.com/en-us/library/bb259689.aspx
I am overlaying some clickable hotspots on top of a proprietary panorama viewer application in flash (as3), and I need to make sure that the hotspots scale according to the changing field of view as the user zooms in / zooms out, but I'm not sure what formula to use.
I set a maximum and minimum field of view of 90 and 25, respectively. I've been given some suggestions of how to calculate the scale of the icons:
from the maker of the panorama software:
Scale => 1/tan(FoV)
This doesn't seem to work for me. And:
scalar += (ZOOM_SCALE_UPPER - ZOOM_SCALE_LOWER) * ( ZOOM_LIMIT_OUT - tempFOV )/( ZOOM_LIMIT_OUT-ZOOM_LIMIT_IN) ;
hotspot.scaleX = hotspot.scaleY = scalar;
Gets me close, but at some point the hotspot stops scaling even though the panorama continues to scale. I thought I could just do something like:
diffFOV = previousFOV - currentFOV.
hotspot.scale = currentScale*(1-diffFov)
But that's not quite right either. Everything gets way too big or too small.
Any ideas?
You may be over thinking it.
//assume we change the scale
var NEW_SCALE:Number = currentScale*(1-(previousFOV-currentFOV));
//1. change the scale of the parent containing both the view and the hotspots
viewSprite.scale = NEW_SCALE;
//this way the hotspot and the panorama will scale together
//2. if they are not in the same parent... then set them both to the same view
hotspot.scale = panorama.scale;
Only thing you may have to do after is reposition if they are not registered on their center point.
First of all, I would like to say that I'm a newbie in Java3D. Please bear with my ignorance.
I have made an application with Java3D and I have the following problems with zooming.
It seems the MouseWheelZoom behaviour of Java3D moves the object along Z-axis. On the scene my Z-axis is not out of plane so by using MouseWheelZoom , the object doesn't get closer but it get out of screen. Is there a way to set the zoom direction to an arbitrary direction?
I have got around the problem by using MouseWheelListener and changing the viewing platform based on zoom steps. But there is another problem now. As the object gets closer than a certain distance, some parts of the object ( usually the corners) start disappearing so I can't zoom as much as I desire.
Could you please help ?
Regards,
Hassan
Question:
I guess you use an OrbitBehavior for MouseControl like:
orbit = new OrbitBehavior(canvas3d, OrbitBehavior.REVERSE_ALL);
If that is the case then try
orbit.setZoomFactor(-1d);
To reverse the zoom direction (the default zoom factor is +1d).
To your 2. Question:
You have to set a BoundingLeaf on your PlatformGeometry to encapsulate your "viewing area".
Try something like this
defaultBounds = new BoundingSphere(new Point3d(radiusGameMap, 0.0, radiusGameMap),
radiusGameMap * 6.0d);
BoundingLeaf boundingLeaf = new BoundingLeaf(defaultBounds);
PlatformGeometry platformGeom = new PlatformGeometry();
platformGeom.addChild(boundingLeaf);
where radiusGameMap is a double defining the radius of your whole map.