liuyg
2021-07-02 25ce610f6ecca7325e7a743dc032c4a76559c63d
widgets/slope/Widget.js
@@ -41,66 +41,25 @@
                //         roll: 6.2831853016686185
                //     }
                // });
                viewer.imageryLayers.addImageryProvider(new Cesium.SuperMapImageryProvider({
                    url: 'http://www.supermapol.com/realspace/services/3D-ZF_normal/rest/realspace/datas/image'
                }));
                var slope = new Cesium.SlopeSetting();
                slope.DisplayMode = Cesium.SlopeSettingEnum.DisplayMode.FACE_AND_ARROW;
                slope.MaxVisibleValue = document.getElementById("widemax").value;
                slope.MinVisibleValue = document.getElementById("widemin").value;
                var colorTable = new Cesium.ColorTable();
                colorTable.insert(80, new Cesium.Color(255 / 255, 0 / 255, 0 / 255));
                colorTable.insert(50, new Cesium.Color(221 / 255, 224 / 255, 7 / 255));
                colorTable.insert(30, new Cesium.Color(20 / 255, 187 / 255, 18 / 255));
                colorTable.insert(20, new Cesium.Color(0, 161 / 255, 1));
                colorTable.insert(8000, new Cesium.Color(255 / 255, 0 / 255, 0 / 255));
                colorTable.insert(5000, new Cesium.Color(221 / 255, 224 / 255, 7 / 255));
                colorTable.insert(3000, new Cesium.Color(20 / 255, 187 / 255, 18 / 255));
                colorTable.insert(2000, new Cesium.Color(0, 161 / 255, 1));
                colorTable.insert(0, new Cesium.Color(9 / 255, 9 / 255, 255 / 255));
                var wide;
                wide = Cesium.HypsometricSettingEnum.AnalysisRegionMode.ARM_REGION;
                slope.ColorTable = colorTable;
                slope.Opacity = 1;
                function createTooltip(frameDiv) {//创建需要的函数
                    var tooltip = function (frameDiv) {
                        var div = document.createElement('DIV');
                        div.className = "twipsy right";
                        var arrow = document.createElement('DIV');
                        arrow.className = "twipsy-arrow";
                        div.appendChild(arrow);
                        var title = document.createElement('DIV');
                        title.className = "twipsy-inner";
                        div.appendChild(title);
                        this._div = div;
                        this._title = title;
                        this.message = '';
                        // add to frame div and display coordinates
                        frameDiv.appendChild(div);
                        var that = this;
                        div.onmousemove = function (evt) {
                            that.showAt({ x: evt.clientX, y: evt.clientY }, that.message);
                        };
                    };
                    tooltip.prototype.setVisible = function (visible) {
                        this._div.style.display = visible ? 'block' : 'none';
                    };
                    tooltip.prototype.showAt = function (position, message) {
                        if (position && message) {
                            this.setVisible(true);
                            this._title.innerHTML = message;
                            this._div.style.left = position.x + 10 + "px";
                            this._div.style.top = (position.y - this._div.clientHeight / 2) + "px";
                            this.message = message;
                        }
                    };
                    return new tooltip(frameDiv);
                }
                var tooltip = createTooltip(viewer._element);
                var tooltip = window.MYcreateTooltip(viewer._element);
                //绘制多边形
                var handlerPolygon = new Cesium.DrawHandler(viewer, Cesium.DrawMode.Polygon, 0);
                handlerPolygon.activeEvt.addEventListener(function (isActive) {