mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0029451: Information Message Alert to debug an algorithm or object functionality,
0030268: Inspectors - improvements in VInspector plugin Dump/Init implementation in OCCT object and parsing it in MessageView (VInspector later)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
TModelingData TKShapeView
|
||||
TModelingData TKShapeView TKMessageModel TKMessageView
|
||||
TVisualization TKView TKVInspector
|
||||
TApplicationFramework TKTreeModel TKTInspectorAPI TKDFBrowser
|
||||
TTool TKTInspector TKToolsDraw TInspectorEXE
|
108
src/AIS/AIS.cxx
108
src/AIS/AIS.cxx
@@ -82,6 +82,24 @@
|
||||
|
||||
const Standard_Real SquareTolerance = Precision::SquareConfusion();
|
||||
|
||||
namespace
|
||||
{
|
||||
static Standard_CString AIS_Table_PrintDisplayMode[2] =
|
||||
{
|
||||
"WIREFRAME", "SHADING"
|
||||
};
|
||||
|
||||
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 :
|
||||
@@ -1533,3 +1551,93 @@ void AIS::ComputeProjVertexPresentation (const Handle( Prs3d_Presentation )& aPr
|
||||
StdPrs_WFShape::Add (aPresentation, MakEd.Edge(), aDrawer);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DisplayModeToString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_CString AIS::DisplayModeToString (AIS_DisplayMode theType)
|
||||
{
|
||||
return AIS_Table_PrintDisplayMode[theType];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DisplayModeFromString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS::DisplayModeFromString (Standard_CString theTypeString,
|
||||
AIS_DisplayMode& theType)
|
||||
{
|
||||
TCollection_AsciiString aName (theTypeString);
|
||||
aName.UpperCase();
|
||||
for (Standard_Integer aTypeIter = 0; aTypeIter <= AIS_Shaded; ++aTypeIter)
|
||||
{
|
||||
Standard_CString aTypeName = AIS_Table_PrintDisplayMode[aTypeIter];
|
||||
if (aName == aTypeName)
|
||||
{
|
||||
theType = AIS_DisplayMode (aTypeIter);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//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;
|
||||
}
|
||||
|
@@ -17,6 +17,9 @@
|
||||
#ifndef _AIS_HeaderFile
|
||||
#define _AIS_HeaderFile
|
||||
|
||||
#include <AIS_DisplayStatus.hxx>
|
||||
#include <AIS_DisplayMode.hxx>
|
||||
#include <AIS_KindOfInteractive.hxx>
|
||||
#include <AIS_KindOfSurface.hxx>
|
||||
#include <Aspect_TypeOfLine.hxx>
|
||||
#include <Aspect_TypeOfMarker.hxx>
|
||||
@@ -203,6 +206,72 @@ 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 mode
|
||||
//! @return string identifier
|
||||
Standard_EXPORT static Standard_CString DisplayModeToString (AIS_DisplayMode theType);
|
||||
|
||||
//! Returns the display mode from the given string identifier (using case-insensitive comparison).
|
||||
//! @param theTypeString string identifier
|
||||
//! @return status type or AIS_WireFrame if string identifier is invalid
|
||||
static AIS_DisplayMode DisplayModeFromString (Standard_CString theTypeString)
|
||||
{
|
||||
AIS_DisplayMode aType = AIS_WireFrame;
|
||||
DisplayModeFromString (theTypeString, aType);
|
||||
return aType;
|
||||
}
|
||||
|
||||
//! Determines the display mode 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 DisplayModeFromString (const Standard_CString theTypeString,
|
||||
AIS_DisplayMode& theType);
|
||||
|
||||
//! 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
|
||||
|
@@ -98,7 +98,7 @@ void AIS_InteractiveObject::SetCappingStyle (const Handle(Graphic3d_AspectFillCa
|
||||
const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter);
|
||||
if (!aPrs3d.IsNull())
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation();
|
||||
const Handle(Graphic3d_Structure)& aStruct = aPrs3d;
|
||||
if (!aStruct.IsNull())
|
||||
{
|
||||
const Graphic3d_SequenceOfGroup& aGroups = aStruct->Groups();
|
||||
@@ -175,3 +175,27 @@ void AIS_InteractiveObject::SetAspect(const Handle(Prs3d_BasicAspect)& theAspect
|
||||
aGroup->SetGroupPrimitivesAspect (aTextAspect->Aspect());
|
||||
}
|
||||
}
|
||||
|
||||
const TCollection_AsciiString AIS_InteractiveObject_ClassName = "AIS_InteractiveObject";
|
||||
|
||||
// =======================================================================
|
||||
// function : Dump
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void AIS_InteractiveObject::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, AIS_InteractiveObject_ClassName);
|
||||
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
SelectMgr_SelectableObject::Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "SelectMgr_SelectableObject", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
|
||||
DUMP_VALUES (OS, "InteractiveContext", TCollection::GetPointerInfo (myCTXPtr));
|
||||
DUMP_VALUES (OS, "Owner", TCollection::GetPointerInfo (myOwner));
|
||||
DUMP_VALUES (OS, "CappingStyle", TCollection::GetPointerInfo (myCappingStyle));
|
||||
|
||||
DUMP_STOP_KEY (OS, AIS_InteractiveObject_ClassName);
|
||||
|
||||
}
|
||||
|
@@ -124,6 +124,9 @@ public:
|
||||
Standard_DEPRECATED("Deprecated method, results might be undefined")
|
||||
Standard_EXPORT void SetAspect (const Handle(Prs3d_BasicAspect)& anAspect);
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
//! The TypeOfPresention3d means that the interactive object
|
||||
|
452
src/Aspect/Aspect.cxx
Normal file
452
src/Aspect/Aspect.cxx
Normal 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
284
src/Aspect/Aspect.hxx
Normal 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
|
@@ -1,3 +1,5 @@
|
||||
Aspect.cxx
|
||||
Aspect.hxx
|
||||
Aspect_AspectFillAreaDefinitionError.hxx
|
||||
Aspect_AspectLineDefinitionError.hxx
|
||||
Aspect_AspectMarkerDefinitionError.hxx
|
||||
|
@@ -18,7 +18,9 @@
|
||||
|
||||
#include <BVH_Constants.hxx>
|
||||
#include <BVH_Types.hxx>
|
||||
#include <Message_Alerts.hxx>
|
||||
#include <Standard_ShortReal.hxx>
|
||||
#include <TCollection.hxx>
|
||||
|
||||
#include <limits>
|
||||
|
||||
@@ -108,6 +110,17 @@ 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());
|
||||
|
||||
OS << "Bnd_Box" << TCollection::DumpSeparator();
|
||||
BVH::ToBndBox (CornerMin(), CornerMax()).Dump (OS);
|
||||
OS << TCollection::DumpSeparator();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Checks if the Box is out of the other box.
|
||||
|
@@ -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,37 @@ 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);
|
||||
|
||||
OS << "Bnd_Box" << TCollection::DumpSeparator();
|
||||
BVH::ToBndBox (MinPoint (theNodeIndex), MaxPoint (theNodeIndex)).Dump (OS);
|
||||
OS << TCollection::DumpSeparator();
|
||||
|
||||
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.
|
||||
|
@@ -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;
|
||||
|
@@ -20,7 +20,10 @@
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <NCollection_List.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <TCollection.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
// set the flag to one
|
||||
#define ClearVoidFlag() ( Flags &= ~VoidMask )
|
||||
@@ -43,6 +46,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 +973,71 @@ void Bnd_Box::Dump () const
|
||||
std::cout << "\n Gap : " << Gap;
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PointsSeparator
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TCollection_AsciiString PointsSeparator()
|
||||
{
|
||||
return " - ";
|
||||
}
|
||||
|
||||
|
||||
const TCollection_AsciiString Bnd_Box_ClassName = "Bnd_Box";
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Bnd_Box::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, Bnd_Box_ClassName);
|
||||
|
||||
DUMP_VALUES (OS, "Xmin", Xmin);
|
||||
DUMP_VALUES (OS, "Ymin", Ymin);
|
||||
DUMP_VALUES (OS, "Zmin", Zmin);
|
||||
DUMP_VALUES (OS, "Xmax", Xmax);
|
||||
DUMP_VALUES (OS, "Ymax", Ymax);
|
||||
DUMP_VALUES (OS, "Zmax", Zmax);
|
||||
DUMP_VALUES (OS, "Gap", Gap);
|
||||
DUMP_VALUES (OS, "Flags", Flags);
|
||||
|
||||
DUMP_STOP_KEY (OS, Bnd_Box_ClassName);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Bnd_Box::Init (const Standard_SStream& OS)
|
||||
{
|
||||
NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aStreamValues;
|
||||
TCollection_AsciiString aKey;
|
||||
TCollection::Split (OS, aStreamValues, aKey);
|
||||
|
||||
TCollection_AsciiString aXmin, anYmin, aZmin, aXmax, anYmax, aZmax, aGap, aFlags;
|
||||
if (!aStreamValues.FindFromKey ("Xmin", aXmin) ||
|
||||
!aStreamValues.FindFromKey ("Ymin", anYmin) ||
|
||||
!aStreamValues.FindFromKey ("Zmin", aZmin) ||
|
||||
!aStreamValues.FindFromKey ("Xmax", aXmax) ||
|
||||
!aStreamValues.FindFromKey ("Ymax", anYmax) ||
|
||||
!aStreamValues.FindFromKey ("Zmax", aZmax) ||
|
||||
!aStreamValues.FindFromKey ("Gap", aGap) ||
|
||||
!aStreamValues.FindFromKey ("Flags", aFlags))
|
||||
return Standard_False;
|
||||
|
||||
Xmin = aXmin.RealValue();
|
||||
Ymin = anYmin.RealValue();
|
||||
Zmin = aZmin.RealValue();
|
||||
Xmax = aXmax.RealValue();
|
||||
Ymax = anYmax.RealValue();
|
||||
Zmax = aZmax.RealValue();
|
||||
|
||||
Gap = aGap.RealValue();
|
||||
Flags = aFlags.IntegerValue();
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -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,20 @@ public:
|
||||
&& Xmax >= Xmin;
|
||||
}
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT void Dump (Standard_OStream& OS) const;
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT Standard_Boolean Init (const Standard_SStream& OS);
|
||||
|
||||
//! Covers bounding box into string in format: (Xmin, Ymin, Zmin) - (Xmax, Ymax, Zmax)
|
||||
//! \return the string value
|
||||
Standard_EXPORT TCollection_AsciiString ToString() const { return ""; }
|
||||
|
||||
//! 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) { (void)theValue; return Standard_False; }
|
||||
|
||||
protected:
|
||||
|
||||
//! Bit flags.
|
||||
|
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <NCollection_Array1.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <TCollection.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
//! Auxiliary class to select from the points stored in
|
||||
@@ -992,3 +993,78 @@ void Bnd_OBB::Add(const Bnd_OBB& theOther)
|
||||
ReBuild(TColgp_Array1OfPnt(aList[0], 0, 15));
|
||||
}
|
||||
|
||||
const TCollection_AsciiString Bnd_OBB_ClassName = "Bnd_OBB";
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Bnd_OBB::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, Bnd_OBB_ClassName);
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myCenter.Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "Center", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myAxes[0].Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "XAxis", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myAxes[1].Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "YAxis", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myAxes[2].Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "ZAxis", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
|
||||
DUMP_VALUES (OS, "XHSize", XHSize());
|
||||
DUMP_VALUES (OS, "YHSize", YHSize());
|
||||
DUMP_VALUES (OS, "ZHSize", ZHSize());
|
||||
DUMP_VALUES (OS, "IsAABox", myIsAABox);
|
||||
|
||||
DUMP_STOP_KEY (OS, Bnd_OBB_ClassName);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Bnd_OBB::Init (const Standard_SStream& /*OS*/)
|
||||
{
|
||||
//NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString> aStreamValues;
|
||||
//TCollection::Split (OS, aStreamValues, aKey);
|
||||
|
||||
//TCollection_AsciiString anXYZValue;
|
||||
//if (aStreamValues.Size() == 1)
|
||||
//{
|
||||
// NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>::Iterator anIterator (aStreamValues);
|
||||
// TCollection_AsciiString aValueStr = anIterator.Value();
|
||||
// Standard_Integer aPosition = aValueStr.Search (Bnd_Box_ClassName + TCollection::ClassNameSeparator());
|
||||
// if (aPosition < 1)
|
||||
// return Standard_False;
|
||||
// anXYZValue = aValueStr.Split (aPosition);
|
||||
//}
|
||||
|
||||
//NCollection_Vector<Standard_Real> aValues;
|
||||
//if (!TCollection::SplitReal (anXYZValue, TCollection::VectorSeparator(), aValues))
|
||||
// return Standard_False;
|
||||
|
||||
//if (aValues.Size() != 8)
|
||||
// return Standard_False;
|
||||
|
||||
//Update (aValues.Value (1), aValues.Value (2), aValues.Value (3), aValues.Value (4), aValues.Value (5), aValues.Value (6));
|
||||
//Gap = aValues.Value (7);
|
||||
//Flags = (Standard_Integer)aValues.Value (8);
|
||||
|
||||
//return Standard_True;
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
@@ -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>
|
||||
@@ -281,6 +282,20 @@ public:
|
||||
//! (which it was created from) and theP.
|
||||
Standard_EXPORT void Add(const gp_Pnt& theP);
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT Standard_Boolean Init (const Standard_SStream& OS);
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT void Dump (Standard_OStream& OS) const;
|
||||
|
||||
//! Covers bounding box into string in format: (Xmin, Ymin, Zmin) - (Xmax, Ymax, Zmax)
|
||||
//! \return the string value
|
||||
Standard_EXPORT TCollection_AsciiString ToString() const { return ""; }
|
||||
|
||||
//! 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) { (void)theValue; return Standard_False; }
|
||||
|
||||
protected:
|
||||
|
||||
void ProcessOnePoint(const gp_Pnt& theP)
|
||||
|
@@ -174,4 +174,13 @@ 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 + "]";
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -1,3 +1,5 @@
|
||||
Font.cxx
|
||||
Font.hxx
|
||||
Font_BRepFont.cxx
|
||||
Font_BRepFont.hxx
|
||||
Font_BRepTextBuilder.cxx
|
||||
|
56
src/Font/Font.cxx
Normal file
56
src/Font/Font.cxx
Normal 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
54
src/Font/Font.hxx
Normal 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
|
@@ -1,3 +1,5 @@
|
||||
Graphic3d.cxx
|
||||
Graphic3d.hxx
|
||||
Graphic3d_AlphaMode.hxx
|
||||
Graphic3d_ArrayFlags.hxx
|
||||
Graphic3d_ArrayOfPoints.hxx
|
||||
@@ -112,6 +114,7 @@ Graphic3d_NameOfTexture2D.hxx
|
||||
Graphic3d_NameOfTextureEnv.hxx
|
||||
Graphic3d_NameOfTexturePlane.hxx
|
||||
Graphic3d_NMapOfTransient.hxx
|
||||
Graphic3d_PolygonOffset.cxx
|
||||
Graphic3d_PolygonOffset.hxx
|
||||
Graphic3d_PriorityDefinitionError.hxx
|
||||
Graphic3d_RenderingMode.hxx
|
||||
|
521
src/Graphic3d/Graphic3d.cxx
Normal file
521
src/Graphic3d/Graphic3d.cxx
Normal 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] =
|
||||
{
|
||||
"UNKNOWN", "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
327
src/Graphic3d/Graphic3d.hxx
Normal 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
|
@@ -12,6 +12,7 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Graphic3d_Aspects.hxx>
|
||||
#include <TCollection.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Aspects, Standard_Transient)
|
||||
|
||||
@@ -60,3 +61,69 @@ void Graphic3d_Aspects::SetTextureMap (const Handle(Graphic3d_TextureMap)& theTe
|
||||
|
||||
myTextureSet = new Graphic3d_TextureSet (theTexture);
|
||||
}
|
||||
|
||||
const TCollection_AsciiString Graphic3d_Aspects_ClassName = "Graphic3d_Aspects";
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Graphic3d_Aspects::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, Graphic3d_Aspects_ClassName);
|
||||
|
||||
/*Handle(Graphic3d_ShaderProgram) myProgram;
|
||||
Handle(Graphic3d_TextureSet) myTextureSet;
|
||||
Handle(Graphic3d_MarkerImage) myMarkerImage;
|
||||
Handle(Graphic3d_HatchStyle) myHatchStyle;
|
||||
Handle(TCollection_HAsciiString) myTextFont;
|
||||
Graphic3d_MaterialAspect myFrontMaterial;
|
||||
Graphic3d_MaterialAspect myBackMaterial;
|
||||
*/
|
||||
|
||||
Standard_SStream aTmpStream;
|
||||
myInteriorColor.Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "InteriorColor", TCollection::ToDumpString (aTmpStream));
|
||||
|
||||
aTmpStream.str ("");
|
||||
myBackInteriorColor.Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "BackInteriorColor", TCollection::ToDumpString (aTmpStream));
|
||||
|
||||
aTmpStream.str ("");
|
||||
myEdgeColor.Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "EdgeColor", TCollection::ToDumpString (aTmpStream));
|
||||
|
||||
aTmpStream.str ("");
|
||||
myPolygonOffset.Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "PolygonOffset", TCollection::ToDumpString (aTmpStream));
|
||||
|
||||
|
||||
/*Aspect_InteriorStyle myInteriorStyle;
|
||||
Graphic3d_TypeOfShadingModel myShadingModel;
|
||||
Graphic3d_AlphaMode myAlphaMode;
|
||||
Standard_ShortReal myAlphaCutoff;
|
||||
|
||||
Aspect_TypeOfLine myLineType;
|
||||
Standard_ShortReal myLineWidth;
|
||||
|
||||
Aspect_TypeOfMarker myMarkerType;
|
||||
Standard_ShortReal myMarkerScale;
|
||||
|
||||
Aspect_TypeOfStyleText myTextStyle;
|
||||
Aspect_TypeOfDisplayText myTextDisplayType;
|
||||
Font_FontAspect myTextFontAspect;
|
||||
Standard_ShortReal myTextAngle;
|
||||
*/
|
||||
|
||||
DUMP_VALUES (OS, "ToSkipFirstEdge", myToSkipFirstEdge);
|
||||
DUMP_VALUES (OS, "ToDistinguishMaterials", myToDistinguishMaterials);
|
||||
DUMP_VALUES (OS, "ToDrawEdges", myToDrawEdges);
|
||||
DUMP_VALUES (OS, "ToDrawSilhouette", myToDrawSilhouette);
|
||||
DUMP_VALUES (OS, "ToSuppressBackFaces", myToSuppressBackFaces);
|
||||
DUMP_VALUES (OS, "ToMapTexture", myToMapTexture);
|
||||
DUMP_VALUES (OS, "IsTextZoomable", myIsTextZoomable);
|
||||
|
||||
|
||||
DUMP_STOP_KEY (OS, Graphic3d_Aspects_ClassName);
|
||||
}
|
||||
|
@@ -477,6 +477,9 @@ public:
|
||||
&& myIsTextZoomable == theOther.myIsTextZoomable;
|
||||
}
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT void Dump (Standard_OStream& OS) const;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Graphic3d_ShaderProgram) myProgram;
|
||||
|
@@ -447,3 +447,22 @@ void Graphic3d_Group::AddText (const Handle(Graphic3d_Text)& theTextParams,
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
const TCollection_AsciiString Graphic3d_Group_ClassName = "Graphic3d_Group";
|
||||
|
||||
// =======================================================================
|
||||
// function : Dump
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_Group::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, Graphic3d_Group_ClassName);
|
||||
|
||||
//Graphic3d_Structure* myStructure; //!< pointer to the parent structure
|
||||
//Graphic3d_BndBox4f myBounds; //!< bounding box
|
||||
|
||||
DUMP_VALUES (OS, "IsClosed", myIsClosed);
|
||||
DUMP_VALUES (OS, "ContainsFacet", myContainsFacet);
|
||||
|
||||
DUMP_STOP_KEY (OS, Graphic3d_Group_ClassName);
|
||||
}
|
||||
|
@@ -280,6 +280,9 @@ public:
|
||||
const Standard_Boolean theHasOwnAnchor = Standard_True);
|
||||
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const;
|
||||
|
||||
protected:
|
||||
|
||||
//! Creates a group in the structure <AStructure>.
|
||||
|
35
src/Graphic3d/Graphic3d_PolygonOffset.cxx
Normal file
35
src/Graphic3d/Graphic3d_PolygonOffset.cxx
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2016 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_PolygonOffset.hxx>
|
||||
|
||||
#include <Aspect.hxx>
|
||||
#include <TCollection.hxx>
|
||||
|
||||
const TCollection_AsciiString Graphic3d_PolygonOffset_ClassName = "Graphic3d_PolygonOffset";
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Graphic3d_PolygonOffset::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, Graphic3d_PolygonOffset_ClassName);
|
||||
|
||||
DUMP_VALUES (OS, "Mode", Aspect::PolygonOffsetModeToString (Mode));
|
||||
DUMP_VALUES (OS, "Factor", Factor);
|
||||
DUMP_VALUES (OS, "Units", Units);
|
||||
|
||||
DUMP_STOP_KEY (OS, Graphic3d_PolygonOffset_ClassName);
|
||||
}
|
@@ -15,6 +15,7 @@
|
||||
#define _Graphic3d_PolygonOffset_HeaderFile
|
||||
|
||||
#include <Aspect_PolygonOffsetMode.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
|
||||
//! Polygon offset parameters.
|
||||
struct Graphic3d_PolygonOffset
|
||||
@@ -33,6 +34,10 @@ struct Graphic3d_PolygonOffset
|
||||
&& Factor == theOther.Factor
|
||||
&& Units == theOther.Units;
|
||||
}
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT void Dump (Standard_OStream& OS) const;
|
||||
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_PolygonOffset_HeaderFile
|
||||
|
@@ -1,8 +1,21 @@
|
||||
Message.cxx
|
||||
Message.hxx
|
||||
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.cxx
|
||||
Message_Attribute.hxx
|
||||
Message_AttributeObject.cxx
|
||||
Message_AttributeObject.hxx
|
||||
Message_AttributeStream.cxx
|
||||
Message_AttributeStream.hxx
|
||||
Message_CompositeAlerts.cxx
|
||||
Message_CompositeAlerts.hxx
|
||||
Message_ExecStatus.hxx
|
||||
Message_Gravity.hxx
|
||||
Message_HArrayOfMsg.hxx
|
||||
@@ -15,6 +28,9 @@ Message_Msg.hxx
|
||||
Message_Msg.lxx
|
||||
Message_MsgFile.cxx
|
||||
Message_MsgFile.hxx
|
||||
Message_PerfMeter.cxx
|
||||
Message_PerfMeter.hxx
|
||||
Message_PerfMeterMode.hxx
|
||||
Message_Printer.cxx
|
||||
Message_Printer.hxx
|
||||
Message_PrinterOStream.cxx
|
||||
@@ -32,8 +48,8 @@ Message_SequenceOfPrinters.hxx
|
||||
Message_SequenceOfProgressScale.hxx
|
||||
Message_Status.hxx
|
||||
Message_StatusType.hxx
|
||||
Message_Alert.cxx
|
||||
Message_Alert.hxx
|
||||
Message_ListOfAlert.hxx
|
||||
Message_Report.cxx
|
||||
Message_Report.hxx
|
||||
Message_ReportCallBack.cxx
|
||||
Message_ReportCallBack.hxx
|
||||
|
@@ -49,3 +49,342 @@ TCollection_AsciiString Message::FillTime (const Standard_Integer hour,
|
||||
Sprintf (t, "%.2fs", second);
|
||||
return TCollection_AsciiString (t);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
static Standard_CString Message_Table_PrintGravityEnum[5] =
|
||||
{
|
||||
"TRACE", "INFO", "WARNING", "ALARM", "FAIL"
|
||||
};
|
||||
|
||||
static Standard_CString Message_Table_PrintPerfMeterModeEnum[10] =
|
||||
{
|
||||
"NONE", "USER_TIME_CPU", "SYSTEM_TIME_CPU", "MEM_PRIVATE", "MEM_VIRTUAL",
|
||||
"MEM_WORKING_SET", "MEM_WORKING_SET_PEAK", "MEM_SWAP_USAGE", "MEM_SWAP_USAGE_PEAK", "MEM_HEAP_USAGE"
|
||||
};
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GravityToString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_CString Message::GravityToString (const Message_Gravity theGravity)
|
||||
{
|
||||
return Message_Table_PrintGravityEnum[theGravity];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GravityFromString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Message::GravityFromString (const Standard_CString theGravityString,
|
||||
Message_Gravity& theGravity)
|
||||
{
|
||||
TCollection_AsciiString aName (theGravityString);
|
||||
aName.UpperCase();
|
||||
for (Standard_Integer aGravityIter = 0; aGravityIter <= Message_Fail; ++aGravityIter)
|
||||
{
|
||||
Standard_CString aGravityName = Message_Table_PrintGravityEnum[aGravityIter];
|
||||
if (aName == aGravityName)
|
||||
{
|
||||
theGravity = Message_Gravity (aGravityIter);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PerfMeterModeToString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_CString Message::PerfMeterModeToString (const Message_PerfMeterMode theValue)
|
||||
{
|
||||
return Message_Table_PrintPerfMeterModeEnum[theValue];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PerfMeterModeFromString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Message::PerfMeterModeFromString (const Standard_CString theString,
|
||||
Message_PerfMeterMode& theValue)
|
||||
{
|
||||
TCollection_AsciiString aName (theString);
|
||||
aName.UpperCase();
|
||||
for (Standard_Integer aModeIter = 0; aModeIter <= Message_PerfMeterMode_MemHeapUsage; ++aModeIter)
|
||||
{
|
||||
Standard_CString aModeName = Message_Table_PrintPerfMeterModeEnum[aModeIter];
|
||||
if (aName == aModeName)
|
||||
{
|
||||
theValue = Message_PerfMeterMode (aModeIter);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
@@ -17,14 +17,19 @@
|
||||
#ifndef _Message_HeaderFile
|
||||
#define _Message_HeaderFile
|
||||
|
||||
#include <Message_Gravity.hxx>
|
||||
#include <Message_PerfMeterMode.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#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;
|
||||
@@ -59,8 +64,129 @@ public:
|
||||
//! 3. (0, 0, 4.5 ) returns "4.50s"
|
||||
Standard_EXPORT static TCollection_AsciiString FillTime (const Standard_Integer Hour, const Standard_Integer Minute, const Standard_Real Second);
|
||||
|
||||
//! Returns the string name for a given gravity.
|
||||
//! @param Gravity gravity type
|
||||
//! @return string identifier from the list Message_Trace, Message_Info, Message_Warning, Message_Alarm and Message_Fail
|
||||
Standard_EXPORT static Standard_CString GravityToString (const Message_Gravity theGravity);
|
||||
|
||||
//! Returns the gravity type from the given string identifier (using case-insensitive comparison).
|
||||
//! @param theGravityString string identifier
|
||||
//! @return gravity or Message_Trace if string identifier is invalid
|
||||
static Message_Gravity GravityFromString (const Standard_CString theGravityString)
|
||||
{
|
||||
Message_Gravity aGravity = Message_Trace;
|
||||
GravityFromString (theGravityString, aGravity);
|
||||
return aGravity;
|
||||
}
|
||||
|
||||
//! Determines the gravity from the given string identifier (using case-insensitive comparison).
|
||||
//! @param theGravityString string identifier
|
||||
//! @param theGravity detected shape type
|
||||
//! @return TRUE if string identifier is known
|
||||
Standard_EXPORT static Standard_Boolean GravityFromString (const Standard_CString theGravityString,
|
||||
Message_Gravity& theGravity);
|
||||
|
||||
//! Returns the string name for a perf meter mode.
|
||||
//! @param theValue mode
|
||||
//! @return string identifier
|
||||
Standard_EXPORT static Standard_CString PerfMeterModeToString (const Message_PerfMeterMode theValue);
|
||||
|
||||
//! Returns the enum value from the given string identifier (using case-insensitive comparison).
|
||||
//! @param theString string identifier
|
||||
//! @return enum or Message_PerfMeterMode_None if string identifier is invalid
|
||||
static Message_PerfMeterMode PerfMeterModeFromString (const Standard_CString theString)
|
||||
{
|
||||
Message_PerfMeterMode aValue = Message_PerfMeterMode_None;
|
||||
PerfMeterModeFromString (theString, aValue);
|
||||
return aValue;
|
||||
}
|
||||
|
||||
//! Returns the enum value from the given string identifier (using case-insensitive comparison).
|
||||
//! @param theString string identifier
|
||||
//! @return enum or Message_PerfMeterMode_None if string identifier is invalid
|
||||
//! @return TRUE if string identifier is known
|
||||
Standard_EXPORT static Standard_Boolean PerfMeterModeFromString (const Standard_CString theString,
|
||||
Message_PerfMeterMode& theValue);
|
||||
|
||||
|
||||
//! 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:
|
||||
|
||||
|
81
src/Message/Message_AlertExtended.cxx
Normal file
81
src/Message/Message_AlertExtended.cxx
Normal file
@@ -0,0 +1,81 @@
|
||||
// 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_AlertExtended.hxx>
|
||||
#include <Message_Attribute.hxx>
|
||||
#include <Message_CompositeAlerts.hxx>
|
||||
#include <Message_Report.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_Assert.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Message_AlertExtended,Message_Alert)
|
||||
|
||||
//=======================================================================
|
||||
//function : GetMessageKey
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_CString Message_AlertExtended::GetMessageKey () const
|
||||
{
|
||||
if (myAttribute.IsNull())
|
||||
return Message_Alert::GetMessageKey();
|
||||
|
||||
return myAttribute->GetMessageKey();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetCompositeAlerts
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle (Message_CompositeAlerts) Message_AlertExtended::GetCompositeAlerts (const Standard_Boolean isCreate)
|
||||
{
|
||||
if (myCompositAlerts.IsNull() && isCreate)
|
||||
myCompositAlerts = new Message_CompositeAlerts();
|
||||
|
||||
return myCompositAlerts;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsMetricValid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Message_AlertExtended::IsMetricValid() const
|
||||
{
|
||||
return fabs (myMetricStart - GetUndefinedMetric()) > Precision::Confusion() &&
|
||||
fabs (myMetricStop - GetUndefinedMetric()) > Precision::Confusion();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddAlert
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Message_Alert) Message_AlertExtended::AddAlert (const Handle(Message_Report)& theReport,
|
||||
const Handle(Message_Attribute)& theAttribute,
|
||||
Message_PerfMeter* thePerfMeter,
|
||||
const Handle(Message_Alert)& theParentAlert)
|
||||
{
|
||||
if (!theReport->IsActive (Message_Info))
|
||||
return Handle(Message_Alert)();
|
||||
|
||||
Handle(Message_AlertExtended) anAlert = new Message_AlertExtended();
|
||||
anAlert->SetAttribute (theAttribute);
|
||||
theReport->AddAlert (Message_Info, anAlert, thePerfMeter, theParentAlert);
|
||||
|
||||
return anAlert;
|
||||
}
|
133
src/Message/Message_AlertExtended.hxx
Normal file
133
src/Message/Message_AlertExtended.hxx
Normal file
@@ -0,0 +1,133 @@
|
||||
// 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_AlertExtended_HeaderFile
|
||||
#define _Message_AlertExtended_HeaderFile
|
||||
|
||||
#include <Message_Alert.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
class Message_Attribute;
|
||||
class Message_PerfMeter;
|
||||
class Message_Report;
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Message_AlertExtended, Message_Alert)
|
||||
|
||||
class Message_CompositeAlerts;
|
||||
|
||||
//! Inherited class of Message_Alert with some additional information.
|
||||
//!
|
||||
//! It has Message_Attributes to provide the alert name, description and
|
||||
//! other custom information
|
||||
//!
|
||||
//! It is possible to set performance meter into alert to store time/memory metric information
|
||||
//! spent between the next alert adding. Also time of child alerts are collected
|
||||
//!
|
||||
//! It has a container of composite alerts, if the alert might provide
|
||||
//! sub-alerts collecting.
|
||||
//!
|
||||
|
||||
class Message_AlertExtended : public Message_Alert
|
||||
{
|
||||
public:
|
||||
//! Empty constructor
|
||||
Standard_EXPORT Message_AlertExtended()
|
||||
: Message_Alert(), myMetricStart (GetUndefinedMetric()), myMetricStop (GetUndefinedMetric()) {}
|
||||
|
||||
//! Return a C string to be used as a key for generating text user
|
||||
//! messages describing this alert.
|
||||
//! The messages are generated with help of Message_Msg class, in
|
||||
//! Message_Report::Dump().
|
||||
//! Base implementation returns dynamic type name of the instance.
|
||||
virtual Standard_EXPORT Standard_CString GetMessageKey () const;
|
||||
|
||||
//! Sets container of the alert attributes
|
||||
//! \param theAttributes an attribute values
|
||||
void SetAttribute (const Handle(Message_Attribute)& theAttribute) { myAttribute = theAttribute; }
|
||||
|
||||
//! Returns container of the alert attributes
|
||||
//! \param theAttributes an attribute values
|
||||
const Handle(Message_Attribute)& Attribute () const { return myAttribute; }
|
||||
|
||||
//! Returns class provided hierarchy of alerts if created or create if the parameter is true
|
||||
//! \param isCreate if composite alert has not been created for this alert, it should be created
|
||||
//! \return instance or NULL
|
||||
Standard_EXPORT Handle (Message_CompositeAlerts) GetCompositeAlerts (const Standard_Boolean isCreate = Standard_False);
|
||||
|
||||
//! Returns performance meter
|
||||
//! \return instance or NULL
|
||||
Message_PerfMeter* GetPerfMeter() { return myPerfMeter; }
|
||||
|
||||
//! Returns true if metric is computed
|
||||
//! @return value
|
||||
Standard_EXPORT Standard_Boolean IsMetricValid() const;
|
||||
|
||||
//! Returns the alert cumulative metric. It includes time/mem of sub alerts
|
||||
//! @return value
|
||||
Standard_Real MetricStart() const { return myMetricStart; }
|
||||
|
||||
//! Returns the alert cumulative metric. It includes time/mem of sub alerts
|
||||
//! @return value
|
||||
Standard_Real MetricStop() const { return myMetricStop; }
|
||||
|
||||
//! Sets cumulative time/mem of alert
|
||||
//! \param theCumulativeMetric time/mem of the alert
|
||||
void SetMetricValues (const Standard_Real theStartValue, const Standard_Real theStopValue)
|
||||
{ myMetricStart = theStartValue; myMetricStop = theStopValue; }
|
||||
|
||||
//! Return true if this type of alert can be merged with other
|
||||
//! of the same type to avoid duplication.
|
||||
//! Basis implementation returns true.
|
||||
virtual Standard_EXPORT Standard_Boolean SupportsMerge () const { return Standard_False; }
|
||||
|
||||
//! Returns default value of the time/mem when it is not defined
|
||||
//! \return integer value
|
||||
static Standard_Real GetUndefinedMetric() { return -1.0; }
|
||||
|
||||
//! Creates new instance of the alert and put it into report with Message_Info gravity.
|
||||
//! It does nothing if such kind of gravity is not active in the report
|
||||
//! @param theReport the message report where new alert is placed
|
||||
//! @param theAttribute container of additional values of the alert
|
||||
//! @param thePerfMeter performance meter calculates the alert spent time and participate in searching the last alert if needed
|
||||
//! @param theParentAlert parent for the new alert, or alert is placed under the report
|
||||
//! @return created alert or NULL if Message_Info is not active in report
|
||||
static Standard_EXPORT Handle(Message_Alert) AddAlert (const Handle(Message_Report)& theReport,
|
||||
const Handle(Message_Attribute)& theAttribute,
|
||||
Message_PerfMeter* thePerfMeter,
|
||||
const Handle(Message_Alert)& theParentAlert = Handle(Message_Alert)());
|
||||
|
||||
// OCCT RTTI
|
||||
DEFINE_STANDARD_RTTIEXT(Message_AlertExtended, Message_Alert)
|
||||
|
||||
protected:
|
||||
//! Sets performance meter
|
||||
//! \param theMeter instance pointer or NULL
|
||||
void SetPerfMeter (Message_PerfMeter* theMeter) { myPerfMeter = theMeter; }
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Message_CompositeAlerts) myCompositAlerts; //!< class provided hierarchical structure of alerts
|
||||
//!< It should be created by an attempt of a child alert creation
|
||||
|
||||
Handle(Message_Attribute) myAttribute; //!< container of the alert attributes
|
||||
|
||||
Message_PerfMeter* myPerfMeter; //!< performance meter
|
||||
Standard_Real myMetricStart; //!< value on start metric computation
|
||||
Standard_Real myMetricStop; //!< value on stop metric computation
|
||||
|
||||
friend Message_PerfMeter;
|
||||
};
|
||||
|
||||
#endif // _Message_Alert_HeaderFile
|
102
src/Message/Message_Alerts.hxx
Normal file
102
src/Message/Message_Alerts.hxx
Normal 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_AttributeStream.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, 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_AttributeObject (Object, StreamValues, Name, Description), PerfMeter, ParentAlert ); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define MESSAGE_INFO_STREAM(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_AttributeStream (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
|
30
src/Message/Message_Attribute.cxx
Normal file
30
src/Message/Message_Attribute.cxx
Normal file
@@ -0,0 +1,30 @@
|
||||
// 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_Attribute.hxx>
|
||||
|
||||
#include <Standard_Assert.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Message_Attribute, Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
//function : GetMessageKey
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_CString Message_Attribute::GetMessageKey () const
|
||||
{
|
||||
return !myName.IsEmpty() ? myName.ToCString() : "";
|
||||
}
|
67
src/Message/Message_Attribute.hxx
Normal file
67
src/Message/Message_Attribute.hxx
Normal file
@@ -0,0 +1,67 @@
|
||||
// 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_Attribute_HeaderFile
|
||||
#define _Message_Attribute_HeaderFile
|
||||
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Message_Attribute, Standard_Transient)
|
||||
|
||||
//! Additional information of extended alert attribute
|
||||
//! To provide other custom attribute container, it might be redefined.
|
||||
class Message_Attribute : public Standard_Transient
|
||||
{
|
||||
public:
|
||||
//! Empty constructor
|
||||
Standard_EXPORT Message_Attribute (const TCollection_AsciiString& theName = TCollection_AsciiString(),
|
||||
const TCollection_AsciiString& theDescription = TCollection_AsciiString())
|
||||
: myName (theName), myDescription (theDescription) {}
|
||||
|
||||
//! Return a C string to be used as a key for generating text user
|
||||
//! messages describing this alert.
|
||||
//! The messages are generated with help of Message_Msg class, in
|
||||
//! Message_Report::Dump().
|
||||
//! Base implementation returns dynamic type name of the instance.
|
||||
virtual Standard_EXPORT Standard_CString GetMessageKey () const;
|
||||
|
||||
//! Returns custom name of alert if it is set
|
||||
//! @return alert name
|
||||
const TCollection_AsciiString& GetName() const { return myName; }
|
||||
|
||||
//! Sets the custom name of alert
|
||||
//! @param theName a name for the alert
|
||||
void SetName (const TCollection_AsciiString& theName) { myName = theName; }
|
||||
|
||||
//! Sets desription of alert
|
||||
//! @param theName a name for the alert
|
||||
void SetDescription (const TCollection_AsciiString& theDescription) { myDescription = theDescription; }
|
||||
|
||||
//! Returns description of alert if it is set
|
||||
//! @return alert description
|
||||
virtual const TCollection_AsciiString& GetDescription() const { return myDescription; }
|
||||
|
||||
// OCCT RTTI
|
||||
DEFINE_STANDARD_RTTIEXT(Message_Attribute, Standard_Transient)
|
||||
|
||||
private:
|
||||
|
||||
TCollection_AsciiString myName; //!< alert name, if defined is used in GetMessageKey
|
||||
TCollection_AsciiString myDescription; //!< alert description if defined
|
||||
|
||||
};
|
||||
|
||||
#endif // _Message_Attribute_HeaderFile
|
32
src/Message/Message_AttributeObject.cxx
Normal file
32
src/Message/Message_AttributeObject.cxx
Normal file
@@ -0,0 +1,32 @@
|
||||
// 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_AttributeObject.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeObject, Message_AttributeStream)
|
||||
|
||||
//=======================================================================
|
||||
//function : Message_AttributeObject
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Message_AttributeObject::Message_AttributeObject (const Handle(Standard_Transient)& theObject,
|
||||
const Standard_SStream& theStream,
|
||||
const TCollection_AsciiString& theName,
|
||||
const TCollection_AsciiString& theDescription)
|
||||
: Message_AttributeStream (theStream, theName, theDescription)
|
||||
{
|
||||
myObject = theObject;
|
||||
}
|
46
src/Message/Message_AttributeObject.hxx
Normal file
46
src/Message/Message_AttributeObject.hxx
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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_AttributeObject_HeaderFile
|
||||
#define _Message_AttributeObject_HeaderFile
|
||||
|
||||
#include <Message_AttributeStream.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
//! Alert object storing Transient object in its field
|
||||
class Message_AttributeObject : public Message_AttributeStream
|
||||
{
|
||||
public:
|
||||
//! Constructor with string argument
|
||||
Standard_EXPORT Message_AttributeObject (const Handle(Standard_Transient)& theObject,
|
||||
const Standard_SStream& theStream,
|
||||
const TCollection_AsciiString& theName = TCollection_AsciiString(),
|
||||
const TCollection_AsciiString& theDescription = TCollection_AsciiString());
|
||||
|
||||
//! Sets the object
|
||||
//! @param theObject an instance
|
||||
void SetObject (const Handle(Standard_Transient)& theObject) { myObject = theObject; }
|
||||
|
||||
//! Returns object
|
||||
Handle(Standard_Transient) GetObject() const { return myObject; }
|
||||
|
||||
// OCCT RTTI
|
||||
DEFINE_STANDARD_RTTIEXT(Message_AttributeObject, Message_AttributeStream)
|
||||
|
||||
private:
|
||||
Handle(Standard_Transient) myObject;
|
||||
};
|
||||
|
||||
#endif // _Message_AttributeObject_HeaderFile
|
47
src/Message/Message_AttributeStream.cxx
Normal file
47
src/Message/Message_AttributeStream.cxx
Normal file
@@ -0,0 +1,47 @@
|
||||
// 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_AttributeStream.hxx>
|
||||
|
||||
#include <Message.hxx>
|
||||
#include <Message_Msg.hxx>
|
||||
#include <Message_PerfMeter.hxx>
|
||||
#include <Message_Report.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeStream, Message_Attribute)
|
||||
|
||||
//=======================================================================
|
||||
//function : SetValues
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Message_AttributeStream::Message_AttributeStream (const Standard_SStream& theStream,
|
||||
const TCollection_AsciiString& theName,
|
||||
const TCollection_AsciiString& theDescription)
|
||||
: Message_Attribute(theName, theDescription)
|
||||
{
|
||||
SetStream (theStream);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetStream
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Message_AttributeStream::SetStream (const Standard_SStream& theStream)
|
||||
{
|
||||
TCollection_AsciiString aStreamStr (theStream.str().c_str());
|
||||
myStream << aStreamStr;
|
||||
}
|
||||
|
50
src/Message/Message_AttributeStream.hxx
Normal file
50
src/Message/Message_AttributeStream.hxx
Normal file
@@ -0,0 +1,50 @@
|
||||
// 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_AttributeStream_HeaderFile
|
||||
#define _Message_AttributeStream_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_AttributeStream : public Message_Attribute
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor with string argument
|
||||
Standard_EXPORT Message_AttributeStream (const Standard_SStream& theStream,
|
||||
const TCollection_AsciiString& theName = TCollection_AsciiString(),
|
||||
const TCollection_AsciiString& theDescription = TCollection_AsciiString());
|
||||
|
||||
//! Sets stream value
|
||||
Standard_EXPORT void SetStream (const Standard_SStream& theStream);
|
||||
|
||||
//! Returns stream value
|
||||
const Standard_SStream& GetStream() const { return myStream; }
|
||||
|
||||
// OCCT RTTI
|
||||
DEFINE_STANDARD_RTTIEXT(Message_AttributeStream, Message_Attribute)
|
||||
|
||||
private:
|
||||
Standard_SStream myStream; //!< container of values
|
||||
};
|
||||
|
||||
#endif // _Message_AttributeStream_HeaderFile
|
69
src/Message/Message_CompositeAlerts.cxx
Normal file
69
src/Message/Message_CompositeAlerts.cxx
Normal file
@@ -0,0 +1,69 @@
|
||||
// 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_CompositeAlerts.hxx>
|
||||
#include <Message_AlertExtended.hxx>
|
||||
#include <Standard_Assert.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Message_CompositeAlerts, Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
//function : Merge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Message_CompositeAlerts::Merge (const Handle(Message_Alert)& theTarget)
|
||||
{
|
||||
Handle(Message_AlertExtended) anExtAlert = Handle(Message_AlertExtended)::DownCast (theTarget);
|
||||
if (!anExtAlert.IsNull() && !anExtAlert->GetCompositeAlerts().IsNull())
|
||||
{
|
||||
Handle(Message_CompositeAlerts) anExtCompositeAlert = anExtAlert->GetCompositeAlerts();
|
||||
// hierarchical alerts can not be merged
|
||||
for (int iGravity = Message_Trace; iGravity <= Message_Fail; ++iGravity)
|
||||
{
|
||||
if (!GetAlerts ((Message_Gravity)iGravity).IsEmpty() ||
|
||||
!anExtCompositeAlert->GetAlerts ((Message_Gravity)iGravity).IsEmpty())
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
// by default, merge trivially
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetAlerts
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Message_ListOfAlert& Message_CompositeAlerts::GetAlerts (const Message_Gravity theGravity)
|
||||
{
|
||||
return myChildAlerts[theGravity];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasAlerts
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Message_CompositeAlerts::HasAlert (const Handle(Message_Alert)& theAlert)
|
||||
{
|
||||
for (int iGravity = Message_Trace; iGravity <= Message_Fail; ++iGravity)
|
||||
{
|
||||
Message_ListOfAlert& anAlerts = GetAlerts ((Message_Gravity)iGravity);
|
||||
if (anAlerts.Contains (theAlert))
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
67
src/Message/Message_CompositeAlerts.hxx
Normal file
67
src/Message/Message_CompositeAlerts.hxx
Normal file
@@ -0,0 +1,67 @@
|
||||
// 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_CompositeAlerts_HeaderFile
|
||||
#define _Message_CompositeAlerts_HeaderFile
|
||||
|
||||
#include <Message_Alert.hxx>
|
||||
#include <Message_Gravity.hxx>
|
||||
#include <Message_ListOfAlert.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
class Message_CompositeAlerts;
|
||||
DEFINE_STANDARD_HANDLE(Message_CompositeAlerts, Standard_Transient)
|
||||
|
||||
//! Base class of the hierarchy of classes describing various situations
|
||||
//! occurring during execution of some algorithm or procedure.
|
||||
//!
|
||||
//! Alert should provide unique text identifier that can be used to distinguish
|
||||
//! particular type of alerts, e.g. to get text message string describing it.
|
||||
//! See method GetMessageKey(); by default, dynamic type name is used.
|
||||
//!
|
||||
//! Alert can contain some data. To avoid duplication of data, new alert
|
||||
//! can be merged with another one of the same type. Method SupportsMerge()
|
||||
//! should return true if merge is supported; method Merge() should do the
|
||||
//! merge if possible and return true in that case and false otherwise.
|
||||
//!
|
||||
class Message_CompositeAlerts : public Standard_Transient
|
||||
{
|
||||
public:
|
||||
//! Empty constructor
|
||||
Standard_EXPORT Message_CompositeAlerts () {}
|
||||
|
||||
//! If possible, merge data contained in this alert to theTarget.
|
||||
//! @return True if merged.
|
||||
//! Base implementation always returns true.
|
||||
virtual Standard_EXPORT Standard_Boolean Merge (const Handle(Message_Alert)& theTarget);
|
||||
|
||||
//! Returns list of collected alerts with specified gravity
|
||||
Standard_EXPORT Message_ListOfAlert& GetAlerts (const Message_Gravity theGravity);
|
||||
|
||||
//! Returns true if the alert belong the list of the child alerts.
|
||||
//! \param theAlert an alert to be checked as a child alert
|
||||
//! \return true if the alert is found in a container of children
|
||||
Standard_EXPORT Standard_Boolean HasAlert (const Handle(Message_Alert)& theAlert);
|
||||
|
||||
// OCCT RTTI
|
||||
DEFINE_STANDARD_RTTIEXT(Message_CompositeAlerts,Standard_Transient)
|
||||
|
||||
protected:
|
||||
// store messages in a lists sorted by gravity;
|
||||
// here we rely on knowledge that Message_Fail is the last element of the enum
|
||||
Message_ListOfAlert myChildAlerts[Message_Fail + 1];
|
||||
};
|
||||
|
||||
#endif // _Message_CompositeAlerts_HeaderFile
|
192
src/Message/Message_PerfMeter.cxx
Normal file
192
src/Message/Message_PerfMeter.cxx
Normal file
@@ -0,0 +1,192 @@
|
||||
// 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_PerfMeter.hxx>
|
||||
|
||||
#include <Message_AlertExtended.hxx>
|
||||
#include <Message_CompositeAlerts.hxx>
|
||||
|
||||
#include <OSD_Chronometer.hxx>
|
||||
#include <OSD_MemInfo.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Destructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Message_PerfMeter::~Message_PerfMeter()
|
||||
{
|
||||
releaseAlert (0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetAlert
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Message_AlertExtended) Message_PerfMeter::GetAlert (const Standard_Integer theLevelId) const
|
||||
{
|
||||
if (!myActiveAlerts.IsBound (theLevelId))
|
||||
return Handle(Message_AlertExtended)();
|
||||
|
||||
return myActiveAlerts.Find (theLevelId).myAlert;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddAlert
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Message_PerfMeter::AddAlert (const Handle(Message_Alert)& theAlert,
|
||||
const Message_PerfMeterMode theMode)
|
||||
{
|
||||
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast (theAlert);
|
||||
if (anExtendedAlert.IsNull())
|
||||
return;
|
||||
|
||||
if (myActiveAlerts.IsEmpty())
|
||||
{
|
||||
setAlert (0, theAlert, theMode);
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Integer aSize = myActiveAlerts.Size();
|
||||
// looking for the parent of the parameter alert to release the previous alert
|
||||
for (Standard_Integer aLevelId = 0; aLevelId < aSize; aLevelId++)
|
||||
{
|
||||
Handle(Message_AlertExtended) anAlert = GetAlert (aLevelId);
|
||||
Handle(Message_CompositeAlerts) aCompositeAlert = anAlert->GetCompositeAlerts();
|
||||
Standard_ASSERT_RETURN (! aCompositeAlert.IsNull(), "Any alert of the performance meter has composite and children",);
|
||||
if (!aCompositeAlert->HasAlert (theAlert))
|
||||
continue;
|
||||
// parent alert is found
|
||||
if (myActiveAlerts.IsBound (aLevelId + 1))
|
||||
releaseAlert (aLevelId + 1);
|
||||
|
||||
setAlert (aLevelId + 1, theAlert, theMode);
|
||||
return;
|
||||
}
|
||||
Standard_Boolean isDone = Standard_True;
|
||||
Standard_ASSERT_RETURN (!isDone, "Alert should be processed above",);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : setAlert
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Message_PerfMeter::setAlert (const Standard_Integer theLevelId,
|
||||
const Handle(Message_Alert)& theAlert,
|
||||
const Message_PerfMeterMode theMode)
|
||||
{
|
||||
if (!GetAlert (theLevelId).IsNull())
|
||||
return Standard_False;
|
||||
|
||||
Handle(Message_AlertExtended) anAlertExtended = Handle(Message_AlertExtended)::DownCast (theAlert);
|
||||
if (anAlertExtended.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
myActiveAlerts.Bind (theLevelId, AlertInfo (anAlertExtended, getCurrentInfo (theMode)));
|
||||
anAlertExtended->SetPerfMeter (this);
|
||||
myMode = theMode;
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : releaseAlert
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Message_PerfMeter::releaseAlert (const Standard_Integer theLevelId)
|
||||
{
|
||||
// release alerts from the tail till the given alert
|
||||
for (Standard_Integer aLevelId = myActiveAlerts.Extent() - 1; aLevelId >= theLevelId; aLevelId--)
|
||||
{
|
||||
if (!myActiveAlerts.IsBound (aLevelId))
|
||||
continue;
|
||||
stopAlert (aLevelId);
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : stopAlert
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Message_PerfMeter::stopAlert (const Standard_Integer theLevelId)
|
||||
{
|
||||
if (!myActiveAlerts.IsBound (theLevelId))
|
||||
return Standard_False;
|
||||
|
||||
AlertInfo anAlertInfo = myActiveAlerts.Find (theLevelId);
|
||||
Handle(Message_AlertExtended) anExtendedAlert = anAlertInfo.myAlert;
|
||||
|
||||
anExtendedAlert->SetMetricValues (anAlertInfo.myStartValue, getCurrentInfo(myMode));
|
||||
anExtendedAlert->SetPerfMeter (0);
|
||||
myActiveAlerts.UnBind (theLevelId);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : getLevel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer Message_PerfMeter::getLevel (const Handle(Message_Alert)& theAlert)
|
||||
{
|
||||
for (NCollection_DataMap<Standard_Integer, AlertInfo>::Iterator anIterator (myActiveAlerts);
|
||||
anIterator.More(); anIterator.Next())
|
||||
{
|
||||
if (anIterator.Value().myAlert == theAlert)
|
||||
return anIterator.Key();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : getCurrentInfo
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real Message_PerfMeter::getCurrentInfo (const Message_PerfMeterMode theMode)
|
||||
{
|
||||
if (theMode == Message_PerfMeterMode_UserTimeCPU ||
|
||||
theMode == Message_PerfMeterMode_SystemTimeInfo)
|
||||
{
|
||||
Standard_Real aUserSeconds, aSystemSeconds;
|
||||
OSD_Chronometer::GetThreadCPU (aUserSeconds, aSystemSeconds);
|
||||
return theMode == Message_PerfMeterMode_UserTimeCPU ? aUserSeconds : aSystemSeconds;
|
||||
}
|
||||
|
||||
OSD_MemInfo::Counter aType;
|
||||
switch (theMode)
|
||||
{
|
||||
case Message_PerfMeterMode_MemPrivate: aType = OSD_MemInfo::MemPrivate; break;
|
||||
case Message_PerfMeterMode_MemVirtual: aType = OSD_MemInfo::MemVirtual; break;
|
||||
case Message_PerfMeterMode_MemWorkingSet: aType = OSD_MemInfo::MemWorkingSet; break;
|
||||
case Message_PerfMeterMode_MemWorkingSetPeak: aType = OSD_MemInfo::MemWorkingSetPeak; break;
|
||||
case Message_PerfMeterMode_MemSwapUsage: aType = OSD_MemInfo::MemSwapUsage; break;
|
||||
case Message_PerfMeterMode_MemSwapUsagePeak: aType = OSD_MemInfo::MemSwapUsagePeak; break;
|
||||
case Message_PerfMeterMode_MemHeapUsage: aType = OSD_MemInfo::MemHeapUsage; break;
|
||||
default: return Message_AlertExtended::GetUndefinedMetric(); break;
|
||||
}
|
||||
|
||||
OSD_MemInfo aMemInfo (Standard_False);
|
||||
aMemInfo.Update (aType);
|
||||
return (Standard_Real)aMemInfo.ValuePreciseMiB (aType);
|
||||
}
|
97
src/Message/Message_PerfMeter.hxx
Normal file
97
src/Message/Message_PerfMeter.hxx
Normal file
@@ -0,0 +1,97 @@
|
||||
// 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_PerfMeter_HeaderFile
|
||||
#define _Message_PerfMeter_HeaderFile
|
||||
|
||||
#include <Message_AlertExtended.hxx>
|
||||
#include <Message_Gravity.hxx>
|
||||
#include <Message_PerfMeterMode.hxx>
|
||||
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <Standard.hxx>
|
||||
|
||||
//! This class is performance meter for message alerts. The usage is create the simple instance of it (not a pointer)
|
||||
//! in a method. Finalizing of the method will call destructor of the meter and store time into alert.
|
||||
class Message_PerfMeter
|
||||
{
|
||||
|
||||
public:
|
||||
//! Constructs and starts (if autoStart is true) the named meter
|
||||
//! One string key is used for all alert meters. The perf meter is not started automatically, it will be done in
|
||||
//! AddAlert method
|
||||
Message_PerfMeter() : myGravity (Message_Info), myMode (Message_PerfMeterMode_None) {}
|
||||
|
||||
//! Assures stopping upon destruction
|
||||
Standard_EXPORT ~Message_PerfMeter();
|
||||
|
||||
//! Returns message alert on the level, by default the upper alert is returned
|
||||
//! \param theLevelId a level of child position inside the upper alert of performance meter
|
||||
//! \return alert instance or NULL
|
||||
Handle(Message_AlertExtended) GetAlert (const Standard_Integer theLevelId = 0) const;
|
||||
|
||||
//! Processes the parameter alert. There are some variants:
|
||||
//! - current alert is NULL, the alert becomes the current one and perf meter is started
|
||||
//! - last alert of the current alert is stopped (perf meter becomes NULL, time is calculated),
|
||||
//! the parameter alert is started (perf meter becomes the current one)
|
||||
Standard_EXPORT void AddAlert (const Handle(Message_Alert)& theAlert,
|
||||
const Message_PerfMeterMode theMode);
|
||||
|
||||
protected:
|
||||
|
||||
//! Sets message alert on the level
|
||||
//! \param theLevelId a level of child position inside the upper alert of performance meter
|
||||
//! \param theAlert an alert to be stored
|
||||
//! \return true if succeeded, false if there is stored alert on the given level
|
||||
Standard_Boolean setAlert (const Standard_Integer theLevelId,
|
||||
const Handle(Message_Alert)& theAlert,
|
||||
const Message_PerfMeterMode theMode);
|
||||
|
||||
//! Stop alert, store time into the alert and last child alert
|
||||
//! \param theLevelId a level of child position inside the upper alert of performance meter
|
||||
Standard_Boolean releaseAlert (const Standard_Integer theLevelId);
|
||||
|
||||
//! Sets NULL perf meter and parameter time into the alert
|
||||
//! \param theLevelId a level of child position inside the upper alert of performance meter
|
||||
Standard_Boolean stopAlert (const Standard_Integer theLevelId);
|
||||
|
||||
//! Returns level of given alert if it participates in the performance meter
|
||||
//! \param theAlert modified alert
|
||||
//! \return level value or -1
|
||||
Standard_Integer getLevel (const Handle(Message_Alert)& theAlert);
|
||||
|
||||
//! Returns cumulative info of the performance meter
|
||||
//! \param theMeterId a performance meter index
|
||||
//! \return time value
|
||||
static Standard_Real getCurrentInfo (const Message_PerfMeterMode theMode);
|
||||
|
||||
protected:
|
||||
//! Struct to store start time for the alert
|
||||
struct AlertInfo
|
||||
{
|
||||
AlertInfo (const Handle(Message_AlertExtended)& theAlert, Standard_Real theStartValue)
|
||||
: myAlert (theAlert), myStartValue (theStartValue) {}
|
||||
|
||||
Handle(Message_AlertExtended) myAlert; //!< an alert
|
||||
Standard_Real myStartValue; //!< start alert information
|
||||
};
|
||||
|
||||
NCollection_DataMap<Standard_Integer, AlertInfo> myActiveAlerts; //!< container of current alerts
|
||||
Message_Gravity myGravity; //!< perf meter alert gravity
|
||||
Message_PerfMeterMode myMode; //!< mode to define which information to collect
|
||||
};
|
||||
|
||||
|
||||
#endif // _Message_PerfMeter_HeaderFile
|
34
src/Message/Message_PerfMeterMode.hxx
Normal file
34
src/Message/Message_PerfMeterMode.hxx
Normal file
@@ -0,0 +1,34 @@
|
||||
// Created on: 2019-08-13
|
||||
// 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 _Message_PerfMeterMode_HeaderFile
|
||||
#define _Message_PerfMeterMode_HeaderFile
|
||||
|
||||
//! Specifies kind of report information to collect
|
||||
enum Message_PerfMeterMode
|
||||
{
|
||||
Message_PerfMeterMode_None, //!< no computation
|
||||
Message_PerfMeterMode_UserTimeCPU, //!< the current CPU user time in seconds
|
||||
Message_PerfMeterMode_SystemTimeInfo, //!< the current CPU system time in seconds
|
||||
Message_PerfMeterMode_MemPrivate, //!< OSD_MemInfo::MemPrivate
|
||||
Message_PerfMeterMode_MemVirtual, //!< OSD_MemInfo::MemVirtual
|
||||
Message_PerfMeterMode_MemWorkingSet, //!< OSD_MemInfo::MemWorkingSet
|
||||
Message_PerfMeterMode_MemWorkingSetPeak, //!< OSD_MemInfo::MemWorkingSetPeak
|
||||
Message_PerfMeterMode_MemSwapUsage, //!< OSD_MemInfo::MemSwapUsage
|
||||
Message_PerfMeterMode_MemSwapUsagePeak, //!< OSD_MemInfo::MemSwapUsagePeak
|
||||
Message_PerfMeterMode_MemHeapUsage //!< OSD_MemInfo::MemHeapUsage
|
||||
};
|
||||
|
||||
#endif // _Message_PerfMeterKind_HeaderFile
|
@@ -14,19 +14,42 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Message_Report.hxx>
|
||||
|
||||
#include <Message_AlertExtended.hxx>
|
||||
#include <Message_CompositeAlerts.hxx>
|
||||
#include <Message_Msg.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Message_PerfMeter.hxx>
|
||||
#include <Message_ReportCallBack.hxx>
|
||||
|
||||
#include <NCollection_Map.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Message_Report,Standard_Transient)
|
||||
|
||||
static Handle(Message_Report) MyReport;
|
||||
|
||||
//=======================================================================
|
||||
//function : Message_Report
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Message_Report::Message_Report ()
|
||||
: myPerfMeterMode (Message_PerfMeterMode_None), myLimit (-1)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -36,6 +59,9 @@ Message_Report::Message_Report ()
|
||||
|
||||
void Message_Report::AddAlert (Message_Gravity theGravity, const Handle(Message_Alert)& theAlert)
|
||||
{
|
||||
if (!IsActive (theGravity))
|
||||
return;
|
||||
|
||||
Standard_ASSERT_RETURN (! theAlert.IsNull(), "Attempt to add null alert",);
|
||||
Standard_ASSERT_RETURN (theGravity >= 0 && size_t(theGravity) < sizeof(myAlerts)/sizeof(myAlerts[0]),
|
||||
"Adding alert with gravity not in valid range",);
|
||||
@@ -58,6 +84,63 @@ void Message_Report::AddAlert (Message_Gravity theGravity, const Handle(Message_
|
||||
|
||||
// if not merged, just add to the list
|
||||
aList.Append (theAlert);
|
||||
|
||||
if (!myCallBack.IsNull())
|
||||
myCallBack->Update (theAlert);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddAlert
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Message_Report::AddAlert (const Message_Gravity theGravity, const Handle(Message_Alert)& theAlert,
|
||||
Message_PerfMeter* thePerfMeter, const Handle(Message_Alert)& theParentAlert)
|
||||
{
|
||||
if (!IsActive (theGravity))
|
||||
return;
|
||||
|
||||
Standard_ASSERT_RETURN (!theAlert.IsNull(), "Attempt to add null alert",);
|
||||
Standard_ASSERT_RETURN (theGravity >= 0 && size_t(theGravity) < sizeof(myAlerts)/sizeof(myAlerts[0]),
|
||||
"Adding alert with gravity not in valid range",);
|
||||
|
||||
Standard_Mutex::Sentry aSentry (myMutex);
|
||||
|
||||
// iterate by already recorded alerts and try to merge new one with one of those
|
||||
Handle(Message_Alert) aParentAlert = theParentAlert;
|
||||
if (aParentAlert.IsNull() && thePerfMeter)
|
||||
aParentAlert = thePerfMeter->GetAlert();
|
||||
if (aParentAlert.IsNull())
|
||||
aParentAlert = getLastAlertInPerfMeter(theGravity);
|
||||
|
||||
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(aParentAlert);
|
||||
Handle(Message_CompositeAlerts) aCompositeAlert = !anExtendedAlert.IsNull() ? anExtendedAlert->GetCompositeAlerts (Standard_True)
|
||||
: Handle(Message_CompositeAlerts)();
|
||||
Message_ListOfAlert& aList = !aCompositeAlert.IsNull() ? aCompositeAlert->GetAlerts (theGravity) : myAlerts[theGravity];
|
||||
|
||||
if (theAlert->SupportsMerge() && !aList.IsEmpty())
|
||||
{
|
||||
// merge is performed only for alerts of exactly same type and same name
|
||||
const Handle(Standard_Type)& aType = theAlert->DynamicType();
|
||||
for (Message_ListOfAlert::Iterator anIt(aList); anIt.More(); anIt.Next())
|
||||
{
|
||||
// if merged successfully, just return
|
||||
if (aType == anIt.Value()->DynamicType() && theAlert->Merge (anIt.Value()))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
aList.RemoveFirst();
|
||||
|
||||
if (thePerfMeter)
|
||||
thePerfMeter->AddAlert (theAlert, PerfMeterMode());
|
||||
|
||||
if (!myCallBack.IsNull())
|
||||
myCallBack->Update(theAlert);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -73,6 +156,156 @@ const Message_ListOfAlert& Message_Report::GetAlerts (Message_Gravity theGravity
|
||||
return myAlerts[theGravity];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CumulativeMetric
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real Message_Report::CumulativeMetric (const Message_Gravity theGravity) const
|
||||
{
|
||||
switch (myPerfMeterMode)
|
||||
{
|
||||
case Message_PerfMeterMode_None: return 0.0;
|
||||
case Message_PerfMeterMode_UserTimeCPU:
|
||||
case Message_PerfMeterMode_SystemTimeInfo:
|
||||
{
|
||||
Standard_Real aStartTime = Message_AlertExtended::GetUndefinedMetric();
|
||||
Standard_Boolean isFound = Standard_False;
|
||||
for (Message_ListOfAlert::Iterator anAlertsIt (GetAlerts (theGravity)); anAlertsIt.More(); anAlertsIt.Next())
|
||||
{
|
||||
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(anAlertsIt.Value());
|
||||
if (anExtendedAlert.IsNull() && anExtendedAlert->IsMetricValid())
|
||||
{
|
||||
aStartTime = anExtendedAlert->MetricStart();
|
||||
isFound = Standard_True;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isFound)
|
||||
return 0.0;
|
||||
|
||||
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(getLastAlert (theGravity));
|
||||
if (anExtendedAlert.IsNull() || !anExtendedAlert->IsMetricValid())
|
||||
return 0.0;
|
||||
|
||||
return anExtendedAlert->MetricStop() - aStartTime;
|
||||
}
|
||||
case Message_PerfMeterMode_MemPrivate:
|
||||
case Message_PerfMeterMode_MemVirtual:
|
||||
case Message_PerfMeterMode_MemWorkingSet:
|
||||
{
|
||||
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(getLastAlert (theGravity));
|
||||
if (!anExtendedAlert.IsNull())
|
||||
return anExtendedAlert->MetricStop();
|
||||
}
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : getLastAlert
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Message_Alert) Message_Report::getLastAlert (const Message_Gravity theGravity) const
|
||||
{
|
||||
if (!IsActive (theGravity))
|
||||
return Handle(Message_Alert)();
|
||||
|
||||
const Message_ListOfAlert& anAlerts = GetAlerts (theGravity);
|
||||
if (anAlerts.IsEmpty())
|
||||
return Handle(Message_Alert)();
|
||||
|
||||
Handle(Message_Alert) aLastAlert = anAlerts.Last();
|
||||
|
||||
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast (aLastAlert);
|
||||
if (anExtendedAlert.IsNull())
|
||||
return aLastAlert;
|
||||
Handle(Message_CompositeAlerts) aCompositeAlert = anExtendedAlert->GetCompositeAlerts (Standard_True);
|
||||
if (aCompositeAlert.IsNull())
|
||||
return aLastAlert;
|
||||
|
||||
while (!aCompositeAlert.IsNull() && !aCompositeAlert->GetAlerts (theGravity).IsEmpty())
|
||||
{
|
||||
Handle(Message_Alert) anAlert = aCompositeAlert->GetAlerts (theGravity).Last();
|
||||
|
||||
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast (anAlert);
|
||||
if (anExtendedAlert.IsNull())
|
||||
{
|
||||
aLastAlert = anAlert;
|
||||
break;
|
||||
}
|
||||
|
||||
aLastAlert = anExtendedAlert;
|
||||
aCompositeAlert = anExtendedAlert->GetCompositeAlerts();
|
||||
}
|
||||
|
||||
// if alert has perf meter, use as the last alert, an alert of the perf meter
|
||||
anExtendedAlert = Handle(Message_AlertExtended)::DownCast (aLastAlert);
|
||||
if (anExtendedAlert.IsNull())
|
||||
return aLastAlert;
|
||||
|
||||
return aLastAlert;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : getLastAlertInPerfMeter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Message_Alert) Message_Report::getLastAlertInPerfMeter (const Message_Gravity theGravity) const
|
||||
{
|
||||
if (!IsActive (theGravity))
|
||||
return Handle(Message_Alert)();
|
||||
|
||||
const Message_ListOfAlert& anAlerts = GetAlerts (theGravity);
|
||||
if (anAlerts.IsEmpty())
|
||||
return Handle(Message_Alert)();
|
||||
|
||||
Handle(Message_Alert) aLastAlert = anAlerts.Last();
|
||||
|
||||
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast (aLastAlert);
|
||||
if (anExtendedAlert.IsNull())
|
||||
return aLastAlert;
|
||||
Handle(Message_CompositeAlerts) aCompositeAlert = anExtendedAlert->GetCompositeAlerts (Standard_True);
|
||||
if (aCompositeAlert.IsNull())
|
||||
return aLastAlert;
|
||||
|
||||
Standard_Boolean aHasPerfMeter = anExtendedAlert->GetPerfMeter() != NULL;
|
||||
if (!aHasPerfMeter) // the alert has finished and is not the last alert anymore
|
||||
return Handle(Message_Alert)();
|
||||
|
||||
while (!aCompositeAlert.IsNull() && !aCompositeAlert->GetAlerts (theGravity).IsEmpty())
|
||||
{
|
||||
Handle(Message_Alert) anAlert = aCompositeAlert->GetAlerts (theGravity).Last();
|
||||
|
||||
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast (anAlert);
|
||||
if (anExtendedAlert.IsNull())
|
||||
{
|
||||
if (!aHasPerfMeter) // if there is a perf meter, use alert of it
|
||||
aLastAlert = anAlert;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!aHasPerfMeter)
|
||||
aHasPerfMeter = anExtendedAlert->GetPerfMeter() != NULL;
|
||||
else if (!anExtendedAlert->GetPerfMeter())
|
||||
break; // last alert is the previous alert where perf meter is not NULL
|
||||
|
||||
aLastAlert = anExtendedAlert;
|
||||
aCompositeAlert = anExtendedAlert->GetCompositeAlerts();
|
||||
}
|
||||
|
||||
// if alert has perf meter, use as the last alert, an alert of the perf meter
|
||||
anExtendedAlert = Handle(Message_AlertExtended)::DownCast (aLastAlert);
|
||||
if (anExtendedAlert.IsNull())
|
||||
return aLastAlert;
|
||||
//if (anExtendedAlert->GetPerfMeter())
|
||||
// aLastAlert = anExtendedAlert->GetPerfMeter()->GetAlert();
|
||||
|
||||
return aLastAlert;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasAlert
|
||||
//purpose :
|
||||
@@ -248,3 +481,22 @@ void Message_Report::Merge (const Handle(Message_Report)& theOther, Message_Grav
|
||||
AddAlert (theGravity, anIt.Value());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetActive
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Message_Report::SetActive (const Standard_Boolean theActive, const Standard_Integer theGravity)
|
||||
{
|
||||
if (theGravity < 0)
|
||||
{
|
||||
for (int iGravity = Message_Trace; iGravity <= Message_Fail; ++iGravity)
|
||||
SetActive (theActive, iGravity);
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_ASSERT_RETURN (theGravity >= 0 && size_t (theGravity) < sizeof (myAlerts) / sizeof (myAlerts[0]),
|
||||
"Set active report with gravity not in valid range", );
|
||||
myIsActive[theGravity] = theActive;
|
||||
}
|
||||
|
@@ -18,12 +18,15 @@
|
||||
|
||||
#include <Message_Gravity.hxx>
|
||||
#include <Message_ListOfAlert.hxx>
|
||||
#include <Message_PerfMeterMode.hxx>
|
||||
#include <Standard_Mutex.hxx>
|
||||
|
||||
class Message_Messenger;
|
||||
|
||||
class Message_PerfMeter;
|
||||
class Message_Report;
|
||||
DEFINE_STANDARD_HANDLE(Message_Report, MMgt_TShared)
|
||||
class Message_ReportCallBack;
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Message_Report, Standard_Transient)
|
||||
|
||||
//! Container for alert messages, sorted according to their gravity.
|
||||
//!
|
||||
@@ -54,10 +57,24 @@ 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);
|
||||
|
||||
//! Add alert with specified gravity. The alert is a sub-alert of report or another alert
|
||||
//! The parent alert is the parameter alert or the last alert if found else report.
|
||||
//! \param theGravity a message gravity
|
||||
//! \param theAlert a new alert to be added
|
||||
//! \param thePerfMeter performance meter calculates the alert spent time and participate in searching the last alert if needed
|
||||
//! \param theParentAlert if not NULL specifies parent alert where the alert should be placed, if the parent is an extednded alert
|
||||
Standard_EXPORT void AddAlert (const Message_Gravity theGravity, const Handle(Message_Alert)& theAlert,
|
||||
Message_PerfMeter* thePerfMeter, const Handle(Message_Alert)& theParentAlert = Handle(Message_Alert)());
|
||||
|
||||
//! Returns list of collected alerts with specified gravity
|
||||
Standard_EXPORT const Message_ListOfAlert& GetAlerts (Message_Gravity theGravity) const;
|
||||
|
||||
@@ -94,15 +111,70 @@ public:
|
||||
//! Merges alerts with specified gravity from theOther report into this
|
||||
Standard_EXPORT void Merge (const Handle(Message_Report)& theOther, Message_Gravity theGravity);
|
||||
|
||||
//! Returns a state whether the report is active
|
||||
//! \return the state
|
||||
Standard_Boolean IsActive (const Message_Gravity theGravity) const { return myIsActive[theGravity]; }
|
||||
|
||||
//! Starts a timer to compute time between messages. If a timer has already been started, it will be stopped
|
||||
//! \param theActive new state of report active
|
||||
//! \param theGravity gravity type, if '-1', apply value for all gravity kinds
|
||||
Standard_EXPORT void SetActive (const Standard_Boolean theActive, const Standard_Integer theGravity = -1);
|
||||
|
||||
//! Sets a perf meter mode
|
||||
//! \param theMode new mode
|
||||
Standard_EXPORT void SetPerfMeterMode (const Message_PerfMeterMode theMode)
|
||||
{ myPerfMeterMode = theMode; }
|
||||
|
||||
//! Returns mode of perf meter
|
||||
//! \return the state
|
||||
Standard_EXPORT Message_PerfMeterMode PerfMeterMode() const
|
||||
{ return myPerfMeterMode; }
|
||||
|
||||
//! Returns maximum number of collecting alerts. If the limit is achieved,
|
||||
//! adding of a new alert after removing the first cached alert.
|
||||
//! \return the limit value
|
||||
Standard_EXPORT Standard_Integer GetLimit() const { return myLimit; }
|
||||
|
||||
//! Sets maximum number of collecting alerts.
|
||||
//! \return theLimit limit value
|
||||
Standard_EXPORT void SetLimit(const Standard_Integer theLimit) { myLimit = theLimit; }
|
||||
|
||||
//! Returns the report cumulative metric. It includes time/mem of sub alerts depending on PerfMeter mode
|
||||
//! @return value
|
||||
Standard_EXPORT Standard_Real CumulativeMetric (const Message_Gravity theGravity) const;
|
||||
|
||||
//! Sets a listener for the report events
|
||||
void SetCallBack(const Handle(Message_ReportCallBack)& theCallBack) { myCallBack = theCallBack; }
|
||||
|
||||
//! Returns listener of the reports events
|
||||
const Handle(Message_ReportCallBack)& GetCallBack() const { return myCallBack; }
|
||||
|
||||
// OCCT RTTI
|
||||
DEFINE_STANDARD_RTTIEXT(Message_Report,Standard_Transient)
|
||||
|
||||
protected:
|
||||
//! Returns last alert in list of report alerts or last alert in hierarchical tree of alerts provided by
|
||||
//! the last alert
|
||||
//! \parm theGravity a message gravity
|
||||
Standard_EXPORT Handle(Message_Alert) getLastAlert (const Message_Gravity theGravity) const;
|
||||
|
||||
//! Returns last alert in list of report alerts or last alert in hierarchical tree of alerts provided by
|
||||
//! the last alert
|
||||
//! \parm theGravity a message gravity
|
||||
Standard_EXPORT Handle(Message_Alert) getLastAlertInPerfMeter (const Message_Gravity theGravity) const;
|
||||
|
||||
protected:
|
||||
Standard_Mutex myMutex;
|
||||
|
||||
// store messages in a lists sorted by gravity;
|
||||
// here we rely on knowledge that Message_Fail is the last element of the enum
|
||||
Message_ListOfAlert myAlerts[Message_Fail + 1];
|
||||
|
||||
Standard_Boolean myIsActive[Message_Fail + 1];
|
||||
Message_PerfMeterMode myPerfMeterMode; //! If true, each alert will store the mode information
|
||||
Standard_Integer myLimit; //! Maximum number of collected alerts
|
||||
|
||||
Handle(Message_ReportCallBack) myCallBack; //! signal about performed modifications
|
||||
};
|
||||
|
||||
#endif // _Message_Report_HeaderFile
|
||||
|
22
src/Message/Message_ReportCallBack.cxx
Normal file
22
src/Message/Message_ReportCallBack.cxx
Normal file
@@ -0,0 +1,22 @@
|
||||
// Created on: 2017-12-01
|
||||
// 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_ReportCallBack.hxx"
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Message_ReportCallBack, Standard_Transient)
|
||||
|
||||
Message_ReportCallBack::Message_ReportCallBack ()
|
||||
{
|
||||
}
|
44
src/Message/Message_ReportCallBack.hxx
Normal file
44
src/Message/Message_ReportCallBack.hxx
Normal file
@@ -0,0 +1,44 @@
|
||||
// Created on: 2017-12-01
|
||||
// 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_ReportCallBack_HeaderFile
|
||||
#define _Message_ReportCallBack_HeaderFile
|
||||
|
||||
#include <Standard_Handle.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
class Message_Alert;
|
||||
class Message_ReportCallBack;
|
||||
DEFINE_STANDARD_HANDLE(Message_ReportCallBack, Standard_Transient)
|
||||
|
||||
//! Interface to have possibility of processing message report events.
|
||||
class Message_ReportCallBack : public Standard_Transient
|
||||
{
|
||||
public:
|
||||
|
||||
//! Empty constructor
|
||||
Standard_EXPORT Message_ReportCallBack ();
|
||||
~Message_ReportCallBack () {}
|
||||
|
||||
//! Interface to be implemented in the child to process the message report event
|
||||
//! \param theAlert created or modified message alert
|
||||
virtual void Update(const Handle(Message_Alert)& theAlert) = 0;
|
||||
|
||||
//! OCCT RTTI
|
||||
DEFINE_STANDARD_RTTIEXT(Message_ReportCallBack, Standard_Transient)
|
||||
};
|
||||
|
||||
#endif // _Message_ReportCallBack_HeaderFile
|
@@ -186,6 +186,145 @@ void OSD_MemInfo::Update()
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Update
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OSD_MemInfo::Update (const OSD_MemInfo::Counter theCounter)
|
||||
{
|
||||
#ifndef OCCT_UWP
|
||||
#if defined(_WIN32)
|
||||
|
||||
if (theCounter == MemVirtual)
|
||||
{
|
||||
#if (_WIN32_WINNT >= 0x0500)
|
||||
MEMORYSTATUSEX aStatEx;
|
||||
aStatEx.dwLength = sizeof(aStatEx);
|
||||
GlobalMemoryStatusEx (&aStatEx);
|
||||
myCounters[MemVirtual] = Standard_Size(aStatEx.ullTotalVirtual - aStatEx.ullAvailVirtual);
|
||||
#else
|
||||
MEMORYSTATUS aStat;
|
||||
aStat.dwLength = sizeof(aStat);
|
||||
GlobalMemoryStatus (&aStat);
|
||||
myCounters[MemVirtual] = Standard_Size(aStat.dwTotalVirtual - aStat.dwAvailVirtual);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (theCounter == MemPrivate ||
|
||||
theCounter == MemWorkingSet ||
|
||||
theCounter == MemWorkingSetPeak ||
|
||||
theCounter == MemSwapUsage ||
|
||||
theCounter == MemSwapUsagePeak)
|
||||
{
|
||||
// use Psapi library
|
||||
HANDLE aProcess = GetCurrentProcess();
|
||||
#if (_WIN32_WINNT >= 0x0501)
|
||||
PROCESS_MEMORY_COUNTERS_EX aProcMemCnts;
|
||||
#else
|
||||
PROCESS_MEMORY_COUNTERS aProcMemCnts;
|
||||
#endif
|
||||
if (GetProcessMemoryInfo (aProcess, (PROCESS_MEMORY_COUNTERS* )&aProcMemCnts, sizeof(aProcMemCnts)))
|
||||
{
|
||||
#if (_WIN32_WINNT >= 0x0501)
|
||||
myCounters[MemPrivate] = aProcMemCnts.PrivateUsage;
|
||||
#endif
|
||||
myCounters[MemWorkingSet] = aProcMemCnts.WorkingSetSize;
|
||||
myCounters[MemWorkingSetPeak] = aProcMemCnts.PeakWorkingSetSize;
|
||||
myCounters[MemSwapUsage] = aProcMemCnts.PagefileUsage;
|
||||
myCounters[MemSwapUsagePeak] = aProcMemCnts.PeakPagefileUsage;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (theCounter == MemHeapUsage)
|
||||
{
|
||||
_HEAPINFO hinfo;
|
||||
int heapstatus;
|
||||
hinfo._pentry = NULL;
|
||||
|
||||
myCounters[MemHeapUsage] = 0;
|
||||
while((heapstatus = _heapwalk(&hinfo)) == _HEAPOK)
|
||||
{
|
||||
if(hinfo._useflag == _USEDENTRY)
|
||||
myCounters[MemHeapUsage] += hinfo._size;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#elif (defined(__linux__) || defined(__linux))
|
||||
/*
|
||||
// use procfs on Linux
|
||||
char aBuff[4096];
|
||||
snprintf (aBuff, sizeof(aBuff), "/proc/%d/status", getpid());
|
||||
std::ifstream aFile;
|
||||
aFile.open (aBuff);
|
||||
if (!aFile.is_open())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
while (!aFile.eof())
|
||||
{
|
||||
memset (aBuff, 0, sizeof(aBuff));
|
||||
aFile.getline (aBuff, 4096);
|
||||
if (aBuff[0] == '\0')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strncmp (aBuff, "VmSize:", strlen ("VmSize:")) == 0)
|
||||
{
|
||||
myCounters[MemVirtual] = atol (aBuff + strlen ("VmSize:")) * 1024;
|
||||
}
|
||||
//else if (strncmp (aBuff, "VmPeak:", strlen ("VmPeak:")) == 0)
|
||||
// myVirtualPeak = atol (aBuff + strlen ("VmPeak:")) * 1024;
|
||||
else if (strncmp (aBuff, "VmRSS:", strlen ("VmRSS:")) == 0)
|
||||
{
|
||||
myCounters[MemWorkingSet] = atol (aBuff + strlen ("VmRSS:")) * 1024; // RSS - resident set size
|
||||
}
|
||||
else if (strncmp (aBuff, "VmHWM:", strlen ("VmHWM:")) == 0)
|
||||
{
|
||||
myCounters[MemWorkingSetPeak] = atol (aBuff + strlen ("VmHWM:")) * 1024; // HWM - high water mark
|
||||
}
|
||||
else if (strncmp (aBuff, "VmData:", strlen ("VmData:")) == 0)
|
||||
{
|
||||
if (myCounters[MemPrivate] == Standard_Size(-1)) ++myCounters[MemPrivate];
|
||||
myCounters[MemPrivate] += atol (aBuff + strlen ("VmData:")) * 1024;
|
||||
}
|
||||
else if (strncmp (aBuff, "VmStk:", strlen ("VmStk:")) == 0)
|
||||
{
|
||||
if (myCounters[MemPrivate] == Standard_Size(-1)) ++myCounters[MemPrivate];
|
||||
myCounters[MemPrivate] += atol (aBuff + strlen ("VmStk:")) * 1024;
|
||||
}
|
||||
}
|
||||
aFile.close();
|
||||
|
||||
struct mallinfo aMI = mallinfo();
|
||||
myCounters[MemHeapUsage] = aMI.uordblks;
|
||||
|
||||
#elif (defined(__APPLE__))
|
||||
struct task_basic_info aTaskInfo;
|
||||
mach_msg_type_number_t aTaskInfoCount = TASK_BASIC_INFO_COUNT;
|
||||
if (task_info (mach_task_self(), TASK_BASIC_INFO,
|
||||
(task_info_t )&aTaskInfo, &aTaskInfoCount) == KERN_SUCCESS)
|
||||
{
|
||||
// On Mac OS X, these values in bytes, not pages!
|
||||
myCounters[MemVirtual] = aTaskInfo.virtual_size;
|
||||
myCounters[MemWorkingSet] = aTaskInfo.resident_size;
|
||||
|
||||
//Getting malloc statistics
|
||||
malloc_statistics_t aStats;
|
||||
malloc_zone_statistics (NULL, &aStats);
|
||||
|
||||
myCounters[MemHeapUsage] = aStats.size_in_use;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : ToString
|
||||
// purpose :
|
||||
|
@@ -74,6 +74,9 @@ public:
|
||||
//! Update counters
|
||||
Standard_EXPORT void Update();
|
||||
|
||||
//! Update counter of specified counter
|
||||
Standard_EXPORT void Update (const OSD_MemInfo::Counter theCounter);
|
||||
|
||||
//! Return the string representation for all available counter.
|
||||
Standard_EXPORT TCollection_AsciiString ToString() const;
|
||||
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include <OpenGl_Context.hxx>
|
||||
#include <OpenGl_Workspace.hxx>
|
||||
|
||||
#include <Graphic3d.hxx>
|
||||
#include <Graphic3d_TypeOfReflection.hxx>
|
||||
#include <Graphic3d_MaterialAspect.hxx>
|
||||
|
||||
@@ -114,3 +115,28 @@ void OpenGl_Aspects::Release (OpenGl_Context* theContext)
|
||||
myResSprite.Release (theContext);
|
||||
myResProgram.Release (theContext);
|
||||
}
|
||||
|
||||
const TCollection_AsciiString OpenGl_Aspects_ClassName = "OpenGl_Aspects";
|
||||
|
||||
// =======================================================================
|
||||
// function : Dump
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Aspects::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, OpenGl_Aspects_ClassName);
|
||||
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myAspect->Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "Aspect", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
|
||||
DUMP_VALUES (OS, "myShadingModel", Graphic3d::TypeOfShadingModelToString (myShadingModel));
|
||||
|
||||
//mutable OpenGl_AspectsProgram myResProgram;
|
||||
//mutable OpenGl_AspectsTextureSet myResTextureSet;
|
||||
//mutable OpenGl_AspectsSprite myResSprite;
|
||||
|
||||
DUMP_STOP_KEY (OS, OpenGl_Aspects_ClassName);
|
||||
}
|
||||
|
@@ -89,6 +89,9 @@ public:
|
||||
//! Update presentation aspects parameters after their modification.
|
||||
virtual void SynchronizeAspects() Standard_OVERRIDE { SetAspect (myAspect); }
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT void Dump (Standard_OStream& OS) const;
|
||||
|
||||
protected:
|
||||
|
||||
//! OpenGl resources
|
||||
|
@@ -353,3 +353,34 @@ void OpenGl_Group::Release (const Handle(OpenGl_Context)& theGlCtx)
|
||||
|
||||
OpenGl_Element::Destroy (theGlCtx.get(), myAspects);
|
||||
}
|
||||
|
||||
const TCollection_AsciiString OpenGl_Group_ClassName = "OpenGl_Group";
|
||||
|
||||
// =======================================================================
|
||||
// function : Dump
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Group::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, OpenGl_Group_ClassName);
|
||||
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
Graphic3d_Group::Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "Graphic3d_Group", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
|
||||
if (myAspects)
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myAspects->Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "Aspects", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
//OpenGl_CappingPlaneResource* myAspectFillCapping;
|
||||
//OpenGl_ElementNode* myFirst;
|
||||
//OpenGl_ElementNode* myLast;
|
||||
|
||||
DUMP_VALUES (OS, "myIsRaytracable", myIsRaytracable);
|
||||
|
||||
DUMP_STOP_KEY (OS, OpenGl_Group_ClassName);
|
||||
}
|
||||
|
@@ -111,6 +111,9 @@ public:
|
||||
//! Returns OpenGL capping filling aspect.
|
||||
const OpenGl_CappingPlaneResource* AspectFillCapping() const { return myAspectFillCapping; }
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT virtual ~OpenGl_Group();
|
||||
|
@@ -159,15 +159,6 @@ OpenGl_LayerList::OpenGl_LayerList (const Standard_Integer theNbPriorities)
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ~OpenGl_LayerList
|
||||
//purpose : Destructor
|
||||
//=======================================================================
|
||||
|
||||
OpenGl_LayerList::~OpenGl_LayerList()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetFrustumCullingBVHBuilder
|
||||
//purpose :
|
||||
|
@@ -25,8 +25,10 @@
|
||||
#include <NCollection_Sequence.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
class OpenGl_FrameBuffer;
|
||||
class OpenGl_Structure;
|
||||
class OpenGl_Workspace;
|
||||
|
||||
struct OpenGl_GlobalLayerSettings;
|
||||
|
||||
//! Class defining the list of layers.
|
||||
@@ -35,10 +37,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; }
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
|
||||
#include <Prs3d_InvalidAngle.hxx>
|
||||
#include <TCollection.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_ArrowAspect, Prs3d_BasicAspect)
|
||||
|
||||
@@ -65,3 +66,24 @@ void Prs3d_ArrowAspect::SetAngle (const Standard_Real theAngle)
|
||||
|| theAngle >= M_PI / 2.0, "Prs3d_ArrowAspect::SetAngle() - angle out of range");
|
||||
myAngle = theAngle;
|
||||
}
|
||||
|
||||
const TCollection_AsciiString Prs3d_ArrowAspect_ClassName = "Prs3d_ArrowAspect";
|
||||
|
||||
// =======================================================================
|
||||
// function : Dump
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_ArrowAspect::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, Prs3d_ArrowAspect_ClassName);
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myArrowAspect->Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "ArrowAspect", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
|
||||
DUMP_VALUES (OS, "Angle", myAngle);
|
||||
DUMP_VALUES (OS, "Length", myLength);
|
||||
|
||||
DUMP_STOP_KEY (OS, Prs3d_ArrowAspect_ClassName);
|
||||
}
|
||||
|
@@ -57,6 +57,9 @@ public:
|
||||
|
||||
void SetAspect (const Handle(Graphic3d_AspectLine3d)& theAspect) { myArrowAspect = theAspect; }
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Graphic3d_AspectLine3d) myArrowAspect;
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#define _Prs3d_BasicAspect_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
@@ -25,6 +26,10 @@
|
||||
class Prs3d_BasicAspect : public Standard_Transient
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(Prs3d_BasicAspect, Standard_Transient)
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
virtual void Dump (Standard_OStream& OS) const = 0;
|
||||
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Prs3d_BasicAspect, Standard_Transient)
|
||||
|
@@ -14,6 +14,9 @@
|
||||
|
||||
#include <Prs3d_DatumAspect.hxx>
|
||||
|
||||
#include <Prs3d.hxx>
|
||||
#include <TCollection.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DatumAspect, Prs3d_BasicAspect)
|
||||
|
||||
// =======================================================================
|
||||
@@ -167,3 +170,40 @@ Prs3d_DatumParts Prs3d_DatumAspect::ArrowPartForAxis (Prs3d_DatumParts thePart)
|
||||
}
|
||||
return Prs3d_DP_None;
|
||||
}
|
||||
|
||||
const TCollection_AsciiString Prs3d_DatumAspect_ClassName = "Prs3d_DatumAspect";
|
||||
|
||||
// =======================================================================
|
||||
// function : Dump
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_DatumAspect::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, Prs3d_DatumAspect_ClassName);
|
||||
|
||||
DUMP_VALUES (OS, "Axes", Prs3d::DatumAxesToString (myAxes));
|
||||
DUMP_VALUES (OS, "ToDrawLabels", myToDrawLabels);
|
||||
DUMP_VALUES (OS, "ToDrawArrows", myToDrawArrows);
|
||||
|
||||
//NCollection_DataMap<Prs3d_DatumAttribute, Standard_Real> myAttributes;
|
||||
//NCollection_DataMap<Prs3d_DatumParts, Handle(Prs3d_ShadingAspect)> myShadedAspects;
|
||||
//NCollection_DataMap<Prs3d_DatumParts, Handle(Prs3d_LineAspect)> myLineAspects;
|
||||
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myTextAspect->Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "TextAspect", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myPointAspect->Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "PointAspect", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myArrowAspect->Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "ArrowAspect", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
DUMP_STOP_KEY (OS, Prs3d_DatumAspect_ClassName);
|
||||
}
|
||||
|
||||
|
@@ -153,6 +153,9 @@ public:
|
||||
//! Returns type of arrow for a type of axis
|
||||
Standard_EXPORT Prs3d_DatumParts ArrowPartForAxis (Prs3d_DatumParts thePart) const;
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
Prs3d_DatumAxes myAxes;
|
||||
Standard_Boolean myToDrawLabels;
|
||||
|
@@ -16,6 +16,8 @@
|
||||
|
||||
#include <Aspect_TypeOfLine.hxx>
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
#include <Prs3d.hxx>
|
||||
#include <TCollection.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DimensionAspect, Prs3d_BasicAspect)
|
||||
|
||||
@@ -59,3 +61,43 @@ void Prs3d_DimensionAspect::SetCommonColor (const Quantity_Color& theColor)
|
||||
myTextAspect->SetColor (theColor);
|
||||
myArrowAspect->SetColor (theColor);
|
||||
}
|
||||
|
||||
const TCollection_AsciiString Prs3d_DimensionAspect_ClassName = "Prs3d_DimensionAspect";
|
||||
|
||||
// =======================================================================
|
||||
// function : Dump
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_DimensionAspect::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, Prs3d_DimensionAspect_ClassName);
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myLineAspect->Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "LineAspect", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myTextAspect->Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "TextAspect", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myArrowAspect->Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "ArrowAspect", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
DUMP_VALUES (OS, "ValueStringFormat", myValueStringFormat);
|
||||
DUMP_VALUES (OS, "ExtensionSize", myExtensionSize);
|
||||
DUMP_VALUES (OS, "ArrowTailSize", myArrowTailSize);
|
||||
DUMP_VALUES (OS, "ArrowOrientation", Prs3d::DimensionArrowOrientationToString (myArrowOrientation));
|
||||
DUMP_VALUES (OS, "TextHPosition", Prs3d::DimensionTextHorizontalPositionToString (myTextHPosition));
|
||||
DUMP_VALUES (OS, "TextVPosition", Prs3d::DimensionTextVerticalPositionToString (myTextVPosition));
|
||||
|
||||
DUMP_VALUES (OS, "ToDisplayUnits", myToDisplayUnits);
|
||||
DUMP_VALUES (OS, "IsText3d", myIsText3d);
|
||||
DUMP_VALUES (OS, "IsTextShaded", myIsTextShaded);
|
||||
DUMP_VALUES (OS, "IsArrows3d", myIsArrows3d);
|
||||
|
||||
DUMP_STOP_KEY (OS, Prs3d_DimensionAspect_ClassName);
|
||||
}
|
||||
|
||||
|
@@ -115,6 +115,9 @@ public:
|
||||
//! Returns format.
|
||||
const TCollection_AsciiString& ValueStringFormat() const { return myValueStringFormat; }
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Prs3d_LineAspect) myLineAspect;
|
||||
|
@@ -14,6 +14,8 @@
|
||||
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
|
||||
#include <TCollection.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_LineAspect, Prs3d_BasicAspect)
|
||||
|
||||
// =======================================================================
|
||||
@@ -27,3 +29,21 @@ Prs3d_LineAspect::Prs3d_LineAspect (const Quantity_Color& theColor,
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
const TCollection_AsciiString Prs3d_LineAspect_ClassName = "Prs3d_LineAspect";
|
||||
|
||||
// =======================================================================
|
||||
// function : Dump
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_LineAspect::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, Prs3d_LineAspect_ClassName);
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myAspect->Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "Aspect", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
DUMP_STOP_KEY (OS, Prs3d_LineAspect_ClassName);
|
||||
}
|
||||
|
||||
|
@@ -63,6 +63,9 @@ public:
|
||||
|
||||
void SetAspect (const Handle(Graphic3d_AspectLine3d)& theAspect) { myAspect = theAspect; }
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Graphic3d_AspectLine3d) myAspect;
|
||||
|
@@ -14,6 +14,8 @@
|
||||
|
||||
#include <Prs3d_PlaneAspect.hxx>
|
||||
|
||||
#include <TCollection.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_PlaneAspect, Prs3d_BasicAspect)
|
||||
|
||||
// =======================================================================
|
||||
@@ -37,3 +39,43 @@ Prs3d_PlaneAspect::Prs3d_PlaneAspect()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
const TCollection_AsciiString Prs3d_PlaneAspect_ClassName = "Prs3d_PlaneAspect";
|
||||
|
||||
// =======================================================================
|
||||
// function : Dump
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_PlaneAspect::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, Prs3d_PlaneAspect_ClassName);
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myEdgesAspect->Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "EdgesAspect", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myIsoAspect->Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "IsoAspect", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myArrowAspect->Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "ArrowAspect", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
|
||||
DUMP_VALUES (OS, "ArrowsLength", myArrowsLength);
|
||||
DUMP_VALUES (OS, "ArrowsSize", myArrowsSize);
|
||||
DUMP_VALUES (OS, "ArrowsAngle", myArrowsAngle);
|
||||
DUMP_VALUES (OS, "PlaneXLength", myPlaneXLength);
|
||||
DUMP_VALUES (OS, "PlaneYLength", myPlaneYLength);
|
||||
DUMP_VALUES (OS, "IsoDistance", myIsoDistance);
|
||||
DUMP_VALUES (OS, "DrawCenterArrow", myDrawCenterArrow);
|
||||
DUMP_VALUES (OS, "DrawEdgesArrows", myDrawEdgesArrows);
|
||||
DUMP_VALUES (OS, "DrawEdges", myDrawEdges);
|
||||
DUMP_VALUES (OS, "DrawIso", myDrawIso);
|
||||
|
||||
DUMP_STOP_KEY (OS, Prs3d_PlaneAspect_ClassName);
|
||||
}
|
||||
|
||||
|
@@ -96,6 +96,9 @@ public:
|
||||
//! Returns the distance between isoparameters used in the display of planes.
|
||||
Standard_Real IsoDistance() const { return myIsoDistance; }
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Prs3d_LineAspect) myEdgesAspect;
|
||||
|
@@ -14,6 +14,8 @@
|
||||
|
||||
#include <Prs3d_PointAspect.hxx>
|
||||
|
||||
#include <TCollection.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_PointAspect, Prs3d_BasicAspect)
|
||||
|
||||
// =======================================================================
|
||||
@@ -40,3 +42,22 @@ Prs3d_PointAspect::Prs3d_PointAspect (const Quantity_Color& theColor,
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
const TCollection_AsciiString Prs3d_PointAspect_ClassName = "Prs3d_PointAspect";
|
||||
|
||||
// =======================================================================
|
||||
// function : Dump
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_PointAspect::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, Prs3d_PointAspect_ClassName);
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myAspect->Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "Aspect", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
|
||||
DUMP_STOP_KEY (OS, Prs3d_PointAspect_ClassName);
|
||||
}
|
||||
|
||||
|
@@ -61,6 +61,9 @@ public:
|
||||
//! Returns marker's texture.
|
||||
const Handle(Graphic3d_MarkerImage)& GetTexture() const { return myAspect->GetMarkerImage(); }
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Graphic3d_AspectMarker3d) myAspect;
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include <Graphic3d_MaterialAspect.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_ShadingAspect, Prs3d_BasicAspect)
|
||||
|
||||
@@ -164,3 +165,22 @@ Standard_Real Prs3d_ShadingAspect::Transparency (const Aspect_TypeOfFacingModel
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
const TCollection_AsciiString Prs3d_ShadingAspect_ClassName = "Prs3d_ShadingAspect";
|
||||
|
||||
// =======================================================================
|
||||
// function : Dump
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_ShadingAspect::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, Prs3d_ShadingAspect_ClassName);
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myAspect->Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "Aspect", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
|
||||
DUMP_STOP_KEY (OS, Prs3d_ShadingAspect_ClassName);
|
||||
}
|
||||
|
||||
|
@@ -62,6 +62,9 @@ public:
|
||||
|
||||
void SetAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect) { myAspect = theAspect; }
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Graphic3d_AspectFillArea3d) myAspect;
|
||||
|
@@ -17,6 +17,8 @@
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
|
||||
#include <Font_NameOfFont.hxx>
|
||||
#include <Graphic3d.hxx>
|
||||
#include <TCollection.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Prs3d_TextAspect, Prs3d_BasicAspect)
|
||||
|
||||
@@ -47,3 +49,28 @@ Prs3d_TextAspect::Prs3d_TextAspect (const Handle(Graphic3d_AspectText3d)& theAsp
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
const TCollection_AsciiString Prs3d_TextAspect_ClassName = "Prs3d_TextAspect";
|
||||
|
||||
// =======================================================================
|
||||
// function : Dump
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_TextAspect::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, Prs3d_TextAspect_ClassName);
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myTextAspect->Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "TextAspect", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
|
||||
DUMP_VALUES (OS, "Height", myHeight);
|
||||
|
||||
DUMP_VALUES (OS, "HorizontalJustification", Graphic3d::HorizontalTextAlignmentToString (myHorizontalJustification));
|
||||
DUMP_VALUES (OS, "VerticalJustification", Graphic3d::VerticalTextAlignmentToString (myVerticalJustification));
|
||||
DUMP_VALUES (OS, "Orientation", Graphic3d::TextPathToString (myOrientation));
|
||||
|
||||
DUMP_STOP_KEY (OS, Prs3d_TextAspect_ClassName);
|
||||
}
|
||||
|
||||
|
@@ -97,6 +97,9 @@ public:
|
||||
|
||||
void SetAspect (const Handle(Graphic3d_AspectText3d)& theAspect) { myTextAspect = theAspect; }
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Graphic3d_AspectText3d) myTextAspect;
|
||||
|
@@ -1,3 +1,5 @@
|
||||
PrsMgr.cxx
|
||||
PrsMgr.hxx
|
||||
PrsMgr_ListOfPresentableObjects.hxx
|
||||
PrsMgr_ListOfPresentations.hxx
|
||||
PrsMgr_PresentableObject.cxx
|
||||
|
54
src/PrsMgr/PrsMgr.cxx
Normal file
54
src/PrsMgr/PrsMgr.cxx
Normal 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
53
src/PrsMgr/PrsMgr.hxx
Normal 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
|
@@ -837,3 +837,43 @@ void PrsMgr_PresentableObject::PolygonOffsets (Standard_Integer& theMode,
|
||||
myDrawer->ShadingAspect()->Aspect()->PolygonOffsets (theMode, theFactor, theUnits);
|
||||
}
|
||||
}
|
||||
|
||||
const TCollection_AsciiString PrsMgr_PresentableObject_ClassName = "PrsMgr_PresentableObject";
|
||||
|
||||
// =======================================================================
|
||||
// function : Dump
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void PrsMgr_PresentableObject::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, PrsMgr_PresentableObject_ClassName);
|
||||
|
||||
DUMP_VALUES (OS, "Parent", TCollection::GetPointerInfo (myParent));
|
||||
|
||||
DUMP_VALUES (OS, "Width", myOwnWidth);
|
||||
DUMP_VALUES (OS, "OwnColor", hasOwnColor);
|
||||
DUMP_VALUES (OS, "OwnMaterial", hasOwnMaterial);
|
||||
|
||||
DUMP_VALUES (OS, "InfiniteState", myInfiniteState);
|
||||
DUMP_VALUES (OS, "IsMutable", myIsMutable);
|
||||
DUMP_VALUES (OS, "HasOwnPresentations", myHasOwnPresentations);
|
||||
|
||||
DUMP_STOP_KEY (OS, PrsMgr_PresentableObject_ClassName);
|
||||
|
||||
/*
|
||||
PrsMgr_Presentations myPresentations; //!< list of presentations
|
||||
Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes; //!< sequence of object-specific clipping planes
|
||||
Handle(Prs3d_Drawer) myDrawer; //!< main presentation attributes
|
||||
Handle(Prs3d_Drawer) myHilightDrawer; //!< (optional) custom presentation attributes for highlighting selected object
|
||||
Handle(Prs3d_Drawer) myDynHilightDrawer; //!< (optional) custom presentation attributes for highlighting detected object
|
||||
Handle(Graphic3d_TransformPers) myTransformPersistence; //!< transformation persistence
|
||||
Handle(Geom_Transformation) myLocalTransformation; //!< local transformation relative to parent object
|
||||
Handle(Geom_Transformation) myTransformation; //!< absolute transformation of this object (combined parents + local transformations)
|
||||
Handle(Geom_Transformation) myCombinedParentTransform; //!< transformation of parent object (combined for all parents)
|
||||
PrsMgr_ListOfPresentableObjects myChildren; //!< list of children
|
||||
gp_GTrsf myInvTransformation; //!< inversion of absolute transformation (combined parents + local transformations)
|
||||
PrsMgr_TypeOfPresentation3d myTypeOfPresentation3d; //!< presentation type
|
||||
|
||||
Aspect_TypeOfFacingModel myCurrentFacingModel; //!< current facing model
|
||||
*/
|
||||
}
|
||||
|
@@ -479,6 +479,9 @@ public: //! @name simplified presentation properties API
|
||||
//! Clears settings provided by the drawing tool aDrawer.
|
||||
Standard_EXPORT virtual void UnsetAttributes();
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const;
|
||||
|
||||
public: //! @name deprecated methods
|
||||
|
||||
//! gives the list of modes which are flagged "to be updated".
|
||||
|
@@ -1,3 +1,5 @@
|
||||
Quantity.cxx
|
||||
Quantity.hxx
|
||||
Quantity_AbsorbedDose.hxx
|
||||
Quantity_Acceleration.hxx
|
||||
Quantity_AcousticIntensity.hxx
|
||||
|
191
src/Quantity/Quantity.cxx
Normal file
191
src/Quantity/Quantity.cxx
Normal 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
53
src/Quantity/Quantity.hxx
Normal 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
|
@@ -15,10 +15,14 @@
|
||||
|
||||
#include <Quantity_Color.hxx>
|
||||
|
||||
#include <Message_Alerts.hxx>
|
||||
#include <NCollection_Vector.hxx>
|
||||
|
||||
#include <Quantity_ColorDefinitionError.hxx>
|
||||
#include <Quantity_ColorRGBA.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <TCollection.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#include <string.h>
|
||||
@@ -3924,3 +3928,32 @@ void call_rgbhls (float r, float g, float b, float& h, float& l, float& s)
|
||||
if (h < 0.0) h += 360.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const TCollection_AsciiString Quantity_Color_ClassName = "Quantity_Color";
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Quantity_Color::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, Quantity_Color_ClassName);
|
||||
|
||||
DUMP_VALUES (OS, "MyRed", MyRed);
|
||||
DUMP_VALUES (OS, "MyGreen", MyGreen);
|
||||
DUMP_VALUES (OS, "MyBlue", MyBlue);
|
||||
|
||||
DUMP_STOP_KEY (OS, Quantity_Color_ClassName);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean Quantity_Color::Init (const Standard_OStream& /*OS*/)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
@@ -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,12 @@ Standard_Boolean operator == (const Quantity_Color& Other) const
|
||||
//! Internal test
|
||||
Standard_EXPORT static void Test();
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT void Dump (Standard_OStream& OS) const;
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS);
|
||||
|
||||
private:
|
||||
|
||||
//! Converts HLS components into RGB ones.
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#include <Quantity_ColorRGBA.hxx>
|
||||
|
||||
#include <Graphic3d_Vec4.hxx>
|
||||
#include <TCollection.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -198,3 +199,24 @@ bool Quantity_ColorRGBA::ColorFromHex (const char* const theHexColorString,
|
||||
const ColorInteger aColorComponentBase = isShort ? THE_HEX_COLOR_COMPONENT_SHORT_BASE : THE_HEX_COLOR_COMPONENT_BASE;
|
||||
return convertIntegerToColorRGBA (aHexColorInteger, aColorComponentBase, hasAlphaComponent, theColor);
|
||||
}
|
||||
|
||||
const TCollection_AsciiString Quantity_ColorRGBA_ClassName = "Quantity_ColorRGBA";
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Quantity_ColorRGBA::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, Quantity_ColorRGBA_ClassName);
|
||||
|
||||
DUMP_VALUES (OS, "Alpha", Alpha());
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
myRgb.Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "RGB", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
|
||||
DUMP_STOP_KEY (OS, Quantity_ColorRGBA_ClassName);
|
||||
}
|
||||
|
@@ -121,6 +121,9 @@ public:
|
||||
Quantity_ColorRGBA& theColor,
|
||||
const bool theAlphaComponentIsOff = false);
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT void Dump (Standard_OStream& OS) const;
|
||||
|
||||
private:
|
||||
|
||||
static void myTestSize3() { Standard_STATIC_ASSERT (sizeof(float) * 3 == sizeof(Quantity_Color)); }
|
||||
|
@@ -1,3 +1,5 @@
|
||||
SelectMgr.cxx
|
||||
SelectMgr.hxx
|
||||
SelectMgr_AndFilter.cxx
|
||||
SelectMgr_AndFilter.hxx
|
||||
SelectMgr_BaseFrustum.cxx
|
||||
|
89
src/SelectMgr/SelectMgr.cxx
Normal file
89
src/SelectMgr/SelectMgr.cxx
Normal 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;
|
||||
}
|
82
src/SelectMgr/SelectMgr.hxx
Normal file
82
src/SelectMgr/SelectMgr.hxx
Normal 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
|
@@ -15,6 +15,9 @@
|
||||
|
||||
#include <SelectMgr_BaseFrustum.hxx>
|
||||
|
||||
#include <Message.hxx>
|
||||
#include <Message_Alerts.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_BaseFrustum,Standard_Transient)
|
||||
|
||||
//=======================================================================
|
||||
@@ -245,3 +248,17 @@ gp_Pnt SelectMgr_BaseFrustum::DetectedPoint (const Standard_Real /*theDepth*/) c
|
||||
{
|
||||
return gp_Pnt (RealLast(), RealLast(), RealLast());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//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));
|
||||
}
|
||||
|
@@ -28,6 +28,8 @@
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.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
|
||||
@@ -171,6 +173,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:
|
||||
|
@@ -82,3 +82,22 @@ void SelectMgr_EntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationMa
|
||||
mySelectable->HilightOwnerWithColor (thePM, theStyle, this);
|
||||
}
|
||||
}
|
||||
|
||||
const TCollection_AsciiString SelectMgr_EntityOwner_ClassName = "SelectMgr_EntityOwner";
|
||||
|
||||
// =======================================================================
|
||||
// function : Dump
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void SelectMgr_EntityOwner::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, SelectMgr_EntityOwner_ClassName);
|
||||
|
||||
|
||||
DUMP_VALUES (OS, "Selectable", TCollection::GetPointerInfo (mySelectable));
|
||||
DUMP_VALUES (OS, "Priority", mypriority);
|
||||
DUMP_VALUES (OS, "IsSelected", myIsSelected);
|
||||
DUMP_VALUES (OS, "ComesFromDecomposition", myFromDecomposition);
|
||||
|
||||
DUMP_STOP_KEY (OS, SelectMgr_EntityOwner_ClassName);
|
||||
}
|
||||
|
@@ -187,6 +187,9 @@ public:
|
||||
//! Sets flag indicating this owner points to a part of object (TRUE) or to entire object (FALSE).
|
||||
void SetComesFromDecomposition (const Standard_Boolean theIsFromDecomposition) { myFromDecomposition = theIsFromDecomposition; }
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const;
|
||||
|
||||
public:
|
||||
|
||||
//! Sets the selectable object.
|
||||
|
@@ -548,3 +548,32 @@ const Handle(SelectMgr_EntityOwner)& SelectMgr_SelectableObject::GetAssemblyOwne
|
||||
{
|
||||
return THE_NULL_ENTITYOWNER;
|
||||
}
|
||||
|
||||
const TCollection_AsciiString SelectMgr_SelectableObject_ClassName = "SelectMgr_SelectableObject";
|
||||
|
||||
// =======================================================================
|
||||
// function : Dump
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void SelectMgr_SelectableObject::Dump (Standard_OStream& OS) const
|
||||
{
|
||||
DUMP_START_KEY (OS, SelectMgr_SelectableObject_ClassName);
|
||||
|
||||
{
|
||||
Standard_SStream aTmpStream;
|
||||
PrsMgr_PresentableObject::Dump (aTmpStream);
|
||||
DUMP_VALUES (OS, "PrsMgr_PresentableObject", TCollection::ToDumpString (aTmpStream));
|
||||
}
|
||||
|
||||
DUMP_VALUES (OS, "GlobalSelectionMode", myGlobalSelMode);
|
||||
//DUMP_VALUES (OS, "mycurrent", mycurrent);
|
||||
DUMP_VALUES (OS, "IsAutoHilight", myAutoHilight);
|
||||
|
||||
/*
|
||||
SelectMgr_SequenceOfSelection myselections; //!< list of selections
|
||||
Handle(Prs3d_Presentation) mySelectionPrs; //!< optional presentation for highlighting selected object
|
||||
Handle(Prs3d_Presentation) myHilightPrs; //!< optional presentation for highlighting detected object
|
||||
*/
|
||||
|
||||
DUMP_STOP_KEY (OS, SelectMgr_SelectableObject_ClassName);
|
||||
}
|
||||
|
@@ -169,6 +169,9 @@ public:
|
||||
//! Returns common entity owner if the object is an assembly
|
||||
Standard_EXPORT virtual const Handle(SelectMgr_EntityOwner)& GetAssemblyOwner() const;
|
||||
|
||||
//! Dumps the content of me on the stream <OS>.
|
||||
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
//! Begins the iteration scanning for sensitive primitives.
|
||||
|
@@ -223,6 +223,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
|
||||
|
@@ -18,6 +18,8 @@
|
||||
|
||||
#include <Bnd_Range.hxx>
|
||||
#include <Standard_TypeDef.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
#include <TCollection.hxx>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -117,6 +119,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;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user