@eturnity/eturnity_3d 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_3d",
3
3
  "private": false,
4
- "version": "1.0.3",
4
+ "version": "1.0.5",
5
5
  "main": "dist/main.js",
6
6
  "scripts": {
7
7
  "dev": "vue-cli-service serve --skip-plugins @vue/cli-plugin-eslint",
@@ -60,21 +60,48 @@ export default {
60
60
  this.three_map.position.set(-coords.x*coef,-coords.y*coef,0)
61
61
  this.scene.add(this.three_map)
62
62
  }else{
63
- let apiKey=process.env.VUE_APP_GOOGLE_MAP_API_KEY
64
- console.log('apiKey Google',apiKey)
65
- let backgroundPlanes=[]
66
-
67
- let planeGeometry = new THREE.PlaneGeometry(1000, 1000)
63
+ let googleMapType='satellite'
64
+ switch(this.selectedMapLayer.key){
65
+ case 'googleLayerRoadmap':
66
+ googleMapType='roadmap'
67
+ break;
68
+ case 'googleLayer':
69
+ googleMapType='satellite'
70
+ break;
71
+ case 'googleLayerTerrain':
72
+ googleMapType='terrain'
73
+ break;
74
+
75
+ }
76
+
77
+ let apiKey = process.env.VUE_APP_GOOGLE_MAP_API_KEY
78
+ let backgroundPlane=[]
79
+ let size=640
80
+ let planeGeometry=[]
81
+ let planeMaterial=[]
82
+ let texture=[]
83
+ let zoomLevels=[18,12]
84
+ for(let indexGoogleBackground=0;indexGoogleBackground<zoomLevels.length; indexGoogleBackground++){
85
+ let zoomLevel=zoomLevels[indexGoogleBackground]
86
+ let groundResolution = (Math.cos(this.layoutSettings.layout_latitude * Math.PI/180) * 2 * Math.PI * 6378137) / (256 * Math.pow(2,zoomLevel))
87
+ let sizeInMeter=groundResolution*size
88
+ planeGeometry[indexGoogleBackground] = new THREE.PlaneGeometry(sizeInMeter, sizeInMeter)
89
+ let googleBackgroundUrl = `https://maps.googleapis.com/maps/api/staticmap?center=${
90
+ this.layoutSettings.layout_latitude +
91
+ ',' +
92
+ this.layoutSettings.layout_longitude
93
+ }&maptype=${googleMapType}&zoom=${zoomLevel}&size=${size}x${size}&key=${apiKey}`
94
+
95
+ texture[indexGoogleBackground] = this.loader.load(googleBackgroundUrl)
96
+ planeMaterial[indexGoogleBackground] = new THREE.MeshBasicMaterial({
97
+ map: texture[indexGoogleBackground],
98
+ side: THREE.DoubleSide
99
+ })
100
+ backgroundPlane[indexGoogleBackground] = new THREE.Mesh(planeGeometry[indexGoogleBackground], planeMaterial[indexGoogleBackground])
101
+ backgroundPlane[indexGoogleBackground].position.z = -indexGoogleBackground/2
102
+ this.background_map.add(backgroundPlane[indexGoogleBackground])
103
+ }
68
104
 
69
- let googleBackgroundUrl_0=`https://maps.googleapis.com/maps/api/staticmap?center=${this.layoutSettings.layout_latitude+","+this.layoutSettings.layout_longitude}&zoom=14&size=400x400&key=${apiKey}`
70
- let texture = this.loader.load(googleBackgroundUrl_0)
71
- let planeMaterial = new THREE.MeshBasicMaterial( {
72
- map: texture,
73
- side: THREE.DoubleSide
74
- })
75
- backgroundPlanes[0] = new THREE.Mesh(planeGeometry, planeMaterial)
76
- backgroundPlanes[0] .position.z=0
77
- this.background_map.add( backgroundPlanes[0] )
78
105
  }
79
106
  this.scene.add(this.background_map)
80
107
  },