Answer the question
In order to leave comments, you need to log in
How to design the construction of objects according to user settings?
Hello.
At work, I maintain software that draws some system of elements. For example, a user using an editor adds a pipe to the system and sets its parameters. Then he attaches a sensor or valve to it, and so on. It's all visualized. The downside is that the elements of the system are hard-coded, so you cannot add a new element without a programmer. I would like to get away from this. Those. we need to make it so that the user can select an image (what the element looks like) and some of its properties, for example, 'has a diameter', 'minimum length', etc. and it will have an element with these properties. So I want to ask if there is any standard solution to this problem? Or something similar? Or maybe some kind of open-source project with similar functionality that can be smoked? Thanks in advance!
Answer the question
In order to leave comments, you need to log in
As well as "an element hard-coded in the code" - you need to encode the ability to change the parameters i.e. you again need a programmer (and a normal technical specification for him).
Regarding the standard solution to the problem - the problem looks like some kind of highly specialized, so there is either no such solution, or it will not fully meet your needs. (well, in terms of visualization, any 3D edit will do, but as I understand it, it’s not only a beautiful picture that is needed there?)
You need a factory (class) that constructs your objects based on the parameters passed to it.
Next, you need a dialog in which the parameters of the element, a picture, are set. The parameters are passed to the factory.
The factory returns the constructed element.
cpp-reference.ru/articles/virtual-constructor
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question