Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cesium): support altitude modes via ground primitives #493

Merged
merged 30 commits into from
Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7b7854a
feat(cesium): support altitude modes via ground primitives
wallw-teal Apr 19, 2019
117154a
fix(cesium): check for EllipsoidTerrainProvider in off case
wallw-teal Apr 23, 2019
309f7ac
refactor(map): use constants for altitude mode
wallw-teal Apr 24, 2019
57b08e3
fix(cesium): fix occasional error on extent calculation
wallw-teal Apr 24, 2019
8350471
fix(cesium): use polygon rather than polyline for fills
wallw-teal Apr 24, 2019
0d5ade6
Merge remote-tracking branch 'origin/master' into fix-draw-clamped-to…
wallw-teal Apr 24, 2019
7726b02
fix(draw): let Cesium interpolate further with the default granularity
wallw-teal Apr 24, 2019
9eb0dce
fix(cesium): force 0 height for pickEllipsoid
wallw-teal Apr 29, 2019
ed1a495
Merge branch 'master' into fix-draw-clamped-to-ground
wallw-teal May 1, 2019
a49a204
chore(package): as long as we're upgrading, use the latest
wallw-teal May 2, 2019
94a7591
fix(cesium): do not show ground atmosphere
wallw-teal May 2, 2019
a1e03ab
chore(package): upgrade Cesium to latest
wallw-teal Jul 1, 2019
f3bac98
fix(cesium): ensure polylines always use the correct interpolation me…
wallw-teal Jul 8, 2019
8e22e85
feat: altitudeMode is now set on edited geometries
wallw-teal Jul 8, 2019
077d520
Merge branch 'master' into fix-draw-clamped-to-ground
wallw-teal Jul 8, 2019
fb2143a
Merge branch 'master' into fix-draw-clamped-to-ground
wallw-teal Jul 9, 2019
70ff1a8
test: add check to avoid null map container
wallw-teal Jul 9, 2019
17c5cdd
Merge remote-tracking branch 'origin/master' into fix-draw-clamped-to…
wallw-teal Jul 15, 2019
fec2483
fix(cesium): disable scene.highDynamicRange
wallw-teal Jul 15, 2019
c15eb28
fix(cesium): sync heightReference on updates
wallw-teal Jul 15, 2019
38db323
fix(cesium): add scene.highDynamicRange to externs
wallw-teal Jul 17, 2019
48d3d31
fix(feature): quit updating the feature/geometry so often
wallw-teal Jul 19, 2019
32c2ec7
fix(kml): polygons should write out primitive geom options
wallw-teal Jul 23, 2019
ff788cb
fix: handle altitudeMode arrays from multigeoms and collections
wallw-teal Jul 24, 2019
a6f7f46
chore(package): upgrade Cesium to 1.60
wallw-teal Aug 5, 2019
cd1b79c
fix(cesium): fix heightReference updates as classes
wallw-teal Aug 5, 2019
40e599d
fix(places): clone on missing geom as well
wallw-teal Aug 7, 2019
639b9f0
fix(feature): save alt mode to correct geom
wallw-teal Aug 8, 2019
19a3896
fix(cesium): fix hover for specific altitude modes
wallw-teal Aug 12, 2019
b22fe3d
Merge branch 'master' into fix-draw-clamped-to-ground
wallw-teal Aug 13, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 101 additions & 75 deletions externs/Cesium.externs.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,26 @@ Cesium.BlendOption = {
};


/**
* @enum {number}
*/
Cesium.ArcType = {
NONE: 0,
GEODESIC: 1,
RHUMB: 2
};


/**
* @enum {number}
*/
Cesium.ClassificationType = {
TERRAIN: 0,
CESIUM_3D_TILE: 1,
BOTH: 2,
NUMBER_OF_CLASSIFICATION_TYPES: 3
};


/**
* @constructor
Expand Down Expand Up @@ -1568,6 +1588,12 @@ Cesium.Globe.prototype.enableLighting;
Cesium.Globe.prototype.depthTestAgainstTerrain;


/**
* @type {boolean}
*/
Cesium.Globe.prototype.showGroundAtmosphere;


/**
* @param {!Cesium.Cartographic} cartographic
* @return {number|undefined}
Expand Down Expand Up @@ -1877,6 +1903,47 @@ Cesium.optionsGroundPrimitive;
Cesium.GroundPrimitive = function(opt_opts) {};


/**
* @constructor
* @param {Cesium.optionsGroundPolylinePrimitive} opt_opts
* @extends {Cesium.Primitive}
*/
Cesium.GroundPolylinePrimitive = function(opt_opts) {};


