@figure{VStudio_projects.png,"Inspector packages in MS Visual Studio",160}
+@subsection occt_inspector_5_1 Building tools with CMake outside of OCCT
+
+To compile OCCT tools, run CMake and set the source directory into the "tools" folder of OCCT.
+@figure{build_cmake_tools.png,"OCCT tools",160}
+
+"OpenCASCADE_Dir" should be defined and point into <b>cmake</b> directory of installed OCCT. (Please be sure that sources
+of OCCT for compiled tools are the same as sources of installed OCCT, otherwise interface might be different and
+you have compilation errors)
+
+After, define 3RDPARTY_QT_DIR
+
+Checked variables BUILD_PLUGIN_* define which plugins should be compiled.
+If only BUILD_PLUGIN_TreeModel is checked, no plugins are compiled, only TreeModel library that might be used as an interface
+of communication to Qt tree model by items implementation.
+
+
@section occt_inspector_6 Sources and packaging
OCCT sources are extended by the /tools directory.
set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE)
+# build variables
+macro (BUILD_TOOL_MESSAGE BUILD_TOOL_TARGET_VARIABLE BUILD_TOOL_TARGET_STRING)
+set (${BUILD_TOOL_TARGET_VARIABLE}_DESCR
+"Indicates whether ${BUILD_TOOL_TARGET_STRING} tool should be built or not.
+It should be noted that some toolkits of the module can be built even if this module
+is not checked (this happens if some other modules depend on these toolkits)")
+set (${BUILD_TOOL_TARGET_VARIABLE} ON CACHE BOOL "${${BUILD_TOOL_TARGET_VARIABLE}_DESCR}")
+endmacro()
+
+BUILD_TOOL_MESSAGE (BUILD_PLUGIN_TKTreeModel "TKTreeModel")
+BUILD_TOOL_MESSAGE (BUILD_PLUGIN_TKDFBrowser "TKDFBrowser")
+BUILD_TOOL_MESSAGE (BUILD_PLUGIN_TKVInspector "TKVInspector")
+BUILD_TOOL_MESSAGE (BUILD_PLUGIN_TKShapeView "TKShapeView")
+if (NOT BUILD_PLUGIN_TKDFBrowser AND NOT BUILD_PLUGIN_TKVInspector AND NOT BUILD_PLUGIN_TKShapeView)
+ set (BUILD_TREE_MODEL_ONLY ON)
+endif()
+
# macro: include patched file if it exists
macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake")
# list <OCCT_TOOLS> will contain all tools
#if (BUILD_Inspector)
OCCT_MODULES_AND_TOOLKITS (TOOLS "TOOL_TOOLKITS" OCCT_TOOLS)
- foreach (OCCT_TOOL ${OCCT_TOOLS})
- list (APPEND BUILD_TOOL_TOOLKITS ${${OCCT_TOOL}_TOOL_TOOLKITS})
- endforeach()
+
+ if (DEFINED BUILD_TREE_MODEL_ONLY AND BUILD_TREE_MODEL_ONLY)
+ list (APPEND BUILD_TOOL_TOOLKITS "TKTreeModel")
+ else()
+ foreach (OCCT_TOOL ${OCCT_TOOLS})
+ list (APPEND BUILD_TOOL_TOOLKITS ${${OCCT_TOOL}_TOOL_TOOLKITS})
+ endforeach()
+ endif()
+
+ message("Build: ${BUILD_TOOL_TOOLKITS}")
# collect all the headers to <binary dir>/inc/inspector folder
string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
endif()
# include patched toolkit projects or original ones
-if (BUILD_TOOL_TOOLKITS)
+if (BUILD_TREE_MODEL_ONLY)
+ OCCT_ADD_SUBDIRECTORY ("tools/TKTreeModel")
+ message (STATUS "Info: TKTreeModel OCCT toolkits processed")
+else()
foreach (BUILD_TOOL_TOOLKIT ${BUILD_TOOL_TOOLKITS})
- OCCT_ADD_SUBDIRECTORY ("tools/${BUILD_TOOL_TOOLKIT}")
+ if (NOT DEFINED BUILD_PLUGIN_${BUILD_TOOL_TOOLKIT} OR BUILD_PLUGIN_${BUILD_TOOL_TOOLKIT})
+ OCCT_ADD_SUBDIRECTORY ("tools/${BUILD_TOOL_TOOLKIT}")
+ message (STATUS "Info: ${BUILD_TOOL_TOOLKIT} toolkits processed")
+ endif()
endforeach()
endif()
}
}
bool aDocumentItemFound = false;
- QModelIndex aParentIndex = index (0, 0);
- TreeModel_ItemBasePtr aParentItem = TreeModel_ModelBase::GetItemByIndex (aParentIndex); // application item
+ QModelIndex aParentIndex;
+ TreeModel_ItemBasePtr aParentItem;
// find document, where label of document item is equal to Root label
- for (int aChildId = 0, aCount = aParentItem->rowCount(); aChildId < aCount; aChildId++)
+ for (int aChildId = 0, aCount = rowCount(); aChildId < aCount; aChildId++)
{
- QModelIndex anIndex = index (aChildId, 0, aParentIndex);
+ QModelIndex anIndex = index (aChildId, 0);
TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
DFBrowser_ItemDocumentPtr anItem = itemDynamicCast<DFBrowser_ItemDocument> (anItemBase);
if (anItem->GetLabel() == aRoot)
// =======================================================================
QModelIndex ShapeView_TreeModel::FindIndex (const TopoDS_Shape& theShape) const
{
- QModelIndex aParentIndex = index (0, 0);
- TreeModel_ItemBasePtr aParentItem = TreeModel_ModelBase::GetItemByIndex (aParentIndex); // application item
- for (int aChildId = 0, aCount = aParentItem->rowCount(); aChildId < aCount; aChildId++)
+ for (int aChildId = 0, aCount = rowCount(); aChildId < aCount; aChildId++)
{
- QModelIndex anIndex = index (aChildId, 0, aParentIndex);
+ QModelIndex anIndex = index (aChildId, 0);
ShapeView_ItemShapePtr anItem = itemDynamicCast<ShapeView_ItemShape> (TreeModel_ModelBase::GetItemByIndex (anIndex));
if (anItem && anItem->GetItemShape() == theShape)
return anIndex;
if (!hasIndex (theRow, theColumn, theParent))
return QModelIndex();
- // to create index on the root item
- if (!theParent.isValid())
- return createIndex (theRow, theColumn, getIndexValue (RootItem (theColumn)));
-
TreeModel_ItemBasePtr aParentItem;
if (!theParent.isValid())
aParentItem = RootItem (theColumn);
// =======================================================================
int TreeModel_ModelBase::rowCount (const QModelIndex& theParent) const
{
- // to create index on the root item
- if (!theParent.isValid())
- return 1;
-
TreeModel_ItemBasePtr aParentItem;
if (!theParent.isValid())
aParentItem = RootItem (0);
QModelIndexList VInspector_ViewModel::FindPointers (const QStringList& thePointers)
{
QModelIndexList anIndices;
- QModelIndex aParentIndex = index (0, 0);
- TreeModel_ItemBasePtr aParentItem = TreeModel_ModelBase::GetItemByIndex (aParentIndex); // context item
- for (int aRowId = 0, aCount = aParentItem->rowCount(); aRowId < aCount; aRowId++)
+ for (int aRowId = 0, aCount = rowCount(); aRowId < aCount; aRowId++)
{
- QModelIndex anIndex = index (aRowId, 0, aParentIndex);
+ QModelIndex anIndex = index (aRowId, 0);
TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
VInspector_ItemPresentableObjectPtr anItemPrs = itemDynamicCast<VInspector_ItemPresentableObject>(anItemBase);
if (!anItemPrs)