more docs

This commit is contained in:
j 2011-05-16 12:49:48 +02:00
commit cc75e25415
42 changed files with 664 additions and 93 deletions

View file

@ -6,6 +6,12 @@ Ox.ListMap <f:Ox.Element> ListMap Object
(options) -> <f> ListMap Object
(options, self) -> <f> ListMap Object
options <o> Options object
addPlace <f|null>
height <n|256>
labels <b|false>
places <f|null>
selected <a|[]>
width <n|256>
self <o> shared private variable
@*/
@ -349,6 +355,9 @@ Ox.ListMap = function(options, self) {
return val.toFixed(8);
}
/*@
setOption <f> setOption
@*/
self.setOption = function(key, value) {
Ox.print('ONCHANGE')
if (key == 'height' || key == 'width') {
@ -362,16 +371,25 @@ Ox.ListMap = function(options, self) {
}
}
/*@
focusList <f> focusList
@*/
that.focusList = function() {
self.$list.gainFocus();
return that;
}
/*@
reloadList <f> reloadList
@*/
that.reloadList = function() {
self.$list.reloadList();
return that;
}
/*@
resizeMap <f> resizeMap
@*/
that.resizeMap = function() {
Ox.print('Ox.ListMap.resizeMap()')
self.$map.resizeMap();

View file

@ -6,20 +6,16 @@ Ox.MapImage <f:Ox.Element> MapImage Object
(options) -> <f> MapImage Object
(options, self) -> <f> MapImage Object
options <o> Options object
self <o> shared private variable
height <n|360> image height (px)
places <a|o|[]> array of either names (''), points ([0, 0]),
or objects ({name, point, highlight})
type <s|satellite> map type ('hybrid', 'roadmap', 'satellite', 'terrain')
width <n|640> image width (px)
self <o> shared private variable
@*/
Ox.MapImage = function(options, self) {
/**
options
height image height (px)
places array of either names (''), points ([0, 0]),
or objects ({name, point, highlight})
type map type ('hybrid', 'roadmap', 'satellite', 'terrain')
width image width (px)
*/
var self = self || {},
that = new Ox.Element('<img>', self)
.defaults({

View file

@ -1,5 +1,15 @@
// vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.MapMarker <f> MapMarker Object
(options) -> <f> MapMarker Object
options <o> Options object
color <a|[255, 0, 0]> marker color
map <o|null> map
place <o|null> place
size <n|16> size
@*/
Ox.MapMarker = function(options) {
options = Ox.extend({
@ -150,33 +160,56 @@ Ox.MapMarker = function(options) {
}
}
/*@
add <f> add to map
() -> <f> add to map, returns MapMarker
@*/
that.add = function() {
that.marker.setMap(that.map.map);
google.maps.event.addListener(that.marker, 'click', click);
return that;
};
/*@
edit <f> edit marker
() -> <f> edit marker, returns MapMarker
@*/
that.edit = function() {
setOptions();
google.maps.event.addListener(that.marker, 'dragstart', dragstart);
google.maps.event.addListener(that.marker, 'drag', drag);
google.maps.event.addListener(that.marker, 'dragend', dragend);
return that;
};
/*@
remove <f> remove marker
() -> <f> remove marker from map, returns MapMarker
@*/
that.remove = function() {
that.marker.setMap(null);
google.maps.event.clearListeners(that.marker);
return that;
};
/*@
submit <f> submit marker
() -> <f> clear edit listeners, returns MapMarker
@*/
that.submit = function() {
google.maps.event.clearListeners(that.marker, 'dragstart');
google.maps.event.clearListeners(that.marker, 'drag');
google.maps.event.clearListeners(that.marker, 'dragend');
return that;
}
/*@
update <f> update marker
() -> <f> update marker, returns MapMarker
@*/
that.update = function() {
setOptions();
return that;
}
return that;

View file

@ -1,5 +1,15 @@
// vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.MapMarkerImage <f:google.maps.MarkerImage> MapMarkerImage Object
(options) -> <f> google.maps.MarkerImage
options <o> Options object
color <a|[255, 0, 0]> marker color
mode <s|normal> can be: normal, selected, editing
size <n|16> size
type <s|place> can be: place, result, rectangle
@*/
Ox.MapMarkerImage = (function() {
var cache = {};
@ -46,4 +56,4 @@ Ox.MapMarkerImage = (function() {
}
}());
}());

View file

@ -1,5 +1,24 @@
// vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.MapPlace <f> MapPlace Object
(options) -> <f> MapPlace Object
options <o> Options object
east <n|0>
editing <b|false>
geoname <s|''>
map <o|null>
markerColor <a|[255> 0> 0]>
markerSize <n|16>
name <s|''>
north <n|0>
selected <b|false>
south <n|0>
type <a|[]>
visible <b|false>
west <n|0>
@*/
Ox.MapPlace = function(options) {
options = Ox.extend({
@ -70,12 +89,18 @@ Ox.MapPlace = function(options) {
return that.map.options('editable') && that.editable;
}
/*@
add <f> add
@*/
that.add = function() {
that.visible = true;
that.marker.add();
return that;
};
/*@
cancel <f> cancel
@*/
that.cancel = function() {
if (editable()) {
that.undo();
@ -86,10 +111,16 @@ Ox.MapPlace = function(options) {
return that;
};
/*@
crossesDateline <f> crossesDateline
@*/
that.crossesDateline = function() {
return that.west > that.east;
}
/*@
deselect <f> dselect
@*/
that.deselect = function() {
that.editing && that.submit();
that.selected = false;
@ -98,6 +129,9 @@ Ox.MapPlace = function(options) {
return that;
};
/*@
edit <f> edit
@*/
that.edit = function() {
if (editable()) {
that.editing = true;
@ -113,6 +147,9 @@ Ox.MapPlace = function(options) {
return that;
}
/*@
remove <f> remove
@*/
that.remove = function() {
that.editing && that.submit();
that.selected && that.deselect();
@ -121,6 +158,9 @@ Ox.MapPlace = function(options) {
return that;
};
/*@
select <f> select
@*/
that.select = function() {
that.selected = true;
!that.visible && that.add();
@ -129,6 +169,9 @@ Ox.MapPlace = function(options) {
return that;
};
/*@
submit <f> submit
@*/
that.submit = function() {
if (editable()) {
that.editing = false;
@ -138,11 +181,17 @@ Ox.MapPlace = function(options) {
return that;
};
/*@
update <f> update
@*/
that.update = function() {
update();
return that;
};
/*@
undo <f> undo
@*/
that.undo = function() {
if (editable()) {
Ox.forEach(that.original, function(v, k) {
@ -157,4 +206,4 @@ Ox.MapPlace = function(options) {
return that;
};
};

View file

@ -1,4 +1,16 @@
// vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.MapRectangle <f> MapRectangle Object
() -> <f> MapRectangle Object
(options) -> <f> MapRectangle Object
(options, self) -> <f> MapRectangle Object
options <o> Options object
map <o|null> map
place <o|null> place
self <o> shared private variable
@*/
Ox.MapRectangle = function(options, self) {
var options = Ox.extend({
@ -11,10 +23,16 @@ Ox.MapRectangle = function(options, self) {
that[key] = val;
});
/*@
rectangle <f> google.maps.Rectangle
@*/
that.rectangle = new google.maps.Rectangle({
clickable: true,
bounds: that.place.bounds,
});
/*@
markers <a> array of markers
@*/
that.markers = Ox.map(that.place.points, function(point, position) {
return new Ox.MapRectangleMarker({
map: that.map,
@ -48,12 +66,18 @@ Ox.MapRectangle = function(options, self) {
})
}
/*@
add <f> add
@*/
that.add = function() {
that.rectangle.setMap(that.map.map);
google.maps.event.addListener(that.rectangle, 'click', click);
return that;
};
/*@
deselect <f> deselect
@*/
that.deselect = function() {
setOptions();
Ox.print('MARKERS', that.markers)
@ -62,12 +86,18 @@ Ox.MapRectangle = function(options, self) {
});
};
/*@
remove <f> remove
@*/
that.remove = function() {
that.rectangle.setMap(null);
google.maps.event.clearListeners(that.rectangle);
return that
}
/*@
select <f> select
@*/
that.select = function() {
setOptions();
Ox.forEach(that.markers, function(marker) {
@ -75,6 +105,9 @@ Ox.MapRectangle = function(options, self) {
});
};
/*@
update <f> udpate
@*/
that.update = function() {
that.rectangle.setOptions({
bounds: that.place.bounds

View file

@ -1,5 +1,17 @@
// vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.MapRectangleMarker <f> MapRectangleMarker Object
() -> <f> MapRectangleMarker Object
(options) -> <f> MapRectangleMarker Object
(options, self) -> <f> MapRectangleMarker Object
options <o> Options object
map <o|null> map
place <o|null> place
position <s|''>
self <o> shared private variable
@*/
Ox.MapRectangleMarker = function(options, self) {
options = Ox.extend({
@ -73,6 +85,9 @@ Ox.MapRectangleMarker = function(options, self) {
}
}
/*@
add <f> add
@*/
that.add = function() {
that.marker.setMap(that.map.map);
google.maps.event.addListener(that.marker, 'dragstart', dragstart);
@ -80,11 +95,17 @@ Ox.MapRectangleMarker = function(options, self) {
google.maps.event.addListener(that.marker, 'dragend', dragend);
};
/*@
remove <f> remove
@*/
that.remove = function() {
that.marker.setMap(null);
google.maps.event.clearListeners(that.marker);
};
/*@
update <f> update
@*/
that.update = function() {
that.marker.setOptions({
position: that.place.points[that.position]