Skip to content

Commit

Permalink
Merge pull request #7492 from shehzan10/rhumb-lines
Browse files Browse the repository at this point in the history
Add Rhumb Line Support to Polygon and Polyline Geometries
  • Loading branch information
Hannah authored Jan 24, 2019
2 parents 99717a8 + 5f7a7ac commit 9892e1d
Show file tree
Hide file tree
Showing 33 changed files with 1,514 additions and 103 deletions.
15 changes: 15 additions & 0 deletions Apps/Sandcastle/gallery/Polygon.html
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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);
});
Loading

0 comments on commit 9892e1d

Please sign in to comment.