hree = THREE;
// Ensure 'three' is defined if needed: three = THREE;
class GeoThreeExtension extends Autodesk.Viewing.Extension {
constructor(viewer, options) {
super(viewer, options);
this.viewer = viewer;
}
load() {
var provider = new Geo.DebugProvider();
var DEV_BING_API_KEY =
"AuViYD_FXGfc3dxc0pNa8ZEJxyZyPq1lwOLPCOydV3f0tlEVH-HKMgxZ9ilcRj-T";
var provider = new Geo.BingMapsProvider(
DEV_BING_API_KEY,
Geo.BingMapsProvider.ROAD
);
var map = new Geo.MapView(Geo.MapView.PLANAR, provider);
map.position.set(14900, -27300, -45);
this.viewer.overlays.addScene("map");
this.viewer.overlays.addMesh(map, "map");
map.updateMatrixWorld(false);
this.viewer.autocam.shotParams.destinationPercent = 3;
this.viewer.autocam.shotParams.duration = 3;
var cam = this.viewer.getCamera();
var coords = Geo.UnitsUtils.datumsToSpherical(40.940119, -8.535589);
cam.target.set(coords.x, 0, -coords.y);
cam.position.set(0, 1000, 0);
this.viewer.addEventListener(Autodesk.Viewing.CAMERA_CHANGE_EVENT, () => {
this.viewer.autocam.toPerspective();
map.lod.updateLOD(
map,
cam,
this.viewer.impl.glrenderer(),
this.viewer.overlays.impl.overlayScenes.map.scene,
this.viewer.impl
);
});
return true;
}
unload() {
return true;
}
}
Autodesk.Viewing.theExtensionManager.registerExtension(
"GeoThreeExtension",
GeoThreeExtension
);
This is the custom GeoThreeExtension so instead of DEV_BING_API_KEY ,I have google api key .
so how can i use that in this extension.
I have get this code from the git resource https://github.com/wallabyway/geo-three-ext.
when i used the below GOOGLE_MAPS_API_ instead of DEV_BING_API_KEY
var GOOGLE_MAPS_API_KEY = "YOUR_GOOGLE_MAPS_API_KEY";
var provider = new Geo.GoogleMapsProvider(GOOGLE_MAPS_API_KEY);
iam getting errors.
I want to use google api key in the custom GeoThreeExtension .
how can i use that ,Please help me .
iam using autodesk forge viewer
<script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.min.js"></script>
Thanks in advance