mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
0156fa8914 |
BIN
dox/user_guides/inspector/images/build_cmake_tools.png
Normal file
BIN
dox/user_guides/inspector/images/build_cmake_tools.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 55 KiB |
@@ -557,6 +557,22 @@ When this option is switched ON, MS Visual Studio project has an additional tree
|
|||||||
@figure{VStudio_projects.png,"Inspector packages in MS Visual Studio",160}
|
@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
|
@section occt_inspector_6 Sources and packaging
|
||||||
|
|
||||||
OCCT sources are extended by the /tools directory.
|
OCCT sources are extended by the /tools directory.
|
||||||
|
@@ -26,6 +26,23 @@ set (CMAKE_SUPPRESS_REGENERATION TRUE)
|
|||||||
|
|
||||||
set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE)
|
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: include patched file if it exists
|
||||||
macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)
|
macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)
|
||||||
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake")
|
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake")
|
||||||
@@ -333,9 +350,16 @@ endif()
|
|||||||
# list <OCCT_TOOLS> will contain all tools
|
# list <OCCT_TOOLS> will contain all tools
|
||||||
#if (BUILD_Inspector)
|
#if (BUILD_Inspector)
|
||||||
OCCT_MODULES_AND_TOOLKITS (TOOLS "TOOL_TOOLKITS" OCCT_TOOLS)
|
OCCT_MODULES_AND_TOOLKITS (TOOLS "TOOL_TOOLKITS" OCCT_TOOLS)
|
||||||
foreach (OCCT_TOOL ${OCCT_TOOLS})
|
|
||||||
list (APPEND BUILD_TOOL_TOOLKITS ${${OCCT_TOOL}_TOOL_TOOLKITS})
|
if (DEFINED BUILD_TREE_MODEL_ONLY AND BUILD_TREE_MODEL_ONLY)
|
||||||
endforeach()
|
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
|
# collect all the headers to <binary dir>/inc/inspector folder
|
||||||
string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
|
string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
|
||||||
@@ -363,9 +387,15 @@ if (3RDPARTY_LIBRARY_DIRS)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# include patched toolkit projects or original ones
|
# 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})
|
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()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@@ -98,12 +98,12 @@ QModelIndex DFBrowser_TreeModel::FindIndex (const TDF_Label& theLabel) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool aDocumentItemFound = false;
|
bool aDocumentItemFound = false;
|
||||||
QModelIndex aParentIndex = index (0, 0);
|
QModelIndex aParentIndex;
|
||||||
TreeModel_ItemBasePtr aParentItem = TreeModel_ModelBase::GetItemByIndex (aParentIndex); // application item
|
TreeModel_ItemBasePtr aParentItem;
|
||||||
// find document, where label of document item is equal to Root label
|
// 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);
|
TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
|
||||||
DFBrowser_ItemDocumentPtr anItem = itemDynamicCast<DFBrowser_ItemDocument> (anItemBase);
|
DFBrowser_ItemDocumentPtr anItem = itemDynamicCast<DFBrowser_ItemDocument> (anItemBase);
|
||||||
if (anItem->GetLabel() == aRoot)
|
if (anItem->GetLabel() == aRoot)
|
||||||
|
@@ -107,11 +107,9 @@ void ShapeView_TreeModel::RemoveAllShapes()
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
QModelIndex ShapeView_TreeModel::FindIndex (const TopoDS_Shape& theShape) const
|
QModelIndex ShapeView_TreeModel::FindIndex (const TopoDS_Shape& theShape) const
|
||||||
{
|
{
|
||||||
QModelIndex aParentIndex = index (0, 0);
|
for (int aChildId = 0, aCount = rowCount(); aChildId < aCount; aChildId++)
|
||||||
TreeModel_ItemBasePtr aParentItem = TreeModel_ModelBase::GetItemByIndex (aParentIndex); // application item
|
|
||||||
for (int aChildId = 0, aCount = aParentItem->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));
|
ShapeView_ItemShapePtr anItem = itemDynamicCast<ShapeView_ItemShape> (TreeModel_ModelBase::GetItemByIndex (anIndex));
|
||||||
if (anItem && anItem->GetItemShape() == theShape)
|
if (anItem && anItem->GetItemShape() == theShape)
|
||||||
return anIndex;
|
return anIndex;
|
||||||
|
@@ -66,10 +66,6 @@ QModelIndex TreeModel_ModelBase::index (int theRow, int theColumn, const QModelI
|
|||||||
if (!hasIndex (theRow, theColumn, theParent))
|
if (!hasIndex (theRow, theColumn, theParent))
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
|
||||||
// to create index on the root item
|
|
||||||
if (!theParent.isValid())
|
|
||||||
return createIndex (theRow, theColumn, getIndexValue (RootItem (theColumn)));
|
|
||||||
|
|
||||||
TreeModel_ItemBasePtr aParentItem;
|
TreeModel_ItemBasePtr aParentItem;
|
||||||
if (!theParent.isValid())
|
if (!theParent.isValid())
|
||||||
aParentItem = RootItem (theColumn);
|
aParentItem = RootItem (theColumn);
|
||||||
@@ -164,10 +160,6 @@ QVariant TreeModel_ModelBase::headerData (int theSection, Qt::Orientation theOri
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
int TreeModel_ModelBase::rowCount (const QModelIndex& theParent) const
|
int TreeModel_ModelBase::rowCount (const QModelIndex& theParent) const
|
||||||
{
|
{
|
||||||
// to create index on the root item
|
|
||||||
if (!theParent.isValid())
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
TreeModel_ItemBasePtr aParentItem;
|
TreeModel_ItemBasePtr aParentItem;
|
||||||
if (!theParent.isValid())
|
if (!theParent.isValid())
|
||||||
aParentItem = RootItem (0);
|
aParentItem = RootItem (0);
|
||||||
|
@@ -105,11 +105,9 @@ void VInspector_ViewModel::SetContext (const Handle(AIS_InteractiveContext)& the
|
|||||||
QModelIndexList VInspector_ViewModel::FindPointers (const QStringList& thePointers)
|
QModelIndexList VInspector_ViewModel::FindPointers (const QStringList& thePointers)
|
||||||
{
|
{
|
||||||
QModelIndexList anIndices;
|
QModelIndexList anIndices;
|
||||||
QModelIndex aParentIndex = index (0, 0);
|
for (int aRowId = 0, aCount = rowCount(); aRowId < aCount; aRowId++)
|
||||||
TreeModel_ItemBasePtr aParentItem = TreeModel_ModelBase::GetItemByIndex (aParentIndex); // context item
|
|
||||||
for (int aRowId = 0, aCount = aParentItem->rowCount(); aRowId < aCount; aRowId++)
|
|
||||||
{
|
{
|
||||||
QModelIndex anIndex = index (aRowId, 0, aParentIndex);
|
QModelIndex anIndex = index (aRowId, 0);
|
||||||
TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
|
TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
|
||||||
VInspector_ItemPresentableObjectPtr anItemPrs = itemDynamicCast<VInspector_ItemPresentableObject>(anItemBase);
|
VInspector_ItemPresentableObjectPtr anItemPrs = itemDynamicCast<VInspector_ItemPresentableObject>(anItemBase);
|
||||||
if (!anItemPrs)
|
if (!anItemPrs)
|
||||||
|
Reference in New Issue
Block a user