diff --git a/positioning/apps/main/templates/main/index.html b/positioning/apps/main/templates/main/index.html
index a7a0afd..947aa91 100644
--- a/positioning/apps/main/templates/main/index.html
+++ b/positioning/apps/main/templates/main/index.html
@@ -48,6 +48,7 @@
+
{% endblock %}
{% block script_footer %}
@@ -161,25 +162,7 @@
await updateMarkers();
setInterval(updateMarkers, 3000);
- function VlocationStyleFunction(feature, resolution) {
- return new ol.style.Style({
- image: new ol.style.Icon({
- src: '{% static 'img/worker.png' %}',
- width: 25,
- height: 30
- })
- })
- }
- function BaseStationStyleFunction(feature, resolution) {
- return new ol.style.Style({
- image: new ol.style.Icon({
- src: '{% static 'img/base-station.png' %}',
- width: 50,
- height: 40
- })
- })
- }
function polygonGrayStyleFunction(feature, resolution) {
return new ol.style.Style({
diff --git a/positioning/apps/street_pos/templates/street_pos/map.html b/positioning/apps/street_pos/templates/street_pos/map.html
index 63590e4..b555c68 100644
--- a/positioning/apps/street_pos/templates/street_pos/map.html
+++ b/positioning/apps/street_pos/templates/street_pos/map.html
@@ -65,6 +65,7 @@
+
{% endblock %}
{% block script_footer %}
diff --git a/static/openLayers/layersStyles.js b/static/openLayers/layersStyles.js
index 5d2cdef..7537b7f 100644
--- a/static/openLayers/layersStyles.js
+++ b/static/openLayers/layersStyles.js
@@ -75,16 +75,83 @@ function createHatchPattern() {
return ctx.createPattern(canvas, 'repeat');
}
-function VlocationStyleFunction(feature, resolution) {
+
+function BaseStationStyleFunction(feature, resolution) {
return new ol.style.Style({
image: new ol.style.Icon({
- src: '/static/img/worker.png',
- width: 25,
- height: 30
+ src: '/static/img/base-station.png',
+ width: 50,
+ height: 40
})
})
}
+const createFeatureTextStyle = function (feature, resolution, bgFill, textFill) {
+
+ const font = 'bold' + ' ' + '12px' + '/' + '1' + ' ' + 'Arial';
+ return new ol.style.Text({
+ textAlign: 'center',
+ textBaseline: 'middle',
+ font: font,
+ text: feature.get('sn'),
+ fill: textFill,
+ offsetX: 0,
+ offsetY: -27,
+ placement: 'point',
+ maxAngle: '0.7853981633974483',
+ overflow: 'false',
+ rotation: parseFloat('0'),
+ backgroundFill: bgFill,
+ backgroundStroke: new ol.style.Stroke({color: '#000', width: 1}),
+ padding: [3, 3, 3, 3],
+ });
+};
+
+function VlocationStyleFunction(feature, resolution) {
+ const objDate = new Date(feature.get("iso_time"))
+ let bgFill = undefined
+ let textFill = new ol.style.Fill({color: '#000'})
+
+ if (objDate) {
+ const nowDate = new Date()
+ const diffDate = (nowDate - objDate) / (1000 * 60 * 60)
+ if (diffDate < 1) {
+ bgFill = '#fff'
+ } else if (diffDate > 1 && diffDate < 24) {
+ bgFill = '#ffc107'
+ } else {
+ bgFill = "#bebebe"
+ }
+ }
+
+ const backgroundStyle = new ol.style.Circle({
+ radius: 15,
+ fill: new ol.style.Fill({
+ color: bgFill
+ }),
+ stroke: new ol.style.Stroke({
+ color: '#000',
+ width: 1
+ })
+ });
+
+ return [
+ new ol.style.Style({
+ image: backgroundStyle
+ }),
+ new ol.style.Style({
+ image: new ol.style.Icon({
+ src: '/static/img/worker.png',
+ width: 25,
+ height: 30
+ })
+ }),
+ new ol.style.Style({
+ text: createFeatureTextStyle(feature, resolution, new ol.style.Fill({color: bgFill}), textFill)
+ })
+ ];
+}
+
function SPStyleFunction(feature, resolution) {
return new ol.style.Style({
image: new ol.style.Icon({