Merge branch 'develop/3.0' into map/3.0

This commit is contained in:
Igor Kulikov 2020-05-07 12:25:31 +03:00 committed by GitHub
commit 3280df3b9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 32 additions and 21 deletions

View File

@ -258,11 +258,11 @@ sql:
ttl: ttl:
ts: ts:
enabled: "${SQL_TTL_TS_ENABLED:true}" enabled: "${SQL_TTL_TS_ENABLED:true}"
execution_interval_ms: "${SQL_TTL_TS_EXECUTION_INTERVAL:86400000}" # Number of miliseconds. The current value corresponds to one day execution_interval_ms: "${SQL_TTL_TS_EXECUTION_INTERVAL:86400000}" # Number of milliseconds. The current value corresponds to one day
ts_key_value_ttl: "${SQL_TTL_TS_TS_KEY_VALUE_TTL:0}" # Number of seconds ts_key_value_ttl: "${SQL_TTL_TS_TS_KEY_VALUE_TTL:0}" # Number of seconds
events: events:
enabled: "${SQL_TTL_EVENTS_ENABLED:true}" enabled: "${SQL_TTL_EVENTS_ENABLED:true}"
execution_interval_ms: "${SQL_TTL_EVENTS_EXECUTION_INTERVAL:86400000}" # Number of miliseconds. The current value corresponds to one day execution_interval_ms: "${SQL_TTL_EVENTS_EXECUTION_INTERVAL:86400000}" # Number of milliseconds. The current value corresponds to one day
events_ttl: "${SQL_TTL_EVENTS_EVENTS_TTL:0}" # Number of seconds events_ttl: "${SQL_TTL_EVENTS_EVENTS_TTL:0}" # Number of seconds
debug_events_ttl: "${SQL_TTL_EVENTS_DEBUG_EVENTS_TTL:604800}" # Number of seconds. The current value corresponds to one week debug_events_ttl: "${SQL_TTL_EVENTS_DEBUG_EVENTS_TTL:604800}" # Number of seconds. The current value corresponds to one week

View File

@ -34,7 +34,7 @@ public class MqttNoSqlTestSuite {
@ClassRule @ClassRule
public static CustomSqlUnit sqlUnit = new CustomSqlUnit( public static CustomSqlUnit sqlUnit = new CustomSqlUnit(
Arrays.asList("sql/schema-entities-hsql.sql", "sql/system-data.sql"), Arrays.asList("sql/schema-entities-hsql.sql", "sql/system-data.sql"),
"sql/drop-all-tables.sql", "sql/hsql/drop-all-tables.sql",
"nosql-test.properties"); "nosql-test.properties");
@ClassRule @ClassRule

View File

@ -391,6 +391,7 @@ public class JsonConverter {
break; break;
case JSON_V: case JSON_V:
result.add(de.getKv().getKey(), JSON_PARSER.parse(de.getKv().getJsonV())); result.add(de.getKv().getKey(), JSON_PARSER.parse(de.getKv().getJsonV()));
break;
default: default:
throw new IllegalArgumentException("Unsupported data type: " + de.getKv().getType()); throw new IllegalArgumentException("Unsupported data type: " + de.getKv().getType());
} }

View File

@ -32,7 +32,7 @@ public class NoSqlDaoServiceTestSuite {
@ClassRule @ClassRule
public static CustomSqlUnit sqlUnit = new CustomSqlUnit( public static CustomSqlUnit sqlUnit = new CustomSqlUnit(
Arrays.asList("sql/schema-entities-hsql.sql", "sql/schema-entities-idx.sql", "sql/system-data.sql", "sql/system-test.sql"), Arrays.asList("sql/schema-entities-hsql.sql", "sql/schema-entities-idx.sql", "sql/system-data.sql", "sql/system-test.sql"),
"sql/drop-all-tables.sql", "sql/hsql/drop-all-tables.sql",
"nosql-test.properties" "nosql-test.properties"
); );

View File

@ -177,6 +177,7 @@ public abstract class TbAbstractGetAttributesNode<C extends TbGetAttributesNodeC
} catch (IOException e) { } catch (IOException e) {
throw new JsonParseException("Can't parse jsonValue: " + r.getJsonValue().get(), e); throw new JsonParseException("Can't parse jsonValue: " + r.getJsonValue().get(), e);
} }
break;
} }
msg.getMetaData().putValue(r.getKey(), value.toString()); msg.getMetaData().putValue(r.getKey(), value.toString());
} }

View File

