Skip to content
Snippets Groups Projects
Commit 36b391b7 authored by Bhabesh Bhabani Mukhopadhyay's avatar Bhabesh Bhabani Mukhopadhyay
Browse files

#VOAPP-13 : For new POI user's current gps location captured

parent fa2ba366
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@ compile to www folder</description>
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<plugin name="cordova-plugin-geolocation" spec="4.1.0" />
<platform name="android">
<allow-intent href="market:*" />
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
......
......@@ -84,6 +84,7 @@ export default{
poi : {},
mapZoom : 0,
poiTypes : [],
}
},
methods : {
......@@ -124,7 +125,7 @@ export default{
})
localStorage.setItem(CommonUtil.CONST_STORAGE_POI_LIST,JSON.stringify(lstPOI));
},
initMap()
/* initMap()
{
let mapZoom = this.mapZoom;
let urlMap = CommonUtil.CONST_GPS_URL_NORWAY_MAP;
......@@ -169,7 +170,7 @@ export default{
renderer : 'canvas',
})
})
},
}, */
myImage()
{
var fill = new Fill({
......@@ -224,8 +225,76 @@ export default{
return (mapInteractions) ? [] : '';
},
/** My current location */
myposition()
{
let options = { enableHighAccuracy: true };
navigator.geolocation.getCurrentPosition(this.geolocationSuccess, this.geolocationError, options);
//navigator.geolocation.getCurrentPosition(this.geolocationSuccess, this.geolocationError, this.geolocationOptions);
},
geolocationOptions(options){
console.log('geolocation options : '+options);
},
geolocationError(error){
console.log('geolocation error : '+geolocationError);
},
geolocationSuccess(pos) {
let This = this;
console.log(pos);
This.poi.latitude = pos.coords.latitude;
This.poi.longitude = pos.coords.longitude;
let coord = [pos.coords.longitude,pos.coords.latitude];
let transFormCord = transform(coord, 'EPSG:3857','EPSG:4326');
let vectorLayer = new VectorLayer({
source : new VectorSource ({
features : [
new Feature({
geometry : new Point(fromLonLat(transFormCord))
})
],
}),
style : new Style({
image : new CircleStyle ({
radius : 5,
fill : new Fill({
color : 'red'
}),
stroke : new Stroke({
color : 'red',
width : 4
})
})
})
});
let geoGSON = new GeoJSON();
let resultGeoGSON = geoGSON.writeFeatures(vectorLayer.getSource().getFeatures(), {
dataProjection : 'EPSG:4326',
featureProjection : 'EPSG:3857'
})
This.poi.geoJSON = resultGeoGSON;
This.mapInit();
},
mapInit()
{
let This = this;
let urlMap = CommonUtil.CONST_GPS_URL_NORWAY_MAP;
let latitude = this.poi.latitude;
......@@ -347,9 +416,19 @@ export default{
this.mapZoom = CommonUtil.CONST_GPS_OBSERVATION_ZOOM;
this.poiTypes = JSON.parse(CommonUtil.CONST_POI_TYPES);
this.getPointOfInterest(this.$route.params.pointOfInterestId);
if(this.$route.params.pointOfInterestId)
{
this.getPointOfInterest(this.$route.params.pointOfInterestId);
this.mapInit();
}
else
{
this.myposition();
}
//this.initMap();
this.mapInit();
},
beforeDestroy() {
// This resets the container layout when leaving the router page
......
......@@ -6,7 +6,16 @@
<div class='col-10 '><h5>{{poi.name}}</h5></div>
<div class='col'><i class="fas fa-plus-circle fa-2x"></i></div>
</router-link>
<div class="clearfix" />
</div>
<div id='divNewPOI' class="container">
<router-link class="row fw-bold" ref='linkMapPoi' :to="{name:'MapPOI', params: {}}" >
<div class='col-10 '></div>
<div class='col'><i class="fas fa-plus-circle fa-2x"></i></div>
</router-link>
</div>
<common-util ref="CommonUtil"/>
</div>
</template>
......@@ -47,6 +56,7 @@ export default {
getPlacesList()
{
let lstPOI = JSON.parse(localStorage.getItem(CommonUtil.CONST_STORAGE_POI_LIST));
return lstPOI;
}
......@@ -61,3 +71,9 @@ export default {
}
}
</script>
<style>
#divNewPOI {
position: fixed;
bottom : 0;
}
</style>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment