A model is available to define and represent all the new components that are added. This is kept in the JSON format and is contained within the CustomModulesDefinition.json file.
It is important to have a single file for all new modules. The order in which the components are defined is important as there may be dependencies between components. For example, a component may remove out-of-the-box components as part of its definition, but another component may be using it as a container.
The example below shows how a typical CustomAnalystModuleConfig.json file looks:
{ "modules": [{
"name": "GIQueryModule",
"description": "Module For GI query",
"modulePath": "extensions/dynamic.module.ts#DynamicModule",
"components":[{componentName:"TestComponent","parentComponentName": "SettingsPanel",
"initParameters": {
"initX": 0,
"initY": 0,
"endPointUrl": "localhost:3306/mysql/gidata",
}
}}],
"externalLibraryPath": [{
"libName": "GDAL",
"libPath": "../controller/theme/app/gdal.js",
}
],
"mapConfigAssociated": {
"GeoInsightMaps": ["TestComponent"],
"GeoInsightSummaryMaps": ["TestComponent"]
}
}
],
,
"componentsToRemove":[
{"componentName":"BaseMapSwitcherComponent",
"fromMapConfig":"Drive Time"},
{"componentName":"MapConfigSwitcherComponent",
" fromMapConfig":"Drive Time"}
]}
}
Top Level Nodes
The following table describes the parameters that can be included in a custom module definition.
Field Name | Type | Required | Description |
---|---|---|---|
Modules | Json Array | Yes | An array of multiple module definitions as described in the definitions section above. |
ComponentsToRemove | Json Array | Yes | An array of pre-existing components provided out-of-the-box with Spectrum Spatial Analyst that would be removed. |
Module JSON Object
Each array element inside the Modules node defines a module as follows.
Field Name | Type | Required | Description |
---|---|---|---|
Name | String | Yes | The name should not be the same as any of the Spectrum Spatial Analyst modules. You can find a list of module names in the documentation.. |
description | String | optional | Gives details about the purpose of the module for users looking at the configuration file. |
ModulePath | String | Yes |
The location of the module in the file system. This will be in: customerconfigurations/analyst/theme/extensions Note: The folder containing the module should be in this path for it to be accessible #ModuleName is mandatory in the module path to allow it to be loaded. #ModuleName is the name of the Module class in the ts file. Note Each module can have a separate folder. For example, extensions/weather/weather.module.ts#WeatherModule |
Components | Map | Yes |
This is a key value pair where • Key = Name of the component • Value = The parent container in Spectrum Spatial Analyst where the component is to be injected. Note: The Component Name should match the #ModuleName that you have declared for creating Angular 4 component class and not the selector. |
externalLibraryPath | JsonArray | Optional | Set of third-party libraries that component may need for it to function. This path can be CDN or a local path relative to index.html of Spectrum Spatial Analyst. |
mapConfigAssociated | Map | Optional |
A key value pair where: • Key = Spectrum Spatial Analyst map configuration name • Value = Array of components that will be visible for that map configuration If the component is not explicitly associated with a mapconfig file, then it will appear for all mapconfig files that are available. |
initparameters | Json Object | Optional |
A key value pair where: • Key = Name of the component • Value = json object of the initialization parameters which will be passed to each instance of the component. There is no restriction on the type of init parameter; it can be any type. |
ComponentToRemove
Each array element inside the ComponentsToRemove node will define the following.
Field Name | Type | Required | Description |
---|---|---|---|
componentName | String | Yes | Name of the component to be removed. Note this is an existing Spectrum Spatial Analyst component and not a third-party component. Specific components, like BaseMapSwitcher and SearchBox, may be removed from the application. |
fromMapConfig | String | Optional | Removes the component from a specific mapconfig file. If omitted, it removes the component from all mapconfigs files. |