Merge branch 'master' into develop/2.3
This commit is contained in:
		
						commit
						a1e8ed8ff4
					
				@ -41,6 +41,10 @@
 | 
			
		||||
    </properties>
 | 
			
		||||
 | 
			
		||||
    <dependencies>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>de.ruedigermoeller</groupId>
 | 
			
		||||
            <artifactId>fst</artifactId>
 | 
			
		||||
        </dependency>
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>io.netty</groupId>
 | 
			
		||||
            <artifactId>netty-transport-native-epoll</artifactId>
 | 
			
		||||
 | 
			
		||||
@ -17,8 +17,8 @@ package org.thingsboard.server.service.encoding;
 | 
			
		||||
 | 
			
		||||
import com.google.protobuf.ByteString;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.nustaq.serialization.FSTConfiguration;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.util.SerializationUtils;
 | 
			
		||||
import org.thingsboard.server.common.msg.TbActorMsg;
 | 
			
		||||
import org.thingsboard.server.common.msg.cluster.ServerAddress;
 | 
			
		||||
import org.thingsboard.server.gen.cluster.ClusterAPIProtos;
 | 
			
		||||
@ -30,13 +30,14 @@ import static org.thingsboard.server.gen.cluster.ClusterAPIProtos.MessageType.CL
 | 
			
		||||
 | 
			
		||||
@Slf4j
 | 
			
		||||
@Service
 | 
			
		||||
public class ProtoWithJavaSerializationDecodingEncodingService implements DataDecodingEncodingService {
 | 
			
		||||
public class ProtoWithFSTService implements DataDecodingEncodingService {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    private final FSTConfiguration config = FSTConfiguration.createDefaultConfiguration();
 | 
			
		||||
    @Override
 | 
			
