Mining Site Haulage Simulator
This sample demonstrates a mine haulage simulation. A fleet of haul trucks drives a road network between stations, braking for curves, queuing at busy sites and pathing to their next location. Bottlenecks are detecting and trucks display a red signal when they are stuck waiting.
The trucks themselves are unbound Parts. Every animation frame advances the simulation inside a Diagram.commit with a null transaction name, so nothing is recorded as a model change. All of the machines are built from Geometry path strings, and the moving pieces are named so the simulation can find them with Panel.findObject and redraw their poses.
Click a truck to open its telemetry card, trace its remaining route as a dashed yellow line, and lock the camera to it using Diagram.scale and Diagram.position.
GoJS Features in this sample
Animation
GoJS offers several built-in animations, enabled by default, as well as the ability to create arbitrary animations.
The Diagram.animationManager handles animations within a Diagram. The AnimationManager automatically sets up and dispatches default animations, and has properties to customize and disable them. Custom animations are possible by creating instances of Animation or AnimationTrigger. More information can be found in the GoJS learn pages.
Geometry Path Strings
The GoJS Geometry class controls the "shape" of a Shape, whereas the Shape.fill and Shape.stroke and other shape properties control the colors and appearance of the shape. For common shape figures, there are predefined geometries that can be used by setting Shape.figure. However one can also define custom geometries.
One can construct any Geometry by allocating and initializing a Geometry of at least one PathFigure holding some PathSegments. But you may find that using the string representation of a Geometry is easier to write and save in a database. Use the static method Geometry.parse or the Shape.geometryString property to transform a geometry path string into a Geometry object.
More information can be found in the GoJS learn pages.
HTML Interaction
GoJS Diagrams can be used alongside other HTML elements in a webapp. For custom Text Editors, Context Menus, and ToolTips, which are invoked and hidden via GoJS tool operations, it is best to use the HTMLInfo class.
More information can be found in the GoJS learn pages.