骑行轨迹展示
This commit is contained in:
parent
c09de480a1
commit
9083f88541
BIN
ebike-operate/src/assets/endPoint.png
Normal file
BIN
ebike-operate/src/assets/endPoint.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
BIN
ebike-operate/src/assets/startPoint.png
Normal file
BIN
ebike-operate/src/assets/startPoint.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
@ -869,6 +869,8 @@ const viewOrderInfo = (record) => {
|
|||||||
ebikeCode: record['ebikeCode'],
|
ebikeCode: record['ebikeCode'],
|
||||||
startTime: record['startTime'],
|
startTime: record['startTime'],
|
||||||
endTime: record['endTime'],
|
endTime: record['endTime'],
|
||||||
|
ridePoint: record['ridePoint'],
|
||||||
|
returnPoint: record['returnPoint'],
|
||||||
}
|
}
|
||||||
formModelOrderInfo.value.openForm(params);
|
formModelOrderInfo.value.openForm(params);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -5,23 +5,30 @@
|
|||||||
>
|
>
|
||||||
<tlbs-map
|
<tlbs-map
|
||||||
ref="mapRef"
|
ref="mapRef"
|
||||||
:api-key="config.map.apiKey"
|
api-key="OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77"
|
||||||
:center="center"
|
:center="center"
|
||||||
zoom="16"
|
:zoom="zoom"
|
||||||
:control="control"
|
:control="control"
|
||||||
:options="options"
|
@click="onClick"
|
||||||
@map_inited="onMapInited"
|
@map_inited="onMapInited"
|
||||||
>
|
>
|
||||||
<tlbs-geometry-editor
|
<tlbs-multi-polyline
|
||||||
ref="editorRef"
|
ref="polylineRef"
|
||||||
action-mode="draw"
|
:geometries="geometriesLine"
|
||||||
selectable
|
:styles="styles"
|
||||||
@draw_complete="onDrowComplet"
|
:options="options"
|
||||||
@draw_error="onDrawError"
|
|
||||||
@adjust_complete="onAdjustComplete"
|
|
||||||
@adjust_error="onAdjustError"
|
|
||||||
@delete_complete="onDeleteComplete"
|
|
||||||
/>
|
/>
|
||||||
|
<tlbs-multi-marker
|
||||||
|
ref="markerRef"
|
||||||
|
:geometries="geometriesPoint"
|
||||||
|
:styles="styles"
|
||||||
|
:options="options"
|
||||||
|
/>
|
||||||
|
<div class="control-container">
|
||||||
|
<button @click.stop="getLayerInstance">
|
||||||
|
打印折线实例
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</tlbs-map>
|
</tlbs-map>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -44,11 +51,42 @@ const props = defineProps({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const mapRef = ref(null);
|
const mapRef = ref(null);
|
||||||
const center = ref(config.map.center);
|
const polylineRef = ref(null);
|
||||||
const control = ref({ scale: {}, zoom: { position: 'topRight', }, });
|
const center = ref({ lat: 0, lng: 0 });
|
||||||
const options = ref({ renderOptions: { renderOptions: true, } });
|
const zoom = ref(16);
|
||||||
const editorRef = ref(null);
|
|
||||||
const points = ref([])
|
const control = ref({
|
||||||
|
scale: {},
|
||||||
|
zoom: {
|
||||||
|
position: 'topRight',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const geometriesLine = ref([]);
|
||||||
|
const geometriesPoint = ref([]);
|
||||||
|
|
||||||
|
const styles = ref({
|
||||||
|
polyline: {
|
||||||
|
color: '#2C68FF', // 线填充色
|
||||||
|
borderWidth: 1, // 边线宽度
|
||||||
|
borderColor: '#004EE1', // 边线颜色
|
||||||
|
},
|
||||||
|
markerStart: {
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
src: '/src/assets/startPoint.png'
|
||||||
|
},
|
||||||
|
markerEnd: {
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
src: '/src/assets/endPoint.png'
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const options = ref({
|
||||||
|
zIndex: 1,
|
||||||
|
});
|
||||||
|
|
||||||
const onMapInited = () => {
|
const onMapInited = () => {
|
||||||
if (mapRef.value) {
|
if (mapRef.value) {
|
||||||
const windowWidth = window.innerWidth;
|
const windowWidth = window.innerWidth;
|
||||||
@ -71,47 +109,42 @@ const onMapInited = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
points.value = res.data
|
center.value = { lat: props.orderParams.ridePoint.split(",")[1], lng: props.orderParams.ridePoint.split(",")[0] }
|
||||||
loadGeometry();
|
const trajectory = [{ lat: props.orderParams.ridePoint.split(",")[1], lng: props.orderParams.ridePoint.split(",")[0] }];
|
||||||
|
res.data.map(item => {
|
||||||
|
trajectory.push({ lat: item['latitude'], lng: item['longitude'] })
|
||||||
|
})
|
||||||
|
trajectory.push({ lat: props.orderParams.returnPoint.split(",")[1], lng: props.orderParams.returnPoint.split(",")[0] })
|
||||||
|
geometriesLine.value = [
|
||||||
|
{
|
||||||
|
id: 'polyline1',
|
||||||
|
styleId: 'polyline',
|
||||||
|
paths: trajectory,
|
||||||
|
properties: {
|
||||||
|
title: 'polyline',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
geometriesPoint.value = [
|
||||||
|
{
|
||||||
|
styleId: 'markerStart', position: {
|
||||||
|
lat: parseFloat(props.orderParams.ridePoint.split(",")[1]),
|
||||||
|
lng: parseFloat(props.orderParams.ridePoint.split(",")[0])
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
styleId: 'markerEnd', position: {
|
||||||
|
lat: parseFloat(props.orderParams.returnPoint.split(",")[1]),
|
||||||
|
lng: parseFloat(props.orderParams.returnPoint.split(",")[0])
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const loadGeometry = () => {
|
|
||||||
|
|
||||||
if (points.value.length > 0) {
|
|
||||||
const circleGeometries = [];//editorRef.value.circle.getGeometries();
|
|
||||||
if (circleGeometries.length > 0) {
|
|
||||||
circleGeometries.forEach((geometry) => {
|
|
||||||
editorRef.value.circle.remove(geometry); // 删除之前的图形数据
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const trajectory = points.value.map(item => {
|
|
||||||
return new TMap.LatLng(item['latitude'], item['longitude'])
|
|
||||||
})
|
|
||||||
const shapeId = getGUID()
|
|
||||||
circleGeometries.push({
|
|
||||||
id: shapeId,
|
|
||||||
style: new TMap.PolylineStyle({
|
|
||||||
'color': '#blue', //线填充色
|
|
||||||
'width': 6, //折线宽度
|
|
||||||
'borderWidth': 5, //边线宽度
|
|
||||||
'borderColor': 'red', //边线颜色
|
|
||||||
'lineCap': 'round' //线端头方式
|
|
||||||
}),
|
|
||||||
paths: trajectory,
|
|
||||||
center: new TMap.LatLng(points.value[0].latitude, points.value[0].longitude),
|
|
||||||
});
|
|
||||||
editorRef.value.circle.setGeometries(circleGeometries);
|
|
||||||
//设置视野范围
|
|
||||||
const mycircle = editorRef.value.circle.getGeometryById(shapeId);
|
|
||||||
const boundary = TMap.geometry.computeBoundingRectangle(mycircle.paths);
|
|
||||||
mapRef.value.map.fitBounds(boundary, {
|
|
||||||
padding: 100, // 设置地图边界的内边距
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -43,6 +43,8 @@ const openForm = (params = {}) => {
|
|||||||
orderParams.value['ebikeCode'] = params['ebikeCode'];
|
orderParams.value['ebikeCode'] = params['ebikeCode'];
|
||||||
orderParams.value['startTime'] = params['startTime'];
|
orderParams.value['startTime'] = params['startTime'];
|
||||||
orderParams.value['endTime'] = params['endTime'];
|
orderParams.value['endTime'] = params['endTime'];
|
||||||
|
orderParams.value['ridePoint'] = params['ridePoint'];
|
||||||
|
orderParams.value['returnPoint'] = params['returnPoint'];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user