-
Notifications
You must be signed in to change notification settings - Fork 11
Miscellaneous
This page contains information about various architecture or code implementations that do not fit into a specific category of the wiki.
The LineExtractionApp makes use of a special type of enum. The enum is implemented as a simple object literal with the type names as fields.
const ExampleEnum = {
Type1 : 1,
Type2 : 2,
Type3 : 3
};
Some enums are also used to store information about each type. This is accomplished through a special "properties" field. For example, the FilterTechniqueEnum
from the LineExtractionApp.Processing.Filtering
module allows for the easy definition of different filtering techniques.
const LineExtractionTechniqueEnum = {
SPLIT_MERGE: 1,
properties: {
1: { name: "SPLIT_MERGE", value: 1, displayName: "Iterative end point split-merge", bIsDefault: true }
}
};
The initial fields provide an easy means of quickly selecting the type by name, and then the properties field allows for various properties of that type to be queried. For example, retrieving the display name for the "SPLIT_MERGE" technique is accomplished like so:
LineExtractionTechniqueEnum.properties[LineExtractionTechniqueEnum.SPLIT_MERGE].displayName;
The LineExtractionApp makes use of these custom enums in defining settings for various modules and classes. The end result is an implementation that is remarkably quick to update, modify or extend. Because the rest of the application is built procedurally using these enums, adding support for a technique is as simple as adding a new entry and its associated properties to the LineExtractionTechniqueEnum
.