mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-13 14:27:08 +03:00
0030268: Inspectors - improvements in VInspector plugin
- VInspectorPaneAIS - to create additional rows for custom AIS presentations in property table, example is a table for AIS_Shape (ViewControl_PaneCreator/PaneItem interface for it, to be used in DFBrowser instead of DFBrowserPane_Creator) - VInspector items for: Select3D_SensitiveSet, Graphics3d_CView, Graphic3d_Camera, Aspect_Window objects - VInspector camera follower presentation - draft.
This commit is contained in:
@@ -88,6 +88,11 @@ namespace
|
||||
{
|
||||
"DISPLAYED", "ERASED", "NONE"
|
||||
};
|
||||
|
||||
static Standard_CString AIS_Table_PrintKindOfInteractive[6] =
|
||||
{
|
||||
"NONE", "DATUM", "SHAPE", "OBJECT", "RELATION", "DIMENSION"
|
||||
};
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -1576,3 +1581,33 @@ Standard_Boolean AIS::DisplayStatusFromString (Standard_CString theTypeString,
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : KindOfInteractiveToString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_CString AIS::KindOfInteractiveToString (AIS_KindOfInteractive theType)
|
||||
{
|
||||
return AIS_Table_PrintKindOfInteractive[theType];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : KindOfInteractiveFromString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS::KindOfInteractiveFromString (Standard_CString theTypeString,
|
||||
AIS_KindOfInteractive& theType)
|
||||
{
|
||||
TCollection_AsciiString aName (theTypeString);
|
||||
aName.UpperCase();
|
||||
for (Standard_Integer aTypeIter = 0; aTypeIter <= AIS_KOI_Dimension; ++aTypeIter)
|
||||
{
|
||||
Standard_CString aTypeName = AIS_Table_PrintKindOfInteractive[aTypeIter];
|
||||
if (aName == aTypeName)
|
||||
{
|
||||
theType = AIS_KindOfInteractive (aTypeIter);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <AIS_KindOfInteractive.hxx>
|
||||
#include <AIS_KindOfSurface.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
@@ -273,6 +274,28 @@ public:
|
||||
Standard_EXPORT static Standard_Boolean DisplayStatusFromString (const Standard_CString theTypeString,
|
||||
AIS_DisplayStatus& theType);
|
||||
|
||||
//! Returns the string name for a given enum type.
|
||||
//! @param theType display status
|
||||
//! @return string identifier
|
||||
Standard_EXPORT static Standard_CString KindOfInteractiveToString (AIS_KindOfInteractive theType);
|
||||
|
||||
//! Returns the display status from the given string identifier (using case-insensitive comparison).
|
||||
//! @param theTypeString string identifier
|
||||
//! @return status type or AIS_KOI_None if string identifier is invalid
|
||||
static AIS_KindOfInteractive KindOfInteractiveFromString (Standard_CString theTypeString)
|
||||
{
|
||||
AIS_KindOfInteractive aType = AIS_KOI_None;
|
||||
KindOfInteractiveFromString (theTypeString, aType);
|
||||
return aType;
|
||||
}
|
||||
|
||||
//! Determines the shape type from the given string identifier (using case-insensitive comparison).
|
||||
//! @param theTypeString string identifier
|
||||
//! @param theType detected display status
|
||||
//! @return TRUE if string identifier is known
|
||||
Standard_EXPORT static Standard_Boolean KindOfInteractiveFromString (const Standard_CString theTypeString,
|
||||
AIS_KindOfInteractive& theType);
|
||||
|
||||
};
|
||||
|
||||
#endif // _AIS_HeaderFile
|
||||
|
@@ -61,6 +61,29 @@ namespace
|
||||
{
|
||||
"NONE", "ZOOM_PERS", "ROTATE_PERS", "TRIEDRON_PERS", "2d", "ZOOM_ROTATE_PERS"
|
||||
};
|
||||
|
||||
static Standard_CString Graphic3d_Table_PrintCameraProjection[5] =
|
||||
{
|
||||
"ORTHOGRAPHIC", "PERSPECTIVE", "STEREO", "MONOLEFTEYE", "MONORIGHTEYE"
|
||||
};
|
||||
|
||||
static Standard_CString Graphic3d_Table_PrintFocusType[2] =
|
||||
{
|
||||
"ABSOLUTE", "RELATIVE"
|
||||
};
|
||||
|
||||
static Standard_CString Graphic3d_Table_PrintIODType[2] =
|
||||
{
|
||||
"ABSOLUTE", "RELATIVE"
|
||||
};
|
||||
|
||||
static Standard_CString Graphic3d_Table_PrintNameOfMaterial[26] =
|
||||
{
|
||||
"BRASS", "BRONZE", "COPPER", "GOLD", "PEWTER", "PLASTER", "PLASTIC", "SILVER", // 8
|
||||
"STEEL", "STONE", "SHINY_PLASTIC", "SATIN", "METALIZED", "NEON_GNC", "CHROME", // 7
|
||||
"ALUMINIUM", "OBSIDIAN", "NEON_PHC", "JADE", "CHARCOAL", "WATER", "GLASS", // 7
|
||||
"DIAMOND", "TRANSPARENT", "DEFAULT", "UserDefined" // 4
|
||||
};
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -290,8 +313,6 @@ Standard_Boolean Graphic3d::TypeOfAttributeFromString (Standard_CString theTypeS
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TypeOfDataToString
|
||||
//purpose :
|
||||
@@ -368,3 +389,126 @@ Standard_Boolean Graphic3d::TransModeFlagsFromString (Standard_CString theTypeSt
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CameraProjectionToString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_CString Graphic3d::CameraProjectionToString (Graphic3d_Camera::Projection theType)
|
||||
{
|
||||
return Graphic3d_Table_PrintCameraProjection[theType];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CameraProjectionFromString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Graphic3d::CameraProjectionFromString (Standard_CString theTypeString,
|
||||
Graphic3d_Camera::Projection& theType)
|
||||
{
|
||||
TCollection_AsciiString aName (theTypeString);
|
||||
aName.UpperCase();
|
||||
for (Standard_Integer aTypeIter = Graphic3d_Camera::Projection_Orthographic;
|
||||
aTypeIter <= Graphic3d_Camera::Projection_MonoRightEye; ++aTypeIter)
|
||||
{
|
||||
Standard_CString aTypeName = Graphic3d_Table_PrintCameraProjection[aTypeIter];
|
||||
if (aName == aTypeName)
|
||||
{
|
||||
theType = Graphic3d_Camera::Projection (aTypeIter);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CameraFocusTypeToString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_CString Graphic3d::CameraFocusTypeToString (Graphic3d_Camera::FocusType theType)
|
||||
{
|
||||
return Graphic3d_Table_PrintFocusType[theType];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FocusTypeFromString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Graphic3d::CameraFocusTypeFromString (Standard_CString theTypeString,
|
||||
Graphic3d_Camera::FocusType& theType)
|
||||
{
|
||||
TCollection_AsciiString aName (theTypeString);
|
||||
aName.UpperCase();
|
||||
for (Standard_Integer aTypeIter = Graphic3d_Camera::FocusType_Absolute;
|
||||
aTypeIter <= Graphic3d_Camera::FocusType_Relative; ++aTypeIter)
|
||||
{
|
||||
Standard_CString aTypeName = Graphic3d_Table_PrintFocusType[aTypeIter];
|
||||
if (aName == aTypeName)
|
||||
{
|
||||
theType = Graphic3d_Camera::FocusType (aTypeIter);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CameraIODTypeToString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_CString Graphic3d::CameraIODTypeToString (Graphic3d_Camera::IODType theType)
|
||||
{
|
||||
return Graphic3d_Table_PrintIODType[theType];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IODTypeFromString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Graphic3d::CameraIODTypeFromString (Standard_CString theTypeString,
|
||||
Graphic3d_Camera::IODType& theType)
|
||||
{
|
||||
TCollection_AsciiString aName (theTypeString);
|
||||
aName.UpperCase();
|
||||
for (Standard_Integer aTypeIter = Graphic3d_Camera::IODType_Absolute;
|
||||
aTypeIter <= Graphic3d_Camera::IODType_Relative; ++aTypeIter)
|
||||
{
|
||||
Standard_CString aTypeName = Graphic3d_Table_PrintIODType[aTypeIter];
|
||||
if (aName == aTypeName)
|
||||
{
|
||||
theType = Graphic3d_Camera::IODType (aTypeIter);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NameOfMaterialToString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_CString Graphic3d::NameOfMaterialToString (Graphic3d_NameOfMaterial theType)
|
||||
{
|
||||
return Graphic3d_Table_PrintNameOfMaterial[theType];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NameOfMaterialFromString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Graphic3d::NameOfMaterialFromString (Standard_CString theTypeString,
|
||||
Graphic3d_NameOfMaterial& theType)
|
||||
{
|
||||
TCollection_AsciiString aName (theTypeString);
|
||||
aName.UpperCase();
|
||||
for (Standard_Integer aTypeIter = Graphic3d_TOD_USHORT; aTypeIter <= Graphic3d_TOD_FLOAT; ++aTypeIter)
|
||||
{
|
||||
Standard_CString aTypeName = Graphic3d_Table_PrintNameOfMaterial[aTypeIter];
|
||||
if (aName == aTypeName)
|
||||
{
|
||||
theType = Graphic3d_NameOfMaterial (aTypeIter);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
@@ -16,11 +16,13 @@
|
||||
|
||||
#include <Graphic3d_AlphaMode.hxx>
|
||||
#include <Graphic3d_Buffer.hxx>
|
||||
#include <Graphic3d_Camera.hxx>
|
||||
#include <Graphic3d_HorizontalTextAlignment.hxx>
|
||||
#include <Graphic3d_VerticalTextAlignment.hxx>
|
||||
#include <Graphic3d_TextPath.hxx>
|
||||
#include <Graphic3d_TransModeFlags.hxx>
|
||||
#include <Graphic3d_TypeOfShadingModel.hxx>
|
||||
#include <Graphic3d_NameOfMaterial.hxx>
|
||||
|
||||
#include <Graphic3d_ZLayerId.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
@@ -232,6 +234,94 @@ public:
|
||||
//! @return TRUE if string identifier is known
|
||||
Standard_EXPORT static Standard_Boolean TransModeFlagsFromString (const Standard_CString theTypeString,
|
||||
Graphic3d_TransModeFlags& theType);
|
||||
|
||||
//! Returns the string name for a given type.
|
||||
//! @param theType an enumeration type
|
||||
//! @return string identifier from the enumeration list
|
||||
Standard_EXPORT static Standard_CString CameraProjectionToString (Graphic3d_Camera::Projection theType);
|
||||
|
||||
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
|
||||
//! @param theTypeString string identifier
|
||||
//! @return enumeration type or Projection_Orthographic if string identifier is invalid
|
||||
static Graphic3d_Camera::Projection CameraProjectionFromString (Standard_CString theTypeString)
|
||||
{
|
||||
Graphic3d_Camera::Projection aType = Graphic3d_Camera::Projection_Orthographic;
|
||||
CameraProjectionFromString (theTypeString, aType);
|
||||
return aType;
|
||||
}
|
||||
|
||||
//! Determines the type from the given string identifier (using case-insensitive comparison).
|
||||
//! @param theTypeString string identifier
|
||||
//! @param theType detected type
|
||||
//! @return TRUE if string identifier is known
|
||||
Standard_EXPORT static Standard_Boolean CameraProjectionFromString (const Standard_CString theTypeString,
|
||||
Graphic3d_Camera::Projection& theType);
|
||||
|
||||
//! Returns the string name for a given type.
|
||||
//! @param theType an enumeration type
|
||||
//! @return string identifier from the enumeration list
|
||||
Standard_EXPORT static Standard_CString CameraFocusTypeToString (Graphic3d_Camera::FocusType theType);
|
||||
|
||||
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
|
||||
//! @param theTypeString string identifier
|
||||
//! @return enumeration type or FocusType_Absolute if string identifier is invalid
|
||||
static Graphic3d_Camera::FocusType CameraFocusTypeFromString (Standard_CString theTypeString)
|
||||
{
|
||||
Graphic3d_Camera::FocusType aType = Graphic3d_Camera::FocusType_Absolute;
|
||||
CameraFocusTypeFromString (theTypeString, aType);
|
||||
return aType;
|
||||
}
|
||||
|
||||
//! Determines the type from the given string identifier (using case-insensitive comparison).
|
||||
//! @param theTypeString string identifier
|
||||
//! @param theType detected type
|
||||
//! @return TRUE if string identifier is known
|
||||
Standard_EXPORT static Standard_Boolean CameraFocusTypeFromString (const Standard_CString theTypeString,
|
||||
Graphic3d_Camera::FocusType& theType);
|
||||
|
||||
//! Returns the string name for a given type.
|
||||
//! @param theType an enumeration type
|
||||
//! @return string identifier from the enumeration list
|
||||
Standard_EXPORT static Standard_CString CameraIODTypeToString (Graphic3d_Camera::IODType theType);
|
||||
|
||||
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
|
||||
//! @param theTypeString string identifier
|
||||
//! @return enumeration type or IODType_Absolute if string identifier is invalid
|
||||
static Graphic3d_Camera::IODType CameraIODTypeFromString (Standard_CString theTypeString)
|
||||
{
|
||||
Graphic3d_Camera::IODType aType = Graphic3d_Camera::IODType_Absolute;
|
||||
CameraIODTypeFromString (theTypeString, aType);
|
||||
return aType;
|
||||
}
|
||||
|
||||
//! Determines the type from the given string identifier (using case-insensitive comparison).
|
||||
//! @param theTypeString string identifier
|
||||
//! @param theType detected type
|
||||
//! @return TRUE if string identifier is known
|
||||
Standard_EXPORT static Standard_Boolean CameraIODTypeFromString (const Standard_CString theTypeString,
|
||||
Graphic3d_Camera::IODType& theType);
|
||||
|
||||
//! Returns the string name for a given type.
|
||||
//! @param theType an enumeration type
|
||||
//! @return string identifier from the enumeration list
|
||||
Standard_EXPORT static Standard_CString NameOfMaterialToString (Graphic3d_NameOfMaterial theType);
|
||||
|
||||
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
|
||||
//! @param theTypeString string identifier
|
||||
//! @return enumeration type or IODType_Absolute if string identifier is invalid
|
||||
static Graphic3d_NameOfMaterial NameOfMaterialFromString (Standard_CString theTypeString)
|
||||
{
|
||||
Graphic3d_NameOfMaterial aType = Graphic3d_NOM_BRASS;
|
||||
NameOfMaterialFromString (theTypeString, aType);
|
||||
return aType;
|
||||
}
|
||||
|
||||
//! Determines the type from the given string identifier (using case-insensitive comparison).
|
||||
//! @param theTypeString string identifier
|
||||
//! @param theType detected type
|
||||
//! @return TRUE if string identifier is known
|
||||
Standard_EXPORT static Standard_Boolean NameOfMaterialFromString (const Standard_CString theTypeString,
|
||||
Graphic3d_NameOfMaterial& theType);
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_HeaderFile
|
||||
|
@@ -520,6 +520,17 @@ void V3d_View::SetAxis (const Standard_Real theX, const Standard_Real theY, co
|
||||
myDefaultViewAxis.SetCoord (theVx, theVy, theVz);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Axis
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void V3d_View::Axis (Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ,
|
||||
Standard_Real& theVx, Standard_Real& theVy, Standard_Real& theVz)
|
||||
{
|
||||
myDefaultViewPoint.Coord (theX, theY, theZ);
|
||||
myDefaultViewAxis.Coord (theVx, theVy, theVz);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : SetShadingModel
|
||||
//purpose :
|
||||
|
@@ -229,6 +229,12 @@ public:
|
||||
Standard_EXPORT void SetAxis (const Standard_Real X, const Standard_Real Y, const Standard_Real Z,
|
||||
const Standard_Real Vx, const Standard_Real Vy, const Standard_Real Vz);
|
||||
|
||||
//! Returns an axis from its origin and
|
||||
//! its orientation .
|
||||
//! This is the current axis for rotations and movements.
|
||||
Standard_EXPORT void Axis (Standard_Real& X, Standard_Real& Y, Standard_Real& Z,
|
||||
Standard_Real& Vx, Standard_Real& Vy, Standard_Real& Vz);
|
||||
|
||||
//! Defines the shading model for the visualization. Various models are available.
|
||||
Standard_EXPORT void SetShadingModel (const Graphic3d_TypeOfShadingModel theShadingModel);
|
||||
|
||||
|
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <inspector/ShapeView_ItemRoot.hxx>
|
||||
#include <inspector/ShapeView_ItemShape.hxx>
|
||||
#include <inspector/ViewControl_Tools.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
@@ -162,27 +163,6 @@ void ToOtherInfo (const TopoDS_Shape& theShape, QVariant& theValue, QVariant& th
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : locationInfo
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QString locationInfo (const TopLoc_Location& theLocation)
|
||||
{
|
||||
QString anInfo;
|
||||
|
||||
gp_Trsf aTrsf = theLocation.Transformation();
|
||||
QStringList aValues, aRowValues;
|
||||
for (int aRowId = 1; aRowId <= 3; aRowId++)
|
||||
{
|
||||
aRowValues.clear();
|
||||
for (int aColumnId = 1; aColumnId <= 4; aColumnId++)
|
||||
aRowValues.append (QString::number (aTrsf.Value(aRowId, aColumnId)));
|
||||
aValues.append (aRowValues.join (","));
|
||||
}
|
||||
anInfo.append (aValues.join (" "));
|
||||
return anInfo;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetShape
|
||||
// purpose :
|
||||
@@ -218,7 +198,7 @@ QVariant ShapeView_ItemShape::initValue(const int theRole) const
|
||||
case 2: return rowCount() > 0 ? QVariant (rowCount()) : QVariant();
|
||||
case 3: return TShapePointer().ToCString();
|
||||
case 4: return ToName(aShape.Orientation());
|
||||
case 5: return locationInfo(aShape.Location());
|
||||
case 5: return ViewControl_Tools::ToString (aShape.Location()).ToCString();
|
||||
case 6: return ToString (aShape.Checked());
|
||||
case 7: return ToString (aShape.Closed());
|
||||
case 8: return ToString (aShape.Infinite());
|
||||
|
@@ -105,7 +105,7 @@ ShapeView_Window::ShapeView_Window (QWidget* theParent)
|
||||
myMainWindow->setCentralWidget (myTreeView);
|
||||
|
||||
// view
|
||||
myViewWindow = new View_Window (myMainWindow, false);
|
||||
myViewWindow = new View_Window (myMainWindow, NULL, false);
|
||||
connect (myViewWindow, SIGNAL(eraseAllPerformed()), this, SLOT(onEraseAllPerformed()));
|
||||
aVisibilityState->SetDisplayer (myViewWindow->GetDisplayer());
|
||||
aVisibilityState->SetPresentationType (View_PresentationType_Main);
|
||||
|
@@ -42,7 +42,7 @@
|
||||
|
||||
const int TINSPECTOR_DEFAULT_WIDTH = 650;
|
||||
const int TINSPECTOR_DEFAULT_HEIGHT = 500;//350;
|
||||
const int TINSPECTOR_DEFAULT_POSITION_X = 200;
|
||||
const int TINSPECTOR_DEFAULT_POSITION_X = 100;//200;
|
||||
const int TINSPECTOR_DEFAULT_POSITION_Y = 60;
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -122,7 +122,7 @@ int main (int argc, char** argv)
|
||||
aPlugins.insert("TKShapeView");
|
||||
aPlugins.insert("TKVInspector");
|
||||
|
||||
anActivatedPluginName = "TKDFBrowser";
|
||||
anActivatedPluginName = "TKVInspector";
|
||||
}
|
||||
else
|
||||
anActivatedPluginName = *aPlugins.rbegin();
|
||||
|
@@ -1 +1,2 @@
|
||||
VInspectorPaneAIS
|
||||
VInspector
|
@@ -235,6 +235,24 @@ QModelIndex TreeModel_ModelBase::SingleSelected (const QModelIndexList& theIndic
|
||||
return aSelected.size() == 1 ? aSelected.first() : QModelIndex();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetSelectedItems
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QList<TreeModel_ItemBasePtr> TreeModel_ModelBase::GetSelectedItems (const QModelIndexList& theIndices)
|
||||
{
|
||||
QList<TreeModel_ItemBasePtr> anItems;
|
||||
|
||||
for (QModelIndexList::const_iterator anIndicesIt = theIndices.begin(); anIndicesIt != theIndices.end(); anIndicesIt++)
|
||||
{
|
||||
TreeModel_ItemBasePtr anItem = TreeModel_ModelBase::GetItemByIndex (*anIndicesIt);
|
||||
if (!anItem || anItems.contains (anItem))
|
||||
continue;
|
||||
anItems.append (anItem);
|
||||
}
|
||||
return anItems;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : getIndexValue
|
||||
// purpose :
|
||||
|
@@ -163,6 +163,12 @@ public:
|
||||
Standard_EXPORT static QModelIndex SingleSelected (const QModelIndexList& theIndices, const int theCellId,
|
||||
const Qt::Orientation theOrientation = Qt::Horizontal);
|
||||
|
||||
|
||||
//! Returns selected tree model items for indices.
|
||||
//! \param theIndices a container of selected indices
|
||||
//! \return model items from the list
|
||||
Standard_EXPORT static QList<TreeModel_ItemBasePtr> GetSelectedItems (const QModelIndexList& theIndices);
|
||||
|
||||
protected:
|
||||
//! Creates root item
|
||||
//! \param theColumnId index of a column
|
||||
|
@@ -5,16 +5,22 @@ VInspector_CallBackMode.hxx
|
||||
VInspector_Communicator.cxx
|
||||
VInspector_Communicator.hxx
|
||||
VInspector_DisplayActionType.hxx
|
||||
VInspector_ItemAspectWindow.cxx
|
||||
VInspector_ItemAspectWindow.hxx
|
||||
VInspector_ItemBase.cxx
|
||||
VInspector_ItemBase.hxx
|
||||
VInspector_ItemContext.cxx
|
||||
VInspector_ItemContext.hxx
|
||||
VInspector_ItemFolderObject.cxx
|
||||
VInspector_ItemFolderObject.hxx
|
||||
VInspector_ItemGraphic3dCamera.cxx
|
||||
VInspector_ItemGraphic3dCamera.hxx
|
||||
VInspector_ItemGraphic3dClipPlane.cxx
|
||||
VInspector_ItemGraphic3dClipPlane.hxx
|
||||
VInspector_ItemGraphic3dCStructure.cxx
|
||||
VInspector_ItemGraphic3dCStructure.hxx
|
||||
VInspector_ItemGraphic3dCView.cxx
|
||||
VInspector_ItemGraphic3dCView.hxx
|
||||
VInspector_ItemGraphic3dGroup.cxx
|
||||
VInspector_ItemGraphic3dGroup.hxx
|
||||
VInspector_ItemGraphic3dTransformPers.cxx
|
||||
@@ -38,6 +44,8 @@ VInspector_ItemPrs3dDrawer.cxx
|
||||
VInspector_ItemPrs3dDrawer.hxx
|
||||
VInspector_ItemPrs3dPresentation.cxx
|
||||
VInspector_ItemPrs3dPresentation.hxx
|
||||
VInspector_ItemSelect3DSensitiveSetItem.hxx
|
||||
VInspector_ItemSelect3DSensitiveSetItem.cxx
|
||||
VInspector_ItemSelectBasicsEntityOwner.cxx
|
||||
VInspector_ItemSelectBasicsEntityOwner.hxx
|
||||
VInspector_ItemSelectBasicsSensitiveEntity.cxx
|
||||
|
@@ -38,7 +38,15 @@ IMPLEMENT_STANDARD_RTTIEXT(VInspector_CallBack, VInspectorAPI_CallBack)
|
||||
// =======================================================================
|
||||
void VInspector_CallBack::Activate (Handle(AIS_InteractiveObject) thePrs, const Standard_Integer theMode)
|
||||
{
|
||||
QList<QVariant> anInfo = VInspector_Tools::GetInfo (thePrs);
|
||||
QList<QVariant> anInfo;
|
||||
if (!thePrs.IsNull())
|
||||
anInfo = VInspector_Tools::GetInfo (thePrs);
|
||||
else
|
||||
{
|
||||
anInfo.append ("Activate");
|
||||
anInfo.append ("");
|
||||
anInfo.append ("");
|
||||
}
|
||||
anInfo[0] = QString ("%1: %2").arg (anInfo[0].toString()).arg (theMode);
|
||||
myHistoryModel->AddElement (VInspector_CallBackMode_Activate, anInfo);
|
||||
}
|
||||
|
154
tools/VInspector/VInspector_ItemAspectWindow.cxx
Normal file
154
tools/VInspector/VInspector_ItemAspectWindow.cxx
Normal file
@@ -0,0 +1,154 @@
|
||||
// Created on: 2018-12-14
|
||||
// Created by: Natalia ERMOLAEVA
|
||||
// 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.
|
||||
|
||||
|
||||
#include <inspector/VInspector_ItemAspectWindow.hxx>
|
||||
|
||||
#include <Select3D_SensitiveSet.hxx>
|
||||
#include <Aspect_Window.hxx>
|
||||
#include <inspector/VInspector_ItemV3dView.hxx>
|
||||
#include <inspector/VInspector_Tools.hxx>
|
||||
#include <inspector/ViewControl_Tools.hxx>
|
||||
|
||||
#include <V3d_View.hxx>
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QColor>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : initValue
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QVariant VInspector_ItemAspectWindow::initValue (int theItemRole) const
|
||||
{
|
||||
if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
|
||||
return QVariant();
|
||||
|
||||
Handle(Aspect_Window) aWindow = GetAspectWindow();
|
||||
if (aWindow.IsNull())
|
||||
return Column() == 0 ? "Empty Aspect_Window" : "";
|
||||
|
||||
switch (Column())
|
||||
{
|
||||
case 0: return theItemRole == Qt::DisplayRole ? aWindow->DynamicType()->Name()
|
||||
: STANDARD_TYPE (Aspect_Window)->Name();
|
||||
case 1:
|
||||
return rowCount();
|
||||
case 2:
|
||||
return ViewControl_Tools::GetPointerInfo (aWindow, true).ToCString();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_ItemAspectWindow::Init()
|
||||
{
|
||||
VInspector_ItemV3dViewPtr aParentItem = itemDynamicCast<VInspector_ItemV3dView>(Parent());
|
||||
if (aParentItem)
|
||||
myWindow = aParentItem->GetView()->Window();
|
||||
|
||||
UpdatePresentationShape();
|
||||
TreeModel_ItemBase::Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Reset
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_ItemAspectWindow::Reset()
|
||||
{
|
||||
myWindow = NULL;
|
||||
// an empty method to don't clear the main label, otherwise the model will be empty
|
||||
TreeModel_ItemBase::Reset();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initItem
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_ItemAspectWindow::initItem() const
|
||||
{
|
||||
if (IsInitialized())
|
||||
return;
|
||||
const_cast<VInspector_ItemAspectWindow*>(this)->Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableRowCount
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
int VInspector_ItemAspectWindow::GetTableRowCount() const
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableData
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QVariant VInspector_ItemAspectWindow::GetTableData (const int theRow, const int theColumn, const int theRole) const
|
||||
{
|
||||
if (theRole != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
bool isFirstColumn = theColumn == 0;
|
||||
|
||||
Handle(Aspect_Window) aWindow = GetAspectWindow();
|
||||
switch (theRow)
|
||||
{
|
||||
case 0: return isFirstColumn ? QVariant ("Background") : QVariant ();
|
||||
case 1: return isFirstColumn ? QVariant ("BackgroundFillMethod") : QVariant ();
|
||||
case 2: return isFirstColumn ? QVariant ("GradientBackground") : QVariant ();
|
||||
case 3: return isFirstColumn ? QVariant ("IsMapped") : QVariant (aWindow->IsMapped());
|
||||
case 4: return isFirstColumn ? QVariant ("IsVirtual") : QVariant (aWindow->IsVirtual());
|
||||
case 5: return isFirstColumn ? QVariant ("Ratio") : QVariant (aWindow->Ratio());
|
||||
case 6:
|
||||
{
|
||||
if (isFirstColumn)
|
||||
return QVariant ("Position");
|
||||
Standard_Integer aX1, aY1, aX2, aY2;
|
||||
aWindow->Position (aX1, aY1, aX2, aY2);
|
||||
return QString ("X1 = %1, Y1 = %2, X2 = %3, Y2 = %4").arg (aX1).arg (aY1).arg (aX2).arg (aY2);
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
if (isFirstColumn)
|
||||
return QVariant ("Size");
|
||||
Standard_Integer aWidth, aHeight;
|
||||
aWindow->Size (aWidth, aHeight);
|
||||
return QString ("width = %1, height = %2").arg (aWidth).arg (aHeight);
|
||||
}
|
||||
case 8: return isFirstColumn ? QVariant ("NativeHandle") : QVariant ();
|
||||
case 9: return isFirstColumn ? QVariant ("NativeParentHandle") : QVariant ();
|
||||
case 10: return isFirstColumn ? QVariant ("NativeFBConfig") : QVariant ();
|
||||
default: break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : buildPresentationShape
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TopoDS_Shape VInspector_ItemAspectWindow::buildPresentationShape()
|
||||
{
|
||||
return TopoDS_Shape();
|
||||
}
|
112
tools/VInspector/VInspector_ItemAspectWindow.hxx
Normal file
112
tools/VInspector/VInspector_ItemAspectWindow.hxx
Normal file
@@ -0,0 +1,112 @@
|
||||
// Created on: 2018-12-14
|
||||
// Created by: Natalia ERMOLAEVA
|
||||
// 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.
|
||||
|
||||
#ifndef VInspector_ItemAspectWindow_H
|
||||
#define VInspector_ItemAspectWindow_H
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Aspect_Window.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <inspector/VInspector_ItemBase.hxx>
|
||||
|
||||
class QItemSelectionModel;
|
||||
class VInspector_ItemAspectWindow;
|
||||
|
||||
typedef QExplicitlySharedDataPointer<VInspector_ItemAspectWindow> VInspector_ItemAspectWindowPtr;
|
||||
|
||||
//! \class VInspector_ItemAspectWindow
|
||||
//! The item shows information about SelectBasics_EntityOwner.
|
||||
//! The parent is item selection, children are item entity owners
|
||||
class VInspector_ItemAspectWindow : public VInspector_ItemBase
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Creates an item wrapped by a shared pointer
|
||||
static VInspector_ItemAspectWindowPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
|
||||
{ return VInspector_ItemAspectWindowPtr (new VInspector_ItemAspectWindow (theParent, theRow, theColumn)); }
|
||||
|
||||
//! Destructor
|
||||
virtual ~VInspector_ItemAspectWindow() Standard_OVERRIDE {};
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myWindow; }
|
||||
|
||||
//! \return the current sensitive entity
|
||||
Standard_EXPORT Handle(Aspect_Window) GetAspectWindow() const
|
||||
{ return Handle(Aspect_Window)::DownCast (GetObject()); }
|
||||
|
||||
//! Inits the item, fills internal containers
|
||||
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||
|
||||
//! Resets cached values
|
||||
Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
|
||||
|
||||
//! Returns number of table rows
|
||||
//! \return an integer value
|
||||
virtual int GetTableRowCount() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns table value for the row in form: <function name> <function value>
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! Initialize the current item. It is empty because Reset() is also empty.
|
||||
virtual void initItem() const Standard_OVERRIDE;
|
||||
|
||||
//! \return number of children.
|
||||
virtual int initRowCount() const Standard_OVERRIDE { return 0; }
|
||||
|
||||
//! Returns item information for the given role. Fills internal container if it was not filled yet
|
||||
//! \param theItemRole a value role
|
||||
//! \return the value
|
||||
virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! Creates a child item in the given position.
|
||||
//! \param theRow the child row position
|
||||
//! \param theColumn the child column position
|
||||
//! \return the created item
|
||||
virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE
|
||||
{ (void)theRow; (void)theColumn; return TreeModel_ItemBasePtr(); }
|
||||
|
||||
//! Returns table value for the row in form: <function name> <function value> depending on the aspect kind
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
//! \param theEntityKind kind or kind of entity
|
||||
QVariant getTableData (const int theRow,
|
||||
const int theColumn,
|
||||
const int theRole,
|
||||
const TCollection_AsciiString& theEntityKind) const;
|
||||
|
||||
protected:
|
||||
//! Build presentation shape
|
||||
//! \return generated shape of the item parameters
|
||||
virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE;
|
||||
|
||||
//! Constructor
|
||||
//! param theParent a parent item
|
||||
VInspector_ItemAspectWindow(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
|
||||
: VInspector_ItemBase(theParent, theRow, theColumn) {}
|
||||
|
||||
protected:
|
||||
Handle(Aspect_Window) myWindow; //!< aspect window
|
||||
};
|
||||
|
||||
#endif
|
@@ -59,3 +59,16 @@ Handle(AIS_InteractiveContext) VInspector_ItemBase::GetContext() const
|
||||
|
||||
return myContext;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetContext
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TopoDS_Shape VInspector_ItemBase::GetPresentationShape() const
|
||||
{
|
||||
if (Column() != TreeModel_ColumnType_Name)
|
||||
return TopoDS_Shape();
|
||||
|
||||
initItem();
|
||||
return myPresentationShape;
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <Standard.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
#include <inspector/TreeModel_ColumnType.hxx>
|
||||
#include <inspector/TreeModel_ItemBase.hxx>
|
||||
#include <inspector/ViewControl_EditType.hxx>
|
||||
|
||||
@@ -46,6 +47,10 @@ public:
|
||||
//! \return a context
|
||||
Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const;
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { return NULL; }
|
||||
|
||||
//! Returns presentation of the attribute to be visualized in the view
|
||||
//! \thePresentations [out] container of presentation handles to be visualized
|
||||
virtual void GetPresentations (NCollection_List<Handle(Standard_Transient)>& thePresentations)
|
||||
@@ -53,7 +58,11 @@ public:
|
||||
|
||||
//! Returns shape of the item parameters
|
||||
//! \return generated shape of the item parameters
|
||||
virtual TopoDS_Shape GetPresentationShape() const { initItem(); return myPresentationShape; }
|
||||
Standard_EXPORT virtual TopoDS_Shape GetPresentationShape() const;
|
||||
|
||||
//! Rebuild presentation shape if the item use it
|
||||
//! \return generated shape of the item parameters
|
||||
void UpdatePresentationShape() { myPresentationShape = buildPresentationShape(); }
|
||||
|
||||
//! Returns number of table rows
|
||||
//! \return an integer value
|
||||
@@ -91,6 +100,10 @@ protected:
|
||||
//! Initialize the current item. It creates a backup of the specific item information
|
||||
virtual void initItem() const {}
|
||||
|
||||
//! Build presentation shape
|
||||
//! \return generated shape of the item parameters
|
||||
virtual TopoDS_Shape buildPresentationShape() { return TopoDS_Shape(); }
|
||||
|
||||
protected:
|
||||
|
||||
//! Constructor
|
||||
|
@@ -38,6 +38,10 @@ public:
|
||||
//! Destructor
|
||||
virtual ~VInspector_ItemContext() Standard_OVERRIDE {};
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myContext; }
|
||||
|
||||
//! Returns number of displayed presentations
|
||||
//! \return rows count
|
||||
Standard_EXPORT virtual int initRowCount() const Standard_OVERRIDE;
|
||||
|
@@ -45,6 +45,10 @@ public:
|
||||
//! Destructor
|
||||
virtual ~VInspector_ItemFolderObject() Standard_OVERRIDE {};
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { return NULL; }
|
||||
|
||||
//! Inits the item, fills internal containers
|
||||
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||
|
||||
|
@@ -28,16 +28,6 @@
|
||||
#include <QStringList>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : GetCStructure
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Graphic3d_CStructure) VInspector_ItemGraphic3dCStructure::GetCStructure() const
|
||||
{
|
||||
initItem();
|
||||
return myCStructure;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetGroup
|
||||
// purpose :
|
||||
@@ -141,6 +131,30 @@ int VInspector_ItemGraphic3dCStructure::GetTableRowCount() const
|
||||
return 40;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableEnumValues
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QList<QVariant> VInspector_ItemGraphic3dCStructure::GetTableEnumValues (const int theRow, const int) const
|
||||
{
|
||||
QList<QVariant> aValues;
|
||||
switch (theRow)
|
||||
{
|
||||
case 8:
|
||||
{
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_UNKNOWN));
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_Default));
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_Top));
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_Topmost));
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_TopOSD));
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_BotOSD));
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return aValues;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableData
|
||||
// purpose :
|
||||
@@ -193,6 +207,21 @@ QVariant VInspector_ItemGraphic3dCStructure::GetTableData (const int theRow, con
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetTableData
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool VInspector_ItemGraphic3dCStructure::SetTableData (const int theRow, const int, const QVariant& theValue)
|
||||
{
|
||||
Handle(Graphic3d_CStructure) aCStructure = GetCStructure();
|
||||
switch (theRow)
|
||||
{
|
||||
case 8: aCStructure->SetZLayer (Graphic3d::ZLayerIdFromString (theValue.toString().toStdString().c_str()));
|
||||
default: return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : createChild
|
||||
// purpose :
|
||||
|
@@ -40,9 +40,14 @@ public:
|
||||
//! Destructor
|
||||
virtual ~VInspector_ItemGraphic3dCStructure() Standard_OVERRIDE {};
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myCStructure; }
|
||||
|
||||
//! Returns the current C structure, init item if it was not initialized yet
|
||||
//! \return graphic C structure object
|
||||
Standard_EXPORT Handle(Graphic3d_CStructure) GetCStructure() const;
|
||||
Standard_EXPORT Handle(Graphic3d_CStructure) GetCStructure() const
|
||||
{ return Handle(Graphic3d_CStructure)::DownCast (GetObject()); }
|
||||
|
||||
//! Returns group of the C structure
|
||||
//! \param theRowId a group index
|
||||
@@ -59,11 +64,23 @@ public:
|
||||
//! \return an integer value
|
||||
virtual int GetTableRowCount() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns container of string values for enumeration in the model row
|
||||
//! \param theRow table model row index
|
||||
//! \param theColumn a model index column
|
||||
//! \return string values for the enumeration presented in the row or an empty container
|
||||
virtual QList<QVariant> GetTableEnumValues (const int theRow, const int theColumn) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns table value for the row in form: <function name> <function value>
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole) const Standard_OVERRIDE;
|
||||
|
||||
//! Sets the value into the table cell. Only 1st column value might be modified.
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
//! \param theValue a new cell value
|
||||
virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! Initialize the current item. It creates a backup of the specific item information
|
||||
|
273
tools/VInspector/VInspector_ItemGraphic3dCView.cxx
Normal file
273
tools/VInspector/VInspector_ItemGraphic3dCView.cxx
Normal file
@@ -0,0 +1,273 @@
|
||||
// Created on: 2018-08-16
|
||||
// Created by: Natalia ERMOLAEVA
|
||||
// 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.
|
||||
|
||||
#include <inspector/VInspector_ItemGraphic3dCView.hxx>
|
||||
|
||||
#include <inspector/VInspector_ItemV3dView.hxx>
|
||||
#include <inspector/VInspector_ItemGraphic3dCamera.hxx>
|
||||
#include <inspector/VInspector_ItemGraphic3dClipPlane.hxx>
|
||||
#include <inspector/VInspector_Tools.hxx>
|
||||
#include <inspector/ViewControl_Tools.hxx>
|
||||
|
||||
#include <AIS.hxx>
|
||||
#include <Graphic3d_CView.hxx>
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QStringList>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : GetClipPlane
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Graphic3d_ClipPlane) VInspector_ItemGraphic3dCView::GetClipPlane(const int theRow)
|
||||
{
|
||||
//Handle(V3d_View) aView = GetView();
|
||||
|
||||
//const Handle(Graphic3d_SequenceOfHClipPlane)& aClipPlanes = aView->ClipPlanes();
|
||||
|
||||
//Standard_Integer aPlaneId = 0;
|
||||
//for (Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (*aClipPlanes); aPlaneIt.More(); aPlaneIt.Next(), ++aPlaneId)
|
||||
//{
|
||||
// if (aPlaneId == theRow)
|
||||
// return aPlaneIt.Value();
|
||||
//}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_ItemGraphic3dCView::Init()
|
||||
{
|
||||
VInspector_ItemV3dViewPtr aParentItem = itemDynamicCast<VInspector_ItemV3dView>(Parent());
|
||||
|
||||
myCView = aParentItem->GetView()->View();
|
||||
|
||||
TreeModel_ItemBase::Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Reset
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_ItemGraphic3dCView::Reset()
|
||||
{
|
||||
VInspector_ItemBase::Reset();
|
||||
myCView = NULL;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initItem
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_ItemGraphic3dCView::initItem() const
|
||||
{
|
||||
if (IsInitialized())
|
||||
return;
|
||||
const_cast<VInspector_ItemGraphic3dCView*>(this)->Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initRowCount
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
int VInspector_ItemGraphic3dCView::initRowCount() const
|
||||
{
|
||||
if (Column() != 0)
|
||||
return 0;
|
||||
|
||||
int aNbElements = 1; // Camera
|
||||
|
||||
Handle(Graphic3d_CView) aCView = GetCView();
|
||||
const Handle(Graphic3d_SequenceOfHClipPlane)& aClipPlanes = aCView->ClipPlanes();
|
||||
if (!aClipPlanes.IsNull())
|
||||
aNbElements += aClipPlanes->Size();
|
||||
|
||||
return aNbElements;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initValue
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QVariant VInspector_ItemGraphic3dCView::initValue (const int theItemRole) const
|
||||
{
|
||||
if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
|
||||
return QVariant();
|
||||
|
||||
Handle(Graphic3d_CView) aCView = GetCView();
|
||||
if (aCView.IsNull())
|
||||
return Column() == 0 ? "Empty Graphic3d_CView" : "";
|
||||
|
||||
switch (Column())
|
||||
{
|
||||
case 0: return theItemRole == Qt::DisplayRole ? aCView->DynamicType()->Name()
|
||||
: STANDARD_TYPE (Graphic3d_CView)->Name();
|
||||
case 1:
|
||||
return rowCount();
|
||||
case 2:
|
||||
return ViewControl_Tools::GetPointerInfo (aCView, true).ToCString();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableRowCount
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
int VInspector_ItemGraphic3dCView::GetTableRowCount() const
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableEditType
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
ViewControl_EditType VInspector_ItemGraphic3dCView::GetTableEditType (const int theRow, const int) const
|
||||
{
|
||||
switch (theRow)
|
||||
{
|
||||
/*case 4: return ViewControl_EditType_Line;
|
||||
case 5: return ViewControl_EditType_Combo;
|
||||
case 6: return ViewControl_EditType_Bool;
|
||||
case 12: return ViewControl_EditType_Bool;
|
||||
case 17: return ViewControl_EditType_Combo;
|
||||
case 18: return ViewControl_EditType_Bool;
|
||||
case 22: return ViewControl_EditType_Bool;*/
|
||||
default: return ViewControl_EditType_None;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableEnumValues
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QList<QVariant> VInspector_ItemGraphic3dCView::GetTableEnumValues (const int theRow, const int) const
|
||||
{
|
||||
QList<QVariant> aValues;
|
||||
/*switch (theRow)
|
||||
{
|
||||
case 5:
|
||||
{
|
||||
for (int i = 0; i <= Aspect_TOFM_FRONT_SIDE; i++)
|
||||
aValues.append (Aspect::TypeOfFacingModelToString((Aspect_TypeOfFacingModel)i));
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
{
|
||||
for (int i = 0; i <= PrsMgr_TOP_ProjectorDependant; i++)
|
||||
aValues.append (PrsMgr::TypeOfPresentation3dToString ((PrsMgr_TypeOfPresentation3d)i));
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}*/
|
||||
return aValues;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableData
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QVariant VInspector_ItemGraphic3dCView::GetTableData (const int theRow, const int theColumn, const int theRole) const
|
||||
{
|
||||
if (theRole != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
Handle(Graphic3d_CView) aCView = GetCView();
|
||||
if (aCView.IsNull())
|
||||
return QVariant();
|
||||
|
||||
//bool isFirstColumn = theColumn == 0;
|
||||
//switch (theRow)
|
||||
//{
|
||||
// case 0: return isFirstColumn ? QVariant ("LineAspect") : QVariant (ViewControl_Tools::GetPointerInfo (aGroup->LineAspect()).ToCString());
|
||||
// case 1: return isFirstColumn ? QVariant ("FillAreaAspect") : QVariant (ViewControl_Tools::GetPointerInfo (aGroup->FillAreaAspect()).ToCString());
|
||||
// case 2: return isFirstColumn ? QVariant ("TextAspect") : QVariant (ViewControl_Tools::GetPointerInfo (aGroup->TextAspect()).ToCString());
|
||||
// case 3: return isFirstColumn ? QVariant ("MarkerAspect") : QVariant (ViewControl_Tools::GetPointerInfo (aGroup->MarkerAspect()).ToCString());
|
||||
// case 4: return isFirstColumn ? QVariant ("ContainsFacet") : QVariant (aGroup->ContainsFacet());
|
||||
// case 5: return isFirstColumn ? QVariant ("IsDeleted") : QVariant (aGroup->IsDeleted());
|
||||
// case 6: return isFirstColumn ? QVariant ("IsEmpty") : QVariant (aGroup->IsEmpty());
|
||||
// case 7: return isFirstColumn ? QVariant ("IsClosed") : QVariant (aGroup->IsClosed());
|
||||
// case 8:
|
||||
// {
|
||||
// if (isFirstColumn)
|
||||
// return QVariant ("MinMaxValues");
|
||||
// Standard_Real aXMin, anYMin, aZMin, aXMax, anYMax, aZMax;
|
||||
// aGroup->MinMaxValues (aXMin, anYMin, aZMin, aXMax, anYMax, aZMax);
|
||||
// Bnd_Box aBox;
|
||||
// aBox.Update(aXMin, anYMin, aZMin, aXMax, anYMax, aZMax);
|
||||
// return QVariant (ViewControl_Tools::ToString (aBox).ToCString());
|
||||
// }
|
||||
// case 9:
|
||||
// {
|
||||
// if (isFirstColumn)
|
||||
// return QVariant ("BoundingBox");
|
||||
// const Graphic3d_BndBox4f& aBndBox = aGroup->BoundingBox();
|
||||
// Bnd_Box aBox;
|
||||
// aBox.Update((Standard_Real )aBndBox.CornerMin().x(),
|
||||
// (Standard_Real )aBndBox.CornerMin().y(),
|
||||
// (Standard_Real )aBndBox.CornerMin().z(),
|
||||
// (Standard_Real )aBndBox.CornerMax().x(),
|
||||
// (Standard_Real )aBndBox.CornerMax().y(),
|
||||
// (Standard_Real )aBndBox.CornerMax().z());
|
||||
// return QVariant (ViewControl_Tools::ToString (aBox).ToCString());
|
||||
// }
|
||||
//}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetTableData
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool VInspector_ItemGraphic3dCView::SetTableData (const int theRow, const int, const QVariant& theValue)
|
||||
{
|
||||
/*Handle(AIS_InteractiveObject) aPrs = GetInteractiveObject();
|
||||
switch (theRow)
|
||||
{
|
||||
case 4:
|
||||
{
|
||||
double aValue = theValue.toDouble();
|
||||
if (aValue > 0) aPrs->SetWidth (aValue);
|
||||
else aPrs->UnsetWidth();
|
||||
}
|
||||
break;
|
||||
case 5: aPrs->SetCurrentFacingModel (Aspect::TypeOfFacingModelFromString (theValue.toString().toStdString().c_str()));
|
||||
case 6: aPrs->SetInfiniteState (theValue.toBool());
|
||||
case 12: aPrs->SetAutoHilight(theValue.toBool());
|
||||
case 17: aPrs->SetTypeOfPresentation (PrsMgr::TypeOfPresentation3dFromString (theValue.toString().toStdString().c_str()));
|
||||
case 18: aPrs->SetMutable (theValue.toBool());
|
||||
case 22: if (!theValue.toBool()) aPrs->ResetTransformation();
|
||||
default: return false;
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : createChild
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TreeModel_ItemBasePtr VInspector_ItemGraphic3dCView::createChild (int theRow, int theColumn)
|
||||
{
|
||||
if (theRow == 0)
|
||||
return VInspector_ItemGraphic3dCamera::CreateItem (currentItem(), theRow, theColumn);
|
||||
else
|
||||
return VInspector_ItemGraphic3dClipPlane::CreateItem (currentItem(), theRow, theColumn);
|
||||
}
|
124
tools/VInspector/VInspector_ItemGraphic3dCView.hxx
Normal file
124
tools/VInspector/VInspector_ItemGraphic3dCView.hxx
Normal file
@@ -0,0 +1,124 @@
|
||||
// Created on: 2018-08-16
|
||||
// Created by: Natalia ERMOLAEVA
|
||||
// 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.
|
||||
|
||||
#ifndef VInspector_ItemGraphic3dCView_H
|
||||
#define VInspector_ItemGraphic3dCView_H
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <inspector/VInspector_ItemBase.hxx>
|
||||
|
||||
class Graphic3d_CView;
|
||||
|
||||
class VInspector_ItemGraphic3dCView;
|
||||
typedef QExplicitlySharedDataPointer<VInspector_ItemGraphic3dCView> VInspector_ItemGraphic3dCViewPtr;
|
||||
|
||||
//! \class VInspector_ItemGraphic3dCView
|
||||
//! Parent item, that corresponds to AIS_InteractiveContext
|
||||
//! Children of the item are:
|
||||
//! - "Property" item to show context attributes such as selection filters and drawer properties
|
||||
//! - presentation items to show all interactive elements displayed/erased in the context
|
||||
class VInspector_ItemGraphic3dCView : public VInspector_ItemBase
|
||||
{
|
||||
public:
|
||||
|
||||
//! Creates an item wrapped by a shared pointer
|
||||
static VInspector_ItemGraphic3dCViewPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
|
||||
{ return VInspector_ItemGraphic3dCViewPtr (new VInspector_ItemGraphic3dCView (theParent, theRow, theColumn)); }
|
||||
|
||||
//! Destructor
|
||||
virtual ~VInspector_ItemGraphic3dCView() Standard_OVERRIDE {};
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myCView; }
|
||||
|
||||
//! Returns current clip plane, initialize if it was not initialized yet
|
||||
Standard_EXPORT Handle(Graphic3d_CView) GetCView() const
|
||||
{ return Handle(Graphic3d_CView)::DownCast (GetObject()); }
|
||||
|
||||
//! Returns clip plane of the row if possible
|
||||
//! \param theRow child row index
|
||||
Standard_EXPORT Handle(Graphic3d_ClipPlane) GetClipPlane(const int theRow);
|
||||
|
||||
//! Inits the item, fills internal containers
|
||||
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||
|
||||
//! Resets cached values
|
||||
Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
|
||||
|
||||
//! Returns number of table rows
|
||||
//! \return an integer value
|
||||
virtual int GetTableRowCount() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns type of edit control for the model index. By default, it is an empty control
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
//! \return edit type
|
||||
virtual ViewControl_EditType GetTableEditType (const int theRow, const int theColumn) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns container of string values for enumeration in the model row
|
||||
//! \param theRow table model row index
|
||||
//! \param theColumn a model index column
|
||||
//! \return string values for the enumeration presented in the row or an empty container
|
||||
virtual QList<QVariant> GetTableEnumValues (const int theRow, const int theColumn) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns table value for the row in form: <function name> <function value>
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole) const Standard_OVERRIDE;
|
||||
|
||||
//! Sets the value into the table cell. Only 1st column value might be modified.
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
//! \param theValue a new cell value
|
||||
virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! Initialize the current item. It creates a backup of the specific item information
|
||||
//! Do nothing as context has been already set into item
|
||||
virtual void initItem() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns number of displayed presentations
|
||||
//! \return rows count
|
||||
Standard_EXPORT virtual int initRowCount() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns item information for the given role. Fills internal container if it was not filled yet
|
||||
//! \param theItemRole a value role
|
||||
//! \return the value
|
||||
Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! Creates a child item in the given position.
|
||||
//! \param theRow the child row position
|
||||
//! \param theColumn the child column position
|
||||
//! \return the created item
|
||||
virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
//! Constructor
|
||||
//! param theParent a parent item
|
||||
//! \param theRow the item row positition in the parent item
|
||||
//! \param theColumn the item column positition in the parent item
|
||||
VInspector_ItemGraphic3dCView(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
|
||||
: VInspector_ItemBase(theParent, theRow, theColumn) {}
|
||||
|
||||
private:
|
||||
Handle(Graphic3d_CView) myCView; //! current graphical CView
|
||||
};
|
||||
|
||||
#endif
|
330
tools/VInspector/VInspector_ItemGraphic3dCamera.cxx
Normal file
330
tools/VInspector/VInspector_ItemGraphic3dCamera.cxx
Normal file
@@ -0,0 +1,330 @@
|
||||
// Created on: 2018-08-16
|
||||
// Created by: Natalia ERMOLAEVA
|
||||
// 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.
|
||||
|
||||
#include <inspector/VInspector_ItemGraphic3dCamera.hxx>
|
||||
|
||||
#include <inspector/VInspector_ItemGraphic3dCView.hxx>
|
||||
#include <inspector/VInspector_ItemV3dView.hxx>
|
||||
#include <inspector/VInspector_Tools.hxx>
|
||||
|
||||
#include <inspector/ViewControl_Table.hxx>
|
||||
#include <inspector/ViewControl_Tools.hxx>
|
||||
|
||||
#include <AIS.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
#include <Graphic3d.hxx>
|
||||
#include <Graphic3d_Camera.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QStringList>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_ItemGraphic3dCamera::Init()
|
||||
{
|
||||
VInspector_ItemV3dViewPtr aParentItem = itemDynamicCast<VInspector_ItemV3dView>(Parent());
|
||||
if (aParentItem)
|
||||
myCamera = aParentItem->GetView()->DefaultCamera();
|
||||
else
|
||||
{
|
||||
VInspector_ItemGraphic3dCViewPtr aParentItem = itemDynamicCast<VInspector_ItemGraphic3dCView>(Parent());
|
||||
if (aParentItem)
|
||||
myCamera = aParentItem->GetCView()->Camera();
|
||||
}
|
||||
|
||||
UpdatePresentationShape();
|
||||
TreeModel_ItemBase::Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Reset
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_ItemGraphic3dCamera::Reset()
|
||||
{
|
||||
VInspector_ItemBase::Reset();
|
||||
myCamera = NULL;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initItem
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_ItemGraphic3dCamera::initItem() const
|
||||
{
|
||||
if (IsInitialized())
|
||||
return;
|
||||
const_cast<VInspector_ItemGraphic3dCamera*>(this)->Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initRowCount
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
int VInspector_ItemGraphic3dCamera::initRowCount() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initValue
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QVariant VInspector_ItemGraphic3dCamera::initValue (const int theItemRole) const
|
||||
{
|
||||
if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
|
||||
return QVariant();
|
||||
|
||||
Handle(Graphic3d_Camera) aCamera = GetCamera();
|
||||
if (aCamera.IsNull())
|
||||
return Column() == 0 ? "Empty Graphic3d_Camera" : "";
|
||||
|
||||
switch (Column())
|
||||
{
|
||||
case 0: return theItemRole == Qt::DisplayRole ? aCamera->DynamicType()->Name()
|
||||
: STANDARD_TYPE (Graphic3d_Camera)->Name();
|
||||
case 1:
|
||||
return rowCount();
|
||||
case 2:
|
||||
return ViewControl_Tools::GetPointerInfo (aCamera, true).ToCString();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableRowCount
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
int VInspector_ItemGraphic3dCamera::GetTableRowCount() const
|
||||
{
|
||||
return 40;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableEditType
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
ViewControl_EditType VInspector_ItemGraphic3dCamera::GetTableEditType (const int theRow, const int) const
|
||||
{
|
||||
switch (theRow)
|
||||
{
|
||||
//case 0: return ViewControl_EditType_DoubleVec3;
|
||||
//case 1: return ViewControl_EditType_DoubleVec3;
|
||||
//case 2: return ViewControl_EditType_DoubleVec3;
|
||||
//case 3: return ViewControl_EditType_DoubleVec3;
|
||||
case 4: return ViewControl_EditType_Double;
|
||||
case 5: return ViewControl_EditType_Combo;
|
||||
case 6: return ViewControl_EditType_Double;
|
||||
case 7: return ViewControl_EditType_Double;
|
||||
case 8: return ViewControl_EditType_Double;
|
||||
case 9: return ViewControl_EditType_Double;
|
||||
case 10: return ViewControl_EditType_Combo;
|
||||
case 11: return ViewControl_EditType_Combo;
|
||||
case 12: return ViewControl_EditType_Double;
|
||||
// calculated
|
||||
//case 13: return ViewControl_EditType_DoubleVec3;
|
||||
//case 14: return ViewControl_EditType_DoubleVec3;
|
||||
//case 15: return ViewControl_EditType_DoubleVec3;
|
||||
default: return ViewControl_EditType_None;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableEnumValues
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QList<QVariant> VInspector_ItemGraphic3dCamera::GetTableEnumValues (const int theRow, const int) const
|
||||
{
|
||||
QList<QVariant> aValues;
|
||||
switch (theRow)
|
||||
{
|
||||
case 5:
|
||||
{
|
||||
for (int i = 0; i <= Graphic3d_Camera::Projection_MonoRightEye; i++)
|
||||
aValues.append (Graphic3d::CameraProjectionToString((Graphic3d_Camera::Projection)i));
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
{
|
||||
for (int i = 0; i <= Graphic3d_Camera::FocusType_Relative; i++)
|
||||
aValues.append (Graphic3d::CameraFocusTypeToString((Graphic3d_Camera::FocusType)i));
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
{
|
||||
for (int i = 0; i <= Graphic3d_Camera::IODType_Relative; i++)
|
||||
aValues.append (Graphic3d::CameraIODTypeToString((Graphic3d_Camera::IODType)i));
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return aValues;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableData
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QVariant VInspector_ItemGraphic3dCamera::GetTableData (const int theRow, const int theColumn, const int theRole) const
|
||||
{
|
||||
if (theRole != Qt::DisplayRole && theRole != Qt::ToolTipRole)
|
||||
return QVariant();
|
||||
|
||||
Handle(Graphic3d_Camera) aCamera = GetCamera();
|
||||
if (aCamera.IsNull())
|
||||
return QVariant();
|
||||
|
||||
bool isFirstColumn = theColumn == 0;
|
||||
bool isToolTip = theRole == Qt::ToolTipRole;
|
||||
switch (theRow)
|
||||
{
|
||||
case 0: return isFirstColumn ? (!isToolTip ? QVariant("Eye") : QVariant ("Camera Eye position"))
|
||||
: QVariant (ViewControl_Tools::ToString (aCamera->Eye()).ToCString());
|
||||
case 1: return isFirstColumn ? (!isToolTip ? QVariant("Center") : QVariant ("Center of the camera"))
|
||||
: QVariant (ViewControl_Tools::ToString (aCamera->Center()).ToCString());
|
||||
case 2: return isFirstColumn ? (!isToolTip ? QVariant("Up") : QVariant ("Camera Up direction vector, orthogonal to camera direction"))
|
||||
: QVariant (ViewControl_Tools::ToString (aCamera->Up()).ToCString());
|
||||
|
||||
case 3: return isFirstColumn ? (!isToolTip ? QVariant ("AxialScale") : QVariant ("Camera axial scale vector"))
|
||||
: QVariant (ViewControl_Tools::ToString (aCamera->AxialScale()).ToCString());
|
||||
case 4: return isFirstColumn ? (!isToolTip ? QVariant ("Scale") : QVariant ("Camera scale (depend on Projection, see sources doc)"))
|
||||
: ViewControl_Tools::ToVariant (aCamera->Scale());
|
||||
case 5: return isFirstColumn ? (!isToolTip ? QVariant ("ProjectionType") : QVariant ("Camera projection type"))
|
||||
: QVariant (Graphic3d::CameraProjectionToString (aCamera->ProjectionType()));
|
||||
|
||||
case 6: return isFirstColumn ? (!isToolTip ? QVariant ("FOVy") : QVariant ("Field Of View (FOV) in y axis for perspective projection"))
|
||||
: ViewControl_Tools::ToVariant (aCamera->FOVy());
|
||||
case 7: return isFirstColumn ? (!isToolTip ? QVariant ("ZNear") : QVariant ("Near Z-clipping plane position: distance of the plane from the Eye"))
|
||||
: ViewControl_Tools::ToVariant (aCamera->ZNear());
|
||||
case 8: return isFirstColumn ? (!isToolTip ? QVariant ("ZFar") : QVariant ("Far Z-clipping plane position: distance of the plane from the Eye"))
|
||||
: ViewControl_Tools::ToVariant (aCamera->ZFar());
|
||||
case 9: return isFirstColumn ? (!isToolTip ? QVariant ("Aspect") : QVariant ("Camera width / height display ratio"))
|
||||
: ViewControl_Tools::ToVariant (aCamera->Aspect());
|
||||
|
||||
case 10: return isFirstColumn ? (!isToolTip ? QVariant ("ZFocusType") : QVariant ("Type used for stereographic focus"))
|
||||
: QVariant (Graphic3d::CameraFocusTypeToString (aCamera->ZFocusType()));
|
||||
case 11: return isFirstColumn ? (!isToolTip ? QVariant ("ZFocus") : QVariant ("Stereographic focus value"))
|
||||
: ViewControl_Tools::ToVariant (aCamera->ZFocus());
|
||||
|
||||
case 12: return isFirstColumn ? (!isToolTip ? QVariant ("GetIODType") : QVariant ("Intraocular distance definition type"))
|
||||
: QVariant (Graphic3d::CameraIODTypeToString (aCamera->GetIODType()));
|
||||
case 13: return isFirstColumn ? (!isToolTip ? QVariant ("IOD") : QVariant ("Intraocular distance value"))
|
||||
: ViewControl_Tools::ToVariant (aCamera->IOD());
|
||||
|
||||
case 14: return ViewControl_Table::SeparatorData();
|
||||
case 15: return isFirstColumn ? QVariant ("Calculated values:") : QVariant();
|
||||
case 16: return ViewControl_Table::SeparatorData();
|
||||
|
||||
case 17: return isFirstColumn ? (!isToolTip ? QVariant ("Distance") : QVariant ("Distance of Eye from camera Center"))
|
||||
: ViewControl_Tools::ToVariant (aCamera->Distance());
|
||||
case 18: return isFirstColumn ? (!isToolTip ? QVariant ("Direction") : QVariant ("Camera look direction"))
|
||||
: QVariant (ViewControl_Tools::ToString (aCamera->Direction()).ToCString());
|
||||
case 19: return isFirstColumn ? (!isToolTip ? QVariant ("ViewDimensions") : QVariant ("View plane size at center (target) point and distance between ZFar and ZNear planes"))
|
||||
: ViewControl_Tools::ToString (aCamera->ViewDimensions()).ToCString();
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetTableData
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool VInspector_ItemGraphic3dCamera::SetTableData (const int theRow, const int, const QVariant& theValue)
|
||||
{
|
||||
Handle(Graphic3d_Camera) aCamera = GetCamera();
|
||||
if (aCamera.IsNull())
|
||||
return false;
|
||||
|
||||
switch (theRow)
|
||||
{
|
||||
//case 0: return isFirstColumn ? (!isToolTip ? QVariant("Eye") : QVariant ("Camera Eye position"))
|
||||
// : QVariant (ViewControl_Tools::ToString (aCamera->Eye()).ToCString());
|
||||
//case 1: return isFirstColumn ? (!isToolTip ? QVariant("Center") : QVariant ("Center of the camera"))
|
||||
// : QVariant (ViewControl_Tools::ToString (aCamera->Center()).ToCString());
|
||||
//case 2: return isFirstColumn ? (!isToolTip ? QVariant("Up") : QVariant ("Camera Up direction vector, orthogonal to camera direction"))
|
||||
// : QVariant (ViewControl_Tools::ToString (aCamera->Up()).ToCString());
|
||||
//case 3: return isFirstColumn ? (!isToolTip ? QVariant ("AxialScale") : QVariant ("Camera axial scale vector"))
|
||||
// : QVariant (ViewControl_Tools::ToString (aCamera->AxialScale()).ToCString());
|
||||
case 4: aCamera->SetScale (ViewControl_Tools::ToRealValue (theValue)); break;
|
||||
case 5: aCamera->SetProjectionType (Graphic3d::CameraProjectionFromString(theValue.toString().toStdString().c_str())); break;
|
||||
|
||||
case 6: aCamera->SetFOVy (ViewControl_Tools::ToRealValue (theValue)); break;
|
||||
case 7: aCamera->SetZRange (ViewControl_Tools::ToRealValue (theValue), aCamera->ZFar()); break;
|
||||
case 8: aCamera->SetZRange (aCamera->ZNear(), ViewControl_Tools::ToRealValue (theValue)); break;
|
||||
case 9: aCamera->SetAspect (ViewControl_Tools::ToRealValue (theValue)); break;
|
||||
|
||||
case 10: aCamera->SetZFocus (Graphic3d::CameraFocusTypeFromString(theValue.toString().toStdString().c_str()),
|
||||
aCamera->ZFocus()); break;
|
||||
case 11: aCamera->SetZFocus (aCamera->ZFocusType(), ViewControl_Tools::ToRealValue (theValue)); break;
|
||||
|
||||
case 12: aCamera->SetIOD (Graphic3d::CameraIODTypeFromString(theValue.toString().toStdString().c_str()),
|
||||
aCamera->IOD()); break;
|
||||
case 13: aCamera->SetIOD (aCamera->GetIODType(),
|
||||
ViewControl_Tools::ToRealValue (theValue)); break;
|
||||
|
||||
//case 14: return ViewControl_Table::SeparatorData();
|
||||
//case 15: return isFirstColumn ? QVariant ("Calculated values:") : QVariant();
|
||||
//case 16: return ViewControl_Table::SeparatorData();
|
||||
|
||||
case 17: aCamera->SetDistance (ViewControl_Tools::ToRealValue (theValue)); break;
|
||||
//case 18: return isFirstColumn ? (!isToolTip ? QVariant ("Direction") : QVariant ("Camera look direction"))
|
||||
// : QVariant (ViewControl_Tools::ToString (aCamera->Direction()).ToCString());
|
||||
default: return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : buildPresentationShape
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TopoDS_Shape VInspector_ItemGraphic3dCamera::buildPresentationShape (const Handle(Graphic3d_Camera)& theCamera)
|
||||
{
|
||||
if (theCamera.IsNull())
|
||||
return TopoDS_Shape();
|
||||
|
||||
BRep_Builder aBuilder;
|
||||
TopoDS_Compound aCompound;
|
||||
aBuilder.MakeCompound (aCompound);
|
||||
|
||||
const gp_Pnt& aCenter = theCamera->Center ();
|
||||
const gp_Pnt& anEye = theCamera->Eye ();
|
||||
const gp_Dir& anUp = theCamera->Up();
|
||||
const gp_Dir& aCameraDirection = theCamera->Direction();
|
||||
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (aCenter));
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (anEye));
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Lin (anEye, anUp)));
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Lin (anEye, aCameraDirection)));
|
||||
|
||||
return aCompound;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : createChild
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TreeModel_ItemBasePtr VInspector_ItemGraphic3dCamera::createChild (int, int)
|
||||
{
|
||||
return TreeModel_ItemBasePtr();
|
||||
}
|
128
tools/VInspector/VInspector_ItemGraphic3dCamera.hxx
Normal file
128
tools/VInspector/VInspector_ItemGraphic3dCamera.hxx
Normal file
@@ -0,0 +1,128 @@
|
||||
// Created on: 2018-08-16
|
||||
// Created by: Natalia ERMOLAEVA
|
||||
// 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.
|
||||
|
||||
#ifndef VInspector_ItemGraphic3dCamera_H
|
||||
#define VInspector_ItemGraphic3dCamera_H
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <inspector/VInspector_ItemBase.hxx>
|
||||
|
||||
class Graphic3d_Camera;
|
||||
|
||||
class VInspector_ItemGraphic3dCamera;
|
||||
typedef QExplicitlySharedDataPointer<VInspector_ItemGraphic3dCamera> VInspector_ItemGraphic3dCameraPtr;
|
||||
|
||||
//! \class VInspector_ItemGraphic3dCamera
|
||||
//! Parent item, that corresponds to AIS_InteractiveContext
|
||||
//! Children of the item are:
|
||||
//! - "Property" item to show context attributes such as selection filters and drawer properties
|
||||
//! - presentation items to show all interactive elements displayed/erased in the context
|
||||
class VInspector_ItemGraphic3dCamera : public VInspector_ItemBase
|
||||
{
|
||||
public:
|
||||
|
||||
//! Creates an item wrapped by a shared pointer
|
||||
static VInspector_ItemGraphic3dCameraPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
|
||||
{ return VInspector_ItemGraphic3dCameraPtr (new VInspector_ItemGraphic3dCamera (theParent, theRow, theColumn)); }
|
||||
|
||||
//! Destructor
|
||||
virtual ~VInspector_ItemGraphic3dCamera() Standard_OVERRIDE {};
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myCamera; }
|
||||
|
||||
//! Returns the current graphic3d camera, init item if it was not initialized yet
|
||||
//! \return graphic camera
|
||||
Standard_EXPORT Handle(Graphic3d_Camera) GetCamera() const { return Handle(Graphic3d_Camera)::DownCast (GetObject()); }
|
||||
|
||||
//! Inits the item, fills internal containers
|
||||
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||
|
||||
//! Resets cached values
|
||||
Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
|
||||
|
||||
//! Returns number of table rows
|
||||
//! \return an integer value
|
||||
virtual int GetTableRowCount() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns type of edit control for the model index. By default, it is an empty control
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
//! \return edit type
|
||||
virtual ViewControl_EditType GetTableEditType (const int theRow, const int theColumn) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns container of string values for enumeration in the model row
|
||||
//! \param theRow table model row index
|
||||
//! \param theColumn a model index column
|
||||
//! \return string values for the enumeration presented in the row or an empty container
|
||||
virtual QList<QVariant> GetTableEnumValues (const int theRow, const int theColumn) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns table value for the row in form: <function name> <function value>
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole) const Standard_OVERRIDE;
|
||||
|
||||
//! Sets the value into the table cell. Only 1st column value might be modified.
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
//! \param theValue a new cell value
|
||||
virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
//! Build presentation shape
|
||||
//! \return generated shape of the item parameters
|
||||
virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE { return buildPresentationShape (myCamera); }
|
||||
|
||||
//! Creates shape for the 3d view parameters
|
||||
//! \param theView current view
|
||||
//! \return shape or NULL
|
||||
static TopoDS_Shape buildPresentationShape (const Handle(Graphic3d_Camera)& theView);
|
||||
|
||||
//! Initialize the current item. It creates a backup of the specific item information
|
||||
//! Do nothing as context has been already set into item
|
||||
virtual void initItem() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns number of displayed presentations
|
||||
//! \return rows count
|
||||
Standard_EXPORT virtual int initRowCount() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns item information for the given role. Fills internal container if it was not filled yet
|
||||
//! \param theItemRole a value role
|
||||
//! \return the value
|
||||
Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! Creates a child item in the given position.
|
||||
//! \param theRow the child row position
|
||||
//! \param theColumn the child column position
|
||||
//! \return the created item
|
||||
virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
//! Constructor
|
||||
//! param theParent a parent item
|
||||
//! \param theRow the item row positition in the parent item
|
||||
//! \param theColumn the item column positition in the parent item
|
||||
VInspector_ItemGraphic3dCamera(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
|
||||
: VInspector_ItemBase(theParent, theRow, theColumn) {}
|
||||
|
||||
private:
|
||||
Handle(Graphic3d_Camera) myCamera; //! current graphic group
|
||||
};
|
||||
|
||||
#endif
|
@@ -71,14 +71,14 @@ QVariant VInspector_ItemGraphic3dClipPlane::initValue (const int theItemRole) co
|
||||
|
||||
void VInspector_ItemGraphic3dClipPlane::Init()
|
||||
{
|
||||
VInspector_ItemV3dViewPtr aParentViewItem = itemDynamicCast<VInspector_ItemV3dView>(Parent());
|
||||
Handle(Graphic3d_ClipPlane) aClipPlane;
|
||||
if (!aParentViewItem) // ClipPlanes
|
||||
{
|
||||
aParentViewItem = itemDynamicCast<VInspector_ItemV3dView>(Parent()->Parent());
|
||||
aClipPlane = aParentViewItem->GetClipPlane(Row());
|
||||
}
|
||||
setClipPlane (aClipPlane);
|
||||
//VInspector_ItemV3dViewPtr aParentViewItem = itemDynamicCast<VInspector_ItemV3dView>(Parent());
|
||||
//Handle(Graphic3d_ClipPlane) aClipPlane;
|
||||
//if (!aParentViewItem) // ClipPlanes
|
||||
//{
|
||||
// aParentViewItem = itemDynamicCast<VInspector_ItemV3dView>(Parent()->Parent());
|
||||
// aClipPlane = aParentViewItem->GetClipPlane(Row());
|
||||
//}
|
||||
//setClipPlane (aClipPlane);
|
||||
TreeModel_ItemBase::Init();
|
||||
}
|
||||
|
||||
@@ -106,17 +106,6 @@ void VInspector_ItemGraphic3dClipPlane::initItem() const
|
||||
const_cast<VInspector_ItemGraphic3dClipPlane*>(this)->Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetView
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
Handle(Graphic3d_ClipPlane) VInspector_ItemGraphic3dClipPlane::GetClipPlane() const
|
||||
{
|
||||
initItem();
|
||||
return myClipPlane;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableRowCount
|
||||
// purpose :
|
||||
|
@@ -46,8 +46,13 @@ public:
|
||||
//! Resets cached values
|
||||
Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myClipPlane; }
|
||||
|
||||
//! Returns current clip plane, initialize if it was not initialized yet
|
||||
Standard_EXPORT Handle(Graphic3d_ClipPlane) GetClipPlane() const;
|
||||
Standard_EXPORT Handle(Graphic3d_ClipPlane) GetClipPlane() const
|
||||
{ return Handle(Graphic3d_ClipPlane)::DownCast (GetObject()); }
|
||||
|
||||
protected:
|
||||
//! Initialize the current item. It is empty because Reset() is also empty.
|
||||
|
@@ -27,16 +27,6 @@
|
||||
#include <QStringList>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : GetGroup
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Graphic3d_Group) VInspector_ItemGraphic3dGroup::GetGroup() const
|
||||
{
|
||||
initItem();
|
||||
return myGroup;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
|
@@ -41,9 +41,14 @@ public:
|
||||
//! Destructor
|
||||
virtual ~VInspector_ItemGraphic3dGroup() Standard_OVERRIDE {};
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myGroup; }
|
||||
|
||||
//! Returns the current graphic3d group, init item if it was not initialized yet
|
||||
//! \return graphic group
|
||||
Standard_EXPORT Handle(Graphic3d_Group) GetGroup() const;
|
||||
Standard_EXPORT Handle(Graphic3d_Group) GetGroup() const
|
||||
{ return Handle(Graphic3d_Group)::DownCast (GetObject()); }
|
||||
|
||||
//! Inits the item, fills internal containers
|
||||
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||
|
@@ -30,16 +30,6 @@
|
||||
#include <QStringList>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTransformPers
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Graphic3d_TransformPers) VInspector_ItemGraphic3dTransformPers::GetTransformPers() const
|
||||
{
|
||||
initItem();
|
||||
return myTransformPers;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
|
@@ -40,9 +40,14 @@ public:
|
||||
//! Destructor
|
||||
virtual ~VInspector_ItemGraphic3dTransformPers() Standard_OVERRIDE {};
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myTransformPers; }
|
||||
|
||||
//! Returns the current C structure, init item if it was not initialized yet
|
||||
//! \return graphic C structure object
|
||||
Standard_EXPORT Handle(Graphic3d_TransformPers) GetTransformPers() const;
|
||||
Standard_EXPORT Handle(Graphic3d_TransformPers) GetTransformPers() const
|
||||
{ return Handle(Graphic3d_TransformPers)::DownCast (GetObject()); }
|
||||
|
||||
//! Inits the item, fills internal containers
|
||||
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||
|
@@ -32,9 +32,9 @@ QVariant VInspector_ItemHistoryElement::initValue(const int theRole) const
|
||||
switch (Column())
|
||||
{
|
||||
case 0: return getName();
|
||||
case 1: return QVariant();
|
||||
case 2: return GetPointerInfo();
|
||||
case 3: return GetShapeTypeInfo();
|
||||
case 2: return QVariant();
|
||||
case 3: return GetPointerInfo();
|
||||
case 4: return GetShapeTypeInfo();
|
||||
default: break;
|
||||
}
|
||||
return QVariant();
|
||||
|
@@ -64,6 +64,11 @@ void VInspector_ItemHistoryRoot::AddElement (const VInspector_CallBackMode& theM
|
||||
const VInspector_ItemHistoryTypeInfo& VInspector_ItemHistoryRoot::GetTypeInfo (const int theChildRowIndex)
|
||||
{
|
||||
int anInfoMapIndex = theChildRowIndex + myFirstIndex;
|
||||
|
||||
bool aReversed = true;
|
||||
if (aReversed)
|
||||
anInfoMapIndex = (myInfoMap.size() - myFirstIndex) - 1 - anInfoMapIndex;
|
||||
|
||||
return myInfoMap[anInfoMapIndex];
|
||||
}
|
||||
|
||||
@@ -79,7 +84,7 @@ QVariant VInspector_ItemHistoryRoot::initValue (const int theRole) const
|
||||
switch (Column())
|
||||
{
|
||||
case 0: return "History";
|
||||
case 1: return theRole == Qt::ToolTipRole ? QVariant ("Count of children") : QVariant (rowCount());
|
||||
case 2: return theRole == Qt::ToolTipRole ? QVariant ("Count of children") : QVariant (rowCount());
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@@ -61,16 +61,17 @@ QVariant VInspector_ItemHistoryType::initValue(const int theRole) const
|
||||
|
||||
VInspector_ItemHistoryRootPtr aParentItem = itemDynamicCast<VInspector_ItemHistoryRoot>(Parent());
|
||||
const VInspector_ItemHistoryTypeInfo& aTypeInfo = aParentItem->GetTypeInfo(Row());
|
||||
int aRowCount = rowCount();
|
||||
QList<QVariant> anElements = rowCount() > 0 ? aTypeInfo.myElements[rowCount() - 1] : QList<QVariant>(); // the last item
|
||||
int anInfoSize = anElements.size();
|
||||
switch (Column())
|
||||
{
|
||||
case 0: return VInspector_CallBack::GetInfo(aTypeInfo.myMode);
|
||||
case 1: return rowCount();
|
||||
case 2: return anInfoSize > 1 ? anElements[1].toString() : QVariant(); // pointer info
|
||||
case 3: return anInfoSize > 2 ? anElements[2].toString() : QVariant(); // shape type
|
||||
case 4: return anInfoSize > 0 ? anElements[0].toString() : QVariant(); // AIS name
|
||||
case 5: return anInfoSize > 3 ? anElements[3].toString() : QVariant(); // owner info
|
||||
case 3: return rowCount();
|
||||
case 4: return anInfoSize > 1 ? anElements[1].toString() : QVariant(); // pointer info
|
||||
case 5: return anInfoSize > 2 ? anElements[2].toString() : QVariant(); // shape type
|
||||
case 6: return anInfoSize > 0 ? anElements[0].toString() : QVariant(); // AIS name
|
||||
case 7: return anInfoSize > 3 ? anElements[3].toString() : QVariant(); // owner info
|
||||
default: break;
|
||||
}
|
||||
return QVariant();
|
||||
|
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <inspector/VInspector_ItemPresentableObject.hxx>
|
||||
|
||||
#include <AIS.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <AIS_ListOfInteractive.hxx>
|
||||
#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
||||
@@ -25,11 +26,14 @@
|
||||
#include <inspector/VInspector_ItemFolderObject.hxx>
|
||||
#include <inspector/VInspector_ItemPresentations.hxx>
|
||||
#include <inspector/VInspector_ItemSelectMgrSelection.hxx>
|
||||
#include <inspector/ViewControl_Table.hxx>
|
||||
#include <inspector/ViewControl_Tools.hxx>
|
||||
#include <inspector/VInspector_Tools.hxx>
|
||||
#include <inspector/VInspector_ViewModel.hxx>
|
||||
|
||||
#include <inspector/ViewControl_ColorSelector.hxx>
|
||||
#include <inspector/ViewControl_Table.hxx>
|
||||
#include <inspector/ViewControl_Tools.hxx>
|
||||
|
||||
#include <Graphic3d.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
#include <Prs3d.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
@@ -49,16 +53,6 @@
|
||||
// =======================================================================
|
||||
QVariant VInspector_ItemPresentableObject::initValue (int theItemRole) const
|
||||
{
|
||||
if (Column() == 20 && theItemRole == Qt::BackgroundRole) {
|
||||
Handle(AIS_InteractiveObject) anIO = GetInteractiveObject();
|
||||
if (!anIO.IsNull() && anIO->HasColor())
|
||||
{
|
||||
Quantity_Color aColor;
|
||||
anIO->Color(aColor);
|
||||
return QColor ((int)(aColor.Red()*255.), (int)(aColor.Green()*255.), (int)(aColor.Blue()*255.));
|
||||
}
|
||||
}
|
||||
|
||||
if (theItemRole == Qt::DisplayRole || theItemRole == Qt::ToolTipRole)
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anIO = GetInteractiveObject();
|
||||
@@ -82,37 +76,11 @@ QVariant VInspector_ItemPresentableObject::initValue (int theItemRole) const
|
||||
return VInspector_Tools::GetPointerInfo (anIO, true).ToCString();
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
Handle(AIS_Shape) aShapeIO = Handle(AIS_Shape)::DownCast (anIO);
|
||||
if (!aShapeIO.IsNull())
|
||||
{
|
||||
const TopoDS_Shape& aShape = aShapeIO->Shape();
|
||||
if (!aShape.IsNull())
|
||||
return VInspector_Tools::GetShapeTypeInfo (aShape.ShapeType()).ToCString();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
int aNbSelected = VInspector_Tools::SelectedOwners (GetContext(), anIO, false);
|
||||
return aNbSelected > 0 ? QString::number (aNbSelected) : "";
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
TColStd_ListOfInteger aModes;
|
||||
Handle(AIS_InteractiveContext) aContext = GetContext();
|
||||
aContext->ActivatedModes(anIO, aModes);
|
||||
TCollection_AsciiString aModesInfo;
|
||||
for (TColStd_ListIteratorOfListOfInteger itr (aModes); itr.More(); itr.Next())
|
||||
{
|
||||
if (!aModesInfo.IsEmpty())
|
||||
aModesInfo += ", ";
|
||||
aModesInfo += VInspector_Tools::GetShapeTypeInfo (AIS_Shape::SelectionType(itr.Value()));
|
||||
}
|
||||
return aModesInfo.ToCString();
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
double aDeviationCoefficient = 0;
|
||||
@@ -124,18 +92,6 @@ QVariant VInspector_ItemPresentableObject::initValue (int theItemRole) const
|
||||
}
|
||||
return QString::number(aDeviationCoefficient);
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
double aShapeDeflection = 0;
|
||||
Handle(AIS_Shape) aShapeIO = Handle(AIS_Shape)::DownCast (anIO);
|
||||
if (!aShapeIO.IsNull())
|
||||
{
|
||||
const TopoDS_Shape& aShape = aShapeIO->Shape();
|
||||
if (!aShape.IsNull())
|
||||
aShapeDeflection = Prs3d::GetDeflection(aShape, anIO->Attributes());
|
||||
}
|
||||
return QString::number (aShapeDeflection);
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
double aDeviationCoefficient = 0;
|
||||
@@ -149,21 +105,6 @@ QVariant VInspector_ItemPresentableObject::initValue (int theItemRole) const
|
||||
bool anIsAutoTriangulation = aNullIO ? false : anIO->Attributes()->IsAutoTriangulation();
|
||||
return anIsAutoTriangulation ? QString ("true") : QString ("false");
|
||||
}
|
||||
case 17:
|
||||
case 18:
|
||||
case 19:
|
||||
{
|
||||
Handle(AIS_Shape) aShapeIO = Handle(AIS_Shape)::DownCast (anIO);
|
||||
if (aShapeIO.IsNull())
|
||||
return QVariant();
|
||||
const TopoDS_Shape& aShape = aShapeIO->Shape();
|
||||
if (aShape.IsNull())
|
||||
return QVariant();
|
||||
|
||||
return Column() == 17 ? VInspector_Tools::GetPointerInfo (aShape.TShape(), true).ToCString()
|
||||
: Column() == 18 ? VInspector_Tools::OrientationToName (aShape.Orientation()).ToCString()
|
||||
: /*19*/ ViewControl_Tools::ToString (aShape.Location()).ToCString();
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
@@ -263,11 +204,7 @@ void VInspector_ItemPresentableObject::Init()
|
||||
}
|
||||
|
||||
setInteractiveObject (anIO);
|
||||
|
||||
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (anIO);
|
||||
if (!aShape.IsNull())
|
||||
myPresentationShape = aShape->Shape();
|
||||
|
||||
UpdatePresentationShape();
|
||||
TreeModel_ItemBase::Init(); // to use getIO() without circling initialization
|
||||
}
|
||||
|
||||
@@ -295,13 +232,20 @@ void VInspector_ItemPresentableObject::initItem() const
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetInteractiveObject
|
||||
// function : buildPresentationShape
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(AIS_InteractiveObject) VInspector_ItemPresentableObject::GetInteractiveObject() const
|
||||
TopoDS_Shape VInspector_ItemPresentableObject::buildPresentationShape()
|
||||
{
|
||||
initItem();
|
||||
return myIO;
|
||||
Handle(AIS_InteractiveObject) aPrs = myIO;
|
||||
if (aPrs.IsNull())
|
||||
return TopoDS_Shape();
|
||||
|
||||
Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast (aPrs);
|
||||
if (!aShapePrs.IsNull())
|
||||
return aShapePrs->Shape();
|
||||
|
||||
return TopoDS_Shape();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -331,7 +275,7 @@ void VInspector_ItemPresentableObject::GetPresentations (NCollection_List<Handle
|
||||
// =======================================================================
|
||||
int VInspector_ItemPresentableObject::GetTableRowCount() const
|
||||
{
|
||||
return 23;
|
||||
return 36;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -342,13 +286,18 @@ ViewControl_EditType VInspector_ItemPresentableObject::GetTableEditType (const i
|
||||
{
|
||||
switch (theRow)
|
||||
{
|
||||
case 4: return ViewControl_EditType_Line;
|
||||
case 5: return ViewControl_EditType_Combo;
|
||||
case 6: return ViewControl_EditType_Bool;
|
||||
case 12: return ViewControl_EditType_Bool;
|
||||
case 3: return ViewControl_EditType_Combo;
|
||||
case 6: return ViewControl_EditType_Combo;
|
||||
case 8: return ViewControl_EditType_Bool;
|
||||
case 13: return ViewControl_EditType_Color;
|
||||
case 15: return ViewControl_EditType_Line;
|
||||
case 17: return ViewControl_EditType_Combo;
|
||||
case 18: return ViewControl_EditType_Bool;
|
||||
case 22: return ViewControl_EditType_Bool;
|
||||
case 18: return ViewControl_EditType_Line;
|
||||
|
||||
case 29: return ViewControl_EditType_Combo;
|
||||
case 30: return ViewControl_EditType_Bool;
|
||||
case 32: return ViewControl_EditType_Combo;
|
||||
case 35: return ViewControl_EditType_Bool;
|
||||
default: return ViewControl_EditType_None;
|
||||
}
|
||||
}
|
||||
@@ -362,18 +311,40 @@ QList<QVariant> VInspector_ItemPresentableObject::GetTableEnumValues (const int
|
||||
QList<QVariant> aValues;
|
||||
switch (theRow)
|
||||
{
|
||||
case 5:
|
||||
case 3:
|
||||
{
|
||||
for (int i = 0; i <= AIS_KOI_Dimension; i++)
|
||||
aValues.append (AIS::KindOfInteractiveToString((AIS_KindOfInteractive)i));
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
{
|
||||
for (int i = 0; i <= Aspect_TOFM_FRONT_SIDE; i++)
|
||||
aValues.append (Aspect::TypeOfFacingModelToString((Aspect_TypeOfFacingModel)i));
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
{
|
||||
for (int i = 0; i <= Graphic3d_NOM_UserDefined; i++)
|
||||
aValues.append (Graphic3d::NameOfMaterialToString ((Graphic3d_NameOfMaterial)i));
|
||||
}
|
||||
break;
|
||||
case 29:
|
||||
{
|
||||
for (int i = 0; i <= PrsMgr_TOP_ProjectorDependant; i++)
|
||||
aValues.append (PrsMgr::TypeOfPresentation3dToString ((PrsMgr_TypeOfPresentation3d)i));
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
{
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_UNKNOWN));
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_Default));
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_Top));
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_Topmost));
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_TopOSD));
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_BotOSD));
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return aValues;
|
||||
@@ -385,10 +356,10 @@ QList<QVariant> VInspector_ItemPresentableObject::GetTableEnumValues (const int
|
||||
// =======================================================================
|
||||
QVariant VInspector_ItemPresentableObject::GetTableData (const int theRow, const int theColumn, const int theRole) const
|
||||
{
|
||||
if (theRole != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
bool isFirstColumn = theColumn == 0;
|
||||
if (theRole != Qt::DisplayRole && theRole != Qt::BackgroundRole ||
|
||||
(theRole == Qt::BackgroundRole && (isFirstColumn || theRow != 13)))
|
||||
return QVariant();
|
||||
|
||||
Handle(AIS_InteractiveObject) aPrs = GetInteractiveObject();
|
||||
switch (theRow)
|
||||
@@ -397,39 +368,76 @@ QVariant VInspector_ItemPresentableObject::GetTableData (const int theRow, const
|
||||
case 1: return isFirstColumn ? QVariant (STANDARD_TYPE (AIS_InteractiveObject)->Name())
|
||||
: ViewControl_Tools::GetPointerInfo (aPrs).ToCString();
|
||||
case 2: return ViewControl_Table::SeparatorData();
|
||||
case 3: return isFirstColumn ? QVariant ("HasWidth") : QVariant (aPrs->HasWidth());
|
||||
case 4: return isFirstColumn ? QVariant ("Width") : QVariant (aPrs->Width());
|
||||
case 5: return isFirstColumn ? QVariant ("CurrentFacingModel")
|
||||
case 3: return isFirstColumn ? QVariant("Type")
|
||||
: QVariant (AIS::KindOfInteractiveToString (aPrs->Type()));
|
||||
case 4: return isFirstColumn ? QVariant("Signature") : QVariant (aPrs->Signature());
|
||||
|
||||
case 5: return isFirstColumn ? QVariant("AcceptShapeDecomposition") : QVariant (aPrs->AcceptShapeDecomposition());
|
||||
case 6: return isFirstColumn ? QVariant ("CurrentFacingModel")
|
||||
: QVariant (Aspect::TypeOfFacingModelToString (aPrs->CurrentFacingModel()));
|
||||
case 6: return isFirstColumn ? QVariant ("IsInfinite") : QVariant (aPrs->IsInfinite());
|
||||
case 7: return isFirstColumn ? QVariant ("HasColor") : QVariant (aPrs->HasColor());
|
||||
case 8: return isFirstColumn ? QVariant ("HasMaterial") : QVariant (aPrs->HasMaterial());
|
||||
case 7: return isFirstColumn ? QVariant ("DefaultDisplayMode") : QVariant (aPrs->DefaultDisplayMode());
|
||||
case 8: return isFirstColumn ? QVariant ("IsInfinite") : QVariant (aPrs->IsInfinite());
|
||||
case 9: return isFirstColumn ? QVariant ("Owner")
|
||||
: (aPrs->GetOwner().IsNull() ? QVariant("") : ViewControl_Tools::GetPointerInfo (aPrs).ToCString());
|
||||
case 10: return isFirstColumn ? QVariant ("DisplayMode") : QVariant (aPrs->DisplayMode());
|
||||
case 11: return isFirstColumn ? QVariant ("HilightMode") : QVariant (aPrs->HilightMode());
|
||||
|
||||
case 9: return ViewControl_Table::SeparatorData();
|
||||
case 10: return isFirstColumn ? QVariant (STANDARD_TYPE (SelectMgr_SelectableObject)->Name())
|
||||
case 12: return isFirstColumn ? QVariant ("HasColor") : QVariant (aPrs->HasColor());
|
||||
case 13:
|
||||
{
|
||||
if (isFirstColumn)
|
||||
return QVariant ("Color");
|
||||
Quantity_Color aColor;
|
||||
aPrs->Color(aColor);
|
||||
return ViewControl_ColorSelector::ColorToQColor (aColor);
|
||||
}
|
||||
case 14: return isFirstColumn ? QVariant ("HasWidth") : QVariant (aPrs->HasWidth());
|
||||
case 15: return isFirstColumn ? QVariant ("Width") : QVariant (aPrs->Width());
|
||||
case 16: return isFirstColumn ? QVariant ("HasMaterial") : QVariant (aPrs->HasMaterial());
|
||||
case 17: return isFirstColumn ? QVariant ("Material")
|
||||
: QVariant (Graphic3d::NameOfMaterialToString (aPrs->Material()));
|
||||
case 18: return isFirstColumn ? QVariant ("Transparency") : QVariant (aPrs->Transparency());
|
||||
case 19:
|
||||
{
|
||||
if (isFirstColumn)
|
||||
return QVariant ("PolygonOffsets");
|
||||
Standard_Integer aMode;
|
||||
Standard_ShortReal aFactor, aUnits;
|
||||
aPrs->PolygonOffsets (aMode, aFactor, aUnits);
|
||||
return QString("Mode: %1, Factor: %2, Units: %3").arg (aMode).arg (aFactor).arg (aUnits);
|
||||
}
|
||||
case 20: return ViewControl_Table::SeparatorData();
|
||||
case 21: return isFirstColumn ? QVariant (STANDARD_TYPE (SelectMgr_SelectableObject)->Name())
|
||||
: ViewControl_Tools::GetPointerInfo (aPrs).ToCString();
|
||||
case 11: return ViewControl_Table::SeparatorData();
|
||||
case 12: return isFirstColumn ? QVariant ("IsAutoHilight") : QVariant (aPrs->IsAutoHilight());
|
||||
case 13: return isFirstColumn ? QVariant ("GlobalSelectionMode") : QVariant (aPrs->GlobalSelectionMode());
|
||||
|
||||
case 14: return ViewControl_Table::SeparatorData();
|
||||
case 15: return isFirstColumn ? QVariant (STANDARD_TYPE (PrsMgr_PresentableObject)->Name())
|
||||
case 22: return ViewControl_Table::SeparatorData();
|
||||
case 23: return isFirstColumn ? QVariant ("IsAutoHilight") : QVariant (aPrs->IsAutoHilight());
|
||||
case 24: return isFirstColumn ? QVariant ("GlobalSelectionMode") : QVariant (aPrs->GlobalSelectionMode());
|
||||
case 25:
|
||||
{
|
||||
if (isFirstColumn)
|
||||
return QVariant ("BoundingBox");
|
||||
Bnd_Box aBndBox;
|
||||
aPrs->BoundingBox (aBndBox);
|
||||
return ViewControl_Tools::ToString (aBndBox).ToCString();
|
||||
}
|
||||
case 26: return ViewControl_Table::SeparatorData();
|
||||
case 27: return isFirstColumn ? QVariant (STANDARD_TYPE (PrsMgr_PresentableObject)->Name())
|
||||
: ViewControl_Tools::GetPointerInfo (aPrs).ToCString();
|
||||
case 16: return ViewControl_Table::SeparatorData();
|
||||
case 17: return isFirstColumn ? QVariant ("TypeOfPresentation3d")
|
||||
case 28: return ViewControl_Table::SeparatorData();
|
||||
case 29: return isFirstColumn ? QVariant ("TypeOfPresentation3d")
|
||||
: QVariant (PrsMgr::TypeOfPresentation3dToString (aPrs->TypeOfPresentation3d()));
|
||||
case 18: return isFirstColumn ? QVariant ("IsMutable") : QVariant (aPrs->IsMutable());
|
||||
case 19: return isFirstColumn ? QVariant ("HasOwnPresentations") : QVariant (aPrs->HasOwnPresentations());
|
||||
case 20: return isFirstColumn ? QVariant ("TransformationGeom")
|
||||
case 30: return isFirstColumn ? QVariant ("IsMutable") : QVariant (aPrs->IsMutable());
|
||||
case 31: return isFirstColumn ? QVariant ("HasOwnPresentations") : QVariant (aPrs->HasOwnPresentations());
|
||||
case 32: return isFirstColumn ? QVariant ("ZLayer") : QVariant (Graphic3d::ZLayerIdToString (aPrs->ZLayer()));
|
||||
case 33: return isFirstColumn ? QVariant ("TransformationGeom")
|
||||
: (!aPrs->TransformationGeom().IsNull()
|
||||
? QVariant (ViewControl_Tools::ToString(aPrs->TransformationGeom()->Trsf()).ToCString()) : QVariant());
|
||||
case 21: return isFirstColumn ? QVariant ("LocalTransformationGeom")
|
||||
case 34: return isFirstColumn ? QVariant ("LocalTransformationGeom")
|
||||
: (!aPrs->LocalTransformationGeom().IsNull()
|
||||
? QVariant (ViewControl_Tools::ToString(aPrs->LocalTransformationGeom()->Trsf()).ToCString()) : QVariant());
|
||||
case 22: return isFirstColumn ? QVariant ("ResetTransformation") : (!aPrs->LocalTransformationGeom().IsNull());
|
||||
case 35: return isFirstColumn ? QVariant ("ResetTransformation") : (!aPrs->LocalTransformationGeom().IsNull());
|
||||
default: return QVariant();
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -441,19 +449,34 @@ bool VInspector_ItemPresentableObject::SetTableData (const int theRow, const int
|
||||
Handle(AIS_InteractiveObject) aPrs = GetInteractiveObject();
|
||||
switch (theRow)
|
||||
{
|
||||
case 4:
|
||||
case 6: aPrs->SetCurrentFacingModel (Aspect::TypeOfFacingModelFromString (theValue.toString().toStdString().c_str())); break;
|
||||
case 8: aPrs->SetInfiniteState (theValue.toBool()); break;
|
||||
case 15:
|
||||
{
|
||||
double aValue = theValue.toDouble();
|
||||
if (aValue > 0) aPrs->SetWidth (aValue);
|
||||
else aPrs->UnsetWidth();
|
||||
}
|
||||
break;
|
||||
case 5: aPrs->SetCurrentFacingModel (Aspect::TypeOfFacingModelFromString (theValue.toString().toStdString().c_str()));
|
||||
case 6: aPrs->SetInfiniteState (theValue.toBool());
|
||||
case 12: aPrs->SetAutoHilight(theValue.toBool());
|
||||
case 17: aPrs->SetTypeOfPresentation (PrsMgr::TypeOfPresentation3dFromString (theValue.toString().toStdString().c_str()));
|
||||
case 18: aPrs->SetMutable (theValue.toBool());
|
||||
case 22: if (!theValue.toBool()) aPrs->ResetTransformation();
|
||||
case 13:
|
||||
{
|
||||
float anAlpha;
|
||||
aPrs->SetColor (ViewControl_ColorSelector::StringToColor (theValue.toString(), anAlpha));
|
||||
}
|
||||
break;
|
||||
case 17: aPrs->SetMaterial (Graphic3d::NameOfMaterialFromString (theValue.toString().toStdString().c_str())); break;
|
||||
case 18:
|
||||
{
|
||||
double aValue = theValue.toDouble();
|
||||
if (aValue > 0 && aValue < 1)
|
||||
aPrs->SetTransparency(theValue.toDouble());
|
||||
}
|
||||
break;
|
||||
case 23: aPrs->SetAutoHilight(theValue.toBool()); break;
|
||||
case 29: aPrs->SetTypeOfPresentation (PrsMgr::TypeOfPresentation3dFromString (theValue.toString().toStdString().c_str())); break;
|
||||
case 30: aPrs->SetMutable (theValue.toBool()); break;
|
||||
case 32: aPrs->SetZLayer (Graphic3d::ZLayerIdFromString (theValue.toString().toStdString().c_str())); break;
|
||||
case 35: if (!theValue.toBool()) aPrs->ResetTransformation(); break;
|
||||
default: return false;
|
||||
}
|
||||
return true;
|
||||
|
@@ -41,9 +41,14 @@ public:
|
||||
//! Destructor
|
||||
virtual ~VInspector_ItemPresentableObject() Standard_OVERRIDE {};
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myIO; }
|
||||
|
||||
//! Returns the current interactive object, init item if it was not initialized yet
|
||||
//! \return interactive object
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) GetInteractiveObject() const;
|
||||
Standard_EXPORT Handle(AIS_InteractiveObject) GetInteractiveObject() const
|
||||
{ return Handle(AIS_InteractiveObject)::DownCast (GetObject()); }
|
||||
|
||||
//! Returns pointer information for the current interactive object, init item if it was not initialized yet
|
||||
//! \return string value
|
||||
@@ -106,7 +111,10 @@ protected:
|
||||
//! \return the created item
|
||||
virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
protected:
|
||||
//! Build presentation shape
|
||||
//! \return generated shape of the item parameters
|
||||
virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE;
|
||||
|
||||
//! Set interactive object into the current field
|
||||
//! \param theIO a presentation
|
||||
|
@@ -49,10 +49,10 @@ int VInspector_ItemPresentations::initRowCount() const
|
||||
Handle(AIS_InteractiveObject) aPresentation = aParentPrsItem->GetInteractiveObject();
|
||||
|
||||
int aNbProperties = 0;
|
||||
if (!aPresentation->GetSelectPresentation (NULL).IsNull())
|
||||
if (!aPresentation->GetSelectPresentation (GetContext()->MainPrsMgr()).IsNull())
|
||||
aNbProperties++;
|
||||
|
||||
if (!aPresentation->GetHilightPresentation (NULL).IsNull())
|
||||
if (!aPresentation->GetHilightPresentation (GetContext()->MainPrsMgr()).IsNull())
|
||||
aNbProperties++;
|
||||
|
||||
for (PrsMgr_Presentations::Iterator aPrsIter (aPresentation->Presentations()); aPrsIter.More(); aPrsIter.Next())
|
||||
|
@@ -182,17 +182,6 @@ void VInspector_ItemPrs3dAspect::initItem() const
|
||||
const_cast<VInspector_ItemPrs3dAspect*>(this)->Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetDrawer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
Handle(Prs3d_BasicAspect) VInspector_ItemPrs3dAspect::GetAspect() const
|
||||
{
|
||||
initItem();
|
||||
return myAspect;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetPrs3dAspect
|
||||
// purpose :
|
||||
|
@@ -46,7 +46,14 @@ public:
|
||||
//! Resets cached values
|
||||
Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Handle(Prs3d_BasicAspect) GetAspect() const;
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myAspect; }
|
||||
|
||||
//! Returns the current aspect, init item if it was not initialized yet
|
||||
//! \return interactive object
|
||||
Standard_EXPORT Handle(Prs3d_BasicAspect) GetAspect() const
|
||||
{ return Handle(Prs3d_BasicAspect)::DownCast (GetObject()); }
|
||||
|
||||
//! Returns sub aspect of the row if possible, e.g. Datum/Dimension aspect
|
||||
//! \param theRow child row index
|
||||
|
@@ -165,17 +165,6 @@ void VInspector_ItemPrs3dDrawer::initItem() const
|
||||
const_cast<VInspector_ItemPrs3dDrawer*>(this)->Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetDrawer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
Handle(Prs3d_Drawer) VInspector_ItemPrs3dDrawer::GetDrawer() const
|
||||
{
|
||||
initItem();
|
||||
return myDrawer;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetPrs3dAspect
|
||||
// purpose :
|
||||
|
@@ -48,8 +48,13 @@ public:
|
||||
//! Resets cached values
|
||||
Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myDrawer; }
|
||||
|
||||
//! Returns current drawer, initialize the drawer if it was not initialized yet
|
||||
Standard_EXPORT Handle(Prs3d_Drawer) GetDrawer() const;
|
||||
Standard_EXPORT Handle(Prs3d_Drawer) GetDrawer() const
|
||||
{ return Handle(Prs3d_Drawer)::DownCast (GetObject()); }
|
||||
|
||||
//! Returns drawer of the row if possible
|
||||
//! \param theRow child row index
|
||||
|
@@ -90,9 +90,7 @@ void VInspector_ItemPrs3dPresentation::Init()
|
||||
TCollection_AsciiString aName;
|
||||
Handle(Prs3d_Presentation) aPresentation = aParentItem->GetPresentation (Row(), aName);
|
||||
setPresentation (aPresentation, aName);
|
||||
|
||||
myPresentationShape = VInspector_Tools::CreateShape (aPresentation->MinMaxValues());
|
||||
|
||||
UpdatePresentationShape();
|
||||
TreeModel_ItemBase::Init(); // to use getIO() without circling initialization
|
||||
}
|
||||
|
||||
@@ -118,16 +116,6 @@ void VInspector_ItemPrs3dPresentation::initItem() const
|
||||
const_cast<VInspector_ItemPrs3dPresentation*>(this)->Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetInteractiveObject
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Prs3d_Presentation) VInspector_ItemPrs3dPresentation::GetPresentation() const
|
||||
{
|
||||
initItem();
|
||||
return myPresentation;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : setPresentation
|
||||
// purpose :
|
||||
@@ -148,6 +136,31 @@ int VInspector_ItemPrs3dPresentation::GetTableRowCount() const
|
||||
return 14;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableEnumValues
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QList<QVariant> VInspector_ItemPrs3dPresentation::GetTableEnumValues (const int theRow, const int) const
|
||||
{
|
||||
QList<QVariant> aValues;
|
||||
switch (theRow)
|
||||
{
|
||||
case 4:
|
||||
{
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_UNKNOWN));
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_Default));
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_Top));
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_Topmost));
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_TopOSD));
|
||||
aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_BotOSD));
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return aValues;
|
||||
}
|
||||
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableData
|
||||
// purpose :
|
||||
@@ -183,3 +196,30 @@ QVariant VInspector_ItemPrs3dPresentation::GetTableData (const int theRow, const
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetTableData
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool VInspector_ItemPrs3dPresentation::SetTableData (const int theRow, const int, const QVariant& theValue)
|
||||
{
|
||||
Handle(Prs3d_Presentation) aPrs = GetPresentation();
|
||||
switch (theRow)
|
||||
{
|
||||
case 8: aPrs->SetZLayer (Graphic3d::ZLayerIdFromString (theValue.toString().toStdString().c_str()));
|
||||
default: return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : buildPresentationShape
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TopoDS_Shape VInspector_ItemPrs3dPresentation::buildPresentationShape()
|
||||
{
|
||||
if (!myPresentation.IsNull())
|
||||
myPresentationShape = VInspector_Tools::CreateShape (myPresentation->MinMaxValues());
|
||||
|
||||
return TopoDS_Shape();
|
||||
}
|
||||
|
@@ -41,9 +41,14 @@ public:
|
||||
//! Destructor
|
||||
virtual ~VInspector_ItemPrs3dPresentation() Standard_OVERRIDE {};
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myPresentation; }
|
||||
|
||||
//! Returns the current presentation, init item if it was not initialized yet
|
||||
//! \return presentation object
|
||||
Standard_EXPORT Handle(Prs3d_Presentation) GetPresentation() const;
|
||||
Standard_EXPORT Handle(Prs3d_Presentation) GetPresentation() const
|
||||
{ return Handle(Prs3d_Presentation)::DownCast (GetObject()); }
|
||||
|
||||
//! Inits the item, fills internal containers
|
||||
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||
@@ -55,11 +60,23 @@ public:
|
||||
//! \return an integer value
|
||||
virtual int GetTableRowCount() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns container of string values for enumeration in the model row
|
||||
//! \param theRow table model row index
|
||||
//! \param theColumn a model index column
|
||||
//! \return string values for the enumeration presented in the row or an empty container
|
||||
virtual QList<QVariant> GetTableEnumValues (const int theRow, const int theColumn) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns table value for the row in form: <function name> <function value>
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole) const Standard_OVERRIDE;
|
||||
|
||||
//! Sets the value into the table cell. Only 1st column value might be modified.
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
//! \param theValue a new cell value
|
||||
virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! Initialize the current item. It is empty because Reset() is also empty.
|
||||
@@ -80,6 +97,10 @@ protected:
|
||||
//! \return the created item
|
||||
virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
|
||||
|
||||
//! Build presentation shape
|
||||
//! \return generated shape of the item parameters
|
||||
virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
//! Set presentation into the current field
|
||||
|
193
tools/VInspector/VInspector_ItemSelect3DSensitiveSetItem.cxx
Normal file
193
tools/VInspector/VInspector_ItemSelect3DSensitiveSetItem.cxx
Normal file
@@ -0,0 +1,193 @@
|
||||
// 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/VInspector_ItemSelect3DSensitiveSetItem.hxx>
|
||||
|
||||
//#include <AIS_ListOfInteractive.hxx>
|
||||
//#include <AIS_Shape.hxx>
|
||||
//#include <BRep_Builder.hxx>
|
||||
//#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
//#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
//#include <SelectBasics_SensitiveEntity.hxx>
|
||||
//#include <Select3D_SensitiveBox.hxx>
|
||||
//#include <Select3D_SensitiveCircle.hxx>
|
||||
//#include <Select3D_SensitiveCurve.hxx>
|
||||
//#include <Select3D_SensitiveFace.hxx>
|
||||
//#include <Select3D_SensitivePoint.hxx>
|
||||
//#include <Select3D_SensitiveSegment.hxx>
|
||||
#include <Select3D_SensitiveSet.hxx>
|
||||
//#include <Select3D_SensitiveTriangle.hxx>
|
||||
//#include <Select3D_InteriorSensitivePointSet.hxx> // child of Select3D_SensitiveSet
|
||||
//#include <Select3D_SensitiveGroup.hxx>
|
||||
//#include <Select3D_SensitivePoly.hxx>
|
||||
//#include <Select3D_SensitivePrimitiveArray.hxx>
|
||||
//#include <Select3D_SensitiveTriangulation.hxx>
|
||||
//#include <Select3D_SensitiveWire.hxx>
|
||||
//#include <SelectMgr_EntityOwner.hxx>
|
||||
//#include <SelectMgr_Selection.hxx>
|
||||
//#include <SelectMgr_SensitiveEntity.hxx>
|
||||
//#include <Standard_Version.hxx>
|
||||
//#include <StdSelect_BRepOwner.hxx>
|
||||
//#include <TColgp_HArray1OfPnt.hxx>
|
||||
//#include <TopoDS_Edge.hxx>
|
||||
//#include <TopoDS_Face.hxx>
|
||||
//#include <TopoDS_Shape.hxx>
|
||||
//#include <TopoDS_Vertex.hxx>
|
||||
//
|
||||
//#include <inspector/VInspector_ItemContext.hxx>
|
||||
#include <inspector/VInspector_ItemSelectBasicsSensitiveEntity.hxx>
|
||||
//#include <inspector/VInspector_ItemSelectMgrSensitiveEntity.hxx>
|
||||
#include <inspector/VInspector_Tools.hxx>
|
||||
//#include <inspector/ViewControl_Table.hxx>
|
||||
//#include <inspector/ViewControl_Tools.hxx>
|
||||
//
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
//#include <QStringList>
|
||||
#include <QColor>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : GetSensitiveEntity
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Standard_Transient) VInspector_ItemSelect3DSensitiveSetItem::GetObject() const
|
||||
{
|
||||
//initItem(); // to update presentation shapes
|
||||
VInspector_ItemSelectBasicsSensitiveEntityPtr aParentItem = itemDynamicCast<VInspector_ItemSelectBasicsSensitiveEntity>(Parent());
|
||||
if (aParentItem)
|
||||
return aParentItem->GetSensitiveEntity();
|
||||
return Handle(Standard_Transient)();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initValue
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QVariant VInspector_ItemSelect3DSensitiveSetItem::initValue (int theItemRole) const
|
||||
{
|
||||
Handle(SelectBasics_SensitiveEntity) anEntity = GetSensitiveEntity();
|
||||
if (anEntity.IsNull())
|
||||
return QVariant();
|
||||
|
||||
switch (theItemRole)
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
case Qt::EditRole:
|
||||
case Qt::ToolTipRole:
|
||||
{
|
||||
switch (Column())
|
||||
{
|
||||
case 0: return QString ("Index = %1").arg (Row());
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Qt::BackgroundRole:
|
||||
case Qt::ForegroundRole:
|
||||
{
|
||||
VInspector_ItemSelectBasicsSensitiveEntityPtr aParentItem = itemDynamicCast<VInspector_ItemSelectBasicsSensitiveEntity>(Parent());
|
||||
if (aParentItem)
|
||||
return aParentItem->data(QModelIndex(), theItemRole);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_ItemSelect3DSensitiveSetItem::Init()
|
||||
{
|
||||
UpdatePresentationShape();
|
||||
TreeModel_ItemBase::Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Reset
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_ItemSelect3DSensitiveSetItem::Reset()
|
||||
{
|
||||
// an empty method to don't clear the main label, otherwise the model will be empty
|
||||
TreeModel_ItemBase::Reset();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initItem
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_ItemSelect3DSensitiveSetItem::initItem() const
|
||||
{
|
||||
if (IsInitialized())
|
||||
return;
|
||||
const_cast<VInspector_ItemSelect3DSensitiveSetItem*>(this)->Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableRowCount
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
int VInspector_ItemSelect3DSensitiveSetItem::GetTableRowCount() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableData
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QVariant VInspector_ItemSelect3DSensitiveSetItem::GetTableData (const int theRow, const int theColumn, const int theRole) const
|
||||
{
|
||||
if (theRole != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
bool isFirstColumn = theColumn == 0;
|
||||
|
||||
Handle(Select3D_SensitiveSet) aSensitiveSet = Handle(Select3D_SensitiveSet)::DownCast (GetSensitiveEntity());
|
||||
if (aSensitiveSet.IsNull() || aSensitiveSet->Size() <= Row())
|
||||
return "Empty Select3D_SensitiveSet item";
|
||||
|
||||
Handle(SelectBasics_SensitiveEntity) anEntity = GetSensitiveEntity();
|
||||
switch (theRow)
|
||||
{
|
||||
case 0: return isFirstColumn ? QVariant ("Box") : QVariant (VInspector_Tools::ToVariant (aSensitiveSet->Box (Row())));
|
||||
default: break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : buildPresentationShape
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TopoDS_Shape VInspector_ItemSelect3DSensitiveSetItem::buildPresentationShape()
|
||||
{
|
||||
Handle(SelectBasics_SensitiveEntity) anEntity = GetSensitiveEntity();
|
||||
if (anEntity.IsNull())
|
||||
return TopoDS_Shape();
|
||||
|
||||
Handle(Select3D_SensitiveSet) aSensitiveSet = Handle(Select3D_SensitiveSet)::DownCast (GetSensitiveEntity());
|
||||
if (aSensitiveSet.IsNull() || aSensitiveSet->Size() < Row())
|
||||
return TopoDS_Shape();
|
||||
|
||||
Select3D_BndBox3d aBndBox = aSensitiveSet->Box (Row());
|
||||
return VInspector_Tools::CreateShape (aBndBox);
|
||||
}
|
130
tools/VInspector/VInspector_ItemSelect3DSensitiveSetItem.hxx
Normal file
130
tools/VInspector/VInspector_ItemSelect3DSensitiveSetItem.hxx
Normal file
@@ -0,0 +1,130 @@
|
||||
// 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 VInspector_ItemSelect3DSensitiveSetItem_H
|
||||
#define VInspector_ItemSelect3DSensitiveSetItem_H
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <SelectBasics_SensitiveEntity.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <inspector/VInspector_ItemBase.hxx>
|
||||
|
||||
class QItemSelectionModel;
|
||||
class SelectBasics_EntityOwner;
|
||||
class VInspector_ItemSelect3DSensitiveSetItem;
|
||||
|
||||
typedef QExplicitlySharedDataPointer<VInspector_ItemSelect3DSensitiveSetItem> VInspector_ItemSelect3DSensitiveSetItemPtr;
|
||||
|
||||
//! \class VInspector_ItemSelect3DSensitiveSetItem
|
||||
//! The item shows information about SelectBasics_EntityOwner.
|
||||
//! The parent is item selection, children are item entity owners
|
||||
class VInspector_ItemSelect3DSensitiveSetItem : public VInspector_ItemBase
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Creates an item wrapped by a shared pointer
|
||||
static VInspector_ItemSelect3DSensitiveSetItemPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
|
||||
{ return VInspector_ItemSelect3DSensitiveSetItemPtr (new VInspector_ItemSelect3DSensitiveSetItem (theParent, theRow, theColumn)); }
|
||||
|
||||
//! Destructor
|
||||
virtual ~VInspector_ItemSelect3DSensitiveSetItem() Standard_OVERRIDE {};
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const;
|
||||
|
||||
//! \return the current sensitive entity
|
||||
Standard_EXPORT Handle(SelectBasics_SensitiveEntity) GetSensitiveEntity() const
|
||||
{ return Handle(SelectBasics_SensitiveEntity)::DownCast (GetObject()); }
|
||||
|
||||
//! Inits the item, fills internal containers
|
||||
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||
|
||||
//! Resets cached values
|
||||
Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
|
||||
|
||||
//! Returns presentation of the attribute to be visualized in the view
|
||||
//! \thePresentations [out] container of presentation handles to be visualized
|
||||
//Standard_EXPORT virtual void GetPresentations (NCollection_List<Handle(Standard_Transient)>& thePresentations);
|
||||
|
||||
//! Returns number of table rows
|
||||
//! \return an integer value
|
||||
virtual int GetTableRowCount() const Standard_OVERRIDE;
|
||||
|
||||
//! Returns type of edit control for the model index. By default, it is an empty control
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
//! \return edit type
|
||||
//virtual ViewControl_EditType GetTableEditType (const int theRow, const int theColumn) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns table value for the row in form: <function name> <function value>
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole) const Standard_OVERRIDE;
|
||||
|
||||
//! Sets the value into the table cell. Only 1st column value might be modified.
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
//! \param theValue a new cell value
|
||||
//virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! Initialize the current item. It is empty because Reset() is also empty.
|
||||
virtual void initItem() const Standard_OVERRIDE;
|
||||
|
||||
//! \return number of children.
|
||||
virtual int initRowCount() const Standard_OVERRIDE { return 0; }
|
||||
|
||||
//! Returns item information for the given role. Fills internal container if it was not filled yet
|
||||
//! \param theItemRole a value role
|
||||
//! \return the value
|
||||
virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! Creates a child item in the given position.
|
||||
//! \param theRow the child row position
|
||||
//! \param theColumn the child column position
|
||||
//! \return the created item
|
||||
virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE
|
||||
{ return TreeModel_ItemBasePtr(); }
|
||||
|
||||
//! Returns owner of the current sensitive entity
|
||||
//! \return owner
|
||||
//Handle(SelectBasics_EntityOwner) getEntityOwner() const;
|
||||
|
||||
//! Returns table value for the row in form: <function name> <function value> depending on the aspect kind
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
//! \param theEntityKind kind or kind of entity
|
||||
QVariant getTableData (const int theRow,
|
||||
const int theColumn,
|
||||
const int theRole,
|
||||
const TCollection_AsciiString& theEntityKind) const;
|
||||
|
||||
protected:
|
||||
//! Build presentation shape
|
||||
//! \return generated shape of the item parameters
|
||||
virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE;
|
||||
|
||||
//! Constructor
|
||||
//! param theParent a parent item
|
||||
VInspector_ItemSelect3DSensitiveSetItem(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
|
||||
: VInspector_ItemBase(theParent, theRow, theColumn) {}
|
||||
};
|
||||
|
||||
#endif
|
@@ -17,6 +17,7 @@
|
||||
#include <inspector/VInspector_ItemSelectMgrSensitiveEntity.hxx>
|
||||
#include <inspector/VInspector_ItemPresentableObject.hxx>
|
||||
#include <inspector/VInspector_Tools.hxx>
|
||||
#include <inspector/ViewControl_Table.hxx>
|
||||
#include <inspector/ViewControl_Tools.hxx>
|
||||
|
||||
#include <SelectMgr_SensitiveEntity.hxx>
|
||||
@@ -49,47 +50,47 @@ QVariant VInspector_ItemSelectBasicsEntityOwner::initValue(int theItemRole) cons
|
||||
{
|
||||
case 0: return anOwner->DynamicType()->Name();
|
||||
case 2: return VInspector_Tools::GetPointerInfo (anOwner, true).ToCString();
|
||||
case 3:
|
||||
{
|
||||
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
|
||||
if (BROwnr.IsNull())
|
||||
return QVariant();
|
||||
|
||||
const TopoDS_Shape& aShape = BROwnr->Shape();
|
||||
if (aShape.IsNull())
|
||||
return QVariant();
|
||||
|
||||
return VInspector_Tools::GetShapeTypeInfo (aShape.ShapeType()).ToCString();
|
||||
}
|
||||
case 17:
|
||||
case 18:
|
||||
case 19:
|
||||
{
|
||||
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
|
||||
if (BROwnr.IsNull())
|
||||
return QVariant();
|
||||
|
||||
const TopoDS_Shape& aShape = BROwnr->Shape();
|
||||
if (aShape.IsNull())
|
||||
return QVariant();
|
||||
|
||||
return Column() == 17 ? VInspector_Tools::GetPointerInfo (aShape.TShape(), true).ToCString()
|
||||
: Column() == 18 ? VInspector_Tools::OrientationToName (aShape.Orientation()).ToCString()
|
||||
: /*19*/ ViewControl_Tools::ToString (aShape.Location()).ToCString();
|
||||
}
|
||||
case 21:
|
||||
{
|
||||
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
|
||||
if (BROwnr.IsNull())
|
||||
return QVariant();
|
||||
|
||||
//const TopoDS_Shape& aShape = BROwnr->Shape();
|
||||
//if (aShape.IsNull())
|
||||
//case 3:
|
||||
//{
|
||||
// Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
|
||||
// if (BROwnr.IsNull())
|
||||
// return QVariant();
|
||||
|
||||
return ViewControl_Tools::ToString (BROwnr->Location()).ToCString();
|
||||
}
|
||||
default: break;
|
||||
// const TopoDS_Shape& aShape = BROwnr->Shape();
|
||||
// if (aShape.IsNull())
|
||||
// return QVariant();
|
||||
|
||||
// return VInspector_Tools::GetShapeTypeInfo (aShape.ShapeType()).ToCString();
|
||||
//}
|
||||
//case 17:
|
||||
//case 18:
|
||||
//case 19:
|
||||
// {
|
||||
// Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
|
||||
// if (BROwnr.IsNull())
|
||||
// return QVariant();
|
||||
|
||||
// const TopoDS_Shape& aShape = BROwnr->Shape();
|
||||
// if (aShape.IsNull())
|
||||
// return QVariant();
|
||||
|
||||
// return Column() == 17 ? VInspector_Tools::GetPointerInfo (aShape.TShape(), true).ToCString()
|
||||
// : Column() == 18 ? VInspector_Tools::OrientationToName (aShape.Orientation()).ToCString()
|
||||
// : /*19*/ ViewControl_Tools::ToString (aShape.Location()).ToCString();
|
||||
//}
|
||||
//case 21:
|
||||
// {
|
||||
// Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
|
||||
// if (BROwnr.IsNull())
|
||||
// return QVariant();
|
||||
|
||||
// //const TopoDS_Shape& aShape = BROwnr->Shape();
|
||||
// //if (aShape.IsNull())
|
||||
// // return QVariant();
|
||||
|
||||
// return ViewControl_Tools::ToString (BROwnr->Location()).ToCString();
|
||||
//}
|
||||
//default: break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -126,6 +127,7 @@ void VInspector_ItemSelectBasicsEntityOwner::Init()
|
||||
if (aParentItem)
|
||||
{
|
||||
Handle(SelectMgr_SensitiveEntity) anEntity = aParentItem->GetSensitiveEntity();
|
||||
if (!anEntity.IsNull() && !anEntity->BaseSensitive().IsNull())
|
||||
anOwner = anEntity->BaseSensitive()->OwnerId();
|
||||
}
|
||||
else
|
||||
@@ -164,6 +166,7 @@ void VInspector_ItemSelectBasicsEntityOwner::Init()
|
||||
}
|
||||
}
|
||||
myOwner = anOwner;
|
||||
UpdatePresentationShape();
|
||||
TreeModel_ItemBase::Init();
|
||||
}
|
||||
|
||||
@@ -188,16 +191,6 @@ void VInspector_ItemSelectBasicsEntityOwner::initItem() const
|
||||
const_cast<VInspector_ItemSelectBasicsEntityOwner*>(this)->Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : getEntityOwner
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(SelectBasics_EntityOwner) VInspector_ItemSelectBasicsEntityOwner::getEntityOwner() const
|
||||
{
|
||||
initItem();
|
||||
return myOwner;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableRowCount
|
||||
// purpose :
|
||||
@@ -213,16 +206,11 @@ int VInspector_ItemSelectBasicsEntityOwner::GetTableRowCount() const
|
||||
// =======================================================================
|
||||
ViewControl_EditType VInspector_ItemSelectBasicsEntityOwner::GetTableEditType(const int theRow, const int) const
|
||||
{
|
||||
/*switch (theRow)
|
||||
switch (theRow)
|
||||
{
|
||||
case 4: return ViewControl_EditType_Line;
|
||||
case 5: return ViewControl_EditType_Combo;
|
||||
case 6: return ViewControl_EditType_Bool;
|
||||
case 12: return ViewControl_EditType_Bool;
|
||||
case 17: return ViewControl_EditType_Combo;
|
||||
case 18: return ViewControl_EditType_Bool;
|
||||
case 0: return ViewControl_EditType_Spin;
|
||||
default: return ViewControl_EditType_None;
|
||||
}*/
|
||||
}
|
||||
return ViewControl_EditType_None;
|
||||
}
|
||||
|
||||
@@ -263,38 +251,34 @@ QVariant VInspector_ItemSelectBasicsEntityOwner::GetTableData(const int theRow,
|
||||
|
||||
bool isFirstColumn = theColumn == 0;
|
||||
|
||||
/*Handle(AIS_InteractiveObject) aPrs = GetInteractiveObject();
|
||||
Handle(SelectBasics_EntityOwner) anOwner = getEntityOwner();
|
||||
switch (theRow)
|
||||
{
|
||||
case 0: return isFirstColumn ? QVariant ("Priority") : QVariant (anOwner->Priority());
|
||||
case 1: return isFirstColumn ? QVariant ("HasLocation") : QVariant (anOwner->HasLocation());
|
||||
case 2: return isFirstColumn ? QVariant ("Location") :
|
||||
(anOwner->HasLocation() ? QVariant (ViewControl_Tools::ToString (anOwner->Location()).ToCString()) : QVariant());
|
||||
default: break;
|
||||
}
|
||||
|
||||
Handle(StdSelect_BRepOwner) aBROwner = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
|
||||
if (aBROwner.IsNull())
|
||||
return QVariant();
|
||||
|
||||
int aBRepOwnerRow = theRow - 3;
|
||||
switch (aBRepOwnerRow)
|
||||
{
|
||||
case 0: return ViewControl_Table::SeparatorData();
|
||||
case 1: return isFirstColumn ? QVariant (STANDARD_TYPE (AIS_InteractiveObject)->Name())
|
||||
: ViewControl_Tools::GetPointerInfo (aPrs).ToCString();
|
||||
case 1: return isFirstColumn ? QVariant (STANDARD_TYPE (StdSelect_BRepOwner)->Name())
|
||||
: ViewControl_Tools::GetPointerInfo (aBROwner).ToCString();
|
||||
case 2: return ViewControl_Table::SeparatorData();
|
||||
case 3: return isFirstColumn ? QVariant ("HasWidth") : QVariant (aPrs->HasWidth());
|
||||
case 4: return isFirstColumn ? QVariant ("Width") : QVariant (aPrs->Width());
|
||||
case 5: return isFirstColumn ? QVariant ("CurrentFacingModel")
|
||||
: QVariant (Aspect::TypeOfFacingModelToString (aPrs->CurrentFacingModel()));
|
||||
case 6: return isFirstColumn ? QVariant ("IsInfinite") : QVariant (aPrs->IsInfinite());
|
||||
case 7: return isFirstColumn ? QVariant ("HasColor") : QVariant (aPrs->HasColor());
|
||||
case 8: return isFirstColumn ? QVariant ("HasMaterial") : QVariant (aPrs->HasMaterial());
|
||||
|
||||
case 9: return ViewControl_Table::SeparatorData();
|
||||
case 10: return isFirstColumn ? QVariant (STANDARD_TYPE (SelectMgr_SelectableObject)->Name())
|
||||
: ViewControl_Tools::GetPointerInfo (aPrs).ToCString();
|
||||
case 11: return ViewControl_Table::SeparatorData();
|
||||
case 12: return isFirstColumn ? QVariant ("IsAutoHilight") : QVariant (aPrs->IsAutoHilight());
|
||||
case 13: return isFirstColumn ? QVariant ("GlobalSelectionMode") : QVariant (aPrs->GlobalSelectionMode());
|
||||
|
||||
case 14: return ViewControl_Table::SeparatorData();
|
||||
case 15: return isFirstColumn ? QVariant (STANDARD_TYPE (PrsMgr_PresentableObject)->Name())
|
||||
: ViewControl_Tools::GetPointerInfo (aPrs).ToCString();
|
||||
case 16: return ViewControl_Table::SeparatorData();
|
||||
case 17: return isFirstColumn ? QVariant ("TypeOfPresentation3d")
|
||||
: QVariant (PrsMgr::TypeOfPresentation3dToString (aPrs->TypeOfPresentation3d()));
|
||||
case 18: return isFirstColumn ? QVariant ("IsMutable") : QVariant (aPrs->IsMutable());
|
||||
case 19: return isFirstColumn ? QVariant ("HasOwnPresentations") : QVariant (aPrs->HasOwnPresentations());
|
||||
case 3: return isFirstColumn ? QVariant ("HilightMode") : QVariant (aBROwner->HilightMode());
|
||||
case 4: return isFirstColumn ? QVariant ("Shape") :
|
||||
(!aBROwner->Shape().IsNull() ? ViewControl_Tools::GetPointerInfo (aBROwner->Shape().TShape()).ToCString() : QVariant());
|
||||
case 5: return isFirstColumn ? QVariant ("ShapeType") :
|
||||
(!aBROwner->Shape().IsNull() ? VInspector_Tools::GetShapeTypeInfo (aBROwner->Shape().ShapeType()).ToCString() : QVariant());
|
||||
default: return QVariant();
|
||||
}*/
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
@@ -304,22 +288,24 @@ QVariant VInspector_ItemSelectBasicsEntityOwner::GetTableData(const int theRow,
|
||||
// =======================================================================
|
||||
bool VInspector_ItemSelectBasicsEntityOwner::SetTableData(const int theRow, const int, const QVariant& theValue)
|
||||
{
|
||||
/*Handle(AIS_InteractiveObject) aPrs = GetInteractiveObject();
|
||||
Handle(SelectBasics_EntityOwner) anOwner = getEntityOwner();
|
||||
switch (theRow)
|
||||
{
|
||||
case 4:
|
||||
{
|
||||
double aValue = theValue.toDouble();
|
||||
if (aValue > 0) aPrs->SetWidth (aValue);
|
||||
else aPrs->UnsetWidth();
|
||||
}
|
||||
break;
|
||||
case 5: aPrs->SetCurrentFacingModel (Aspect::TypeOfFacingModelFromString (theValue.toString().toStdString().c_str()));
|
||||
case 6: aPrs->SetInfiniteState (theValue.toBool());
|
||||
case 12: aPrs->SetAutoHilight(theValue.toBool());
|
||||
case 17: aPrs->SetTypeOfPresentation (PrsMgr::TypeOfPresentation3dFromString (theValue.toString().toStdString().c_str()));
|
||||
case 18: aPrs->SetMutable (theValue.toBool());
|
||||
case 0: anOwner->SetPriority (theValue.toInt());
|
||||
default: return false;
|
||||
}*/
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : buildPresentationShape
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TopoDS_Shape VInspector_ItemSelectBasicsEntityOwner::buildPresentationShape()
|
||||
{
|
||||
Handle(StdSelect_BRepOwner) aBROwner = Handle(StdSelect_BRepOwner)::DownCast (myOwner);
|
||||
if (aBROwner.IsNull())
|
||||
return TopoDS_Shape();
|
||||
|
||||
return aBROwner->Shape();
|
||||
}
|
||||
|
@@ -45,6 +45,10 @@ public:
|
||||
//! Resets cached values
|
||||
Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myOwner; }
|
||||
|
||||
//! Returns the current entity owner
|
||||
Handle(SelectBasics_EntityOwner) EntityOwner() const { return myOwner; }
|
||||
|
||||
@@ -88,6 +92,9 @@ protected:
|
||||
virtual void initItem() const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
//! Build presentation shape
|
||||
//! \return generated shape of the item parameters
|
||||
virtual TopoDS_Shape buildPresentationShape();
|
||||
|
||||
//! Creates a child item in the given position.
|
||||
//! \param theRow the child row position
|
||||
@@ -106,7 +113,8 @@ private:
|
||||
private:
|
||||
|
||||
//! Returns the current entity owner. Initializes the item if it was not initialized yet
|
||||
Handle(SelectBasics_EntityOwner) getEntityOwner() const;
|
||||
Handle(SelectBasics_EntityOwner) getEntityOwner() const
|
||||
{ return Handle(SelectBasics_EntityOwner)::DownCast (GetObject()); }
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -15,6 +15,7 @@
|
||||
|
||||
|
||||
#include <inspector/VInspector_ItemSelectBasicsSensitiveEntity.hxx>
|
||||
#include <inspector/VInspector_ItemSelect3DSensitiveSetItem.hxx>
|
||||
|
||||
#include <AIS_ListOfInteractive.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
@@ -59,22 +60,16 @@
|
||||
#include <QColor>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : GetSensitiveEntity
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(SelectBasics_SensitiveEntity) VInspector_ItemSelectBasicsSensitiveEntity::GetSensitiveEntity() const
|
||||
{
|
||||
initItem();
|
||||
return myEntity;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initValue
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
int VInspector_ItemSelectBasicsSensitiveEntity::initRowCount() const
|
||||
{
|
||||
Handle(Select3D_SensitiveSet) aSensitiveSet = Handle(Select3D_SensitiveSet)::DownCast (GetSensitiveEntity());
|
||||
if (!aSensitiveSet.IsNull())
|
||||
return aSensitiveSet->Size();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -85,6 +80,9 @@ int VInspector_ItemSelectBasicsSensitiveEntity::initRowCount() const
|
||||
QVariant VInspector_ItemSelectBasicsSensitiveEntity::initValue (int theItemRole) const
|
||||
{
|
||||
Handle(SelectBasics_SensitiveEntity) anEntity = GetSensitiveEntity();
|
||||
if (anEntity.IsNull())
|
||||
return QVariant();
|
||||
|
||||
Handle(SelectBasics_EntityOwner) anOwner = anEntity->OwnerId();
|
||||
|
||||
switch (theItemRole)
|
||||
@@ -130,7 +128,7 @@ QVariant VInspector_ItemSelectBasicsSensitiveEntity::initValue (int theItemRole)
|
||||
// =======================================================================
|
||||
TreeModel_ItemBasePtr VInspector_ItemSelectBasicsSensitiveEntity::createChild (int theRow, int theColumn)
|
||||
{
|
||||
return VInspector_ItemSelectBasicsEntityOwner::CreateItem (currentItem(), theRow, theColumn);
|
||||
return VInspector_ItemSelect3DSensitiveSetItem::CreateItem (currentItem(), theRow, theColumn);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -144,8 +142,8 @@ void VInspector_ItemSelectBasicsSensitiveEntity::Init()
|
||||
Handle(SelectMgr_SensitiveEntity) anEntity = aParentItem->GetSensitiveEntity();
|
||||
|
||||
myEntity = anEntity->BaseSensitive();
|
||||
myPresentationShape = buildPresentationShape (myEntity);
|
||||
|
||||
UpdatePresentationShape();
|
||||
TreeModel_ItemBase::Init();
|
||||
}
|
||||
|
||||
@@ -207,7 +205,11 @@ void VInspector_ItemSelectBasicsSensitiveEntity::GetPresentations(NCollection_Li
|
||||
if (aBaseEntity.IsNull())
|
||||
return;
|
||||
|
||||
myPresentation = new AIS_Shape (myPresentationShape);
|
||||
TopoDS_Shape aShape = GetPresentationShape();
|
||||
if (aShape.IsNull())
|
||||
return;
|
||||
|
||||
myPresentation = new AIS_Shape (aShape);
|
||||
myPresentation->SetColor (Quantity_Color (Quantity_NOC_BLUE1));
|
||||
thePresentations.Append (myPresentation);
|
||||
}
|
||||
@@ -246,6 +248,9 @@ QVariant VInspector_ItemSelectBasicsSensitiveEntity::GetTableData (const int the
|
||||
bool isFirstColumn = theColumn == 0;
|
||||
|
||||
Handle(SelectBasics_SensitiveEntity) anEntity = GetSensitiveEntity();
|
||||
if (anEntity.IsNull())
|
||||
return QVariant();
|
||||
|
||||
switch (theRow)
|
||||
{
|
||||
case 0: return ViewControl_Table::SeparatorData();
|
||||
@@ -398,7 +403,10 @@ QVariant VInspector_ItemSelectBasicsSensitiveEntity::getTableData (const int the
|
||||
}
|
||||
}
|
||||
}
|
||||
//Select3D_SensitivePrimitiveArray
|
||||
else if (theEntityKind == STANDARD_TYPE (Select3D_SensitivePrimitiveArray)->Name())
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
else if (theEntityKind == STANDARD_TYPE (Select3D_SensitiveTriangulation)->Name())
|
||||
{
|
||||
Handle(Select3D_SensitiveTriangulation) anEntity = Handle(Select3D_SensitiveTriangulation)::DownCast (aBaseEntity);
|
||||
@@ -424,7 +432,11 @@ TopoDS_Shape VInspector_ItemSelectBasicsSensitiveEntity::buildPresentationShape
|
||||
TopoDS_Compound aCompound;
|
||||
aBuilder.MakeCompound (aCompound);
|
||||
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex(aBaseEntity->CenterOfGeometry()));
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (aBaseEntity->CenterOfGeometry()));
|
||||
|
||||
Select3D_BndBox3d aBoundingBox = aBaseEntity->BoundingBox();
|
||||
if (aBoundingBox.IsValid())
|
||||
aBuilder.Add (aCompound, VInspector_Tools::CreateShape (aBoundingBox));
|
||||
|
||||
Standard_CString aTypeName = aBaseEntity->DynamicType()->Name();
|
||||
if (aTypeName == STANDARD_TYPE (Select3D_SensitiveBox)->Name())
|
||||
@@ -471,6 +483,9 @@ TopoDS_Shape VInspector_ItemSelectBasicsSensitiveEntity::buildPresentationShape
|
||||
for (Standard_Integer aPntIter = aPoints->Lower(); aPntIter <= aPoints->Upper(); ++aPntIter)
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex(aPoints->Value (aPntIter)));
|
||||
}
|
||||
else if (aTypeName == STANDARD_TYPE (Select3D_SensitivePrimitiveArray)->Name())
|
||||
{
|
||||
}
|
||||
else if (aTypeName == STANDARD_TYPE (Select3D_SensitiveTriangulation)->Name())
|
||||
{
|
||||
Handle(Select3D_SensitiveTriangulation) anEntity = Handle(Select3D_SensitiveTriangulation)::DownCast (aBaseEntity);
|
||||
|
@@ -43,8 +43,13 @@ public:
|
||||
//! Destructor
|
||||
virtual ~VInspector_ItemSelectBasicsSensitiveEntity() Standard_OVERRIDE {};
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myEntity; }
|
||||
|
||||
//! \return the current sensitive entity
|
||||
Standard_EXPORT Handle(SelectBasics_SensitiveEntity) GetSensitiveEntity() const;
|
||||
Standard_EXPORT Handle(SelectBasics_SensitiveEntity) GetSensitiveEntity() const
|
||||
{ return Handle(SelectBasics_SensitiveEntity)::DownCast (GetObject()); }
|
||||
|
||||
//! Inits the item, fills internal containers
|
||||
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||
@@ -111,13 +116,16 @@ protected:
|
||||
const int theRole,
|
||||
const TCollection_AsciiString& theEntityKind) const;
|
||||
|
||||
protected:
|
||||
//! Build presentation shape
|
||||
//! \return generated shape of the item parameters
|
||||
virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE { return buildPresentationShape (myEntity); }
|
||||
|
||||
//! Creates shape depending on the entity kind and parameters
|
||||
//! \param theEntity current sensitive entity
|
||||
//! \return shape or NULL
|
||||
static TopoDS_Shape buildPresentationShape (const Handle(SelectBasics_SensitiveEntity)& theEntity);
|
||||
|
||||
private:
|
||||
|
||||
//! Constructor
|
||||
//! param theParent a parent item
|
||||
VInspector_ItemSelectBasicsSensitiveEntity(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
|
||||
|
@@ -127,12 +127,3 @@ void VInspector_ItemSelectMgrFilter::initItem() const
|
||||
const_cast<VInspector_ItemSelectMgrFilter*>(this)->Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetInteractiveObject
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(SelectMgr_Filter) VInspector_ItemSelectMgrFilter::GetFilter() const
|
||||
{
|
||||
initItem();
|
||||
return myFilter;
|
||||
}
|
||||
|
@@ -40,9 +40,14 @@ public:
|
||||
//! Destructor
|
||||
virtual ~VInspector_ItemSelectMgrFilter() Standard_OVERRIDE {};
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myFilter; }
|
||||
|
||||
//! Returns the current filter, init item if it was not initialized yet
|
||||
//! \return filter object
|
||||
Standard_EXPORT Handle(SelectMgr_Filter) GetFilter() const;
|
||||
Standard_EXPORT Handle(SelectMgr_Filter) GetFilter() const
|
||||
{ return Handle(SelectMgr_Filter)::DownCast (GetObject()); }
|
||||
|
||||
//! Inits the item, fills internal containers
|
||||
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||
|
@@ -31,23 +31,13 @@
|
||||
#include <QColor>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : getSelection
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(SelectMgr_Selection) VInspector_ItemSelectMgrSelection::getSelection() const
|
||||
{
|
||||
initItem();
|
||||
return mySelection;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initRowCount
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
int VInspector_ItemSelectMgrSelection::initRowCount() const
|
||||
{
|
||||
Handle(SelectMgr_Selection) aSelection = getSelection();
|
||||
Handle(SelectMgr_Selection) aSelection = GetSelection();
|
||||
#if OCC_VERSION_HEX < 0x070201
|
||||
int aRows = 0;
|
||||
for (aSelection->Init(); aSelection->More(); aSelection->Next())
|
||||
@@ -72,7 +62,7 @@ QVariant VInspector_ItemSelectMgrSelection::initValue (int theItemRole) const
|
||||
{
|
||||
switch (Column())
|
||||
{
|
||||
case 0: return getSelection()->DynamicType()->Name();
|
||||
case 0: return GetSelection()->DynamicType()->Name();
|
||||
case 1: return rowCount();
|
||||
case 3:
|
||||
{
|
||||
@@ -81,7 +71,7 @@ QVariant VInspector_ItemSelectMgrSelection::initValue (int theItemRole) const
|
||||
else
|
||||
{
|
||||
VInspector_ItemPresentableObjectPtr aParentItem = itemDynamicCast<VInspector_ItemPresentableObject>(Parent());
|
||||
return VInspector_Tools::SelectionModeToName(getSelection()->Mode(), aParentItem->GetInteractiveObject()).ToCString();
|
||||
return VInspector_Tools::SelectionModeToName(GetSelection()->Mode(), aParentItem->GetInteractiveObject()).ToCString();
|
||||
}
|
||||
}
|
||||
case 4:
|
||||
@@ -90,7 +80,7 @@ QVariant VInspector_ItemSelectMgrSelection::initValue (int theItemRole) const
|
||||
return "SelectMgr_StateOfSelection";
|
||||
else {
|
||||
int aNbSelected = 0;
|
||||
SelectMgr_StateOfSelection aState = getSelection()->GetSelectionState();
|
||||
SelectMgr_StateOfSelection aState = GetSelection()->GetSelectionState();
|
||||
if (aState == SelectMgr_SOS_Activated || aState == SelectMgr_SOS_Any)
|
||||
{
|
||||
Handle(AIS_InteractiveContext) aContext = GetContext();
|
||||
@@ -112,16 +102,16 @@ QVariant VInspector_ItemSelectMgrSelection::initValue (int theItemRole) const
|
||||
}
|
||||
case 9:
|
||||
{
|
||||
SelectMgr_StateOfSelection aState = getSelection()->GetSelectionState();
|
||||
SelectMgr_StateOfSelection aState = GetSelection()->GetSelectionState();
|
||||
return VInspector_Tools::ToName (VInspector_SelectionType_StateOfSelection, aState).ToCString();
|
||||
}
|
||||
case 10: return QString::number (getSelection()->Sensitivity());
|
||||
case 10: return QString::number (GetSelection()->Sensitivity());
|
||||
case 11:
|
||||
return VInspector_Tools::ToName (VInspector_SelectionType_TypeOfUpdate,
|
||||
getSelection()->UpdateStatus()).ToCString();
|
||||
GetSelection()->UpdateStatus()).ToCString();
|
||||
case 12:
|
||||
return VInspector_Tools::ToName (VInspector_SelectionType_TypeOfBVHUpdate,
|
||||
getSelection()->BVHUpdateStatus()).ToCString();
|
||||
GetSelection()->BVHUpdateStatus()).ToCString();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -129,7 +119,7 @@ QVariant VInspector_ItemSelectMgrSelection::initValue (int theItemRole) const
|
||||
}
|
||||
case Qt::ForegroundRole:
|
||||
{
|
||||
SelectMgr_StateOfSelection aState = getSelection()->GetSelectionState();
|
||||
SelectMgr_StateOfSelection aState = GetSelection()->GetSelectionState();
|
||||
return QVariant (aState == SelectMgr_SOS_Activated ? QColor (Qt::black) : QColor (Qt::darkGray));
|
||||
}
|
||||
}
|
||||
|
@@ -38,8 +38,13 @@ public:
|
||||
//! Destructor
|
||||
virtual ~VInspector_ItemSelectMgrSelection() {};
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return mySelection; }
|
||||
|
||||
//! \return current selection value
|
||||
Standard_EXPORT Handle(SelectMgr_Selection) getSelection() const;
|
||||
Standard_EXPORT Handle(SelectMgr_Selection) GetSelection() const
|
||||
{ return Handle(SelectMgr_Selection)::DownCast (GetObject()); }
|
||||
|
||||
//! Inits the item, fills internal containers
|
||||
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||
|
@@ -37,16 +37,6 @@
|
||||
#include <QColor>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : GetSensitiveEntity
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(SelectMgr_SensitiveEntity) VInspector_ItemSelectMgrSensitiveEntity::GetSensitiveEntity() const
|
||||
{
|
||||
initItem();
|
||||
return myEntity;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initValue
|
||||
// purpose :
|
||||
@@ -66,8 +56,6 @@ int VInspector_ItemSelectMgrSensitiveEntity::initRowCount() const
|
||||
QVariant VInspector_ItemSelectMgrSensitiveEntity::initValue (int theItemRole) const
|
||||
{
|
||||
Handle(SelectMgr_SensitiveEntity) anEntity = GetSensitiveEntity();
|
||||
Handle(SelectBasics_EntityOwner) anOwner = anEntity->BaseSensitive()->OwnerId();
|
||||
|
||||
switch (theItemRole)
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
@@ -77,34 +65,6 @@ QVariant VInspector_ItemSelectMgrSensitiveEntity::initValue (int theItemRole) co
|
||||
switch (Column())
|
||||
{
|
||||
case 0: return anEntity->DynamicType()->Name();
|
||||
/*case 2: return VInspector_Tools::GetPointerInfo (GetSensitiveEntity()->BaseSensitive()->OwnerId(), true).ToCString();
|
||||
case 3:
|
||||
{
|
||||
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
|
||||
if (BROwnr.IsNull())
|
||||
return QVariant();
|
||||
|
||||
const TopoDS_Shape& aShape = BROwnr->Shape();
|
||||
if (aShape.IsNull())
|
||||
return QVariant();
|
||||
|
||||
return VInspector_Tools::GetShapeTypeInfo (aShape.ShapeType()).ToCString();
|
||||
}
|
||||
case 13: return
|
||||
#if OCC_VERSION_HEX <= 0x060901
|
||||
("none");
|
||||
#else
|
||||
myEntity->IsActiveForSelection() ? QString ("true") : QString ("false");
|
||||
#endif
|
||||
case 14: return QString::number (GetSensitiveEntity()->BaseSensitive()->SensitivityFactor());
|
||||
case 15: return QString::number (GetSensitiveEntity()->BaseSensitive()->NbSubElements());
|
||||
case 16:
|
||||
{
|
||||
Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
|
||||
if (BROwnr.IsNull())
|
||||
return QVariant();
|
||||
return anOwner->Priority();
|
||||
}*/
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -155,7 +115,7 @@ void VInspector_ItemSelectMgrSensitiveEntity::Init()
|
||||
{
|
||||
VInspector_ItemSelectMgrSelectionPtr aParentItem = itemDynamicCast<VInspector_ItemSelectMgrSelection>(Parent());
|
||||
|
||||
Handle(SelectMgr_Selection) aSelection = aParentItem->getSelection();
|
||||
Handle(SelectMgr_Selection) aSelection = aParentItem->GetSelection();
|
||||
|
||||
int aRowId = Row();
|
||||
int aCurrentId = 0;
|
||||
|
@@ -41,8 +41,13 @@ public:
|
||||
//! Destructor
|
||||
virtual ~VInspector_ItemSelectMgrSensitiveEntity() Standard_OVERRIDE {};
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myEntity; }
|
||||
|
||||
//! \return the current sensitive entity
|
||||
Standard_EXPORT Handle(SelectMgr_SensitiveEntity) GetSensitiveEntity() const;
|
||||
Standard_EXPORT Handle(SelectMgr_SensitiveEntity) GetSensitiveEntity() const
|
||||
{ return Handle(SelectMgr_SensitiveEntity)::DownCast (GetObject()); }
|
||||
|
||||
//! Inits the item, fills internal containers
|
||||
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||
|
@@ -17,8 +17,17 @@
|
||||
|
||||
#include <AIS.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <V3d_ListOfLight.hxx>
|
||||
|
||||
#include <inspector/ViewControl_Tools.hxx>
|
||||
#include <inspector/VInspector_ItemAspectWindow.hxx>
|
||||
#include <inspector/VInspector_ItemContext.hxx>
|
||||
#include <inspector/VInspector_ItemGraphic3dClipPlane.hxx>
|
||||
#include <inspector/VInspector_ItemGraphic3dCamera.hxx>
|
||||
#include <inspector/VInspector_ItemGraphic3dCView.hxx>
|
||||
#include <inspector/VInspector_ItemV3dViewer.hxx>
|
||||
#include <inspector/VInspector_Tools.hxx>
|
||||
|
||||
@@ -26,25 +35,6 @@
|
||||
#include <QStringList>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : initRowCount
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Graphic3d_ClipPlane) VInspector_ItemV3dView::GetClipPlane(const int theRow)
|
||||
{
|
||||
Handle(V3d_View) aView = GetView();
|
||||
|
||||
const Handle(Graphic3d_SequenceOfHClipPlane)& aClipPlanes = aView->ClipPlanes();
|
||||
|
||||
Standard_Integer aPlaneId = 0;
|
||||
for (Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (*aClipPlanes); aPlaneIt.More(); aPlaneIt.Next(), ++aPlaneId)
|
||||
{
|
||||
if (aPlaneId == theRow)
|
||||
return aPlaneIt.Value();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initRowCount
|
||||
// purpose :
|
||||
@@ -54,7 +44,9 @@ int VInspector_ItemV3dView::initRowCount() const
|
||||
if (Column() != 0)
|
||||
return 0;
|
||||
|
||||
return 1; // ClipPlanes
|
||||
return 3; // 0 - Default Camera, 1 - Aspect_Window, 2 - CView
|
||||
// TODO: V3d_ListOfLight, V3d_Trihedron,
|
||||
//Aspect_Grid-MyPlane-MyTrsf-MyGridEchoStructure-MyGridEchoGroup
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -90,11 +82,11 @@ void VInspector_ItemV3dView::Init()
|
||||
Handle(V3d_View) aView;
|
||||
if (aParentItem)
|
||||
{
|
||||
Handle(V3d_Viewer) aViewer = aParentItem->GetViewer();
|
||||
aViewer->InitActiveViews();
|
||||
aView = aViewer->ActiveView();
|
||||
aView = aParentItem->GetView (Row());
|
||||
}
|
||||
setView (aView);
|
||||
|
||||
UpdatePresentationShape();
|
||||
TreeModel_ItemBase::Init(); // to use getIO() without circling initialization
|
||||
}
|
||||
|
||||
@@ -122,31 +114,20 @@ void VInspector_ItemV3dView::initItem() const
|
||||
const_cast<VInspector_ItemV3dView*>(this)->Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetView
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
Handle(V3d_View) VInspector_ItemV3dView::GetView() const
|
||||
{
|
||||
initItem();
|
||||
return myView;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableRowCount
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
int VInspector_ItemV3dView::GetTableRowCount() const
|
||||
{
|
||||
return 0;
|
||||
return 60;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableEditType
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
ViewControl_EditType VInspector_ItemV3dView::GetTableEditType (const int theRow, const int) const
|
||||
ViewControl_EditType VInspector_ItemV3dView::GetTableEditType (const int, const int) const
|
||||
{
|
||||
return ViewControl_EditType_None;
|
||||
}
|
||||
@@ -155,7 +136,7 @@ ViewControl_EditType VInspector_ItemV3dView::GetTableEditType (const int theRow,
|
||||
// function : GetTableEnumValues
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QList<QVariant> VInspector_ItemV3dView::GetTableEnumValues (const int theRow, const int) const
|
||||
QList<QVariant> VInspector_ItemV3dView::GetTableEnumValues (const int, const int) const
|
||||
{
|
||||
QList<QVariant> aValues;
|
||||
return aValues;
|
||||
@@ -169,17 +150,95 @@ QVariant VInspector_ItemV3dView::GetTableData (const int theRow, const int theCo
|
||||
{
|
||||
if (theRole != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
Handle(V3d_View) aView = GetView();
|
||||
if (aView.IsNull())
|
||||
return QVariant();
|
||||
|
||||
bool isFirstColumn = theColumn == 0;
|
||||
switch (theRow)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if (isFirstColumn)
|
||||
return QVariant ("ImmediateUpdate");
|
||||
|
||||
Standard_Boolean aCurState = aView->SetImmediateUpdate (Standard_False);
|
||||
aView->SetImmediateUpdate (aCurState);
|
||||
|
||||
return aCurState;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if (isFirstColumn)
|
||||
return QVariant ("ActiveLights");
|
||||
|
||||
V3d_ListOfLightIterator aLightsIt = aView->ActiveLightIterator();
|
||||
Standard_Integer aNbOfLights = 0;
|
||||
while (aLightsIt.More())
|
||||
{
|
||||
aNbOfLights++;
|
||||
aLightsIt.Next();
|
||||
}
|
||||
return aNbOfLights;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if (isFirstColumn)
|
||||
return QVariant ("Axis: origin");
|
||||
|
||||
Standard_Real aX, anY, aZ, aVx, aVy, aVz;
|
||||
aView->Axis (aX, anY, aZ, aVx, aVy, aVz);
|
||||
|
||||
return ViewControl_Tools::ToString (gp_Pnt (aX, anY, aZ)).ToCString();
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
if (isFirstColumn)
|
||||
return QVariant ("Axis: direction");
|
||||
|
||||
Standard_Real aX, anY, aZ, aVx, aVy, aVz;
|
||||
aView->Axis (aX, anY, aZ, aVx, aVy, aVz);
|
||||
|
||||
return ViewControl_Tools::ToString (gp_Dir (aVx, aVy, aVz)).ToCString();
|
||||
}
|
||||
case 4: return isFirstColumn ? QVariant ("ComputedMode") : QVariant (aView->ComputedMode());
|
||||
case 5: return isFirstColumn ? QVariant ("AutoZFitMode") : QVariant (aView->AutoZFitMode());
|
||||
case 6: return isFirstColumn ? QVariant ("AutoZFitScaleFactor") : QVariant (aView->AutoZFitScaleFactor());
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetTableData
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool VInspector_ItemV3dView::SetTableData (const int theRow, const int, const QVariant& theValue)
|
||||
bool VInspector_ItemV3dView::SetTableData (const int, const int, const QVariant&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : buildPresentationShape
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TopoDS_Shape VInspector_ItemV3dView::buildPresentationShape (const Handle(V3d_View)& theView)
|
||||
{
|
||||
BRep_Builder aBuilder;
|
||||
TopoDS_Compound aCompound;
|
||||
aBuilder.MakeCompound (aCompound);
|
||||
|
||||
Standard_Real aX, anY, aZ, aVx, aVy, aVz;
|
||||
theView->Axis (aX, anY, aZ, aVx, aVy, aVz);
|
||||
gp_Pnt anOrigin (aX, anY, aZ);
|
||||
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (anOrigin));
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Lin (anOrigin, gp_Dir (aVx, aVy, aVz))));
|
||||
|
||||
return aCompound;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : createChild
|
||||
// purpose :
|
||||
@@ -187,7 +246,11 @@ bool VInspector_ItemV3dView::SetTableData (const int theRow, const int, const QV
|
||||
TreeModel_ItemBasePtr VInspector_ItemV3dView::createChild (int theRow, int theColumn)
|
||||
{
|
||||
if (theRow == 0)
|
||||
return VInspector_ItemGraphic3dClipPlane::CreateItem (currentItem(), theRow, theColumn);
|
||||
return VInspector_ItemGraphic3dCamera::CreateItem (currentItem(), theRow, theColumn);
|
||||
else if (theRow == 1)
|
||||
return VInspector_ItemAspectWindow::CreateItem (currentItem(), theRow, theColumn);
|
||||
else if (theRow == 2)
|
||||
return VInspector_ItemGraphic3dCView::CreateItem (currentItem(), theRow, theColumn);
|
||||
|
||||
return TreeModel_ItemBasePtr();
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include <Standard.hxx>
|
||||
#include <inspector/VInspector_ItemBase.hxx>
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
|
||||
class VInspector_ItemV3dView;
|
||||
@@ -46,12 +47,13 @@ public:
|
||||
//! Resets cached values
|
||||
Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
|
||||
|
||||
//! Returns current drawer, initialize the drawer if it was not initialized yet
|
||||
Standard_EXPORT Handle(V3d_View) GetView() const;
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myView; }
|
||||
|
||||
//! Returns clip plane of the row if possible
|
||||
//! \param theRow child row index
|
||||
Standard_EXPORT Handle(Graphic3d_ClipPlane) GetClipPlane(const int theRow);
|
||||
//! Returns current drawer, initialize the drawer if it was not initialized yet
|
||||
Standard_EXPORT Handle(V3d_View) GetView() const
|
||||
{ return Handle(V3d_View)::DownCast (GetObject()); }
|
||||
|
||||
protected:
|
||||
//! Initialize the current item. It is empty because Reset() is also empty.
|
||||
@@ -93,6 +95,17 @@ protected:
|
||||
//! \param theValue a new cell value
|
||||
virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! Build presentation shape
|
||||
//! \return generated shape of the item parameters
|
||||
virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE { return buildPresentationShape (myView); }
|
||||
|
||||
//! Creates shape for the 3d view parameters
|
||||
//! \param theView current view
|
||||
//! \return shape or NULL
|
||||
static TopoDS_Shape buildPresentationShape (const Handle(V3d_View)& theView);
|
||||
|
||||
protected:
|
||||
|
||||
//! Creates a child item in the given position.
|
||||
|
@@ -26,6 +26,29 @@
|
||||
#include <QStringList>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : GetView
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(V3d_View) VInspector_ItemV3dViewer::GetView (const int theRow) const
|
||||
{
|
||||
Handle(V3d_Viewer) aViewer = GetViewer();
|
||||
|
||||
int aViewId = 0;
|
||||
for (V3d_ListOfViewIterator anActiveViewIter (GetViewer()->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next())
|
||||
{
|
||||
Handle(V3d_View) aView = anActiveViewIter.Value();
|
||||
if (aView->View().IsNull())
|
||||
continue;
|
||||
|
||||
if (theRow == aViewId)
|
||||
return aView;
|
||||
aViewId++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : initRowCount
|
||||
// purpose :
|
||||
@@ -35,7 +58,13 @@ int VInspector_ItemV3dViewer::initRowCount() const
|
||||
if (Column() != 0)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
int aNbOfViews = 0;
|
||||
for (V3d_ListOfViewIterator anActiveViewIter (GetViewer()->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next())
|
||||
{
|
||||
if (!anActiveViewIter.Value().IsNull())
|
||||
aNbOfViews++;
|
||||
}
|
||||
return aNbOfViews;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -106,17 +135,6 @@ void VInspector_ItemV3dViewer::initItem() const
|
||||
const_cast<VInspector_ItemV3dViewer*>(this)->Init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetViewer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
Handle(V3d_Viewer) VInspector_ItemV3dViewer::GetViewer() const
|
||||
{
|
||||
initItem();
|
||||
return myViewer;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableRowCount
|
||||
// purpose :
|
||||
|
@@ -40,14 +40,24 @@ public:
|
||||
//! Destructor
|
||||
virtual ~VInspector_ItemV3dViewer() Standard_OVERRIDE {};
|
||||
|
||||
//! Returns view by index using active views iterator
|
||||
//! \param theRow row index of the view
|
||||
//! \return view
|
||||
Standard_EXPORT Handle(V3d_View) GetView (const int theRow) const;
|
||||
|
||||
//! Inits the item, fills internal containers
|
||||
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||
|
||||
//! Resets cached values
|
||||
Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
|
||||
|
||||
//! Returns data object of the item.
|
||||
//! \return object
|
||||
virtual Handle(Standard_Transient) GetObject() const { initItem(); return myViewer; }
|
||||
|
||||
//! Returns current drawer, initialize the drawer if it was not initialized yet
|
||||
Standard_EXPORT Handle(V3d_Viewer) GetViewer() const;
|
||||
Standard_EXPORT Handle(V3d_Viewer) GetViewer() const
|
||||
{ return Handle(V3d_Viewer)::DownCast (GetObject()); }
|
||||
|
||||
protected:
|
||||
//! Initialize the current item. It is empty because Reset() is also empty.
|
||||
|
@@ -56,7 +56,7 @@ private:
|
||||
//! aSelection, available in Shape mode, specified by
|
||||
//! aMode
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode) {}
|
||||
const Standard_Integer theMode) {(void)theSelection; (void)theMode; }
|
||||
|
||||
// OCCT RTTI
|
||||
DEFINE_STANDARD_RTTIEXT(VInspector_PrsOpenGlElement, AIS_InteractiveObject)
|
||||
|
@@ -15,10 +15,13 @@
|
||||
|
||||
#include <inspector/VInspector_TableModelValues.hxx>
|
||||
|
||||
#include <inspector/ViewControl_Pane.hxx>
|
||||
#include <inspector/ViewControl_TableModel.hxx>
|
||||
#include <inspector/ViewControl_TableModelFilter.hxx>
|
||||
#include <inspector/VInspector_Tools.hxx>
|
||||
|
||||
#include <inspector/ViewControl_PaneCreator.hxx>
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QFont>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
@@ -28,8 +31,9 @@
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
VInspector_TableModelValues::VInspector_TableModelValues (const TreeModel_ItemBasePtr& theItem)
|
||||
: ViewControl_TableModelValues(), myItem (theItem)
|
||||
VInspector_TableModelValues::VInspector_TableModelValues (const TreeModel_ItemBasePtr& theItem,
|
||||
const NCollection_List<Handle(ViewControl_PaneCreator)>& theCreators)
|
||||
: ViewControl_TableModelValues(), myItem (theItem), myCreators (theCreators)
|
||||
{
|
||||
QList<TreeModel_HeaderSection> aHeaderValues;
|
||||
aHeaderValues.append(TreeModel_HeaderSection ("Function", 190));
|
||||
@@ -70,7 +74,26 @@ QVariant VInspector_TableModelValues::Data (const int theRow, const int theColum
|
||||
return ViewControl_TableModelValues::EditCellColor();
|
||||
}
|
||||
default:
|
||||
return GetItem()->GetTableData (theRow, theColumn, theRole);
|
||||
{
|
||||
VInspector_ItemBasePtr anItem = GetItem();
|
||||
Handle(Standard_Transient) anObject = anItem->GetObject();
|
||||
if (anObject.IsNull())
|
||||
return anItem->GetTableData (theRow, theColumn, theRole);
|
||||
|
||||
int aCurrentRow = theRow;
|
||||
for (NCollection_List<Handle(ViewControl_PaneCreator)>::Iterator anIterator (myCreators); anIterator.More(); anIterator.Next())
|
||||
{
|
||||
Handle(ViewControl_PaneCreator) aCreator = anIterator.Value();
|
||||
ViewControl_Pane* aPane = aCreator->GetPane (anObject->DynamicType()->Name());
|
||||
if (!aPane)
|
||||
continue;
|
||||
if (aCurrentRow >= aPane->GetTableRowCount (anObject))
|
||||
aCurrentRow -= aPane->GetTableRowCount (anObject);
|
||||
else
|
||||
return aPane->GetTableData (anObject, aCurrentRow, theColumn, theRole);
|
||||
}
|
||||
return anItem->GetTableData (aCurrentRow, theColumn, theRole);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +107,24 @@ bool VInspector_TableModelValues::SetData (const int theRow, const int theColumn
|
||||
if (theRole != Qt::EditRole)
|
||||
return false;
|
||||
|
||||
return GetItem()->SetTableData (theRow, theColumn, theValue);
|
||||
VInspector_ItemBasePtr anItem = GetItem();
|
||||
Handle(Standard_Transient) anObject = anItem->GetObject();
|
||||
if (anObject.IsNull())
|
||||
return anItem->SetTableData (theRow, theColumn, theValue);
|
||||
|
||||
int aCurrentRow = theRow;
|
||||
for (NCollection_List<Handle(ViewControl_PaneCreator)>::Iterator anIterator (myCreators); anIterator.More(); anIterator.Next())
|
||||
{
|
||||
Handle(ViewControl_PaneCreator) aCreator = anIterator.Value();
|
||||
ViewControl_Pane* aPane = aCreator->GetPane (anObject->DynamicType()->Name());
|
||||
if (!aPane)
|
||||
continue;
|
||||
if (aCurrentRow >= aPane->GetTableRowCount (anObject))
|
||||
aCurrentRow -= aPane->GetTableRowCount (anObject);
|
||||
else
|
||||
return aPane->SetTableData (anObject, aCurrentRow, theColumn, theValue);
|
||||
}
|
||||
return anItem->SetTableData (aCurrentRow, theColumn, theValue);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -109,7 +149,22 @@ Qt::ItemFlags VInspector_TableModelValues::Flags (const QModelIndex& theIndex) c
|
||||
|
||||
int VInspector_TableModelValues::GetValuesCount () const
|
||||
{
|
||||
return GetItem()->GetTableRowCount() * 2;
|
||||
VInspector_ItemBasePtr anItem = GetItem();
|
||||
|
||||
int aRowCount = anItem->GetTableRowCount();
|
||||
Handle(Standard_Transient) anObject = anItem->GetObject();
|
||||
if (anObject.IsNull())
|
||||
return aRowCount * 2;
|
||||
|
||||
for (NCollection_List<Handle(ViewControl_PaneCreator)>::Iterator anIterator (myCreators); anIterator.More(); anIterator.Next())
|
||||
{
|
||||
Handle(ViewControl_PaneCreator) aCreator = anIterator.Value();
|
||||
ViewControl_Pane* aPane = aCreator->GetPane (anObject->DynamicType()->Name());
|
||||
if (!aPane)
|
||||
continue;
|
||||
aRowCount += aPane->GetTableRowCount (anObject);
|
||||
}
|
||||
return aRowCount * 2;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -122,7 +177,24 @@ ViewControl_EditType VInspector_TableModelValues::GetEditType (const int theRow,
|
||||
if (theColumn == 0)
|
||||
return ViewControl_EditType_None;
|
||||
|
||||
return GetItem()->GetTableEditType (theRow, theColumn);
|
||||
VInspector_ItemBasePtr anItem = GetItem();
|
||||
Handle(Standard_Transient) anObject = anItem->GetObject();
|
||||
if (anObject.IsNull())
|
||||
return anItem->GetTableEditType (theRow, theColumn);
|
||||
|
||||
int aCurrentRow = theRow;
|
||||
for (NCollection_List<Handle(ViewControl_PaneCreator)>::Iterator anIterator (myCreators); anIterator.More(); anIterator.Next())
|
||||
{
|
||||
Handle(ViewControl_PaneCreator) aCreator = anIterator.Value();
|
||||
ViewControl_Pane* aPane = aCreator->GetPane (anObject->DynamicType()->Name());
|
||||
if (!aPane)
|
||||
continue;
|
||||
if (aCurrentRow >= aPane->GetTableRowCount (anObject))
|
||||
aCurrentRow -= aPane->GetTableRowCount (anObject);
|
||||
else
|
||||
return aPane->GetTableEditType (anObject, aCurrentRow, theColumn);
|
||||
}
|
||||
return anItem->GetTableEditType (aCurrentRow, theColumn);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -135,7 +207,24 @@ QList<QVariant> VInspector_TableModelValues::GetEnumValues (const int theRow, co
|
||||
if (theColumn != 1)
|
||||
return QList<QVariant>();
|
||||
|
||||
return GetItem()->GetTableEnumValues (theRow, theColumn);
|
||||
VInspector_ItemBasePtr anItem = GetItem();
|
||||
Handle(Standard_Transient) anObject = anItem->GetObject();
|
||||
if (anObject.IsNull())
|
||||
return anItem->GetTableEnumValues (theRow, theColumn);
|
||||
|
||||
int aCurrentRow = theRow;
|
||||
for (NCollection_List<Handle(ViewControl_PaneCreator)>::Iterator anIterator (myCreators); anIterator.More(); anIterator.Next())
|
||||
{
|
||||
Handle(ViewControl_PaneCreator) aCreator = anIterator.Value();
|
||||
ViewControl_Pane* aPane = aCreator->GetPane (anObject->DynamicType()->Name());
|
||||
if (!aPane)
|
||||
continue;
|
||||
if (aCurrentRow >= aPane->GetTableRowCount (anObject))
|
||||
aCurrentRow -= aPane->GetTableRowCount (anObject);
|
||||
else
|
||||
return aPane->GetTableEnumValues (anObject, aCurrentRow, theColumn);
|
||||
}
|
||||
return anItem->GetTableEnumValues (aCurrentRow, theColumn);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -21,6 +21,10 @@
|
||||
#include <inspector/VInspector_ItemBase.hxx>
|
||||
#include <inspector/TreeModel_ItemBase.hxx>
|
||||
|
||||
class ViewControl_PaneCreator;
|
||||
|
||||
#include <NCollection_List.hxx>
|
||||
|
||||
//! \class VInspector_TableModelValues
|
||||
//! \brief This is an implementation for ViewControl_TableModel to present tree item values
|
||||
class VInspector_TableModelValues : public ViewControl_TableModelValues
|
||||
@@ -28,7 +32,8 @@ class VInspector_TableModelValues : public ViewControl_TableModelValues
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
Standard_EXPORT VInspector_TableModelValues (const TreeModel_ItemBasePtr& theItem);
|
||||
Standard_EXPORT VInspector_TableModelValues (const TreeModel_ItemBasePtr& theItem,
|
||||
const NCollection_List<Handle(ViewControl_PaneCreator)>& theCreators);
|
||||
|
||||
//! Destructor
|
||||
virtual ~VInspector_TableModelValues() Standard_OVERRIDE {}
|
||||
@@ -84,6 +89,7 @@ private:
|
||||
VInspector_ItemBasePtr GetItem() const;
|
||||
|
||||
private:
|
||||
NCollection_List<Handle(ViewControl_PaneCreator)> myCreators; //!< pane creators
|
||||
TreeModel_ItemBasePtr myItem; //!< source item base
|
||||
};
|
||||
|
||||
|
@@ -30,6 +30,8 @@
|
||||
#include <AIS_Trihedron.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepPrimAPI_MakeBox.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <Graphic3d.hxx>
|
||||
#include <Graphic3d_IndexBuffer.hxx>
|
||||
@@ -46,6 +48,8 @@
|
||||
#include <QStringList>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
#include <TopoDS_Compound.hxx>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
// =======================================================================
|
||||
@@ -511,6 +515,7 @@ TopoDS_Shape VInspector_Tools::ReadShape (const TCollection_AsciiString& theFile
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_Tools::GetPropertyTableValues (const TreeModel_ItemBasePtr& theItem,
|
||||
const NCollection_List<Handle(ViewControl_PaneCreator)>& theCreators,
|
||||
QList<ViewControl_TableModelValues*>& theTableValues)
|
||||
{
|
||||
TreeModel_ItemBasePtr anItem = theItem;
|
||||
@@ -523,7 +528,7 @@ void VInspector_Tools::GetPropertyTableValues (const TreeModel_ItemBasePtr& theI
|
||||
anItem = theItem->Parent();
|
||||
}
|
||||
|
||||
theTableValues.append (new VInspector_TableModelValues (anItem));
|
||||
theTableValues.append (new VInspector_TableModelValues (anItem, theCreators));
|
||||
}
|
||||
|
||||
namespace
|
||||
@@ -590,6 +595,65 @@ TopoDS_Shape VInspector_Tools::CreateShape (const Bnd_Box& theBoundingBox)
|
||||
return aBoxBuilder.Shape();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CreateShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopoDS_Shape VInspector_Tools::CreateShape (const Select3D_BndBox3d& theBoundingBox)
|
||||
{
|
||||
if (!theBoundingBox.IsValid())
|
||||
return TopoDS_Shape();
|
||||
|
||||
gp_Pnt aPntMin = gp_Pnt (theBoundingBox.CornerMin().x(), theBoundingBox.CornerMin().y(), theBoundingBox.CornerMin().z());
|
||||
gp_Pnt aPntMax = gp_Pnt (theBoundingBox.CornerMax().x(), theBoundingBox.CornerMax().y(), theBoundingBox.CornerMax().z());
|
||||
|
||||
Standard_Boolean aThinOnX = fabs (aPntMin.X() - aPntMax.X()) < Precision::Confusion();
|
||||
Standard_Boolean aThinOnY = fabs (aPntMin.Y() - aPntMax.Y()) < Precision::Confusion();
|
||||
Standard_Boolean aThinOnZ = fabs (aPntMin.Z() - aPntMax.Z()) < Precision::Confusion();
|
||||
if (aThinOnX || aThinOnY || aThinOnZ)
|
||||
{
|
||||
gp_Pnt aPnt1, aPnt2, aPnt3, aPnt4 ;
|
||||
if (aThinOnX)
|
||||
{
|
||||
aPnt1 = gp_Pnt(aPntMin.X(), aPntMin.Y(), aPntMin.Z());
|
||||
aPnt2 = gp_Pnt(aPntMin.X(), aPntMax.Y(), aPntMin.Z());
|
||||
aPnt3 = gp_Pnt(aPntMin.X(), aPntMax.Y(), aPntMax.Z());
|
||||
aPnt4 = gp_Pnt(aPntMin.X(), aPntMin.Y(), aPntMax.Z());
|
||||
}
|
||||
if (aThinOnY)
|
||||
{
|
||||
aPnt1 = gp_Pnt(aPntMin.X(), aPntMin.Y(), aPntMin.Z());
|
||||
aPnt2 = gp_Pnt(aPntMax.X(), aPntMin.Y(), aPntMin.Z());
|
||||
aPnt3 = gp_Pnt(aPntMax.X(), aPntMin.Y(), aPntMax.Z());
|
||||
aPnt4 = gp_Pnt(aPntMin.X(), aPntMin.Y(), aPntMax.Z());
|
||||
}
|
||||
if (aThinOnZ)
|
||||
{
|
||||
aPnt1 = gp_Pnt(aPntMin.X(), aPntMin.Y(), aPntMin.Z());
|
||||
aPnt2 = gp_Pnt(aPntMax.X(), aPntMin.Y(), aPntMin.Z());
|
||||
aPnt3 = gp_Pnt(aPntMax.X(), aPntMax.Y(), aPntMin.Z());
|
||||
aPnt4 = gp_Pnt(aPntMin.X(), aPntMax.Y(), aPntMin.Z());
|
||||
}
|
||||
BRep_Builder aBuilder;
|
||||
TopoDS_Compound aCompound;
|
||||
aBuilder.MakeCompound (aCompound);
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt1, aPnt2));
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt2, aPnt3));
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt3, aPnt4));
|
||||
aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt4, aPnt1));
|
||||
|
||||
return aCompound;
|
||||
}
|
||||
else
|
||||
{
|
||||
BRepPrimAPI_MakeBox aBoxBuilder (
|
||||
gp_Pnt (theBoundingBox.CornerMin().x(), theBoundingBox.CornerMin().y(), theBoundingBox.CornerMin().z()),
|
||||
gp_Pnt (theBoundingBox.CornerMax().x(), theBoundingBox.CornerMax().y(), theBoundingBox.CornerMax().z()));
|
||||
return aBoxBuilder.Shape();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ToVariant
|
||||
//purpose :
|
||||
|
@@ -31,6 +31,9 @@
|
||||
#include <inspector/VInspector_CallBackMode.hxx>
|
||||
#include <inspector/VInspector_DisplayActionType.hxx>
|
||||
#include <inspector/VInspector_SelectionType.hxx>
|
||||
|
||||
#include <inspector/ViewControl_PaneCreator.hxx>
|
||||
|
||||
#include <inspector/TreeModel_ItemBase.hxx>
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
@@ -148,6 +151,7 @@ public:
|
||||
//! \param theAlert a message alert
|
||||
//! \param theTableValue container of values
|
||||
Standard_EXPORT static void GetPropertyTableValues (const TreeModel_ItemBasePtr& theItem,
|
||||
const NCollection_List<Handle(ViewControl_PaneCreator)>& theCreators,
|
||||
QList<ViewControl_TableModelValues*>& theTableValues);
|
||||
|
||||
//! Returns the string name for a given type.
|
||||
@@ -177,12 +181,16 @@ public:
|
||||
//! \return string presentation
|
||||
Standard_EXPORT static QVariant ToVariant (const Select3D_BndBox3d& theBoundingBox);
|
||||
|
||||
|
||||
//! Creates box shape
|
||||
//! \param theBoundingBox box shape parameters
|
||||
//! \return created shape
|
||||
Standard_EXPORT static TopoDS_Shape CreateShape (const Bnd_Box& theBoundingBox);
|
||||
|
||||
//! Creates box shape
|
||||
//! \param theBoundingBox box shape parameters
|
||||
//! \return created shape
|
||||
Standard_EXPORT static TopoDS_Shape CreateShape (const Select3D_BndBox3d& theBoundingBox);
|
||||
|
||||
//! Build string presentation of Graphic3D index buffer
|
||||
//! \param theIndexBuffer index buffer
|
||||
//! \return string presentation
|
||||
|
@@ -45,11 +45,12 @@ VInspector_ViewModelHistory::VInspector_ViewModelHistory (QObject* theParent, co
|
||||
: TreeModel_ModelBase (theParent)
|
||||
{
|
||||
SetHeaderItem (0, TreeModel_HeaderSection ("Name", COLUMN_NAME_WIDTH));
|
||||
SetHeaderItem (1, TreeModel_HeaderSection ("Size", COLUMN_SIZE_WIDTH));
|
||||
SetHeaderItem (2, TreeModel_HeaderSection ("Pointer", COLUMN_POINTER_WIDTH));
|
||||
SetHeaderItem (3, TreeModel_HeaderSection ("Shape type", COLUMN_SHAPE_TYPE_WIDTH));
|
||||
SetHeaderItem (4, TreeModel_HeaderSection ("AIS Name", COLUMN_AIS_NAME_WIDTH));
|
||||
SetHeaderItem (5, TreeModel_HeaderSection ("Selected/Highlighted", -1));
|
||||
SetHeaderItem (1, TreeModel_HeaderSection ("Visibility", COLUMN_SIZE_WIDTH)); // visualization item
|
||||
SetHeaderItem (2, TreeModel_HeaderSection ("Size", COLUMN_SIZE_WIDTH));
|
||||
SetHeaderItem (3, TreeModel_HeaderSection ("Pointer", COLUMN_POINTER_WIDTH));
|
||||
SetHeaderItem (4, TreeModel_HeaderSection ("Shape type", COLUMN_SHAPE_TYPE_WIDTH));
|
||||
SetHeaderItem (5, TreeModel_HeaderSection ("AIS Name", COLUMN_AIS_NAME_WIDTH));
|
||||
SetHeaderItem (6, TreeModel_HeaderSection ("Selected/Highlighted", -1));
|
||||
|
||||
for (int aColumnId = 0, aNbColumns = columnCount(); aColumnId < aNbColumns; aColumnId++)
|
||||
{
|
||||
|
@@ -16,7 +16,9 @@
|
||||
#include <inspector/VInspector_Window.hxx>
|
||||
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <AIS_Trihedron.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <Geom_Axis2Placement.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
|
||||
#include <inspector/TreeModel_ColumnType.hxx>
|
||||
@@ -42,6 +44,8 @@
|
||||
#include <inspector/VInspector_ViewModel.hxx>
|
||||
#include <inspector/VInspector_ViewModelHistory.hxx>
|
||||
|
||||
#include <inspector/VInspectorPaneAIS_PaneCreator.hxx>
|
||||
|
||||
#include <inspector/ViewControl_PropertyView.hxx>
|
||||
#include <inspector/ViewControl_TreeView.hxx>
|
||||
|
||||
@@ -62,6 +66,11 @@
|
||||
#include <QWidget>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
//#define DEBUG_TWO_VIEWS
|
||||
#ifdef DEBUG_TWO_VIEWS
|
||||
#include <inspector/View_CameraPositionPrs.hxx>
|
||||
#endif
|
||||
|
||||
const int VINSPECTOR_DEFAULT_PROPERTY_VIEW_WIDTH = 300;//600;
|
||||
const int VINSPECTOR_DEFAULT_PROPERTY_VIEW_HEIGHT = 1000;
|
||||
|
||||
@@ -128,6 +137,8 @@ VInspector_Window::VInspector_Window()
|
||||
myMainWindow->setCentralWidget (aCentralWidget);
|
||||
|
||||
// property view
|
||||
myPaneCreators.Append (new VInspectorPaneAIS_PaneCreator());
|
||||
|
||||
myPropertyView = new ViewControl_PropertyView (myMainWindow,
|
||||
QSize(VINSPECTOR_DEFAULT_PROPERTY_VIEW_WIDTH, VINSPECTOR_DEFAULT_PROPERTY_VIEW_HEIGHT));
|
||||
myPropertyPanelWidget = new QDockWidget (tr ("PropertyPanel"), myMainWindow);
|
||||
@@ -300,6 +311,14 @@ void VInspector_Window::UpdateContent()
|
||||
myTreeView->scrollTo (aPresentationIndex);
|
||||
}
|
||||
}
|
||||
|
||||
if (!myCallBack.IsNull())
|
||||
{
|
||||
VInspector_ViewModelHistory* aHistoryModel = dynamic_cast<VInspector_ViewModelHistory*>
|
||||
(myHistoryView->model());
|
||||
aHistoryModel->Reset();
|
||||
aHistoryModel->EmitLayoutChanged();
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -310,15 +329,7 @@ NCollection_List<Handle(AIS_InteractiveObject)> VInspector_Window::GetSelectedPr
|
||||
{
|
||||
NCollection_List<Handle(AIS_InteractiveObject)> aSelectedPresentations;
|
||||
|
||||
QList<TreeModel_ItemBasePtr> anItems;
|
||||
QModelIndexList anIndices = theModel->selectedIndexes();
|
||||
for (QModelIndexList::const_iterator anIndicesIt = anIndices.begin(); anIndicesIt != anIndices.end(); anIndicesIt++)
|
||||
{
|
||||
TreeModel_ItemBasePtr anItem = TreeModel_ModelBase::GetItemByIndex (*anIndicesIt);
|
||||
if (!anItem || anItems.contains (anItem))
|
||||
continue;
|
||||
anItems.append (anItem);
|
||||
}
|
||||
QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::GetSelectedItems (theModel->selectedIndexes());
|
||||
|
||||
QList<size_t> aSelectedIds; // Remember of selected address in order to avoid duplicates
|
||||
NCollection_List<Handle(Standard_Transient)> anItemPresentations;
|
||||
@@ -349,21 +360,11 @@ NCollection_List<Handle(AIS_InteractiveObject)> VInspector_Window::GetSelectedPr
|
||||
// function : GetSelectedShapes
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
NCollection_List<TopoDS_Shape> VInspector_Window::GetSelectedShapes (QItemSelectionModel* theModel)
|
||||
NCollection_List<TopoDS_Shape> VInspector_Window::GetSelectedShapes (const QModelIndexList& theIndices)
|
||||
{
|
||||
NCollection_List<TopoDS_Shape> aSelectedShapes;
|
||||
|
||||
QList<TreeModel_ItemBasePtr> anItems;
|
||||
QModelIndexList anIndices = theModel->selectedIndexes();
|
||||
for (QModelIndexList::const_iterator anIndicesIt = anIndices.begin(); anIndicesIt != anIndices.end(); anIndicesIt++)
|
||||
{
|
||||
TreeModel_ItemBasePtr anItem = TreeModel_ModelBase::GetItemByIndex (*anIndicesIt);
|
||||
if (!anItem || anItems.contains (anItem))
|
||||
continue;
|
||||
anItems.append (anItem);
|
||||
}
|
||||
|
||||
QList<size_t> aSelectedIds; // Remember of selected address in order to avoid duplicates
|
||||
QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::GetSelectedItems (theIndices);
|
||||
for (QList<TreeModel_ItemBasePtr>::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++)
|
||||
{
|
||||
TreeModel_ItemBasePtr anItem = *anItemIt;
|
||||
@@ -419,6 +420,36 @@ NCollection_List<OpenGl_Element*> VInspector_Window::GetSelectedElements (QItemS
|
||||
return anElements;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetSelectedTransformPers
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Graphic3d_TransformPers) VInspector_Window::GetSelectedTransformPers()
|
||||
{
|
||||
QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::GetSelectedItems (myTreeView->selectionModel()->selectedIndexes());
|
||||
for (QList<TreeModel_ItemBasePtr>::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++)
|
||||
{
|
||||
TreeModel_ItemBasePtr anItem = *anItemIt;
|
||||
VInspector_ItemBasePtr aVItem = itemDynamicCast<VInspector_ItemBase>(anItem);
|
||||
if (!aVItem)
|
||||
continue;
|
||||
|
||||
Handle(AIS_InteractiveObject) anIO;
|
||||
while (aVItem && anIO.IsNull())
|
||||
{
|
||||
VInspector_ItemPresentableObjectPtr aPrsObjectItem = itemDynamicCast<VInspector_ItemPresentableObject>(aVItem);
|
||||
if (aPrsObjectItem)
|
||||
{
|
||||
anIO = aPrsObjectItem->GetInteractiveObject();
|
||||
}
|
||||
aVItem = itemDynamicCast<VInspector_ItemBase>(aVItem->Parent());
|
||||
}
|
||||
if (!anIO.IsNull() && !anIO->TransformPersistence().IsNull())
|
||||
return anIO->TransformPersistence();
|
||||
}
|
||||
return Handle(Graphic3d_TransformPers)();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
@@ -654,8 +685,8 @@ void VInspector_Window::onTreeViewSelectionChanged (const QItemSelection&,
|
||||
if (myPropertyPanelWidget->toggleViewAction()->isChecked())
|
||||
updatePropertyPanelBySelection();
|
||||
|
||||
NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (myTreeView->selectionModel());
|
||||
updatePreviewPresentation(aSelectedShapes);
|
||||
NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (myTreeView->selectionModel()->selectedIndexes());
|
||||
updatePreviewPresentation(aSelectedShapes, GetSelectedTransformPers());
|
||||
|
||||
NCollection_List<OpenGl_Element*> aSelectedElements = GetSelectedElements (myTreeView->selectionModel());
|
||||
updatePreviewPresentation(aSelectedElements);
|
||||
@@ -701,8 +732,9 @@ void VInspector_Window::onHistoryViewSelectionChanged (const QItemSelection& the
|
||||
// =======================================================================
|
||||
void VInspector_Window::onExportToShapeView()
|
||||
{
|
||||
NCollection_List<Handle(AIS_InteractiveObject)> aSelectedPresentations = GetSelectedPresentations (myTreeView->selectionModel());
|
||||
if (aSelectedPresentations.Extent() <= 0)
|
||||
const QModelIndexList anIndices;
|
||||
NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (myTreeView->selectionModel()->selectedIndexes());
|
||||
if (aSelectedShapes.Extent() <= 0)
|
||||
return;
|
||||
|
||||
TCollection_AsciiString aPluginName ("TKShapeView");
|
||||
@@ -715,13 +747,9 @@ void VInspector_Window::onExportToShapeView()
|
||||
anItemNames = myParameters->GetSelectedNames (aPluginName);
|
||||
|
||||
QStringList anExportedPointers;
|
||||
for (NCollection_List<Handle(AIS_InteractiveObject)>::Iterator anIOIt (aSelectedPresentations); anIOIt.More(); anIOIt.Next())
|
||||
for (NCollection_List<TopoDS_Shape>::Iterator anIOIt (aSelectedShapes); anIOIt.More(); anIOIt.Next())
|
||||
{
|
||||
Handle(AIS_Shape) aShapePresentation = Handle(AIS_Shape)::DownCast (anIOIt.Value());
|
||||
if (aShapePresentation.IsNull())
|
||||
continue;
|
||||
|
||||
const TopoDS_Shape& aShape = aShapePresentation->Shape();
|
||||
const TopoDS_Shape& aShape = anIOIt.Value();
|
||||
if (aShape.IsNull())
|
||||
continue;
|
||||
aParameters.Append (aShape.TShape());
|
||||
@@ -758,6 +786,54 @@ void VInspector_Window::onDisplayActionTypeClicked()
|
||||
displaySelectedPresentations (VInspector_Tools::DisplayActionTypeFromString (anAction->text().toStdString().c_str()));
|
||||
}
|
||||
|
||||
#ifdef DEBUG_TWO_VIEWS
|
||||
// =======================================================================
|
||||
// function : onViewLeftButtonDown
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_Window::onViewLeftButtonDown (const int theX, const int theY)
|
||||
{
|
||||
myCameraPrs->StartTransformation (theX, theY);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : onViewLeftButtonUp
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_Window::onViewLeftButtonUp (const int theX, const int theY)
|
||||
{
|
||||
myCameraPrs->StopTransformation (theX, theY);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : onViewMoveTo
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_Window::onViewMoveTo (const int theX, const int theY)
|
||||
{
|
||||
View_Widget* aViewWidget = (View_Widget*) sender();
|
||||
|
||||
myCameraPrs->Transform (theX, theY, aViewWidget->GetViewer()->GetView());
|
||||
|
||||
VInspector_ViewModel* aViewModel = dynamic_cast<VInspector_ViewModel*> (myTreeView->model());
|
||||
if (!aViewModel)
|
||||
return;
|
||||
Handle(AIS_InteractiveContext) aContext = aViewModel->GetContext();
|
||||
if (aContext.IsNull())
|
||||
return;
|
||||
aContext->Redisplay (myCameraPrs, Standard_True);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : onViewLeftButtonUp
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_Window::onViewLeftButtonUp()
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
// =======================================================================
|
||||
// function : UpdateTreeModel
|
||||
// purpose :
|
||||
@@ -785,7 +861,7 @@ void VInspector_Window::updatePropertyPanelBySelection()
|
||||
if (aSelected.size() == 1)
|
||||
{
|
||||
TreeModel_ItemBasePtr aSelectedItem = TreeModel_ModelBase::GetItemByIndex(aSelected.first());
|
||||
VInspector_Tools::GetPropertyTableValues (aSelectedItem, aTableValues);
|
||||
VInspector_Tools::GetPropertyTableValues (aSelectedItem, myPaneCreators, aTableValues);
|
||||
}
|
||||
myPropertyView->Init (aTableValues);
|
||||
}
|
||||
@@ -810,13 +886,31 @@ void VInspector_Window::displaySelectedPresentations (const VInspector_DisplayAc
|
||||
return;
|
||||
|
||||
NCollection_List<Handle(AIS_InteractiveObject)> aSelectedPresentations = GetSelectedPresentations (aSelectionModel);
|
||||
if (aSelectedPresentations.Extent() <= 0)
|
||||
return;
|
||||
const QModelIndexList& aSelectedIndices = aSelectionModel->selectedIndexes();
|
||||
|
||||
bool aPreviewPresentationShown = !myPreviewPresentation.IsNull();
|
||||
// the order of objects returned by AIS_InteractiveContext is changed because the processed object is moved from
|
||||
// Erased to Displayed container or back
|
||||
aSelectionModel->clear();
|
||||
|
||||
// redisplay preview presentation if exists
|
||||
if (aPreviewPresentationShown && theType == VInspector_DisplayActionType_RedisplayId)
|
||||
{
|
||||
QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::GetSelectedItems (aSelectedIndices);
|
||||
for (QList<TreeModel_ItemBasePtr>::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++)
|
||||
{
|
||||
TreeModel_ItemBasePtr anItem = *anItemIt;
|
||||
VInspector_ItemBasePtr aVItem = itemDynamicCast<VInspector_ItemBase>(anItem);
|
||||
if (aVItem)
|
||||
aVItem->UpdatePresentationShape();
|
||||
}
|
||||
NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (aSelectedIndices);
|
||||
updatePreviewPresentation(aSelectedShapes, GetSelectedTransformPers());
|
||||
}
|
||||
|
||||
if (aSelectedPresentations.Extent() == 0)
|
||||
return;
|
||||
|
||||
for (NCollection_List<Handle(AIS_InteractiveObject)>::Iterator anIOIt(aSelectedPresentations); anIOIt.More(); anIOIt.Next())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) aPresentation = anIOIt.Value();
|
||||
@@ -846,19 +940,47 @@ void VInspector_Window::displaySelectedPresentations (const VInspector_DisplayAc
|
||||
// =======================================================================
|
||||
Handle(AIS_InteractiveContext) VInspector_Window::createView()
|
||||
{
|
||||
myViewWindow = new View_Window (0);
|
||||
// create two view windows
|
||||
Handle(AIS_InteractiveContext) aContext = View_Viewer::CreateStandardViewer();
|
||||
|
||||
Handle(AIS_Trihedron) aTrihedron = new AIS_Trihedron (new Geom_Axis2Placement (gp::XOY()));
|
||||
aTrihedron->SetDatumDisplayMode (Prs3d_DM_Shaded);
|
||||
aContext->Display (aTrihedron, Standard_True);
|
||||
|
||||
myViewWindow = new View_Window (0, aContext);
|
||||
myViewWindow->GetView()->SetPredefinedSize (VINSPECTOR_DEFAULT_VIEW_WIDTH, VINSPECTOR_DEFAULT_VIEW_HEIGHT);
|
||||
myViewWindow->move (VINSPECTOR_DEFAULT_VIEW_POSITION_X, VINSPECTOR_DEFAULT_VIEW_POSITION_Y);
|
||||
myViewWindow->show();
|
||||
|
||||
return myViewWindow->GetView()->GetViewer()->GetContext();
|
||||
#ifdef DEBUG_TWO_VIEWS
|
||||
myViewWindow->move (VINSPECTOR_DEFAULT_VIEW_POSITION_X - 240, VINSPECTOR_DEFAULT_VIEW_POSITION_Y);
|
||||
|
||||
View_Window* aSecondViewWindow = new View_Window (0, aContext);
|
||||
aSecondViewWindow->GetView()->SetPredefinedSize (VINSPECTOR_DEFAULT_VIEW_WIDTH, VINSPECTOR_DEFAULT_VIEW_HEIGHT);
|
||||
aSecondViewWindow->move (VINSPECTOR_DEFAULT_VIEW_POSITION_X + 220, VINSPECTOR_DEFAULT_VIEW_POSITION_Y);
|
||||
aSecondViewWindow->show();
|
||||
|
||||
myCameraPrs = new View_CameraPositionPrs (aContext, 0);
|
||||
aContext->Display (myCameraPrs, Standard_True);
|
||||
|
||||
View_Widget* aViewWidget = myViewWindow->GetView();
|
||||
connect (aViewWidget, SIGNAL (leftButtonDown (const int, const int)),
|
||||
this, SLOT (onViewLeftButtonDown (const int, const int)));
|
||||
connect (aViewWidget, SIGNAL (leftButtonUp (const int, const int)),
|
||||
this, SLOT (onViewLeftButtonUp (const int, const int)));
|
||||
connect (aViewWidget, SIGNAL (moveTo (const int, const int)),
|
||||
this, SLOT(onViewMoveTo (const int, const int)));
|
||||
#endif
|
||||
|
||||
return aContext;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : updatePreviewPresentation
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void VInspector_Window::updatePreviewPresentation (const NCollection_List<TopoDS_Shape>& theShapes)
|
||||
void VInspector_Window::updatePreviewPresentation (const NCollection_List<TopoDS_Shape>& theShapes,
|
||||
const Handle(Graphic3d_TransformPers)& thePersistent)
|
||||
{
|
||||
Handle(AIS_InteractiveContext) aContext;
|
||||
VInspector_ViewModel* aViewModel = dynamic_cast<VInspector_ViewModel*> (myTreeView->model());
|
||||
@@ -886,12 +1008,15 @@ void VInspector_Window::updatePreviewPresentation (const NCollection_List<TopoDS
|
||||
myPreviewPresentation = new AIS_Shape (aCompound);
|
||||
myPreviewPresentation->SetColor (Quantity_Color (Quantity_NOC_BLUE1));
|
||||
myPreviewPresentation->SetZLayer (Graphic3d_ZLayerId_Topmost);
|
||||
|
||||
myPreviewPresentation->SetTransformPersistence(thePersistent);
|
||||
if (!aContext.IsNull())
|
||||
aContext->Display (myPreviewPresentation, Standard_True);
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(AIS_Shape)::DownCast (myPreviewPresentation)->Set (aCompound);
|
||||
myPreviewPresentation->SetTransformPersistence(thePersistent);
|
||||
if (!aContext.IsNull())
|
||||
aContext->Redisplay (myPreviewPresentation, Standard_True);
|
||||
}
|
||||
@@ -928,7 +1053,7 @@ void VInspector_Window::updatePreviewPresentation (const NCollection_List<OpenGl
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(VInspector_PrsOpenGlElement)::DownCast (myOpenGlPreviewPresentation)->Set (theElements);
|
||||
myOpenGlPreviewPresentation->Set (theElements);
|
||||
if (!aContext.IsNull())
|
||||
aContext->Redisplay (myOpenGlPreviewPresentation, Standard_True);
|
||||
}
|
||||
|
@@ -25,6 +25,8 @@
|
||||
#include <inspector/VInspector_CallBack.hxx>
|
||||
#include <inspector/VInspector_DisplayActionType.hxx>
|
||||
|
||||
#include <inspector/ViewControl_PaneCreator.hxx>
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QObject>
|
||||
#include <QItemSelection>
|
||||
@@ -47,6 +49,13 @@ class QDockWidget;
|
||||
class QTreeView;
|
||||
class QWidget;
|
||||
|
||||
//#define DEBUG_TWO_VIEWS
|
||||
|
||||
#ifdef DEBUG_TWO_VIEWS
|
||||
class View_CameraPositionPrs;
|
||||
#endif
|
||||
|
||||
|
||||
//! \class VInspector_Window
|
||||
//! Window that unites all VInspector controls.
|
||||
class VInspector_Window : public QObject
|
||||
@@ -96,13 +105,16 @@ public:
|
||||
//! Returns selected shapes
|
||||
//! \param theModel selection model
|
||||
//! \return container of shapes
|
||||
NCollection_List<TopoDS_Shape> GetSelectedShapes (QItemSelectionModel* theModel);
|
||||
NCollection_List<TopoDS_Shape> GetSelectedShapes (const QModelIndexList& theIndices);
|
||||
|
||||
//! Returns selected elements
|
||||
//! \param theModel selection model
|
||||
//! \return container of OpenGl elements
|
||||
NCollection_List<OpenGl_Element*> GetSelectedElements (QItemSelectionModel* theModel);
|
||||
|
||||
//! Returns the first not zero transform persistent of selected elements
|
||||
Handle(Graphic3d_TransformPers) GetSelectedTransformPers();
|
||||
|
||||
private:
|
||||
|
||||
//! Fills controls of the plugin by parameters:
|
||||
@@ -151,6 +163,26 @@ private slots:
|
||||
//! Apply activated display action
|
||||
void onDisplayActionTypeClicked();
|
||||
|
||||
#ifdef DEBUG_TWO_VIEWS
|
||||
//! Processing mouse down in the view
|
||||
//! \param theX X mouse position in pixels
|
||||
//! \param theY Y mouse position in pixels
|
||||
void onViewLeftButtonDown (const int theX, const int theY);
|
||||
|
||||
//! Processing mouse up in the view
|
||||
//! \param theX X mouse position in pixels
|
||||
//! \param theY Y mouse position in pixels
|
||||
void onViewLeftButtonUp (const int theX, const int theY);
|
||||
|
||||
//! Processing move in the view
|
||||
//! \param theX X mouse position in pixels
|
||||
//! \param theY Y mouse position in pixels
|
||||
void onViewMoveTo (const int theX, const int theY);
|
||||
|
||||
//! Processing left button up
|
||||
void onViewLeftButtonUp();
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
//! Inits the window content by the given context
|
||||
@@ -174,7 +206,9 @@ private:
|
||||
|
||||
//!< Updates presentation of preview for parameter shapes. Creates a compound of the shapes
|
||||
//!< \param theShape container of shapes
|
||||
void updatePreviewPresentation (const NCollection_List<TopoDS_Shape>& theShapes);
|
||||
//!< \param thePersistent transform persistent to be used in preview presentation
|
||||
void updatePreviewPresentation (const NCollection_List<TopoDS_Shape>& theShapes,
|
||||
const Handle(Graphic3d_TransformPers)& thePersistent);
|
||||
|
||||
//!< Updates presentation of preview for OpenGl elements.
|
||||
//!< \param theElements container of elements
|
||||
@@ -194,12 +228,18 @@ private:
|
||||
QTreeView* myHistoryView; //!< history of AIS context calls
|
||||
Handle(VInspector_CallBack) myCallBack; //!< AIS context call back, if set
|
||||
|
||||
NCollection_List<Handle(ViewControl_PaneCreator)> myPaneCreators; //!< panes for AIS presentations
|
||||
|
||||
ViewControl_MessageDialog* myExportToShapeViewDialog; //!< dialog about exporting TopoDS_Shape to ShapeView plugin
|
||||
View_Window* myViewWindow; //!< temporary view window, it is created if Open is called but context is still NULL
|
||||
|
||||
Handle(TInspectorAPI_PluginParameters) myParameters; //!< plugins parameters container
|
||||
Handle(AIS_InteractiveObject) myPreviewPresentation; //!< presentation of preview for a selected object
|
||||
Handle(VInspector_PrsOpenGlElement) myOpenGlPreviewPresentation; //!< presentation of preview for OpenGl elements
|
||||
|
||||
#ifdef DEBUG_TWO_VIEWS
|
||||
Handle(View_CameraPositionPrs) myCameraPrs;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
6
tools/VInspectorPaneAIS/FILES
Normal file
6
tools/VInspectorPaneAIS/FILES
Normal file
@@ -0,0 +1,6 @@
|
||||
VInspectorPaneAIS_PaneCreator.cxx
|
||||
VInspectorPaneAIS_PaneCreator.hxx
|
||||
VInspectorPaneAIS_Shape.cxx
|
||||
VInspectorPaneAIS_Shape.hxx
|
||||
VInspectorPaneAIS_Trihedron.cxx
|
||||
VInspectorPaneAIS_Trihedron.hxx
|
53
tools/VInspectorPaneAIS/VInspectorPaneAIS_PaneCreator.cxx
Normal file
53
tools/VInspectorPaneAIS/VInspectorPaneAIS_PaneCreator.cxx
Normal file
@@ -0,0 +1,53 @@
|
||||
// Created on: 2018-12-08
|
||||
// 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/VInspectorPaneAIS_PaneCreator.hxx>
|
||||
#include <inspector/VInspectorPaneAIS_Shape.hxx>
|
||||
#include <inspector/VInspectorPaneAIS_Trihedron.hxx>
|
||||
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <AIS_Trihedron.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(VInspectorPaneAIS_PaneCreator, VInspectorAPI_CallBack)
|
||||
|
||||
// =======================================================================
|
||||
// function : createPane
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
ViewControl_Pane* VInspectorPaneAIS_PaneCreator::createPane (const Standard_CString& theName)
|
||||
{
|
||||
if (theName == STANDARD_TYPE (AIS_Shape)->Name())
|
||||
return new VInspectorPaneAIS_Shape();
|
||||
//else if (theName == STANDARD_TYPE (AIS_Trihedron)->Name())
|
||||
// return new VInspectorPaneAIS_Trihedron();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : buildPresentationShape
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
ViewControl_Pane* VInspectorPaneAIS_PaneCreator::GetPane (const Standard_CString& theName)
|
||||
{
|
||||
if (myPanes.IsBound (theName))
|
||||
return myPanes.Find (theName);
|
||||
|
||||
ViewControl_Pane* aPane = createPane (theName);
|
||||
if (aPane)
|
||||
myPanes.Bind (theName, aPane);
|
||||
|
||||
return aPane;
|
||||
}
|
58
tools/VInspectorPaneAIS/VInspectorPaneAIS_PaneCreator.hxx
Normal file
58
tools/VInspectorPaneAIS/VInspectorPaneAIS_PaneCreator.hxx
Normal file
@@ -0,0 +1,58 @@
|
||||
// Created on: 2018-12-08
|
||||
// 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 VInspectorPaneAIS_PaneCreator_H
|
||||
#define VInspectorPaneAIS_PaneCreator_H
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
#include <inspector/ViewControl_PaneCreator.hxx>
|
||||
#include <inspector/ViewControl_Pane.hxx>
|
||||
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE (VInspectorPaneAIS_PaneCreator, ViewControl_PaneCreator)
|
||||
|
||||
//! \class VInspectorPaneAIS_PaneCreator
|
||||
//! \brief An interface to create custom panes by transient object name.
|
||||
class VInspectorPaneAIS_PaneCreator : public ViewControl_PaneCreator
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
VInspectorPaneAIS_PaneCreator() {}
|
||||
|
||||
//! Destructor
|
||||
virtual ~VInspectorPaneAIS_PaneCreator() {}
|
||||
|
||||
//! Returns pane for the name, creates a new pane if it does not exist and possible to create
|
||||
//! \param theName type of the pane
|
||||
//! \return a pane instance or NULL
|
||||
virtual ViewControl_Pane* GetPane (const Standard_CString& theName);
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(VInspectorPaneAIS_PaneCreator, ViewControl_PaneCreator)
|
||||
|
||||
protected:
|
||||
//! Creates new pane for the name
|
||||
//! \return pane instance or NULL
|
||||
ViewControl_Pane* createPane (const Standard_CString& theName);
|
||||
|
||||
private:
|
||||
NCollection_DataMap<TCollection_AsciiString, ViewControl_Pane*> myPanes; //!< created panes
|
||||
};
|
||||
|
||||
#endif
|
216
tools/VInspectorPaneAIS/VInspectorPaneAIS_Shape.cxx
Normal file
216
tools/VInspectorPaneAIS/VInspectorPaneAIS_Shape.cxx
Normal file
@@ -0,0 +1,216 @@
|
||||
// Created on: 2018-12-08
|
||||
// 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/VInspectorPaneAIS_Shape.hxx>
|
||||
|
||||
//#include <AIS_Shape.hxx>
|
||||
//#include <AIS_ListOfInteractive.hxx>
|
||||
//#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
||||
//#include <Aspect.hxx>
|
||||
//
|
||||
//#include <inspector/VInspector_ItemContext.hxx>
|
||||
//#include <inspector/VInspector_ItemSelectBasicsEntityOwner.hxx>
|
||||
//#include <inspector/VInspector_ItemFolderObject.hxx>
|
||||
//#include <inspector/VInspector_ItemPresentations.hxx>
|
||||
//#include <inspector/VInspector_ItemSelectMgrSelection.hxx>
|
||||
#include <inspector/ViewControl_Table.hxx>
|
||||
#include <inspector/ViewControl_Tools.hxx>
|
||||
#include <inspector/VInspector_Tools.hxx>
|
||||
//#include <inspector/VInspector_ViewModel.hxx>
|
||||
|
||||
#include <inspector/ViewControl_PaneItem.hxx>
|
||||
|
||||
#include <Prs3d.hxx>
|
||||
#include <TopAbs.hxx>
|
||||
//
|
||||
//#include <Graphic3d.hxx>
|
||||
//#include <NCollection_List.hxx>
|
||||
//#include <Prs3d.hxx>
|
||||
//#include <Prs3d_Drawer.hxx>
|
||||
//#include <PrsMgr.hxx>
|
||||
//#include <SelectBasics_EntityOwner.hxx>
|
||||
//#include <StdSelect_BRepOwner.hxx>
|
||||
//#include <Standard_Version.hxx>
|
||||
//
|
||||
//#include <Standard_WarningsDisable.hxx>
|
||||
//#include <QColor>
|
||||
//#include <QItemSelectionModel>
|
||||
//#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableRowCount
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
int VInspectorPaneAIS_Shape::GetTableRowCount(const Handle(Standard_Transient)& theObject) const
|
||||
{
|
||||
Handle(AIS_Shape) aPrs = GetPresentation (theObject);
|
||||
if (aPrs.IsNull())
|
||||
return 0;
|
||||
|
||||
return 8;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableData
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QVariant VInspectorPaneAIS_Shape::GetTableData (const Handle(Standard_Transient)& theObject,
|
||||
const int theRow, const int theColumn, const int theRole) const
|
||||
{
|
||||
Handle(AIS_Shape) aPrs = GetPresentation (theObject);
|
||||
if (aPrs.IsNull())
|
||||
return QVariant();
|
||||
|
||||
if (theRole != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
bool isFirstColumn = theColumn == 0;
|
||||
switch (theRow)
|
||||
{
|
||||
case 0: return ViewControl_Table::SeparatorData();
|
||||
case 1: return isFirstColumn ? QVariant (STANDARD_TYPE (AIS_Shape)->Name())
|
||||
: ViewControl_Tools::GetPointerInfo (aPrs).ToCString();
|
||||
case 2: return ViewControl_Table::SeparatorData();
|
||||
case 3: return isFirstColumn ? QVariant ("TShape")
|
||||
: (aPrs->Shape().IsNull() ? QVariant ("") : ViewControl_Tools::GetPointerInfo (aPrs->Shape().TShape()).ToCString());
|
||||
case 4: return isFirstColumn ? QVariant ("ShapeType")
|
||||
: (aPrs->Shape().IsNull() ? QVariant ("") : TopAbs::ShapeTypeToString (aPrs->Shape().ShapeType()));
|
||||
case 5: return isFirstColumn ? QVariant ("Orientation")
|
||||
: (aPrs->Shape().IsNull() ? QVariant ("") : VInspector_Tools::OrientationToName (aPrs->Shape().Orientation()).ToCString());
|
||||
case 6: return isFirstColumn ? QVariant ("Location")
|
||||
: (aPrs->Shape().IsNull() ? QVariant ("") : ViewControl_Tools::ToString (aPrs->Shape().Location()).ToCString());
|
||||
case 7: return isFirstColumn ? QVariant ("Deflection")
|
||||
: (aPrs->Shape().IsNull() ? QVariant ("") : QVariant (Prs3d::GetDeflection(aPrs->Shape(), aPrs->Attributes())));
|
||||
|
||||
default: return QVariant();
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableEditType
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
ViewControl_EditType VInspectorPaneAIS_Shape::GetTableEditType (const Handle(Standard_Transient)& theObject,
|
||||
const int theRow, const int) const
|
||||
{
|
||||
Handle(AIS_Shape) aPrs = GetPresentation (theObject);
|
||||
if (aPrs.IsNull())
|
||||
return ViewControl_EditType_None;
|
||||
|
||||
switch (theRow)
|
||||
{
|
||||
//case 4: return ViewControl_EditType_Line;
|
||||
//case 5: return ViewControl_EditType_Combo;
|
||||
//case 6: return ViewControl_EditType_Bool;
|
||||
//case 12: return ViewControl_EditType_Bool;
|
||||
//case 17: return ViewControl_EditType_Combo;
|
||||
//case 18: return ViewControl_EditType_Bool;
|
||||
//case 20: return ViewControl_EditType_Combo;
|
||||
//case 23: return ViewControl_EditType_Bool;
|
||||
default: return ViewControl_EditType_None;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetTableEnumValues
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QList<QVariant> VInspectorPaneAIS_Shape::GetTableEnumValues (const Handle(Standard_Transient)& theObject,
|
||||
const int theRow, const int) const
|
||||
{
|
||||
Handle(AIS_Shape) aPrs = GetPresentation (theObject);
|
||||
if (aPrs.IsNull())
|
||||
return QList<QVariant>();
|
||||
|
||||
QList<QVariant> aValues;
|
||||
switch (theRow)
|
||||
{
|
||||
//case 5:
|
||||
//{
|
||||
// for (int i = 0; i <= Aspect_TOFM_FRONT_SIDE; i++)
|
||||
// aValues.append (Aspect::TypeOfFacingModelToString((Aspect_TypeOfFacingModel)i));
|
||||
//}
|
||||
//break;
|
||||
//case 17:
|
||||
//{
|
||||
// for (int i = 0; i <= PrsMgr_TOP_ProjectorDependant; i++)
|
||||
// aValues.append (PrsMgr::TypeOfPresentation3dToString ((PrsMgr_TypeOfPresentation3d)i));
|
||||
//}
|
||||
//break;
|
||||
//case 20:
|
||||
//{
|
||||
// aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_UNKNOWN));
|
||||
// aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_Default));
|
||||
// aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_Top));
|
||||
// aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_Topmost));
|
||||
// aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_TopOSD));
|
||||
// aValues.append (Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId_BotOSD));
|
||||
//}
|
||||
//break;
|
||||
default: break;
|
||||
}
|
||||
return aValues;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetTableData
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
bool VInspectorPaneAIS_Shape::SetTableData (const Handle(Standard_Transient)& theObject,
|
||||
const int theRow, const int, const QVariant& theValue)
|
||||
{
|
||||
Handle(AIS_Shape) aPrs = GetPresentation (theObject);
|
||||
if (aPrs.IsNull())
|
||||
return false;
|
||||
|
||||
//Handle(AIS_InteractiveObject) aPrs = GetInteractiveObject();
|
||||
switch (theRow)
|
||||
{
|
||||
//case 4:
|
||||
//{
|
||||
// double aValue = theValue.toDouble();
|
||||
// if (aValue > 0) aPrs->SetWidth (aValue);
|
||||
// else aPrs->UnsetWidth();
|
||||
//}
|
||||
//break;
|
||||
//case 5: aPrs->SetCurrentFacingModel (Aspect::TypeOfFacingModelFromString (theValue.toString().toStdString().c_str()));
|
||||
//case 6: aPrs->SetInfiniteState (theValue.toBool());
|
||||
//case 12: aPrs->SetAutoHilight(theValue.toBool());
|
||||
//case 17: aPrs->SetTypeOfPresentation (PrsMgr::TypeOfPresentation3dFromString (theValue.toString().toStdString().c_str()));
|
||||
//case 18: aPrs->SetMutable (theValue.toBool());
|
||||
//case 20: aPrs->SetZLayer (Graphic3d::ZLayerIdFromString (theValue.toString().toStdString().c_str()));
|
||||
//case 23: if (!theValue.toBool()) aPrs->ResetTransformation();
|
||||
default: return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetSelected
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
ViewControl_PaneItem* VInspectorPaneAIS_Shape::GetSelected (const Handle(Standard_Transient)& theObject,
|
||||
const int theRow, const int theColumn)
|
||||
{
|
||||
Handle(AIS_Shape) aPrs = GetPresentation (theObject);
|
||||
if (aPrs.IsNull())
|
||||
return NULL;
|
||||
|
||||
ViewControl_PaneItem* aPaneItem = new ViewControl_PaneItem();
|
||||
aPaneItem->SetShape (aPrs->Shape());
|
||||
|
||||
return aPaneItem;
|
||||
}
|
82
tools/VInspectorPaneAIS/VInspectorPaneAIS_Shape.hxx
Normal file
82
tools/VInspectorPaneAIS/VInspectorPaneAIS_Shape.hxx
Normal file
@@ -0,0 +1,82 @@
|
||||
// Created on: 2018-12-08
|
||||
// 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 VInspectorPaneAIS_Shape_H
|
||||
#define VInspectorPaneAIS_Shape_H
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <inspector/ViewControl_Pane.hxx>
|
||||
|
||||
#include <AIS_Shape.hxx>
|
||||
|
||||
//! \class VInspectorPaneAIS_Shape
|
||||
//! Item presents information about AIS_InteractiveObject.
|
||||
//! Parent is item context, children are item selections.
|
||||
class VInspectorPaneAIS_Shape : public ViewControl_Pane
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
VInspectorPaneAIS_Shape() : ViewControl_Pane() {}
|
||||
|
||||
//! Destructor
|
||||
~VInspectorPaneAIS_Shape() {}
|
||||
|
||||
//! Returns number of table rows
|
||||
//! \return an integer value
|
||||
Standard_EXPORT virtual int GetTableRowCount(const Handle(Standard_Transient)& theObject) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns table value for the row in form: <function name> <function value>
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
Standard_EXPORT virtual QVariant GetTableData (const Handle(Standard_Transient)& theObject,
|
||||
const int theRow, const int theColumn, const int theRole) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns type of edit control for the model index. By default, it is an empty control
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
//! \return edit type
|
||||
Standard_EXPORT virtual ViewControl_EditType GetTableEditType (const Handle(Standard_Transient)& theObject,
|
||||
const int theRow, const int theColumn) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns container of string values for enumeration in the model row
|
||||
//! \param theRow table model row index
|
||||
//! \param theColumn a model index column
|
||||
//! \return string values for the enumeration presented in the row or an empty container
|
||||
Standard_EXPORT virtual QList<QVariant> GetTableEnumValues (const Handle(Standard_Transient)& theObject,
|
||||
const int theRow, const int theColumn) const Standard_OVERRIDE;
|
||||
|
||||
//! Sets the value into the table cell. Only 1st column value might be modified.
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
//! \param theValue a new cell value
|
||||
Standard_EXPORT virtual bool SetTableData (const Handle(Standard_Transient)& theObject,
|
||||
const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
|
||||
|
||||
//! Return selected element in the pane cell
|
||||
//! \param theObject current pane object
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
Standard_EXPORT virtual ViewControl_PaneItem* GetSelected (const Handle(Standard_Transient)& theObject,
|
||||
const int theRow, const int theColumn) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
//! Converts transient object to custom presentation type
|
||||
//! \return custom presentation
|
||||
Handle(AIS_Shape) GetPresentation (const Handle(Standard_Transient)& theObject) const
|
||||
{ return Handle(AIS_Shape)::DownCast (theObject); };
|
||||
};
|
||||
|
||||
#endif
|
17
tools/VInspectorPaneAIS/VInspectorPaneAIS_Trihedron.cxx
Normal file
17
tools/VInspectorPaneAIS/VInspectorPaneAIS_Trihedron.cxx
Normal file
@@ -0,0 +1,17 @@
|
||||
// Created on: 2018-12-08
|
||||
// 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/VInspectorPaneAIS_Trihedron.hxx>
|
||||
|
29
tools/VInspectorPaneAIS/VInspectorPaneAIS_Trihedron.hxx
Normal file
29
tools/VInspectorPaneAIS/VInspectorPaneAIS_Trihedron.hxx
Normal file
@@ -0,0 +1,29 @@
|
||||
// Created on: 2018-12-08
|
||||
// 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 VInspectorPaneAIS_Trihedron_H
|
||||
#define VInspectorPaneAIS_Trihedron_H
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <inspector/ViewControl_Pane.hxx>
|
||||
|
||||
//! \class VInspectorPaneAIS_Trihedron
|
||||
//! Item presents information about AIS_InteractiveObject.
|
||||
//! Parent is item context, children are item selections.
|
||||
class VInspectorPaneAIS_Trihedron : public ViewControl_Pane
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,4 +1,6 @@
|
||||
View.qrc
|
||||
View_CameraPositionPrs.cxx
|
||||
View_CameraPositionPrs.hxx
|
||||
View_ContextType.hxx
|
||||
View_Displayer.cxx
|
||||
View_Displayer.hxx
|
||||
|
338
tools/View/View_CameraPositionPrs.cxx
Normal file
338
tools/View/View_CameraPositionPrs.cxx
Normal file
@@ -0,0 +1,338 @@
|
||||
// Created on: 2018-12-11
|
||||
// Created by: Natalia ERMOLAEVA
|
||||
// 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.
|
||||
|
||||
#include <inspector/View_CameraPositionPrs.hxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfPolylines.hxx>
|
||||
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// function : StartTransformation
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void View_CameraPositionPrs::StartTransformation (const int theX, const int theY)
|
||||
{
|
||||
myIsTransformationStarted = Standard_True;
|
||||
myStartPosition = gp_Pnt2d (theX, theY);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : StopTransformation
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void View_CameraPositionPrs::StopTransformation (const int theX, const int theY)
|
||||
{
|
||||
myIsTransformationStarted = Standard_False;
|
||||
myStartPosition = gp_Pnt2d (0, 0);
|
||||
|
||||
int aValue = 9;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Transform
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void View_CameraPositionPrs::Transform (const int theX, const int theY, const Handle(V3d_View) theView)
|
||||
{
|
||||
// scale camera symmetry according to the center
|
||||
if (!myIsTransformationStarted)
|
||||
return;
|
||||
|
||||
Standard_Integer aXDiff = theX - myStartPosition.X();
|
||||
Standard_Integer anYDiff = theY - myStartPosition.Y();
|
||||
|
||||
Handle(V3d_View) aTargetView = GetView();
|
||||
if (aTargetView.IsNull())
|
||||
return;
|
||||
TColgp_SequenceOfPnt aPoints = getCameraPoints(aTargetView->Camera());
|
||||
TColgp_SequenceOfPnt2d aPixelPoints = projectToView (aPoints, theView);
|
||||
Standard_Real aWidthInPixels = aPixelPoints.Value(2).Distance (aPixelPoints.Value(1));
|
||||
Standard_Real aHeightInPixels = aPixelPoints.Value(3).Distance (aPixelPoints.Value(2));
|
||||
|
||||
if (aWidthInPixels < Precision::Confusion() ||
|
||||
aHeightInPixels < Precision::Confusion())
|
||||
return;
|
||||
|
||||
Standard_Real aXScaleToMove = aXDiff / aWidthInPixels;
|
||||
Standard_Real anYScaleToMove = anYDiff / aHeightInPixels;
|
||||
|
||||
TColgp_SequenceOfPnt2d aTargetPixelPoints = projectToView (aPoints, aTargetView);
|
||||
Standard_Real aTargetWidthInPixels = aTargetPixelPoints.Value(2).Distance (aTargetPixelPoints.Value(1));
|
||||
Standard_Real aTargetHeightInPixels = aTargetPixelPoints.Value(3).Distance (aTargetPixelPoints.Value(2));
|
||||
if (aTargetWidthInPixels < Precision::Confusion() ||
|
||||
aTargetHeightInPixels < Precision::Confusion())
|
||||
return;
|
||||
|
||||
gp_XYZ aTargetCameraDimensions = aTargetView->Camera()->ViewDimensions();
|
||||
Standard_Real aTargetXDiff = aXScaleToMove * aTargetWidthInPixels;
|
||||
Standard_Real aTargetYDiff = anYScaleToMove * aTargetHeightInPixels;
|
||||
|
||||
double aRatio = aHeightInPixels / aWidthInPixels;
|
||||
|
||||
bool isXScale = true;
|
||||
if (aTargetXDiff == 0 && aTargetYDiff == 0)
|
||||
return;
|
||||
else if (aTargetXDiff == 0)
|
||||
isXScale = false;
|
||||
else if (aTargetYDiff == 0)
|
||||
isXScale = true;
|
||||
else // both X, Y are not zero
|
||||
{
|
||||
double aDiffRatio = aTargetYDiff / aTargetXDiff;
|
||||
isXScale = aDiffRatio > aRatio;
|
||||
}
|
||||
|
||||
Standard_Real aNewScale = 1;
|
||||
if (isXScale)
|
||||
{
|
||||
bool isIncrease = true;
|
||||
double aScaleSign = isIncrease ? 1.0 : -1.0;
|
||||
|
||||
double aScale = aTargetView->Camera()->Scale();
|
||||
Standard_Real aTargetWidthInPixelsNew = aScale + aTargetXDiff * aScaleSign;
|
||||
aNewScale = aTargetWidthInPixelsNew;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Nothing to do" << std::endl;
|
||||
myStartPosition = gp_Pnt2d (theX, theY);
|
||||
return;
|
||||
}
|
||||
|
||||
aTargetView->Camera()->SetScale (aNewScale);
|
||||
aTargetView->AutoZFit();
|
||||
//aTargetView->ImmediateUpdate();
|
||||
//aTargetView->Pan (aTargetXDiff, aTargetYDiff);
|
||||
|
||||
myStartPosition = gp_Pnt2d (theX, theY);
|
||||
|
||||
// move camera center
|
||||
//if (!myIsTransformationStarted)
|
||||
// return;
|
||||
|
||||
//Standard_Integer aXDiff = theX - myStartPosition.X();
|
||||
//Standard_Integer anYDiff = theY - myStartPosition.Y();
|
||||
//aXDiff = -aXDiff;
|
||||
|
||||
//Handle(V3d_View) aTargetView = GetView();
|
||||
//if (aTargetView.IsNull())
|
||||
// return;
|
||||
//TColgp_SequenceOfPnt aPoints = getCameraPoints(aTargetView->Camera());
|
||||
//TColgp_SequenceOfPnt2d aPixelPoints = projectToView (aPoints, theView);
|
||||
//Standard_Real aWidthInPixels = aPixelPoints.Value(2).Distance (aPixelPoints.Value(1));
|
||||
//Standard_Real aHeightInPixels = aPixelPoints.Value(3).Distance (aPixelPoints.Value(2));
|
||||
|
||||
//if (aWidthInPixels < Precision::Confusion() ||
|
||||
// aHeightInPixels < Precision::Confusion())
|
||||
// return;
|
||||
|
||||
//Standard_Real aXScaleToMove = aXDiff / aWidthInPixels;
|
||||
//Standard_Real anYScaleToMove = anYDiff / aHeightInPixels;
|
||||
|
||||
//TColgp_SequenceOfPnt2d aTargetPixelPoints = projectToView (aPoints, aTargetView);
|
||||
//Standard_Real aTargetWidthInPixels = aTargetPixelPoints.Value(2).Distance (aTargetPixelPoints.Value(1));
|
||||
//Standard_Real aTargetHeightInPixels = aTargetPixelPoints.Value(3).Distance (aTargetPixelPoints.Value(2));
|
||||
//if (aTargetWidthInPixels < Precision::Confusion() ||
|
||||
// aTargetHeightInPixels < Precision::Confusion())
|
||||
// return;
|
||||
|
||||
//gp_XYZ aTargetCameraDimensions = aTargetView->Camera()->ViewDimensions();
|
||||
//Standard_Real aTargetXDiff = aXScaleToMove * aTargetWidthInPixels;
|
||||
//Standard_Real aTargetYDiff = anYScaleToMove * aTargetHeightInPixels;
|
||||
|
||||
//aTargetView->Pan (aTargetXDiff, aTargetYDiff);
|
||||
|
||||
//myStartPosition = gp_Pnt2d (theX, theY);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : CreateView
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void View_CameraPositionPrs::Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
thePresentation->Clear();
|
||||
if (GetView().IsNull())
|
||||
return;
|
||||
|
||||
Handle (Graphic3d_Camera) aCamera = GetView()->Camera();
|
||||
|
||||
Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePresentation);
|
||||
Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d (Quantity_NOC_RED, Aspect_TOL_SOLID, 5);
|
||||
aGroup->SetGroupPrimitivesAspect (aLineAspect);
|
||||
|
||||
gp_Pnt aCameraCenter = aCamera->Center();
|
||||
gp_XYZ aCameraDims = aCamera->ViewDimensions();
|
||||
gp_XYZ aCameraHalfDims = 0.5 * aCameraDims;
|
||||
|
||||
gp_Dir anEyeDir (gp_Vec (aCameraCenter, aCamera->Eye()));
|
||||
gp_Dir anUpVec = aCamera->Up();
|
||||
|
||||
gp_Dir aZAxis = anEyeDir;
|
||||
gp_Dir anYAxis = anUpVec;
|
||||
gp_Dir aXAxis = aZAxis ^ anYAxis;
|
||||
|
||||
aZAxis = gp_Dir ((gp_Vec (aCamera->Eye(), aCameraCenter)));
|
||||
aZAxis.Reverse();
|
||||
double aZValue = 0;//aCamera->Scale();
|
||||
|
||||
TColgp_SequenceOfPnt aPoints = getCameraPoints (aCamera);
|
||||
{
|
||||
//aZValue = aZAxis.Z() * aCamera->Scale();
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aSegments = new Graphic3d_ArrayOfPolylines (aPoints.Size());
|
||||
for (Standard_Integer aPointIndex = 1, aPointCount = aPoints.Length(); aPointIndex <= aPointCount; aPointIndex++)
|
||||
{
|
||||
aSegments->SetVertice (aPointIndex, aPoints (aPointIndex));
|
||||
////aSegments->SetVertice (aPointIndex, gp_Pnt (aPoints (aPointIndex).X(), aPoints (aPointIndex).Y(), aZValue));
|
||||
//gp_Pnt aPoint = aPoints (aPointIndex);
|
||||
//aPoint.Translate(gp_Vec(aCamera->Eye(), gp::Origin()));
|
||||
|
||||
//aSegments->SetVertice (aPointIndex, gp_Pnt (aPoint.X(), aPoint.Y(), aPoint.Z()));
|
||||
}
|
||||
aGroup->AddPrimitiveArray (aSegments);
|
||||
}
|
||||
|
||||
{
|
||||
aGroup = Prs3d_Root::NewGroup (thePresentation);
|
||||
aLineAspect = new Graphic3d_AspectLine3d (Quantity_NOC_GREEN, Aspect_TOL_SOLID, 3);
|
||||
aGroup->SetGroupPrimitivesAspect (aLineAspect);
|
||||
|
||||
//aZValue = aZAxis.Z() * aCamera->Scale();
|
||||
aZValue = 20;//aCamera->ZFar() / aCamera->Scale();
|
||||
|
||||
double aDistance = aCameraCenter.Distance (aCamera->Eye());
|
||||
Handle (Graphic3d_Camera) aDefCamera = GetView()->DefaultCamera();
|
||||
double aDefCameraScale = aDefCamera->Scale();
|
||||
double aScale = aCamera->Scale();
|
||||
|
||||
double aMoveDistance = -aDistance + aDistance * (1 - aScale / aDefCameraScale);
|
||||
|
||||
//std::cout << "aDistance = " << aDistance << "aScale = " << aScale << "1 - aScale / aDefCameraScale = " << 1 - aScale / aDefCameraScale
|
||||
// << "aMoveDistance = " << aMoveDistance << std::endl;
|
||||
|
||||
Handle(Graphic3d_ArrayOfPolylines) aSegments = new Graphic3d_ArrayOfPolylines (aPoints.Size());
|
||||
for (Standard_Integer aPointIndex = 1, aPointCount = aPoints.Length(); aPointIndex <= aPointCount; aPointIndex++)
|
||||
{
|
||||
//aSegments->SetVertice (aPointIndex, aPoints (aPointIndex));
|
||||
//aSegments->SetVertice (aPointIndex, gp_Pnt (aPoints (aPointIndex).X(), aPoints (aPointIndex).Y(), aZValue));
|
||||
gp_Pnt aPoint = aPoints (aPointIndex);
|
||||
gp_Dir aDir = gp_Dir (gp_Vec(aCamera->Eye(), aCameraCenter));
|
||||
gp_Pnt aNewPoint = gp_Pnt(aPoint.XYZ() + aDir.XYZ() * aMoveDistance);
|
||||
gp_Vec aVec (aPoint, aNewPoint);
|
||||
aPoint.Translate(aVec);
|
||||
|
||||
aSegments->SetVertice (aPointIndex, gp_Pnt (aPoint.X(), aPoint.Y(), aPoint.Z()));
|
||||
|
||||
}
|
||||
aGroup->AddPrimitiveArray (aSegments);
|
||||
}
|
||||
|
||||
Handle(Graphic3d_ArrayOfPoints) aVertices = new Graphic3d_ArrayOfPoints(1);
|
||||
aVertices->SetVertice (1, aCameraCenter);
|
||||
|
||||
Handle(Graphic3d_AspectMarker3d) aMarkerAspect = new Graphic3d_AspectMarker3d (Aspect_TOM_PLUS, Quantity_NOC_GREEN, 3);
|
||||
aGroup->SetGroupPrimitivesAspect (aMarkerAspect);
|
||||
aGroup->AddPrimitiveArray(aVertices);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ComputeSelection
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void View_CameraPositionPrs::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetCamera
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(V3d_View) View_CameraPositionPrs::GetView() const
|
||||
{
|
||||
Handle(V3d_Viewer) aViewer = myContext->CurrentViewer();
|
||||
|
||||
int aViewId = 0;
|
||||
for (V3d_ListOfViewIterator anActiveViewIter (aViewer->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next())
|
||||
{
|
||||
Handle(V3d_View) aView = anActiveViewIter.Value();
|
||||
if (aView->View().IsNull())
|
||||
continue;
|
||||
|
||||
if (myViewId == aViewId)
|
||||
return aView;
|
||||
aViewId++;
|
||||
}
|
||||
return Handle(V3d_View)();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : getCameraPoints
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TColgp_SequenceOfPnt View_CameraPositionPrs::getCameraPoints (const Handle (Graphic3d_Camera)& theCamera)
|
||||
{
|
||||
gp_Pnt aCameraCenter = theCamera->Center();
|
||||
gp_XYZ aCameraDims = theCamera->ViewDimensions();
|
||||
gp_XYZ aCameraHalfDims = 0.5 * aCameraDims;
|
||||
|
||||
gp_Dir anEyeDir (gp_Vec (aCameraCenter, theCamera->Eye()));
|
||||
gp_Dir anUpVec = theCamera->Up();
|
||||
|
||||
gp_Dir aZAxis = anEyeDir;
|
||||
gp_Dir anYAxis = anUpVec;
|
||||
gp_Dir aXAxis = aZAxis ^ anYAxis;
|
||||
|
||||
aZAxis = gp_Dir ((gp_Vec (theCamera->Eye(), aCameraCenter)));
|
||||
aZAxis.Reverse();
|
||||
double aZValue = 0;//aCamera->Scale();
|
||||
|
||||
TColgp_SequenceOfPnt aPoints;
|
||||
aPoints.Append (gp_Pnt (aCameraCenter.XYZ() - aXAxis.XYZ() * aCameraHalfDims.X() + anYAxis.XYZ() * aCameraHalfDims.Y()));
|
||||
aPoints.Append (gp_Pnt (aCameraCenter.XYZ() + aXAxis.XYZ() * aCameraHalfDims.X() + anYAxis.XYZ() * aCameraHalfDims.Y()));
|
||||
aPoints.Append (gp_Pnt (aCameraCenter.XYZ() + aXAxis.XYZ() * aCameraHalfDims.X() - anYAxis.XYZ() * aCameraHalfDims.Y()));
|
||||
aPoints.Append (gp_Pnt (aCameraCenter.XYZ() - aXAxis.XYZ() * aCameraHalfDims.X() - anYAxis.XYZ() * aCameraHalfDims.Y()));
|
||||
aPoints.Append (gp_Pnt (aCameraCenter.XYZ() - aXAxis.XYZ() * aCameraHalfDims.X() + anYAxis.XYZ() * aCameraHalfDims.Y()));
|
||||
|
||||
return aPoints;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : projectToView
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TColgp_SequenceOfPnt2d View_CameraPositionPrs::projectToView (const TColgp_SequenceOfPnt& thePoints,
|
||||
const Handle(V3d_View)& theView)
|
||||
{
|
||||
TColgp_SequenceOfPnt2d aPoints;
|
||||
|
||||
Standard_Integer aX, anY;
|
||||
for (Standard_Integer aPointIndex = 1, aPointCount = thePoints.Length(); aPointIndex <= aPointCount; aPointIndex++)
|
||||
{
|
||||
gp_Pnt aPoint = thePoints (aPointIndex);
|
||||
|
||||
theView->Convert (aPoint.X(), aPoint.Y(), aPoint.Z(), aX, anY);
|
||||
aPoints.Append (gp_Pnt2d (aX, anY));
|
||||
}
|
||||
return aPoints;
|
||||
}
|
74
tools/View/View_CameraPositionPrs.hxx
Normal file
74
tools/View/View_CameraPositionPrs.hxx
Normal file
@@ -0,0 +1,74 @@
|
||||
// Created on: 2018-12-11
|
||||
// Created by: Natalia ERMOLAEVA
|
||||
// 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.
|
||||
|
||||
#ifndef View_View_CameraPositionPrs_H
|
||||
#define View_View_CameraPositionPrs_H
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Graphic3d_Camera.hxx>
|
||||
#include <TColgp_SequenceOfPnt2d.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
|
||||
//! \class View_CameraPositionPrs
|
||||
//! \brief Displays contour of the camera position of another view
|
||||
class View_CameraPositionPrs : public AIS_InteractiveObject
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
View_CameraPositionPrs (const Handle(AIS_InteractiveContext)& theContext,
|
||||
const Standard_Integer theViewId)
|
||||
: myContext (theContext), myViewId (theViewId), myIsTransformationStarted (Standard_False) {}
|
||||
|
||||
//! Destructor
|
||||
virtual ~View_CameraPositionPrs() {}
|
||||
|
||||
Standard_EXPORT void StartTransformation (const int theX, const int theY);
|
||||
Standard_EXPORT void StopTransformation (const int theX, const int theY);
|
||||
Standard_EXPORT void Transform (const int theX, const int theY, const Handle(V3d_View) theView);
|
||||
|
||||
protected:
|
||||
Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode = 0) Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode) Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
//! Returns the camera of the viewer of the context by the view index
|
||||
//! \return camera instance or NULL
|
||||
Handle (V3d_View) GetView() const;
|
||||
|
||||
//! Computes the camera bounding points
|
||||
//! \param theCamera source camera
|
||||
//! \return container of bound points
|
||||
TColgp_SequenceOfPnt getCameraPoints (const Handle (Graphic3d_Camera)& theCamera);
|
||||
|
||||
//! Converts container of 3D points in the container of points in pixels on the parameter view
|
||||
//! \param thePoints container of source points
|
||||
//! \return container of projectd points
|
||||
TColgp_SequenceOfPnt2d projectToView (const TColgp_SequenceOfPnt& thePoints,
|
||||
const Handle(V3d_View)& theView);
|
||||
|
||||
protected:
|
||||
Handle(AIS_InteractiveContext) myContext; //!< interactive context
|
||||
Standard_Integer myViewId; //!< index of the view in the viewer
|
||||
Standard_Boolean myIsTransformationStarted;
|
||||
gp_Pnt2d myStartPosition;
|
||||
};
|
||||
|
||||
#endif // View_CameraPositionPrs_H
|
@@ -41,26 +41,38 @@ void View_Viewer::SetWindow(const Handle(Aspect_Window)& theWindow)
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : InitStandardViewer
|
||||
// function : InitViewer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void View_Viewer::InitStandardViewer()
|
||||
void View_Viewer::InitViewer (const Handle(AIS_InteractiveContext)& theContext)
|
||||
{
|
||||
myContext = theContext;
|
||||
myViewer = myContext->CurrentViewer();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : CreateStandardViewer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(AIS_InteractiveContext) View_Viewer::CreateStandardViewer()
|
||||
{
|
||||
Handle(Aspect_DisplayConnection) aDisplayConnection = new Aspect_DisplayConnection();
|
||||
static Handle(OpenGl_GraphicDriver) aGraphicDriver = new OpenGl_GraphicDriver (aDisplayConnection);
|
||||
|
||||
#if OCC_VERSION_HEX > 0x060901
|
||||
myViewer = new V3d_Viewer (aGraphicDriver);
|
||||
Handle(V3d_Viewer) aViewer = new V3d_Viewer (aGraphicDriver);
|
||||
#else
|
||||
TCollection_AsciiString a3DName ("Visu3D");
|
||||
myViewer = new V3d_Viewer (aGraphicDriver, a3DName.ToExtString(), "", 1000.0, V3d_XposYnegZpos, Quantity_NOC_GRAY30,
|
||||
V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT, Standard_True, Standard_False);
|
||||
Handle(V3d_Viewer) aViewer = new V3d_Viewer (aGraphicDriver, a3DName.ToExtString(), "", 1000.0, V3d_XposYnegZpos,
|
||||
Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT, Standard_True, Standard_False);
|
||||
#endif
|
||||
|
||||
myViewer->SetDefaultLights();
|
||||
myViewer->SetLightOn();
|
||||
myViewer->SetDefaultBackgroundColor (Quantity_NOC_GRAY30);
|
||||
aViewer->SetDefaultLights();
|
||||
aViewer->SetLightOn();
|
||||
aViewer->SetDefaultBackgroundColor (Quantity_NOC_GRAY30);
|
||||
|
||||
myContext = new AIS_InteractiveContext (myViewer);
|
||||
myContext->UpdateCurrentViewer();
|
||||
Handle(AIS_InteractiveContext) aContext = new AIS_InteractiveContext (aViewer);
|
||||
aContext->UpdateCurrentViewer();
|
||||
|
||||
return aContext;
|
||||
}
|
||||
|
@@ -50,7 +50,11 @@ public:
|
||||
|
||||
//! Creates OCC components on the window
|
||||
//! \param theWindowHandle an id of the application window
|
||||
Standard_EXPORT void InitStandardViewer();
|
||||
Standard_EXPORT void InitViewer (const Handle(AIS_InteractiveContext)& theContext);
|
||||
|
||||
//! Creates OCC components on the window
|
||||
//! \param theWindowHandle an id of the application window
|
||||
Standard_EXPORT static Handle(AIS_InteractiveContext) CreateStandardViewer();
|
||||
|
||||
//! Returns an OCC viewer
|
||||
const Handle(V3d_Viewer)& GetViewer() { return myViewer; }
|
||||
|
@@ -63,16 +63,25 @@
|
||||
// function : Constructor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
View_Widget::View_Widget (QWidget* theParent, const bool isFitAllActive)
|
||||
View_Widget::View_Widget (QWidget* theParent,
|
||||
const Handle(AIS_InteractiveContext)& theContext,
|
||||
const bool isFitAllActive)
|
||||
: QWidget (theParent), myCurrentMode (View_CurrentAction3d_Nothing), myFirst (true), myDefaultWidth (-1),
|
||||
myDefaultHeight (-1), myViewIsEnabled (true), myXmin (0), myYmin (0), myXmax (0), myYmax (0), myDragButtonDownX (0),
|
||||
myDragButtonDownY (0), myDragMultiButtonDownX (0), myDragMultiButtonDownY (0), myIsRectVisible (false), myRectBand (0),
|
||||
myHasInitProj (Standard_False), myInitVx (0), myInitVy (0), myInitVz (0)
|
||||
{
|
||||
myViewer = new View_Viewer (View_Viewer::DefaultColor());
|
||||
myViewer->InitStandardViewer();
|
||||
if (!theContext.IsNull())
|
||||
myViewer->InitViewer (theContext);
|
||||
else
|
||||
{
|
||||
myViewer->InitViewer (myViewer->CreateStandardViewer());
|
||||
|
||||
myViewer->GetContext()->Display(new AIS_Trihedron (new Geom_Axis2Placement (gp::XOY())), Standard_True);
|
||||
Handle(AIS_Trihedron) aTrihedron = new AIS_Trihedron (new Geom_Axis2Placement (gp::XOY()));
|
||||
aTrihedron->SetDatumDisplayMode (Prs3d_DM_Shaded);
|
||||
myViewer->GetContext()->Display (aTrihedron, Standard_True);
|
||||
}
|
||||
|
||||
setAttribute (Qt::WA_PaintOnScreen);
|
||||
setAttribute (Qt::WA_NoSystemBackground);
|
||||
@@ -420,6 +429,7 @@ void View_Widget::processLeftButtonDown (const int theFlags, const QPoint thePoi
|
||||
}
|
||||
}
|
||||
activateCursor (myCurrentMode);
|
||||
emit leftButtonDown(thePoint.x(), thePoint.y());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -513,8 +523,10 @@ void View_Widget::processLeftButtonUp (const int theFlags, const QPoint thePoint
|
||||
myDragMultiButtonDownX = 0;
|
||||
myDragMultiButtonDownY = 0;
|
||||
|
||||
myCurrentMode = View_CurrentAction3d_Nothing;
|
||||
activateCursor (myCurrentMode);
|
||||
emit selectionChanged();
|
||||
emit leftButtonUp(thePoint.x(), thePoint.y());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -608,6 +620,7 @@ void View_Widget::processMouseMove (const int theFlags, const QPoint thePoint)
|
||||
else
|
||||
processMoveEvent (thePoint.x(), thePoint.y());
|
||||
}
|
||||
emit moveTo (thePoint.x(), thePoint.y());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -74,7 +74,9 @@ protected:
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
Standard_EXPORT View_Widget (QWidget* theParent, const bool isFitAllActive);
|
||||
Standard_EXPORT View_Widget (QWidget* theParent,
|
||||
const Handle(AIS_InteractiveContext)& theContext,
|
||||
const bool isFitAllActive);
|
||||
|
||||
//! Destructor
|
||||
virtual ~View_Widget() {}
|
||||
@@ -125,6 +127,21 @@ signals:
|
||||
//! Sends a signal about selection change if the left mouse button is pressed and current action does not process it
|
||||
void selectionChanged();
|
||||
|
||||
//! Sends a signal about moving to the point in the view
|
||||
//! \param theX X mouse position in pixels
|
||||
//! \param theY Y mouse position in pixels
|
||||
void moveTo (const int theX, const int theY);
|
||||
|
||||
//! Sends a signal about up the left mouse button down
|
||||
//! \param theX X mouse position in pixels
|
||||
//! \param theY Y mouse position in pixels
|
||||
void leftButtonDown (const int theX, const int theY);
|
||||
|
||||
//! Sends a signal about up the left mouse button up
|
||||
//! \param theX X mouse position in pixels
|
||||
//! \param theY Y mouse position in pixels
|
||||
void leftButtonUp (const int theX, const int theY);
|
||||
|
||||
//! Sends a signal about display mode change
|
||||
void displayModeClicked();
|
||||
|
||||
|
@@ -43,14 +43,16 @@ const int DEFAULT_SPACING = 3;
|
||||
// function : Constructor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
View_Window::View_Window (QWidget* theParent, const bool isUseKeepView, const bool isFitAllActive)
|
||||
View_Window::View_Window (QWidget* theParent,
|
||||
const Handle(AIS_InteractiveContext)& theContext,
|
||||
const bool isUseKeepView, const bool isFitAllActive)
|
||||
: QWidget (theParent)
|
||||
{
|
||||
QGridLayout* aViewLayout = new QGridLayout (this);
|
||||
aViewLayout->setContentsMargins (0, 0, 0, 0);
|
||||
aViewLayout->setSpacing (DEFAULT_SPACING);
|
||||
|
||||
myView = new View_Widget (this, isFitAllActive);
|
||||
myView = new View_Widget (this, theContext, isFitAllActive);
|
||||
myViewToolBar = new View_ToolBar (this, isUseKeepView);
|
||||
aViewLayout->addWidget (myViewToolBar->GetControl(), 0, 0, 1, 2);
|
||||
connect (myViewToolBar, SIGNAL (contextChanged()), this, SLOT (onViewSelectorActivated()));
|
||||
|
@@ -40,7 +40,9 @@ class View_Window : public QWidget
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
Standard_EXPORT View_Window (QWidget* theParent, const bool isUseKeepView = true, const bool isFitAllActive = true);
|
||||
Standard_EXPORT View_Window (QWidget* theParent,
|
||||
const Handle(AIS_InteractiveContext)& theContext = Handle(AIS_InteractiveContext)(),
|
||||
const bool isUseKeepView = true, const bool isFitAllActive = true);
|
||||
|
||||
//! Destructor
|
||||
virtual ~View_Window() {}
|
||||
|
@@ -4,6 +4,10 @@ ViewControl_ColorSelector.hxx
|
||||
ViewControl_EditType.hxx
|
||||
ViewControl_MessageDialog.cxx
|
||||
ViewControl_MessageDialog.hxx
|
||||
ViewControl_Pane.hxx
|
||||
ViewControl_PaneCreator.cxx
|
||||
ViewControl_PaneCreator.hxx
|
||||
ViewControl_PaneItem.hxx
|
||||
ViewControl_PropertyView.cxx
|
||||
ViewControl_PropertyView.hxx
|
||||
ViewControl_Table.cxx
|
||||
|
@@ -483,6 +483,21 @@ QString ViewControl_ColorSelector::ColorToString (const Quantity_ColorRGBA& theC
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
QColor ViewControl_ColorSelector::ColorToQColor (const Quantity_Color& theColor)
|
||||
{
|
||||
int aDelta = 255;
|
||||
|
||||
Standard_Real aRed, aGreen, aBlue;
|
||||
theColor.Values (aRed, aGreen, aBlue, Quantity_TOC_RGB);
|
||||
|
||||
return QColor((int)(aRed * aDelta), (int)(aGreen * aDelta), (int)(aBlue * aDelta));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ColorToQColor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
|
||||
QColor ViewControl_ColorSelector::ColorToQColor (const Quantity_ColorRGBA& theColor)
|
||||
{
|
||||
int aDelta = 255;
|
||||
|
@@ -67,6 +67,11 @@ public:
|
||||
//! \return text value
|
||||
static QString ColorToString (const Quantity_ColorRGBA& theColor);
|
||||
|
||||
//! Converts color to QColor value in form: r;g;b
|
||||
//! \param theColor color value
|
||||
//! \return qt color value
|
||||
static QColor ColorToQColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Converts color to QColor value in form: r;g;b;a
|
||||
//! \param theColor color value
|
||||
//! \return qt color value
|
||||
|
@@ -25,7 +25,8 @@ enum ViewControl_EditType
|
||||
ViewControl_EditType_Combo, //!< combo box widget
|
||||
ViewControl_EditType_Double, //!< line edit widget used double validator
|
||||
ViewControl_EditType_Line, //!< line edit widget
|
||||
ViewControl_EditType_Spin //!< spin box widget
|
||||
ViewControl_EditType_Spin, //!< spin box widget
|
||||
ViewControl_EditType_DoubleVec3 //!< control to enter three double values
|
||||
};
|
||||
|
||||
#endif
|
||||
|
87
tools/ViewControl/ViewControl_Pane.hxx
Normal file
87
tools/ViewControl/ViewControl_Pane.hxx
Normal file
@@ -0,0 +1,87 @@
|
||||
// Created on: 2018-12-08
|
||||
// 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 ViewControl_Pane_H
|
||||
#define ViewControl_Pane_H
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
#include <inspector/ViewControl_EditType.hxx>
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
#include <Standard_WarningsRestore.hxx>
|
||||
|
||||
class ViewControl_PaneItem;
|
||||
|
||||
//! \class ViewControl_PaneItem
|
||||
//! Pane for getting/setting pane table values
|
||||
//!
|
||||
class ViewControl_Pane
|
||||
{
|
||||
public:
|
||||
|
||||
//! Returns number of table rows
|
||||
//! \param theObject current pane object
|
||||
//! \return an integer value
|
||||
virtual int GetTableRowCount (const Handle(Standard_Transient)& theObject) const = 0;
|
||||
|
||||
//! Returns table value for the row in form: <function name> <function value>
|
||||
//! \param theObject current pane object
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
virtual QVariant GetTableData (const Handle(Standard_Transient)& theObject,
|
||||
const int theRow, const int theColumn, const int theRole) const = 0;
|
||||
|
||||
//! Returns type of edit control for the model index. By default, it is an empty control
|
||||
//! \param theObject current pane object
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
//! \return edit type
|
||||
virtual ViewControl_EditType GetTableEditType (const Handle(Standard_Transient)& theObject,
|
||||
const int theRow, const int theColumn) const
|
||||
{ (void)theObject; (void)theRow; (void)theColumn; return ViewControl_EditType_None; }
|
||||
|
||||
//! Returns container of string values for enumeration in the model row
|
||||
//! \param theObject current pane object
|
||||
//! \param theRow table model row index
|
||||
//! \param theColumn a model index column
|
||||
//! \return string values for the enumeration presented in the row or an empty container
|
||||
virtual QList<QVariant> GetTableEnumValues (const Handle(Standard_Transient)& theObject,
|
||||
const int theRow, const int theColumn) const
|
||||
{ (void)theObject; (void)theRow; (void)theColumn; return QList<QVariant>(); }
|
||||
|
||||
//! Sets the value into the table cell. Only 1st column value might be modified.
|
||||
//! \param theObject current pane object
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
//! \param theValue a new cell value
|
||||
virtual bool SetTableData (const Handle(Standard_Transient)& theObject,
|
||||
const int theRow, const int theColumn, const QVariant& theValue)
|
||||
{ (void)theObject; (void)theRow; (void)theColumn; (void)theValue; return false; }
|
||||
|
||||
//! Return selected element in the pane cell
|
||||
//! \param theObject current pane object
|
||||
//! \param theRow a model index row
|
||||
//! \param theColumn a model index column
|
||||
virtual ViewControl_PaneItem* GetSelected (const Handle(Standard_Transient)& theObject,
|
||||
const int theRow, const int theColumn)
|
||||
{ (void)theObject; (void)theRow; (void)theColumn; return 0; }
|
||||
};
|
||||
|
||||
#endif
|
18
tools/ViewControl/ViewControl_PaneCreator.cxx
Normal file
18
tools/ViewControl/ViewControl_PaneCreator.cxx
Normal file
@@ -0,0 +1,18 @@
|
||||
// Created on: 2018-12-08
|
||||
// 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/ViewControl_PaneCreator.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(ViewControl_PaneCreator, Standard_Transient)
|
49
tools/ViewControl/ViewControl_PaneCreator.hxx
Normal file
49
tools/ViewControl/ViewControl_PaneCreator.hxx
Normal file
@@ -0,0 +1,49 @@
|
||||
// Created on: 2018-12-08
|
||||
// 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 ViewControl_PaneCreator_H
|
||||
#define ViewControl_PaneCreator_H
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
class ViewControl_Pane;
|
||||
|
||||
DEFINE_STANDARD_HANDLE (ViewControl_PaneCreator, Standard_Transient)
|
||||
|
||||
//! \class ViewControl_PaneCreator
|
||||
//! \brief An interface to create custom panes by transient object name.
|
||||
class ViewControl_PaneCreator : public Standard_Transient
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
ViewControl_PaneCreator() {}
|
||||
|
||||
//! Destructor
|
||||
virtual ~ViewControl_PaneCreator() {}
|
||||
|
||||
//! Creates pane for type
|
||||
//! \param theName a type name
|
||||
//! \return a pane if it can be created for this type or NULL
|
||||
virtual ViewControl_Pane* GetPane (const Standard_CString& theName) = 0;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT (ViewControl_PaneCreator, Standard_Transient)
|
||||
};
|
||||
|
||||
#endif
|
53
tools/ViewControl/ViewControl_PaneItem.hxx
Normal file
53
tools/ViewControl/ViewControl_PaneItem.hxx
Normal file
@@ -0,0 +1,53 @@
|
||||
// Created on: 2018-12-08
|
||||
// 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 ViewControl_PaneItem_H
|
||||
#define ViewControl_PaneItem_H
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
//! \class ViewControl_PaneItem
|
||||
//! Container of pane item information
|
||||
|
||||
class ViewControl_PaneItem
|
||||
{
|
||||
public:
|
||||
|
||||
//! Returns shape of the item or NULL
|
||||
//! \return shape instance
|
||||
virtual TopoDS_Shape GetShape() { return myShape; }
|
||||
|
||||
//! Sets shape
|
||||
//! \param theShape shape instance
|
||||
void SetShape (const TopoDS_Shape& theShape) { myShape = theShape; }
|
||||
|
||||
//! Returns object or NULL
|
||||
//! \return current object
|
||||
virtual Handle(Standard_Transient) GetObject() { return myObject; }
|
||||
|
||||
//! Sets object
|
||||
//! \param theObject an object
|
||||
virtual void SetObject (Handle(Standard_Transient)& theObject) { myObject = theObject; }
|
||||
|
||||
protected:
|
||||
TopoDS_Shape myShape; //!< current shape
|
||||
Handle(Standard_Transient) myObject; //!< current object
|
||||
};
|
||||
|
||||
#endif
|
@@ -188,12 +188,37 @@ TCollection_AsciiString ViewControl_Tools::ToString (const gp_Pnt& thePoint)
|
||||
+ TCollection_AsciiString (thePoint.Z());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ToString
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TCollection_AsciiString ViewControl_Tools::ToString (const gp_Dir& theDir)
|
||||
{
|
||||
return TCollection_AsciiString (theDir.X()) + ","
|
||||
+ TCollection_AsciiString (theDir.Y()) + ","
|
||||
+ TCollection_AsciiString (theDir.Z());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ToString
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TCollection_AsciiString ViewControl_Tools::ToString (const gp_XYZ& theValue)
|
||||
{
|
||||
return TCollection_AsciiString (theValue.X()) + ","
|
||||
+ TCollection_AsciiString (theValue.Y()) + ","
|
||||
+ TCollection_AsciiString (theValue.Z());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ToString
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TCollection_AsciiString ViewControl_Tools::ToString (const Bnd_Box& theValue)
|
||||
{
|
||||
if (theValue.IsVoid())
|
||||
return "Bnd_Box is void";
|
||||
|
||||
return QString ("(%1, %2, %3), (%4, %5, %6)")
|
||||
.arg (theValue.CornerMin().X()).arg (theValue.CornerMin().Y()).arg (theValue.CornerMin().Z())
|
||||
.arg (theValue.CornerMax().X()).arg (theValue.CornerMax().Y()).arg (theValue.CornerMax().Z()).toStdString().c_str();
|
||||
@@ -212,3 +237,12 @@ TCollection_AsciiString ViewControl_Tools::ToString (const Handle(TColgp_HArray1
|
||||
|
||||
return aPointList.join(" ,").toStdString().c_str();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ToString
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
TCollection_AsciiString ViewControl_Tools::ToString (const TopLoc_Location& theLocation)
|
||||
{
|
||||
return ToString (theLocation.Transformation());
|
||||
}
|
||||
|
@@ -16,13 +16,16 @@
|
||||
#ifndef ViewControl_Tools_H
|
||||
#define ViewControl_Tools_H
|
||||
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
|
||||
#include <Standard_WarningsDisable.hxx>
|
||||
#include <QString>
|
||||
@@ -100,7 +103,17 @@ public:
|
||||
//! Returns text of point
|
||||
//! \param theValue a 3D point
|
||||
//! \return text value
|
||||
Standard_EXPORT static TCollection_AsciiString ToString (const gp_Pnt& theValue);
|
||||
Standard_EXPORT static TCollection_AsciiString ToString (const gp_Pnt& thePoint);
|
||||
|
||||
//! Returns text of direction
|
||||
//! \param theValue a direction
|
||||
//! \return text value
|
||||
Standard_EXPORT static TCollection_AsciiString ToString (const gp_Dir& theDir);
|
||||
|
||||
//! Returns text of cartesian entity in 3D space
|
||||
//! \param theValue an entity
|
||||
//! \return text value
|
||||
Standard_EXPORT static TCollection_AsciiString ToString (const gp_XYZ& theValue);
|
||||
|
||||
//! Returns text of bounding box in form: (xmin, ymin, zmin), (xmax, ymax, zmax)
|
||||
//! \param theValue a bounding box
|
||||
@@ -112,6 +125,11 @@ public:
|
||||
//! \return text value
|
||||
Standard_EXPORT static TCollection_AsciiString ToString (const Handle(TColgp_HArray1OfPnt)& thePoints);
|
||||
|
||||
//! Returns text of location
|
||||
//! \param theLocation object location
|
||||
//! \return text value
|
||||
Standard_EXPORT static TCollection_AsciiString ToString (const TopLoc_Location& theLocation);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user