-

   rss_rss_hh_new

 - e-mail

 

 -

 LiveInternet.ru:
: 17.03.2011
:
:
: 51

:


[ ] Google Maps

, 14 2017 . 19:33 +


- ? . , , .


( ?), . Google , . . HTML-. JavaScript GMapsTable. , - . .


image


, zoom , scale . Google Maps API, .



, ? - (, , JSON) - JavaScript, .


( : , ). .


HTML GMapsTable:


 .. :



 .. :

GMapsTable GoogleMaps API. . JavaScript'y! GMapsTable, DataContainer div'a :


// : ID div'
//      GoogleMaps,
//     
var container = new DataContainer("map", {
    zoom: 9,
    center: {lat: 55.7558, lng: 37.6173},
    mapTypeId: 'roadmap'
});

:


container.dataLoader = function (scale, borders) {
    ...  container.processData(some_data);
}

container.scaler = function (zoom) {
    ... return - ;
}

?.. , GMapsTable.


Data DataContainer


DataContainer , . "", , , dataLoader. DataContainer.processData. :


data: {
    minLat: float,
    difLat: float,
    minLon: float,
    difLon: float,
    scale: int,
    table: [
        [value, value, ...],
        [value, value, ...],
        ...
    ],
    tocache: boolean
}

(value) , , . (sale) , , . tocache , .


data: {
    minLat: 55.0,
    difLat: 2.0,
    minLon: 37.0,
    difLon: 1.0,
    scale: 2,
    table: [
        [1, 3, 0, 1],
        [0, 1, 2, 0]
    ],
    tocache: true
}

55.0, 37.0 57.0, 38.0 2 (, - 4 ). , , .



(zoom) Google Maps API, 1 ( ) 22 (). , GMapsTable (scale) , , .



, GMapsTable ( ) . , 42 10 (500 , ) 17 200 ( , ). , , , . :


   GMapsTable


(bounds) JavaScript minlat, maxlat, minlon, maxlon Google Maps .


dataLoader , . scale, -. dataLoader ( , ):


     GMapsTable



DataContainer:


1) scaler(zoom) GoogleMaps GMapsTable. .


2) dataLoader(scale, borders) , . DataContainer.processData(data).


borders JavaScript minlat, maxlat, minlon, maxlon Google Maps .


3) tableBeforeInit(map, table, data) , . map Google Maps, table HTML , data .


4) cellFormatter(td, val) . td HTML element, . val .


5) boundsChangedListener(zoom) , Google Maps.


6) minZoomLevel, maxZoomLevel . 1 ( ) 22 ().


DataContainer .



: HTML- JS-.
GMapsTable GitHub.

Original source: habrahabr.ru (comments, light).

https://habrahabr.ru/post/330920/

:  

: [1] []
 

:
: 

: ( )

:

  URL