Change examples/demos structure

This commit is contained in:
Éric Lemoine
2012-09-28 13:31:36 +02:00
parent 3910318f1b
commit e3cef24f5f
15 changed files with 29 additions and 147 deletions

5
.gitignore vendored
View File

@@ -6,6 +6,5 @@
/build/ol-all.js
/build/proj4js-combined.js
/build/require-all.js
/demos/*/advanced-optimizations.*
/demos/*/build.html
/demos/*/index.html
/demos/*.json
/demos/*.combined.js

View File

@@ -4,6 +4,7 @@ PLOVR_JAR = bin/plovr-b254c26318c5.jar
SPEC = $(shell find test/spec -name \*.js)
SRC = $(shell find exports externs src/ol -name \*.js)
TARGETS = $(shell find demos -name advanced-optimizations.js)
EXAMPLES = $(shell find demos -maxdepth 1 -name \*.html)
comma := ,
empty :=
space := $(empty) $(empty)
@@ -32,77 +33,19 @@ build/require-all.js: $(SRC)
( echo "goog.require('goog.dom');" ; find src/ol -name \*.js | xargs grep -rh ^goog.provide | sort | uniq | sed -e 's/provide/require/g' ) >$@
.PHONY: demos
demos: demos/full-screen demos/proj4js demos/side-by-side demos/two-layers
demos: $(subst .html,.json,$(EXAMPLES))
.PHONY: demos/proj4js
demos/proj4js: \
demos/proj4js/build.html \
demos/proj4js/index.html
demos/%.json: base.json
@echo "{\"id\": \"$(basename $(notdir $@))\", \"inherits\": \"../base.json\", \"inputs\": \"$(subst .json,.js,$@)\"}" > $@
demos/proj4js/build.html: demos/proj4js/template.html.in
sed -e 's|@SRC@|../../build/ol.js|' $< >$@
demos/proj4js/index.html: demos/proj4js/template.html.in
sed -e 's|@SRC@|http://localhost:9810/compile?id=ol|' $< >$@
.PHONY: demos/full-screen
demos/full-screen: \
demos/full-screen/advanced-optimizations.html \
demos/full-screen/advanced-optimizations.js \
demos/full-screen/index.html
demos/full-screen/advanced-optimizations.html: demos/full-screen/template.html.in
sed -e 's|@SRC@|advanced-optimizations.js|' $< >$@
demos/full-screen/advanced-optimizations.js: $(PLOVR_JAR) $(SRC) base.json \
demos/full-screen/full-screen.json demos/full-screen/full-screen.js
java -jar $(PLOVR_JAR) build demos/full-screen/full-screen.json >$@
demos/%.combined.js: $(PLOVR_JAR) base.json demos/%.js
java -jar $(PLOVR_JAR) build $(subst .combined.js,.json,$@) >$@
@echo $@ "uncompressed:" $$(wc -c <$@) bytes
@echo $@ " compressed:" $$(gzip -9 -c <$@ | wc -c) bytes
demos/full-screen/index.html: demos/full-screen/template.html.in
sed -e 's|@SRC@|../loader.js?id=demo-full-screen|' $< >$@
.PHONY: demos/side-by-side
demos/side-by-side: \
demos/side-by-side/advanced-optimizations.html \
demos/side-by-side/advanced-optimizations.js \
demos/side-by-side/index.html
demos/side-by-side/advanced-optimizations.html: demos/side-by-side/template.html.in
sed -e 's|@SRC@|advanced-optimizations.js|' $< >$@
demos/side-by-side/advanced-optimizations.js: $(PLOVR_JAR) $(SRC) base.json \
demos/side-by-side/side-by-side.json demos/side-by-side/side-by-side.js
java -jar $(PLOVR_JAR) build demos/side-by-side/side-by-side.json >$@
@echo $@ "uncompressed:" $$(wc -c <$@) bytes
@echo $@ " compressed:" $$(gzip -9 -c <$@ | wc -c) bytes
demos/side-by-side/index.html: demos/side-by-side/template.html.in
sed -e 's|@SRC@|../loader.js?id=demo-side-by-side|' $< >$@
.PHONY: demos/two-layers
demos/two-layers: \
demos/two-layers/advanced-optimizations.html \
demos/two-layers/advanced-optimizations.js \
demos/two-layers/index.html
demos/two-layers/advanced-optimizations.html: demos/two-layers/template.html.in
sed -e 's|@SRC@|advanced-optimizations.js|' $< >$@
demos/two-layers/advanced-optimizations.js: $(PLOVR_JAR) $(SRC) base.json \
demos/two-layers/two-layers.json demos/two-layers/two-layers.js
java -jar $(PLOVR_JAR) build demos/two-layers/two-layers.json >$@
@echo $@ "uncompressed:" $$(wc -c <$@) bytes
@echo $@ " compressed:" $$(gzip -9 -c <$@ | wc -c) bytes
demos/two-layers/index.html: demos/two-layers/template.html.in
sed -e 's|@SRC@|../loader.js?id=demo-two-layers|' $< >$@
.PHONY: serve
serve: $(PLOVR_JAR) build/require-all.js
java -jar $(PLOVR_JAR) serve build/*.json demos/*/*.json
java -jar $(PLOVR_JAR) serve build/*.json demos/*.json
.PHONY: lint
lint: build/lint-src-timestamp build/lint-spec-timestamp
@@ -138,8 +81,8 @@ clean:
rm -f build/ol.js
rm -f build/ol-all.js
rm -f build/require-all.js
rm -f demos/*/advanced-optimizations.*
rm -f demos/*/index.html
rm -f demos/*.json
rm -f demos/*.combined.js
rm -rf build/apidoc
reallyclean: clean

View File

@@ -1,32 +0,0 @@
<!doctype html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<style type="text/css">
html, body, #map {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
</style>
<link rel="stylesheet" href="../../css/ol.css" type="text/css">
<title>ol3 full-screen demo</title>
</head>
<body>
<div id="map"></div>
<script src="../../build/ol.js" type="text/javascript"></script>
<script type="text/javascript">
var layer = new ol.layer.TileLayer({
source: new ol.source.MapQuestOpenAerial()
});
var map = new ol.Map(document.getElementById('map'), {
center: new ol.Coordinate(0, 0),
layers: new ol.Collection([layer]),
zoom: 0
});
</script>
</body>
</html>

View File

@@ -10,11 +10,11 @@
height: 100%;
}
</style>
<link rel="stylesheet" href="../../css/ol.css" type="text/css">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<title>ol3 full-screen demo</title>
</head>
<body>
<div id="map"></div>
<script src="@SRC@" type="text/javascript"></script>
<script src="loader.js?id=full-screen" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,9 +0,0 @@
{
"id": "demo-full-screen",
"inherits": "../../base.json",
"inputs": "demos/full-screen/full-screen.js"
}

13
demos/proj4js.html Normal file
View File

@@ -0,0 +1,13 @@
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<script src="http://svn.osgeo.org/metacrs/proj4js/trunk/lib/proj4js-compressed.js" type="text/javascript"></script>
<title>ol3 proj4js demo</title>
</head>
<body>
<h1>ol3 proj4js demo</h1>
<div id="output"></div>
<script src="loader.js?id=proj4js" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,14 +0,0 @@
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="../../css/ol.css" type="text/css">
<script src="../../build/proj4js-combined.js" type="text/javascript"></script>
<script src="@SRC@" type="text/javascript"></script>
<title>ol3 proj4js demo</title>
</head>
<body>
<h1>ol3 proj4js demo</h1>
<div id="output"></div>
<script src="proj4js.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -8,7 +8,7 @@
border: thin solid;
}
</style>
<link rel="stylesheet" href="../../css/ol.css" type="text/css">
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<title>ol3 side-by-side demo</title>
</head>
<body>
@@ -67,6 +67,6 @@
</tr>
</table>
<p><b>Notes:</b> The two maps share the same center, resolution, rotation and layers. Currently the DOM map does not support rotation.</p>
<script src="@SRC@" type="text/javascript"></script>
<script src="loader.js?id=side-by-side" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,9 +0,0 @@
{
"id": "demo-side-by-side",
"inherits": "../../base.json",
"inputs": "demos/side-by-side/side-by-side.js"
}

View File

@@ -28,6 +28,6 @@
</td>
</tr>
</table>
<script src="@SRC@" type="text/javascript"></script>
<script src="loader.js?id=two-layers" type="text/javascript"></script>
</body>
</html>

View File

@@ -1,9 +0,0 @@
{
"id": "demo-two-layers",
"inherits": "../../base.json",
"inputs": "demos/two-layers/two-layers.js"
}