@ -70,10 +70,8 @@ export class TelemetryWebsocketService implements TelemetryService {
private ngZone: NgZone, private ngZone: NgZone,
@Inject(WINDOW) private window: Window) { @Inject(WINDOW) private window: Window) {
this.store.pipe(select(selectIsAuthenticated)).subscribe( this.store.pipe(select(selectIsAuthenticated)).subscribe(
(authenticated: boolean) => { () => {
if (!authenticated) { this.reset(true);
this.reset(true);
}
} }
); );

View File

@ -40,7 +40,6 @@ export default abstract class LeafletMap {
markers: Map<string, Marker> = new Map(); markers: Map<string, Marker> = new Map();
polylines: Map<string, Polyline> = new Map(); polylines: Map<string, Polyline> = new Map();
polygons: Map<string, Polygon> = new Map(); polygons: Map<string, Polygon> = new Map();
dragMode = false;
map: L.Map; map: L.Map;
map$: BehaviorSubject<L.Map> = new BehaviorSubject(null); map$: BehaviorSubject<L.Map> = new BehaviorSubject(null);
ready$: Observable<L.Map> = this.map$.pipe(filter(map => !!map)); ready$: Observable<L.Map> = this.map$.pipe(filter(map => !!map));
@ -240,7 +239,7 @@ export default abstract class LeafletMap {
convertToCustomFormat(position: L.LatLng): object { convertToCustomFormat(position: L.LatLng): object {
return { return {
[this.options.latKeyName]: position.lat % 180, [this.options.latKeyName]: position.lat % 90,
[this.options.lngKeyName]: position.lng % 180 [this.options.lngKeyName]: position.lng % 180
} }
} }

View File

@ -75,7 +75,7 @@ const imageAspectMap = {};
function imageLoader(imageUrl: string): Observable<HTMLImageElement> { function imageLoader(imageUrl: string): Observable<HTMLImageElement> {
return new Observable((observer: Observer<HTMLImageElement>) => { return new Observable((observer: Observer<HTMLImageElement>) => {
const image = new Image(); const image = document.createElement('img'); // support IE
image.style.position = 'absolute'; image.style.position = 'absolute';
image.style.left = '-99999px'; image.style.left = '-99999px';
image.style.top = '-99999px'; image.style.top = '-99999px';
@ -236,3 +236,13 @@ export function safeExecute(func: (...args: any[]) => any, params = []) {
} }
return res; return res;
} }
export function calculateNewPointCoordinate(coordinate: number, imageSize: number): number {
let pointCoordinate = coordinate / imageSize;
if (pointCoordinate < 0) {
pointCoordinate = 0;
} else if (pointCoordinate > 1) {
pointCoordinate = 1;
}
return pointCoordinate;
}

View File

@ -29,8 +29,8 @@ export class Marker {
data: FormattedData; data: FormattedData;
dataSources: FormattedData[]; dataSources: FormattedData[];
constructor(location: L.LatLngExpression, public settings: MarkerSettings, constructor(location: L.LatLngExpression, public settings: MarkerSettings,
data?: FormattedData, dataSources?, onDragendListener?) { data?: FormattedData, dataSources?, onDragendListener?) {
this.setDataSources(data, dataSources); this.setDataSources(data, dataSources);
this.leafletMarker = L.marker(location, { this.leafletMarker = L.marker(location, {
draggable: settings.draggableMarker draggable: settings.draggableMarker

View File

@ -19,7 +19,7 @@ import LeafletMap from '../leaflet-map';
import { UnitedMapSettings } from '../map-models'; import { UnitedMapSettings } from '../map-models';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { map, filter, switchMap } from 'rxjs/operators'; import { map, filter, switchMap } from 'rxjs/operators';
import { aspectCache, parseFunction } from '@home/components/widget/lib/maps/maps-utils'; import { aspectCache, calculateNewPointCoordinate, parseFunction } from '@home/components/widget/lib/maps/maps-utils';
const maxZoom = 4;// ? const maxZoom = 4;// ?
@ -79,9 +79,10 @@ export class ImageMap extends LeafletMap {
if (lastCenterPos) { if (lastCenterPos) {
lastCenterPos.x *= w; lastCenterPos.x *= w;
lastCenterPos.y *= h; lastCenterPos.y *= h;
/* this.ctx.$scope.$injector.get('$mdUtil').nextTick(() => { const center = this.pointToLatLng(lastCenterPos.x, lastCenterPos.y);
this.map.panTo(center, { animate: false }); setTimeout(() => {
});*/ this.map.panTo(center, { animate: false });
}, 0);
} }
} }
@ -97,7 +98,7 @@ export class ImageMap extends LeafletMap {
width *= maxZoom; width *= maxZoom;
const prevWidth = this.width; const prevWidth = this.width;
const prevHeight = this.height; const prevHeight = this.height;
if (this.width !== width) { if (this.width !== width || updateImage) {
this.width = width; this.width = width;
this.height = width / this.aspect; this.height = width / this.aspect;
if (!this.map) { if (!this.map) {
@ -134,7 +135,7 @@ export class ImageMap extends LeafletMap {
convertPosition(expression): L.LatLng { convertPosition(expression): L.LatLng {
if (isNaN(expression[this.options.xPosKeyName]) || isNaN(expression[this.options.yPosKeyName])) return null; if (isNaN(expression[this.options.xPosKeyName]) || isNaN(expression[this.options.yPosKeyName])) return null;
Object.assign(expression, this.posFunction(expression[this.options.xPosKeyName], expression[this.options.yPosKeyName])) Object.assign(expression, this.posFunction(expression[this.options.xPosKeyName], expression[this.options.yPosKeyName]));
return this.pointToLatLng( return this.pointToLatLng(
expression.x * this.width, expression.x * this.width,
expression.y * this.height); expression.y * this.height);
@ -149,9 +150,10 @@ export class ImageMap extends LeafletMap {
} }
convertToCustomFormat(position: L.LatLng): object { convertToCustomFormat(position: L.LatLng): object {
const point = this.latLngToPoint(position);
return { return {
[this.options.xPosKeyName]: (position.lng + 180) / 360, [this.options.xPosKeyName]: calculateNewPointCoordinate(point.x, this.width),
[this.options.yPosKeyName]: (position.lat + 180) / 360 [this.options.yPosKeyName]: calculateNewPointCoordinate(point.y, this.height)
} }
} }
} }