C3D Toolkit
Kernel - 117982, Vision - 2.9.2.2
|
Class ExplodeDispatcher is used to manage the process of disassembling objects of the geometric model (scene segments), it also provides support for working with GUI tabs and provides various viewing modes. More...
#include <vsn_explodedispatcher.h>
Public Types | |
enum | ControlParameterType { } |
Public Member Functions | |
ExplodeDispatcher () | |
Default constructor. | |
~ExplodeDispatcher () | |
Destructor. | |
void | Init (const std::string &mainTabName, const std::string &tabNameSeparator, SceneSegment *pSegmModel) |
The name of the main (main) tab and a pointer to the root segment of the model are passed as initialization parameters. | |
ResultState | GetParameterValues (const ControlParameterType paramType, ExplodeParameterValues ¶mValues) const |
Get parameter values. | |
ResultState | GetParameterState (const ControlParameterType paramType, ExplodeParameterState ¶mState) |
Get parameter state. | |
ExplodeDispatcher::ResultState | SetParameter (const ControlParameterType paramType, const Variant &data, const bool recalculate=true) |
Set a new value for the control parameters and, if recalculate == ture, recalculate the geometry of decomposed objects (decomposition model). | |
std::vector< ControlParameterType > | GetControlParameters () const |
Get control parameters. | |
void | Recalculate () |
Recalculate the decomposition model using the current parameter values. | |
bool | IsRecalculateRequired () const |
The method returns true if the geometry of decomposed objects needs to be recalculated after changes in the parameters. | |
void | GetCameraOptions (Point3DF &position, Point3DF &targetPosition, Vector3DF &upVector) const |
Get camera parameters for the current view (current tab). | |
void | SetCameraOptions (const Point3DF &position, const Point3DF &targetPosition, const Vector3DF &upVector) |
Set camera parameters for the current view (current tab). | |
const SceneSegment * | GetSelectedSegment () const |
Get selected segment. | |
void | SetSelectedSegment (const SceneSegment *pSegm) |
Set selected segment and update selection related parameters. | |
bool | CreateNewItem (const std::string &tabName, const SceneSegment *pSegmSelected) |
Create a tab with a new view. | |
bool | SwitchActiveItem (const std::string &tabName) |
Make the specified tab active. | |
bool | RemoveItem (const std::string &tabName) |
Delete the specified tab (view mode). | |
int | GetMaximumTabNumber () const |
Get the maximum number among existing tabs. Can be used when generating a new tab name. | |
Class ExplodeDispatcher is used to manage the process of disassembling objects of the geometric model (scene segments), it also provides support for working with GUI tabs and provides various viewing modes.
The “Explosion” functionality can be used when the user needs to use a small number of actions to get an idea of the objects that make up the model, their relationships and internal structure of the model. In particular, you can get an idea of the bodies inside subassemblies, blocked by other bodies. In such cases, the use of approaches like hiding some bodies or changing the degree of their transparency can be much more time-consuming. The decomposition of objects is determined by a set of control parameters defined in the type ExplodeDispatcher::ControlParameterType. The cpt_Explode parameter is responsible for moving disassembled objects, with the zero value of this parameter corresponding to the initial state of the model before the decomposition. The speed at which objects move is determined by the cpt_Speed parameter. The functionality provides quite an extensive set of options for controlling the decomposition modes: the ability to set the center of decomposition relative to selected object (cpt_ExplodeFromItem), decomposition relative to the center of the scene (cpt_ExplodeFromCenter), decomposition is supported in radial direction (cpt_RadialTrajectory), axial direction (cpt_AxialTrajectory) and in the direction orthogonal to the axial (cpt_OrthToAxialTrajectory). The API supports multi-window GUI: it is possible to view selected assemblies in separate tabs and configure the desired decomposition mode in each tab, separately from other tabs. Other supported features: the ability to synchronize the decomposition modes between all tabs, synchronization of parameters that define the decomposition mode (cpt_SynchronizeExplode), synchronization of camera parameters (cpt_SynchronizeCamera) and selected objects (cpt_SynchronizeSelection). To visually reduce the amount of disassembled objects, you can set the level in the scene segment graph (parameter cpt_TreeLevel), starting from which subassemblies will be moved as part of their parent assemblies. For example, you can set the "ecomposition of root assemblies so that subassemblies at higher levels remain fixed relative to the root assemblies. Functionality provides additional features for quick selection of objects. From the selected object, you can get the subassemblies (cpt_SelectAssembly) containing the selected object at any level, including the root assembly (cpt_SelectRootItem). You can use the cpt_SelectAll option to select all items in the active tab. It is possible to set filters to hide objects, whose dimensions are less than the specified value (cpt_FilterHideSmallItems) or greater than the specified value (cpt_FilterHideBigItems), or hide objects located farther from the specified center than the specified value (cpt_FilterHideByDistance). In the active tab, you can switch to review mode (cpt_StartReviewMode) to view subassemblies of the selected assembly. It is also possible to call this mode again to view subassemblies of the current subassembly and so on. The cpt_StopReviewMode parameter is used to return from review mode to original mode. To create a new tab, the CreateNewItem() method is used, which receives as parameters the name of the tab and a pointer to a segment that defines a subassembly in the scene graph. The ability to create a new tab in the current mode can be determined by the state of the parameter (cpt_CreateNewExplodeView). For the current tab the cpt_ResetExplodeView parameter allows you to reset the view mode settings to their original state, the parameter cpt_RebuildExplodeView is used to recalculate and rebuild the configuration of expanding objects models relative to the selected center. If cpt_CollapsOnRebuild is set to true, then the configuration of objects during a rebuild will "collapse" into the initial state, while the selected the object will not change its position. With cpt_AutoRebuild set to true, after each selection, the configuration of disassembled objects will be automatically restructured with a new given center of decomposition. When selecting an object in the GUI, you must pass the appropriate scene graph segment in ExplodeDispatcher using the SetSelectedSegment() method. Method GetSelectedSegment() returns the selected object. The methods SetSelectedSegment() and GetSelectedSegment() are supposed to be used along with the selection functionality defined by the following parameters: cpt_SelectAssembly, cpt_SelectRootItem, cpt_SelectAll.