/**
* @typedef {{
* geometryInstances: (!Cesium.GeometryInstance|!Array<!Cesium.GeometryInstance>),
* appearance: !Cesium.Appearance,
* show: (boolean|undefined),
* interleave: (boolean|undefined),
* releaseGeometryInstances: (boolean|undefined),
* allowPicking: (boolean|undefined),
* asynchronous: (boolean|undefined),
* classificationType: (Cesium.ClassificationType|undefined)
* }}
*/
Cesium.optionsGroundPolylinePrimitive;


/**
* @constructor
* @param {Cesium.optionsGroundPolylineGeometry=} opt_opts
*/
Cesium.GroundPolylineGeometry = function(opt_opts) {};


/**
* @typedef {{
* positions: Array<Cesium.Cartesian3>,
* width: (number|undefined),
* granularity: (number|undefined),
* loop: (boolean|undefined),
* arcType: (Cesium.ArcType|undefined)
* }}
*/
Cesium.optionsGroundPolylineGeometry;


/**
* @constructor
Expand Down Expand Up @@ -1968,82 +2035,27 @@ Cesium.LabelCollection = function(opt_options) {};


/**
* @constructor
* @struct
*/
Cesium.optionsLabelCollection = function() {};


/**
* @type {string| undefined}
*/
Cesium.optionsLabelCollection.prototype.text;


/**
* @type {string| undefined}
*/
Cesium.optionsLabelCollection.prototype.font;


/**
* @type {Cesium.Cartesian2| undefined}
*/
Cesium.optionsLabelCollection.prototype.pixelOffset;


/**
* @type {Cesium.Cartesian3|undefined}
*/
Cesium.optionsLabelCollection.prototype.position;


/**
* @type {Cesium.Color|undefined}
*/
Cesium.optionsLabelCollection.prototype.fillColor;


/**
* @type {Cesium.Color|undefined}
*/
Cesium.optionsLabelCollection.prototype.outlineColor;


/**
* @type {number|undefined}
*/
Cesium.optionsLabelCollection.prototype.outlineWidth;


/**
* @type {boolean|undefined}
*/
Cesium.optionsLabelCollection.prototype.show;


/**
* @type {number|undefined}
*/
Cesium.optionsLabelCollection.prototype.style;


/**
* @type {Cesium.HorizontalOrigin|undefined}
*/
Cesium.optionsLabelCollection.prototype.horizontalOrigin;


/**
* @type {Cesium.VerticalOrigin|undefined}
*/
Cesium.optionsLabelCollection.prototype.verticalOrigin;


/**
* @type {Cesium.HeightReference|undefined}
* @typedef {{
* show: (boolean|undefined),
* position: (Cesium.Cartesian3|undefined),
* text: (string|undefined),
* font: (string|undefined),
* fillColor: (Cesium.Color|undefined),
* outlineColor: (Cesium.Color|undefined),
* outlineWidth: (number|undefined),
* showBackground: (boolean|undefined),
* backgroundColor: (Cesium.Color|undefined),
* backgroundPadding: (Cesium.Cartesian2|undefined),
* style: (Cesium.LabelStyle|undefined),
* pixelOffset: (Cesium.Cartesian2|undefined),
* eyeOffset: (Cesium.Cartesian3|undefined),
* horizontalOrigin: (Cesium.HorizontalOrigin|undefined),
* verticalOrigin: (Cesium.VerticalOrigin|undefined),
* scale: (number|undefined),
* heightReference: (Cesium.HeightReference|undefined)
* }}
*/
Cesium.optionsLabelCollection.prototype.heightReference;
Cesium.optionsLabelCollection;


/**
Expand Down Expand Up @@ -2642,6 +2654,7 @@ Cesium.Transforms.headingPitchRollToFixedFrame = function(origin, hpr, opt_ellip
* Cesium.BillboardCollection|Cesium.Billboard|
* Cesium.LabelCollection|Cesium.Label|
* Cesium.PrimitiveCollection|Cesium.Primitive|
* Cesium.GroundPrimitive|Cesium.GroundPolylinePrimitive|
* Cesium.Cesium3DTileset)
* }
*/
Expand Down Expand Up @@ -3970,6 +3983,13 @@ Cesium.Scene.prototype.context;
Cesium.Scene.prototype.fog;



/**
* @type {!boolean}
*/
Cesium.Scene.prototype.highDynamicRange;


/**
*/
Cesium.Scene.prototype.initializeFrame = function() {};
Expand Down Expand Up @@ -4074,6 +4094,12 @@ Cesium.Scene.prototype.mode;
Cesium.Scene.prototype.primitives;


