#include <TColStd_MapOfTransient.hxx>
#include <TColStd_MapIteratorOfMapOfTransient.hxx>
+#ifdef VINSPECTOR
+#include <VInspectorAPI_CallBack.h>
+#endif
+
#include <Events_Loop.h>
#include <ModelAPI_Events.h>
: myWorkshop(theWorkshop), myNeedUpdate(false),
myIsTrihedronActive(true), myViewerBlockedRecursiveCount(0)
{
+ #ifdef VINSPECTOR
+ myContextCallBack = 0;
+ #endif
myCustomPrs = std::shared_ptr<GeomAPI_ICustomPrs>(new XGUI_CustomPrs(theWorkshop));
}
anAISIO->Attributes()->SetFaceBoundaryDraw( Standard_True );
anAISIO->SetDisplayMode(aDispMode);
aContext->Display(anAISIO, aDispMode, 0, false, true, AIS_DS_Displayed);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->Display(anAISIO);
+ #endif
aDisplayed = true;
emit objectDisplayed(theObject, theAIS);
if (!anAIS.IsNull()) {
emit beforeObjectErase(theObject, anObject);
aContext->Remove(anAIS, false/*update viewer*/);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->Remove(anAIS);
+ #endif
ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::erase -- Remove");
aErased = true;
}
aContext->Deactivate(aAISIO, 0);
#endif
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->Redisplay(aAISIO);
+ #endif
ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::redisplay -- Redisplay");
if (aNeedToRestoreSelection)
deactivateAIS(anAIS);
// the selection from the previous activation modes should be cleared manually (#26172)
aContext->LocalContext()->ClearOutdatedSelection(anAIS, true);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->ClearOutdatedSelection(anAIS);
+ #endif
ModuleBase_Tools::selectionInfo(aContext,
"XGUI_Displayer::deactivate -- ClearOutdatedSelection");
if (theUpdateViewer)
TColStd_ListOfInteger aModes;
aContext->ActivatedModes(anAIS, aModes);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->ActivatedModes(anAIS, aModes);
+ #endif
+
return aModes.Extent() > 0;
}
if (aContext->HasOpenedContext()) {
aContext->UnhilightSelected(false);
aContext->ClearSelected(false);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->ClearSelected();
+ #endif
NCollection_DataMap<TopoDS_Shape, NCollection_Map<Handle(AIS_InteractiveObject)>>
aShapesToBeSelected;
// problem 2: IO is not specified, so the first found owner is selected, as a result
// it might belong to another result
aContext->AddOrRemoveSelected(aShape, false);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->AddOrRemoveSelected(aShape);
+ #endif
#else
NCollection_Map<Handle(AIS_InteractiveObject)> aPresentations;
if (aShapesToBeSelected.IsBound(aShape))
//aContext->SetSelected(anAIS, false);
// The selection in the context was cleared, so the method sets the objects are selected
aContext->AddOrRemoveSelected(anAIS, false);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->AddOrRemoveSelected(anAIS);
+ #endif
}
}
}
if (!aContext.IsNull()) {
aContext->UnhilightCurrents(false);
aContext->ClearSelected(theUpdateViewer);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->ClearSelected();
+ #endif
}
}
if (!anIO.IsNull()) {
emit beforeObjectErase(aObj, aAISObj);
aContext->Remove(anIO, false/*update viewer*/);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->Remove(anIO);
+ #endif
aErased = true;
}
}
void deactivateObject(Handle(AIS_InteractiveContext) theContext,
Handle(AIS_InteractiveObject) theObject,
+#ifdef VINSPECTOR
+ VInspectorAPI_CallBack* theCallBack,
+#endif
const bool theClear = true)
{
if (!theObject.IsNull()) {
theContext->Deactivate(theObject);
+ #ifdef VINSPECTOR
+ if (theCallBack) theCallBack->Deactivate(theObject);
+ #endif
ModuleBase_Tools::selectionInfo(theContext, "XGUI_Displayer::deactivateObject -- Deactivate");
//if (theClear) {
//theObject->ClearSelected();
Handle(AIS_InteractiveContext) aContext = AISContext();
if (!aTrihedron.IsNull() && aContext->IsDisplayed(aTrihedron)) {
Handle(AIS_Trihedron) aTrie = Handle(AIS_Trihedron)::DownCast(aTrihedron);
- deactivateObject(aContext, aTrie);
+ deactivateObject(aContext, aTrie, myContextCallBack);
/// #1136 hidden axis are selected in sketch
/// workaround for Cascade: there is a crash in AIS_LocalContext::ClearOutdatedSelection
/// for Position AIS object in SelectionModes.
- deactivateObject(aContext, aTrie->XAxis());
- deactivateObject(aContext, aTrie->YAxis());
- deactivateObject(aContext, aTrie->Axis());
- deactivateObject(aContext, aTrie->Position());
+ deactivateObject(aContext, aTrie->XAxis(), myContextCallBack);
+ deactivateObject(aContext, aTrie->YAxis(), myContextCallBack);
+ deactivateObject(aContext, aTrie->Axis(), myContextCallBack);
+ deactivateObject(aContext, aTrie->Position(), myContextCallBack);
- deactivateObject(aContext, aTrie->XYPlane());
- deactivateObject(aContext, aTrie->XZPlane());
- deactivateObject(aContext, aTrie->YZPlane());
+ deactivateObject(aContext, aTrie->XYPlane(), myContextCallBack);
+ deactivateObject(aContext, aTrie->XZPlane(), myContextCallBack);
+ deactivateObject(aContext, aTrie->YZPlane(), myContextCallBack);
if (theUpdateViewer)
updateViewer();
aContext->Activate(theIO, theMode, false);
} else
aContext->Activate(theIO, theMode, false);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->Activate(theIO, theMode);
+ #endif
// the fix from VPA for more suitable selection of sketcher lines
if (theIO->Width() > 1) {
{
Handle(AIS_InteractiveContext) aContext = AISContext();
if (!aContext.IsNull()) {
- if (theMode == -1)
+ if (theMode == -1) {
aContext->Deactivate(theIO);
- else
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->Deactivate(theIO);
+ #endif
+ }
+ else {
aContext->Deactivate(theIO, theMode);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->Deactivate(theIO, theMode);
+ #endif
+ }
ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::deactivateAIS -- Deactivate");
#ifdef DEBUG_DEACTIVATE_AIS
Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
if (!aContext.IsNull() && !anAISIO.IsNull()) {
aContext->Display(anAISIO, 0/*wireframe*/, 0, false/*update viewer*/, true, AIS_DS_Displayed);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->Display(anAISIO);
+ #endif
aDisplayed = true;
aContext->Deactivate(anAISIO);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->Deactivate(anAISIO);
+ #endif
aContext->Load(anAISIO);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->Load(anAISIO);
+ #endif
if (toActivateInSelectionModes) {
if (aContext->HasOpenedContext()) {
if (myActiveSelectionModes.size() == 0)
Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
if (!anAISIO.IsNull() && aContext->IsDisplayed(anAISIO)) {
aContext->Remove(anAISIO, false/*update viewer*/);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->Remove(anAISIO);
+ #endif
ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::eraseAIS -- Remove");
aErased = true;
}
// The result is the selection of the first IO is lost.
TColStd_ListOfInteger aTColModes;
aContext->ActivatedModes(theIO, aTColModes);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->ActivatedModes(theIO, aTColModes);
+ #endif
TColStd_ListIteratorOfListOfInteger itr( aTColModes );
QIntList aModesActivatedForIO;
bool isDeactivated = false;
if (isDeactivated) {
// the selection from the previous activation modes should be cleared manually (#26172)
theIO->ClearSelected();
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->ClearSelected(theIO);
+ #endif
aContext->LocalContext()->ClearOutdatedSelection(theIO, true);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->ClearOutdatedSelection(theIO);
+ #endif
ModuleBase_Tools::selectionInfo(aContext,
"XGUI_Displayer::activate -- ClearSelected/ClearOutdatedSelection");
// For performance issues
// loading the interactive object allowing the decomposition
if (aTColModes.IsEmpty()) {
aContext->Load(theIO, -1, true);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->Load(theIO);
+ #endif
}
// trihedron AIS check should be after the AIS loading.
Standard_True /* update viewer*/,
Standard_False /* allow decomposition */,
AIS_DS_Displayed /* xdisplay status */);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->Display(aTrihedron);
+ #endif
if (!isTrihedronActive())
deactivateTrihedron(false);
// the selection from the previous activation modes should be cleared manually (#26172)
aContext->Erase(aTrihedron);
+ #ifdef VINSPECTOR
+ if (myContextCallBack) myContextCallBack->Remove(aTrihedron);
+ #endif
}
updateViewer();
return aModes;
}
+#ifdef VINSPECTOR
+void XGUI_Displayer::setCallBack(VInspectorAPI_CallBack* theCallBack)
+{
+ myContextCallBack = theCallBack;
+}
+
+VInspectorAPI_CallBack* XGUI_Displayer::getCallBack() const
+{
+ return myContextCallBack;
+}
+#endif
+
void XGUI_Displayer::AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) theContext,
- const NCollection_DataMap<TopoDS_Shape,
+ const NCollection_DataMap<TopoDS_Shape,
NCollection_Map<Handle(AIS_InteractiveObject)>>& theShapesToBeSelected)
{
Handle(AIS_LocalContext) aLContext = theContext->LocalContext();