[Merged] Refactoring ViewProviderSketch

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: Refactoring ViewProviderSketch

Post by chrisb »

Sorry for the confusion, I had googled ascii tab and found this code in the extended range between 128-255 :oops: . Let's hope it is not locale dependent, but as unicode it should be robust.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
wmayer
Founder
Posts: 20202
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Refactoring ViewProviderSketch

Post by wmayer »

chrisb wrote: Thu Nov 18, 2021 9:47 pm Sorry for the confusion, I had googled ascii tab and found this code in the extended range between 128-255 :oops: . Let's hope it is not locale dependent, but as unicode it should be robust.
It is locale specific. Only the characters of the range [0, 127] are equal on all systems.
openBrain
Veteran
Posts: 9031
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Refactoring ViewProviderSketch

Post by openBrain »

wmayer wrote: Fri Nov 19, 2021 4:36 pm It is locale specific. Only the characters of the range [0, 127] are equal on all systems.
Just to be clear with everybody, the [128,255] range of extended ASCII is locale specific (or actually is changing depending on the used codepage).
But here in my PR (and generally as Unicode), it isn't locale specific. ;)
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Refactoring ViewProviderSketch

Post by abdullah »

-alex- wrote: Wed Nov 17, 2021 4:58 pm
abdullah wrote: Wed Nov 17, 2021 1:30 pm Not really. A refactoring...
Thanks for informations.
so that ViewProvider is substantially agnostic of the actual coin implementation used.

So it could ease to workaround Coin3D at this stage (sketcher) by using Vlukan?
I am not familiar with Vulkan. But if Vulkan is a substitute for Coin3D it should help.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Refactoring ViewProviderSketch

Post by abdullah »

openBrain wrote: Thu Nov 18, 2021 1:52 pm I'll prepare the PR. Feel free to tell me here what you think about this (everybody, not just @chrisb ;) ).

@abdullah : sorry for cluttering, feel free to split.
If it is locale independent, I have not problem at all with a PR.

Eventually your code will move with the refactor, but the essence will stay ;)

Solving problems is never clutter. I have no problem at all with it. No need to split. :)
User avatar
jonasb
Posts: 162
Joined: Tue Dec 22, 2020 7:57 pm

Re: Refactoring ViewProviderSketch

Post by jonasb »

abdullah wrote: Fri Nov 19, 2021 6:43 pm I am not familiar with Vulkan. But if Vulkan is a substitute for Coin3D it should help.
AFAIK Vulkan is rather an alternative/successor for OpenGL than for Coin3D.
User avatar
-alex-
Veteran
Posts: 1849
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: Refactoring ViewProviderSketch

Post by -alex- »

abdullah wrote: Fri Nov 19, 2021 6:43 pm I am not familiar with Vulkan. But if Vulkan is a substitute for Coin3D it should help.
Thanks for your opinion.
jonasb wrote: Fri Nov 19, 2021 7:38 pm AFAIK Vulkan is rather an alternative/successor for OpenGL than for Coin3D.
Yes, maybe I make some confusion here because AFAIK Coin3D deals with Openiventor which deals itself with openGL so...
But Coin3D is maybe not the level to consider, I'm not an expert though, just an end user, so maybe I miss the point here.
Anyway, that's pretty offtopic, so if ones want talk about that we should do it elsewhere to not hijack this thread ;)
User avatar
jonasb
Posts: 162
Joined: Tue Dec 22, 2020 7:57 pm

Re: Refactoring ViewProviderSketch

Post by jonasb »

-alex- wrote: Fri Nov 19, 2021 8:07 pm Anyway, that's pretty offtopic, so if ones want talk about that we should do it elsewhere to not hijack this thread ;)
=> https://forum.freecadweb.org/viewtopic.php?t=12134
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Refactoring ViewProviderSketch

Post by abdullah »

Today's progress report is as follows:

EditData (the pimpl structure that stored all types of parameters relating to edit mode) has undergone a severe diet. Different responsibilities have been assumed by ViewProvider and CoinManager. What is left there at the moment is Preselection and Selection.

Preselection and Selection are spread over ViewProvider and CoinManager. This splitting of responsibilities is a very important part of this refactor, as geometry layers will change the coin part of it, and the refactor should make sure the separation of responsibilities is right, so that when layers are coded, this does not affect ViewProvider selection and preselection. Ideally, any change to layers in coin should not affect a single line of code of how ViewProvider handles selection and preselection.

This is the challenge I am facing now. It is also the last item in my list regarding separation of responsibilities between ViewProviderSketch and CoinManager. After that, ViewProviderSketch will be finished and refactoring work will only remain on the CoinManager part of it.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Refactoring ViewProviderSketch

Post by abdullah »

It turned out that there was some dead code in VPSketch. After refactoring it, I realised it was not used at all (it is not used in master either).

I believe to be close to the end. The bit that I do not like yet relates to selection/preselection indexing. Because this has to refactor in the right direction, I hacked some code to show two layers. So this is an example of one geometry in another layer, which has a different drawing style for lines:
Screenshot_20211205_123047.png
Screenshot_20211205_123047.png (15.26 KiB) Viewed 2111 times
This is not production code. It is a hack for me to test that the selection/preselection mechanisms would work on any layer.
Post Reply