/**
* @type {!Cesium.PrimitiveCollection}
*/
Cesium.Scene.prototype.groundPrimitives;


/**
* @type {Object}
*/
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@
"blob-polyfill": "^2.0.20171115",
"bootstrap": "4.3.1",
"bootswatch": "4.3.1",
"cesium": "1.49.0",
"cesium": "1.60",
"compass-mixins": "^0.12.10",
"crossfilter2": "^1.4.5",
"d3": "^3.5.17",
Expand Down
1 change: 1 addition & 0 deletions src/os/data/recordfield.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ goog.require('goog.object');
*/
os.data.RecordField = {
ALPHA: 'alpha',
ALTITUDE_MODE: 'altitudeMode',
COLOR: 'color',
ELLIPSE: 'ellipse',
GEOM: 'geometry',
Expand Down
5 changes: 3 additions & 2 deletions src/os/feature/feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,10 +526,11 @@ os.feature.setAltitude = function(feature, opt_field) {
* @param {ol.Feature} feature The feature
* @param {boolean=} opt_replace If existing values should be replaced
* @param {ol.geom.Geometry=} opt_geometry Alternate geometry to populate the fields
* @param {boolean=} opt_silent
*
* @suppress {accessControls} To allow direct access to feature metadata.
*/
os.feature.populateCoordFields = function(feature, opt_replace, opt_geometry) {
os.feature.populateCoordFields = function(feature, opt_replace, opt_geometry, opt_silent) {
var changed = false;
var geom = opt_geometry || feature.getGeometry();
if (geom instanceof ol.geom.Point) {
Expand Down Expand Up @@ -582,7 +583,7 @@ os.feature.populateCoordFields = function(feature, opt_replace, opt_geometry) {
}

// fire a change event if anything was updated, so the UI can update
if (changed) {
if (!opt_silent && changed) {
feature.changed();
}
};
Expand Down
1 change: 1 addition & 0 deletions src/os/mapcontainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,7 @@ os.MapContainer.prototype.init = function() {
this.drawingLayer_.setSticky(true);
this.drawingLayer_.setSynchronizerType(os.layer.SynchronizerType.DRAW);
this.drawingLayer_.renderLegend = goog.nullFunction;
this.drawingLayer_.set(os.data.RecordField.ALTITUDE_MODE, os.webgl.AltitudeMode.CLAMP_TO_GROUND);

var tileGroup = new os.layer.Group();
tileGroup.setPriority(-2);
Expand Down
45 changes: 45 additions & 0 deletions src/os/mixin/geometrymixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,51 @@ ol.geom.Geometry.prototype.toLonLat = function() {
return this;
};

(function() {
var oldPoints = ol.geom.MultiPoint.prototype.getPoints;

/**
* @return {Array<ol.geom.Point>}
* @suppress {accessControls}
*/
ol.geom.MultiPoint.prototype.getPoints = function() {
var points = oldPoints.call(this);
for (var i = 0, n = points.length; i < n; i++) {
ol.obj.assign(points[i].values_, this.values_);
}
return points;
};

var oldLines = ol.geom.MultiLineString.prototype.getLineStrings;

/**
* @return {Array<ol.geom.LineString>}
* @suppress {accessControls}
*/
ol.geom.MultiLineString.prototype.getLineStrings = function() {
var lines = oldLines.call(this);
for (var i = 0, n = lines.length; i < n; i++) {
ol.obj.assign(lines[i].values_, this.values_);
}
return lines;
};


var oldPolys = ol.geom.MultiPolygon.prototype.getPolygons;

/**
* @return {Array<ol.geom.Polygon>}
* @suppress {accessControls}
*/
ol.geom.MultiPolygon.prototype.getPolygons = function() {
var polys = oldPolys.call(this);
for (var i = 0, n = polys.length; i < n; i++) {
ol.obj.assign(polys[i].values_, this.values_);
}
return polys;
};
})();


(function() {
/**
Expand Down
22 changes: 22 additions & 0 deletions src/os/mixin/polygonmixin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
goog.provide('os.mixin.polygon');

goog.require('ol.geom.Polygon');


(function() {
var old = ol.geom.Polygon.prototype.getLinearRings;

/**
* @return {Array<ol.geom.LinearRing>}
* @suppress {accessControls}
*/
ol.geom.Polygon.prototype.getLinearRings = function() {
var rings = old.call(this);

for (var i = 0, n = rings.length; i < n; i++) {
ol.obj.assign(rings[i].values_, this.values_);
}

return rings;
};
})();
Loading