Skip to content

Commit

Permalink
Merge pull request #155 from AnalyticalGraphicsInc/polygonHoleSupport
Browse files Browse the repository at this point in the history
Polygon Hierarchy
  • Loading branch information
pjcozzi committed Aug 15, 2012
2 parents 53df7e3 + b5b8d70 commit b5b1cd2
Show file tree
Hide file tree
Showing 5 changed files with 912 additions and 663 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -31,6 +31,7 @@ Beta Releases
For more details, go to the [Fabric wiki page](https://github.com/AnalyticalGraphicsInc/cesium/wiki/Fabric).

* All `Quaternion` operations now have static versions that work with any objects exposing `x`, `y`, `z` and `w` properties.
* Added support for nested polygons with holes. See `Polygon.configureFromPolygonHierarchy`.

### b7 - 08/01/2012

Expand Down
47 changes: 47 additions & 0 deletions Examples/Sandbox/CodeSnippets/Polygon.js
Expand Up @@ -31,6 +31,53 @@
};
};

Sandbox.NestedPolygon = function(scene, ellipsoid, primitives) {
this.code = function () {
var hierarchy = {
positions : ellipsoid.cartographicArrayToCartesianArray([
new Cesium.Cartographic.fromDegrees(-109.0, 35.0, 0.0),
new Cesium.Cartographic.fromDegrees(-95.0, 35.0, 0.0),
new Cesium.Cartographic.fromDegrees(-95.0, 40.0, 0.0),
new Cesium.Cartographic.fromDegrees(-109.0, 40.0, 0.0)
]),
holes : [{
positions : ellipsoid.cartographicArrayToCartesianArray([
new Cesium.Cartographic.fromDegrees(-107.0, 36.0, 0.0),
new Cesium.Cartographic.fromDegrees(-107.0, 39.0, 0.0),
new Cesium.Cartographic.fromDegrees(-97.0, 39.0, 0.0),
new Cesium.Cartographic.fromDegrees(-97.0, 36.0, 0.0)
]),
holes : [{
positions : ellipsoid.cartographicArrayToCartesianArray([
new Cesium.Cartographic.fromDegrees(-105.0, 36.5, 0.0),
new Cesium.Cartographic.fromDegrees(-99.0, 36.5, 0.0),
new Cesium.Cartographic.fromDegrees(-99.0, 38.5, 0.0),
new Cesium.Cartographic.fromDegrees(-105.0, 38.5, 0.0)
]),
holes : [{
positions : ellipsoid.cartographicArrayToCartesianArray([
new Cesium.Cartographic.fromDegrees(-103.0, 37.25, 0.0),
new Cesium.Cartographic.fromDegrees(-101.0, 37.25, 0.0),
new Cesium.Cartographic.fromDegrees(-101.0, 37.75, 0.0),
new Cesium.Cartographic.fromDegrees(-103.0, 37.75, 0.0)
])
}]
}]
}]
};
var polygon = new Cesium.Polygon();
polygon.configureFromPolygonHierarchy(hierarchy);
primitives.add(polygon);

};

this.camera = {
eye : new Cesium.Cartesian3(-1280476.6605044599, -6108296.327862781, 4770090.478198281),
target : new Cesium.Cartesian3(0.16300940344701773, 0.7776086602705017, -0.6072501180404701),
up : new Cesium.Cartesian3(0.12458922984093211, 0.5943317505129697, 0.7945107262585154)
};
};

Sandbox.PolygonColor = function (scene, ellipsoid, primitives) {
this.code = function () {
var polygon = new Cesium.Polygon(undefined);
Expand Down
1 change: 1 addition & 0 deletions Examples/Sandbox/Main.js
Expand Up @@ -70,6 +70,7 @@
var pg = tree.addNode('Polygon', '', null, 'Polygon');
tree.addNode('Draw a polygon', [new Sandbox.Polygon(scene, ellipsoid, primitives)], pg, 'Polygon');
tree.addNode('Draw a polygon using an extent', [new Sandbox.PolygonWithExtent(scene, ellipsoid, primitives)], pg, 'Polygon');
tree.addNode('Draw nested polygons', [new Sandbox.NestedPolygon(scene, ellipsoid, primitives)], pg, 'Polygon');
var mat = tree.addNode('Materials', '', pg, 'Material');
tree.addNode('Modify the default material', [new Sandbox.PolygonColor(scene, ellipsoid, primitives)], mat, 'Material');
tree.addNode('Apply a composite material', [new Sandbox.CompositeMaterial1(scene, ellipsoid, primitives)], mat, 'Material');
Expand Down

0 comments on commit b5b1cd2

Please sign in to comment.