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

Add Rhumb Line Support to Polygon and Polyline Geometries #7492

Merged
merged 27 commits into from Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f473014
Initial implementation of using rhumb lines limited to PolygonGeometry
shehzan10 Jan 8, 2019
ba3a6dc
Rhumb lines working on PolygonGeometry with geojson load
shehzan10 Jan 8, 2019
0248d9e
Add enum for LineType.STRAIGHT
shehzan10 Jan 14, 2019
f90b6d4
Add rhumb line support to polygon and polyline geometry with extrude …
shehzan10 Jan 14, 2019
5be47b2
Add lineType support to GeoJsonDataSource
shehzan10 Jan 14, 2019
7c60e88
Add rhumb line support to GroundPolylineGeometry
shehzan10 Jan 14, 2019
d9db99a
Rename EllipsoidRhumb -> EllipsoidRhumbLine
shehzan10 Jan 15, 2019
6362be5
Fix GroundPolylineGeometry across PM and IDL, Add granularity, lineTy…
shehzan10 Jan 15, 2019
4c2141d
Add tests for all the classes where LineType is used
shehzan10 Jan 16, 2019
9cbc248
Remove usage of EllipsoidRhumbLine.fromStartAndEnd
shehzan10 Jan 17, 2019
851a21e
Fix propagation of lineType from shadow volume
shehzan10 Jan 17, 2019
39e6d95
Add rhumb line polygons and polylines to sandcastle examples
shehzan10 Jan 17, 2019
739eb52
Update CHANGES.md
shehzan10 Jan 18, 2019
62b28a8
Fix tests failing because of ground primitives
shehzan10 Jan 18, 2019
2745a2d
Revert inadvertent change to sandcastle
shehzan10 Jan 18, 2019
0f4e088
Merge remote-tracking branch 'upstream' into rhumb-lines
shehzan10 Jan 21, 2019
9ee96b7
Add PR numbers to CHANGES.md
shehzan10 Jan 21, 2019
a47ebd1
Fixes from PR comments
shehzan10 Jan 22, 2019
1dcdbe2
Some more fixes from PR review
shehzan10 Jan 23, 2019
1883350
Check polyline difference after update
shehzan10 Jan 23, 2019
6584a8f
Typo
shehzan10 Jan 23, 2019
b2e70ed
Remove lineType option from GeoJsonDataSource. Always uses RHUMB lines
shehzan10 Jan 23, 2019
81b2ecb
Add checks for invalid lineType option, cleaner checks in constructors
shehzan10 Jan 23, 2019
ce9f96b
Better desciption of changing followSurface to lineType in CHANGES.md
shehzan10 Jan 23, 2019
96d25d5
Change LineType to ArcType, LineType.STRAIGHT to ArcType.NONE
shehzan10 Jan 24, 2019
763aa70
Fix ordering of defines for ArcType
shehzan10 Jan 24, 2019
5f7a7ac
Fixes for PR comments: Remove followSurface from doc, remove redundan…
shehzan10 Jan 24, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions Apps/Sandcastle/gallery/Polygon.html
Expand Up @@ -125,6 +125,21 @@
}
});

var purplePolygonUsingRhumbLines = viewer.entities.add({
name : 'Purple polygon using rhumb lines with outline',
polygon : {
hierarchy : Cesium.Cartesian3.fromDegreesArray([-120.0, 45.0,
-80.0, 45.0,
-80.0, 55.0,
-120.0, 55.0]),
extrudedHeight: 50000,
material : Cesium.Color.PURPLE,
outline : true,
outlineColor : Cesium.Color.MAGENTA,
arcType : Cesium.ArcType.RHUMB
}
});

viewer.zoomTo(viewer.entities);//Sandcastle_End
Sandcastle.finishedLoading();
}
Expand Down
13 changes: 12 additions & 1 deletion Apps/Sandcastle/gallery/Polyline.html
Expand Up @@ -40,6 +40,17 @@
}
});

var greenRhumbLine = viewer.entities.add({
name : 'Green rhumb line',
polyline : {
positions : Cesium.Cartesian3.fromDegreesArray([-75, 35,
-125, 35]),
width : 5,
arcType : Cesium.ArcType.RHUMB,
material : Cesium.Color.GREEN
}
});

var glowingLine = viewer.entities.add({
name : 'Glowing blue line on the surface',
polyline : {
Expand Down Expand Up @@ -73,7 +84,7 @@
positions : Cesium.Cartesian3.fromDegreesArrayHeights([-75, 43, 500000,
-125, 43, 500000]),
width : 10,
followSurface : false,
arcType : Cesium.ArcType.NONE,
material : new Cesium.PolylineArrowMaterialProperty(Cesium.Color.PURPLE)
}
});
Expand Down
21 changes: 21 additions & 0 deletions Apps/Sandcastle/gallery/development/Ground Primitive.html
Expand Up @@ -31,6 +31,7 @@
terrainProvider: Cesium.createWorldTerrain()
});
var scene = viewer.scene;
viewer.extend(Cesium.viewerCesiumInspectorMixin);

function offsetPositions(positions, degreeOffset) {
positions = scene.globe.ellipsoid.cartesianArrayToCartographicArray(positions);
Expand Down Expand Up @@ -325,6 +326,26 @@
}),
classificationType : Cesium.ClassificationType.TERRAIN
}));

// Rhumb line polygon geometry
scene.groundPrimitives.add(new Cesium.GroundPrimitive({
geometryInstances : new Cesium.GeometryInstance({
geometry : new Cesium.PolygonGeometry({
polygonHierarchy: new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArray([
-130, 55,
-100, 55,
-100, 45,
-130, 45
])),
arcType : Cesium.ArcType.RHUMB
}),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(new Cesium.Color(1.0, 1.0, 0.0, 0.5))
},
id : 'rhumbPolygon'
}),
classificationType : Cesium.ClassificationType.TERRAIN
}));
});

Sandcastle.reset = function() {
Expand Down
14 changes: 14 additions & 0 deletions Apps/Sandcastle/gallery/development/Polylines.html
Expand Up @@ -119,6 +119,20 @@
})
});
Sandcastle.declare(fadingPolyline); // For highlighting on mouseover in Sandcastle.

// A rhumb line with two points.
var rhumbLine = polylines.add({
positions : Cesium.PolylinePipeline.generateCartesianRhumbArc({
positions : Cesium.Cartesian3.fromDegreesArray([-130.0, 30.0,
-75.0, 30.0])
}),
width: 5,
material : Cesium.Material.fromType('Color', {
color : new Cesium.Color(0.0, 1.0, 0.0, 1.0)
})
});
Sandcastle.declare(rhumbLine); // For highlighting on mouseover in Sandcastle.

}

var viewer = new Cesium.Viewer('cesiumContainer');
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
Expand Up @@ -9,6 +9,8 @@ Change Log

##### Deprecated :hourglass_flowing_sand:
* `Scene.clampToHeight` now takes an optional `width` argument before the `result` argument. The previous function definition will no longer work in 1.56. [#7287](https://github.com/AnalyticalGraphicsInc/cesium/pull/7287)
* `PolylineGeometry.followSurface` has been superceded by `PolylineGeometry.arcType`. The previous definition will no longer work in 1.57. Replace `followSurface: false` with `arcType: Cesium.ArcType.NONE` and `followSurface: true` with `arcType: Cesium.ArcType.GEODESIC`. [#7492](https://github.com/AnalyticalGraphicsInc/cesium/pull/7492)
* `SimplePolylineGeometry.followSurface` has been superceded by `SimplePolylineGeometry.arcType`. The previous definition will no longer work in 1.57. Replace `followSurface: false` with `arcType: Cesium.ArcType.NONE` and `followSurface: true` with `arcType: Cesium.ArcType.GEODESIC`. [#7492](https://github.com/AnalyticalGraphicsInc/cesium/pull/7492)

##### Additions :tada:
* Added support for textured ground entities (entities with unspecified `height`) and `GroundPrimitives` on 3D Tiles. [#7434](https://github.com/AnalyticalGraphicsInc/cesium/pull/7434)
Expand All @@ -17,6 +19,7 @@ Change Log
* Added the ability to specify the width of the intersection volume for `Scene.sampleHeight`, `Scene.clampToHeight`, `Scene.sampleHeightMostDetailed`, and `Scene.clampToHeightMostDetailed`. [#7287](https://github.com/AnalyticalGraphicsInc/cesium/pull/7287)
* Added a [new Sandcastle example](https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=Time%20Dynamic%20Wheels.html) on using `nodeTransformations` to rotate a model's wheels based on its velocity. [#7361](https://github.com/AnalyticalGraphicsInc/cesium/pull/7361)
* Added `EllipsoidRhumbLine` class as a rhumb line counterpart to `EllipsoidGeodesic`. [#7484](https://github.com/AnalyticalGraphicsInc/cesium/pull/7484)
* Added rhumb line support to `PolygonGeometry`, `PolygonOutlineGeometry`, `PolylineGeometry`, `GroundPolylineGeometry`, and `SimplePolylineGeometry`. [#7492](https://github.com/AnalyticalGraphicsInc/cesium/pull/7492)

##### Fixes :wrench:
* Fixed 3D Tiles performance regression. [#7482](https://github.com/AnalyticalGraphicsInc/cesium/pull/7482)
Expand All @@ -28,6 +31,7 @@ Change Log
* Fixed Sandcastle's "Open in New Window" button not displaying imagery due to blob URI limitations. [#7250](https://github.com/AnalyticalGraphicsInc/cesium/pull/7250)
* Fixed an issue where setting `scene.globe.cartographicLimitRectangle` to `undefined` would cause a crash. [#7477](https://github.com/AnalyticalGraphicsInc/cesium/issues/7477)
* Fixed `PrimitiveCollection.removeAll` to no longer `contain` removed primitives. [#7491](https://github.com/AnalyticalGraphicsInc/cesium/pull/7491)
* Fixed `GeoJsonDataSource` to use polygons and polylines that use rhumb lines. [#7492](https://github.com/AnalyticalGraphicsInc/cesium/pull/7492)

### 1.53 - 2019-01-02

Expand Down
39 changes: 39 additions & 0 deletions Source/Core/ArcType.js
@@ -0,0 +1,39 @@
define([
'./freezeObject'
], function(
freezeObject) {
'use strict';

/**
* ArcType defines the path that should be taken connecting vertices.
*
* @exports ArcType
*/
var ArcType = {
/**
* Straight line that does not conform to the surface of the ellipsoid.
*
* @type {Number}
* @constant
*/
NONE : 0,

/**
* Follow geodesic path.
*
* @type {Number}
* @constant
*/
GEODESIC : 1,

/**
* Follow rhumb or loxodrome path.
*
* @type {Number}
* @constant
*/
RHUMB : 2
};

return freezeObject(ArcType);
});