UMN-LATIS / leaflet-treering

Use link below to test non-released changes.
https://umn-latis.github.io/leaflet-treering/
0 stars 0 forks source link

Repository Link: leaflet-treering

To Run Code:

The repository contains a docker-compose file to assist with development. To begin, run docker compose up to start the container. After it launches, you can visit http://localhost:4000 to access Leaflet Treering.

General Code Style/Organization:

Variable Conventions:

Simple variables use CamelCase naming convention. More complex variables or variables which relate to other variables use SnakeCase.

Descriptive variables names should be used along with comments explaining why code exists are required.

Example:

// Asset title in separate parts so title can be arranged in any order
var assetArea = 'CCS';
var assetNumber = '130';
var assetCode = 'A';
var asset_area_number_code = assestArea + assetNumber + assetCode;

Function Conventions:

Syntax:

Functions which are used more than once or have the possibility to be reused in the future are located under Function Helper() at the bottom.

Multi-line comments above them explaining purpose, function type, and inputs are required.

Example:

/**
 * Calculate distance between two points
 * @function distanceCalc
 * @param {point A} - ptA
 * @param {point B} - ptB
 */
 function distanceCalc (ptA, ptB) {...}

Object/Method Connections:

Callback functions, located under LTreering, are used to connect all objects and methods. Most functions input 'Lt', short for LTreering, as their keyword to access object/methods from other areas of leaflet-treering.js.

Example:

function AssetAttributes (Lt) {
  this.name = Lt.meta.assetName;
  this.pointsIndex = Lt.data.index;
  this.enableMeasurements = Lt.createPoint.enable();
}

How to Test Code:

All tools/features should be tested on multiple scenarios through at least Google Chrome, Mozilla FireFox, and Safari before merging to main.

All Tools/Features:

Various Measurement Scenarios:

Different scenarios are located in index_descriptor_descriptor .html files.

Current scenarios: