|
@@ -166,7 +166,7 @@ export function getHeigthByPointMostDetailed(viewer, points) {
|
|
|
throw new Cesium.DeveloperError("points is required.");
|
|
|
}
|
|
|
|
|
|
- let positions = Cesium.Cartographic.fromDegrees(points[0], points[1]);//经纬度转为世界坐标;
|
|
|
+ let positions = Cesium.Cartographic.fromDegrees(points[0], points[1]); //经纬度转为世界坐标;
|
|
|
|
|
|
let terrainProvider = viewer.terrainProvider;
|
|
|
|
|
@@ -178,3 +178,42 @@ export function getHeigthByPointMostDetailed(viewer, points) {
|
|
|
});
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+import '../../Assets/styles/tooltip.css';
|
|
|
+export 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;
|
|
|
+
|
|
|
+ // add to frame div and display coordinates
|
|
|
+ frameDiv.appendChild(div);
|
|
|
+ }
|
|
|
+
|
|
|
+ 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";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return new tooltip(frameDiv);
|
|
|
+}
|