Next to the main product LuciadRIA, a LuciadRIA release installation also contains sample code that illustrates how the LuciadRIA API can help you implement all kinds of use cases.

LuciadRIA sample applications

LuciadRIA samples are small example applications that typically showcase one specific use case. They combine the LuciadRIA API with the React UI framework and multiple re-usable common sample and toolbox packages.

You can find the samples under samples/<module>/<sample_name>. See Editing, building and running the sample code for more information about our samples.

Common sample UI components

The samples/common directory of a release contains UI components that are used by multiple samples.

Some examples are:

  • samples/common/ui/map/SampleMap: a container for a LuciadRIA Map. It renders a <div/> element and creates a Map instance with that element.

  • samples/common/ui/map/SingleMapSample: a sample template based on a single map that covers the entire window. It has a SampleMap, overlay components, and a placeholder for UI below the map, such as the bottomBar property. Most LuciadRIA samples are based on this component.

LuciadRIA Toolbox

LuciadRIA Toolbox is a collection of tools and utility code required by many customers. A basic integration API gives you easy access to the sophisticated features in this toolbox. You either use the toolbox as-is, or completely modify it from source code.

Note that, unlike the samples/common directory, LuciadRIA Toolbox samples don’t contain UI, only functionality.

Some examples are:

  • toolbox/ria/magnifier: a tool that magnifies a part of the map around the mouse cursor.

  • toolbox/ria/scene-navigation : a controller called SceneNavigationController that allows users to better navigate small 3D assets, like a BIM design of a factory.

Re-use sample code in your project

If you want to re-use code from our samples, samples/common, or toolbox packages, we recommend that you copy over the code from the samples to your application.

If you’re not using TypeScript yourself, it can be useful to transpile the LuciadRIA code to JavaScript:

  • For the samples, use the transpile-to-js command.

  • For the common samples and the toolbox packages, launch the TypeScript compiler with the tsc --outDir ./out command.

To make this easier, we recommend using something like webpack resolve aliases, so that you don’t have to change all imports when you’re copying the files to your project.

Although the LuciadRIA Toolbox packages all have a package.json, we explicitly discourage you from adding dependencies to those packages through npm. These packages don’t follow semantic versioning, so a patch update may result in backward-incompatible changes, for example.

Thanks to the backwards compatibility guarantees given for LuciadRIA, the sample code that you copied over from an older LuciadRIA release should still work with a newer LuciadRIA version. If you want to update the code that you copied before to the one present in the latest LuciadRIA release, we recommend that you fully replace your earlier copy with the new code. If that isn’t be possible because you modified the copied code, we recommend using a data comparison tool or merging tool to compare the two versions and resolve the issues one by one.