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

Move clock.js to dynamicData example #657

Merged
merged 1 commit into from
Dec 14, 2016
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
4 changes: 1 addition & 3 deletions docs/developers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ the instrumentation is in place and the page is loaded. The ``startTest`` funct
be called with function as an argument that should be called when page is ready to
run the unit tests. This is provided as a convenience for the default behavior
of :py:func:`selenium_test.BaseTest.wait` with no arguments. Developers can
extend this behavior as necessary to provide more complicated use cases. As an
example, see the ``d3Animation`` test case which sets a custom variable in a callback
script for a test that is run asynchronously.
extend this behavior as necessary to provide more complicated use cases.

The compiled version of these
tests are placed inside the deployment root so the users can manually see the test
Expand Down
5 changes: 0 additions & 5 deletions docs/users.rst
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,6 @@ documentation for each of the classes.
`geo.jsonReader <http://opengeoscience.github.io/geojs/apidocs/geo.jsonReader.html>`_,
which is an extendable geojson reader.

`geo.clock <http://opengeoscience.github.io/geojs/apidocs/geo.clock.html>`_
The clock object is attached to the map and is resposible for maintaining a user
definable concept of time. The clock can run, paused, and restarted. The
clock triggers events on the map to synchronize animations.

The API documentation is in the process of being updated. You can always find the latest version
at `http://opengeoscience.github.io/geojs/apidocs/geo.html <http://opengeoscience.github.io/geojs/apidocs/geo.html>`_.

Expand Down
31 changes: 16 additions & 15 deletions src/clock.js → examples/dynamicData/clock.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
var inherit = require('./inherit');
var object = require('./object');

