Skip to content

Commit

Permalink
Merge pull request ngageoint#962 in WV/opensphere from ~SALANKEYJ/ope…
Browse files Browse the repository at this point in the history
…nsphere:THIN-13312 to release

* commit 'e1fd382352336627adf762db6a1cc2797088aef9':
  fix(query): adds special case zooming behavior for the world query
  fix(3d): fixes cesium rendering of the whole world query
  • Loading branch information
jsalankey committed Oct 11, 2019
2 parents 7282f4e + e1fd382 commit 37c8dcc
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 7 deletions.
6 changes: 6 additions & 0 deletions src/os/mapcontainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ goog.require('os.ol.control.MousePosition');
goog.require('os.ol.feature');
goog.require('os.proj');
goog.require('os.proj.switch');
goog.require('os.query');
goog.require('os.source.Vector');
goog.require('os.style');
goog.require('os.style.StyleType');
Expand Down Expand Up @@ -668,6 +669,11 @@ os.MapContainer.prototype.onZoom_ = function(event) {
}).filter(os.fn.filterFalsey);

if (features.length) {
if (this.is3DEnabled() && features.length == 1 && os.query.isWorldQuery(features[0].getGeometry())) {
// while in 3D mode only, handle zooming to the world area by looking at the back of the world
features[0] = os.query.WORLD_ZOOM_FEATURE;
}

os.feature.flyTo(/** @type {Array<ol.Feature>} */ (features));
} else {
var extent = /** @type {!Array<?{geometry: ol.geom.Geometry}>} */ (context).reduce(
Expand Down
32 changes: 31 additions & 1 deletion src/os/query/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,28 @@ os.query.initWorldArea = function(opt_reset) {
os.query.WORLD_EXTENT = [-179.9999999999999, -89.99999999999999, 180, 90];


/**
* The world coordinates in EPSG:4326. This is the max precision that a polygon can handle.
* Note: this includes coordinates at 0 latitude to ensure directionality of the vertical line components in 3D.
* @type {Array<Array<Array<number>>>}
* @const
*/
os.query.WORLD_COORDS = [[
[-179.9999999999999, -89.99999999999999],
[-179.9999999999999, 0],
[-179.9999999999999, 90],
[180, 90],
[180, 0],
[180, -89.99999999999999],
[-179.9999999999999, -89.99999999999999]
]];


/**
* Polygon representing the whole world.
* @type {ol.geom.Polygon}
*/
os.query.WORLD_GEOM = ol.geom.Polygon.fromExtent(os.query.WORLD_EXTENT);
os.query.WORLD_GEOM = new ol.geom.Polygon(os.query.WORLD_COORDS);


/**
Expand All @@ -162,6 +179,19 @@ os.query.WORLD_AREA = new ol.Feature({
});


/**
* Feature representing the area we want to zoom to when zooming to the whole world.
* @type {ol.Feature}
*/
os.query.WORLD_ZOOM_FEATURE = new ol.Feature(new ol.geom.Polygon([[
[179, 90],
[181, 90],
[181, -90],
[179, -90],
[179, 90]
]]));


/**
* Get whether country borders are enabled.
* @return {boolean} Whether or not picking by country is enabled
Expand Down
6 changes: 0 additions & 6 deletions src/plugin/cesium/sync/featureconverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1791,11 +1791,6 @@ plugin.cesium.sync.FeatureConverter.prototype.olGeometryToCesium = function(feat
geomType = 'ellipse';
}

if (geometry.getType() === ol.geom.GeometryType.POLYGON && os.query.isWorldQuery(geometry)) {
// do not show these
return;
}

var heightReference = this.getHeightReference(context.layer, feature, geometry);
if (this.isPrimitiveTypeChanging(heightReference, primitive)) {
// we cannot update it; it must be recreated
Expand Down Expand Up @@ -1853,7 +1848,6 @@ plugin.cesium.sync.FeatureConverter.prototype.olGeometryToCesium = function(feat
case ol.geom.GeometryType.POLYGON:
geometry = /** @type {!ol.geom.Polygon} */ (geometry);
primitive = this.olPolygonGeometryToCesiumPolyline(feature, geometry, context, style);
// primitive = this.olPolygonGeometryToCesium(feature, geometry, context, style);
break;
case ol.geom.GeometryType.MULTI_POINT:
case ol.geom.GeometryType.MULTI_LINE_STRING:
Expand Down

0 comments on commit 37c8dcc

Please sign in to comment.