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

GeoJSON defaults #2256

Merged
merged 8 commits into from
Nov 7, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 15 additions & 6 deletions Apps/Sandcastle/gallery/GeoJSON and TopoJSON.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,25 @@
function startup(Cesium) {
"use strict";
//Sandcastle_Begin
//Create the viewer
var viewer = new Cesium.Viewer('cesiumContainer');
Cesium.viewerEntityMixin(viewer);

//Example 1: Load a GeoJSON or TopoJSON file with default settings.
Sandcastle.addDefaultToolbarButton('Basic loading', function() {
//Example 1: Load with default styling.
Sandcastle.addDefaultToolbarButton('Default styling', function() {
viewer.dataSources.add(Cesium.GeoJsonDataSource.fromUrl('../../SampleData/ne_10m_us_states.topojson'));
});

//Example 2: Apply custom graphics to a GeoJSON or TopoJSON file
//based on the metadata contained in the file.
Sandcastle.addToolbarButton('Custom Graphics', function() {
//Example 2: Load with basic styling options.
Sandcastle.addToolbarButton('Basic styling', function() {
viewer.dataSources.add(Cesium.GeoJsonDataSource.fromUrl('../../SampleData/ne_10m_us_states.topojson', {
stroke: Cesium.Color.HOTPINK,
fill: Cesium.Color.PINK,
strokeWidth: 3
}));
});

//Example 3: Apply custom graphics after load.
Sandcastle.addToolbarButton('Custom styling', function() {
//Seed the random number generator for repeatable results.
Cesium.Math.setRandomNumberSeed(0);

Expand Down Expand Up @@ -68,6 +75,8 @@

//Set the polygon material to our random color.
entity.polygon.material = Cesium.ColorMaterialProperty.fromColor(color);
//Outline each polygon in black.
entity.polygon.outlineColor = new Cesium.ConstantProperty(Cesium.Color.BLACK);

//Extrude the polygon based on the state's population. Each entity
//stores the properties for the GeoJSON feature it was created from
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ Change Log

### 1.4 - 2014-12-01

* Deprecated
* The `sourceUri` parameter to `GeoJsonDatasource.load` has been removed, use `options.sourceUri` instead.
* Added geometry outline width support to the `DataSource` layer. This is exposed via the new `outlineWidth` property on `EllipseGraphics`, `EllipsoidGraphics`, `PolygonGraphics`, `RectangleGraphics`, and `WallGraphics`.
* Added `outlineWidth` support to CZML geometry packets.
* Added `stroke-width` support to the GeoJSON simple-style implementation.
* Added `modelMatrix` option to `Primitive` constructor.
* Added the ability to specify global GeoJSON default styling. See the [documentation](http://cesiumjs.org/Cesium/Build/Documentation/GeoJsonDataSource.html) for details.
* Added an options parameter to `GeoJsonDataSource.load`, `GeoJsonDataSource.loadUrl`, and `GeoJsonDataSource.fromUrl` to allow for basic per-instance styling. [Sandcastle example](http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=GeoJSON%20and%20TopoJSON.html&label=Showcases).
* Fixed a bug in `PolylineGeometry` that would cause the geometry to be split across the IDL for 3D only scenes. [#1197](https://github.com/AnalyticalGraphicsInc/cesium/issues/1197)

### 1.3 - 2014-11-03
Expand Down
Loading