Debug tool TInspector replaces VInspector and DFBrowser.
+++ /dev/null
-# - Try to find DFBrowser
-# Once done this will define
-#
-# DBROWSER_FOUND - system has DFBrowser
-# DFBROWSER_INCLUDE_DIRS - the DFBrowser include directory
-# DFBROWSER_LIBRARIES - Link these to use DFBrowser
-
-#=============================================================================
-## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-#=============================================================================
-
-SET(DFBROWSER_ROOT_DIR $ENV{DFBROWSER_ROOT_DIR} CACHE PATH "Path to the DFBrowser directory")
-IF(EXISTS ${DFBROWSER_ROOT_DIR})
- SET(DFBROWSER_INCLUDE_DIR "${DFBROWSER_ROOT_DIR}/include")
- SET(DFBROWSER_LIB_DIR "${DFBROWSER_ROOT_DIR}/lib")
-
- FIND_LIBRARY(DFBrowserAPI DFBrowserAPI "${DFBROWSER_LIB_DIR}")
- IF(DFBrowserAPI)
- SET(DFBrowserAPI ${DFBrowserAPI})
- MESSAGE(STATUS "DFBrowser found at ${DFBROWSER_ROOT_DIR}")
- MESSAGE(STATUS "DFBrowser include dir at ${DFBROWSER_INCLUDE_DIR}")
- MESSAGE(STATUS "DFBrowser lib dir at ${DFBROWSER_LIB_DIR}")
- ENDIF(DFBrowserAPI)
-
-ENDIF(EXISTS ${DFBROWSER_ROOT_DIR})
--- /dev/null
+# - Try to find TInspector
+# Once done this will define
+#
+# TInspector - system has OCCT tool inspector
+# TINSPECTOR_INCLUDE_DIRS - the tool inspector include directory
+# TINSPECTOR_LIBRARIES - Link these to use TInspector
+
+#=============================================================================
+## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+#=============================================================================
+
+SET(TINSPECTOR_ROOT_DIR $ENV{TINSPECTOR_ROOT_DIR} CACHE PATH "Path to the TInspector directory")
+IF(EXISTS ${TINSPECTOR_ROOT_DIR})
+ SET(TINSPECTOR_INCLUDE_DIR "${TINSPECTOR_ROOT_DIR}/inc")
+ SET(TINSPECTOR_LIB_DIR "${TINSPECTOR_ROOT_DIR}/lib")
+
+ FIND_LIBRARY(TKTInspector TKTInspector "${TINSPECTOR_LIB_DIR}")
+ IF(TKTInspector)
+ SET(TKTInspector ${TKTInspector})
+ MESSAGE(STATUS "TInspector is found at ${TINSPECTOR_ROOT_DIR}")
+ MESSAGE(STATUS "TInspector include dir is ${TINSPECTOR_INCLUDE_DIR}")
+ MESSAGE(STATUS "TInspector lib dir is ${TINSPECTOR_LIB_DIR}")
+
+ FIND_LIBRARY(TKVInspector TKVInspector "${TINSPECTOR_LIB_DIR}")
+ SET(TKVInspector ${TKVInspector})
+
+ ENDIF(TKTInspector)
+
+ENDIF(EXISTS ${TINSPECTOR_ROOT_DIR})
+++ /dev/null
-# - Try to find VInspector
-# Once done this will define
-#
-# VINSPECTOR_FOUND - system has VInspector
-# VINSPECTOR_INCLUDE_DIRS - the VInspector include directory
-# VINSPECTOR_LIBRARIES - Link these to use VInspector
-
-#=============================================================================
-## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-#=============================================================================
-
-SET(VINSPECTOR_ROOT_DIR $ENV{VINSPECTOR_ROOT_DIR} CACHE PATH "Path to the VInspector directory")
-IF(EXISTS $ENV{VINSPECTOR_ROOT_DIR})
- SET(VINSPECTOR_INCLUDE_DIR "$ENV{VINSPECTOR_ROOT_DIR}/include")
- SET(VINSPECTOR_LIB_DIR "$ENV{VINSPECTOR_ROOT_DIR}/lib")
-
- FIND_LIBRARY(VInspectorAPI VInspectorAPI "${VINSPECTOR_LIB_DIR}")
- IF(VInspectorAPI)
- SET(VInspectorAPI ${VInspectorAPI})
- MESSAGE(STATUS "VInspector found at ${VINSPECTOR_ROOT_DIR}")
- MESSAGE(STATUS "VInspector include dir at ${VINSPECTOR_INCLUDE_DIR}")
- MESSAGE(STATUS "VInspector lib dir at ${VINSPECTOR_LIB_DIR}")
- ENDIF(VInspectorAPI)
-
-ENDIF(EXISTS $ENV{VINSPECTOR_ROOT_DIR})
INCLUDE(FindSalome)
INCLUDE(FindCAS)
INCLUDE(FindSUIT)
-INCLUDE(FindDFBrowser)
-INCLUDE(FindVInspector)
+INCLUDE(FindTInspector)
# Find LibXml2
IF(DEFINED ENV{LIBXML2_ROOT_DIR})
)
-IF(DFBrowserAPI)
- SET(PROJECT_LIBRARIES ${PROJECT_LIBRARIES} ${DFBrowserAPI})
- SET(PROJECT_INCLUDES ${PROJECT_INCLUDES} ${DFBROWSER_INCLUDE_DIR})
-
- ADD_DEFINITIONS(-DDFBROWSER)
+IF(TKTInspector)
+ ADD_DEFINITIONS(-DTINSPECTOR)
ENDIF()
ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS})
: myID(theID), myKind(theKind), myIsActive(false),
myDoc(new TDocStd_Document("BinOcaf")) // binary OCAF format
{
-#ifdef DFBROWSER
+#ifdef TINSPECTOR
CDF_Session::CurrentSession()->Directory()->Add(myDoc);
#endif
myObjs = new Model_Objects(myDoc->Main());
PartSet_WidgetFeaturePointSelector::PartSet_WidgetFeaturePointSelector(QWidget* theParent,
ModuleBase_IWorkshop* theWorkshop,
const Config_WidgetAPI* theData)
-: ModuleBase_WidgetShapeSelector(theParent, theWorkshop, theData)
+: ModuleBase_WidgetShapeSelector(theParent, theWorkshop, theData), myBaseSelected(false)
{
}
}
//********************************************************************
-void PartSet_WidgetFeaturePointSelector::activateCustom()
+bool PartSet_WidgetFeaturePointSelector::activateSelectionAndFilters(bool toActivate)
{
- ModuleBase_WidgetShapeSelector::activateCustom();
-
- myWorkshop->module()->activateCustomPrs(myFeature,
- ModuleBase_IModule::CustomizeHighlightedObjects, true);
-
+#ifdef HIGHLIGHT_STAYS_PROBLEM
Handle(AIS_InteractiveContext) aContext =
- XGUI_Tools::workshop(myWorkshop)->viewer()->AISContext();
+ XGUI_Tools::workshop(myWorkshop)->viewer()->AISContext();
+ Quantity_Color aColor;
+ Handle(Graphic3d_HighlightStyle) aHStyle = aContext->HighlightStyle();
+ Handle(Graphic3d_HighlightStyle) aSStyle = aContext->SelectionStyle();
+ if (toActivate) {
+ std::vector<int> aColors;
+ aColors = Config_PropManager::color("Visualization", "sketch_entity_color",
+ SKETCH_ENTITY_COLOR);
+ aColor = Quantity_Color(aColors[0] / 255., aColors[1] / 255., aColors[2] / 255., Quantity_TOC_RGB);
- std::vector<int> aColors;
- aColors = Config_PropManager::color("Visualization", "sketch_entity_color",
- SKETCH_ENTITY_COLOR);
- Quantity_Color aColor(aColors[0] / 255., aColors[1] / 255., aColors[2] / 255., Quantity_TOC_RGB);
+ myHighlightColor = aHStyle->Color();
+ mySelectionColor = aSStyle->Color();
-#ifdef HIGHLIGHT_STAYS_PROBLEM
- Handle(Graphic3d_HighlightStyle) aHStyle = aContext->HighlightStyle();
- myHighlightColor = aHStyle->Color();
+ aHStyle->SetTransparency(0.5f);
+ }
+ else {
+ aColor = myHighlightColor;
+ }
aHStyle->SetColor(aColor);
aContext->SetHighlightStyle(aHStyle);
- Handle(Graphic3d_HighlightStyle) aSStyle = aContext->SelectionStyle();
- mySelectionColor = aSStyle->Color();
aSStyle->SetColor(aColor);
aContext->SetSelectionStyle(aSStyle);
+
#endif
+
+ return ModuleBase_WidgetShapeSelector::activateSelectionAndFilters(toActivate);
}
//********************************************************************
-void PartSet_WidgetFeaturePointSelector::deactivate()
+void PartSet_WidgetFeaturePointSelector::activateCustom()
{
- ModuleBase_WidgetShapeSelector::deactivate();
+ ModuleBase_WidgetShapeSelector::activateCustom();
- Handle(AIS_InteractiveContext) aContext =
- XGUI_Tools::workshop(myWorkshop)->viewer()->AISContext();
+ myBaseSelected = false;
-#ifdef HIGHLIGHT_STAYS_PROBLEM
- Handle(Graphic3d_HighlightStyle) aHStyle = aContext->HighlightStyle();
- aHStyle->SetColor(myHighlightColor);
- aContext->SetHighlightStyle(aHStyle);
+ myWorkshop->module()->activateCustomPrs(myFeature,
+ ModuleBase_IModule::CustomizeHighlightedObjects, true);
+}
- Handle(Graphic3d_HighlightStyle) aSStyle = aContext->SelectionStyle();
- aSStyle->SetColor(mySelectionColor);
- aContext->SetSelectionStyle(aSStyle);
-#endif
+//********************************************************************
+void PartSet_WidgetFeaturePointSelector::deactivate()
+{
+ ModuleBase_WidgetShapeSelector::deactivate();
}
//********************************************************************
ModuleBase_ISelection* aSelect = myWorkshop->selection();
QList<ModuleBase_ViewerPrsPtr> aHighlighted = aSelect->getHighlighted();
- if (!aHighlighted.empty()) {
- ModuleBase_ViewerPrsPtr aPrs = aHighlighted.first();
- fillFeature(aPrs, theWindow, theEvent);
- }
+ ModuleBase_ViewerPrsPtr aPrs = !aHighlighted.empty() ? aHighlighted.first() : ModuleBase_ViewerPrsPtr();
+ fillFeature(aPrs, theWindow, theEvent);
}
//********************************************************************
if (theEvent->button() != Qt::LeftButton)
return;
+ myBaseSelected = true;
emit focusOutWidget(this);
// we need to deselect base feature for better visibility of selected feature
XGUI_Tools::workshop(myWorkshop)->displayer()->clearSelected(false);
QMouseEvent* theEvent)
{
bool aFilled = false;
- if (theSelectedPrs.get() && theSelectedPrs->object().get()) {
- ObjectPtr anObject = theSelectedPrs->object();
- gp_Pnt aPnt = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView());
- double aX, anY;
- Handle(V3d_View) aView = theWindow->v3dView();
- PartSet_Tools::convertTo2D(aPnt, mySketch, aView, aX, anY);
-
- std::shared_ptr<ModelAPI_AttributeReference> aRef =
- std::dynamic_pointer_cast<ModelAPI_AttributeReference>(
- feature()->data()->attribute(SketchPlugin_Trim::BASE_OBJECT()));
- aRef->setValue(anObject);
-
- std::shared_ptr<GeomDataAPI_Point2D> anAttributePoint =
- std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
- feature()->data()->attribute(SketchPlugin_Trim::ENTITY_POINT()));
- anAttributePoint->setValue(aX, anY);
- // redisplay AIS presentation in viewer
+ ObjectPtr anObject;
+ if (theSelectedPrs.get() && theSelectedPrs->object().get())
+ anObject = theSelectedPrs->object();
+
+ gp_Pnt aPnt = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView());
+ double aX, anY;
+ Handle(V3d_View) aView = theWindow->v3dView();
+ PartSet_Tools::convertTo2D(aPnt, mySketch, aView, aX, anY);
+
+ std::shared_ptr<ModelAPI_AttributeReference> aRef =
+ std::dynamic_pointer_cast<ModelAPI_AttributeReference>(
+ feature()->data()->attribute(SketchPlugin_Trim::BASE_OBJECT()));
+ aRef->setValue(anObject);
+
+ std::shared_ptr<GeomDataAPI_Point2D> anAttributePoint =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ feature()->data()->attribute(SketchPlugin_Trim::ENTITY_POINT()));
+ anAttributePoint->setValue(aX, anY);
+ // redisplay AIS presentation in viewer
#ifndef HIGHLIGHT_STAYS_PROBLEM
- // an attempt to clear highlighted item in the viewer: but of OCCT
- XGUI_Tools::workshop(myWorkshop)->displayer()->clearSelected(true);
+ // an attempt to clear highlighted item in the viewer: but of OCCT
+ XGUI_Tools::workshop(myWorkshop)->displayer()->clearSelected(true);
#endif
- updateObject(feature());
- aFilled = true;
- }
+ updateObject(feature());
+ aFilled = true;
+
return aFilled;
}
return QList<ModuleBase_ViewerPrsPtr>();
}
+//********************************************************************
+void PartSet_WidgetFeaturePointSelector::updateSelectionName()
+{
+ if (myBaseSelected)
+ ModuleBase_WidgetShapeSelector::updateSelectionName();
+}
//********************************************************************
bool PartSet_WidgetFeaturePointSelector::setSelection(
/// \return a boolean value
virtual bool isValidSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
+ /// Activate or deactivate selection and selection filters
+ /// \return true if the selection filter of the widget is activated in viewer context
+ virtual bool activateSelectionAndFilters(bool toActivate);
+
/// Set sketcher
/// \param theSketch a sketcher object
void setSketcher(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
/// a shape. If the attribute do not uses the shape, it is empty
virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getAttributeSelection() const;
+ /// Computes and updates name of selected object in the widget
+ virtual void updateSelectionName();
+
protected:
/// The methiod called when widget is activated
virtual void activateCustom();
CompositeFeaturePtr mySketch;
Quantity_Color myHighlightColor;
Quantity_Color mySelectionColor;
+ bool myBaseSelected;
};
#endif
\ No newline at end of file
data()->attribute(SketchPlugin_Trim::BASE_OBJECT()));
ObjectPtr aBaseObject = aBaseObjectAttr->value();
if (!aBaseObject.get())
- return anAIS;
+ return AISObjectPtr();
FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObjectAttr->value());
// point on feature
if (myCashedShapes.find(aBaseObject) == myCashedShapes.end())
fillObjectShapes(aBaseObject);
+ GeomShapePtr aBaseShape;
+
const std::set<GeomShapePtr>& aShapes = myCashedShapes[aBaseObject];
if (!aShapes.empty()) {
std::set<GeomShapePtr>::const_iterator anIt = aShapes.begin(), aLast = aShapes.end();
for (; anIt != aLast; anIt++) {
- GeomShapePtr aBaseShape = *anIt;
+ GeomShapePtr aShape = *anIt;
std::shared_ptr<GeomAPI_Pnt> aProjectedPoint;
- if (ModelGeomAlgo_Point2D::isPointOnEdge(aBaseShape, anAttributePnt, aProjectedPoint)) {
- if (aBaseShape) {
- if (!anAIS)
- anAIS = AISObjectPtr(new GeomAPI_AISObject);
- anAIS->createShape(aBaseShape);
-
- std::shared_ptr<ModelAPI_AttributeBoolean> anAuxiliaryAttr =
- aBaseFeature->data()->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID());
-
- bool isConstruction = anAuxiliaryAttr.get() != NULL && anAuxiliaryAttr->value();
-
- std::vector<int> aColor;
- aColor = Config_PropManager::color("Visualization", "operation_remove_feature_color",
- OPERATION_REMOVE_FEATURE_COLOR());
- double aWidth = SketchPlugin_SketchEntity::SKETCH_LINE_WIDTH();
- int aLineStyle = SketchPlugin_SketchEntity::SKETCH_LINE_STYLE();
- if (isConstruction) {
- aWidth = SketchPlugin_SketchEntity::SKETCH_LINE_WIDTH_AUXILIARY();
- aLineStyle = SketchPlugin_SketchEntity::SKETCH_LINE_STYLE_AUXILIARY();
- }
- anAIS->setColor(aColor[0], aColor[1], aColor[2]);
- anAIS->setWidth(aWidth);
- anAIS->setLineStyle(aLineStyle);
- break;
- }
- }
+ if (ModelGeomAlgo_Point2D::isPointOnEdge(aShape, anAttributePnt, aProjectedPoint))
+ aBaseShape = aShape;
+ }
+ }
+
+ if (aBaseShape.get()) {
+ if (!anAIS)
+ anAIS = AISObjectPtr(new GeomAPI_AISObject);
+ anAIS->createShape(aBaseShape);
+
+ std::shared_ptr<ModelAPI_AttributeBoolean> anAuxiliaryAttr =
+ aBaseFeature->data()->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID());
+
+ bool isConstruction = anAuxiliaryAttr.get() != NULL && anAuxiliaryAttr->value();
+ std::vector<int> aColor;
+ aColor = Config_PropManager::color("Visualization", "operation_remove_feature_color",
+ OPERATION_REMOVE_FEATURE_COLOR());
+ double aWidth = SketchPlugin_SketchEntity::SKETCH_LINE_WIDTH();
+ int aLineStyle = SketchPlugin_SketchEntity::SKETCH_LINE_STYLE();
+ if (isConstruction) {
+ aWidth = SketchPlugin_SketchEntity::SKETCH_LINE_WIDTH_AUXILIARY();
+ aLineStyle = SketchPlugin_SketchEntity::SKETCH_LINE_STYLE_AUXILIARY();
}
+ anAIS->setColor(aColor[0], aColor[1], aColor[2]);
+ // width is extened in several points in order to see this preview over highlight
+ anAIS->setWidth(aWidth + 2);
+ anAIS->setLineStyle(aLineStyle);
}
+ else
+ anAIS = AISObjectPtr();
return anAIS;
}
INCLUDE_DIRECTORIES(${SALOME_KERNEL_INCLUDE})
ENDIF(${HAVE_SALOME})
-IF(VInspectorAPI)
- message("VINSPECTOR is defined")
- SET(PROJECT_LIBRARIES ${PROJECT_LIBRARIES} ${VInspectorAPI})
- SET(PROJECT_INCLUDES ${PROJECT_INCLUDES} ${VINSPECTOR_INCLUDE_DIR})
-
- ADD_DEFINITIONS(-DVINSPECTOR)
-ENDIF()
-
IF(NOT ${HAVE_SALOME})
SET(PROJECT_INCLUDES ${PROJECT_INCLUDES} ${APPELEMENTS_INCLUDE_DIR})
ENDIF(NOT ${HAVE_SALOME})
-IF(DFBrowserAPI)
- message("DFBROWSER is defined")
- SET(PROJECT_LIBRARIES ${PROJECT_LIBRARIES} ${DFBrowserAPI})
- SET(PROJECT_INCLUDES ${PROJECT_INCLUDES} ${DFBROWSER_INCLUDE_DIR})
+IF(TKTInspector)
+ message("TINSPECTOR is defined")
+ SET(PROJECT_LIBRARIES ${PROJECT_LIBRARIES} ${TKTInspector} ${TKVInspector})
+ SET(PROJECT_INCLUDES ${PROJECT_INCLUDES} ${TINSPECTOR_INCLUDE_DIR})
- ADD_DEFINITIONS(-DDFBROWSER)
+ ADD_DEFINITIONS(-DTINSPECTOR)
ENDIF()
INCLUDE_DIRECTORIES(${PROJECT_INCLUDES})
tr("Select parent feature"), aDesktop);
addAction("SHOW_FEATURE_CMD", aAction);
-#ifdef VINSPECTOR
- aAction = ModuleBase_Tools::createAction(QIcon(), tr("Debug Visualization"), aDesktop);
- addAction("VINSPECTOR_VIEW", aAction);
-#endif
-#ifdef DFBROWSER
- aAction = ModuleBase_Tools::createAction(QIcon(), tr("DFBrowser"), aDesktop);
- addAction("DFBROWSER_VIEW", aAction);
+#ifdef TINSPECTOR
+ aAction = ModuleBase_Tools::createAction(QIcon(), tr("TInspector"), aDesktop);
+ addAction("TINSPECTOR_VIEW", aAction);
#endif
buildObjBrowserMenu();
action("DEFLECTION_CMD")->setEnabled(true);
#ifdef _DEBUG
- #ifdef VINSPECTOR
- action("VINSPECTOR_VIEW")->setEnabled(true);
- #endif
- #ifdef DFBROWSER
- action("DFBROWSER_VIEW")->setEnabled(true);
+ #ifdef TINSPECTOR
+ action("TINSPECTOR_VIEW")->setEnabled(true);
#endif
#endif
}
#ifdef _DEBUG
if (aSelected == 0) {
- #ifdef VINSPECTOR
- aActions.append(action("VINSPECTOR_VIEW"));
- #endif
- #ifdef DFBROWSER
- aActions.append(action("DFBROWSER_VIEW"));
+ #ifdef TINSPECTOR
+ aActions.append(action("TINSPECTOR_VIEW"));
#endif
}
#endif
#include <AppElements_Viewer.h>
#endif
-#ifdef VINSPECTOR
-#include <VInspectorAPI_Communicator.hxx>
-#ifndef HAVE_SALOME
-#include <AppElements_MainWindow.h>
-#endif
-static bool VInspector_FirstCall = true;
-#endif
-
#include <ModelAPI_Document.h>
#include <ModelAPI_Data.h>
#include <ModelAPI_Object.h>
#include <TColStd_MapOfTransient.hxx>
#include <TColStd_MapIteratorOfMapOfTransient.hxx>
-#ifdef VINSPECTOR
+#ifdef TINSPECTOR
#include <VInspectorAPI_CallBack.hxx>
#endif
myIsTrihedronActive(true), myViewerBlockedRecursiveCount(0),
myIsFirstAISContextUse(true)
{
- #ifdef VINSPECTOR
- myCommunicator = 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
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->Display(anAISIO);
#endif
aDisplayed = true;
if (!anAIS.IsNull()) {
emit beforeObjectErase(theObject, anObject);
aContext->Remove(anAIS, false/*update viewer*/);
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->Remove(anAIS);
#endif
aErased = true;
#endif
aContext->Redisplay(aAISIO, false);
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->Redisplay(aAISIO);
#endif
TColStd_ListOfInteger aModes;
aContext->ActivatedModes(anAIS, aModes);
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->ActivatedModes(anAIS, aModes);
#endif
return;
aContext->UnhilightSelected(false);
aContext->ClearSelected(false);
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->ClearSelected();
#endif
NCollection_DataMap<TopoDS_Shape, NCollection_Map<Handle(AIS_InteractiveObject)>>
// 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
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->AddOrRemoveSelected(aShape);
#endif
#else
//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
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->AddOrRemoveSelected(anAIS);
#endif
}
if (!aContext.IsNull()) {
aContext->UnhilightSelected(false);//UnhilightCurrents(false);
aContext->ClearSelected(theUpdateViewer);
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->ClearSelected();
#endif
}
if (!anIO.IsNull()) {
emit beforeObjectErase(aObj, aAISObj);
aContext->Remove(anIO, false/*update viewer*/);
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->Remove(anIO);
#endif
aErased = true;
void deactivateObject(Handle(AIS_InteractiveContext) theContext,
Handle(AIS_InteractiveObject) theObject
-#ifdef VINSPECTOR
- , VInspectorAPI_CallBack* theCallBack
+#ifdef TINSPECTOR
+ , Handle(VInspectorAPI_CallBack) theCallBack
#endif
)
{
if (!theObject.IsNull()) {
theContext->Deactivate(theObject);
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (theCallBack) theCallBack->Deactivate(theObject);
#endif
}
if (!aTrihedron.IsNull() && aContext->IsDisplayed(aTrihedron)) {
Handle(AIS_Trihedron) aTrie = Handle(AIS_Trihedron)::DownCast(aTrihedron);
deactivateObject(aContext, aTrie
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
, getCallBack()
#endif
);
/// #1136 hidden axis are selected in sketch
#ifdef BEFORE_TRIHEDRON_PATCH
deactivateObject(aContext, aTrie->XAxis()
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
, getCallBack()
#endif
);
deactivateObject(aContext, aTrie->YAxis()
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
, getCallBack()
#endif
);
deactivateObject(aContext, aTrie->Axis()
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
, getCallBack()
#endif
);
deactivateObject(aContext, aTrie->Position()
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
, getCallBack()
#endif
);
deactivateObject(aContext, aTrie->XYPlane()
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
, getCallBack()
#endif
);
deactivateObject(aContext, aTrie->XZPlane()
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
, getCallBack()
#endif
);
deactivateObject(aContext, aTrie->YZPlane()
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
, getCallBack()
#endif
);
aContext->Activate(theIO, theMode, false);
} else
aContext->Activate(theIO, theMode, false);
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->Activate(theIO, theMode);
#endif
if (!aContext.IsNull()) {
if (theMode == -1) {
aContext->Deactivate(theIO);
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->Deactivate(theIO);
#endif
}
else {
aContext->Deactivate(theIO, theMode);
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->Deactivate(theIO, theMode);
#endif
}
{
Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
if (!aContext.IsNull() && myIsFirstAISContextUse/*&& !aContext->HasOpenedContext()*/) {
-#ifdef VINSPECTOR
- if (VInspector_FirstCall) {
- XGUI_Displayer* aDisplayer = (XGUI_Displayer*)this;
-
- VInspectorAPI_Communicator* aCommunicator =
- VInspectorAPI_Communicator::loadPluginLibrary("TKVInspector.dll");
- if (aCommunicator) {
- aCommunicator->setContext(aContext);
-
- aDisplayer->setCommunicator(aCommunicator);
- #ifndef HAVE_SALOME
- AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
- if (aViewer)
- aViewer->setCallBack(aCommunicator->getCallBack());
- #endif
- }
- VInspector_FirstCall = false;
- }
-#endif
XGUI_Displayer* aDisplayer = (XGUI_Displayer*)this;
aDisplayer->myIsFirstAISContextUse = false;
//aContext->OpenLocalContext();
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
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->Display(anAISIO);
#endif
aDisplayed = true;
aContext->Deactivate(anAISIO);
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->Deactivate(anAISIO);
#endif
aContext->Load(anAISIO);
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->Load(anAISIO);
#endif
if (toActivateInSelectionModes) {
Handle(AIS_InteractiveObject) anAISIO = theAIS->impl<Handle(AIS_InteractiveObject)>();
if (!anAISIO.IsNull() && aContext->IsDisplayed(anAISIO)) {
aContext->Remove(anAISIO, false/*update viewer*/);
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->Remove(anAISIO);
#endif
aErased = true;
// The result is the selection of the first IO is lost.
TColStd_ListOfInteger aTColModes;
aContext->ActivatedModes(theIO, aTColModes);
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->ActivatedModes(theIO, aTColModes);
#endif
TColStd_ListIteratorOfListOfInteger itr( aTColModes );
if (isDeactivated) {
// the selection from the previous activation modes should be cleared manually (#26172)
//theIO->ClearSelected();
- //#ifdef VINSPECTOR
+ //#ifdef TINSPECTOR
//if (getCallBack()) getCallBack()->ClearSelected(theIO);
//#endif
#ifndef CLEAR_OUTDATED_SELECTION_BEFORE_REDISPLAY
aContext->SelectionManager()->Load(theIO);
}
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->Load(theIO);
#endif
}
Standard_True /* update viewer*/,
Standard_False /* allow decomposition */,
AIS_DS_Displayed /* xdisplay status */);
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->Display(aTrihedron);
#endif
deactivateTrihedron(false);
aContext->Erase(aTrihedron);
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (getCallBack()) getCallBack()->Remove(aTrihedron);
#endif
}
return aModes;
}
-#ifdef VINSPECTOR
-void XGUI_Displayer::setCommunicator(VInspectorAPI_Communicator* theCommunicator)
-{
- myCommunicator = theCommunicator;
-}
-
-void XGUI_Displayer::setVInspectorVisible(const bool theVisible)
-{
- if (myCommunicator)
- myCommunicator->setVisible(true);
-}
-
-VInspectorAPI_CallBack* XGUI_Displayer::getCallBack() const
-{
- return myCommunicator ? myCommunicator->getCallBack() : NULL;
-}
-#endif
-
void XGUI_Displayer::AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) theContext,
const NCollection_DataMap<TopoDS_Shape,
NCollection_Map<Handle(AIS_InteractiveObject)>>& theShapesToBeSelected)
class ModelAPI_Feature;
class XGUI_Workshop;
-#ifdef VINSPECTOR
-class VInspectorAPI_Communicator;
+#ifdef TINSPECTOR
class VInspectorAPI_CallBack;
#endif
/// Selection modes will be returned according to TopAbs_ShapeEnum
QIntList activeSelectionModes() const;
-#ifdef VINSPECTOR
- void setVInspectorVisible(const bool theVisible);
-
- void setCommunicator(VInspectorAPI_Communicator* theCommunicator);
-
- VInspectorAPI_CallBack* getCallBack() const;
+#ifdef TINSPECTOR
+ void setCallBack(const Handle(VInspectorAPI_CallBack)& theCallBack)
+ { myVCallBack = theCallBack; }
+ Handle(VInspectorAPI_CallBack) getCallBack() const { return myVCallBack; }
#endif
/// Converts shape type (TopAbs_ShapeEnum) to selection mode
/// \param theShapeType a shape type from TopAbs_ShapeEnum
protected:
/// Reference to workshop
XGUI_Workshop* myWorkshop;
-#ifdef VINSPECTOR
- VInspectorAPI_Communicator* myCommunicator; ///< callback to debug display, show/hide it
+#ifdef TINSPECTOR
+ Handle(VInspectorAPI_CallBack) myVCallBack;
#endif
/// A container for selection filters
Handle(SelectMgr_AndFilter) myAndFilter;
#include <SelectMgr_ListIteratorOfListOfFilter.hxx>
-#ifdef VINSPECTOR
+#ifdef TINSPECTOR
#include <VInspectorAPI_CallBack.hxx>
#endif
Handle(SelectMgr_EntityOwner) anOwner = theSelectedOwners(i);
aContext->AddOrRemoveSelected(anOwner, isUpdateViewer);
- #ifdef VINSPECTOR
+ #ifdef TINSPECTOR
if (myWorkshop->displayer()->getCallBack())
myWorkshop->displayer()->getCallBack()->AddOrRemoveSelected(anOwner);
#endif
#include <iterator>
-#ifdef DFBROWSER
+#ifdef TINSPECTOR
#include <CDF_Session.hxx>
#include <CDF_Application.hxx>
-#include <DFBrowserAPI_Communicator.hxx>
-static bool DFBrowser_FirstCall = true;
+#include <TInspector_Communicator.hxx>
+#include <VInspector_CallBack.hxx>
+static TInspector_Communicator* MyTCommunicator;
+static Handle(VInspector_CallBack) MyVCallBack;
+
#endif
#ifdef _DEBUG
} else if (theId == "SHOW_FEATURE_CMD") {
highlightFeature(aObjects);
}
-#ifdef VINSPECTOR
- else if (theId == "VINSPECTOR_VIEW") {
- displayer()->setVInspectorVisible(true);
- }
-#endif
-#ifdef DFBROWSER
- else if (theId == "DFBROWSER_VIEW") {
- if (DFBrowser_FirstCall) {
- Handle(CDF_Application) anApplication = CDF_Session::CurrentSession()->CurrentApplication();
- DFBrowserAPI_Communicator* aCommunicator =
- DFBrowserAPI_Communicator::loadPluginLibrary("TKDFBrowser.dll");
- if (aCommunicator) {
- aCommunicator->setApplication(anApplication);
+#ifdef TINSPECTOR
+ else if (theId == "TINSPECTOR_VIEW") {
+ Handle(CDF_Application) anApplication = CDF_Session::CurrentSession()->CurrentApplication();
+ if (!anApplication.IsNull())
+ {
+ if (!MyTCommunicator)
+ {
+ MyTCommunicator = new TInspector_Communicator();
+
+ NCollection_List<Handle(Standard_Transient)> aParameters;
+ aParameters.Append(anApplication);
Handle(AIS_InteractiveContext) aContext = viewer()->AISContext();
- if (aContext)
- aCommunicator->setContext(aContext);
+ if (!aContext.IsNull())
+ aParameters.Append(aContext);
+
+ MyVCallBack = new VInspector_CallBack();
+ myDisplayer->setCallBack(MyVCallBack);
+ #ifndef HAVE_SALOME
+ AppElements_Viewer* aViewer = mainWindow()->viewer();
+ if (aViewer)
+ aViewer->setCallBack(MyVCallBack);
+ #endif
+ aParameters.Append(MyVCallBack);
+
+ MyTCommunicator->init(aParameters);
+ MyTCommunicator->Activate("TKVInspector"); // to have filled callback by model
+ MyTCommunicator->Activate("TKDFBrowser");
}
- DFBrowser_FirstCall = false;
+ MyTCommunicator->setVisible(true);
}
}
#endif