Skip to content

Commit

Permalink
Если регион по точке не найден, устанавливаем регион 1000000 - Открыт…
Browse files Browse the repository at this point in the history
…ое море
  • Loading branch information
klimashkin committed Dec 9, 2013
1 parent 55ef0fe commit 2664f8a
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions controllers/region.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ function saveRegion(socket, data, cb) {
} catch (err) {
return cb({message: err && err.message || 'GeoJSON parse error!', error: true});
}
if (Object.keys(data.geo).length !== 2 || !Array.isArray(data.geo.coordinates) || !data.geo.type || (data.geo.type !== 'Polygon' && data.geo.type !== 'MultiPolygon')) {
if (Object.keys(data.geo).length !== 2 || !Array.isArray(data.geo.coordinates) || !data.geo.type || (data.geo.type !== 'Point' && data.geo.type !== 'Polygon' && data.geo.type !== 'MultiPolygon')) {
return cb({message: 'It\'s not GeoJSON geometry!'});
}
} else if (data.geo) {
Expand Down Expand Up @@ -544,13 +544,20 @@ function clearObjRegions(obj) {

//Возвращает список регионов, в которые попадает заданая точка
var getRegionsByGeoPoint = function () {
var defFields = {_id: 0, geo: 0, __v: 0};
var defRegion = 1000000,//Если регион не найден, возвращаем Открытое море
defFields = {_id: 0, geo: 0, __v: 0};

return function (geo, fields, cb) {
Region.find({geo: {$nearSphere: {$geometry: {type: 'Point', coordinates: geo}, $maxDistance: 1}} }, fields || defFields, {lean: true, sort: {parents: -1}}, function (err, regions) {
if (err) {
return cb(err);
}
if (!regions) {
regions = [];
}
if (!regions.length && regionCacheHash[defRegion]) {
regions.push(regionCacheHash[defRegion]);
}
cb(null, regions);
});
};
Expand Down
Binary file added public/js/lib/leaflet/images/layers-2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/js/lib/leaflet/images/layers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/js/lib/leaflet/images/marker-icon-2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/js/lib/leaflet/images/marker-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/js/lib/leaflet/images/marker-shadow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/js/module/photo/photo.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ define(['underscore', 'underscore.string', 'Utils', 'socket!', 'Params', 'knocko
],
{
parent: this,
level: this.level + 2 //Чтобы не удалился модуль комментариев
level: this.level + 3 //Чтобы не удалился модуль комментариев
}
);
}
Expand Down
2 changes: 1 addition & 1 deletion redirectRules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ oldmos.ru/photo/user/[x*] -> pastvu.com/u/[x*]/photo

Фотографии:
oldmos.ru/photo/view/[x*] -> pastvu.com/p/[x*]
oldsp.ru/photo/view/[x*] -> pastvu.com/p/[N+x*] Номера фотографий oldsp будут подняты на номер последней фотографии oldmos
oldsp.ru/photo/view/[x*] -> pastvu.com/p/[112493+x*] Номера фотографий oldsp будут подняты на номер последней фотографии oldmos (Фото с oldsp на новом портале: 112495 - 140783)

Файлы фотографий.
http://oldmos.ru/upload/photos/[x1]/[x2]/[x3]/yyyy_[x*] -> http://klimashkin.com:3000/_p/d/[x1]/[x2]/[x3]/[x*]
Expand Down

0 comments on commit 2664f8a

Please sign in to comment.