Nasal library/geo: Difference between revisions

Jump to navigation Jump to search
Line 297: Line 297:
};
};


# we will register this function to be called whenever an item is added
# This function will be called whenever an item is added
var added = func(apt){
var added = func(apt){
     print("Airport ", apt.id, " added");
     print("Airport ", apt.id, " added");
}
}


# we will register this fucntion to be invoked whenever an item is removed
# This function will be called whenever an item is removed
var removed = func(apt){
var removed = func(apt){
     print("Airport ", apt.id, " removed");
     print("Airport ", apt.id, " removed");
}
}


# create a new object, pass it the search function to be used, and the callbacks to be invoked for event handling (adding/removing items)
# Create a new object, passing to it the search function to be used and the callbacks
var searcher = geo.PositionedSearch.new(searchCmd, added, removed);
var searcher = geo.PositionedSearch.new(searchCmd, added, removed);


# actually update the searcher obejct
# Actually update the searcher object
searcher.update();
searcher.update();
}}
}}
Line 344: Line 344:
}}
}}
==== _equals ====
==== _equals ====
{{Main article|Canvas_MapStructure#Symbol_Controller}}
{{Nasal doc
{{Nasal doc
|syntax = geo.PositionedSearch._equals;
|syntax = geo.PositionedSearch._equals;
|text = Function that checks if two objects are equal. You must redefine this function to use <code>geo.PositionedSearch</code> for other uses (i.e. objects not working in terms of the geo.Coord interface).
|text = Function that checks if two objects are equal. You must redefine this function to use <code>geo.PositionedSearch</code> for other uses.
|example1 = var searchCmd = func(){
|example1 = var searchCmd = func(){
     var vec = [];
     var vec = [];

Navigation menu