//////////////////////////////////////////////////////////////////////////////
/**
* Stores the current time for a map, triggers time keeping events, and
Expand All @@ -11,16 +8,14 @@ var object = require('./object');
* @returns {geo.clock}
*/
//////////////////////////////////////////////////////////////////////////////
var clock = function (opts) {
geo.clock = function (opts) {
'use strict';

if (!(this instanceof clock)) {
return new clock(opts);
if (!(this instanceof geo.clock)) {
return new geo.clock(opts);
}
geo.object.call(this, opts);
opts = opts || {};
object.call(this, opts);

var geo_event = require('./event');

//////////////////////////////////////////////////////////////////////////////
/**
Expand Down Expand Up @@ -59,7 +54,7 @@ var clock = function (opts) {
*/
//////////////////////////////////////////////////////////////////////////////
this._attached = function () {
return (m_object instanceof object);
return (m_object instanceof geo.object);
};

//////////////////////////////////////////////////////////////////////////////
Expand All @@ -76,7 +71,7 @@ var clock = function (opts) {

if (m_now !== previous &&
m_this._attached()) {
m_this.object().geoTrigger(geo_event.clock.change, {
m_this.object().geoTrigger(geo.event.clock.change, {
previous: previous,
current: m_now,
clock: m_this
Expand Down Expand Up @@ -269,7 +264,7 @@ var clock = function (opts) {
window.setTimeout(frame, 1000 / m_this.framerate());
}
} else if (m_this._attached()) {
m_this.object().geoTrigger(geo_event.clock[m_this.state()], {
m_this.object().geoTrigger(geo.event.clock[m_this.state()], {
current: m_this.now(),
clock: m_this
});
Expand All @@ -278,7 +273,7 @@ var clock = function (opts) {

// trigger the play event
if (m_this._attached()) {
m_this.object().geoTrigger(geo_event.clock.play, {
m_this.object().geoTrigger(geo.event.clock.play, {
current: m_this.now(),
clock: m_this
});
Expand All @@ -291,7 +286,13 @@ var clock = function (opts) {
window.setTimeout(frame, 1000 / m_this.framerate());
}
};

};

inherit(clock, object);
module.exports = clock;
geo.inherit(geo.clock, geo.object);
geo.event.clock = {
play: 'geo_clock_play',
stop: 'geo_clock_stop',
pause: 'geo_clock_pause',
change: 'geo_clock_change'
};
2 changes: 1 addition & 1 deletion examples/dynamicData/example.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"path": "dynamicData",
"title": "Dynamic Data",
"exampleCss": ["main.css"],
"exampleJs": ["main.js"],
"exampleJs": ["main.js", "clock.js"],
"about": {
"text": "Rendering data that changes with time."
},
Expand Down
3 changes: 2 additions & 1 deletion examples/dynamicData/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ $(function () {
var map = geo.map({node: '#map', zoom: 3});

// Add and start a clock
var clock = map.clock();
var clock = geo.clock();
var omega = 10000;

clock.object(map);
clock.start(0)
.step(1)
.end(omega)
Expand Down
12 changes: 0 additions & 12 deletions src/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,18 +332,6 @@ geo_event.transitioncancel = 'geo_transitioncancel';
//////////////////////////////////////////////////////////////////////////////
geo_event.parallelprojection = 'geo_parallelprojection';

////////////////////////////////////////////////////////////////////////////
/**
* @namespace
*/
////////////////////////////////////////////////////////////////////////////
geo_event.clock = {
play: 'geo_clock_play',
stop: 'geo_clock_stop',
pause: 'geo_clock_pause',
change: 'geo_clock_change'
};

////////////////////////////////////////////////////////////////////////////
/**
* This event object provides mouse/keyboard events that can be handled
Expand Down
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ module.exports = $.extend({
annotationLayer: require('./annotationLayer'),
camera: require('./camera'),
choroplethFeature: require('./choroplethFeature'),
clock: require('./clock'),
contourFeature: require('./contourFeature'),
domRenderer: require('./domRenderer'),
event: require('./event'),
Expand Down
21 changes: 0 additions & 21 deletions src/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ var sceneObject = require('./sceneObject');
* *** Advanced parameters ***
* @param {geo.camera?} camera The camera to control the view
* @param {geo.mapInteractor?} interactor The UI event handler
* @param {geo.clock?} clock The clock used to synchronize time events
* @param {array} [animationQueue] An array used to synchonize animations. If
* specified, this should be an empty array or the same array as passed to
* other map instances.
Expand Down Expand Up @@ -91,7 +90,6 @@ var map = function (arg) {
var registry = require('./registry');
var geo_event = require('./event');
var mapInteractor = require('./mapInteractor');
var clock = require('./clock');
var uiLayer = require('./ui/uiLayer');

////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -119,7 +117,6 @@ var map = function (arg) {
m_validZoomRange = {min: 0, max: 16, origMin: 0},
m_transition = null,
m_queuedTransition = null,
m_clock = null,
m_discreteZoom = arg.discreteZoom ? true : false,
m_allowRotation = (typeof arg.allowRotation === 'function' ?
arg.allowRotation : (arg.allowRotation === undefined ?
Expand Down Expand Up @@ -991,23 +988,6 @@ var map = function (arg) {
return m_this;
};

////////////////////////////////////////////////////////////////////////////
/**
* Get or set the map clock
*/
////////////////////////////////////////////////////////////////////////////
this.clock = function (arg) {
if (arg === undefined) {
return m_clock;
}
m_clock = arg;

if (m_clock) {
m_clock.object(m_this);
}
return m_this;
};

////////////////////////////////////////////////////////////////////////////
/**
* Get or set the min/max zoom range.
Expand Down Expand Up @@ -1972,7 +1952,6 @@ var map = function (arg) {
if (arg.interactor !== null) {
this.interactor(arg.interactor || mapInteractor({discreteZoom: m_discreteZoom}));
}
this.clock(arg.clock || clock());

function resizeSelf() {
m_this.resize(0, 0, m_node.width(), m_node.height());
Expand Down
3 changes: 0 additions & 3 deletions testing/test-cases/selenium-tests/d3Animation/include.css

This file was deleted.

1 change: 0 additions & 1 deletion testing/test-cases/selenium-tests/d3Animation/include.html

This file was deleted.

63 changes: 0 additions & 63 deletions testing/test-cases/selenium-tests/d3Animation/include.js

This file was deleted.

74 changes: 0 additions & 74 deletions testing/test-cases/selenium-tests/d3Animation/testd3Animate.py

This file was deleted.