trinnguyen / bahndsl

BahnDSL: A Domain-Specific Language for Configuring and Modelling Model Railways
GNU General Public License v3.0
1 stars 0 forks source link

Add command line option to specify route generation strategy #26

Closed eyip002 closed 2 years ago

eyip002 commented 2 years ago

For large railway layouts, the generation of all possible routes between pairs of signals takes too much memory and time. Add a command line option to generate simple routes between a source signal and an immediate destination signal, or extended routes between any two signals (with possibly zero or more intermediate signals).

eyip002 commented 2 years ago

Command line option is added to the EMF resource so that it can be accessed by the layout generator.

trinnguyen commented 2 years ago

@eyip002 Just a suggestion for passing the command line option from to Layout generator, another option is to making use of: GeneratorContext if you have problem with the current approach.

class BahnGeneratorContext extends GeneratorContext {
    private String route;

    // getter, setter
}
eyip002 commented 2 years ago

@trinnguyen thanks for the hint! I current approach with the EMF resource works now, but your suggestion looks better. I will try and implement it.

eyip002 commented 2 years ago

Now implemented in https://github.com/trinnguyen/bahndsl/commit/e3cc6992a25e332ad22886ed10cf2e121fc79dfb and https://github.com/trinnguyen/bahndsl/commit/281944072293953c815bfc91194236dcaa63569b

eyip002 commented 2 years ago

Minor fix to support Eclipse. Eclipse RCP creates its own context using GeneratorContext, so a check is needed to see if IGeneratorContext context is of an instance of BahnGeneratorContext.