Skip to content

Commit

Permalink
Update to Ol3.5 and Cesium 1.9
Browse files Browse the repository at this point in the history
Migrate examples to new ol.source.Vector.
Validate example Geojson data.
  • Loading branch information
gberaudo committed May 12, 2015
1 parent 1528fb4 commit 6b97364
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 143 deletions.
25 changes: 11 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ UNAME := $(shell uname)
SRC_JS_FILES := $(shell find src -type f -name '*.js')
EXAMPLES_JS_FILES := $(shell find examples -type f -name '*.js')
EXAMPLES_HTML_FILES := $(shell find examples -type f -name '*.html')
EXAMPLES_GEOJSON_FILES := $(shell find examples/data/ -name '*.geojson')


.PHONY: all
Expand All @@ -33,7 +34,7 @@ help:
npm-install: .build/node_modules.timestamp

.PHONY: serve
serve: npm-install ol3/build/ol.js ol3/build/ol.css cesium/Build/Cesium/Cesium.js
serve: npm-install ol3/build/olX cesium/Build/Cesium/Cesium.js
node build/serve.js

.PHONY: dist
Expand All @@ -50,8 +51,12 @@ dist-apidoc:
.PHONY: lint
lint: .build/python-venv/bin/gjslint .build/gjslint.timestamp

.build/geojsonhint.timestamp: $(EXAMPLES_GEOJSON_FILES)
$(foreach file,$?, echo $(file); node_modules/geojsonhint/bin/geojsonhint $(file);)
touch $@

.PHONY: check
check: lint dist
check: lint dist .build/geojsonhint.timestamp

.PHONY: clean
clean:
Expand Down Expand Up @@ -79,7 +84,7 @@ cleanall: clean
.build/python-venv/bin/gjslint --jslint_error=all --strict --custom_jsdoc_tags=api $?
touch $@

.build/dist-examples.timestamp: ol3/build/ol-debug.js ol3/build/ol.js ol3/build/ol.css cesium/Build/Cesium/Cesium.js dist/ol3cesium.js $(EXAMPLES_JS_FILES) $(EXAMPLES_HTML_FILES)
.build/dist-examples.timestamp: ol3/build/olX cesium/Build/Cesium/Cesium.js dist/ol3cesium.js $(EXAMPLES_JS_FILES) $(EXAMPLES_HTML_FILES)
node build/parse-examples.js
mkdir -p $(dir $@)
mkdir -p dist/ol3
Expand Down Expand Up @@ -119,17 +124,9 @@ dist/ol3cesium.js: build/ol3cesium.json $(SRC_JS_FILES) ol3/build/ol-externs.js
ol3/build/ol-externs.js:
(cd ol3 && npm install && node tasks/generate-externs.js build/ol-externs.js)

.PHONY: ol3/build/ol.js
ol3/build/ol.js:
(cd ol3 && npm install && python build.py build/ol.js)

.PHONY: ol3/build/ol-debug.js
ol3/build/ol-debug.js:
(cd ol3 && npm install && python build.py build/ol-debug.js)

.PHONY: ol3/build/ol.css
ol3/build/ol.css:
(cd ol3 && npm install && python build.py build/ol.css)
.PHONY: ol3/build/olX
ol3/build/olX:
(cd ol3 && npm install && make build)

