Announcement

Collapse
No announcement yet.

Change View distance

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Change View distance

    If my canvas has a width size much bigger than the height, the globe gets big and requires me to zoom out in order to see the whole globe. Is there anyway i can set the zoom level to be able to see the full globe when the page first renders?

  • #2
    I believe you can get the canvas width by doing something similar to this:
    var cw = jQuery("*[id~=canvas1").width(); //Where canvas1 is whatever you actually called your canvas.

    You can set your view accordingly then by creating then calling this function:
    /*
    * This function sets the user's view of the globe. In other words, it sets the camera's view.
    * @param heading - The bearing degrees to set the camera to look at. (0-359) where is North is 0, East is 90, South is 180, and West is 270.
    * @param tilt - The tilt angle in degrees to orient the camera. (0-90) where 0 is looking straight down, and 90 is looking flat at the horizon.
    * @param roll - The clockwise roll to orient the camera. (0-359). This should almost always be left at 0 unless you want a barrel roll kind of effect.
    * @param range - The distance from the camera to the look at lat lon location. (This has the net affect of setting the camera's altitude in an indirect way, as the final altitude of the camera is based on the range distance given in correlation with the tilt angle.)
    * @param lookALat - The latitude that the camera should be looking directly at. (this is not the latitude position of the camera itself)
    * @param lookALon - The longitude that the camera should be looking directly at. (this is not the longitude position of the camera itself)
    */
    var SetView = function(heading, tilt, roll, range, lookAtLat, lookAtLon)
    {
    wwd.navigator.heading = heading;
    wwd.navigator.tilt = tilt;
    wwd.navigator.roll = roll;
    wwd.navigator.range = range;
    wwd.navigator.lookAtLocation.latitude = lookAtLat;
    wwd.navigator.lookAtLocation.longitude = lookAtLon;
    };


    So between the two of those you ought to be able to tweak in the values to achieve what you need it to do.

    Hope that helps.
    Last edited by price5583; 12-26-2018, 04:03 PM.

    Comment

    Working...
    X