ptcrealitylab / vuforia-spatial-toolbox-userinterface

The user interface of the Vuforia Spatial Toolbox
https://spatialtoolbox.vuforia.com
Mozilla Public License 2.0
7 stars 6 forks source link
iot vuforia

vuforia-spatial-toolbox-userinterface

The vuforia-spatial-toolbox-userinterface contains the large majority of the code for rendering the user interface and for client-user interactions. It is a web application that is built to run in a WebView in the vuforia-spatial-toolbox-ios application, which provides device-specific APIs such as AR tracking. All content rendering, user interactions, and most communication with Vuforia Spatial Edge Servers takes place in the userinterface repository.

Read First

The Vuforia Spatial Toolbox and Vuforia Spatial Edge Server make up a shared research platform for exploring spatial computing as a community. This research platform is not an out of the box production-ready enterprise solution. Please read the MPL 2.0 license before use.

Join the conversations in our discourse forum if you have questions, ideas want to collaborate or just say hi.

Installation

Installation instructions for iOS can be found in the Vuforia Toolbox iOS repository.

Installation instructions for Android, when available, will be found in the Vuforia Toolbox Android repository.

Development

If you just want to compile and run the app as it is currently implemented, that is all you need to know about the userinterface.

If, however, you want to understand and contribute to the codebase, the following sections will give you an overview of what you need to know.

Beyond this README, please refer to our Spatial Toolbox Forum for additional questions and answers.

Navigating the Code

index.html is the entry-point for this codebase, and mostly consists of including all the relevant scripts.

The src directory contains all of the JavaScript files defining the application behavior.

It contains the following tree:

Outside of the src directory, we also have directories for additional resources including: css styles, svg and png images (for menu and button icons, etc), nodes (the HTML for how to render each node type), and thirdPartyCode, which contains additional libraries used by the userinterface.

Extending the userinterface with new features

The userinterface has an addon system where it can load additional content_scripts from the addon packages installed on the local vuforia-spatial-edge-server running within the app, such as the Core Addon, whose README contains an example of how to structure such a script.

You will have to recompile the app to update the userinterface with its new content_scripts.

"Plugin" features that are optional to the core functionality of the app are best constructed as addons. Core services that other modules depend on should instead be included directly in this repository.

Important Concepts

To understand how the userinterface works, you should start with a handful of core concepts and entry-points into the codebase:

Notable DOM Elements

If you are debugging the userinterface and need to inspect the HTML Elements, you may want to look at these:

Object Data Model

You should learn several key vocabulary terms, which correspond to classes or other data structures that compose the system's data model.

  1. Object
  2. Frame (Tool)
  3. Node
  4. Link
  5. Data
  6. Logic Node
  7. Block
  8. Block Link

In-depth explanations of each of these concepts are available in the Data Model documentation.

Code Documentation

Most code is documented using JSDoc comments, which can be compiled into human-readable pages of documentation using documentation.js.

You should first install the documentation.js node package:

npm install -g documentation

Then you can generate up-to-date documentation of each file by running the included generate_docs script:

bash ./generate_docs.sh

This will generate a docs directory with a hierarchical set of folders mirroring the structure of the src directory. Open each index.html to view the documented members of each module.

Optimized bundling

The userinterface source code may optionally be bundled using npm run build. This will create a subdirectory dist with the compiled, optimized files. This subdirectory may be used anywhere the normal root of the userinterface would have gone previously. For example, the remote operator hardware interface can be configured to point to <path to userinterface>/dist for a significant speedup once the code is compiled using npm run build.