# Only generated when cesium/Build/Cesium/Cesium.js does not exist
cesium/Build/Cesium/Cesium.js:
Expand Down
1 change: 1 addition & 0 deletions build/ol3cesium.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"compile": {
"externs": [
"ol3/build/ol-externs.js",
"ol3/externs/esrijson.js",
"externs/olcsx.js",
"Cesium.externs.js"
],
Expand Down
2 changes: 1 addition & 1 deletion cesium
152 changes: 152 additions & 0 deletions examples/data/geojson/vector_data.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
{
"type": "FeatureCollection",
"crs": {
"type": "name",
"properties": {
"name": "EPSG:3857"
}
},
"features": [
{
"type": "Feature",
"geometry": null,
"properties": {
"type": "without geometry as allowed in spec"
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [0, 0, 1e5]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[1e5, 1e5, 1],
[2e5, 2e5, 100000],
[3e5, 3e5, 1000],
[4e5, 4e5, 100000],
[5e5, 5e5, 100],
[6e5, 6e5, 100000],
[7e5, 7e5, 1]
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[4e6, -2e6, 100000],
[8e6, 2e6, 200000]
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [[4e6, 2e6], [8e6, -2e6]]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [
[[-5e6, -1e6, 1e6], [-4e6, 1e6, 1e6], [-3e6, -1e6, 1e6], [-5e6, -1e6, 1e6]]
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "MultiLineString",
"coordinates": [
[[-1e6, -7.5e5], [-1e6, 7.5e5]],
[[1e6, -7.5e5], [1e6, 7.5e5]],
[[-7.5e5, -1e6], [7.5e5, -1e6]],
[[-7.5e5, 1e6], [7.5e5, 1e6]]
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[[
[-5e6, 6e6, 8e5],
[-5e6, 8e6, 8e5],
[-3e6, 8e6, 8e5],
[-3e6, 6e6, 8e5],
[-5e6, 6e6, 8e5]
]],
[[
[-2e6, 6e6, 4e5],
[-2e6, 8e6, 1e5],
[0, 8e6, 0],
[0, 6e6, 0],
[-2e6, 6e6, 4e5]]
],
[[
[1e6, 6e6, 1e5],
[1e6, 8e6, 0],
[3e6, 8e6, 0],
[3e6, 6e6, 0],
[1e6, 6e6, 1e5]
]]
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "MultiPoint",
"coordinates": [
[-5e6, 6e6, 8e5],
[-2e6, 6e6, 4e5],
[1e6, 6e6, 1e5]
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "GeometryCollection",
"geometries": [
{
"type": "LineString",
"coordinates": [[-5e6, -5e6], [0, -5e6]]
},
{
"type": "Point",
"coordinates": [4e6, -5e6]
},
{
"type": "Polygon",
"coordinates": [[
[1e6, -6e6],
[2e6, -4e6],
[3e6, -6e6],
[1e6, -6e6]
]]
}
]
}
}
]
}
4 changes: 2 additions & 2 deletions examples/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ var raster = new ol.layer.Tile({
});

var vector = new ol.layer.Vector({
source: new ol.source.GeoJSON({
projection: 'EPSG:3857',
source: new ol.source.Vector({
format: new ol.format.GeoJSON(),
url: 'data/geojson/countries.geojson'
})
});
Expand Down
129 changes: 4 additions & 125 deletions examples/vectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,131 +111,10 @@ var styleFunction = function(feature, resolution) {
return geo ? styles[geo.getType()] : styles['Point'];
};

var vectorSource = new ol.source.GeoJSON(
/** @type {olx.source.GeoJSONOptions} */ ({
object: {
'type': 'FeatureCollection',
'crs': {
'type': 'name',
'properties': {
'name': 'EPSG:3857'
}
},
'features': [
{
'type': 'Feature',
'geometry': null,
'properties': {
'type': 'without geometry as allowed in spec',
}
},
{
'type': 'Feature',
'geometry': {
'type': 'Point',
'coordinates': [0, 0, 1e5]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'LineString',
'coordinates': [
[1e5, 1e5, 1],
[2e5, 2e5, 100000],
[3e5, 3e5, 1000],
[4e5, 4e5, 100000],
[5e5, 5e5, 100],
[6e5, 6e5, 100000],
[7e5, 7e5, 1]
]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'LineString',
'coordinates': [[4e6, -2e6, 100000], [8e6, 2e6, 200000]]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'LineString',
'coordinates': [[4e6, 2e6], [8e6, -2e6]]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [
[[-5e6, -1e6, 1e6], [-4e6, 1e6, 1e6], [-3e6, -1e6, 1e6]]
]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'MultiLineString',
'coordinates': [
[[-1e6, -7.5e5], [-1e6, 7.5e5]],
[[1e6, -7.5e5], [1e6, 7.5e5]],
[[-7.5e5, -1e6], [7.5e5, -1e6]],
[[-7.5e5, 1e6], [7.5e5, 1e6]]
]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'MultiPolygon',
'coordinates': [
[[
[-5e6, 6e6, 8e5],
[-5e6, 8e6, 8e5],
[-3e6, 8e6, 8e5],
[-3e6, 6e6, 8e5]
]],
[[[-2e6, 6e6, 4e5], [-2e6, 8e6, 1e5], [0, 8e6, 0], [0, 6e6, 0]]],
[[[1e6, 6e6, 1e5], [1e6, 8e6, 0], [3e6, 8e6, 0], [3e6, 6e6, 0]]]
]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'MultiPoint',
'coordinates': [
[-5e6, 6e6, 8e5],
[-2e6, 6e6, 4e5],
[1e6, 6e6, 1e5]
]
}
},
{
'type': 'Feature',
'geometry': {
'type': 'GeometryCollection',
'geometries': [
{
'type': 'LineString',
'coordinates': [[-5e6, -5e6], [0, -5e6]]
},
{
'type': 'Point',
'coordinates': [4e6, -5e6]
},
{
'type': 'Polygon',
'coordinates': [[[1e6, -6e6], [2e6, -4e6], [3e6, -6e6]]]
}
]
}
}
]
}
}));
var vectorSource = new ol.source.Vector({
format: new ol.format.GeoJSON(),
url: 'data/geojson/vector_data.geojson'
});

var theCircle = new ol.Feature(new ol.geom.Circle([5e6, 7e6, 5e5], 1e6));

Expand Down
2 changes: 1 addition & 1 deletion ol3
Submodule ol3 updated from 626d1d to c8bc17
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"devDependencies": {
"closure-util": "0.19.0",
"geojsonhint": "^1.0.0",
"fs-extra": "~0.8.1",
"graceful-fs": "~3.0.2",
"jsdoc": "~3.3.0-alpha7",
Expand Down

0 comments on commit 6b97364

Please sign in to comment.