//Set inital Renderers
appConfig.pipelineRenderer = pipelineRenderer;
appConfig.wellpadRenderer = wellpadRenderer;
appConfig.facilityRenderer = facilityRenderer;
// Switch the view between 2D and 3D each time the button is clicked
switchButton.addEventListener("click", function () {
switchView();
});
// Switches the view from 2D to 3D and vice versa
function switchView() {
var is3D = appConfig.activeView.type === "3d";
// var activeViewpoint = appConfig.activeView.viewpoint.clone();
// Remove the reference to the container for the previous view
appConfig.activeView.container = null;
if (is3D) {
// if the input view is a SceneView, set the viewpoint on the
// mapView instance. Set the container on the mapView and flag
// it as the active view
// appConfig.mapView.viewpoint = activeViewpoint;
// appConfig.mapView.container = appConfig.container;
appConfig.activeView = appConfig.mapView;
switchButton.value = "3D";
appConfig.pipelineRenderer = pipelineRenderer;
appConfig.wellpadRenderer = wellpadRenderer;
appConfig.facilityRenderer = facilityRenderer;
} else {
// appConfig.sceneView.viewpoint = activeViewpoint;
appConfig.sceneView.container = appConfig.container;
appConfig.activeView = appConfig.sceneView;
switchButton.value = "2D";
// var pipeLineLayer = map.findLayerById("idPipelineLayer");
// var facilityLayer = map.findLayerById("idFacilityLayer");
// var wellpadLayer = map.findLayerById("idWellpadLayer");
// pipeLineLayer.set(pipelineRenderer3D);
// pipeLineLayer.refresh();
// facilityLayer.set(facilityRenderer3D);
// facilityLayer.refresh();
// wellpadLayer.set(wellpadRenderer3D);
// wellpadLayer.refresh();
appConfig.pipelineRenderer = pipelineRenderer3D;
appConfig.wellpadRenderer = wellpadRenderer3D;
appConfig.facilityRenderer = facilityRenderer3D;
}
}