Merge branch 'master' into develop/2.3
This commit is contained in:
commit
a1e8ed8ff4
@ -41,6 +41,10 @@
|
|||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.ruedigermoeller</groupId>
|
||||||
|
<artifactId>fst</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.netty</groupId>
|
<groupId>io.netty</groupId>
|
||||||
<artifactId>netty-transport-native-epoll</artifactId>
|
<artifactId>netty-transport-native-epoll</artifactId>
|
||||||
|
|||||||
@ -17,8 +17,8 @@ package org.thingsboard.server.service.encoding;
|
|||||||
|
|
||||||
import com.google.protobuf.ByteString;
|
import com.google.protobuf.ByteString;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nustaq.serialization.FSTConfiguration;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.SerializationUtils;
|
|
||||||
import org.thingsboard.server.common.msg.TbActorMsg;
|
import org.thingsboard.server.common.msg.TbActorMsg;
|
||||||
import org.thingsboard.server.common.msg.cluster.ServerAddress;
|
import org.thingsboard.server.common.msg.cluster.ServerAddress;
|
||||||
import org.thingsboard.server.gen.cluster.ClusterAPIProtos;
|
import org.thingsboard.server.gen.cluster.ClusterAPIProtos;
|
||||||
@ -30,13 +30,14 @@ import static org.thingsboard.server.gen.cluster.ClusterAPIProtos.MessageType.CL
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class ProtoWithJavaSerializationDecodingEncodingService implements DataDecodingEncodingService {
|
public class ProtoWithFSTService implements DataDecodingEncodingService {
|
||||||
|
|
||||||
|
|
||||||
|
private final FSTConfiguration config = FSTConfiguration.createDefaultConfiguration();
|
||||||
@Override
|
@Override
|
||||||
public Optional<TbActorMsg> decode(byte[] byteArray) {
|
public Optional<TbActorMsg> decode(byte[] byteArray) {
|
||||||
try {
|
try {
|
||||||
TbActorMsg msg = (TbActorMsg) SerializationUtils.deserialize(byteArray);
|
TbActorMsg msg = (TbActorMsg) config.asObject(byteArray);
|
||||||
return Optional.of(msg);
|
return Optional.of(msg);
|
||||||
|
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
@ -47,7 +48,7 @@ public class ProtoWithJavaSerializationDecodingEncodingService implements DataDe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] encode(TbActorMsg msq) {
|
public byte[] encode(TbActorMsg msq) {
|
||||||
return SerializationUtils.serialize(msq);
|
return config.asByteArray(msq);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
6
pom.xml
6
pom.xml
@ -84,6 +84,7 @@
|
|||||||
<delight-nashorn-sandbox.version>0.1.14</delight-nashorn-sandbox.version>
|
<delight-nashorn-sandbox.version>0.1.14</delight-nashorn-sandbox.version>
|
||||||
<kafka.version>2.0.0</kafka.version>
|
<kafka.version>2.0.0</kafka.version>
|
||||||
<bucket4j.version>4.1.1</bucket4j.version>
|
<bucket4j.version>4.1.1</bucket4j.version>
|
||||||
|
<fst.version>2.57</fst.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
@ -789,6 +790,11 @@
|
|||||||
<artifactId>bucket4j-core</artifactId>
|
<artifactId>bucket4j-core</artifactId>
|
||||||
<version>${bucket4j.version}</version>
|
<version>${bucket4j.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.ruedigermoeller</groupId>
|
||||||
|
<artifactId>fst</artifactId>
|
||||||
|
<version>${fst.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.springfox.ui</groupId>
|
<groupId>io.springfox.ui</groupId>
|
||||||
<artifactId>springfox-swagger-ui-rfc6570</artifactId>
|
<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": "Register count",
|
||||||
"modbus-register-count-range": "Register count should be a positive value.",
|
"modbus-register-count-range": "Register count should be a positive value.",
|
||||||
"modbus-byte-order": "Byte order",
|
"modbus-byte-order": "Byte order",
|
||||||
|
|
||||||
"sync": {
|
"sync": {
|
||||||
"status": "Status",
|
"status": "Status",
|
||||||
"sync": "Sync",
|
"sync": "Sync",
|
||||||
@ -1042,7 +1041,6 @@
|
|||||||
"last-sync-time": "Last sync time",
|
"last-sync-time": "Last sync time",
|
||||||
"not-available": "Not available"
|
"not-available": "Not available"
|
||||||
},
|
},
|
||||||
|
|
||||||
"export-extensions-configuration": "Export extensions configuration",
|
"export-extensions-configuration": "Export extensions configuration",
|
||||||
"import-extensions-configuration": "Import extensions configuration",
|
"import-extensions-configuration": "Import extensions configuration",
|
||||||
"import-extensions": "Import extensions",
|
"import-extensions": "Import extensions",
|
||||||
@ -1568,6 +1566,7 @@
|
|||||||
"language": {
|
"language": {
|
||||||
"language": "Language",
|
"language": "Language",
|
||||||
"locales": {
|
"locales": {
|
||||||
|
"de_DE": "German",
|
||||||
"fr_FR": "French",
|
"fr_FR": "French",
|
||||||
"zh_CN": "Chinese",
|
"zh_CN": "Chinese",
|
||||||
"en_US": "English",
|
"en_US": "English",
|
||||||
|
|||||||
@ -1034,7 +1034,6 @@
|
|||||||
"modbus-register-count": "Contador del registro",
|
"modbus-register-count": "Contador del registro",
|
||||||
"modbus-register-count-range": "Contador del registro debe ser un valor positivo.",
|
"modbus-register-count-range": "Contador del registro debe ser un valor positivo.",
|
||||||
"modbus-byte-order": "Orden del byte",
|
"modbus-byte-order": "Orden del byte",
|
||||||
|
|
||||||
"sync": {
|
"sync": {
|
||||||
"status": "Estado",
|
"status": "Estado",
|
||||||
"sync": "Sincronización",
|
"sync": "Sincronización",
|
||||||
@ -1042,7 +1041,6 @@
|
|||||||
"last-sync-time": "Último tiempo de sincroniación",
|
"last-sync-time": "Último tiempo de sincroniación",
|
||||||
"not-available": "No disponible"
|
"not-available": "No disponible"
|
||||||
},
|
},
|
||||||
|
|
||||||
"export-extensions-configuration": "Exportar configuración de extensiones",
|
"export-extensions-configuration": "Exportar configuración de extensiones",
|
||||||
"import-extensions-configuration": "Importar configuración de extensiones",
|
"import-extensions-configuration": "Importar configuración de extensiones",
|
||||||
"import-extensions": "Importar extensiones",
|
"import-extensions": "Importar extensiones",
|
||||||
@ -1568,6 +1566,7 @@
|
|||||||
"language": {
|
"language": {
|
||||||
"language": "Lenguaje",
|
"language": "Lenguaje",
|
||||||
"locales": {
|
"locales": {
|
||||||
|
"de_DE": "Alemán",
|
||||||
"fr_FR": "Francés",
|
"fr_FR": "Francés",
|
||||||
"zh_CN": "Chino",
|
"zh_CN": "Chino",
|
||||||
"en_US": "Inglés",
|
"en_US": "Inglés",
|
||||||
|
|||||||
@ -1003,6 +1003,7 @@
|
|||||||
"language": {
|
"language": {
|
||||||
"language": "Language",
|
"language": "Language",
|
||||||
"locales": {
|
"locales": {
|
||||||
|
"de_DE": "Allemand",
|
||||||
"en_US": "Anglais",
|
"en_US": "Anglais",
|
||||||
"fr_FR": "Français",
|
"fr_FR": "Français",
|
||||||
"es_ES": "Espagnol",
|
"es_ES": "Espagnol",
|
||||||
|
|||||||
@ -910,7 +910,6 @@
|
|||||||
"modbus-register-count": "Register count",
|
"modbus-register-count": "Register count",
|
||||||
"modbus-register-count-range": "Register count should be a positive value.",
|
"modbus-register-count-range": "Register count should be a positive value.",
|
||||||
"modbus-byte-order": "Byte order",
|
"modbus-byte-order": "Byte order",
|
||||||
|
|
||||||
"sync": {
|
"sync": {
|
||||||
"status": "Stato",
|
"status": "Stato",
|
||||||
"sync": "Sincronizzato",
|
"sync": "Sincronizzato",
|
||||||
@ -918,7 +917,6 @@
|
|||||||
"last-sync-time": "Ultima sincronizzazione",
|
"last-sync-time": "Ultima sincronizzazione",
|
||||||
"not-available": "Non disponibile"
|
"not-available": "Non disponibile"
|
||||||
},
|
},
|
||||||
|
|
||||||
"export-extensions-configuration": "Esporta configurazione estensioni",
|
"export-extensions-configuration": "Esporta configurazione estensioni",
|
||||||
"import-extensions-configuration": "Importa configurazione estensioni",
|
"import-extensions-configuration": "Importa configurazione estensioni",
|
||||||
"import-extensions": "Importa estensione",
|
"import-extensions": "Importa estensione",
|
||||||
@ -1434,6 +1432,7 @@
|
|||||||
"language": {
|
"language": {
|
||||||
"language": "Lingua",
|
"language": "Lingua",
|
||||||
"locales": {
|
"locales": {
|
||||||
|
"de_DE": "Tedesco",
|
||||||
"fr_FR": "Francese",
|
"fr_FR": "Francese",
|
||||||
"zh_CN": "Cinese",
|
"zh_CN": "Cinese",
|
||||||
"ko_KR": "Coreano",
|
"ko_KR": "Coreano",
|
||||||
|
|||||||
@ -919,7 +919,6 @@
|
|||||||
"modbus-register-count": "レジスタ数",
|
"modbus-register-count": "レジスタ数",
|
||||||
"modbus-register-count-range": "レジスタ数は正の値でなければなりません。",
|
"modbus-register-count-range": "レジスタ数は正の値でなければなりません。",
|
||||||
"modbus-byte-order": "バイト順",
|
"modbus-byte-order": "バイト順",
|
||||||
|
|
||||||
"sync": {
|
"sync": {
|
||||||
"status": "状態",
|
"status": "状態",
|
||||||
"sync": "同期",
|
"sync": "同期",
|
||||||
@ -927,7 +926,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": "拡張機能のインポート",
|
||||||
@ -1451,6 +1449,7 @@
|
|||||||
"language": {
|
"language": {
|
||||||
"language": "言語",
|
"language": "言語",
|
||||||
"locales": {
|
"locales": {
|
||||||
|
"de_DE": "ドイツ語",
|
||||||
"en_US": "英語",
|
"en_US": "英語",
|
||||||
"ko_KR": "韓国語",
|
"ko_KR": "韓国語",
|
||||||
"it_IT": "イタリアの",
|
"it_IT": "イタリアの",
|
||||||
|
|||||||
@ -85,7 +85,6 @@
|
|||||||
"enable-tls": "TLS 사용",
|
"enable-tls": "TLS 사용",
|
||||||
"send-test-mail": "테스트 메일 보내기"
|
"send-test-mail": "테스트 메일 보내기"
|
||||||
},
|
},
|
||||||
|
|
||||||
"alarm": {
|
"alarm": {
|
||||||
"alarm": "Alarm",
|
"alarm": "Alarm",
|
||||||
"alarms": "Alarms",
|
"alarms": "Alarms",
|
||||||
@ -831,7 +830,6 @@
|
|||||||
"modbus-register-count": "Register count",
|
"modbus-register-count": "Register count",
|
||||||
"modbus-register-count-range": "Register count should be a positive value.",
|
"modbus-register-count-range": "Register count should be a positive value.",
|
||||||
"modbus-byte-order": "Byte order",
|
"modbus-byte-order": "Byte order",
|
||||||
|
|
||||||
"sync": {
|
"sync": {
|
||||||
"status": "Status",
|
"status": "Status",
|
||||||
"sync": "Sync",
|
"sync": "Sync",
|
||||||
@ -839,7 +837,6 @@
|
|||||||
"last-sync-time": "Last sync time",
|
"last-sync-time": "Last sync time",
|
||||||
"not-available": "Not available"
|
"not-available": "Not available"
|
||||||
},
|
},
|
||||||
|
|
||||||
"export-extensions-configuration": "Export extensions configuration",
|
"export-extensions-configuration": "Export extensions configuration",
|
||||||
"import-extensions-configuration": "Import extensions configuration",
|
"import-extensions-configuration": "Import extensions configuration",
|
||||||
"import-extensions": "Import extensions",
|
"import-extensions": "Import extensions",
|
||||||
@ -1328,6 +1325,7 @@
|
|||||||
"language": {
|
"language": {
|
||||||
"language": "언어",
|
"language": "언어",
|
||||||
"locales": {
|
"locales": {
|
||||||
|
"de_DE": "독일어",
|
||||||
"en_US": "영어",
|
"en_US": "영어",
|
||||||
"fr_FR": "프랑스의",
|
"fr_FR": "프랑스의",
|
||||||
"ko_KR": "한글",
|
"ko_KR": "한글",
|
||||||
|
|||||||
@ -1032,7 +1032,6 @@
|
|||||||
"modbus-register-count": "Количество регистров",
|
"modbus-register-count": "Количество регистров",
|
||||||
"modbus-register-count-range": "Количество регистров должно быть больше ноля.",
|
"modbus-register-count-range": "Количество регистров должно быть больше ноля.",
|
||||||
"modbus-byte-order": "Порядок байтов",
|
"modbus-byte-order": "Порядок байтов",
|
||||||
|
|
||||||
"sync": {
|
"sync": {
|
||||||
"status": "Статус",
|
"status": "Статус",
|
||||||
"sync": "Синхронизирован",
|
"sync": "Синхронизирован",
|
||||||
@ -1040,7 +1039,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": "Импортировать расширения",
|
||||||
@ -1566,6 +1564,7 @@
|
|||||||
"language": {
|
"language": {
|
||||||
"language": "Язык",
|
"language": "Язык",
|
||||||
"locales": {
|
"locales": {
|
||||||
|
"de_DE": "Немецкий",
|
||||||
"en_US": "Английский",
|
"en_US": "Английский",
|
||||||
"zh_CN": "Китайский",
|
"zh_CN": "Китайский",
|
||||||
"ko_KR": "Корейский",
|
"ko_KR": "Корейский",
|
||||||
|
|||||||
@ -1175,7 +1175,7 @@
|
|||||||
"delete-rulechains-action-title": "{ count, plural, 1 {1 kuralı} other {# kuralı} } sil",
|
"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.",
|
"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",
|
"add-rulechain-text": "Yeni kural ekle",
|
||||||
"no-rulechains-text":"Hiçbir kural bulunamadı",
|
"no-rulechains-text": "Hiçbir kural bulunamadı",
|
||||||
"rulechain-details": "Kural detayları",
|
"rulechain-details": "Kural detayları",
|
||||||
"details": "Detaylar",
|
"details": "Detaylar",
|
||||||
"events": "Olaylar",
|
"events": "Olaylar",
|
||||||
@ -1531,6 +1531,7 @@
|
|||||||
"language": {
|
"language": {
|
||||||
"language": "Dil",
|
"language": "Dil",
|
||||||
"locales": {
|
"locales": {
|
||||||
|
"de_DE": "Almanca",
|
||||||
"fr_FR": "Fransızca",
|
"fr_FR": "Fransızca",
|
||||||
"zh_CN": "Çince",
|
"zh_CN": "Çince",
|
||||||
"en_US": "İngilizce",
|
"en_US": "İngilizce",
|
||||||
|
|||||||
@ -916,7 +916,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": "导入扩展",
|
||||||
@ -1299,7 +1298,6 @@
|
|||||||
"saveAs": "部件另存为",
|
"saveAs": "部件另存为",
|
||||||
"save-widget-type-as": "部件类型另存为",
|
"save-widget-type-as": "部件类型另存为",
|
||||||
"save-widget-type-as-text": "请输入新的部件标题或选择目标部件包",
|
"save-widget-type-as-text": "请输入新的部件标题或选择目标部件包",
|
||||||
|
|
||||||
"toggle-fullscreen": "切换全屏",
|
"toggle-fullscreen": "切换全屏",
|
||||||
"run": "运行部件",
|
"run": "运行部件",
|
||||||
"title": "部件标题",
|
"title": "部件标题",
|
||||||
@ -1437,6 +1435,7 @@
|
|||||||
"language": {
|
"language": {
|
||||||
"language": "语言",
|
"language": "语言",
|
||||||
"locales": {
|
"locales": {
|
||||||
|
"de_DE": "德语",
|
||||||
"en_US": "英语",
|
"en_US": "英语",
|
||||||
"fr_FR": "法国",
|
"fr_FR": "法国",
|
||||||
"ko_KR": "韩语",
|
"ko_KR": "韩语",
|
||||||
|
|||||||
@ -314,6 +314,48 @@ export default class TbGoogleMap {
|
|||||||
polyline.setMap(null);
|
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 */
|
/* eslint-disable no-undef */
|
||||||
fitBounds(bounds) {
|
fitBounds(bounds) {
|
||||||
if (this.dontFitMapBounds && this.defaultZoomLevel) {
|
if (this.dontFitMapBounds && this.defaultZoomLevel) {
|
||||||
|
|||||||
@ -369,6 +369,21 @@ export default class TbImageMap {
|
|||||||
removePolyline(/*polyline*/) {
|
removePolyline(/*polyline*/) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createPolygon(/*latLangs, settings*/) {
|
||||||
|
}
|
||||||
|
|
||||||
|
removePolygon(/*latLangs, settings*/) {
|
||||||
|
}
|
||||||
|
|
||||||
|
updatePolygonColor(/*latLangs, settings*/) {
|
||||||
|
}
|
||||||
|
|
||||||
|
getPolygonLatLngs(/*latLangs, settings*/) {
|
||||||
|
}
|
||||||
|
|
||||||
|
setPolygonLatLngs(/*latLangs, settings*/) {
|
||||||
|
}
|
||||||
|
|
||||||
fitBounds() {
|
fitBounds() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -49,8 +49,8 @@ export default class TbOpenStreetMap {
|
|||||||
|
|
||||||
updateMarkerLabel(marker, settings) {
|
updateMarkerLabel(marker, settings) {
|
||||||
marker.unbindTooltip();
|
marker.unbindTooltip();
|
||||||
marker.bindTooltip('<div style="color: '+ settings.labelColor +';"><b>'+settings.labelText+'</b></div>',
|
marker.bindTooltip('<div style="color: ' + settings.labelColor + ';"><b>' + settings.labelText + '</b></div>',
|
||||||
{ className: 'tb-marker-label', permanent: true, direction: 'top', offset: marker.tooltipOffset });
|
{className: 'tb-marker-label', permanent: true, direction: 'top', offset: marker.tooltipOffset});
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMarkerColor(marker, color) {
|
updateMarkerColor(marker, color) {
|
||||||
@ -65,8 +65,8 @@ export default class TbOpenStreetMap {
|
|||||||
if (settings.showLabel) {
|
if (settings.showLabel) {
|
||||||
marker.unbindTooltip();
|
marker.unbindTooltip();
|
||||||
marker.tooltipOffset = [0, -iconInfo.size[1] + 10];
|
marker.tooltipOffset = [0, -iconInfo.size[1] + 10];
|
||||||
marker.bindTooltip('<div style="color: '+ settings.labelColor +';"><b>'+settings.labelText+'</b></div>',
|
marker.bindTooltip('<div style="color: ' + settings.labelColor + ';"><b>' + settings.labelText + '</b></div>',
|
||||||
{ className: 'tb-marker-label', permanent: true, direction: 'top', offset: marker.tooltipOffset });
|
{className: 'tb-marker-label', permanent: true, direction: 'top', offset: marker.tooltipOffset});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ export default class TbOpenStreetMap {
|
|||||||
var icon = L.icon({
|
var icon = L.icon({
|
||||||
iconUrl: currentImage.url,
|
iconUrl: currentImage.url,
|
||||||
iconSize: [width, height],
|
iconSize: [width, height],
|
||||||
iconAnchor: [width/2, height],
|
iconAnchor: [width / 2, height],
|
||||||
popupAnchor: [0, -height]
|
popupAnchor: [0, -height]
|
||||||
});
|
});
|
||||||
var iconInfo = {
|
var iconInfo = {
|
||||||
@ -133,8 +133,8 @@ export default class TbOpenStreetMap {
|
|||||||
marker.setIcon(iconInfo.icon);
|
marker.setIcon(iconInfo.icon);
|
||||||
if (settings.showLabel) {
|
if (settings.showLabel) {
|
||||||
marker.tooltipOffset = [0, -iconInfo.size[1] + 10];
|
marker.tooltipOffset = [0, -iconInfo.size[1] + 10];
|
||||||
marker.bindTooltip('<div style="color: '+ settings.labelColor +';"><b>'+settings.labelText+'</b></div>',
|
marker.bindTooltip('<div style="color: ' + settings.labelColor + ';"><b>' + settings.labelText + '</b></div>',
|
||||||
{ className: 'tb-marker-label', permanent: true, direction: 'top', offset: marker.tooltipOffset });
|
{className: 'tb-marker-label', permanent: true, direction: 'top', offset: marker.tooltipOffset});
|
||||||
}
|
}
|
||||||
marker.addTo(opMap.map);
|
marker.addTo(opMap.map);
|
||||||
});
|
});
|
||||||
@ -158,7 +158,7 @@ export default class TbOpenStreetMap {
|
|||||||
var popup = L.popup();
|
var popup = L.popup();
|
||||||
popup.setContent('');
|
popup.setContent('');
|
||||||
marker.bindPopup(popup, {autoClose: settings.autocloseTooltip, closeOnClick: false});
|
marker.bindPopup(popup, {autoClose: settings.autocloseTooltip, closeOnClick: false});
|
||||||
this.tooltips.push( {
|
this.tooltips.push({
|
||||||
markerArgs: markerArgs,
|
markerArgs: markerArgs,
|
||||||
popup: popup,
|
popup: popup,
|
||||||
locationSettings: settings,
|
locationSettings: settings,
|
||||||
@ -190,6 +190,42 @@ export default class TbOpenStreetMap {
|
|||||||
this.map.removeLayer(polyline);
|
this.map.removeLayer(polyline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
removePolygon(polygon) {
|
||||||
|
this.map.removeLayer(polygon);
|
||||||
|
}
|
||||||
|
|
||||||
|
updatePolygonColor(polygon, settings, color) {
|
||||||
|
let style = {
|
||||||
|
fill: true,
|
||||||
|
fillColor: color,
|
||||||
|
color: color,
|
||||||
|
weight: settings.polygonStrokeWeight,
|
||||||
|
fillOpacity: settings.polygonOpacity,
|
||||||
|
opacity: settings.polygonStrokeOpacity
|
||||||
|
};
|
||||||
|
polygon.setStyle(style);
|
||||||
|
}
|
||||||
|
|
||||||
|
getPolygonLatLngs(polygon) {
|
||||||
|
return polygon.getLatLngs();
|
||||||
|
}
|
||||||
|
|
||||||
|
setPolygonLatLngs(polygon, latLngs) {
|
||||||
|
polygon.setLatLngs(latLngs);
|
||||||
|
}
|
||||||
|
|
||||||
fitBounds(bounds) {
|
fitBounds(bounds) {
|
||||||
if (bounds.isValid()) {
|
if (bounds.isValid()) {
|
||||||
if (this.dontFitMapBounds && this.defaultZoomLevel) {
|
if (this.dontFitMapBounds && this.defaultZoomLevel) {
|
||||||
@ -197,7 +233,7 @@ export default class TbOpenStreetMap {
|
|||||||
this.map.panTo(bounds.getCenter(), {animate: false});
|
this.map.panTo(bounds.getCenter(), {animate: false});
|
||||||
} else {
|
} else {
|
||||||
var tbMap = this;
|
var tbMap = this;
|
||||||
this.map.once('zoomend', function() {
|
this.map.once('zoomend', function () {
|
||||||
if (!tbMap.defaultZoomLevel && tbMap.map.getZoom() > tbMap.minZoomLevel) {
|
if (!tbMap.defaultZoomLevel && tbMap.map.getZoom() > tbMap.minZoomLevel) {
|
||||||
tbMap.map.setZoom(tbMap.minZoomLevel, {animate: false});
|
tbMap.map.setZoom(tbMap.minZoomLevel, {animate: false});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,7 @@ var tmGlobals = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
@ -36,7 +36,7 @@ export default class TbTencentMap {
|
|||||||
|
|
||||||
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>"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ export default class TbTencentMap {
|
|||||||
/* 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;
|
||||||
@ -73,7 +73,7 @@ export default class TbTencentMap {
|
|||||||
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.';
|
||||||
@ -83,7 +83,7 @@ export default class TbTencentMap {
|
|||||||
|
|
||||||
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++) {
|
||||||
@ -106,16 +106,16 @@ export default class TbTencentMap {
|
|||||||
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);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -149,6 +149,7 @@ export default class TbTencentMap {
|
|||||||
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 */
|
/* eslint-disable no-undef,no-unused-vars */
|
||||||
@ -157,6 +158,7 @@ export default class TbTencentMap {
|
|||||||
marker.setIcon(iconInfo.icon);
|
marker.setIcon(iconInfo.icon);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-enable no-undef,,no-unused-vars */
|
/* eslint-enable no-undef,,no-unused-vars */
|
||||||
|
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
@ -164,10 +166,11 @@ export default class TbTencentMap {
|
|||||||
this.createMarkerIcon(marker, settings, (iconInfo) => {
|
this.createMarkerIcon(marker, settings, (iconInfo) => {
|
||||||
marker.setIcon(iconInfo.icon);
|
marker.setIcon(iconInfo.icon);
|
||||||
if (marker.label) {
|
if (marker.label) {
|
||||||
marker.label.setOffset(new qq.maps.Size(-100, -iconInfo.size[1]-20));
|
marker.label.setOffset(new qq.maps.Size(-100, -iconInfo.size[1] - 20));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
|
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
@ -189,8 +192,8 @@ export default class TbTencentMap {
|
|||||||
}
|
}
|
||||||
var icon = new qq.maps.MarkerImage(currentImage.url,
|
var icon = new qq.maps.MarkerImage(currentImage.url,
|
||||||
new qq.maps.Size(width, height),
|
new qq.maps.Size(width, height),
|
||||||
new qq.maps.Point(0,0),
|
new qq.maps.Point(0, 0),
|
||||||
new qq.maps.Point(width/2, height),
|
new qq.maps.Point(width / 2, height),
|
||||||
new qq.maps.Size(width, height));
|
new qq.maps.Size(width, height));
|
||||||
var iconInfo = {
|
var iconInfo = {
|
||||||
size: [width, height],
|
size: [width, height],
|
||||||
@ -206,6 +209,7 @@ export default class TbTencentMap {
|
|||||||
this.createDefaultMarkerIcon(marker, settings.color, onMarkerIconReady);
|
this.createDefaultMarkerIcon(marker, settings.color, onMarkerIconReady);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-enable no-undef */
|
/* eslint-enable no-undef */
|
||||||
|
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
@ -213,7 +217,7 @@ export default class TbTencentMap {
|
|||||||
var pinColor = color.substr(1);
|
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,
|
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.Size(40, 37),
|
||||||
new qq.maps.Point(0,0),
|
new qq.maps.Point(0, 0),
|
||||||
new qq.maps.Point(10, 37));
|
new qq.maps.Point(10, 37));
|
||||||
var iconInfo = {
|
var iconInfo = {
|
||||||
size: [40, 37],
|
size: [40, 37],
|
||||||
@ -221,6 +225,7 @@ export default class TbTencentMap {
|
|||||||
};
|
};
|
||||||
onMarkerIconReady(iconInfo);
|
onMarkerIconReady(iconInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-enable no-undef */
|
/* eslint-enable no-undef */
|
||||||
|
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
@ -236,7 +241,7 @@ export default class TbTencentMap {
|
|||||||
marker.label = new qq.maps.Label({
|
marker.label = new qq.maps.Label({
|
||||||
clickable: false,
|
clickable: false,
|
||||||
content: settings.labelText,
|
content: settings.labelText,
|
||||||
offset: new qq.maps.Size(-100, -iconInfo.size[1]-20),
|
offset: new qq.maps.Size(-100, -iconInfo.size[1] - 20),
|
||||||
style: tMap.createMarkerLabelStyle(settings),
|
style: tMap.createMarkerLabelStyle(settings),
|
||||||
visible: true,
|
visible: true,
|
||||||
position: location,
|
position: location,
|
||||||
@ -270,10 +275,10 @@ export default class TbTencentMap {
|
|||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
createTooltip(marker, dsIndex, settings, markerArgs) {
|
createTooltip(marker, dsIndex, settings, markerArgs) {
|
||||||
var popup = new qq.maps.InfoWindow({
|
var popup = new qq.maps.InfoWindow({
|
||||||
map :this.map
|
map: this.map
|
||||||
});
|
});
|
||||||
var map = this;
|
var map = this;
|
||||||
qq.maps.event.addListener(marker, 'click', function() {
|
qq.maps.event.addListener(marker, 'click', function () {
|
||||||
if (settings.autocloseTooltip) {
|
if (settings.autocloseTooltip) {
|
||||||
map.tooltips.forEach((tooltip) => {
|
map.tooltips.forEach((tooltip) => {
|
||||||
tooltip.popup.close();
|
tooltip.popup.close();
|
||||||
@ -282,13 +287,14 @@ export default class TbTencentMap {
|
|||||||
popup.open();
|
popup.open();
|
||||||
popup.setPosition(marker);
|
popup.setPosition(marker);
|
||||||
});
|
});
|
||||||
this.tooltips.push( {
|
this.tooltips.push({
|
||||||
markerArgs: markerArgs,
|
markerArgs: markerArgs,
|
||||||
popup: popup,
|
popup: popup,
|
||||||
locationSettings: settings,
|
locationSettings: settings,
|
||||||
dsIndex: dsIndex
|
dsIndex: dsIndex
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-enable no-undef */
|
/* eslint-enable no-undef */
|
||||||
|
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
@ -302,6 +308,7 @@ export default class TbTencentMap {
|
|||||||
};
|
};
|
||||||
polyline.setOptions(options);
|
polyline.setOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-enable no-undef */
|
/* eslint-enable no-undef */
|
||||||
|
|
||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
@ -316,12 +323,52 @@ export default class TbTencentMap {
|
|||||||
|
|
||||||
return polyline;
|
return polyline;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-enable no-undef */
|
/* eslint-enable no-undef */
|
||||||
|
|
||||||
removePolyline(polyline) {
|
removePolyline(polyline) {
|
||||||
polyline.setMap(null);
|
polyline.setMap(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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 */
|
||||||
|
|
||||||
|
removePolygon (polygon) {
|
||||||
|
polygon.setMap(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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*/
|
/* eslint-disable no-undef ,no-unused-vars*/
|
||||||
fitBounds(bounds) {
|
fitBounds(bounds) {
|
||||||
if (this.dontFitMapBounds && this.defaultZoomLevel) {
|
if (this.dontFitMapBounds && this.defaultZoomLevel) {
|
||||||
@ -329,7 +376,7 @@ export default class TbTencentMap {
|
|||||||
this.map.setCenter(bounds.getCenter());
|
this.map.setCenter(bounds.getCenter());
|
||||||
} else {
|
} else {
|
||||||
var tbMap = this;
|
var tbMap = this;
|
||||||
qq.maps.event.addListenerOnce(this.map, 'bounds_changed', function() { // eslint-disable-line no-undef
|
qq.maps.event.addListenerOnce(this.map, 'bounds_changed', function () { // eslint-disable-line no-undef
|
||||||
if (!tbMap.defaultZoomLevel && tbMap.map.getZoom() > tbMap.minZoomLevel) {
|
if (!tbMap.defaultZoomLevel && tbMap.map.getZoom() > tbMap.minZoomLevel) {
|
||||||
tbMap.map.setZoom(tbMap.minZoomLevel);
|
tbMap.map.setZoom(tbMap.minZoomLevel);
|
||||||
}
|
}
|
||||||
@ -337,6 +384,7 @@ export default class TbTencentMap {
|
|||||||
this.map.fitBounds(bounds);
|
this.map.fitBounds(bounds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-enable no-undef,no-unused-vars */
|
/* eslint-enable no-undef,no-unused-vars */
|
||||||
|
|
||||||
createLatLng(lat, lng) {
|
createLatLng(lat, lng) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user