Open zod opened 2 years ago
Yes, that would be one of the tasks with some higher priority.
@abrensch mentioned a while ago that those are only a hack:
So that' currently only a hack and profile:xxx does not overwrite params of the "StdModel", and there are other hacks, e.g. does profile:vmax at the same time requests the speed-limit-profile. But if that should become a feature I could of course remove the hacks and make it more consistent.
What is the current state there?
It seems like it hasn't changed much. The special handling for profile:vmax
was removed, but as it seems overwriting parameters of StdModel
isn't possible. I'm not sure if we need to overwrite those parameters or it's sufficient to overwrite parameters which are provided by the profiles.
or it's sufficient to overwrite parameters which are provided by the profiles
subtile difference between "provided by/to the profiles"
The way I did it in KinematicModel is to inject the url-parameter when the Model queries a parameter from the profile (If you look at https://github.com/abrensch/brouter/blob/master/brouter-core/src/main/java/btools/router/StdModel.java here the parameter keyValues of the init method is ignored)
But that means it does not work for parameters which are used BY the profile.
So we would need to inject the parameter before the profile is parsed, same way/same syntax as BRouter-Web already does it.
And be careful with profile caching to invalid a cached profile when a url-param changes, , but that should be o.k. already ( rc.getKeyValueChecksum() is part of the cache-key in https://github.com/abrensch/brouter/blob/master/brouter-core/src/main/java/btools/router/ProfileCache.java )
So we would need to inject the parameter before the profile is parsed
This is done in lib 1.6.4. In RoutingContext the routine readGlobalConfig() calls the setVariableValue with true (means create variable) and this is done in BExpressionContext
Best would actually be to be able to upload a profile from a URL. This way, we could store our profile on our personal github for example and then just upload it from a "raw" url to the file.
Currently changing profile parameters using brouter-web causes a new custom profile to be uploaded to BRouter. Because custom profiles are only cached and not stored persistently the brouter-web URL doesn't contain a reference of the profile. I sometimes store routes as bookmarks, but this doesn't work for profiles with adapted parameters.
BRouter provides an undocumented way to pass profile parameters as parameters of the request which would offer the possibility for persistent urls even with adapted parameters.