		||||
    public Optional<TbActorMsg> decode(byte[] byteArray) {
 | 
			
		||||
        try {
 | 
			
		||||
            TbActorMsg msg = (TbActorMsg) SerializationUtils.deserialize(byteArray);
 | 
			
		||||
            TbActorMsg msg = (TbActorMsg) config.asObject(byteArray);
 | 
			
		||||
            return Optional.of(msg);
 | 
			
		||||
 | 
			
		||||
        } catch (IllegalArgumentException e) {
 | 
			
		||||
@ -47,7 +48,7 @@ public class ProtoWithJavaSerializationDecodingEncodingService implements DataDe
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public byte[] encode(TbActorMsg msq) {
 | 
			
		||||
        return SerializationUtils.serialize(msq);
 | 
			
		||||
        return config.asByteArray(msq);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
							
								
								
									
										6
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								pom.xml
									
									
									
									
									
								
							@ -84,6 +84,7 @@
 | 
			
		||||
        <delight-nashorn-sandbox.version>0.1.14</delight-nashorn-sandbox.version>
 | 
			
		||||
        <kafka.version>2.0.0</kafka.version>
 | 
			
		||||
        <bucket4j.version>4.1.1</bucket4j.version>
 | 
			
		||||
        <fst.version>2.57</fst.version>
 | 
			
		||||
    </properties>
 | 
			
		||||
 | 
			
		||||
    <modules>
 | 
			
		||||
@ -789,6 +790,11 @@
 | 
			
		||||
                <artifactId>bucket4j-core</artifactId>
 | 
			
		||||
                <version>${bucket4j.version}</version>
 | 
			
		||||
            </dependency>
 | 
			
		||||
            <dependency>
 | 
			
		||||
                <groupId>de.ruedigermoeller</groupId>
 | 
			
		||||
                <artifactId>fst</artifactId>
 | 
			
		||||
                <version>${fst.version}</version>
 | 
			
		||||
            </dependency>
 | 
			
		||||
            <dependency>
 | 
			
		||||
                <groupId>io.springfox.ui</groupId>
 | 
			
		||||
                <artifactId>springfox-swagger-ui-rfc6570</artifactId>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1581
									
								
								ui/src/app/locale/locale.constant-de_DE.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1581
									
								
								ui/src/app/locale/locale.constant-de_DE.json
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -1034,7 +1034,6 @@
 | 
			
		||||
        "modbus-register-count": "Register count",
 | 
			
		||||
        "modbus-register-count-range": "Register count should be a positive value.",
 | 
			
		||||
        "modbus-byte-order": "Byte order",
 | 
			
		||||
 | 
			
		||||
        "sync": {
 | 
			
		||||
            "status": "Status",
 | 
			
		||||
            "sync": "Sync",
 | 
			
		||||
@ -1042,7 +1041,6 @@
 | 
			
		||||
            "last-sync-time": "Last sync time",
 | 
			
		||||
            "not-available": "Not available"
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        "export-extensions-configuration": "Export extensions configuration",
 | 
			
		||||
        "import-extensions-configuration": "Import extensions configuration",
 | 
			
		||||
        "import-extensions": "Import extensions",
 | 
			
		||||
@ -1568,7 +1566,8 @@
 | 
			
		||||
    "language": {
 | 
			
		||||
        "language": "Language",
 | 
			
		||||
        "locales": {
 | 
			
		||||
			"fr_FR": "French",
 | 
			
		||||
            "de_DE": "German",
 | 
			
		||||
            "fr_FR": "French",
 | 
			
		||||
            "zh_CN": "Chinese",
 | 
			
		||||
            "en_US": "English",
 | 
			
		||||
            "it_IT": "Italian",
 | 
			
		||||
@ -1579,4 +1578,4 @@
 | 
			
		||||
            "tr_TR": "Turkish"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
@ -1034,7 +1034,6 @@
 | 
			
		||||
        "modbus-register-count": "Contador del registro",
 | 
			
		||||
        "modbus-register-count-range": "Contador del registro debe ser un valor positivo.",
 | 
			
		||||
        "modbus-byte-order": "Orden del byte",
 | 
			
		||||
 | 
			
		||||
        "sync": {
 | 
			
		||||
            "status": "Estado",
 | 
			
		||||
            "sync": "Sincronización",
 | 
			
		||||
@ -1042,7 +1041,6 @@
 | 
			
		||||
            "last-sync-time": "Último tiempo de sincroniación",
 | 
			
		||||
            "not-available": "No disponible"
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        "export-extensions-configuration": "Exportar configuración de extensiones",
 | 
			
		||||
        "import-extensions-configuration": "Importar configuración de extensiones",
 | 
			
		||||
        "import-extensions": "Importar extensiones",
 | 
			
		||||
@ -1568,6 +1566,7 @@
 | 
			
		||||
    "language": {
 | 
			
		||||
        "language": "Lenguaje",
 | 
			
		||||
        "locales": {
 | 
			
		||||
            "de_DE": "Alemán",
 | 
			
		||||
            "fr_FR": "Francés",
 | 
			
		||||
            "zh_CN": "Chino",
 | 
			
		||||
            "en_US": "Inglés",
 | 
			
		||||
@ -1579,4 +1578,4 @@
 | 
			
		||||
            "tr_TR": "Turco"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
@ -1003,6 +1003,7 @@
 | 
			
		||||
    "language": {
 | 
			
		||||
        "language": "Language",
 | 
			
		||||
        "locales": {
 | 
			
		||||
            "de_DE": "Allemand",
 | 
			
		||||
            "en_US": "Anglais",
 | 
			
		||||
            "fr_FR": "Français",
 | 
			
		||||
            "es_ES": "Espagnol",
 | 
			
		||||
@ -1459,4 +1460,4 @@
 | 
			
		||||
        "widgets-bundle-required": "Un groupe de widgets est requis.",
 | 
			
		||||
        "widgets-bundles": "Groupes de widgets"
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
@ -100,7 +100,7 @@
 | 
			
		||||
            "UNACK": "Non riconosciuto"
 | 
			
		||||
        },
 | 
			
		||||
        "display-status": {
 | 
			
		||||
            "ACTIVE_UNACK": "Active Unacknowledged", 
 | 
			
		||||
            "ACTIVE_UNACK": "Active Unacknowledged",
 | 
			
		||||
            "ACTIVE_ACK": "Active Acknowledged",
 | 
			
		||||
            "CLEARED_UNACK": "Cleared Unacknowledged",
 | 
			
		||||
            "CLEARED_ACK": "Cleared Acknowledged"
 | 
			
		||||
@ -109,8 +109,8 @@
 | 
			
		||||
        "created-time": "Orario di creazione",
 | 
			
		||||
        "type": "Tipo",
 | 
			
		||||
        "severity": "Livello di gravità",
 | 
			
		||||
        "originator": "Origine", 
 | 
			
		||||
        "originator-type": "Tipo origine", 
 | 
			
		||||
        "originator": "Origine",
 | 
			
		||||
        "originator-type": "Tipo origine",
 | 
			
		||||
        "details": "Dettagli",
 | 
			
		||||
        "status": "Stato",
 | 
			
		||||
        "alarm-details": "Dettagli allarme",
 | 
			
		||||
@ -132,9 +132,9 @@
 | 
			
		||||
        "polling-interval-required": "Intervallo di polling Allarmi richiesto.",
 | 
			
		||||
        "min-polling-interval-message": "L'intervallo di polling deve essere di almeno 1 sec.",
 | 
			
		||||
        "aknowledge-alarms-title": "Conferma { count, plural, 1 {1 allarme} other {# allarmi} }",
 | 
			
		||||
        "aknowledge-alarms-text": "Sei sicuro di voler confermare { count, plural, 1 {1 allarme} other {# allarmi} }?", 
 | 
			
		||||
        "aknowledge-alarms-text": "Sei sicuro di voler confermare { count, plural, 1 {1 allarme} other {# allarmi} }?",
 | 
			
		||||
        "clear-alarms-title": "Elimina { count, plural, 1 {1 allarme} other {# allarmi} }",
 | 
			
		||||
        "clear-alarms-text": "Sei sicuro di voler eliminare { count, plural, 1 {1 allarme} other {# allarmi} }?" 
 | 
			
		||||
        "clear-alarms-text": "Sei sicuro di voler eliminare { count, plural, 1 {1 allarme} other {# allarmi} }?"
 | 
			
		||||
    },
 | 
			
		||||
    "alias": {
 | 
			
		||||
        "add": "Aggiungi alias",
 | 
			
		||||
@ -910,7 +910,6 @@
 | 
			
		||||
        "modbus-register-count": "Register count",
 | 
			
		||||
        "modbus-register-count-range": "Register count should be a positive value.",
 | 
			
		||||
        "modbus-byte-order": "Byte order",
 | 
			
		||||
 | 
			
		||||
        "sync": {
 | 
			
		||||
            "status": "Stato",
 | 
			
		||||
            "sync": "Sincronizzato",
 | 
			
		||||
@ -918,7 +917,6 @@
 | 
			
		||||
            "last-sync-time": "Ultima sincronizzazione",
 | 
			
		||||
            "not-available": "Non disponibile"
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        "export-extensions-configuration": "Esporta configurazione estensioni",
 | 
			
		||||
        "import-extensions-configuration": "Importa configurazione estensioni",
 | 
			
		||||
        "import-extensions": "Importa estensione",
 | 
			
		||||
@ -1414,7 +1412,7 @@
 | 
			
		||||
        "export": "Esporta un tipo di widget",
 | 
			
		||||
        "export-failed-error": "Impossibile esportare il tipo di widget: {{error}}",
 | 
			
		||||
        "create-new-widget-type": "Crea un nuovo tipo di widget",
 | 
			
		||||
        "widget-type-file": "Widget type file", 
 | 
			
		||||
        "widget-type-file": "Widget type file",
 | 
			
		||||
        "invalid-widget-type-file-error": "Impossibile importare un tipo di widget: struttura dati del widget non valida."
 | 
			
		||||
    },
 | 
			
		||||
    "icon": {
 | 
			
		||||
@ -1424,7 +1422,7 @@
 | 
			
		||||
        "show-all": "Mostra tutte le icone"
 | 
			
		||||
    },
 | 
			
		||||
    "custom": {
 | 
			
		||||
        "widget-action": { 
 | 
			
		||||
        "widget-action": {
 | 
			
		||||
            "action-cell-button": "Action cell button",
 | 
			
		||||
            "row-click": "On row click",
 | 
			
		||||
            "marker-click": "On marker click",
 | 
			
		||||
@ -1434,7 +1432,8 @@
 | 
			
		||||
    "language": {
 | 
			
		||||
        "language": "Lingua",
 | 
			
		||||
        "locales": {
 | 
			
		||||
			"fr_FR": "Francese",
 | 
			
		||||
            "de_DE": "Tedesco",
 | 
			
		||||
            "fr_FR": "Francese",
 | 
			
		||||
            "zh_CN": "Cinese",
 | 
			
		||||
            "ko_KR": "Coreano",
 | 
			
		||||
            "en_US": "Inglese",
 | 
			
		||||
@ -1445,4 +1444,4 @@
 | 
			
		||||
            "tr_TR": "Turco"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
@ -288,11 +288,11 @@
 | 
			
		||||
		"type-suspended": "一時停止中",
 | 
			
		||||
		"type-credentials-read": "信用証明書を読む",
 | 
			
		||||
		"type-attributes-read": "読み取られた属性",
 | 
			
		||||
        "type-relation-add-or-update": "関係が更新されました",
 | 
			
		||||
        "type-relation-delete": "関係が削除されました",
 | 
			
		||||
        "type-relations-delete": "すべてのリレーションを削除",
 | 
			
		||||
        "type-alarm-ack": "承認された",
 | 
			
		||||
        "type-alarm-clear": "クリアされた",													  
 | 
			
		||||
		"type-relation-add-or-update": "関係が更新されました",
 | 
			
		||||
		"type-relation-delete": "関係が削除されました",
 | 
			
		||||
		"type-relations-delete": "すべてのリレーションを削除",
 | 
			
		||||
		"type-alarm-ack": "承認された",
 | 
			
		||||
		"type-alarm-clear": "クリアされた",
 | 
			
		||||
		"status-success": "成功",
 | 
			
		||||
		"status-failure": "失敗",
 | 
			
		||||
		"audit-log-details": "監査ログの詳細",
 | 
			
		||||
@ -322,7 +322,7 @@
 | 
			
		||||
	"common": {
 | 
			
		||||
		"username": "ユーザー名",
 | 
			
		||||
		"password": "パスワード",
 | 
			
		||||
        "enter-username": "ユーザーネームを入力してください",
 | 
			
		||||
		"enter-username": "ユーザーネームを入力してください",
 | 
			
		||||
		"enter-password": "パスワードを入力する",
 | 
			
		||||
		"enter-search": "検索を入力"
 | 
			
		||||
	},
 | 
			
		||||
@ -919,7 +919,6 @@
 | 
			
		||||
		"modbus-register-count": "レジスタ数",
 | 
			
		||||
		"modbus-register-count-range": "レジスタ数は正の値でなければなりません。",
 | 
			
		||||
		"modbus-byte-order": "バイト順",
 | 
			
		||||
 | 
			
		||||
		"sync": {
 | 
			
		||||
			"status": "状態",
 | 
			
		||||
			"sync": "同期",
 | 
			
		||||
@ -927,7 +926,6 @@
 | 
			
		||||
			"last-sync-time": "前回の同期時間",
 | 
			
		||||
			"not-available": "利用不可"
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		"export-extensions-configuration": "エクステンション設定のエクスポート",
 | 
			
		||||
		"import-extensions-configuration": "エクステンション設定のインポート",
 | 
			
		||||
		"import-extensions": "拡張機能のインポート",
 | 
			
		||||
@ -1417,7 +1415,7 @@
 | 
			
		||||
		"action-source-required": "アクションソースが必要です。",
 | 
			
		||||
		"action-name": "名",
 | 
			
		||||
		"action-name-required": "アクション名は必須です。",
 | 
			
		||||
        "action-name-not-unique": "同じ名前の別のアクションがすでに存在します。<br/>アクション名は、同じアクションソース内で一意である必要があります。",
 | 
			
		||||
		"action-name-not-unique": "同じ名前の別のアクションがすでに存在します。<br/>アクション名は、同じアクションソース内で一意である必要があります。",
 | 
			
		||||
		"action-icon": "アイコン",
 | 
			
		||||
		"action-type": "タイプ",
 | 
			
		||||
		"action-type-required": "アクションタイプが必要です。",
 | 
			
		||||
@ -1427,7 +1425,7 @@
 | 
			
		||||
		"delete-action-text": "'{{actionName}}'?"
 | 
			
		||||
	},
 | 
			
		||||
	"widget-type": {
 | 
			
		||||
        "import": "インポートウィジェットタイプ",
 | 
			
		||||
		"import": "インポートウィジェットタイプ",
 | 
			
		||||
		"export": "ウィジェットのタイプをエクスポートする",
 | 
			
		||||
		"export-failed-error": "{{error}}",
 | 
			
		||||
		"create-new-widget-type": "新しいウィジェットタイプを作成する",
 | 
			
		||||
@ -1451,6 +1449,7 @@
 | 
			
		||||
	"language": {
 | 
			
		||||
		"language": "言語",
 | 
			
		||||
		"locales": {
 | 
			
		||||
			"de_DE": "ドイツ語",
 | 
			
		||||
			"en_US": "英語",
 | 
			
		||||
			"ko_KR": "韓国語",
 | 
			
		||||
			"it_IT": "イタリアの",
 | 
			
		||||
@ -1461,4 +1460,4 @@
 | 
			
		||||
			"tr_TR": "トルコ語"
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
@ -85,7 +85,6 @@
 | 
			
		||||
        "enable-tls": "TLS 사용",
 | 
			
		||||
        "send-test-mail": "테스트 메일 보내기"
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    "alarm": {
 | 
			
		||||
        "alarm": "Alarm",
 | 
			
		||||
        "alarms": "Alarms",
 | 
			
		||||
@ -831,7 +830,6 @@
 | 
			
		||||
        "modbus-register-count": "Register count",
 | 
			
		||||
        "modbus-register-count-range": "Register count should be a positive value.",
 | 
			
		||||
        "modbus-byte-order": "Byte order",
 | 
			
		||||
 | 
			
		||||
        "sync": {
 | 
			
		||||
            "status": "Status",
 | 
			
		||||
            "sync": "Sync",
 | 
			
		||||
@ -839,7 +837,6 @@
 | 
			
		||||
            "last-sync-time": "Last sync time",
 | 
			
		||||
            "not-available": "Not available"
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        "export-extensions-configuration": "Export extensions configuration",
 | 
			
		||||
        "import-extensions-configuration": "Import extensions configuration",
 | 
			
		||||
        "import-extensions": "Import extensions",
 | 
			
		||||
@ -1328,8 +1325,9 @@
 | 
			
		||||
    "language": {
 | 
			
		||||
        "language": "언어",
 | 
			
		||||
        "locales": {
 | 
			
		||||
            "de_DE": "독일어",
 | 
			
		||||
            "en_US": "영어",
 | 
			
		||||
			"fr_FR": "프랑스의",
 | 
			
		||||
            "fr_FR": "프랑스의",
 | 
			
		||||
            "ko_KR": "한글",
 | 
			
		||||
            "zh_CN": "중국어",
 | 
			
		||||
            "ru_RU": "러시아어",
 | 
			
		||||
@ -1339,4 +1337,4 @@
 | 
			
		||||
            "tr_TR": "터키어"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
@ -1032,7 +1032,6 @@
 | 
			
		||||
        "modbus-register-count": "Количество регистров",
 | 
			
		||||
        "modbus-register-count-range": "Количество регистров должно быть больше ноля.",
 | 
			
		||||
        "modbus-byte-order": "Порядок байтов",
 | 
			
		||||
 | 
			
		||||
        "sync": {
 | 
			
		||||
            "status": "Статус",
 | 
			
		||||
            "sync": "Синхронизирован",
 | 
			
		||||
@ -1040,7 +1039,6 @@
 | 
			
		||||
            "last-sync-time": "Время последней синхронизации",
 | 
			
		||||
            "not-available": "Не доступен"
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        "export-extensions-configuration": "Экспортировать конфигурацию расширений",
 | 
			
		||||
        "import-extensions-configuration": "Импортировать конфигурацию расширений",
 | 
			
		||||
        "import-extensions": "Импортировать расширения",
 | 
			
		||||
@ -1566,6 +1564,7 @@
 | 
			
		||||
    "language": {
 | 
			
		||||
        "language": "Язык",
 | 
			
		||||
        "locales": {
 | 
			
		||||
            "de_DE": "Немецкий",
 | 
			
		||||
            "en_US": "Английский",
 | 
			
		||||
            "zh_CN": "Китайский",
 | 
			
		||||
            "ko_KR": "Корейский",
 | 
			
		||||
@ -1577,4 +1576,4 @@
 | 
			
		||||
            "ja_JA": "Японский"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
@ -1175,7 +1175,7 @@
 | 
			
		||||
        "delete-rulechains-action-title": "{ count, plural, 1 {1 kuralı} other {# kuralı} } sil",
 | 
			
		||||
        "delete-rulechains-text": "UYARI: Onaylandıktan sonra seçili tüm kurallar ve ilişkili tüm veriler geri yüklenemez şekilde silinecektir.",
 | 
			
		||||
        "add-rulechain-text": "Yeni kural ekle",
 | 
			
		||||
        "no-rulechains-text":"Hiçbir kural bulunamadı",
 | 
			
		||||
        "no-rulechains-text": "Hiçbir kural bulunamadı",
 | 
			
		||||
        "rulechain-details": "Kural detayları",
 | 
			
		||||
        "details": "Detaylar",
 | 
			
		||||
        "events": "Olaylar",
 | 
			
		||||
@ -1531,6 +1531,7 @@
 | 
			
		||||
    "language": {
 | 
			
		||||
        "language": "Dil",
 | 
			
		||||
        "locales": {
 | 
			
		||||
            "de_DE": "Almanca",
 | 
			
		||||
            "fr_FR": "Fransızca",
 | 
			
		||||
            "zh_CN": "Çince",
 | 
			
		||||
            "en_US": "İngilizce",
 | 
			
		||||
 | 
			
		||||
@ -916,7 +916,6 @@
 | 
			
		||||
            "last-sync-time": "最后同步时间",
 | 
			
		||||
            "not-available": "无法使用"
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        "export-extensions-configuration": "导出扩展配置",
 | 
			
		||||
        "import-extensions-configuration": "导入扩展配置",
 | 
			
		||||
        "import-extensions": "导入扩展",
 | 
			
		||||
@ -1299,7 +1298,6 @@
 | 
			
		||||
        "saveAs": "部件另存为",
 | 
			
		||||
        "save-widget-type-as": "部件类型另存为",
 | 
			
		||||
        "save-widget-type-as-text": "请输入新的部件标题或选择目标部件包",
 | 
			
		||||
 | 
			
		||||
        "toggle-fullscreen": "切换全屏",
 | 
			
		||||
        "run": "运行部件",
 | 
			
		||||
        "title": "部件标题",
 | 
			
		||||
@ -1437,8 +1435,9 @@
 | 
			
		||||
    "language": {
 | 
			
		||||
        "language": "语言",
 | 
			
		||||
        "locales": {
 | 
			
		||||
            "de_DE": "德语",
 | 
			
		||||
            "en_US": "英语",
 | 
			
		||||
			"fr_FR": "法国",
 | 
			
		||||
            "fr_FR": "法国",
 | 
			
		||||
            "ko_KR": "韩语",
 | 
			
		||||
            "zh_CN": "汉语",
 | 
			
		||||
            "ru_RU": "俄语",
 | 
			
		||||
@ -1448,4 +1447,4 @@
 | 
			
		||||
            "tr_TR": "土耳其"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
@ -314,6 +314,48 @@ export default class TbGoogleMap {
 | 
			
		||||
        polyline.setMap(null);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	createPolygon(latLangs, settings) {
 | 
			
		||||
		let polygon = new google.maps.Polygon({
 | 
			
		||||
			map: this.map,
 | 
			
		||||
			paths: latLangs,
 | 
			
		||||
			strokeColor: settings.polygonStrokeColor,
 | 
			
		||||
			strokeOpacity: settings.polygonStrokeColor,
 | 
			
		||||
			fillColor: settings.polygonColor,
 | 
			
		||||
			fillOpacity: settings.polygonOpacity,
 | 
			
		||||
			strokeWeight: settings.polygonStrokeWeight
 | 
			
		||||
		});
 | 
			
		||||
		return polygon;
 | 
			
		||||
	}
 | 
			
		||||
	/* eslint-disable no-undef */
 | 
			
		||||
 | 
			
		||||
	removePolygon (polygon) {
 | 
			
		||||
		polygon.setMap(null);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* eslint-disable no-undef,no-unused-vars */
 | 
			
		||||
	updatePolygonColor (polygon, settings, color) {
 | 
			
		||||
		let options = {
 | 
			
		||||
			paths: polygon.getPaths(),
 | 
			
		||||
			map: this.map,
 | 
			
		||||
			strokeColor: color,
 | 
			
		||||
			fillColor: color,
 | 
			
		||||
			strokeWeight: settings.polygonStrokeWeight
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	/* eslint-disable no-undef ,no-unused-vars*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	getPolygonLatLngs(polygon) {
 | 
			
		||||
		return polygon.getPaths().getArray();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	setPolygonLatLngs(polygon, latLngs) {
 | 
			
		||||
		polygon.setPaths(latLngs);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /* eslint-disable no-undef */
 | 
			
		||||
    fitBounds(bounds) {
 | 
			
		||||
        if (this.dontFitMapBounds && this.defaultZoomLevel) {
 | 
			
		||||
 | 
			
		||||
@ -369,6 +369,21 @@ export default class TbImageMap {
 | 
			
		||||
    removePolyline(/*polyline*/) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	createPolygon(/*latLangs, settings*/) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	removePolygon(/*latLangs, settings*/) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	updatePolygonColor(/*latLangs, settings*/) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	getPolygonLatLngs(/*latLangs, settings*/) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	setPolygonLatLngs(/*latLangs, settings*/) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    fitBounds() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -19,234 +19,270 @@ import 'leaflet-providers';
 | 
			
		||||
 | 
			
		||||
export default class TbOpenStreetMap {
 | 
			
		||||
 | 
			
		||||
    constructor($containerElement, utils, initCallback, defaultZoomLevel, dontFitMapBounds, minZoomLevel, mapProvider) {
 | 
			
		||||
	constructor($containerElement, utils, initCallback, defaultZoomLevel, dontFitMapBounds, minZoomLevel, mapProvider) {
 | 
			
		||||
 | 
			
		||||
        this.utils = utils;
 | 
			
		||||
        this.defaultZoomLevel = defaultZoomLevel;
 | 
			
		||||
        this.dontFitMapBounds = dontFitMapBounds;
 | 
			
		||||
        this.minZoomLevel = minZoomLevel;
 | 
			
		||||
        this.tooltips = [];
 | 
			
		||||
		this.utils = utils;
 | 
			
		||||
		this.defaultZoomLevel = defaultZoomLevel;
 | 
			
		||||
		this.dontFitMapBounds = dontFitMapBounds;
 | 
			
		||||
		this.minZoomLevel = minZoomLevel;
 | 
			
		||||
		this.tooltips = [];
 | 
			
		||||
 | 
			
		||||
        if (!mapProvider) {
 | 
			
		||||
            mapProvider = "OpenStreetMap.Mapnik";
 | 
			
		||||
        }
 | 
			
		||||
		if (!mapProvider) {
 | 
			
		||||
			mapProvider = "OpenStreetMap.Mapnik";
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
        this.map = L.map($containerElement[0]).setView([0, 0], this.defaultZoomLevel || 8);
 | 
			
		||||
		this.map = L.map($containerElement[0]).setView([0, 0], this.defaultZoomLevel || 8);
 | 
			
		||||
 | 
			
		||||
        var tileLayer = L.tileLayer.provider(mapProvider);
 | 
			
		||||
		var tileLayer = L.tileLayer.provider(mapProvider);
 | 
			
		||||
 | 
			
		||||
        tileLayer.addTo(this.map);
 | 
			
		||||
		tileLayer.addTo(this.map);
 | 
			
		||||
 | 
			
		||||
        if (initCallback) {
 | 
			
		||||
            setTimeout(initCallback, 0); //eslint-disable-line
 | 
			
		||||
        }
 | 
			
		||||
		if (initCallback) {
 | 
			
		||||
			setTimeout(initCallback, 0); //eslint-disable-line
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    inited() {
 | 
			
		||||
        return angular.isDefined(this.map);
 | 
			
		||||
    }
 | 
			
		||||
	inited() {
 | 
			
		||||
		return angular.isDefined(this.map);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    updateMarkerLabel(marker, settings) {
 | 
			
		||||
        marker.unbindTooltip();
 | 
			
		||||
        marker.bindTooltip('<div style="color: '+ settings.labelColor +';"><b>'+settings.labelText+'</b></div>',
 | 
			
		||||
            { className: 'tb-marker-label', permanent: true, direction: 'top', offset: marker.tooltipOffset });
 | 
			
		||||
    }
 | 
			
		||||
	updateMarkerLabel(marker, settings) {
 | 
			
		||||
		marker.unbindTooltip();
 | 
			
		||||
		marker.bindTooltip('<div style="color: ' + settings.labelColor + ';"><b>' + settings.labelText + '</b></div>',
 | 
			
		||||
			{className: 'tb-marker-label', permanent: true, direction: 'top', offset: marker.tooltipOffset});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    updateMarkerColor(marker, color) {
 | 
			
		||||
        this.createDefaultMarkerIcon(marker, color, (iconInfo) => {
 | 
			
		||||
            marker.setIcon(iconInfo.icon);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
	updateMarkerColor(marker, color) {
 | 
			
		||||
		this.createDefaultMarkerIcon(marker, color, (iconInfo) => {
 | 
			
		||||
			marker.setIcon(iconInfo.icon);
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    updateMarkerIcon(marker, settings) {
 | 
			
		||||
        this.createMarkerIcon(marker, settings, (iconInfo) => {
 | 
			
		||||
            marker.setIcon(iconInfo.icon);
 | 
			
		||||
            if (settings.showLabel) {
 | 
			
		||||
                marker.unbindTooltip();
 | 
			
		||||
                marker.tooltipOffset = [0, -iconInfo.size[1] + 10];
 | 
			
		||||
                marker.bindTooltip('<div style="color: '+ settings.labelColor +';"><b>'+settings.labelText+'</b></div>',
 | 
			
		||||
                    { className: 'tb-marker-label', permanent: true, direction: 'top', offset: marker.tooltipOffset });
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
	updateMarkerIcon(marker, settings) {
 | 
			
		||||
		this.createMarkerIcon(marker, settings, (iconInfo) => {
 | 
			
		||||
			marker.setIcon(iconInfo.icon);
 | 
			
		||||
			if (settings.showLabel) {
 | 
			
		||||
				marker.unbindTooltip();
 | 
			
		||||
				marker.tooltipOffset = [0, -iconInfo.size[1] + 10];
 | 
			
		||||
				marker.bindTooltip('<div style="color: ' + settings.labelColor + ';"><b>' + settings.labelText + '</b></div>',
 | 
			
		||||
					{className: 'tb-marker-label', permanent: true, direction: 'top', offset: marker.tooltipOffset});
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    createMarkerIcon(marker, settings, onMarkerIconReady) {
 | 
			
		||||
        var currentImage = settings.currentImage;
 | 
			
		||||
        var opMap = this;
 | 
			
		||||
        if (currentImage && currentImage.url) {
 | 
			
		||||
            this.utils.loadImageAspect(currentImage.url).then(
 | 
			
		||||
                (aspect) => {
 | 
			
		||||
                    if (aspect) {
 | 
			
		||||
                        var width;
 | 
			
		||||
                        var height;
 | 
			
		||||
                        if (aspect > 1) {
 | 
			
		||||
                            width = currentImage.size;
 | 
			
		||||
                            height = currentImage.size / aspect;
 | 
			
		||||
                        } else {
 | 
			
		||||
                            width = currentImage.size * aspect;
 | 
			
		||||
                            height = currentImage.size;
 | 
			
		||||
                        }
 | 
			
		||||
                        var icon = L.icon({
 | 
			
		||||
                            iconUrl: currentImage.url,
 | 
			
		||||
                            iconSize: [width, height],
 | 
			
		||||
                            iconAnchor: [width/2, height],
 | 
			
		||||
                            popupAnchor: [0, -height]
 | 
			
		||||
                        });
 | 
			
		||||
                        var iconInfo = {
 | 
			
		||||
                            size: [width, height],
 | 
			
		||||
                            icon: icon
 | 
			
		||||
                        };
 | 
			
		||||
                        onMarkerIconReady(iconInfo);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        opMap.createDefaultMarkerIcon(marker, settings.color, onMarkerIconReady);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            );
 | 
			
		||||
        } else {
 | 
			
		||||
            this.createDefaultMarkerIcon(marker, settings.color, onMarkerIconReady);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
	createMarkerIcon(marker, settings, onMarkerIconReady) {
 | 
			
		||||
		var currentImage = settings.currentImage;
 | 
			
		||||
		var opMap = this;
 | 
			
		||||
		if (currentImage && currentImage.url) {
 | 
			
		||||
			this.utils.loadImageAspect(currentImage.url).then(
 | 
			
		||||
				(aspect) => {
 | 
			
		||||
					if (aspect) {
 | 
			
		||||
						var width;
 | 
			
		||||
						var height;
 | 
			
		||||
						if (aspect > 1) {
 | 
			
		||||
							width = currentImage.size;
 | 
			
		||||
							height = currentImage.size / aspect;
 | 
			
		||||
						} else {
 | 
			
		||||
							width = currentImage.size * aspect;
 | 
			
		||||
							height = currentImage.size;
 | 
			
		||||
						}
 | 
			
		||||
						var icon = L.icon({
 | 
			
		||||
							iconUrl: currentImage.url,
 | 
			
		||||
							iconSize: [width, height],
 | 
			
		||||
							iconAnchor: [width / 2, height],
 | 
			
		||||
							popupAnchor: [0, -height]
 | 
			
		||||
						});
 | 
			
		||||
						var iconInfo = {
 | 
			
		||||
							size: [width, height],
 | 
			
		||||
							icon: icon
 | 
			
		||||
						};
 | 
			
		||||
						onMarkerIconReady(iconInfo);
 | 
			
		||||
					} else {
 | 
			
		||||
						opMap.createDefaultMarkerIcon(marker, settings.color, onMarkerIconReady);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			);
 | 
			
		||||
		} else {
 | 
			
		||||
			this.createDefaultMarkerIcon(marker, settings.color, onMarkerIconReady);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    createDefaultMarkerIcon(marker, color, onMarkerIconReady) {
 | 
			
		||||
        var pinColor = color.substr(1);
 | 
			
		||||
        var icon = L.icon({
 | 
			
		||||
            iconUrl: 'https://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|' + pinColor,
 | 
			
		||||
            iconSize: [21, 34],
 | 
			
		||||
            iconAnchor: [10, 34],
 | 
			
		||||
            popupAnchor: [0, -34],
 | 
			
		||||
            shadowUrl: 'https://chart.apis.google.com/chart?chst=d_map_pin_shadow',
 | 
			
		||||
            shadowSize: [40, 37],
 | 
			
		||||
            shadowAnchor: [12, 35]
 | 
			
		||||
        });
 | 
			
		||||
        var iconInfo = {
 | 
			
		||||
            size: [21, 34],
 | 
			
		||||
            icon: icon
 | 
			
		||||
        };
 | 
			
		||||
        onMarkerIconReady(iconInfo);
 | 
			
		||||
    }
 | 
			
		||||
	createDefaultMarkerIcon(marker, color, onMarkerIconReady) {
 | 
			
		||||
		var pinColor = color.substr(1);
 | 
			
		||||
		var icon = L.icon({
 | 
			
		||||
			iconUrl: 'https://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|' + pinColor,
 | 
			
		||||
			iconSize: [21, 34],
 | 
			
		||||
			iconAnchor: [10, 34],
 | 
			
		||||
			popupAnchor: [0, -34],
 | 
			
		||||
			shadowUrl: 'https://chart.apis.google.com/chart?chst=d_map_pin_shadow',
 | 
			
		||||
			shadowSize: [40, 37],
 | 
			
		||||
			shadowAnchor: [12, 35]
 | 
			
		||||
		});
 | 
			
		||||
		var iconInfo = {
 | 
			
		||||
			size: [21, 34],
 | 
			
		||||
			icon: icon
 | 
			
		||||
		};
 | 
			
		||||
		onMarkerIconReady(iconInfo);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    createMarker(location, dsIndex, settings, onClickListener, markerArgs) {
 | 
			
		||||
        var marker = L.marker(location, {});
 | 
			
		||||
        var opMap = this;
 | 
			
		||||
        this.createMarkerIcon(marker, settings, (iconInfo) => {
 | 
			
		||||
            marker.setIcon(iconInfo.icon);
 | 
			
		||||
            if (settings.showLabel) {
 | 
			
		||||
                marker.tooltipOffset = [0, -iconInfo.size[1] + 10];
 | 
			
		||||
                marker.bindTooltip('<div style="color: '+ settings.labelColor +';"><b>'+settings.labelText+'</b></div>',
 | 
			
		||||
                    { className: 'tb-marker-label', permanent: true, direction: 'top', offset: marker.tooltipOffset });
 | 
			
		||||
            }
 | 
			
		||||
            marker.addTo(opMap.map);
 | 
			
		||||
        });
 | 
			
		||||
	createMarker(location, dsIndex, settings, onClickListener, markerArgs) {
 | 
			
		||||
		var marker = L.marker(location, {});
 | 
			
		||||
		var opMap = this;
 | 
			
		||||
		this.createMarkerIcon(marker, settings, (iconInfo) => {
 | 
			
		||||
			marker.setIcon(iconInfo.icon);
 | 
			
		||||
			if (settings.showLabel) {
 | 
			
		||||
				marker.tooltipOffset = [0, -iconInfo.size[1] + 10];
 | 
			
		||||
				marker.bindTooltip('<div style="color: ' + settings.labelColor + ';"><b>' + settings.labelText + '</b></div>',
 | 
			
		||||
					{className: 'tb-marker-label', permanent: true, direction: 'top', offset: marker.tooltipOffset});
 | 
			
		||||
			}
 | 
			
		||||
			marker.addTo(opMap.map);
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
        if (settings.displayTooltip) {
 | 
			
		||||
            this.createTooltip(marker, dsIndex, settings, markerArgs);
 | 
			
		||||
        }
 | 
			
		||||
		if (settings.displayTooltip) {
 | 
			
		||||
			this.createTooltip(marker, dsIndex, settings, markerArgs);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
        if (onClickListener) {
 | 
			
		||||
            marker.on('click', onClickListener);
 | 
			
		||||
        }
 | 
			
		||||
		if (onClickListener) {
 | 
			
		||||
			marker.on('click', onClickListener);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
        return marker;
 | 
			
		||||
    }
 | 
			
		||||
		return marker;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    removeMarker(marker) {
 | 
			
		||||
        this.map.removeLayer(marker);
 | 
			
		||||
    }
 | 
			
		||||
	removeMarker(marker) {
 | 
			
		||||
		this.map.removeLayer(marker);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    createTooltip(marker, dsIndex, settings, markerArgs) {
 | 
			
		||||
        var popup = L.popup();
 | 
			
		||||
        popup.setContent('');
 | 
			
		||||
        marker.bindPopup(popup, {autoClose: settings.autocloseTooltip, closeOnClick: false});
 | 
			
		||||
        this.tooltips.push( {
 | 
			
		||||
            markerArgs: markerArgs,
 | 
			
		||||
            popup: popup,
 | 
			
		||||
            locationSettings: settings,
 | 
			
		||||
            dsIndex: dsIndex
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
	createTooltip(marker, dsIndex, settings, markerArgs) {
 | 
			
		||||
		var popup = L.popup();
 | 
			
		||||
		popup.setContent('');
 | 
			
		||||
		marker.bindPopup(popup, {autoClose: settings.autocloseTooltip, closeOnClick: false});
 | 
			
		||||
		this.tooltips.push({
 | 
			
		||||
			markerArgs: markerArgs,
 | 
			
		||||
			popup: popup,
 | 
			
		||||
			locationSettings: settings,
 | 
			
		||||
			dsIndex: dsIndex
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    updatePolylineColor(polyline, settings, color) {
 | 
			
		||||
        var style = {
 | 
			
		||||
            color: color,
 | 
			
		||||
            opacity: settings.strokeOpacity,
 | 
			
		||||
            weight: settings.strokeWeight
 | 
			
		||||
        };
 | 
			
		||||
        polyline.setStyle(style);
 | 
			
		||||
    }
 | 
			
		||||
	updatePolylineColor(polyline, settings, color) {
 | 
			
		||||
		var style = {
 | 
			
		||||
			color: color,
 | 
			
		||||
			opacity: settings.strokeOpacity,
 | 
			
		||||
			weight: settings.strokeWeight
 | 
			
		||||
		};
 | 
			
		||||
		polyline.setStyle(style);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    createPolyline(locations, settings) {
 | 
			
		||||
        var polyline = L.polyline(locations,
 | 
			
		||||
            {
 | 
			
		||||
                color: settings.color,
 | 
			
		||||
                opacity: settings.strokeOpacity,
 | 
			
		||||
                weight: settings.strokeWeight
 | 
			
		||||
            }
 | 
			
		||||
        ).addTo(this.map);
 | 
			
		||||
        return polyline;
 | 
			
		||||
    }
 | 
			
		||||
	createPolyline(locations, settings) {
 | 
			
		||||
		var polyline = L.polyline(locations,
 | 
			
		||||
			{
 | 
			
		||||
				color: settings.color,
 | 
			
		||||
				opacity: settings.strokeOpacity,
 | 
			
		||||
				weight: settings.strokeWeight
 | 
			
		||||
			}
 | 
			
		||||
		).addTo(this.map);
 | 
			
		||||
		return polyline;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    removePolyline(polyline) {
 | 
			
		||||
        this.map.removeLayer(polyline);
 | 
			
		||||
    }
 | 
			
		||||
	removePolyline(polyline) {
 | 
			
		||||
		this.map.removeLayer(polyline);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    fitBounds(bounds) {
 | 
			
		||||
        if (bounds.isValid()) {
 | 
			
		||||
            if (this.dontFitMapBounds && this.defaultZoomLevel) {
 | 
			
		||||
                this.map.setZoom(this.defaultZoomLevel, {animate: false});
 | 
			
		||||
                this.map.panTo(bounds.getCenter(), {animate: false});
 | 
			
		||||
            } else {
 | 
			
		||||
                var tbMap = this;
 | 
			
		||||
                this.map.once('zoomend', function() {
 | 
			
		||||
                    if (!tbMap.defaultZoomLevel && tbMap.map.getZoom() > tbMap.minZoomLevel) {
 | 
			
		||||
                        tbMap.map.setZoom(tbMap.minZoomLevel, {animate: false});
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
                this.map.fitBounds(bounds, {padding: [50, 50], animate: false});
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
	createPolygon(latLangs, settings) {
 | 
			
		||||
		let polygon = L.polygon(latLangs, {
 | 
			
		||||
			fill: true,
 | 
			
		||||
			fillColor: settings.polygonColor,
 | 
			
		||||
			color: settings.polygonStrokeColor,
 | 
			
		||||
			weight: settings.polygonStrokeWeight,
 | 
			
		||||
			fillOpacity: settings.polygonOpacity,
 | 
			
		||||
			opacity: settings.polygonStrokeOpacity
 | 
			
		||||
		}).addTo(this.map);
 | 
			
		||||
		return polygon;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    createLatLng(lat, lng) {
 | 
			
		||||
        return L.latLng(lat, lng);
 | 
			
		||||
    }
 | 
			
		||||
	removePolygon(polygon) {
 | 
			
		||||
		this.map.removeLayer(polygon);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    extendBoundsWithMarker(bounds, marker) {
 | 
			
		||||
        bounds.extend(marker.getLatLng());
 | 
			
		||||
    }
 | 
			
		||||
	updatePolygonColor(polygon, settings, color) {
 | 
			
		||||
		let style = {
 | 
			
		||||
			fill: true,
 | 
			
		||||
			fillColor: color,
 | 
			
		||||
			color: color,
 | 
			
		||||
			weight: settings.polygonStrokeWeight,
 | 
			
		||||
			fillOpacity: settings.polygonOpacity,
 | 
			
		||||
			opacity: settings.polygonStrokeOpacity
 | 
			
		||||
		};
 | 
			
		||||
		polygon.setStyle(style);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    getMarkerPosition(marker) {
 | 
			
		||||
        return marker.getLatLng();
 | 
			
		||||
    }
 | 
			
		||||
	getPolygonLatLngs(polygon) {
 | 
			
		||||
		return polygon.getLatLngs();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    setMarkerPosition(marker, latLng) {
 | 
			
		||||
        marker.setLatLng(latLng);
 | 
			
		||||
    }
 | 
			
		||||
	setPolygonLatLngs(polygon, latLngs) {
 | 
			
		||||
		polygon.setLatLngs(latLngs);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    getPolylineLatLngs(polyline) {
 | 
			
		||||
        return polyline.getLatLngs();
 | 
			
		||||
    }
 | 
			
		||||
	fitBounds(bounds) {
 | 
			
		||||
		if (bounds.isValid()) {
 | 
			
		||||
			if (this.dontFitMapBounds && this.defaultZoomLevel) {
 | 
			
		||||
				this.map.setZoom(this.defaultZoomLevel, {animate: false});
 | 
			
		||||
				this.map.panTo(bounds.getCenter(), {animate: false});
 | 
			
		||||
			} else {
 | 
			
		||||
				var tbMap = this;
 | 
			
		||||
				this.map.once('zoomend', function () {
 | 
			
		||||
					if (!tbMap.defaultZoomLevel && tbMap.map.getZoom() > tbMap.minZoomLevel) {
 | 
			
		||||
						tbMap.map.setZoom(tbMap.minZoomLevel, {animate: false});
 | 
			
		||||
					}
 | 
			
		||||
				});
 | 
			
		||||
				this.map.fitBounds(bounds, {padding: [50, 50], animate: false});
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    setPolylineLatLngs(polyline, latLngs) {
 | 
			
		||||
        polyline.setLatLngs(latLngs);
 | 
			
		||||
    }
 | 
			
		||||
	createLatLng(lat, lng) {
 | 
			
		||||
		return L.latLng(lat, lng);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    createBounds() {
 | 
			
		||||
        return L.latLngBounds();
 | 
			
		||||
    }
 | 
			
		||||
	extendBoundsWithMarker(bounds, marker) {
 | 
			
		||||
		bounds.extend(marker.getLatLng());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    extendBounds(bounds, polyline) {
 | 
			
		||||
        if (polyline && polyline.getLatLngs()) {
 | 
			
		||||
            bounds.extend(polyline.getBounds());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
	getMarkerPosition(marker) {
 | 
			
		||||
		return marker.getLatLng();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    invalidateSize() {
 | 
			
		||||
        this.map.invalidateSize(true);
 | 
			
		||||
    }
 | 
			
		||||
	setMarkerPosition(marker, latLng) {
 | 
			
		||||
		marker.setLatLng(latLng);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    getTooltips() {
 | 
			
		||||
        return this.tooltips;
 | 
			
		||||
    }
 | 
			
		||||
	getPolylineLatLngs(polyline) {
 | 
			
		||||
		return polyline.getLatLngs();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	setPolylineLatLngs(polyline, latLngs) {
 | 
			
		||||
		polyline.setLatLngs(latLngs);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	createBounds() {
 | 
			
		||||
		return L.latLngBounds();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	extendBounds(bounds, polyline) {
 | 
			
		||||
		if (polyline && polyline.getLatLngs()) {
 | 
			
		||||
			bounds.extend(polyline.getBounds());
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	invalidateSize() {
 | 
			
		||||
		this.map.invalidateSize(true);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	getTooltips() {
 | 
			
		||||
		return this.tooltips;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -14,377 +14,425 @@
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
var tmGlobals = {
 | 
			
		||||
    loadingTmId: null,
 | 
			
		||||
    tmApiKeys: {}
 | 
			
		||||
	loadingTmId: null,
 | 
			
		||||
	tmApiKeys: {}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default class TbTencentMap {
 | 
			
		||||
    constructor($containerElement,utils, initCallback, defaultZoomLevel, dontFitMapBounds, minZoomLevel, tmApiKey, tmDefaultMapType) {
 | 
			
		||||
        var tbMap = this;
 | 
			
		||||
        this.utils = utils;
 | 
			
		||||
        this.defaultZoomLevel = defaultZoomLevel;
 | 
			
		||||
        this.dontFitMapBounds = dontFitMapBounds;
 | 
			
		||||
        this.minZoomLevel = minZoomLevel;
 | 
			
		||||
        this.tooltips = [];
 | 
			
		||||
        this.defaultMapType = tmDefaultMapType;
 | 
			
		||||
	constructor($containerElement, utils, initCallback, defaultZoomLevel, dontFitMapBounds, minZoomLevel, tmApiKey, tmDefaultMapType) {
 | 
			
		||||
		var tbMap = this;
 | 
			
		||||
		this.utils = utils;
 | 
			
		||||
		this.defaultZoomLevel = defaultZoomLevel;
 | 
			
		||||
		this.dontFitMapBounds = dontFitMapBounds;
 | 
			
		||||
		this.minZoomLevel = minZoomLevel;
 | 
			
		||||
		this.tooltips = [];
 | 
			
		||||
		this.defaultMapType = tmDefaultMapType;
 | 
			
		||||
 | 
			
		||||
        function clearGlobalId() {
 | 
			
		||||
            if (tmGlobals.loadingTmId && tmGlobals.loadingTmId === tbMap.mapId) {
 | 
			
		||||
                tmGlobals.loadingTmId = null;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
		function clearGlobalId() {
 | 
			
		||||
			if (tmGlobals.loadingTmId && tmGlobals.loadingTmId === tbMap.mapId) {
 | 
			
		||||
				tmGlobals.loadingTmId = null;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
        function displayError(message) {
 | 
			
		||||
            $containerElement.html( // eslint-disable-line angular/angularelement
 | 
			
		||||
                "<div class='error'>"+ message + "</div>"
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
		function displayError(message) {
 | 
			
		||||
			$containerElement.html( // eslint-disable-line angular/angularelement
 | 
			
		||||
				"<div class='error'>" + message + "</div>"
 | 
			
		||||
			);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
        function initTencentMap() {
 | 
			
		||||
            tbMap.map = new qq.maps.Map($containerElement[0], { // eslint-disable-line no-undef
 | 
			
		||||
                scrollwheel: true,
 | 
			
		||||
                mapTypeId: getTencentMapTypeId(tbMap.defaultMapType),
 | 
			
		||||
                zoom: tbMap.defaultZoomLevel || 8
 | 
			
		||||
            });
 | 
			
		||||
		function initTencentMap() {
 | 
			
		||||
			tbMap.map = new qq.maps.Map($containerElement[0], { // eslint-disable-line no-undef
 | 
			
		||||
				scrollwheel: true,
 | 
			
		||||
				mapTypeId: getTencentMapTypeId(tbMap.defaultMapType),
 | 
			
		||||
				zoom: tbMap.defaultZoomLevel || 8
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
            if (initCallback) {
 | 
			
		||||
                initCallback();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
			if (initCallback) {
 | 
			
		||||
				initCallback();
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
        /* eslint-disable no-undef */
 | 
			
		||||
		/* eslint-disable no-undef */
 | 
			
		||||
 | 
			
		||||
        function getTencentMapTypeId(mapType) {
 | 
			
		||||
            var mapTypeId =qq.maps.MapTypeId.ROADMAP;
 | 
			
		||||
            if (mapType) {
 | 
			
		||||
                if (mapType === 'hybrid') {
 | 
			
		||||
                   mapTypeId = qq.maps.MapTypeId.HYBRID;
 | 
			
		||||
                } else if (mapType === 'satellite') {
 | 
			
		||||
                   mapTypeId = qq.maps.MapTypeId.SATELLITE;
 | 
			
		||||
                } else if (mapType === 'terrain') {
 | 
			
		||||
                   mapTypeId = qq.maps.MapTypeId.ROADMAP;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return mapTypeId;
 | 
			
		||||
        }
 | 
			
		||||
		function getTencentMapTypeId(mapType) {
 | 
			
		||||
			var mapTypeId = qq.maps.MapTypeId.ROADMAP;
 | 
			
		||||
			if (mapType) {
 | 
			
		||||
				if (mapType === 'hybrid') {
 | 
			
		||||
					mapTypeId = qq.maps.MapTypeId.HYBRID;
 | 
			
		||||
				} else if (mapType === 'satellite') {
 | 
			
		||||
					mapTypeId = qq.maps.MapTypeId.SATELLITE;
 | 
			
		||||
				} else if (mapType === 'terrain') {
 | 
			
		||||
					mapTypeId = qq.maps.MapTypeId.ROADMAP;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			return mapTypeId;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
        /* eslint-enable no-undef */
 | 
			
		||||
		/* eslint-enable no-undef */
 | 
			
		||||
 | 
			
		||||
        this.mapId = '' + Math.random().toString(36).substr(2, 9);
 | 
			
		||||
        this.apiKey = tmApiKey || '84d6d83e0e51e481e50454ccbe8986b';
 | 
			
		||||
		this.mapId = '' + Math.random().toString(36).substr(2, 9);
 | 
			
		||||
		this.apiKey = tmApiKey || '84d6d83e0e51e481e50454ccbe8986b';
 | 
			
		||||
 | 
			
		||||
        window.tm_authFailure = function() { // eslint-disable-line no-undef, angular/window-service
 | 
			
		||||
            if (tmGlobals.loadingTmId && tmGlobals.loadingTmId === tbMap.mapId) {
 | 
			
		||||
                tmGlobals.loadingTmId = null;
 | 
			
		||||
                tmGlobals.tmApiKeys[tbMap.apiKey].error = 'Unable to authentificate for tencent Map API.</br>Please check your API key.';
 | 
			
		||||
                displayError(tmGlobals.tmApiKeys[tbMap.apiKey].error);
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
		window.tm_authFailure = function () { // eslint-disable-line no-undef, angular/window-service
 | 
			
		||||
			if (tmGlobals.loadingTmId && tmGlobals.loadingTmId === tbMap.mapId) {
 | 
			
		||||
				tmGlobals.loadingTmId = null;
 | 
			
		||||
				tmGlobals.tmApiKeys[tbMap.apiKey].error = 'Unable to authentificate for tencent Map API.</br>Please check your API key.';
 | 
			
		||||
				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
 | 
			
		||||
            tmGlobals.tmApiKeys[tbMap.apiKey].loaded = true;
 | 
			
		||||
            initTencentMap();
 | 
			
		||||
            for (var p = 0; p < tmGlobals.tmApiKeys[tbMap.apiKey].pendingInits.length; p++) {
 | 
			
		||||
                var pendingInit = tmGlobals.tmApiKeys[tbMap.apiKey].pendingInits[p];
 | 
			
		||||
                pendingInit();
 | 
			
		||||
            }
 | 
			
		||||
            tmGlobals.tmApiKeys[tbMap.apiKey].pendingInits = [];
 | 
			
		||||
        };
 | 
			
		||||
        if (this.apiKey && this.apiKey.length > 0) {
 | 
			
		||||
            if (tmGlobals.tmApiKeys[this.apiKey]) {
 | 
			
		||||
                if (tmGlobals.tmApiKeys[this.apiKey].error) {
 | 
			
		||||
                    displayError(tmGlobals.tmApiKeys[this.apiKey].error);
 | 
			
		||||
                } else if (tmGlobals.tmApiKeys[this.apiKey].loaded) {
 | 
			
		||||
                    initTencentMap();
 | 
			
		||||
                } else {
 | 
			
		||||
                    tmGlobals.tmApiKeys[this.apiKey].pendingInits.push(initTencentMap);
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                tmGlobals.tmApiKeys[this.apiKey] = {
 | 
			
		||||
                    loaded: false,
 | 
			
		||||
                    pendingInits: []
 | 
			
		||||
                };
 | 
			
		||||
                var tencentMapScriptRes = 'https://map.qq.com/api/js?v=2.exp&key='+this.apiKey+'&callback='+this.initMapFunctionName;
 | 
			
		||||
		window[this.initMapFunctionName] = function () { // eslint-disable-line no-undef, angular/window-service
 | 
			
		||||
			tmGlobals.tmApiKeys[tbMap.apiKey].loaded = true;
 | 
			
		||||
			initTencentMap();
 | 
			
		||||
			for (var p = 0; p < tmGlobals.tmApiKeys[tbMap.apiKey].pendingInits.length; p++) {
 | 
			
		||||
				var pendingInit = tmGlobals.tmApiKeys[tbMap.apiKey].pendingInits[p];
 | 
			
		||||
				pendingInit();
 | 
			
		||||
			}
 | 
			
		||||
			tmGlobals.tmApiKeys[tbMap.apiKey].pendingInits = [];
 | 
			
		||||
		};
 | 
			
		||||
		if (this.apiKey && this.apiKey.length > 0) {
 | 
			
		||||
			if (tmGlobals.tmApiKeys[this.apiKey]) {
 | 
			
		||||
				if (tmGlobals.tmApiKeys[this.apiKey].error) {
 | 
			
		||||
					displayError(tmGlobals.tmApiKeys[this.apiKey].error);
 | 
			
		||||
				} else if (tmGlobals.tmApiKeys[this.apiKey].loaded) {
 | 
			
		||||
					initTencentMap();
 | 
			
		||||
				} else {
 | 
			
		||||
					tmGlobals.tmApiKeys[this.apiKey].pendingInits.push(initTencentMap);
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				tmGlobals.tmApiKeys[this.apiKey] = {
 | 
			
		||||
					loaded: false,
 | 
			
		||||
					pendingInits: []
 | 
			
		||||
				};
 | 
			
		||||
				var tencentMapScriptRes = 'https://map.qq.com/api/js?v=2.exp&key=' + this.apiKey + '&callback=' + this.initMapFunctionName;
 | 
			
		||||
 | 
			
		||||
                tmGlobals.loadingTmId = this.mapId;
 | 
			
		||||
                lazyLoad.load({ type: 'js', path: tencentMapScriptRes }).then( // eslint-disable-line no-undef
 | 
			
		||||
                    function success() {
 | 
			
		||||
                        setTimeout(clearGlobalId, 2000); // eslint-disable-line no-undef, angular/timeout-service
 | 
			
		||||
                    },
 | 
			
		||||
                    function fail(e) {
 | 
			
		||||
                        clearGlobalId();
 | 
			
		||||
                        tmGlobals.tmApiKeys[tbMap.apiKey].error = 'tencent map api load failed!</br>'+e;
 | 
			
		||||
                        displayError(tmGlobals.tmApiKeys[tbMap.apiKey].error);
 | 
			
		||||
                    }
 | 
			
		||||
                );
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            displayError('No tencent Map Api Key provided!');
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
				tmGlobals.loadingTmId = this.mapId;
 | 
			
		||||
				lazyLoad.load({type: 'js', path: tencentMapScriptRes}).then( // eslint-disable-line no-undef
 | 
			
		||||
					function success() {
 | 
			
		||||
						setTimeout(clearGlobalId, 2000); // eslint-disable-line no-undef, angular/timeout-service
 | 
			
		||||
					},
 | 
			
		||||
					function fail(e) {
 | 
			
		||||
						clearGlobalId();
 | 
			
		||||
						tmGlobals.tmApiKeys[tbMap.apiKey].error = 'tencent map api load failed!</br>' + e;
 | 
			
		||||
						displayError(tmGlobals.tmApiKeys[tbMap.apiKey].error);
 | 
			
		||||
					}
 | 
			
		||||
				);
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			displayError('No tencent Map Api Key provided!');
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    inited() {
 | 
			
		||||
        return angular.isDefined(this.map);
 | 
			
		||||
    }
 | 
			
		||||
	inited() {
 | 
			
		||||
		return angular.isDefined(this.map);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    createMarkerLabelStyle(settings) {
 | 
			
		||||
        return {
 | 
			
		||||
            width: "200px",
 | 
			
		||||
            textAlign: "center",
 | 
			
		||||
            color: settings.labelColor,
 | 
			
		||||
            background: "none",
 | 
			
		||||
            border: "none",
 | 
			
		||||
            fontSize: "12px",
 | 
			
		||||
            fontFamily: "\"Helvetica Neue\", Arial, Helvetica, sans-serif",
 | 
			
		||||
            fontWeight: "bold"
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
	createMarkerLabelStyle(settings) {
 | 
			
		||||
		return {
 | 
			
		||||
			width: "200px",
 | 
			
		||||
			textAlign: "center",
 | 
			
		||||
			color: settings.labelColor,
 | 
			
		||||
			background: "none",
 | 
			
		||||
			border: "none",
 | 
			
		||||
			fontSize: "12px",
 | 
			
		||||
			fontFamily: "\"Helvetica Neue\", Arial, Helvetica, sans-serif",
 | 
			
		||||
			fontWeight: "bold"
 | 
			
		||||
		};
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    /* eslint-disable no-undef,no-unused-vars*/
 | 
			
		||||
    updateMarkerLabel(marker, settings) {
 | 
			
		||||
        if (marker.label) {
 | 
			
		||||
            marker.label.setContent(settings.labelText);
 | 
			
		||||
            marker.label.setStyle(this.createMarkerLabelStyle(settings));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    /* eslint-enable no-undef,no-unused-vars */
 | 
			
		||||
	/* eslint-disable no-undef,no-unused-vars*/
 | 
			
		||||
	updateMarkerLabel(marker, settings) {
 | 
			
		||||
		if (marker.label) {
 | 
			
		||||
			marker.label.setContent(settings.labelText);
 | 
			
		||||
			marker.label.setStyle(this.createMarkerLabelStyle(settings));
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    /* eslint-disable no-undef,no-unused-vars */
 | 
			
		||||
    updateMarkerColor(marker, color) {
 | 
			
		||||
        this.createDefaultMarkerIcon(marker, color, (iconInfo) => {
 | 
			
		||||
            marker.setIcon(iconInfo.icon);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    /* eslint-enable no-undef,,no-unused-vars */
 | 
			
		||||
	/* eslint-enable no-undef,no-unused-vars */
 | 
			
		||||
 | 
			
		||||
    /* eslint-disable no-undef */
 | 
			
		||||
    updateMarkerIcon(marker, settings) {
 | 
			
		||||
        this.createMarkerIcon(marker, settings, (iconInfo) => {
 | 
			
		||||
            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,no-unused-vars */
 | 
			
		||||
	updateMarkerColor(marker, color) {
 | 
			
		||||
		this.createDefaultMarkerIcon(marker, color, (iconInfo) => {
 | 
			
		||||
			marker.setIcon(iconInfo.icon);
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    /* eslint-disable no-undef */
 | 
			
		||||
    createMarkerIcon(marker, settings, onMarkerIconReady) {
 | 
			
		||||
        var currentImage = settings.currentImage;
 | 
			
		||||
        var tMap = this;
 | 
			
		||||
        if (currentImage && currentImage.url) {
 | 
			
		||||
            this.utils.loadImageAspect(currentImage.url).then(
 | 
			
		||||
                (aspect) => {
 | 
			
		||||
                    if (aspect) {
 | 
			
		||||
                        var width;
 | 
			
		||||
                        var height;
 | 
			
		||||
                        if (aspect > 1) {
 | 
			
		||||
                            width = currentImage.size;
 | 
			
		||||
                            height = currentImage.size / aspect;
 | 
			
		||||
                        } else {
 | 
			
		||||
                            width = currentImage.size * aspect;
 | 
			
		||||
                            height = currentImage.size;
 | 
			
		||||
                        }
 | 
			
		||||
                        var icon = new qq.maps.MarkerImage(currentImage.url,
 | 
			
		||||
                            new qq.maps.Size(width, height),
 | 
			
		||||
                            new qq.maps.Point(0,0),
 | 
			
		||||
                            new qq.maps.Point(width/2, height),
 | 
			
		||||
                            new qq.maps.Size(width, height));
 | 
			
		||||
                        var iconInfo = {
 | 
			
		||||
                            size: [width, height],
 | 
			
		||||
                            icon: icon
 | 
			
		||||
                        };
 | 
			
		||||
                        onMarkerIconReady(iconInfo);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        tMap.createDefaultMarkerIcon(marker, settings.color, onMarkerIconReady);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            );
 | 
			
		||||
        } else {
 | 
			
		||||
            this.createDefaultMarkerIcon(marker, settings.color, onMarkerIconReady);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    /* eslint-enable no-undef */
 | 
			
		||||
	/* eslint-enable no-undef,,no-unused-vars */
 | 
			
		||||
 | 
			
		||||
    /* eslint-disable no-undef */
 | 
			
		||||
    createDefaultMarkerIcon(marker, color, onMarkerIconReady) {
 | 
			
		||||
        var pinColor = color.substr(1);
 | 
			
		||||
        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),
 | 
			
		||||
            new qq.maps.Point(0,0),
 | 
			
		||||
            new qq.maps.Point(10, 37));
 | 
			
		||||
        var iconInfo = {
 | 
			
		||||
            size: [40, 37],
 | 
			
		||||
            icon: icon
 | 
			
		||||
        };
 | 
			
		||||
        onMarkerIconReady(iconInfo);
 | 
			
		||||
    }
 | 
			
		||||
    /* eslint-enable no-undef */
 | 
			
		||||
	/* eslint-disable no-undef */
 | 
			
		||||
	updateMarkerIcon(marker, settings) {
 | 
			
		||||
		this.createMarkerIcon(marker, settings, (iconInfo) => {
 | 
			
		||||
			marker.setIcon(iconInfo.icon);
 | 
			
		||||
			if (marker.label) {
 | 
			
		||||
				marker.label.setOffset(new qq.maps.Size(-100, -iconInfo.size[1] - 20));
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    /* eslint-disable no-undef */
 | 
			
		||||
    createMarker(location, dsIndex, settings, onClickListener, markerArgs) {
 | 
			
		||||
        var marker = new qq.maps.Marker({
 | 
			
		||||
            position: location
 | 
			
		||||
        });
 | 
			
		||||
        var tMap = this;
 | 
			
		||||
        this.createMarkerIcon(marker, settings, (iconInfo) => {
 | 
			
		||||
            marker.setIcon(iconInfo.icon);
 | 
			
		||||
            marker.setMap(tMap.map);
 | 
			
		||||
            if (settings.showLabel) {
 | 
			
		||||
                marker.label = new qq.maps.Label({
 | 
			
		||||
                    clickable: false,
 | 
			
		||||
                    content: settings.labelText,
 | 
			
		||||
                    offset: new qq.maps.Size(-100, -iconInfo.size[1]-20),
 | 
			
		||||
                    style: tMap.createMarkerLabelStyle(settings),
 | 
			
		||||
                    visible: true,
 | 
			
		||||
                    position: location,
 | 
			
		||||
                    map: tMap.map,
 | 
			
		||||
                    zIndex: 1000
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
	/* eslint-disable no-undef */
 | 
			
		||||
 | 
			
		||||
        if (settings.displayTooltip) {
 | 
			
		||||
            this.createTooltip(marker, dsIndex, settings, markerArgs);
 | 
			
		||||
        }
 | 
			
		||||
	/* eslint-disable no-undef */
 | 
			
		||||
	createMarkerIcon(marker, settings, onMarkerIconReady) {
 | 
			
		||||
		var currentImage = settings.currentImage;
 | 
			
		||||
		var tMap = this;
 | 
			
		||||
		if (currentImage && currentImage.url) {
 | 
			
		||||
			this.utils.loadImageAspect(currentImage.url).then(
 | 
			
		||||
				(aspect) => {
 | 
			
		||||
					if (aspect) {
 | 
			
		||||
						var width;
 | 
			
		||||
						var height;
 | 
			
		||||
						if (aspect > 1) {
 | 
			
		||||
							width = currentImage.size;
 | 
			
		||||
							height = currentImage.size / aspect;
 | 
			
		||||
						} else {
 | 
			
		||||
							width = currentImage.size * aspect;
 | 
			
		||||
							height = currentImage.size;
 | 
			
		||||
						}
 | 
			
		||||
						var icon = new qq.maps.MarkerImage(currentImage.url,
 | 
			
		||||
							new qq.maps.Size(width, height),
 | 
			
		||||
							new qq.maps.Point(0, 0),
 | 
			
		||||
							new qq.maps.Point(width / 2, height),
 | 
			
		||||
							new qq.maps.Size(width, height));
 | 
			
		||||
						var iconInfo = {
 | 
			
		||||
							size: [width, height],
 | 
			
		||||
							icon: icon
 | 
			
		||||
						};
 | 
			
		||||
						onMarkerIconReady(iconInfo);
 | 
			
		||||
					} else {
 | 
			
		||||
						tMap.createDefaultMarkerIcon(marker, settings.color, onMarkerIconReady);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			);
 | 
			
		||||
		} else {
 | 
			
		||||
			this.createDefaultMarkerIcon(marker, settings.color, onMarkerIconReady);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
        if (onClickListener) {
 | 
			
		||||
            qq.maps.event.addListener(marker, 'click', onClickListener);
 | 
			
		||||
        }
 | 
			
		||||
	/* eslint-enable no-undef */
 | 
			
		||||
 | 
			
		||||
        return marker;
 | 
			
		||||
    }
 | 
			
		||||
	/* eslint-disable no-undef */
 | 
			
		||||
	createDefaultMarkerIcon(marker, color, onMarkerIconReady) {
 | 
			
		||||
		var pinColor = color.substr(1);
 | 
			
		||||
		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),
 | 
			
		||||
			new qq.maps.Point(0, 0),
 | 
			
		||||
			new qq.maps.Point(10, 37));
 | 
			
		||||
		var iconInfo = {
 | 
			
		||||
			size: [40, 37],
 | 
			
		||||
			icon: icon
 | 
			
		||||
		};
 | 
			
		||||
		onMarkerIconReady(iconInfo);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    /* eslint-disable no-undef */
 | 
			
		||||
    removeMarker(marker) {
 | 
			
		||||
        marker.setMap(null);
 | 
			
		||||
        if (marker.label) {
 | 
			
		||||
            marker.label.setMap(null);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
	/* eslint-enable no-undef */
 | 
			
		||||
 | 
			
		||||
    /* eslint-enable no-undef */
 | 
			
		||||
	/* eslint-disable no-undef */
 | 
			
		||||
	createMarker(location, dsIndex, settings, onClickListener, markerArgs) {
 | 
			
		||||
		var marker = new qq.maps.Marker({
 | 
			
		||||
			position: location
 | 
			
		||||
		});
 | 
			
		||||
		var tMap = this;
 | 
			
		||||
		this.createMarkerIcon(marker, settings, (iconInfo) => {
 | 
			
		||||
			marker.setIcon(iconInfo.icon);
 | 
			
		||||
			marker.setMap(tMap.map);
 | 
			
		||||
			if (settings.showLabel) {
 | 
			
		||||
				marker.label = new qq.maps.Label({
 | 
			
		||||
					clickable: false,
 | 
			
		||||
					content: settings.labelText,
 | 
			
		||||
					offset: new qq.maps.Size(-100, -iconInfo.size[1] - 20),
 | 
			
		||||
					style: tMap.createMarkerLabelStyle(settings),
 | 
			
		||||
					visible: true,
 | 
			
		||||
					position: location,
 | 
			
		||||
					map: tMap.map,
 | 
			
		||||
					zIndex: 1000
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
    /* eslint-disable no-undef */
 | 
			
		||||
    createTooltip(marker, dsIndex, settings, markerArgs) {
 | 
			
		||||
        var popup = new qq.maps.InfoWindow({
 | 
			
		||||
            map :this.map
 | 
			
		||||
        });
 | 
			
		||||
        var map = this;
 | 
			
		||||
        qq.maps.event.addListener(marker, 'click', function() {
 | 
			
		||||
            if (settings.autocloseTooltip) {
 | 
			
		||||
                map.tooltips.forEach((tooltip) => {
 | 
			
		||||
                    tooltip.popup.close();
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
            popup.open();
 | 
			
		||||
            popup.setPosition(marker);
 | 
			
		||||
        });
 | 
			
		||||
        this.tooltips.push( {
 | 
			
		||||
            markerArgs: markerArgs,
 | 
			
		||||
            popup: popup,
 | 
			
		||||
            locationSettings: settings,
 | 
			
		||||
            dsIndex: dsIndex
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    /* eslint-enable no-undef */
 | 
			
		||||
		if (settings.displayTooltip) {
 | 
			
		||||
			this.createTooltip(marker, dsIndex, settings, markerArgs);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
    /* eslint-disable no-undef */
 | 
			
		||||
    updatePolylineColor(polyline, settings, color) {
 | 
			
		||||
        var options = {
 | 
			
		||||
            path: polyline.getPath(),
 | 
			
		||||
            strokeColor: color,
 | 
			
		||||
            strokeOpacity: settings.strokeOpacity,
 | 
			
		||||
            strokeWeight: settings.strokeWeight,
 | 
			
		||||
            map: this.map
 | 
			
		||||
        };
 | 
			
		||||
        polyline.setOptions(options);
 | 
			
		||||
    }
 | 
			
		||||
    /* eslint-enable no-undef */
 | 
			
		||||
		if (onClickListener) {
 | 
			
		||||
			qq.maps.event.addListener(marker, 'click', onClickListener);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
    /* eslint-disable no-undef */
 | 
			
		||||
    createPolyline(locations, settings) {
 | 
			
		||||
        var polyline = new qq.maps.Polyline({
 | 
			
		||||
            path: locations,
 | 
			
		||||
            strokeColor: settings.color,
 | 
			
		||||
            strokeOpacity: settings.strokeOpacity,
 | 
			
		||||
            strokeWeight: settings.strokeWeight,
 | 
			
		||||
            map: this.map
 | 
			
		||||
        });
 | 
			
		||||
		return marker;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
        return polyline;
 | 
			
		||||
    }
 | 
			
		||||
    /* eslint-enable no-undef */
 | 
			
		||||
	/* eslint-disable no-undef */
 | 
			
		||||
	removeMarker(marker) {
 | 
			
		||||
		marker.setMap(null);
 | 
			
		||||
		if (marker.label) {
 | 
			
		||||
			marker.label.setMap(null);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    removePolyline(polyline) {
 | 
			
		||||
        polyline.setMap(null);
 | 
			
		||||
    }
 | 
			
		||||
	/* eslint-enable no-undef */
 | 
			
		||||
 | 
			
		||||
    /* eslint-disable no-undef ,no-unused-vars*/
 | 
			
		||||
    fitBounds(bounds) {
 | 
			
		||||
        if (this.dontFitMapBounds && this.defaultZoomLevel) {
 | 
			
		||||
            this.map.setZoom(this.defaultZoomLevel);
 | 
			
		||||
            this.map.setCenter(bounds.getCenter());
 | 
			
		||||
        } 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);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
            this.map.fitBounds(bounds);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    /* eslint-enable no-undef,no-unused-vars */
 | 
			
		||||
	/* eslint-disable no-undef */
 | 
			
		||||
	createTooltip(marker, dsIndex, settings, markerArgs) {
 | 
			
		||||
		var popup = new qq.maps.InfoWindow({
 | 
			
		||||
			map: this.map
 | 
			
		||||
		});
 | 
			
		||||
		var map = this;
 | 
			
		||||
		qq.maps.event.addListener(marker, 'click', function () {
 | 
			
		||||
			if (settings.autocloseTooltip) {
 | 
			
		||||
				map.tooltips.forEach((tooltip) => {
 | 
			
		||||
					tooltip.popup.close();
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
			popup.open();
 | 
			
		||||
			popup.setPosition(marker);
 | 
			
		||||
		});
 | 
			
		||||
		this.tooltips.push({
 | 
			
		||||
			markerArgs: markerArgs,
 | 
			
		||||
			popup: popup,
 | 
			
		||||
			locationSettings: settings,
 | 
			
		||||
			dsIndex: dsIndex
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    createLatLng(lat, lng) {
 | 
			
		||||
        return new qq.maps.LatLng(lat, lng); // eslint-disable-line no-undef
 | 
			
		||||
    }
 | 
			
		||||
	/* eslint-enable no-undef */
 | 
			
		||||
 | 
			
		||||
    extendBoundsWithMarker(bounds, marker) {
 | 
			
		||||
        bounds.extend(marker.getPosition());
 | 
			
		||||
    }
 | 
			
		||||
	/* eslint-disable no-undef */
 | 
			
		||||
	updatePolylineColor(polyline, settings, color) {
 | 
			
		||||
		var options = {
 | 
			
		||||
			path: polyline.getPath(),
 | 
			
		||||
			strokeColor: color,
 | 
			
		||||
			strokeOpacity: settings.strokeOpacity,
 | 
			
		||||
			strokeWeight: settings.strokeWeight,
 | 
			
		||||
			map: this.map
 | 
			
		||||
		};
 | 
			
		||||
		polyline.setOptions(options);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    getMarkerPosition(marker) {
 | 
			
		||||
        return marker.getPosition();
 | 
			
		||||
    }
 | 
			
		||||
	/* eslint-enable no-undef */
 | 
			
		||||
 | 
			
		||||
    setMarkerPosition(marker, latLng) {
 | 
			
		||||
        marker.setPosition(latLng);
 | 
			
		||||
        if (marker.label) {
 | 
			
		||||
            marker.label.setPosition(latLng);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
	/* eslint-disable no-undef */
 | 
			
		||||
	createPolyline(locations, settings) {
 | 
			
		||||
		var polyline = new qq.maps.Polyline({
 | 
			
		||||
			path: locations,
 | 
			
		||||
			strokeColor: settings.color,
 | 
			
		||||
			strokeOpacity: settings.strokeOpacity,
 | 
			
		||||
			strokeWeight: settings.strokeWeight,
 | 
			
		||||
			map: this.map
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
    getPolylineLatLngs(polyline) {
 | 
			
		||||
        return polyline.getPath().getArray();
 | 
			
		||||
    }
 | 
			
		||||
		return polyline;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    setPolylineLatLngs(polyline, latLngs) {
 | 
			
		||||
        polyline.setPath(latLngs);
 | 
			
		||||
    }
 | 
			
		||||
	/* eslint-enable no-undef */
 | 
			
		||||
 | 
			
		||||
    createBounds() {
 | 
			
		||||
        return new qq.maps.LatLngBounds(); // eslint-disable-line no-undef
 | 
			
		||||
    }
 | 
			
		||||
	removePolyline(polyline) {
 | 
			
		||||
		polyline.setMap(null);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    extendBounds(bounds, polyline) {
 | 
			
		||||
        if (polyline && polyline.getPath()) {
 | 
			
		||||
            var locations = polyline.getPath();
 | 
			
		||||
            for (var i = 0; i < locations.getLength(); i++) {
 | 
			
		||||
                bounds.extend(locations.getAt(i));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
	/* eslint-disable no-undef */
 | 
			
		||||
	createPolygon(latLangs, settings) {
 | 
			
		||||
		let polygon = new qq.maps.Polygon({
 | 
			
		||||
			map: this.map,
 | 
			
		||||
			path: latLangs,
 | 
			
		||||
			strokeColor: settings.polygonStrokeColor,
 | 
			
		||||
			fillColor: settings.polygonColor,
 | 
			
		||||
			strokeWeight: settings.polygonStrokeWeight
 | 
			
		||||
		});
 | 
			
		||||
		return polygon;
 | 
			
		||||
	}
 | 
			
		||||
	/* eslint-disable no-undef */
 | 
			
		||||
 | 
			
		||||
    invalidateSize() {
 | 
			
		||||
        qq.maps.event.trigger(this.map, "resize"); // eslint-disable-line no-undef
 | 
			
		||||
    }
 | 
			
		||||
	removePolygon (polygon) {
 | 
			
		||||
		polygon.setMap(null);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    getTooltips() {
 | 
			
		||||
        return this.tooltips;
 | 
			
		||||
    }
 | 
			
		||||
	/* eslint-disable no-undef,no-unused-vars */
 | 
			
		||||
	updatePolygonColor (polygon, settings, color) {
 | 
			
		||||
		let options = {
 | 
			
		||||
			path: polygon.getPath(),
 | 
			
		||||
			map: this.map,
 | 
			
		||||
			strokeColor: color,
 | 
			
		||||
			fillColor: color,
 | 
			
		||||
			strokeWeight: settings.polygonStrokeWeight
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	/* eslint-disable no-undef ,no-unused-vars*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	getPolygonLatLngs(polygon) {
 | 
			
		||||
		return polygon.getPath().getArray();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	setPolygonLatLngs(polygon, latLngs) {
 | 
			
		||||
		polygon.setPath(latLngs);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* eslint-disable no-undef ,no-unused-vars*/
 | 
			
		||||
	fitBounds(bounds) {
 | 
			
		||||
		if (this.dontFitMapBounds && this.defaultZoomLevel) {
 | 
			
		||||
			this.map.setZoom(this.defaultZoomLevel);
 | 
			
		||||
			this.map.setCenter(bounds.getCenter());
 | 
			
		||||
		} 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);
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
			this.map.fitBounds(bounds);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* 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;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user