Tuesday, December 28, 2010

Solver Visualization Document Logic

Solver's visualization had a half heart transplant: firstly, as infrastructure was already done, all solver code was made as a document based drawing, limitations appear easily.
In short the design of Solver is like this:
- for all scene a intermediary representation named corresponding to geometry is stores like: Solver Point, Solver Edge, and so on
- a set of rules is processing the current mouse position (and sometimes the previous one) and returns a SolverPoint structure that stores all information that visualization need like: the plane, the point (that is the result of the applying the rule, for example to align to the a continuation of an line), a direction (for parallel lines) and a display logic, named marker
- if points are drawn, they did add interactive shapes to opencascade scene
How logic was changed?
- extraction remains the same, just that Solver Point, Solver Edge will store just the point, the edge and so on
- applying of rules will generate a SolverPreview instance. This will not make that SolverPoint to store the plane!? or direction!? Also if a rule will need to put extra data in visualization, will simply create a custom data that implements mostly a simple class that gives the new mouse position and a custom visualization routine based on NaroCAD's shapes
- before any visualization, the previous solver helper geometry will be cleared (_solverDocument.Revert() call),
- if a SolverPreview instance exists, will be called to execute it's preview code and will update the mouse coordinate.
The code behaves the same from user point of view, just by separating the extracting shapes by preview will make much simpler extending and fixing errors on Solver area. Stay tuned for changes!

No comments: