[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH 13/13] Improve the slippy map notifier usage to
From: |
Thomas Petazzoni |
Subject: |
[Maposmatic-dev] [PATCH 13/13] Improve the slippy map notifier usage to show when the area is too big |
Date: |
Thu, 5 Aug 2010 16:56:26 +0200 |
Signed-off-by: Thomas Petazzoni <address@hidden>
---
www/media/map_rendering_form.js | 14 ++++++++++++--
www/media/osm_map.js | 15 ++++-----------
www/templates/maposmatic/new.html | 3 +++
3 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/www/media/map_rendering_form.js b/www/media/map_rendering_form.js
index 918a733..3cd8313 100644
--- a/www/media/map_rendering_form.js
+++ b/www/media/map_rendering_form.js
@@ -430,8 +430,18 @@ function getCurrentMode() {
return 'admin';
}
-function mapAreaSelectionNotifier() {
- allowNextStep();
+/** Callback that the slippy map calls when a new area is defined. The
+ * boolean tells whether the area is valid (not too big) or not valid
+ * (too large to be rendered) */
+function mapAreaSelectionNotifier(isvalid) {
+ if (isvalid) {
+ allowNextStep();
+ $("#toobigareaerror").hide();
+ }
+ else {
+ disallowNextStep();
+ $("#toobigareaerror").show();
+ }
}
/** Page initialization. */
diff --git a/www/media/osm_map.js b/www/media/osm_map.js
index da3671a..9b24b49 100644
--- a/www/media/osm_map.js
+++ b/www/media/osm_map.js
@@ -50,7 +50,7 @@ function getAreaBottomRightLat() { return
document.getElementById('area_lat_bott
function getAreaBottomRightLon() { return
document.getElementById('area_lon_bottom_right'); }
/* Update form fields on bbox drawing. */
-function updateFormBbox(bounds)
+function updateFormBbox(bounds, areaSelectionNotifier)
{
bounds = bounds.transform(epsg_projection, epsg_display_projection);
@@ -68,15 +68,9 @@ function updateFormBbox(bounds)
if (bbox_width > BBOX_MAXIMUM_LENGTH_IN_KM ||
bbox_height > BBOX_MAXIMUM_LENGTH_IN_KM)
- {
- document.getElementById('bboxtoolarge').style.display = 'block'
- document.getElementById('id_go_next_btn').disabled = true
- }
+ areaSelectionNotifier(false);
else
- {
- document.getElementById('bboxtoolarge').style.display = 'none'
- document.getElementById('id_go_next_btn').disabled = false
- }
+ areaSelectionNotifier(true);
}
/* Update the map on form field modification. */
@@ -168,8 +162,7 @@ function mapInit(areaSelectionNotifier)
bounds.toGeometry(), {}, bbox_style);
vectorLayer.destroyFeatures()
vectorLayer.addFeatures(feature);
- updateFormBbox(bounds);
- areaSelectionNotifier();
+ updateFormBbox(bounds, areaSelectionNotifier);
}
});
map.addControl(selectControl);
diff --git a/www/templates/maposmatic/new.html
b/www/templates/maposmatic/new.html
index 43bf5e1..e35f611 100644
--- a/www/templates/maposmatic/new.html
+++ b/www/templates/maposmatic/new.html
@@ -61,6 +61,9 @@
{{ form.bbox.errors }}
<p class="bbox_select_help">{% blocktrans %}Latitude and longitude of
the top left and bottom right corners of the area to render.{% endblocktrans
%}</p>
<p class="bbox_select_help">{% blocktrans %}You can use
<tt>Shift+drag</tt> to zoom on a specific area of the map. If you only want to
render part of what the slippy map shows, you can use <tt>Control+drag</tt> to
draw the limits of the area to render.{% endblocktrans %}</p>
+ <ul id="toobigareaerror" class="errorlist" style="display: none;">
+ <li>{% blocktrans %}Area too big to be rendered. Please select a
smaller area.{% endblocktrans %}</li>
+ </ul>
</div>
<div id="step-location-admin">
--
1.7.0.4
- [Maposmatic-dev] [PATCH 01/13] Extend MapRenderingJob with stylesheet, papersize and layout, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 03/13] Add a get_bbox_from_osm_id() helper, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 11/13] Fix language selector to work on Chrome, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 07/13] Fix maptitle handling in MapRenderingJobForm, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 04/13] Add layout, stylesheet and papersize to MapRenderingForm, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 13/13] Improve the slippy map notifier usage to show when the area is too big,
Thomas Petazzoni <=
- [Maposmatic-dev] [PATCH 12/13] Move Ajax service to the /apis/ directory, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 10/13] Update licence years, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 02/13] Implement a skeleton /papersize/ service, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 06/13] Implement a brand new wizard for map creation, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 08/13] Add link and form to search maps on the front page, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 09/13] Add licence boilerplate in map_rendering_form.css, Thomas Petazzoni, 2010/08/05
- [Maposmatic-dev] [PATCH 05/13] Upgrade jquery to 1.4.2, Thomas Petazzoni, 2010/08/05