mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
Coding - Apply .clang-format formatting #286
Update empty method guards to new style with regex (see PR). Used clang-format 18.1.8. New actions to validate code formatting is added. Update .clang-format with disabling of include sorting. It is temporary changes, then include will be sorted. Apply formatting for /src and /tools folder. The files with .hxx,.cxx,.lxx,.h,.pxx,.hpp,*.cpp extensions.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
// 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.
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <inspector/DFBrowserPane_TNamingNamedShape.hxx>
|
||||
|
||||
@@ -56,78 +56,88 @@ static const int COLUMN_EXPORT_WIDTH = 20;
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
DFBrowserPane_TNamingNamedShape::DFBrowserPane_TNamingNamedShape()
|
||||
: DFBrowserPane_AttributePane(), myEvolutionTableView (0), myHelperExport (0)
|
||||
: DFBrowserPane_AttributePane(),
|
||||
myEvolutionTableView(0),
|
||||
myHelperExport(0)
|
||||
{
|
||||
getPaneModel()->SetColumnCount (5);
|
||||
getPaneModel()->SetColumnCount(5);
|
||||
|
||||
myEvolutionPaneModel = new DFBrowserPane_AttributePaneModel();
|
||||
myEvolutionPaneModel->SetColumnCount (10);
|
||||
myEvolutionPaneModel->SetColumnCount(10);
|
||||
QList<int> anItalicColumns;
|
||||
anItalicColumns << 1 << 5;
|
||||
myEvolutionPaneModel->SetItalicColumns (anItalicColumns);
|
||||
QItemSelectionModel* aSelectionModel = new QItemSelectionModel (myEvolutionPaneModel);
|
||||
mySelectionModels.push_back (aSelectionModel);
|
||||
myEvolutionPaneModel->SetItalicColumns(anItalicColumns);
|
||||
QItemSelectionModel* aSelectionModel = new QItemSelectionModel(myEvolutionPaneModel);
|
||||
mySelectionModels.push_back(aSelectionModel);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : CreateWidget
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QWidget* DFBrowserPane_TNamingNamedShape::CreateWidget (QWidget* theParent)
|
||||
QWidget* DFBrowserPane_TNamingNamedShape::CreateWidget(QWidget* theParent)
|
||||
{
|
||||
QWidget* aMainWidget = new QWidget (theParent);
|
||||
aMainWidget->setVisible (false);
|
||||
QWidget* aMainWidget = new QWidget(theParent);
|
||||
aMainWidget->setVisible(false);
|
||||
|
||||
myTableView = new DFBrowserPane_TableView (aMainWidget);
|
||||
myTableView->GetTableView()->verticalHeader()->setVisible (false);
|
||||
myTableView->SetModel (myPaneModel);
|
||||
myTableView = new DFBrowserPane_TableView(aMainWidget);
|
||||
myTableView->GetTableView()->verticalHeader()->setVisible(false);
|
||||
myTableView->SetModel(myPaneModel);
|
||||
QTableView* aTableView = myTableView->GetTableView();
|
||||
aTableView->setSelectionBehavior (QAbstractItemView::SelectItems);
|
||||
aTableView->setSelectionBehavior(QAbstractItemView::SelectItems);
|
||||
std::list<QItemSelectionModel*>::const_iterator aSelectionModelsIt = mySelectionModels.begin();
|
||||
aTableView->setSelectionModel (*aSelectionModelsIt);
|
||||
aTableView->setSelectionModel(*aSelectionModelsIt);
|
||||
aSelectionModelsIt++;
|
||||
|
||||
aTableView->horizontalHeader()->setStretchLastSection (false);
|
||||
aTableView->setColumnWidth (3, COLUMN_EXPORT_WIDTH);
|
||||
aTableView->setColumnWidth (4, COLUMN_EXPORT_WIDTH);
|
||||
DFBrowserPane_ItemDelegateButton* anItemDelegate = new DFBrowserPane_ItemDelegateButton (aTableView,
|
||||
":/icons/export_shape.png");
|
||||
aTableView->horizontalHeader()->setStretchLastSection(false);
|
||||
aTableView->setColumnWidth(3, COLUMN_EXPORT_WIDTH);
|
||||
aTableView->setColumnWidth(4, COLUMN_EXPORT_WIDTH);
|
||||
DFBrowserPane_ItemDelegateButton* anItemDelegate =
|
||||
new DFBrowserPane_ItemDelegateButton(aTableView, ":/icons/export_shape.png");
|
||||
QList<int> aRows;
|
||||
aRows << 0 << 1;
|
||||
anItemDelegate->SetFreeRows (aRows);
|
||||
QObject::connect (anItemDelegate, SIGNAL (buttonPressed (const QModelIndex&)),
|
||||
&myHelperExport, SLOT (OnButtonPressed (const QModelIndex&)));
|
||||
aTableView->setItemDelegateForColumn (3, anItemDelegate);
|
||||
anItemDelegate->SetFreeRows(aRows);
|
||||
QObject::connect(anItemDelegate,
|
||||
SIGNAL(buttonPressed(const QModelIndex&)),
|
||||
&myHelperExport,
|
||||
SLOT(OnButtonPressed(const QModelIndex&)));
|
||||
aTableView->setItemDelegateForColumn(3, anItemDelegate);
|
||||
|
||||
DFBrowserPane_ItemDelegateButton* anItemDelegate2 = new DFBrowserPane_ItemDelegateButton (aTableView,
|
||||
":/icons/folder_export.png");
|
||||
anItemDelegate2->SetFreeRows (aRows);
|
||||
aTableView->setItemDelegateForColumn (4, anItemDelegate2);
|
||||
DFBrowserPane_ItemDelegateButton* anItemDelegate2 =
|
||||
new DFBrowserPane_ItemDelegateButton(aTableView, ":/icons/folder_export.png");
|
||||
anItemDelegate2->SetFreeRows(aRows);
|
||||
aTableView->setItemDelegateForColumn(4, anItemDelegate2);
|
||||
|
||||
myEvolutionTableView = new DFBrowserPane_TableView (aMainWidget);
|
||||
myEvolutionTableView->SetModel (myEvolutionPaneModel);
|
||||
myEvolutionTableView = new DFBrowserPane_TableView(aMainWidget);
|
||||
myEvolutionTableView->SetModel(myEvolutionPaneModel);
|
||||
aTableView = myEvolutionTableView->GetTableView();
|
||||
|
||||
aTableView->setSelectionModel (*aSelectionModelsIt);
|
||||
aTableView->setSelectionModel(*aSelectionModelsIt);
|
||||
|
||||
aTableView->horizontalHeader()->setStretchLastSection (false);
|
||||
aTableView->setColumnWidth (4, COLUMN_EXPORT_WIDTH);
|
||||
aTableView->setColumnWidth (9, COLUMN_EXPORT_WIDTH);
|
||||
aTableView->horizontalHeader()->setStretchLastSection(false);
|
||||
aTableView->setColumnWidth(4, COLUMN_EXPORT_WIDTH);
|
||||
aTableView->setColumnWidth(9, COLUMN_EXPORT_WIDTH);
|
||||
|
||||
anItemDelegate = new DFBrowserPane_ItemDelegateButton (myEvolutionTableView->GetTableView(), ":/icons/export_shape.png");
|
||||
QObject::connect (anItemDelegate, SIGNAL (buttonPressed (const QModelIndex&)),
|
||||
&myHelperExport, SLOT (OnButtonPressed (const QModelIndex&)));
|
||||
myEvolutionTableView->GetTableView()->setItemDelegateForColumn (4, anItemDelegate);
|
||||
anItemDelegate = new DFBrowserPane_ItemDelegateButton(myEvolutionTableView->GetTableView(),
|
||||
":/icons/export_shape.png");
|
||||
QObject::connect(anItemDelegate,
|
||||
SIGNAL(buttonPressed(const QModelIndex&)),
|
||||
&myHelperExport,
|
||||
SLOT(OnButtonPressed(const QModelIndex&)));
|
||||
myEvolutionTableView->GetTableView()->setItemDelegateForColumn(4, anItemDelegate);
|
||||
|
||||
anItemDelegate = new DFBrowserPane_ItemDelegateButton (myEvolutionTableView->GetTableView(), ":/icons/export_shape.png");
|
||||
QObject::connect (anItemDelegate, SIGNAL (buttonPressed (const QModelIndex&)),
|
||||
&myHelperExport, SLOT (OnButtonPressed (const QModelIndex&)));
|
||||
myEvolutionTableView->GetTableView()->setItemDelegateForColumn (9, anItemDelegate);
|
||||
anItemDelegate = new DFBrowserPane_ItemDelegateButton(myEvolutionTableView->GetTableView(),
|
||||
":/icons/export_shape.png");
|
||||
QObject::connect(anItemDelegate,
|
||||
SIGNAL(buttonPressed(const QModelIndex&)),
|
||||
&myHelperExport,
|
||||
SLOT(OnButtonPressed(const QModelIndex&)));
|
||||
myEvolutionTableView->GetTableView()->setItemDelegateForColumn(9, anItemDelegate);
|
||||
|
||||
QGridLayout* aLay = new QGridLayout (aMainWidget);
|
||||
aLay->setContentsMargins (0, 0, 0, 0);
|
||||
aLay->addWidget (myTableView, 0, 0);
|
||||
aLay->addWidget (myEvolutionTableView, 1, 0);
|
||||
QGridLayout* aLay = new QGridLayout(aMainWidget);
|
||||
aLay->setContentsMargins(0, 0, 0, 0);
|
||||
aLay->addWidget(myTableView, 0, 0);
|
||||
aLay->addWidget(myEvolutionTableView, 1, 0);
|
||||
|
||||
return aMainWidget;
|
||||
}
|
||||
@@ -136,81 +146,88 @@ QWidget* DFBrowserPane_TNamingNamedShape::CreateWidget (QWidget* theParent)
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void DFBrowserPane_TNamingNamedShape::Init (const Handle(TDF_Attribute)& theAttribute)
|
||||
void DFBrowserPane_TNamingNamedShape::Init(const Handle(TDF_Attribute)& theAttribute)
|
||||
{
|
||||
Handle(TNaming_NamedShape) aShapeAttr = Handle(TNaming_NamedShape)::DownCast (theAttribute);
|
||||
Handle(TNaming_NamedShape) aShapeAttr = Handle(TNaming_NamedShape)::DownCast(theAttribute);
|
||||
myHelperExport.Clear();
|
||||
|
||||
QList<QVariant> aValues;
|
||||
aValues << "Version" << QString::number (aShapeAttr->Version()) << "" << "" << "";
|
||||
aValues << "Evolution" << DFBrowserPane_Tools::ToName (DB_NS_TYPE, aShapeAttr->Evolution()).ToCString() << "" << "" << "";
|
||||
aValues << "Version" << QString::number(aShapeAttr->Version()) << "" << "" << "";
|
||||
aValues << "Evolution"
|
||||
<< DFBrowserPane_Tools::ToName(DB_NS_TYPE, aShapeAttr->Evolution()).ToCString() << ""
|
||||
<< "" << "";
|
||||
|
||||
NCollection_List<TopoDS_Shape> aShapes;
|
||||
QList<int> aFreeRows;
|
||||
QList<int> aFreeRows;
|
||||
aFreeRows << 0 << 1;
|
||||
|
||||
TopoDS_Shape aShape = aShapeAttr->Get();
|
||||
TCollection_AsciiString aShapeInfo = !aShape.IsNull() ? Standard_Dump::GetPointerInfo (aShape.TShape()) : "";
|
||||
aValues << "Shape" << aShapeInfo.ToCString() << DFBrowserPane_Tools::ShapeTypeInfo (aShape) << "" << "";
|
||||
aShapes.Append (aShape);
|
||||
TopoDS_Shape aShape = aShapeAttr->Get();
|
||||
TCollection_AsciiString aShapeInfo =
|
||||
!aShape.IsNull() ? Standard_Dump::GetPointerInfo(aShape.TShape()) : "";
|
||||
aValues << "Shape" << aShapeInfo.ToCString() << DFBrowserPane_Tools::ShapeTypeInfo(aShape) << ""
|
||||
<< "";
|
||||
aShapes.Append(aShape);
|
||||
if (aShape.IsNull())
|
||||
aFreeRows << 2;
|
||||
|
||||
TopoDS_Shape aCurrentShape = TNaming_Tool::CurrentShape (aShapeAttr);
|
||||
TCollection_AsciiString aCurrentShapeInfo = !aCurrentShape.IsNull() ?
|
||||
Standard_Dump::GetPointerInfo (aCurrentShape.TShape()) : "";
|
||||
TopoDS_Shape aCurrentShape = TNaming_Tool::CurrentShape(aShapeAttr);
|
||||
TCollection_AsciiString aCurrentShapeInfo =
|
||||
!aCurrentShape.IsNull() ? Standard_Dump::GetPointerInfo(aCurrentShape.TShape()) : "";
|
||||
aValues << "CurrentShape" << aCurrentShapeInfo.ToCString()
|
||||
<< DFBrowserPane_Tools::ShapeTypeInfo (aCurrentShape) << "" << "";
|
||||
aShapes.Append (aCurrentShape);
|
||||
<< DFBrowserPane_Tools::ShapeTypeInfo(aCurrentShape) << "" << "";
|
||||
aShapes.Append(aCurrentShape);
|
||||
if (aCurrentShape.IsNull())
|
||||
aFreeRows << 3;
|
||||
|
||||
TopoDS_Shape anOriginalShape = TNaming_Tool::OriginalShape (aShapeAttr);
|
||||
TCollection_AsciiString anOriginalShapeInfo = !anOriginalShape.IsNull() ?
|
||||
Standard_Dump::GetPointerInfo (anOriginalShape.TShape()) : "";
|
||||
TopoDS_Shape anOriginalShape = TNaming_Tool::OriginalShape(aShapeAttr);
|
||||
TCollection_AsciiString anOriginalShapeInfo =
|
||||
!anOriginalShape.IsNull() ? Standard_Dump::GetPointerInfo(anOriginalShape.TShape()) : "";
|
||||
aValues << "OriginalShape" << anOriginalShapeInfo.ToCString()
|
||||
<< DFBrowserPane_Tools::ShapeTypeInfo (anOriginalShape) << "" << "";
|
||||
aShapes.Append (anOriginalShape);
|
||||
<< DFBrowserPane_Tools::ShapeTypeInfo(anOriginalShape) << "" << "";
|
||||
aShapes.Append(anOriginalShape);
|
||||
if (anOriginalShape.IsNull())
|
||||
aFreeRows << 4;
|
||||
|
||||
|
||||
DFBrowserPane_AttributePaneModel* aModel = getPaneModel();
|
||||
aModel->Init (aValues);
|
||||
aModel->Init(aValues);
|
||||
if (myTableView)
|
||||
{
|
||||
QTableView* aTableView = myTableView->GetTableView();
|
||||
for (int i = 0; i < aModel->columnCount(); i++)
|
||||
{
|
||||
if (i == 3 || i == 4)
|
||||
dynamic_cast<DFBrowserPane_ItemDelegateButton*>(aTableView->itemDelegateForColumn(3))->SetFreeRows (aFreeRows);
|
||||
dynamic_cast<DFBrowserPane_ItemDelegateButton*>(aTableView->itemDelegateForColumn(3))
|
||||
->SetFreeRows(aFreeRows);
|
||||
else
|
||||
aTableView->resizeColumnToContents (i);
|
||||
aTableView->resizeColumnToContents(i);
|
||||
}
|
||||
}
|
||||
QModelIndexList anIndices;
|
||||
int aRowId = 2;
|
||||
for (NCollection_List<TopoDS_Shape>::Iterator aShapeIt (aShapes); aShapeIt.More(); aShapeIt.Next(), aRowId++)
|
||||
int aRowId = 2;
|
||||
for (NCollection_List<TopoDS_Shape>::Iterator aShapeIt(aShapes); aShapeIt.More();
|
||||
aShapeIt.Next(), aRowId++)
|
||||
{
|
||||
if (aShapeIt.Value().IsNull())
|
||||
continue;
|
||||
anIndices.clear();
|
||||
anIndices << aModel->index (aRowId, 1) << aModel->index (aRowId, 2) <<
|
||||
aModel->index (aRowId, 3) << aModel->index (aRowId, 4);
|
||||
myHelperExport.AddShape (aShapeIt.Value(), anIndices);
|
||||
anIndices << aModel->index(aRowId, 1) << aModel->index(aRowId, 2) << aModel->index(aRowId, 3)
|
||||
<< aModel->index(aRowId, 4);
|
||||
myHelperExport.AddShape(aShapeIt.Value(), anIndices);
|
||||
}
|
||||
|
||||
// evolution table view filling
|
||||
aValues.clear();
|
||||
aRowId = 0;
|
||||
aRowId = 0;
|
||||
bool aHasModified = false;
|
||||
for (TNaming_Iterator aShapeAttrIt (aShapeAttr); aShapeAttrIt.More(); aShapeAttrIt.Next(), aRowId++)
|
||||
for (TNaming_Iterator aShapeAttrIt(aShapeAttr); aShapeAttrIt.More();
|
||||
aShapeAttrIt.Next(), aRowId++)
|
||||
{
|
||||
const TopoDS_Shape& anOldShape = aShapeAttrIt.OldShape();
|
||||
const TopoDS_Shape& aNewShape = aShapeAttrIt.NewShape();
|
||||
const TopoDS_Shape& aNewShape = aShapeAttrIt.NewShape();
|
||||
|
||||
Handle(TNaming_NamedShape) anOldAttr = TNaming_Tool::NamedShape (anOldShape, aShapeAttr->Label());
|
||||
aValues << DFBrowserPane_Tools::ToName (DB_NS_TYPE, aShapeAttrIt.Evolution()).ToCString();
|
||||
Handle(TNaming_NamedShape) anOldAttr =
|
||||
TNaming_Tool::NamedShape(anOldShape, aShapeAttr->Label());
|
||||
aValues << DFBrowserPane_Tools::ToName(DB_NS_TYPE, aShapeAttrIt.Evolution()).ToCString();
|
||||
aHasModified = aHasModified | aShapeAttrIt.IsModification();
|
||||
|
||||
aValues << "New:";
|
||||
@@ -220,55 +237,56 @@ void DFBrowserPane_TNamingNamedShape::Init (const Handle(TDF_Attribute)& theAttr
|
||||
{
|
||||
TDF_Label anOldLabel = anOldAttr->Label();
|
||||
if (!anOldLabel.IsNull())
|
||||
aLabelInfo = QString (DFBrowserPane_Tools::GetEntry (anOldLabel).ToCString());
|
||||
aLabelInfo = QString(DFBrowserPane_Tools::GetEntry(anOldLabel).ToCString());
|
||||
}
|
||||
if (!aNewShape.IsNull())
|
||||
aValues << Standard_Dump::GetPointerInfo (aNewShape.TShape()->This()).ToCString()
|
||||
<< DFBrowserPane_Tools::ShapeTypeInfo (aNewShape)
|
||||
<< "";
|
||||
aValues << Standard_Dump::GetPointerInfo(aNewShape.TShape()->This()).ToCString()
|
||||
<< DFBrowserPane_Tools::ShapeTypeInfo(aNewShape) << "";
|
||||
else
|
||||
aValues << "-" << "-" << "";
|
||||
aValues << "Old:";
|
||||
if (!anOldShape.IsNull())
|
||||
aValues << Standard_Dump::GetPointerInfo (anOldShape.TShape()->This()).ToCString()
|
||||
<< DFBrowserPane_Tools::ShapeTypeInfo (anOldShape)
|
||||
<< aLabelInfo
|
||||
<< "";
|
||||
aValues << Standard_Dump::GetPointerInfo(anOldShape.TShape()->This()).ToCString()
|
||||
<< DFBrowserPane_Tools::ShapeTypeInfo(anOldShape) << aLabelInfo << "";
|
||||
else
|
||||
aValues << "-" << "-" << "-" << "";
|
||||
}
|
||||
|
||||
if (myEvolutionTableView)
|
||||
{
|
||||
myEvolutionTableView->setVisible (aValues.size() > 0);
|
||||
myEvolutionTableView->GetTableView()->setColumnHidden (1, !aHasModified);
|
||||
myEvolutionPaneModel->Init (aValues);
|
||||
myEvolutionTableView->setVisible(aValues.size() > 0);
|
||||
myEvolutionTableView->GetTableView()->setColumnHidden(1, !aHasModified);
|
||||
myEvolutionPaneModel->Init(aValues);
|
||||
|
||||
aRowId = 0;
|
||||
for (TNaming_Iterator aShapeAttrIt (aShapeAttr); aShapeAttrIt.More(); aShapeAttrIt.Next(), aRowId++)
|
||||
for (TNaming_Iterator aShapeAttrIt(aShapeAttr); aShapeAttrIt.More();
|
||||
aShapeAttrIt.Next(), aRowId++)
|
||||
{
|
||||
const TopoDS_Shape& anOldShape = aShapeAttrIt.OldShape();
|
||||
const TopoDS_Shape& aNewShape = aShapeAttrIt.NewShape();
|
||||
const TopoDS_Shape& aNewShape = aShapeAttrIt.NewShape();
|
||||
|
||||
if (!aNewShape.IsNull())
|
||||
{
|
||||
anIndices.clear();
|
||||
anIndices << myEvolutionPaneModel->index (aRowId, 2) << myEvolutionPaneModel->index (aRowId, 3)
|
||||
<< myEvolutionPaneModel->index (aRowId, 4);
|
||||
myHelperExport.AddShape (aNewShape, anIndices);
|
||||
anIndices << myEvolutionPaneModel->index(aRowId, 2)
|
||||
<< myEvolutionPaneModel->index(aRowId, 3)
|
||||
<< myEvolutionPaneModel->index(aRowId, 4);
|
||||
myHelperExport.AddShape(aNewShape, anIndices);
|
||||
}
|
||||
if (!anOldShape.IsNull())
|
||||
{
|
||||
anIndices.clear();
|
||||
anIndices << myEvolutionPaneModel->index (aRowId, 6) << myEvolutionPaneModel->index (aRowId, 7)
|
||||
<< myEvolutionPaneModel->index (aRowId, 9);
|
||||
myHelperExport.AddShape (anOldShape, anIndices);
|
||||
anIndices << myEvolutionPaneModel->index(aRowId, 6)
|
||||
<< myEvolutionPaneModel->index(aRowId, 7)
|
||||
<< myEvolutionPaneModel->index(aRowId, 9);
|
||||
myHelperExport.AddShape(anOldShape, anIndices);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < myEvolutionPaneModel->columnCount(); i++)
|
||||
{
|
||||
if (i == 5 || i == 10) continue;
|
||||
myEvolutionTableView->GetTableView()->resizeColumnToContents (i);
|
||||
if (i == 5 || i == 10)
|
||||
continue;
|
||||
myEvolutionTableView->GetTableView()->resizeColumnToContents(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -277,57 +295,63 @@ void DFBrowserPane_TNamingNamedShape::Init (const Handle(TDF_Attribute)& theAttr
|
||||
// function : GetValues
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void DFBrowserPane_TNamingNamedShape::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
|
||||
{
|
||||
}
|
||||
void DFBrowserPane_TNamingNamedShape::GetValues(const Handle(TDF_Attribute)&, QList<QVariant>&) {}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetAttributeInfo
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QVariant DFBrowserPane_TNamingNamedShape::GetAttributeInfo (const Handle(TDF_Attribute)& theAttribute, int theRole,
|
||||
int theColumnId)
|
||||
QVariant DFBrowserPane_TNamingNamedShape::GetAttributeInfo(
|
||||
const Handle(TDF_Attribute)& theAttribute,
|
||||
int theRole,
|
||||
int theColumnId)
|
||||
{
|
||||
if (theColumnId != 0)
|
||||
return DFBrowserPane_AttributePane::GetAttributeInfo (theAttribute, theRole, theColumnId);
|
||||
return DFBrowserPane_AttributePane::GetAttributeInfo(theAttribute, theRole, theColumnId);
|
||||
|
||||
switch (theRole)
|
||||
{
|
||||
case Qt::DecorationRole: return QIcon (":/icons/named_shape.png");
|
||||
case DFBrowserPane_ItemRole_Decoration_40x40: return QIcon (":/icons/named_shape_40x40.png");
|
||||
case Qt::ForegroundRole:
|
||||
{
|
||||
TopoDS_Shape aShape;
|
||||
Handle(TNaming_NamedShape) anAttribute = Handle(TNaming_NamedShape)::DownCast (theAttribute);
|
||||
case Qt::DecorationRole:
|
||||
return QIcon(":/icons/named_shape.png");
|
||||
case DFBrowserPane_ItemRole_Decoration_40x40:
|
||||
return QIcon(":/icons/named_shape_40x40.png");
|
||||
case Qt::ForegroundRole: {
|
||||
TopoDS_Shape aShape;
|
||||
Handle(TNaming_NamedShape) anAttribute = Handle(TNaming_NamedShape)::DownCast(theAttribute);
|
||||
if (!anAttribute.IsNull())
|
||||
aShape = anAttribute->Get();
|
||||
if (aShape.IsNull())
|
||||
return QColor (Qt::black);
|
||||
return QColor(Qt::black);
|
||||
|
||||
return QColor (aShape.Orientation() == TopAbs_FORWARD ? Qt::darkGray :
|
||||
aShape.Orientation() == TopAbs_REVERSED ? QColor (Qt::gray) : Qt::black);
|
||||
return QColor(aShape.Orientation() == TopAbs_FORWARD ? Qt::darkGray
|
||||
: aShape.Orientation() == TopAbs_REVERSED ? QColor(Qt::gray)
|
||||
: Qt::black);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
return DFBrowserPane_AttributePane::GetAttributeInfo (theAttribute, theRole, theColumnId);
|
||||
return DFBrowserPane_AttributePane::GetAttributeInfo(theAttribute, theRole, theColumnId);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetShortAttributeInfo
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void DFBrowserPane_TNamingNamedShape::GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
|
||||
QList<QVariant>& theValues)
|
||||
void DFBrowserPane_TNamingNamedShape::GetShortAttributeInfo(
|
||||
const Handle(TDF_Attribute)& theAttribute,
|
||||
QList<QVariant>& theValues)
|
||||
{
|
||||
Handle(TNaming_NamedShape) aShapeAttribute = Handle(TNaming_NamedShape)::DownCast (theAttribute);
|
||||
Handle(TNaming_NamedShape) aShapeAttribute = Handle(TNaming_NamedShape)::DownCast(theAttribute);
|
||||
|
||||
if (aShapeAttribute->Get().IsNull())
|
||||
theValues.append ("EMPTY SHAPE");
|
||||
theValues.append("EMPTY SHAPE");
|
||||
else
|
||||
{
|
||||
theValues.append (QString ("%1 : %2").arg (DFBrowserPane_Tools::ToName (DB_SHAPE_TYPE, aShapeAttribute->Get().ShapeType()).ToCString())
|
||||
.arg (DFBrowserPane_Tools::ToName (DB_NS_TYPE, aShapeAttribute->Evolution()).ToCString()));
|
||||
theValues.append(
|
||||
QString("%1 : %2")
|
||||
.arg(DFBrowserPane_Tools::ToName(DB_SHAPE_TYPE, aShapeAttribute->Get().ShapeType())
|
||||
.ToCString())
|
||||
.arg(DFBrowserPane_Tools::ToName(DB_NS_TYPE, aShapeAttribute->Evolution()).ToCString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,9 +359,9 @@ void DFBrowserPane_TNamingNamedShape::GetShortAttributeInfo (const Handle(TDF_At
|
||||
// function : GetSelectionKind
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
int DFBrowserPane_TNamingNamedShape::GetSelectionKind (QItemSelectionModel* theModel)
|
||||
int DFBrowserPane_TNamingNamedShape::GetSelectionKind(QItemSelectionModel* theModel)
|
||||
{
|
||||
int aKind = DFBrowserPane_AttributePaneAPI::GetSelectionKind (theModel);
|
||||
int aKind = DFBrowserPane_AttributePaneAPI::GetSelectionKind(theModel);
|
||||
|
||||
QTableView* aTableView = myTableView->GetTableView();
|
||||
if (aTableView->selectionModel() != theModel)
|
||||
@@ -348,7 +372,7 @@ int DFBrowserPane_TNamingNamedShape::GetSelectionKind (QItemSelectionModel* theM
|
||||
return aKind;
|
||||
|
||||
QModelIndex aSelectedIndex = aSelectedIndices.first();
|
||||
int aRow = aSelectedIndex.row();
|
||||
int aRow = aSelectedIndex.row();
|
||||
if (aRow == 0 || aRow == 1)
|
||||
return aKind;
|
||||
|
||||
@@ -362,9 +386,10 @@ int DFBrowserPane_TNamingNamedShape::GetSelectionKind (QItemSelectionModel* theM
|
||||
// function : GetSelectionParameters
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void DFBrowserPane_TNamingNamedShape::GetSelectionParameters (QItemSelectionModel* theModel,
|
||||
NCollection_List<Handle(Standard_Transient)>& theParameters,
|
||||
NCollection_List<TCollection_AsciiString>& theItemNames)
|
||||
void DFBrowserPane_TNamingNamedShape::GetSelectionParameters(
|
||||
QItemSelectionModel* theModel,
|
||||
NCollection_List<Handle(Standard_Transient)>& theParameters,
|
||||
NCollection_List<TCollection_AsciiString>& theItemNames)
|
||||
{
|
||||
QTableView* aTableView = myTableView->GetTableView();
|
||||
if (aTableView->selectionModel() != theModel)
|
||||
@@ -378,48 +403,49 @@ void DFBrowserPane_TNamingNamedShape::GetSelectionParameters (QItemSelectionMode
|
||||
if (aSelectedIndex.column() != 4)
|
||||
return;
|
||||
|
||||
const TopoDS_Shape& aShape = myHelperExport.Shape (aSelectedIndex);
|
||||
const TopoDS_Shape& aShape = myHelperExport.Shape(aSelectedIndex);
|
||||
if (aShape.IsNull())
|
||||
return;
|
||||
theParameters.Append (aShape.TShape());
|
||||
theItemNames.Append (TInspectorAPI_PluginParameters::ParametersToString (aShape));
|
||||
theParameters.Append(aShape.TShape());
|
||||
theItemNames.Append(TInspectorAPI_PluginParameters::ParametersToString(aShape));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetReferences
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void DFBrowserPane_TNamingNamedShape::GetReferences (const Handle(TDF_Attribute)& theAttribute,
|
||||
NCollection_List<TDF_Label>& theRefLabels,
|
||||
Handle(Standard_Transient)& theRefPresentation)
|
||||
void DFBrowserPane_TNamingNamedShape::GetReferences(const Handle(TDF_Attribute)& theAttribute,
|
||||
NCollection_List<TDF_Label>& theRefLabels,
|
||||
Handle(Standard_Transient)& theRefPresentation)
|
||||
{
|
||||
if (!myEvolutionTableView)
|
||||
return;
|
||||
QStringList aSelectedEntries = DFBrowserPane_TableView::GetSelectedColumnValues (
|
||||
myEvolutionTableView->GetTableView(), 9);
|
||||
QStringList aSelectedEntries =
|
||||
DFBrowserPane_TableView::GetSelectedColumnValues(myEvolutionTableView->GetTableView(), 9);
|
||||
|
||||
Handle(TNaming_NamedShape) aShapeAttr = Handle(TNaming_NamedShape)::DownCast (theAttribute);
|
||||
for (TNaming_Iterator aShapeAttrIt (aShapeAttr); aShapeAttrIt.More(); aShapeAttrIt.Next())
|
||||
Handle(TNaming_NamedShape) aShapeAttr = Handle(TNaming_NamedShape)::DownCast(theAttribute);
|
||||
for (TNaming_Iterator aShapeAttrIt(aShapeAttr); aShapeAttrIt.More(); aShapeAttrIt.Next())
|
||||
{
|
||||
const TopoDS_Shape& anOldShape = aShapeAttrIt.OldShape();
|
||||
|
||||
Handle(TNaming_NamedShape) anOldAttr = TNaming_Tool::NamedShape (anOldShape, aShapeAttr->Label());
|
||||
Handle(TNaming_NamedShape) anOldAttr =
|
||||
TNaming_Tool::NamedShape(anOldShape, aShapeAttr->Label());
|
||||
QString aLabelInfo;
|
||||
if (!anOldAttr.IsNull())
|
||||
{
|
||||
TDF_Label anOldLabel = anOldAttr->Label();
|
||||
if (!anOldLabel.IsNull())
|
||||
{
|
||||
if (aSelectedEntries.contains (DFBrowserPane_Tools::GetEntry (anOldLabel).ToCString()))
|
||||
theRefLabels.Append (anOldLabel);
|
||||
if (aSelectedEntries.contains(DFBrowserPane_Tools::GetEntry(anOldLabel).ToCString()))
|
||||
theRefLabels.Append(anOldLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
TopoDS_Shape aShape = getSelectedShapes();
|
||||
if (!aShape.IsNull())
|
||||
{
|
||||
Handle(AIS_Shape) aPresentation = new AIS_Shape (aShape);
|
||||
aPresentation->Attributes()->SetAutoTriangulation (Standard_False);
|
||||
Handle(AIS_Shape) aPresentation = new AIS_Shape(aShape);
|
||||
aPresentation->Attributes()->SetAutoTriangulation(Standard_False);
|
||||
theRefPresentation = aPresentation;
|
||||
}
|
||||
}
|
||||
@@ -428,10 +454,11 @@ void DFBrowserPane_TNamingNamedShape::GetReferences (const Handle(TDF_Attribute)
|
||||
// function : GetPresentation
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Standard_Transient) DFBrowserPane_TNamingNamedShape::GetPresentation (const Handle(TDF_Attribute)& theAttribute)
|
||||
Handle(Standard_Transient) DFBrowserPane_TNamingNamedShape::GetPresentation(
|
||||
const Handle(TDF_Attribute)& theAttribute)
|
||||
{
|
||||
Handle(Standard_Transient) aPresentation;
|
||||
Handle(TNaming_NamedShape) aShapeAttr = Handle(TNaming_NamedShape)::DownCast (theAttribute);
|
||||
Handle(TNaming_NamedShape) aShapeAttr = Handle(TNaming_NamedShape)::DownCast(theAttribute);
|
||||
if (aShapeAttr.IsNull())
|
||||
return aPresentation;
|
||||
|
||||
@@ -439,7 +466,7 @@ Handle(Standard_Transient) DFBrowserPane_TNamingNamedShape::GetPresentation (con
|
||||
if (aShape.IsNull())
|
||||
return aPresentation;
|
||||
|
||||
aPresentation = new AIS_Shape (aShape);
|
||||
aPresentation = new AIS_Shape(aShape);
|
||||
return aPresentation;
|
||||
}
|
||||
|
||||
@@ -456,18 +483,20 @@ TopoDS_Shape DFBrowserPane_TNamingNamedShape::getSelectedShapes()
|
||||
|
||||
// table view selected shapes
|
||||
QItemSelectionModel* aTableViewSelModel = myTableView->GetTableView()->selectionModel();
|
||||
QModelIndexList anIndices = aTableViewSelModel->selectedIndexes();
|
||||
QModelIndexList anIndices = aTableViewSelModel->selectedIndexes();
|
||||
|
||||
BRep_Builder aBuilder;
|
||||
BRep_Builder aBuilder;
|
||||
TopoDS_Compound aComp;
|
||||
aBuilder.MakeCompound (aComp);
|
||||
aBuilder.MakeCompound(aComp);
|
||||
bool aHasShapes = false;
|
||||
for (QModelIndexList::const_iterator anIt = anIndices.begin(), aLast = anIndices.end(); anIt != aLast; anIt++)
|
||||
for (QModelIndexList::const_iterator anIt = anIndices.begin(), aLast = anIndices.end();
|
||||
anIt != aLast;
|
||||
anIt++)
|
||||
{
|
||||
QModelIndex anIndex = *anIt;
|
||||
if (!myHelperExport.HasShape (anIndex))
|
||||
if (!myHelperExport.HasShape(anIndex))
|
||||
continue;
|
||||
aBuilder.Add (aComp, myHelperExport.Shape (anIndex));
|
||||
aBuilder.Add(aComp, myHelperExport.Shape(anIndex));
|
||||
aHasShapes = true;
|
||||
}
|
||||
|
||||
@@ -475,12 +504,14 @@ TopoDS_Shape DFBrowserPane_TNamingNamedShape::getSelectedShapes()
|
||||
aTableViewSelModel = myEvolutionTableView->GetTableView()->selectionModel();
|
||||
anIndices.clear();
|
||||
anIndices = aTableViewSelModel->selectedIndexes();
|
||||
for (QModelIndexList::const_iterator anIt = anIndices.begin(), aLast = anIndices.end(); anIt != aLast; anIt++)
|
||||
for (QModelIndexList::const_iterator anIt = anIndices.begin(), aLast = anIndices.end();
|
||||
anIt != aLast;
|
||||
anIt++)
|
||||
{
|
||||
QModelIndex anIndex = *anIt;
|
||||
if (!myHelperExport.HasShape (anIndex))
|
||||
if (!myHelperExport.HasShape(anIndex))
|
||||
continue;
|
||||
aBuilder.Add (aComp, myHelperExport.Shape (anIndex));
|
||||
aBuilder.Add(aComp, myHelperExport.Shape(anIndex));
|
||||
aHasShapes = true;
|
||||
}
|
||||
if (aHasShapes)
|
||||
|
Reference in New Issue
Block a user