Ovi Maps API Reference

Contents

Class ovi.mapsapi.map.component.panning.Kinetic

Class Summary

The kinetic component will add kinetic panning possibilities to the display. If being added to a display certain other component will automatically detect that and use the kinetic panning, e.g. the panning.Click, panning.Tap and panning.Drag components.

A kinetic panning persists out of two phases, the movement and the sliding phase. Within the first phase the map is moved, these movements and their timings are recorded so that the kinetic panning module knows how fast the map is currently moving and into which direction. Within the second phase, the sliding phase, the kinetic component will simulate what happens when the map is released while moving into the recorded direction with the recorded speed (pixel per second), so the map will run after as if a pysical map would have been dragged and then suddenly released.

It is possible to use the kinetic panning as well from other components. Because it must be avoided that two kinetic pannings are running at the same time, the component implements mechanisms to ensures that only one kinetic panning at a time is performed. Example of how a kinetic panning shall be done:

 // Query for the kinetic component.
 var kineticComponent = display.getComponentById("panning.Kinetic");

 // Initialize the kinetic engine to record a new movement, it directly 
 // starts within the movement phase.
 var kineticMovement = kineticComponent.startMovement();

 // Move the map, if the last parameter is omitted no movement will occurr
 // (simulation mode), the kinetic panning component will just recognize it  
 // for the sliding phase calculations.
 kineticMovement.moveBy(10, 10, true);
 //...

 // Finish the recording and release the map, which will cause the 
 // sliding phase to start. You can't reuse a kinetic movement, therefore
 // after calling "endMovement" all further calls to moveBy will be 
 // ignored.
 kineticMovement.endMovement();

 // From now on the map will slide until stop at the kinetic movement 
 // is called or the map speed reduced to zero due to the fraction.
 kineticMovement.addObserver(
   "finished",
   function(kineticMovement, key, value, oldValue) {
     if (value===true)
       alert("kinetic movement "+(this.aborted?"was aborted":"finished successfully")+"!");
   },
   this
 );

Method Summary
addObserver (key, callback, [context]) : ovi.mapsapi.util.OObject Register an observer for a property.
attach (mapDisplay) Callback method that is invoked when the component is attached to a map.
detach (mapDisplay) Callback method that is invoked when the component is detached from a map.
get (key) : Variant Returns the value of the property with the given name.
getId () : String Returns a unique identifier of the component.
getVersion () : String Returns the version of the component.
queryReference () : ovi.mapsapi.map.component.Component Queries a new reference to this component.
releaseReference () : Number Release a reference to this component and return the new updated reference count.
remove (key) : ovi.mapsapi.util.OObject Removes the property with the given name.
removeObserver (key, callback, context) : ovi.mapsapi.util.OObject Remove an observer from a key.
set (nameOrObject, [value, [force]]) : ovi.mapsapi.util.OObject Set the value(s) of a property or properties of given name(s) to given value(s).
startMovement () : ovi.mapsapi.map.component.panning.KineticMovement Starts a new kinetic movement, makes it the current kinetic movement and returns it.
Field Summary
ovi.mapsapi.map.component.panning.KineticMovement current The currently executed kinetic movement or null, if currently no movement is executed.
ovi.mapsapi.map.Display mapDisplay A reference to the map to which this component belongs.
Constructor Detail

The kinetic component will add kinetic panning possibilities to the display. If being added to a display certain other component will automatically detect that and use the kinetic panning, e.g. the panning.Click, panning.Tap and panning.Drag components.

A kinetic panning persists out of two phases, the movement and the sliding phase. Within the first phase the map is moved, these movements and their timings are recorded so that the kinetic panning module knows how fast the map is currently moving and into which direction. Within the second phase, the sliding phase, the kinetic component will simulate what happens when the map is released while moving into the recorded direction with the recorded speed (pixel per second), so the map will run after as if a pysical map would have been dragged and then suddenly released.

It is possible to use the kinetic panning as well from other components. Because it must be avoided that two kinetic pannings are running at the same time, the component implements mechanisms to ensures that only one kinetic panning at a time is performed. Example of how a kinetic panning shall be done:

 // Query for the kinetic component.
 var kineticComponent = display.getComponentById("panning.Kinetic");

 // Initialize the kinetic engine to record a new movement, it directly 
 // starts within the movement phase.
 var kineticMovement = kineticComponent.startMovement();

 // Move the map, if the last parameter is omitted no movement will occurr
 // (simulation mode), the kinetic panning component will just recognize it  
 // for the sliding phase calculations.
 kineticMovement.moveBy(10, 10, true);
 //...

 // Finish the recording and release the map, which will cause the 
 // sliding phase to start. You can't reuse a kinetic movement, therefore
 // after calling "endMovement" all further calls to moveBy will be 
 // ignored.
 kineticMovement.endMovement();

 // From now on the map will slide until stop at the kinetic movement 
 // is called or the map speed reduced to zero due to the fraction.
 kineticMovement.addObserver(
   "finished",
   function(kineticMovement, key, value, oldValue) {
     if (value===true)
       alert("kinetic movement "+(this.aborted?"was aborted":"finished successfully")+"!");
   },
   this
 );

new ovi.mapsapi.map.component.panning.Kinetic()
Method Detail
Starts a new kinetic movement, makes it the current kinetic movement and returns it.
Returns:
{ovi.mapsapi.map.component.panning.KineticMovement} The new kinetic movement.
Field Detail
The currently executed kinetic movement or null, if currently no movement is executed. If this property is modified, the previously assigned kinetic movement will become disabled.
Examples:
		// Create a new kinetic movement
		var kineticPanning = display.getComponentById("panning.Kinetic"),
			kineticMovement;
		if (kineticPanning) {
			kineticMovement = kineticPanning.startMovement();
			// ... 
		}
Documentation generated on Fri Aug 19 2011 13:36:05 GMT+0200 (CEST).