├── demo1.gif ├── demo2.gif ├── demos ├── Android │ └── IndoorMap-Canvas-Zoom │ │ ├── cordova │ │ ├── node_modules │ │ │ └── shelljs │ │ │ │ ├── .npmignore │ │ │ │ ├── jshint.json │ │ │ │ ├── .travis.yml │ │ │ │ ├── .documentup.json │ │ │ │ ├── global.js │ │ │ │ ├── scripts │ │ │ │ ├── docs.js │ │ │ │ └── run-tests.js │ │ │ │ ├── make.js │ │ │ │ ├── bin │ │ │ │ └── shjs │ │ │ │ ├── LICENSE │ │ │ │ ├── package.json │ │ │ │ └── README.md │ │ ├── version │ │ ├── check_reqs │ │ ├── log.bat │ │ ├── run.bat │ │ ├── build.bat │ │ ├── clean.bat │ │ ├── version.bat │ │ ├── lib │ │ │ ├── list-devices.bat │ │ │ ├── install-device.bat │ │ │ ├── start-emulator.bat │ │ │ ├── install-emulator.bat │ │ │ ├── list-emulator-images.bat │ │ │ ├── list-started-emulators.bat │ │ │ ├── list-devices │ │ │ ├── list-emulator-images │ │ │ ├── list-started-emulators │ │ │ ├── install-device │ │ │ ├── start-emulator │ │ │ ├── install-emulator │ │ │ ├── clean.js │ │ │ ├── log.js │ │ │ ├── appinfo.js │ │ │ ├── build.js │ │ │ ├── check_reqs.js │ │ │ ├── device.js │ │ │ ├── run.js │ │ │ └── emulator.js │ │ ├── log │ │ ├── clean │ │ ├── run │ │ └── build │ │ ├── bin │ │ ├── classes.dex │ │ ├── resources.ap_ │ │ ├── IndoorMap-Canvas-Zoom.apk │ │ ├── jarlist.cache │ │ ├── res │ │ │ └── drawable │ │ │ │ └── ic_launcher.png │ │ ├── classes │ │ │ └── cn │ │ │ │ └── swu │ │ │ │ └── indoormap │ │ │ │ ├── R.class │ │ │ │ ├── R$attr.class │ │ │ │ ├── R$xml.class │ │ │ │ ├── Activity.class │ │ │ │ ├── R$string.class │ │ │ │ ├── BuildConfig.class │ │ │ │ └── R$drawable.class │ │ ├── dexedLibs │ │ │ └── cordova-3.1.0-91c3c0f7a3f99301a0f18209997748de.jar │ │ └── AndroidManifest.xml │ │ ├── assets │ │ └── www │ │ │ ├── cordova_plugins.js │ │ │ ├── fonts │ │ │ ├── mwa.eot │ │ │ ├── mwa.ttf │ │ │ └── mwa.woff │ │ │ ├── images │ │ │ ├── LV.png │ │ │ ├── NB.png │ │ │ ├── 7-11.png │ │ │ ├── BOC.png │ │ │ ├── GUCCI.png │ │ │ ├── KFC.png │ │ │ ├── Nike.png │ │ │ ├── CHANEL.png │ │ │ ├── Stairs.png │ │ │ ├── Toilet.png │ │ │ ├── UNIQLO.png │ │ │ ├── Elevator.png │ │ │ ├── Escalator.png │ │ │ ├── McDonald's.png │ │ │ ├── PizzaHut.png │ │ │ └── Starbucks.png │ │ │ ├── scripts │ │ │ ├── index.js │ │ │ ├── mapinfo.js │ │ │ └── canvas-zoom.js │ │ │ ├── css │ │ │ ├── fonts.css │ │ │ └── style.css │ │ │ └── index.html │ │ ├── libs │ │ └── cordova-3.1.0.jar │ │ ├── res │ │ ├── drawable │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ └── strings.xml │ │ └── xml │ │ │ └── config.xml │ │ ├── gen │ │ └── cn │ │ │ └── swu │ │ │ └── indoormap │ │ │ ├── BuildConfig.java │ │ │ └── R.java │ │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ │ ├── .classpath │ │ ├── local.properties │ │ ├── project.properties │ │ ├── proguard-project.txt │ │ ├── .project │ │ ├── src │ │ └── cn │ │ │ └── swu │ │ │ └── indoormap │ │ │ └── Activity.java │ │ ├── AndroidManifest.xml │ │ └── build.xml └── web │ ├── fonts │ ├── mwa.eot │ ├── mwa.ttf │ └── mwa.woff │ ├── images │ ├── LV.png │ ├── NB.png │ ├── 7-11.png │ ├── BOC.png │ ├── KFC.png │ ├── Nike.png │ ├── CHANEL.png │ ├── GUCCI.png │ ├── Stairs.png │ ├── Toilet.png │ ├── UNIQLO.png │ ├── Elevator.png │ ├── Escalator.png │ ├── PizzaHut.png │ ├── Starbucks.png │ └── McDonald's.png │ ├── css │ ├── fonts.css │ └── style.css │ ├── scripts │ ├── mapinfo.js │ └── canvas-zoom.js │ └── index.html ├── README.md └── LICENSE /demo1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demo1.gif -------------------------------------------------------------------------------- /demo2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demo2.gif -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/node_modules/shelljs/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | -------------------------------------------------------------------------------- /demos/web/fonts/mwa.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/fonts/mwa.eot -------------------------------------------------------------------------------- /demos/web/fonts/mwa.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/fonts/mwa.ttf -------------------------------------------------------------------------------- /demos/web/images/LV.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/images/LV.png -------------------------------------------------------------------------------- /demos/web/images/NB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/images/NB.png -------------------------------------------------------------------------------- /demos/web/fonts/mwa.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/fonts/mwa.woff -------------------------------------------------------------------------------- /demos/web/images/7-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/images/7-11.png -------------------------------------------------------------------------------- /demos/web/images/BOC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/images/BOC.png -------------------------------------------------------------------------------- /demos/web/images/KFC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/images/KFC.png -------------------------------------------------------------------------------- /demos/web/images/Nike.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/images/Nike.png -------------------------------------------------------------------------------- /demos/web/images/CHANEL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/images/CHANEL.png -------------------------------------------------------------------------------- /demos/web/images/GUCCI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/images/GUCCI.png -------------------------------------------------------------------------------- /demos/web/images/Stairs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/images/Stairs.png -------------------------------------------------------------------------------- /demos/web/images/Toilet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/images/Toilet.png -------------------------------------------------------------------------------- /demos/web/images/UNIQLO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/images/UNIQLO.png -------------------------------------------------------------------------------- /demos/web/images/Elevator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/images/Elevator.png -------------------------------------------------------------------------------- /demos/web/images/Escalator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/images/Escalator.png -------------------------------------------------------------------------------- /demos/web/images/PizzaHut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/images/PizzaHut.png -------------------------------------------------------------------------------- /demos/web/images/Starbucks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/images/Starbucks.png -------------------------------------------------------------------------------- /demos/web/images/McDonald's.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/web/images/McDonald's.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/node_modules/shelljs/jshint.json: -------------------------------------------------------------------------------- 1 | { 2 | "loopfunc": true, 3 | "sub": true 4 | } -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/node_modules/shelljs/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.6 4 | - 0.8 5 | 6 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/bin/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/bin/classes.dex -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/bin/resources.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/bin/resources.ap_ -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/node_modules/shelljs/.documentup.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ShellJS", 3 | "twitter": [ 4 | "r2r" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/cordova_plugins.js: -------------------------------------------------------------------------------- 1 | cordova.define('cordova/plugin_list', function(require, exports, module) { 2 | module.exports = [] 3 | }); -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/node_modules/shelljs/global.js: -------------------------------------------------------------------------------- 1 | var shell = require('./shell.js'); 2 | for (var cmd in shell) 3 | global[cmd] = shell[cmd]; 4 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/libs/cordova-3.1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/libs/cordova-3.1.0.jar -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/fonts/mwa.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/fonts/mwa.eot -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/fonts/mwa.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/fonts/mwa.ttf -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/LV.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/LV.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/NB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/NB.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/fonts/mwa.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/fonts/mwa.woff -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/7-11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/7-11.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/BOC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/BOC.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/GUCCI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/GUCCI.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/KFC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/KFC.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/Nike.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/Nike.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/CHANEL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/CHANEL.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/Stairs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/Stairs.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/Toilet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/Toilet.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/UNIQLO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/UNIQLO.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/bin/IndoorMap-Canvas-Zoom.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/bin/IndoorMap-Canvas-Zoom.apk -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/bin/jarlist.cache: -------------------------------------------------------------------------------- 1 | # cache for current jar dependency. DO NOT EDIT. 2 | # format is 3 | # Encoding is UTF-8 4 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/res/drawable/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/res/drawable/ic_launcher.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/Elevator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/Elevator.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/Escalator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/Escalator.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/McDonald's.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/McDonald's.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/PizzaHut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/PizzaHut.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/Starbucks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/assets/www/images/Starbucks.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/bin/res/drawable/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/bin/res/drawable/ic_launcher.png -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | IndoorMap-Canvas-Zoom 4 | 5 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/bin/classes/cn/swu/indoormap/R.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/bin/classes/cn/swu/indoormap/R.class -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/bin/classes/cn/swu/indoormap/R$attr.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/bin/classes/cn/swu/indoormap/R$attr.class -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/bin/classes/cn/swu/indoormap/R$xml.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/bin/classes/cn/swu/indoormap/R$xml.class -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/bin/classes/cn/swu/indoormap/Activity.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/bin/classes/cn/swu/indoormap/Activity.class -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/bin/classes/cn/swu/indoormap/R$string.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/bin/classes/cn/swu/indoormap/R$string.class -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/bin/classes/cn/swu/indoormap/BuildConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/bin/classes/cn/swu/indoormap/BuildConfig.class -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/bin/classes/cn/swu/indoormap/R$drawable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/bin/classes/cn/swu/indoormap/R$drawable.class -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/gen/cn/swu/indoormap/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package cn.swu.indoormap; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/bin/dexedLibs/cordova-3.1.0-91c3c0f7a3f99301a0f18209997748de.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/licaomeng/canvas-zoom/HEAD/demos/Android/IndoorMap-Canvas-Zoom/bin/dexedLibs/cordova-3.1.0-91c3c0f7a3f99301a0f18209997748de.jar -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.source=1.6 5 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/node_modules/shelljs/scripts/docs.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../global'); 3 | 4 | echo('Appending docs to README.md'); 5 | 6 | cd(__dirname + '/..'); 7 | 8 | // Extract docs from shell.js 9 | var docs = grep('//@', 'shell.js'); 10 | // Remove '//@' 11 | docs = docs.replace(/\/\/\@ ?/g, ''); 12 | // Append docs to README 13 | sed('-i', /## Command reference(.|\n)*/, '## Command reference\n\n' + docs, 'README.md'); 14 | 15 | echo('All done.'); 16 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/local.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | 7 | # location of the SDK. This is only used by Ant 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | sdk.dir=C:\\work-station\\IDE\\android ADT\\adt-bundle-windows-x86_64-20130522\\sdk 11 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-17 15 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/gen/cn/swu/indoormap/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package cn.swu.indoormap; 9 | 10 | public final class R { 11 | public static final class attr { 12 | } 13 | public static final class drawable { 14 | public static final int ic_launcher=0x7f020000; 15 | } 16 | public static final class string { 17 | public static final int app_name=0x7f040000; 18 | } 19 | public static final class xml { 20 | public static final int config=0x7f030000; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/scripts/index.js: -------------------------------------------------------------------------------- 1 | // 有关“空白”模板的简介,请参阅以下文档: 2 | // http://go.microsoft.com/fwlink/?LinkID=397704 3 | // 若要在 Ripple 或 Android 设备/仿真程序中调试代码: 启用你的应用程序,设置断点, 4 | // 然后在 JavaScript 控制台中运行 "window.location.reload()"。 5 | (function () { 6 | "use strict"; 7 | 8 | document.addEventListener( 'deviceready', onDeviceReady.bind( this ), false ); 9 | 10 | function onDeviceReady() { 11 | // 处理 Cordova 暂停并恢复事件 12 | document.addEventListener( 'pause', onPause.bind( this ), false ); 13 | document.addEventListener( 'resume', onResume.bind( this ), false ); 14 | 15 | // TODO: Cordova 已加载。在此处执行任何需要 Cordova 的初始化。 16 | }; 17 | 18 | function onPause() { 19 | // TODO: 此应用程序已挂起。在此处保存应用程序状态。 20 | }; 21 | 22 | function onResume() { 23 | // TODO: 此应用程序已重新激活。在此处还原应用程序状态。 24 | }; 25 | } )(); -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /demos/web/css/fonts.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'mwa'; 3 | src: url('../fonts/mwa.eot') format('embedded-opentype'), /* IE6-IE8 */ 4 | url('../fonts/mwa.ttf') format('truetype'), /* Safari, Android, iOS */ 5 | url('../fonts/mwa.woff') format('woff'); /* Modern Browsers */ 6 | font-weight: normal; 7 | font-style: normal; 8 | } 9 | 10 | [class^="icon-"], [class*=" icon-"] { 11 | font-family: 'mwa'; 12 | speak: none; 13 | font-style: normal; 14 | font-weight: normal; 15 | font-variant: normal; 16 | text-transform: none; 17 | line-height: 1; 18 | /* Better Font Rendering =========== */ 19 | -webkit-font-smoothing: antialiased; 20 | -moz-osx-font-smoothing: grayscale; 21 | } 22 | 23 | .icon-plus:before { 24 | content: "\e60d"; 25 | } 26 | 27 | .icon-minus:before { 28 | content: "\e60f"; 29 | } 30 | 31 | .icon-location:before { 32 | content: "\e614"; 33 | } 34 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/css/fonts.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'mwa'; 3 | src: url('../fonts/mwa.eot') format('embedded-opentype'), /* IE6-IE8 */ 4 | url('../fonts/mwa.ttf') format('truetype'), /* Safari, Android, iOS */ 5 | url('../fonts/mwa.woff') format('woff'); /* Modern Browsers */ 6 | font-weight: normal; 7 | font-style: normal; 8 | } 9 | 10 | [class^="icon-"], [class*=" icon-"] { 11 | font-family: 'mwa'; 12 | speak: none; 13 | font-style: normal; 14 | font-weight: normal; 15 | font-variant: normal; 16 | text-transform: none; 17 | line-height: 1; 18 | /* Better Font Rendering =========== */ 19 | -webkit-font-smoothing: antialiased; 20 | -moz-osx-font-smoothing: grayscale; 21 | } 22 | 23 | .icon-plus:before { 24 | content: "\e60d"; 25 | } 26 | 27 | .icon-minus:before { 28 | content: "\e60f"; 29 | } 30 | 31 | .icon-location:before { 32 | content: "\e614"; 33 | } 34 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | IndoorMap-Canvas-Zoom 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/version: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | // Coho updates this line: 23 | var VERSION = "3.1.0"; 24 | 25 | console.log(VERSION); 26 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/check_reqs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var check_reqs = require('./lib/check_reqs'); 23 | 24 | if(!check_reqs.run()) { 25 | process.exit(2); 26 | } 27 | 28 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/log.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0log" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'log' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/run.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0run" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'run' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/build.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0build" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'build' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/clean.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0clean" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'clean' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/version.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0version" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'version' script in 'cordova' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/list-devices.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0list-devices" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'list-devices' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/install-device.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0install-device" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'install-device' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/start-emulator.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0start-emulator" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'start-emulator' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/install-emulator.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0install-emulator" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'install-emulator' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/list-emulator-images.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0list-emulator-images" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'list-emulator-images' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) 27 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/list-started-emulators.bat: -------------------------------------------------------------------------------- 1 | :: Licensed to the Apache Software Foundation (ASF) under one 2 | :: or more contributor license agreements. See the NOTICE file 3 | :: distributed with this work for additional information 4 | :: regarding copyright ownership. The ASF licenses this file 5 | :: to you under the Apache License, Version 2.0 (the 6 | :: "License"); you may not use this file except in compliance 7 | :: with the License. You may obtain a copy of the License at 8 | :: 9 | :: http://www.apache.org/licenses/LICENSE-2.0 10 | :: 11 | :: Unless required by applicable law or agreed to in writing, 12 | :: software distributed under the License is distributed on an 13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | :: KIND, either express or implied. See the License for the 15 | :: specific language governing permissions and limitations 16 | :: under the License. 17 | 18 | @ECHO OFF 19 | SET script_path="%~dp0list-started-emulators" 20 | IF EXIST %script_path% ( 21 | node "%script_path%" %* 22 | ) ELSE ( 23 | ECHO. 24 | ECHO ERROR: Could not find 'list-started-emulators' script in 'cordova\lib' folder, aborting...>&2 25 | EXIT /B 1 26 | ) -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/list-devices: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var devices = require('./device'); 23 | 24 | // Usage support for when args are given 25 | var device_list = devices.list(); 26 | for(device in device_list) { 27 | console.log(device_list[device]); 28 | } -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/list-emulator-images: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var emulators = require('./emulator'); 23 | 24 | // Usage support for when args are given 25 | var emulator_list = emulators.list_images(); 26 | for(emulator in emulator_list) { 27 | console.log(emulator_list[emulator].name); 28 | process.exit(0); 29 | } -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/list-started-emulators: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var emulators = require('./emulator'); 23 | 24 | // Usage support for when args are given 25 | var emulator_list = emulators.list_started(); 26 | for(emulator in emulator_list) { 27 | console.log(emulator_list[emulator]); 28 | process.exit(0); 29 | } -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/node_modules/shelljs/make.js: -------------------------------------------------------------------------------- 1 | require('./global'); 2 | config.fatal = true; 3 | 4 | global.target = {}; 5 | 6 | // This ensures we only execute the script targets after the entire script has 7 | // been evaluated 8 | var args = process.argv.slice(2); 9 | setTimeout(function() { 10 | var t; 11 | 12 | if (args.length === 1 && args[0] === '--help') { 13 | console.log('Available targets:'); 14 | for (t in target) 15 | console.log(' ' + t); 16 | return; 17 | } 18 | 19 | // Wrap targets to prevent duplicate execution 20 | for (t in target) { 21 | (function(t, oldTarget){ 22 | 23 | // Wrap it 24 | target[t] = function(force) { 25 | if (oldTarget.done && !force) 26 | return; 27 | oldTarget.done = true; 28 | return oldTarget.apply(oldTarget, arguments); 29 | }; 30 | 31 | })(t, target[t]); 32 | } 33 | 34 | // Execute desired targets 35 | if (args.length > 0) { 36 | args.forEach(function(arg) { 37 | if (arg in target) 38 | target[arg](); 39 | else { 40 | console.log('no such target: ' + arg); 41 | exit(1); 42 | } 43 | }); 44 | } else if ('all' in target) { 45 | target.all(); 46 | } 47 | 48 | }, 0); 49 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/log: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var log = require('./lib/log'), 23 | reqs = require('./lib/check_reqs'), 24 | args = process.argv; 25 | 26 | // Usage support for when args are given 27 | if(args.length > 2) { 28 | log.help(); 29 | } else if(reqs.run()) { 30 | log.run(); 31 | } else { 32 | process.exit(2); 33 | } -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/clean: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var clean = require('./lib/clean'), 23 | reqs = require('./lib/check_reqs'), 24 | args = process.argv; 25 | 26 | // Usage support for when args are given 27 | if(args.length > 2) { 28 | clean.help(); 29 | } else if(reqs.run()) { 30 | clean.run(); 31 | process.exit(0); 32 | } else { 33 | process.exit(2); 34 | } -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/node_modules/shelljs/scripts/run-tests.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../global'); 3 | 4 | var path = require('path'); 5 | 6 | var failed = false; 7 | 8 | // 9 | // Lint 10 | // 11 | JSHINT_BIN = './node_modules/jshint/bin/jshint'; 12 | cd(__dirname + '/..'); 13 | 14 | if (!test('-f', JSHINT_BIN)) { 15 | echo('JSHint not found. Run `npm install` in the root dir first.'); 16 | exit(1); 17 | } 18 | 19 | if (exec(JSHINT_BIN + ' --config jshint.json *.js test/*.js').code !== 0) { 20 | failed = true; 21 | echo('*** JSHINT FAILED! (return code != 0)'); 22 | echo(); 23 | } else { 24 | echo('All JSHint tests passed'); 25 | echo(); 26 | } 27 | 28 | // 29 | // Unit tests 30 | // 31 | cd(__dirname + '/../test'); 32 | ls('*.js').forEach(function(file) { 33 | echo('Running test:', file); 34 | if (exec('node ' + file).code !== 123) { // 123 avoids false positives (e.g. premature exit) 35 | failed = true; 36 | echo('*** TEST FAILED! (missing exit code "123")'); 37 | echo(); 38 | } 39 | }); 40 | 41 | if (failed) { 42 | echo(); 43 | echo('*******************************************************'); 44 | echo('WARNING: Some tests did not pass!'); 45 | echo('*******************************************************'); 46 | exit(1); 47 | } else { 48 | echo(); 49 | echo('All tests passed.'); 50 | } 51 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/src/cn/swu/indoormap/Activity.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | package cn.swu.indoormap; 21 | 22 | import android.os.Bundle; 23 | import org.apache.cordova.*; 24 | 25 | public class Activity extends CordovaActivity { 26 | @Override 27 | public void onCreate(Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | super.init(); 30 | super.loadUrl(Config.getStartUrl()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var run = require('./lib/run'), 23 | reqs = require('./lib/check_reqs'), 24 | args = process.argv; 25 | 26 | // Support basic help commands 27 | if (args[2] == '--help' || args[2] == '/?' || args[2] == '-h' || 28 | args[2] == 'help' || args[2] == '-help' || args[2] == '/help') { 29 | run.help(); 30 | } else if(reqs.run()) { 31 | run.run(args); 32 | process.exit(0); 33 | } else { 34 | process.exit(2); 35 | } -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/node_modules/shelljs/bin/shjs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../global'); 3 | 4 | if (process.argv.length < 3) { 5 | console.log('ShellJS: missing argument (script name)'); 6 | console.log(); 7 | process.exit(1); 8 | } 9 | 10 | var args, 11 | scriptName = process.argv[2]; 12 | env['NODE_PATH'] = __dirname + '/../..'; 13 | 14 | if (!scriptName.match(/\.js/) && !scriptName.match(/\.coffee/)) { 15 | if (test('-f', scriptName + '.js')) 16 | scriptName += '.js'; 17 | if (test('-f', scriptName + '.coffee')) 18 | scriptName += '.coffee'; 19 | } 20 | 21 | if (!test('-f', scriptName)) { 22 | console.log('ShellJS: script not found ('+scriptName+')'); 23 | console.log(); 24 | process.exit(1); 25 | } 26 | 27 | args = process.argv.slice(3); 28 | 29 | for (var i = 0, l = args.length; i < l; i++) { 30 | if (args[i][0] !== "-"){ 31 | args[i] = '"' + args[i] + '"'; // fixes arguments with multiple words 32 | } 33 | } 34 | 35 | if (scriptName.match(/\.coffee$/)) { 36 | // 37 | // CoffeeScript 38 | // 39 | if (which('coffee')) { 40 | exec('coffee ' + scriptName + ' ' + args.join(' '), { async: true }); 41 | } else { 42 | console.log('ShellJS: CoffeeScript interpreter not found'); 43 | console.log(); 44 | process.exit(1); 45 | } 46 | } else { 47 | // 48 | // JavaScript 49 | // 50 | exec('node ' + scriptName + ' ' + args.join(' '), { async: true }); 51 | } 52 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var build = require('./lib/build'), 23 | reqs = require('./lib/check_reqs'), 24 | args = process.argv; 25 | 26 | // Support basic help commands 27 | if(args[2] == '--help' || args[2] == '/?' || args[2] == '-h' || 28 | args[2] == 'help' || args[2] == '-help' || args[2] == '/help') { 29 | build.help(); 30 | } else if(reqs.run()) { 31 | build.run(args[2]); 32 | process.exit(0); 33 | } else { 34 | process.exit(2); 35 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # canvas-zoom 2 | An indoor map sample based on HTML5 canvas, you can zoom in and zoom out the map with your fingers 3 | 4 | # Blog 5 | #### [http://blog.csdn.net/licaomengrice/article/details/50116781](http://blog.csdn.net/licaomengrice/article/details/50116781) 6 | 7 | # Demo 8 | ![](https://github.com/licaomeng/canvas-zoom/blob/master/demo1.gif)                    9 | ![](https://github.com/licaomeng/canvas-zoom/blob/master/demo2.gif) 10 | 11 | # Usage 12 | You can add your data into ```mapinfo.js``` to make your indoor map. 13 | #### Desktop 14 | In your browser, open the file: ```/web/index.html``` 15 | #### Android 16 | Import project 'IndoorMap-Canvas-Zoom' to Eclipse 17 | #### iOS 18 | Coming soon... 19 | 20 | License 21 | ======= 22 | 23 | Copyright 2015 Caomeng Li 24 | 25 | Licensed under the Apache License, Version 2.0 (the "License"); 26 | you may not use this file except in compliance with the License. 27 | You may obtain a copy of the License at 28 | 29 | http://www.apache.org/licenses/LICENSE-2.0 30 | 31 | Unless required by applicable law or agreed to in writing, software 32 | distributed under the License is distributed on an "AS IS" BASIS, 33 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 34 | See the License for the specific language governing permissions and 35 | limitations under the License. 36 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/install-device: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var device = require('./device'), 23 | args = process.argv; 24 | 25 | if(args.length > 2) { 26 | var install_target; 27 | if (args[2].substring(0, 9) == '--target=') { 28 | install_target = args[2].substring(9, args[2].length); 29 | device.install(install_target); 30 | process.exit(0); 31 | } else { 32 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.'); 33 | process.exit(2); 34 | } 35 | } else { 36 | device.install(); 37 | process.exit(0); 38 | } -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | 18 | 19 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 39 | 40 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/bin/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | 18 | 19 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 39 | 40 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/start-emulator: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var emulator = require('./emulator'), 23 | args = process.argv; 24 | 25 | if(args.length > 2) { 26 | var install_target; 27 | if (args[2].substring(0, 9) == '--target=') { 28 | install_target = args[2].substring(9, args[2].length); 29 | emulator.start(install_target); 30 | process.exit(0); 31 | } else { 32 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.'); 33 | process.exit(2); 34 | } 35 | } else { 36 | emulator.start(); 37 | process.exit(0); 38 | } -------------------------------------------------------------------------------- /demos/web/css/style.css: -------------------------------------------------------------------------------- 1 | 2 | #zoom-btn-container { 3 | -webkit-box-shadow: 1px 1px 2px rgba(0,0,0,.4); 4 | background: rgba(255,255,255,.8); 5 | border-radius: 3px; 6 | } 7 | 8 | .zoom-btn { 9 | display: -webkit-box; 10 | -webkit-box-align: center; 11 | -webkit-box-pack: center; 12 | -webkit-box-sizing: border-box; 13 | height: 80px; 14 | width: 80px; 15 | } 16 | 17 | .zoom-btn-in { 18 | margin-bottom: -1px; 19 | border-bottom: 1px solid #ececec; 20 | } 21 | 22 | .zin, .zout { 23 | height: 20px; 24 | width: 20px; 25 | font-size: 36px; 26 | font-weight: bold; 27 | color: #686A5B; 28 | } 29 | 30 | .blue-disable .zin { 31 | opacity: .53; 32 | } 33 | 34 | .blue-disable .zout { 35 | opacity: .53; 36 | } 37 | 38 | .init-btn { 39 | display: -webkit-box; 40 | -webkit-box-align: center; 41 | -webkit-box-pack: center; 42 | -webkit-box-sizing: border-box; 43 | height: 80px; 44 | width: 80px; 45 | background: rgba(255,255,255,.8); 46 | -webkit-box-shadow: 1px 1px 2px rgba(0,0,0,.4); 47 | border-radius: 3px; 48 | } 49 | 50 | 51 | .map-init .init-btn b { 52 | height: 20px; 53 | width: 20px; 54 | font-size: 36px; 55 | font-weight: bold; 56 | color: #686A5B; 57 | } 58 | 59 | .map-init .init-btn.active { 60 | background-color: #eee; 61 | } 62 | 63 | .map-init .init-btn.active b { 64 | background-position: -4px 1px; 65 | } 66 | 67 | .zoom-btn:active, .init-btn:active { 68 | background-color: #e5e5e5 !important; 69 | } 70 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/install-emulator: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var emulator = require('./emulator'), 23 | args = process.argv; 24 | 25 | if(args.length > 2) { 26 | var install_target; 27 | if (args[2].substring(0, 9) == '--target=') { 28 | install_target = args[2].substring(9, args[2].length); 29 | emulator.install(install_target); 30 | process.exit(0); 31 | } else { 32 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.'); 33 | process.exit(2); 34 | } 35 | } else { 36 | emulator.install(); 37 | process.exit(0); 38 | } -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/css/style.css: -------------------------------------------------------------------------------- 1 | 2 | #zoom-btn-container { 3 | -webkit-box-shadow: 1px 1px 2px rgba(0,0,0,.4); 4 | background: rgba(255,255,255,.8); 5 | border-radius: 3px; 6 | } 7 | 8 | .zoom-btn { 9 | display: -webkit-box; 10 | -webkit-box-align: center; 11 | -webkit-box-pack: center; 12 | -webkit-box-sizing: border-box; 13 | height: 80px; 14 | width: 80px; 15 | } 16 | 17 | .zoom-btn-in { 18 | margin-bottom: -1px; 19 | border-bottom: 1px solid #ececec; 20 | } 21 | 22 | .zin, .zout { 23 | height: 20px; 24 | width: 20px; 25 | font-size: 36px; 26 | font-weight: bold; 27 | color: #686A5B; 28 | } 29 | 30 | .blue-disable .zin { 31 | opacity: .53; 32 | } 33 | 34 | .blue-disable .zout { 35 | opacity: .53; 36 | } 37 | 38 | .init-btn { 39 | display: -webkit-box; 40 | -webkit-box-align: center; 41 | -webkit-box-pack: center; 42 | -webkit-box-sizing: border-box; 43 | height: 80px; 44 | width: 80px; 45 | background: rgba(255,255,255,.8); 46 | -webkit-box-shadow: 1px 1px 2px rgba(0,0,0,.4); 47 | border-radius: 3px; 48 | } 49 | 50 | 51 | .map-init .init-btn b { 52 | height: 20px; 53 | width: 20px; 54 | font-size: 36px; 55 | font-weight: bold; 56 | color: #686A5B; 57 | } 58 | 59 | .map-init .init-btn.active { 60 | background-color: #eee; 61 | } 62 | 63 | .map-init .init-btn.active b { 64 | background-position: -4px 1px; 65 | } 66 | 67 | .zoom-btn:active, .init-btn:active { 68 | background-color: #e5e5e5 !important; 69 | } 70 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/res/xml/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello Cordova 4 | 5 | A sample Apache Cordova application that responds to the deviceready event. 6 | 7 | 8 | Apache Cordova Team 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/node_modules/shelljs/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Artur Adib 2 | All rights reserved. 3 | 4 | You may use this project under the terms of the New BSD license as follows: 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | * Neither the name of Artur Adib nor the 14 | names of the contributors may be used to endorse or promote products 15 | derived from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL ARTUR ADIB BE LIABLE FOR ANY 21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/clean.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var shell = require('shelljs'), 23 | path = require('path'), 24 | ROOT = path.join(__dirname, '..', '..'); 25 | 26 | /* 27 | * Cleans the project using ant 28 | */ 29 | module.exports.run = function() { 30 | var cmd = 'ant clean -f ' + path.join(ROOT, 'build.xml'); 31 | var result = shell.exec(cmd, {silent:false, async:false}); 32 | if (result.code > 0) { 33 | console.error('ERROR: Failed to clean android project.'); 34 | console.error(result.output); 35 | process.exit(2); 36 | } 37 | } 38 | 39 | module.exports.help = function() { 40 | console.log('Usage: ' + path.relative(process.cwd(), process.argv[1])); 41 | console.log('Cleans the project directory.'); 42 | process.exit(0); 43 | } -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/log.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var shell = require('shelljs'), 23 | path = require('path'), 24 | ROOT = path.join(__dirname, '..', '..'); 25 | 26 | /* 27 | * Starts running logcat in the shell. 28 | */ 29 | module.exports.run = function() { 30 | var cmd = 'adb logcat | grep -v nativeGetEnabledTags'; 31 | var result = shell.exec(cmd, {silent:false, async:false}); 32 | if (result.code > 0) { 33 | console.error('ERROR: Failed to run logcat command.'); 34 | console.error(result.output); 35 | process.exit(2); 36 | } 37 | } 38 | 39 | module.exports.help = function() { 40 | console.log('Usage: ' + path.relative(process.cwd(), path.join(ROOT, 'corodva', 'log'))); 41 | console.log('Gives the logcat output on the command line.'); 42 | process.exit(0); 43 | } -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/appinfo.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var path = require('path'); 23 | var fs = require('fs'); 24 | var cachedAppInfo = null; 25 | 26 | function readAppInfoFromManifest() { 27 | var manifestPath = path.join(__dirname, '..', '..', 'AndroidManifest.xml'); 28 | var manifestData = fs.readFileSync(manifestPath, {encoding:'utf8'}); 29 | var packageName = /\bpackage\s*=\s*"(.+?)"/.exec(manifestData); 30 | if (!packageName) throw new Error('Could not find package name within ' + manifestPath); 31 | var activityTag = //.exec(manifestData); 32 | if (!activityTag) throw new Error('Could not find within ' + manifestPath); 33 | var activityName = /\bandroid:name\s*=\s*"(.+?)"/.exec(activityTag); 34 | if (!activityName) throw new Error('Could not find android:name within ' + manifestPath); 35 | 36 | return packageName[1] + '/.' + activityName[1]; 37 | } 38 | 39 | exports.getActivityName = function() { 40 | return cachedAppInfo = cachedAppInfo || readAppInfoFromManifest(); 41 | }; 42 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/build.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var shell = require('shelljs'), 23 | clean = require('./clean'), 24 | path = require('path'), 25 | fs = require('fs'), 26 | ROOT = path.join(__dirname, '..', '..'); 27 | 28 | /* 29 | * Builds the project with ant. 30 | */ 31 | module.exports.run = function(build_type) { 32 | //default build type 33 | build_type = typeof build_type !== 'undefined' ? build_type : "--debug"; 34 | var cmd; 35 | switch(build_type) { 36 | case '--debug' : 37 | clean.run(); 38 | cmd = 'ant debug -f ' + path.join(ROOT, 'build.xml'); 39 | break; 40 | case '--release' : 41 | clean.run(); 42 | cmd = 'ant release -f ' + path.join(ROOT, 'build.xml'); 43 | break; 44 | case '--nobuild' : 45 | console.log('Skipping build...'); 46 | break; 47 | default : 48 | console.error('Build option \'' + build_type + '\' not recognized.'); 49 | process.exit(2); 50 | break; 51 | } 52 | if(cmd) { 53 | var result = shell.exec(cmd, {silent:false, async:false}); 54 | if(result.code > 0) { 55 | console.error('ERROR: Failed to build android project.'); 56 | console.error(result.output); 57 | process.exit(2); 58 | } 59 | } 60 | } 61 | 62 | /* 63 | * Gets the path to the apk file, if not such file exists then 64 | * the script will error out. (should we error or just return undefined?) 65 | */ 66 | module.exports.get_apk = function() { 67 | if(fs.existsSync(path.join(ROOT, 'bin'))) { 68 | var bin_files = fs.readdirSync(path.join(ROOT, 'bin')); 69 | for (file in bin_files) { 70 | if(path.extname(bin_files[file]) == '.apk') { 71 | return path.join(ROOT, 'bin', bin_files[file]); 72 | } 73 | } 74 | console.error('ERROR : No .apk found in \'bin\' folder'); 75 | process.exit(2); 76 | } else { 77 | console.error('ERROR : unable to find project bin folder, could not locate .apk'); 78 | process.exit(2); 79 | } 80 | } 81 | 82 | module.exports.help = function() { 83 | console.log('Usage: ' + path.relative(process.cwd(), path.join(ROOT, 'corodva', 'build')) + ' [build_type]'); 84 | console.log('Build Types : '); 85 | console.log(' \'--debug\': Default build, will build project in using ant debug'); 86 | console.log(' \'--release\': will build project using ant release'); 87 | console.log(' \'--nobuild\': will skip build process (can be used with run command)'); 88 | process.exit(0); 89 | } -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/check_reqs.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var shell = require('shelljs'), 23 | path = require('path'), 24 | fs = require('fs'), 25 | ROOT = path.join(__dirname, '..', '..'); 26 | 27 | // Get valid target from framework/project.properties 28 | module.exports.get_target = function() { 29 | if(fs.existsSync(path.join(ROOT, 'framework', 'project.properties'))) { 30 | var target = shell.grep(/target=android-[\d+]/, path.join(ROOT, 'framework', 'project.properties')); 31 | return target.split('=')[1].replace('\n', '').replace('\r', '').replace(' ', ''); 32 | } else if (fs.existsSync(path.join(ROOT, 'project.properties'))) { 33 | // if no target found, we're probably in a project and project.properties is in ROOT. 34 | var target = shell.grep(/target=android-[\d+]/, path.join(ROOT, 'project.properties')); 35 | return target.split('=')[1].replace('\n', '').replace('\r', '').replace(' ', ''); 36 | } 37 | } 38 | 39 | module.exports.check_ant = function() { 40 | var test = shell.exec('ant -version', {silent:true, async:false}); 41 | if(test.code > 0) { 42 | console.error('ERROR : executing command \'ant\', make sure you have ant installed and added to your path.'); 43 | return false; 44 | } 45 | return true; 46 | } 47 | 48 | module.exports.check_java = function() { 49 | if(process.env.JAVA_HOME) { 50 | var test = shell.exec('java', {silent:true, async:false}); 51 | if(test.code > 0) { 52 | console.error('ERROR : executing command \'java\', make sure you java environment is set up. Including your JDK and JRE.'); 53 | return false; 54 | } 55 | return true; 56 | } else { 57 | console.error('ERROR : Make sure JAVA_HOME is set, as well as paths to your JDK and JRE for java.'); 58 | return false; 59 | } 60 | } 61 | 62 | module.exports.check_android = function() { 63 | var valid_target = this.get_target(); 64 | var targets = shell.exec('android list targets', {silent:true, async:false}); 65 | 66 | if(targets.code > 0 && targets.output.match(/command\snot\sfound/)) { 67 | console.error('The command \"android\" failed. Make sure you have the latest Android SDK installed, and the \"android\" command (inside the tools/ folder) is added to your path.'); 68 | return false; 69 | } else if(!targets.output.match(valid_target)) { 70 | console.error('Please install Android target ' + valid_target.split('-')[1] + ' (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run \"android\" from your command-line to install/update any missing SDKs or tools.'); 71 | return false; 72 | } 73 | return true; 74 | } 75 | 76 | module.exports.run = function() { 77 | return this.check_ant() && this.check_java && this.check_android(); 78 | } 79 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/device.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var shell = require('shelljs'), 23 | path = require('path'), 24 | build = require('./build'), 25 | appinfo = require('./appinfo'), 26 | exec = require('child_process').exec, 27 | ROOT = path.join(__dirname, '..', '..'); 28 | 29 | /** 30 | * Returns a list of the device ID's found 31 | */ 32 | module.exports.list = function() { 33 | var cmd = 'adb devices'; 34 | var result = shell.exec(cmd, {silent:true, async:false}); 35 | if (result.code > 0) { 36 | console.error('Failed to execute android command \'' + cmd + '\'.'); 37 | process.exit(2); 38 | } else { 39 | var response = result.output.split('\n'); 40 | var device_list = []; 41 | for (var i = 1; i < response.length; i++) { 42 | if (response[i].match(/\w+\tdevice/) && !response[i].match(/emulator/)) { 43 | device_list.push(response[i].replace(/\tdevice/, '').replace('\r', '')); 44 | } 45 | } 46 | return device_list; 47 | } 48 | } 49 | 50 | /* 51 | * Installs a previously built application on the device 52 | * and launches it. 53 | */ 54 | module.exports.install = function(target) { 55 | var device_list = this.list(); 56 | if (device_list.length > 0) { 57 | // default device 58 | target = typeof target !== 'undefined' ? target : device_list[0]; 59 | if (device_list.indexOf(target) > -1) { 60 | var apk_path = build.get_apk(); 61 | var launchName = appinfo.getActivityName(); 62 | console.log('Installing app on device...'); 63 | cmd = 'adb -s ' + target + ' install -r ' + apk_path; 64 | var install = shell.exec(cmd, {silent:false, async:false}); 65 | if (install.error || install.output.match(/Failure/)) { 66 | console.error('ERROR : Failed to install apk to device : '); 67 | console.error(install.output); 68 | process.exit(2); 69 | } 70 | 71 | //unlock screen 72 | cmd = 'adb -s ' + target + ' shell input keyevent 82'; 73 | shell.exec(cmd, {silent:true, async:false}); 74 | 75 | // launch the application 76 | console.log('Launching application...'); 77 | cmd = 'adb -s ' + target + ' shell am start -W -a android.intent.action.MAIN -n ' + launchName; 78 | var launch = shell.exec(cmd, {silent:true, async:false}); 79 | if(launch.code > 0) { 80 | console.error('ERROR : Failed to launch application on emulator : ' + launch.error); 81 | console.error(launch.output); 82 | process.exit(2); 83 | } else { 84 | console.log('LANCH SUCCESS'); 85 | } 86 | } else { 87 | console.error('ERROR : Unable to find target \'' + target + '\'.'); 88 | console.error('Failed to deploy to device.'); 89 | process.exit(2); 90 | } 91 | } else { 92 | console.error('ERROR : Failed to deploy to device, no devices found.'); 93 | process.exit(2); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | 40 | 49 | 50 | 51 | 52 | 56 | 57 | 69 | 70 | 71 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/run.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var path = require('path'), 23 | build = require('./build'), 24 | emulator = require('./emulator'), 25 | device = require('./device'); 26 | 27 | /* 28 | * Runs the application on a device if availible. 29 | * If not device is found, it will use a started emulator. 30 | * If no started emulators are found it will attempt to start an avd. 31 | * If no avds are found it will error out. 32 | */ 33 | module.exports.run = function(args) { 34 | var build_type; 35 | var install_target; 36 | 37 | for (var i=2; i -1) { 68 | device.install(install_target); 69 | } else if (started_emulators.indexOf(install_target) > -1) { 70 | emulator.install(install_target); 71 | } else { 72 | // if target emulator isn't started, then start it. 73 | var emulator_ID; 74 | for(avd in avds) { 75 | if(avds[avd].name == install_target) { 76 | emulator_ID = emulator.start(install_target); 77 | emulator.install(emulator_ID); 78 | break; 79 | } 80 | } 81 | if(!emulator_ID) { 82 | console.error('ERROR : Target \'' + install_target + '\' not found, unalbe to run project'); 83 | process.exit(2); 84 | } 85 | } 86 | } else { 87 | // no target given, deploy to device if availible, otherwise use the emulator. 88 | var device_list = device.list(); 89 | if (device_list.length > 0) { 90 | console.log('WARNING : No target specified, deploying to device \'' + device_list[0] + '\'.'); 91 | device.install(device_list[0]) 92 | } else { 93 | var emulator_list = emulator.list_started(); 94 | if (emulator_list.length > 0) { 95 | console.log('WARNING : No target specified, deploying to emulator \'' + emulator_list[0] + '\'.'); 96 | emulator.install(emulator_list[0]); 97 | } else { 98 | console.log('WARNING : No started emulators found, starting an emulator.'); 99 | var best_avd = emulator.best_image(); 100 | if(best_avd) { 101 | var emulator_ID = emulator.start(best_avd.name); 102 | console.log('WARNING : No target specified, deploying to emulator \'' + emulator_ID + '\'.'); 103 | emulator.install(emulator_ID); 104 | } else { 105 | emulator.start(); 106 | } 107 | } 108 | } 109 | } 110 | } 111 | 112 | module.exports.help = function() { 113 | console.log('Usage: ' + path.relative(process.cwd(), args[0]) + ' [options]'); 114 | console.log('Build options :'); 115 | console.log(' --debug : Builds project in debug mode'); 116 | console.log(' --release : Builds project in release mode'); 117 | console.log(' --nobuild : Runs the currently built project without recompiling'); 118 | console.log('Deploy options :'); 119 | console.log(' --device : Will deploy the built project to a device'); 120 | console.log(' --emulator : Will deploy the built project to an emulator if one exists'); 121 | console.log(' --target= : Installs to the target with the specified id.'); 122 | process.exit(0); 123 | } -------------------------------------------------------------------------------- /demos/web/scripts/mapinfo.js: -------------------------------------------------------------------------------- 1 | var ALLMAPINFO = [[ 2 | { 3 | title: 'Toilet', 4 | x: 0, 5 | y: 0, 6 | width: 171, 7 | height: 283, 8 | color: "rgba(76, 181, 216, 0.2)", 9 | textcolor: "black", 10 | bordercolor: "rgba(76, 181, 216, 1)", 11 | imageurl: 'images/Toilet.png', 12 | }, 13 | { 14 | title: 'UNIQLO', 15 | x: 0, 16 | y: 284, 17 | width: 171, 18 | height: 286, 19 | color: "rgba(230, 110, 250, 0.2)", 20 | textcolor: "black", 21 | bordercolor: "rgba(230, 110, 250, 1)", 22 | imageurl: 'images/UNIQLO.png', 23 | }, 24 | { 25 | title: '', 26 | x: 0, 27 | y: 570.5, 28 | width: 171, 29 | height: 246, 30 | color: "rgba(230, 110, 250, 0.2)", 31 | textcolor: "black", 32 | bordercolor: "rgba(230, 110, 250, 1)", 33 | imageurl: '', 34 | }, 35 | { 36 | title: 'Stairs', 37 | x: 0, 38 | y: 871, 39 | width: 119, 40 | height: 223, 41 | color: "rgba(225, 215, 155, 0.1)", 42 | textcolor: "black", 43 | bordercolor: "rgba(220, 169, 105, 1)", 44 | imageurl: 'images/Stairs.png', 45 | }, 46 | { 47 | title: '', 48 | x: 119, 49 | y: 871, 50 | width: 52, 51 | height: 223, 52 | color: "rgba(230, 110, 250, 0.2)", 53 | textcolor: "black", 54 | bordercolor: "rgba(230, 110, 250, 1)", 55 | imageurl: '', 56 | }, 57 | { 58 | title: '', 59 | x: 0, 60 | y: 1094, 61 | width: 171, 62 | height: 81, 63 | color: "rgba(230, 110, 250, 0.2)", 64 | textcolor: "black", 65 | bordercolor: "rgba(230, 110, 250, 1)", 66 | imageurl: '', 67 | }, 68 | { 69 | title: 'Starbucks', 70 | x: 243, 71 | y: 51, 72 | width: 131, 73 | height: 193, 74 | color: "rgba(220, 169, 105, 0.2)", 75 | textcolor: "black", 76 | bordercolor: "rgba(220, 169, 105, 1)", 77 | imageurl: 'images/Starbucks.png', 78 | }, 79 | { 80 | title: 'KFC', 81 | x: 409, 82 | y: 51, 83 | width: 392, 84 | height: 162, 85 | color: "rgba(220, 169, 105, 0.2)", 86 | textcolor: "black", 87 | bordercolor: "rgba(220, 169, 105, 1)", 88 | imageurl: 'images/KFC.png', 89 | }, 90 | { 91 | title: 'Escalator', 92 | x: 409, 93 | y: 213, 94 | width: 302, 95 | height: 107, 96 | color: "rgba(225, 215, 155, 0.1)", 97 | textcolor: "black", 98 | bordercolor: "rgba(220, 169, 105, 1)", 99 | imageurl: 'images/Escalator.png', 100 | }, 101 | { 102 | title: 'McDonald\'s', 103 | x: 409, 104 | y: 320, 105 | width: 392, 106 | height: 140, 107 | color: "rgba(220, 169, 105, 0.2)", 108 | textcolor: "black", 109 | bordercolor: "rgba(220, 169, 105, 1)", 110 | imageurl: 'images/McDonald\'s.png', 111 | }, 112 | { 113 | title: 'PizzaHut', 114 | x: 243, 115 | y: 283, 116 | width: 131, 117 | height: 177, 118 | color: "rgba(220, 169, 105, 0.2)", 119 | textcolor: "black", 120 | bordercolor: "rgba(220, 169, 105, 1)", 121 | imageurl: 'images/PizzaHut.png', 122 | }, 123 | { 124 | title: 'Louis Vuitton', 125 | x: 243, 126 | y: 533, 127 | width: 99, 128 | height: 275, 129 | color: "rgba(230, 110, 250, 0.2)", 130 | textcolor: "black", 131 | bordercolor: "rgba(230, 110, 250, 1)", 132 | imageurl: 'images/LV.png', 133 | }, 134 | { 135 | title: '', 136 | x: 342, 137 | y: 533, 138 | width: 160, 139 | height: 150, 140 | color: "rgba(230, 110, 250, 0.2)", 141 | textcolor: "black", 142 | bordercolor: "rgba(230, 110, 250, 1)", 143 | imageurl: '', 144 | }, 145 | { 146 | title: '7-ELEVEn', 147 | x: 502, 148 | y: 533, 149 | width: 146, 150 | height: 150, 151 | color: "rgba(230, 110, 250, 0.2)", 152 | textcolor: "black", 153 | bordercolor: "rgba(230, 110, 250, 1)", 154 | imageurl: 'images/7-11.png', 155 | }, 156 | { 157 | title: '', 158 | x: 648, 159 | y: 533, 160 | width: 153, 161 | height: 150, 162 | color: "rgba(230, 110, 250, 0.2)", 163 | textcolor: "black", 164 | bordercolor: "rgba(230, 110, 250, 1)", 165 | imageurl: '', 166 | }, 167 | { 168 | title: '', 169 | x: 684, 170 | y: 683, 171 | width: 117, 172 | height: 163, 173 | color: "rgba(230, 110, 250, 0.2)", 174 | textcolor: "black", 175 | bordercolor: "rgba(230, 110, 250, 1)", 176 | imageurl: '', 177 | }, 178 | { 179 | title: '中国银行', 180 | x: 684, 181 | y: 846, 182 | width: 117, 183 | height: 179, 184 | color: "rgba(230, 110, 250, 0.2)", 185 | textcolor: "black", 186 | bordercolor: "rgba(230, 110, 250, 1)", 187 | imageurl: 'images/BOC.png', 188 | }, 189 | { 190 | title: 'GUCCI', 191 | x: 243, 192 | y: 808, 193 | width: 99, 194 | height: 217, 195 | color: "rgba(230, 110, 250, 0.2)", 196 | textcolor: "black", 197 | bordercolor: "rgba(230, 110, 250, 1)", 198 | imageurl: 'images/GUCCI.png', 199 | }, 200 | { 201 | title: '', 202 | x: 342, 203 | y: 683, 204 | width: 342, 205 | height: 342, 206 | color: "rgba(100, 100, 100, 0.1)", 207 | textcolor: "black", 208 | bordercolor: "rgba(100, 100, 100, 0.85)", 209 | imageurl: '', 210 | }, 211 | { 212 | title: 'Escalator', 213 | x: 387, 214 | y: 1025, 215 | width: 297, 216 | height: 103, 217 | color: "rgba(225, 215, 155, 0.1)", 218 | textcolor: "black", 219 | bordercolor: "rgba(220, 169, 105, 1)", 220 | imageurl: 'images/Escalator.png', 221 | }, 222 | { 223 | title: 'CHANEL', 224 | x: 297, 225 | y: 1128, 226 | width: 450, 227 | height: 47, 228 | color: "rgba(230, 110, 250, 0.2)", 229 | textcolor: "black", 230 | bordercolor: "rgba(230, 110, 250, 1)", 231 | imageurl: 'images/CHANEL.png', 232 | }, 233 | { 234 | title: 'Nike', 235 | x: 886, 236 | y: 0, 237 | width: 194, 238 | height: 352, 239 | color: "rgba(230, 110, 250, 0.2)", 240 | textcolor: "black", 241 | bordercolor: "rgba(230, 110, 250, 1)", 242 | imageurl: 'images/Nike.png', 243 | }, 244 | { 245 | title: 'New Balance', 246 | x: 886, 247 | y: 352, 248 | width: 194, 249 | height: 306, 250 | color: "rgba(230, 110, 250, 0.2)", 251 | textcolor: "black", 252 | bordercolor: "rgba(230, 110, 250, 1)", 253 | imageurl: 'images/NB.png', 254 | }, 255 | { 256 | title: 'Stairs', 257 | x: 886, 258 | y: 658, 259 | width: 194, 260 | height: 115, 261 | color: "rgba(225, 215, 155, 0.1)", 262 | textcolor: "black", 263 | bordercolor: "rgba(220, 169, 105, 1)", 264 | imageurl: 'images/Stairs.png', 265 | }, 266 | { 267 | title: 'Elevator', 268 | x: 922, 269 | y: 817, 270 | width: 79, 271 | height: 70, 272 | color: "rgba(225, 215, 155, 0.1)", 273 | textcolor: "black", 274 | bordercolor: "rgba(220, 169, 105, 1)", 275 | imageurl: 'images/Elevator.png', 276 | }, 277 | { 278 | title: 'Elevator', 279 | x: 1001, 280 | y: 817, 281 | width: 79, 282 | height: 70, 283 | color: "rgba(225, 215, 155, 0.1)", 284 | textcolor: "black", 285 | bordercolor: "rgba(220, 169, 105, 1)", 286 | imageurl: 'images/Elevator.png', 287 | }, 288 | { 289 | title: 'Toilet', 290 | x: 886, 291 | y: 887, 292 | width: 194, 293 | height: 288, 294 | color: "rgba(76, 181, 216, 0.1)", 295 | textcolor: "black", 296 | bordercolor: "rgba(76, 181, 216, 0.85)", 297 | imageurl: 'images/Toilet.png', 298 | }, 299 | ]] 300 | var MAPINFO = ALLMAPINFO[0]; -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/scripts/mapinfo.js: -------------------------------------------------------------------------------- 1 | var ALLMAPINFO = [[ 2 | { 3 | title: 'Toilet', 4 | x: 0, 5 | y: 0, 6 | width: 171, 7 | height: 283, 8 | color: "rgba(76, 181, 216, 0.2)", 9 | textcolor: "black", 10 | bordercolor: "rgba(76, 181, 216, 1)", 11 | imageurl: 'images/Toilet.png', 12 | }, 13 | { 14 | title: 'UNIQLO', 15 | x: 0, 16 | y: 284, 17 | width: 171, 18 | height: 286, 19 | color: "rgba(230, 110, 250, 0.2)", 20 | textcolor: "black", 21 | bordercolor: "rgba(230, 110, 250, 1)", 22 | imageurl: 'images/UNIQLO.png', 23 | }, 24 | { 25 | title: '', 26 | x: 0, 27 | y: 570.5, 28 | width: 171, 29 | height: 246, 30 | color: "rgba(230, 110, 250, 0.2)", 31 | textcolor: "black", 32 | bordercolor: "rgba(230, 110, 250, 1)", 33 | imageurl: '', 34 | }, 35 | { 36 | title: 'Stairs', 37 | x: 0, 38 | y: 871, 39 | width: 119, 40 | height: 223, 41 | color: "rgba(225, 215, 155, 0.1)", 42 | textcolor: "black", 43 | bordercolor: "rgba(220, 169, 105, 1)", 44 | imageurl: 'images/Stairs.png', 45 | }, 46 | { 47 | title: '', 48 | x: 119, 49 | y: 871, 50 | width: 52, 51 | height: 223, 52 | color: "rgba(230, 110, 250, 0.2)", 53 | textcolor: "black", 54 | bordercolor: "rgba(230, 110, 250, 1)", 55 | imageurl: '', 56 | }, 57 | { 58 | title: '', 59 | x: 0, 60 | y: 1094, 61 | width: 171, 62 | height: 81, 63 | color: "rgba(230, 110, 250, 0.2)", 64 | textcolor: "black", 65 | bordercolor: "rgba(230, 110, 250, 1)", 66 | imageurl: '', 67 | }, 68 | { 69 | title: 'Starbucks', 70 | x: 243, 71 | y: 51, 72 | width: 131, 73 | height: 193, 74 | color: "rgba(220, 169, 105, 0.2)", 75 | textcolor: "black", 76 | bordercolor: "rgba(220, 169, 105, 1)", 77 | imageurl: 'images/Starbucks.png', 78 | }, 79 | { 80 | title: 'KFC', 81 | x: 409, 82 | y: 51, 83 | width: 392, 84 | height: 162, 85 | color: "rgba(220, 169, 105, 0.2)", 86 | textcolor: "black", 87 | bordercolor: "rgba(220, 169, 105, 1)", 88 | imageurl: 'images/KFC.png', 89 | }, 90 | { 91 | title: 'Escalator', 92 | x: 409, 93 | y: 213, 94 | width: 302, 95 | height: 107, 96 | color: "rgba(225, 215, 155, 0.1)", 97 | textcolor: "black", 98 | bordercolor: "rgba(220, 169, 105, 1)", 99 | imageurl: 'images/Escalator.png', 100 | }, 101 | { 102 | title: 'McDonald\'s', 103 | x: 409, 104 | y: 320, 105 | width: 392, 106 | height: 140, 107 | color: "rgba(220, 169, 105, 0.2)", 108 | textcolor: "black", 109 | bordercolor: "rgba(220, 169, 105, 1)", 110 | imageurl: 'images/McDonald\'s.png', 111 | }, 112 | { 113 | title: 'PizzaHut', 114 | x: 243, 115 | y: 283, 116 | width: 131, 117 | height: 177, 118 | color: "rgba(220, 169, 105, 0.2)", 119 | textcolor: "black", 120 | bordercolor: "rgba(220, 169, 105, 1)", 121 | imageurl: 'images/PizzaHut.png', 122 | }, 123 | { 124 | title: 'Louis Vuitton', 125 | x: 243, 126 | y: 533, 127 | width: 99, 128 | height: 275, 129 | color: "rgba(230, 110, 250, 0.2)", 130 | textcolor: "black", 131 | bordercolor: "rgba(230, 110, 250, 1)", 132 | imageurl: 'images/LV.png', 133 | }, 134 | { 135 | title: '', 136 | x: 342, 137 | y: 533, 138 | width: 160, 139 | height: 150, 140 | color: "rgba(230, 110, 250, 0.2)", 141 | textcolor: "black", 142 | bordercolor: "rgba(230, 110, 250, 1)", 143 | imageurl: '', 144 | }, 145 | { 146 | title: '7-ELEVEn', 147 | x: 502, 148 | y: 533, 149 | width: 146, 150 | height: 150, 151 | color: "rgba(230, 110, 250, 0.2)", 152 | textcolor: "black", 153 | bordercolor: "rgba(230, 110, 250, 1)", 154 | imageurl: 'images/7-11.png', 155 | }, 156 | { 157 | title: '', 158 | x: 648, 159 | y: 533, 160 | width: 153, 161 | height: 150, 162 | color: "rgba(230, 110, 250, 0.2)", 163 | textcolor: "black", 164 | bordercolor: "rgba(230, 110, 250, 1)", 165 | imageurl: '', 166 | }, 167 | { 168 | title: '', 169 | x: 684, 170 | y: 683, 171 | width: 117, 172 | height: 163, 173 | color: "rgba(230, 110, 250, 0.2)", 174 | textcolor: "black", 175 | bordercolor: "rgba(230, 110, 250, 1)", 176 | imageurl: '', 177 | }, 178 | { 179 | title: '中国银行', 180 | x: 684, 181 | y: 846, 182 | width: 117, 183 | height: 179, 184 | color: "rgba(230, 110, 250, 0.2)", 185 | textcolor: "black", 186 | bordercolor: "rgba(230, 110, 250, 1)", 187 | imageurl: 'images/BOC.png', 188 | }, 189 | { 190 | title: 'GUCCI', 191 | x: 243, 192 | y: 808, 193 | width: 99, 194 | height: 217, 195 | color: "rgba(230, 110, 250, 0.2)", 196 | textcolor: "black", 197 | bordercolor: "rgba(230, 110, 250, 1)", 198 | imageurl: 'images/GUCCI.png', 199 | }, 200 | { 201 | title: '', 202 | x: 342, 203 | y: 683, 204 | width: 342, 205 | height: 342, 206 | color: "rgba(100, 100, 100, 0.1)", 207 | textcolor: "black", 208 | bordercolor: "rgba(100, 100, 100, 0.85)", 209 | imageurl: '', 210 | }, 211 | { 212 | title: 'Escalator', 213 | x: 387, 214 | y: 1025, 215 | width: 297, 216 | height: 103, 217 | color: "rgba(225, 215, 155, 0.1)", 218 | textcolor: "black", 219 | bordercolor: "rgba(220, 169, 105, 1)", 220 | imageurl: 'images/Escalator.png', 221 | }, 222 | { 223 | title: 'CHANEL', 224 | x: 297, 225 | y: 1128, 226 | width: 450, 227 | height: 47, 228 | color: "rgba(230, 110, 250, 0.2)", 229 | textcolor: "black", 230 | bordercolor: "rgba(230, 110, 250, 1)", 231 | imageurl: 'images/CHANEL.png', 232 | }, 233 | { 234 | title: 'Nike', 235 | x: 886, 236 | y: 0, 237 | width: 194, 238 | height: 352, 239 | color: "rgba(230, 110, 250, 0.2)", 240 | textcolor: "black", 241 | bordercolor: "rgba(230, 110, 250, 1)", 242 | imageurl: 'images/Nike.png', 243 | }, 244 | { 245 | title: 'New Balance', 246 | x: 886, 247 | y: 352, 248 | width: 194, 249 | height: 306, 250 | color: "rgba(230, 110, 250, 0.2)", 251 | textcolor: "black", 252 | bordercolor: "rgba(230, 110, 250, 1)", 253 | imageurl: 'images/NB.png', 254 | }, 255 | { 256 | title: 'Stairs', 257 | x: 886, 258 | y: 658, 259 | width: 194, 260 | height: 115, 261 | color: "rgba(225, 215, 155, 0.1)", 262 | textcolor: "black", 263 | bordercolor: "rgba(220, 169, 105, 1)", 264 | imageurl: 'images/Stairs.png', 265 | }, 266 | { 267 | title: 'Elevator', 268 | x: 922, 269 | y: 817, 270 | width: 79, 271 | height: 70, 272 | color: "rgba(225, 215, 155, 0.1)", 273 | textcolor: "black", 274 | bordercolor: "rgba(220, 169, 105, 1)", 275 | imageurl: 'images/Elevator.png', 276 | }, 277 | { 278 | title: 'Elevator', 279 | x: 1001, 280 | y: 817, 281 | width: 79, 282 | height: 70, 283 | color: "rgba(225, 215, 155, 0.1)", 284 | textcolor: "black", 285 | bordercolor: "rgba(220, 169, 105, 1)", 286 | imageurl: 'images/Elevator.png', 287 | }, 288 | { 289 | title: 'Toilet', 290 | x: 886, 291 | y: 887, 292 | width: 194, 293 | height: 288, 294 | color: "rgba(76, 181, 216, 0.1)", 295 | textcolor: "black", 296 | bordercolor: "rgba(76, 181, 216, 0.85)", 297 | imageurl: 'images/Toilet.png', 298 | }, 299 | ]] 300 | var MAPINFO = ALLMAPINFO[0]; -------------------------------------------------------------------------------- /demos/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |
17 | 18 | 19 |
20 |
21 |
22 |
23 |
24 | 25 | 26 |
27 |
28 | 29 | 30 |
31 |
32 |
33 | [Your browser is too old!] 34 |
35 | 36 | 37 | 75 | 76 | 195 | 196 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |
18 | 19 | 20 |
21 |
22 |
23 |
24 |
25 | 26 | 27 |
28 |
29 | 30 | 31 |
32 |
33 |
34 | [Your browser is too old!] 35 |
36 | 37 | 38 | 76 | 77 | 196 | 197 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /demos/web/scripts/canvas-zoom.js: -------------------------------------------------------------------------------- 1 | /* 2 | ================================= 3 | canvas-zoom - v0.1 4 | http://github.com/licaomeng/canvas-zoom 5 | 6 | (c) 2015 Caomeng LI 7 | This code may be freely distributed under the Apache License 8 | ================================= 9 | */ 10 | 11 | (function () { 12 | var root = this; // global object 13 | var CanvasZoom = function (options) { 14 | if (!options || !options.canvas) { 15 | throw 'CanvasZoom constructor: missing arguments canvas'; 16 | } 17 | 18 | this.canvas = options.canvas; 19 | this.canvas.width = this.canvas.clientWidth; 20 | this.canvas.height = this.canvas.clientHeight; 21 | this.context = this.canvas.getContext('2d'); 22 | 23 | this.desktop = options.desktop || false; // non touch events 24 | 25 | this.scaleAdaption = 1; 26 | 27 | var indoormap = document.getElementById("indoormap"); 28 | var pageWidth = parseInt(indoormap.getAttribute("width")); 29 | var pageHeight = parseInt(indoormap.getAttribute("height")); 30 | currentWidth = document.documentElement.clientWidth; 31 | currentHeight = document.documentElement.clientHeight; 32 | 33 | var offsetX = 0; 34 | var offsetY = 0; 35 | if (pageWidth < pageHeight) {//canvas.width < canvas.height 36 | this.scaleAdaption = currentHeight / pageHeight; 37 | if (pageWidth * this.scaleAdaption > currentWidth) { 38 | this.scaleAdaption = this.scaleAdaption * (currentWidth / (this.scaleAdaption * pageWidth)); 39 | } 40 | } else {//canvas.width >= canvas.height 41 | this.scaleAdaption = currentWidth / pageWidth; 42 | if (pageHeight * this.scaleAdaption > currentHeight) { 43 | this.scaleAdaption = this.scaleAdaption * (currentHeight / (this.scaleAdaption * pageHeight)); 44 | } 45 | } 46 | 47 | indoormap.setAttribute("width", pageWidth * this.scaleAdaption); 48 | indoormap.setAttribute("height", pageHeight * this.scaleAdaption); 49 | 50 | this.positionAdaption = { 51 | x: (parseInt(currentWidth) - parseInt(indoormap.getAttribute("width"))) / 2, 52 | y: (parseInt(currentHeight) - parseInt(indoormap.getAttribute("height"))) / 2 53 | }; 54 | 55 | indoormap.setAttribute("width", currentWidth); 56 | indoormap.setAttribute("height", currentHeight); 57 | 58 | this.position = { 59 | x: 0, 60 | y: 0 61 | }; 62 | 63 | this.scale = { 64 | x: 1, 65 | y: 1 66 | }; 67 | 68 | this.focusPointer = { 69 | x: 0, 70 | y: 0 71 | } 72 | 73 | this.lastZoomScale = null; 74 | this.lastX = null; 75 | this.lastY = null; 76 | 77 | this.mdown = false; // desktop drag 78 | 79 | this.init = false; 80 | this.checkRequestAnimationFrame(); 81 | requestAnimationFrame(this.animate.bind(this)); 82 | 83 | this.setEventListeners(); 84 | }; 85 | 86 | CanvasZoom.prototype = { 87 | animate: function () { 88 | // set scale such as image cover all the canvas 89 | if (!this.init) { 90 | var scaleRatio = null; 91 | if (this.canvas.clientWidth > this.canvas.clientHeight) { 92 | scaleRatio = this.scale.x; 93 | } else { 94 | scaleRatio = this.scale.y; 95 | } 96 | this.scale.x = scaleRatio; 97 | this.scale.y = scaleRatio; 98 | this.init = true; 99 | } 100 | this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); 101 | // indoor map drawing function 102 | DrawMapInfo(this.scale.x * this.scaleAdaption, this.scale.y * this.scaleAdaption, this.position.x + this.positionAdaption.x, this.position.y + this.positionAdaption.y); 103 | requestAnimationFrame(this.animate.bind(this)); 104 | }, 105 | 106 | gesturePinchZoom: function (event) { 107 | var zoom = false; 108 | if (event.targetTouches.length >= 2) { 109 | var p1 = event.targetTouches[0]; 110 | var p2 = event.targetTouches[1]; 111 | this.focusPointer.x = (p1.pageX + p2.pageX) / 2; 112 | this.focusPointer.y = (p1.pageY + p2.pageY) / 2; 113 | var zoomScale = Math.sqrt(Math.pow(p2.pageX - p1.pageX, 2) + Math.pow(p2.pageY - p1.pageY, 2)); // euclidian 114 | if (this.lastZoomScale) { 115 | zoom = zoomScale - this.lastZoomScale; 116 | } 117 | this.lastZoomScale = zoomScale; 118 | } 119 | return zoom; 120 | }, 121 | 122 | doZoom: function (zoom) { 123 | if (!zoom) 124 | return; 125 | // new scale 126 | var currentScale = this.scale.x; 127 | var newScale = this.scale.x + zoom / 400; 128 | 129 | if (newScale > 1) { 130 | if (newScale > 2.5) { 131 | newScale = 2.5; 132 | } else { 133 | newScale = this.scale.x + zoom / 400; 134 | } 135 | } else { 136 | newScale = 1; 137 | } 138 | this.scale.x = newScale; 139 | this.scale.y = newScale; 140 | 141 | var deltaScale = newScale - currentScale; 142 | var currentWidth = (this.canvas.width * this.scale.x); 143 | var currentHeight = (this.canvas.height * this.scale.y); 144 | var deltaWidth = this.canvas.width * deltaScale; 145 | var deltaHeight = this.canvas.height * deltaScale; 146 | var canvasmiddleX = this.focusPointer.x; 147 | var canvasmiddleY = this.focusPointer.y; 148 | var xonmap = (-this.position.x) + canvasmiddleX; 149 | var yonmap = (-this.position.y) + canvasmiddleY; 150 | var coefX = -xonmap / (currentWidth); 151 | var coefY = -yonmap / (currentHeight); 152 | var newPosX = this.position.x + deltaWidth * coefX; 153 | var newPosY = this.position.y + deltaHeight * coefY; 154 | // edges cases 155 | var newWidth = currentWidth + deltaWidth; 156 | var newHeight = currentHeight + deltaHeight; 157 | if (newWidth < this.canvas.clientWidth) 158 | return; 159 | if (newPosX > 0) { 160 | newPosX = 0; 161 | } 162 | if (newPosX + newWidth < this.canvas.clientWidth) { 163 | newPosX = this.canvas.clientWidth - newWidth; 164 | } 165 | 166 | if (newHeight < this.canvas.clientHeight) 167 | return; 168 | if (newPosY > 0) { 169 | newPosY = 0; 170 | } 171 | if (newPosY + newHeight < this.canvas.clientHeight) { 172 | newPosY = this.canvas.clientHeight - newHeight; 173 | } 174 | 175 | // finally affectations 176 | this.scale.x = newScale; 177 | this.scale.y = newScale; 178 | this.position.x = newPosX; 179 | this.position.y = newPosY; 180 | }, 181 | 182 | doMove: function (relativeX, relativeY) { 183 | if (this.lastX && this.lastY) { 184 | var deltaX = relativeX - this.lastX; 185 | var deltaY = relativeY - this.lastY; 186 | 187 | var currentWidth = (this.canvas.clientWidth * this.scale.x); 188 | var currentHeight = (this.canvas.clientHeight * this.scale.y); 189 | 190 | this.position.x += deltaX; 191 | this.position.y += deltaY; 192 | 193 | // edge cases 194 | if (this.position.x > 0) { 195 | this.position.x = 0; 196 | } else if (this.position.x + currentWidth < this.canvas.clientWidth) { 197 | this.position.x = this.canvas.width - currentWidth; 198 | } 199 | if (this.position.y > 0) { 200 | this.position.y = 0; 201 | } else if (this.position.y + currentHeight < this.canvas.clientHeight) { 202 | this.position.y = this.canvas.height - currentHeight; 203 | } 204 | } 205 | this.lastX = relativeX; 206 | this.lastY = relativeY; 207 | }, 208 | 209 | setEventListeners: function () { 210 | // touch 211 | this.canvas.addEventListener('touchstart', function (e) { 212 | this.lastX = null; 213 | this.lastY = null; 214 | this.lastZoomScale = null; 215 | }.bind(this)); 216 | 217 | this.canvas.addEventListener('touchmove', function (e) { 218 | e.preventDefault(); 219 | 220 | if (e.targetTouches.length == 2) { // pinch 221 | this.doZoom(this.gesturePinchZoom(e)); 222 | } else if (e.targetTouches.length == 1) {// move 223 | var relativeX = e.targetTouches[0].pageX - this.canvas.getBoundingClientRect().left; 224 | var relativeY = e.targetTouches[0].pageY - this.canvas.getBoundingClientRect().top; 225 | 226 | this.doMove(relativeX, relativeY); 227 | } 228 | }.bind(this)); 229 | 230 | if (this.desktop) { 231 | // keyboard+mouse 232 | window.addEventListener('keyup', function (e) { 233 | if (e.keyCode == 187 || e.keyCode == 61) { // + 234 | this.doZoom(15); 235 | } else if (e.keyCode == 54) {// - 236 | this.doZoom(-15); 237 | } 238 | }.bind(this)); 239 | 240 | window.addEventListener('mousedown', function (e) { 241 | this.mdown = true; 242 | this.lastX = null; 243 | this.lastY = null; 244 | }.bind(this)); 245 | 246 | window.addEventListener('mouseup', function (e) { 247 | this.mdown = false; 248 | }.bind(this)); 249 | 250 | window.addEventListener('mousemove', function (e) { 251 | var relativeX = e.pageX - this.canvas.getBoundingClientRect().left; 252 | var relativeY = e.pageY - this.canvas.getBoundingClientRect().top; 253 | 254 | if (e.target == this.canvas && this.mdown) { 255 | this.doMove(relativeX, relativeY); 256 | } 257 | 258 | if (relativeX <= 0 || relativeX >= this.canvas.clientWidth || relativeY <= 0 || relativeY >= this.canvas.clientHeight) { 259 | this.mdown = false; 260 | } 261 | }.bind(this)); 262 | } 263 | }, 264 | 265 | checkRequestAnimationFrame: function () { 266 | var lastTime = 0; 267 | var vendors = ['ms', 'moz', 'webkit', 'o']; 268 | for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { 269 | window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; 270 | window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] 271 | || window[vendors[x] + 'CancelRequestAnimationFrame']; 272 | } 273 | 274 | if (!window.requestAnimationFrame) { 275 | window.requestAnimationFrame = function (callback, element) { 276 | var currTime = new Date().getTime(); 277 | var timeToCall = Math.max(0, 16 - (currTime - lastTime)); 278 | var id = window.setTimeout(function () { 279 | callback(currTime + timeToCall); 280 | }, timeToCall); 281 | lastTime = currTime + timeToCall; 282 | return id; 283 | }; 284 | } 285 | 286 | if (!window.cancelAnimationFrame) { 287 | window.cancelAnimationFrame = function (id) { 288 | clearTimeout(id); 289 | }; 290 | } 291 | } 292 | }; 293 | 294 | root.CanvasZoom = CanvasZoom; 295 | }).call(this); -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/assets/www/scripts/canvas-zoom.js: -------------------------------------------------------------------------------- 1 | /* 2 | ================================= 3 | canvas-zoom - v0.1 4 | http://github.com/licaomeng/canvas-zoom 5 | 6 | (c) 2015 Caomeng LI 7 | This code may be freely distributed under the Apache License 8 | ================================= 9 | */ 10 | 11 | (function () { 12 | var root = this; // global object 13 | var CanvasZoom = function (options) { 14 | if (!options || !options.canvas) { 15 | throw 'CanvasZoom constructor: missing arguments canvas'; 16 | } 17 | 18 | this.canvas = options.canvas; 19 | this.canvas.width = this.canvas.clientWidth; 20 | this.canvas.height = this.canvas.clientHeight; 21 | this.context = this.canvas.getContext('2d'); 22 | 23 | this.desktop = options.desktop || false; // non touch events 24 | 25 | this.scaleAdaption = 1; 26 | 27 | var indoormap = document.getElementById("indoormap"); 28 | var pageWidth = parseInt(indoormap.getAttribute("width")); 29 | var pageHeight = parseInt(indoormap.getAttribute("height")); 30 | currentWidth = document.documentElement.clientWidth; 31 | currentHeight = document.documentElement.clientHeight; 32 | 33 | var offsetX = 0; 34 | var offsetY = 0; 35 | if (pageWidth < pageHeight) {//canvas.width < canvas.height 36 | this.scaleAdaption = currentHeight / pageHeight; 37 | if (pageWidth * this.scaleAdaption > currentWidth) { 38 | this.scaleAdaption = this.scaleAdaption * (currentWidth / (this.scaleAdaption * pageWidth)); 39 | } 40 | } else {//canvas.width >= canvas.height 41 | this.scaleAdaption = currentWidth / pageWidth; 42 | if (pageHeight * this.scaleAdaption > currentHeight) { 43 | this.scaleAdaption = this.scaleAdaption * (currentHeight / (this.scaleAdaption * pageHeight)); 44 | } 45 | } 46 | 47 | indoormap.setAttribute("width", pageWidth * this.scaleAdaption); 48 | indoormap.setAttribute("height", pageHeight * this.scaleAdaption); 49 | 50 | this.positionAdaption = { 51 | x: (parseInt(currentWidth) - parseInt(indoormap.getAttribute("width"))) / 2, 52 | y: (parseInt(currentHeight) - parseInt(indoormap.getAttribute("height"))) / 2 53 | }; 54 | 55 | indoormap.setAttribute("width", currentWidth); 56 | indoormap.setAttribute("height", currentHeight); 57 | 58 | this.position = { 59 | x: 0, 60 | y: 0 61 | }; 62 | 63 | this.scale = { 64 | x: 1, 65 | y: 1 66 | }; 67 | 68 | this.focusPointer = { 69 | x: 0, 70 | y: 0 71 | } 72 | 73 | this.lastZoomScale = null; 74 | this.lastX = null; 75 | this.lastY = null; 76 | 77 | this.mdown = false; // desktop drag 78 | 79 | this.init = false; 80 | this.checkRequestAnimationFrame(); 81 | requestAnimationFrame(this.animate.bind(this)); 82 | 83 | this.setEventListeners(); 84 | }; 85 | 86 | CanvasZoom.prototype = { 87 | animate: function () { 88 | // set scale such as image cover all the canvas 89 | if (!this.init) { 90 | var scaleRatio = null; 91 | if (this.canvas.clientWidth > this.canvas.clientHeight) { 92 | scaleRatio = this.scale.x; 93 | } else { 94 | scaleRatio = this.scale.y; 95 | } 96 | this.scale.x = scaleRatio; 97 | this.scale.y = scaleRatio; 98 | this.init = true; 99 | } 100 | this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); 101 | // indoor map drawing function 102 | DrawMapInfo(this.scale.x * this.scaleAdaption, this.scale.y * this.scaleAdaption, this.position.x + this.positionAdaption.x, this.position.y + this.positionAdaption.y); 103 | requestAnimationFrame(this.animate.bind(this)); 104 | }, 105 | 106 | gesturePinchZoom: function (event) { 107 | var zoom = false; 108 | if (event.targetTouches.length >= 2) { 109 | var p1 = event.targetTouches[0]; 110 | var p2 = event.targetTouches[1]; 111 | this.focusPointer.x = (p1.pageX + p2.pageX) / 2; 112 | this.focusPointer.y = (p1.pageY + p2.pageY) / 2; 113 | var zoomScale = Math.sqrt(Math.pow(p2.pageX - p1.pageX, 2) + Math.pow(p2.pageY - p1.pageY, 2)); // euclidian 114 | if (this.lastZoomScale) { 115 | zoom = zoomScale - this.lastZoomScale; 116 | } 117 | this.lastZoomScale = zoomScale; 118 | } 119 | return zoom; 120 | }, 121 | 122 | doZoom: function (zoom) { 123 | if (!zoom) 124 | return; 125 | // new scale 126 | var currentScale = this.scale.x; 127 | var newScale = this.scale.x + zoom / 400; 128 | 129 | if (newScale > 1) { 130 | if (newScale > 2.5) { 131 | newScale = 2.5; 132 | } else { 133 | newScale = this.scale.x + zoom / 400; 134 | } 135 | } else { 136 | newScale = 1; 137 | } 138 | this.scale.x = newScale; 139 | this.scale.y = newScale; 140 | 141 | var deltaScale = newScale - currentScale; 142 | var currentWidth = (this.canvas.width * this.scale.x); 143 | var currentHeight = (this.canvas.height * this.scale.y); 144 | var deltaWidth = this.canvas.width * deltaScale; 145 | var deltaHeight = this.canvas.height * deltaScale; 146 | var canvasmiddleX = this.focusPointer.x; 147 | var canvasmiddleY = this.focusPointer.y; 148 | var xonmap = (-this.position.x) + canvasmiddleX; 149 | var yonmap = (-this.position.y) + canvasmiddleY; 150 | var coefX = -xonmap / (currentWidth); 151 | var coefY = -yonmap / (currentHeight); 152 | var newPosX = this.position.x + deltaWidth * coefX; 153 | var newPosY = this.position.y + deltaHeight * coefY; 154 | // edges cases 155 | var newWidth = currentWidth + deltaWidth; 156 | var newHeight = currentHeight + deltaHeight; 157 | if (newWidth < this.canvas.clientWidth) 158 | return; 159 | if (newPosX > 0) { 160 | newPosX = 0; 161 | } 162 | if (newPosX + newWidth < this.canvas.clientWidth) { 163 | newPosX = this.canvas.clientWidth - newWidth; 164 | } 165 | 166 | if (newHeight < this.canvas.clientHeight) 167 | return; 168 | if (newPosY > 0) { 169 | newPosY = 0; 170 | } 171 | if (newPosY + newHeight < this.canvas.clientHeight) { 172 | newPosY = this.canvas.clientHeight - newHeight; 173 | } 174 | 175 | // finally affectations 176 | this.scale.x = newScale; 177 | this.scale.y = newScale; 178 | this.position.x = newPosX; 179 | this.position.y = newPosY; 180 | }, 181 | 182 | doMove: function (relativeX, relativeY) { 183 | if (this.lastX && this.lastY) { 184 | var deltaX = relativeX - this.lastX; 185 | var deltaY = relativeY - this.lastY; 186 | 187 | var currentWidth = (this.canvas.clientWidth * this.scale.x); 188 | var currentHeight = (this.canvas.clientHeight * this.scale.y); 189 | 190 | this.position.x += deltaX; 191 | this.position.y += deltaY; 192 | 193 | // edge cases 194 | if (this.position.x > 0) { 195 | this.position.x = 0; 196 | } else if (this.position.x + currentWidth < this.canvas.clientWidth) { 197 | this.position.x = this.canvas.width - currentWidth; 198 | } 199 | if (this.position.y > 0) { 200 | this.position.y = 0; 201 | } else if (this.position.y + currentHeight < this.canvas.clientHeight) { 202 | this.position.y = this.canvas.height - currentHeight; 203 | } 204 | } 205 | this.lastX = relativeX; 206 | this.lastY = relativeY; 207 | }, 208 | 209 | setEventListeners: function () { 210 | // touch 211 | this.canvas.addEventListener('touchstart', function (e) { 212 | this.lastX = null; 213 | this.lastY = null; 214 | this.lastZoomScale = null; 215 | }.bind(this)); 216 | 217 | this.canvas.addEventListener('touchmove', function (e) { 218 | e.preventDefault(); 219 | 220 | if (e.targetTouches.length == 2) { // pinch 221 | this.doZoom(this.gesturePinchZoom(e)); 222 | } else if (e.targetTouches.length == 1) {// move 223 | var relativeX = e.targetTouches[0].pageX - this.canvas.getBoundingClientRect().left; 224 | var relativeY = e.targetTouches[0].pageY - this.canvas.getBoundingClientRect().top; 225 | 226 | this.doMove(relativeX, relativeY); 227 | } 228 | }.bind(this)); 229 | 230 | if (this.desktop) { 231 | // keyboard+mouse 232 | window.addEventListener('keyup', function (e) { 233 | if (e.keyCode == 187 || e.keyCode == 61) { // + 234 | this.doZoom(15); 235 | } else if (e.keyCode == 54) {// - 236 | this.doZoom(-15); 237 | } 238 | }.bind(this)); 239 | 240 | window.addEventListener('mousedown', function (e) { 241 | this.mdown = true; 242 | this.lastX = null; 243 | this.lastY = null; 244 | }.bind(this)); 245 | 246 | window.addEventListener('mouseup', function (e) { 247 | this.mdown = false; 248 | }.bind(this)); 249 | 250 | window.addEventListener('mousemove', function (e) { 251 | var relativeX = e.pageX - this.canvas.getBoundingClientRect().left; 252 | var relativeY = e.pageY - this.canvas.getBoundingClientRect().top; 253 | 254 | if (e.target == this.canvas && this.mdown) { 255 | this.doMove(relativeX, relativeY); 256 | } 257 | 258 | if (relativeX <= 0 || relativeX >= this.canvas.clientWidth || relativeY <= 0 || relativeY >= this.canvas.clientHeight) { 259 | this.mdown = false; 260 | } 261 | }.bind(this)); 262 | } 263 | }, 264 | 265 | checkRequestAnimationFrame: function () { 266 | var lastTime = 0; 267 | var vendors = ['ms', 'moz', 'webkit', 'o']; 268 | for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { 269 | window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; 270 | window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] 271 | || window[vendors[x] + 'CancelRequestAnimationFrame']; 272 | } 273 | 274 | if (!window.requestAnimationFrame) { 275 | window.requestAnimationFrame = function (callback, element) { 276 | var currTime = new Date().getTime(); 277 | var timeToCall = Math.max(0, 16 - (currTime - lastTime)); 278 | var id = window.setTimeout(function () { 279 | callback(currTime + timeToCall); 280 | }, timeToCall); 281 | lastTime = currTime + timeToCall; 282 | return id; 283 | }; 284 | } 285 | 286 | if (!window.cancelAnimationFrame) { 287 | window.cancelAnimationFrame = function (id) { 288 | clearTimeout(id); 289 | }; 290 | } 291 | } 292 | }; 293 | 294 | root.CanvasZoom = CanvasZoom; 295 | }).call(this); -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/lib/emulator.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /* 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | var shell = require('shelljs'), 23 | path = require('path'), 24 | appinfo = require('./appinfo'), 25 | build = require('./build'), 26 | ROOT = path.join(__dirname, '..', '..'), 27 | new_emulator = 'cordova_emulator'; 28 | 29 | /** 30 | * Returns a list of emulator images in the form of objects 31 | * { 32 | name : , 33 | path : , 34 | target : , 35 | abi : , 36 | skin : 37 | } 38 | */ 39 | module.exports.list_images = function() { 40 | var cmd = 'android list avds'; 41 | var result = shell.exec(cmd, {silent:true, async:false}); 42 | if (result.code > 0) { 43 | console.error('Failed to execute android command \'' + cmd + '\'.'); 44 | process.exit(2); 45 | } else { 46 | var response = result.output.split('\n'); 47 | var emulator_list = []; 48 | for (var i = 1; i < response.length; i++) { 49 | // To return more detailed information use img_obj 50 | var img_obj = {}; 51 | if (response[i].match(/Name:\s/)) { 52 | img_obj['name'] = response[i].split('Name: ')[1].replace('\r', ''); 53 | if (response[i + 1].match(/Path:\s/)) { 54 | i++; 55 | img_obj['path'] = response[i].split('Path: ')[1].replace('\r', ''); 56 | } 57 | if (response[i + 1].match(/\(API\slevel\s/)) { 58 | i++; 59 | img_obj['target'] = response[i].replace('\r', ''); 60 | } 61 | if (response[i + 1].match(/ABI:\s/)) { 62 | i++; 63 | img_obj['abi'] = response[i].split('ABI: ')[1].replace('\r', ''); 64 | } 65 | if (response[i + 1].match(/Skin:\s/)) { 66 | i++; 67 | img_obj['skin'] = response[i].split('Skin: ')[1].replace('\r', ''); 68 | } 69 | 70 | emulator_list.push(img_obj); 71 | } 72 | /* To just return a list of names use this 73 | if (response[i].match(/Name:\s/)) { 74 | emulator_list.push(response[i].split('Name: ')[1].replace('\r', ''); 75 | }*/ 76 | 77 | } 78 | return emulator_list; 79 | } 80 | } 81 | 82 | /** 83 | * Will return the closest avd to the projects target 84 | * or undefined if no avds exist. 85 | */ 86 | module.exports.best_image = function() { 87 | var project_target = this.get_target().replace('android-', ''); 88 | var images = this.list_images(); 89 | var closest = 9999; 90 | var best = images[0]; 91 | for (i in images) { 92 | var target = images[i].target; 93 | if(target) { 94 | var num = target.split('(API level ')[1].replace(')', ''); 95 | if (num == project_target) { 96 | return images[i]; 97 | } else if (project_target - num < closest && project_target > num) { 98 | var closest = project_target - num; 99 | best = images[i]; 100 | } 101 | } 102 | } 103 | return best; 104 | } 105 | 106 | module.exports.list_started = function() { 107 | var cmd = 'adb devices'; 108 | var result = shell.exec(cmd, {silent:true, async:false}); 109 | if (result.code > 0) { 110 | console.error('Failed to execute android command \'' + cmd + '\'.'); 111 | process.exit(2); 112 | } else { 113 | var response = result.output.split('\n'); 114 | var started_emulator_list = []; 115 | for (var i = 1; i < response.length; i++) { 116 | if (response[i].match(/device/) && response[i].match(/emulator/)) { 117 | started_emulator_list.push(response[i].replace(/\tdevice/, '').replace('\r', '')); 118 | } 119 | } 120 | return started_emulator_list; 121 | } 122 | } 123 | 124 | module.exports.get_target = function() { 125 | var target = shell.grep(/target=android-[\d+]/, path.join(ROOT, 'project.properties')); 126 | return target.split('=')[1].replace('\n', '').replace('\r', '').replace(' ', ''); 127 | } 128 | 129 | module.exports.list_targets = function() { 130 | var target_out = shell.exec('android list targets', {silent:true, async:false}).output.split('\n'); 131 | var targets = []; 132 | for (var i = target_out.length; i >= 0; i--) { 133 | if(target_out[i].match(/id:/)) { 134 | targets.push(targets[i].split(' ')[1]); 135 | } 136 | } 137 | return targets; 138 | } 139 | 140 | /* 141 | * Starts an emulator with the given ID, 142 | * and returns the started ID of that emulator. 143 | * If no ID is given it will used the first image availible, 144 | * if no image is availible it will error out (maybe create one?). 145 | */ 146 | module.exports.start = function(emulator_ID) { 147 | var started_emulators = this.list_started(); 148 | var num_started = started_emulators.length; 149 | if (typeof emulator_ID === 'undefined') { 150 | var emulator_list = this.list_images(); 151 | if (emulator_list.length > 0) { 152 | emulator_ID = this.best_image().name; 153 | console.log('WARNING : no emulator specified, defaulting to ' + emulator_ID); 154 | } else { 155 | console.error('ERROR : No emulator images (avds) found, if you would like to create an'); 156 | console.error(' avd follow the instructions provided here : '); 157 | console.error(' http://developer.android.com/tools/devices/index.html') 158 | console.error(' Or run \'android create avd --name --target \' '); 159 | console.error(' in on the command line.'); 160 | process.exit(2); 161 | /*console.log('WARNING : no emulators availible, creating \'' + new_emulator + '\'.'); 162 | this.create_image(new_emulator, this.get_target()); 163 | emulator_ID = new_emulator;*/ 164 | } 165 | } 166 | 167 | var pipe_null = (process.platform == 'win32' || process.platform == 'win64'? '> NUL' : '> /dev/null'); 168 | var cmd = 'emulator -avd ' + emulator_ID + ' ' + pipe_null + ' &'; 169 | if(process.platform == 'win32' || process.platform == 'win64') { 170 | cmd = '%comspec% /c start cmd /c ' + cmd; 171 | } 172 | var result = shell.exec(cmd, {silent:true, async:false}, function(code, output) { 173 | if (code > 0) { 174 | console.error('Failed to execute android command \'' + cmd + '\'.'); 175 | console.error(output); 176 | process.exit(2); 177 | } 178 | }); 179 | 180 | // wait for emulator to start 181 | console.log('Waiting for emulator...'); 182 | var new_started = this.wait_for_emulator(num_started); 183 | var emulator_id; 184 | if (new_started.length > 1) { 185 | for (i in new_started) { 186 | console.log(new_started[i]); 187 | console.log(started_emulators.indexOf(new_started[i])); 188 | if (started_emulators.indexOf(new_started[i]) < 0) { 189 | emulator_id = new_started[i]; 190 | } 191 | } 192 | } else { 193 | emulator_id = new_started[0]; 194 | } 195 | if (!emulator_id) { 196 | console.error('ERROR : Failed to start emulator, could not find new emulator'); 197 | process.exit(2); 198 | } 199 | 200 | //wait for emulator to boot up 201 | process.stdout.write('Booting up emulator (this may take a while)...'); 202 | this.wait_for_boot(emulator_id); 203 | console.log('BOOT COMPLETE'); 204 | 205 | //unlock screen 206 | cmd = 'adb -s ' + emulator_id + ' shell input keyevent 82'; 207 | shell.exec(cmd, {silent:false, async:false}); 208 | 209 | //return the new emulator id for the started emulators 210 | return emulator_id; 211 | } 212 | 213 | /* 214 | * Waits for the new emulator to apear on the started-emulator list. 215 | */ 216 | module.exports.wait_for_emulator = function(num_running) { 217 | var new_started = this.list_started(); 218 | if (new_started.length > num_running) { 219 | return new_started; 220 | } else { 221 | this.sleep(1); 222 | return this.wait_for_emulator(num_running); 223 | } 224 | } 225 | 226 | /* 227 | * Waits for the boot animation property of the emulator to switch to 'stopped' 228 | */ 229 | module.exports.wait_for_boot = function(emulator_id) { 230 | var cmd; 231 | // ShellJS opens a lot of file handles, and the default on OS X is too small. 232 | // TODO : This is not working, need to find a better way to increese the ulimit. 233 | if(process.platform == 'win32' || process.platform == 'win64') { 234 | cmd = 'adb -s ' + emulator_id + ' shell getprop init.svc.bootanim'; 235 | } else { 236 | cmd = 'ulimit -S -n 4096; adb -s ' + emulator_id + ' shell getprop init.svc.bootanim'; 237 | } 238 | var boot_anim = shell.exec(cmd, {silent:true, async:false}); 239 | if (boot_anim.output.match(/stopped/)) { 240 | return; 241 | } else { 242 | process.stdout.write('.'); 243 | this.sleep(3); 244 | return this.wait_for_boot(emulator_id); 245 | } 246 | } 247 | 248 | /* 249 | * TODO : find a better way to wait for the emulator (maybe using async methods?) 250 | */ 251 | module.exports.sleep = function(time_sec) { 252 | if (process.platform == 'win32' || process.platform == 'win64') { 253 | shell.exec('ping 127.0.0.1 -n ' + time_sec, {silent:true, async:false}); 254 | } else { 255 | shell.exec('sleep ' + time_sec, {silent:true, async:false}); 256 | } 257 | } 258 | 259 | /* 260 | * Create avd 261 | * TODO : Enter the stdin input required to complete the creation of an avd. 262 | */ 263 | module.exports.create_image = function(name, target) { 264 | console.log('Creating avd named ' + name); 265 | if (target) { 266 | var cmd = 'android create avd --name ' + name + ' --target ' + target; 267 | var create = shell.exec(cmd, {sient:false, async:false}); 268 | if (create.error) { 269 | console.error('ERROR : Failed to create emulator image : '); 270 | console.error(' Do you have the latest android targets including ' + target + '?'); 271 | console.error(create.output); 272 | process.exit(2); 273 | } 274 | } else { 275 | console.log('WARNING : Project target not found, creating avd with a different target but the project may fail to install.'); 276 | var cmd = 'android create avd --name ' + name + ' --target ' + this.list_targets()[0]; 277 | var create = shell.exec(cmd, {sient:false, async:false}); 278 | if (create.error) { 279 | console.error('ERROR : Failed to create emulator image : '); 280 | console.error(create.output); 281 | process.exit(2); 282 | } 283 | console.error('ERROR : Unable to create an avd emulator, no targets found.'); 284 | console.error('Please insure you have targets availible by runing the "android" command'). 285 | process.exit(2); 286 | } 287 | } 288 | 289 | /* 290 | * Installs a previously built application on the emulator and launches it. 291 | * If no target is specified, then it picks one. 292 | * If no started emulators are found, error out. 293 | */ 294 | module.exports.install = function(target) { 295 | var emulator_list = this.list_started(); 296 | if (emulator_list.length < 1) { 297 | console.error('ERROR : No started emulators found, please start an emultor before deploying your project.'); 298 | process.exit(2); 299 | /*console.log('WARNING : No started emulators found, attemting to start an avd...'); 300 | this.start(this.best_image().name);*/ 301 | } 302 | // default emulator 303 | target = typeof target !== 'undefined' ? target : emulator_list[0]; 304 | if (emulator_list.indexOf(target) > -1) { 305 | console.log('Installing app on emulator...'); 306 | var apk_path = build.get_apk(); 307 | var cmd = 'adb -s ' + target + ' install -r ' + apk_path; 308 | var install = shell.exec(cmd, {sient:false, async:false}); 309 | if (install.error || install.output.match(/Failure/)) { 310 | console.error('ERROR : Failed to install apk to emulator : '); 311 | console.error(install.output); 312 | process.exit(2); 313 | } 314 | 315 | //unlock screen 316 | cmd = 'adb -s ' + target + ' shell input keyevent 82'; 317 | shell.exec(cmd, {silent:true, async:false}); 318 | 319 | // launch the application 320 | console.log('Launching application...'); 321 | var launchName = appinfo.getActivityName(); 322 | cmd = 'adb -s ' + target + ' shell am start -W -a android.intent.action.MAIN -n ' + launchName; 323 | console.log(cmd); 324 | var launch = shell.exec(cmd, {silent:false, async:false}); 325 | if(launch.code > 0) { 326 | console.error('ERROR : Failed to launch application on emulator : ' + launch.error); 327 | console.error(launch.output); 328 | process.exit(2); 329 | } else { 330 | console.log('LANCH SUCCESS'); 331 | } 332 | } else { 333 | console.error('ERROR : Unable to find target \'' + target + '\'.'); 334 | console.error('Failed to deploy to emulator.'); 335 | process.exit(2); 336 | } 337 | } 338 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/node_modules/shelljs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "shelljs", 3 | "version": "0.1.4", 4 | "author": { 5 | "name": "Artur Adib", 6 | "email": "aadib@mozilla.com" 7 | }, 8 | "description": "Portable Unix shell commands for Node.js", 9 | "keywords": [ 10 | "unix", 11 | "shell", 12 | "makefile", 13 | "make", 14 | "jake", 15 | "synchronous" 16 | ], 17 | "repository": { 18 | "type": "git", 19 | "url": "git://github.com/arturadib/shelljs.git" 20 | }, 21 | "homepage": "http://github.com/arturadib/shelljs", 22 | "main": "./shell.js", 23 | "scripts": { 24 | "test": "node scripts/run-tests" 25 | }, 26 | "bin": { 27 | "shjs": "./bin/shjs" 28 | }, 29 | "dependencies": {}, 30 | "devDependencies": { 31 | "jshint": "~1.1.0" 32 | }, 33 | "optionalDependencies": {}, 34 | "engines": { 35 | "node": "*" 36 | }, 37 | "readme": "# ShellJS - Unix shell commands for Node.js [![Build Status](https://secure.travis-ci.org/arturadib/shelljs.png)](http://travis-ci.org/arturadib/shelljs)\n\nShellJS is a portable **(Windows/Linux/OS X)** implementation of Unix shell commands on top of the Node.js API. You can use it to eliminate your shell script's dependency on Unix while still keeping its familiar and powerful commands. You can also install it globally so you can run it from outside Node projects - say goodbye to those gnarly Bash scripts!\n\nThe project is [unit-tested](http://travis-ci.org/arturadib/shelljs) and battled-tested in projects like:\n\n+ [PDF.js](http://github.com/mozilla/pdf.js) - Firefox's next-gen PDF reader\n+ [Firebug](http://getfirebug.com/) - Firefox's infamous debugger\n+ [JSHint](http://jshint.com) - Most popular JavaScript linter\n+ [Zepto](http://zeptojs.com) - jQuery-compatible JavaScript library for modern browsers\n+ [Yeoman](http://yeoman.io/) - Web application stack and development tool\n+ [Deployd.com](http://deployd.com) - Open source PaaS for quick API backend generation\n\nand [many more](https://npmjs.org/browse/depended/shelljs).\n\n## Installing\n\nVia npm:\n\n```bash\n$ npm install [-g] shelljs\n```\n\nIf the global option `-g` is specified, the binary `shjs` will be installed. This makes it possible to\nrun ShellJS scripts much like any shell script from the command line, i.e. without requiring a `node_modules` folder:\n\n```bash\n$ shjs my_script\n```\n\nYou can also just copy `shell.js` into your project's directory, and `require()` accordingly.\n\n\n## Examples\n\n### JavaScript\n\n```javascript\nrequire('shelljs/global');\n\nif (!which('git')) {\n echo('Sorry, this script requires git');\n exit(1);\n}\n\n// Copy files to release dir\nmkdir('-p', 'out/Release');\ncp('-R', 'stuff/*', 'out/Release');\n\n// Replace macros in each .js file\ncd('lib');\nls('*.js').forEach(function(file) {\n sed('-i', 'BUILD_VERSION', 'v0.1.2', file);\n sed('-i', /.*REMOVE_THIS_LINE.*\\n/, '', file);\n sed('-i', /.*REPLACE_LINE_WITH_MACRO.*\\n/, cat('macro.js'), file);\n});\ncd('..');\n\n// Run external tool synchronously\nif (exec('git commit -am \"Auto-commit\"').code !== 0) {\n echo('Error: Git commit failed');\n exit(1);\n}\n```\n\n### CoffeeScript\n\n```coffeescript\nrequire 'shelljs/global'\n\nif not which 'git'\n echo 'Sorry, this script requires git'\n exit 1\n\n# Copy files to release dir\nmkdir '-p', 'out/Release'\ncp '-R', 'stuff/*', 'out/Release'\n\n# Replace macros in each .js file\ncd 'lib'\nfor file in ls '*.js'\n sed '-i', 'BUILD_VERSION', 'v0.1.2', file\n sed '-i', /.*REMOVE_THIS_LINE.*\\n/, '', file\n sed '-i', /.*REPLACE_LINE_WITH_MACRO.*\\n/, cat 'macro.js', file\ncd '..'\n\n# Run external tool synchronously\nif (exec 'git commit -am \"Auto-commit\"').code != 0\n echo 'Error: Git commit failed'\n exit 1\n```\n\n## Global vs. Local\n\nThe example above uses the convenience script `shelljs/global` to reduce verbosity. If polluting your global namespace is not desirable, simply require `shelljs`.\n\nExample:\n\n```javascript\nvar shell = require('shelljs');\nshell.echo('hello world');\n```\n\n## Make tool\n\nA convenience script `shelljs/make` is also provided to mimic the behavior of a Unix Makefile. In this case all shell objects are global, and command line arguments will cause the script to execute only the corresponding function in the global `target` object. To avoid redundant calls, target functions are executed only once per script.\n\nExample (CoffeeScript):\n\n```coffeescript\nrequire 'shelljs/make'\n\ntarget.all = ->\n target.bundle()\n target.docs()\n\ntarget.bundle = ->\n cd __dirname\n mkdir 'build'\n cd 'lib'\n (cat '*.js').to '../build/output.js'\n\ntarget.docs = ->\n cd __dirname\n mkdir 'docs'\n cd 'lib'\n for file in ls '*.js'\n text = grep '//@', file # extract special comments\n text.replace '//@', '' # remove comment tags\n text.to 'docs/my_docs.md'\n```\n\nTo run the target `all`, call the above script without arguments: `$ node make`. To run the target `docs`: `$ node make docs`, and so on.\n\n\n\n\n\n\n## Command reference\n\n\nAll commands run synchronously, unless otherwise stated.\n\n\n### cd('dir')\nChanges to directory `dir` for the duration of the script\n\n### pwd()\nReturns the current directory.\n\n### ls([options ,] path [,path ...])\n### ls([options ,] path_array)\nAvailable options:\n\n+ `-R`: recursive\n+ `-A`: all files (include files beginning with `.`, except for `.` and `..`)\n\nExamples:\n\n```javascript\nls('projs/*.js');\nls('-R', '/users/me', '/tmp');\nls('-R', ['/users/me', '/tmp']); // same as above\n```\n\nReturns array of files in the given path, or in current directory if no path provided.\n\n### find(path [,path ...])\n### find(path_array)\nExamples:\n\n```javascript\nfind('src', 'lib');\nfind(['src', 'lib']); // same as above\nfind('.').filter(function(file) { return file.match(/\\.js$/); });\n```\n\nReturns array of all files (however deep) in the given paths.\n\nThe main difference from `ls('-R', path)` is that the resulting file names\ninclude the base directories, e.g. `lib/resources/file1` instead of just `file1`.\n\n### cp([options ,] source [,source ...], dest)\n### cp([options ,] source_array, dest)\nAvailable options:\n\n+ `-f`: force\n+ `-r, -R`: recursive\n\nExamples:\n\n```javascript\ncp('file1', 'dir1');\ncp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp');\ncp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above\n```\n\nCopies files. The wildcard `*` is accepted.\n\n### rm([options ,] file [, file ...])\n### rm([options ,] file_array)\nAvailable options:\n\n+ `-f`: force\n+ `-r, -R`: recursive\n\nExamples:\n\n```javascript\nrm('-rf', '/tmp/*');\nrm('some_file.txt', 'another_file.txt');\nrm(['some_file.txt', 'another_file.txt']); // same as above\n```\n\nRemoves files. The wildcard `*` is accepted.\n\n### mv(source [, source ...], dest')\n### mv(source_array, dest')\nAvailable options:\n\n+ `f`: force\n\nExamples:\n\n```javascript\nmv('-f', 'file', 'dir/');\nmv('file1', 'file2', 'dir/');\nmv(['file1', 'file2'], 'dir/'); // same as above\n```\n\nMoves files. The wildcard `*` is accepted.\n\n### mkdir([options ,] dir [, dir ...])\n### mkdir([options ,] dir_array)\nAvailable options:\n\n+ `p`: full path (will create intermediate dirs if necessary)\n\nExamples:\n\n```javascript\nmkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g');\nmkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above\n```\n\nCreates directories.\n\n### test(expression)\nAvailable expression primaries:\n\n+ `'-b', 'path'`: true if path is a block device\n+ `'-c', 'path'`: true if path is a character device\n+ `'-d', 'path'`: true if path is a directory\n+ `'-e', 'path'`: true if path exists\n+ `'-f', 'path'`: true if path is a regular file\n+ `'-L', 'path'`: true if path is a symboilc link\n+ `'-p', 'path'`: true if path is a pipe (FIFO)\n+ `'-S', 'path'`: true if path is a socket\n\nExamples:\n\n```javascript\nif (test('-d', path)) { /* do something with dir */ };\nif (!test('-f', path)) continue; // skip if it's a regular file\n```\n\nEvaluates expression using the available primaries and returns corresponding value.\n\n### cat(file [, file ...])\n### cat(file_array)\n\nExamples:\n\n```javascript\nvar str = cat('file*.txt');\nvar str = cat('file1', 'file2');\nvar str = cat(['file1', 'file2']); // same as above\n```\n\nReturns a string containing the given file, or a concatenated string\ncontaining the files if more than one file is given (a new line character is\nintroduced between each file). Wildcard `*` accepted.\n\n### 'string'.to(file)\n\nExamples:\n\n```javascript\ncat('input.txt').to('output.txt');\n```\n\nAnalogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as\nthose returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_\n\n### sed([options ,] search_regex, replace_str, file)\nAvailable options:\n\n+ `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_\n\nExamples:\n\n```javascript\nsed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js');\nsed(/.*DELETE_THIS_LINE.*\\n/, '', 'source.js');\n```\n\nReads an input string from `file` and performs a JavaScript `replace()` on the input\nusing the given search regex and replacement string. Returns the new string after replacement.\n\n### grep([options ,] regex_filter, file [, file ...])\n### grep([options ,] regex_filter, file_array)\nAvailable options:\n\n+ `-v`: Inverse the sense of the regex and print the lines not matching the criteria.\n\nExamples:\n\n```javascript\ngrep('-v', 'GLOBAL_VARIABLE', '*.js');\ngrep('GLOBAL_VARIABLE', '*.js');\n```\n\nReads input string from given files and returns a string containing all lines of the\nfile that match the given `regex_filter`. Wildcard `*` accepted.\n\n### which(command)\n\nExamples:\n\n```javascript\nvar nodeExec = which('node');\n```\n\nSearches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions.\nReturns string containing the absolute path to the command.\n\n### echo(string [,string ...])\n\nExamples:\n\n```javascript\necho('hello world');\nvar str = echo('hello world');\n```\n\nPrints string to stdout, and returns string with additional utility methods\nlike `.to()`.\n\n### dirs([options | '+N' | '-N'])\n\nAvailable options:\n\n+ `-c`: Clears the directory stack by deleting all of the elements.\n\nArguments:\n\n+ `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.\n+ `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.\n\nDisplay the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified.\n\nSee also: pushd, popd\n\n### pushd([options,] [dir | '-N' | '+N'])\n\nAvailable options:\n\n+ `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.\n\nArguments:\n\n+ `dir`: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir`.\n+ `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.\n+ `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.\n\nExamples:\n\n```javascript\n// process.cwd() === '/usr'\npushd('/etc'); // Returns /etc /usr\npushd('+1'); // Returns /usr /etc\n```\n\nSave the current directory on the top of the directory stack and then cd to `dir`. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.\n\n### popd([options,] ['-N' | '+N'])\n\nAvailable options:\n\n+ `-n`: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.\n\nArguments:\n\n+ `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.\n+ `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.\n\nExamples:\n\n```javascript\necho(process.cwd()); // '/usr'\npushd('/etc'); // '/etc /usr'\necho(process.cwd()); // '/etc'\npopd(); // '/usr'\necho(process.cwd()); // '/usr'\n```\n\nWhen no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.\n\n### exit(code)\nExits the current process with the given exit code.\n\n### env['VAR_NAME']\nObject containing environment variables (both getter and setter). Shortcut to process.env.\n\n### exec(command [, options] [, callback])\nAvailable options (all `false` by default):\n\n+ `async`: Asynchronous execution. Defaults to true if a callback is provided.\n+ `silent`: Do not echo program output to console.\n\nExamples:\n\n```javascript\nvar version = exec('node --version', {silent:true}).output;\n\nvar child = exec('some_long_running_process', {async:true});\nchild.stdout.on('data', function(data) {\n /* ... do something with data ... */\n});\n\nexec('some_long_running_process', function(code, output) {\n console.log('Exit code:', code);\n console.log('Program output:', output);\n});\n```\n\nExecutes the given `command` _synchronously_, unless otherwise specified.\nWhen in synchronous mode returns the object `{ code:..., output:... }`, containing the program's\n`output` (stdout + stderr) and its exit `code`. Otherwise returns the child process object, and\nthe `callback` gets the arguments `(code, output)`.\n\n**Note:** For long-lived processes, it's best to run `exec()` asynchronously as\nthe current synchronous implementation uses a lot of CPU. This should be getting\nfixed soon.\n\n### chmod(octal_mode || octal_string, file)\n### chmod(symbolic_mode, file)\n\nAvailable options:\n\n+ `-v`: output a diagnostic for every file processed\n+ `-c`: like verbose but report only when a change is made\n+ `-R`: change files and directories recursively\n\nExamples:\n\n```javascript\nchmod(755, '/Users/brandon');\nchmod('755', '/Users/brandon'); // same as above \nchmod('u+x', '/Users/brandon');\n```\n\nAlters the permissions of a file or directory by either specifying the\nabsolute permissions in octal form or expressing the changes in symbols.\nThis command tries to mimic the POSIX behavior as much as possible.\nNotable exceptions:\n\n+ In symbolic modes, 'a-r' and '-r' are identical. No consideration is\n given to the umask.\n+ There is no \"quiet\" option since default behavior is to run silent.\n\n## Configuration\n\n\n### config.silent\nExample:\n\n```javascript\nvar silentState = config.silent; // save old silent state\nconfig.silent = true;\n/* ... */\nconfig.silent = silentState; // restore old silent state\n```\n\nSuppresses all command output if `true`, except for `echo()` calls.\nDefault is `false`.\n\n### config.fatal\nExample:\n\n```javascript\nconfig.fatal = true;\ncp('this_file_does_not_exist', '/dev/null'); // dies here\n/* more commands... */\n```\n\nIf `true` the script will die on errors. Default is `false`.\n\n## Non-Unix commands\n\n\n### tempdir()\nSearches and returns string containing a writeable, platform-dependent temporary directory.\nFollows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).\n\n### error()\nTests if error occurred in the last command. Returns `null` if no error occurred,\notherwise returns string explaining the error\n", 38 | "readmeFilename": "README.md", 39 | "bugs": { 40 | "url": "https://github.com/arturadib/shelljs/issues" 41 | }, 42 | "_id": "shelljs@0.1.4", 43 | "dist": { 44 | "shasum": "7a8aeaa3dc3c0be2e59d83168e83b4c4bc4dac95" 45 | }, 46 | "_from": "shelljs@0.1.4", 47 | "_resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.1.4.tgz" 48 | } 49 | -------------------------------------------------------------------------------- /demos/Android/IndoorMap-Canvas-Zoom/cordova/node_modules/shelljs/README.md: -------------------------------------------------------------------------------- 1 | # ShellJS - Unix shell commands for Node.js [![Build Status](https://secure.travis-ci.org/arturadib/shelljs.png)](http://travis-ci.org/arturadib/shelljs) 2 | 3 | ShellJS is a portable **(Windows/Linux/OS X)** implementation of Unix shell commands on top of the Node.js API. You can use it to eliminate your shell script's dependency on Unix while still keeping its familiar and powerful commands. You can also install it globally so you can run it from outside Node projects - say goodbye to those gnarly Bash scripts! 4 | 5 | The project is [unit-tested](http://travis-ci.org/arturadib/shelljs) and battled-tested in projects like: 6 | 7 | + [PDF.js](http://github.com/mozilla/pdf.js) - Firefox's next-gen PDF reader 8 | + [Firebug](http://getfirebug.com/) - Firefox's infamous debugger 9 | + [JSHint](http://jshint.com) - Most popular JavaScript linter 10 | + [Zepto](http://zeptojs.com) - jQuery-compatible JavaScript library for modern browsers 11 | + [Yeoman](http://yeoman.io/) - Web application stack and development tool 12 | + [Deployd.com](http://deployd.com) - Open source PaaS for quick API backend generation 13 | 14 | and [many more](https://npmjs.org/browse/depended/shelljs). 15 | 16 | ## Installing 17 | 18 | Via npm: 19 | 20 | ```bash 21 | $ npm install [-g] shelljs 22 | ``` 23 | 24 | If the global option `-g` is specified, the binary `shjs` will be installed. This makes it possible to 25 | run ShellJS scripts much like any shell script from the command line, i.e. without requiring a `node_modules` folder: 26 | 27 | ```bash 28 | $ shjs my_script 29 | ``` 30 | 31 | You can also just copy `shell.js` into your project's directory, and `require()` accordingly. 32 | 33 | 34 | ## Examples 35 | 36 | ### JavaScript 37 | 38 | ```javascript 39 | require('shelljs/global'); 40 | 41 | if (!which('git')) { 42 | echo('Sorry, this script requires git'); 43 | exit(1); 44 | } 45 | 46 | // Copy files to release dir 47 | mkdir('-p', 'out/Release'); 48 | cp('-R', 'stuff/*', 'out/Release'); 49 | 50 | // Replace macros in each .js file 51 | cd('lib'); 52 | ls('*.js').forEach(function(file) { 53 | sed('-i', 'BUILD_VERSION', 'v0.1.2', file); 54 | sed('-i', /.*REMOVE_THIS_LINE.*\n/, '', file); 55 | sed('-i', /.*REPLACE_LINE_WITH_MACRO.*\n/, cat('macro.js'), file); 56 | }); 57 | cd('..'); 58 | 59 | // Run external tool synchronously 60 | if (exec('git commit -am "Auto-commit"').code !== 0) { 61 | echo('Error: Git commit failed'); 62 | exit(1); 63 | } 64 | ``` 65 | 66 | ### CoffeeScript 67 | 68 | ```coffeescript 69 | require 'shelljs/global' 70 | 71 | if not which 'git' 72 | echo 'Sorry, this script requires git' 73 | exit 1 74 | 75 | # Copy files to release dir 76 | mkdir '-p', 'out/Release' 77 | cp '-R', 'stuff/*', 'out/Release' 78 | 79 | # Replace macros in each .js file 80 | cd 'lib' 81 | for file in ls '*.js' 82 | sed '-i', 'BUILD_VERSION', 'v0.1.2', file 83 | sed '-i', /.*REMOVE_THIS_LINE.*\n/, '', file 84 | sed '-i', /.*REPLACE_LINE_WITH_MACRO.*\n/, cat 'macro.js', file 85 | cd '..' 86 | 87 | # Run external tool synchronously 88 | if (exec 'git commit -am "Auto-commit"').code != 0 89 | echo 'Error: Git commit failed' 90 | exit 1 91 | ``` 92 | 93 | ## Global vs. Local 94 | 95 | The example above uses the convenience script `shelljs/global` to reduce verbosity. If polluting your global namespace is not desirable, simply require `shelljs`. 96 | 97 | Example: 98 | 99 | ```javascript 100 | var shell = require('shelljs'); 101 | shell.echo('hello world'); 102 | ``` 103 | 104 | ## Make tool 105 | 106 | A convenience script `shelljs/make` is also provided to mimic the behavior of a Unix Makefile. In this case all shell objects are global, and command line arguments will cause the script to execute only the corresponding function in the global `target` object. To avoid redundant calls, target functions are executed only once per script. 107 | 108 | Example (CoffeeScript): 109 | 110 | ```coffeescript 111 | require 'shelljs/make' 112 | 113 | target.all = -> 114 | target.bundle() 115 | target.docs() 116 | 117 | target.bundle = -> 118 | cd __dirname 119 | mkdir 'build' 120 | cd 'lib' 121 | (cat '*.js').to '../build/output.js' 122 | 123 | target.docs = -> 124 | cd __dirname 125 | mkdir 'docs' 126 | cd 'lib' 127 | for file in ls '*.js' 128 | text = grep '//@', file # extract special comments 129 | text.replace '//@', '' # remove comment tags 130 | text.to 'docs/my_docs.md' 131 | ``` 132 | 133 | To run the target `all`, call the above script without arguments: `$ node make`. To run the target `docs`: `$ node make docs`, and so on. 134 | 135 | 136 | 137 | 142 | 143 | 144 | ## Command reference 145 | 146 | 147 | All commands run synchronously, unless otherwise stated. 148 | 149 | 150 | ### cd('dir') 151 | Changes to directory `dir` for the duration of the script 152 | 153 | ### pwd() 154 | Returns the current directory. 155 | 156 | ### ls([options ,] path [,path ...]) 157 | ### ls([options ,] path_array) 158 | Available options: 159 | 160 | + `-R`: recursive 161 | + `-A`: all files (include files beginning with `.`, except for `.` and `..`) 162 | 163 | Examples: 164 | 165 | ```javascript 166 | ls('projs/*.js'); 167 | ls('-R', '/users/me', '/tmp'); 168 | ls('-R', ['/users/me', '/tmp']); // same as above 169 | ``` 170 | 171 | Returns array of files in the given path, or in current directory if no path provided. 172 | 173 | ### find(path [,path ...]) 174 | ### find(path_array) 175 | Examples: 176 | 177 | ```javascript 178 | find('src', 'lib'); 179 | find(['src', 'lib']); // same as above 180 | find('.').filter(function(file) { return file.match(/\.js$/); }); 181 | ``` 182 | 183 | Returns array of all files (however deep) in the given paths. 184 | 185 | The main difference from `ls('-R', path)` is that the resulting file names 186 | include the base directories, e.g. `lib/resources/file1` instead of just `file1`. 187 | 188 | ### cp([options ,] source [,source ...], dest) 189 | ### cp([options ,] source_array, dest) 190 | Available options: 191 | 192 | + `-f`: force 193 | + `-r, -R`: recursive 194 | 195 | Examples: 196 | 197 | ```javascript 198 | cp('file1', 'dir1'); 199 | cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp'); 200 | cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above 201 | ``` 202 | 203 | Copies files. The wildcard `*` is accepted. 204 | 205 | ### rm([options ,] file [, file ...]) 206 | ### rm([options ,] file_array) 207 | Available options: 208 | 209 | + `-f`: force 210 | + `-r, -R`: recursive 211 | 212 | Examples: 213 | 214 | ```javascript 215 | rm('-rf', '/tmp/*'); 216 | rm('some_file.txt', 'another_file.txt'); 217 | rm(['some_file.txt', 'another_file.txt']); // same as above 218 | ``` 219 | 220 | Removes files. The wildcard `*` is accepted. 221 | 222 | ### mv(source [, source ...], dest') 223 | ### mv(source_array, dest') 224 | Available options: 225 | 226 | + `f`: force 227 | 228 | Examples: 229 | 230 | ```javascript 231 | mv('-f', 'file', 'dir/'); 232 | mv('file1', 'file2', 'dir/'); 233 | mv(['file1', 'file2'], 'dir/'); // same as above 234 | ``` 235 | 236 | Moves files. The wildcard `*` is accepted. 237 | 238 | ### mkdir([options ,] dir [, dir ...]) 239 | ### mkdir([options ,] dir_array) 240 | Available options: 241 | 242 | + `p`: full path (will create intermediate dirs if necessary) 243 | 244 | Examples: 245 | 246 | ```javascript 247 | mkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g'); 248 | mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above 249 | ``` 250 | 251 | Creates directories. 252 | 253 | ### test(expression) 254 | Available expression primaries: 255 | 256 | + `'-b', 'path'`: true if path is a block device 257 | + `'-c', 'path'`: true if path is a character device 258 | + `'-d', 'path'`: true if path is a directory 259 | + `'-e', 'path'`: true if path exists 260 | + `'-f', 'path'`: true if path is a regular file 261 | + `'-L', 'path'`: true if path is a symboilc link 262 | + `'-p', 'path'`: true if path is a pipe (FIFO) 263 | + `'-S', 'path'`: true if path is a socket 264 | 265 | Examples: 266 | 267 | ```javascript 268 | if (test('-d', path)) { /* do something with dir */ }; 269 | if (!test('-f', path)) continue; // skip if it's a regular file 270 | ``` 271 | 272 | Evaluates expression using the available primaries and returns corresponding value. 273 | 274 | ### cat(file [, file ...]) 275 | ### cat(file_array) 276 | 277 | Examples: 278 | 279 | ```javascript 280 | var str = cat('file*.txt'); 281 | var str = cat('file1', 'file2'); 282 | var str = cat(['file1', 'file2']); // same as above 283 | ``` 284 | 285 | Returns a string containing the given file, or a concatenated string 286 | containing the files if more than one file is given (a new line character is 287 | introduced between each file). Wildcard `*` accepted. 288 | 289 | ### 'string'.to(file) 290 | 291 | Examples: 292 | 293 | ```javascript 294 | cat('input.txt').to('output.txt'); 295 | ``` 296 | 297 | Analogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as 298 | those returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_ 299 | 300 | ### sed([options ,] search_regex, replace_str, file) 301 | Available options: 302 | 303 | + `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_ 304 | 305 | Examples: 306 | 307 | ```javascript 308 | sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js'); 309 | sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js'); 310 | ``` 311 | 312 | Reads an input string from `file` and performs a JavaScript `replace()` on the input 313 | using the given search regex and replacement string. Returns the new string after replacement. 314 | 315 | ### grep([options ,] regex_filter, file [, file ...]) 316 | ### grep([options ,] regex_filter, file_array) 317 | Available options: 318 | 319 | + `-v`: Inverse the sense of the regex and print the lines not matching the criteria. 320 | 321 | Examples: 322 | 323 | ```javascript 324 | grep('-v', 'GLOBAL_VARIABLE', '*.js'); 325 | grep('GLOBAL_VARIABLE', '*.js'); 326 | ``` 327 | 328 | Reads input string from given files and returns a string containing all lines of the 329 | file that match the given `regex_filter`. Wildcard `*` accepted. 330 | 331 | ### which(command) 332 | 333 | Examples: 334 | 335 | ```javascript 336 | var nodeExec = which('node'); 337 | ``` 338 | 339 | Searches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions. 340 | Returns string containing the absolute path to the command. 341 | 342 | ### echo(string [,string ...]) 343 | 344 | Examples: 345 | 346 | ```javascript 347 | echo('hello world'); 348 | var str = echo('hello world'); 349 | ``` 350 | 351 | Prints string to stdout, and returns string with additional utility methods 352 | like `.to()`. 353 | 354 | ### dirs([options | '+N' | '-N']) 355 | 356 | Available options: 357 | 358 | + `-c`: Clears the directory stack by deleting all of the elements. 359 | 360 | Arguments: 361 | 362 | + `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero. 363 | + `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero. 364 | 365 | Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified. 366 | 367 | See also: pushd, popd 368 | 369 | ### pushd([options,] [dir | '-N' | '+N']) 370 | 371 | Available options: 372 | 373 | + `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated. 374 | 375 | Arguments: 376 | 377 | + `dir`: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir`. 378 | + `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack. 379 | + `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack. 380 | 381 | Examples: 382 | 383 | ```javascript 384 | // process.cwd() === '/usr' 385 | pushd('/etc'); // Returns /etc /usr 386 | pushd('+1'); // Returns /usr /etc 387 | ``` 388 | 389 | Save the current directory on the top of the directory stack and then cd to `dir`. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack. 390 | 391 | ### popd([options,] ['-N' | '+N']) 392 | 393 | Available options: 394 | 395 | + `-n`: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated. 396 | 397 | Arguments: 398 | 399 | + `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero. 400 | + `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero. 401 | 402 | Examples: 403 | 404 | ```javascript 405 | echo(process.cwd()); // '/usr' 406 | pushd('/etc'); // '/etc /usr' 407 | echo(process.cwd()); // '/etc' 408 | popd(); // '/usr' 409 | echo(process.cwd()); // '/usr' 410 | ``` 411 | 412 | When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack. 413 | 414 | ### exit(code) 415 | Exits the current process with the given exit code. 416 | 417 | ### env['VAR_NAME'] 418 | Object containing environment variables (both getter and setter). Shortcut to process.env. 419 | 420 | ### exec(command [, options] [, callback]) 421 | Available options (all `false` by default): 422 | 423 | + `async`: Asynchronous execution. Defaults to true if a callback is provided. 424 | + `silent`: Do not echo program output to console. 425 | 426 | Examples: 427 | 428 | ```javascript 429 | var version = exec('node --version', {silent:true}).output; 430 | 431 | var child = exec('some_long_running_process', {async:true}); 432 | child.stdout.on('data', function(data) { 433 | /* ... do something with data ... */ 434 | }); 435 | 436 | exec('some_long_running_process', function(code, output) { 437 | console.log('Exit code:', code); 438 | console.log('Program output:', output); 439 | }); 440 | ``` 441 | 442 | Executes the given `command` _synchronously_, unless otherwise specified. 443 | When in synchronous mode returns the object `{ code:..., output:... }`, containing the program's 444 | `output` (stdout + stderr) and its exit `code`. Otherwise returns the child process object, and 445 | the `callback` gets the arguments `(code, output)`. 446 | 447 | **Note:** For long-lived processes, it's best to run `exec()` asynchronously as 448 | the current synchronous implementation uses a lot of CPU. This should be getting 449 | fixed soon. 450 | 451 | ### chmod(octal_mode || octal_string, file) 452 | ### chmod(symbolic_mode, file) 453 | 454 | Available options: 455 | 456 | + `-v`: output a diagnostic for every file processed 457 | + `-c`: like verbose but report only when a change is made 458 | + `-R`: change files and directories recursively 459 | 460 | Examples: 461 | 462 | ```javascript 463 | chmod(755, '/Users/brandon'); 464 | chmod('755', '/Users/brandon'); // same as above 465 | chmod('u+x', '/Users/brandon'); 466 | ``` 467 | 468 | Alters the permissions of a file or directory by either specifying the 469 | absolute permissions in octal form or expressing the changes in symbols. 470 | This command tries to mimic the POSIX behavior as much as possible. 471 | Notable exceptions: 472 | 473 | + In symbolic modes, 'a-r' and '-r' are identical. No consideration is 474 | given to the umask. 475 | + There is no "quiet" option since default behavior is to run silent. 476 | 477 | ## Configuration 478 | 479 | 480 | ### config.silent 481 | Example: 482 | 483 | ```javascript 484 | var silentState = config.silent; // save old silent state 485 | config.silent = true; 486 | /* ... */ 487 | config.silent = silentState; // restore old silent state 488 | ``` 489 | 490 | Suppresses all command output if `true`, except for `echo()` calls. 491 | Default is `false`. 492 | 493 | ### config.fatal 494 | Example: 495 | 496 | ```javascript 497 | config.fatal = true; 498 | cp('this_file_does_not_exist', '/dev/null'); // dies here 499 | /* more commands... */ 500 | ``` 501 | 502 | If `true` the script will die on errors. Default is `false`. 503 | 504 | ## Non-Unix commands 505 | 506 | 507 | ### tempdir() 508 | Searches and returns string containing a writeable, platform-dependent temporary directory. 509 | Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir). 510 | 511 | ### error() 512 | Tests if error occurred in the last command. Returns `null` if no error occurred, 513 | otherwise returns string explaining the error 514 | --------------------------------------------------------------------------------