- samples/tools/TStandalone is removed, to build Inspector out of OCCT, CMake should use tools/CMakeLists.txt fileName
- samples/tools/TInspectorEXE is moved to tools/TInspectorEXE
- TInspectorAPI_Version.hxx provides compilation inspector with earlier version of OCCT.
# list <TOOLNAME>_TOOLKITS is created foreach tool and contains its toolkits
# list <OCCT_TOOLS> will contain all tools
if (BUILD_Inspector)
+ add_definitions (-DHAVE_Inspector)
+
OCCT_MODULES_AND_TOOLKITS (TOOLS "TOOL_TOOLKITS" OCCT_TOOLS)
foreach (OCCT_TOOL ${OCCT_TOOLS})
list (APPEND BUILD_TOOL_TOOLKITS ${${OCCT_TOOL}_TOOL_TOOLKITS})
message (STATUS "Info: qt samples excluded due to BUILD_MODULE_QtSamples is disabled")
endif()
- if (NOT BUILD_Inspector)
- list (REMOVE_ITEM OCCT_SAMPLES tools)
- message (STATUS "Info: TInspectorEXE sample excluded due to BUILD_Inspector is disabled")
- endif()
-
foreach (OCCT_SAMPLE ${OCCT_SAMPLES})
list (APPEND BUILD_SAMPLE_TOOLKITS ${${OCCT_SAMPLE}_SAMPLES_TOOLKITS})
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE)
endif()
+ set (OpenCASCADE_BINARY_DIR "${INSTALL_DIR}/${INSTALL_DIR_BIN}")
# patch TInspectorEXE
- OCCT_CONFIGURE ("adm/templates/TInspectorEXE.vcxproj.user.in" "${CMAKE_BINARY_DIR}/samples/tools/TInspectorEXE/TInspectorEXE.vcxproj.user")
+ OCCT_CONFIGURE ("adm/templates/TInspectorEXE.vcxproj.user.in" "${CMAKE_BINARY_DIR}/tools/TInspectorEXE/TInspectorEXE.vcxproj.user")
endif()
# Prepare variables for configuration of OpenCASCADE cmake config file
-qt AndroidQt FuncDemo IESample Tutorial
-tools TInspectorEXE
\ No newline at end of file
+qt AndroidQt FuncDemo IESample Tutorial
\ No newline at end of file
TModelingData TKShapeView
TVisualization TKView TKVInspector
TApplicationFramework TKTreeModel TKTInspectorAPI TKDFBrowser
-TTool TKTInspector TKToolsDraw
\ No newline at end of file
+TTool TKTInspector TKToolsDraw TInspectorEXE
\ No newline at end of file
<LocalDebuggerEnvironment>CASROOT=@CMAKE_SOURCE_DIR@
CSF_OCCTDataPath=@CMAKE_SOURCE_DIR@/data
QTDIR=@3RDPARTY_QT_DIR@
-PATH=@3RDPARTY_DLL_DIRS_FOR_PATH@;%PATH%
+PATH=@3RDPARTY_DLL_DIRS_FOR_PATH@;@OpenCASCADE_BINARY_DIR@;%PATH%
</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerWorkingDirectory>@CMAKE_BINARY_DIR@</LocalDebuggerWorkingDirectory>
<LocalDebuggerEnvironment>CASROOT=@CMAKE_SOURCE_DIR@
CSF_OCCTDataPath=@CMAKE_SOURCE_DIR@/data
QTDIR=@3RDPARTY_QT_DIR@
-PATH=@3RDPARTY_DLL_DIRS_FOR_PATH@;%PATH%
+PATH=@3RDPARTY_DLL_DIRS_FOR_PATH@;@OpenCASCADE_BINARY_DIR@i;%PATH%
</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerWorkingDirectory>@CMAKE_BINARY_DIR@</LocalDebuggerWorkingDirectory>
<LocalDebuggerEnvironment>CASROOT=@CMAKE_SOURCE_DIR@
CSF_OCCTDataPath=@CMAKE_SOURCE_DIR@/data
QTDIR=@3RDPARTY_QT_DIR@
-PATH=@3RDPARTY_DLL_DIRS_FOR_PATH@;%PATH%
+PATH=@3RDPARTY_DLL_DIRS_FOR_PATH@;@OpenCASCADE_BINARY_DIR@d;%PATH%
</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerWorkingDirectory>@CMAKE_BINARY_DIR@</LocalDebuggerWorkingDirectory>
+++ /dev/null
-project(TInspectorEXE)
-
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_sample)
-set (RELATIVE_DIR "samples/tools")
-include_directories("${CMAKE_SOURCE_DIR}/${RELATIVE_DIR}/TInspectorEXE/src")
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
-OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_sample)
+++ /dev/null
-TKTInspector
\ No newline at end of file
+++ /dev/null
-EXTERNLIB
-PACKAGES
+++ /dev/null
-TInspectorEXE/src
+++ /dev/null
-TInspectorEXE.cxx
-TInspectorEXE_OpenFileDialog.cxx
-TInspectorEXE_OpenFileDialog.hxx
-TInspectorEXE_OpenFileViewModel.cxx
-TInspectorEXE_OpenFileViewModel.hxx
-TInspectorEXE.qrc
\ No newline at end of file
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#include <TInspectorEXE_OpenFileDialog.hxx>
-
-#include <inspector/TInspector_Communicator.hxx>
-
-#include <OSD_Environment.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QAction>
-#include <QApplication>
-#include <QDir>
-#include <QMainWindow>
-#include <QToolBar>
-#include <Standard_WarningsRestore.hxx>
-
-#include <set>
-
-// =======================================================================
-// function : fileNameInDataDir
-// purpose :
-// =======================================================================
-TCollection_AsciiString fileNameInDataDir(const TCollection_AsciiString& theEnvironmentDir,
- const TCollection_AsciiString& theName)
-{
- OSD_Environment anEnvironment(theEnvironmentDir);
-
- TCollection_AsciiString aFileName = anEnvironment.Value();
- aFileName += TCollection_AsciiString("/") + theName;
-
- return aFileName;
-}
-
-// =======================================================================
-// function : setPluginSampleDirectory
-// purpose :
-// =======================================================================
-void setPluginSampleDirectory (const TCollection_AsciiString& theName, TInspector_Communicator* theCommunicator,
- TInspectorEXE_OpenButton* theButtonControl)
-{
- if (theName.IsEqual ("TKDFBrowser"))
- {
- theCommunicator->OpenFile (theName, fileNameInDataDir ("CSF_OCCTDataPath", "step/screw.step"));
- theButtonControl->SetPluginDir (theName, fileNameInDataDir ("CSF_OCCTDataPath", "step"));
- }
- else if (theName.IsEqual ("TKShapeView"))
- {
- theCommunicator->OpenFile (theName, fileNameInDataDir ("CSF_OCCTDataPath", "occ/hammer.brep"));
- theButtonControl->SetPluginDir (theName, fileNameInDataDir ("CSF_OCCTDataPath", "occ"));
- }
- else if (theName.IsEqual ("TKVInspector"))
- {
- theCommunicator->OpenFile (theName, fileNameInDataDir ("CSF_OCCTDataPath", "occ/face1.brep"));
- theCommunicator->OpenFile (theName, fileNameInDataDir ("CSF_OCCTDataPath", "occ/face2.brep"));
- theButtonControl->SetPluginDir (theName, fileNameInDataDir ("CSF_OCCTDataPath", "occ"));
- }
-}
-
-// =======================================================================
-// function : main
-// purpose :
-// =======================================================================
-int main (int argc, char** argv)
-{
-#if QT_VERSION > 0x050000
- TCollection_AsciiString aPlugindsDirName = OSD_Environment ("QTDIR").Value();
- if (!aPlugindsDirName.IsEmpty())
- QApplication::addLibraryPath (QString (aPlugindsDirName.ToCString()) + "/plugins");
-#endif
- QApplication anApp (argc, argv);
-
- std::set<TCollection_AsciiString> aPlugins;
- for (int anArgId = 1; anArgId < argc; anArgId++ )
- {
- if (!strcmp (argv[anArgId], "dfbrowser"))
- aPlugins.insert ("TKDFBrowser");
-
- if (!strcmp (argv[anArgId], "shapeview"))
- aPlugins.insert ("TKShapeView");
-
- if (!strcmp (argv[anArgId], "vinspector"))
- aPlugins.insert ("TKVInspector");
- }
- NCollection_List<Handle(Standard_Transient)> aParameters;
-
- // Create tool communicator
- TInspector_Communicator* aCommunicator = TInspectorEXE_OpenFileDialog::Communicator();
- if (!aCommunicator)
- {
- std::cout << "Communicator can not be created" << std::endl;
- return 0;
- }
-
- TInspectorEXE_OpenButton* aButtonControl = new TInspectorEXE_OpenButton (0);
- TCollection_AsciiString anActivatedPluginName;
- if (aPlugins.empty())
- {
- aPlugins.insert("TKDFBrowser");
- aPlugins.insert("TKShapeView");
- aPlugins.insert("TKVInspector");
-
- anActivatedPluginName = "TKDFBrowser";
- }
- else
- anActivatedPluginName = *aPlugins.rbegin();
-
- for (std::set<TCollection_AsciiString>::const_iterator aPluginIt = aPlugins.begin(); aPluginIt != aPlugins.end(); aPluginIt++)
- {
- TCollection_AsciiString aName = *aPluginIt;
- aCommunicator->RegisterPlugin (aName);
- aCommunicator->Init (aName, aParameters);
- setPluginSampleDirectory (aName, aCommunicator, aButtonControl);
- }
- aCommunicator->Activate (anActivatedPluginName);
-
- aCommunicator->SetVisible (true);
- aCommunicator->SetOpenButton (aButtonControl->StartButton());
-
- return anApp.exec();
-}
+++ /dev/null
-<!DOCTYPE RCC><RCC version="1.0">
- <qresource prefix="/">
- <file alias="folder_open.png">../icons/folder_open.png</file>
- <file alias="folder_import.png">../icons/folder_import.png</file>
- </qresource>
-</RCC>
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <TInspectorEXE_OpenFileDialog.hxx>
-#include <TInspectorEXE_OpenFileViewModel.hxx>
-
-#include <inspector/TInspector_Communicator.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QApplication>
-#include <QCompleter>
-#include <QDir>
-#include <QFileDialog>
-#include <QFileSystemModel>
-#include <QItemSelectionModel>
-#include <QGroupBox>
-#include <QHBoxLayout>
-#include <QHeaderView>
-#include <QLabel>
-#include <QLineEdit>
-#include <QScrollBar>
-#include <QTableView>
-#include <QToolButton>
-#include <QPushButton>
-#include <QVBoxLayout>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-const int FONT_POINT_SIZE = 18;
-const int ICON_SIZE = 40;
-
-const int OPEN_DIALOG_WIDTH = 550;
-const int OPEN_DIALOG_HEIGHT = 200;
-
-const int MARGIN_DIALOG = 4;
-const int SPACING_DIALOG = 2;
-
-TInspector_Communicator* MyCommunicator;
-
-// =======================================================================
-// function : StartButton
-// purpose :
-// =======================================================================
-QPushButton* TInspectorEXE_OpenButton::StartButton()
-{
- if (!myStartButton)
- {
- myStartButton = new QPushButton();
- myStartButton->setIcon (QIcon (":folder_open.png"));
- connect (myStartButton, SIGNAL (clicked()), this, SLOT (onStartButtonClicked()));
- }
- return myStartButton;
-}
-
-// =======================================================================
-// function : onStartButtonClicked
-// purpose :
-// =======================================================================
-void TInspectorEXE_OpenButton::onStartButtonClicked()
-{
- QPushButton* aButton = (QPushButton*)sender();
- TCollection_AsciiString aPluginName (aButton->objectName().toStdString().c_str());
- if (aPluginName.IsEmpty())
- return;
-
- QString aDataDirName = QDir::currentPath();
- if (myDefaultDirs.IsBound (aPluginName))
- aDataDirName = myDefaultDirs.Find (aPluginName).ToCString();
-
- QString aFileName = TInspectorEXE_OpenFileDialog::OpenFile (0, aDataDirName);
- aFileName = QDir().toNativeSeparators (aFileName);
- if (!aFileName.isEmpty()) {
- QApplication::setOverrideCursor (Qt::WaitCursor);
- TInspectorEXE_OpenFileDialog::Communicator()->OpenFile (aPluginName, TCollection_AsciiString (aFileName.toUtf8().data()));
- QApplication::restoreOverrideCursor();
- }
-}
-
-// =======================================================================
-// function : changeMargins
-// purpose :
-// =======================================================================
-void changeMargins (QBoxLayout* theLayout)
-{
- theLayout->setContentsMargins (MARGIN_DIALOG, MARGIN_DIALOG, MARGIN_DIALOG, MARGIN_DIALOG);
- theLayout->setSpacing (SPACING_DIALOG);
-}
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-TInspectorEXE_OpenFileDialog::TInspectorEXE_OpenFileDialog (QWidget* theParent, const QString& theDataDirName)
-: QDialog(theParent), myDataDir (theDataDirName)
-{
- setWindowTitle (theDataDirName);
-
- QVBoxLayout* aDialogLay = new QVBoxLayout (this);
- changeMargins (aDialogLay);
-
- // Title label
- QLabel* aTitleLabel = new QLabel (this);
- aTitleLabel->setText (tr ("Open File"));
- aDialogLay->addWidget (aTitleLabel);
-
- // Samples View
- QGroupBox* aSamplesBox = new QGroupBox (this);
- aSamplesBox->setTitle (tr ("Samples"));
- aDialogLay->addWidget (aSamplesBox);
- QVBoxLayout* aSampleLay = new QVBoxLayout (aSamplesBox);
- changeMargins (aSampleLay);
- mySamplesView = createTableView (readSampleNames());
- aSampleLay->addWidget (mySamplesView);
-
- // Select file
- QGroupBox* aSelectFileBox = new QGroupBox (this);
- aSelectFileBox->setTitle (tr ("Select file"));
- aDialogLay->addWidget (aSelectFileBox);
- QGridLayout* aSelectFileLay = new QGridLayout (aSelectFileBox);
- aSelectFileLay->setContentsMargins (MARGIN_DIALOG, MARGIN_DIALOG, MARGIN_DIALOG, MARGIN_DIALOG);
-
- mySelectedName = new QLineEdit (aSelectFileBox);
- QCompleter* aCompleter = new QCompleter();
- QFileSystemModel* aFileSystemModel = new QFileSystemModel;
- aFileSystemModel->setRootPath (QDir::rootPath());
- aCompleter->setModel (aFileSystemModel);
- mySelectedName->setCompleter (aCompleter);
- aSelectFileLay->addWidget (mySelectedName, 1, 0);
-
- QToolButton* aSelectFileBtn = new QToolButton (aSelectFileBox);
- aSelectFileBtn->setIcon (QIcon (":folder_open.png"));
- aSelectFileLay->addWidget (aSelectFileBtn, 1, 1);
-
- myFolderApplyOpen = new QToolButton (aSelectFileBox);
- myFolderApplyOpen->setIcon (QIcon (":folder_import.png"));
- myFolderApplyOpen->setIconSize (QSize (ICON_SIZE, ICON_SIZE));
- myFolderApplyOpen->setEnabled (false);
- aSelectFileLay->addWidget (myFolderApplyOpen, 0, 2, 2, 1);
-
- connect (mySelectedName, SIGNAL (textChanged (const QString&)),
- this, SLOT (onNameChanged (const QString&)));
- connect (aSelectFileBtn, SIGNAL (clicked()), this, SLOT (onSelectClicked()));
- connect (myFolderApplyOpen, SIGNAL (clicked()), this, SLOT (onApplySelectClicked()));
-
- resize (OPEN_DIALOG_WIDTH, OPEN_DIALOG_HEIGHT);
-}
-
-// =======================================================================
-// function : OpenFile
-// purpose :
-// =======================================================================
-QString TInspectorEXE_OpenFileDialog::OpenFile (QWidget* theParent, const QString& theDataDirName)
-{
- QString aFileName;
- TInspectorEXE_OpenFileDialog* aDialog = new TInspectorEXE_OpenFileDialog(theParent, theDataDirName);
- if (aDialog->exec() == QDialog::Accepted)
- aFileName = aDialog->GetFileName();
-
- return aFileName;
-}
-
-// =======================================================================
-// function : Communicator
-// purpose :
-// =======================================================================
-TInspector_Communicator* TInspectorEXE_OpenFileDialog::Communicator()
-{
- if (!MyCommunicator)
- MyCommunicator = new TInspector_Communicator();
- return MyCommunicator;
-}
-
-// =======================================================================
-// function : onSampleSelectionChanged
-// purpose :
-// =======================================================================
-void TInspectorEXE_OpenFileDialog::onSampleSelectionChanged (const QItemSelection& theSelected,
- const QItemSelection&)
-{
- QItemSelectionModel* aSelectionModel = (QItemSelectionModel*)sender();
- if (!aSelectionModel)
- return;
- if (theSelected.isEmpty())
- return;
-
- QModelIndex anIndex = theSelected.first().indexes().first();
- if (!anIndex.isValid())
- return;
-
- myFileName = aSelectionModel->model()->data (anIndex, Qt::ToolTipRole).toString();
- accept();
-}
-
-// =======================================================================
-// function : onNameChanged
-// purpose :
-// =======================================================================
-void TInspectorEXE_OpenFileDialog::onNameChanged (const QString& theText)
-{
- QFileInfo aFileInfo (theText);
- bool anExists = aFileInfo.exists() && aFileInfo.isFile();
- myFolderApplyOpen->setEnabled (anExists);
-}
-
-// =======================================================================
-// function : onSelectClicked
-// purpose :
-// =======================================================================
-void TInspectorEXE_OpenFileDialog::onSelectClicked()
-{
- QString anEnteredPath;
- QString aDirName = mySelectedName->text();
- if (!aDirName.isEmpty())
- {
- QDir aDir (aDirName);
- if (aDir.exists())
- anEnteredPath = aDirName;
- }
-
- QString aFileName = QFileDialog::getOpenFileName (0, "Open document", anEnteredPath);
-
- if (aFileName.isEmpty())
- return; // do nothing, left the previous value
-
-
- myFileName = aFileName;
- accept();
-}
-
-// =======================================================================
-// function : onApplySelectClicked
-// purpose :
-// =======================================================================
-void TInspectorEXE_OpenFileDialog::onApplySelectClicked()
-{
- myFileName = mySelectedName->text();
- accept();
-}
-
-// =======================================================================
-// function : createTableView
-// purpose :
-// =======================================================================
-QTableView* TInspectorEXE_OpenFileDialog::createTableView (const QStringList& theFileNames)
-{
- QTableView* aTableView = new QTableView (this);
- aTableView->setFrameStyle (QFrame::NoFrame);
- QPalette aPalette = aTableView->viewport()->palette();
- QColor aWindowColor = aPalette.color (QPalette::Window);
- aPalette.setBrush (QPalette::Base, aWindowColor);
- aTableView->viewport()->setPalette (aPalette);
-
- aTableView->horizontalHeader()->setVisible (false);
- aTableView->verticalHeader()->setVisible (false);
- aTableView->setGridStyle (Qt::NoPen);
- aTableView->setModel (createModel (theFileNames));
- aTableView->setItemDelegateForRow (0, new TInspectorEXE_OpenFileItemDelegate (aTableView,
- aPalette.color (QPalette::Highlight)));
- aTableView->viewport()->setAttribute (Qt::WA_Hover);
- int aCellHeight = ICON_SIZE + aTableView->verticalHeader()->defaultSectionSize();
- aTableView->setRowHeight (0, aCellHeight);
- int aScrollHeight = aTableView->horizontalScrollBar()->sizeHint().height();
- aTableView->setMinimumHeight (aCellHeight + aScrollHeight);
- QItemSelectionModel* aSelectionModel = new QItemSelectionModel (aTableView->model());
- connect (aSelectionModel, SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)),
- this, SLOT (onSampleSelectionChanged (const QItemSelection&, const QItemSelection&)));
- aTableView->setSelectionModel (aSelectionModel);
-
- return aTableView;
-}
-
-// =======================================================================
-// function : createModel
-// purpose :
-// =======================================================================
-QAbstractItemModel* TInspectorEXE_OpenFileDialog::createModel (const QStringList& theFileNames)
-{
- TInspectorEXE_OpenFileViewModel* aModel = new TInspectorEXE_OpenFileViewModel (this);
- aModel->Init (theFileNames);
- return aModel;
-}
-
-// =======================================================================
-// function : readSampleNames
-// purpose :
-// =======================================================================
-QStringList TInspectorEXE_OpenFileDialog::readSampleNames()
-{
- QStringList aNames;
-
- QDir aDir(myDataDir);
- aDir.setSorting(QDir::Name);
-
- QFileInfoList aDirEntries = aDir.entryInfoList();
- for (int aDirId = 0; aDirId < aDirEntries.size(); ++aDirId)
- {
- QFileInfo aFileInfo = aDirEntries.at(aDirId);
- if (aFileInfo.isFile())
- aNames.append (aFileInfo.absoluteFilePath());
- }
- return aNames;
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef TInspectorEXE_OpenFileDialog_H
-#define TInspectorEXE_OpenFileDialog_H
-
-#include <NCollection_DataMap.hxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QDialog>
-#include <QItemSelection>
-#include <QStringList>
-#include <Standard_WarningsRestore.hxx>
-
-#include <map>
-
-class TInspector_Communicator;
-
-class QAbstractItemModel;
-class QLineEdit;
-class QPushButton;
-class QTableView;
-class QToolButton;
-class QWidget;
-
-//! \class TInspectorEXE_OpenButton
-//! Class that contains push button and the button processing. It obtains a file name from the default or current
-//! directory and gives the name into TInspector communicator
-//! Object name of the button is the name of the plugin to get the default directory, or the current directory is used.
-class TInspectorEXE_OpenButton : public QObject
-{
- Q_OBJECT
-
-public:
-
- //! Constructor
- TInspectorEXE_OpenButton (QObject* theParent) : QObject (theParent), myStartButton (0) {}
-
- //! Destructor
- virtual ~TInspectorEXE_OpenButton() {}
-
- //! Returns the start button, if this is the first call, it creates the button and connect it to the slot
- QPushButton* StartButton();
-
- //! Sets the default directory of plugin.
- void SetPluginDir (const TCollection_AsciiString& thePluginName, const TCollection_AsciiString& theDefaultDir)
- { myDefaultDirs.Bind (thePluginName, theDefaultDir); }
-
-private slots:
-
- //! Processes the button click, open default/current directory to select open file, calls OpenFile of communicator
- void onStartButtonClicked();
-
-private:
-
- QPushButton* myStartButton; //!< processed button
- NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString> myDefaultDirs; //!< plugins default directories
-};
-
-//! \class TInspectorEXE_OpenFileDialog
-//! Control that contains table view of samples and line to select a file name from other directory.
-//! Click on element of samples table view calls this sample opening else after entering(or opening) file name
-//! the import becomes active. Click on the button will open selected file if it is possible
-class TInspectorEXE_OpenFileDialog : public QDialog
-{
- Q_OBJECT
-private:
-
- //! Constructor
- TInspectorEXE_OpenFileDialog (QWidget* theParent, const QString& theDataDirName);
-
-public:
-
- //! Destructor
- virtual ~TInspectorEXE_OpenFileDialog() Standard_OVERRIDE {}
-
- //! Opens this file dialog using for samples view the given directory and try to open new file
- //! \param theParent a parent for the new dialog
- //! \param theDataDirName path to default samples directory
- //! \returns a file name from the open file dialog
- static QString OpenFile (QWidget* theParent, const QString& theDataDirName);
-
- //! Returns selection name from the dialog
- QString GetFileName() const { return myFileName; }
-
- //! Returns communicator, if this is the first call, create a communicator instance
- static TInspector_Communicator* Communicator();
-
-private slots:
-
- //! Stores name of selected sample file
- void onSampleSelectionChanged (const QItemSelection& theSelected, const QItemSelection& theDeselected);
-
- //! Updates enabling state of Open file button, it is enabled if the file by the entered path exists
- //! \param theText a file name text in line edit
- void onNameChanged (const QString& theText);
-
- //! Open file dialog to select a file name. Fills file name line, enable import button
- void onSelectClicked();
-
- //! Accepts open file dialog
- void onApplySelectClicked();
-
-private:
-
- //! Creates view of file names in samples directory
- //! \param theFileNames a container of names
- //! \return table view
- QTableView* createTableView (const QStringList& theFileNames);
-
- //! Creates view model and fills it by the file names
- //! \param theFileNames a container of names
- //! \return model
- QAbstractItemModel* createModel (const QStringList& theFileNames);
-
- //! Generates container of file names in samples directory
- //! \return container of names
- QStringList readSampleNames();
-
-private:
-
- QString myDataDir; //!< samples directory
- QString myFileName; //!< result file name
- QTableView* mySamplesView; //! <view of sample file names
- QLineEdit* mySelectedName; //!< alternative control to open file
- QToolButton* myFolderApplyOpen; //! button to open file
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <TInspectorEXE_OpenFileViewModel.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QApplication>
-#include <QFileInfo>
-#include <QIcon>
-#include <QPainter>
-#include <Standard_WarningsRestore.hxx>
-
-const int ICON_SIZE = 40;
-
-// =======================================================================
-// function : paint
-// purpose :
-// =======================================================================
-void TInspectorEXE_OpenFileItemDelegate::paint (QPainter* thePainter, const QStyleOptionViewItem& theOption,
- const QModelIndex& theIndex) const
-{
- // highlight cell
- if (theOption.state & QStyle::State_MouseOver)
- thePainter->fillRect (theOption.rect, myColor);
-
- // action icon for all indices before the last one
- QIcon anIcon (":/icons/folder_import.png");
- QSize anIconSize (ICON_SIZE, ICON_SIZE);
- int aDX = (theOption.rect.width() - anIconSize.width()) / 2;
- int aMargin = qApp->style()->pixelMetric (QStyle::PM_HeaderMargin);
- thePainter->drawPixmap (QRect (theOption.rect.left() + aDX,
- theOption.rect.top() + aMargin,
- anIconSize.width(),
- anIconSize.height()),
- anIcon.pixmap(anIconSize.width(), anIconSize.height()));
- // default paint
- QItemDelegate::paint (thePainter, theOption, theIndex);
-}
-
-// =======================================================================
-// function : Init
-// purpose :
-// =======================================================================
-void TInspectorEXE_OpenFileViewModel::Init (const QStringList& theValues)
-{
- myValues = theValues;
-}
-
-// =======================================================================
-// function : data
-// purpose :
-// =======================================================================
-QVariant TInspectorEXE_OpenFileViewModel::data (const QModelIndex& theIndex, int theRole) const
-{
- switch (theRole)
- {
- case Qt::DisplayRole: return QFileInfo (myValues[theIndex.column()]).fileName();
- case Qt::ToolTipRole: return myValues[theIndex.column()];
- case Qt::TextAlignmentRole: return QVariant (Qt::AlignBottom | Qt::AlignHCenter);
- default: break;
- }
- return QVariant();
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef TInspectorEXE_OpenFileViewModel_H
-#define TInspectorEXE_OpenFileViewModel_H
-
-#include <Standard_Macro.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QAbstractTableModel>
-#include <QStringList>
-#include <QItemDelegate>
-#include <Standard_WarningsRestore.hxx>
-
-class QObject;
-class QPainter;
-
-//! \class TInspectorEXE_OpenFileItemDelegate
-//! Draws large(40x40) icons in cell. The icon background in colored in highlight when mouse is over button
-class TInspectorEXE_OpenFileItemDelegate : public QItemDelegate
-{
-
-public:
-
- //! Constructor
- TInspectorEXE_OpenFileItemDelegate (QObject* theParent, const QColor& theHighlightColor)
- : QItemDelegate (theParent), myColor(theHighlightColor) {}
-
- //! Destructor
- virtual ~TInspectorEXE_OpenFileItemDelegate() {}
-
- //! Draw an icon in the cell
- //! \param thePainter a painter
- //! \param theOption a paint options
- //! \param theIndex a view index
- virtual void paint (QPainter* thePainter, const QStyleOptionViewItem& theOption,
- const QModelIndex& theIndex) const Standard_OVERRIDE;
-
-private:
-
- QColor myColor; //!< highlight color
-};
-
-//! \class TInspectorEXE_OpenFileViewModel
-//! Table model that visualizes container of string values (file names)
-//! Table orientation is horizontal, it has 1 row, number of columns equals to number of values
-class TInspectorEXE_OpenFileViewModel : public QAbstractTableModel
-{
-
-public:
-
- //! Constructor
- TInspectorEXE_OpenFileViewModel (QObject* theParent = 0) : QAbstractTableModel (theParent) {}
-
- //! Destructor
- virtual ~TInspectorEXE_OpenFileViewModel() {}
-
- //! Store values
- //! \param theValues a container of values to fill model
- void Init (const QStringList& theValues);
-
- //! Returns content of the model index for the given role, it is obtained from internal container of values
- //! It returns value only for DisplayRole.
- //! \param theIndex a model index
- //! \param theRole a view role
- //! \return value intepreted depending on the given role
- virtual QVariant data (const QModelIndex& theIndex, int theRole = Qt::DisplayRole) const Standard_OVERRIDE;
-
- //! Returns number of rows
- //! \param theParent an index of the parent item
- //! \return an integer value
- virtual int rowCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE
- { (void)theParent; return 1; }
-
- //! Returns number of columns
- //! \param theParent an index of the parent item
- //! \return an integer value
- virtual int columnCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE
- { (void)theParent; return myValues.size(); }
-
-private:
-
- QStringList myValues; //!< file names
-};
-
-#endif
+++ /dev/null
-cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
-project (TStandalone)
-
-set (CASROOT "" CACHE PATH "Third party OpenCascade dir" )
-set (3RDPARTY_DIR "" CACHE PATH "Third party dir" )
-set (INSTALL_DIR "" CACHE PATH "Where to install" )
-
-if (NOT "$ENV{CASROOT}" STREQUAL "" AND EXISTS "$ENV{CASROOT}")
- set (CASROOT "$ENV{CASROOT}")
- #set (3RDPARTY_OCCT_DIR "${CASROOT}")
- #message("Environment CASROOT: ${CASROOT}")
- #message("Environment 3RDPARTY_OCCT_DIR: ${CASROOT}")
-endif()
-
-if (NOT "$ENV{THIRDPARTY_DIR}" STREQUAL "" AND EXISTS "$ENV{THIRDPARTY_DIR}")
- set (3RDPARTY_DIR "$ENV{THIRDPARTY_DIR}")
- message("Environment THIRDPARTY_DIR: ${3RDPARTY_DIR}")
-endif()
-
-if (NOT "$ENV{INSTALL_DIR}" STREQUAL "")
- set (INSTALL_DIR "$ENV{INSTALL_DIR}")
- message("Environment INSTALL_DIR: ${INSTALL_DIR}")
-endif()
-
-# Define the next variable to has defined 3rdParties DLL dir variables
-set (BUILD_SHARED_LIBS ON)
-
-set (CASROOT_SOURCE_FILES "${CMAKE_SOURCE_DIR}/../../.." CACHE PATH "OCCT sources dir to find tools packages" )
-if ("${CASROOT}" STREQUAL "")
- set (CASROOT "${CASROOT_SOURCE_FILES}/work/install" CACHE PATH "OCCT sources dir to find tools packages" )
-endif()
-
-macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)
- include (${CASROOT_SOURCE_FILES}/${BEING_INCLUDED_FILE}.cmake)
-endmacro()
-
-macro (OCCT_INCLUDE_CMAKE_FILE_STANDALONE BEING_INCLUDED_FILE)
- include (${CMAKE_SOURCE_DIR}/${BEING_INCLUDED_FILE}.cmake)
-endmacro()
-
-set (ADDITIONAL_DLL_DIR "" CACHE PATH "Additional paths that should be included into PATH" )
-if (NOT "$ENV{ADDITIONAL_DLL_DIR}" STREQUAL "")
- set (ADDITIONAL_DLL_DIR "$ENV{ADDITIONAL_DLL_DIR}")
- message("Environment ADDITIONAL_DLL_DIR: ${ADDITIONAL_DLL_DIR}")
-endif()
-
-set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE)
-
-OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/3rdparty_macro")
-OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
-
-OCCT_INCLUDE_CMAKE_FILE_STANDALONE("adm/cmake/occt")
-if (OCCT_LIBRARY_NOT_FOUND)
- message (FATAL_ERROR "Could NOT find OCCT Library in : ${3RDPARTY_OCCT_LIBRARY_DIR}" )
-endif()
-
-OCCT_MAKE_OS_WITH_BITNESS()
-OCCT_MAKE_COMPILER_SHORT_NAME()
-
-set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE )
-set (INSTALL_API_DIR "${INSTALL_DIR}/api" CACHE PATH "" FORCE)
-set (INSTALL_DIR_BIN "${OS_WITH_BIT}/${COMPILER}/bin" CACHE PATH "" FORCE)
-set (INSTALL_DIR_LIB "${OS_WITH_BIT}/${COMPILER}/lib" CACHE PATH "" FORCE)
-set (INSTALL_DIR_INCLUDE "inc" CACHE PATH "")
-
-OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freetype")
-OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/freeimage")
-OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gl2ps")
-OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb")
-OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/qt")
-OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
-
-#include (${CMAKE_SOURCE_DIR}/adm/cmake/3rdparty.cmake)
-
-set (3RDPARTY_DLL_PATH "${USED_3RDPARTY_OCCT_DIRS};\
-${USED_3RDPARTY_FREETYPE_DIR};\
-${USED_3RDPARTY_FREEIMAGE_DIRS};\
-${USED_3RDPARTY_GL2PS_DIRS};\
-${3RDPARTY_QT_DIR}/bin;\
-${3RDPARTY_TBB_DLL_DIR}")
-
-if (ADDITIONAL_DLL_DIR)
- set (3RDPARTY_DLL_PATH "${3RDPARTY_DLL_PATH};\
-${ADDITIONAL_DLL_DIR}")
-endif()
-
-set (3RDPARTY_DLL_DEB_PATH "${3RDPARTY_DLL_PATH}")
-
-
-set (BUILD_TOOLKITS
- TKTInspectorAPI
- TKView
- TKTreeModel
- TKDFBrowser
- TKVInspector
- TKShapeView
- TKTInspector
- TKToolsDraw
-)
-
-string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
-message (STATUS "\nInfo: \(${CURRENT_TIME}\) Start collecting all header files into ${CMAKE_BINARY_DIR}/inc ...")
-# collect all the headers to <binary dir>/inc folder
-COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_BINARY_DIR}" "${BUILD_TOOLKITS}" "${CASROOT_SOURCE_FILES}/tools" "${INSTALL_DIR_INCLUDE}/inspector")
-
-OCCT_INCLUDE_CMAKE_FILE_STANDALONE ("adm/cmake/standalone_macros")
-OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/qt_macro")
-
-set (BUILD_PROJECTS
- TInspectorAPI
- View
- TreeModel
- DFBrowserPane
- DFBrowserPaneXDE
- DFBrowser
- ShapeView
- VInspector
- TInspector
- TInspectorEXE
- ToolsDraw
-)
-# include patched toolkit projects or original ones
-foreach (PROJECT_ITEM ${BUILD_PROJECTS})
- OCCT_ADD_SUBDIRECTORY ("src/${PROJECT_ITEM}")
-endforeach()
+++ /dev/null
-#freeimage
-
-if(NOT "${CASROOT}" STREQUAL "")
- #message(FATAL_ERROR, "Empty OCCT dir")
- #return()
- #set("3RDPARTY_OCCT_DIR ${CASROOT}")
-endif()
-
-#set(3RDPARTY_OCC_DIR ${CASROOT})
-#message("3RDPARTY_OCC_DIR: ${3RDPARTY_OCC_DIR}")
-#set("3RDPARTY_OCC_DIR ${3RDPARTY_OCCT_DIR}")
-#message("3RDPARTY_OCC_DIR: ${3RDPARTY_OCC_DIR}")
-
-set(CSF_TKernel "TKernel")
-THIRDPARTY_PRODUCT("OCCT" "Standard.hxx" "CSF_TKernel" "")
-
-set(3RDPARTY_OCCT_DIR ${3RDPARTY_OCC_DIR} CACHE PATH "OCCT dir")
-
-OCCT_MAKE_OS_WITH_BITNESS()
-OCCT_MAKE_COMPILER_SHORT_NAME()
-
-SET(3RDPARTY_OCCT_INCLUDE_DIR "${3RDPARTY_OCC_INCLUDE_DIR}" CACHE PATH "OCCT include dir")
-SET(3RDPARTY_OCCT_LIBRARY_DIR "${3RDPARTY_OCC_LIBRARY_DIR}" CACHE PATH "OCCT library dir")
-SET(3RDPARTY_OCCT_DLL_DIR "${3RDPARTY_OCC_DLL_DIR}" CACHE PATH "OCCT dll dir")
-
-SET(CSF_StandardDefaults_DIR ${CASROOT}/src/StdResource CACHE PATH "OCCT Standard Resource")
-SET(CSF_XCAFDefaults_DIR ${CASROOT}/src/StdResource CACHE PATH "OCCT XCAF Defaults")
-SET(CSF_PluginDefaults_DIR ${CASROOT}/src/StdResource CACHE PATH "OCCT Plugin Defaults")
-
-message (STATUS "... OCCT dir: ${3RDPARTY_OCCT_DIR}")
-message (STATUS "... OCCT Include dirs: ${3RDPARTY_OCCT_INCLUDE_DIR}")
-message (STATUS "... OCCT Library dirs: ${3RDPARTY_OCCT_LIBRARY_DIRS}")
-message (STATUS "... OCCT Binary dirs: ${3RDPARTY_OCCT_DLL_DIRS}")
-
-SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${3RDPARTY_OCCT_LIBRARY_DIRS}")
-
-find_library(TKernel TKernel PATHS "${3RDPARTY_OCCT_LIBRARY_DIRS}"
- PATH_SUFFIXES lib
- NO_DEFAULT_PATH)
-
-if ("${TKernel}" STREQUAL "TKernel-NOTFOUND")
- set (OCCT_LIBRARY_NOT_FOUND ON)
-endif()
-
-find_library(TKMath TKMath)
-
-find_library(TKCAF TKCAF)
-find_library(TKCDF TKCDF)
-find_library(TKLCAF TKLCAF)
-find_library(TKVCAF TKVCAF)
-
-find_library(TKBRep TKBRep)
-find_library(TKService TKService)
-
-find_library(TKOpenGl TKOpenGl)
-find_library(TKV3d TKV3d)
-
-find_library(TKXCAF TKXCAF)
-find_library(TKXSBase TKXSBase)
-find_library(TKXDESTEP TKXDESTEP)
-find_library(TKXmlXCAF TKXmlXCAF)
-find_library(TKXml TKXml)
-
-find_library(TKBin TKBin)
-find_library(TKBinL TKBinL)
-find_library(TKBinXCAF TKBinXCAF)
-
-find_library(TKStd TKStd)
-find_library(TKXmlL TKXmlL)
-find_library(TKStdL TKStdL)
-# VInspector additionally:
-find_library(TKBO TKBO)
-# ShapeView additionally:
-find_library(TKGeomBase TKGeomBase)
-find_library(TKG3d TKG3d)
+++ /dev/null
-# script for each OCCT toolkit
-
-#Qt dependencies
-#message ("Project is ${PROJECT_NAME}")
-if (EXECUTABLE_PROJECT)
- set (PACKAGE_PREFIX_DIR "samples/tools")
- SET(SOURCE_DIR ${CMAKE_SOURCE_DIR}/../${PROJECT_NAME})
- include_directories("${SOURCE_DIR}")
- #message("Inc dir: ${CMAKE_SOURCE_DIR}/../${PROJECT_NAME}")
-else()
- set (PACKAGE_PREFIX_DIR "tools")
- SET(SOURCE_DIR ${CASROOT_SOURCE_FILES}/${PACKAGE_PREFIX_DIR}/${PROJECT_NAME})
-endif()
-
-FIND_SOURCES_AND_HEADERS_FILES(${SOURCE_DIR} SOURCE_FILES HEADER_FILES)
-
-#message ("Source dir is ${SOURCE_DIR}")
-#message ("Sources are ${SOURCE_FILES}")
-
-unset(RCC_FILES)
-if (USE_QT)
- FIND_QT_PACKAGE(PROJECT_LIBRARIES_DEBUG PROJECT_LIBRARIES_RELEASE PROJECT_INCLUDES)
-
- FIND_AND_WRAP_MOC_FILES("${SOURCE_FILES}")
- FIND_AND_WRAP_RESOURCE_FILE("${SOURCE_DIR}/${PROJECT_NAME}.qrc" RCC_FILES)
-
-endif()
-
-if (TOOLKIT_NAME)
- set(TARGET_NAME TK${PROJECT_NAME})
-else ()
- set(TARGET_NAME ${PROJECT_NAME})
-endif()
-
-if (EXECUTABLE_PROJECT)
- add_executable (${TARGET_NAME} ${SOURCE_FILES} ${HEADER_FILES})
-else()
- add_library(${TARGET_NAME} SHARED ${SOURCE_FILES} ${HEADER_FILES})
-endif()
-
-
-include_directories(
- ${PROJECT_INCLUDES}
- ${SOURCE_DIR}
- ${3RDPARTY_OCCT_INCLUDE_DIR}
- "${CMAKE_BINARY_DIR}/inc")
-
-add_definitions(-D__WIN32__)
-add_definitions(-DWNT)
-add_definitions(-D__${PROJECT_NAME}_DLL)
-
-# parce EXTERNLIB file
-FILE_TO_LIST ("src/${PROJECT_NAME}/EXTERNLIB" USED_EXTERNLIB_AND_TOOLKITS)
-foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
- string (REGEX MATCH "^ *#" COMMENT_FOUND ${USED_ITEM})
- if (NOT COMMENT_FOUND)
- set (LIB_ITEM ${USED_ITEM})
- set (LIB_PARSED_ITEM ${${USED_ITEM}})
-
- if (LIB_PARSED_ITEM)
- list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT ${${USED_ITEM}})
- #message("Append external lib: ${${USED_ITEM}}")
- else ()
- list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT ${USED_ITEM})
- #message("Append lib: ${USED_ITEM}")
- endif()
-
- endif()
-endforeach()
-
-
-target_link_libraries (${TARGET_NAME} ${USED_TOOLKITS_BY_CURRENT_PROJECT})
-
-if (USE_QT)
- target_link_libraries (${TARGET_NAME} debug ${PROJECT_LIBRARIES_DEBUG})
- target_link_libraries (${TARGET_NAME} optimized ${PROJECT_LIBRARIES_RELEASE})
-
- if (NOT "${RCC_FILES}" STREQUAL "")
- #message("RCC files: ${RCC_FILES}")
- target_sources(${TARGET_NAME} PRIVATE ${RCC_FILES})
- endif()
-endif()
-
-if (EXECUTABLE_PROJECT)
- INSTALL(TARGETS ${TARGET_NAME} DESTINATION "${INSTALL_DIR_BIN}")
-else()
- if (MSVC)
- install (DIRECTORY ${PROJECT_BINARY_DIR}/Debug/
- DESTINATION "${INSTALL_DIR_BIN}"
- FILES_MATCHING PATTERN *.pdb)
- if (INSTALL_API_DIR)
- install (DIRECTORY ${PROJECT_BINARY_DIR}/Debug/
- DESTINATION "${INSTALL_API_DIR}/bin"
- FILES_MATCHING PATTERN *.pdb)
- endif()
- endif()
- install (TARGETS ${TARGET_NAME}
- RUNTIME DESTINATION "${INSTALL_DIR_BIN}"
- ARCHIVE DESTINATION "${INSTALL_DIR_LIB}"
- LIBRARY DESTINATION "${INSTALL_DIR_LIB}")
-
- if (INSTALL_API_DIR)
- install (TARGETS ${TARGET_NAME}
- RUNTIME DESTINATION "${INSTALL_API_DIR}/bin")
-
- if (INSTALL_API)
- INSTALL(FILES ${HEADER_FILES} DESTINATION "${INSTALL_API_DIR}/${INSTALL_DIR_INCLUDE}")
-
- install (DIRECTORY ${PROJECT_BINARY_DIR}/Debug/
- DESTINATION "${INSTALL_API_DIR}/lib"
- FILES_MATCHING PATTERN *.lib)
- endif()
- endif()
-
-endif()
+++ /dev/null
-#freeimage
-
-macro (FIND_SOURCES_AND_HEADERS_FILES CURRENT_SOURCES_DIR SOURCE_FILES HEADER_FILES)
- if (EXISTS "${CURRENT_SOURCES_DIR}/FILES")
- file (STRINGS "${CURRENT_SOURCES_DIR}/FILES" HEADER_FILES_H REGEX ".+[.]h")
- file (STRINGS "${CURRENT_SOURCES_DIR}/FILES" SOURCE_FILES_C REGEX ".+[.]c")
-
- if (NOT "${HEADER_FILES_H}" STREQUAL "")
- foreach (ORIGIN_FILE ${HEADER_FILES_H})
- list (APPEND HEADER_FILES_ ${CURRENT_SOURCES_DIR}/${ORIGIN_FILE})
- endforeach()
-
- #message("${HEADER_FILES_}")
- set(${HEADER_FILES} ${HEADER_FILES_})
- endif()
-
- if(NOT "${SOURCE_FILES_C}" STREQUAL "")
- foreach (ORIGIN_FILE ${SOURCE_FILES_C})
- list (APPEND SOURCE_FILES_ ${CURRENT_SOURCES_DIR}/${ORIGIN_FILE})
- endforeach()
-
- #message("${SOURCE_FILES_}")
- set(${SOURCE_FILES} ${SOURCE_FILES_})
- endif()
-
- #set(${HEADER_FILES} ${HEADER_FILES_H})
- #set(${SOURCE_FILES} ${SOURCE_FILES_C})
-
- else()
- message(WARNING "file FILES is absent in $TARGET")
- endif()
-
-endmacro()
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <LocalDebuggerEnvironment>PATH=@3RDPARTY_DLL_DEB_PATH@;@CMAKE_INSTALL_PREFIX@/@INSTALL_DIR_BIN@;%PATH%
-DATA_DIR=@INSTALL_DIR@/data
-QTDIR=@3RDPARTY_QT_DIR@
-CSF_OCCTDataPath=@3RDPARTY_OCCT_DIR@/data
- </LocalDebuggerEnvironment>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <LocalDebuggerEnvironment>PATH=@3RDPARTY_DLL_DEB_PATH@;@CMAKE_INSTALL_PREFIX@/@INSTALL_DIR_BIN@;%PATH%
-DATA_DIR=@INSTALL_DIR@/data
-QTDIR=@3RDPARTY_QT_DIR@
-CSF_OCCTDataPath=@3RDPARTY_OCCT_DIR@/data
- </LocalDebuggerEnvironment>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <LocalDebuggerEnvironment>PATH=@3RDPARTY_DLL_DEB_PATH@;@CMAKE_INSTALL_PREFIX@/@INSTALL_DIR_BIN@;%PATH%
-DATA_DIR=@INSTALL_DIR@/data
-QTDIR=@3RDPARTY_QT_DIR@
-CSF_OCCTDataPath=@3RDPARTY_OCCT_DIR@/data
-CSF_ShadersDirectory=@CASROOT@/src/Shaders
- </LocalDebuggerEnvironment>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'" Label="Configuration">
- </PropertyGroup>
-</Project>
+++ /dev/null
-@OCCT_HEADER_FILE_CONTENT@
+++ /dev/null
-project(DFBrowser)
-
-ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
-
-set (USE_QT ON)
-set (TOOLKIT_NAME ON)
-
-OCCT_INCLUDE_CMAKE_FILE_STANDALONE ("adm/cmake/occt_toolkit_standalone")
-
-unset (USE_QT)
-unset (TOOLKIT_NAME)
+++ /dev/null
-DFBrowserPane
-DFBrowserPaneXDE
-TKBRep
-TKMath
-TKV3d
-TKBRep
-TKBin
-TKBinL
-TKBinXCAF
-TKCAF
-TKCDF
-TKernel
-TKLCAF
-TKMath
-TKOpenGl
-TKService
-TKStd
-TKStdL
-TKTInspector
-TKTInspectorAPI
-TKTreeModel
-TKV3d
-TKView
-TKXSBase
-TKXCAF
-TKXDESTEP
-TKXmlXCAF
-TKXml
-TKXmlL
+++ /dev/null
-project(DFBrowserPane)
-
-set (USE_QT ON)
-OCCT_INCLUDE_CMAKE_FILE_STANDALONE ("adm/cmake/occt_toolkit_standalone")
-unset (USE_QT)
+++ /dev/null
-TKG3d
-TKTInspectorAPI
-TKTreeModel
-TKernel
-TKMath
-TKService
-TKV3d
-TKVCAF
-TKCDF
-TKCAF
-TKLCAF
-TKBRep
+++ /dev/null
-project(DFBrowserPaneXDE)
-
-set (USE_QT ON)
-OCCT_INCLUDE_CMAKE_FILE_STANDALONE ("adm/cmake/occt_toolkit_standalone")
-unset (USE_QT)
+++ /dev/null
-DFBrowserPane
-TKernel
-TKTInspectorAPI
-TKXSBase
-TKXDESTEP
-TKBRep
-TKXCAF
+++ /dev/null
-project(ShapeView)
-
-set (USE_QT ON)
-set (TOOLKIT_NAME ON)
-
-OCCT_INCLUDE_CMAKE_FILE_STANDALONE ("adm/cmake/occt_toolkit_standalone")
-
-unset (USE_QT)
-unset (TOOLKIT_NAME)
-
-
+++ /dev/null
-TKBRep
-TKGeomBase
-TKG3d
-TKMath
-TKTInspectorAPI
-TKTreeModel
-TKService
-TKView
+++ /dev/null
-project(TInspector)
-
-set (USE_QT ON)
-set (TOOLKIT_NAME ON)
-set (INSTALL_API ON)
-
-OCCT_INCLUDE_CMAKE_FILE_STANDALONE ("adm/cmake/occt_toolkit_standalone")
-
-unset (USE_QT)
-unset (TOOLKIT_NAME)
-unset (INSTALL_API)
+++ /dev/null
-TKernel
-TKTInspectorAPI
+++ /dev/null
-project(TInspectorAPI)
-
-set (TOOLKIT_NAME ON)
-set (INSTALL_API ON)
-
-OCCT_INCLUDE_CMAKE_FILE_STANDALONE ("adm/cmake/occt_toolkit_standalone")
-
-unset (TOOLKIT_NAME)
-unset (INSTALL_API)
-
+++ /dev/null
-TKernel
-TKLCAF
+++ /dev/null
-project(TInspectorEXE)
-
-set (USE_QT ON)
-set (EXECUTABLE_PROJECT ON)
-
-OCCT_INCLUDE_CMAKE_FILE_STANDALONE ("adm/cmake/occt_toolkit_standalone")
-
-unset (USE_QT)
-unset (EXECUTABLE_PROJECT)
-
-configure_file(${CMAKE_SOURCE_DIR}/adm/templates/${PROJECT_NAME}.vcxproj.user.in
- ${${PROJECT_NAME}_BINARY_DIR}/${PROJECT_NAME}.vcxproj.user @ONLY)
-
+++ /dev/null
-TKBRep
-TKG3d
-TKService
-TKTInspector
-TKXCAF
-TKXDESTEP
-TKXSBase
-TKView
+++ /dev/null
-project(TreeModel)
-
-set (USE_QT ON)
-set (TOOLKIT_NAME ON)
-
-OCCT_INCLUDE_CMAKE_FILE_STANDALONE ("adm/cmake/occt_toolkit_standalone")
-
-unset (USE_QT)
-
-
+++ /dev/null
-project(VInspector)
-
-set (USE_QT ON)
-set (TOOLKIT_NAME ON)
-
-OCCT_INCLUDE_CMAKE_FILE_STANDALONE ("adm/cmake/occt_toolkit_standalone")
-
-unset (USE_QT)
-unset (TOOLKIT_NAME)
+++ /dev/null
-TKBO
-TKBRep
-TKG3d
-TKernel
-TKMath
-TKTInspectorAPI
-TKTreeModel
-TKService
-TKV3d
-TKView
+++ /dev/null
-project(View)
-
-set (USE_QT ON)
-set (TOOLKIT_NAME ON)
-
-OCCT_INCLUDE_CMAKE_FILE_STANDALONE ("adm/cmake/occt_toolkit_standalone")
-
-unset (USE_QT)
-
+++ /dev/null
-TKernel
-TKMath
-TKService
-TKOpenGl
-TKV3d
--- /dev/null
+cmake_minimum_required (VERSION 2.8.12 FATAL_ERROR)
+
+set (ADDITIONAL_INLCUDE_DIR_DESCR "Additional directory to be added in the projects include section")
+if (NOT DEFINED ADDITIONAL_INLCUDE_DIR)
+ set (ADDITIONAL_INLCUDE_DIR "" CACHE PATH ${ADDITIONAL_INLCUDE_DIR_DESCR})
+ get_filename_component (ADDITIONAL_INLCUDE_DIR "${ADDITIONAL_INLCUDE_DIR}" ABSOLUTE)
+else()
+ file (TO_CMAKE_PATH "${ADDITIONAL_INLCUDE_DIR}" ADDITIONAL_INLCUDE_DIR)
+ set (ADDITIONAL_INLCUDE_DIR "${ADDITIONAL_INLCUDE_DIR}" CACHE PATH "${ADDITIONAL_INLCUDE_DIR_DESCR}" FORCE)
+endif()
+
+set (ADDITIONAL_DLL_DIR_DESCR "Additional directories that should be included into PATH")
+if (NOT DEFINED ADDITIONAL_DLL_DIR)
+ set (ADDITIONAL_DLL_DIR "" CACHE PATH ${ADDITIONAL_DLL_DIR_DESCR})
+ get_filename_component (ADDITIONAL_DLL_DIR "${ADDITIONAL_DLL_DIR}" ABSOLUTE)
+else()
+ file (TO_CMAKE_PATH "${ADDITIONAL_DLL_DIR}" ADDITIONAL_DLL_DIR)
+ set (ADDITIONAL_DLL_DIR "${ADDITIONAL_DLL_DIR}" CACHE PATH "${ADDITIONAL_DLL_DIR_DESCR}" FORCE)
+endif()
+
+set (CURRENT_DIR "${CMAKE_SOURCE_DIR}")
+set (CMAKE_SOURCE_DIR "${CMAKE_SOURCE_DIR}/.." CACHE INTERNAL "" FORCE)
+set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/adm/cmake")
+
+set (CMAKE_SUPPRESS_REGENERATION TRUE)
+
+set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FORCE)
+
+# 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")
+ include (${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake)
+ else()
+ include (${CMAKE_SOURCE_DIR}/${BEING_INCLUDED_FILE}.cmake)
+ endif()
+endmacro()
+
+macro (OCCT_INCLUDE_3RDPARTY_PRODUCT USE_PRODUCT PRODUCT_CONFIG_FILE)
+ if (${USE_PRODUCT})
+ OCCT_INCLUDE_CMAKE_FILE ("${PRODUCT_CONFIG_FILE}")
+ endif (${USE_PRODUCT})
+endmacro()
+
+# include variable description
+OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/vardescr")
+
+# set type of OCCT libraries
+if (NOT BUILD_LIBRARY_TYPE)
+ set (BUILD_LIBRARY_TYPE "Shared" CACHE STRING "${BUILD_LIBRARY_TYPE_DESCR}" FORCE)
+ SET_PROPERTY(CACHE BUILD_LIBRARY_TYPE PROPERTY STRINGS Shared Static)
+endif()
+
+if ("${BUILD_LIBRARY_TYPE}" STREQUAL "Shared")
+ set (BUILD_SHARED_LIBS ON)
+
+ if (NOT DEFINED BUILD_SHARED_LIBRARY_NAME_POSTFIX)
+ set (BUILD_SHARED_LIBRARY_NAME_POSTFIX "" CACHE STRING "${BUILD_SHARED_LIBRARY_NAME_POSTFIX_DESCR}" FORCE)
+ endif()
+else()
+ unset (BUILD_SHARED_LIBS)
+ unset (BUILD_SHARED_LIBRARY_NAME_POSTFIX)
+endif()
+
+# the name of the project
+project (Inspector)
+
+if (WIN32)
+ add_definitions(-DUNICODE)
+ add_definitions(-D_UNICODE)
+endif()
+
+# include occt macros
+OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
+
+# Solution folder property
+set_property (GLOBAL PROPERTY USE_FOLDERS ON)
+
+# a single-configuration generator like the Makefile generator defines CMAKE_BUILD_TYPE variable
+# check this variable and set if it's required
+if (DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE) # single-configuration generator.
+ set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
+endif()
+
+if (BUILD_WITH_DEBUG)
+ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:DEBUG>:OCCT_DEBUG>)
+endif()
+
+# install dir of the project
+if (NOT DEFINED INSTALL_DIR)
+ # set default install directory for Windows
+ if (WIN32 AND NOT DEFINED CMAKE_INSTALL_PREFIX)
+ set (CMAKE_INSTALL_PREFIX "C:/opencascade-${OCC_VERSION_STRING_EXT}/inspector")
+ endif()
+ set (INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "${INSTALL_DIR_DESCR}")
+else()
+ file (TO_CMAKE_PATH "${INSTALL_DIR}" INSTALL_DIR)
+ set (INSTALL_DIR "${INSTALL_DIR}" CACHE PATH "${INSTALL_DIR_DESCR}" FORCE)
+endif()
+
+# choose a variant of the layout of the install paths
+if (NOT INSTALL_DIR_LAYOUT)
+ if (WIN32)
+ set (INSTALL_DIR_LAYOUT "Windows" CACHE STRING "${INSTALL_DIR_LAYOUT_DESCR}" FORCE)
+ else()
+ set (INSTALL_DIR_LAYOUT "Unix" CACHE STRING "${INSTALL_DIR_LAYOUT_DESCR}" FORCE)
+ endif()
+ SET_PROPERTY(CACHE INSTALL_DIR_LAYOUT PROPERTY STRINGS Windows Unix)
+endif()
+
+# check INSTALL_DIR_LAYOUT changes and update INSTALL_DIR_* paths if necessary
+if (NOT DEFINED INSTALL_DIR_LAYOUT_PREV)
+ set (INSTALL_DIR_LAYOUT_PREV "${INSTALL_DIR_LAYOUT}" CACHE INTERNAL "" FORCE)
+elseif (NOT "${INSTALL_DIR_LAYOUT_PREV}" STREQUAL "${INSTALL_DIR_LAYOUT}")
+ set (INSTALL_DIR_LAYOUT_PREV "${INSTALL_DIR_LAYOUT}" CACHE INTERNAL "" FORCE)
+ # The structure of install folder should be reset due to changed layout
+ OCCT_CHECK_AND_UNSET_INSTALL_DIR_SUBDIRS ()
+
+ # Unset INSTALL_DIR_WITH_VERSION on windows
+ if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Windows")
+ OCCT_CHECK_AND_UNSET (INSTALL_DIR_WITH_VERSION)
+ else()
+ if (NOT DEFINED INSTALL_DIR_WITH_VERSION)
+ set (INSTALL_DIR_WITH_VERSION OFF CACHE BOOL "${INSTALL_DIR_WITH_VERSION_DESCR}")
+ endif()
+ endif()
+endif()
+
+# check CMAKE_INSTALL_PREFIX changes and update INSTALL_DIR if necessary
+if (NOT DEFINED CMAKE_INSTALL_PREFIX_PREV)
+ set (CMAKE_INSTALL_PREFIX_PREV "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "" FORCE)
+elseif (NOT "${CMAKE_INSTALL_PREFIX_PREV}" STREQUAL "${CMAKE_INSTALL_PREFIX}")
+ # CMAKE_INSTALL_PREFIX has been changed at previous step
+ set (CMAKE_INSTALL_PREFIX_PREV "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "" FORCE)
+
+ # INSTALL_DIR is required to be updated
+ set (INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "${INSTALL_DIR_DESCR}" FORCE)
+endif()
+
+# check INSTALL_DIR changes and update CMAKE_INSTALL_PREFIX if necessary
+if (NOT DEFINED INSTALL_DIR_PREV)
+ set (INSTALL_DIR_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
+elseif (NOT "${INSTALL_DIR_PREV}" STREQUAL "${INSTALL_DIR}")
+ # INSTALL_DIR has been changed at previous step
+ set (INSTALL_DIR_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
+
+ # sync CMAKE_INSTALL_PREFIX with INSTALL_DIR
+ set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
+
+ # set CMAKE_INSTALL_PREFIX_PREV to avoid the reset of structure of the install folder
+ set (CMAKE_INSTALL_PREFIX_PREV "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
+endif()
+
+if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
+ if (NOT DEFINED INSTALL_DIR_WITH_VERSION_PREV)
+ set (INSTALL_DIR_WITH_VERSION_PREV "${INSTALL_DIR_WITH_VERSION}" CACHE INTERNAL "" FORCE)
+ elseif (NOT "${INSTALL_DIR_WITH_VERSION_PREV}" STREQUAL "${INSTALL_DIR_WITH_VERSION}")
+ # INSTALL_DIR_WITH_VERSION has been changed at previous step
+ set (INSTALL_DIR_WITH_VERSION_PREV "${INSTALL_DIR_WITH_VERSION}" CACHE INTERNAL "" FORCE)
+
+ OCCT_CHECK_AND_UNSET_INSTALL_DIR_SUBDIRS ()
+ endif()
+endif()
+
+# hide CMAKE_INSTALL_PREFIX from a user
+set (CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "" FORCE)
+
+set (BIN_LETTER "")
+if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
+ set (BIN_LETTER "d")
+elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
+ set (BIN_LETTER "i")
+endif()
+
+# Get all used variables: OS_WITH_BIT, COMPILER
+OCCT_MAKE_OS_WITH_BITNESS()
+OCCT_MAKE_COMPILER_SHORT_NAME()
+
+# do not define INSTALL_DIR_BIN for win.
+# Leave library structure for win: <prefix>/win64/vc10/bin(d)
+if (NOT DEFINED INSTALL_DIR_BIN)
+ if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
+ set (INSTALL_DIR_BIN "bin" CACHE PATH "${INSTALL_DIR_BIN_DESCR}")
+ else()
+ set (INSTALL_DIR_BIN "${OS_WITH_BIT}/${COMPILER}/bin" CACHE PATH "${INSTALL_DIR_BIN_DESCR}")
+ endif()
+endif()
+
+# define folder contaning all shell/batch scripts
+if (NOT DEFINED INSTALL_DIR_SCRIPT)
+ if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
+ set (INSTALL_DIR_SCRIPT "${INSTALL_DIR_BIN}" CACHE PATH "${INSTALL_DIR_SCRIPT_DESCR}")
+ else()
+ set (INSTALL_DIR_SCRIPT "." CACHE PATH "${INSTALL_DIR_SCRIPT_DESCR}")
+ endif()
+endif()
+
+# place the libraries to <prefix>/lib folder for unix and leave old structure for windows
+if (NOT DEFINED INSTALL_DIR_LIB)
+ if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
+ set (INSTALL_DIR_LIB "lib" CACHE PATH "${INSTALL_DIR_LIB_DESCR}")
+ else()
+ set (INSTALL_DIR_LIB "${OS_WITH_BIT}/${COMPILER}/lib" CACHE PATH "${INSTALL_DIR_LIB_DESCR}")
+ endif()
+endif()
+
+# OCCT headers: <prefix>/inc for windows,
+# <prefix>/include/opencascade-7.0.0 for unix
+if (NOT DEFINED INSTALL_DIR_INCLUDE)
+ if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
+ set (INSTALL_DIR_INCLUDE "include/opencascade" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}")
+ if (INSTALL_DIR_WITH_VERSION)
+ set (INSTALL_DIR_INCLUDE "include/opencascade-${OCC_VERSION_STRING_EXT}" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}" FORCE)
+ endif()
+ else()
+ set (INSTALL_DIR_INCLUDE "inc" CACHE PATH "${INSTALL_DIR_INCLUDE_DESCR}")
+ endif()
+endif()
+
+# OCCT resources: <prefix>/src for windows,
+# <prefix>/share/opencascade-7.0.0/resources for unix
+if (NOT DEFINED INSTALL_DIR_RESOURCE)
+ if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
+ set (INSTALL_DIR_RESOURCE "share/opencascade/resources" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}")
+ if (INSTALL_DIR_WITH_VERSION)
+ set (INSTALL_DIR_RESOURCE "share/opencascade-${OCC_VERSION_STRING_EXT}/resources" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}" FORCE)
+ endif()
+ else()
+ set (INSTALL_DIR_RESOURCE "src" CACHE PATH "${INSTALL_DIR_RESOURCE_DESCR}")
+ endif()
+endif()
+
+# OCCT data
+if (NOT DEFINED INSTALL_DIR_DATA)
+ if ("${INSTALL_DIR_LAYOUT}" STREQUAL "Unix")
+ set (INSTALL_DIR_DATA "share/opencascade/data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}")
+ if (INSTALL_DIR_WITH_VERSION)
+ set (INSTALL_DIR_DATA "share/opencascade-${OCC_VERSION_STRING_EXT}/data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}" FORCE)
+ endif()
+ else()
+ set (INSTALL_DIR_DATA "data" CACHE PATH "${INSTALL_DIR_DATA_DESCR}")
+ endif()
+endif()
+
+# include the patched or original list of definitions and flags
+OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_defs_flags")
+
+OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/3rdparty_macro")
+
+if (NOT DEFINED 3RDPARTY_DIR)
+ set (3RDPARTY_DIR "" CACHE PATH ${3RDPARTY_DIR_DESCR})
+ get_filename_component (3RDPARTY_DIR "${3RDPARTY_DIR}" ABSOLUTE)
+else()
+ file (TO_CMAKE_PATH "${3RDPARTY_DIR}" 3RDPARTY_DIR)
+ set (3RDPARTY_DIR "${3RDPARTY_DIR}" CACHE PATH "${3RDPARTY_DIR_DESCR}" FORCE)
+endif()
+
+find_package(OpenCASCADE QUIET PATHS "${OpenCASCADE_DIR}" "${OpenCASCADE_INSTALL_PREFIX}" NO_DEFAULT_PATH)
+# include OCCT headers
+include_directories ("${OpenCASCADE_INCLUDE_DIR}")
+
+if (NOT OpenCASCADE_FOUND)
+ message (FATAL_ERROR "coult not find OpenCASCADE, please set OpenCASCADE_DIR variable" )
+else()
+ set (OpenCASCADE_DIR "${OpenCASCADE_INSTALL_PREFIX}" CACHE PATH "OpenCASCADE directory" FORCE)
+ message (STATUS "Using OpenCASCADE from \"${OpenCASCADE_DIR}\"" )
+endif()
+
+set (USE_TCL "${OpenCASCADE_WITH_TCL}")
+set (USE_FREETYPE "${OpenCASCADE_WITH_FREETYPE}")
+set (USE_FREEIMAGE "${OpenCASCADE_WITH_FREEIMAGE}")
+set (USE_GL2PS "${OpenCASCADE_WITH_GL2PS}")
+set (USE_TBB "${OpenCASCADE_WITH_TBB}")
+set (USE_VTK "${OpenCASCADE_WITH_VTK}")
+set (USE_FFMPEG "${OpenCASCADE_WITH_FFMPEG}")
+set (USE_GLES2 "${OpenCASCADE_WITH_GLES2}")
+set (USE_GLX "${OpenCASCADE_WITH_GLX}")
+
+
+# define CSF variable
+OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_csf")
+
+# custom definitions (CMakeConfig of OCCT)
+OCCT_INCLUDE_3RDPARTY_PRODUCT (USE_TCL "adm/cmake/tcl")
+OCCT_INCLUDE_3RDPARTY_PRODUCT (USE_FREETYPE "adm/cmake/freetype")
+OCCT_INCLUDE_3RDPARTY_PRODUCT (USE_FREEIMAGE "adm/cmake/freeimage")
+OCCT_INCLUDE_3RDPARTY_PRODUCT (USE_GL2PS "adm/cmake/gl2ps")
+OCCT_INCLUDE_3RDPARTY_PRODUCT (USE_TBB "adm/cmake/tbb")
+OCCT_INCLUDE_3RDPARTY_PRODUCT (USE_VTK "adm/cmake/vtk")
+OCCT_INCLUDE_3RDPARTY_PRODUCT (USE_FFMPEG "adm/cmake/ffmpeg")
+OCCT_INCLUDE_3RDPARTY_PRODUCT (USE_GLES2 "adm/cmake/egl")
+OCCT_INCLUDE_3RDPARTY_PRODUCT (USE_GLES2 "adm/cmake/gles2")
+OCCT_INCLUDE_3RDPARTY_PRODUCT (USE_GLX "adm/cmake/glx")
+
+
+OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/qt")
+OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
+
+#include (${CMAKE_SOURCE_DIR}/adm/cmake/3rdparty.cmake)
+
+set (3RDPARTY_DLL_DEB_PATH "${3RDPARTY_DLL_PATH}")
+
+# build directories
+if (SINGLE_GENERATOR)
+ set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}")
+ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BIN_LETTER}")
+ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BIN_LETTER}")
+ if (WIN32)
+ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BIN_LETTER}")
+ endif()
+endif()
+
+set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
+set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
+set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
+
+set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi")
+set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini")
+set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libi")
+
+set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
+set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
+set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/libd")
+
+if (WIN32)
+ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin")
+ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bini")
+ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bind")
+endif()
+
+# OCCT tools
+# include the patched or original list of tools
+# list <TOOLNAME>_TOOLKITS is created foreach tool and contains its toolkits
+# 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()
+
+ # collect all the headers to <binary dir>/inc/inspector folder
+ string(TIMESTAMP CURRENT_TIME "%H:%M:%S")
+ message (STATUS "\nInfo: \(${CURRENT_TIME}\) Start collecting all OCCT tool header files into ${CMAKE_BINARY_DIR}/inc/inspector ...")
+ COLLECT_AND_INSTALL_OCCT_HEADER_FILES ("${CMAKE_BINARY_DIR}" "${BUILD_TOOL_TOOLKITS}" "${CMAKE_SOURCE_DIR}/tools" "${INSTALL_DIR_INCLUDE}/inspector")
+#endif()
+
+# include <cmake binary folder>/inc
+include_directories (${CMAKE_BINARY_DIR}/${INSTALL_DIR_INCLUDE})
+
+include_directories (${ADDITIONAL_INLCUDE_DIR})
+
+if (3RDPARTY_INCLUDE_DIRS)
+ list (REMOVE_DUPLICATES 3RDPARTY_INCLUDE_DIRS)
+ string (REGEX REPLACE ";" "\n\t" 3RDPARTY_INCLUDE_DIRS_WITH_ENDS "${3RDPARTY_INCLUDE_DIRS}")
+ message (STATUS "Info: The directories of 3rdparty headers: \n\t${3RDPARTY_INCLUDE_DIRS_WITH_ENDS}")
+ include_directories (${3RDPARTY_INCLUDE_DIRS})
+endif()
+
+if (3RDPARTY_LIBRARY_DIRS)
+ list (REMOVE_DUPLICATES 3RDPARTY_LIBRARY_DIRS)
+ string (REGEX REPLACE ";" "\n\t" 3RDPARTY_LIBRARY_DIRS_WITH_ENDS "${3RDPARTY_LIBRARY_DIRS}")
+ message (STATUS "Info: The directories of 3rdparty libraries: \n\t${3RDPARTY_LIBRARY_DIRS_WITH_ENDS}")
+ link_directories (${3RDPARTY_LIBRARY_DIRS})
+endif()
+
+# include patched toolkit projects or original ones
+if (BUILD_TOOL_TOOLKITS)
+ foreach (BUILD_TOOL_TOOLKIT ${BUILD_TOOL_TOOLKITS})
+ OCCT_ADD_SUBDIRECTORY ("tools/${BUILD_TOOL_TOOLKIT}")
+ endforeach()
+endif()
+
+message (STATUS "Info: \(${CURRENT_TIME}\) OCCT toolkits processed")
+
+OCCT_MODULES_AND_TOOLKITS (SAMPLES "SAMPLES_TOOLKITS" OCCT_SAMPLES)
+
+# patch TInspectorEXE
+if (MSVC AND 3RDPARTY_DLL_DIRS)
+ list (REMOVE_DUPLICATES 3RDPARTY_DLL_DIRS)
+ set (3RDPARTY_DLL_DIRS_FOR_PATH "")
+
+ foreach (3RDPARTY_DLL_DIR ${3RDPARTY_DLL_DIRS})
+ set (3RDPARTY_DLL_DIRS_FOR_PATH "${3RDPARTY_DLL_DIRS_FOR_PATH};${3RDPARTY_DLL_DIR}")
+ endforeach()
+
+ if (ADDITIONAL_DLL_DIR)
+ foreach (3RDPARTY_DLL_DIR ${ADDITIONAL_DLL_DIR})
+ set (3RDPARTY_DLL_DIRS_FOR_PATH "${3RDPARTY_DLL_DIRS_FOR_PATH};${3RDPARTY_DLL_DIR}")
+ endforeach()
+ endif (ADDITIONAL_DLL_DIR)
+
+ OCCT_MAKE_COMPILER_BITNESS()
+ set (X_COMPILER_BITNESS "x64")
+ if ("${COMPILER_BITNESS}" STREQUAL "32")
+ set (X_COMPILER_BITNESS "Win32")
+ endif()
+
+ # patch TInspectorEXE
+ OCCT_CONFIGURE ("adm/templates/TInspectorEXE.vcxproj.user.in" "${CMAKE_BINARY_DIR}/TInspectorEXE/TInspectorEXE.vcxproj.user")
+endif()
+
+message (STATUS "Info: \(${CURRENT_TIME}\) Inspector configuration files prepared")
TInspectorAPI_PluginParameters.cxx
TInspectorAPI_PluginParameters.hxx
TInspectorAPI_PreferencesDataMap.hxx
+TInspectorAPI_Version.hxx
// commercial license or contractual agreement.
#include <inspector/TInspectorAPI_PluginParameters.hxx>
+#include <inspector/TInspectorAPI_Version.hxx>
#if OCC_VERSION_HEX <= 0x060901
IMPLEMENT_STANDARD_HANDLE (TInspectorAPI_PluginParameters, Standard_Transient)
return;
anOrientationStr.Split (anOrientationStr.Length() - 1);
+#if TINSPECTORAPI_VERSION_HEX > 0x070200
TopAbs_Orientation anOrientation;
if (!TopAbs::ShapeOrientationFromString (anOrientationStr.ToCString(), anOrientation))
return;
theShape.Location (aLocation);
theShape.Orientation (anOrientation);
+#else
+ (void)theValue; (void)theShape;
+#endif
}
--- /dev/null
+// Copyright (c) 2018 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+/*======================================================================
+//
+// Purpose: Defines macros identifying current version of Inspector
+// The version is equal to current OCCT version and used to support compile compatibility
+// to previous OCCT versions interface.
+// To compile Inspector with earlier version of OCCT, change version variable here to needed OCCT version.
+//
+// TINSPECTORAPI_VERSION_MAJOR : (integer) number identifying major version
+// TINSPECTORAPI_VERSION_MINOR : (integer) number identifying minor version
+// TINSPECTORAPI_VERSION_MAINTENANCE : (integer) number identifying maintenance version
+// TINSPECTORAPI_VERSION_HEX : (hex) complete number as hex, two positions per each of major, minor, and patch number
+//
+//======================================================================*/
+
+#ifndef _TInspectorAPI_Version_HeaderFile
+#define _TInspectorAPI_Version_HeaderFile
+
+#include <Standard_Version.hxx>
+
+// Primary definitions
+#define TINSPECTORAPI_VERSION_MAJOR OCC_VERSION_MAJOR
+#define TINSPECTORAPI_VERSION_MINOR OCC_VERSION_MINOR
+#define TINSPECTORAPI_VERSION_MAINTENANCE 0//OCC_VERSION_MAINTENANCE
+
+// Derived: complete version as hex (0x0'major'0'minor'0'maintenance')
+#define TINSPECTORAPI_VERSION_HEX (TINSPECTORAPI_VERSION_MAJOR << 16 | TINSPECTORAPI_VERSION_MINOR << 8 | TINSPECTORAPI_VERSION_MAINTENANCE)
+
+#endif /* _TInspectorAPI_Version_HeaderFile */
--- /dev/null
+project(TInspectorEXE)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
+set (EXECUTABLE_PROJECT ON)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+unset (EXECUTABLE_PROJECT)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
--- /dev/null
+TKTInspector
\ No newline at end of file
--- /dev/null
+TInspectorEXE.cxx
+TInspectorEXE_OpenFileDialog.cxx
+TInspectorEXE_OpenFileDialog.hxx
+TInspectorEXE_OpenFileViewModel.cxx
+TInspectorEXE_OpenFileViewModel.hxx
+TInspectorEXE.qrc
+EXTERNLIB
--- /dev/null
+TInspectorEXE
--- /dev/null
+// Created on: 2017-06-16
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+
+#include <inspector/TInspectorEXE_OpenFileDialog.hxx>
+
+#include <inspector/TInspector_Communicator.hxx>
+
+#include <OSD_Environment.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QAction>
+#include <QApplication>
+#include <QDir>
+#include <QMainWindow>
+#include <QToolBar>
+#include <Standard_WarningsRestore.hxx>
+
+#include <set>
+
+// =======================================================================
+// function : fileNameInDataDir
+// purpose :
+// =======================================================================
+TCollection_AsciiString fileNameInDataDir(const TCollection_AsciiString& theEnvironmentDir,
+ const TCollection_AsciiString& theName)
+{
+ OSD_Environment anEnvironment(theEnvironmentDir);
+
+ TCollection_AsciiString aFileName = anEnvironment.Value();
+ aFileName += TCollection_AsciiString("/") + theName;
+
+ return aFileName;
+}
+
+// =======================================================================
+// function : setPluginSampleDirectory
+// purpose :
+// =======================================================================
+void setPluginSampleDirectory (const TCollection_AsciiString& theName, TInspector_Communicator* theCommunicator,
+ TInspectorEXE_OpenButton* theButtonControl)
+{
+ if (theName.IsEqual ("TKDFBrowser"))
+ {
+ theCommunicator->OpenFile (theName, fileNameInDataDir ("CSF_OCCTDataPath", "step/screw.step"));
+ theButtonControl->SetPluginDir (theName, fileNameInDataDir ("CSF_OCCTDataPath", "step"));
+ }
+ else if (theName.IsEqual ("TKShapeView"))
+ {
+ theCommunicator->OpenFile (theName, fileNameInDataDir ("CSF_OCCTDataPath", "occ/hammer.brep"));
+ theButtonControl->SetPluginDir (theName, fileNameInDataDir ("CSF_OCCTDataPath", "occ"));
+ }
+ else if (theName.IsEqual ("TKVInspector"))
+ {
+ theCommunicator->OpenFile (theName, fileNameInDataDir ("CSF_OCCTDataPath", "occ/face1.brep"));
+ theCommunicator->OpenFile (theName, fileNameInDataDir ("CSF_OCCTDataPath", "occ/face2.brep"));
+ theButtonControl->SetPluginDir (theName, fileNameInDataDir ("CSF_OCCTDataPath", "occ"));
+ }
+}
+
+// =======================================================================
+// function : main
+// purpose :
+// =======================================================================
+int main (int argc, char** argv)
+{
+#if QT_VERSION > 0x050000
+ TCollection_AsciiString aPlugindsDirName = OSD_Environment ("QTDIR").Value();
+ if (!aPlugindsDirName.IsEmpty())
+ QApplication::addLibraryPath (QString (aPlugindsDirName.ToCString()) + "/plugins");
+#endif
+ QApplication anApp (argc, argv);
+
+ std::set<TCollection_AsciiString> aPlugins;
+ for (int anArgId = 1; anArgId < argc; anArgId++ )
+ {
+ if (!strcmp (argv[anArgId], "dfbrowser"))
+ aPlugins.insert ("TKDFBrowser");
+
+ if (!strcmp (argv[anArgId], "shapeview"))
+ aPlugins.insert ("TKShapeView");
+
+ if (!strcmp (argv[anArgId], "vinspector"))
+ aPlugins.insert ("TKVInspector");
+ }
+ NCollection_List<Handle(Standard_Transient)> aParameters;
+
+ // Create tool communicator
+ TInspector_Communicator* aCommunicator = TInspectorEXE_OpenFileDialog::Communicator();
+ if (!aCommunicator)
+ {
+ std::cout << "Communicator can not be created" << std::endl;
+ return 0;
+ }
+
+ TInspectorEXE_OpenButton* aButtonControl = new TInspectorEXE_OpenButton (0);
+ TCollection_AsciiString anActivatedPluginName;
+ if (aPlugins.empty())
+ {
+ aPlugins.insert("TKDFBrowser");
+ aPlugins.insert("TKShapeView");
+ aPlugins.insert("TKVInspector");
+
+ anActivatedPluginName = "TKDFBrowser";
+ }
+ else
+ anActivatedPluginName = *aPlugins.rbegin();
+
+ for (std::set<TCollection_AsciiString>::const_iterator aPluginIt = aPlugins.begin(); aPluginIt != aPlugins.end(); aPluginIt++)
+ {
+ TCollection_AsciiString aName = *aPluginIt;
+ aCommunicator->RegisterPlugin (aName);
+ aCommunicator->Init (aName, aParameters);
+ setPluginSampleDirectory (aName, aCommunicator, aButtonControl);
+ }
+ aCommunicator->Activate (anActivatedPluginName);
+
+ aCommunicator->SetVisible (true);
+ aCommunicator->SetOpenButton (aButtonControl->StartButton());
+
+ return anApp.exec();
+}
--- /dev/null
+<!DOCTYPE RCC><RCC version="1.0">
+ <qresource prefix="/">
+ <file alias="folder_open.png">icons/folder_open.png</file>
+ <file alias="folder_import.png">icons/folder_import.png</file>
+ </qresource>
+</RCC>
--- /dev/null
+// Created on: 2017-06-16
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <inspector/TInspectorEXE_OpenFileDialog.hxx>
+#include <inspector/TInspectorEXE_OpenFileViewModel.hxx>
+
+#include <inspector/TInspector_Communicator.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QApplication>
+#include <QCompleter>
+#include <QDir>
+#include <QFileDialog>
+#include <QFileSystemModel>
+#include <QItemSelectionModel>
+#include <QGroupBox>
+#include <QHBoxLayout>
+#include <QHeaderView>
+#include <QLabel>
+#include <QLineEdit>
+#include <QScrollBar>
+#include <QTableView>
+#include <QToolButton>
+#include <QPushButton>
+#include <QVBoxLayout>
+#include <QWidget>
+#include <Standard_WarningsRestore.hxx>
+
+const int FONT_POINT_SIZE = 18;
+const int ICON_SIZE = 40;
+
+const int OPEN_DIALOG_WIDTH = 550;
+const int OPEN_DIALOG_HEIGHT = 200;
+
+const int MARGIN_DIALOG = 4;
+const int SPACING_DIALOG = 2;
+
+TInspector_Communicator* MyCommunicator;
+
+// =======================================================================
+// function : StartButton
+// purpose :
+// =======================================================================
+QPushButton* TInspectorEXE_OpenButton::StartButton()
+{
+ if (!myStartButton)
+ {
+ myStartButton = new QPushButton();
+ myStartButton->setIcon (QIcon (":folder_open.png"));
+ connect (myStartButton, SIGNAL (clicked()), this, SLOT (onStartButtonClicked()));
+ }
+ return myStartButton;
+}
+
+// =======================================================================
+// function : onStartButtonClicked
+// purpose :
+// =======================================================================
+void TInspectorEXE_OpenButton::onStartButtonClicked()
+{
+ QPushButton* aButton = (QPushButton*)sender();
+ TCollection_AsciiString aPluginName (aButton->objectName().toStdString().c_str());
+ if (aPluginName.IsEmpty())
+ return;
+
+ QString aDataDirName = QDir::currentPath();
+ if (myDefaultDirs.IsBound (aPluginName))
+ aDataDirName = myDefaultDirs.Find (aPluginName).ToCString();
+
+ QString aFileName = TInspectorEXE_OpenFileDialog::OpenFile (0, aDataDirName);
+ aFileName = QDir().toNativeSeparators (aFileName);
+ if (!aFileName.isEmpty()) {
+ QApplication::setOverrideCursor (Qt::WaitCursor);
+ TInspectorEXE_OpenFileDialog::Communicator()->OpenFile (aPluginName, TCollection_AsciiString (aFileName.toUtf8().data()));
+ QApplication::restoreOverrideCursor();
+ }
+}
+
+// =======================================================================
+// function : changeMargins
+// purpose :
+// =======================================================================
+void changeMargins (QBoxLayout* theLayout)
+{
+ theLayout->setContentsMargins (MARGIN_DIALOG, MARGIN_DIALOG, MARGIN_DIALOG, MARGIN_DIALOG);
+ theLayout->setSpacing (SPACING_DIALOG);
+}
+
+// =======================================================================
+// function : Constructor
+// purpose :
+// =======================================================================
+TInspectorEXE_OpenFileDialog::TInspectorEXE_OpenFileDialog (QWidget* theParent, const QString& theDataDirName)
+: QDialog(theParent), myDataDir (theDataDirName)
+{
+ setWindowTitle (theDataDirName);
+
+ QVBoxLayout* aDialogLay = new QVBoxLayout (this);
+ changeMargins (aDialogLay);
+
+ // Title label
+ QLabel* aTitleLabel = new QLabel (this);
+ aTitleLabel->setText (tr ("Open File"));
+ aDialogLay->addWidget (aTitleLabel);
+
+ // Samples View
+ QGroupBox* aSamplesBox = new QGroupBox (this);
+ aSamplesBox->setTitle (tr ("Samples"));
+ aDialogLay->addWidget (aSamplesBox);
+ QVBoxLayout* aSampleLay = new QVBoxLayout (aSamplesBox);
+ changeMargins (aSampleLay);
+ mySamplesView = createTableView (readSampleNames());
+ aSampleLay->addWidget (mySamplesView);
+
+ // Select file
+ QGroupBox* aSelectFileBox = new QGroupBox (this);
+ aSelectFileBox->setTitle (tr ("Select file"));
+ aDialogLay->addWidget (aSelectFileBox);
+ QGridLayout* aSelectFileLay = new QGridLayout (aSelectFileBox);
+ aSelectFileLay->setContentsMargins (MARGIN_DIALOG, MARGIN_DIALOG, MARGIN_DIALOG, MARGIN_DIALOG);
+
+ mySelectedName = new QLineEdit (aSelectFileBox);
+ QCompleter* aCompleter = new QCompleter();
+ QFileSystemModel* aFileSystemModel = new QFileSystemModel;
+ aFileSystemModel->setRootPath (QDir::rootPath());
+ aCompleter->setModel (aFileSystemModel);
+ mySelectedName->setCompleter (aCompleter);
+ aSelectFileLay->addWidget (mySelectedName, 1, 0);
+
+ QToolButton* aSelectFileBtn = new QToolButton (aSelectFileBox);
+ aSelectFileBtn->setIcon (QIcon (":folder_open.png"));
+ aSelectFileLay->addWidget (aSelectFileBtn, 1, 1);
+
+ myFolderApplyOpen = new QToolButton (aSelectFileBox);
+ myFolderApplyOpen->setIcon (QIcon (":folder_import.png"));
+ myFolderApplyOpen->setIconSize (QSize (ICON_SIZE, ICON_SIZE));
+ myFolderApplyOpen->setEnabled (false);
+ aSelectFileLay->addWidget (myFolderApplyOpen, 0, 2, 2, 1);
+
+ connect (mySelectedName, SIGNAL (textChanged (const QString&)),
+ this, SLOT (onNameChanged (const QString&)));
+ connect (aSelectFileBtn, SIGNAL (clicked()), this, SLOT (onSelectClicked()));
+ connect (myFolderApplyOpen, SIGNAL (clicked()), this, SLOT (onApplySelectClicked()));
+
+ resize (OPEN_DIALOG_WIDTH, OPEN_DIALOG_HEIGHT);
+}
+
+// =======================================================================
+// function : OpenFile
+// purpose :
+// =======================================================================
+QString TInspectorEXE_OpenFileDialog::OpenFile (QWidget* theParent, const QString& theDataDirName)
+{
+ QString aFileName;
+ TInspectorEXE_OpenFileDialog* aDialog = new TInspectorEXE_OpenFileDialog(theParent, theDataDirName);
+ if (aDialog->exec() == QDialog::Accepted)
+ aFileName = aDialog->GetFileName();
+
+ return aFileName;
+}
+
+// =======================================================================
+// function : Communicator
+// purpose :
+// =======================================================================
+TInspector_Communicator* TInspectorEXE_OpenFileDialog::Communicator()
+{
+ if (!MyCommunicator)
+ MyCommunicator = new TInspector_Communicator();
+ return MyCommunicator;
+}
+
+// =======================================================================
+// function : onSampleSelectionChanged
+// purpose :
+// =======================================================================
+void TInspectorEXE_OpenFileDialog::onSampleSelectionChanged (const QItemSelection& theSelected,
+ const QItemSelection&)
+{
+ QItemSelectionModel* aSelectionModel = (QItemSelectionModel*)sender();
+ if (!aSelectionModel)
+ return;
+ if (theSelected.isEmpty())
+ return;
+
+ QModelIndex anIndex = theSelected.first().indexes().first();
+ if (!anIndex.isValid())
+ return;
+
+ myFileName = aSelectionModel->model()->data (anIndex, Qt::ToolTipRole).toString();
+ accept();
+}
+
+// =======================================================================
+// function : onNameChanged
+// purpose :
+// =======================================================================
+void TInspectorEXE_OpenFileDialog::onNameChanged (const QString& theText)
+{
+ QFileInfo aFileInfo (theText);
+ bool anExists = aFileInfo.exists() && aFileInfo.isFile();
+ myFolderApplyOpen->setEnabled (anExists);
+}
+
+// =======================================================================
+// function : onSelectClicked
+// purpose :
+// =======================================================================
+void TInspectorEXE_OpenFileDialog::onSelectClicked()
+{
+ QString anEnteredPath;
+ QString aDirName = mySelectedName->text();
+ if (!aDirName.isEmpty())
+ {
+ QDir aDir (aDirName);
+ if (aDir.exists())
+ anEnteredPath = aDirName;
+ }
+
+ QString aFileName = QFileDialog::getOpenFileName (0, "Open document", anEnteredPath);
+
+ if (aFileName.isEmpty())
+ return; // do nothing, left the previous value
+
+
+ myFileName = aFileName;
+ accept();
+}
+
+// =======================================================================
+// function : onApplySelectClicked
+// purpose :
+// =======================================================================
+void TInspectorEXE_OpenFileDialog::onApplySelectClicked()
+{
+ myFileName = mySelectedName->text();
+ accept();
+}
+
+// =======================================================================
+// function : createTableView
+// purpose :
+// =======================================================================
+QTableView* TInspectorEXE_OpenFileDialog::createTableView (const QStringList& theFileNames)
+{
+ QTableView* aTableView = new QTableView (this);
+ aTableView->setFrameStyle (QFrame::NoFrame);
+ QPalette aPalette = aTableView->viewport()->palette();
+ QColor aWindowColor = aPalette.color (QPalette::Window);
+ aPalette.setBrush (QPalette::Base, aWindowColor);
+ aTableView->viewport()->setPalette (aPalette);
+
+ aTableView->horizontalHeader()->setVisible (false);
+ aTableView->verticalHeader()->setVisible (false);
+ aTableView->setGridStyle (Qt::NoPen);
+ aTableView->setModel (createModel (theFileNames));
+ aTableView->setItemDelegateForRow (0, new TInspectorEXE_OpenFileItemDelegate (aTableView,
+ aPalette.color (QPalette::Highlight)));
+ aTableView->viewport()->setAttribute (Qt::WA_Hover);
+ int aCellHeight = ICON_SIZE + aTableView->verticalHeader()->defaultSectionSize();
+ aTableView->setRowHeight (0, aCellHeight);
+ int aScrollHeight = aTableView->horizontalScrollBar()->sizeHint().height();
+ aTableView->setMinimumHeight (aCellHeight + aScrollHeight);
+ QItemSelectionModel* aSelectionModel = new QItemSelectionModel (aTableView->model());
+ connect (aSelectionModel, SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)),
+ this, SLOT (onSampleSelectionChanged (const QItemSelection&, const QItemSelection&)));
+ aTableView->setSelectionModel (aSelectionModel);
+
+ return aTableView;
+}
+
+// =======================================================================
+// function : createModel
+// purpose :
+// =======================================================================
+QAbstractItemModel* TInspectorEXE_OpenFileDialog::createModel (const QStringList& theFileNames)
+{
+ TInspectorEXE_OpenFileViewModel* aModel = new TInspectorEXE_OpenFileViewModel (this);
+ aModel->Init (theFileNames);
+ return aModel;
+}
+
+// =======================================================================
+// function : readSampleNames
+// purpose :
+// =======================================================================
+QStringList TInspectorEXE_OpenFileDialog::readSampleNames()
+{
+ QStringList aNames;
+
+ QDir aDir(myDataDir);
+ aDir.setSorting(QDir::Name);
+
+ QFileInfoList aDirEntries = aDir.entryInfoList();
+ for (int aDirId = 0; aDirId < aDirEntries.size(); ++aDirId)
+ {
+ QFileInfo aFileInfo = aDirEntries.at(aDirId);
+ if (aFileInfo.isFile())
+ aNames.append (aFileInfo.absoluteFilePath());
+ }
+ return aNames;
+}
--- /dev/null
+// Created on: 2017-06-16
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef TInspectorEXE_OpenFileDialog_H
+#define TInspectorEXE_OpenFileDialog_H
+
+#include <NCollection_DataMap.hxx>
+#include <TCollection_AsciiString.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QDialog>
+#include <QItemSelection>
+#include <QStringList>
+#include <Standard_WarningsRestore.hxx>
+
+#include <map>
+
+class TInspector_Communicator;
+
+class QAbstractItemModel;
+class QLineEdit;
+class QPushButton;
+class QTableView;
+class QToolButton;
+class QWidget;
+
+//! \class TInspectorEXE_OpenButton
+//! Class that contains push button and the button processing. It obtains a file name from the default or current
+//! directory and gives the name into TInspector communicator
+//! Object name of the button is the name of the plugin to get the default directory, or the current directory is used.
+class TInspectorEXE_OpenButton : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ //! Constructor
+ TInspectorEXE_OpenButton (QObject* theParent) : QObject (theParent), myStartButton (0) {}
+
+ //! Destructor
+ virtual ~TInspectorEXE_OpenButton() {}
+
+ //! Returns the start button, if this is the first call, it creates the button and connect it to the slot
+ QPushButton* StartButton();
+
+ //! Sets the default directory of plugin.
+ void SetPluginDir (const TCollection_AsciiString& thePluginName, const TCollection_AsciiString& theDefaultDir)
+ { myDefaultDirs.Bind (thePluginName, theDefaultDir); }
+
+private slots:
+
+ //! Processes the button click, open default/current directory to select open file, calls OpenFile of communicator
+ void onStartButtonClicked();
+
+private:
+
+ QPushButton* myStartButton; //!< processed button
+ NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString> myDefaultDirs; //!< plugins default directories
+};
+
+//! \class TInspectorEXE_OpenFileDialog
+//! Control that contains table view of samples and line to select a file name from other directory.
+//! Click on element of samples table view calls this sample opening else after entering(or opening) file name
+//! the import becomes active. Click on the button will open selected file if it is possible
+class TInspectorEXE_OpenFileDialog : public QDialog
+{
+ Q_OBJECT
+private:
+
+ //! Constructor
+ TInspectorEXE_OpenFileDialog (QWidget* theParent, const QString& theDataDirName);
+
+public:
+
+ //! Destructor
+ virtual ~TInspectorEXE_OpenFileDialog() Standard_OVERRIDE {}
+
+ //! Opens this file dialog using for samples view the given directory and try to open new file
+ //! \param theParent a parent for the new dialog
+ //! \param theDataDirName path to default samples directory
+ //! \returns a file name from the open file dialog
+ static QString OpenFile (QWidget* theParent, const QString& theDataDirName);
+
+ //! Returns selection name from the dialog
+ QString GetFileName() const { return myFileName; }
+
+ //! Returns communicator, if this is the first call, create a communicator instance
+ static TInspector_Communicator* Communicator();
+
+private slots:
+
+ //! Stores name of selected sample file
+ void onSampleSelectionChanged (const QItemSelection& theSelected, const QItemSelection& theDeselected);
+
+ //! Updates enabling state of Open file button, it is enabled if the file by the entered path exists
+ //! \param theText a file name text in line edit
+ void onNameChanged (const QString& theText);
+
+ //! Open file dialog to select a file name. Fills file name line, enable import button
+ void onSelectClicked();
+
+ //! Accepts open file dialog
+ void onApplySelectClicked();
+
+private:
+
+ //! Creates view of file names in samples directory
+ //! \param theFileNames a container of names
+ //! \return table view
+ QTableView* createTableView (const QStringList& theFileNames);
+
+ //! Creates view model and fills it by the file names
+ //! \param theFileNames a container of names
+ //! \return model
+ QAbstractItemModel* createModel (const QStringList& theFileNames);
+
+ //! Generates container of file names in samples directory
+ //! \return container of names
+ QStringList readSampleNames();
+
+private:
+
+ QString myDataDir; //!< samples directory
+ QString myFileName; //!< result file name
+ QTableView* mySamplesView; //! <view of sample file names
+ QLineEdit* mySelectedName; //!< alternative control to open file
+ QToolButton* myFolderApplyOpen; //! button to open file
+};
+
+#endif
--- /dev/null
+// Created on: 2017-06-16
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <inspector/TInspectorEXE_OpenFileViewModel.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QApplication>
+#include <QFileInfo>
+#include <QIcon>
+#include <QPainter>
+#include <Standard_WarningsRestore.hxx>
+
+const int ICON_SIZE = 40;
+
+// =======================================================================
+// function : paint
+// purpose :
+// =======================================================================
+void TInspectorEXE_OpenFileItemDelegate::paint (QPainter* thePainter, const QStyleOptionViewItem& theOption,
+ const QModelIndex& theIndex) const
+{
+ // highlight cell
+ if (theOption.state & QStyle::State_MouseOver)
+ thePainter->fillRect (theOption.rect, myColor);
+
+ // action icon for all indices before the last one
+ QIcon anIcon (":/icons/folder_import.png");
+ QSize anIconSize (ICON_SIZE, ICON_SIZE);
+ int aDX = (theOption.rect.width() - anIconSize.width()) / 2;
+ int aMargin = qApp->style()->pixelMetric (QStyle::PM_HeaderMargin);
+ thePainter->drawPixmap (QRect (theOption.rect.left() + aDX,
+ theOption.rect.top() + aMargin,
+ anIconSize.width(),
+ anIconSize.height()),
+ anIcon.pixmap(anIconSize.width(), anIconSize.height()));
+ // default paint
+ QItemDelegate::paint (thePainter, theOption, theIndex);
+}
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+void TInspectorEXE_OpenFileViewModel::Init (const QStringList& theValues)
+{
+ myValues = theValues;
+}
+
+// =======================================================================
+// function : data
+// purpose :
+// =======================================================================
+QVariant TInspectorEXE_OpenFileViewModel::data (const QModelIndex& theIndex, int theRole) const
+{
+ switch (theRole)
+ {
+ case Qt::DisplayRole: return QFileInfo (myValues[theIndex.column()]).fileName();
+ case Qt::ToolTipRole: return myValues[theIndex.column()];
+ case Qt::TextAlignmentRole: return QVariant (Qt::AlignBottom | Qt::AlignHCenter);
+ default: break;
+ }
+ return QVariant();
+}
--- /dev/null
+// Created on: 2017-06-16
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2017 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef TInspectorEXE_OpenFileViewModel_H
+#define TInspectorEXE_OpenFileViewModel_H
+
+#include <Standard_Macro.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QAbstractTableModel>
+#include <QStringList>
+#include <QItemDelegate>
+#include <Standard_WarningsRestore.hxx>
+
+class QObject;
+class QPainter;
+
+//! \class TInspectorEXE_OpenFileItemDelegate
+//! Draws large(40x40) icons in cell. The icon background in colored in highlight when mouse is over button
+class TInspectorEXE_OpenFileItemDelegate : public QItemDelegate
+{
+
+public:
+
+ //! Constructor
+ TInspectorEXE_OpenFileItemDelegate (QObject* theParent, const QColor& theHighlightColor)
+ : QItemDelegate (theParent), myColor(theHighlightColor) {}
+
+ //! Destructor
+ virtual ~TInspectorEXE_OpenFileItemDelegate() {}
+
+ //! Draw an icon in the cell
+ //! \param thePainter a painter
+ //! \param theOption a paint options
+ //! \param theIndex a view index
+ virtual void paint (QPainter* thePainter, const QStyleOptionViewItem& theOption,
+ const QModelIndex& theIndex) const Standard_OVERRIDE;
+
+private:
+
+ QColor myColor; //!< highlight color
+};
+
+//! \class TInspectorEXE_OpenFileViewModel
+//! Table model that visualizes container of string values (file names)
+//! Table orientation is horizontal, it has 1 row, number of columns equals to number of values
+class TInspectorEXE_OpenFileViewModel : public QAbstractTableModel
+{
+
+public:
+
+ //! Constructor
+ TInspectorEXE_OpenFileViewModel (QObject* theParent = 0) : QAbstractTableModel (theParent) {}
+
+ //! Destructor
+ virtual ~TInspectorEXE_OpenFileViewModel() {}
+
+ //! Store values
+ //! \param theValues a container of values to fill model
+ void Init (const QStringList& theValues);
+
+ //! Returns content of the model index for the given role, it is obtained from internal container of values
+ //! It returns value only for DisplayRole.
+ //! \param theIndex a model index
+ //! \param theRole a view role
+ //! \return value intepreted depending on the given role
+ virtual QVariant data (const QModelIndex& theIndex, int theRole = Qt::DisplayRole) const Standard_OVERRIDE;
+
+ //! Returns number of rows
+ //! \param theParent an index of the parent item
+ //! \return an integer value
+ virtual int rowCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE
+ { (void)theParent; return 1; }
+
+ //! Returns number of columns
+ //! \param theParent an index of the parent item
+ //! \return an integer value
+ virtual int columnCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE
+ { (void)theParent; return myValues.size(); }
+
+private:
+
+ QStringList myValues; //!< file names
+};
+
+#endif
+TKDraw
TKDCAF
TKTInspector
TKTInspectorAPI
+TKG3d
TKernel
TKMath
TKService
#include <inspector/View_Window.hxx>
+#include <inspector/TInspectorAPI_Version.hxx>
+
#include <inspector/View_Displayer.hxx>
#include <inspector/View_ToolBar.hxx>
#include <inspector/View_Tools.hxx>
// =======================================================================
void View_Window::onViewContextMenuRequested (const QPoint& thePosition)
{
+#if TINSPECTORAPI_VERSION_HEX > 0x070200
QMenu* aMenu = new QMenu (this);
QMenu* anOrientationSubMenu = aMenu->addMenu ("Set View Orientation");
QPoint aPoint = myView->mapToGlobal (thePosition);
aMenu->exec (aPoint);
+#else
+ (void)thePosition;
+#endif
}
// =======================================================================
// =======================================================================
void View_Window::onSetOrientation()
{
+#if TINSPECTORAPI_VERSION_HEX > 0x070200
QAction* anAction = (QAction*)(sender());
TCollection_AsciiString anOrientationStr (anAction->text().toStdString().c_str());
aView->SetProj (anOrientationType);
aView->FitAll();
aView->Redraw();
+#endif
}
// =======================================================================
--- /dev/null
+if ("${TARGET_FOLDER}" STREQUAL "")
+ set (CMAKE_SOURCE_DIR "${CMAKE_SOURCE_DIR}/..")
+endif("${TARGET_FOLDER}" STREQUAL "")
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)