In short
The observer pattern works through an ObserverManager where views can register. ObserverSubject derivates will push change events on the ObserverManager, which will then notify Observer of these changes. Read all about it here.
There are 2 important aspects of the observer pattern
- The changes are more fine-grained then simply broadcasting a redraw command
- Sequence of changes can be processed in batch before redrawing the Observer, increasing the performance and allowing for consolidation techniques.
Essential is that Oberserver override the RedrawView , which redraws after a small change, and RebuildView , which does a complete reconstruction of the view internal representation.
If having been away from this subject for some time, read the articles inside the CTrack solution under Doc/Oberserver Pattern:
- ObserverPattern.md : general overview of the pattern
- CNodeView_Architecture.md : specific for CTrack
- ObserverPattern_Migration_Plan.md : work plan
In the first phase changes to Nodes will be handled through NodeObserverView derivation. As the Observer pattern can handle a range of categories of changes, later we can also apply this pattern for other changes such as:
- state changes
- connection changes
- buffering changes
- cursor updates
Overview of Observer views
The current observers are:
- CView3DFrame
CViewDRO
- CViewDOR3D
- CViewPose
- CBCGPMyRibbonBar
- CBCGPPropBar
CNodeGridCtrl
CNodeTreePropertyCtrl
- Live / Database Alignment / Projects
- CChartWindow2D
- AIS_TrajectoryColorScale
- CDDataFeatureViewer
CBCGPPropBar
This is the property window that shows things like the radius of a circle.
Currently it is updated through CNodeTreePropertyCtrl, which establishes a bad direct link between two observers and is very wrong.
So we need to start with this one, implement Redraw and Rebuild, an tackle all the changes, from which rename, delete, setselected and color or the most important ones.
The CNodeTreePropertyCtrl layer has to go. Currently it houses the next functions for updating the property window under selection:
- PropertyWindow_Set
- PropertyWindow_Get
- OnSetFocus
- OnLButtonDown
- OnViewData
- OnAlignShowPoints