@ -14,377 +14,425 @@
* limitations under the License .
* limitations under the License .
* /
* /
var tmGlobals = {
var tmGlobals = {
loadingTmId : null ,
loadingTmId : null ,
tmApiKeys : { }
tmApiKeys : { }
}
}
export default class TbTencentMap {
export default class TbTencentMap {
constructor ( $containerElement , utils , initCallback , defaultZoomLevel , dontFitMapBounds , minZoomLevel , tmApiKey , tmDefaultMapType ) {
constructor ( $containerElement , utils , initCallback , defaultZoomLevel , dontFitMapBounds , minZoomLevel , tmApiKey , tmDefaultMapType ) {
var tbMap = this ;
var tbMap = this ;
this . utils = utils ;
this . utils = utils ;
this . defaultZoomLevel = defaultZoomLevel ;
this . defaultZoomLevel = defaultZoomLevel ;
this . dontFitMapBounds = dontFitMapBounds ;
this . dontFitMapBounds = dontFitMapBounds ;
this . minZoomLevel = minZoomLevel ;
this . minZoomLevel = minZoomLevel ;
this . tooltips = [ ] ;
this . tooltips = [ ] ;
this . defaultMapType = tmDefaultMapType ;
this . defaultMapType = tmDefaultMapType ;
function clearGlobalId ( ) {
function clearGlobalId ( ) {
if ( tmGlobals . loadingTmId && tmGlobals . loadingTmId === tbMap . mapId ) {
if ( tmGlobals . loadingTmId && tmGlobals . loadingTmId === tbMap . mapId ) {
tmGlobals . loadingTmId = null ;
tmGlobals . loadingTmId = null ;
}
}
}
}
function displayError ( message ) {
function displayError ( message ) {
$containerElement . html ( // eslint-disable-line angular/angularelement
$containerElement . html ( // eslint-disable-line angular/angularelement
"<div class='error'>" + message + "</div>"
"<div class='error'>" + message + "</div>"
) ;
) ;
}
}
function initTencentMap ( ) {
function initTencentMap ( ) {
tbMap . map = new qq . maps . Map ( $containerElement [ 0 ] , { // eslint-disable-line no-undef
tbMap . map = new qq . maps . Map ( $containerElement [ 0 ] , { // eslint-disable-line no-undef
scrollwheel : true ,
scrollwheel : true ,
mapTypeId : getTencentMapTypeId ( tbMap . defaultMapType ) ,
mapTypeId : getTencentMapTypeId ( tbMap . defaultMapType ) ,
zoom : tbMap . defaultZoomLevel || 8
zoom : tbMap . defaultZoomLevel || 8
} ) ;
} ) ;
if ( initCallback ) {
if ( initCallback ) {
initCallback ( ) ;
initCallback ( ) ;
}
}
}
}
/* eslint-disable no-undef */
/* eslint-disable no-undef */
function getTencentMapTypeId ( mapType ) {
function getTencentMapTypeId ( mapType ) {
var mapTypeId = qq . maps . MapTypeId . ROADMAP ;
var mapTypeId = qq . maps . MapTypeId . ROADMAP ;
if ( mapType ) {
if ( mapType ) {
if ( mapType === 'hybrid' ) {
if ( mapType === 'hybrid' ) {
mapTypeId = qq . maps . MapTypeId . HYBRID ;
mapTypeId = qq . maps . MapTypeId . HYBRID ;
} else if ( mapType === 'satellite' ) {
} else if ( mapType === 'satellite' ) {
mapTypeId = qq . maps . MapTypeId . SATELLITE ;
mapTypeId = qq . maps . MapTypeId . SATELLITE ;
} else if ( mapType === 'terrain' ) {
} else if ( mapType === 'terrain' ) {
mapTypeId = qq . maps . MapTypeId . ROADMAP ;
mapTypeId = qq . maps . MapTypeId . ROADMAP ;
}
}
}
}
return mapTypeId ;
return mapTypeId ;
}
}
/* eslint-enable no-undef */
/* eslint-enable no-undef */
this . mapId = '' + Math . random ( ) . toString ( 36 ) . substr ( 2 , 9 ) ;
this . mapId = '' + Math . random ( ) . toString ( 36 ) . substr ( 2 , 9 ) ;
this . apiKey = tmApiKey || '84d6d83e0e51e481e50454ccbe8986b' ;
this . apiKey = tmApiKey || '84d6d83e0e51e481e50454ccbe8986b' ;
window . tm_authFailure = function ( ) { // eslint-disable-line no-undef, angular/window-service
window . tm_authFailure = function ( ) { // eslint-disable-line no-undef, angular/window-service
if ( tmGlobals . loadingTmId && tmGlobals . loadingTmId === tbMap . mapId ) {
if ( tmGlobals . loadingTmId && tmGlobals . loadingTmId === tbMap . mapId ) {
tmGlobals . loadingTmId = null ;
tmGlobals . loadingTmId = null ;
tmGlobals . tmApiKeys [ tbMap . apiKey ] . error = 'Unable to authentificate for tencent Map API.</br>Please check your API key.' ;
tmGlobals . tmApiKeys [ tbMap . apiKey ] . error = 'Unable to authentificate for tencent Map API.</br>Please check your API key.' ;
displayError ( tmGlobals . tmApiKeys [ tbMap . apiKey ] . error ) ;
displayError ( tmGlobals . tmApiKeys [ tbMap . apiKey ] . error ) ;
}
}
} ;
} ;
this . initMapFunctionName = 'initTencentMap_' + this . mapId ;
this . initMapFunctionName = 'initTencentMap_' + this . mapId ;
window [ this . initMapFunctionName ] = function ( ) { // eslint-disable-line no-undef, angular/window-service
window [ this . initMapFunctionName ] = function ( ) { // eslint-disable-line no-undef, angular/window-service
tmGlobals . tmApiKeys [ tbMap . apiKey ] . loaded = true ;
tmGlobals . tmApiKeys [ tbMap . apiKey ] . loaded = true ;
initTencentMap ( ) ;
initTencentMap ( ) ;
for ( var p = 0 ; p < tmGlobals . tmApiKeys [ tbMap . apiKey ] . pendingInits . length ; p ++ ) {
for ( var p = 0 ; p < tmGlobals . tmApiKeys [ tbMap . apiKey ] . pendingInits . length ; p ++ ) {
var pendingInit = tmGlobals . tmApiKeys [ tbMap . apiKey ] . pendingInits [ p ] ;
var pendingInit = tmGlobals . tmApiKeys [ tbMap . apiKey ] . pendingInits [ p ] ;
pendingInit ( ) ;
pendingInit ( ) ;
}
}
tmGlobals . tmApiKeys [ tbMap . apiKey ] . pendingInits = [ ] ;
tmGlobals . tmApiKeys [ tbMap . apiKey ] . pendingInits = [ ] ;
} ;
} ;
if ( this . apiKey && this . apiKey . length > 0 ) {
if ( this . apiKey && this . apiKey . length > 0 ) {
if ( tmGlobals . tmApiKeys [ this . apiKey ] ) {
if ( tmGlobals . tmApiKeys [ this . apiKey ] ) {
if ( tmGlobals . tmApiKeys [ this . apiKey ] . error ) {
if ( tmGlobals . tmApiKeys [ this . apiKey ] . error ) {
displayError ( tmGlobals . tmApiKeys [ this . apiKey ] . error ) ;
displayError ( tmGlobals . tmApiKeys [ this . apiKey ] . error ) ;
} else if ( tmGlobals . tmApiKeys [ this . apiKey ] . loaded ) {
} else if ( tmGlobals . tmApiKeys [ this . apiKey ] . loaded ) {
initTencentMap ( ) ;
initTencentMap ( ) ;
} else {
} else {
tmGlobals . tmApiKeys [ this . apiKey ] . pendingInits . push ( initTencentMap ) ;
tmGlobals . tmApiKeys [ this . apiKey ] . pendingInits . push ( initTencentMap ) ;
}
}
} else {
} else {
tmGlobals . tmApiKeys [ this . apiKey ] = {
tmGlobals . tmApiKeys [ this . apiKey ] = {
loaded : false ,
loaded : false ,
pendingInits : [ ]
pendingInits : [ ]
} ;
} ;
var tencentMapScriptRes = 'https://map.qq.com/api/js?v=2.exp&key=' + this . apiKey + '&callback=' + this . initMapFunctionName ;
var tencentMapScriptRes = 'https://map.qq.com/api/js?v=2.exp&key=' + this . apiKey + '&callback=' + this . initMapFunctionName ;
tmGlobals . loadingTmId = this . mapId ;
tmGlobals . loadingTmId = this . mapId ;
lazyLoad . load ( { type : 'js' , path : tencentMapScriptRes } ) . then ( // eslint-disable-line no-undef
lazyLoad . load ( { type : 'js' , path : tencentMapScriptRes } ) . then ( // eslint-disable-line no-undef
function success ( ) {
function success ( ) {
setTimeout ( clearGlobalId , 2000 ) ; // eslint-disable-line no-undef, angular/timeout-service
setTimeout ( clearGlobalId , 2000 ) ; // eslint-disable-line no-undef, angular/timeout-service
} ,
} ,
function fail ( e ) {
function fail ( e ) {
clearGlobalId ( ) ;
clearGlobalId ( ) ;
tmGlobals . tmApiKeys [ tbMap . apiKey ] . error = 'tencent map api load failed!</br>' + e ;
tmGlobals . tmApiKeys [ tbMap . apiKey ] . error = 'tencent map api load failed!</br>' + e ;
displayError ( tmGlobals . tmApiKeys [ tbMap . apiKey ] . error ) ;
displayError ( tmGlobals . tmApiKeys [ tbMap . apiKey ] . error ) ;
}
}
) ;
) ;
}
}
} else {
} else {
displayError ( 'No tencent Map Api Key provided!' ) ;
displayError ( 'No tencent Map Api Key provided!' ) ;
}
}
}
}
inited ( ) {
inited ( ) {
return angular . isDefined ( this . map ) ;
return angular . isDefined ( this . map ) ;
}
}
createMarkerLabelStyle ( settings ) {
createMarkerLabelStyle ( settings ) {
return {
return {
width : "200px" ,
width : "200px" ,
textAlign : "center" ,
textAlign : "center" ,
color : settings . labelColor ,
color : settings . labelColor ,
background : "none" ,
background : "none" ,
border : "none" ,
border : "none" ,
fontSize : "12px" ,
fontSize : "12px" ,
fontFamily : "\"Helvetica Neue\", Arial, Helvetica, sans-serif" ,
fontFamily : "\"Helvetica Neue\", Arial, Helvetica, sans-serif" ,
fontWeight : "bold"
fontWeight : "bold"
} ;
} ;
}
}
/* eslint-disable no-undef,no-unused-vars*/
/* eslint-disable no-undef,no-unused-vars*/
updateMarkerLabel ( marker , settings ) {
updateMarkerLabel ( marker , settings ) {
if ( marker . label ) {
if ( marker . label ) {
marker . label . setContent ( settings . labelText ) ;
marker . label . setContent ( settings . labelText ) ;
marker . label . setStyle ( this . createMarkerLabelStyle ( settings ) ) ;
marker . label . setStyle ( this . createMarkerLabelStyle ( settings ) ) ;
}
}
}
}
/* eslint-enable no-undef,no-unused-vars */
/* eslint-enable no-undef,no-unused-vars */
/* eslint-disable no-undef,no-unused-vars */
updateMarkerColor ( marker , color ) {
/* eslint-disable no-undef,no-unused-vars */
this . createDefaultMarkerIcon ( marker , color , ( iconInfo ) => {
updateMarkerColor ( marker , color ) {
marker . setIcon ( iconInfo . icon ) ;
this . createDefaultMarkerIcon ( marker , color , ( iconInfo ) => {
} ) ;
marker . setIcon ( iconInfo . icon ) ;
}
} ) ;
/* eslint-enable no-undef,,no-unused-vars */
}
/* eslint-disable no-undef */
/* eslint-enable no-undef,,no-unused-vars */
updateMarkerIcon ( marker , settings ) {
this . createMarkerIcon ( marker , settings , ( iconInfo ) => {
/* eslint-disable no-undef */
marker . setIcon ( iconInfo . icon ) ;
updateMarkerIcon ( marker , settings ) {
if ( marker . label ) {
this . createMarkerIcon ( marker , settings , ( iconInfo ) => {
marker . label . setOffset ( new qq . maps . Size ( - 100 , - iconInfo . size [ 1 ] - 20 ) ) ;
marker . setIcon ( iconInfo . icon ) ;
}
if ( marker . label ) {
} ) ;
marker . label . setOffset ( new qq . maps . Size ( - 100 , - iconInfo . size [ 1 ] - 20 ) ) ;
}
}
/* eslint-disable no-undef */
} ) ;
}
/* eslint-disable no-undef */
createMarkerIcon ( marker , settings , onMarkerIconReady ) {
/* eslint-disable no-undef */
var currentImage = settings . currentImage ;
var tMap = this ;
/* eslint-disable no-undef */
if ( currentImage && currentImage . url ) {
createMarkerIcon ( marker , settings , onMarkerIconReady ) {
this . utils . loadImageAspect ( currentImage . url ) . then (
var currentImage = settings . currentImage ;
( aspect ) => {
var tMap = this ;
if ( aspect ) {
if ( currentImage && currentImage . url ) {
var width ;
this . utils . loadImageAspect ( currentImage . url ) . then (
var height ;
( aspect ) => {
if ( aspect > 1 ) {
if ( aspect ) {
width = currentImage . size ;
var width ;
height = currentImage . size / aspect ;
var height ;
} else {
if ( aspect > 1 ) {
width = currentImage . size * aspect ;
width = currentImage . size ;
height = currentImage . size ;
height = currentImage . size / aspect ;
}
} else {
var icon = new qq . maps . MarkerImage ( currentImage . url ,
width = currentImage . size * aspect ;
new qq . maps . Size ( width , height ) ,
height = currentImage . size ;
new qq . maps . Point ( 0 , 0 ) ,
}
new qq . maps . Point ( width / 2 , height ) ,
var icon = new qq . maps . MarkerImage ( currentImage . url ,
new qq . maps . Size ( width , height ) ) ;
new qq . maps . Size ( width , height ) ,
var iconInfo = {
new qq . maps . Point ( 0 , 0 ) ,
size : [ width , height ] ,
new qq . maps . Point ( width / 2 , height ) ,
icon : icon
new qq . maps . Size ( width , height ) ) ;
} ;
var iconInfo = {
onMarkerIconReady ( iconInfo ) ;
size : [ width , height ] ,
} else {
icon : icon
tMap . createDefaultMarkerIcon ( marker , settings . color , onMarkerIconReady ) ;
} ;
}
onMarkerIconReady ( iconInfo ) ;
}
} else {
) ;
tMap . createDefaultMarkerIcon ( marker , settings . color , onMarkerIconReady ) ;
} else {
}
this . createDefaultMarkerIcon ( marker , settings . color , onMarkerIconReady ) ;
}
}
) ;
}
} else {
/* eslint-enable no-undef */
this . createDefaultMarkerIcon ( marker , settings . color , onMarkerIconReady ) ;
}
/* eslint-disable no-undef */
}
createDefaultMarkerIcon ( marker , color , onMarkerIconReady ) {
var pinColor = color . substr ( 1 ) ;
/* eslint-enable no-undef */
var icon = new qq . maps . MarkerImage ( "https://chart.apis.google.com/chart?chst=d_map_pin_letter_withshadow&chld=%E2%80%A2|" + pinColor ,
new qq . maps . Size ( 40 , 37 ) ,
/* eslint-disable no-undef */
new qq . maps . Point ( 0 , 0 ) ,
createDefaultMarkerIcon ( marker , color , onMarkerIconReady ) {
new qq . maps . Point ( 10 , 37 ) ) ;
var pinColor = color . substr ( 1 ) ;
var iconInfo = {
var icon = new qq . maps . MarkerImage ( "https://chart.apis.google.com/chart?chst=d_map_pin_letter_withshadow&chld=%E2%80%A2|" + pinColor ,
size : [ 40 , 37 ] ,
new qq . maps . Size ( 40 , 37 ) ,
icon : icon
new qq . maps . Point ( 0 , 0 ) ,
} ;
new qq . maps . Point ( 10 , 37 ) ) ;
onMarkerIconReady ( iconInfo ) ;
var iconInfo = {
}
size : [ 40 , 37 ] ,
/* eslint-enable no-undef */
icon : icon
} ;
/* eslint-disable no-undef */
onMarkerIconReady ( iconInfo ) ;
createMarker ( location , dsIndex , settings , onClickListener , markerArgs ) {
}
var marker = new qq . maps . Marker ( {
position : location
/* eslint-enable no-undef */
} ) ;
var tMap = this ;
/* eslint-disable no-undef */
this . createMarkerIcon ( marker , settings , ( iconInfo ) => {
createMarker ( location , dsIndex , settings , onClickListener , markerArgs ) {
marker . setIcon ( iconInfo . icon ) ;
var marker = new qq . maps . Marker ( {
marker . setMap ( tMap . map ) ;
position : location
if ( settings . showLabel ) {
} ) ;
marker . label = new qq . maps . Label ( {
var tMap = this ;
clickable : false ,
this . createMarkerIcon ( marker , settings , ( iconInfo ) => {
content : settings . labelText ,
marker . setIcon ( iconInfo . icon ) ;
offset : new qq . maps . Size ( - 100 , - iconInfo . size [ 1 ] - 20 ) ,
marker . setMap ( tMap . map ) ;
style : tMap . createMarkerLabelStyle ( settings ) ,
if ( settings . showLabel ) {
visible : true ,
marker . label = new qq . maps . Label ( {
position : location ,
clickable : false ,
map : tMap . map ,
content : settings . labelText ,
zIndex : 1000
offset : new qq . maps . Size ( - 100 , - iconInfo . size [ 1 ] - 20 ) ,
} ) ;
style : tMap . createMarkerLabelStyle ( settings ) ,
}
visible : true ,
} ) ;
position : location ,
map : tMap . map ,
if ( settings . displayTooltip ) {
zIndex : 1000
this . createTooltip ( marker , dsIndex , settings , markerArgs ) ;
} ) ;
}
}
} ) ;
if ( onClickListener ) {
qq . maps . event . addListener ( marker , 'click' , onClickListener ) ;
if ( settings . displayTooltip ) {
}
this . createTooltip ( marker , dsIndex , settings , markerArgs ) ;
}
return marker ;
}
if ( onClickListener ) {
qq . maps . event . addListener ( marker , 'click' , onClickListener ) ;
/* eslint-disable no-undef */
}
removeMarker ( marker ) {
marker . setMap ( null ) ;
return marker ;
if ( marker . label ) {
}
marker . label . setMap ( null ) ;
}
/* eslint-disable no-undef */
}
removeMarker ( marker ) {
marker . setMap ( null ) ;
/* eslint-enable no-undef */
if ( marker . label ) {
marker . label . setMap ( null ) ;
/* eslint-disable no-undef */
}
createTooltip ( marker , dsIndex , settings , markerArgs ) {
}
var popup = new qq . maps . InfoWindow ( {
map : this . map
/* eslint-enable no-undef */
} ) ;
var map = this ;
/* eslint-disable no-undef */
qq . maps . event . addListener ( marker , 'click' , function ( ) {
createTooltip ( marker , dsIndex , settings , markerArgs ) {
if ( settings . autocloseTooltip ) {
var popup = new qq . maps . InfoWindow ( {
map . tooltips . forEach ( ( tooltip ) => {
map : this . map
tooltip . popup . close ( ) ;
} ) ;
} ) ;
var map = this ;
}
qq . maps . event . addListener ( marker , 'click' , function ( ) {
popup . open ( ) ;
if ( settings . autocloseTooltip ) {
popup . setPosition ( marker ) ;
map . tooltips . forEach ( ( tooltip ) => {
} ) ;
tooltip . popup . close ( ) ;
this . tooltips . push ( {
} ) ;
markerArgs : markerArgs ,
}
popup : popup ,
popup . open ( ) ;
locationSettings : settings ,
popup . setPosition ( marker ) ;
dsIndex : dsIndex
} ) ;
} ) ;
this . tooltips . push ( {
}
markerArgs : markerArgs ,
/* eslint-enable no-undef */
popup : popup ,
locationSettings : settings ,
/* eslint-disable no-undef */
dsIndex : dsIndex
updatePolylineColor ( polyline , settings , color ) {
} ) ;
var options = {
}
path : polyline . getPath ( ) ,
strokeColor : color ,
/* eslint-enable no-undef */
strokeOpacity : settings . strokeOpacity ,
strokeWeight : settings . strokeWeight ,
/* eslint-disable no-undef */
map : this . map
updatePolylineColor ( polyline , settings , color ) {
} ;
var options = {
polyline . setOptions ( options ) ;
path : polyline . getPath ( ) ,
}
strokeColor : color ,
/* eslint-enable no-undef */
strokeOpacity : settings . strokeOpacity ,
strokeWeight : settings . strokeWeight ,
/* eslint-disable no-undef */
map : this . map
createPolyline ( locations , settings ) {
} ;
var polyline = new qq . maps . Polyline ( {
polyline . setOptions ( options ) ;
path : locations ,
}
strokeColor : settings . color ,
strokeOpacity : settings . strokeOpacity ,
/* eslint-enable no-undef */
strokeWeight : settings . strokeWeight ,
map : this . map
/* eslint-disable no-undef */
} ) ;
createPolyline ( locations , settings ) {
var polyline = new qq . maps . Polyline ( {
return polyline ;
path : locations ,
}
strokeColor : settings . color ,
/* eslint-enable no-undef */
strokeOpacity : settings . strokeOpacity ,
strokeWeight : settings . strokeWeight ,
removePolyline ( polyline ) {
map : this . map
polyline . setMap ( null ) ;
} ) ;
}
return polyline ;
/* eslint-disable no-undef ,no-unused-vars*/
}
fitBounds ( bounds ) {
if ( this . dontFitMapBounds && this . defaultZoomLevel ) {
/* eslint-enable no-undef */
this . map . setZoom ( this . defaultZoomLevel ) ;
this . map . setCenter ( bounds . getCenter ( ) ) ;
removePolyline ( polyline ) {
} else {
polyline . setMap ( null ) ;
var tbMap = this ;
}
qq . maps . event . addListenerOnce ( this . map , 'bounds_changed' , function ( ) { // eslint-disable-line no-undef
if ( ! tbMap . defaultZoomLevel && tbMap . map . getZoom ( ) > tbMap . minZoomLevel ) {
/* eslint-disable no-undef */
tbMap . map . setZoom ( tbMap . minZoomLevel ) ;
createPolygon ( latLangs , settings ) {
}
let polygon = new qq . maps . Polygon ( {
} ) ;
map : this . map ,
this . map . fitBounds ( bounds ) ;
path : latLangs ,
}
strokeColor : settings . polygonStrokeColor ,
}
fillColor : settings . polygonColor ,
/* eslint-enable no-undef,no-unused-vars */
strokeWeight : settings . polygonStrokeWeight
} ) ;
createLatLng ( lat , lng ) {
return polygon ;
return new qq . maps . LatLng ( lat , lng ) ; // eslint-disable-line no-undef
}
}
/* eslint-disable no-undef */
extendBoundsWithMarker ( bounds , marker ) {
removePolygon ( polygon ) {
bounds . extend ( marker . getPosition ( ) ) ;
polygon . setMap ( null ) ;
}
}
getMarkerPosition ( marker ) {
/* eslint-disable no-undef,no-unused-vars */
return marker . getPosition ( ) ;
updatePolygonColor ( polygon , settings , color ) {
}
let options = {
path : polygon . getPath ( ) ,
setMarkerPosition ( marker , latLng ) {
map : this . map ,
marker . setPosition ( latLng ) ;
strokeColor : color ,
if ( marker . label ) {
fillColor : color ,
marker . label . setPosition ( latLng ) ;
strokeWeight : settings . polygonStrokeWeight
}
}
}
}
getPolylineLatLngs ( polyline ) {
/* eslint-disable no-undef ,no-unused-vars*/
return polyline . getPath ( ) . getArray ( ) ;
}
getPolygonLatLngs ( polygon ) {
setPolylineLatLngs ( polyline , latLngs ) {
return polygon . getPath ( ) . getArray ( ) ;
polyline . setPath ( latLngs ) ;
}
}
setPolygonLatLngs ( polygon , latLngs ) {
createBounds ( ) {
polygon . setPath ( latLngs ) ;
return new qq . maps . LatLngBounds ( ) ; // eslint-disable-line no-undef
}
}
/* eslint-disable no-undef ,no-unused-vars*/
extendBounds ( bounds , polyline ) {
fitBounds ( bounds ) {
if ( polyline && polyline . getPath ( ) ) {
if ( this . dontFitMapBounds && this . defaultZoomLevel ) {
var locations = polyline . getPath ( ) ;
this . map . setZoom ( this . defaultZoomLevel ) ;
for ( var i = 0 ; i < locations . getLength ( ) ; i ++ ) {
this . map . setCenter ( bounds . getCenter ( ) ) ;
bounds . extend ( locations . getAt ( i ) ) ;
} else {
}
var tbMap = this ;
}
qq . maps . event . addListenerOnce ( this . map , 'bounds_changed' , function ( ) { // eslint-disable-line no-undef
}
if ( ! tbMap . defaultZoomLevel && tbMap . map . getZoom ( ) > tbMap . minZoomLevel ) {
tbMap . map . setZoom ( tbMap . minZoomLevel ) ;
invalidateSize ( ) {
}
qq . maps . event . trigger ( this . map , "resize" ) ; // eslint-disable-line no-undef
} ) ;
}
this . map . fitBounds ( bounds ) ;
}
getTooltips ( ) {
}
return this . tooltips ;
}
/* eslint-enable no-undef,no-unused-vars */
createLatLng ( lat , lng ) {
return new qq . maps . LatLng ( lat , lng ) ; // eslint-disable-line no-undef
}
extendBoundsWithMarker ( bounds , marker ) {
bounds . extend ( marker . getPosition ( ) ) ;
}
getMarkerPosition ( marker ) {
return marker . getPosition ( ) ;
}
setMarkerPosition ( marker , latLng ) {
marker . setPosition ( latLng ) ;
if ( marker . label ) {
marker . label . setPosition ( latLng ) ;
}
}
getPolylineLatLngs ( polyline ) {
return polyline . getPath ( ) . getArray ( ) ;
}
setPolylineLatLngs ( polyline , latLngs ) {
polyline . setPath ( latLngs ) ;
}
createBounds ( ) {
return new qq . maps . LatLngBounds ( ) ; // eslint-disable-line no-undef
}
extendBounds ( bounds , polyline ) {
if ( polyline && polyline . getPath ( ) ) {
var locations = polyline . getPath ( ) ;
for ( var i = 0 ; i < locations . getLength ( ) ; i ++ ) {
bounds . extend ( locations . getAt ( i ) ) ;
}
}
}
invalidateSize ( ) {
qq . maps . event . trigger ( this . map , "resize" ) ; // eslint-disable-line no-undef
}
getTooltips ( ) {
return this . tooltips ;
}
}
}