1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0030268: Inspectors - improvements in VInspector plugin,

0029451: Information Message Alert to debug an algorithm or object functionality
This commit is contained in:
nds
2019-06-14 10:39:35 +03:00
parent c9d8f1a93a
commit cafd762c93
276 changed files with 26577 additions and 1918 deletions

View File

@@ -82,6 +82,19 @@
const Standard_Real SquareTolerance = Precision::SquareConfusion();
namespace
{
static Standard_CString AIS_Table_PrintDisplayStatus[3] =
{
"DISPLAYED", "ERASED", "NONE"
};
static Standard_CString AIS_Table_PrintKindOfInteractive[6] =
{
"NONE", "DATUM", "SHAPE", "OBJECT", "RELATION", "DIMENSION"
};
}
//=======================================================================
//function : Nearest
//purpose :
@@ -1538,3 +1551,63 @@ void AIS::ComputeProjVertexPresentation (const Handle( Prs3d_Presentation )& aPr
StdPrs_WFShape::Add (aPresentation, MakEd.Edge(), aDrawer);
}
}
//=======================================================================
//function : DisplayStatusToString
//purpose :
//=======================================================================
Standard_CString AIS::DisplayStatusToString (AIS_DisplayStatus theType)
{
return AIS_Table_PrintDisplayStatus[theType];
}
//=======================================================================
//function : DisplayStatusFromString
//purpose :
//=======================================================================
Standard_Boolean AIS::DisplayStatusFromString (Standard_CString theTypeString,
AIS_DisplayStatus& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= AIS_DS_None; ++aTypeIter)
{
Standard_CString aTypeName = AIS_Table_PrintDisplayStatus[aTypeIter];
if (aName == aTypeName)
{
theType = AIS_DisplayStatus (aTypeIter);
return Standard_True;
}
}
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;
}

View File

