in Ox.Map, use '=' and '!=' as operators for 'in between' and 'not in between'

This commit is contained in:
rolux 2012-04-02 17:33:54 +02:00
parent 241f0bc064
commit 461233e87b

View file

@ -527,7 +527,7 @@ Ox.Map = function(options, self) {
var place = getSelectedPlace(), var place = getSelectedPlace(),
country = Ox.getCountryByGeoname(place.geoname); country = Ox.getCountryByGeoname(place.geoname);
Ox.extend(place, data); Ox.extend(place, data);
Ox.print('addPlaceToPlaces, place name:', place.name) //Ox.print('addPlaceToPlaces, place name:', place.name)
self.options.selected = place.id; self.options.selected = place.id;
place.countryCode = country ? country.code : ''; place.countryCode = country ? country.code : '';
Ox.Log('Map', 'addP2P', data, place); Ox.Log('Map', 'addP2P', data, place);
@ -907,7 +907,7 @@ Ox.Map = function(options, self) {
function mapChanged() { function mapChanged() {
// gets called after panning or zooming // gets called after panning or zooming
Ox.print('Map', 'mapChanged'); //Ox.print('Map', 'mapChanged');
if (self.boundsChanged) { if (self.boundsChanged) {
var bounds = self.map.getBounds(), var bounds = self.map.getBounds(),
southWest = bounds.getSouthWest(), southWest = bounds.getSouthWest(),
@ -939,13 +939,13 @@ Ox.Map = function(options, self) {
keys: self.placeKeys, keys: self.placeKeys,
query: { query: {
conditions: Ox.merge([ conditions: Ox.merge([
{key: 'lat', value: [south, north], operator: '-'} {key: 'lat', value: [south, north], operator: '='}
], spansGlobe() ? [ ], spansGlobe() ? [
{key: 'lng', value: [-180, 180], operator: '-'} {key: 'lng', value: [-180, 180], operator: '='}
] : crossesDateline() ? [ ] : crossesDateline() ? [
{key: 'lng', value: [east, west], operator: '!-'} {key: 'lng', value: [east, west], operator: '!='}
] : [ ] : [
{key: 'lng', value: [west, east], operator: '-'} {key: 'lng', value: [west, east], operator: '='}
]), ]),
operator: '&' operator: '&'
}, },
@ -1129,7 +1129,7 @@ Ox.Map = function(options, self) {
self.places.splice(Ox.getIndexById(self.places, place.id), 1); self.places.splice(Ox.getIndexById(self.places, place.id), 1);
self.resultPlace && self.resultPlace.remove(); self.resultPlace && self.resultPlace.remove();
self.resultPlace = place; self.resultPlace = place;
Ox.print('removed place, place is now', place); //Ox.print('removed place, place is now', place);
place.marker.update(); place.marker.update();
place.rectangle.update(); place.rectangle.update();
} }
@ -1141,7 +1141,7 @@ Ox.Map = function(options, self) {
} }
function selectPlace(id, zoom) { function selectPlace(id, zoom) {
Ox.print('SELECT PLACE', id) //Ox.print('SELECT PLACE', id)
// id can be null (deselect) // id can be null (deselect)
var place, selected = getSelectedMarker(); var place, selected = getSelectedMarker();
if (!self.loaded) { if (!self.loaded) {
@ -1189,7 +1189,7 @@ Ox.Map = function(options, self) {
} }
} }
function select() { function select() {
Ox.print('select...', place) //Ox.print('select...', place)
place && place.select(); place && place.select();
self.options.selected = id; self.options.selected = id;
setPlaceControls(place); setPlaceControls(place);
@ -1405,7 +1405,7 @@ Ox.Map = function(options, self) {
that.resizeMap(); that.resizeMap();
} else if (key == 'places') { } else if (key == 'places') {
// fixme: assumes !self.isAsync // fixme: assumes !self.isAsync
Ox.print('MAP SET OPTIONS PLACES', value); //Ox.print('MAP SET OPTIONS PLACES', value);
addPlaces(); addPlaces();
getMapBounds(function(mapBounds) { getMapBounds(function(mapBounds) {
if (mapBounds) { if (mapBounds) {
@ -1509,7 +1509,7 @@ Ox.Map = function(options, self) {
that.value = function(id, key, value) { that.value = function(id, key, value) {
// fixme: should be like the corresponding List/TextList/etc value function // fixme: should be like the corresponding List/TextList/etc value function
Ox.print('Map', 'Map.value', id, key, value); Ox.Log('Map', 'Map.value', id, key, value);
getPlaceById(id).options(key, value); getPlaceById(id).options(key, value);
if (id == self.options.selected) { if (id == self.options.selected) {
if (key == 'name') { if (key == 'name') {