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

Addition of new backend Emscripten pathfinding algorithm and new datastore generation #41

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
f09a9f3
Updated README with build instructions
Apr 21, 2016
25aab8e
Finally figured out how to generate docs. Missing dependency
Apr 22, 2016
aed56f1
Build instructions were missing some steps
Apr 27, 2016
dbbef13
Update README.md
Apr 27, 2016
62688b0
Added an annotated source file with my comments on what everything does
Apr 27, 2016
1ec3cc9
Ported datastore building from ecs-193a project. Untested
mazarf Apr 28, 2016
6694527
Fixed undefined dataStore problem and bad path to priority queue JS
Apr 28, 2016
15876c2
Add comments detailing next steps.
mazarf Apr 28, 2016
c551f75
Updated pathfinding to use Emscripten compiled C++ code
May 2, 2016
331e7fe
Got path animation working. Still needs to be tested for bugs
May 4, 2016
a2b72ad
Modified datastore-test.js beforeEach to use callback
May 5, 2016
440098b
Recompiled datastore.js to not generate .mem file as it was causing p…
May 5, 2016
d872d48
Updated karma config file to work with new js sources for testing
May 5, 2016
144d1d8
Update unit tests to work with new implementation.
mazarf May 11, 2016
e93188a
Update README.md
May 11, 2016
a167aaa
Integrate new unit tests.
mazarf May 11, 2016
5fb9b71
Updated documentation for datastore object.
May 11, 2016
7c46f74
Added partially linted versions of jquery.wayfinding & datastore-test
May 11, 2016
a4aa554
Fixed linter errors in jquery.wayfinding.js & datastore-test.js
May 12, 2016
b7cf53f
Renamed datastore.js to pathfinding.js
May 12, 2016
f7c4dd3
Passing all linter checks now
May 12, 2016
c55c939
Ignoring priority-queue.min.js & pathfinding.js from uglify grunt plugin
May 12, 2016
5fe3e0f
Updated datastore-test.js to use callback instead of setTimeout
May 12, 2016
e703460
In process of updating unit test files
May 12, 2016
c64465a
Updated unit tests to include our pathfinding tests
May 12, 2016
deab344
Grunt is missing from the devDependencies...
May 12, 2016
0530104
Updated Gruntfile to include C++ build instructions
May 12, 2016
3684d43
Removed rapidjson from repo. Updated Makefile to download it if needed
May 12, 2016
e488a52
Forgot a comma
May 12, 2016
23ee9ac
Revert "Removed rapidjson from repo. Updated Makefile to download it …
May 12, 2016
6aec6ef
Added ability to switch between new backend and old.
May 12, 2016
f567fef
Updated the documentation again to have both datastore definitions
May 12, 2016
fc1c1eb
Changed pathfinding file names to emscripten.pathfinding
May 12, 2016
1e1fe4d
Changed option newBackend to emscriptenBackend.
May 12, 2016
999032a
Updated README to include issues we have encountered with node_modules
May 12, 2016
84fcca0
Forgot to update datastores.html to work with old backend
May 12, 2016
8204d79
Update README.md
May 12, 2016
51ae06d
Merge pull request #1 from psalessi/master
cthielen May 19, 2016
af04b89
Refactored CPP code. Still needs more comments
May 25, 2016
dcf4299
Updated function names to now use old & new but recursive & emscripten
May 27, 2016
8fdcc78
Removed trailing space to pass linter
May 27, 2016
eee49f6
Removed trailing space to pass linter
May 27, 2016
d523764
Updated dist files
May 27, 2016
35af7d2
Can't let this fall behind
May 28, 2016
275f8fd
Changed some function names
May 28, 2016
8c12c3d
Add SVG linter.
jlperona May 31, 2016
f405fe9
Update included test files.
jlperona May 31, 2016
086df8c
Merge branch 'master' of github.com:dssit/wayfinding
jlperona Jun 1, 2016
4e47ff0
Merge pull request #2 from jlperona/master
cthielen Jun 1, 2016
10b9fa9
Added some final comments to C++ code
Jun 2, 2016
1187d0c
Refactored CPP code. Still needs more comments
May 25, 2016
1df370c
Updated function names to now use old & new but recursive & emscripten
May 27, 2016
9e41e3b
Removed trailing space to pass linter
May 27, 2016
7e31ce3
Updated dist files
May 27, 2016
42b8ade
Changed some function names
May 28, 2016
e5e72dd
Added some final comments to C++ code
Jun 2, 2016
4730a5c
Added emscriptenBackend option to wayfinding init in index.html
Jun 2, 2016
3ab3db0
Merge branch 'master' of https://github.com/psalessi/wayfinding
Jun 2, 2016
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
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/**/emscripten.pathfinding.js
src/**/priority-queue.min.js
65 changes: 58 additions & 7 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,27 @@ module.exports = function (grunt) {
'jshint',
'eslint'
],
// C++ compilation step
'build': [
'shell:makeClean',
'shell:compileEmscripten'
],
'test': [ // run all tests
'connect:test',
'karma:unit'
],
'package': [
'clean',
'uglify'
'uglify',
'shell:emscriptenPathfinding',
'shell:priorityQueue'
],
'document': [
'jsdoc'
],
'open-docs': [
'open:docs',
'open:coverage'
//'open:coverage'
],
'benchmark': [ // separate from document as it adds a milestone each time
'plato',
Expand Down Expand Up @@ -79,7 +86,11 @@ module.exports = function (grunt) {
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
reporter: require('jshint-stylish'),
ignores: [
'src/**/emscripten.pathfinding.js',
'src/**/priority-queue.min.js'
]
},
gruntfile: {
src: 'Gruntfile.js'
Expand All @@ -94,7 +105,7 @@ module.exports = function (grunt) {
eslint: {
options: {
config: 'eslint.json',
format: 'stylish'
format: 'stylish',
},
target: [
'<%= config.app %>/src/{,*/}*.js',
Expand All @@ -109,7 +120,11 @@ module.exports = function (grunt) {
banner: '<%= banner %>'
},
dist: {
src: ['src/**/*.js'],
src: [
'src/**/*.js',
'!src/**/emscripten.pathfinding.js',
'!src/**/priority-queue.js'
],
dest: 'dist/jquery.<%= pkg.name %>.min.js'
}
},
Expand Down Expand Up @@ -177,7 +192,9 @@ module.exports = function (grunt) {
// The rest of your configuration.
src: [
'<%= config.app %>/src/**/*.js',
'README.md'
'README.md',
'!src/**/emscripten.pathfinding.js',
'!src/**/priority-queue.min.js'
],
options: {
destination: 'docs/',
Expand All @@ -200,7 +217,9 @@ module.exports = function (grunt) {
},
files: {
'plato': [
'<%= config.dev %>/{,*/}*.js'
'<%= config.dev %>/{,*/}*.js',
'!<%= config.dev %>/{,*/}emscripten.pathfinding.js',
'!<%= config.dev %>/{,*/}priority-queue.min.js'
]
}
}
Expand Down Expand Up @@ -245,6 +264,38 @@ module.exports = function (grunt) {
cwd: '.'
}
}
},
emscriptenPathfinding: {
command: 'cp src/emscripten.pathfinding.js dist/',
options: {
execOptions: {
cwd: '.'
}
}
},
priorityQueue: {
command: 'cp src/priority-queue.min.js dist/',
options: {
execOptions: {
cwd: '.'
}
}
},
makeClean: {
command: 'make clean',
options: {
execOptions: {
cwd: '.'
}
}
},
compileEmscripten: {
command: 'make',
options: {
execOptions: {
cwd: '.'
}
}
}
}
});
Expand Down
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# EMSCRIPTEN SECTION
EMCC = em++
CPPFILE = src/emscripten.pathfinding.cpp
EMPPFLAGS = -Oz --bind --memory-init-file 0
CPPFLAGS = -std='c++11'
EMJS = src/emscripten.pathfinding.js

