It can be useful to have different sorts of Lightspeed maps, each with their own characteristics.
An example is a mission preparation map and mission preview map as illustrated in the samples.lucy.lightspeed.missionmap.Main
sample.
To support this, a type is associated with each ILcyLspMapComponent
and the TLcyLspMapAddOn
allows to have an individual configuration file and/or map component factory for each type.
When only the configuration differs between the different map types,
it is sufficient to adjust the TLcyLspMapAddOn.cfg
file to link the appropriate configuration file to each map type (as illustrated in MissionMap_TLcyLspMapAddOn.cfg
).
When you want to use a different ALcyGUIFactory
instance for each map type, you can specify this in the config file as well,
or you can override TLcyLspMapAddOn#createGUIFactory(String)
and return a different instance for each type, as shown in Program: Use different factories for different types of map components..
samples/lucy/lightspeed/map/guifactory/LspMapAddOn
)
@Override
protected ALcyGUIFactory<ILcyLspMapComponent> createGUIFactory(String aMapComponentType) {
if (ILcyLspMapComponent.DEFAULT_MAP_TYPE.equals(aMapComponentType)) {
//Return the custom gui factory instance for the default map type
return new LspMapComponentFactory(getLucyEnv());
} else {
//leave the map component factories for all other types untouched
return super.createGUIFactory(aMapComponentType);
}
}