Logo
Developer

VisioWeb 1.16.1

Class

visioweb.Path

Mapviewer's Path class to draw routes.
This object should be constructed from the Mapviewer's addPath method.

Constructor

new Path()

See:

Methods summary


Name Description
getInterpolatedPosition returns interpolated point
getLength returns length of path in local coordinates, takes into account turns
hide This method is called to hide the Path.
options Use this method to change a Path option, e.g. interpolationTextureLikeWindow or speed
remove This method is called to remove the Path. It can no longer be added back. It should be called when the path will no longer be displayed.
setInterpolatedStartEnd changes the path to start and end in the middle If start is smaller than end, the line is not displayed. It can be used to make the track increasing size (grow), or to show just a subsection of the track.
show This method is called to show the Path.

Methods detail

getInterpolatedPosition(t) → {point}

returns interpolated point
Parameters:
Name Type Description
t number between 0 and 1
Since:
  • 1.7.11
Returns:
position {x:,y:,z:} or false if error.
Type
point

getLength() → {number}

returns length of path in local coordinates, takes into account turns
Since:
  • 1.7.11
Returns:
Type
number

hide()

This method is called to hide the Path.

options(option, value) → {Object|string|number}

Use this method to change a Path option, e.g. interpolationTextureLikeWindow or speed
Parameters:
Name Type Description
option string the option name. If not specified return the options that has been used to create the Path.
value string the option value to set. If not specified return the option value. Only supported for 'speed' and 'interpolationTextureLikeWindow'
Returns:
Type
Object | string | number

remove()

This method is called to remove the Path. It can no longer be added back. It should be called when the path will no longer be displayed.

setInterpolatedStartEnd(start, endopt)

changes the path to start and end in the middle If start is smaller than end, the line is not displayed. It can be used to make the track increasing size (grow), or to show just a subsection of the track.
Parameters:
Name Type Attributes Default Description
start number number between 0 and 1
end number <optional>
1.0 number between 0 and 1
Since:
  • 1.7.11
Example
subpath_animation_start = function() {
            window.subpath_animation = jQuery({v: 0}).animate({v: 1},
            {
                duration: 10000,
                easing: 'linear',
                step: function(v) {
                    // how just a subsegment... change start and end for other effects
                    var length = mypath.getLength();
                    var displayLength = 10; // 3 meters
                    // just a segment of 3 meters
                    mypath.setInterpolatedStartEnd(v-displayLength/length,v);
                    pos = mypath.getInterpolatedPosition(v);
                    pos.radius = mapviewer.camera.position.radius;
                    mapviewer.camera.position = pos;
                },
                complete: function()
                {
                    // follow path at the same altitude as you are
                    pos = mypath.getInterpolatedPosition(0);
                    pos.radius = mapviewer.camera.position.radius;
                    // move back camera, and restart
            mapviewer.camera.goTo(pos,{animationDuration: 2000})
            .done(subpath_animation_start);
                }
            });
        }
        subpath_animation_start();
        // ...
        subpath_animation.stop();

show()

This method is called to show the Path.