@@ -17,6 +17,8 @@
#ifndef _AIS_HeaderFile
#define _AIS_HeaderFile
#include <AIS_DisplayStatus.hxx>
#include <AIS_KindOfInteractive.hxx>
#include <AIS_KindOfSurface.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <Aspect_TypeOfMarker.hxx>
@@ -203,6 +205,50 @@ public:
Standard_EXPORT static void ComputeProjVertexPresentation (const Handle(Prs3d_Presentation)& aPres, const Handle(Prs3d_Drawer)& aDrawer, const TopoDS_Vertex& aVertex, const gp_Pnt& ProjPoint, const Quantity_NameOfColor aColor = Quantity_NOC_PURPLE, const Standard_Real aWidth = 2, const Aspect_TypeOfMarker aProjTOM = Aspect_TOM_PLUS, const Aspect_TypeOfLine aCallTOL = Aspect_TOL_DOT);
//! Returns the string name for a given enum type.
//! @param theType display status
//! @return string identifier
Standard_EXPORT static Standard_CString DisplayStatusToString (AIS_DisplayStatus theType);
//! Returns the display status from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return status type or AIS_DS_None if string identifier is invalid
static AIS_DisplayStatus DisplayStatusFromString (Standard_CString theTypeString)
{
AIS_DisplayStatus aType = AIS_DS_None;
DisplayStatusFromString (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 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

452
src/Aspect/Aspect.cxx Normal file
View File

@@ -0,0 +1,452 @@
// 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 <Aspect.hxx>
#include <TCollection_AsciiString.hxx>
namespace
{
static Standard_CString Aspect_Table_PrintTypeOfDeflection[2] =
{
"RELATIVE", "ABSOLUTE"
};
static Standard_CString Aspect_Table_PrintTypeOfFacingModel[3] =
{
"BOTH", "BACK", "FRONT"
};
static Standard_CString Aspect_Table_PrintTypeOfHighlightMethod[2] =
{
"COLOR", "BOUNDBOX"
};
static Standard_CString Aspect_Table_PrintTypeOfLine[6] =
{
"EMPTY", "SOLID", "DASH", "DOT", "DOT_DASH", "USER_DEFINED"
};
static Standard_CString Aspect_Table_PrintTypeOfMarker[15] =
{
"EMPTY", "POINT", "PLUS", "STAR", "X", "O", "O_POINT", "O_PLUS", "O_STAR", "O_X",
"RING1", "RING2", "RING3", "BALL", "USER_DEFINED"
};
static Standard_CString Aspect_Table_PrintTypeOfDisplayText[6] =
{
"NORMAL", "SUBTITLE", "DEKALE", "BLEND", "DIMENSION", "SHADOW"
};
static Standard_CString Aspect_Table_PrintTypeOfStyleText[2] =
{
"NORMAL", "ANNOTATION"
};
static Standard_CString Aspect_Table_PrintInteriorStyle[6] =
{
"EMPTY", "HOLLOW", "HATCH", "SOLID", "HIDDEN_LINE", "POINT"
};
static Standard_CString Aspect_Table_PrintPolygonOffsetMode[7] =
{
"OFF", "FILL", "LINE", "POINT", "ALL", "NONE", "MASK"
};
static Standard_CString Aspect_Table_PrintHatchStyle[14] =
{
"SOLID", "HORIZONTAL", "HORIZONTAL_WIDE", "VERTICAL", "VERTICAL_WIDE",
"DIAGONAL_45", "DIAGONAL_45_WIDE", "DIAGONAL_135", "DIAGONAL_135_WIDE",
"GRID", "GRID_WIDE", "GRID_DIAGONAL", "GRID_DIAGONAL_WIDE", "NB"
};
static Standard_CString Aspect_Table_PrintTypeOfTriedronPosition[9] =
{
"CENTER", "TOP", "BOTTOM", "LEFT", "RIGHT", "LEFT_LOWER", "LEFT_UPPER", "RIGHT_LOWER", "RIGHT_UPPER"
};
}
//=======================================================================
//function : TypeOfDeflectionToString
//purpose :
//=======================================================================
Standard_CString Aspect::TypeOfDeflectionToString (Aspect_TypeOfDeflection theType)
{
return Aspect_Table_PrintTypeOfDeflection[theType];
}
//=======================================================================
//function : TypeOfDeflectionFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::TypeOfDeflectionFromString (Standard_CString theTypeString,
Aspect_TypeOfDeflection& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= Aspect_TOD_ABSOLUTE; ++aTypeIter)
{
Standard_CString aTypeName = Aspect_Table_PrintTypeOfDeflection[aTypeIter];
if (aName == aTypeName)
{
theType = Aspect_TypeOfDeflection (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TypeOfFacingModelToString
//purpose :
//=======================================================================
Standard_CString Aspect::TypeOfFacingModelToString (Aspect_TypeOfFacingModel theType)
{
return Aspect_Table_PrintTypeOfFacingModel[theType];
}
//=======================================================================
//function : TypeOfFacingModelFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::TypeOfFacingModelFromString (Standard_CString theTypeString,
Aspect_TypeOfFacingModel& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= Aspect_TOFM_FRONT_SIDE; ++aTypeIter)
{
Standard_CString aTypeName = Aspect_Table_PrintTypeOfFacingModel[aTypeIter];
if (aName == aTypeName)
{
theType = Aspect_TypeOfFacingModel (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TypeOfHighlightMethodToString
//purpose :
//=======================================================================
Standard_CString Aspect::TypeOfHighlightMethodToString (Aspect_TypeOfHighlightMethod theType)
{
return Aspect_Table_PrintTypeOfHighlightMethod[theType];
}
//=======================================================================
//function : TypeOfHighlightMethodFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::TypeOfHighlightMethodFromString (Standard_CString theTypeString,
Aspect_TypeOfHighlightMethod& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= Aspect_TOHM_BOUNDBOX; ++aTypeIter)
{
Standard_CString aTypeName = Aspect_Table_PrintTypeOfHighlightMethod[aTypeIter];
if (aName == aTypeName)
{
theType = Aspect_TypeOfHighlightMethod (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TypeOfLineToString
//purpose :
//=======================================================================
Standard_CString Aspect::TypeOfLineToString (Aspect_TypeOfLine theType)
{
return Aspect_Table_PrintTypeOfLine[theType];
}
//=======================================================================
//function : TypeOfLineFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::TypeOfLineFromString (Standard_CString theTypeString,
Aspect_TypeOfLine& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = Aspect_TOL_EMPTY; aTypeIter <= Aspect_TOL_USERDEFINED; ++aTypeIter)
{
Standard_CString aTypeName = Aspect_Table_PrintTypeOfLine[aTypeIter + 1];
if (aName == aTypeName)
{
theType = Aspect_TypeOfLine (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TypeOfMarkerToString
//purpose :
//=======================================================================
Standard_CString Aspect::TypeOfMarkerToString (Aspect_TypeOfMarker theType)
{
return Aspect_Table_PrintTypeOfMarker[theType];
}
//=======================================================================
//function : TypeOfMarkerFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::TypeOfMarkerFromString (Standard_CString theTypeString,
Aspect_TypeOfMarker& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = Aspect_TOM_EMPTY; aTypeIter <= Aspect_TOM_USERDEFINED; ++aTypeIter)
{
Standard_CString aTypeName = Aspect_Table_PrintTypeOfMarker[aTypeIter + 1];
if (aName == aTypeName)
{
theType = Aspect_TypeOfMarker (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TypeOfDisplayTextToString
//purpose :
//=======================================================================
Standard_CString Aspect::TypeOfDisplayTextToString (Aspect_TypeOfDisplayText theType)
{
return Aspect_Table_PrintTypeOfDisplayText[theType];
}
//=======================================================================
//function : TypeOfDisplayTextFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::TypeOfDisplayTextFromString (Standard_CString theTypeString,
Aspect_TypeOfDisplayText& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = Aspect_TODT_NORMAL; aTypeIter <= Aspect_TODT_SHADOW; ++aTypeIter)
{
Standard_CString aTypeName = Aspect_Table_PrintTypeOfDisplayText[aTypeIter];
if (aName == aTypeName)
{
theType = Aspect_TypeOfDisplayText (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TypeOfStyleTextToString
//purpose :
//=======================================================================
Standard_CString Aspect::TypeOfStyleTextToString (Aspect_TypeOfStyleText theType)
{
return Aspect_Table_PrintTypeOfStyleText[theType];
}
//=======================================================================
//function : TypeOfStyleTextFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::TypeOfStyleTextFromString (Standard_CString theTypeString,
Aspect_TypeOfStyleText& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = Aspect_TOST_NORMAL; aTypeIter <= Aspect_TOST_ANNOTATION; ++aTypeIter)
{
Standard_CString aTypeName = Aspect_Table_PrintTypeOfStyleText[aTypeIter];
if (aName == aTypeName)
{
theType = Aspect_TypeOfStyleText (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : InteriorStyleToString
//purpose :
//=======================================================================
Standard_CString Aspect::InteriorStyleToString (Aspect_InteriorStyle theType)
{
return Aspect_Table_PrintInteriorStyle[theType];
}
//=======================================================================
//function : InteriorStyleFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::InteriorStyleFromString (Standard_CString theTypeString,
Aspect_InteriorStyle& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = Aspect_IS_EMPTY; aTypeIter <= Aspect_IS_POINT; ++aTypeIter)
{
Standard_CString aTypeName = Aspect_Table_PrintInteriorStyle[aTypeIter];
if (aName == aTypeName)
{
theType = Aspect_InteriorStyle (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : PolygonOffsetModeToString
//purpose :
//=======================================================================
Standard_CString Aspect::PolygonOffsetModeToString (Aspect_PolygonOffsetMode theType)
{
switch (theType)
{
case Aspect_POM_Off: return Aspect_Table_PrintPolygonOffsetMode[0];
case Aspect_POM_Fill: return Aspect_Table_PrintPolygonOffsetMode[1];
case Aspect_POM_Line: return Aspect_Table_PrintPolygonOffsetMode[2];
case Aspect_POM_Point: return Aspect_Table_PrintPolygonOffsetMode[3];
case Aspect_POM_All: return Aspect_Table_PrintPolygonOffsetMode[4];
case Aspect_POM_None: return Aspect_Table_PrintPolygonOffsetMode[5];
case Aspect_POM_Mask: return Aspect_Table_PrintPolygonOffsetMode[6];
}
return "";
}
//=======================================================================
//function : PolygonOffsetModeFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::PolygonOffsetModeFromString (Standard_CString theTypeString,
Aspect_PolygonOffsetMode& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
if (aName == Aspect_Table_PrintPolygonOffsetMode[0]) { theType = Aspect_POM_Off; return Standard_True; }
else if (aName == Aspect_Table_PrintPolygonOffsetMode[1]) { theType = Aspect_POM_Fill; return Standard_True; }
else if (aName == Aspect_Table_PrintPolygonOffsetMode[2]) { theType = Aspect_POM_Line; return Standard_True; }
else if (aName == Aspect_Table_PrintPolygonOffsetMode[3]) { theType = Aspect_POM_Point; return Standard_True; }
else if (aName == Aspect_Table_PrintPolygonOffsetMode[4]) { theType = Aspect_POM_All; return Standard_True; }
else if (aName == Aspect_Table_PrintPolygonOffsetMode[5]) { theType = Aspect_POM_None; return Standard_True; }
else if (aName == Aspect_Table_PrintPolygonOffsetMode[6]) { theType = Aspect_POM_Mask; return Standard_True; }
return Standard_False;
}
//=======================================================================
//function : HatchStyleToString
//purpose :
//=======================================================================
Standard_CString Aspect::HatchStyleToString (Aspect_HatchStyle theType)
{
return Aspect_Table_PrintHatchStyle[theType];
switch (theType)
{
case Aspect_HS_SOLID: return Aspect_Table_PrintHatchStyle[0];
case Aspect_HS_HORIZONTAL: return Aspect_Table_PrintHatchStyle[1];
case Aspect_HS_HORIZONTAL_WIDE: return Aspect_Table_PrintHatchStyle[2];
case Aspect_HS_VERTICAL: return Aspect_Table_PrintHatchStyle[3];
case Aspect_HS_VERTICAL_WIDE: return Aspect_Table_PrintHatchStyle[4];
case Aspect_HS_DIAGONAL_45: return Aspect_Table_PrintHatchStyle[5];
case Aspect_HS_DIAGONAL_45_WIDE: return Aspect_Table_PrintHatchStyle[6];
case Aspect_HS_DIAGONAL_135: return Aspect_Table_PrintHatchStyle[7];
case Aspect_HS_DIAGONAL_135_WIDE: return Aspect_Table_PrintHatchStyle[8];
case Aspect_HS_GRID: return Aspect_Table_PrintHatchStyle[9];
case Aspect_HS_GRID_WIDE: return Aspect_Table_PrintHatchStyle[10];
case Aspect_HS_GRID_DIAGONAL: return Aspect_Table_PrintHatchStyle[11];
case Aspect_HS_GRID_DIAGONAL_WIDE: return Aspect_Table_PrintHatchStyle[12];
case Aspect_HS_NB: return Aspect_Table_PrintHatchStyle[13];
}
return "";
}
//=======================================================================
//function : HatchStyleFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::HatchStyleFromString (Standard_CString theTypeString,
Aspect_HatchStyle& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
if (aName == Aspect_Table_PrintHatchStyle[0]) { theType = Aspect_HS_SOLID; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[1]) { theType = Aspect_HS_HORIZONTAL; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[2]) { theType = Aspect_HS_HORIZONTAL_WIDE; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[3]) { theType = Aspect_HS_VERTICAL; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[4]) { theType = Aspect_HS_VERTICAL_WIDE; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[5]) { theType = Aspect_HS_DIAGONAL_45; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[6]) { theType = Aspect_HS_DIAGONAL_45_WIDE; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[7]) { theType = Aspect_HS_DIAGONAL_135; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[8]) { theType = Aspect_HS_DIAGONAL_135_WIDE; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[9]) { theType = Aspect_HS_GRID; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[10]) { theType = Aspect_HS_GRID_WIDE; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[11]) { theType = Aspect_HS_GRID_DIAGONAL; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[12]) { theType = Aspect_HS_GRID_DIAGONAL_WIDE; return Standard_True; }
else if (aName == Aspect_Table_PrintHatchStyle[13]) { theType = Aspect_HS_NB; return Standard_True; }
return Standard_False;
}
//=======================================================================
//function : TypeOfTriedronPositionToString
//purpose :
//=======================================================================
Standard_CString Aspect::TypeOfTriedronPositionToString (Aspect_TypeOfTriedronPosition theType)
{
return Aspect_Table_PrintTypeOfTriedronPosition[theType];
switch (theType)
{
case Aspect_TOTP_CENTER: return Aspect_Table_PrintTypeOfTriedronPosition[0];
case Aspect_TOTP_TOP: return Aspect_Table_PrintTypeOfTriedronPosition[1];
case Aspect_TOTP_BOTTOM: return Aspect_Table_PrintTypeOfTriedronPosition[2];
case Aspect_TOTP_LEFT: return Aspect_Table_PrintTypeOfTriedronPosition[3];
case Aspect_TOTP_RIGHT: return Aspect_Table_PrintTypeOfTriedronPosition[4];
case Aspect_TOTP_LEFT_LOWER: return Aspect_Table_PrintTypeOfTriedronPosition[5];
case Aspect_TOTP_LEFT_UPPER: return Aspect_Table_PrintTypeOfTriedronPosition[6];
case Aspect_TOTP_RIGHT_LOWER: return Aspect_Table_PrintTypeOfTriedronPosition[7];
case Aspect_TOTP_RIGHT_UPPER: return Aspect_Table_PrintTypeOfTriedronPosition[8];
}
return "";
}
//=======================================================================
//function : TypeOfTriedronPositionFromString
//purpose :
//=======================================================================
Standard_Boolean Aspect::TypeOfTriedronPositionFromString (Standard_CString theTypeString,
Aspect_TypeOfTriedronPosition& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
if (aName == Aspect_Table_PrintTypeOfTriedronPosition[0]) { theType = Aspect_TOTP_CENTER; return Standard_True; }
else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[1]) { theType = Aspect_TOTP_TOP; return Standard_True; }
else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[2]) { theType = Aspect_TOTP_BOTTOM; return Standard_True; }
else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[3]) { theType = Aspect_TOTP_LEFT; return Standard_True; }
else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[4]) { theType = Aspect_TOTP_RIGHT; return Standard_True; }
else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[5]) { theType = Aspect_TOTP_LEFT_LOWER; return Standard_True; }
else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[6]) { theType = Aspect_TOTP_LEFT_UPPER; return Standard_True; }
else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[7]) { theType = Aspect_TOTP_RIGHT_LOWER; return Standard_True; }
else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[8]) { theType = Aspect_TOTP_RIGHT_UPPER; return Standard_True; }
return Standard_False;
}

284
src/Aspect/Aspect.hxx Normal file
View File

@@ -0,0 +1,284 @@
// 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 _Aspect_HeaderFile
#define _Aspect_HeaderFile
#include <Aspect_HatchStyle.hxx>
#include <Aspect_InteriorStyle.hxx>
#include <Aspect_PolygonOffsetMode.hxx>
#include <Aspect_TypeOfDeflection.hxx>
#include <Aspect_TypeOfDisplayText.hxx>
#include <Aspect_TypeOfFacingModel.hxx>
#include <Aspect_TypeOfHighlightMethod.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <Aspect_TypeOfMarker.hxx>
#include <Aspect_TypeOfStyleText.hxx>
#include <Aspect_TypeOfTriedronPosition.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Macro.hxx>
#include <Standard_Type.hxx>
//! Provides methods to cast enumerations of package to string value
class Aspect
{
public:
DEFINE_STANDARD_ALLOC
//! 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 TypeOfDeflectionToString (Aspect_TypeOfDeflection theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_TOFM_BOTH_SIDE if string identifier is invalid
static Aspect_TypeOfDeflection TypeOfDeflectionFromString (Standard_CString theTypeString)
{
Aspect_TypeOfDeflection aType = Aspect_TOD_RELATIVE;
TypeOfDeflectionFromString (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 TypeOfDeflectionFromString (const Standard_CString theTypeString,
Aspect_TypeOfDeflection& 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 TypeOfFacingModelToString (Aspect_TypeOfFacingModel theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_TOFM_BOTH_SIDE if string identifier is invalid
static Aspect_TypeOfFacingModel TypeOfFacingModelFromString (Standard_CString theTypeString)
{
Aspect_TypeOfFacingModel aType = Aspect_TOFM_BOTH_SIDE;
TypeOfFacingModelFromString (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 TypeOfFacingModelFromString (const Standard_CString theTypeString,
Aspect_TypeOfFacingModel& 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 TypeOfHighlightMethodToString (Aspect_TypeOfHighlightMethod theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_TOHM_COLOR if string identifier is invalid
static Aspect_TypeOfHighlightMethod TypeOfHighlightMethodFromString (Standard_CString theTypeString)
{
Aspect_TypeOfHighlightMethod aType = Aspect_TOHM_COLOR;
TypeOfHighlightMethodFromString (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 TypeOfHighlightMethodFromString (const Standard_CString theTypeString,
Aspect_TypeOfHighlightMethod& 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 TypeOfLineToString (Aspect_TypeOfLine theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_TOL_EMPTY if string identifier is invalid
static Aspect_TypeOfLine TypeOfLineFromString (Standard_CString theTypeString)
{
Aspect_TypeOfLine aType = Aspect_TOL_EMPTY;
TypeOfLineFromString (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 TypeOfLineFromString (const Standard_CString theTypeString,
Aspect_TypeOfLine& 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 TypeOfMarkerToString (Aspect_TypeOfMarker theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_TOM_EMPTY if string identifier is invalid
static Aspect_TypeOfMarker TypeOfMarkerFromString (Standard_CString theTypeString)
{
Aspect_TypeOfMarker aType = Aspect_TOM_EMPTY;
TypeOfMarkerFromString (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 TypeOfMarkerFromString (const Standard_CString theTypeString,
Aspect_TypeOfMarker& 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 TypeOfDisplayTextToString (Aspect_TypeOfDisplayText theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_TODT_NORMAL if string identifier is invalid
static Aspect_TypeOfDisplayText TypeOfDisplayTextFromString (Standard_CString theTypeString)
{
Aspect_TypeOfDisplayText aType = Aspect_TODT_NORMAL;
TypeOfDisplayTextFromString (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 TypeOfDisplayTextFromString (const Standard_CString theTypeString,
Aspect_TypeOfDisplayText& 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 TypeOfStyleTextToString (Aspect_TypeOfStyleText theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_TODT_NORMAL if string identifier is invalid
static Aspect_TypeOfStyleText TypeOfStyleTextFromString (Standard_CString theTypeString)
{
Aspect_TypeOfStyleText aType = Aspect_TOST_NORMAL;
TypeOfStyleTextFromString (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 TypeOfStyleTextFromString (const Standard_CString theTypeString,
Aspect_TypeOfStyleText& 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 InteriorStyleToString (Aspect_InteriorStyle theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_IS_EMPTY if string identifier is invalid
static Aspect_InteriorStyle InteriorStyleFromString (Standard_CString theTypeString)
{
Aspect_InteriorStyle aType = Aspect_IS_EMPTY;
InteriorStyleFromString (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 InteriorStyleFromString (const Standard_CString theTypeString,
Aspect_InteriorStyle& 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 PolygonOffsetModeToString (Aspect_PolygonOffsetMode theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_POM_Off if string identifier is invalid
static Aspect_PolygonOffsetMode PolygonOffsetModeFromString (Standard_CString theTypeString)
{
Aspect_PolygonOffsetMode aType = Aspect_POM_Off;
PolygonOffsetModeFromString (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 PolygonOffsetModeFromString (const Standard_CString theTypeString,
Aspect_PolygonOffsetMode& 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 HatchStyleToString (Aspect_HatchStyle theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_POM_Off if string identifier is invalid
static Aspect_HatchStyle HatchStyleFromString (Standard_CString theTypeString)
{
Aspect_HatchStyle aType = Aspect_HS_SOLID;
HatchStyleFromString (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 HatchStyleFromString (const Standard_CString theTypeString,
Aspect_HatchStyle& 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 TypeOfTriedronPositionToString (Aspect_TypeOfTriedronPosition theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_TOTP_CENTER if string identifier is invalid
static Aspect_TypeOfTriedronPosition TypeOfTriedronPositionFromString (Standard_CString theTypeString)
{
Aspect_TypeOfTriedronPosition aType = Aspect_TOTP_CENTER;
TypeOfTriedronPositionFromString (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 TypeOfTriedronPositionFromString (const Standard_CString theTypeString,
Aspect_TypeOfTriedronPosition& theType);
};
#endif // _Aspect_HeaderFile

View File

@@ -1,3 +1,5 @@
Aspect.cxx
Aspect.hxx
Aspect_AspectFillAreaDefinitionError.hxx
Aspect_AspectLineDefinitionError.hxx
Aspect_AspectMarkerDefinitionError.hxx

View File

@@ -18,6 +18,7 @@
#include <BVH_Constants.hxx>
#include <BVH_Types.hxx>
#include <Message_Alerts.hxx>
#include <Standard_ShortReal.hxx>
#include <limits>
@@ -108,6 +109,18 @@ public:
//! Returns center of bounding box along the given axis.
T Center (const Standard_Integer theAxis) const;
//! Dumps the content of me on the stream <OS>.
void Dump (Standard_OStream& OS) const
{
DUMP_VALUES (OS, "BVH_Box", 2);
DUMP_VALUES (OS, "IsValid", IsValid());
DUMP_VALUES (OS, "Bnd_Box", BVH::ToBndBox (CornerMin(), CornerMax()).ToString());
//DUMP_VALUES (OS, "CornerMin", BVH::ToString (CornerMin()));
//DUMP_VALUES (OS, "CornerMin", BVH::ToString (CornerMax()));
}
public:
//! Checks if the Box is out of the other box.

View File

@@ -18,6 +18,11 @@
#include <BVH_Box.hxx>
#include <Message_Alerts.hxx>
#include <Standard_Macro.hxx>
#include <Standard_OStream.hxx>
template<class T, int N> class BVH_Builder;
//! A non-template class for using as base for BVH_TreeBase
@@ -27,6 +32,13 @@ class BVH_TreeBaseTransient : public Standard_Transient
DEFINE_STANDARD_RTTIEXT(BVH_TreeBaseTransient, Standard_Transient)
protected:
BVH_TreeBaseTransient() {}
//! Dumps the content of me on the stream <OS>.
virtual void Dump (Standard_OStream& OS) const { (void)OS; }
//! Dumps the content of the given node on the stream <OS>.
virtual void DumpNode (const int theNodeIndex, Standard_OStream& OS) const
{ (void)theNodeIndex; (void)OS; }
};
//! Stores parameters of bounding volume hierarchy (BVH).
@@ -178,6 +190,35 @@ public: //! @name methods for accessing serialized tree data
return myMaxPointBuffer;
}
//! Dumps the content of me on the stream <OS>.
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE
{
DUMP_VALUES (OS, "BVH_Tree", 2);
DUMP_VALUES (OS, "Depth", Depth());
DUMP_VALUES (OS, "Length", Length());
for (Standard_Integer aNodeIdx = 0; aNodeIdx < Length(); ++aNodeIdx)
{
DumpNode (aNodeIdx, OS);
}
}
//! Dumps the content of the given node on the stream <OS>.
Standard_EXPORT virtual void DumpNode (const int theNodeIndex, Standard_OStream& OS) const Standard_OVERRIDE
{
DUMP_VALUES (OS, "BVH_TreeNode", 2);
DUMP_VALUES (OS, "NodeIndex", theNodeIndex);
DUMP_VALUES (OS, "MinPoint - MaxPoint", BVH::ToBndBox (MinPoint (theNodeIndex), MaxPoint (theNodeIndex)).ToString());
DUMP_VALUES (OS, "BegPrimitive", BegPrimitive (theNodeIndex));
DUMP_VALUES (OS, "EndPrimitive", EndPrimitive (theNodeIndex));
DUMP_VALUES (OS, "Level", Level (theNodeIndex));
DUMP_VALUES (OS, "IsOuter", IsOuter (theNodeIndex));
}
public: //! @name protected fields
//! Array of node data records.

View File

@@ -21,10 +21,12 @@
#include <vector>
#include <Bnd_Box.hxx>
#include <NCollection_Mat4.hxx>
#include <NCollection_Vec2.hxx>
#include <NCollection_Vec3.hxx>
#include <NCollection_Vector.hxx>
#include <Standard_OStream.hxx>
#include <Standard_Type.hxx>
// GCC supports shrink function only in C++11 mode
@@ -57,6 +59,32 @@ namespace BVH
typedef NCollection_Vec3<T> Type;
};
template<class T> Bnd_Box ToBndBox (const T& theType1, const T& theType2)
{
return Bnd_Box (theType1, 0., 0., theType2, 0., 0.);
}
template<class T> Bnd_Box ToBndBox (const NCollection_Vec2<T>& theType1,
const NCollection_Vec2<T>& theType2)
{
return Bnd_Box (theType1.x(), theType1.y(), 0.,
theType2.x(), theType2.y(), 0.);
}
template<class T> Bnd_Box ToBndBox (const NCollection_Vec3<T>& theType1,
const NCollection_Vec3<T>& theType2)
{
return Bnd_Box (theType1.x(), theType1.y(), theType1.z(),
theType2.x(), theType2.y(), theType2.z());
}
template<class T> Bnd_Box ToBndBox (const NCollection_Vec4<T>& theType1,
const NCollection_Vec4<T>& theType2)
{
return Bnd_Box (theType1.x(), theType1.y(), theType1.z(),
theType2.x(), theType2.y(), theType2.z());
}
template<class T> struct VectorType<T, 4>
{
typedef NCollection_Vec4<T> Type;

View File

@@ -43,6 +43,19 @@ Bnd_Box::Bnd_Box()
SetVoid();
}
//=======================================================================
//function : Bnd_Box
//purpose :
//=======================================================================
Bnd_Box::Bnd_Box (const Standard_Real theXmin, const Standard_Real theYmin, const Standard_Real theZmin,
const Standard_Real theXmax, const Standard_Real theYmax, const Standard_Real theZmax)
: Gap (0.0)
{
SetVoid();
Update (theXmin, theYmin, theZmin, theXmax, theYmax, theZmax);
}
//=======================================================================
//function : Set
//purpose :
@@ -957,3 +970,49 @@ void Bnd_Box::Dump () const
cout << "\n Gap : " << Gap;
cout << "\n";
}
//=======================================================================
//function : PointsSeparator
//purpose :
//=======================================================================
TCollection_AsciiString PointsSeparator()
{
return " - ";
}
//=======================================================================
//function : ToString
//purpose :
//=======================================================================
TCollection_AsciiString Bnd_Box::ToString() const
{
return gp_XYZ (Xmin, Ymin, Zmin).ToString()
+ PointsSeparator()
+ gp_XYZ (Xmax, Ymax, Zmax).ToString();
}
//=======================================================================
//function : FromString
//purpose :
//=======================================================================
Standard_Boolean Bnd_Box::FromString (const TCollection_AsciiString& theValue)
{
TCollection_AsciiString aCurrentString = theValue;
Standard_Integer aPosition = aCurrentString.Search (PointsSeparator());
if (aPosition < 0)
return Standard_False;
TCollection_AsciiString aLeftString = aCurrentString;
TCollection_AsciiString aRightString = aLeftString.Split (aPosition - 1);
aCurrentString = aRightString;
aRightString = aCurrentString.Split (PointsSeparator().Length());
gp_XYZ aMinPoint, aMaxPoint;
if (!aMinPoint.FromString (aLeftString) || !aMaxPoint.FromString (aRightString))
return Standard_False;
Update (aMinPoint.X(), aMinPoint.Y(), aMinPoint.Z(), aMaxPoint.X(), aMaxPoint.Y(), aMaxPoint.Z());
return Standard_True;
}

View File

@@ -24,6 +24,10 @@
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <TCollection_AsciiString.hxx>
#include <gp_XYZ.hxx>
class Standard_ConstructionError;
class gp_Pnt;
class gp_Dir;
@@ -69,6 +73,14 @@ public:
//! The constructed box is qualified Void. Its gap is null.
Standard_EXPORT Bnd_Box();
//! Creates a bounding box, it contains:
//! - interval [ aXmin,aXmax ] in the "X Direction",
//! - interval [ aYmin,aYmax ] in the "Y Direction",
//! - interval [ aZmin,aZmax ] in the "Z Direction";
//! The constructed box is qualified Void. Its gap is null.
Standard_EXPORT Bnd_Box (const Standard_Real aXmin, const Standard_Real aYmin, const Standard_Real aZmin,
const Standard_Real aXmax, const Standard_Real aYmax, const Standard_Real aZmax);
//! Sets this bounding box so that it covers the whole of 3D space.
//! It is infinitely long in all directions.
void SetWhole() { Flags = WholeMask; }
@@ -296,6 +308,14 @@ public:
&& Xmax >= Xmin;
}
//! Covers bounding box into string in format: (Xmin, Ymin, Zmin) - (Xmax, Ymax, Zmax)
//! \return the string value
Standard_EXPORT TCollection_AsciiString ToString() const;
//! Converts text value into parameters if possible, the string format is: (Xmin, Ymin, Zmin) - (Xmax, Ymax, Zmax)
//! \return true if conversion is done
Standard_EXPORT Standard_Boolean FromString (const TCollection_AsciiString& theValue);
protected:
//! Bit flags.

View File

@@ -677,3 +677,19 @@ void Bnd_OBB::Add(const Bnd_OBB& theOther)
ReBuild(TColgp_Array1OfPnt(aList[0], 0, 15));
}
// =======================================================================
// function : Init
// purpose :
// =======================================================================
Standard_Boolean Bnd_OBB::Init (const Standard_OStream&)
{
return Standard_False;
}
// =======================================================================
// function : Dump
// purpose :
// =======================================================================
void Bnd_OBB::Dump (Standard_OStream&) const
{
}

View File

@@ -20,6 +20,7 @@
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_OStream.hxx>
#include <Bnd_Box.hxx>
#include <gp_Ax3.hxx>
@@ -288,6 +289,12 @@ protected:
myCenter = theP.XYZ();
}
//! Dumps the content of me on the stream <OS>.
Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS);
//! Dumps the content of me on the stream <OS>.
Standard_EXPORT void Dump (Standard_OStream& OS) const;
private:
//! Center of the OBB

View File

@@ -175,3 +175,12 @@ void Bnd_Range::Split(const Standard_Real theVal,
theList.Append(Bnd_Range(aValPrev, myLast));
}
}
//=======================================================================
//function : ToString
//purpose :
//=======================================================================
TCollection_AsciiString Bnd_Range::ToString() const
{
return TCollection_AsciiString ("[") + myFirst + ", " + myLast + "]";
}

View File

@@ -18,6 +18,7 @@
#include <Standard_Real.hxx>
#include <Standard_ConstructionError.hxx>
#include <TCollection_AsciiString.hxx>
#include <NCollection_List.hxx>
@@ -256,6 +257,10 @@ public:
return ((myFirst == theOther.myFirst) && (myLast == theOther.myLast));
}
//! Covers point into string in format: [myFirst, myLast]
//! \return the string value
Standard_EXPORT TCollection_AsciiString ToString() const;
private:
Standard_Real myFirst; //!< Start of range

View File

@@ -1,3 +1,5 @@
Font.cxx
Font.hxx
Font_BRepFont.cxx
Font_BRepFont.hxx
Font_BRepTextBuilder.cxx

56
src/Font/Font.cxx Normal file
View File

@@ -0,0 +1,56 @@
// 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 <Font.hxx>
#include <TCollection_AsciiString.hxx>
namespace
{
static Standard_CString Font_Table_PrintFontAspect[5] =
{
"UNDEFINED", "REGULAR", "BOLD", "ITALIC", "BOLD_ITALIC"
};
}
//=======================================================================
//function : FontAspectToString
//purpose :
//=======================================================================
Standard_CString Font::FontAspectToString (Font_FontAspect theType)
{
return Font_Table_PrintFontAspect[theType];
}
//=======================================================================
//function : FontAspectFromString
//purpose :
//=======================================================================
Standard_Boolean Font::FontAspectFromString (Standard_CString theTypeString,
Font_FontAspect& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= Font_FA_BoldItalic; ++aTypeIter)
{
Standard_CString aTypeName = Font_Table_PrintFontAspect[aTypeIter];
if (aName == aTypeName)
{
theType = Font_FontAspect (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}

54
src/Font/Font.hxx Normal file
View File

@@ -0,0 +1,54 @@
// 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 _Font_HeaderFile
#define _Font_HeaderFile
#include <Font_FontAspect.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Macro.hxx>
#include <Standard_Type.hxx>
//! Provides methods to cast enumerations of package to string value
class Font
{
public:
DEFINE_STANDARD_ALLOC
//! 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 FontAspectToString (Font_FontAspect theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Aspect_TOFM_BOTH_SIDE if string identifier is invalid
static Font_FontAspect FontAspectFromString (Standard_CString theTypeString)
{
Font_FontAspect aType = Font_FA_Undefined;
FontAspectFromString (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 FontAspectFromString (const Standard_CString theTypeString,
Font_FontAspect& theType);
};
#endif // _Font_HeaderFile

View File

@@ -1,3 +1,5 @@
Graphic3d.cxx
Graphic3d.hxx
Graphic3d_AlphaMode.hxx
Graphic3d_ArrayFlags.hxx
Graphic3d_ArrayOfPoints.hxx

521
src/Graphic3d/Graphic3d.cxx Normal file
View File

@@ -0,0 +1,521 @@
// 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 <Graphic3d.hxx>
#include <TCollection_AsciiString.hxx>
namespace
{
static Standard_CString Graphic3d_Table_PrintZLayerId[6] =
{
"INKNOWN", "DEFAULT", "TOP", "TOPMOST", "TOP_OSD", "BOT_OSD"
};
static Standard_CString Graphic3d_Table_PrintHorizontalTextAlignment[3] =
{
"LEFT", "CENTER", "RIGHT"
};
static Standard_CString Graphic3d_Table_PrintVerticalTextAlignment[4] =
{
"BOTTOM", "CENTER", "TOP", "TOP_FIRST_LINE"
};
static Standard_CString Graphic3d_Table_PrintTextPath[4] =
{
"UP", "DOWN", "LEFT", "RIGHT"
};
static Standard_CString Graphic3d_Table_PrintAlphaMode[4] =
{
"BLEND_AUTO", "OPAQUE", "MASK", "BLEND"
};
static Standard_CString Graphic3d_Table_PrintTypeOfShadingModel[5] =
{
"DEFAULT", "UNLIT", "FACET", "VERTEX", "FRAGMENT"
};
static Standard_CString Graphic3d_Table_PrintTypeOfAttribute[5] =
{
"POS", "NORM", "UV", "COLOR", "CUSTOM"
};
static Standard_CString Graphic3d_Table_PrintTypeOfData[7] =
{
"USHORT", "UINT", "VEC2", "VEC3", "VEC4", "VEC4UB", "FLOAT"
};
static Standard_CString Graphic3d_Table_PrintTransModeFlags[6] =
{
"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
};
}
//=======================================================================
//function : ZLayerIdToString
//purpose :
//=======================================================================
Standard_CString Graphic3d::ZLayerIdToString (Graphic3d_ZLayerId theType)
{
switch (theType)
{
case Graphic3d_ZLayerId_UNKNOWN: return Graphic3d_Table_PrintZLayerId[0]; break;
case Graphic3d_ZLayerId_Default: return Graphic3d_Table_PrintZLayerId[1]; break;
case Graphic3d_ZLayerId_Top: return Graphic3d_Table_PrintZLayerId[2]; break;
case Graphic3d_ZLayerId_Topmost: return Graphic3d_Table_PrintZLayerId[3]; break;
case Graphic3d_ZLayerId_TopOSD: return Graphic3d_Table_PrintZLayerId[4]; break;
case Graphic3d_ZLayerId_BotOSD: return Graphic3d_Table_PrintZLayerId[5]; break;
}
return "";
}
//=======================================================================
//function : ZLayerIdFromString
//purpose :
//=======================================================================
Standard_Boolean Graphic3d::ZLayerIdFromString (Standard_CString theTypeString,
Graphic3d_ZLayerId& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= 5; ++aTypeIter)
{
Standard_CString aTypeName = Graphic3d_Table_PrintZLayerId[aTypeIter];
if (aName == aTypeName)
{
switch (aTypeIter)
{
case 0: theType = Graphic3d_ZLayerId_UNKNOWN; break;
case 1: theType = Graphic3d_ZLayerId_Default; break;
case 2: theType = Graphic3d_ZLayerId_Top; break;
case 3: theType = Graphic3d_ZLayerId_Topmost; break;
case 4: theType = Graphic3d_ZLayerId_TopOSD; break;
case 5: theType = Graphic3d_ZLayerId_BotOSD; break;
}
return Standard_True;
}
}
if (aName.IsIntegerValue())
{
theType = aName.IntegerValue();
return Standard_True;
}
return Standard_False;
}
//=======================================================================
//function : HorizontalTextAlignmentToString
//purpose :
//=======================================================================
Standard_CString Graphic3d::HorizontalTextAlignmentToString (Graphic3d_HorizontalTextAlignment theType)
{
return Graphic3d_Table_PrintHorizontalTextAlignment[theType];
}
//=======================================================================
//function : HorizontalTextAlignmentFromString
//purpose :
//=======================================================================
Standard_Boolean Graphic3d::HorizontalTextAlignmentFromString (Standard_CString theTypeString,
Graphic3d_HorizontalTextAlignment& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = Graphic3d_HTA_LEFT; aTypeIter <= Graphic3d_HTA_RIGHT; ++aTypeIter)
{
Standard_CString aTypeName = Graphic3d_Table_PrintHorizontalTextAlignment[aTypeIter];
if (aName == aTypeName)
{
theType = Graphic3d_HorizontalTextAlignment (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : VerticalTextAlignmentToString
//purpose :
//=======================================================================
Standard_CString Graphic3d::VerticalTextAlignmentToString (Graphic3d_VerticalTextAlignment theType)
{
return Graphic3d_Table_PrintVerticalTextAlignment[theType];
}
//=======================================================================
//function : VerticalTextAlignmentFromString
//purpose :
//=======================================================================
Standard_Boolean Graphic3d::VerticalTextAlignmentFromString (Standard_CString theTypeString,
Graphic3d_VerticalTextAlignment& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = Graphic3d_VTA_BOTTOM; aTypeIter <= Graphic3d_VTA_TOPFIRSTLINE; ++aTypeIter)
{
Standard_CString aTypeName = Graphic3d_Table_PrintVerticalTextAlignment[aTypeIter];
if (aName == aTypeName)
{
theType = Graphic3d_VerticalTextAlignment (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TextPathToString
//purpose :
//=======================================================================
Standard_CString Graphic3d::TextPathToString (Graphic3d_TextPath theType)
{
return Graphic3d_Table_PrintTextPath[theType];
}
//=======================================================================
//function : TextPathFromString
//purpose :
//=======================================================================
Standard_Boolean Graphic3d::TextPathFromString (Standard_CString theTypeString,
Graphic3d_TextPath& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = Graphic3d_TP_UP; aTypeIter <= Graphic3d_TP_RIGHT; ++aTypeIter)
{
Standard_CString aTypeName = Graphic3d_Table_PrintTextPath[aTypeIter];
if (aName == aTypeName)
{
theType = Graphic3d_TextPath (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : AlphaModeToString
//purpose :
//=======================================================================
Standard_CString Graphic3d::AlphaModeToString (Graphic3d_AlphaMode theType)
{
return Graphic3d_Table_PrintAlphaMode[theType + 1];
}
//=======================================================================
//function : AlphaModeFromString
//purpose :
//=======================================================================
Standard_Boolean Graphic3d::AlphaModeFromString (Standard_CString theTypeString,
Graphic3d_AlphaMode& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = Graphic3d_AlphaMode_BlendAuto; aTypeIter <= Graphic3d_AlphaMode_Blend; ++aTypeIter)
{
Standard_CString aTypeName = Graphic3d_Table_PrintAlphaMode[aTypeIter + 1];
if (aName == aTypeName)
{
theType = Graphic3d_AlphaMode (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TypeOfShadingModelToString
//purpose :
//=======================================================================
Standard_CString Graphic3d::TypeOfShadingModelToString (Graphic3d_TypeOfShadingModel theType)
{
return Graphic3d_Table_PrintTypeOfShadingModel[theType + 1];
}
//=======================================================================
//function : TypeOfShadingModelFromString
//purpose :
//=======================================================================
Standard_Boolean Graphic3d::TypeOfShadingModelFromString (Standard_CString theTypeString,
Graphic3d_TypeOfShadingModel& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = Graphic3d_TOSM_DEFAULT; aTypeIter <= Graphic3d_TOSM_FRAGMENT; ++aTypeIter)
{
Standard_CString aTypeName = Graphic3d_Table_PrintTypeOfShadingModel[aTypeIter + 1];
if (aName == aTypeName)
{
theType = Graphic3d_TypeOfShadingModel (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TypeOfAttributeToString
//purpose :
//=======================================================================
Standard_CString Graphic3d::TypeOfAttributeToString (Graphic3d_TypeOfAttribute theType)
{
return Graphic3d_Table_PrintTypeOfAttribute[theType];
}
//=======================================================================
//function : TypeOfAttributeFromString
//purpose :
//=======================================================================
Standard_Boolean Graphic3d::TypeOfAttributeFromString (Standard_CString theTypeString,
Graphic3d_TypeOfAttribute& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = Graphic3d_TOA_POS; aTypeIter <= Graphic3d_TOA_CUSTOM; ++aTypeIter)
{
Standard_CString aTypeName = Graphic3d_Table_PrintTypeOfAttribute[aTypeIter];
if (aName == aTypeName)
{
theType = Graphic3d_TypeOfAttribute (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TypeOfDataToString
//purpose :
//=======================================================================
Standard_CString Graphic3d::TypeOfDataToString (Graphic3d_TypeOfData theType)
{
return Graphic3d_Table_PrintTypeOfData[theType];
}
//=======================================================================
//function : TypeOfDataFromString
//purpose :
//=======================================================================
Standard_Boolean Graphic3d::TypeOfDataFromString (Standard_CString theTypeString,
Graphic3d_TypeOfData& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = Graphic3d_TOD_USHORT; aTypeIter <= Graphic3d_TOD_FLOAT; ++aTypeIter)
{
Standard_CString aTypeName = Graphic3d_Table_PrintTypeOfData[aTypeIter];
if (aName == aTypeName)
{
theType = Graphic3d_TypeOfData (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TransModeFlagsToString
//purpose :
//=======================================================================
Standard_CString Graphic3d::TransModeFlagsToString (Graphic3d_TransModeFlags theType)
{
switch (theType)
{
case Graphic3d_TMF_None: return Graphic3d_Table_PrintTransModeFlags[0]; break;
case Graphic3d_TMF_ZoomPers: return Graphic3d_Table_PrintTransModeFlags[1]; break;
case Graphic3d_TMF_RotatePers: return Graphic3d_Table_PrintTransModeFlags[2]; break;
case Graphic3d_TMF_TriedronPers: return Graphic3d_Table_PrintTransModeFlags[3]; break;
case Graphic3d_TMF_2d: return Graphic3d_Table_PrintTransModeFlags[4]; break;
case Graphic3d_TMF_ZoomRotatePers: return Graphic3d_Table_PrintTransModeFlags[5]; break;
}
return "";
}
//=======================================================================
//function : ZLayerIdFromString
//purpose :
//=======================================================================
Standard_Boolean Graphic3d::TransModeFlagsFromString (Standard_CString theTypeString,
Graphic3d_TransModeFlags& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= 5; ++aTypeIter)
{
Standard_CString aTypeName = Graphic3d_Table_PrintTransModeFlags[aTypeIter];
if (aName == aTypeName)
{
switch (aTypeIter)
{
case 0: theType = Graphic3d_TMF_None; break;
case 1: theType = Graphic3d_TMF_ZoomPers; break;
case 2: theType = Graphic3d_TMF_RotatePers; break;
case 3: theType = Graphic3d_TMF_TriedronPers; break;
case 4: theType = Graphic3d_TMF_2d; break;
case 5: theType = Graphic3d_TMF_ZoomRotatePers; break;
}
return Standard_True;
}
}
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;
}

327
src/Graphic3d/Graphic3d.hxx Normal file
View File

@@ -0,0 +1,327 @@
// 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 _Graphic3d_HeaderFile
#define _Graphic3d_HeaderFile
#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>
#include <Standard_Macro.hxx>
#include <Standard_Type.hxx>
//! Provides methods to cast enumerations of package to string value
class Graphic3d
{
public:
DEFINE_STANDARD_ALLOC
//! 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 ZLayerIdToString (Graphic3d_ZLayerId theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Graphic3d_ZLayerId_UNKNOWN if string identifier is invalid
static Graphic3d_ZLayerId ZLayerIdFromString (Standard_CString theTypeString)
{
Graphic3d_ZLayerId aType = Graphic3d_ZLayerId_UNKNOWN;
ZLayerIdFromString (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 ZLayerIdFromString (const Standard_CString theTypeString,
Graphic3d_ZLayerId& 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 HorizontalTextAlignmentToString (Graphic3d_HorizontalTextAlignment theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Graphic3d_HTA_LEFT if string identifier is invalid
static Graphic3d_HorizontalTextAlignment HorizontalTextAlignmentFromString (Standard_CString theTypeString)
{
Graphic3d_HorizontalTextAlignment aType = Graphic3d_HTA_LEFT;
HorizontalTextAlignmentFromString (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 HorizontalTextAlignmentFromString (const Standard_CString theTypeString,
Graphic3d_HorizontalTextAlignment& 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 VerticalTextAlignmentToString (Graphic3d_VerticalTextAlignment theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Graphic3d_VTA_BOTTOM if string identifier is invalid
static Graphic3d_VerticalTextAlignment VerticalTextAlignmentFromString (Standard_CString theTypeString)
{
Graphic3d_VerticalTextAlignment aType = Graphic3d_VTA_BOTTOM;
VerticalTextAlignmentFromString (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 VerticalTextAlignmentFromString (const Standard_CString theTypeString,
Graphic3d_VerticalTextAlignment& 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 TextPathToString (Graphic3d_TextPath theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Graphic3d_TP_UP if string identifier is invalid
static Graphic3d_TextPath TextPathFromString (Standard_CString theTypeString)
{
Graphic3d_TextPath aType = Graphic3d_TP_UP;
TextPathFromString (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 TextPathFromString (const Standard_CString theTypeString,
Graphic3d_TextPath& 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 AlphaModeToString (Graphic3d_AlphaMode theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Graphic3d_AlphaMode_Opaque if string identifier is invalid
static Graphic3d_AlphaMode AlphaModeFromString (Standard_CString theTypeString)
{
Graphic3d_AlphaMode aType = Graphic3d_AlphaMode_Opaque;
AlphaModeFromString (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 AlphaModeFromString (const Standard_CString theTypeString,
Graphic3d_AlphaMode& 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 TypeOfShadingModelToString (Graphic3d_TypeOfShadingModel theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Graphic3d_TOSM_DEFAULT if string identifier is invalid
static Graphic3d_TypeOfShadingModel TypeOfShadingModelFromString (Standard_CString theTypeString)
{
Graphic3d_TypeOfShadingModel aType = Graphic3d_TOSM_DEFAULT;
TypeOfShadingModelFromString (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 TypeOfShadingModelFromString (const Standard_CString theTypeString,
Graphic3d_TypeOfShadingModel& 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 TypeOfAttributeToString (Graphic3d_TypeOfAttribute theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Graphic3d_TOA_POS if string identifier is invalid
static Graphic3d_TypeOfAttribute TypeOfAttributeFromString (Standard_CString theTypeString)
{
Graphic3d_TypeOfAttribute aType = Graphic3d_TOA_POS;
TypeOfAttributeFromString (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 TypeOfAttributeFromString (const Standard_CString theTypeString,
Graphic3d_TypeOfAttribute& 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 TypeOfDataToString (Graphic3d_TypeOfData theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Graphic3d_TOSM_DEFAULT if string identifier is invalid
static Graphic3d_TypeOfData TypeOfDataFromString (Standard_CString theTypeString)
{
Graphic3d_TypeOfData aType = Graphic3d_TOD_USHORT;
TypeOfDataFromString (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 TypeOfDataFromString (const Standard_CString theTypeString,
Graphic3d_TypeOfData& 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 TransModeFlagsToString (Graphic3d_TransModeFlags theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Graphic3d_TOSM_DEFAULT if string identifier is invalid
static Graphic3d_TransModeFlags TransModeFlagsFromString (Standard_CString theTypeString)
{
Graphic3d_TransModeFlags aType = Graphic3d_TMF_None;
TransModeFlagsFromString (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 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

View File

@@ -4,17 +4,16 @@ Message_Alert.cxx
Message_Alert.hxx
Message_AlertExtended.cxx
Message_AlertExtended.hxx
Message_Alerts.hxx
Message_Algorithm.cxx
Message_Algorithm.hxx
Message_Algorithm.lxx
Message_Attribute.hxx
Message_Attribute.cxx
Message_AttributeObject.hxx
Message_Attribute.hxx
Message_AttributeObject.cxx
Message_AttributeVectorOfReal.hxx
Message_AttributeVectorOfReal.cxx
Message_AttributeVectorOfRealVec3.hxx
Message_AttributeVectorOfRealVec3.cxx
Message_AttributeObject.hxx
Message_AttributeVectorOfValues.cxx
Message_AttributeVectorOfValues.hxx
Message_CompositeAlerts.cxx
Message_CompositeAlerts.hxx
Message_ExecStatus.hxx

View File

@@ -89,3 +89,264 @@ Standard_Boolean Message::GravityFromString (const Standard_CString theGravitySt
}
return Standard_False;
}
// =======================================================================
// function : GetPointerInfo
// purpose :
// =======================================================================
TCollection_AsciiString Message::TransientToString (const Handle(Standard_Transient)& thePointer, const bool isShortInfo)
{
if (thePointer.IsNull())
return TCollection_AsciiString();
return PointerToString(thePointer.operator->(), isShortInfo);
}
// =======================================================================
// function : GetPointerInfo
// purpose :
// =======================================================================
TCollection_AsciiString Message::PointerToString (const void* thePointer, const bool isShortInfo)
{
std::ostringstream aPtrStr;
aPtrStr << thePointer;
if (!isShortInfo)
return aPtrStr.str().c_str();
TCollection_AsciiString anInfoPtr (aPtrStr.str().c_str());
for (int aSymbolId = 1; aSymbolId < anInfoPtr.Length(); aSymbolId++)
{
if (anInfoPtr.Value(aSymbolId) != '0')
{
anInfoPtr = anInfoPtr.SubString(aSymbolId, anInfoPtr.Length());
anInfoPtr.Prepend("0x");
return anInfoPtr;
}
}
return aPtrStr.str().c_str();
}
// =======================================================================
// function : StrVectorToString
// purpose :
// =======================================================================
TCollection_AsciiString Message::StrVectorToString
(const NCollection_Vector<TCollection_AsciiString>& theValues)
{
TCollection_AsciiString aValue;
for (NCollection_Vector<TCollection_AsciiString>::Iterator aValuesIt (theValues); aValuesIt.More(); aValuesIt.Next())
{
aValue += aValuesIt.Value();
if (aValuesIt.More())
aValue += VectorSeparator();
}
return aValue;
}
// =======================================================================
// function : StrVectorFromString
// purpose :
// =======================================================================
Standard_Boolean Message::StrVectorFromString
(const TCollection_AsciiString& theValue,
NCollection_Vector<TCollection_AsciiString>& theValues)
{
TCollection_AsciiString aCurrentString = theValue, aValueString;
while (!aCurrentString.IsEmpty())
{
Standard_Integer aPosition = aCurrentString.Search (", ");
aValueString = aCurrentString;
if (aPosition > 0)
aCurrentString = aValueString.Split (aPosition - 1);
theValues.Append (aValueString.RealValue());
if (aPosition > 0)
aCurrentString = aCurrentString.Split (2);
}
return Standard_True;
}
// =======================================================================
// function : RealVectorToString
// purpose :
// =======================================================================
TCollection_AsciiString Message::RealVectorToString
(const NCollection_Vector<Standard_Real>& theValues)
{
TCollection_AsciiString aValue = ("(");
for (NCollection_Vector<Standard_Real>::Iterator aValuesIt (theValues); aValuesIt.More(); aValuesIt.Next())
{
aValue += aValuesIt.Value();
if (aValuesIt.More())
aValue += VectorSeparator();
}
aValue += ")";
return aValue;
}
// =======================================================================
// function : RealVectorFromString
// purpose :
// =======================================================================
Standard_Boolean Message::RealVectorFromString
(const TCollection_AsciiString& theValue,
NCollection_Vector<Standard_Real>& theValues)
{
TCollection_AsciiString aCurrentString = theValue, aValueString;
Standard_Integer aPosition = aCurrentString.Search ("(");
if (aPosition != 1)
return Standard_False;
aCurrentString = aCurrentString.Split (aPosition);
aPosition = aCurrentString.Search (")");
if (aPosition != 1)
return Standard_False;
aValueString = aCurrentString.Split (aPosition);
while (!aCurrentString.IsEmpty())
{
// x value
aPosition = aCurrentString.Search (", ");
aValueString = aCurrentString;
if (aPosition > 0)
aCurrentString = aValueString.Split (aPosition - 1);
theValues.Append (aValueString.RealValue());
if (aPosition > 0)
aCurrentString = aCurrentString.Split (2);
}
return Standard_True;
}
// =======================================================================
// function : CoordVectorToString
// purpose :
// =======================================================================
TCollection_AsciiString Message::CoordVectorToString
(const NCollection_Vector<Standard_Real>& theValues)
{
TCollection_AsciiString aValue = ("(");
aValue += RealVectorToString (theValues);
aValue += ")";
return aValue;
}
// =======================================================================
// function : CoordVectorFromString
// purpose :
// =======================================================================
Standard_Boolean Message::CoordVectorFromString
(const TCollection_AsciiString& theValue,
NCollection_Vector<Standard_Real>& theValues)
{
TCollection_AsciiString aCurrentString = theValue, aValueString;
Standard_Integer aPosition = aCurrentString.Search ("(");
if (aPosition != 1)
return Standard_False;
aCurrentString = aCurrentString.Split (aPosition);
aPosition = aCurrentString.Search (")");
if (aPosition != 1)
return Standard_False;
aValueString = aCurrentString.Split (aPosition);
return RealVectorFromString (aCurrentString, theValues);
}
// =======================================================================
// function : ColorVectorToString
// purpose :
// =======================================================================
TCollection_AsciiString Message::ColorVectorToString
(const NCollection_Vector<Standard_Real>& theValues)
{
TCollection_AsciiString aValue = ("[");
aValue += RealVectorToString (theValues);
aValue += "]";
return aValue;
}
// =======================================================================
// function : ColorVectorFromString
// purpose :
// =======================================================================
Standard_Boolean Message::ColorVectorFromString
(const TCollection_AsciiString& theValue,
NCollection_Vector<Standard_Real>& theValues)
{
TCollection_AsciiString aCurrentString = theValue, aValueString;
Standard_Integer aPosition = aCurrentString.Search ("[");
if (aPosition != 1)
return Standard_False;
aCurrentString = aCurrentString.Split (aPosition);
aPosition = aCurrentString.Search ("]");
if (aPosition != 1)
return Standard_False;
aValueString = aCurrentString.Split (aPosition);
return RealVectorFromString (aCurrentString, theValues);
}
// =======================================================================
// function : ConvertStream
// purpose :
// =======================================================================
void Message::ConvertStream (const Standard_SStream& theStream,
Standard_Integer& theColumnCount,
NCollection_Vector<TCollection_AsciiString>& theValues)
{
TCollection_AsciiString aStream (theStream.str().c_str());
Standard_Character aSeparator = Message::DumpSeparator();
Standard_Integer aColumnCount = 0;
TCollection_AsciiString aCurrentString = aStream;
Standard_Integer aPosition = aCurrentString.Search (aSeparator);
if (aPosition >= 1)
{
TCollection_AsciiString aTailString = aCurrentString.Split (aPosition);
Standard_Boolean aClassNameFound = Standard_False;
while (!aCurrentString.IsEmpty())
{
TCollection_AsciiString aValueString = aCurrentString;
aPosition = aValueString.Search (aSeparator);
if (aPosition < 0 )
break;
aCurrentString = aValueString.Split (aPosition - 1);
if (!aColumnCount)
{
if (!aClassNameFound)
aClassNameFound = Standard_True;
else
{
if (!aValueString.IsIntegerValue())
break; // not correct Dump, in correct the first value is number of property columns
aColumnCount = aValueString.IntegerValue();
}
}
else
theValues.Append (aValueString);
if (aTailString.IsEmpty())
break;
aCurrentString = aTailString;
aPosition = aCurrentString.Search (aSeparator);
if (aPosition < 0 )
{
aCurrentString = aTailString;
aTailString = TCollection_AsciiString();
}
else
aTailString = aCurrentString.Split (aPosition);
}
}
theColumnCount = aColumnCount;
}

View File

@@ -18,6 +18,7 @@
#define _Message_HeaderFile
#include <Message_Gravity.hxx>
#include <NCollection_Vector.hxx>
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
@@ -25,8 +26,9 @@
#include <Standard_Integer.hxx>
#include <Standard_Real.hxx>
#include <TCollection_AsciiString.hxx>
class Message_Messenger;
class TCollection_AsciiString;
class Message_Msg;
class Message_MsgFile;
class Message_Messenger;
@@ -83,7 +85,84 @@ public:
Standard_EXPORT static Standard_Boolean GravityFromString (const Standard_CString theGravityString,
Message_Gravity& theGravity);
//! Returns separator symbol of Dump information
static Standard_Character DumpSeparator() { return '\\'; }
//! Returns separator symbol of values vector union
static TCollection_AsciiString VectorSeparator() { return " ,"; }
//! Convert handle pointer to string value
//! \param thePointer a pointer
//! \param isShortInfo if true, all '0' symbols in the beginning of the pointer are skipped
//! \return the string value
Standard_EXPORT static TCollection_AsciiString TransientToString (const Handle(Standard_Transient)& thePointer,
const bool isShortInfo = true);
//! Convert pointer to string value
//! \param thePointer a pointer
//! \param isShortInfo if true, all '0' symbols in the beginning of the pointer are skipped
//! \return the string value
Standard_EXPORT static TCollection_AsciiString PointerToString (const void* thePointer,
const bool isShortInfo = true);
//! Convert vector of real values to string, separator is vector separator
//! \param thePointer a container of real values
//! \return the string value
Standard_EXPORT static TCollection_AsciiString StrVectorToString
(const NCollection_Vector<TCollection_AsciiString>& theValues);
//! Convert string to vector of real values, separator is vector separator
//! \param thePointer a container of real values
//! \return the string value
Standard_EXPORT static Standard_Boolean StrVectorFromString
(const TCollection_AsciiString& theValue,
NCollection_Vector<TCollection_AsciiString>& theValues);
//! Convert vector of real values to string, separator is vector separator
//! \param thePointer a container of real values
//! \return the string value
Standard_EXPORT static TCollection_AsciiString RealVectorToString
(const NCollection_Vector<Standard_Real>& theValues);
//! Convert string to vector of real values, separator is vector separator
//! \param thePointer a container of real values
//! \return the string value
Standard_EXPORT static Standard_Boolean RealVectorFromString
(const TCollection_AsciiString& theValue,
NCollection_Vector<Standard_Real>& theValues);
//! Convert vector of real values to string, separator is vector separator
//! \param thePointer a container of real values
//! \return the string value
Standard_EXPORT static TCollection_AsciiString CoordVectorToString
(const NCollection_Vector<Standard_Real>& theValues);
//! Convert string to vector of real values, separator is vector separator
//! \param thePointer a container of real values
//! \return the string value
Standard_EXPORT static Standard_Boolean CoordVectorFromString
(const TCollection_AsciiString& theValue,
NCollection_Vector<Standard_Real>& theValues);
//! Convert vector of real values to string, separator is vector separator
//! \param thePointer a container of real values
//! \return the string value
Standard_EXPORT static TCollection_AsciiString ColorVectorToString
(const NCollection_Vector<Standard_Real>& theValues);
//! Convert string to vector of real values, separator is vector separator
//! \param thePointer a container of real values
//! \return the string value
Standard_EXPORT static Standard_Boolean ColorVectorFromString
(const TCollection_AsciiString& theValue,
NCollection_Vector<Standard_Real>& theValues);
//! Converts stream to vector of values and column count
//! \param theStream stream value
//! \param theColumnCount [out] number of columns
//! \param theValues [out] container of split values
static Standard_EXPORT void ConvertStream (const Standard_SStream& theStream,
Standard_Integer& theColumnCount,
NCollection_Vector<TCollection_AsciiString>& theValues);
protected:

View File

@@ -0,0 +1,102 @@
// Created on: 2018-06-10
// 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 _Message_Alerts_HeaderFile
#define _Message_Alerts_HeaderFile
#include <Message.hxx>
#include <Message_AlertExtended.hxx>
#include <Message_AttributeObject.hxx>
#include <Message_AttributeVectorOfValues.hxx>
#include <Message_Gravity.hxx>
#include <Message_Report.hxx>
#include <NCollection_Vector.hxx>
#include <TCollection_AsciiString.hxx>
static Handle(Message_Alert) OCCT_Message_Alert;
#define MESSAGE_INFO(Name, Description, PerfMeter, ParentAlert) \
{ \
if (!Message_Report::CurrentReport().IsNull() && \
Message_Report::CurrentReport()->IsActive (Message_Info)) \
{ \
OCCT_Message_Alert = Message_AlertExtended::AddAlert (Message_Report::CurrentReport(), \
new Message_Attribute (Name, Description), PerfMeter, ParentAlert); \
} \
}
#define MESSAGE_INFO_OBJECT(Object, Name, Description, PerfMeter, ParentAlert) \
{ \
if (!Message_Report::CurrentReport().IsNull() && \
Message_Report::CurrentReport()->IsActive (Message_Info)) \
{ \
OCCT_Message_Alert = Message_AlertExtended::AddAlert (Message_Report::CurrentReport(), \
new Message_AttributeObject (Object, Name, Description), PerfMeter, ParentAlert ); \
} \
}
#define MESSAGE_INFO_VALUES(StreamValues, Name, Description, PerfMeter, ParentAlert) \
{ \
if (!Message_Report::CurrentReport().IsNull() && \
Message_Report::CurrentReport()->IsActive (Message_Info)) \
{ \
OCCT_Message_Alert = Message_AlertExtended::AddAlert (Message_Report::CurrentReport(), \
new Message_AttributeVectorOfValues (StreamValues, Name, Description), PerfMeter, ParentAlert ); \
} \
}
#define DUMP_VALUE(OS, Value) \
{ \
OS << Value << Message::DumpSeparator(); \
}
#define DUMP_VALUES_COLUMNS(OS, ObjectName, ColumnCount) \
{ \
OS << ObjectName << Message::DumpSeparator() << ColumnCount << Message::DumpSeparator(); \
}
#define DUMP_VALUES(OS, Value1, Value2) \
{ \
OS << Value1 << Message::DumpSeparator() << Value2 << Message::DumpSeparator(); \
}
#define DUMP_VEC_COLOR(Values, Value) \
{ \
Value = Message::ColorVectorToString (aValues); \
}
#define DUMP_VEC_COLOR_SPLIT(Value, Values) \
{ \
Message::ColorVectorFromString (Value, Values); \
}
#define DUMP_VEC_COORD(Values, Value) \
{ \
Value = Message::CoordVectorToString (aValues); \
}
#define DUMP_VEC_COORD_SPLIT(Value, Values) \
{ \
Message::CoordVectorFromString (Value, Values); \
}
#define DUMP_VALUES_SPLIT(OS, ColumnCount, Values) \
{ \
Message::ConvertStream (OS, aColumnCount, aValues); \
}
#endif // _Message_Alerts_HeaderFile

View File

@@ -1,68 +0,0 @@
// Created on: 2018-06-10
// 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 <Message_AttributeVectorOfReal.hxx>
#include <Message_Msg.hxx>
#include <Message_PerfMeter.hxx>
#include <Message_Report.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeVectorOfReal, Message_Attribute)
//=======================================================================
//function : Message_AttributeVectorOfReal
//purpose :
//=======================================================================
Message_AttributeVectorOfReal::Message_AttributeVectorOfReal (const NCollection_Vector<Standard_Real>& theValues,
const TCollection_AsciiString& theName,
const TCollection_AsciiString& theDescription)
: Message_Attribute(theName, theDescription)
{
SetValues (theValues);
}
//=======================================================================
//function : SetValues
//purpose :
//=======================================================================
void Message_AttributeVectorOfReal::SetValues (const NCollection_Vector<Standard_Real>& theValues)
{
myValues = theValues;
myCachedValue = TCollection_AsciiString ("[") + (Standard_Integer)myValues.Length() + "] : ";
if (myValues.Length() < 2)
return;
myCachedValue += myValues.First();
myCachedValue += " ... ";
myCachedValue += myValues.Last();
}
//=======================================================================
//function : GetDescription
//purpose :
//=======================================================================
const TCollection_AsciiString& Message_AttributeVectorOfReal::GetDescription() const
{
if (!Message_Attribute::GetDescription().IsEmpty())
return Message_Attribute::GetDescription();
return myCachedValue;
}

View File

@@ -1,58 +0,0 @@
// Created on: 2018-06-10
// 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 _Message_AttributeVectorOfReal_HeaderFile
#define _Message_AttributeVectorOfReal_HeaderFile
#include <Message_Attribute.hxx>
#include <TCollection_AsciiString.hxx>
#include <NCollection_Vector.hxx>
class Message_PerfMeter;
class Message_Report;
//! Alert object storing container of Standard_Real values in its field
class Message_AttributeVectorOfReal : public Message_Attribute
{
public:
//! Constructor with string argument
Standard_EXPORT Message_AttributeVectorOfReal (const NCollection_Vector<Standard_Real>& theValues,
const TCollection_AsciiString& theName = TCollection_AsciiString(),
const TCollection_AsciiString& theDescription = TCollection_AsciiString());
//! Sets the values
//! @param theValues container of values
Standard_EXPORT void SetValues (const NCollection_Vector<Standard_Real>& theValues);
//! Returns values
//! @return values
const NCollection_Vector<Standard_Real>& GetValues() const { return myValues; }
//! Returns description of alert if it is set
//! @return alert description
virtual const TCollection_AsciiString& GetDescription() const;
// OCCT RTTI
DEFINE_STANDARD_RTTIEXT(Message_AttributeVectorOfReal, Message_Attribute)
private:
NCollection_Vector<Standard_Real> myValues; //!< container of values
TCollection_AsciiString myCachedValue; //!< short description of the values in form: [size] : first ... last
};
#endif // _Message_AttributeVectorOfReal_HeaderFile

View File

@@ -1,69 +0,0 @@
// Created on: 2018-06-10
// 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 <Message_AttributeVectorOfRealVec3.hxx>
#include <Message_Msg.hxx>
#include <Message_PerfMeter.hxx>
#include <Message_Report.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeVectorOfRealVec3, Message_Attribute)
//=======================================================================
//function : Message_AttributeVectorOfRealVec3
//purpose :
//=======================================================================
Message_AttributeVectorOfRealVec3::Message_AttributeVectorOfRealVec3 (const NCollection_Vector<NCollection_Vec3<Standard_Real>>& theValues,
const TCollection_AsciiString& theName,
const TCollection_AsciiString& theDescription)
: Message_Attribute (theName, theDescription)
{
SetValues (theValues);
}
//=======================================================================
//function : SetValues
//purpose :
//=======================================================================
void Message_AttributeVectorOfRealVec3::SetValues (const NCollection_Vector<NCollection_Vec3<Standard_Real>>& theValues)
{
myValues = theValues;
myCachedValue = TCollection_AsciiString ("[") + (Standard_Integer)myValues.Length() + "] : ";
if (myValues.Length() < 2)
return;
NCollection_Vec3<Standard_Real> aValue = myValues.First();
myCachedValue = myCachedValue + "(" + aValue.x() + "," + aValue.y() + "," + aValue.z() + ")";
myCachedValue += " ... ";
aValue = myValues.Last();
myCachedValue = myCachedValue + "(" + aValue.x() + "," + aValue.y() + "," + aValue.z() + ")";
}
//=======================================================================
//function : GetDescription
//purpose :
//=======================================================================
const TCollection_AsciiString& Message_AttributeVectorOfRealVec3::GetDescription() const
{
if (!Message_Attribute::GetDescription().IsEmpty())
return Message_Attribute::GetDescription();
return myCachedValue;
}

View File

@@ -1,56 +0,0 @@
// Created on: 2018-06-10
// 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 _Message_AttributeVectorOfRealVec3_HeaderFile
#define _Message_AttributeVectorOfRealVec3_HeaderFile
#include <Message_Attribute.hxx>
#include <TCollection_AsciiString.hxx>
#include <NCollection_Vector.hxx>
#include <NCollection_Vec3.hxx>
//! Alert object storing container of Standard_Real values in its field
class Message_AttributeVectorOfRealVec3 : public Message_Attribute
{
public:
//! Constructor with string argument
Standard_EXPORT Message_AttributeVectorOfRealVec3 (const NCollection_Vector<NCollection_Vec3<Standard_Real>>& theValues,
const TCollection_AsciiString& theName = TCollection_AsciiString(),
const TCollection_AsciiString& theDescription = TCollection_AsciiString());
//! Sets the values
//! @param theValues container of values
Standard_EXPORT void SetValues (const NCollection_Vector<NCollection_Vec3<Standard_Real>>& theValues);
//! Returns values
//! @return values
const NCollection_Vector<NCollection_Vec3<Standard_Real>>& GetValues() const { return myValues; }
//! Returns description of alert if it is set
//! @return alert description
virtual const TCollection_AsciiString& GetDescription() const;
// OCCT RTTI
DEFINE_STANDARD_RTTIEXT(Message_AttributeVectorOfRealVec3, Message_Attribute)
private:
NCollection_Vector<NCollection_Vec3<Standard_Real>> myValues; //!< container of values
TCollection_AsciiString myCachedValue;
TCollection_AsciiString myDescription; //!< short description of the values in form: [size] : first ... last
};
#endif // _Message_AttributeVectorOfRealVec3_HeaderFile

View File

@@ -0,0 +1,117 @@
// Created on: 2018-06-10
// 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 <Message_AttributeVectorOfValues.hxx>
#include <Message.hxx>
#include <Message_Msg.hxx>
#include <Message_PerfMeter.hxx>
#include <Message_Report.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeVectorOfValues, Message_Attribute)
//=======================================================================
//function : SetValues
//purpose :
//=======================================================================
Message_AttributeVectorOfValues::Message_AttributeVectorOfValues (const Standard_SStream& theStream,
const TCollection_AsciiString& theName,
const TCollection_AsciiString& theDescription)
: Message_Attribute(theName, theDescription)
{
TCollection_AsciiString aStream (theStream.str().c_str());
Standard_Character aSeparator = Message::DumpSeparator();
Standard_Integer aColumnCount = 0;
TCollection_AsciiString aCurrentString = aStream;
Standard_Integer aPosition = aCurrentString.Search (aSeparator);
if (aPosition >= 1)
{
TCollection_AsciiString aTailString = aCurrentString.Split (aPosition);
Standard_Boolean aClassNameFound = Standard_False;
while (!aCurrentString.IsEmpty())
{
TCollection_AsciiString aValueString = aCurrentString;
aPosition = aValueString.Search (aSeparator);
if (aPosition < 0 )
break;
aCurrentString = aValueString.Split (aPosition - 1);
if (!aColumnCount)
{
if (!aClassNameFound)
aClassNameFound = Standard_True;
else
{
if (!aValueString.IsIntegerValue())
break; // not correct Dump, in correct the first value is number of property columns
aColumnCount = aValueString.IntegerValue();
}
}
else
myValues.Append (aValueString);
if (aTailString.IsEmpty())
break;
aCurrentString = aTailString;
aPosition = aCurrentString.Search (aSeparator);
if (aPosition < 0 )
{
aCurrentString = aTailString;
aTailString = TCollection_AsciiString();
}
else
aTailString = aCurrentString.Split (aPosition);
}
}
myColumnCount = aColumnCount;
}
//=======================================================================
//function : SetValues
//purpose :
//=======================================================================
void Message_AttributeVectorOfValues::SetValues (const NCollection_Vector<TCollection_AsciiString>& theValues)
{
myValues = theValues;
int aLength = (Standard_Integer)myValues.Length();
if (aLength < 2)
return;
if (myColumnCount <= 0)
myCachedValue = TCollection_AsciiString ("[") + aLength + "] : ";
else
myCachedValue = TCollection_AsciiString ("[") + (aLength / myColumnCount) + ", " + myColumnCount + "] : ";
myCachedValue += myValues.First();
myCachedValue += " ... ";
myCachedValue += myValues.Last();
}
//=======================================================================
//function : GetDescription
//purpose :
//=======================================================================
const TCollection_AsciiString& Message_AttributeVectorOfValues::GetDescription() const
{
if (!Message_Attribute::GetDescription().IsEmpty())
return Message_Attribute::GetDescription();
return myCachedValue;
}

View File

@@ -0,0 +1,68 @@
// Created on: 2018-06-10
// 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 _Message_AttributeVectorOfValues_HeaderFile
#define _Message_AttributeVectorOfValues_HeaderFile
#include <Message_Attribute.hxx>
#include <TCollection_AsciiString.hxx>
#include <NCollection_Vector.hxx>
class Message_PerfMeter;
class Message_Report;
//! Alert object storing container of Standard_Real values in its field
class Message_AttributeVectorOfValues : public Message_Attribute
{
public:
//! Constructor with string argument
Standard_EXPORT Message_AttributeVectorOfValues (const Standard_SStream& theStream,
const TCollection_AsciiString& theName = TCollection_AsciiString(),
const TCollection_AsciiString& theDescription = TCollection_AsciiString());
//! Sets the values
//! @param theValues container of values
Standard_EXPORT void SetValues (const NCollection_Vector<TCollection_AsciiString>& theValues);
//! Returns values
//! @return values
const NCollection_Vector<TCollection_AsciiString>& GetValues() const { return myValues; }
//! Returns description of alert if it is set
//! @return alert description
virtual const TCollection_AsciiString& GetDescription() const;
//! Sets value to present values in a table view
//! \param theValue value of division the values on sub-containers
void SetColumnCount (const Standard_Integer& theValue) { myColumnCount = theValue; }
//! Gets value to present values in a table view
//! \param theSubSize value of division the values on sub-containers
Standard_Integer GetColumnCount() const { return myColumnCount; }
// OCCT RTTI
DEFINE_STANDARD_RTTIEXT(Message_AttributeVectorOfValues, Message_Attribute)
private:
NCollection_Vector<TCollection_AsciiString> myValues; //!< container of values
Standard_Integer myColumnCount; //!< value to present container of values into table
TCollection_AsciiString myCachedValue; //!< short description of the values in form: [size] : first ... last
};
#endif // _Message_AttributeVectorOfValues_HeaderFile

View File

@@ -26,6 +26,8 @@
IMPLEMENT_STANDARD_RTTIEXT(Message_Report,Standard_Transient)
static Handle(Message_Report) MyReport;
//=======================================================================
//function : Message_Report
//purpose :
@@ -37,6 +39,18 @@ Message_Report::Message_Report ()
SetActive (Standard_True);
}
//=======================================================================
//function : CurrentReport
//purpose :
//=======================================================================
Handle(Message_Report) Message_Report::CurrentReport(const Standard_Boolean theToCreate)
{
if (MyReport.IsNull() && theToCreate)
MyReport = new Message_Report();
return MyReport;
}
//=======================================================================
//function : AddAlert
//purpose :
@@ -118,7 +132,7 @@ void Message_Report::AddAlert (const Message_Gravity theGravity, const Handle(Me
// if not merged, just add to the list
aList.Append (theAlert);
// remove alerts under the report only
if (theParentAlert.IsNull() && aParentAlert.IsNull() && myLimit > 0 && aList.Extent() >= myLimit)
if (theParentAlert.IsNull() && aParentAlert.IsNull() && myLimit > 0 && aList.Extent() > myLimit)
aList.RemoveFirst();
if (thePerfMeter)
@@ -193,8 +207,8 @@ Handle(Message_Alert) Message_Report::getLastAlert (const Message_Gravity theGra
anExtendedAlert = Handle(Message_AlertExtended)::DownCast (aLastAlert);
if (anExtendedAlert.IsNull())
return aLastAlert;
if (anExtendedAlert->GetPerfMeter())
aLastAlert = anExtendedAlert->GetPerfMeter()->GetAlert();
//if (anExtendedAlert->GetPerfMeter())
// aLastAlert = anExtendedAlert->GetPerfMeter()->GetAlert();
return aLastAlert;
}

View File

@@ -56,6 +56,11 @@ public:
//! Empty constructor
Standard_EXPORT Message_Report ();
//! returns the only one instance of Report
//! When theToCreate is true - automatically creates message report when not exist.
//! that has been created.
Standard_EXPORT static Handle(Message_Report) CurrentReport (const Standard_Boolean theToCreate = Standard_False);
//! Add alert with specified gravity.
//! This method is thread-safe, i.e. alerts can be added from parallel threads safely.
Standard_EXPORT void AddAlert (Message_Gravity theGravity, const Handle(Message_Alert)& theAlert);

View File

@@ -177,15 +177,6 @@ OpenGl_LayerList::OpenGl_LayerList (const Standard_Integer theNbPriorities)
myTransparentToProcess.Allocate (myLayers.Length());
}
//=======================================================================
//function : ~OpenGl_LayerList
//purpose : Destructor
//=======================================================================
OpenGl_LayerList::~OpenGl_LayerList()
{
}
//=======================================================================
//function : SetFrustumCullingBVHBuilder
//purpose :

View File

@@ -25,8 +25,10 @@
#include <NCollection_Sequence.hxx>
#include <NCollection_DataMap.hxx>
class OpenGl_FrameBuffer;
class OpenGl_Structure;
class OpenGl_Workspace;
struct OpenGl_GlobalLayerSettings;
typedef NCollection_Sequence<Handle(OpenGl_Layer)> OpenGl_SequenceOfLayers;
@@ -38,10 +40,10 @@ class OpenGl_LayerList
public:
//! Constructor
OpenGl_LayerList (const Standard_Integer theNbPriorities);
Standard_EXPORT OpenGl_LayerList (const Standard_Integer theNbPriorities);
//! Destructor
virtual ~OpenGl_LayerList();
virtual ~OpenGl_LayerList() {}
//! Method returns the number of available priorities
Standard_Integer NbPriorities() const { return myNbPriorities; }

View File

@@ -26,6 +26,57 @@
#include <TopoDS_Shape.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
namespace
{
static Standard_CString Prs3d_Table_PrintTypeOfHighlight[7] =
{
"NONE", "SELECTED", "DYNAMIC", "LOCAL_SELECTED", "LOCAL_DYNAMIC", "SUB_INTENSITY", "NB"
};
static Standard_CString Prs3d_Table_PrintTypeOfHLR[3] =
{
"NOT_SET", "POLY_ALGO", "ALGO"
};
static Standard_CString Prs3d_Table_PrintVertexDrawMode[3] =
{
"ISOLATED", "ALL", "INHERITED"
};
static Standard_CString Prs3d_Table_PrintDatumParts[11] =
{
"ORIGIN", "X_AXIS", "Y_AXIS", "Z_AXIS", "X_ARROW", "Y_ARROW", "Z_ARROW",
"XOY_AXIS", "YOZ_AXIS", "XOZ_AXIS", "NONE"
};
static Standard_CString Prs3d_Table_PrintDatumAttribute[8] =
{
"X_AXIS_LENGTH", "Y_AXIS_LENGTH", "Z_AXIS_LENGTH", "SHADING_TUBE_RADIUS_PERCENT",
"SHADING_CONE_RADIUS_PERCENT", "SHADING_CONE_LENGTH_PERCENT", "SHADING_ORIGIN_RADIUS_PERCENT",
"SHADING_NUMBER_OF_FACETTES"
};
static Standard_CString Prs3d_Table_PrintDatumAxes[7] =
{
"X_AXIS", "Y_AXIS", "Z_AXIS", "XY_AXIS", "YZ_AXIS", "XZ_AXIS", "XYZ_AXIS"
};
static Standard_CString Prs3d_Table_PrintDimensionArrowOrientation[3] =
{
"INTERNAL", "EXTERNAL", "FIT"
};
static Standard_CString Prs3d_Table_PrintDimensionTextHorizontalPosition[4] =
{
"LEFT", "RIGHT", "CENTER", "FIT"
};
static Standard_CString Prs3d_Table_PrintDimensionTextVerticalPosition[3] =
{
"ABOVE", "BELOW", "CENTER"
};
}
//=======================================================================
//function : MatchSegment
//purpose :
@@ -145,3 +196,273 @@ void Prs3d::AddPrimitivesGroup (const Handle(Prs3d_Presentation)& thePrs,
aGroup->AddPrimitiveArray (aPrims);
}
}
//=======================================================================
//function : TypeOfHighlightToString
//purpose :
//=======================================================================
Standard_CString Prs3d::TypeOfHighlightToString (Prs3d_TypeOfHighlight theType)
{
return Prs3d_Table_PrintTypeOfHighlight[theType];
}
//=======================================================================
//function : TypeOfHighlightFromString
//purpose :
//=======================================================================
Standard_Boolean Prs3d::TypeOfHighlightFromString (Standard_CString theTypeString,
Prs3d_TypeOfHighlight& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= Prs3d_TypeOfHighlight_NB; ++aTypeIter)
{
Standard_CString aTypeName = Prs3d_Table_PrintTypeOfHighlight[aTypeIter];
if (aName == aTypeName)
{
theType = Prs3d_TypeOfHighlight (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : TypeOfHLRToString
//purpose :
//=======================================================================
Standard_CString Prs3d::TypeOfHLRToString (Prs3d_TypeOfHLR theType)
{
return Prs3d_Table_PrintTypeOfHLR[theType];
}
//=======================================================================
//function : TypeOfHLRFromString
//purpose :
//=======================================================================
Standard_Boolean Prs3d::TypeOfHLRFromString (Standard_CString theTypeString,
Prs3d_TypeOfHLR& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= Prs3d_TOH_Algo; ++aTypeIter)
{
Standard_CString aTypeName = Prs3d_Table_PrintTypeOfHLR[aTypeIter];
if (aName == aTypeName)
{
theType = Prs3d_TypeOfHLR (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : VertexDrawModeToString
//purpose :
//=======================================================================
Standard_CString Prs3d::VertexDrawModeToString (Prs3d_VertexDrawMode theType)
{
return Prs3d_Table_PrintVertexDrawMode[theType];
}
//=======================================================================
//function : VertexDrawModeFromString
//purpose :
//=======================================================================
Standard_Boolean Prs3d::VertexDrawModeFromString (Standard_CString theTypeString,
Prs3d_VertexDrawMode& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= Prs3d_VDM_Inherited; ++aTypeIter)
{
Standard_CString aTypeName = Prs3d_Table_PrintVertexDrawMode[aTypeIter];
if (aName == aTypeName)
{
theType = Prs3d_VertexDrawMode (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : DatumPartsToString
//purpose :
//=======================================================================
Standard_CString Prs3d::DatumPartsToString (Prs3d_DatumParts theType)
{
return Prs3d_Table_PrintDatumParts[theType];
}
//=======================================================================
//function : DatumPartsFromString
//purpose :
//=======================================================================
Standard_Boolean Prs3d::DatumPartsFromString (Standard_CString theTypeString,
Prs3d_DatumParts& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= Prs3d_DP_None; ++aTypeIter)
{
Standard_CString aTypeName = Prs3d_Table_PrintDatumParts[aTypeIter];
if (aName == aTypeName)
{
theType = Prs3d_DatumParts (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : DatumAttributeToString
//purpose :
//=======================================================================
Standard_CString Prs3d::DatumAttributeToString (Prs3d_DatumAttribute theType)
{
return Prs3d_Table_PrintDatumAttribute[theType];
}
//=======================================================================
//function : DatumAttributeFromString
//purpose :
//=======================================================================
Standard_Boolean Prs3d::DatumAttributeFromString (Standard_CString theTypeString,
Prs3d_DatumAttribute& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= Prs3d_DP_ShadingNumberOfFacettes; ++aTypeIter)
{
Standard_CString aTypeName = Prs3d_Table_PrintDatumAttribute[aTypeIter];
if (aName == aTypeName)
{
theType = Prs3d_DatumAttribute (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : DatumAxesToString
//purpose :
//=======================================================================
Standard_CString Prs3d::DatumAxesToString (Prs3d_DatumAxes theType)
{
return Prs3d_Table_PrintDatumAxes[theType];
}
//=======================================================================
//function : DatumAxesFromString
//purpose :
//=======================================================================
Standard_Boolean Prs3d::DatumAxesFromString (Standard_CString theTypeString,
Prs3d_DatumAxes& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= Prs3d_DA_XYZAxis; ++aTypeIter)
{
Standard_CString aTypeName = Prs3d_Table_PrintDatumAxes[aTypeIter];
if (aName == aTypeName)
{
theType = Prs3d_DatumAxes (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : DimensionArrowOrientationToString
//purpose :
//=======================================================================
Standard_CString Prs3d::DimensionArrowOrientationToString (Prs3d_DimensionArrowOrientation theType)
{
return Prs3d_Table_PrintDimensionArrowOrientation[theType];
}
//=======================================================================
//function : DimensionArrowOrientationFromString
//purpose :
//=======================================================================
Standard_Boolean Prs3d::DimensionArrowOrientationFromString (Standard_CString theTypeString,
Prs3d_DimensionArrowOrientation& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= Prs3d_DAO_Fit; ++aTypeIter)
{
Standard_CString aTypeName = Prs3d_Table_PrintDimensionArrowOrientation[aTypeIter];
if (aName == aTypeName)
{
theType = Prs3d_DimensionArrowOrientation (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : DimensionTextHorizontalPositionToString
//purpose :
//=======================================================================
Standard_CString Prs3d::DimensionTextHorizontalPositionToString (Prs3d_DimensionTextHorizontalPosition theType)
{
return Prs3d_Table_PrintDimensionTextHorizontalPosition[theType];
}
//=======================================================================
//function : DimensionTextHorizontalPositionFromString
//purpose :
//=======================================================================
Standard_Boolean Prs3d::DimensionTextHorizontalPositionFromString (Standard_CString theTypeString,
Prs3d_DimensionTextHorizontalPosition& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= Prs3d_DTHP_Fit; ++aTypeIter)
{
Standard_CString aTypeName = Prs3d_Table_PrintDimensionTextHorizontalPosition[aTypeIter];
if (aName == aTypeName)
{
theType = Prs3d_DimensionTextHorizontalPosition (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : DimensionTextVerticalPositionToString
//purpose :
//=======================================================================
Standard_CString Prs3d::DimensionTextVerticalPositionToString (Prs3d_DimensionTextVerticalPosition theType)
{
return Prs3d_Table_PrintDimensionTextVerticalPosition[theType];
}
//=======================================================================
//function : DimensionTextVerticalPositionFromString
//purpose :
//=======================================================================
Standard_Boolean Prs3d::DimensionTextVerticalPositionFromString (Standard_CString theTypeString,
Prs3d_DimensionTextVerticalPosition& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= Prs3d_DTVP_Center; ++aTypeIter)
{
Standard_CString aTypeName = Prs3d_Table_PrintDimensionTextVerticalPosition[aTypeIter];
if (aName == aTypeName)
{
theType = Prs3d_DimensionTextVerticalPosition (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}

View File

@@ -18,12 +18,25 @@
#define _Prs3d_HeaderFile
#include <Graphic3d_ArrayOfPrimitives.hxx>
#include <Prs3d_DatumAttribute.hxx>
#include <Prs3d_DatumAxes.hxx>
#include <Prs3d_DatumParts.hxx>
#include <Prs3d_DimensionArrowOrientation.hxx>
#include <Prs3d_DimensionTextHorizontalPosition.hxx>
#include <Prs3d_DimensionTextVerticalPosition.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_NListOfSequenceOfPnt.hxx>
#include <Prs3d_TypeOfHighlight.hxx>
#include <Prs3d_TypeOfHLR.hxx>
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_NListOfSequenceOfPnt.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_VertexDrawMode.hxx>
class TopoDS_Shape;
@@ -74,6 +87,204 @@ public:
const Handle(Prs3d_LineAspect)& theAspect,
Prs3d_NListOfSequenceOfPnt& thePolylines);
//! Returns the string name for a given orientation type.
//! @param theType orientation type
//! @return string identifier from the list Xpos, Ypos, Zpos and others
Standard_EXPORT static Standard_CString TypeOfHighlightToString (Prs3d_TypeOfHighlight theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return orientation type or Prs3d_TypeOfHighlight_None if string identifier is invalid
static Prs3d_TypeOfHighlight TypeOfHighlightFromString (Standard_CString theTypeString)
{
Prs3d_TypeOfHighlight aType = Prs3d_TypeOfHighlight_None;
TypeOfHighlightFromString (theTypeString, aType);
return aType;
}
//! Determines the shape type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected shape type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean TypeOfHighlightFromString (const Standard_CString theTypeString,
Prs3d_TypeOfHighlight& theType);
//! Returns the string name for a given orientation type.
//! @param theType orientation type
//! @return string identifier from the list Xpos, Ypos, Zpos and others
Standard_EXPORT static Standard_CString TypeOfHLRToString (Prs3d_TypeOfHLR theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return orientation type or Prs3d_TOH_NotSet if string identifier is invalid
static Prs3d_TypeOfHLR TypeOfHLRFromString (Standard_CString theTypeString)
{
Prs3d_TypeOfHLR aType = Prs3d_TOH_NotSet;
TypeOfHLRFromString (theTypeString, aType);
return aType;
}
//! Determines the shape type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected shape type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean TypeOfHLRFromString (const Standard_CString theTypeString,
Prs3d_TypeOfHLR& theType);
//! Returns the string name for a given orientation type.
//! @param theType orientation type
//! @return string identifier from the list Xpos, Ypos, Zpos and others
Standard_EXPORT static Standard_CString VertexDrawModeToString (Prs3d_VertexDrawMode theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return orientation type or Prs3d_VDM_Isolated if string identifier is invalid
static Prs3d_VertexDrawMode VertexDrawModeFromString (Standard_CString theTypeString)
{
Prs3d_VertexDrawMode aType = Prs3d_VDM_Isolated;
VertexDrawModeFromString (theTypeString, aType);
return aType;
}
//! Determines the shape type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected shape type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean VertexDrawModeFromString (const Standard_CString theTypeString,
Prs3d_VertexDrawMode& theType);
//! Returns the string name for a given orientation type.
//! @param theType orientation type
//! @return string identifier from the list Xpos, Ypos, Zpos and others
Standard_EXPORT static Standard_CString DatumPartsToString (Prs3d_DatumParts theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return orientation type or Prs3d_DP_None if string identifier is invalid
static Prs3d_DatumParts DatumPartsFromString (Standard_CString theTypeString)
{
Prs3d_DatumParts aType = Prs3d_DP_None;
DatumPartsFromString (theTypeString, aType);
return aType;
}
//! Determines the shape type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected shape type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean DatumPartsFromString (const Standard_CString theTypeString,
Prs3d_DatumParts& theType);
//! Returns the string name for a given orientation type.
//! @param theType orientation type
//! @return string identifier from the list Xpos, Ypos, Zpos and others
Standard_EXPORT static Standard_CString DatumAttributeToString (Prs3d_DatumAttribute theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return orientation type or Prs3d_DA_XAxisLength if string identifier is invalid
static Prs3d_DatumAttribute DatumAttributeFromString (Standard_CString theTypeString)
{
Prs3d_DatumAttribute aType = Prs3d_DA_XAxisLength;
DatumAttributeFromString (theTypeString, aType);
return aType;
}
//! Determines the shape type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected shape type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean DatumAttributeFromString (const Standard_CString theTypeString,
Prs3d_DatumAttribute& theType);
//! Returns the string name for a given orientation type.
//! @param theType orientation type
//! @return string identifier from the list Xpos, Ypos, Zpos and others
Standard_EXPORT static Standard_CString DatumAxesToString (Prs3d_DatumAxes theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return orientation type or Prs3d_DA_XAxis if string identifier is invalid
static Prs3d_DatumAxes DatumAxesFromString (Standard_CString theTypeString)
{
Prs3d_DatumAxes aType = Prs3d_DA_XAxis;
DatumAxesFromString (theTypeString, aType);
return aType;
}
//! Determines the shape type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected shape type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean DatumAxesFromString (const Standard_CString theTypeString,
Prs3d_DatumAxes& theType);
//! Returns the string name for a given orientation type.
//! @param theType orientation type
//! @return string identifier from the list Xpos, Ypos, Zpos and others
Standard_EXPORT static Standard_CString DimensionArrowOrientationToString (Prs3d_DimensionArrowOrientation theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return orientation type or Prs3d_DAO_Internal if string identifier is invalid
static Prs3d_DimensionArrowOrientation DimensionArrowOrientationFromString (Standard_CString theTypeString)
{
Prs3d_DimensionArrowOrientation aType = Prs3d_DAO_Internal;
DimensionArrowOrientationFromString (theTypeString, aType);
return aType;
}
//! Determines the shape type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected shape type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean DimensionArrowOrientationFromString (const Standard_CString theTypeString,
Prs3d_DimensionArrowOrientation& theType);
//! Returns the string name for a given orientation type.
//! @param theType orientation type
//! @return string identifier from the list Xpos, Ypos, Zpos and others
Standard_EXPORT static Standard_CString DimensionTextHorizontalPositionToString (Prs3d_DimensionTextHorizontalPosition theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return orientation type or Prs3d_DTHP_Left if string identifier is invalid
static Prs3d_DimensionTextHorizontalPosition DimensionTextHorizontalPositionFromString (Standard_CString theTypeString)
{
Prs3d_DimensionTextHorizontalPosition aType = Prs3d_DTHP_Left;
DimensionTextHorizontalPositionFromString (theTypeString, aType);
return aType;
}
//! Determines the shape type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected shape type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean DimensionTextHorizontalPositionFromString (const Standard_CString theTypeString,
Prs3d_DimensionTextHorizontalPosition& theType);
//! Returns the string name for a given orientation type.
//! @param theType orientation type
//! @return string identifier from the list Xpos, Ypos, Zpos and others
Standard_EXPORT static Standard_CString DimensionTextVerticalPositionToString (Prs3d_DimensionTextVerticalPosition theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return orientation type or Prs3d_DTVP_Above if string identifier is invalid
static Prs3d_DimensionTextVerticalPosition DimensionTextVerticalPositionFromString (Standard_CString theTypeString)
{
Prs3d_DimensionTextVerticalPosition aType = Prs3d_DTVP_Above;
DimensionTextVerticalPositionFromString (theTypeString, aType);
return aType;
}
//! Determines the shape type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected shape type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean DimensionTextVerticalPositionFromString (const Standard_CString theTypeString,
Prs3d_DimensionTextVerticalPosition& theType);
};
#endif // _Prs3d_HeaderFile

View File

@@ -1,3 +1,5 @@
PrsMgr.cxx
PrsMgr.hxx
PrsMgr_ListOfPresentableObjects.hxx
PrsMgr_ListOfPresentations.hxx
PrsMgr_PresentableObject.cxx

54
src/PrsMgr/PrsMgr.cxx Normal file
View File

@@ -0,0 +1,54 @@
// 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 <PrsMgr.hxx>
#include <TCollection_AsciiString.hxx>
namespace
{
static Standard_CString PrsMgr_Table_PrintTypeOfPresentation3d[2] =
{
"ALL_VIEW", "PROJECTOR_DEPENDANT"
};
}
//=======================================================================
//function : TypeOfPresentation3dToString
//purpose :
//=======================================================================
Standard_CString PrsMgr::TypeOfPresentation3dToString (PrsMgr_TypeOfPresentation3d theType)
{
return PrsMgr_Table_PrintTypeOfPresentation3d[theType];
}
//=======================================================================
//function : TypeOfPresentation3dFromString
//purpose :
//=======================================================================
Standard_Boolean PrsMgr::TypeOfPresentation3dFromString (Standard_CString theTypeString,
PrsMgr_TypeOfPresentation3d& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= PrsMgr_TOP_ProjectorDependant; ++aTypeIter)
{
Standard_CString aTypeName = PrsMgr_Table_PrintTypeOfPresentation3d[aTypeIter];
if (aName == aTypeName)
{
theType = PrsMgr_TypeOfPresentation3d (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}

53
src/PrsMgr/PrsMgr.hxx Normal file
View File

@@ -0,0 +1,53 @@
// 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 _PrsMgr_HeaderFile
#define _PrsMgr_HeaderFile
#include <PrsMgr_TypeOfPresentation3d.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Macro.hxx>
#include <Standard_Type.hxx>
//! Provides methods to cast enumerations of package to string value
class PrsMgr
{
public:
DEFINE_STANDARD_ALLOC
//! 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 TypeOfPresentation3dToString (PrsMgr_TypeOfPresentation3d theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or PrsMgr_TOP_AllView if string identifier is invalid
static PrsMgr_TypeOfPresentation3d TypeOfPresentation3dFromString (Standard_CString theTypeString)
{
PrsMgr_TypeOfPresentation3d aType = PrsMgr_TOP_AllView;
TypeOfPresentation3dFromString (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 TypeOfPresentation3dFromString (const Standard_CString theTypeString,
PrsMgr_TypeOfPresentation3d& theType);
};
#endif // _PrsMgr_HeaderFile

View File

@@ -1,3 +1,5 @@
Quantity.cxx
Quantity.hxx
Quantity_AbsorbedDose.hxx
Quantity_Acceleration.hxx
Quantity_AcousticIntensity.hxx

191
src/Quantity/Quantity.cxx Normal file
View File

@@ -0,0 +1,191 @@
// 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 <Quantity.hxx>
#include <TCollection_AsciiString.hxx>
namespace
{
static Standard_CString Quantity_Table_PrintNameOfColor[517] =
{
"BLACK", "MATRABLUE", "MATRAGRAY", "ALICEBLUE",
"ANTIQUEWHITE", "ANTIQUEWHITE1", "ANTIQUEWHITE2", "ANTIQUEWHITE3", "ANTIQUEWHITE4",
"AQUAMARINE1", "AQUAMARINE2", "AQUAMARINE4",
"AZURE", "AZURE2", "AZURE3", "AZURE4",
"BEIGE",
"BISQUE", "BISQUE2", "BISQUE3", "BISQUE4",
"BLANCHEDALMOND",
"BLUE1", "BLUE2", "BLUE3", "BLUE4",
"BLUEVIOLET",
"BROWN", "BROWN1", "BROWN2", "BROWN3", "BROWN4",
"BURLYWOOD", "BURLYWOOD1", "BURLYWOOD2", "BURLYWOOD3", "BURLYWOOD4",
"CADETBLUE", "CADETBLUE1", "CADETBLUE2", "CADETBLUE3", "CADETBLUE4",
"CHARTREUSE", "CHARTREUSE1", "CHARTREUSE2", "CHARTREUSE3", "CHARTREUSE4",
"CHOCOLATE", "CHOCOLATE1", "CHOCOLATE2", "CHOCOLATE3", "CHOCOLATE4",
"CORAL", "CORAL1", "CORAL2", "CORAL3", "CORAL4",
"CORNFLOWERBLUE",
"CORNSILK1", "CORNSILK2", "CORNSILK3", "CORNSILK4",
"CYAN1", "CYAN2", "CYAN3", "CYAN4",
"DARKGOLDENROD", "DARKGOLDENROD1", "DARKGOLDENROD2", "DARKGOLDENROD3", "DARKGOLDENROD4",
"DARKGREEN",
"DARKKHAKI",
"DARKOLIVEGREEN", "DARKOLIVEGREEN1", "DARKOLIVEGREEN2", "DARKOLIVEGREEN3", "DARKOLIVEGREEN4",
"DARKORANGE", "DARKORANGE1", "DARKORANGE2", "DARKORANGE3", "DARKORANGE4",
"DARKORCHID", "DARKORCHID1", "DARKORCHID2", "DARKORCHID3", "DARKORCHID4",
"DARKSALMON",
"DARKSEAGREEN", "DARKSEAGREEN1", "DARKSEAGREEN2", "DARKSEAGREEN3", "DARKSEAGREEN4",
"DARKSLATEBLUE",
"DARKSLATEGRAY1", "DARKSLATEGRAY2", "DARKSLATEGRAY3", "DARKSLATEGRAY4", "DARKSLATEGRAY",
"DARKTURQUOISE",
"DARKVIOLET",
"DEEPPINK", "DEEPPINK2", "DEEPPINK3", "DEEPPINK4",
"DEEPSKYBLUE1", "DEEPSKYBLUE2", "DEEPSKYBLUE3", "DEEPSKYBLUE4",
"DODGERBLUE1", "DODGERBLUE2", "DODGERBLUE3", "DODGERBLUE4",
"FIREBRICK", "FIREBRICK1", "FIREBRICK2", "FIREBRICK3", "FIREBRICK4",
"FLORALWHITE",
"FORESTGREEN",
"GAINSBORO",
"GHOSTWHITE",
"GOLD", "GOLD1", "GOLD2", "GOLD3", "GOLD4",
"GOLDENROD", "GOLDENROD1", "GOLDENROD2", "GOLDENROD3", "GOLDENROD4",
"GRAY", "GRAY0", "GRAY1", "GRAY10", "GRAY11", "GRAY12", "GRAY13", "GRAY14", "GRAY15", "GRAY16",
"GRAY17", "GRAY18", "GRAY19", "GRAY2", "GRAY20", "GRAY21", "GRAY22", "GRAY23", "GRAY24", "GRAY25",
"GRAY26", "GRAY27", "GRAY28", "GRAY29", "GRAY3", "GRAY30", "GRAY31", "GRAY32", "GRAY33", "GRAY34",
"GRAY35", "GRAY36", "GRAY37", "GRAY38", "GRAY39", "GRAY4", "GRAY40", "GRAY41", "GRAY42", "GRAY43",
"GRAY44", "GRAY45", "GRAY46", "GRAY47", "GRAY48", "GRAY49", "GRAY5", "GRAY50", "GRAY51", "GRAY52",
"GRAY53", "GRAY54", "GRAY55", "GRAY56", "GRAY57", "GRAY58", "GRAY59", "GRAY6", "GRAY60", "GRAY61",
"GRAY62", "GRAY63", "GRAY64", "GRAY65", "GRAY66", "GRAY67", "GRAY68", "GRAY69", "GRAY7", "GRAY70",
"GRAY71", "GRAY72", "GRAY73", "GRAY74", "GRAY75", "GRAY76", "GRAY77", "GRAY78", "GRAY79", "GRAY8",
"GRAY80", "GRAY81", "GRAY82", "GRAY83", "GRAY85", "GRAY86", "GRAY87", "GRAY88", "GRAY89", "GRAY9",
"GRAY90", "GRAY91", "GRAY92", "GRAY93", "GRAY94", "GRAY95",
"GREEN", "GREEN1", "GREEN2", "GREEN3", "GREEN4",
"GREENYELLOW",
"GRAY97", "GRAY98", "GRAY99",
"HONEYDEW", "HONEYDEW2", "HONEYDEW3", "HONEYDEW4",
"HOTPINK", "HOTPINK1", "HOTPINK2", "HOTPINK3", "HOTPINK4",
"INDIANRED", "INDIANRED1", "INDIANRED2", "INDIANRED3", "INDIANRED4",
"IVORY", "IVORY2", "IVORY3", "IVORY4",
"KHAKI", "KHAKI1", "KHAKI2", "KHAKI3", "KHAKI4",
"LAVENDER", "LAVENDERBLUSH1", "LAVENDERBLUSH2", "LAVENDERBLUSH3", "LAVENDERBLUSH4",
"LAWNGREEN", "LEMONCHIFFON1", "LEMONCHIFFON2", "LEMONCHIFFON3", "LEMONCHIFFON4",
"LIGHTBLUE", "LIGHTBLUE1", "LIGHTBLUE2", "LIGHTBLUE3", "LIGHTBLUE4",
"LIGHTCORAL",
"LIGHTCYAN1", "LIGHTCYAN2", "LIGHTCYAN3", "LIGHTCYAN4",
"LIGHTGOLDENROD", "LIGHTGOLDENROD1", "LIGHTGOLDENROD2", "LIGHTGOLDENROD3", "LIGHTGOLDENROD4",
"LIGHTGOLDENRODYELLOW",
"LIGHTGRAY"
"LIGHTPINK", "LIGHTPINK1", "LIGHTPINK2", "LIGHTPINK3", "LIGHTPINK4",
"LIGHTSALMON1", "LIGHTSALMON2", "LIGHTSALMON3", "LIGHTSALMON4",
"LIGHTSEAGREEN",
"LIGHTSKYBLUE", "LIGHTSKYBLUE1", "LIGHTSKYBLUE2", "LIGHTSKYBLUE3", "LIGHTSKYBLUE4",
"LIGHTSLATEBLUE",
"LIGHTSLATEGRAY",
"LIGHTSTEELBLUE", "LIGHTSTEELBLUE1", "LIGHTSTEELBLUE2", "LIGHTSTEELBLUE3", "LIGHTSTEELBLUE4",
"LIGHTYELLOW", "LIGHTYELLOW2", "LIGHTYELLOW3", "LIGHTYELLOW4",
"LIMEGREEN",
"LINEN",
"MAGENTA1", "MAGENTA2", "MAGENTA3", "MAGENTA4",
"MAROON", "MAROON1", "MAROON2", "MAROON3", "MAROON4",
"MEDIUMAQUAMARINE",
"MEDIUMORCHID", "MEDIUMORCHID1", "MEDIUMORCHID2", "MEDIUMORCHID3", "MEDIUMORCHID4",
"MEDIUMPURPLE", "MEDIUMPURPLE1", "MEDIUMPURPLE2", "MEDIUMPURPLE3", "MEDIUMPURPLE4",
"MEDIUMSEAGREEN",
"MEDIUMSLATEBLUE",
"MEDIUMSPRINGGREEN",
"MEDIUMTURQUOISE",
"MEDIUMVIOLETRED",
"MIDNIGHTBLUE",
"MINTCREAM",
"MISTYROSE", "MISTYROSE2", "MISTYROSE3", "MISTYROSE4",
"MOCCASIN",
"NAVAJOWHITE1", "NAVAJOWHITE2", "NAVAJOWHITE3", "NAVAJOWHITE4",
"NAVYBLUE",
"OLDLACE",
"OLIVEDRAB", "OLIVEDRAB1", "OLIVEDRAB2", "OLIVEDRAB3", "OLIVEDRAB4",
"ORANGE", "ORANGE1", "ORANGE2", "ORANGE3", "ORANGE4",
"ORANGERED", "ORANGERED1", "ORANGERED2", "ORANGERED3", "ORANGERED4",
"ORCHID", "ORCHID1", "ORCHID2", "ORCHID3", "ORCHID4",
"PALEGOLDENROD",
"PALEGREEN", "PALEGREEN1", "PALEGREEN2", "PALEGREEN3", "PALEGREEN4",
"PALETURQUOISE", "PALETURQUOISE1", "PALETURQUOISE2", "PALETURQUOISE3", "PALETURQUOISE4",
"PALEVIOLETRED", "PALEVIOLETRED1", "PALEVIOLETRED2", "PALEVIOLETRED3", "PALEVIOLETRED4",
"PAPAYAWHIP",
"PEACHPUFF", "PEACHPUFF2", "PEACHPUFF3", "PEACHPUFF4",
"PERU",
"PINK", "PINK1", "PINK2", "PINK3", "PINK4",
"PLUM", "PLUM1", "PLUM2", "PLUM3", "PLUM4",
"POWDERBLUE",
"PURPLE", "PURPLE1", "PURPLE2", "PURPLE3", "PURPLE4",
"RED", "RED1", "RED2", "RED3", "RED4",
"ROSYBROWN", "ROSYBROWN1", "ROSYBROWN2", "ROSYBROWN3", "ROSYBROWN4",
"ROYALBLUE", "ROYALBLUE1", "ROYALBLUE2", "ROYALBLUE3", "ROYALBLUE4",
"SADDLEBROWN",
"SALMON", "SALMON1", "SALMON2", "SALMON3", "SALMON4",
"SANDYBROWN",
"SEAGREEN", "SEAGREEN1", "SEAGREEN2", "SEAGREEN3", "SEAGREEN4",
"SEASHELL", "SEASHELL2", "SEASHELL3", "SEASHELL4",
"BEET",
"TEAL",
"SIENNA", "SIENNA1", "SIENNA2", "SIENNA3", "SIENNA4",
"SKYBLUE", "SKYBLUE1", "SKYBLUE2", "SKYBLUE3", "SKYBLUE4",
"SLATEBLUE", "SLATEBLUE1", "SLATEBLUE2", "SLATEBLUE3", "SLATEBLUE4",
"SLATEGRAY1", "SLATEGRAY2", "SLATEGRAY3", "SLATEGRAY4", "SLATEGRAY",
"SNOW", "SNOW2", "SNOW3", "SNOW4",
"SPRINGGREEN", "SPRINGGREEN2", "SPRINGGREEN3", "SPRINGGREEN4",
"STEELBLUE", "STEELBLUE1", "STEELBLUE2", "STEELBLUE3", "STEELBLUE4",
"TAN", "TAN1", "TAN2", "TAN3", "TAN4",
"THISTLE", "THISTLE1", "THISTLE2", "THISTLE3", "THISTLE4",
"TOMATO", "TOMATO1", "TOMATO2", "TOMATO3", "TOMATO4",
"TURQUOISE", "TURQUOISE1", "TURQUOISE2", "TURQUOISE3", "TURQUOISE4",
"VIOLET",
"VIOLETRED", "VIOLETRED1", "VIOLETRED2", "VIOLETRED3", "VIOLETRED4",
"WHEAT", "WHEAT1", "WHEAT2", "WHEAT3", "WHEAT4",
"WHITESMOKE",
"YELLOW", "YELLOW1", "YELLOW2", "YELLOW3", "YELLOW4",
"YELLOWGREEN",
"WHITE"
};
}
//=======================================================================
//function : NameOfColorToString
//purpose :
//=======================================================================
Standard_CString Quantity::NameOfColorToString (Quantity_NameOfColor theType)
{
return Quantity_Table_PrintNameOfColor[theType];
}
//=======================================================================
//function : NameOfColorFromString
//purpose :
//=======================================================================
Standard_Boolean Quantity::NameOfColorFromString (Standard_CString theTypeString,
Quantity_NameOfColor& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= Quantity_NOC_WHITE; ++aTypeIter)
{
Standard_CString aTypeName = Quantity_Table_PrintNameOfColor[aTypeIter];
if (aName == aTypeName)
{
theType = Quantity_NameOfColor (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}

53
src/Quantity/Quantity.hxx Normal file
View File

@@ -0,0 +1,53 @@
// 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 _Quantity_HeaderFile
#define _Quantity_HeaderFile
#include <Quantity_NameOfColor.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Macro.hxx>
#include <Standard_Type.hxx>
//! Provides methods to cast enumerations of package to string value
class Quantity
{
public:
DEFINE_STANDARD_ALLOC
//! 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 NameOfColorToString (Quantity_NameOfColor theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return enumeration type or Quantity_NOC_BLACK if string identifier is invalid
static Quantity_NameOfColor NameOfColorFromString (Standard_CString theTypeString)
{
Quantity_NameOfColor aType = Quantity_NOC_BLACK;
NameOfColorFromString (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 NameOfColorFromString (const Standard_CString theTypeString,
Quantity_NameOfColor& theType);
};
#endif // _Quantity_HeaderFile

View File

@@ -15,6 +15,9 @@
#include <Quantity_Color.hxx>
#include <Message_Alerts.hxx>
#include <NCollection_Vector.hxx>
#include <Quantity_ColorDefinitionError.hxx>
#include <Quantity_ColorRGBA.hxx>
#include <Standard_ErrorHandler.hxx>
@@ -3924,3 +3927,41 @@ void call_rgbhls (float r, float g, float b, float& h, float& l, float& s)
if (h < 0.0) h += 360.0;
}
}
//=======================================================================
// function : ToString
// purpose :
//=======================================================================
TCollection_AsciiString Quantity_Color::ToString() const
{
NCollection_Vector<Standard_Real> aValues;
aValues.Append (MyRed);
aValues.Append (MyGreen);
aValues.Append (MyBlue);
Standard_SStream OS;
TCollection_AsciiString aValue;
DUMP_VEC_COLOR(aValues, aValue)
return aValue;
}
//=======================================================================
// function : FromString
// purpose :
//=======================================================================
Standard_Boolean Quantity_Color::FromString (const TCollection_AsciiString& theValue)
{
NCollection_Vector<Standard_Real> aValues;
DUMP_VEC_COLOR_SPLIT (theValue, aValues)
if (aValues.Size() != 3)
return Standard_False;
MyRed = (Standard_ShortReal)aValues.Value (0);
MyGreen = (Standard_ShortReal)aValues.Value (1);
MyBlue = (Standard_ShortReal)aValues.Value (2);
return Standard_True;
}

View File

@@ -21,6 +21,7 @@
#include <Standard_Handle.hxx>
#include <Standard_ShortReal.hxx>
#include <TCollection_AsciiString.hxx>
#include <Quantity_NameOfColor.hxx>
#include <Quantity_TypeOfColor.hxx>
#include <Standard_Real.hxx>
@@ -264,6 +265,14 @@ Standard_Boolean operator == (const Quantity_Color& Other) const
//! Internal test
Standard_EXPORT static void Test();
//! Covers point into string in format: (X, Y, Z)
//! \return the string value
Standard_EXPORT TCollection_AsciiString ToString() const;
//! Converts text value into parameters if possible, the string format is: (X, Y, Z)
//! \return true if conversion is done
Standard_EXPORT Standard_Boolean FromString (const TCollection_AsciiString& theValue);
private:
//! Converts HLS components into RGB ones.

View File

@@ -1,3 +1,5 @@
SelectMgr.cxx
SelectMgr.hxx
SelectMgr_AndFilter.cxx
SelectMgr_AndFilter.hxx
SelectMgr_BaseFrustum.cxx

View File

@@ -0,0 +1,89 @@
// 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 <SelectMgr.hxx>
#include <TCollection_AsciiString.hxx>
namespace
{
static Standard_CString SelectMgr_Table_PrintPickingStrategy[2] =
{
"FIRST_ACCEPTABLE", "ONLY_TOPMOST"
};
static Standard_CString SelectMgr_Table_PrintBVHSubset[4] =
{
"3d", "3dPersistent", "2dPersistent", "Nb"
};
}
//=======================================================================
//function : TypeOfOrientationToString
//purpose :
//=======================================================================
Standard_CString SelectMgr::PickingStrategyToString (SelectMgr_PickingStrategy theType)
{
return SelectMgr_Table_PrintPickingStrategy[theType];
}
//=======================================================================
//function : PickingStrategyFromString
//purpose :
//=======================================================================
Standard_Boolean SelectMgr::PickingStrategyFromString (Standard_CString theTypeString,
SelectMgr_PickingStrategy& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= SelectMgr_PickingStrategy_OnlyTopmost; ++aTypeIter)
{
Standard_CString aTypeName = SelectMgr_Table_PrintPickingStrategy[aTypeIter];
if (aName == aTypeName)
{
theType = SelectMgr_PickingStrategy (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : BVHSubsetToString
//purpose :
//=======================================================================
Standard_CString SelectMgr::BVHSubsetToString (SelectMgr_SelectableObjectSet::BVHSubset theType)
{
return SelectMgr_Table_PrintBVHSubset[theType];
}
//=======================================================================
//function : BVHSubsetFromString
//purpose :
//=======================================================================
Standard_Boolean SelectMgr::BVHSubsetFromString (Standard_CString theTypeString,
SelectMgr_SelectableObjectSet::BVHSubset& theType)
{
TCollection_AsciiString aName (theTypeString);
aName.UpperCase();
for (Standard_Integer aTypeIter = 0; aTypeIter <= SelectMgr_SelectableObjectSet::BVHSubsetNb; ++aTypeIter)
{
Standard_CString aTypeName = SelectMgr_Table_PrintBVHSubset[aTypeIter];
if (aName == aTypeName)
{
theType = SelectMgr_SelectableObjectSet::BVHSubset (aTypeIter);
return Standard_True;
}
}
return Standard_False;
}

View File

@@ -0,0 +1,82 @@
// 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 _SelectMgr_HeaderFile
#define _SelectMgr_HeaderFile
#include <SelectMgr_PickingStrategy.hxx>
#include <SelectMgr_SelectableObjectSet.hxx>
#include <SelectMgr_StateOfSelection.hxx>
#include <SelectMgr_TypeOfBVHUpdate.hxx>
#include <SelectMgr_TypeOfUpdate.hxx>
#include <Standard.hxx>
#include <Standard_Macro.hxx>
#include <Standard_TypeDef.hxx>
//! This package contains the set of commands and services of the SelectMgr
class SelectMgr
{
public:
DEFINE_STANDARD_ALLOC
//! Returns the string name for a given orientation type.
//! @param theType orientation type
//! @return string identifier from the list Xpos, Ypos, Zpos and others
Standard_EXPORT static Standard_CString PickingStrategyToString (SelectMgr_PickingStrategy theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return orientation type or V3d_TypeOfOrientation if string identifier is invalid
static SelectMgr_PickingStrategy PickingStrategyFromString (Standard_CString theTypeString)
{
SelectMgr_PickingStrategy aType = SelectMgr_PickingStrategy_FirstAcceptable;
PickingStrategyFromString (theTypeString, aType);
return aType;
}
//! Determines the shape type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected shape type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean PickingStrategyFromString (const Standard_CString theTypeString,
SelectMgr_PickingStrategy& theType);
//! Returns the string name for a given orientation type.
//! @param theType orientation type
//! @return string identifier from the list Xpos, Ypos, Zpos and others
Standard_EXPORT static Standard_CString BVHSubsetToString (SelectMgr_SelectableObjectSet::BVHSubset theType);
//! Returns the orientation type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return orientation type or BVHSubset_3d if string identifier is invalid
static SelectMgr_SelectableObjectSet::BVHSubset BVHSubsetFromString (Standard_CString theTypeString)
{
SelectMgr_SelectableObjectSet::BVHSubset aType = SelectMgr_SelectableObjectSet::BVHSubset_3d;
BVHSubsetFromString (theTypeString, aType);
return aType;
}
//! Determines the shape type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @param theType detected shape type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean BVHSubsetFromString (const Standard_CString theTypeString,
SelectMgr_SelectableObjectSet::BVHSubset& theType);
};
#endif // _SelectMgr_HeaderFile

View File

@@ -15,6 +15,9 @@
#include <SelectMgr_BaseFrustum.hxx>
#include <Message.hxx>
#include <Message_Alerts.hxx>
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_BaseFrustum,Standard_Transient)
//=======================================================================
@@ -251,3 +254,17 @@ Standard_Boolean SelectMgr_BaseFrustum::IsClipped (const Graphic3d_SequenceOfHCl
{
return Standard_True;
}
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
void SelectMgr_BaseFrustum::Dump(Standard_OStream& OS)const
{
DUMP_VALUES (OS, "SelectMgr_BaseFrustum", 2);
DUMP_VALUES (OS, "myPixelTolerance", myPixelTolerance);
DUMP_VALUES (OS, "myIsOrthographic", myIsOrthographic);
DUMP_VALUES (OS, "myBuilder", Message::TransientToString (myBuilder));
DUMP_VALUES (OS, "myCamera", Message::TransientToString (myCamera));
}

View File

@@ -35,6 +35,8 @@
#include <SelectBasics_PickResult.hxx>
#include <Standard_OStream.hxx>
//! This class is an interface for different types of selecting frustums,
//! defining different selection types, like point, box or polyline
//! selection. It contains signatures of functions for detection of
@@ -186,6 +188,9 @@ public:
return;
}
//! Dumps the content of me on the stream <OS>.
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const;
DEFINE_STANDARD_RTTIEXT(SelectMgr_BaseFrustum,Standard_Transient)
protected:

View File

@@ -217,6 +217,19 @@ public:
return mySelectingVolumes[myActiveSelectionType / 2];
}
//! Returns active selecting volume that was built during last
//! run of OCCT selection mechanism
Handle(SelectMgr_BaseFrustum) GetVolume (const SelectionType& theType) const
{
switch (theType)
{
case Point:
case Box: return mySelectingVolumes[Frustum];
case Polyline: return mySelectingVolumes[FrustumSet];
default: return NULL;
}
}
//! Stores plane equation coefficients (in the following form:
//! Ax + By + Cz + D = 0) to the given vector
virtual void GetPlanes (NCollection_Vector<SelectMgr_Vec4>& thePlaneEquations) const Standard_OVERRIDE

View File

@@ -18,6 +18,7 @@
#include <Bnd_Range.hxx>
#include <Standard_TypeDef.hxx>
#include <Standard_OStream.hxx>
//! Class for handling depth clipping range.
//! It is used to perform checks in case if global (for the whole view)
@@ -106,6 +107,16 @@ public:
//! Adds a clipping sub-range (for clipping chains).
void AddClipSubRange (const Bnd_Range& theRange) { myClipRanges.push_back (theRange); }
//! Dumps the content of me on the stream <OS>.
Standard_EXPORT void Dump (Standard_OStream& OS) const
{
DUMP_VALUES (OS, "SelectMgr_ViewClipRange", 2);
DUMP_VALUES (OS, "myUnclipRange", myUnclipRange.ToString());
DUMP_VALUES (OS, "myClipRanges", myClipRanges.size());
for (size_t aRangeIter = 0; aRangeIter < myClipRanges.size(); ++aRangeIter)
DUMP_VALUES (OS, aRangeIter, myClipRanges[aRangeIter].ToString());
}
private:
std::vector<Bnd_Range> myClipRanges;

View File

@@ -19,10 +19,12 @@
#include <BVH_Tree.hxx>
#include <gp_GTrsf.hxx>
#include <gp_Pnt.hxx>
#include <Message_Alerts.hxx>
#include <OSD_Environment.hxx>
#include <Precision.hxx>
#include <Select3D_SensitiveEntity.hxx>
#include <SelectBasics_PickResult.hxx>
#include <SelectMgr.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_SortCriterion.hxx>
#include <SelectMgr_SensitiveEntitySet.hxx>
@@ -33,6 +35,12 @@
#include <algorithm>
#define REPORT_SELECTION_BUILD
#ifdef REPORT_SELECTION_BUILD
#include <Message_Alerts.hxx>
#include <Message_PerfMeter.hxx>
#endif
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_ViewerSelector, Standard_Transient)
namespace {
@@ -209,6 +217,12 @@ void SelectMgr_ViewerSelector::checkOverlap (const Handle(Select3D_SensitiveEnti
const gp_GTrsf& theInversedTrsf,
SelectMgr_SelectingVolumeManager& theMgr)
{
#ifdef REPORT_SELECTION_BUILD
Message_PerfMeter aPerfMeter;
MESSAGE_INFO_OBJECT (theEntity, "checkOverlap", "", &aPerfMeter, NULL);
Handle(Message_Alert) aParentAlert = OCCT_Message_Alert;
#endif
const Handle(SelectMgr_EntityOwner)& anOwner = theEntity->OwnerId();
Handle(SelectMgr_SelectableObject) aSelectable;
Standard_Boolean toRestoresViewClipEnabled = Standard_False;
@@ -258,7 +272,13 @@ void SelectMgr_ViewerSelector::checkOverlap (const Handle(Select3D_SensitiveEnti
}
SelectBasics_PickResult aPickResult;
#ifdef REPORT_SELECTION_BUILD
MESSAGE_INFO (TCollection_AsciiString ("Matches - start"), "", &aPerfMeter, aParentAlert);
#endif
const Standard_Boolean isMatched = theEntity->Matches(theMgr, aPickResult);
#ifdef REPORT_SELECTION_BUILD
MESSAGE_INFO (TCollection_AsciiString ("Matches - end"), "", &aPerfMeter, aParentAlert);
#endif
if (toRestoresViewClipEnabled)
{
theMgr.SetViewClippingEnabled (Standard_True);
@@ -270,6 +290,15 @@ void SelectMgr_ViewerSelector::checkOverlap (const Handle(Select3D_SensitiveEnti
return;
}
if (!mySelectingVolumeMgr.ViewClipping().IsNull())
{
Standard_Real aDepth = /*aPickResult.HasPickedPoint() ?*+/ aPickResult.Depth();// :*/ aPickResult.DistToGeomCenter();
Standard_Boolean isClipped = mySelectingVolumeMgr.IsClipped (*mySelectingVolumeMgr.ViewClipping(),
aDepth);
if (isClipped)
return;
}
if (HasDepthClipping (anOwner)
&& !aSelectable.IsNull()
&& theMgr.GetActiveSelectionType() == SelectMgr_SelectingVolumeManager::Point)
@@ -366,6 +395,12 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
return;
}
#ifdef REPORT_SELECTION_BUILD
Message_PerfMeter aPerfMeter;
MESSAGE_INFO_OBJECT (theObject, "traverseObject", "", &aPerfMeter, NULL);
Handle(Message_Alert) aParentAlert = OCCT_Message_Alert;
#endif
const opencascade::handle<BVH_Tree<Standard_Real, 3> >& aSensitivesTree = anEntitySet->BVH();
gp_GTrsf aInversedTrsf;
if (theObject->HasTransformation() || !theObject->TransformPersistence().IsNull())
@@ -442,6 +477,10 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
Standard_Integer aHead = -1;
for (;;)
{
#ifdef REPORT_SELECTION_BUILD
MESSAGE_INFO (TCollection_AsciiString ("aNode") + aNode, "", &aPerfMeter, aParentAlert);
#endif
if (!aSensitivesTree->IsOuter (aNode))
{
const Standard_Integer aLeftChildIdx = aSensitivesTree->Child<0> (aNode);
@@ -570,11 +609,24 @@ void SelectMgr_ViewerSelector::traverseObject (const Handle(SelectMgr_Selectable
//=======================================================================
void SelectMgr_ViewerSelector::TraverseSensitives()
{
#ifdef REPORT_SELECTION_BUILD
Message_PerfMeter aPerfMeter;
MESSAGE_INFO ("TraverseSensitives", "", &aPerfMeter, NULL);
Handle(Message_Alert) aParentAlert = OCCT_Message_Alert;
Standard_SStream aStream;
Dump (aStream);
MESSAGE_INFO_VALUES (aStream, "Parameters", "", &aPerfMeter, aParentAlert);
#endif
mystored.Clear();
Standard_Integer aWidth;
Standard_Integer aHeight;
mySelectingVolumeMgr.WindowSize (aWidth, aHeight);
#ifdef REPORT_SELECTION_BUILD
MESSAGE_INFO ("UpdateBVH", "", &aPerfMeter, aParentAlert);
#endif
mySelectableObjects.UpdateBVH (mySelectingVolumeMgr.Camera(),
mySelectingVolumeMgr.ProjectionMatrix(),
mySelectingVolumeMgr.WorldViewMatrix(),
@@ -597,6 +649,11 @@ void SelectMgr_ViewerSelector::TraverseSensitives()
SelectMgr_SelectableObjectSet::BVHSubset aBVHSubset =
static_cast<SelectMgr_SelectableObjectSet::BVHSubset> (aBVHSetIt);
#ifdef REPORT_SELECTION_BUILD
MESSAGE_INFO (TCollection_AsciiString ("aBVHSetIt"), SelectMgr::BVHSubsetToString (aBVHSubset), &aPerfMeter, aParentAlert);
Handle(Message_Alert) aParentAlertLevel1 = OCCT_Message_Alert;
#endif
if (mySelectableObjects.IsEmpty (aBVHSubset))
{
continue;
@@ -652,6 +709,9 @@ void SelectMgr_ViewerSelector::TraverseSensitives()
Standard_Integer aHead = -1;
for (;;)
{
#ifdef REPORT_SELECTION_BUILD
MESSAGE_INFO (TCollection_AsciiString ("aNode - ") + aNode, "", &aPerfMeter, aParentAlertLevel1);
#endif
if (!aBVHTree->IsOuter (aNode))
{
const Standard_Integer aLeftChildIdx = aBVHTree->Child<0> (aNode);
@@ -705,7 +765,13 @@ void SelectMgr_ViewerSelector::TraverseSensitives()
}
}
MESSAGE_INFO ("SortResult", "", &aPerfMeter, aParentAlert);
SortResult();
#ifdef REPORT_SELECTION_BUILD
Standard_SStream aStreamDone;
Dump (aStreamDone);
MESSAGE_INFO_VALUES (aStreamDone, "Parameters", "", &aPerfMeter, aParentAlert);
#endif
}
//==================================================
@@ -885,6 +951,12 @@ TCollection_AsciiString SelectMgr_ViewerSelector::Status (const Handle(SelectMgr
//=======================================================================
void SelectMgr_ViewerSelector::SortResult()
{
#ifdef REPORT_SELECTION_BUILD
Message_PerfMeter aPerfMeter;
MESSAGE_INFO ("SortResult", "", &aPerfMeter, NULL);
Handle(Message_Alert) aParentAlert = OCCT_Message_Alert;
#endif
if(mystored.IsEmpty()) return;
const Standard_Integer anExtent = mystored.Extent();
@@ -1082,3 +1154,27 @@ void SelectMgr_ViewerSelector::AllowOverlapDetection (const Standard_Boolean the
{
mySelectingVolumeMgr.AllowOverlapDetection (theIsToAllow);
}
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
void SelectMgr_ViewerSelector::Dump(Standard_OStream& OS)const
{
DUMP_VALUES (OS, "SelectMgr_ViewerSelector", 2);
DUMP_VALUES (OS, "IsPickClosest", IsPickClosest());
DUMP_VALUES (OS, "ToUpdateTolerance", myToUpdateTolerance);
DUMP_VALUES (OS, "mystored", mystored.Extent());
//DUMP_VALUES (OS, "mySelectingVolumeMgr", mySelectingVolumeMgr);
Standard_Integer aNbOfSelected = 0;
for (SelectMgr_SelectableObjectSet::Iterator aSelectableIt (mySelectableObjects); aSelectableIt.More(); aSelectableIt.Next())
{
aNbOfSelected++;
}
DUMP_VALUES (OS, "mySelectableObjects", aNbOfSelected);
DUMP_VALUES (OS, "myTolerances.Tolerance()", myTolerances.Tolerance());
DUMP_VALUES (OS, "myTolerances.CustomTolerance()", myTolerances.CustomTolerance());
DUMP_VALUES (OS, "myZLayerOrderMap", myZLayerOrderMap.Size());
}

View File

@@ -109,6 +109,9 @@ public:
//! depth which is used to choose among objects of the same priority.
void SetPickClosest (const Standard_Boolean theToPreferClosest) { preferclosest = theToPreferClosest; }
//! Return preference of selecting one object for OnePicked() method
Standard_Boolean IsPickClosest() const { return preferclosest; }
//! Returns the number of detected owners.
Standard_Integer NbPicked() const { return mystored.Extent(); }
@@ -201,6 +204,12 @@ public:
//! Returns instance of selecting volume manager of the viewer selector
SelectMgr_SelectingVolumeManager& GetManager() { return mySelectingVolumeMgr; }
//! Returns container of selectable objects
const SelectMgr_SelectableObjectSet& GetSelectableObjects() const { return mySelectableObjects; }
//! Returns container of sensitives
const SelectMgr_MapOfObjectSensitives& GetObjectSensitives() const { return myMapOfObjectSensitives; }
//! Marks all added sensitive entities of all objects as non-selectable
Standard_EXPORT void ResetSelectionActivationStatus();
@@ -209,6 +218,9 @@ public:
//! mark both included and overlapped entities as matched
Standard_EXPORT void AllowOverlapDetection (const Standard_Boolean theIsToAllow);
//! Dumps the content of me on the stream <OS>.
Standard_EXPORT void Dump (Standard_OStream& OS) const;
public:
//! Begins an iteration scanning for the owners detected at a position in the view.

View File

@@ -27,7 +27,7 @@ public:
TopoDS_AlertAttribute (const TopoDS_Shape& theShape,
const TCollection_AsciiString& theName = TCollection_AsciiString(),
const TCollection_AsciiString& theDescription = TCollection_AsciiString())
: Message_Attribute (theName, theDescription), myShape (theShape) {}
: Message_Attribute (theName, theDescription), myShape (theShape) {}
//! Returns contained shape
const TopoDS_Shape& GetShape() const { return myShape; }
@@ -39,5 +39,14 @@ private:
TopoDS_Shape myShape;
};
#define MESSAGE_INFO_SHAPE(Shape, Name, Description, PerfMeter, ParentAlert) \
{ \
if (!Message_Report::CurrentReport().IsNull() && \
Message_Report::CurrentReport()->IsActive (Message_Info)) \
{ \
OCCT_Message_Alert = Message_AlertExtended::AddAlert (Message_Report::CurrentReport(), \
new TopoDS_AlertAttribute (Shape, Name, Description), PerfMeter, ParentAlert); \
} \
}
#endif // _TopoDS_AlertAttribute_HeaderFile

View File

@@ -507,6 +507,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 :

View File

@@ -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);

View File

@@ -17,8 +17,7 @@
#include <Message.hxx>
#include <Message_AlertExtended.hxx>
#include <Message_AttributeVectorOfReal.hxx>
#include <Message_AttributeVectorOfRealVec3.hxx>
#include <Message_AttributeVectorOfValues.hxx>
#include <Message_CompositeAlerts.hxx>
#include <Message_Report.hxx>
@@ -26,7 +25,7 @@
#include <TDataStd_Comment.hxx>
#include <TDataStd_Real.hxx>
#include <TDataStd_Name.hxx>
#include <TDataStd_RealArray.hxx>
#include <TDataStd_ExtStringArray.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDocStd_Application.hxx>
#include <TDocStd_Document.hxx>
@@ -250,36 +249,18 @@ void XmlDrivers_MessageReportStorage::exportAlertParameters (const Handle(Messag
TDataStd_Comment::Set (theAlertLabel, anAttribute->GetDescription());
Standard_CString aDynamicTypeName = anAttribute->DynamicType()->Name();
if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfReal)->Name())
if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfValues)->Name())
{
Handle(Message_AttributeVectorOfReal) aRealArrayAlert = Handle(Message_AttributeVectorOfReal)::DownCast (anAttribute);
Handle(Message_AttributeVectorOfValues) aValuesArrayAlert = Handle(Message_AttributeVectorOfValues)::DownCast (anAttribute);
// store values
const NCollection_Vector<double>& anArrayValues = aRealArrayAlert->GetValues();
const NCollection_Vector<TCollection_AsciiString>& anArrayValues = aValuesArrayAlert->GetValues();
// create real list attribute only if there are values in the attribute
if (anArrayValues.IsEmpty())
return;
int anArraySize = anArrayValues.Length();
Handle(TDataStd_RealArray) aRealListAttribute = TDataStd_RealArray::Set (theAlertLabel, 0, anArraySize - 1);
Handle(TDataStd_ExtStringArray) aListAttribute = TDataStd_ExtStringArray::Set (theAlertLabel, 0, anArraySize - 1);
for (int aValueId = 0; aValueId < anArraySize; aValueId++)
aRealListAttribute->SetValue (aValueId, anArrayValues.Value (aValueId));
}
else if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfRealVec3)->Name())
{
Handle(Message_AttributeVectorOfRealVec3) aRealArrayAlert = Handle(Message_AttributeVectorOfRealVec3)::DownCast (anAttribute);
// store values
const NCollection_Vector<NCollection_Vec3<double>>& anArrayValues = aRealArrayAlert->GetValues();
// create real list attribute only if there are values in the attribute
if (anArrayValues.IsEmpty())
return;
int anArraySize = anArrayValues.Length();
Handle(TDataStd_RealArray) aRealListAttribute = TDataStd_RealArray::Set (theAlertLabel, 0, 3 * anArraySize - 1);
for (int aValueId = 0; aValueId < anArraySize; aValueId++)
{
NCollection_Vec3<double> aValue = anArrayValues.Value (aValueId);
aRealListAttribute->SetValue (3 * aValueId, aValue.x());
aRealListAttribute->SetValue (3 * aValueId + 1, aValue.y());
aRealListAttribute->SetValue (3 * aValueId + 2, aValue.z());
}
aListAttribute->SetValue (aValueId, anArrayValues.Value (aValueId));
}
}
@@ -310,42 +291,24 @@ Handle(Message_Alert) XmlDrivers_MessageReportStorage::importAlertParameters (co
Handle(Message_Attribute) aMessageAttribute;
if (aDynamicTypeName == STANDARD_TYPE (Message_Attribute)->Name())
aMessageAttribute = new Message_Attribute();
else if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfReal)->Name())
else if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfValues)->Name())
{
// values
NCollection_Vector<double> anArrayValues;
if (!aParametersLabel.FindAttribute (TDataStd_RealArray::GetID(), anAttribute))
NCollection_Vector<TCollection_AsciiString> anArrayValues;
if (!aParametersLabel.FindAttribute (TDataStd_ExtStringArray::GetID(), anAttribute))
return Handle(Message_Alert)();
Handle(TDataStd_RealArray) aValuesAttribute = Handle(TDataStd_RealArray)::DownCast (anAttribute);
Handle(TDataStd_ExtStringArray) aValuesAttribute = Handle(TDataStd_ExtStringArray)::DownCast (anAttribute);
if (aValuesAttribute.IsNull())
return Handle(Message_Alert)();
for (int aValueId = aValuesAttribute->Lower(); aValueId <= aValuesAttribute->Upper(); aValueId++)
anArrayValues.Append (aValuesAttribute->Value (aValueId));
aMessageAttribute = new Message_AttributeVectorOfReal (anArrayValues);
}
else if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfRealVec3)->Name())
{
// values
NCollection_Vector<NCollection_Vec3<double>> anArrayValues;
if (!aParametersLabel.FindAttribute(TDataStd_RealArray::GetID(), anAttribute))
return Handle(Message_Alert)();
Handle(TDataStd_RealArray) aValuesAttribute = Handle(TDataStd_RealArray)::DownCast (anAttribute);
if (aValuesAttribute.IsNull())
return Handle(Message_Alert)();
for (int aValueId = aValuesAttribute->Lower(); aValueId <= aValuesAttribute->Upper();
aValueId = aValueId + 3)
{
NCollection_Vec3<double> aValue (aValuesAttribute->Value (aValueId),
aValuesAttribute->Value (aValueId + 1),
aValuesAttribute->Value (aValueId + 2));
anArrayValues.Append (aValue);
}
aMessageAttribute = new Message_AttributeVectorOfRealVec3 (anArrayValues);
Standard_SStream aStream;
Handle(Message_AttributeVectorOfValues) anAlert = new Message_AttributeVectorOfValues (aStream);
anAlert->SetValues (anArrayValues);
aMessageAttribute = anAlert;
}
if (!aMessageAttribute.IsNull())

View File

@@ -22,6 +22,9 @@
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <TCollection_AsciiString.hxx>
class Standard_ConstructionError;
class Standard_OutOfRange;
class gp_Mat2d;
@@ -270,6 +273,16 @@ public:
//! Covers point into string in format: (X, Y)
//! \return the string value
Standard_EXPORT TCollection_AsciiString ToString() const;
//! Converts text value into parameters if possible, the string format is: (X, Y)
//! \return true if conversion is done
Standard_EXPORT Standard_Boolean FromString (const TCollection_AsciiString& theValue);
protected:

View File

@@ -227,3 +227,37 @@ inline gp_XY operator* (const Standard_Real Scalar,
return Coord1.Multiplied(Scalar);
}
inline TCollection_AsciiString gp_XY::ToString() const
{
return TCollection_AsciiString ("(") + x + ", " + y + ")";
}
inline Standard_Boolean gp_XY::FromString (const TCollection_AsciiString& theValue)
{
TCollection_AsciiString aCurrentString = theValue, aValueString;
Standard_Integer aPosition = aCurrentString.Search ("(");
if (aPosition != 1)
return Standard_False;
aCurrentString = aCurrentString.Split (aPosition);
Standard_Real aX, anY;
// x value
aPosition = aCurrentString.Search (", ");
if (aPosition < 0)
return Standard_False;
aCurrentString = aValueString.Split (aPosition);
aX = aValueString.RealValue();
aCurrentString = aCurrentString.Split (2);
// y value
aPosition = aCurrentString.Search (")");
if (aPosition < 0)
return Standard_False;
aCurrentString = aValueString.Split (aPosition);
anY = aValueString.RealValue();
x = aX;
y = anY;
return Standard_True;
}

View File

@@ -22,6 +22,9 @@
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <TCollection_AsciiString.hxx>
class Standard_ConstructionError;
class Standard_OutOfRange;
class gp_Mat;
@@ -324,6 +327,15 @@ public:
void SetLinearForm (const gp_XYZ& XYZ1, const gp_XYZ& XYZ2);
//! Covers point into string in format: (X, Y, Z)
//! \return the string value
Standard_EXPORT TCollection_AsciiString ToString() const;
//! Converts text value into parameters if possible, the string format is: (X, Y, Z)
//! \return true if conversion is done
Standard_EXPORT Standard_Boolean FromString (const TCollection_AsciiString& theValue);
protected:

View File

@@ -306,8 +306,50 @@ inline gp_XYZ operator* (const Standard_Real Scalar, const gp_XYZ& Coord1) {
return Coord1.Multiplied (Scalar);
}
inline TCollection_AsciiString gp_XYZ::ToString() const
{
return TCollection_AsciiString ("(") + x + ", " + y + ", " + z + ")";
}
inline Standard_Boolean gp_XYZ::FromString (const TCollection_AsciiString& theValue)
{
TCollection_AsciiString aCurrentString = theValue, aValueString;
Standard_Integer aPosition = aCurrentString.Search ("(");
if (aPosition != 1)
return Standard_False;
aCurrentString = aCurrentString.Split (aPosition);
Standard_Real aX, anY, aZ;
// x value
aPosition = aCurrentString.Search (", ");
if (aPosition < 0)
return Standard_False;
aValueString = aCurrentString;
aCurrentString = aValueString.Split (aPosition - 1);
aX = aValueString.RealValue();
aCurrentString = aCurrentString.Split (2);
// y value
aPosition = aCurrentString.Search (", ");
if (aPosition < 0)
return Standard_False;
aValueString = aCurrentString;
aCurrentString = aValueString.Split (aPosition - 1);
anY = aValueString.RealValue();
aCurrentString = aCurrentString.Split (2);
// z value
aPosition = aCurrentString.Search (")");
if (aPosition < 0)
return Standard_False;
aValueString = aCurrentString;
aCurrentString = aValueString.Split (aPosition);
aZ = aValueString.RealValue();
x = aX;
y = anY;
z = aZ;
return Standard_True;
}

View File

@@ -420,6 +420,11 @@ void DFBrowser_Window::Init (const NCollection_List<Handle(Standard_Transient)>&
}
return;
}
else
{
if (anApplication.IsNull() && CDF_Session::Exists())
anApplication = Handle(TDocStd_Application)::DownCast (CDF_Session::CurrentSession()->CurrentApplication());
}
myModule = new DFBrowser_Module();
myModule->CreateViewModel (myMainWindow);
@@ -659,7 +664,7 @@ void DFBrowser_Window::onExpand()
for (int aSelectedId = 0, aSize = aSelectedIndices.size(); aSelectedId < aSize; aSelectedId++)
{
int aLevels = 2;
setExpanded (myTreeView, aSelectedIndices[aSelectedId], true, aLevels);
TreeModel_Tools::SetExpanded (myTreeView, aSelectedIndices[aSelectedId], true, aLevels);
}
QApplication::restoreOverrideCursor();
}
@@ -677,7 +682,7 @@ void DFBrowser_Window::onExpandAll()
for (int aSelectedId = 0, aSize = aSelectedIndices.size(); aSelectedId < aSize; aSelectedId++)
{
int aLevels = -1;
setExpanded (myTreeView, aSelectedIndices[aSelectedId], true, aLevels);
TreeModel_Tools::SetExpanded (myTreeView, aSelectedIndices[aSelectedId], true, aLevels);
}
QApplication::restoreOverrideCursor();
}
@@ -692,7 +697,7 @@ void DFBrowser_Window::onCollapseAll()
QModelIndexList aSelectedIndices = aSelectionModel->selectedIndexes();
for (int aSelectedId = 0, aSize = aSelectedIndices.size(); aSelectedId < aSize; aSelectedId++) {
int aLevels = -1;
setExpanded (myTreeView, aSelectedIndices[aSelectedId], false, aLevels);
TreeModel_Tools::SetExpanded (myTreeView, aSelectedIndices[aSelectedId], false, aLevels);
}
}
@@ -988,26 +993,3 @@ void DFBrowser_Window::findPresentations (const QModelIndexList& theIndices, AIS
thePresentations.Append (aPresentation);
}
}
// =======================================================================
// function : setExpanded
// purpose :
// =======================================================================
void DFBrowser_Window::setExpanded (QTreeView* theTreeView, const QModelIndex& theIndex, const bool isExpanded,
int& theLevels)
{
bool isToExpand = theLevels == -1 || theLevels > 0;
if (!isToExpand)
return;
theTreeView->setExpanded (theIndex, isExpanded);
if (theLevels != -1)
theLevels--;
QAbstractItemModel* aModel = theTreeView->model();
for (int aRowId = 0, aRows = aModel->rowCount (theIndex); aRowId < aRows; aRowId++)
{
int aLevels = theLevels;
setExpanded (theTreeView, aModel->index (aRowId, 0, theIndex), isExpanded, aLevels);
}
}

View File

@@ -206,13 +206,6 @@ protected:
//! \return container of presentations or NULL
void findPresentations (const QModelIndexList& theIndices, AIS_ListOfInteractive& thePresentations);
//! Recursive items expanding in tree view staring from the index
//! \param theTreeView an OCAF tree view
//! \param theParentIndex an index which children should be expanded
//! \param isExpanded a boolean state if the item should be expanded or collapsed
//! \param theLevels a number of levels to be expanded, or -1 for all levels
static void setExpanded (QTreeView* theTreeView, const QModelIndex& theParentIndex, const bool isExpanded, int& theLevels);
private:
DFBrowser_Module* myModule; //!< current module

View File

@@ -8,14 +8,14 @@ MessageModel_ItemBase.cxx
MessageModel_ItemBase.hxx
MessageModel_ItemReport.cxx
MessageModel_ItemReport.hxx
MessageModel_ItemReportProperties.cxx
MessageModel_ItemReportProperties.hxx
MessageModel_ItemRoot.cxx
MessageModel_ItemRoot.hxx
MessageModel_ReportCallBack.cxx
MessageModel_ReportCallBack.hxx
MessageModel_TableModelRealValues.cxx
MessageModel_TableModelRealValues.hxx
MessageModel_TableModelRealVec3Values.cxx
MessageModel_TableModelRealVec3Values.hxx
MessageModel_TableModelValues.cxx
MessageModel_TableModelValues.hxx
MessageModel_Tools.cxx
MessageModel_Tools.hxx
MessageModel_TreeModel.cxx

View File

@@ -1,7 +1,6 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>icons/item_shape.png</file>
<file>icons/item_vectorOfReal.png</file>
<file>icons/item_vectorOfRealVec3.png</file>
<file>icons/item_vectorOfValues.png</file>
</qresource>
</RCC>

View File

@@ -21,7 +21,9 @@ enum MessageModel_ActionType
{
MessageModel_ActionType_Activate, //!< set Message_Report active
MessageModel_ActionType_Deactivate, //!< set Message_Report not active
MessageModel_ActionType_ExportToShapeView //!< export TopoDS_Shape of selected item into TKShapeView plugin
MessageModel_ActionType_Clear, //!< clear Message_Report alerts
MessageModel_ActionType_ExportToShapeView, //!< export TopoDS_Shape of selected item into TKShapeView plugin
MessageModel_ActionType_Test //!< test alerts
};
#endif

View File

@@ -24,15 +24,26 @@
#include <inspector/TInspectorAPI_PluginParameters.hxx>
#include <inspector/ViewControl_Tools.hxx>
#include <TCollection_AsciiString.hxx>
#include <TopoDS_AlertWithShape.hxx>
#include <Message_AlertExtended.hxx>
#include <TCollection_AsciiString.hxx>
#include <TopoDS_AlertAttribute.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QAction>
#include <QFileDialog>
#include <QItemSelectionModel>
#include <QMenu>
#include <QMessageBox>
#include <QWidget>
#include <Standard_WarningsRestore.hxx>
#define DEBUG_ALERTS
#ifdef DEBUG_ALERTS
#include <Message_Alerts.hxx>
#include <Message_PerfMeter.hxx>
#endif
// =======================================================================
// function : Constructor
@@ -46,8 +57,14 @@ MessageModel_Actions::MessageModel_Actions (QWidget* theParent,
ViewControl_Tools::CreateAction ("Deactivate", SLOT (OnDeactivateReport()), parent(), this));
myActions.insert (MessageModel_ActionType_Activate,
ViewControl_Tools::CreateAction ("Activate", SLOT (OnActivateReport()), parent(), this));
myActions.insert (MessageModel_ActionType_Clear,
ViewControl_Tools::CreateAction ("Clear", SLOT (OnClearReport()), parent(), this));
myActions.insert (MessageModel_ActionType_ExportToShapeView,
ViewControl_Tools::CreateAction (tr ("Export to ShapeView"), SLOT (OnExportToShapeView()), parent(), this));
#ifdef DEBUG_ALERTS
myActions.insert (MessageModel_ActionType_Test,
ViewControl_Tools::CreateAction ("Test", SLOT (OnTestAlerts()), parent(), this));
#endif
}
// =======================================================================
@@ -98,9 +115,15 @@ void MessageModel_Actions::AddMenuActions (const QModelIndexList& theSelectedInd
{
theMenu->addAction (myActions[MessageModel_ActionType_Deactivate]);
theMenu->addAction (myActions[MessageModel_ActionType_Activate]);
theMenu->addAction (myActions[MessageModel_ActionType_Clear]);
#ifdef DEBUG_ALERTS
theMenu->addAction (myActions[MessageModel_ActionType_Test]);
#endif
}
else if (anAlertItem)
{
theMenu->addAction (myActions[MessageModel_ActionType_ExportToShapeView]);
}
theMenu->addSeparator();
}
@@ -146,7 +169,7 @@ void MessageModel_Actions::OnDeactivateReport()
return;
aReport->SetActive (Standard_False);
((MessageModel_TreeModel*)mySelectionModel)->EmitDataChanged (aReportIndex, aReportIndex);
((MessageModel_TreeModel*)mySelectionModel->model())->EmitDataChanged (aReportIndex, aReportIndex);
}
// =======================================================================
@@ -161,7 +184,22 @@ void MessageModel_Actions::OnActivateReport()
return;
aReport->SetActive (Standard_True);
((MessageModel_TreeModel*)mySelectionModel)->EmitDataChanged (aReportIndex, aReportIndex);
((MessageModel_TreeModel*)mySelectionModel->model())->EmitDataChanged (aReportIndex, aReportIndex);
}
// =======================================================================
// function : OnClearReport
// purpose :
// =======================================================================
void MessageModel_Actions::OnClearReport()
{
QModelIndex aReportIndex;
Handle(Message_Report) aReport = getSelectedReport (aReportIndex);
if (aReport.IsNull())
return;
aReport->Clear();
((MessageModel_TreeModel*)mySelectionModel->model())->EmitDataChanged (aReportIndex, aReportIndex);
}
// =======================================================================
@@ -199,11 +237,18 @@ void MessageModel_Actions::OnExportToShapeView()
if (anAlert.IsNull())
continue;
Handle(TopoDS_AlertWithShape) aShapeAlert = Handle(TopoDS_AlertWithShape)::DownCast (anAlert);
if (aShapeAlert.IsNull() || aShapeAlert->GetShape().IsNull())
Handle(Message_AlertExtended) anExtAlert = Handle(Message_AlertExtended)::DownCast (anAlert);
if (anExtAlert.IsNull())
continue;
const TopoDS_Shape aShape = aShapeAlert->GetShape();
Handle(Message_Attribute) anAttribute = anExtAlert->Attribute();
if (anAttribute.IsNull())
continue;
if (!anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
continue;
const TopoDS_Shape aShape = Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape();
if (aShape.IsNull())
continue;
aPluginParameters.Append (aShape.TShape());
@@ -219,3 +264,50 @@ void MessageModel_Actions::OnExportToShapeView()
QMessageBox::information (0, "Information", QString ("TShapes '%1' are sent to %2 tool.")
.arg (anExportedPointers.join (", ")).arg (QString (aPluginName.ToCString())));
}
// =======================================================================
// function : OnTestAlerts
// purpose :
// =======================================================================
#include <OSD_Chronometer.hxx>
#include <ctime>
void MessageModel_Actions::OnTestAlerts()
{
#ifdef DEBUG_ALERTS
QModelIndex aReportIndex;
Handle(Message_Report) aReport = getSelectedReport (aReportIndex);
if (aReport.IsNull())
return;
Message_PerfMeter aPerfMeter;
MESSAGE_INFO ("MessageModel_Actions::OnTestAlerts()", "", &aPerfMeter, NULL);
unsigned int start_time = clock();
//Standard_Real aSystemSeconds, aCurrentSeconds;
//OSD_Chronometer::GetThreadCPU (aCurrentSeconds, aSystemSeconds);
Standard_Integer aCounter = 50000;
Standard_Real aValue = 0., aValue2 = 0.1;
for (int j = 0; j < aCounter; j++)
{
for (int i = 0; i < aCounter; i++)
{
aValue = (aValue * 2. + 3.) * 0.5 - 0.3 * 0.5;
Standard_Real aValue3 = aValue + aValue2 * 0.2;
//MESSAGE_INFO ("Calculate", aValue, &aPerfMeter, NULL);
}
}
((MessageModel_TreeModel*)mySelectionModel->model())->EmitLayoutChanged();
//Standard_Real aSystemSeconds1, aCurrentSeconds1;
//OSD_Chronometer::GetThreadCPU (aCurrentSeconds1, aSystemSeconds1);
//std::cout << aValue << std::endl;
//std::cout << "user time = " << aCurrentSeconds1 - aCurrentSeconds
// << ", system time = " << aSystemSeconds1 - aSystemSeconds << std::endl;
unsigned int end_time = clock();
std::cout << "clock() = " << end_time - start_time << std::endl;
#endif
}

View File

@@ -16,21 +16,19 @@
#ifndef MessageModel_Actions_H
#define MessageModel_Actions_H
#ifdef _MSC_VER
#pragma warning(disable : 4127 4718) // conditional expression is constant, recursive call has no side effects
#endif
#include <Standard.hxx>
#include <Standard_Transient.hxx>
#include <inspector/MessageModel_ActionType.hxx>
#include <inspector/TInspectorAPI_PluginParameters.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QObject>
#include <QMap>
#include <QModelIndexList>
#include <QPoint>
#include <QString>
#include <Standard_WarningsRestore.hxx>
class Message_Report;
class MessageModel_TreeModel;
@@ -78,9 +76,15 @@ public slots:
//! Set selected report active
void OnActivateReport();
//! Clears container of alerts of selected report
void OnClearReport();
//! Exports the first selected shape into ShapeViewer plugin.
void OnExportToShapeView();
//! Sending several alerts to check message-alert-tool mechanizm
void OnTestAlerts();
protected:
//! Returns report of selected tree view item if a report item is selected
//! \param theReportIndex tree model index of the found report

View File

@@ -18,18 +18,24 @@
#include <inspector/MessageModel_ItemRoot.hxx>
#include <inspector/MessageModel_ItemReport.hxx>
#include <inspector/MessageModel_Tools.hxx>
#include <inspector/ViewControl_Tools.hxx>
#include <inspector/ViewControl_TransientShape.hxx>
#include <inspector/TreeModel_Tools.hxx>
#include <Message_AlertExtended.hxx>
#include <Message_AttributeVectorOfReal.hxx>
#include <Message_AttributeVectorOfRealVec3.hxx>
#include <Message_AttributeObject.hxx>
#include <Message_AttributeVectorOfValues.hxx>
#include <Message_CompositeAlerts.hxx>
#include <Bnd_Box.hxx>
#include <TCollection_AsciiString.hxx>
#include <TopoDS_AlertWithShape.hxx>
#include <TopoDS_AlertAttribute.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QColor>
#include <QIcon>
#include <Standard_WarningsRestore.hxx>
// =======================================================================
// function : initValue
@@ -59,18 +65,19 @@ QVariant MessageModel_ItemAlert::initValue (const int theRole) const
}
Handle(Message_Alert) anAlert = getAlert();
if (anAlert.IsNull())
return QVariant();
// if the alert is composite, process the real alert
if (theRole == Qt::DecorationRole && Column() == 0)
{
if (anAlert->IsKind (STANDARD_TYPE (TopoDS_AlertWithShape)))
Handle(Message_AlertExtended) anExtAttribute = Handle(Message_AlertExtended)::DownCast (anAlert);
if (anExtAttribute.IsNull())
return QVariant();
Handle(Message_Attribute) anAttribute = anExtAttribute->Attribute();
if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
return QIcon (":/icons/item_shape.png");
else if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfReal)))
return QIcon (":/icons/item_vectorOfReal.png");
else if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfRealVec3)))
return QIcon (":/icons/item_vectorOfRealVec3.png");
else if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfValues)))
return QIcon (":/icons/item_vectorOfValues.png");
else
return QVariant();
}
@@ -140,17 +147,26 @@ int MessageModel_ItemAlert::initRowCount() const
if (aCompositeAlert.IsNull())
return GetUnitedAlerts().Size();
int aRowCount = 0;
NCollection_Vector<Message_ListOfAlert> aUnitedAlerts;
MessageModel_ItemAlert* aCurrentItem = (MessageModel_ItemAlert*)this;
for (int aGravityId = Message_Trace; aGravityId <= Message_Fail; aGravityId++)
{
const Message_ListOfAlert& anAlerts = aCompositeAlert->GetAlerts ((Message_Gravity)aGravityId);
if (isUniteAlerts())
GetUnitedAlerts (anAlerts, aUnitedAlerts);
{
MessageModel_Tools::GetUnitedAlerts (anAlerts, aCurrentItem->myChildAlerts);
}
else
aRowCount += anAlerts.Size();
{
for (Message_ListOfAlert::Iterator anIt(anAlerts); anIt.More(); anIt.Next())
{
Message_ListOfAlert aCurAlerts;
aCurAlerts.Append (anIt.Value());
aCurrentItem->myChildAlerts.Bind(myChildAlerts.Size(), aCurAlerts);
}
}
}
return isUniteAlerts() ? aUnitedAlerts.Size() : aRowCount;
return aCurrentItem->myChildAlerts.Size();
}
// =======================================================================
@@ -170,90 +186,51 @@ void MessageModel_ItemAlert::Init()
{
MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport> (Parent());
MessageModel_ItemAlertPtr anAlertItem;
Handle(Message_Report) aReport;
Handle(Message_Alert) anAlert;
if (aReportItem)
aReport = aReportItem->GetReport();
{
Message_ListOfAlert anAlerts;
if (aReportItem->GetChildAlerts (Row(), anAlerts))
{
if (anAlerts.Size() == 1)
myAlert = anAlerts.First();
else
myUnitedAlerts = anAlerts;
}
}
else
{
anAlertItem = itemDynamicCast<MessageModel_ItemAlert> (Parent());
if (anAlertItem)
anAlert = anAlertItem->GetAlert();
}
if (aReport.IsNull() && anAlert.IsNull() && !anAlertItem)
return;
if (anAlert.IsNull() && anAlertItem) // union folder item
{
int aCurrentSubId = 0;
for (Message_ListOfAlert::Iterator anAlertsIt (anAlertItem->GetUnitedAlerts()); anAlertsIt.More();
anAlertsIt.Next(), aCurrentSubId++)
{
if (aCurrentSubId != Row())
continue;
myAlert = anAlertsIt.Value();
MessageModel_ItemBase::Init();
return;
}
return;
}
// iterates through all gravity types, skip types where report is empty, if report is not empty, increment
// current index until it equal to the current row index
Message_ListOfAlert anAlerts;
NCollection_Vector<Message_ListOfAlert> aUnitedAlerts;
int aRowId = Row();
int aPreviousAlertsCount = 0;
for (int aGravityId = Message_Trace; aGravityId <= Message_Fail; aGravityId++)
{
if (!aReport.IsNull())
anAlerts = aReport->GetAlerts ((Message_Gravity)aGravityId);
else if (!anAlert.IsNull())
{
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(anAlert);
Handle(Message_CompositeAlerts) aCompositeAlert = !anExtendedAlert.IsNull() ? anExtendedAlert->GetCompositeAlerts()
: Handle(Message_CompositeAlerts)();
if (!aCompositeAlert.IsNull())
anAlerts = aCompositeAlert->GetAlerts ((Message_Gravity)aGravityId);
}
if (isReversed())
anAlerts.Reverse();
if (isUniteAlerts())
{
GetUnitedAlerts (anAlerts, aUnitedAlerts);
if (aRowId < aUnitedAlerts.Size())
Message_ListOfAlert anAlerts;
if (anAlertItem->GetChildAlerts (Row(), anAlerts))
{
anAlerts = aUnitedAlerts.Value (aRowId);
if (anAlerts.Size() == 1)
myAlert = anAlerts.First();
else
myUnitedAlerts = anAlerts;
MessageModel_ItemBase::Init();
return;
}
}
else
{
if (aRowId < aPreviousAlertsCount + anAlerts.Size())
{
aRowId = aRowId - aPreviousAlertsCount;
int aCurrentId = 0;
for (Message_ListOfAlert::Iterator anAlertsIt (anAlerts); anAlertsIt.More(); anAlertsIt.Next(), aCurrentId++)
{
if (aCurrentId != Row())
continue;
myAlert = anAlertsIt.Value();
MessageModel_ItemBase::Init();
return;
}
}
aPreviousAlertsCount += anAlerts.Size();
}
}
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(myAlert);
if (!anExtendedAlert.IsNull() && !anExtendedAlert->Attribute().IsNull())
{
Handle(Message_Attribute) anAttribute = anExtendedAlert->Attribute();
if (!anAttribute.IsNull())
{
if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeObject)))
myPresentations.Append (Handle(Message_AttributeObject)::DownCast (anAttribute)->GetObject());
if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
myPresentations.Append (new ViewControl_TransientShape (Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape()));
}
TCollection_AsciiString aDescription = anExtendedAlert->Attribute()->GetDescription();
Bnd_Box aBox;
if (aBox.FromString (aDescription))
myPresentations.Append (new ViewControl_TransientShape (ViewControl_Tools::CreateShape (aBox)));
}
MessageModel_ItemBase::Init();
}
// =======================================================================
@@ -265,6 +242,8 @@ void MessageModel_ItemAlert::Reset()
MessageModel_ItemBase::Reset();
myAlert = Handle(Message_Alert)();
myUnitedAlerts.Clear();
myChildAlerts.Clear();
myPresentations.Clear();
}
// =======================================================================
@@ -314,29 +293,3 @@ double MessageModel_ItemAlert::AmountElapsedTime(const Handle(Message_Alert)& th
return anAmountTime;
}
// =======================================================================
// function : GetUnitedAlerts
// purpose :
// =======================================================================
void MessageModel_ItemAlert::GetUnitedAlerts(const Message_ListOfAlert& theAlerts,
NCollection_Vector<Message_ListOfAlert>& theUnitedAlerts)
{
//theUnitedAlerts.Clear();
TCollection_AsciiString anAlertMessageKey;
for (Message_ListOfAlert::Iterator anAlertsIt (theAlerts); anAlertsIt.More(); anAlertsIt.Next())
{
Handle(Message_Alert) anAlert = anAlertsIt.Value();
if (anAlertMessageKey.IsEqual (anAlert->GetMessageKey())) {
Message_ListOfAlert anAlerts = theUnitedAlerts.Last();
anAlerts.Append (anAlert);
theUnitedAlerts.SetValue(theUnitedAlerts.Size()-1, anAlerts);
}
else {
Message_ListOfAlert anAlerts;
anAlerts.Append (anAlert);
theUnitedAlerts.Append (anAlerts);
anAlertMessageKey = anAlert->GetMessageKey();
}
}
}

View File

@@ -20,12 +20,16 @@
#include <Message_Alert.hxx>
#include <Message_ListOfAlert.hxx>
#include <Message_Report.hxx>
#include <NCollection_DataMap.hxx>
#include <Standard.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QMap>
#include <QVariant>
#include <Standard_WarningsRestore.hxx>
#include <NCollection_List.hxx>
#include <NCollection_Vector.hxx>
class QAbstractTableModel;
@@ -53,6 +57,9 @@ public:
//! Returns the current shape
const Handle(Message_Alert)& GetAlert() const { return myAlert; }
//! Returns alert of the report for the parameter row
Standard_Boolean GetChildAlerts (const int theRow, Message_ListOfAlert& theAlerts) const { return myChildAlerts.Find(theRow, theAlerts); }
//! Returns united alerts or empty list
const Message_ListOfAlert& GetUnitedAlerts() const { return myUnitedAlerts; }
@@ -78,17 +85,19 @@ public:
//! \return instance of the shape
const TopoDS_Shape& GetCustomShape() const { return myCustomShape; }
//! Returns presentation of the attribute to be visualized in the view
//! \param theRow a model index row
//! \param theColumn a model index column
//! \thePresentations [out] container of presentation handles to be visualized
void GetPresentations (NCollection_List<Handle(Standard_Transient)>& thePresentations)
{ thePresentations.Append (myPresentations); }
//! Returns summ of children alert elapsed times. The method is recusive.
//! \param theAlert a message alert
//! \return double value
Standard_EXPORT static double AmountElapsedTime (const Handle(Message_Alert)& theAlert);
//! Returns alerts united by Message Key
//! \param theAlerts source message alert
//! \param theUnitedAlerts arranged source message alerts
Standard_EXPORT static void GetUnitedAlerts (const Message_ListOfAlert& theAlerts,
NCollection_Vector<Message_ListOfAlert> & theUnitedAlerts);
protected:
//! Initialize the current item. It is empty because Reset() is also empty.
@@ -122,7 +131,11 @@ private:
private:
Handle(Message_Alert) myAlert;
Message_ListOfAlert myUnitedAlerts;
NCollection_DataMap<Standard_Integer, Message_ListOfAlert> myChildAlerts; //!< container of child alerts
TopoDS_Shape myCustomShape;
NCollection_List<Handle(Standard_Transient)> myPresentations;
};
#endif

View File

@@ -15,12 +15,16 @@
#include <inspector/MessageModel_ItemReport.hxx>
#include <inspector/MessageModel_ItemRoot.hxx>
#include <inspector/MessageModel_ItemAlert.hxx>
#include <inspector/MessageModel_ItemReportProperties.hxx>
#include <inspector/MessageModel_ItemRoot.hxx>
#include <inspector/MessageModel_Tools.hxx>
#include <OSD_Path.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QColor>
#include <Standard_WarningsRestore.hxx>
// =======================================================================
// function : initValue
@@ -84,20 +88,25 @@ int MessageModel_ItemReport::initRowCount() const
if (aReport.IsNull())
return 0;
int aRowCount = 0;
NCollection_Vector<Message_ListOfAlert> aUnitedAlerts;
MessageModel_ItemReport* aCurrentItem = (MessageModel_ItemReport*)this;
for (int aGravityId = Message_Trace; aGravityId <= Message_Fail; aGravityId++)
{
const Message_ListOfAlert& anAlerts = aReport->GetAlerts ((Message_Gravity)aGravityId);
if (isUniteAlerts())
{
MessageModel_ItemAlert::GetUnitedAlerts (anAlerts, aUnitedAlerts);
aRowCount += aUnitedAlerts.Size();
MessageModel_Tools::GetUnitedAlerts (anAlerts, aCurrentItem->myChildAlerts);
}
else
aRowCount += anAlerts.Size();
{
for (Message_ListOfAlert::Iterator anIt(anAlerts); anIt.More(); anIt.Next())
{
Message_ListOfAlert aCurAlerts;
aCurAlerts.Append (anIt.Value());
aCurrentItem->myChildAlerts.Bind(myChildAlerts.Size(), aCurAlerts);
}
}
}
return isUniteAlerts() ? aUnitedAlerts.Size() : aRowCount;
return aCurrentItem->myChildAlerts.Size();
}
// =======================================================================
@@ -117,6 +126,11 @@ void MessageModel_ItemReport::Init()
{
MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (Parent());
myReport = aRootItem ? aRootItem->GetReport (Row(), myDescription) : Handle(Message_Report)();
TreeModel_ItemBasePtr anItem = Parent()->Child (Row(), Column(), false);
SetProperties (new MessageModel_ItemReportProperties(anItem));
MessageModel_ItemBase::Init();
}
// =======================================================================
@@ -137,6 +151,7 @@ void MessageModel_ItemReport::Reset()
{
MessageModel_ItemBase::Reset();
myReport = Handle(Message_Report)();
myChildAlerts.Clear();
}
// =======================================================================
@@ -189,3 +204,24 @@ double MessageModel_ItemReport::AmountElapsedTime (const Handle(Message_Report)&
}
return anAmountTime;
}
// =======================================================================
// function : FindReport
// purpose :
// =======================================================================
Handle(Message_Report) MessageModel_ItemReport::FindReport (const MessageModel_ItemBasePtr& theItem)
{
Handle(Message_Report) aReport;
MessageModel_ItemBasePtr anItem = theItem;
while (anItem)
{
MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport>(anItem);
if (aReportItem)
return aReportItem->GetReport();
anItem = itemDynamicCast<MessageModel_ItemBase>(anItem->Parent());
}
return NULL;
}

View File

@@ -19,10 +19,14 @@
#include <inspector/MessageModel_ItemBase.hxx>
#include <Standard.hxx>
#include <TCollection_AsciiString.hxx>
#include <Message_Alert.hxx>
#include <Message_Report.hxx>
#include <NCollection_DataMap.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QMap>
#include <QVariant>
#include <Standard_WarningsRestore.hxx>
class MessageModel_ItemReport;
typedef QExplicitlySharedDataPointer<MessageModel_ItemReport> MessageModel_ItemReportPtr;
@@ -47,6 +51,10 @@ public:
//! Returns the current shape
const Handle(Message_Report)& GetReport() const { return myReport; }
//! Returns alert of the report for the parameter row
Standard_Boolean GetChildAlerts (const int theRow, Message_ListOfAlert& theAlerts) const { return myChildAlerts.Find(theRow, theAlerts); }
//! Returns the report description or NULL
const TCollection_AsciiString& GetDescription() const { return myDescription; }
//! Inits the item, fills internal containers
@@ -72,6 +80,9 @@ public:
//! \return double value
Standard_EXPORT static double AmountElapsedTime (const Handle(Message_Report)& theReport);
//! Returns report of the item
static Handle(Message_Report) FindReport (const MessageModel_ItemBasePtr& thetItem);
protected:
//! Initialize the current item. It is empty because Reset() is also empty.
@@ -99,6 +110,8 @@ private:
private:
NCollection_DataMap<Standard_Integer, Message_ListOfAlert> myChildAlerts; //!< container of child alerts
Handle(Message_Report) myReport; //!< current report
TCollection_AsciiString myDescription; //!< description
};

View File

@@ -0,0 +1,102 @@
// Created on: 2019-02-25
// Created by: Natalia ERMOLAEVA
// Copyright (c) 2019 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/MessageModel_ItemReportProperties.hxx>
#include <inspector/MessageModel_ItemReport.hxx>
#include <inspector/ShapeView_ItemShape.hxx>
#include <inspector/ShapeView_Tools.hxx>
#include <inspector/ViewControl_Tools.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QApplication>
#include <QFont>
#include <Standard_WarningsRestore.hxx>
IMPLEMENT_STANDARD_RTTIEXT(MessageModel_ItemReportProperties, TreeModel_ItemProperties)
// =======================================================================
// function : RowCount
// purpose :
// =======================================================================
int MessageModel_ItemReportProperties::GetTableRowCount() const
{
return 1;
}
// =======================================================================
// function : Data
// purpose :
// =======================================================================
QVariant MessageModel_ItemReportProperties::GetTableData (const int theRow, const int theColumn, int theRole) const
{
if (theRole != Qt::DisplayRole)
return QVariant();
Handle(Message_Report) aReport = getItemReport();
switch (theRow)
{
case 0: return theColumn == 0 ? QVariant ("Limit") : QVariant (aReport->GetLimit());
default: break;
}
return QVariant();
}
// =======================================================================
// function : GetTableEditType
// purpose :
// =======================================================================
ViewControl_EditType MessageModel_ItemReportProperties::GetTableEditType (const int theRow, const int) const
{
switch (theRow)
{
case 0: return ViewControl_EditType_Spin;
default: return ViewControl_EditType_None;
}
}
// =======================================================================
// function : SetTableData
// purpose :
// =======================================================================
bool MessageModel_ItemReportProperties::SetTableData (const int theRow, const int theColumn, const QVariant& theValue)
{
Handle(Message_Report) aReport = getItemReport();
switch (theRow)
{
case 0: aReport->SetLimit (theValue.toInt()); break;
default: break;
}
return true;
}
// =======================================================================
// function : getItemReport
// purpose :
// =======================================================================
Handle(Message_Report) MessageModel_ItemReportProperties::getItemReport() const
{
MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport>(getItem());
if (!aReportItem)
return NULL;
return aReportItem->GetReport();
}

View File

@@ -0,0 +1,83 @@
// Created on: 2019-02-25
// Created by: Natalia ERMOLAEVA
// Copyright (c) 2019 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 MessageModel_ItemReportProperties_H
#define MessageModel_ItemReportProperties_H
#include <Standard.hxx>
#include <Message_Report.hxx>
#include <inspector/TreeModel_ItemProperties.hxx>
#include <inspector/TreeModel_ItemBase.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QAbstractTableModel>
#include <QColor>
#include <QList>
#include <QModelIndexList>
#include <QVariant>
#include <Standard_WarningsRestore.hxx>
class QItemDelegate;
DEFINE_STANDARD_HANDLE (MessageModel_ItemReportProperties, TreeModel_ItemProperties)
//! \class MessageModel_ItemReportProperties
//! \brief This is an interace for ViewControl_TableModel to give real values of the model
//! It should be filled or redefined.
class MessageModel_ItemReportProperties : public TreeModel_ItemProperties
{
public:
//! Constructor
Standard_EXPORT MessageModel_ItemReportProperties (TreeModel_ItemBasePtr theItem)
: TreeModel_ItemProperties (theItem) {}
//! Destructor
virtual ~MessageModel_ItemReportProperties() {}
//! Returns number of rows, depending on orientation: myColumnCount or size of values container
//! \param theParent an index of the parent item
//! \return an integer value
Standard_EXPORT virtual int GetTableRowCount() const Standard_OVERRIDE;
//! Returns content of the model index for the given role, it is obtained from internal container of values
//! It returns value only for DisplayRole.
//! \param theRow a model index row
//! \param theColumn a model index column
//! \param theRole a view role
//! \return value intepreted depending on the given role
Standard_EXPORT virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole = Qt::DisplayRole) 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 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 int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT (MessageModel_ItemReportProperties, TreeModel_ItemProperties)
protected:
//! Returns report
Handle(Message_Report) getItemReport() const;
};
#endif

View File

@@ -51,6 +51,21 @@ const Handle(Message_Report)& MessageModel_ItemRoot::GetReport (const int theRow
return aReportsIt.Value().myReport;
}
// =======================================================================
// function : HasReport
// purpose :
// =======================================================================
Standard_Boolean MessageModel_ItemRoot::HasReport (const Handle(Message_Report)& theReport)
{
NCollection_List<MessageModel_ReportInformation>::Iterator aReportsIt (myReports);
for (int aRowId = 0; aReportsIt.More(); aReportsIt.Next(), aRowId++)
{
if (aReportsIt.Value().myReport == theReport)
return Standard_True;
}
return Standard_False;
}
// =======================================================================
// function : initValue
// purpose :

View File

@@ -66,6 +66,11 @@ public:
Standard_EXPORT void SetReport (const int theRowId, const Handle(Message_Report)& theReport,
const TCollection_AsciiString& theReportDescription = "");
//! Returns true if report exists is in the list of the current reports
//! \param theReport a report instance
//! \return boolen value
Standard_EXPORT Standard_Boolean HasReport (const Handle(Message_Report)& theReport);
//! Clears internal container of added reports
void RemoveAllReports() { myReports.Clear(); }

View File

@@ -36,7 +36,7 @@ public:
// Interface to be implemented in the child to process the message report event
// \theAlert updated alert
virtual void Update(const Handle(Message_Alert)& theAlert) { (void)theAlert; myCommunicator->UpdateContent(); }
virtual void Update(const Handle(Message_Alert)& theAlert) { (void)theAlert; /*myCommunicator->UpdateContent();*/ }
// OCCT RTTI
DEFINE_STANDARD_RTTIEXT(MessageModel_ReportCallBack, Message_ReportCallBack)

View File

@@ -1,106 +0,0 @@
// 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/MessageModel_TableModelRealValues.hxx>
#include <inspector/ViewControl_TableModel.hxx>
const int REAL_SIGNS = 16;
// =======================================================================
// function : Constructor
// purpose :
// =======================================================================
MessageModel_TableModelRealValues::MessageModel_TableModelRealValues (const Handle(Message_Attribute)& theAttribute,
const int theSectionWidth)
: myAttribute (Handle(Message_AttributeVectorOfReal)::DownCast (theAttribute))
{
SetUseTableProperties (true);
SetUseTablePropertiesXStep (true, -1);
SetDefaultSectionSize (Qt::Horizontal, theSectionWidth);
}
// =======================================================================
// function : ColumnCount
// purpose :
// =======================================================================
int MessageModel_TableModelRealValues::ColumnCount (const QModelIndex&) const
{
return myAttribute->GetValues().Length();
}
// =======================================================================
// function : Data
// purpose :
// =======================================================================
QVariant MessageModel_TableModelRealValues::Data (const int, const int theColumn, int theRole) const
{
if (theRole == Qt::DisplayRole && theColumn < myAttribute->GetValues().Length())
{
return myAttribute->GetValues().Value(theColumn);
}
return QVariant();
}
// =======================================================================
// function : GetRangeValues
// purpose :
// =======================================================================
void MessageModel_TableModelRealValues::GetRangeValues (QString& theMinValue, QString& theMaxValue, const QModelIndexList& theSelected) const
{
double aMinValue, aMaxValue;
aMinValue = DBL_MAX;
aMaxValue = DBL_MIN;
NCollection_Vector<double> aValues = myAttribute->GetValues();
int aValuesSize = aValues.Length();
if (aValuesSize < 1)
return;
if (theSelected.isEmpty())
{
aMinValue = aMaxValue = aValues.First();
for (int i = 1; i < aValuesSize; i++)
{
double aValue = aValues.Value (i);
if (aValue < aMinValue) aMinValue = aValue;
if (aValue > aMaxValue) aMaxValue = aValue;
}
}
else
{
ViewControl_TableModel* aModel = (ViewControl_TableModel*)theSelected[0].model();
int aRow, aColumn;
for (QModelIndexList::const_iterator aSelIt = theSelected.begin(); aSelIt != theSelected.end(); aSelIt++)
{
aModel->GetSourcePosition (*aSelIt, aRow, aColumn);
if (aColumn >= aValuesSize)
continue;
double aValue = aValues.Value (aColumn);
if (aValue < aMinValue) aMinValue = aValue;
if (aValue > aMaxValue) aMaxValue = aValue;
}
}
theMinValue = QString::number(aMinValue, 'g', REAL_SIGNS);
theMaxValue = QString::number(aMaxValue, 'g', REAL_SIGNS);
}

View File

@@ -1,122 +0,0 @@
// 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/MessageModel_TableModelRealVec3Values.hxx>
#include <inspector/ViewControl_TableModel.hxx>
// =======================================================================
// function : Constructor
// purpose :
// =======================================================================
MessageModel_TableModelRealVec3Values::MessageModel_TableModelRealVec3Values (const Handle(Message_Attribute)& theAttribute,
const int theSectionWidth)
: myAttribute (Handle(Message_AttributeVectorOfRealVec3)::DownCast (theAttribute))
{
SetUseTableProperties (true);
SetDefaultSectionSize (Qt::Horizontal, theSectionWidth);
}
// =======================================================================
// function : ColumnCount
// purpose :
// =======================================================================
int MessageModel_TableModelRealVec3Values::ColumnCount (const QModelIndex&) const
{
return myAttribute->GetValues().Length();
}
// =======================================================================
// function : Data
// purpose :
// =======================================================================
QVariant MessageModel_TableModelRealVec3Values::Data (const int, const int theColumn, int theRole) const
{
if (theRole != Qt::DisplayRole || theColumn > myAttribute->GetValues().Length())
return QVariant();
NCollection_Vec3<double> aValue = myAttribute->GetValues().Value(theColumn);
return QString ("%1, %2, %3").arg (aValue.x()).arg (aValue.y()).arg (aValue.z());
}
// =======================================================================
// function : GetRangeValues
// purpose :
// =======================================================================
void MessageModel_TableModelRealVec3Values::GetRangeValues (QString& theMinValue, QString& theMaxValue,
const QModelIndexList& theSelected) const
{
theMinValue = DBL_MAX;
theMaxValue = DBL_MIN;
QList<int> aValuePositions;
if (!theSelected.isEmpty())
{
ViewControl_TableModel* aModel = (ViewControl_TableModel*)theSelected[0].model();
int aRow, aColumn;
for (QModelIndexList::const_iterator aSelIt = theSelected.begin(); aSelIt != theSelected.end(); aSelIt++)
{
aModel->GetSourcePosition (*aSelIt, aRow, aColumn);
aValuePositions.append (aColumn);
}
}
NCollection_Vector<NCollection_Vec3<double>> aValues = myAttribute->GetValues();
int aValuesSize = aValues.Length();
if (aValuesSize < 1)
return;
double aXMinValue = aValues.First().x(), aXMaxValue = aValues.First().x();
NCollection_Vec3<double> aValue;
for (int i = 1; i < aValuesSize; i++)
{
if (!aValuePositions.empty() && !aValuePositions.contains (i))
continue;
aValue = aValues.Value (i);
if (aValue.x() < aXMinValue) aXMinValue = aValue.x();
if (aValue.x() > aXMaxValue) aXMaxValue = aValue.x();
}
double anYMinValue = aValues.First().y(), anYMaxValue = aValues.First().y();
for (int i = 1; i < aValuesSize; i++)
{
if (!aValuePositions.empty() && !aValuePositions.contains (i))
continue;
aValue = aValues.Value (i);
if (aValue.x() == aXMinValue && aValue.y() < anYMinValue) anYMinValue = aValue.y();
if (aValue.x() == aXMaxValue && aValue.y() > anYMaxValue) anYMaxValue = aValue.y();
}
double aZMinValue = aValues.First().z(), aZMaxValue = aValues.First().z();
for (int i = 1; i < aValuesSize; i++)
{
if (!aValuePositions.empty() && !aValuePositions.contains (i))
continue;
aValue = aValues.Value (i);
if (aValue.x() == aXMinValue && aValue.y() == anYMinValue && aValue.z() < aZMinValue) aZMinValue = aValue.z();
if (aValue.x() == aXMaxValue && aValue.y() == anYMaxValue && aValue.z() > aZMaxValue) aZMaxValue = aValue.z();
}
theMinValue = QString ("%1, %2, %3").arg (aXMinValue).arg (anYMinValue).arg (aZMinValue);
theMaxValue = QString ("%1, %2, %3").arg (aXMaxValue).arg (anYMaxValue).arg (aZMaxValue);
}

View File

@@ -1,67 +0,0 @@
// 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 MessageModel_TableModelRealVec3Values_H
#define MessageModel_TableModelRealVec3Values_H
#ifdef _MSC_VER
#pragma warning(disable : 4127 4718) // conditional expression is constant, recursive call has no side effects
#endif
#include <inspector/ViewControl_TableModelValues.hxx>
#include <Message_AttributeVectorOfRealVec3.hxx>
//! \class MessageModel_TableModelRealVec3Values
//! \brief This is an implementation for ViewControl_TableModel to present Message_AttributeVectorOfRealVec3 object
class MessageModel_TableModelRealVec3Values : public ViewControl_TableModelValues
{
public:
//! Constructor
Standard_EXPORT MessageModel_TableModelRealVec3Values (const Handle(Message_Attribute)& theAttribute, const int theSectionWidth);
//! Destructor
virtual ~MessageModel_TableModelRealVec3Values() Standard_OVERRIDE {}
//! Returns number of columns, size of header values
//! \param theParent an index of the parent item
//! \return an integer value
Standard_EXPORT virtual int ColumnCount (const QModelIndex& theParent = QModelIndex()) const;
//! Returns number of rows, depending on orientation: myColumnCount or size of values container
//! \param theParent an index of the parent item
//! \return an integer value
virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const { (void)theParent; return 1; }
//! Returns content of the model index for the given role, it is obtained from internal container of values
//! It returns value only for DisplayRole.
//! \param theIndex a model index
//! \param theRole a view role
//! \return value intepreted depending on the given role
Standard_EXPORT virtual QVariant Data (const int theRow, const int theColumn, int theRole = Qt::DisplayRole) const;
//! Returns minimum and maximum values of selected items or the table content (if selected list is empty)
//! It finds firstly Xmax, then Ymax, after that Zmax. The same for min values.
//! \param theMinValue minimum
//! \param theMaxValue maximum
//! \param theSelected selected cells
virtual void GetRangeValues (QString& theMinValue, QString& theMaxValue, const QModelIndexList& theSelected) const;
private:
Handle(Message_AttributeVectorOfRealVec3) myAttribute; //!< alert attribute, container of table values
};
#endif

View File

@@ -0,0 +1,75 @@
// 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/MessageModel_TableModelValues.hxx>
#include <inspector/ViewControl_TableModel.hxx>
#include <Message_AttributeVectorOfValues.hxx>
const int REAL_SIGNS = 16;
// =======================================================================
// function : Constructor
// purpose :
// =======================================================================
MessageModel_TableModelValues::MessageModel_TableModelValues (const Handle(Message_Attribute)& theAttribute,
const int theSectionWidth)
: myAttribute (Handle(Message_AttributeVectorOfValues)::DownCast (theAttribute))
{
SetDefaultSectionSize (Qt::Horizontal, theSectionWidth);
}
// =======================================================================
// function : ColumnCount
// purpose :
// =======================================================================
int MessageModel_TableModelValues::ColumnCount (const QModelIndex&) const
{
return myAttribute->GetColumnCount();
}
// =======================================================================
// function : RowCount
// purpose :
// =======================================================================
int MessageModel_TableModelValues::RowCount (const QModelIndex& theParent) const
{
int aColumnCount = ColumnCount (theParent);
if (!aColumnCount)
return 0;
return myAttribute->GetValues().Length() / aColumnCount;
}
// =======================================================================
// function : Data
// purpose :
// =======================================================================
QVariant MessageModel_TableModelValues::Data (const int theRow, const int theColumn, int theRole) const
{
int aColumnCount = ColumnCount (QModelIndex());
int anIndex = theRow * aColumnCount + theColumn;
if (theRole == Qt::DisplayRole && anIndex < myAttribute->GetValues().Length())
{
return myAttribute->GetValues().Value(anIndex).ToCString();
}
return QVariant();
}

View File

@@ -13,28 +13,25 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef MessageModel_TableModelRealValues_H
#define MessageModel_TableModelRealValues_H
#ifdef _MSC_VER
#pragma warning(disable : 4127 4718) // conditional expression is constant, recursive call has no side effects
#endif
#ifndef MessageModel_TableModelValues_H
#define MessageModel_TableModelValues_H
#include <inspector/ViewControl_TableModelValues.hxx>
#include <Message_AttributeVectorOfReal.hxx>
#include <Message_Attribute.hxx>
class Message_AttributeVectorOfValues;
//! \class MessageModel_TableModelRealValues
//! \brief This is an implementation for ViewControl_TableModel to present Message_AttributeVectorOfReal object
class MessageModel_TableModelRealValues : public ViewControl_TableModelValues
//! \class MessageModel_TableModelValues
//! \brief This is an implementation for ViewControl_TableModel to present Message_AttributeVectorOfValues object
class MessageModel_TableModelValues : public ViewControl_TableModelValues
{
public:
//! Constructor
Standard_EXPORT MessageModel_TableModelRealValues (const Handle(Message_Attribute)& theAttribute, const int theSectionWidth);
Standard_EXPORT MessageModel_TableModelValues (const Handle(Message_Attribute)& theAttribute, const int theSectionWidth);
//! Destructor
virtual ~MessageModel_TableModelRealValues() Standard_OVERRIDE {}
virtual ~MessageModel_TableModelValues() Standard_OVERRIDE {}
//! Returns number of columns, size of header values
//! \param theParent an index of the parent item
@@ -44,7 +41,7 @@ public:
//! Returns number of rows, depending on orientation: myColumnCount or size of values container
//! \param theParent an index of the parent item
//! \return an integer value
virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const { (void)theParent; return 1; }
Standard_EXPORT virtual int RowCount (const QModelIndex& theParent) const;
//! Returns content of the model index for the given role, it is obtained from internal container of values
//! It returns value only for DisplayRole.
@@ -53,14 +50,8 @@ public:
//! \return value intepreted depending on the given role
Standard_EXPORT virtual QVariant Data (const int theRow, const int theColumn, int theRole = Qt::DisplayRole) const;
//! Returns minimum and maximum values of selected items or the table content (if selected list is empty)
//! \param theMinValue minimum
//! \param theMaxValue maximum
//! \param theSelected selected cells
virtual void GetRangeValues (QString& theMinValue, QString& theMaxValue, const QModelIndexList& theSelected) const;
private:
Handle(Message_AttributeVectorOfReal) myAttribute; //!< alert attribute, container of table values
Handle(Message_AttributeVectorOfValues) myAttribute; //!< alert attribute, container of table values
};
#endif

View File

@@ -14,11 +14,12 @@
// commercial license or contractual agreement.
#include <inspector/MessageModel_Tools.hxx>
#include <inspector/MessageModel_TableModelRealValues.hxx>
#include <inspector/MessageModel_TableModelRealVec3Values.hxx>
#include <inspector/MessageModel_ItemAlert.hxx>
#include <inspector/MessageModel_TableModelValues.hxx>
#include <inspector/ViewControl_Table.hxx>
#include <inspector/ViewControl_TableModelValues.hxx>
#include <inspector/ViewControl_TableModelValuesDefault.hxx>
#include <BRep_Builder.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
@@ -26,10 +27,10 @@
#include <BRepTools.hxx>
#include <Message_AlertExtended.hxx>
#include <Message_AttributeObject.hxx>
#include <Message_AttributeVectorOfReal.hxx>
#include <Message_AttributeVectorOfRealVec3.hxx>
#include <Message_AttributeVectorOfValues.hxx>
#include <Precision.hxx>
#include <TopoDS_AlertWithShape.hxx>
#include <TopoDS_AlertAttribute.hxx>
#include <TopoDS_Edge.hxx>
// =======================================================================
@@ -65,10 +66,18 @@ TCollection_AsciiString MessageModel_Tools::GetPointerInfo (const Handle(Standar
// =======================================================================
TCollection_AsciiString MessageModel_Tools::GetPointerAlertInfo (const Handle(Message_Alert)& theAlert)
{
if (theAlert->IsKind (STANDARD_TYPE (TopoDS_AlertWithShape)))
return GetPointerInfo (Handle(TopoDS_AlertWithShape)::DownCast (theAlert)->GetShape().TShape());
else if (theAlert->IsKind (STANDARD_TYPE (Message_AttributeObject)))
return GetPointerInfo (Handle(Message_AttributeObject)::DownCast (theAlert)->GetObject());
Handle(Message_AlertExtended) anExtAlert = Handle(Message_AlertExtended)::DownCast (theAlert);
if (anExtAlert.IsNull())
return TCollection_AsciiString();
Handle(Message_Attribute) anAttribute = anExtAlert->Attribute();
if (anAttribute.IsNull())
return TCollection_AsciiString();
if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
return GetPointerInfo (Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape().TShape());
else if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeObject)))
return GetPointerInfo (Handle(Message_AttributeObject)::DownCast (anAttribute)->GetObject());
return TCollection_AsciiString();
}
@@ -78,10 +87,17 @@ TCollection_AsciiString MessageModel_Tools::GetPointerAlertInfo (const Handle(Me
// =======================================================================
TCollection_AsciiString MessageModel_Tools::GetShapeTypeAlertInfo (const Handle(Message_Alert)& theAlert)
{
TopoDS_Shape aShape;
Handle(Message_AlertExtended) anExtAlert = Handle(Message_AlertExtended)::DownCast (theAlert);
if (anExtAlert.IsNull())
return TCollection_AsciiString();
if (theAlert->IsKind (STANDARD_TYPE (TopoDS_AlertWithShape)))
aShape = Handle(TopoDS_AlertWithShape)::DownCast (theAlert)->GetShape();
Handle(Message_Attribute) anAttribute = anExtAlert->Attribute();
if (anAttribute.IsNull())
return TCollection_AsciiString();
TopoDS_Shape aShape;
if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
aShape = Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape();
if (aShape.IsNull())
return TCollection_AsciiString();
@@ -98,11 +114,19 @@ TCollection_AsciiString MessageModel_Tools::GetShapeTypeAlertInfo (const Handle(
// =======================================================================
TCollection_AsciiString MessageModel_Tools::GetStandardTypeAlertInfo (const Handle(Message_Alert)& theAlert)
{
Handle(Message_AlertExtended) anExtAlert = Handle(Message_AlertExtended)::DownCast (theAlert);
if (anExtAlert.IsNull())
return TCollection_AsciiString();
Handle(Message_Attribute) anAttribute = anExtAlert->Attribute();
if (anAttribute.IsNull())
return TCollection_AsciiString();
Handle(Standard_Transient) aPointer;
if (theAlert->IsKind (STANDARD_TYPE (TopoDS_AlertWithShape)))
aPointer = Handle(TopoDS_AlertWithShape)::DownCast (theAlert)->GetShape().TShape();
else if (theAlert->IsKind (STANDARD_TYPE (Message_AttributeObject)))
aPointer = Handle(Message_AttributeObject)::DownCast (theAlert)->GetObject();
if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
aPointer = Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape().TShape();
else if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeObject)))
aPointer = Handle(Message_AttributeObject)::DownCast (anAttribute)->GetObject();
if (aPointer.IsNull())
return TCollection_AsciiString();
@@ -114,12 +138,24 @@ TCollection_AsciiString MessageModel_Tools::GetStandardTypeAlertInfo (const Hand
// function : GetPropertyTableValues
// purpose :
// =======================================================================
void MessageModel_Tools::GetPropertyTableValues (const Handle(Message_Alert)& theAlert,
void MessageModel_Tools::GetPropertyTableValues (const TreeModel_ItemBasePtr& theItem,
QList<ViewControl_TableModelValues*>& theTableValues)
{
ViewControl_TableModelValues* aTableValues = 0;
Handle(TreeModel_ItemProperties) anItemProperties = theItem->GetProperties();
if (!anItemProperties.IsNull())
{
ViewControl_TableModelValues* aTableValues = new ViewControl_TableModelValues();
aTableValues->SetProperties (anItemProperties);
theTableValues.append (aTableValues);
return;
}
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(theAlert);
MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert>(theItem);
if (!anAlertItem)
return;
const Handle(Message_Alert)& anAlert = anAlertItem->GetAlert();
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(anAlert);
if (anExtendedAlert.IsNull())
return;
@@ -127,23 +163,17 @@ void MessageModel_Tools::GetPropertyTableValues (const Handle(Message_Alert)& th
if (anAttribute.IsNull())
return;
if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfReal)))
if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfValues)))
{
int aSectionSize = 60;
aTableValues = new MessageModel_TableModelRealValues (anAttribute, aSectionSize);
theTableValues.append (aTableValues);
}
else if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfRealVec3)))
{
int aSectionSize = 160;
aTableValues = new MessageModel_TableModelRealVec3Values (anAttribute, aSectionSize);
int aSectionSize = 200;
ViewControl_TableModelValues* aTableValues = new MessageModel_TableModelValues (anAttribute, aSectionSize);
theTableValues.append (aTableValues);
}
else
{
if (!anAttribute->GetDescription().IsEmpty())
{
aTableValues = new ViewControl_TableModelValues();
ViewControl_TableModelValuesDefault* aTableValues = new ViewControl_TableModelValuesDefault();
QList<TreeModel_HeaderSection> aHeaderValues;
QVector<QVariant> aValues;
aHeaderValues << TreeModel_HeaderSection ("Description", -2);
@@ -166,74 +196,31 @@ void MessageModel_Tools::GetPropertyTableValues (const Handle(Message_Alert)& th
}
// =======================================================================
// function : BuildShape
// function : GetUnitedAlerts
// purpose :
// =======================================================================
TopoDS_Shape MessageModel_Tools::BuildShape (const Handle(Message_Alert)& theAlert, QList<int> theSelectedIndices, ViewControl_Table* theTable)
void MessageModel_Tools::GetUnitedAlerts(const Message_ListOfAlert& theAlerts,
NCollection_DataMap<Standard_Integer, Message_ListOfAlert>& theUnitedAlerts)
{
if (theAlert.IsNull())
return TopoDS_Shape();
BRep_Builder aBuilder;
TopoDS_Compound aCompound;
aBuilder.MakeCompound(aCompound);
if (theAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfReal)))
//theUnitedAlerts.Clear();
TCollection_AsciiString anAlertMessageKey;
Standard_Integer aRowIndex = 0;
Standard_Integer aCurIndex = 0;
for (Message_ListOfAlert::Iterator anAlertsIt (theAlerts); anAlertsIt.More(); anAlertsIt.Next())
{
Handle(Message_AttributeVectorOfReal) aValuesAlert = Handle(Message_AttributeVectorOfReal)::DownCast (theAlert);
NCollection_Vector<double> aValues = aValuesAlert->GetValues();
int aValuesSize = aValues.Size();
gp_Pnt aPreviousPoint(0, 0, 0), aCurrentPoint(0, 0, 0);
double aXStep = theTable->GetProperty()->GetXStep();
if (aXStep < 0)
aXStep = 1;
double aCurrentXValue = 0;
for (QList<int>::const_iterator anIt = theSelectedIndices.begin(); anIt != theSelectedIndices.end(); anIt++)
{
if (*anIt >= aValuesSize)
continue;
if (aCurrentXValue == 0)
{ //just define the previous point
aPreviousPoint.SetX (aCurrentXValue);
aPreviousPoint.SetY (aValues.Value (*anIt));
aCurrentXValue = aCurrentXValue + aXStep;
continue;
}
aCurrentPoint.SetX (aCurrentXValue);
aCurrentPoint.SetY (aValues.Value (*anIt));
if (aPreviousPoint.Distance (aCurrentPoint) < Precision::Confusion())
continue;
TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge (aPreviousPoint, aCurrentPoint);
aBuilder.Add (aCompound, anEdge);
aPreviousPoint = aCurrentPoint;
aCurrentXValue = aCurrentXValue + aXStep;
aCurIndex++;
Handle(Message_Alert) anAlert = anAlertsIt.Value();
if (anAlertMessageKey.IsEqual (anAlert->GetMessageKey())) {
Message_ListOfAlert anAlerts = theUnitedAlerts.Find(aRowIndex-1); // already in the map
anAlerts.Append (anAlert);
theUnitedAlerts.Bind(aRowIndex-1, anAlerts);
}
else {
Message_ListOfAlert anAlerts;
anAlerts.Append (anAlert);
theUnitedAlerts.Bind(aRowIndex, anAlerts);
aRowIndex++;
anAlertMessageKey = anAlert->GetMessageKey();
}
}
else if (theAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfRealVec3)))
{
Handle(Message_AttributeVectorOfRealVec3) aValuesAlert = Handle(Message_AttributeVectorOfRealVec3)::DownCast (theAlert);
NCollection_Vector<NCollection_Vec3<double>> aValues = aValuesAlert->GetValues();
int aValuesSize = aValues.Size();
gp_Pnt aCurrentPoint(0, 0, 0);
NCollection_Vec3<double> aValue;
for (QList<int>::const_iterator anIt = theSelectedIndices.begin(); anIt != theSelectedIndices.end(); anIt++)
{
if (*anIt >= aValuesSize)
continue;
aValue = aValues.Value (*anIt);
aCurrentPoint.SetX (aValue.x());
aCurrentPoint.SetY (aValue.y());
aCurrentPoint.SetZ (aValue.z());
TopoDS_Vertex aVertex = BRepBuilderAPI_MakeVertex (aCurrentPoint);
aBuilder.Add (aCompound, aVertex);
}
}
return aCompound;
}

View File

@@ -19,11 +19,17 @@
#include <Standard.hxx>
#include <TCollection_AsciiString.hxx>
#include <Message_ListOfAlert.hxx>
#include <NCollection_DataMap.hxx>
#include <NCollection_Vector.hxx>
#include <Standard_Transient.hxx>
#include <TopoDS_Shape.hxx>
#include <inspector/TreeModel_ItemBase.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QList>
//#include <QColor>
#include <Standard_WarningsRestore.hxx>
class Message_Alert;
class ViewControl_TableModelValues;
@@ -61,15 +67,14 @@ public:
//! Fills container of table values
//! \param theAlert a message alert
//! \param theTableValue container of values
Standard_EXPORT static void GetPropertyTableValues (const Handle(Message_Alert)& theAlert,
Standard_EXPORT static void GetPropertyTableValues (const TreeModel_ItemBasePtr& theItem,
QList<ViewControl_TableModelValues*>& theTableValues);
//! Creates TopoDS_Compound with TopoDS_Edge/Vertex on alert data
//! \param theAlert a message alert
//! \parm theSelectedIndices a container of indices
//! \param theTableView source view
Standard_EXPORT TopoDS_Shape static BuildShape (const Handle(Message_Alert)& theAlert, QList<int> aSelectedIndices,
ViewControl_Table* theTableView);
//! Returns alerts united by Message Key
//! \param theAlerts source message alert
//! \param theUnitedAlerts arranged source message alerts
Standard_EXPORT static void GetUnitedAlerts(const Message_ListOfAlert& theAlerts,
NCollection_DataMap<Standard_Integer, Message_ListOfAlert>& theUnitedAlerts);
};
#endif

View File

@@ -56,6 +56,19 @@ void MessageModel_TreeModel::createRootItem (const int theColumnId)
m_pRootItem = myRootItems[0];
}
// =======================================================================
// function : HasShape
// purpose :
// =======================================================================
Standard_Boolean MessageModel_TreeModel::HasReport (const Handle(Message_Report)& theReport)
{
if (columnCount() == 0)
return Standard_False;
MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (RootItem (0));
return aRootItem && aRootItem->HasReport (theReport);
}
// =======================================================================
// function : AddShape
// purpose :

View File

@@ -22,8 +22,10 @@
#include <Message_Report.hxx>
#include <inspector/TreeModel_ModelBase.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QMap>
#include <QObject>
#include <Standard_WarningsRestore.hxx>
class MessageModel_TreeModel;
@@ -39,6 +41,11 @@ public:
//! Destructor
virtual ~MessageModel_TreeModel() Standard_OVERRIDE {};
//! Returns true if parameter report was added into the model
//! \param theReport a report instance
//! \return boolen value
Standard_EXPORT Standard_Boolean HasReport (const Handle(Message_Report)& theReport);
//! Add shape, append it to the model root item
//! \param theReport a report instance
//! \param theReportDescription an additional report information

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

View File

@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="20"
height="20"
viewBox="0 0 5.2916664 5.2916666"
version="1.1"
id="svg8"
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
sodipodi:docname="item_vectorOfReal.svg"
inkscape:export-filename="D:\OCCT\master_CR29451_1\tools\MessageModel\icons\item_vectorOfRealVec3.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<defs
id="defs2">
<linearGradient
id="linearGradient4578"
osb:paint="solid">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop4576" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="-2.6544163 : -0.28690906 : 1"
inkscape:vp_y="0 : 1028.295 : 0"
inkscape:vp_z="9.504499 : -1.1228559 : 1"
inkscape:persp3d-origin="2.7661607 : -1.3768436 : 1"
id="perspective3711" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="15.839192"
inkscape:cx="-10.548151"
inkscape:cy="10.279721"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1446"
inkscape:window-height="838"
inkscape:window-x="1733"
inkscape:window-y="67"
inkscape:window-maximized="0"
units="px" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(71.966667,-93.642022)">
<rect
id="rect3769"
width="4.660512"
height="4.443356"
x="-71.632576"
y="94.056023"
style="opacity:1;fill:none;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.26458332;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
id="rect3769-3"
width="4.7041783"
height="2.2966287"
x="-71.676239"
y="96.202751"
style="opacity:1;fill:none;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.19110738;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
id="rect3769-9"
width="2.3560426"
height="4.4502382"
x="-71.617508"
y="94.071091"
style="opacity:1;fill:none;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.18826659;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@@ -17,8 +17,7 @@
#include <inspector/MessageModel_ItemAlert.hxx>
#include <Message_AlertExtended.hxx>
#include <Message_AttributeVectorOfReal.hxx>
#include <Message_AttributeVectorOfRealVec3.hxx>
#include <Message_AttributeVectorOfValues.hxx>
#include <TopoDS_AlertAttribute.hxx>
@@ -28,6 +27,15 @@
// =======================================================================
bool MessageView_VisibilityState::CanBeVisible (const QModelIndex& theIndex) const
{
MessageModel_ItemAlertPtr anAlertItem = getAlertItem (theIndex);
if (anAlertItem)
{
NCollection_List<Handle(Standard_Transient)> aPresentations;
anAlertItem->GetPresentations (aPresentations);
if (!aPresentations.IsEmpty())
return true;
}
return !getShape (theIndex).IsNull();// || hasTableValues (theIndex);
}
@@ -125,7 +133,7 @@ bool MessageView_VisibilityState::hasTableValues (const QModelIndex& theIndex) c
if (anAlert.IsNull())
return false;
if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfReal)) || anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfRealVec3)))
if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfValues)))
return true;
return false;

View File

@@ -29,13 +29,15 @@
#include <inspector/ViewControl_PropertyView.hxx>
#include <inspector/ViewControl_TableModelValues.hxx>
#include <inspector/ViewControl_TableProperty.hxx>
#include <inspector/ViewControl_TreeView.hxx>
#include <inspector/ViewControl_TransientShape.hxx>
#include <inspector/View_Tools.hxx>
#include <inspector/View_Viewer.hxx>
#include <inspector/View_Widget.hxx>
#include <AIS_Shape.hxx>
#include <Graphic3d_Camera.hxx>
#include <OSD_Environment.hxx>
#include <OSD_Directory.hxx>
@@ -99,6 +101,39 @@ const int MESSAGEVIEW_DEFAULT_TREE_VIEW_HEIGHT = 500;
const int MESSAGEVIEW_DEFAULT_VIEW_WIDTH = 200;// 400;
const int MESSAGEVIEW_DEFAULT_VIEW_HEIGHT = 300;// 1000;
#include <Prs3d_PointAspect.hxx>
#include <Prs3d_ShadingAspect.hxx>
Handle(Prs3d_Drawer) GetPreviewAttributes (const Handle(AIS_InteractiveContext)& theContext)
{
Handle(Prs3d_Drawer) myDrawer = new Prs3d_Drawer();
myDrawer->Link (theContext->DefaultDrawer());
Quantity_Color aColor(Quantity_NOC_TOMATO);//Quantity_NOC_GREENYELLOW));//Quantity_NOC_BLUE1));
Standard_ShortReal aTransparency = 0.8;
// point parameters
myDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_O_PLUS, aColor, 3.0));
// shading parameters
Graphic3d_MaterialAspect aShadingMaterial;
aShadingMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
aShadingMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
myDrawer->ShadingAspect()->SetColor (aColor);
myDrawer->ShadingAspect()->SetMaterial (aShadingMaterial);
myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency (aTransparency);
myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial() .SetTransparency (aTransparency);
myDrawer->SetTransparency (aTransparency);
// common parameters
myDrawer->SetZLayer (Graphic3d_ZLayerId_Topmost);
return myDrawer;
}
// =======================================================================
// function : Constructor
// purpose :
@@ -112,6 +147,7 @@ MessageView_Window::MessageView_Window (QWidget* theParent)
((ViewControl_TreeView*)myTreeView)->SetPredefinedSize (QSize (MESSAGEVIEW_DEFAULT_TREE_VIEW_WIDTH,
MESSAGEVIEW_DEFAULT_TREE_VIEW_HEIGHT));
MessageModel_TreeModel* aModel = new MessageModel_TreeModel (myTreeView);
//aModel->SetReversed (Standard_True);
for (int i = 5; i <= 7; i++) // hide shape parameters columns
{
TreeModel_HeaderSection anItem = aModel->GetHeaderItem (i);
@@ -217,7 +253,6 @@ void MessageView_Window::GetPreferences (TInspectorAPI_PreferencesDataMap& theIt
QMap<QString, QString> anItems;
TreeModel_Tools::SaveState (myTreeView, anItems);
View_Tools::SaveState (myViewWindow, anItems);
ViewControl_PropertyView::SaveState (myPropertyView, anItems);
for (QMap<QString, QString>::const_iterator anItemsIt = anItems.begin(); anItemsIt != anItems.end(); anItemsIt++)
theItem.Bind (anItemsIt.key().toStdString().c_str(), anItemsIt.value().toStdString().c_str());
@@ -243,8 +278,6 @@ void MessageView_Window::SetPreferences (const TInspectorAPI_PreferencesDataMap&
continue;
else if (View_Tools::RestoreState (myViewWindow, anItemIt.Key().ToCString(), anItemIt.Value().ToCString()))
continue;
else if (ViewControl_PropertyView::RestoreState (myPropertyView, anItemIt.Key().ToCString(), anItemIt.Value().ToCString()))
continue;
}
}
@@ -274,6 +307,13 @@ void MessageView_Window::UpdateContent()
myParameters->SetFileNames (aName, aNames);
isUpdated = true;
}
Handle(Message_Report) aDefaultReport = Message_Report::CurrentReport( Standard_False);
MessageModel_TreeModel* aViewModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
if (!aDefaultReport.IsNull() && !aViewModel->HasReport (aDefaultReport))
{
aDefaultReport->SetCallBack (myCallBack);
addReport (aDefaultReport);
}
// reload report of selected item
onReloadReport();
@@ -290,6 +330,7 @@ void MessageView_Window::Init (NCollection_List<Handle(Standard_Transient)>& the
NCollection_List<Handle(Standard_Transient)> aParameters;
Handle(Message_ReportCallBack) aReportCallBack;
Handle(Graphic3d_Camera) aViewCamera;
for (NCollection_List<Handle(Standard_Transient)>::Iterator aParamsIt (theParameters);
aParamsIt.More(); aParamsIt.Next())
@@ -301,23 +342,31 @@ void MessageView_Window::Init (NCollection_List<Handle(Standard_Transient)>& the
aMessageReport->SetCallBack (myCallBack);
addReport (aMessageReport);
}
else
else if (!Handle(AIS_InteractiveContext)::DownCast (anObject).IsNull())
{
aParameters.Append (anObject);
if (aContext.IsNull())
aContext = Handle(AIS_InteractiveContext)::DownCast (anObject);
}
else if (!Handle(Graphic3d_Camera)::DownCast (anObject).IsNull())
{
aViewCamera = Handle(Graphic3d_Camera)::DownCast (anObject);
}
}
QAbstractItemModel* aModel = myTreeView->model();
if (!aModel)
return;
MessageModel_TreeModel* aTreeModel = dynamic_cast<MessageModel_TreeModel*> (aModel);
MessageModel_TreeModel* aTreeModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
if (!aTreeModel)
return;
aTreeModel->EmitLayoutChanged();
if (!aContext.IsNull())
{
myContext = aContext;
myViewWindow->SetContext (View_ContextType_External, aContext);
}
if (!aViewCamera.IsNull())
myViewWindow->GetView()->GetViewer()->GetView()->Camera()->Copy (aViewCamera);
theParameters = aParameters;
}
@@ -381,6 +430,26 @@ void MessageView_Window::onTreeViewSelectionChanged (const QItemSelection&, cons
return;
updatePropertyPanelBySelection();
NCollection_List<Handle(Standard_Transient)> aPresentations;
MessageModel_ItemRootPtr aRootItem;
QModelIndexList aSelectedIndices = myTreeView->selectionModel()->selectedIndexes();
for (QModelIndexList::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
{
QModelIndex anIndex = *aSelIt;
if (anIndex.column() != 0)
continue;
TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
if (!anItemBase)
continue;
MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert>(anItemBase);
if (!anAlertItem)
continue;
anAlertItem->GetPresentations (aPresentations);
}
updatePreviewPresentation (aPresentations);
}
// =======================================================================
@@ -413,7 +482,16 @@ void MessageView_Window::onTreeViewContextMenuRequested (const QPoint& thePositi
break;
}
if (aRootItem)
{
aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Import Report"), SLOT (onImportReport()), myMainWindow, this));
// unite
MessageModel_TreeModel* aTreeModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
aMenu->addAction (ViewControl_Tools::CreateAction (aTreeModel->IsUniteAlerts() ? tr ("SetUniteAlerts - OFF") : tr ("SetUniteAlerts - ON"),
SLOT (onUniteAlerts()), myMainWindow, this));
// reversed
//aMenu->addAction (ViewControl_Tools::CreateAction (aTreeModel->IsReversed() ? tr ("SetReversed - OFF") : tr ("SetReversed - ON"),
// SLOT (onSetReversedAlerts()), myMainWindow, this));
}
else if (aReportItem)
{
aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Export Report"), SLOT (onExportReport()), myMainWindow, this));
@@ -484,7 +562,7 @@ void MessageView_Window::onPropertyViewSelectionChanged()
return;
}
TopoDS_Shape aShapeOfSelection = MessageModel_Tools::BuildShape (anAlertItem->GetAlert(), aSelectedIndices[0], aFirstTable);
/*TopoDS_Shape aShapeOfSelection = MessageModel_Tools::BuildShape (anAlertItem->GetAlert(), aSelectedIndices[0], aFirstTable);
if (aShapeOfSelection.IsNull())
return;
@@ -504,7 +582,7 @@ void MessageView_Window::onPropertyViewSelectionChanged()
{
anAlertItem->SetCustomShape (aShapeOfSelection);
aVisibilityState->SetVisible (anIndex, true);
}
}*/
}
// =======================================================================
@@ -559,6 +637,31 @@ void MessageView_Window::onImportReport()
openFile (TCollection_AsciiString (aFileName.toStdString().c_str()));
}
// =======================================================================
// function : onImportReport
// purpose :
// =======================================================================
void MessageView_Window::onUniteAlerts()
{
MessageModel_TreeModel* aTreeModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
Standard_Boolean isUniteAlerts = aTreeModel->IsUniteAlerts();
aTreeModel->SetUniteAlerts (!isUniteAlerts);
}
// =======================================================================
// function : onSetReversedAlerts
// purpose :
// =======================================================================
void MessageView_Window::onSetReversedAlerts()
{
MessageModel_TreeModel* aTreeModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
Standard_Boolean isReversed = aTreeModel->IsReversed();
aTreeModel->SetReversed (!isReversed);
}
// =======================================================================
// function : onReloadReport
// purpose :
@@ -604,12 +707,81 @@ void MessageView_Window::updatePropertyPanelBySelection()
if (!anItemBase)
return;
MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert>(anItemBase);
if (!anAlertItem)
return;
QList<ViewControl_TableModelValues*> aTableValues;
MessageModel_Tools::GetPropertyTableValues (anAlertItem->GetAlert(), aTableValues);
MessageModel_Tools::GetPropertyTableValues (anItemBase, aTableValues);
myPropertyView->Init (aTableValues);
}
// =======================================================================
// function : updatePreviewPresentation
// purpose :
// =======================================================================
void MessageView_Window::updatePreviewPresentation (const NCollection_List<Handle(Standard_Transient)>& thePresentations)
{
if (myContext.IsNull())
return;
Handle(AIS_InteractiveContext) aContext = myContext;
if (!myPreviewPresentations.IsEmpty())
{
for (NCollection_List<Handle(Standard_Transient)>::Iterator aDisplayedIt (myPreviewPresentations); aDisplayedIt.More(); aDisplayedIt.Next())
{
Handle(AIS_InteractiveObject) aPrs = Handle(AIS_InteractiveObject)::DownCast (aDisplayedIt.Value());
if (!aPrs.IsNull())
aContext->Remove (aPrs, Standard_True);
}
}
myPreviewPresentations.Clear();
myPreviewPresentations = thePresentations;
if (myPreviewPresentations.IsEmpty())
return;
BRep_Builder aBuilder;
TopoDS_Compound aCompound;
aBuilder.MakeCompound (aCompound);
for (NCollection_List<Handle(Standard_Transient)>::Iterator aDisplayedIt (myPreviewPresentations); aDisplayedIt.More(); aDisplayedIt.Next())
{
Handle(AIS_InteractiveObject) aPrs = Handle(AIS_InteractiveObject)::DownCast (aDisplayedIt.Value());
if (!aPrs.IsNull())
{
aContext->Display (aPrs, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
}
else if (!Handle(ViewControl_TransientShape)::DownCast (aDisplayedIt.Value()).IsNull())
{
Handle(ViewControl_TransientShape) aShapeObject = Handle(ViewControl_TransientShape)::DownCast (aDisplayedIt.Value());
aBuilder.Add (aCompound, aShapeObject->GetShape());
}
}
if (aCompound.IsNull())
{
if (!aContext.IsNull())
aContext->Remove (myPreviewPresentation, Standard_True);
myPreviewPresentation = NULL;
return;
}
else
{
if (myPreviewPresentation.IsNull())
{
myPreviewPresentation = new AIS_Shape (aCompound);
myPreviewPresentation->SetAttributes (GetPreviewAttributes(myContext));
//myPreviewPresentation->SetAttributes (myPreviewParameters->GetDrawer());
//myPreviewPresentation->SetTransformPersistence(thePersistent);
if (!aContext.IsNull())
aContext->Display (myPreviewPresentation, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
}
else
{
Handle(AIS_Shape)::DownCast (myPreviewPresentation)->Set (aCompound);
//myPreviewPresentation->SetTransformPersistence(thePersistent);
if (!aContext.IsNull())
aContext->Redisplay (myPreviewPresentation, Standard_True);
}
}
}

View File

@@ -21,9 +21,12 @@
#include <TCollection_AsciiString.hxx>
#include <inspector/MessageModel_Actions.hxx>
#include <inspector/TInspectorAPI_PluginParameters.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_InteractiveObject.hxx>
#include <TopoDS_Shape.hxx>
#ifdef _MSC_VER
#pragma warning(disable : 4127) // conditional expression is constant
#endif
@@ -145,6 +148,12 @@ protected slots:
//! Import report into document
void onImportReport();
//! Unite alerts in view model
void onUniteAlerts();
//! Sets report reversed
void onSetReversedAlerts();
//! Reads if possible report of a selected item and updates this report in tree view
void onReloadReport();
@@ -152,6 +161,10 @@ protected:
//! Updates property panel content by item selected in tree view.
void updatePropertyPanelBySelection();
//!< Updates presentation of preview for parameter shapes. Creates a compound of the shapes
//!< \param theShape container of shapes
void updatePreviewPresentation (const NCollection_List<Handle(Standard_Transient)>& thePresentations);
private:
QMainWindow* myMainWindow; //!< main control, parent for all MessageView controls
QDockWidget* myViewDockWidget; //!< view dock widget to hide/show
@@ -165,6 +178,10 @@ private:
Handle(TInspectorAPI_PluginParameters) myParameters; //!< plugins parameters container
Handle(Message_ReportCallBack) myCallBack; //! < message call back to update content of the view
Handle(AIS_InteractiveContext) myContext; //! current context
Handle(AIS_InteractiveObject) myPreviewPresentation; //!< presentation of preview for a selected object
NCollection_List<Handle(Standard_Transient)> myPreviewPresentations;
};
#endif

View File

@@ -1,7 +1,14 @@
ShapeView.qrc
ShapeView_Communicator.cxx
ShapeView_Communicator.hxx
ShapeView_ItemBase.cxx
ShapeView_ItemBase.hxx
ShapeView_ItemPropertiesEdge.cxx
ShapeView_ItemPropertiesEdge.hxx
ShapeView_ItemPropertiesFace.cxx
ShapeView_ItemPropertiesFace.hxx
ShapeView_ItemPropertiesVertex.cxx
ShapeView_ItemPropertiesVertex.hxx
ShapeView_ItemRoot.cxx
ShapeView_ItemRoot.hxx
ShapeView_ItemShape.cxx

View File

@@ -0,0 +1,35 @@
// 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/ShapeView_ItemBase.hxx>
// =======================================================================
// function : initValue
// purpose :
// =======================================================================
QVariant ShapeView_ItemBase::initValue (const int theItemRole) const
{
if (theItemRole != Qt::DisplayRole && theItemRole != Qt::ToolTipRole)
return QVariant();
switch (Column())
{
case 2: { return rowCount(); }
//case 3: return ViewControl_Tools::GetPointerInfo (GetObject(), true).ToCString();
case 4: { return Row(); }
}
return QVariant();
}

View File

@@ -32,6 +32,11 @@ public:
//! Resets cached values
virtual void Reset() Standard_OVERRIDE { TreeModel_ItemBase::Reset(); }
//! Return data value for the role.
//! \param theRole a value role
//! \return the value
Standard_EXPORT virtual QVariant initValue(const int theRole) const;
protected:
//! Initialize the current item. It creates a backup of the specific item information

View File

@@ -0,0 +1,146 @@
// Created on: 2019-02-25
// Created by: Natalia ERMOLAEVA
// Copyright (c) 2019 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/ShapeView_ItemPropertiesEdge.hxx>
#include <inspector/ShapeView_ItemShape.hxx>
#include <inspector/ShapeView_Tools.hxx>
#include <inspector/ViewControl_Tools.hxx>
#include <Adaptor3d_Curve.hxx>
#include <AIS_Shape.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepTools.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <Geom_Curve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QApplication>
#include <QFont>
#include <Standard_WarningsRestore.hxx>
IMPLEMENT_STANDARD_RTTIEXT(ShapeView_ItemPropertiesEdge, TreeModel_ItemProperties)
// =======================================================================
// function : RowCount
// purpose :
// =======================================================================
int ShapeView_ItemPropertiesEdge::GetTableRowCount() const
{
return ShapeView_Tools::GetShapeGlobalPropertiesCount() + 7;
}
// =======================================================================
// function : Data
// purpose :
// =======================================================================
#include <BRep_CurveRepresentation.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRep_TEdge.hxx>
QVariant ShapeView_ItemPropertiesEdge::GetTableData (const int theRow, const int theColumn, int theRole) const
{
if (theRole != Qt::DisplayRole)
return QVariant();
TopoDS_Shape aShape = getItemShape();
if (aShape.ShapeType() != TopAbs_EDGE)
return QVariant();
TopoDS_Edge anEdge = TopoDS::Edge(aShape);
double aFirst, aLast;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
GeomAdaptor_Curve aAdaptor(aCurve, aFirst, aLast);
gp_Pnt aFirstPnt = aAdaptor.Value(aFirst);
gp_Pnt aLastPnt = aAdaptor.Value(aLast);
BRepAdaptor_Curve aBRepAdaptor = BRepAdaptor_Curve(anEdge);
Adaptor3d_Curve* anAdaptor3d = &aBRepAdaptor;
bool isFirstColumn = theColumn == 0;
switch (theRow)
{
case 0: return isFirstColumn ? "Length" : QString::number (GCPnts_AbscissaPoint::Length(*anAdaptor3d));
case 1: return isFirstColumn ? "Geom_Curve" : aCurve->DynamicType()->Name();
case 2: return isFirstColumn ? "FirstPnt" : ViewControl_Tools::ToString (aFirstPnt).ToCString();
case 3: return isFirstColumn ? "LastPnt" : ViewControl_Tools::ToString (aLastPnt).ToCString();
case 4: return isFirstColumn ? "Continuity" : ShapeView_Tools::ToName (aCurve->Continuity());
case 5: return isFirstColumn ? "IsClosed" : ShapeView_Tools::ToString (aCurve->IsClosed());
case 6: return isFirstColumn ? "IsPeriodic" : aCurve->IsPeriodic() ? QString::number (aCurve->Period())
: ShapeView_Tools::ToString (aCurve->IsPeriodic());
default: break;
}
int anOwnRows = 7;
/*int aTableRow = theRow - anOwnRows;
// BRep_Tool::PolygonOnTriangulation // find the representation
TopoDS_Edge E = TopoDS::Edge(aShape);
Handle(Poly_PolygonOnTriangulation) P;
Handle(Poly_Triangulation) T;
TopLoc_Location L;
const BRep_TEdge* TE = static_cast<const BRep_TEdge*>(anEdge.TShape().get());
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
int aCurRow = 0;
while (itcr.More()) {
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
if (cr->IsPolygonOnTriangulation()) {
if (aCurRow < aTableRow)
continue;
const BRep_PolygonOnTriangulation* PT =
static_cast<const BRep_PolygonOnTriangulation*>(cr.get());
P = PT->PolygonOnTriangulation();
T = PT->Triangulation();
L = E.Location() * PT->Location();
return isFirstColumn ? QVariant("Polygon: ") : P.;
}
itcr.Next();
}
L.Identity();
P.Nullify();
T.Nullify();
anOwnRows += aTableRow;
*/
return ShapeView_Tools::GetShapeGlobalProperties (aShape, theRow - anOwnRows, theColumn);
}
// =======================================================================
// function : getItemShape
// purpose :
// =======================================================================
TopoDS_Shape ShapeView_ItemPropertiesEdge::getItemShape() const
{
ShapeView_ItemShapePtr aShapeItem = itemDynamicCast<ShapeView_ItemShape>(getItem());
if (!aShapeItem)
return TopoDS_Shape();
return aShapeItem->GetItemShape();
}

View File

@@ -0,0 +1,72 @@
// Created on: 2019-02-25
// Created by: Natalia ERMOLAEVA
// Copyright (c) 2019 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 ShapeView_ItemPropertiesEdge_H
#define ShapeView_ItemPropertiesEdge_H
#include <Standard.hxx>
#include <TopoDS_Shape.hxx>
#include <inspector/TreeModel_ItemProperties.hxx>
#include <inspector/TreeModel_ItemBase.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QAbstractTableModel>
#include <QColor>
#include <QList>
#include <QModelIndexList>
#include <QVariant>
#include <Standard_WarningsRestore.hxx>
class QItemDelegate;
DEFINE_STANDARD_HANDLE (ShapeView_ItemPropertiesEdge, TreeModel_ItemProperties)
//! \class ShapeView_ItemPropertiesEdge
//! \brief This is an interace for ViewControl_TableModel to give real values of the model
//! It should be filled or redefined.
class ShapeView_ItemPropertiesEdge : public TreeModel_ItemProperties
{
public:
//! Constructor
Standard_EXPORT ShapeView_ItemPropertiesEdge (const TreeModel_ItemBasePtr& theItem)
: TreeModel_ItemProperties (theItem) {}
//! Destructor
virtual ~ShapeView_ItemPropertiesEdge() {}
//! Returns number of rows, depending on orientation: myColumnCount or size of values container
//! \param theParent an index of the parent item
//! \return an integer value
Standard_EXPORT virtual int GetTableRowCount() const Standard_OVERRIDE;
//! Returns content of the model index for the given role, it is obtained from internal container of values
//! It returns value only for DisplayRole.
//! \param theRow a model index row
//! \param theColumn a model index column
//! \param theRole a view role
//! \return value intepreted depending on the given role
Standard_EXPORT virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole = Qt::DisplayRole) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT (ShapeView_ItemPropertiesEdge, TreeModel_ItemProperties)
protected:
//! Returns item shape
TopoDS_Shape getItemShape() const;
};
#endif

View File

@@ -0,0 +1,66 @@
// Created on: 2019-02-25
// Created by: Natalia ERMOLAEVA
// Copyright (c) 2019 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/ShapeView_ItemPropertiesFace.hxx>
#include <inspector/ShapeView_ItemShape.hxx>
#include <inspector/ShapeView_Tools.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QApplication>
#include <QFont>
#include <Standard_WarningsRestore.hxx>
IMPLEMENT_STANDARD_RTTIEXT(ShapeView_ItemPropertiesFace, TreeModel_ItemProperties)
// =======================================================================
// function : RowCount
// purpose :
// =======================================================================
int ShapeView_ItemPropertiesFace::GetTableRowCount() const
{
return ShapeView_Tools::GetShapeGlobalPropertiesCount();
}
// =======================================================================
// function : Data
// purpose :
// =======================================================================
QVariant ShapeView_ItemPropertiesFace::GetTableData (const int theRow, const int theColumn, int theRole) const
{
if (theRole != Qt::DisplayRole)
return QVariant();
TopoDS_Shape aShape = getItemShape();
QVariant aValue = ShapeView_Tools::GetShapeGlobalProperties (aShape, theRow, theColumn);
return aValue;
}
// =======================================================================
// function : getItemShape
// purpose :
// =======================================================================
TopoDS_Shape ShapeView_ItemPropertiesFace::getItemShape() const
{
ShapeView_ItemShapePtr aShapeItem = itemDynamicCast<ShapeView_ItemShape>(getItem());
if (!aShapeItem)
return TopoDS_Shape();
return aShapeItem->GetItemShape();
}

View File

@@ -0,0 +1,72 @@
// Created on: 2019-02-25
// Created by: Natalia ERMOLAEVA
// Copyright (c) 2019 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 ShapeView_ItemPropertiesFace_H
#define ShapeView_ItemPropertiesFace_H
#include <Standard.hxx>
#include <TopoDS_Shape.hxx>
#include <inspector/TreeModel_ItemProperties.hxx>
#include <inspector/TreeModel_ItemBase.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QAbstractTableModel>
#include <QColor>
#include <QList>
#include <QModelIndexList>
#include <QVariant>
#include <Standard_WarningsRestore.hxx>
class QItemDelegate;
DEFINE_STANDARD_HANDLE (ShapeView_ItemPropertiesFace, TreeModel_ItemProperties)
//! \class ShapeView_ItemPropertiesFace
//! \brief This is an interace for ViewControl_TableModel to give real values of the model
//! It should be filled or redefined.
class ShapeView_ItemPropertiesFace : public TreeModel_ItemProperties
{
public:
//! Constructor
Standard_EXPORT ShapeView_ItemPropertiesFace (const TreeModel_ItemBasePtr& theItem)
: TreeModel_ItemProperties (theItem) {}
//! Destructor
virtual ~ShapeView_ItemPropertiesFace() {}
//! Returns number of rows, depending on orientation: myColumnCount or size of values container
//! \param theParent an index of the parent item
//! \return an integer value
Standard_EXPORT virtual int GetTableRowCount() const Standard_OVERRIDE;
//! Returns content of the model index for the given role, it is obtained from internal container of values
//! It returns value only for DisplayRole.
//! \param theRow a model index row
//! \param theColumn a model index column
//! \param theRole a view role
//! \return value intepreted depending on the given role
Standard_EXPORT virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole = Qt::DisplayRole) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT (ShapeView_ItemPropertiesFace, TreeModel_ItemProperties)
protected:
//! Returns item shape
TopoDS_Shape getItemShape() const;
};
#endif

View File

@@ -0,0 +1,74 @@
// Created on: 2019-02-25
// Created by: Natalia ERMOLAEVA
// Copyright (c) 2019 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/ShapeView_ItemPropertiesVertex.hxx>
#include <inspector/ShapeView_ItemShape.hxx>
#include <inspector/ShapeView_Tools.hxx>
#include <inspector/ViewControl_Tools.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QApplication>
#include <QFont>
#include <Standard_WarningsRestore.hxx>
IMPLEMENT_STANDARD_RTTIEXT(ShapeView_ItemPropertiesVertex, TreeModel_ItemProperties)
// =======================================================================
// function : RowCount
// purpose :
// =======================================================================
int ShapeView_ItemPropertiesVertex::GetTableRowCount() const
{
return ShapeView_Tools::GetShapeGlobalPropertiesCount() + 1;
}
// =======================================================================
// function : Data
// purpose :
// =======================================================================
QVariant ShapeView_ItemPropertiesVertex::GetTableData (const int theRow, const int theColumn, int theRole) const
{
if (theRole != Qt::DisplayRole)
return QVariant();
TopoDS_Shape aShape = getItemShape();
switch (theRow)
{
case 0: return theColumn == 0 ? "Vertex" : ViewControl_Tools::ToString (BRep_Tool::Pnt (TopoDS::Vertex (aShape))).ToCString();
default: break;
}
int anOwnRows = 1;
return ShapeView_Tools::GetShapeGlobalProperties (aShape, theRow - anOwnRows, theColumn);
}
// =======================================================================
// function : getItemShape
// purpose :
// =======================================================================
TopoDS_Shape ShapeView_ItemPropertiesVertex::getItemShape() const
{
ShapeView_ItemShapePtr aShapeItem = itemDynamicCast<ShapeView_ItemShape>(getItem());
if (!aShapeItem)
return TopoDS_Shape();
return aShapeItem->GetItemShape();
}

View File

@@ -0,0 +1,72 @@
// Created on: 2019-02-25
// Created by: Natalia ERMOLAEVA
// Copyright (c) 2019 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 ShapeView_ItemPropertiesVertex_H
#define ShapeView_ItemPropertiesVertex_H
#include <Standard.hxx>
#include <TopoDS_Shape.hxx>
#include <inspector/TreeModel_ItemProperties.hxx>
#include <inspector/TreeModel_ItemBase.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QAbstractTableModel>
#include <QColor>
#include <QList>
#include <QModelIndexList>
#include <QVariant>
#include <Standard_WarningsRestore.hxx>
class QItemDelegate;
DEFINE_STANDARD_HANDLE (ShapeView_ItemPropertiesVertex, TreeModel_ItemProperties)
//! \class ShapeView_ItemPropertiesVertex
//! \brief This is an interace for ViewControl_TableModel to give real values of the model
//! It should be filled or redefined.
class ShapeView_ItemPropertiesVertex : public TreeModel_ItemProperties
{
public:
//! Constructor
Standard_EXPORT ShapeView_ItemPropertiesVertex (const TreeModel_ItemBasePtr& theItem)
: TreeModel_ItemProperties (theItem) {}
//! Destructor
virtual ~ShapeView_ItemPropertiesVertex() {}
//! Returns number of rows, depending on orientation: myColumnCount or size of values container
//! \param theParent an index of the parent item
//! \return an integer value
Standard_EXPORT virtual int GetTableRowCount() const Standard_OVERRIDE;
//! Returns content of the model index for the given role, it is obtained from internal container of values
//! It returns value only for DisplayRole.
//! \param theRow a model index row
//! \param theColumn a model index column
//! \param theRole a view role
//! \return value intepreted depending on the given role
Standard_EXPORT virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole = Qt::DisplayRole) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT (ShapeView_ItemPropertiesVertex, TreeModel_ItemProperties)
protected:
//! Returns item shape
TopoDS_Shape getItemShape() const;
};
#endif

Some files were not shown because too many files have changed in this diff Show More