FAQ. Setting the size of icons for your own objects on the map

Материал из WiKi - UserSide

en | ru

On the coverage map the icons of the communication installations are displayed. You can assign and upload custom icons for the communication installations. When you change the scale of the map, the icons are resized to avoid that one icon does not overlap the whole city. However, not all customers like the standard icon scaling rules. This can be changed with a little knowledge of javascript:

Open the file /userside3/main/js/user_script.js. If this file does not exist, create it. It will not be overwritten when updating. In the text of the file add:

function reZoomIconRule(currentZoom) {
   var sizeArray = [];
   if (currentZoom < 14) {
       sizeArray = [1, 1];
   } else {
       switch (currentZoom) {
           case 14:
               sizeArray = [5, 5];
               break;
           case 15:
               sizeArray = [6, 6];
               break;
           case 16:
               sizeArray = [10, 10];
               break;
           case 17:
               sizeArray = [17, 17];
               break;
           case 18:
               sizeArray = [30, 30];
               break;
           case 19:
               sizeArray = [50, 50];
               break;
           case 20:
               sizeArray = [50, 50];
               break;
           case 21:
               sizeArray = [50, 50];
               break;
           case 22:
               sizeArray = [50, 50];
               break;
       }
   }
   return sizeArray;
}

The function reZoomIconRule - is a rule for scaling icons on the map. From the text of the function you can understand that the size of the map depends on the scale of the map. You can manage this to you own preference. Don't forget to save the file after making changes.

To scale icons with users - use the reZoomCustomerIconRule function

function reZoomCustomerIconRule(currentZoom) {
   sizeArray = [30, 30];
   return sizeArray;
}

And the reZoomNodeRadiusRule function to regulate the size of standard "circles" of communication installations on the map

function reZoomNodeRadiusRule(nodeType, zoom, objectType) {
   if (objectType == 'node') {
       switch (zoom) {
           case 10:
           case 11:
           case 12:
           case 13:
           case 14:
               return 1;
               break;
           case 15:
               return 2;
               break;
           case 16:
               return 4;
               break;
           case 17:
               return 7;
               break;
           case 18:
               return 14;
               break;
           case 19:
               return 25;
               break;
           case 20:
               return 28;
               break;
           case 21:
               return 28;
               break;
           case 22:
               return 28;
               break;
       }
   } else {
       return 4;
   }
}