Browse Source

[search] Added Europe to the geography types

Enrico Berti 10 years ago
parent
commit
3fb1c29820

+ 1 - 0
apps/search/src/search/templates/search.mako

@@ -368,6 +368,7 @@ ${ dashboard.layout_skeleton() }
           </span>
           </span>
           <select data-bind="selectedOptions: properties.scope" class="input-small">
           <select data-bind="selectedOptions: properties.scope" class="input-small">
             <option value="world">${ _("World") }</option>
             <option value="world">${ _("World") }</option>
+            <option value="europe">${ _("Europe") }</option>
             <option value="aus">${ _("Australia") }</option>
             <option value="aus">${ _("Australia") }</option>
             <option value="bra">${ _("Brazil") }</option>
             <option value="bra">${ _("Brazil") }</option>
             <option value="can">${ _("Canada") }</option>
             <option value="can">${ _("Canada") }</option>

+ 2 - 2
desktop/core/src/desktop/static/desktop/js/ko.charts.js

@@ -587,7 +587,7 @@ ko.bindingHandlers.mapChart = {
         addToLegend(getHighestCategoryValue(cnt, item));
         addToLegend(getHighestCategoryValue(cnt, item));
         var _place = typeof item.label == "String" ? item.label.toUpperCase() : item.label;
         var _place = typeof item.label == "String" ? item.label.toUpperCase() : item.label;
         if (_place != null) {
         if (_place != null) {
-          if (_scope != "world" && _scope != "usa" && _place.indexOf(".") == -1) {
+          if (_scope != "world" && _scope != "usa" && _scope != "europe" && _place.indexOf(".") == -1) {
             _place = HueGeo.getISOAlpha2(_scope) + "." + _place;
             _place = HueGeo.getISOAlpha2(_scope) + "." + _place;
           }
           }
           _mapdata[_place] = {
           _mapdata[_place] = {
@@ -612,7 +612,7 @@ ko.bindingHandlers.mapChart = {
       $(_data).each(function (cnt, item) {
       $(_data).each(function (cnt, item) {
         var _place = item.label.toUpperCase();
         var _place = item.label.toUpperCase();
         if (_place != null) {
         if (_place != null) {
-          if (_scope != "world" && _scope != "usa" && _place.indexOf(".") == -1) {
+          if (_scope != "world" && _scope != "usa" && _scope != "europe" && _place.indexOf(".") == -1) {
             _place = HueGeo.getISOAlpha2(_scope) + "." + _place;
             _place = HueGeo.getISOAlpha2(_scope) + "." + _place;
           }
           }
           _mapdata[_place] = {
           _mapdata[_place] = {

+ 15 - 0
desktop/core/src/desktop/static/desktop/js/nv.d3.datamaps.js

@@ -102,6 +102,12 @@
           .scale((element.offsetWidth + 1) / 2 / Math.PI)
           .scale((element.offsetWidth + 1) / 2 / Math.PI)
           .translate(defaultTranslate);
           .translate(defaultTranslate);
         break;
         break;
+      case "europe":
+        projection = d3.geo[options.projection]()
+          .center([8.43727461750008, 51.16822764400005])
+          .scale(380)
+          .translate(defaultTranslate);
+        break;
       case "chn":
       case "chn":
         projection = d3.geo[options.projection]()
         projection = d3.geo[options.projection]()
           .center([104.18741784700012,34.672410587000066])
           .center([104.18741784700012,34.672410587000066])
@@ -641,7 +647,16 @@
   /**************************************
   /**************************************
    TopoJSON
    TopoJSON
    ***************************************/
    ***************************************/
+
+  var EUROPE_TOPO = {};
+  if (typeof  WORLD_TOPO != "undefined"){
+    EUROPE_TOPO = WORLD_TOPO;
+    EUROPE_TOPO.objects["europe"] =   EUROPE_TOPO.objects["world"];
+    delete EUROPE_TOPO.objects["world"];
+  }
+
   Datamap.prototype.worldTopo = typeof WORLD_TOPO != "undefined" ? WORLD_TOPO : {};
   Datamap.prototype.worldTopo = typeof WORLD_TOPO != "undefined" ? WORLD_TOPO : {};
+  Datamap.prototype.europeTopo = EUROPE_TOPO;
   Datamap.prototype.abwTopo = typeof ABW_TOPO != "undefined" ? ABW_TOPO : {};
   Datamap.prototype.abwTopo = typeof ABW_TOPO != "undefined" ? ABW_TOPO : {};
   Datamap.prototype.afgTopo = typeof AFG_TOPO != "undefined" ? AFG_TOPO : {};
   Datamap.prototype.afgTopo = typeof AFG_TOPO != "undefined" ? AFG_TOPO : {};
   Datamap.prototype.agoTopo = typeof AGO_TOPO != "undefined" ? AGO_TOPO : {};
   Datamap.prototype.agoTopo = typeof AGO_TOPO != "undefined" ? AGO_TOPO : {};