$(EMJS): $(CPPFILE)
$(EMCC) $(CPPFLAGS) $(CPPFILE) $(EMPPFLAGS) -o $(EMJS)

# CLEAN SECTION
JUNK = src/*.dSYM src/*.mem src/*.map
clean:
rm -rf $(EMJS) $(JUNK)
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,61 @@ Wayfinding

jQuery plugin for interactive SVG maps. Wayfinding provides the shortest route through a series of one or more svg maps. It supports client side map processing or pretraversal of the maps with the server holding the cached traversals. It is useful for kiosks and interactive digital signage, but can also be used to share mobile maps.

---
### Steps we followed for Install & Setup
1. First, you need to have Emscripten installed. The Makefile uses **em++**.
2. Make sure npm is up to date. `npm install npm -g`
3. `npm install` in base directory to install all dependencies listed in
package.json
4. `bower install` in base directory to install all front-end library dependcies
(such as jQuery). If the command *bower* does not exist, install it with `npm
install bower -g`.
5. `grunt` in base directory to run all tasks such as validation, testing,
benchmarking, etc. If the command *grunt* does not exist, install it with `npm
install grunt`. Also might need to do `npm install grunt-cli -g`.
6. To generate documentation, `grunt jsdoc`. If it can't find conf file, go
to **node\_modules/grunt-jsdoc** and run `npm install ink-docstrap`
7. To get unit testing working, go to
**node\_modules/karma-phantomjs-loader** and run `npm install`.
8. To see a list of all possible grunt tasks, `grunt --help`

---
### Issues we encountered
* **grunt** did not exist after doing `npm install`, so we added it to
*package.json* using `npm install grunt --save-dev`
* **grunt jsdoc** was not working after doing `npm install` because ink-docstrap
was missing inside **node\_modules/grunt-jsdoc**, so we had to manually run `npm
install ink-docstrap` in that directory to get JSdoc working.
* Unit testing with Karma was not working after doing `npm install` with the
error:
`
Assertion failed: JS engine does not provide full typed array support' error
again?
`

After searching online, this was a bug fixed in PhantomJS v2. The exisiting
version of **karma-phantomjs-loader** was not using PhantomJS v2. We need at
least v1 of karma-phantomjs-loader, so we upated the package.json
devDependency for that module.

However, the dependencies of karma-phantomjs-loader are not automatically
install by doing `npm install` in the root directory. We have to manually go
to **node\_modules/karma-phantomjs-loader** and run `npm install` to get unit
testing working.
* **grunt open:coverage** is broken with the warning:
`
Warning: Cannot read property 'toString' of undefined Use --force to continue.
`

We have commented it out on *line 56* so that `grunt benchmark` still works.
* **grunt datastore** does not work. When we try to run it, we get the error:
`
phantomjs-node: You don't have 'phantomjs' installed
`

Trying `npm install phantomjs --save-dev` does not fix the error.

___
![SVG File](http://i.imgur.com/Em7Lb5Z.jpg)
An example screenshot from a svg file

Expand Down
17 changes: 17 additions & 0 deletions dist/emscripten.pathfinding.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/jquery.wayfinding.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/priority-queue.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ <h2>Things to try</h2>


<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="src/jquery.wayfinding.js"></script>
<script src="dist/priority-queue.min.js"></script>
<script src="dist/jquery.wayfinding.min.js"></script>
<script src="dist/emscripten.pathfinding.js"></script>

<script>
$(document).ready(function () {
Expand All @@ -99,7 +101,8 @@ <h2>Things to try</h2>
return 'lcd.1';
},
'defaultMap': 'floor1',
'showLocation': true
'showLocation': true,
'emscriptenBackend': false
}, function(){
console.log('callback reached');
});
Expand Down Expand Up @@ -134,7 +137,6 @@ <h2>Things to try</h2>
$('#myMaps').on('wayfinding:roomClicked', function(e, r) {
$('#endSelect option[value="' + r.roomId + '"]').attr('selected', true);
});

});
</script>
</body>
Expand Down
2 changes: 2 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ module.exports = function (config) {
'bower_components/jasmine-jquery/lib/jasmine-jquery.js',

// include our JavaScript files
'src/priority-queue.min.js',
'src/jquery.wayfinding.js',
'src/emscripten.pathfinding.js',

// simple patterns to load the needed testfiles
// equals to {pattern: 'test/*-test.js', watched: true, served: true, included: true}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"MD5": "^1.2.1",
"bower": "^1.3.12",
"fs-extra": "^0.16.5",
"grunt": "^1.0.1",
"grunt-bower-install": "^1.6.0",
"grunt-build-lifecycle": "^0.1.1",
"grunt-contrib-clean": "~0.6.0",
Expand All @@ -54,7 +55,7 @@
"karma-firefox-launcher": "~0.1.4",
"karma-html-reporter": "~0.2.6",
"karma-jasmine": "~0.3.5",
"karma-phantomjs-launcher": "~0.1.4",
"karma-phantomjs-launcher": "^1.0.0",
"karma-safari-launcher": "~0.1.1",
"karma-script-launcher": "~0.1.0",
"load-grunt-tasks": "~3.1.0",
Expand Down
Loading