Skip to content

Commit efc7db9

Browse files
committed
Added OverlaySynchronizer
1 parent ea246a6 commit efc7db9

File tree

5 files changed

+604
-3
lines changed

5 files changed

+604
-3
lines changed

Cesium.externs.js

+63-1
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,19 @@ Cesium.Cartesian3.distance = function(left, right) {};
886886
Cesium.Cartesian3.angleBetween = function(left, right) {};
887887

888888

889+
/**
890+
* @param {Array.<number>} degrees
891+
* @return {Array.<Cesium.Cartesian3>}
892+
*/
893+
Cesium.Cartesian3.fromDegreesArray = function(degrees) {};
894+
/**
895+
* @param {Array.<number>} degrees
896+
* @return {Array.<Cesium.Cartesian3>}
897+
*/
898+
Cesium.Cartesian3.fromDegreesArrayHeights = function(degrees) {};
899+
900+
901+
889902

890903
/**
891904
* @constructor
@@ -2372,6 +2385,14 @@ Cesium.PerspectiveFrustrum.prototype.near;
23722385
*/
23732386
Cesium.PerspectiveFrustrum.prototype.projectionMatrix;
23742387

2388+
/**
2389+
* @param {Cesium.Cartesian3} position
2390+
* @param {Cesium.Cartesian3} direction
2391+
* @param {Cesium.Cartesian3} up
2392+
* @return {Cesium.CullingVolume}
2393+
*/
2394+
Cesium.PerspectiveFrustrum.prototype.computeCullingVolume = function(position, direction, up) {};
2395+
23752396

23762397
/**
23772398
* @param {!number} drawingBufferWidth
@@ -2575,6 +2596,11 @@ Cesium.Scene.prototype.skyAtmosphere;
25752596
*/
25762597
Cesium.Scene.prototype.maximumAliasedLineWidth;
25772598

2599+
/**
2600+
* @param {Cesium.Cartesian3} value
2601+
* @return {Cesium.Cartesian2}
2602+
*/
2603+
Cesium.Scene.prototype.cartesianToCanvasCoordinates = function(value) {};
25782604

25792605
/**
25802606
* @typedef {{
@@ -3378,9 +3404,11 @@ Cesium.EventHelper.prototype.removeAll = function() {};
33783404

33793405

33803406
/**
3407+
* @param {Cesium.Cartesian3=} center
3408+
* @param {number=} radius
33813409
* @constructor
33823410
*/
3383-
Cesium.BoundingSphere = function() {};
3411+
Cesium.BoundingSphere = function(center, radius) {};
33843412

33853413

33863414
/**
@@ -3422,3 +3450,37 @@ Cesium.EntityView.prototype.update = function(currentTime, bs) {};
34223450
* @constructor
34233451
*/
34243452
Cesium.CallbackProperty = function(cb, constant) {};
3453+
3454+
/**
3455+
* @param {Cesium.BoundingSphere} occluderBoundingSphere
3456+
* @param {Cesium.Cartesian3} cameraPosition
3457+
* @constructor
3458+
*/
3459+
Cesium.Occluder = function(occluderBoundingSphere, cameraPosition) {};
3460+
3461+
/**
3462+
* @param {Cesium.Cartesian3} occludee
3463+
*/
3464+
Cesium.Occluder.prototype.isPointVisible = function(occludee) {};
3465+
3466+
/**
3467+
* @enum {number}
3468+
*/
3469+
Cesium.Intersect = {
3470+
OUTSIDE: -1,
3471+
INTERSECTING: 0,
3472+
INSIDE: 1
3473+
};
3474+
3475+
3476+
/**
3477+
* @param {Array.<Cesium.Cartesian4>} planes
3478+
* @constructor
3479+
*/
3480+
Cesium.CullingVolume = function(planes) {};
3481+
3482+
/**
3483+
* @param {Object} boundingVolume
3484+
* @return {Cesium.Intersect}
3485+
*/
3486+
Cesium.Occluder.prototype.computeVisibility = function(boundingVolume) {};

css/olcs.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.olcs-hideoverlay .ol-overlay-container {
2+
visibility:hidden;
3+
}

src/olcs/olcesium.js

+19-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ goog.require('olcs.AutoRenderLoop');
1212
goog.require('olcs.Camera');
1313
goog.require('olcs.RasterSynchronizer');
1414
goog.require('olcs.VectorSynchronizer');
15+
goog.require('olcs.OverlaySynchronizer');
1516

1617

1718

@@ -210,7 +211,8 @@ olcs.OLCesium = function(options) {
210211
const synchronizers = options.createSynchronizers ?
211212
options.createSynchronizers(this.map_, this.scene_, this.dataSourceCollection_) : [
212213
new olcs.RasterSynchronizer(this.map_, this.scene_),
213-
new olcs.VectorSynchronizer(this.map_, this.scene_)
214+
new olcs.VectorSynchronizer(this.map_, this.scene_),
215+
new olcs.OverlaySynchronizer(this.map_, this.scene_)
214216
];
215217

216218
// Assures correct canvas size after initialisation
@@ -532,6 +534,15 @@ olcs.OLCesium.prototype.getEnabled = function() {
532534
return this.enabled_;
533535
};
534536

537+
/**
538+
* @return {Element}
539+
* @api
540+
*/
541+
olcs.OLCesium.prototype.getCanvas = function() {
542+
const viewport = this.map_.getViewport();
543+
return viewport.firstElementChild;
544+
};
545+
535546

536547
/**
537548
* Enables/disables the Cesium.
@@ -563,7 +574,11 @@ olcs.OLCesium.prototype.setEnabled = function(enable) {
563574
this.hiddenRootGroup_ = rootGroup;
564575
this.hiddenRootGroup_.setVisible(false);
565576
}
577+
578+
this.map_.getOverlayContainer().classList.add('olcs-hideoverlay');
579+
this.map_.getOverlayContainerStopEvent().classList.add('olcs-hideoverlay');
566580
}
581+
567582
this.camera_.readFromView();
568583
this.render_();
569584
} else {
@@ -573,7 +588,8 @@ olcs.OLCesium.prototype.setEnabled = function(enable) {
573588
interactions.push(interaction);
574589
});
575590
this.pausedInteractions_.length = 0;
576-
591+
this.map_.getOverlayContainer().classList.remove('olcs-hideoverlay');
592+
this.map_.getOverlayContainerStopEvent().classList.remove('olcs-hideoverlay');
577593
if (this.hiddenRootGroup_) {
578594
this.hiddenRootGroup_.setVisible(true);
579595
this.hiddenRootGroup_ = null;
@@ -709,3 +725,4 @@ olcs.OLCesium.prototype.throwOnUnitializedMap_ = function() {
709725
throw new Error(`The OpenLayers map is not properly initialized: ${center} / ${view.getResolution()}`);
710726
}
711727
};
728+

0 commit comments

Comments
 (0)