Compare commits
24 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
df3644aa35 | ||
|
0252a0a4fb | ||
|
b4baade508 | ||
|
460abf4e0f | ||
|
a9db047e5d | ||
|
9640291ff0 | ||
|
7b296f0230 | ||
|
bf82385599 | ||
|
41a2c46b21 | ||
|
fd448091bf | ||
|
280e1f1b27 | ||
|
fd8fbd466b | ||
|
cdfdde3191 | ||
|
2147f85a35 | ||
|
502194e4fc | ||
|
d5c557436d | ||
|
52cc62eee8 | ||
|
7d4472c752 | ||
|
3ca159f3ca | ||
|
f25bebd7b3 | ||
|
68be9e7b9c | ||
|
7bc6dba60c | ||
|
37d575793d | ||
|
9f13057096 |
@@ -1,4 +1,4 @@
|
||||
TModelingData TKShapeView
|
||||
TModelingData TKShapeView TKMessageModel TKMessageView
|
||||
TVisualization TKView TKVInspector
|
||||
TApplicationFramework TKTreeModel TKTInspectorAPI TKDFBrowser
|
||||
TTool TKTInspector TKToolsDraw TInspectorEXE
|
@@ -58,7 +58,7 @@ set SYS_VS_LIST {}
|
||||
set SYS_VC_LIST {}
|
||||
set SYS_VCVARS_LIST {}
|
||||
|
||||
# detect installed Visual Studio 2017+ instances by running vswhere.exe
|
||||
# detect installed Visual Studio 2017 instances by running vswhere.exe
|
||||
if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] } {
|
||||
lappend ::SYS_VS_LIST "Visual Studio 2017 (15, toolset v141)"
|
||||
lappend ::SYS_VC_LIST "vc141"
|
||||
@@ -69,16 +69,6 @@ if { ! [catch {exec vswhere.exe -version "\[15.0,15.99\]" -latest -requires Micr
|
||||
lappend ::SYS_VC_LIST "vc141-uwp"
|
||||
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
|
||||
}
|
||||
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath} res] } {
|
||||
lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset v142)"
|
||||
lappend ::SYS_VC_LIST "vc142"
|
||||
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
|
||||
}
|
||||
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Workload.Universal -property installationPath} res] } {
|
||||
lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset v142) UWP"
|
||||
lappend ::SYS_VC_LIST "vc142-uwp"
|
||||
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
|
||||
}
|
||||
|
||||
# detect installed Visual Studio instances from global environment
|
||||
if { [info exists ::env(VS140COMNTOOLS)] } {
|
||||
|
@@ -256,7 +256,7 @@ proc genAllResources {} {
|
||||
|
||||
# Wrapper-function to generate VS project files
|
||||
proc genproj {theFormat args} {
|
||||
set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "vc142" "cbp" "xcd" "pro"}
|
||||
set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "cbp" "xcd" "pro"}
|
||||
set aSupportedPlatforms { "wnt" "uwp" "lin" "mac" "ios" "qnx" }
|
||||
set isHelpRequire false
|
||||
|
||||
@@ -312,7 +312,6 @@ proc genproj {theFormat args} {
|
||||
vc12 - Visual Studio 2013
|
||||
vc14 - Visual Studio 2015
|
||||
vc141 - Visual Studio 2017
|
||||
vc142 - Visual Studio 2019
|
||||
cbp - CodeBlocks
|
||||
xcd - XCode
|
||||
pro - Qt Creator
|
||||
@@ -511,8 +510,7 @@ proc OS:MKPRC { theOutDir theFormat theLibType thePlatform theCmpl } {
|
||||
"vc11" -
|
||||
"vc12" -
|
||||
"vc14" -
|
||||
"vc141" -
|
||||
"vc142" { OS:MKVC $anOutDir $aModules $anAllSolution $theFormat $isUWP}
|
||||
"vc141" { OS:MKVC $anOutDir $aModules $anAllSolution $theFormat $isUWP}
|
||||
"cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution $thePlatform $theCmpl }
|
||||
"xcd" {
|
||||
set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000"
|
||||
@@ -936,7 +934,7 @@ proc osutils:collectinc {theModules theIncPath} {
|
||||
set anIncFiles [glob -tails -nocomplain -dir ${anIncPath} "*"]
|
||||
foreach anIncFile ${anIncFiles} {
|
||||
if { [lsearch -exact ${allHeaderFiles} ${anIncFile}] == -1 } {
|
||||
puts "Warning: file ${anIncPath}/${anIncFile} is not present in the sources and will be removed from ${theIncPath}"
|
||||
puts "Warning: file ${anIncPath}/${anIncFile} is not presented in the sources and will be removed from ${theIncPath}!"
|
||||
file delete -force "${theIncPath}/${anIncFile}"
|
||||
}
|
||||
}
|
||||
@@ -967,7 +965,7 @@ proc osutils:vcsolution:header { vcversion } {
|
||||
append var \
|
||||
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \
|
||||
"# Visual Studio 2013\n"
|
||||
} elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141" || "$vcversion" == "vc142" } {
|
||||
} elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141"} {
|
||||
append var \
|
||||
"Microsoft Visual Studio Solution File, Format Version 12.00\n" \
|
||||
"# Visual Studio 14\n"
|
||||
@@ -1205,9 +1203,6 @@ proc osutils:vcproj:readtemplate {theVcVer isUWP isExec} {
|
||||
if { $theVcVer == "vc141" } {
|
||||
set aVCRTVer "vc14"
|
||||
set aToolset "v141"
|
||||
} elseif { $theVcVer == "vc142" } {
|
||||
set aVCRTVer "vc14"
|
||||
set aToolset "v142"
|
||||
}
|
||||
|
||||
set what "$theVcVer"
|
||||
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 11 KiB |
BIN
data/images/hatch_1_.png
Normal file
After Width: | Height: | Size: 670 B |
BIN
data/images/hatch_2.png
Normal file
After Width: | Height: | Size: 679 B |
BIN
data/images/hatch_3.png
Normal file
After Width: | Height: | Size: 761 B |
BIN
data/images/hatch_4.png
Normal file
After Width: | Height: | Size: 674 B |
BIN
data/images/hatch_5.png
Normal file
After Width: | Height: | Size: 887 B |
BIN
data/images/hatch_6.png
Normal file
After Width: | Height: | Size: 933 B |
BIN
data/images/hatch_7.png
Normal file
After Width: | Height: | Size: 633 B |
BIN
data/images/hatch_8.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
@@ -1716,40 +1716,6 @@ aGroup->SetPrimitivesAspect (myDrawer->LineAspect()->Aspect()); //!< next array
|
||||
aGroup->AddPrimitiveArray (aLines);
|
||||
~~~~
|
||||
|
||||
@subsection upgrade_740_materials Material definition
|
||||
|
||||
Decomposition of Ambient, Diffuse, Specular and Emissive properties has been eliminated within *Graphic3d_MaterialAspect* definition.
|
||||
As result, the following methods of *Graphic3d_MaterialAspect* class have been removed: SetReflectionMode(), SetReflectionModeOn(), Ambient(), Diffuse(), Emissive(), Specular(), SetAmbient(), SetDiffuse(), SetSpecular(), SetEmissive().
|
||||
|
||||
Previously, computation of final value required the following code:
|
||||
~~~~
|
||||
Graphic3d_MaterialAspect theMaterial; Quantity_Color theInteriorColor;
|
||||
Graphic3d_Vec3 anAmbient (0.0f);
|
||||
if (theMaterial.ReflectionMode (Graphic3d_TOR_AMBIENT))
|
||||
{
|
||||
anAmbient = theMaterial.MaterialType (Graphic3d_MATERIAL_ASPECT)
|
||||
? (Graphic3d_Vec3 )theInteriorColor * theMaterial.Ambient()
|
||||
: (Graphic3d_Vec3 )theMaterial.AmbientColor() * theMaterial.Ambient();
|
||||
}
|
||||
~~~~
|
||||
|
||||
New code looks like this:
|
||||
~~~~
|
||||
Graphic3d_MaterialAspect theMaterial; Quantity_Color theInteriorColor;
|
||||
Graphic3d_Vec3 anAmbient = theMaterial.AmbientColor();
|
||||
if (theMaterial.MaterialType (Graphic3d_MATERIAL_ASPECT)) { anAmbient *= (Graphic3d_Vec3 )theInteriorColor; }
|
||||
~~~~
|
||||
|
||||
Existing code should be updated to:
|
||||
- Replace Graphic3d_MaterialAspect::SetReflectionModeOff() with setting black color; SetReflectionModeOn() calls can be simply removed.
|
||||
R.g. theMaterial.SetAmbientColor(Quantity_NOC_BLACK).
|
||||
- Replace Graphic3d_MaterialAspect::Ambient(), SetAmbient(), Diffuse(), SetDiffuse(), Specular(), SetSpecular(), Emissive(), SetEmissive() with methods working with pre-multiplied color.
|
||||
E.g. theMaterial.SetAmbientColor(Graphic3d_Vec3 (1.0f, 0.0f, 0.0f) * 0.2f).
|
||||
- Avoid using Graphic3d_MaterialAspect::Color() and SetColor() with non-physical materials (Graphic3d_MATERIAL_ASPECT).
|
||||
These materials do not include color definition, because it is taken from Graphic3d_Aspects::InteriorColor() - this has not been changed.
|
||||
However, previously it was possible storing the color with SetColor() call and then fetching it with Color() by application code (the rendering ignored this value);
|
||||
now SetColor() explicitly ignores call for Graphic3d_MATERIAL_ASPECT materials and Color() returns DiffuseColor() multiplication coefficients.
|
||||
|
||||
@subsection upgrade_740_text Changes in Graphic3d_Text and OpenGl_Text API
|
||||
|
||||
Parameters of *Text* in *Graphic3d_Group* are moved into a new *Graphic3d_Text* class. *AddText* of *Graphic3d_Group* should be used instead of the previous *Text*.
|
||||
|
@@ -79,10 +79,10 @@ case 6: //color
|
||||
Handle(Graphic3d_Group) mygroup = Prs3d_Root::CurrentGroup(aPresentation);
|
||||
myAspect = (new Prs3d_ShadingAspect())->Aspect();
|
||||
Graphic3d_MaterialAspect material = myAspect->FrontMaterial();
|
||||
material.SetAmbientColor (Quantity_NOC_BLACK);
|
||||
material.SetDiffuseColor (Quantity_NOC_BLACK);
|
||||
material.SetSpecularColor(Quantity_NOC_BLACK);
|
||||
material.SetEmissiveColor(Quantity_NOC_BLACK);
|
||||
material.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
|
||||
material.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
|
||||
material.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
|
||||
material.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
|
||||
myAspect->SetFrontMaterial(material);
|
||||
|
||||
mygroup->SetPrimitivesAspect(myAspect);
|
||||
|
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
|
||||
|
@@ -633,6 +633,11 @@ void AIS_ColoredShape::addShapesWithCustomProps (const Handle(Prs3d_Presentation
|
||||
{
|
||||
aShadedGroup = thePrs->NewGroup();
|
||||
aShadedGroup->SetClosed (isClosed);
|
||||
if (isClosed)
|
||||
{
|
||||
if (aDrawer->HasOwnFillCappingAspect())
|
||||
aShadedGroup->SetGroupPrimitivesAspect (aDrawer->FillCappingAspect());
|
||||
}
|
||||
}
|
||||
aShadedGroup->SetPrimitivesAspect (aDrawer->ShadingAspect()->Aspect());
|
||||
aShadedGroup->AddPrimitiveArray (aTriangles);
|
||||
|
@@ -403,17 +403,16 @@ void AIS_Dimension::DrawArrow (const Handle(Prs3d_Presentation)& thePresentation
|
||||
anArrow->AddVertex (aRightPoint);
|
||||
|
||||
// Set aspect for arrow triangles
|
||||
Graphic3d_PolygonOffset aPolOffset;
|
||||
aPolOffset.Mode = Aspect_POM_Off;
|
||||
aPolOffset.Factor = 0.0f;
|
||||
aPolOffset.Units = 0.0f;
|
||||
Handle(Graphic3d_AspectFillArea3d) aShadingStyle = new Graphic3d_AspectFillArea3d();
|
||||
aShadingStyle->SetInteriorStyle (Aspect_IS_SOLID);
|
||||
aShadingStyle->SetColor (myDrawer->DimensionAspect()->ArrowAspect()->Aspect()->Color());
|
||||
aShadingStyle->SetShadingModel (Graphic3d_TOSM_UNLIT);
|
||||
aShadingStyle->SetPolygonOffset (aPolOffset);
|
||||
Graphic3d_MaterialAspect aShadeMat (Graphic3d_NOM_DEFAULT);
|
||||
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
|
||||
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
|
||||
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
|
||||
|
||||
aGroup->SetPrimitivesAspect (aShadingStyle);
|
||||
Handle(Prs3d_ShadingAspect) aShadingStyle = new Prs3d_ShadingAspect();
|
||||
aShadingStyle->SetColor (myDrawer->DimensionAspect()->ArrowAspect()->Aspect()->Color());
|
||||
aShadingStyle->SetMaterial (aShadeMat);
|
||||
|
||||
aGroup->SetPrimitivesAspect (aShadingStyle->Aspect());
|
||||
aGroup->AddPrimitiveArray (anArrow);
|
||||
}
|
||||
|
||||
@@ -531,9 +530,9 @@ void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
}
|
||||
|
||||
Graphic3d_MaterialAspect aShadeMat (Graphic3d_NOM_DEFAULT);
|
||||
aShadeMat.SetAmbientColor (Quantity_NOC_BLACK);
|
||||
aShadeMat.SetDiffuseColor (Quantity_NOC_BLACK);
|
||||
aShadeMat.SetSpecularColor(Quantity_NOC_BLACK);
|
||||
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
|
||||
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
|
||||
aShadeMat.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetInteriorColor (aColor);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetBackInteriorColor (aColor);
|
||||
myDrawer->ShadingAspect()->SetMaterial (aShadeMat);
|
||||
|
@@ -2538,6 +2538,15 @@ void AIS_InteractiveContext::SetTransformPersistence (const Handle(AIS_Interacti
|
||||
const Handle(Graphic3d_TransformPers)& theTrsfPers)
|
||||
{
|
||||
theObject->SetTransformPersistence (theTrsfPers);
|
||||
UpdateOnTransformPersistence (theObject);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdateOnTransformPersistence
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::UpdateOnTransformPersistence (const Handle(AIS_InteractiveObject)& theObject)
|
||||
{
|
||||
if (!myObjects.IsBound (theObject))
|
||||
{
|
||||
return;
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <AIS_ListOfInteractive.hxx>
|
||||
#include <AIS_Selection.hxx>
|
||||
#include <AIS_SelectionModesConcurrency.hxx>
|
||||
#include <AIS_SelectionScheme.hxx>
|
||||
#include <AIS_StatusOfDetection.hxx>
|
||||
#include <AIS_StatusOfPick.hxx>
|
||||
#include <AIS_TypeOfIso.hxx>
|
||||
@@ -344,6 +345,11 @@ public: //! @name object local transformation management
|
||||
Standard_EXPORT void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObject,
|
||||
const Handle(Graphic3d_TransformPers)& theTrsfPers);
|
||||
|
||||
//! Updates displayed interactive object by checking and recomputing its flagged as "to be recomputed" presentation and selection structures.
|
||||
//! This method does not force any recomputation on its own.
|
||||
//! The method recomputes selections even if they are loaded without activation in particular selector.
|
||||
Standard_EXPORT void UpdateOnTransformPersistence (const Handle(AIS_InteractiveObject)& theIObj);
|
||||
|
||||
Standard_DEPRECATED("This method is deprecated - SetTransformPersistence() taking Graphic3d_TransformPers should be called instead")
|
||||
void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObj,
|
||||
const Graphic3d_TransModeFlags& theFlag,
|
||||
@@ -470,6 +476,24 @@ public: //! @name Selection management
|
||||
return AddSelect (theObject->GlobalSelOwner());
|
||||
}
|
||||
|
||||
//! Selects everything found in the bounding rectangle defined by the pixel minima and maxima, XPMin, YPMin, XPMax, and YPMax in the view.
|
||||
//! The objects detected are passed to the main viewer, which is then updated.
|
||||
Standard_EXPORT AIS_StatusOfPick Select (const Standard_Integer theXPMin,
|
||||
const Standard_Integer theYPMin,
|
||||
const Standard_Integer theXPMax,
|
||||
const Standard_Integer theYPMax,
|
||||
const Handle(V3d_View)& theView,
|
||||
const AIS_SelectionScheme theSelScheme);
|
||||
|
||||
//! polyline selection; clears the previous picked list
|
||||
Standard_EXPORT AIS_StatusOfPick Select (const TColgp_Array1OfPnt2d& thePolyline,
|
||||
const Handle(V3d_View)& theView,
|
||||
const AIS_SelectionScheme theSelScheme);
|
||||
|
||||
//! Stores and hilights the previous detected; Unhilights the previous picked.
|
||||
//! @sa MoveTo().
|
||||
Standard_EXPORT AIS_StatusOfPick Select (const AIS_SelectionScheme theSelScheme);
|
||||
|
||||
//! Selects everything found in the bounding rectangle defined by the pixel minima and maxima, XPMin, YPMin, XPMax, and YPMax in the view.
|
||||
//! The objects detected are passed to the main viewer, which is then updated.
|
||||
Standard_EXPORT AIS_StatusOfPick Select (const Standard_Integer theXPMin,
|
||||
@@ -511,6 +535,13 @@ public: //! @name Selection management
|
||||
//! Returns bounding box of selected objects.
|
||||
Standard_EXPORT Bnd_Box BoundingBoxOfSelection() const;
|
||||
|
||||
//! Sets list of owner selected/deselected using selection scheme
|
||||
//! It is possible that selection of other objects is changed relatively selection scheme .
|
||||
//! \param theOwner owners to change selection state
|
||||
//! \param theSelScheme selection scheme
|
||||
Standard_EXPORT AIS_StatusOfPick Select (const AIS_NListOfEntityOwner& theOwners,
|
||||
const AIS_SelectionScheme theSelScheme);
|
||||
|
||||
//! Fits the view correspondingly to the bounds of selected objects.
|
||||
//! Infinite objects are ignored if infinite state of AIS_InteractiveObject is set to true.
|
||||
Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView,
|
||||
@@ -1246,9 +1277,10 @@ protected: //! @name internal methods
|
||||
//! for AutoHighlight, e.g. is used for selection.
|
||||
Standard_EXPORT void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner);
|
||||
|
||||
//! Helper function that highlights the owners with check
|
||||
//! Helper function that highlights the owners given with <theStyle> with check
|
||||
//! for AutoHighlight, e.g. is used for selection.
|
||||
Standard_EXPORT void highlightOwners (const AIS_NListOfEntityOwner& theOwners);
|
||||
Standard_EXPORT void highlightOwners (const AIS_NListOfEntityOwner& theOwners,
|
||||
const Standard_Boolean& theToUseObjectDisplayMode);
|
||||
|
||||
//! Helper function that highlights global owner of the object given with <theStyle> with check
|
||||
//! for AutoHighlight, e.g. is used for selection.
|
||||
@@ -1263,7 +1295,7 @@ protected: //! @name internal methods
|
||||
//! switched on in AIS_GlobalStatus will be highlighted with context's sub-intensity color.
|
||||
Standard_EXPORT void unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
|
||||
|
||||
//! Helper function that unhighlights the owners with check
|
||||
//! Helper function that highlights the owners given with <theStyle> with check
|
||||
//! for AutoHighlight, e.g. is used for selection.
|
||||
Standard_EXPORT void unhighlightOwners (const AIS_NListOfEntityOwner& theOwners,
|
||||
const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
|
||||
|
@@ -107,7 +107,7 @@ void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwn
|
||||
{
|
||||
anOwners.Append (theOwner);
|
||||
}
|
||||
highlightOwners (anOwners);
|
||||
highlightOwners (anOwners, Standard_False/*check if it is really important*/);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -116,14 +116,19 @@ void AIS_InteractiveContext::highlightSelected (const Handle(SelectMgr_EntityOwn
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
|
||||
const Handle(Prs3d_Drawer)& theStyle,
|
||||
const Standard_Integer theDispMode)
|
||||
const Standard_Integer /*theDispMode*/)
|
||||
{
|
||||
if (theObj.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Integer aHiMode = getHilightMode (theObj, theStyle, theDispMode);
|
||||
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (theObj);
|
||||
if (!aStatusPtr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
const Standard_Integer aHiMode = getHilightMode (theObj, theStyle, (*aStatusPtr)->DisplayMode());
|
||||
const Handle(SelectMgr_EntityOwner)& aGlobOwner = theObj->GlobalSelOwner();
|
||||
|
||||
if (aGlobOwner.IsNull())
|
||||
@@ -148,7 +153,7 @@ void AIS_InteractiveContext::highlightGlobal (const Handle(AIS_InteractiveObject
|
||||
{
|
||||
anOwners.Append (aGlobOwner);
|
||||
}
|
||||
highlightOwners (anOwners);
|
||||
highlightOwners (anOwners, Standard_True);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -172,20 +177,16 @@ void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& th
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
|
||||
const Handle(AIS_InteractiveObject) anInteractive = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
|
||||
Handle(AIS_GlobalStatus) aStatus;
|
||||
if (!myObjects.Find (anInteractive, aStatus))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anInteractive);
|
||||
|
||||
if (anOwner->IsAutoHilight())
|
||||
{
|
||||
anOwner->Unhilight (myMainPM);
|
||||
if (theIsToHilightSubIntensity)
|
||||
{
|
||||
if (aStatus->IsSubIntensityOn())
|
||||
if (aStatusPtr && (*aStatusPtr)->IsSubIntensityOn())
|
||||
{
|
||||
const Standard_Integer aHiMode = getHilightMode (anInteractive, aStatus->HilightStyle(), aStatus->DisplayMode());
|
||||
const Standard_Integer aHiMode = getHilightMode (anInteractive, (*aStatusPtr)->HilightStyle(), (*aStatusPtr)->DisplayMode());
|
||||
highlightWithSubintensity (anOwner, aHiMode);
|
||||
}
|
||||
}
|
||||
@@ -194,9 +195,9 @@ void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& th
|
||||
{
|
||||
anObjToClear.Add (anInteractive);
|
||||
}
|
||||
if (anOwner == anInteractive->GlobalSelOwner())
|
||||
if (aStatusPtr && anOwner == anInteractive->GlobalSelOwner())
|
||||
{
|
||||
aStatus->SetHilightStatus (Standard_False);
|
||||
(*aStatusPtr)->SetHilightStatus (Standard_False);
|
||||
}
|
||||
}
|
||||
for (NCollection_IndexedMap<Handle(AIS_InteractiveObject)>::Iterator anIter (anObjToClear); anIter.More(); anIter.Next())
|
||||
@@ -490,86 +491,14 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMi
|
||||
const Standard_Integer theXPMax,
|
||||
const Standard_Integer theYPMax,
|
||||
const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean toUpdateViewer)
|
||||
const AIS_SelectionScheme theSelScheme)
|
||||
{
|
||||
if (theView->Viewer() != myMainVwr)
|
||||
{
|
||||
throw Standard_ProgramError ("AIS_InteractiveContext::Select() - invalid argument");
|
||||
}
|
||||
|
||||
// all objects detected by the selector are taken, previous current objects are emptied,
|
||||
// new objects are put...
|
||||
ClearSelected (Standard_False);
|
||||
myLastActiveView = theView.get();
|
||||
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
|
||||
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner)& aCurOwner = myMainSel->Picked (aPickIter);
|
||||
if (aCurOwner.IsNull() || !aCurOwner->HasSelectable() || !myFilters->IsOk (aCurOwner))
|
||||
continue;
|
||||
|
||||
mySelection->Select (aCurOwner);
|
||||
}
|
||||
|
||||
if (myAutoHilight)
|
||||
{
|
||||
HilightSelected (toUpdateViewer);
|
||||
}
|
||||
|
||||
Standard_Integer aSelNum = NbSelected();
|
||||
|
||||
return (aSelNum == 0) ? AIS_SOP_NothingSelected
|
||||
: (aSelNum == 1) ? AIS_SOP_OneSelected
|
||||
: AIS_SOP_SeveralSelected;
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Select
|
||||
//purpose : Selection by polyline
|
||||
//=======================================================================
|
||||
AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& thePolyline,
|
||||
const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean toUpdateViewer)
|
||||
{
|
||||
if (theView->Viewer() != myMainVwr)
|
||||
{
|
||||
throw Standard_ProgramError ("AIS_InteractiveContext::Select() - invalid argument");
|
||||
}
|
||||
|
||||
// all objects detected by the selector are taken, previous current objects are emptied,
|
||||
// new objects are put...
|
||||
ClearSelected (Standard_False);
|
||||
myLastActiveView = theView.get();
|
||||
myMainSel->Pick (thePolyline, theView);
|
||||
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner) anOwner = myMainSel->Picked (aPickIter);
|
||||
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
|
||||
continue;
|
||||
|
||||
mySelection->Select (anOwner);
|
||||
}
|
||||
|
||||
if (myAutoHilight)
|
||||
{
|
||||
HilightSelected (toUpdateViewer);
|
||||
}
|
||||
|
||||
Standard_Integer aSelNum = NbSelected();
|
||||
|
||||
return (aSelNum == 0) ? AIS_SOP_NothingSelected
|
||||
: (aSelNum == 1) ? AIS_SOP_OneSelected
|
||||
: AIS_SOP_SeveralSelected;
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Select
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdateViewer)
|
||||
{
|
||||
if (!myLastPicked.IsNull())
|
||||
{
|
||||
Graphic3d_Vec2i aMousePos (-1, -1);
|
||||
@@ -582,54 +511,126 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean toUpdate
|
||||
{
|
||||
return AIS_SOP_NothingSelected;
|
||||
}
|
||||
|
||||
if (myAutoHilight)
|
||||
{
|
||||
clearDynamicHighlight();
|
||||
}
|
||||
if (!myLastPicked->IsSelected()
|
||||
|| myLastPicked->IsForcedHilight()
|
||||
|| NbSelected() > 1)
|
||||
{
|
||||
SetSelected (myLastPicked, Standard_False);
|
||||
if(toUpdateViewer)
|
||||
{
|
||||
UpdateCurrentViewer();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
|
||||
|
||||
AIS_NListOfEntityOwner aPickedOwners;
|
||||
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
|
||||
{
|
||||
ClearSelected (toUpdateViewer);
|
||||
aPickedOwners.Append (myMainSel->Picked (aPickIter));
|
||||
}
|
||||
|
||||
Standard_Integer aSelNum = NbSelected();
|
||||
return Select (aPickedOwners, theSelScheme);
|
||||
}
|
||||
|
||||
return (aSelNum == 0) ? AIS_SOP_NothingSelected
|
||||
: (aSelNum == 1) ? AIS_SOP_OneSelected
|
||||
: AIS_SOP_SeveralSelected;
|
||||
//=======================================================================
|
||||
//function : Select
|
||||
//purpose : Selection by polyline
|
||||
//=======================================================================
|
||||
AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& thePolyline,
|
||||
const Handle(V3d_View)& theView,
|
||||
const AIS_SelectionScheme theSelScheme)
|
||||
{
|
||||
if (theView->Viewer() != myMainVwr)
|
||||
{
|
||||
throw Standard_ProgramError ("AIS_InteractiveContext::Select() - invalid argument");
|
||||
}
|
||||
|
||||
myMainSel->Pick (thePolyline, theView);
|
||||
|
||||
AIS_NListOfEntityOwner aPickedOwners;
|
||||
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
|
||||
{
|
||||
aPickedOwners.Append (myMainSel->Picked (aPickIter));
|
||||
}
|
||||
|
||||
return Select (aPickedOwners, theSelScheme);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Select
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_StatusOfPick AIS_InteractiveContext::Select (const AIS_SelectionScheme theSelScheme)
|
||||
{
|
||||
// special case: single selection of detected owner - is it necessary ?
|
||||
/*if (myWasLastMain && !myLastinMain.IsNull() && !myAutoHilight &&
|
||||
(myLastinMain->IsSelected()
|
||||
&& !myLastinMain->IsForcedHilight()
|
||||
&& NbSelected() <= 1))
|
||||
{
|
||||
mySelection->selectOwner(myLastinMain, aPrevSelected, theSelScheme);
|
||||
|
||||
Graphic3d_Vec2i aMousePos (-1, -1);
|
||||
if (myMainSel->GetManager().GetActiveSelectionType() == SelectBasics_SelectingVolumeManager::Point)
|
||||
{
|
||||
aMousePos.SetValues ((Standard_Integer )myMainSel->GetManager().GetMousePosition().X(),
|
||||
(Standard_Integer )myMainSel->GetManager().GetMousePosition().Y());
|
||||
}
|
||||
if (myLastPicked->HandleMouseClick (aMousePos, Aspect_VKeyMouse_LeftButton, Aspect_VKeyFlags_NONE, false))
|
||||
{
|
||||
return AIS_SOP_NothingSelected;
|
||||
}
|
||||
return getStatusOfPick (NbSelected());
|
||||
}*/
|
||||
|
||||
AIS_NListOfEntityOwner aPickedOwners;
|
||||
if (!myLastPicked.IsNull() &&
|
||||
myLastPicked->HasSelectable())
|
||||
{
|
||||
Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast(myLastPicked->Selectable());
|
||||
if (!anIO.IsNull() &&
|
||||
myObjects.IsBound(anIO))
|
||||
{
|
||||
aPickedOwners.Append (myLastPicked);
|
||||
}
|
||||
}
|
||||
|
||||
return Select (aPickedOwners, theSelScheme);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Select
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Integer theXPMin,
|
||||
const Standard_Integer theYPMin,
|
||||
const Standard_Integer theXPMax,
|
||||
const Standard_Integer theYPMax,
|
||||
const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean)
|
||||
{
|
||||
return Select (theXPMin, theYPMin, theXPMax, theYPMax, theView, AIS_SelectionScheme_ClearAndAdd);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Select
|
||||
//purpose : Selection by polyline
|
||||
//=======================================================================
|
||||
AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& thePolyline,
|
||||
const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean)
|
||||
{
|
||||
return Select (thePolyline, theView, AIS_SelectionScheme_ClearAndAdd);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Select
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_StatusOfPick AIS_InteractiveContext::Select (const Standard_Boolean)
|
||||
{
|
||||
return Select (AIS_SelectionScheme_ClearAndAdd);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ShiftSelect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Boolean toUpdateViewer)
|
||||
AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Boolean)
|
||||
{
|
||||
if (myAutoHilight)
|
||||
{
|
||||
clearDynamicHighlight();
|
||||
}
|
||||
if (!myLastPicked.IsNull())
|
||||
{
|
||||
AddOrRemoveSelected (myLastPicked, toUpdateViewer);
|
||||
}
|
||||
|
||||
Standard_Integer aSelNum = NbSelected();
|
||||
|
||||
return (aSelNum == 0) ? AIS_SOP_NothingSelected
|
||||
: (aSelNum == 1) ? AIS_SOP_OneSelected
|
||||
: AIS_SOP_SeveralSelected;
|
||||
return Select (AIS_SelectionScheme_Switch);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -641,39 +642,9 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer the
|
||||
const Standard_Integer theXPMax,
|
||||
const Standard_Integer theYPMax,
|
||||
const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean toUpdateViewer)
|
||||
const Standard_Boolean)
|
||||
{
|
||||
if (theView->Viewer() != myMainVwr)
|
||||
{
|
||||
throw Standard_ProgramError ("AIS_InteractiveContext::ShiftSelect() - invalid argument");
|
||||
}
|
||||
|
||||
myLastActiveView = theView.get();
|
||||
if (myAutoHilight)
|
||||
{
|
||||
UnhilightSelected (Standard_False);
|
||||
}
|
||||
myMainSel->Pick (theXPMin, theYPMin, theXPMax, theYPMax, theView);
|
||||
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner) anOwner = myMainSel->Picked (aPickIter);
|
||||
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
|
||||
continue;
|
||||
|
||||
mySelection->Select (anOwner);
|
||||
}
|
||||
|
||||
if (myAutoHilight)
|
||||
{
|
||||
HilightSelected (toUpdateViewer);
|
||||
}
|
||||
|
||||
Standard_Integer aSelNum = NbSelected();
|
||||
|
||||
return (aSelNum == 0) ? AIS_SOP_NothingSelected
|
||||
: (aSelNum == 1) ? AIS_SOP_OneSelected
|
||||
: AIS_SOP_SeveralSelected;
|
||||
|
||||
return Select (theXPMin, theYPMin, theXPMax, theYPMax, theView, AIS_SelectionScheme_Switch);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -682,31 +653,31 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer the
|
||||
//=======================================================================
|
||||
AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const TColgp_Array1OfPnt2d& thePolyline,
|
||||
const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean toUpdateViewer)
|
||||
const Standard_Boolean)
|
||||
{
|
||||
if (theView->Viewer() != myMainVwr)
|
||||
{
|
||||
throw Standard_ProgramError ("AIS_InteractiveContext::ShiftSelect() - invalid argument");
|
||||
}
|
||||
return Select (thePolyline, theView, AIS_SelectionScheme_Switch);
|
||||
}
|
||||
|
||||
myLastActiveView = theView.get();
|
||||
//=======================================================================
|
||||
//function : Select
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_StatusOfPick AIS_InteractiveContext::Select (const AIS_NListOfEntityOwner& theOwners,
|
||||
const AIS_SelectionScheme theSelScheme)
|
||||
{
|
||||
// all objects detected by the selector are taken, previous current objects are emptied,
|
||||
// new objects are put...
|
||||
if (myAutoHilight)
|
||||
{
|
||||
clearDynamicHighlight();
|
||||
UnhilightSelected (Standard_False);
|
||||
}
|
||||
myMainSel->Pick (thePolyline, theView);
|
||||
for (Standard_Integer aPickIter = 1; aPickIter <= myMainSel->NbPicked(); ++aPickIter)
|
||||
{
|
||||
const Handle(SelectMgr_EntityOwner) anOwner = myMainSel->Picked (aPickIter);
|
||||
if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
|
||||
continue;
|
||||
|
||||
mySelection->Select (anOwner);
|
||||
}
|
||||
mySelection->SelectOwners (theOwners, theSelScheme, myFilters);
|
||||
|
||||
if (myAutoHilight)
|
||||
{
|
||||
HilightSelected (toUpdateViewer);
|
||||
HilightSelected (Standard_False);
|
||||
}
|
||||
|
||||
Standard_Integer aSelNum = NbSelected();
|
||||
@@ -725,7 +696,7 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
|
||||
// In case of selection without using local context
|
||||
clearDynamicHighlight();
|
||||
|
||||
highlightOwners (mySelection->Objects());
|
||||
highlightOwners (mySelection->Objects(), Standard_True);
|
||||
|
||||
if (theToUpdateViewer)
|
||||
UpdateCurrentViewer();
|
||||
@@ -735,7 +706,8 @@ void AIS_InteractiveContext::HilightSelected (const Standard_Boolean theToUpdate
|
||||
//function : highlightOwners
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theOwners)
|
||||
void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theOwners,
|
||||
const Standard_Boolean& theToUseObjectDisplayMode)
|
||||
{
|
||||
AIS_MapOfObjSelectedOwners anObjOwnerMap;
|
||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (theOwners); aSelIter.More(); aSelIter.Next())
|
||||
@@ -746,11 +718,13 @@ void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theO
|
||||
continue;
|
||||
|
||||
const Handle(Prs3d_Drawer)& anObjSelStyle = getSelStyle (anObj, anOwner);
|
||||
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind(anObj);
|
||||
if (anOwner == anObj->GlobalSelOwner())
|
||||
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anObj);
|
||||
if (!aStatusPtr)
|
||||
continue;
|
||||
if (theToUseObjectDisplayMode && anOwner == anObj->GlobalSelOwner())
|
||||
{
|
||||
aState->SetHilightStatus (Standard_True);
|
||||
aState->SetHilightStyle (anObjSelStyle);
|
||||
(*aStatusPtr)->SetHilightStatus (Standard_True);
|
||||
(*aStatusPtr)->SetHilightStyle (anObjSelStyle);
|
||||
}
|
||||
if (!anOwner->IsAutoHilight())
|
||||
{
|
||||
@@ -768,7 +742,7 @@ void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theO
|
||||
}
|
||||
else
|
||||
{
|
||||
const Standard_Integer aHiMode = getHilightMode (anObj, anObjSelStyle, aState->DisplayMode());
|
||||
const Standard_Integer aHiMode = getHilightMode (anObj, anObjSelStyle, theToUseObjectDisplayMode ? (*aStatusPtr)->DisplayMode() : -1);
|
||||
anOwner->HilightWithColor (myMainPM, anObjSelStyle, aHiMode);
|
||||
}
|
||||
}
|
||||
@@ -872,7 +846,9 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
|
||||
}
|
||||
if (aSelOwner == aSelectable->GlobalSelOwner())
|
||||
{
|
||||
myObjects.ChangeFind (aSelectable)->SetHilightStatus (Standard_False);
|
||||
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (aSelectable);
|
||||
if (aStatusPtr)
|
||||
(*aStatusPtr)->SetHilightStatus (Standard_False);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -990,7 +966,13 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
||||
if (myAutoHilight)
|
||||
{
|
||||
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
|
||||
Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj);
|
||||
if (!myObjects.IsBound(anObj)) // e.g. AIS_ViewCubeFlat is not displayed
|
||||
return;
|
||||
|
||||
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anObj);
|
||||
if (!aStatusPtr)
|
||||
return;
|
||||
|
||||
if (theOwner->IsSelected())
|
||||
{
|
||||
highlightSelected (theOwner);
|
||||
@@ -1001,7 +983,7 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
|
||||
anOwners.Append (theOwner);
|
||||
unhighlightOwners (anOwners);
|
||||
|
||||
aStatus->SetHilightStyle (Handle(Prs3d_Drawer)());
|
||||
(*aStatusPtr)->SetHilightStyle (Handle(Prs3d_Drawer)());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectFillCapping.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
@@ -83,6 +84,17 @@ void AIS_InteractiveObject::SetContext (const Handle(AIS_InteractiveContext)& th
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void AIS_InteractiveObject::SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers)
|
||||
{
|
||||
SelectMgr_SelectableObject::SetTransformPersistence (theTrsfPers);
|
||||
|
||||
if (!GetContext().IsNull())
|
||||
{
|
||||
GetContext()->UpdateOnTransformPersistence (this);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasPresentation
|
||||
//purpose :
|
||||
@@ -143,3 +155,26 @@ 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_STOP_KEY (OS, AIS_InteractiveObject_ClassName);
|
||||
|
||||
}
|
||||
|
@@ -108,6 +108,11 @@ public:
|
||||
//! Returns the context pointer to the interactive context.
|
||||
Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const;
|
||||
|
||||
//! Sets up Transform Persistence defining a special Local Coordinate system where this object should be located.
|
||||
//! Updates the presentation in context if it is not NULL
|
||||
//! @sa Graphic3d_TransformPers class description
|
||||
Standard_EXPORT virtual void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers);
|
||||
|
||||
//! Returns TRUE when this object has a presentation in the current DisplayMode()
|
||||
Standard_EXPORT Standard_Boolean HasPresentation() const;
|
||||
|
||||
@@ -118,6 +123,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
|
||||
|
@@ -132,7 +132,7 @@ void AIS_Manipulator::init()
|
||||
myAxes[2] = Axis (gp::OZ(), Quantity_NOC_BLUE1);
|
||||
|
||||
Graphic3d_MaterialAspect aShadingMaterial;
|
||||
aShadingMaterial.SetSpecularColor(Quantity_NOC_BLACK);
|
||||
aShadingMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
|
||||
aShadingMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
|
||||
|
||||
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
@@ -142,10 +142,10 @@ void AIS_Manipulator::init()
|
||||
|
||||
Graphic3d_MaterialAspect aHilightMaterial;
|
||||
aHilightMaterial.SetColor (Quantity_NOC_AZURE);
|
||||
aHilightMaterial.SetAmbientColor (Quantity_NOC_BLACK);
|
||||
aHilightMaterial.SetDiffuseColor (Quantity_NOC_BLACK);
|
||||
aHilightMaterial.SetSpecularColor(Quantity_NOC_BLACK);
|
||||
aHilightMaterial.SetEmissiveColor(Quantity_NOC_BLACK);
|
||||
aHilightMaterial.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
|
||||
aHilightMaterial.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
|
||||
aHilightMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
|
||||
aHilightMaterial.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
|
||||
aHilightMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
|
||||
|
||||
myHighlightAspect = new Prs3d_ShadingAspect();
|
||||
@@ -153,10 +153,11 @@ void AIS_Manipulator::init()
|
||||
myHighlightAspect->SetMaterial (aHilightMaterial);
|
||||
|
||||
Graphic3d_MaterialAspect aDraggerMaterial;
|
||||
aDraggerMaterial.SetAmbientColor (Quantity_NOC_BLACK);
|
||||
aDraggerMaterial.SetDiffuseColor (Quantity_NOC_BLACK);
|
||||
aDraggerMaterial.SetSpecularColor(Quantity_NOC_BLACK);
|
||||
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
|
||||
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
|
||||
aDraggerMaterial.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
|
||||
aDraggerMaterial.SetMaterialType(Graphic3d_MATERIAL_ASPECT);
|
||||
aDraggerMaterial.SetAmbient(1.0);
|
||||
|
||||
myDraggerHighlight = new Prs3d_ShadingAspect();
|
||||
myDraggerHighlight->Aspect()->SetInteriorStyle(Aspect_IS_SOLID);
|
||||
|
@@ -15,6 +15,8 @@
|
||||
#include <AIS_Selection.hxx>
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <AIS_SelectionScheme.hxx>
|
||||
#include <SelectMgr_Filter.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_Selection, Standard_Transient)
|
||||
|
||||
@@ -130,3 +132,71 @@ AIS_SelectStatus AIS_Selection::AddSelect (const Handle(SelectMgr_EntityOwner)&
|
||||
theObject->SetSelected (Standard_True);
|
||||
return AIS_SS_Added;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SelectOwners
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_Selection::SelectOwners (const AIS_NListOfEntityOwner& thePickedOwners,
|
||||
const int theSelScheme,
|
||||
const Handle(SelectMgr_Filter)& theFilter)
|
||||
{
|
||||
int aSelScheme = theSelScheme;
|
||||
AIS_NListOfEntityOwner aPrevSelected = Objects();
|
||||
if (theSelScheme & AIS_SelectionScheme_Clear)
|
||||
{
|
||||
Clear();
|
||||
|
||||
if (theSelScheme & AIS_SelectionScheme_Switch &&
|
||||
theSelScheme & AIS_SelectionScheme_PickedIfEmpty &&
|
||||
thePickedOwners.Size() < aPrevSelected.Size())
|
||||
{
|
||||
// check if all picked objects are in previous selected list, if so, all objects will be deselected,
|
||||
// but in mode AIS_SelectionScheme_PickedIfEmpty new picked objects should be selected, here, after Clear, Add
|
||||
Standard_Boolean anOtherFound = Standard_False;
|
||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
anOtherFound = !aPrevSelected.Contains (aSelIter.Value());
|
||||
if (anOtherFound)
|
||||
break;
|
||||
}
|
||||
if (!anOtherFound)
|
||||
aSelScheme = AIS_SelectionScheme_Add;
|
||||
}
|
||||
}
|
||||
|
||||
for (AIS_NListOfEntityOwner::Iterator aSelIter (thePickedOwners); aSelIter.More(); aSelIter.Next())
|
||||
{
|
||||
selectOwner(aSelIter.Value(), aPrevSelected, aSelScheme, theFilter);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : selectOwner
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_SelectStatus AIS_Selection::selectOwner (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const AIS_NListOfEntityOwner& thePreviousSelected,
|
||||
const int theSelScheme,
|
||||
const Handle(SelectMgr_Filter)& theFilter)
|
||||
{
|
||||
if (theOwner.IsNull() || !theOwner->HasSelectable() || !theFilter->IsOk (theOwner))
|
||||
return AIS_SS_NotDone;
|
||||
|
||||
if (theSelScheme & AIS_SelectionScheme_Add)
|
||||
{
|
||||
return AddSelect (theOwner);
|
||||
}
|
||||
else if (theSelScheme & AIS_SelectionScheme_Switch)
|
||||
{
|
||||
if (thePreviousSelected.Contains (theOwner)) // was selected, should not be now
|
||||
{
|
||||
if (theOwner->IsSelected())
|
||||
return Select (theOwner); // deselect
|
||||
}
|
||||
else
|
||||
return AddSelect (theOwner); // was not selected, should be now
|
||||
}
|
||||
|
||||
return AIS_SS_NotDone;
|
||||
}
|
||||
|
@@ -22,6 +22,8 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
class SelectMgr_Filter;
|
||||
|
||||
//! Class holding the list of selected owners.
|
||||
class AIS_Selection : public Standard_Transient
|
||||
{
|
||||
@@ -75,6 +77,28 @@ public:
|
||||
//! Return selected object at iterator position.
|
||||
const Handle(SelectMgr_EntityOwner)& Value() const { return myIterator.Value(); }
|
||||
|
||||
//! Select or deselect owners depending on the selection scheme
|
||||
//! \param theOwners elements to change selection state
|
||||
//! \param theSelScheme selection scheme, defines how owner is selected
|
||||
//! \param theFilter context filter to skip not acceptable owners
|
||||
//! \return result of selection
|
||||
Standard_EXPORT virtual void SelectOwners (const AIS_NListOfEntityOwner& thePickedOwners,
|
||||
const int theSelScheme,
|
||||
const Handle(SelectMgr_Filter)& theFilter);
|
||||
|
||||
protected:
|
||||
//! Select or deselect owner depending on the selection scheme
|
||||
//! \param theOwner element to change selection state
|
||||
//! \param thePreviousSelected previous selected objects
|
||||
//! \param theSelScheme selection scheme, defines how owner is selected
|
||||
//! \param theFilter context filter to skip not acceptable owners
|
||||
//! \return result of selection
|
||||
Standard_EXPORT virtual AIS_SelectStatus selectOwner (const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const AIS_NListOfEntityOwner& thePreviousSelected,
|
||||
const int theSelScheme,
|
||||
const Handle(SelectMgr_Filter)& theFilter);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
AIS_NListOfEntityOwner myresult;
|
||||
|
34
src/AIS/AIS_SelectionScheme.hxx
Normal file
@@ -0,0 +1,34 @@
|
||||
// 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 _AIS_SelectionScheme_HeaderFile
|
||||
#define _AIS_SelectionScheme_HeaderFile
|
||||
|
||||
|
||||
//! Sets selection schemes for interactive contexts.
|
||||
//! It is possible to use combination of schemes.
|
||||
enum AIS_SelectionScheme
|
||||
{
|
||||
AIS_SelectionScheme_Empty = 0x0000, // do nothing
|
||||
AIS_SelectionScheme_Clear = 0x0001, // clears current selection
|
||||
AIS_SelectionScheme_Add = 0x0002, // add detected object to current selection
|
||||
AIS_SelectionScheme_Switch = 0x0004, // switch selection state in values selected/deselected
|
||||
AIS_SelectionScheme_PickedIfEmpty = 0x0008, // if after switch, result selection is empty, select picked objects
|
||||
AIS_SelectionScheme_ClearAndSwitch = AIS_SelectionScheme_Clear | AIS_SelectionScheme_Switch,
|
||||
AIS_SelectionScheme_ClearAndAdd = AIS_SelectionScheme_Clear | AIS_SelectionScheme_Add,
|
||||
AIS_SelectionScheme_ClearAndSwitchAndPicked = AIS_SelectionScheme_ClearAndSwitch | AIS_SelectionScheme_PickedIfEmpty,
|
||||
AIS_SelectionScheme_Custom // reserved item for custom selection scheme
|
||||
};
|
||||
|
||||
#endif // _AIS_SelectionScheme_HeaderFile
|
@@ -180,10 +180,7 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
|
||||
try
|
||||
{
|
||||
OCC_CATCH_SIGNALS
|
||||
StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer,
|
||||
myDrawer->ShadingAspect()->Aspect()->ToMapTexture()
|
||||
&& !myDrawer->ShadingAspect()->Aspect()->TextureMap().IsNull(),
|
||||
myUVOrigin, myUVRepeat, myUVScale);
|
||||
StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer, myDrawer->FillCappingAspect());
|
||||
}
|
||||
catch (Standard_Failure const& anException)
|
||||
{
|
||||
@@ -637,7 +634,7 @@ void AIS_Shape::setMaterial (const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const Standard_Boolean theToKeepColor,
|
||||
const Standard_Boolean theToKeepTransp) const
|
||||
{
|
||||
const Quantity_Color aColor = theDrawer->ShadingAspect()->Color (myCurrentFacingModel);
|
||||
const Quantity_Color aColor = theDrawer->ShadingAspect()->Material (myCurrentFacingModel).Color();
|
||||
const Standard_Real aTransp = theDrawer->ShadingAspect()->Transparency (myCurrentFacingModel);
|
||||
theDrawer->SetupOwnShadingAspect();
|
||||
theDrawer->ShadingAspect()->SetMaterial (theMaterial, myCurrentFacingModel);
|
||||
|
@@ -137,7 +137,7 @@ void AIS_Triangulation::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aP
|
||||
Standard_Integer i;
|
||||
Standard_Integer j;
|
||||
|
||||
const Standard_Real ambient = 0.2;
|
||||
Standard_Real ambient = aspect->FrontMaterial().Ambient();
|
||||
if (hasVNormals)
|
||||
{
|
||||
const TShort_Array1OfShortReal& normals = myTriangulation->Normals();
|
||||
|
@@ -223,10 +223,10 @@ void AIS_ViewCube::setDefaultAttributes()
|
||||
void AIS_ViewCube::setDefaultHighlightAttributes()
|
||||
{
|
||||
Graphic3d_MaterialAspect aHighlightMaterial;
|
||||
aHighlightMaterial.SetAmbientColor (Quantity_NOC_BLACK);
|
||||
aHighlightMaterial.SetDiffuseColor (Quantity_NOC_BLACK);
|
||||
aHighlightMaterial.SetSpecularColor(Quantity_NOC_BLACK);
|
||||
aHighlightMaterial.SetEmissiveColor(Quantity_NOC_BLACK);
|
||||
aHighlightMaterial.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
|
||||
aHighlightMaterial.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
|
||||
aHighlightMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
|
||||
aHighlightMaterial.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
|
||||
aHighlightMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
|
||||
myDynHilightDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
myDynHilightDrawer->ShadingAspect()->SetMaterial (aHighlightMaterial);
|
||||
|
@@ -145,6 +145,7 @@ AIS_Selection.cxx
|
||||
AIS_Selection.hxx
|
||||
AIS_SelectStatus.hxx
|
||||
AIS_SelectionModesConcurrency.hxx
|
||||
AIS_SelectionScheme.hxx
|
||||
AIS_SequenceOfDimension.hxx
|
||||
AIS_SequenceOfInteractive.hxx
|
||||
AIS_Shape.cxx
|
||||
|
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
@@ -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
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <BRepTopAdaptor_FClass2d.hxx>
|
||||
#include <BRepClass_FaceClassifier.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRepAdaptor_HSurface.hxx>
|
||||
@@ -94,14 +94,8 @@ void BRepExtrema_ExtCF::Perform(const TopoDS_Edge& E, const TopoDS_Face& F2)
|
||||
else
|
||||
{
|
||||
// Exploration of points and classification
|
||||
const Standard_Real Tol = BRep_Tool::Tolerance (F2);
|
||||
BRepTopAdaptor_FClass2d classifier (F2, Tol);
|
||||
|
||||
// If the underlying surface of the face is periodic
|
||||
// Extrema should return the point within the period,
|
||||
// so there is no point to adjust it in classifier.
|
||||
Standard_Boolean isAdjustPeriodic = Standard_False;
|
||||
|
||||
BRepClass_FaceClassifier classifier;
|
||||
const Standard_Real Tol = BRep_Tool::Tolerance(F2);
|
||||
Extrema_POnCurv P1;
|
||||
Extrema_POnSurf P2;
|
||||
|
||||
@@ -110,7 +104,8 @@ void BRepExtrema_ExtCF::Perform(const TopoDS_Edge& E, const TopoDS_Face& F2)
|
||||
myExtCS.Points(i, P1, P2);
|
||||
P2.Parameter(U1, U2);
|
||||
const gp_Pnt2d Puv(U1, U2);
|
||||
const TopAbs_State state = classifier.Perform (Puv, isAdjustPeriodic);
|
||||
classifier.Perform(F2, Puv, Tol);
|
||||
const TopAbs_State state = classifier.State();
|
||||
if (state == TopAbs_ON || state == TopAbs_IN)
|
||||
{
|
||||
mySqDist.Append(myExtCS.SquareDistance(i));
|
||||
|
@@ -233,8 +233,7 @@ void BRepOffset_SimpleOffset::FillFaceData(const TopoDS_Face& theFace)
|
||||
if (theFace.Orientation() == TopAbs_REVERSED)
|
||||
aMult = -1.0;
|
||||
|
||||
BRepOffset_Status aStatus; // set by BRepOffset::Surface(), could be used to check result...
|
||||
aNFD.myOffsetS = BRepOffset::Surface (aS, aMult * myOffsetValue, aStatus, Standard_True);
|
||||
aNFD.myOffsetS = new Geom_OffsetSurface(aS, aMult * myOffsetValue, Standard_True);
|
||||
aNFD.myL = TopLoc_Location(); // Null transformation.
|
||||
|
||||
// Save offset surface in map.
|
||||
|
@@ -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;
|
||||
|
@@ -35,8 +35,6 @@
|
||||
#include <BinMXCAFDoc_MaterialToolDriver.hxx>
|
||||
#include <BinMXCAFDoc_NoteDriver.hxx>
|
||||
#include <BinMXCAFDoc_NoteBalloonDriver.hxx>
|
||||
#include <BinMXCAFDoc_NoteBinDataDriver.hxx>
|
||||
#include <BinMXCAFDoc_NoteCommentDriver.hxx>
|
||||
#include <BinMXCAFDoc_NotesToolDriver.hxx>
|
||||
#include <BinMXCAFDoc_ShapeToolDriver.hxx>
|
||||
#include <BinMXCAFDoc_ViewDriver.hxx>
|
||||
@@ -78,8 +76,7 @@ void BinMXCAFDoc::AddDrivers(const Handle(BinMDF_ADriverTable)& theDriverTable,
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_DimTolDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_MaterialDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_NoteBalloonDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_NoteBinDataDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_NoteCommentDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_NoteDriver (theMsgDrv));
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_ViewDriver (theMsgDrv));
|
||||
|
||||
theDriverTable->AddDriver( new BinMXCAFDoc_ColorToolDriver (theMsgDrv));
|
||||
|
@@ -42,6 +42,9 @@ class BinMXCAFDoc_DimTolToolDriver;
|
||||
class BinMXCAFDoc_MaterialToolDriver;
|
||||
class BinMXCAFDoc_ViewDriver;
|
||||
class BinMXCAFDoc_ViewToolDriver;
|
||||
class BinMXCAFDoc_AnimationDriver;
|
||||
class BinMXCAFDoc_AnimationToolDriver;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -89,6 +92,9 @@ friend class BinMXCAFDoc_DimTolToolDriver;
|
||||
friend class BinMXCAFDoc_MaterialToolDriver;
|
||||
friend class BinMXCAFDoc_ViewDriver;
|
||||
friend class BinMXCAFDoc_ViewToolDriver;
|
||||
friend class BinMXCAFDoc_AnimationDriver;
|
||||
friend class BinMXCAFDoc_AnimationToolDriver;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
112
src/BinMXCAFDoc/BinMXCAFDoc_AnimationDriver.cxx
Normal file
@@ -0,0 +1,112 @@
|
||||
// Created on: 2017-10-02
|
||||
// Created by: Elena MOZOKHINA
|
||||
// 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 <BinMXCAFDoc_AnimationDriver.hxx>
|
||||
#include <BinObjMgt_Persistent.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XCAFDoc_Animation.hxx>
|
||||
# include <TColStd_HArray1OfByte.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_AnimationDriver,BinMDF_ADriver)
|
||||
|
||||
static Standard_Boolean getByteArray(const BinObjMgt_Persistent& theSource, Handle(TColStd_HArray1OfByte)& theArray)
|
||||
{
|
||||
Standard_Integer aFirstInd, aLastInd;
|
||||
if (!(theSource >> aFirstInd >> aLastInd))
|
||||
return Standard_False;
|
||||
if (aLastInd < aFirstInd)
|
||||
return Standard_False;
|
||||
|
||||
theArray.reset(new TColStd_HArray1OfByte(aFirstInd, aLastInd - aFirstInd + 1));
|
||||
theSource.GetByteArray(&theArray->ChangeFirst(), aLastInd - aFirstInd + 1);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
static void putByteArray(BinObjMgt_Persistent& theTarget, const Handle(TColStd_HArray1OfByte)& theArray)
|
||||
{
|
||||
if (theArray.IsNull())
|
||||
return;
|
||||
const Standard_Integer aFirstInd = theArray->Lower();
|
||||
const Standard_Integer aLastInd = theArray->Upper();
|
||||
if (aLastInd < aFirstInd)
|
||||
return;
|
||||
|
||||
theTarget << aFirstInd << aLastInd;
|
||||
theTarget.PutByteArray(&theArray->ChangeFirst(), aLastInd - aFirstInd + 1);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_AnimationDriver::BinMXCAFDoc_AnimationDriver
|
||||
(const Handle(Message_Messenger)& theMsgDriver)
|
||||
: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_Animation)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMXCAFDoc_AnimationDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_Animation();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_AnimationDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
Handle(XCAFDoc_Animation) anAtt = Handle(XCAFDoc_Animation)::DownCast(theTarget);
|
||||
Standard_Real aDensity;
|
||||
TCollection_AsciiString aName;
|
||||
|
||||
if (!(theSource >> aName))
|
||||
return Standard_False;
|
||||
Handle(TColStd_HArray1OfByte) anImage, anAnimation;
|
||||
if (!getByteArray(theSource, anImage) || anImage.IsNull())
|
||||
return Standard_False;
|
||||
if (!getByteArray(theSource, anAnimation) || anAnimation.IsNull())
|
||||
return Standard_False;
|
||||
anAtt->Set(new TCollection_HAsciiString(aName), anImage, anAnimation);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_AnimationDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
Handle(XCAFDoc_Animation) anAtt = Handle(XCAFDoc_Animation)::DownCast(theSource);
|
||||
Handle(TCollection_HAsciiString) aName = anAtt->GetName();
|
||||
if (!aName.IsNull())
|
||||
theTarget << aName->String();
|
||||
|
||||
putByteArray(theTarget, anAtt->GetImage());
|
||||
putByteArray(theTarget, anAtt->GetAnimation());
|
||||
}
|
72
src/BinMXCAFDoc/BinMXCAFDoc_AnimationDriver.hxx
Normal file
@@ -0,0 +1,72 @@
|
||||
// Created on: 2017-10-02
|
||||
// Created by: Elena MOZOKHINA
|
||||
// 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.
|
||||
|
||||
#ifndef _BinMXCAFDoc_AnimationDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_AnimationDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <BinMDF_ADriver.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <BinObjMgt_RRelocationTable.hxx>
|
||||
#include <BinObjMgt_SRelocationTable.hxx>
|
||||
class Message_Messenger;
|
||||
class TDF_Attribute;
|
||||
class BinObjMgt_Persistent;
|
||||
|
||||
|
||||
class BinMXCAFDoc_AnimationDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_AnimationDriver, BinMDF_ADriver)
|
||||
|
||||
|
||||
class BinMXCAFDoc_AnimationDriver : public BinMDF_ADriver
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_AnimationDriver(const Handle(Message_Messenger)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean Paste (const BinObjMgt_Persistent& theSource, const Handle(TDF_Attribute)& theTarget, BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& theSource, BinObjMgt_Persistent& theTarget, BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_AnimationDriver,BinMDF_ADriver)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BinMXCAFDoc_AnimationDriver_HeaderFile
|
65
src/BinMXCAFDoc/BinMXCAFDoc_AnimationToolDriver.cxx
Normal file
@@ -0,0 +1,65 @@
|
||||
// Created on: 2017-10-02
|
||||
// Created by: Elena MOZOKHINA
|
||||
// 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 <BinMXCAFDoc_AnimationToolDriver.hxx>
|
||||
#include <BinObjMgt_Persistent.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <XCAFDoc_AnimationTool.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_AnimationToolDriver, BinMDF_ADriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_AnimationToolDriver::BinMXCAFDoc_AnimationToolDriver
|
||||
(const Handle(Message_Messenger)& theMsgDriver)
|
||||
: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_AnimationTool)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMXCAFDoc_AnimationToolDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_AnimationTool();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_AnimationToolDriver::Paste
|
||||
(const BinObjMgt_Persistent& /*theSource*/,
|
||||
const Handle(TDF_Attribute)& /*theTarget*/,
|
||||
BinObjMgt_RRelocationTable& /*theRelocTable*/) const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_AnimationToolDriver::Paste
|
||||
(const Handle(TDF_Attribute)& /*theSource*/,
|
||||
BinObjMgt_Persistent& /*theTarget*/,
|
||||
BinObjMgt_SRelocationTable& /*theRelocTable*/) const {
|
||||
}
|
50
src/BinMXCAFDoc/BinMXCAFDoc_AnimationToolDriver.hxx
Normal file
@@ -0,0 +1,50 @@
|
||||
// Created on: 2017-10-02
|
||||
// Created by: Elena MOZOKHINA
|
||||
// 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.
|
||||
|
||||
#ifndef _BinMXCAFDoc_AnimationToolDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_AnimationToolDriver_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <BinMDF_ADriver.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <BinObjMgt_RRelocationTable.hxx>
|
||||
#include <BinObjMgt_SRelocationTable.hxx>
|
||||
class Message_Messenger;
|
||||
class TDF_Attribute;
|
||||
class BinObjMgt_Persistent;
|
||||
|
||||
|
||||
class BinMXCAFDoc_AnimationToolDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_AnimationToolDriver, BinMDF_ADriver)
|
||||
|
||||
|
||||
class BinMXCAFDoc_AnimationToolDriver : public BinMDF_ADriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_AnimationToolDriver(const Handle(Message_Messenger)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean Paste(const BinObjMgt_Persistent& theSource, const Handle(TDF_Attribute)& theTarget, BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Paste(const Handle(TDF_Attribute)& theSource, BinObjMgt_Persistent& theTarget, BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_AnimationToolDriver, BinMDF_ADriver)
|
||||
|
||||
};
|
||||
#endif // _BinMXCAFDoc_AnimationToolDriver_HeaderFile
|
@@ -20,14 +20,14 @@
|
||||
#include <BinMXCAFDoc_NoteBalloonDriver.hxx>
|
||||
#include <XCAFDoc_NoteBalloon.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBalloonDriver, BinMXCAFDoc_NoteCommentDriver)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBalloonDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NoteBalloonDriver::BinMXCAFDoc_NoteBalloonDriver(const Handle(Message_Messenger)& theMsgDriver)
|
||||
: BinMXCAFDoc_NoteCommentDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteBalloon)->Name())
|
||||
: BinMXCAFDoc_NoteDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteBalloon)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -40,13 +40,52 @@ Handle(TDF_Attribute) BinMXCAFDoc_NoteBalloonDriver::NewEmpty() const
|
||||
return new XCAFDoc_NoteBalloon();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_NoteBalloonDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const
|
||||
{
|
||||
if (!BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable))
|
||||
return Standard_False;
|
||||
|
||||
Handle(XCAFDoc_NoteBalloon) aNote = Handle(XCAFDoc_NoteBalloon)::DownCast(theTarget);
|
||||
if (aNote.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
TCollection_ExtendedString aComment;
|
||||
if (!(theSource >> aComment))
|
||||
return Standard_False;
|
||||
|
||||
aNote->Set(aComment);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_NoteBalloonDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const
|
||||
{
|
||||
BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
|
||||
|
||||
Handle(XCAFDoc_NoteBalloon) aNote = Handle(XCAFDoc_NoteBalloon)::DownCast(theSource);
|
||||
if (!aNote.IsNull())
|
||||
theTarget << aNote->Get();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NoteBalloonDriver::BinMXCAFDoc_NoteBalloonDriver(const Handle(Message_Messenger)& theMsgDriver,
|
||||
Standard_CString theName)
|
||||
: BinMXCAFDoc_NoteCommentDriver(theMsgDriver, theName)
|
||||
: BinMXCAFDoc_NoteDriver(theMsgDriver, theName)
|
||||
{
|
||||
|
||||
}
|
||||
|
@@ -16,20 +16,28 @@
|
||||
#ifndef _BinMXCAFDoc_NoteBalloonDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_NoteBalloonDriver_HeaderFile
|
||||
|
||||
#include <BinMXCAFDoc_NoteCommentDriver.hxx>
|
||||
#include <BinMXCAFDoc_NoteDriver.hxx>
|
||||
|
||||
class BinMXCAFDoc_NoteBalloonDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_NoteBalloonDriver, BinMXCAFDoc_NoteCommentDriver)
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_NoteBalloonDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
class BinMXCAFDoc_NoteBalloonDriver : public BinMXCAFDoc_NoteCommentDriver
|
||||
class BinMXCAFDoc_NoteBalloonDriver : public BinMXCAFDoc_NoteDriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_NoteBalloonDriver(const Handle(Message_Messenger)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBalloonDriver, BinMXCAFDoc_NoteCommentDriver)
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBalloonDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
|
||||
protected:
|
||||
|
@@ -1,96 +0,0 @@
|
||||
// Created on: 2017-02-13
|
||||
// Created by: Eugeny NIKONOV
|
||||
// Copyright (c) 2005-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 <BinObjMgt_Persistent.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TColStd_HArray1OfByte.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <BinMXCAFDoc_NoteBinDataDriver.hxx>
|
||||
#include <XCAFDoc_NoteBinData.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBinDataDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NoteBinDataDriver::BinMXCAFDoc_NoteBinDataDriver(const Handle(Message_Messenger)& theMsgDriver)
|
||||
: BinMXCAFDoc_NoteDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteBinData)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMXCAFDoc_NoteBinDataDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_NoteBinData();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_NoteBinDataDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const
|
||||
{
|
||||
if (!BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable))
|
||||
return Standard_False;
|
||||
|
||||
Handle(XCAFDoc_NoteBinData) aNote = Handle(XCAFDoc_NoteBinData)::DownCast(theTarget);
|
||||
if (aNote.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
TCollection_ExtendedString aTitle;
|
||||
TCollection_AsciiString aMIMEtype;
|
||||
Standard_Integer nbSize;
|
||||
if (!(theSource >> aTitle >> aMIMEtype >> nbSize))
|
||||
return Standard_False;
|
||||
|
||||
Handle(TColStd_HArray1OfByte) aData;
|
||||
if (nbSize > 0)
|
||||
{
|
||||
aData.reset(new TColStd_HArray1OfByte(1, nbSize));
|
||||
theSource.GetByteArray(&aData->ChangeFirst(), nbSize);
|
||||
}
|
||||
|
||||
aNote->Set(aTitle, aMIMEtype, aData);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_NoteBinDataDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const
|
||||
{
|
||||
BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
|
||||
|
||||
Handle(XCAFDoc_NoteBinData) aNote = Handle(XCAFDoc_NoteBinData)::DownCast(theSource);
|
||||
if (!aNote.IsNull())
|
||||
{
|
||||
theTarget << aNote->Title() << aNote->MIMEtype() << aNote->Size();
|
||||
if (aNote->Size() > 0)
|
||||
theTarget.PutByteArray(&aNote->Data()->ChangeFirst(), aNote->Size());
|
||||
}
|
||||
}
|
@@ -1,44 +0,0 @@
|
||||
// Created on: 2017-02-13
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2005-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 _BinMXCAFDoc_NoteBinDataDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_NoteBinDataDriver_HeaderFile
|
||||
|
||||
#include <BinMXCAFDoc_NoteDriver.hxx>
|
||||
|
||||
class BinMXCAFDoc_NoteBinDataDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_NoteBinDataDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
class BinMXCAFDoc_NoteBinDataDriver : public BinMXCAFDoc_NoteDriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_NoteBinDataDriver(const Handle(Message_Messenger)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_NoteBinDataDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
};
|
||||
|
||||
#endif // _BinMXCAFDoc_NoteBinDataDriver_HeaderFile
|
@@ -1,91 +0,0 @@
|
||||
// Created on: 2017-02-13
|
||||
// Created by: Eugeny NIKONOV
|
||||
// Copyright (c) 2005-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 <BinObjMgt_Persistent.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <BinMXCAFDoc_NoteCommentDriver.hxx>
|
||||
#include <XCAFDoc_NoteComment.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteCommentDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NoteCommentDriver::BinMXCAFDoc_NoteCommentDriver(const Handle(Message_Messenger)& theMsgDriver)
|
||||
: BinMXCAFDoc_NoteDriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_NoteComment)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMXCAFDoc_NoteCommentDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_NoteComment();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BinMXCAFDoc_NoteCommentDriver::Paste(const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const
|
||||
{
|
||||
if (!BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable))
|
||||
return Standard_False;
|
||||
|
||||
Handle(XCAFDoc_NoteComment) aNote = Handle(XCAFDoc_NoteComment)::DownCast(theTarget);
|
||||
if (aNote.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
TCollection_ExtendedString aComment;
|
||||
if (!(theSource >> aComment))
|
||||
return Standard_False;
|
||||
|
||||
aNote->Set(aComment);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BinMXCAFDoc_NoteCommentDriver::Paste(const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const
|
||||
{
|
||||
BinMXCAFDoc_NoteDriver::Paste(theSource, theTarget, theRelocTable);
|
||||
|
||||
Handle(XCAFDoc_NoteComment) aNote = Handle(XCAFDoc_NoteComment)::DownCast(theSource);
|
||||
if (!aNote.IsNull())
|
||||
theTarget << aNote->Comment();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NoteCommentDriver::BinMXCAFDoc_NoteCommentDriver(const Handle(Message_Messenger)& theMsgDriver,
|
||||
Standard_CString theName)
|
||||
: BinMXCAFDoc_NoteDriver(theMsgDriver, theName)
|
||||
{
|
||||
|
||||
}
|
@@ -1,49 +0,0 @@
|
||||
// Created on: 2017-02-13
|
||||
// Created by: Sergey NIKONOV
|
||||
// Copyright (c) 2005-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 _BinMXCAFDoc_NoteCommentDriver_HeaderFile
|
||||
#define _BinMXCAFDoc_NoteCommentDriver_HeaderFile
|
||||
|
||||
#include <BinMXCAFDoc_NoteDriver.hxx>
|
||||
|
||||
class BinMXCAFDoc_NoteCommentDriver;
|
||||
DEFINE_STANDARD_HANDLE(BinMXCAFDoc_NoteCommentDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
class BinMXCAFDoc_NoteCommentDriver : public BinMXCAFDoc_NoteDriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_NoteCommentDriver(const Handle(Message_Messenger)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theSource,
|
||||
BinObjMgt_Persistent& theTarget,
|
||||
BinObjMgt_SRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BinMXCAFDoc_NoteCommentDriver, BinMXCAFDoc_NoteDriver)
|
||||
|
||||
protected:
|
||||
|
||||
BinMXCAFDoc_NoteCommentDriver(const Handle(Message_Messenger)& theMsgDriver,
|
||||
Standard_CString theName);
|
||||
|
||||
};
|
||||
|
||||
#endif // _BinMXCAFDoc_NoteCommentDriver_HeaderFile
|
@@ -22,6 +22,24 @@
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BinMXCAFDoc_NoteDriver, BinMDF_ADriver)
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
BinMXCAFDoc_NoteDriver::BinMXCAFDoc_NoteDriver(const Handle(Message_Messenger)& theMsgDriver)
|
||||
: BinMDF_ADriver(theMsgDriver, STANDARD_TYPE(XCAFDoc_Note)->Name())
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) BinMXCAFDoc_NoteDriver::NewEmpty() const
|
||||
{
|
||||
return new XCAFDoc_Note();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
|
@@ -35,6 +35,10 @@ class BinMXCAFDoc_NoteDriver : public BinMDF_ADriver
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT BinMXCAFDoc_NoteDriver(const Handle(Message_Messenger)& theMsgDriver);
|
||||
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& theSource,
|
||||
const Handle(TDF_Attribute)& theTarget,
|
||||
BinObjMgt_RRelocationTable& theRelocTable) const Standard_OVERRIDE;
|
||||
|
@@ -39,10 +39,6 @@ BinMXCAFDoc_NoteDriver.cxx
|
||||
BinMXCAFDoc_NoteDriver.hxx
|
||||
BinMXCAFDoc_NoteBalloonDriver.cxx
|
||||
BinMXCAFDoc_NoteBalloonDriver.hxx
|
||||
BinMXCAFDoc_NoteCommentDriver.cxx
|
||||
BinMXCAFDoc_NoteCommentDriver.hxx
|
||||
BinMXCAFDoc_NoteBinDataDriver.cxx
|
||||
BinMXCAFDoc_NoteBinDataDriver.hxx
|
||||
BinMXCAFDoc_NotesToolDriver.cxx
|
||||
BinMXCAFDoc_NotesToolDriver.hxx
|
||||
BinMXCAFDoc_ShapeToolDriver.cxx
|
||||
@@ -53,3 +49,7 @@ BinMXCAFDoc_ViewToolDriver.cxx
|
||||
BinMXCAFDoc_ViewToolDriver.hxx
|
||||
BinMXCAFDoc_VolumeDriver.cxx
|
||||
BinMXCAFDoc_VolumeDriver.hxx
|
||||
BinMXCAFDoc_AnimationDriver.cxx
|
||||
BinMXCAFDoc_AnimationDriver.hxx
|
||||
BinMXCAFDoc_AnimationToolDriver.cxx
|
||||
BinMXCAFDoc_AnimationToolDriver.hxx
|
||||
|
@@ -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
|
||||
@@ -973,24 +974,11 @@ Standard_Boolean Bnd_OBB::IsCompletelyInside(const Bnd_OBB& theOther) const
|
||||
// =======================================================================
|
||||
void Bnd_OBB::Add(const gp_Pnt& theP)
|
||||
{
|
||||
if (IsVoid())
|
||||
{
|
||||
myCenter = theP.XYZ();
|
||||
myAxes[0] = gp::DX().XYZ();
|
||||
myAxes[1] = gp::DY().XYZ();
|
||||
myAxes[2] = gp::DZ().XYZ();
|
||||
myHDims[0] = 0.0;
|
||||
myHDims[1] = 0.0;
|
||||
myHDims[2] = 0.0;
|
||||
myIsAABox = Standard_True;
|
||||
}
|
||||
else
|
||||
{
|
||||
gp_Pnt aList[9];
|
||||
GetVertex(aList);
|
||||
aList[8] = theP;
|
||||
ReBuild(TColgp_Array1OfPnt(aList[0], 0, 8));
|
||||
}
|
||||
gp_Pnt aList[9];
|
||||
GetVertex(aList);
|
||||
aList[8] = theP;
|
||||
|
||||
ReBuild(TColgp_Array1OfPnt(aList[0], 0, 8));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -999,26 +987,84 @@ void Bnd_OBB::Add(const gp_Pnt& theP)
|
||||
// =======================================================================
|
||||
void Bnd_OBB::Add(const Bnd_OBB& theOther)
|
||||
{
|
||||
if (!theOther.IsVoid())
|
||||
{
|
||||
if (IsVoid())
|
||||
{
|
||||
myCenter = theOther.myCenter;
|
||||
myAxes[0] = theOther.myAxes[0];
|
||||
myAxes[1] = theOther.myAxes[1];
|
||||
myAxes[2] = theOther.myAxes[2];
|
||||
myHDims[0] = theOther.myHDims[0];
|
||||
myHDims[1] = theOther.myHDims[1];
|
||||
myHDims[2] = theOther.myHDims[2];
|
||||
myIsAABox = theOther.myIsAABox;
|
||||
}
|
||||
else
|
||||
{
|
||||
gp_Pnt aList[16];
|
||||
GetVertex(&aList[0]);
|
||||
theOther.GetVertex(&aList[8]);
|
||||
ReBuild(TColgp_Array1OfPnt(aList[0], 0, 15));
|
||||
}
|
||||
}
|
||||
gp_Pnt aList[16];
|
||||
GetVertex(&aList[0]);
|
||||
theOther.GetVertex(&aList[8]);
|
||||
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
|
||||
|
@@ -28,7 +28,9 @@
|
||||
#include <Standard_Address.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
class StdFail_InfiniteSolutions;
|
||||
class StdFail_NotDone;
|
||||
class Standard_OutOfRange;
|
||||
class Adaptor3d_Curve;
|
||||
class Extrema_CurveTool;
|
||||
class Extrema_POnCurv;
|
||||
@@ -36,6 +38,7 @@ class gp_Pnt;
|
||||
class gp_Vec;
|
||||
|
||||
|
||||
|
||||
class Extrema_ECC
|
||||
{
|
||||
public:
|
||||
|
@@ -28,7 +28,9 @@
|
||||
#include <Standard_Address.hxx>
|
||||
#include <TColgp_HArray1OfPnt2d.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
class StdFail_InfiniteSolutions;
|
||||
class StdFail_NotDone;
|
||||
class Standard_OutOfRange;
|
||||
class Adaptor2d_Curve2d;
|
||||
class Extrema_Curve2dTool;
|
||||
class Extrema_POnCurv2d;
|
||||
@@ -36,6 +38,7 @@ class gp_Pnt2d;
|
||||
class gp_Vec2d;
|
||||
|
||||
|
||||
|
||||
class Extrema_ECC2d
|
||||
{
|
||||
public:
|
||||
|
@@ -16,6 +16,9 @@
|
||||
|
||||
#include <Extrema_ECC2d.hxx>
|
||||
|
||||
#include <StdFail_InfiniteSolutions.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Adaptor2d_Curve2d.hxx>
|
||||
#include <Extrema_Curve2dTool.hxx>
|
||||
#include <Extrema_ExtPC2d.hxx>
|
||||
|
@@ -16,6 +16,9 @@
|
||||
|
||||
#include <Extrema_ECC.hxx>
|
||||
|
||||
#include <StdFail_InfiniteSolutions.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <Extrema_CurveTool.hxx>
|
||||
#include <Extrema_ExtPC.hxx>
|
||||
|
@@ -43,6 +43,7 @@
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <StdFail_InfiniteSolutions.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfTransient.hxx>
|
||||
@@ -326,6 +327,11 @@ void Extrema_ExtCC::Points(const Standard_Integer N,
|
||||
Extrema_POnCurv& P1,
|
||||
Extrema_POnCurv& P2) const
|
||||
{
|
||||
if (IsParallel())
|
||||
{
|
||||
throw StdFail_InfiniteSolutions();
|
||||
}
|
||||
|
||||
if (N < 1 || N > NbExt())
|
||||
{
|
||||
throw Standard_OutOfRange();
|
||||
|
@@ -29,7 +29,9 @@
|
||||
#include <Standard_Address.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
class StdFail_InfiniteSolutions;
|
||||
class StdFail_NotDone;
|
||||
class Standard_OutOfRange;
|
||||
class Adaptor3d_Curve;
|
||||
class Extrema_POnCurv;
|
||||
class gp_Pnt;
|
||||
|
@@ -34,7 +34,10 @@
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <StdFail_InfiniteSolutions.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
Extrema_ExtCC2d::Extrema_ExtCC2d()
|
||||
|
@@ -28,7 +28,9 @@
|
||||
#include <Standard_Address.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
|
||||
class StdFail_InfiniteSolutions;
|
||||
class StdFail_NotDone;
|
||||
class Standard_OutOfRange;
|
||||
class Adaptor2d_Curve2d;
|
||||
class Extrema_POnCurv2d;
|
||||
class gp_Pnt2d;
|
||||
|
@@ -36,7 +36,10 @@
|
||||
#include <gp_Sphere.hxx>
|
||||
#include <gp_Torus.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_TypeMismatch.hxx>
|
||||
#include <StdFail_InfiniteSolutions.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
@@ -494,6 +497,11 @@ void Extrema_ExtCS::Points(const Standard_Integer N,
|
||||
Extrema_POnCurv& P1,
|
||||
Extrema_POnSurf& P2) const
|
||||
{
|
||||
if (IsParallel())
|
||||
{
|
||||
throw StdFail_InfiniteSolutions();
|
||||
}
|
||||
|
||||
if (N < 1 || N > NbExt())
|
||||
{
|
||||
throw Standard_OutOfRange();
|
||||
|
@@ -36,7 +36,9 @@
|
||||
#include <math_DirectPolynomialRoots.hxx>
|
||||
#include <math_TrigonometricFunctionRoots.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <StdFail_InfiniteSolutions.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -1098,6 +1100,11 @@ void Extrema_ExtElC::Points (const Standard_Integer N,
|
||||
Extrema_POnCurv& P1,
|
||||
Extrema_POnCurv& P2) const
|
||||
{
|
||||
if (IsParallel())
|
||||
{
|
||||
throw StdFail_InfiniteSolutions();
|
||||
}
|
||||
|
||||
if (N < 1 || N > NbExt())
|
||||
{
|
||||
throw Standard_OutOfRange();
|
||||
|
@@ -25,7 +25,9 @@
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Extrema_POnCurv.hxx>
|
||||
|
||||
class StdFail_InfiniteSolutions;
|
||||
class StdFail_NotDone;
|
||||
class Standard_OutOfRange;
|
||||
class gp_Lin;
|
||||
class gp_Circ;
|
||||
class gp_Elips;
|
||||
|
@@ -27,7 +27,9 @@
|
||||
#include <math_DirectPolynomialRoots.hxx>
|
||||
#include <math_TrigonometricFunctionRoots.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <StdFail_InfiniteSolutions.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
//=======================================================================
|
||||
@@ -457,6 +459,11 @@ void Extrema_ExtElC2d::Points (const Standard_Integer N,
|
||||
Extrema_POnCurv2d& P1,
|
||||
Extrema_POnCurv2d& P2) const
|
||||
{
|
||||
if (IsParallel())
|
||||
{
|
||||
throw StdFail_InfiniteSolutions();
|
||||
}
|
||||
|
||||
if (N < 1 || N > NbExt()) { throw Standard_OutOfRange(); }
|
||||
P1 = myPoint[N-1][0];
|
||||
P2 = myPoint[N-1][1];
|
||||
|
@@ -25,7 +25,9 @@
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Extrema_POnCurv2d.hxx>
|
||||
|
||||
class StdFail_InfiniteSolutions;
|
||||
class StdFail_NotDone;
|
||||
class Standard_OutOfRange;
|
||||
class gp_Lin2d;
|
||||
class gp_Circ2d;
|
||||
class gp_Elips2d;
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <StdFail_InfiniteSolutions.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
|
||||
@@ -826,6 +827,11 @@ void Extrema_ExtElCS::Points(const Standard_Integer N,
|
||||
Extrema_POnCurv& P1,
|
||||
Extrema_POnSurf& P2) const
|
||||
{
|
||||
if (IsParallel())
|
||||
{
|
||||
throw StdFail_InfiniteSolutions();
|
||||
}
|
||||
|
||||
if (N < 1 || N > NbExt())
|
||||
{
|
||||
throw Standard_OutOfRange();
|
||||
|
@@ -27,7 +27,9 @@
|
||||
#include <Extrema_HArray1OfPOnCurv.hxx>
|
||||
#include <Extrema_HArray1OfPOnSurf.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
|
||||
class StdFail_InfiniteSolutions;
|
||||
class StdFail_NotDone;
|
||||
class Standard_OutOfRange;
|
||||
class gp_Lin;
|
||||
class gp_Pln;
|
||||
class gp_Cylinder;
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <StdFail_InfiniteSolutions.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
Extrema_ExtElSS::Extrema_ExtElSS()
|
||||
@@ -164,6 +165,11 @@ void Extrema_ExtElSS::Points(const Standard_Integer N,
|
||||
Extrema_POnSurf& P1,
|
||||
Extrema_POnSurf& P2) const
|
||||
{
|
||||
if (IsParallel())
|
||||
{
|
||||
throw StdFail_InfiniteSolutions();
|
||||
}
|
||||
|
||||
if (N < 1 || N > NbExt())
|
||||
{
|
||||
throw Standard_OutOfRange();
|
||||
|
@@ -26,7 +26,9 @@
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <Extrema_HArray1OfPOnSurf.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
|
||||
class StdFail_InfiniteSolutions;
|
||||
class StdFail_NotDone;
|
||||
class Standard_OutOfRange;
|
||||
class gp_Pln;
|
||||
class gp_Sphere;
|
||||
class gp_Cylinder;
|
||||
|
@@ -24,7 +24,10 @@
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <Standard_TypeMismatch.hxx>
|
||||
#include <StdFail_InfiniteSolutions.hxx>
|
||||
#include <StdFail_NotDone.hxx>
|
||||
|
||||
Extrema_ExtSS::Extrema_ExtSS()
|
||||
@@ -260,6 +263,11 @@ void Extrema_ExtSS::Points(const Standard_Integer N,
|
||||
Extrema_POnSurf& P1,
|
||||
Extrema_POnSurf& P2) const
|
||||
{
|
||||
if (IsParallel())
|
||||
{
|
||||
throw StdFail_InfiniteSolutions();
|
||||
}
|
||||
|
||||
if (N < 1 || N > NbExt())
|
||||
{
|
||||
throw Standard_OutOfRange();
|
||||
|
@@ -658,6 +658,11 @@ void Extrema_GenExtCC::Points(const Standard_Integer N,
|
||||
POnC& P1,
|
||||
POnC& P2) const
|
||||
{
|
||||
if (IsParallel())
|
||||
{
|
||||
throw StdFail_InfiniteSolutions();
|
||||
}
|
||||
|
||||
if (N < 1 || N > NbExt())
|
||||
{
|
||||
throw Standard_OutOfRange();
|
||||
|
@@ -1,3 +1,5 @@
|
||||
Font.cxx
|
||||
Font.hxx
|
||||
Font_BRepFont.cxx
|
||||
Font_BRepFont.hxx
|
||||
Font_BRepTextBuilder.cxx
|
||||
|
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
@@ -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
|
@@ -15,12 +15,14 @@
|
||||
|
||||
#include <Font_BRepTextBuilder.hxx>
|
||||
|
||||
#include <Font_TextFormatter.hxx>
|
||||
|
||||
// =======================================================================
|
||||
// Function : Perfrom
|
||||
// Purpose :
|
||||
// =======================================================================
|
||||
TopoDS_Shape Font_BRepTextBuilder::Perform (Font_BRepFont& theFont,
|
||||
const Font_TextFormatter& theFormatter,
|
||||
const Handle(Font_TextFormatter)& theFormatter,
|
||||
const gp_Ax3& thePenLoc)
|
||||
{
|
||||
gp_Trsf aTrsf;
|
||||
@@ -31,34 +33,20 @@ TopoDS_Shape Font_BRepTextBuilder::Perform (Font_BRepFont& theFont,
|
||||
|
||||
myBuilder.MakeCompound (aResult);
|
||||
|
||||
Standard_Integer aSymbolCounter = 0;
|
||||
Standard_Real aScaleUnits = theFont.Scale();
|
||||
for (NCollection_Utf8Iter anIter = theFormatter.String().Iterator(); *anIter != 0; ++anIter)
|
||||
Standard_Real aScaleUnits = theFont.Scale();
|
||||
for (Font_TextFormatter::Iterator aFormatterIt (*theFormatter, Font_TextFormatter::IterationFilter_ExcludeInvisible);
|
||||
aFormatterIt .More(); aFormatterIt .Next())
|
||||
{
|
||||
const Standard_Utf32Char aCharCurr = *anIter;
|
||||
if (aCharCurr == '\x0D' // CR (carriage return)
|
||||
|| aCharCurr == '\a' // BEL (alarm)
|
||||
|| aCharCurr == '\f' // FF (form feed) NP (new page)
|
||||
|| aCharCurr == '\b' // BS (backspace)
|
||||
|| aCharCurr == '\v' // VT (vertical tab)
|
||||
|| aCharCurr == ' '
|
||||
|| aCharCurr == '\t'
|
||||
|| aCharCurr == '\n')
|
||||
{
|
||||
continue; // skip unsupported carriage control codes
|
||||
}
|
||||
const NCollection_Vec2<Standard_ShortReal>& aCorner = theFormatter->BottomLeft (aFormatterIt.SymbolPosition());
|
||||
|
||||
const NCollection_Vec2<Standard_ShortReal>& aCorner = theFormatter.TopLeft (aSymbolCounter);
|
||||
aPen.SetCoord (aCorner.x() * aScaleUnits, aCorner.y() * aScaleUnits, 0.0);
|
||||
aGlyphShape = theFont.RenderGlyph (aCharCurr);
|
||||
aGlyphShape = theFont.RenderGlyph (aFormatterIt.Symbol());
|
||||
if (!aGlyphShape.IsNull())
|
||||
{
|
||||
aTrsf.SetTranslation (gp_Vec (aPen));
|
||||
aGlyphShape.Move (aTrsf);
|
||||
myBuilder.Add (aResult, aGlyphShape);
|
||||
}
|
||||
|
||||
++aSymbolCounter;
|
||||
}
|
||||
|
||||
aTrsf.SetTransformation (thePenLoc, gp_Ax3 (gp::XOY()));
|
||||
@@ -77,13 +65,13 @@ TopoDS_Shape Font_BRepTextBuilder::Perform (Font_BRepFont&
|
||||
const Graphic3d_HorizontalTextAlignment theHAlign,
|
||||
const Graphic3d_VerticalTextAlignment theVAlign)
|
||||
{
|
||||
Font_TextFormatter aFormatter;
|
||||
Handle(Font_TextFormatter) aFormatter = new Font_TextFormatter();
|
||||
|
||||
aFormatter.Reset();
|
||||
aFormatter.SetupAlignment (theHAlign, theVAlign);
|
||||
aFormatter->Reset();
|
||||
aFormatter->SetupAlignment (theHAlign, theVAlign);
|
||||
|
||||
aFormatter.Append (theString, *(reinterpret_cast<Font_FTFont*> (&theFont)));
|
||||
aFormatter.Format();
|
||||
aFormatter->Append (theString, *(reinterpret_cast<Font_FTFont*> (&theFont)));
|
||||
aFormatter->Format();
|
||||
|
||||
return Perform (theFont, aFormatter, thePenLoc);
|
||||
}
|
||||
|
@@ -17,9 +17,10 @@
|
||||
#define Font_BRepTextBuilder_Header
|
||||
|
||||
#include <Font_BRepFont.hxx>
|
||||
#include <Font_TextFormatter.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
|
||||
class Font_TextFormatter;
|
||||
|
||||
//! Represents class for applying text formatting.
|
||||
class Font_BRepTextBuilder
|
||||
{
|
||||
@@ -30,7 +31,7 @@ public:
|
||||
//! @param theFormatter formatter which defines alignment for the text
|
||||
//! @return result shape with pen transformation applied as shape location
|
||||
Standard_EXPORT TopoDS_Shape Perform (Font_BRepFont& theFont,
|
||||
const Font_TextFormatter& theFormatter,
|
||||
const Handle(Font_TextFormatter)& theFormatter,
|
||||
const gp_Ax3& thePenLoc = gp_Ax3());
|
||||
//! Render text as BRep shape.
|
||||
//! @param theString text in UTF-8 encoding
|
||||
|
@@ -17,6 +17,10 @@
|
||||
|
||||
#include <Font_FTFont.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT (Font_TextFormatter, Standard_Transient)
|
||||
|
||||
namespace
|
||||
{
|
||||
typedef NCollection_Vec2<Standard_ShortReal> Vec2f;
|
||||
@@ -55,16 +59,17 @@ Font_TextFormatter::Font_TextFormatter()
|
||||
: myAlignX (Graphic3d_HTA_LEFT),
|
||||
myAlignY (Graphic3d_VTA_TOP),
|
||||
myTabSize (8),
|
||||
myWrappingWidth (0.0f),
|
||||
myLastSymbolWidth (0.0f),
|
||||
myMaxSymbolWidth (0.0f),
|
||||
//
|
||||
myPen (0.0f, 0.0f),
|
||||
myRectsNb (0),
|
||||
myLineSpacing (0.0f),
|
||||
myAscender (0.0f),
|
||||
myIsFormatted (false),
|
||||
//
|
||||
myLinesNb (0),
|
||||
myRectLineStart (0),
|
||||
myRectWordStart (0),
|
||||
myNewLineNb(0),
|
||||
myPenCurrLine (0.0f),
|
||||
myBndTop (0.0f),
|
||||
@@ -94,10 +99,12 @@ void Font_TextFormatter::Reset()
|
||||
myIsFormatted = false;
|
||||
myString.Clear();
|
||||
myPen.x() = myPen.y() = 0.0f;
|
||||
myRectsNb = 0;
|
||||
myLineSpacing = myAscender = 0.0f;
|
||||
myCorners.Clear();
|
||||
myNewLines.Clear();
|
||||
|
||||
myLastSymbolWidth = 0.0f;
|
||||
myMaxSymbolWidth = 0.0f;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -119,16 +126,14 @@ void Font_TextFormatter::Append (const NCollection_String& theString,
|
||||
int aSymbolsCounter = 0; // special counter to process tabulation symbols
|
||||
|
||||
// first pass - render all symbols using associated font on single ZERO baseline
|
||||
for (NCollection_Utf8Iter anIter = theString.Iterator(); *anIter != 0;)
|
||||
Standard_Utf32Char aCharThis;
|
||||
for (Font_TextFormatter::Iterator aFormatterIt (*this); aFormatterIt .More(); aFormatterIt .Next())
|
||||
{
|
||||
const Standard_Utf32Char aCharThis = *anIter;
|
||||
const Standard_Utf32Char aCharNext = *++anIter;
|
||||
aCharThis = aFormatterIt.Symbol();
|
||||
const Standard_Utf32Char aCharNext = aFormatterIt.SymbolNext();
|
||||
|
||||
if (aCharThis == '\x0D' // CR (carriage return)
|
||||
|| aCharThis == '\a' // BEL (alarm)
|
||||
|| aCharThis == '\f' // FF (form feed) NP (new page)
|
||||
|| aCharThis == '\b' // BS (backspace)
|
||||
|| aCharThis == '\v') // VT (vertical tab)
|
||||
Standard_ShortReal anAdvanceX = 0;
|
||||
if (IsCommandSymbol (aCharThis))
|
||||
{
|
||||
continue; // skip unsupported carriage control codes
|
||||
}
|
||||
@@ -136,79 +141,66 @@ void Font_TextFormatter::Append (const NCollection_String& theString,
|
||||
{
|
||||
aSymbolsCounter = 0;
|
||||
myNewLines.Append (myPen.x());
|
||||
continue; // will be processed on second pass
|
||||
anAdvanceX = 0; // the symbol has null width
|
||||
}
|
||||
else if (aCharThis == ' ')
|
||||
{
|
||||
++aSymbolsCounter;
|
||||
myPen.x() += theFont.AdvanceX (' ', aCharNext);
|
||||
continue;
|
||||
anAdvanceX = theFont.AdvanceX (' ', aCharNext);
|
||||
}
|
||||
else if (aCharThis == '\t')
|
||||
{
|
||||
const Standard_Integer aSpacesNum = (myTabSize - (aSymbolsCounter - 1) % myTabSize);
|
||||
myPen.x() += theFont.AdvanceX (' ', aCharNext) * Standard_ShortReal(aSpacesNum);
|
||||
anAdvanceX = theFont.AdvanceX (' ', aCharNext) * Standard_ShortReal(aSpacesNum);
|
||||
aSymbolsCounter += aSpacesNum;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
anAdvanceX = theFont.AdvanceX (aCharThis, aCharNext);
|
||||
|
||||
++aSymbolsCounter;
|
||||
|
||||
myCorners.Append (myPen);
|
||||
|
||||
myPen.x() += theFont.AdvanceX (aCharThis, aCharNext);
|
||||
|
||||
++myRectsNb;
|
||||
myPen.x() += anAdvanceX;
|
||||
myMaxSymbolWidth = Max (myMaxSymbolWidth, anAdvanceX);
|
||||
}
|
||||
myLastSymbolWidth = myPen.x() - myCorners.Last().x();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : newLine
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Font_TextFormatter::newLine (const Standard_Integer theLastRect)
|
||||
void Font_TextFormatter::newLine (const Standard_Integer theLastRect,
|
||||
const Standard_ShortReal theMaxLineWidth)
|
||||
{
|
||||
if (myRectLineStart >= myRectsNb)
|
||||
Standard_Integer aFirstCornerId = myRectLineStart;
|
||||
Standard_Integer aLastCornerId = theLastRect;
|
||||
|
||||
if (aFirstCornerId >= myCorners.Length())
|
||||
{
|
||||
++myLinesNb;
|
||||
myPenCurrLine -= myLineSpacing;
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_ShortReal aXMin = BottomLeft (aFirstCornerId).x();
|
||||
Font_Rect aBndBox;
|
||||
BndBox (aLastCornerId, aBndBox);
|
||||
Standard_ShortReal aXMax = aBndBox.Right;
|
||||
|
||||
myMoveVec.y() = myPenCurrLine;
|
||||
switch (myAlignX)
|
||||
{
|
||||
default:
|
||||
case Graphic3d_HTA_LEFT:
|
||||
{
|
||||
myMoveVec.x() = (myNewLineNb > 0) ? -myNewLines.Value (myNewLineNb - 1) : 0.0f;
|
||||
break;
|
||||
}
|
||||
case Graphic3d_HTA_RIGHT:
|
||||
{
|
||||
myMoveVec.x() = (myNewLineNb < myNewLines.Length())
|
||||
? -myNewLines.Value (myNewLineNb)
|
||||
: -myPen.x();
|
||||
break;
|
||||
}
|
||||
case Graphic3d_HTA_CENTER:
|
||||
{
|
||||
const Standard_ShortReal aFrom = (myNewLineNb > 0)
|
||||
? myNewLines.Value (myNewLineNb - 1)
|
||||
: 0.0f;
|
||||
const Standard_ShortReal aTo = (myNewLineNb < myNewLines.Length())
|
||||
? myNewLines.Value (myNewLineNb)
|
||||
: myPen.x();
|
||||
myMoveVec.x() = -0.5f * (aFrom + aTo);
|
||||
break;
|
||||
}
|
||||
case Graphic3d_HTA_LEFT: myMoveVec.x() = -aXMin; break;
|
||||
case Graphic3d_HTA_RIGHT: myMoveVec.x() = -aXMin + (theMaxLineWidth - (aXMax - aXMin)) - theMaxLineWidth; break;
|
||||
case Graphic3d_HTA_CENTER: myMoveVec.x() = -aXMin + 0.5f * (theMaxLineWidth - (aXMax - aXMin)) - 0.5f * theMaxLineWidth; break;
|
||||
}
|
||||
|
||||
move (myCorners, myMoveVec, myRectLineStart, theLastRect);
|
||||
|
||||
++myLinesNb;
|
||||
myPenCurrLine -= myLineSpacing;
|
||||
myRectLineStart = myRectWordStart = theLastRect + 1;
|
||||
myRectLineStart = theLastRect + 1;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -217,13 +209,13 @@ void Font_TextFormatter::newLine (const Standard_Integer theLastRect)
|
||||
// =======================================================================
|
||||
void Font_TextFormatter::Format()
|
||||
{
|
||||
if (myRectsNb == 0 || myIsFormatted)
|
||||
if (myCorners.Length() == 0 || myIsFormatted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myIsFormatted = true;
|
||||
myLinesNb = myRectLineStart = myRectWordStart = 0;
|
||||
myLinesNb = myRectLineStart = 0;
|
||||
myBndTop = 0.0f;
|
||||
myBndWidth = 0.0f;
|
||||
myMoveVec.x() = myMoveVec.y() = 0.0f;
|
||||
@@ -232,59 +224,56 @@ void Font_TextFormatter::Format()
|
||||
myPenCurrLine = -myAscender;
|
||||
Standard_Integer aRectIter = 0;
|
||||
myNewLineNb = 0;
|
||||
Standard_ShortReal aMaxLineWidth = -1.0f;
|
||||
for (NCollection_Utf8Iter anIter = myString.Iterator(); *anIter != 0; ++anIter)
|
||||
{
|
||||
const Standard_Utf32Char aCharThis = *anIter;
|
||||
if (aCharThis == '\x0D' // CR (carriage return)
|
||||
|| aCharThis == '\a' // BEL (alarm)
|
||||
|| aCharThis == '\f' // FF (form feed) NP (new page)
|
||||
|| aCharThis == '\b' // BS (backspace)
|
||||
|| aCharThis == '\v') // VT (vertical tab)
|
||||
{
|
||||
continue; // skip unsupported carriage control codes
|
||||
}
|
||||
else if (aCharThis == '\x0A') // LF (line feed, new line)
|
||||
{
|
||||
// calculate max line width
|
||||
if (myNewLineNb == 0)
|
||||
{
|
||||
aMaxLineWidth = myNewLines.Value(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
aMaxLineWidth = Max (aMaxLineWidth, myNewLines.Value (myNewLineNb) - myNewLines.Value (myNewLineNb - 1));
|
||||
}
|
||||
|
||||
const Standard_Integer aLastRect = aRectIter - 1; // last rect on current line
|
||||
newLine (aLastRect);
|
||||
Standard_ShortReal aMaxLineWidth = Wrapping();
|
||||
if (HasWrapping())
|
||||
{
|
||||
aMaxLineWidth = Max (aMaxLineWidth, MaximumSymbolWidth()); // it is not possible to wrap less than symbol width
|
||||
}
|
||||
else
|
||||
{
|
||||
if (myNewLines.IsEmpty()) // If only one line
|
||||
aMaxLineWidth = myPen.x();
|
||||
else
|
||||
{
|
||||
for (int aLineIt = 0; aLineIt < myNewLines.Size(); aLineIt++)
|
||||
aMaxLineWidth = Max (aMaxLineWidth, LineWidth (aLineIt));
|
||||
aMaxLineWidth = Max (aMaxLineWidth, LineWidth (myNewLines.Size())); // processing the last line also
|
||||
}
|
||||
}
|
||||
|
||||
for (Font_TextFormatter::Iterator aFormatterIt (*this);
|
||||
aFormatterIt .More(); aFormatterIt .Next())
|
||||
{
|
||||
const Standard_Utf32Char aCharThis = aFormatterIt.Symbol();
|
||||
aRectIter = aFormatterIt.SymbolPosition();
|
||||
|
||||
if (aCharThis == '\x0A') // LF (line feed, new line)
|
||||
{
|
||||
const Standard_Integer aLastRect = aRectIter; // last rect on current line
|
||||
newLine (aLastRect, aMaxLineWidth);
|
||||
++myNewLineNb;
|
||||
continue;
|
||||
}
|
||||
else if (aCharThis == ' '
|
||||
|| aCharThis == '\t')
|
||||
else if (HasWrapping()) // wrap lines longer than maximum width
|
||||
{
|
||||
myRectWordStart = aRectIter;
|
||||
continue;
|
||||
Standard_Integer aFirstCornerId = myRectLineStart;
|
||||
|
||||
Font_Rect aBndBox;
|
||||
BndBox (aRectIter, aBndBox);
|
||||
const Standard_ShortReal aNextXPos = aBndBox.Right - BottomLeft (aFirstCornerId).x();
|
||||
if (aNextXPos > aMaxLineWidth) // wrap the line and do processing of the symbol
|
||||
{
|
||||
const Standard_Integer aLastRect = aRectIter - 1; // last rect on current line
|
||||
newLine (aLastRect, aMaxLineWidth);
|
||||
}
|
||||
}
|
||||
|
||||
++aRectIter;
|
||||
}
|
||||
|
||||
// If only one line
|
||||
if (aMaxLineWidth < 0.0f)
|
||||
{
|
||||
aMaxLineWidth = myPen.x();
|
||||
}
|
||||
else // Consider last line
|
||||
{
|
||||
aMaxLineWidth = Max (aMaxLineWidth, myPen.x() - myNewLines.Value (myNewLineNb - 1));
|
||||
}
|
||||
|
||||
myBndWidth = aMaxLineWidth;
|
||||
|
||||
// move last line
|
||||
newLine (myRectsNb - 1);
|
||||
newLine (myCorners.Length() - 1, aMaxLineWidth);
|
||||
|
||||
// apply vertical alignment style
|
||||
if (myAlignY == Graphic3d_VTA_BOTTOM)
|
||||
@@ -302,6 +291,126 @@ void Font_TextFormatter::Format()
|
||||
|
||||
if (myAlignY != Graphic3d_VTA_TOP)
|
||||
{
|
||||
moveY (myCorners, myBndTop, 0, myRectsNb - 1);
|
||||
moveY (myCorners, myBndTop, 0, myCorners.Length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : BndBox
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean Font_TextFormatter::BndBox (const Standard_Integer theIndex, Font_Rect& theBndBox) const
|
||||
{
|
||||
if (theIndex < 0 || theIndex >= Corners().Size())
|
||||
return Standard_False;
|
||||
|
||||
const NCollection_Vec2<Standard_ShortReal>& aLeftCorner = BottomLeft (theIndex);
|
||||
if (theIndex + 1 < myCorners.Length()) // not the last symbol
|
||||
{
|
||||
const NCollection_Vec2<Standard_ShortReal>& aNextLeftCorner = BottomLeft (theIndex + 1);
|
||||
theBndBox.Left = aLeftCorner.x();
|
||||
theBndBox.Bottom = aLeftCorner.y();
|
||||
theBndBox.Top = theBndBox.Bottom + myLineSpacing;
|
||||
if (Abs (aLeftCorner.y() - aNextLeftCorner.y()) < Precision::Confusion()) // in the same row
|
||||
{
|
||||
theBndBox.Right = aNextLeftCorner.x();
|
||||
}
|
||||
else
|
||||
{
|
||||
// the next symbol is on the next row either by '\n' or by wrapping
|
||||
Standard_ShortReal aLineWidth = LineWidth (LineIndex (theIndex));
|
||||
theBndBox.Left = aLeftCorner.x();
|
||||
switch (myAlignX)
|
||||
{
|
||||
case Graphic3d_HTA_LEFT: theBndBox.Right = aLineWidth; break;
|
||||
case Graphic3d_HTA_RIGHT: theBndBox.Right = myBndWidth; break;
|
||||
case Graphic3d_HTA_CENTER: theBndBox.Right = 0.5f * (myBndWidth + aLineWidth); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // the last symbol
|
||||
{
|
||||
theBndBox.Left = aLeftCorner.x();
|
||||
theBndBox.Right = aLeftCorner.x() + myLastSymbolWidth;
|
||||
theBndBox.Bottom = aLeftCorner.y();
|
||||
theBndBox.Top = theBndBox.Bottom + myLineSpacing;
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
// =======================================================================
|
||||
// function : IsLFSymbol
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean Font_TextFormatter::IsLFSymbol (const Standard_Integer theIndex) const
|
||||
{
|
||||
Font_Rect aBndBox;
|
||||
if (!BndBox (theIndex, aBndBox))
|
||||
return Standard_False;
|
||||
|
||||
return Abs (aBndBox.Right - aBndBox.Left) < Precision::Confusion();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : FirstPosition
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_ShortReal Font_TextFormatter::FirstPosition() const
|
||||
{
|
||||
switch (myAlignX)
|
||||
{
|
||||
default:
|
||||
case Graphic3d_HTA_LEFT: return 0; break;
|
||||
case Graphic3d_HTA_RIGHT: return myBndWidth; break;
|
||||
case Graphic3d_HTA_CENTER: return 0.5f * myBndWidth; break;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : LinePositionIndex
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Integer Font_TextFormatter::LinePositionIndex (const Standard_Integer theIndex) const
|
||||
{
|
||||
Standard_Integer anIndex = 0;
|
||||
|
||||
Standard_ShortReal anIndexHeight = BottomLeft (theIndex).y();
|
||||
for (Standard_Integer aPrevIndex = theIndex-1; aPrevIndex >= 0; aPrevIndex--)
|
||||
{
|
||||
if (BottomLeft (aPrevIndex).y() > anIndexHeight)
|
||||
break;
|
||||
anIndex++;
|
||||
}
|
||||
return anIndex;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : LineIndex
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Integer Font_TextFormatter::LineIndex (const Standard_Integer theIndex) const
|
||||
{
|
||||
if (myLineSpacing < 0.0f)
|
||||
return 0;
|
||||
|
||||
return (Standard_Integer)Abs((BottomLeft (theIndex).y() + myAscender) / myLineSpacing);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : LineWidth
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_ShortReal Font_TextFormatter::LineWidth (const Standard_Integer theIndex) const
|
||||
{
|
||||
if (theIndex < 0)
|
||||
return 0;
|
||||
|
||||
if (theIndex < myNewLines.Length())
|
||||
return theIndex == 0 ? myNewLines[0] : myNewLines[theIndex] - myNewLines[theIndex -1];
|
||||
|
||||
if (theIndex == myNewLines.Length()) // the last line
|
||||
return theIndex == 0 ? myPen.x() : myPen.x() - myNewLines[theIndex -1];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -25,10 +25,111 @@
|
||||
|
||||
class Font_FTFont;
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Font_TextFormatter, Standard_Transient)
|
||||
|
||||
//! This class intended to prepare formatted text.
|
||||
class Font_TextFormatter
|
||||
//! Case of the formatter using:
|
||||
//! Handle(Font_TextFormatter) aFormatter = new Font_TextFormatter();
|
||||
//! aFormatter->Append(text_1, aFont1);
|
||||
//! aFormatter->Append(text_2, aFont2);
|
||||
//! aFormatter->Format();
|
||||
//!
|
||||
//! Example of corners indices for the text:
|
||||
//! "row_1\n" - 0-5
|
||||
//! "\n" - 6
|
||||
//! "\n" - 7
|
||||
//! "row_2\n" - 8-13
|
||||
//! Processing of \n symbol:
|
||||
//! - it is placed on the row where it appears
|
||||
//! - BndBox for \n has zero width
|
||||
//! - if the last symbol is \n, use LastBndBox() to get position on the next row
|
||||
//!
|
||||
//! Pay attention that fonts should have the same LineSpacing value
|
||||
//!
|
||||
class Font_TextFormatter : public Standard_Transient
|
||||
{
|
||||
public:
|
||||
//! Iteration filter flags. Command symbols are skipped with any filter.
|
||||
enum IterationFilter
|
||||
{
|
||||
IterationFilter_None = 0x0000, //!< no filter
|
||||
IterationFilter_ExcludeInvisible = 0x0002, //!< exclude ' ', '\t', '\n'
|
||||
};
|
||||
|
||||
//! Iterator through light sources.
|
||||
class Iterator
|
||||
{
|
||||
public:
|
||||
//! Constructor with initialization.
|
||||
Iterator (const Font_TextFormatter& theFormatter,
|
||||
IterationFilter theFilter = IterationFilter_None)
|
||||
: myFilter (theFilter), myIter (theFormatter.myString.Iterator())
|
||||
{
|
||||
mySymbolPosition = readNextSymbol (-1, mySymbolChar);
|
||||
mySymbolNext = readNextSymbol (mySymbolPosition, mySymbolCharNext);
|
||||
}
|
||||
|
||||
//! Returns TRUE if iterator points to a valid item.
|
||||
Standard_Boolean More() const { return mySymbolPosition >= 0; }
|
||||
|
||||
//! Returns TRUE if next item exists
|
||||
Standard_Boolean HasNext() const { return mySymbolNext >= 0; }
|
||||
|
||||
//! Returns current symbol.
|
||||
Standard_Utf32Char Symbol() const { return mySymbolChar; }
|
||||
|
||||
//! Returns the next symbol if exists.
|
||||
Standard_Utf32Char SymbolNext() const { return mySymbolCharNext; }
|
||||
|
||||
//! Returns current symbol position.
|
||||
Standard_Integer SymbolPosition() const { return mySymbolPosition; }
|
||||
|
||||
//! Returns the next symbol position.
|
||||
Standard_Integer SymbolPositionNext() const { return mySymbolNext; }
|
||||
|
||||
//! Moves to the next item.
|
||||
void Next()
|
||||
{
|
||||
mySymbolPosition = mySymbolNext;
|
||||
mySymbolChar = mySymbolCharNext;
|
||||
mySymbolNext = readNextSymbol (mySymbolPosition, mySymbolCharNext);
|
||||
}
|
||||
|
||||
protected:
|
||||
Standard_Integer readNextSymbol (const Standard_Integer aSymbolStartingFrom, Standard_Utf32Char& theSymbolChar)
|
||||
{
|
||||
Standard_Integer aNextSymbol = aSymbolStartingFrom;
|
||||
for (; *myIter != 0; ++myIter)
|
||||
{
|
||||
const Standard_Utf32Char aCharCurr = *myIter;
|
||||
if (Font_TextFormatter::IsCommandSymbol (aCharCurr))
|
||||
{
|
||||
continue; // skip unsupported carriage control codes
|
||||
}
|
||||
aNextSymbol++;
|
||||
if ((myFilter & IterationFilter_ExcludeInvisible) != 0)
|
||||
{
|
||||
if (aCharCurr == '\x0A'|| // LF (line feed, new line)
|
||||
aCharCurr == ' ' ||
|
||||
aCharCurr == '\t')
|
||||
continue;
|
||||
}
|
||||
++myIter;
|
||||
theSymbolChar = aCharCurr;
|
||||
return aNextSymbol; // found the first next, not command and not filtered symbol
|
||||
}
|
||||
return -1; // the next symbol is not found
|
||||
}
|
||||
|
||||
protected:
|
||||
IterationFilter myFilter; //!< possibility to filter not-necessary symbols
|
||||
|
||||
NCollection_Utf8Iter myIter; //!< the next symbol iterator value over the text formatter string
|
||||
Standard_Integer mySymbolPosition; //!< the current position
|
||||
Standard_Utf32Char mySymbolChar; //!< the current symbol
|
||||
Standard_Integer mySymbolNext; //!< position of the next symbol in iterator, if zero, the iterator is finished
|
||||
Standard_Utf32Char mySymbolCharNext; //!< the current symbol
|
||||
};
|
||||
|
||||
//! Default constructor.
|
||||
Standard_EXPORT Font_TextFormatter();
|
||||
@@ -49,16 +150,32 @@ public:
|
||||
Standard_EXPORT void Format();
|
||||
|
||||
//! Returns specific glyph rectangle.
|
||||
inline const NCollection_Vec2<Standard_ShortReal>& TopLeft (const Standard_Integer theIndex) const
|
||||
{
|
||||
return myCorners.Value (theIndex);
|
||||
}
|
||||
inline const NCollection_Vec2<Standard_ShortReal>& BottomLeft (const Standard_Integer theIndex) const
|
||||
{ return myCorners.Value (theIndex); }
|
||||
|
||||
//! Returns current rendering string.
|
||||
inline const NCollection_String& String() const
|
||||
{
|
||||
return myString;
|
||||
}
|
||||
//! Returns symbol bounding box
|
||||
//! @param bounding box.
|
||||
Standard_EXPORT Standard_Boolean BndBox (const Standard_Integer theIndex, Font_Rect& theBndBox) const;
|
||||
|
||||
//! Returns the line height
|
||||
//! \param theIndex a line index, obtained by LineIndex()
|
||||
Standard_ShortReal LineHeight (const Standard_Integer theIndex) const
|
||||
{ return theIndex == 0 ? myAscender : myLineSpacing; }
|
||||
|
||||
//!< Returns width of a line
|
||||
Standard_EXPORT Standard_ShortReal LineWidth (const Standard_Integer theIndex) const;
|
||||
|
||||
//! Returns true if the symbol by the index is '\n'. The width of the symbol is zero.
|
||||
Standard_EXPORT Standard_Boolean IsLFSymbol (const Standard_Integer theIndex) const;
|
||||
|
||||
//! Returns position of the first symbol in a line using alignment
|
||||
Standard_EXPORT Standard_ShortReal FirstPosition() const;
|
||||
|
||||
//! Returns column index of the corner index in the current line
|
||||
Standard_EXPORT Standard_Integer LinePositionIndex (const Standard_Integer theIndex) const;
|
||||
|
||||
//! Returns row index of the corner index among text lines
|
||||
Standard_EXPORT Standard_Integer LineIndex (const Standard_Integer theIndex) const;
|
||||
|
||||
//! Returns tab size.
|
||||
inline Standard_Integer TabSize() const
|
||||
@@ -66,6 +183,21 @@ public:
|
||||
return myTabSize;
|
||||
}
|
||||
|
||||
//!< Returns horizontal alignment style
|
||||
Graphic3d_HorizontalTextAlignment HorizontalTextAlignment() const { return myAlignX; }
|
||||
|
||||
//!< Returns vertical alignment style
|
||||
Graphic3d_VerticalTextAlignment VerticalTextAlignment() const { return myAlignY; }
|
||||
|
||||
//!< Sets text wrapping width, zero means that the text is not bounded by width
|
||||
void SetWrapping (const Standard_ShortReal theWidth) { myWrappingWidth = theWidth; }
|
||||
|
||||
//!< Returns text maximum width, zero means that the text is not bounded by width
|
||||
Standard_Boolean HasWrapping() const { return myWrappingWidth > 0; }
|
||||
|
||||
//!< Returns text maximum width, zero means that the text is not bounded by width
|
||||
Standard_ShortReal Wrapping() const { return myWrappingWidth; }
|
||||
|
||||
//! @return width of formatted text.
|
||||
inline Standard_ShortReal ResultWidth() const
|
||||
{
|
||||
@@ -78,6 +210,9 @@ public:
|
||||
return myLineSpacing * Standard_ShortReal(myLinesNb);
|
||||
}
|
||||
|
||||
//!< @return maximum width of the text symbol
|
||||
inline Standard_ShortReal MaximumSymbolWidth() const { return myMaxSymbolWidth; }
|
||||
|
||||
//! @param bounding box.
|
||||
inline void BndBox (Font_Rect& theBndBox) const
|
||||
{
|
||||
@@ -98,16 +233,40 @@ public:
|
||||
theBndBox.Bottom = theBndBox.Top - myLineSpacing * Standard_ShortReal(myLinesNb);
|
||||
}
|
||||
|
||||
//!< Returns internal container of the top left corners of a formatted rectangles.
|
||||
const NCollection_Vector < NCollection_Vec2<Standard_ShortReal> >& Corners() const { return myCorners; }
|
||||
|
||||
const NCollection_Vector<Standard_ShortReal>& NewLines() const { return myNewLines; }
|
||||
|
||||
//!< Returns true if the symbol is CR, BEL, FF, NP, BS or VT
|
||||
static inline Standard_Boolean IsCommandSymbol (const Standard_Utf32Char& theSymbol)
|
||||
{
|
||||
if (theSymbol == '\x0D' // CR (carriage return)
|
||||
|| theSymbol == '\a' // BEL (alarm)
|
||||
|| theSymbol == '\f' // FF (form feed) NP (new page)
|
||||
|| theSymbol == '\b' // BS (backspace)
|
||||
|| theSymbol == '\v') // VT (vertical tab)
|
||||
return Standard_True;
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT (Font_TextFormatter, Standard_Transient)
|
||||
|
||||
protected: //! @name class auxiliary methods
|
||||
|
||||
//! Move glyphs on the current line to correct position.
|
||||
Standard_EXPORT void newLine (const Standard_Integer theLastRect);
|
||||
Standard_EXPORT void newLine (const Standard_Integer theLastRect,
|
||||
const Standard_ShortReal theMaxLineWidth);
|
||||
|
||||
protected: //! @name configuration
|
||||
|
||||
Graphic3d_HorizontalTextAlignment myAlignX; //!< horizontal alignment style
|
||||
Graphic3d_VerticalTextAlignment myAlignY; //!< vertical alignment style
|
||||
Standard_Integer myTabSize; //!< horizontal tabulation width (number of space symbols)
|
||||
Standard_ShortReal myWrappingWidth; //!< text is wrapped by the width if it is defined (more 0)
|
||||
Standard_ShortReal myLastSymbolWidth; //!< width of the last symbol
|
||||
Standard_ShortReal myMaxSymbolWidth; //!< maximum symbol width of the formatter string
|
||||
|
||||
protected: //! @name input data
|
||||
|
||||
@@ -116,18 +275,16 @@ protected: //! @name input data
|
||||
myPen; //!< current pen position
|
||||
NCollection_Vector < NCollection_Vec2<Standard_ShortReal> >
|
||||
myCorners; //!< The top left corners of a formatted rectangles.
|
||||
Standard_Integer myRectsNb; //!< rectangles number
|
||||
NCollection_Vector<Standard_ShortReal>
|
||||
myNewLines; //!< position at LF
|
||||
Standard_ShortReal myLineSpacing; //!< line spacing (computed as maximum of all fonts involved in text formatting)
|
||||
Standard_ShortReal myAscender; //!<
|
||||
Standard_ShortReal myAscender; //!< line spacing for the first line
|
||||
bool myIsFormatted; //!< formatting state
|
||||
|
||||
protected: //! @name temporary variables for formatting routines
|
||||
|
||||
Standard_Integer myLinesNb; //!< overall (new)lines number (including splitting by width limit)
|
||||
Standard_Integer myRectLineStart; //!< id of first rectangle on the current line
|
||||
Standard_Integer myRectWordStart; //!< id of first rectangle in the current word
|
||||
Standard_Integer myNewLineNb;
|
||||
|
||||
Standard_ShortReal myPenCurrLine; //!< current baseline position
|
||||
@@ -135,6 +292,8 @@ protected: //! @name temporary variables for formatting routines
|
||||
Standard_ShortReal myBndWidth;
|
||||
NCollection_Vec2<Standard_ShortReal>
|
||||
myMoveVec; //!< local variable
|
||||
|
||||
friend Iterator;
|
||||
};
|
||||
|
||||
#endif // Font_TextFormatter_Header
|
||||
|
@@ -1,3 +1,5 @@
|
||||
Graphic3d.cxx
|
||||
Graphic3d.hxx
|
||||
Graphic3d_AlphaMode.hxx
|
||||
Graphic3d_ArrayFlags.hxx
|
||||
Graphic3d_ArrayOfPoints.hxx
|
||||
@@ -15,6 +17,8 @@ Graphic3d_Aspects.cxx
|
||||
Graphic3d_Aspects.hxx
|
||||
Graphic3d_AspectFillArea3d.cxx
|
||||
Graphic3d_AspectFillArea3d.hxx
|
||||
Graphic3d_AspectFillCapping.cxx
|
||||
Graphic3d_AspectFillCapping.hxx
|
||||
Graphic3d_AspectLine3d.cxx
|
||||
Graphic3d_AspectLine3d.hxx
|
||||
Graphic3d_AspectMarker3d.cxx
|
||||
@@ -110,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
@@ -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
@@ -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
|
110
src/Graphic3d/Graphic3d_AspectFillCapping.cxx
Normal file
@@ -0,0 +1,110 @@
|
||||
// Created on: 2017-04-14
|
||||
// Created by: Anton POLETAEV
|
||||
// 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 <Graphic3d_AspectFillCapping.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectFillCapping, Standard_Transient)
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_AspectFillCapping
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_AspectFillCapping::Graphic3d_AspectFillCapping()
|
||||
: myFlags (Flags_None),
|
||||
myHatchingState (0)
|
||||
{
|
||||
Graphic3d_MaterialAspect aMaterial;
|
||||
aMaterial.SetColor (Quantity_NOC_BLACK);
|
||||
aMaterial.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
|
||||
aMaterial.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
|
||||
aMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
|
||||
aMaterial.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
|
||||
aMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
|
||||
SetHatchStyle (Aspect_HS_HORIZONTAL);
|
||||
SetHatchMaterial (aMaterial);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetHatchStyle
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_AspectFillCapping::SetHatchStyle (const Aspect_HatchStyle theStyle)
|
||||
{
|
||||
myStippleHatch = new Graphic3d_HatchStyle (theStyle);
|
||||
myTextureHatch.Nullify();
|
||||
myHatchingState++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetHatchStyle
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_AspectFillCapping::SetHatchStyle (const Handle(Graphic3d_HatchStyle)& theStyle)
|
||||
{
|
||||
myStippleHatch = theStyle;
|
||||
myTextureHatch.Nullify();
|
||||
myHatchingState++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetHatchStyle
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_AspectFillCapping::SetHatchStyle (const Handle(Graphic3d_TextureMap)& theTexture)
|
||||
{
|
||||
myStippleHatch.Nullify();
|
||||
myTextureHatch = theTexture;
|
||||
myHatchingState++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetHatchMaterial
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_AspectFillCapping::SetHatchMaterial (const Graphic3d_MaterialAspect& theMaterial)
|
||||
{
|
||||
myHatchMaterial = theMaterial;
|
||||
myHatchingState++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetToDrawHatch
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_AspectFillCapping::SetToDrawHatch (const Standard_Boolean theToDraw)
|
||||
{
|
||||
setFlag (theToDraw, Flags_DrawHatching);
|
||||
myHatchingState++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetHatchZoomPeristent
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_AspectFillCapping::SetHatchZoomPeristent (const Standard_Boolean theToSet)
|
||||
{
|
||||
setFlag (theToSet, Flags_HatchZoomPersistent);
|
||||
myHatchingState++;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetHatchRotationPeristent
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_AspectFillCapping::SetHatchRotationPeristent (const Standard_Boolean theToSet)
|
||||
{
|
||||
setFlag (theToSet, Flags_HatchRotationPersistent);
|
||||
myHatchingState++;
|
||||
}
|
164
src/Graphic3d/Graphic3d_AspectFillCapping.hxx
Normal file
@@ -0,0 +1,164 @@
|
||||
// Created on: 2017-04-14
|
||||
// Created by: Anton POLETAEV
|
||||
// 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 _Graphic3d_AspectFillCapping_HeaderFile
|
||||
#define _Graphic3d_AspectFillCapping_HeaderFile
|
||||
|
||||
#include <Aspect_HatchStyle.hxx>
|
||||
#include <Graphic3d_Aspects.hxx>
|
||||
#include <Graphic3d_HatchStyle.hxx>
|
||||
#include <Graphic3d_MaterialAspect.hxx>
|
||||
#include <Graphic3d_ShaderProgram.hxx>
|
||||
#include <Graphic3d_TextureMap.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
//! Defines graphical attributes for drawing section planes on solids resulted from clipping (cutting) planes.
|
||||
class Graphic3d_AspectFillCapping : public Graphic3d_Aspects
|
||||
{
|
||||
public:
|
||||
|
||||
//! Default constructor.
|
||||
Standard_EXPORT Graphic3d_AspectFillCapping();
|
||||
|
||||
public:
|
||||
|
||||
//! Sets material for filling section created by clipping.
|
||||
void SetMaterial (const Graphic3d_MaterialAspect& theMaterial) { myMaterial = theMaterial; }
|
||||
|
||||
//! Returns material for filling section created by clipping.
|
||||
const Graphic3d_MaterialAspect& Material() const { return myMaterial; }
|
||||
|
||||
//! Sets flag indicating whether object's material (instead of defined by this aspect) should be used for filling section.
|
||||
void SetUseObjectMaterial (const Standard_Boolean theToUse) { setFlag (theToUse, Flags_UseObjectMaterial); }
|
||||
|
||||
//! Returns flag indicating whether object's material (instead of defined by this aspect) should be used for filling section.
|
||||
Standard_Boolean ToUseObjectMaterial() const { return (myFlags & Flags_UseObjectMaterial) != 0; }
|
||||
|
||||
//! Sets texture for filling section created by clipping.
|
||||
void SetTexture (const Handle(Graphic3d_TextureMap)& theTexture) { myTexture = theTexture; }
|
||||
|
||||
//! Returns texture for filling section created by clipping.
|
||||
const Handle(Graphic3d_TextureMap)& Texture() const { return myTexture; }
|
||||
|
||||
//! Sets flag indicating whether object's texture (instead of defined by this aspect) should be used for filling section.
|
||||
void SetUseObjectTexture (const Standard_Boolean theToUse) { setFlag (theToUse, Flags_UseObjectTexture); }
|
||||
|
||||
//! Returns flag indicating whether object's texture (instead of defined by this aspect) should be used for filling section.
|
||||
Standard_Boolean ToUseObjectTexture() const { return (myFlags & Flags_UseObjectTexture) != 0; }
|
||||
|
||||
//! Sets OpenGL/GLSL shader program.
|
||||
void SetShader (const Handle(Graphic3d_ShaderProgram)& theShader) { myShader = theShader; }
|
||||
|
||||
//! Returns OpenGL/GLSL shader program.
|
||||
const Handle(Graphic3d_ShaderProgram)& Shader() const { return myShader; }
|
||||
|
||||
//! Sets flag indicating whether object's shader (instead of defined by this aspect) should be used for filling section.
|
||||
void SetUseObjectShader (const Standard_Boolean theToUse) { setFlag (theToUse, Flags_UseObjectShader); }
|
||||
|
||||
//! Returns flag indicating whether object's shader (instead of defined by this aspect) should be used for filling section.
|
||||
Standard_Boolean ToUseObjectShader() const { return (myFlags & Flags_UseObjectShader) != 0; }
|
||||
|
||||
public:
|
||||
|
||||
//! Sets style of hatch defined by predefined stipple mask.
|
||||
Standard_EXPORT void SetHatchStyle (const Aspect_HatchStyle theStyle);
|
||||
|
||||
//! Sets style of hatch defined by custom stipple mask.
|
||||
Standard_EXPORT void SetHatchStyle (const Handle(Graphic3d_HatchStyle)& theStyle);
|
||||
|
||||
//! Sets style of hatch defined by texture map (decal texture with alpha channel should be used).
|
||||
Standard_EXPORT void SetHatchStyle (const Handle(Graphic3d_TextureMap)& theTexture);
|
||||
|
||||
//! Sets material style for hatch lines (texture).
|
||||
Standard_EXPORT void SetHatchMaterial (const Graphic3d_MaterialAspect& theMaterial);
|
||||
|
||||
//! Returns material style for hatch lines (texture).
|
||||
const Graphic3d_MaterialAspect& HatchMaterial() const { return myHatchMaterial; }
|
||||
|
||||
//! Sets boolean flag indicating whether the hatch layer should be drawn or not.
|
||||
Standard_EXPORT void SetToDrawHatch (const Standard_Boolean theToDraw);
|
||||
|
||||
//! Returns boolean flag indicating whether the hatch layer should be drawn or not.
|
||||
Standard_Boolean ToDrawHatch() const { return (myFlags & Flags_DrawHatching) != 0; }
|
||||
|
||||
//! Sets flag controlling behavior of hatch texture mapping on zooming.
|
||||
//! @param theToSet [in] if passed TRUE the texture will keep constant screen-scale independent of zooming.
|
||||
Standard_EXPORT void SetHatchZoomPeristent (const Standard_Boolean theToSet);
|
||||
|
||||
//! Returns value of flag controlling behavior of hatch texture mapping on zooming.
|
||||
Standard_Boolean IsHatchZoomPersistent() { return (myFlags & Flags_HatchZoomPersistent) != 0; }
|
||||
|
||||
//! Sets flag controlling behavior of hatch texture mapping on camera rotation around heading vector.
|
||||
Standard_EXPORT void SetHatchRotationPeristent (const Standard_Boolean theToSet);
|
||||
|
||||
//! Returns value of flag controlling behavior of hatch texture mapping on camera rotation around heading vector.
|
||||
Standard_Boolean IsHatchRotationPersistent() { return (myFlags & Flags_HatchRotationPersistent) != 0; }
|
||||
|
||||
//! Returns true if hatch is defined by texture.
|
||||
Standard_Boolean IsTextureHatch() const { return !myTextureHatch.IsNull(); }
|
||||
|
||||
//! Returns texture map defining the hatch.
|
||||
const Handle(Graphic3d_TextureMap)& TextureHatch() const { return myTextureHatch; }
|
||||
|
||||
//! Returns true if hatch is defined by stipple mask.
|
||||
Standard_Boolean IsStippleHatch() const { return !myStippleHatch.IsNull(); }
|
||||
|
||||
//! Returns the stipple mask.
|
||||
const Handle(Graphic3d_HatchStyle)& StippleHatch() const { return myStippleHatch; }
|
||||
|
||||
//! Returns modification counter for hatching state.
|
||||
Standard_Size HatchingState() const { return myHatchingState; }
|
||||
|
||||
private:
|
||||
|
||||
enum Flags
|
||||
{
|
||||
Flags_None = 0x00, //!< no flags
|
||||
Flags_UseObjectMaterial = 0x01, //!< use object material
|
||||
Flags_UseObjectTexture = 0x02, //!< use object texture
|
||||
Flags_UseObjectShader = 0x04, //!< use object GLSL program
|
||||
Flags_HatchZoomPersistent = 0x08, //!< zoom-persistent texturing
|
||||
Flags_HatchRotationPersistent = 0x10, //!< rotation-persistent texturing
|
||||
Flags_DrawHatching = 0x20, //!< draw hatching
|
||||
Flags_UseObjectProperties = //!< use entire fill area aspect from object
|
||||
Flags_UseObjectMaterial
|
||||
| Flags_UseObjectTexture
|
||||
| Flags_UseObjectShader
|
||||
};
|
||||
|
||||
void setFlag (const Standard_Boolean theToUse, const unsigned int theFlag)
|
||||
{
|
||||
myFlags = theToUse ? myFlags | theFlag : myFlags & ~theFlag;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Graphic3d_MaterialAspect myMaterial;
|
||||
Handle(Graphic3d_TextureMap) myTexture;
|
||||
Handle(Graphic3d_ShaderProgram) myShader;
|
||||
Handle(Graphic3d_HatchStyle) myStippleHatch;
|
||||
Handle(Graphic3d_TextureMap) myTextureHatch;
|
||||
Graphic3d_MaterialAspect myHatchMaterial;
|
||||
unsigned int myFlags;
|
||||
Standard_Size myHatchingState;
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectFillCapping, Graphic3d_Aspects)
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE (Graphic3d_AspectFillCapping, Graphic3d_Aspects)
|
||||
|
||||
#endif // _Graphic3d_AspectFillCapping_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;
|
||||
|
@@ -24,19 +24,6 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_ClipPlane,Standard_Transient)
|
||||
namespace
|
||||
{
|
||||
static volatile Standard_Integer THE_CLIP_PLANE_COUNTER = 0;
|
||||
|
||||
static Handle(Graphic3d_AspectFillArea3d) defaultAspect()
|
||||
{
|
||||
Graphic3d_MaterialAspect aMaterial (Graphic3d_NOM_DEFAULT);
|
||||
Handle(Graphic3d_AspectFillArea3d) anAspect = new Graphic3d_AspectFillArea3d();
|
||||
anAspect->SetDistinguishOff();
|
||||
anAspect->SetFrontMaterial (aMaterial);
|
||||
anAspect->SetHatchStyle (Aspect_HS_HORIZONTAL);
|
||||
anAspect->SetInteriorStyle (Aspect_IS_SOLID);
|
||||
anAspect->SetInteriorColor (Quantity_NOC_GRAY20);
|
||||
anAspect->SetSuppressBackFaces (false);
|
||||
return anAspect;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -44,19 +31,8 @@ namespace
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane()
|
||||
: myAspect (defaultAspect()),
|
||||
myPrevInChain(NULL),
|
||||
myPlane (0.0, 0.0, 1.0, 0.0),
|
||||
myEquation (0.0, 0.0, 1.0, 0.0),
|
||||
myEquationRev(0.0, 0.0,-1.0, 0.0),
|
||||
myChainLenFwd(1),
|
||||
myFlags (Graphic3d_CappingFlags_None),
|
||||
myEquationMod(0),
|
||||
myAspectMod (0),
|
||||
myIsOn (Standard_True),
|
||||
myIsCapping (Standard_False)
|
||||
{
|
||||
makeId();
|
||||
init();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -64,19 +40,8 @@ Graphic3d_ClipPlane::Graphic3d_ClipPlane()
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane (const Graphic3d_Vec4d& theEquation)
|
||||
: myAspect (defaultAspect()),
|
||||
myPrevInChain(NULL),
|
||||
myPlane (theEquation.x(), theEquation.y(), theEquation.z(), theEquation.w()),
|
||||
myEquation (theEquation),
|
||||
myEquationRev(0.0, 0.0,-1.0, 0.0),
|
||||
myChainLenFwd(1),
|
||||
myFlags (Graphic3d_CappingFlags_None),
|
||||
myEquationMod(0),
|
||||
myAspectMod (0),
|
||||
myIsOn (Standard_True),
|
||||
myIsCapping (Standard_False)
|
||||
{
|
||||
makeId();
|
||||
init (gp_Pln (theEquation.x(), theEquation.y(), theEquation.z(), theEquation.a()));
|
||||
updateInversedPlane();
|
||||
}
|
||||
|
||||
@@ -84,42 +49,27 @@ Graphic3d_ClipPlane::Graphic3d_ClipPlane (const Graphic3d_Vec4d& theEquation)
|
||||
// function : Graphic3d_ClipPlane
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane(const Graphic3d_ClipPlane& theOther)
|
||||
: Standard_Transient(theOther),
|
||||
myAspect (defaultAspect()),
|
||||
myPrevInChain(NULL),
|
||||
myPlane (theOther.myPlane),
|
||||
myEquation (theOther.myEquation),
|
||||
myEquationRev(theOther.myEquationRev),
|
||||
myChainLenFwd(1),
|
||||
myFlags (theOther.myFlags),
|
||||
myEquationMod(0),
|
||||
myAspectMod (0),
|
||||
myIsOn (theOther.myIsOn),
|
||||
myIsCapping (theOther.myIsCapping)
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane (const Graphic3d_ClipPlane& theOther)
|
||||
: Standard_Transient (theOther)
|
||||
{
|
||||
makeId();
|
||||
*myAspect = *theOther.CappingAspect();
|
||||
*mySectionStyle = *theOther.CappingSectionStyle();
|
||||
init (theOther.myPlane,
|
||||
theOther.myEquationRev,
|
||||
theOther.myIsOn,
|
||||
theOther.myIsCapping,
|
||||
theOther.ToOverrideCappingAspect(),
|
||||
theOther.CappingSectionStyle());
|
||||
updateInversedPlane();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_ClipPlane
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane(const gp_Pln& thePlane)
|
||||
: myAspect (defaultAspect()),
|
||||
myPrevInChain(NULL),
|
||||
myPlane (thePlane),
|
||||
myChainLenFwd(1),
|
||||
myFlags (Graphic3d_CappingFlags_None),
|
||||
myEquationMod(0),
|
||||
myAspectMod (0),
|
||||
myIsOn (Standard_True),
|
||||
myIsCapping (Standard_False)
|
||||
Graphic3d_ClipPlane::Graphic3d_ClipPlane (const gp_Pln& thePlane)
|
||||
{
|
||||
thePlane.Coefficients (myEquation[0], myEquation[1], myEquation[2], myEquation[3]);
|
||||
init (thePlane);
|
||||
updateInversedPlane();
|
||||
makeId();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -131,7 +81,7 @@ void Graphic3d_ClipPlane::SetEquation (const Graphic3d_Vec4d& theEquation)
|
||||
myPlane = gp_Pln (theEquation.x(), theEquation.y(), theEquation.z(), theEquation.w());
|
||||
myEquation = theEquation;
|
||||
updateInversedPlane();
|
||||
myEquationMod++;
|
||||
myOrientationDirty = Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -143,7 +93,7 @@ void Graphic3d_ClipPlane::SetEquation (const gp_Pln& thePlane)
|
||||
myPlane = thePlane;
|
||||
thePlane.Coefficients (myEquation[0], myEquation[1], myEquation[2], myEquation[3]);
|
||||
updateInversedPlane();
|
||||
myEquationMod++;
|
||||
myOrientationDirty = Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -178,133 +128,106 @@ Handle(Graphic3d_ClipPlane) Graphic3d_ClipPlane::Clone() const
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingColor
|
||||
// function : SetCappingSectionStyle
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingColor (const Quantity_Color& theColor)
|
||||
void Graphic3d_ClipPlane::SetCappingSectionStyle (const Handle(Graphic3d_AspectFillCapping)& theStyle)
|
||||
{
|
||||
myAspect->SetInteriorColor (theColor);
|
||||
myAspect->ChangeFrontMaterial().SetColor (theColor);
|
||||
++myAspectMod;
|
||||
mySectionStyle = theStyle;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingMaterial
|
||||
// function : OrientationMatrix
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingMaterial (const Graphic3d_MaterialAspect& theMat)
|
||||
const Graphic3d_Mat4& Graphic3d_ClipPlane::OrientationMatrix() const
|
||||
{
|
||||
myAspect->SetFrontMaterial (theMat);
|
||||
if (myAspect->FrontMaterial().MaterialType() != Graphic3d_MATERIAL_ASPECT)
|
||||
if (myOrientationDirty)
|
||||
{
|
||||
myAspect->SetInteriorColor (theMat.Color());
|
||||
}
|
||||
++myAspectMod;
|
||||
}
|
||||
const Standard_ShortReal aDirection[] = {
|
||||
static_cast<Standard_ShortReal> (myEquation[0]),
|
||||
static_cast<Standard_ShortReal> (myEquation[1]),
|
||||
static_cast<Standard_ShortReal> (myEquation[2])
|
||||
};
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingTexture
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingTexture (const Handle(Graphic3d_TextureMap)& theTexture)
|
||||
{
|
||||
if (!theTexture.IsNull())
|
||||
{
|
||||
myAspect->SetTextureMapOn();
|
||||
Handle(Graphic3d_TextureSet) aTextureSet = myAspect->TextureSet();
|
||||
if (aTextureSet.IsNull() || aTextureSet->Size() != 1)
|
||||
const Standard_ShortReal aTranslate[] = {
|
||||
static_cast<Standard_ShortReal> (myEquation[0] * -myEquation[3]),
|
||||
static_cast<Standard_ShortReal> (myEquation[1] * -myEquation[3]),
|
||||
static_cast<Standard_ShortReal> (myEquation[2] * -myEquation[3])
|
||||
};
|
||||
|
||||
Standard_ShortReal aSide1[] = { 0.0f, 0.0f, 0.0f };
|
||||
Standard_ShortReal aSide2[] = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
const Standard_ShortReal aMagintude = static_cast<Standard_ShortReal> (Sqrt (myEquation[0] * myEquation[0] + myEquation[2] * myEquation[2]));
|
||||
|
||||
if (aMagintude < ShortRealSmall())
|
||||
{
|
||||
aTextureSet = new Graphic3d_TextureSet (theTexture);
|
||||
aSide1[0] = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
aTextureSet->SetFirst (theTexture);
|
||||
aSide1[0] = aDirection[2] / aMagintude;
|
||||
aSide1[2] = -aDirection[0] / aMagintude;
|
||||
}
|
||||
myAspect->SetTextureSet (aTextureSet);
|
||||
|
||||
aSide2[0] = (-aSide1[1] * aDirection[2]) - (-aSide1[2] * aDirection[1]);
|
||||
aSide2[1] = (-aSide1[2] * aDirection[0]) - (-aSide1[0] * aDirection[2]);
|
||||
aSide2[2] = (-aSide1[0] * aDirection[1]) - (-aSide1[1] * aDirection[0]);
|
||||
|
||||
myOrientationMat.SetValue (0, 0, aSide1[0]);
|
||||
myOrientationMat.SetValue (1, 0, aSide1[1]);
|
||||
myOrientationMat.SetValue (2, 0, aSide1[2]);
|
||||
myOrientationMat.SetValue (3, 0, 0.0F);
|
||||
|
||||
myOrientationMat.SetValue (0, 1, aDirection[0]);
|
||||
myOrientationMat.SetValue (1, 1, aDirection[1]);
|
||||
myOrientationMat.SetValue (2, 1, aDirection[2]);
|
||||
myOrientationMat.SetValue (3, 1, 0.0F);
|
||||
|
||||
myOrientationMat.SetValue (0, 2, aSide2[0]);
|
||||
myOrientationMat.SetValue (1, 2, aSide2[1]);
|
||||
myOrientationMat.SetValue (2, 2, aSide2[2]);
|
||||
myOrientationMat.SetValue (3, 2, 0.0F);
|
||||
|
||||
myOrientationMat.SetValue (0, 3, aTranslate[0]);
|
||||
myOrientationMat.SetValue (1, 3, aTranslate[1]);
|
||||
myOrientationMat.SetValue (2, 3, aTranslate[2]);
|
||||
myOrientationMat.SetValue (3, 3, 1.0F);
|
||||
|
||||
myOrientationDirty = Standard_False;
|
||||
}
|
||||
else
|
||||
|
||||
return myOrientationMat;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::init (const gp_Pln& thePlane,
|
||||
const Graphic3d_Vec4d& theEquationRev,
|
||||
const Standard_Boolean theIsOn,
|
||||
const Standard_Boolean theIsCapping,
|
||||
const Standard_Boolean theOverrideStyle,
|
||||
const Handle(Graphic3d_AspectFillCapping)& theStyle)
|
||||
{
|
||||
if (myEntityUID.IsEmpty())
|
||||
{
|
||||
myAspect->SetTextureMapOff();
|
||||
myAspect->SetTextureSet (Handle(Graphic3d_TextureSet)());
|
||||
myEntityUID = TCollection_AsciiString ("Graphic3d_ClipPlane_") //DynamicType()->Name()
|
||||
+ TCollection_AsciiString (Standard_Atomic_Increment (&THE_CLIP_PLANE_COUNTER));
|
||||
}
|
||||
++myAspectMod;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingHatch
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingHatch (const Aspect_HatchStyle theStyle)
|
||||
{
|
||||
myAspect->SetHatchStyle (theStyle);
|
||||
++myAspectMod;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingCustomHatch
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingCustomHatch (const Handle(Graphic3d_HatchStyle)& theStyle)
|
||||
{
|
||||
myAspect->SetHatchStyle (theStyle);
|
||||
++myAspectMod;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingHatchOn
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingHatchOn()
|
||||
{
|
||||
myAspect->SetInteriorStyle (Aspect_IS_HATCH);
|
||||
++myAspectMod;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingHatchOff
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingHatchOff()
|
||||
{
|
||||
myAspect->SetInteriorStyle (Aspect_IS_SOLID);
|
||||
++myAspectMod;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetCappingAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetCappingAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect)
|
||||
{
|
||||
myAspect = theAspect;
|
||||
++myAspectMod;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : setCappingFlag
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::setCappingFlag (bool theToUse, int theFlag)
|
||||
{
|
||||
if (theToUse)
|
||||
{
|
||||
myFlags |= theFlag;
|
||||
}
|
||||
else
|
||||
{
|
||||
myFlags &= ~(theFlag);
|
||||
}
|
||||
++myAspectMod;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : makeId
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::makeId()
|
||||
{
|
||||
myId = TCollection_AsciiString ("Graphic3d_ClipPlane_") //DynamicType()->Name()
|
||||
+ TCollection_AsciiString (Standard_Atomic_Increment (&THE_CLIP_PLANE_COUNTER));
|
||||
myPrevInChain = NULL;
|
||||
myEquationRev = theEquationRev;
|
||||
myChainLenFwd = 1;
|
||||
myPlane = thePlane;
|
||||
myPlane.Coefficients (myEquation[0], myEquation[1], myEquation[2], myEquation[3]);
|
||||
myIsOn = theIsOn;
|
||||
myIsCapping = theIsCapping;
|
||||
myOverrideObjectStyle = theOverrideStyle;
|
||||
mySectionStyle = theStyle.IsNull() ? new Graphic3d_AspectFillCapping() : theStyle;
|
||||
myOrientationDirty = Standard_True;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -326,7 +249,7 @@ void Graphic3d_ClipPlane::updateChainLen()
|
||||
// =======================================================================
|
||||
void Graphic3d_ClipPlane::SetChainNextPlane (const Handle(Graphic3d_ClipPlane)& thePlane)
|
||||
{
|
||||
++myEquationMod;
|
||||
myOrientationDirty = Standard_True;
|
||||
if (!myNextInChain.IsNull())
|
||||
{
|
||||
myNextInChain->myPrevInChain = NULL;
|
||||
|
@@ -19,9 +19,12 @@
|
||||
#include <Aspect_HatchStyle.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectFillCapping.hxx>
|
||||
#include <Graphic3d_BndBox3d.hxx>
|
||||
#include <Graphic3d_CappingFlags.hxx>
|
||||
#include <Graphic3d_Mat4.hxx>
|
||||
#include <Graphic3d_TextureMap.hxx>
|
||||
#include <NCollection_Handle.hxx>
|
||||
#include <NCollection_Vec4.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_TypeDef.hxx>
|
||||
@@ -166,50 +169,6 @@ public:
|
||||
|
||||
public: // @name user-defined graphical attributes
|
||||
|
||||
//! Return color for rendering capping surface.
|
||||
Quantity_Color CappingColor() const { return myAspect->FrontMaterial().MaterialType() == Graphic3d_MATERIAL_ASPECT ? myAspect->FrontMaterial().Color() : myAspect->InteriorColor(); }
|
||||
|
||||
//! Set color for rendering capping surface.
|
||||
Standard_EXPORT void SetCappingColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Set material for rendering capping surface.
|
||||
//! @param theMat [in] the material.
|
||||
Standard_EXPORT void SetCappingMaterial (const Graphic3d_MaterialAspect& theMat);
|
||||
|
||||
//! @return capping material.
|
||||
const Graphic3d_MaterialAspect& CappingMaterial() const { return myAspect->FrontMaterial(); }
|
||||
|
||||
//! Set texture to be applied on capping surface.
|
||||
//! @param theTexture [in] the texture.
|
||||
Standard_EXPORT void SetCappingTexture (const Handle(Graphic3d_TextureMap)& theTexture);
|
||||
|
||||
//! @return capping texture map.
|
||||
Handle(Graphic3d_TextureMap) CappingTexture() const { return !myAspect->TextureSet().IsNull() && !myAspect->TextureSet()->IsEmpty()
|
||||
? myAspect->TextureSet()->First()
|
||||
: Handle(Graphic3d_TextureMap)(); }
|
||||
|
||||
//! Set hatch style (stipple) and turn hatching on.
|
||||
//! @param theStyle [in] the hatch style.
|
||||
Standard_EXPORT void SetCappingHatch (const Aspect_HatchStyle theStyle);
|
||||
|
||||
//! @return hatching style.
|
||||
Aspect_HatchStyle CappingHatch() const { return (Aspect_HatchStyle)myAspect->HatchStyle()->HatchType(); }
|
||||
|
||||
//! Set custom hatch style (stipple) and turn hatching on.
|
||||
//! @param theStyle [in] the hatch pattern.
|
||||
Standard_EXPORT void SetCappingCustomHatch (const Handle(Graphic3d_HatchStyle)& theStyle);
|
||||
|
||||
//! @return hatching style.
|
||||
const Handle(Graphic3d_HatchStyle)& CappingCustomHatch() const { return myAspect->HatchStyle(); }
|
||||
|
||||
//! Turn on hatching.
|
||||
Standard_EXPORT void SetCappingHatchOn();
|
||||
|
||||
//! Turn off hatching.
|
||||
Standard_EXPORT void SetCappingHatchOff();
|
||||
|
||||
//! @return True if hatching mask is turned on.
|
||||
Standard_Boolean IsHatchOn() const { return myAspect->InteriorStyle() == Aspect_IS_HATCH; }
|
||||
|
||||
//! This ID is used for managing associated resources in graphical driver.
|
||||
//! The clip plane can be assigned within a range of IO which can be
|
||||
@@ -220,41 +179,18 @@ public: // @name user-defined graphical attributes
|
||||
//! @return clip plane resource identifier string.
|
||||
const TCollection_AsciiString& GetId() const
|
||||
{
|
||||
return myId;
|
||||
return myEntityUID;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Return capping aspect.
|
||||
//! Returns style used for drawing capping section.
|
||||
//! @return capping surface rendering aspect.
|
||||
const Handle(Graphic3d_AspectFillArea3d)& CappingAspect() const { return myAspect; }
|
||||
const Handle(Graphic3d_AspectFillCapping)& CappingSectionStyle() const { return mySectionStyle; }
|
||||
|
||||
//! Assign capping aspect.
|
||||
Standard_EXPORT void SetCappingAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect);
|
||||
//! Sets clipping section filling aspect.
|
||||
Standard_EXPORT void SetCappingSectionStyle (const Handle(Graphic3d_AspectFillCapping)& theStyle);
|
||||
|
||||
//! Flag indicating whether material for capping plane should be taken from object.
|
||||
//! Default value: FALSE (use dedicated capping plane material).
|
||||
bool ToUseObjectMaterial() const { return (myFlags & Graphic3d_CappingFlags_ObjectMaterial) != 0; }
|
||||
|
||||
//! Set flag for controlling the source of capping plane material.
|
||||
void SetUseObjectMaterial (bool theToUse) { setCappingFlag (theToUse, Graphic3d_CappingFlags_ObjectMaterial); }
|
||||
|
||||
//! Flag indicating whether texture for capping plane should be taken from object.
|
||||
//! Default value: FALSE.
|
||||
bool ToUseObjectTexture() const { return (myFlags & Graphic3d_CappingFlags_ObjectTexture) != 0; }
|
||||
|
||||
//! Set flag for controlling the source of capping plane texture.
|
||||
void SetUseObjectTexture (bool theToUse) { setCappingFlag (theToUse, Graphic3d_CappingFlags_ObjectTexture); }
|
||||
|
||||
//! Flag indicating whether shader program for capping plane should be taken from object.
|
||||
//! Default value: FALSE.
|
||||
bool ToUseObjectShader() const { return (myFlags & Graphic3d_CappingFlags_ObjectShader) != 0; }
|
||||
|
||||
//! Set flag for controlling the source of capping plane shader program.
|
||||
void SetUseObjectShader(bool theToUse) { setCappingFlag (theToUse, Graphic3d_CappingFlags_ObjectShader); }
|
||||
|
||||
//! Return true if some fill area aspect properties should be taken from object.
|
||||
bool ToUseObjectProperties() const { return myFlags != Graphic3d_CappingFlags_None; }
|
||||
|
||||
public:
|
||||
|
||||
@@ -390,14 +326,25 @@ public: // @name modification counters
|
||||
{
|
||||
return myAspectMod;
|
||||
}
|
||||
//! Flag indicating whether section style of the plane should overrides similar property of object presentation.
|
||||
//! Default value: FALSE (use dedicated presentation aspect style).
|
||||
bool ToOverrideCappingAspect() const { return myOverrideObjectStyle; }
|
||||
|
||||
//! Sets flag for controlling the preference of using section style between clip plane and object.
|
||||
void SetToOverrideCappingAspect (const bool theToOverride) { myOverrideObjectStyle = theToOverride; }
|
||||
|
||||
//! Returns plane's orientation matrix.
|
||||
Standard_EXPORT const Graphic3d_Mat4& OrientationMatrix() const;
|
||||
|
||||
private:
|
||||
|
||||
//! Generate unique object id for OpenGL graphic resource manager.
|
||||
void makeId();
|
||||
|
||||
//! Set capping flag.
|
||||
Standard_EXPORT void setCappingFlag (bool theToUse, int theFlag);
|
||||
//! Initializes plane and makes unique identifier (UID) to differentiate clipping plane entities.
|
||||
void init (const gp_Pln& thePlane = gp_Pln(),
|
||||
const Graphic3d_Vec4d& theEquationRev = Graphic3d_Vec4d(0.0, 0.0,-1.0, 0.0),
|
||||
const Standard_Boolean theIsOn = Standard_True,
|
||||
const Standard_Boolean theIsCapping = Standard_False,
|
||||
const Standard_Boolean theOverrideStyle = Standard_False,
|
||||
const Handle(Graphic3d_AspectFillCapping)& theStyle = Handle(Graphic3d_AspectFillCapping)());
|
||||
|
||||
//! Update chain length in backward direction.
|
||||
void updateChainLen();
|
||||
@@ -412,10 +359,10 @@ private:
|
||||
|
||||
private:
|
||||
|
||||
Handle(Graphic3d_AspectFillArea3d) myAspect; //!< fill area aspect
|
||||
Handle(Graphic3d_AspectFillCapping) mySectionStyle; //!< Style set for drawing capped solid section.
|
||||
Handle(Graphic3d_ClipPlane) myNextInChain; //!< next plane in a chain of planes defining logical AND operation
|
||||
Graphic3d_ClipPlane* myPrevInChain; //!< previous plane in a chain of planes defining logical AND operation
|
||||
TCollection_AsciiString myId; //!< resource id
|
||||
TCollection_AsciiString myEntityUID; //!< Unique identifier for the plane
|
||||
gp_Pln myPlane; //!< plane definition
|
||||
Graphic3d_Vec4d myEquation; //!< plane equation vector
|
||||
Graphic3d_Vec4d myEquationRev; //!< reversed plane equation
|
||||
@@ -425,6 +372,9 @@ private:
|
||||
unsigned int myAspectMod; //!< modification counter of aspect
|
||||
Standard_Boolean myIsOn; //!< state of the clipping plane
|
||||
Standard_Boolean myIsCapping; //!< state of graphic driver capping
|
||||
Standard_Boolean myOverrideObjectStyle; //!< Flag forcing to use plane's section style rather than section style defined for object
|
||||
mutable Standard_Boolean myOrientationDirty; //!< Boolean flag indicating whether orientation matrix is dirty or not.
|
||||
mutable Graphic3d_Mat4 myOrientationMat; //!< Plane orientation matrix (for visualization purposes).
|
||||
|
||||
};
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@
|
||||
|
||||
class Graphic3d_Structure;
|
||||
class Graphic3d_ArrayOfPrimitives;
|
||||
class Graphic3d_AspectFillCapping;
|
||||
class Graphic3d_Text;
|
||||
|
||||
//! This class allows the definition of groups
|
||||
@@ -105,6 +106,9 @@ public:
|
||||
//! Modifies the current context of the group to give another aspect for all the primitives created after this call in the group.
|
||||
virtual void SetPrimitivesAspect (const Handle(Graphic3d_Aspects)& theAspect) = 0;
|
||||
|
||||
//! Returns style of filling clipping sections on closed shell primitives.
|
||||
virtual Handle(Graphic3d_AspectFillCapping) FillCappingAspect() const = 0;
|
||||
|
||||
//! Update presentation aspects after their modification.
|
||||
virtual void SynchronizeAspects() = 0;
|
||||
|
||||
@@ -276,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>.
|
||||
|
@@ -21,13 +21,15 @@
|
||||
//! - ASPECT_LINE: aspect for line primitives;
|
||||
//! - ASPECT_TEXT: aspect for text primitives;
|
||||
//! - ASPECT_MARKER: aspect for marker primitives;
|
||||
//! - ASPECT_FILL_AREA: aspect for face primitives.
|
||||
//! - ASPECT_FILL_AREA: aspect for face primitives;
|
||||
//! - Graphic3d_ASPECT_FILL_CAPPING: aspect for filling clipping sections.
|
||||
enum Graphic3d_GroupAspect
|
||||
{
|
||||
Graphic3d_ASPECT_LINE,
|
||||
Graphic3d_ASPECT_TEXT,
|
||||
Graphic3d_ASPECT_MARKER,
|
||||
Graphic3d_ASPECT_FILL_AREA
|
||||
Graphic3d_ASPECT_FILL_AREA,
|
||||
Graphic3d_ASPECT_FILL_CAPPING
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_GroupAspect_HeaderFile
|
||||
|
@@ -25,14 +25,14 @@ namespace
|
||||
{
|
||||
const char* StringName;
|
||||
Graphic3d_BSDF BSDF;
|
||||
Quantity_Color Colors[Graphic3d_TypeOfReflection_NB];
|
||||
Quantity_Color Colors [Graphic3d_TypeOfReflection_NB];
|
||||
Standard_ShortReal ColorCoef[Graphic3d_TypeOfReflection_NB];
|
||||
Standard_ShortReal TransparencyCoef;
|
||||
Standard_ShortReal RefractionIndex;
|
||||
Standard_ShortReal Shininess;
|
||||
Standard_ShortReal AmbientCoef; //!< coefficient for Graphic3d_MaterialAspect::SetColor()
|
||||
Standard_ShortReal DiffuseCoef; //!< coefficient for Graphic3d_MaterialAspect::SetColor()
|
||||
Graphic3d_TypeOfMaterial MaterialType;
|
||||
Graphic3d_NameOfMaterial MaterialName;
|
||||
Standard_Boolean ReflActivity[Graphic3d_TypeOfReflection_NB];
|
||||
|
||||
RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStringName);
|
||||
|
||||
@@ -80,59 +80,62 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
|
||||
TransparencyCoef(0.0f),
|
||||
RefractionIndex (1.0f),
|
||||
Shininess (0.039f),
|
||||
AmbientCoef (0.25f),
|
||||
DiffuseCoef (1.0f),
|
||||
MaterialType (Graphic3d_MATERIAL_ASPECT),
|
||||
MaterialName (theName)
|
||||
{
|
||||
ReflActivity[Graphic3d_TOR_AMBIENT] = Standard_True;
|
||||
ReflActivity[Graphic3d_TOR_DIFFUSE] = Standard_True;
|
||||
ReflActivity[Graphic3d_TOR_SPECULAR] = Standard_True;
|
||||
ReflActivity[Graphic3d_TOR_EMISSION] = Standard_False;
|
||||
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.3f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.65f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.0f;
|
||||
ColorCoef[Graphic3d_TOR_EMISSION] = 0.0f;
|
||||
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.2f, 0.2f, 0.2f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.2f, 0.2f, 0.2f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (1.0f, 1.0f, 1.0f));
|
||||
switch (theName)
|
||||
{
|
||||
case Graphic3d_NOM_PLASTIC:
|
||||
MaterialType = Graphic3d_MATERIAL_ASPECT;
|
||||
Shininess = 0.0078125f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.50f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.24f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.06f;
|
||||
|
||||
Shininess = 0.0078125f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.50f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.24f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.06f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
|
||||
BSDF.Kd = Graphic3d_Vec3 (0.2f);
|
||||
BSDF.Kd = static_cast<Graphic3d_Vec3> (Colors[Graphic3d_TOR_DIFFUSE]);
|
||||
BSDF.Ks = Graphic3d_Vec4 (0.00784314f, 0.00784314f, 0.00784314f, 0.25f);
|
||||
BSDF.Normalize();
|
||||
break;
|
||||
case Graphic3d_NOM_SHINY_PLASTIC:
|
||||
MaterialType = Graphic3d_MATERIAL_ASPECT;
|
||||
Shininess = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.44f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.50f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
|
||||
|
||||
Shininess = 1.00f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.44f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.50f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (1.0f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
|
||||
BSDF.Kd = Graphic3d_Vec3 (0.2f);
|
||||
BSDF.Kd = static_cast<Graphic3d_Vec3> (Colors[Graphic3d_TOR_DIFFUSE]);
|
||||
BSDF.Ks = Graphic3d_Vec4 (0.145f, 0.145f, 0.145f, 0.17f);
|
||||
BSDF.Normalize();
|
||||
break;
|
||||
case Graphic3d_NOM_SATIN:
|
||||
MaterialType = Graphic3d_MATERIAL_ASPECT;
|
||||
|
||||
Shininess = 0.09375f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.33f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.40f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.44f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
Shininess = 0.09375f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.33f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.40f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.44f;
|
||||
|
||||
BSDF.Kd = Graphic3d_Vec3 (0.2f);
|
||||
BSDF.Ks = Graphic3d_Vec4 (0.6f);
|
||||
|
||||
break;
|
||||
case Graphic3d_NOM_NEON_GNC:
|
||||
MaterialType = Graphic3d_MATERIAL_ASPECT;
|
||||
|
||||
Shininess = 0.05f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (1.0f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.62f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (1.0f));
|
||||
Shininess = 0.05f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.62f;
|
||||
ColorCoef[Graphic3d_TOR_EMISSION] = 1.00f;
|
||||
ReflActivity[Graphic3d_TOR_AMBIENT] = Standard_False;
|
||||
ReflActivity[Graphic3d_TOR_EMISSION] = Standard_True;
|
||||
|
||||
BSDF.Kd = Graphic3d_Vec3 (0.0f);
|
||||
BSDF.Ks = Graphic3d_Vec4 (0.5f, 0.5f, 0.5f, 0.f);
|
||||
@@ -140,160 +143,199 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
|
||||
BSDF.FresnelBase = Graphic3d_Fresnel::CreateDielectric (1.5f);
|
||||
break;
|
||||
case Graphic3d_NOM_METALIZED:
|
||||
MaterialType = Graphic3d_MATERIAL_ASPECT;
|
||||
|
||||
Shininess = 0.13f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.47f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.45f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
|
||||
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
|
||||
Graphic3d_Fresnel::CreateSchlick (Graphic3d_Vec3 (0.2f)), 0.045f);
|
||||
Shininess = 0.13f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.90f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.47f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.45f;
|
||||
ReflActivity[Graphic3d_TOR_AMBIENT] = Standard_False;
|
||||
{
|
||||
const Graphic3d_Vec3 aColor = (Graphic3d_Vec3 )Colors[Graphic3d_TOR_DIFFUSE];
|
||||
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
|
||||
Graphic3d_Fresnel::CreateSchlick (aColor), 0.045f);
|
||||
}
|
||||
break;
|
||||
// Ascending Compatibility physical materials. The same definition is taken as in the next constructor.
|
||||
case Graphic3d_NOM_BRASS:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
Shininess = 0.65f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
|
||||
|
||||
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
|
||||
Graphic3d_Fresnel::CreateSchlick (Graphic3d_Vec3 (0.58f, 0.42f, 0.20f)), 0.045f);
|
||||
|
||||
Shininess = 0.65f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.329f, 0.224f, 0.027f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.780f, 0.569f, 0.114f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.992f, 0.941f, 0.808f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
break;
|
||||
case Graphic3d_NOM_BRONZE:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
Shininess = 0.65f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
|
||||
|
||||
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
|
||||
Graphic3d_Fresnel::CreateSchlick (Graphic3d_Vec3 (0.65f, 0.35f, 0.15f)), 0.045f);
|
||||
|
||||
Shininess = 0.65f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.213f, 0.128f, 0.054f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.714f, 0.428f, 0.181f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.590f, 0.408f, 0.250f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
break;
|
||||
case Graphic3d_NOM_COPPER:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
Shininess = 0.65f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
|
||||
|
||||
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
|
||||
Graphic3d_Fresnel::CreateSchlick (Graphic3d_Vec3 (0.955008f, 0.637427f, 0.538163f)), 0.045f);
|
||||
|
||||
Shininess = 0.65f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.191f, 0.074f, 0.023f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.604f, 0.270f, 0.083f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.950f, 0.640f, 0.540f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
break;
|
||||
case Graphic3d_NOM_GOLD:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
Shininess = 0.80f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
|
||||
|
||||
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
|
||||
Graphic3d_Fresnel::CreateSchlick (Graphic3d_Vec3 (1.000000f, 0.765557f, 0.336057f)), 0.045f);
|
||||
|
||||
Shininess = 0.80f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.300f, 0.230f, 0.095f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.752f, 0.580f, 0.100f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (1.000f, 0.710f, 0.290f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
break;
|
||||
case Graphic3d_NOM_PEWTER:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
Shininess = 0.50f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
|
||||
|
||||
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
|
||||
Graphic3d_Fresnel::CreateConductor (1.8800f, 3.4900f), 0.045f);
|
||||
|
||||
Shininess = 0.50f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.106f, 0.059f, 0.114f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.427f, 0.471f, 0.541f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.333f, 0.333f, 0.522f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
break;
|
||||
case Graphic3d_NOM_PLASTER:
|
||||
MaterialType = Graphic3d_MATERIAL_ASPECT;
|
||||
Shininess = 0.01f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.26f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.75f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.05f;
|
||||
|
||||
Shininess = 0.01f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.26f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.75f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.05f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.192f, 0.192f, 0.192f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.508f, 0.508f, 0.508f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.508f, 0.508f, 0.508f));
|
||||
|
||||
BSDF.Kd = Graphic3d_Vec3 (0.482353f, 0.482353f, 0.482353f);
|
||||
|
||||
break;
|
||||
case Graphic3d_NOM_SILVER:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
Shininess = 0.75f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
|
||||
|
||||
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
|
||||
Graphic3d_Fresnel::CreateSchlick (Graphic3d_Vec3 (0.971519f, 0.959915f, 0.915324f)), 0.045f);
|
||||
|
||||
Shininess = 0.75f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.275f, 0.275f, 0.250f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.630f, 0.630f, 0.630f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.950f, 0.930f, 0.880f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
break;
|
||||
case Graphic3d_NOM_STEEL:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
Shininess = 0.90f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
|
||||
|
||||
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
|
||||
Graphic3d_Fresnel::CreateConductor (Graphic3d_Vec3 (2.90f, 2.80f, 2.53f), Graphic3d_Vec3 (3.08f, 2.90f, 2.74f)), 0.045f);
|
||||
|
||||
Shininess = 0.90f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.150f, 0.150f, 0.180f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.500f, 0.510f, 0.520f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.560f, 0.570f, 0.580f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
break;
|
||||
case Graphic3d_NOM_STONE:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
// special case for SetColor()
|
||||
AmbientCoef = 0.19f * 0.25f;
|
||||
DiffuseCoef = 0.75f;
|
||||
Shininess = 0.17f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 0.19f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 0.75f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.08f;
|
||||
|
||||
Shininess = 0.17f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (1.00f, 0.8f, 0.62f) * 0.19f);
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (1.00f, 0.8f, 0.62f) * 0.75f);
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.98f, 1.0f, 0.60f) * 0.08f);
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (1.00f, 0.8f, 0.62f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (1.00f, 0.8f, 0.62f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.98f, 1.0f, 0.60f));
|
||||
|
||||
BSDF.Kd = Graphic3d_Vec3 (0.243137f, 0.243137f, 0.243137f);
|
||||
BSDF.Ks = Graphic3d_Vec4 (0.00392157f, 0.00392157f, 0.00392157f, 0.5f);
|
||||
|
||||
break;
|
||||
// Ascending Compatibility of physical materials. Takes the same definition as in the next constructor. New materials
|
||||
case Graphic3d_NOM_CHROME:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
Shininess = 0.90f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
|
||||
|
||||
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
|
||||
Graphic3d_Fresnel::CreateSchlick (Graphic3d_Vec3 (0.549585f, 0.556114f, 0.554256f)), 0.045f);
|
||||
|
||||
Shininess = 0.90f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.200f, 0.200f, 0.225f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.550f, 0.550f, 0.550f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.975f, 0.975f, 0.975f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
break;
|
||||
case Graphic3d_NOM_ALUMINIUM:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
Shininess = 0.75f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
|
||||
|
||||
BSDF = Graphic3d_BSDF::CreateMetallic (Graphic3d_Vec3 (0.985f, 0.985f, 0.985f),
|
||||
Graphic3d_Fresnel::CreateSchlick (Graphic3d_Vec3 (0.913183f, 0.921494f, 0.924524f)), 0.045f);
|
||||
|
||||
Shininess = 0.75f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.300f, 0.300f, 0.300f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.600f, 0.600f, 0.600f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.910f, 0.920f, 0.920f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
break;
|
||||
case Graphic3d_NOM_NEON_PHC:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
Shininess = 0.05f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.62f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f, 0.90f, 0.414f));
|
||||
Shininess = 0.05f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 0.62f;
|
||||
ColorCoef[Graphic3d_TOR_EMISSION] = 0.90f;
|
||||
ReflActivity[Graphic3d_TOR_AMBIENT] = Standard_False;
|
||||
ReflActivity[Graphic3d_TOR_DIFFUSE] = Standard_False;
|
||||
ReflActivity[Graphic3d_TOR_EMISSION] = Standard_True;
|
||||
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (1.0f, 1.0f, 1.0f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (1.0f, 1.0f, 1.0f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (1.0f, 1.0f, 1.0f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f, 1.0f, 0.46f));
|
||||
|
||||
BSDF.Kd = Graphic3d_Vec3 (0.0f);
|
||||
BSDF.Ks = Graphic3d_Vec4 (0.5f, 0.5f, 0.5f, 0.f);
|
||||
@@ -303,11 +345,14 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
|
||||
case Graphic3d_NOM_OBSIDIAN:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
Shininess = 0.3f;
|
||||
Shininess = 0.3f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.0f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.0f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.0f;
|
||||
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.054f, 0.050f, 0.066f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.183f, 0.170f, 0.225f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.333f, 0.329f, 0.346f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
|
||||
BSDF.Kd = Graphic3d_Vec3 (0.023f, 0.f, 0.023f);
|
||||
BSDF.Ks = Graphic3d_Vec4 (0.0156863f, 0.0156863f, 0.0156863f, 0.1f);
|
||||
@@ -315,11 +360,14 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
|
||||
case Graphic3d_NOM_JADE:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
Shininess = 0.10f;
|
||||
Shininess = 0.10f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
|
||||
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.135f, 0.223f, 0.158f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.540f, 0.890f, 0.630f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.316f, 0.316f, 0.316f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
|
||||
BSDF.FresnelBase = Graphic3d_Fresnel::CreateDielectric (1.5f);
|
||||
BSDF.Kd = Graphic3d_Vec3 (0.208658f, 0.415686f, 0.218401f);
|
||||
@@ -328,11 +376,14 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
|
||||
case Graphic3d_NOM_CHARCOAL:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
Shininess = 0.01f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.050f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.150f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
Shininess = 0.01f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
|
||||
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.050f, 0.050f, 0.050f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.150f, 0.150f, 0.150f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.000f, 0.000f, 0.000f));
|
||||
|
||||
BSDF.Kd = Graphic3d_Vec3 (0.02f, 0.02f, 0.02f);
|
||||
BSDF.Ks = Graphic3d_Vec4 (0.1f, 0.1f, 0.1f, 0.3f);
|
||||
@@ -340,6 +391,10 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
|
||||
case Graphic3d_NOM_WATER:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
Shininess = 0.90f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
|
||||
RefractionIndex = 1.33f;
|
||||
BSDF = Graphic3d_BSDF::CreateGlass (Graphic3d_Vec3 (1.f),
|
||||
Graphic3d_Vec3 (0.7f, 0.75f, 0.85f),
|
||||
@@ -347,15 +402,17 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
|
||||
RefractionIndex);
|
||||
TransparencyCoef = 0.80f;
|
||||
|
||||
Shininess = 0.90f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.450f, 0.450f, 0.475f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.050f, 0.050f, 0.075f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.380f, 0.380f, 0.380f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
break;
|
||||
case Graphic3d_NOM_GLASS:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
Shininess = 0.50f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
|
||||
RefractionIndex = 1.62f;
|
||||
BSDF = Graphic3d_BSDF::CreateGlass (Graphic3d_Vec3 (1.f),
|
||||
Graphic3d_Vec3 (0.75f, 0.95f, 0.9f),
|
||||
@@ -363,15 +420,17 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
|
||||
RefractionIndex);
|
||||
TransparencyCoef = 0.80f;
|
||||
|
||||
Shininess = 0.50f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.550f, 0.575f, 0.575f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.050f, 0.075f, 0.075f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.920f, 0.920f, 0.920f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
break;
|
||||
case Graphic3d_NOM_DIAMOND:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
Shininess = 0.90f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
|
||||
RefractionIndex = 2.42f;
|
||||
BSDF = Graphic3d_BSDF::CreateGlass (Graphic3d_Vec3 (1.f),
|
||||
Graphic3d_Vec3 (0.95f, 0.95f, 0.95f),
|
||||
@@ -379,16 +438,18 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
|
||||
RefractionIndex);
|
||||
TransparencyCoef = 0.80f;
|
||||
|
||||
Shininess = 0.90f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.550f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.100f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.970f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.550f, 0.550f, 0.550f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.100f, 0.100f, 0.100f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.970f, 0.970f, 0.970f));
|
||||
break;
|
||||
|
||||
case Graphic3d_NOM_TRANSPARENT:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
|
||||
Shininess = 0.90f;
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
|
||||
RefractionIndex = 1.0f;
|
||||
|
||||
BSDF.Kd = Graphic3d_Vec3 (0.1f);
|
||||
@@ -396,26 +457,22 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
|
||||
BSDF.FresnelBase = Graphic3d_Fresnel::CreateConstant (0.0f);
|
||||
TransparencyCoef = 0.80f;
|
||||
|
||||
Shininess = 0.90f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.550f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.100f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.970f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.550f, 0.550f, 0.550f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.100f, 0.100f, 0.100f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.970f, 0.970f, 0.970f));
|
||||
break;
|
||||
case Graphic3d_NOM_UserDefined:
|
||||
MaterialType = Graphic3d_MATERIAL_PHYSIC;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.1f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.8f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.2f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
ColorCoef[Graphic3d_TOR_AMBIENT] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_DIFFUSE] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_SPECULAR] = 1.00f;
|
||||
ColorCoef[Graphic3d_TOR_EMISSION] = 1.00f;
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.1f, 0.1f, 0.1f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.8f, 0.8f, 0.8f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.2f, 0.2f, 0.2f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f, 0.0f, 0.0f));
|
||||
break;
|
||||
case Graphic3d_NOM_DEFAULT:
|
||||
MaterialType = Graphic3d_MATERIAL_ASPECT;
|
||||
|
||||
Colors[Graphic3d_TOR_AMBIENT] = Quantity_Color (Graphic3d_Vec3 (0.30f));
|
||||
Colors[Graphic3d_TOR_DIFFUSE] = Quantity_Color (Graphic3d_Vec3 (0.65f));
|
||||
Colors[Graphic3d_TOR_SPECULAR] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
Colors[Graphic3d_TOR_EMISSION] = Quantity_Color (Graphic3d_Vec3 (0.0f));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -453,12 +510,20 @@ void Graphic3d_MaterialAspect::init (const Graphic3d_NameOfMaterial theName)
|
||||
myColors[Graphic3d_TOR_DIFFUSE] = aMat.Colors[Graphic3d_TOR_DIFFUSE];
|
||||
myColors[Graphic3d_TOR_SPECULAR] = aMat.Colors[Graphic3d_TOR_SPECULAR];
|
||||
myColors[Graphic3d_TOR_EMISSION] = aMat.Colors[Graphic3d_TOR_EMISSION];
|
||||
myColorCoef[Graphic3d_TOR_AMBIENT] = aMat.ColorCoef[Graphic3d_TOR_AMBIENT];
|
||||
myColorCoef[Graphic3d_TOR_DIFFUSE] = aMat.ColorCoef[Graphic3d_TOR_DIFFUSE];
|
||||
myColorCoef[Graphic3d_TOR_SPECULAR] = aMat.ColorCoef[Graphic3d_TOR_SPECULAR];
|
||||
myColorCoef[Graphic3d_TOR_EMISSION] = aMat.ColorCoef[Graphic3d_TOR_EMISSION];
|
||||
myTransparencyCoef = aMat.TransparencyCoef;
|
||||
myRefractionIndex = aMat.RefractionIndex;
|
||||
myShininess = aMat.Shininess;
|
||||
myMaterialType = aMat.MaterialType;
|
||||
myMaterialName = theName;
|
||||
myRequestedMaterialName = theName;
|
||||
myReflActivity[Graphic3d_TOR_AMBIENT] = aMat.ReflActivity[Graphic3d_TOR_AMBIENT];
|
||||
myReflActivity[Graphic3d_TOR_DIFFUSE] = aMat.ReflActivity[Graphic3d_TOR_DIFFUSE];
|
||||
myReflActivity[Graphic3d_TOR_SPECULAR] = aMat.ReflActivity[Graphic3d_TOR_SPECULAR];
|
||||
myReflActivity[Graphic3d_TOR_EMISSION] = aMat.ReflActivity[Graphic3d_TOR_EMISSION];
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -488,28 +553,42 @@ void Graphic3d_MaterialAspect::SetMaterialType (const Graphic3d_TypeOfMaterial t
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetAmbient
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_MaterialAspect::SetAmbient (const Standard_ShortReal theValue)
|
||||
{
|
||||
if (theValue < 0.0f
|
||||
|| theValue > 1.0f)
|
||||
{
|
||||
throw Graphic3d_MaterialDefinitionError("Bad value for SetAmbient < 0. or > 1.0");
|
||||
}
|
||||
|
||||
myColorCoef[Graphic3d_TOR_AMBIENT] = theValue;
|
||||
if (myReflActivity[Graphic3d_TOR_AMBIENT]
|
||||
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
|
||||
{
|
||||
setUserMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetColor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_MaterialAspect::SetColor (const Quantity_Color& theColor)
|
||||
{
|
||||
if (myMaterialType == Graphic3d_MATERIAL_ASPECT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const RawMaterial& aSrcMat = THE_MATERIALS[myRequestedMaterialName];
|
||||
const Quantity_Color anAmbient((Graphic3d_Vec3 )theColor * aSrcMat.AmbientCoef);
|
||||
const Quantity_Color aDiffuse ((Graphic3d_Vec3 )theColor * aSrcMat.DiffuseCoef);
|
||||
if (myMaterialName != Graphic3d_NOM_UserDefined
|
||||
&& (!myColors[Graphic3d_TOR_AMBIENT].IsEqual (anAmbient)
|
||||
|| !myColors[Graphic3d_TOR_DIFFUSE].IsEqual (aDiffuse)))
|
||||
const Standard_ShortReal anAmbientCoeff = 0.25f;
|
||||
myColors[Graphic3d_TOR_AMBIENT].SetValues (theColor.Red() * anAmbientCoeff,
|
||||
theColor.Green() * anAmbientCoeff,
|
||||
theColor.Blue() * anAmbientCoeff, Quantity_TOC_RGB);
|
||||
myColors[Graphic3d_TOR_DIFFUSE] = theColor;
|
||||
if (myReflActivity[Graphic3d_TOR_AMBIENT]
|
||||
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
|
||||
{
|
||||
setUserMaterial();
|
||||
}
|
||||
myColors[Graphic3d_TOR_AMBIENT] = anAmbient;
|
||||
myColors[Graphic3d_TOR_DIFFUSE] = aDiffuse;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -518,13 +597,12 @@ void Graphic3d_MaterialAspect::SetColor (const Quantity_Color& theColor)
|
||||
// =======================================================================
|
||||
void Graphic3d_MaterialAspect::SetAmbientColor (const Quantity_Color& theColor)
|
||||
{
|
||||
if (myMaterialType == Graphic3d_MATERIAL_PHYSIC
|
||||
&& myMaterialName != Graphic3d_NOM_UserDefined
|
||||
&& !myColors[Graphic3d_TOR_AMBIENT].IsEqual (theColor))
|
||||
myColors[Graphic3d_TOR_AMBIENT] = theColor;
|
||||
if (myReflActivity[Graphic3d_TOR_AMBIENT]
|
||||
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
|
||||
{
|
||||
setUserMaterial();
|
||||
}
|
||||
myColors[Graphic3d_TOR_AMBIENT] = theColor;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -533,13 +611,12 @@ void Graphic3d_MaterialAspect::SetAmbientColor (const Quantity_Color& theColor)
|
||||
// =======================================================================
|
||||
void Graphic3d_MaterialAspect::SetDiffuseColor (const Quantity_Color& theColor)
|
||||
{
|
||||
if (myMaterialType == Graphic3d_MATERIAL_PHYSIC
|
||||
&& myMaterialName != Graphic3d_NOM_UserDefined
|
||||
&& !myColors[Graphic3d_TOR_DIFFUSE].IsEqual (theColor))
|
||||
myColors[Graphic3d_TOR_DIFFUSE] = theColor;
|
||||
if (myReflActivity[Graphic3d_TOR_DIFFUSE]
|
||||
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
|
||||
{
|
||||
setUserMaterial();
|
||||
}
|
||||
myColors[Graphic3d_TOR_DIFFUSE] = theColor;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -548,13 +625,12 @@ void Graphic3d_MaterialAspect::SetDiffuseColor (const Quantity_Color& theColor)
|
||||
// =======================================================================
|
||||
void Graphic3d_MaterialAspect::SetSpecularColor (const Quantity_Color& theColor)
|
||||
{
|
||||
if (myMaterialType == Graphic3d_MATERIAL_PHYSIC
|
||||
&& myMaterialName != Graphic3d_NOM_UserDefined
|
||||
&& !myColors[Graphic3d_TOR_SPECULAR].IsEqual (theColor))
|
||||
myColors[Graphic3d_TOR_SPECULAR] = theColor;
|
||||
if (myReflActivity[Graphic3d_TOR_SPECULAR]
|
||||
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
|
||||
{
|
||||
setUserMaterial();
|
||||
}
|
||||
myColors[Graphic3d_TOR_SPECULAR] = theColor;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -563,13 +639,86 @@ void Graphic3d_MaterialAspect::SetSpecularColor (const Quantity_Color& theColor)
|
||||
// =======================================================================
|
||||
void Graphic3d_MaterialAspect::SetEmissiveColor (const Quantity_Color& theColor)
|
||||
{
|
||||
if (myMaterialType == Graphic3d_MATERIAL_PHYSIC
|
||||
&& myMaterialName != Graphic3d_NOM_UserDefined
|
||||
&& !myColors[Graphic3d_TOR_EMISSION].IsEqual (theColor))
|
||||
myColors[Graphic3d_TOR_EMISSION] = theColor;
|
||||
if (myReflActivity[Graphic3d_TOR_EMISSION]
|
||||
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
|
||||
{
|
||||
setUserMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetDiffuse
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_MaterialAspect::SetDiffuse (const Standard_ShortReal theValue)
|
||||
{
|
||||
if (theValue < 0.0f
|
||||
|| theValue > 1.0f)
|
||||
{
|
||||
throw Graphic3d_MaterialDefinitionError("Bad value for SetDiffuse < 0. or > 1.0");
|
||||
}
|
||||
|
||||
myColorCoef[Graphic3d_TOR_DIFFUSE] = theValue;
|
||||
if (myReflActivity[Graphic3d_TOR_DIFFUSE]
|
||||
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
|
||||
{
|
||||
setUserMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetEmissive
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_MaterialAspect::SetEmissive (const Standard_ShortReal theValue)
|
||||
{
|
||||
if (theValue < 0.0f
|
||||
|| theValue > 1.0f)
|
||||
{
|
||||
throw Graphic3d_MaterialDefinitionError("Bad value for SetEmissive < 0. or > 1.0");
|
||||
}
|
||||
|
||||
myColorCoef[Graphic3d_TOR_EMISSION] = theValue;
|
||||
if (myReflActivity[Graphic3d_TOR_DIFFUSE]
|
||||
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
|
||||
{
|
||||
setUserMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetReflectionMode
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_MaterialAspect::SetReflectionMode (const Graphic3d_TypeOfReflection theType,
|
||||
const Standard_Boolean theValue)
|
||||
{
|
||||
myReflActivity[theType] = theValue;
|
||||
if (myMaterialType == Graphic3d_MATERIAL_PHYSIC)
|
||||
{
|
||||
setUserMaterial();
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetSpecular
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_MaterialAspect::SetSpecular (const Standard_ShortReal theValue)
|
||||
{
|
||||
if (theValue < 0.0f
|
||||
|| theValue > 1.0f)
|
||||
{
|
||||
throw Graphic3d_MaterialDefinitionError("Bad value for SetSpecular < 0. or > 1.0");
|
||||
}
|
||||
|
||||
myColorCoef[Graphic3d_TOR_SPECULAR] = theValue;
|
||||
if (myReflActivity[Graphic3d_TOR_SPECULAR]
|
||||
&& myMaterialType == Graphic3d_MATERIAL_PHYSIC)
|
||||
{
|
||||
setUserMaterial();
|
||||
}
|
||||
myColors[Graphic3d_TOR_EMISSION] = theColor;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -613,11 +762,8 @@ void Graphic3d_MaterialAspect::SetShininess (const Standard_ShortReal theValue)
|
||||
throw Graphic3d_MaterialDefinitionError("Bad value for Shininess < 0. or > 1.0");
|
||||
}
|
||||
|
||||
if (myShininess != theValue)
|
||||
{
|
||||
myShininess = theValue;
|
||||
setUserMaterial();
|
||||
}
|
||||
myShininess = theValue;
|
||||
setUserMaterial();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -638,55 +784,47 @@ Standard_CString Graphic3d_MaterialAspect::MaterialName (const Standard_Integer
|
||||
// function : MaterialFromName
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean Graphic3d_MaterialAspect::MaterialFromName (const Standard_CString theName,
|
||||
Graphic3d_NameOfMaterial& theMat)
|
||||
Graphic3d_NameOfMaterial Graphic3d_MaterialAspect::MaterialFromName (const Standard_CString theName)
|
||||
{
|
||||
TCollection_AsciiString aName (theName);
|
||||
aName.LowerCase();
|
||||
aName.Capitalize();
|
||||
const Standard_Integer aNbMaterials = Graphic3d_MaterialAspect::NumberOfMaterials();
|
||||
for (Standard_Integer aMatIter = 0; aMatIter <= aNbMaterials; ++aMatIter)
|
||||
for (Standard_Integer aMatIter = 0; aMatIter < aNbMaterials; ++aMatIter)
|
||||
{
|
||||
const RawMaterial& aMat = THE_MATERIALS[aMatIter];
|
||||
if (aName == aMat.StringName)
|
||||
{
|
||||
theMat = Graphic3d_NameOfMaterial(aMatIter);
|
||||
return Standard_True;
|
||||
return Graphic3d_NameOfMaterial(aMatIter);
|
||||
}
|
||||
}
|
||||
|
||||
// parse aliases
|
||||
if (aName == "Plastic") // Plastified
|
||||
{
|
||||
theMat = Graphic3d_NOM_PLASTIC;
|
||||
return Standard_True;
|
||||
return Graphic3d_NOM_PLASTIC;
|
||||
}
|
||||
else if (aName == "Shiny_plastic") // Shiny_plastified
|
||||
{
|
||||
theMat = Graphic3d_NOM_SHINY_PLASTIC;
|
||||
return Standard_True;
|
||||
return Graphic3d_NOM_SHINY_PLASTIC;
|
||||
}
|
||||
else if (aName == "Plaster") // Plastered
|
||||
{
|
||||
theMat = Graphic3d_NOM_PLASTER;
|
||||
return Standard_True;
|
||||
return Graphic3d_NOM_PLASTER;
|
||||
}
|
||||
else if (aName == "Satin") // Satined
|
||||
{
|
||||
theMat = Graphic3d_NOM_SATIN;
|
||||
return Standard_True;
|
||||
return Graphic3d_NOM_SATIN;
|
||||
}
|
||||
else if (aName == "Neon_gnc") // Ionized
|
||||
{
|
||||
theMat = Graphic3d_NOM_NEON_GNC;
|
||||
return Standard_True;
|
||||
return Graphic3d_NOM_NEON_GNC;
|
||||
}
|
||||
else if (aName == "Neon_phc") // Neon
|
||||
{
|
||||
theMat = Graphic3d_NOM_NEON_PHC;
|
||||
return Standard_True;
|
||||
return Graphic3d_NOM_NEON_PHC;
|
||||
}
|
||||
return Standard_False;
|
||||
return Graphic3d_NOM_DEFAULT;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -42,20 +42,8 @@ public:
|
||||
//! Returns the type of the predefined material of specified rank within range [1, NumberOfMaterials()].
|
||||
Standard_EXPORT static Graphic3d_TypeOfMaterial MaterialType (const Standard_Integer theRank);
|
||||
|
||||
//! Finds the material for specified name.
|
||||
//! @param theName [in] name to find
|
||||
//! @param theMat [out] found material
|
||||
//! @return FALSE if name was unrecognized
|
||||
Standard_EXPORT static Standard_Boolean MaterialFromName (const Standard_CString theName,
|
||||
Graphic3d_NameOfMaterial& theMat);
|
||||
|
||||
//! Returns the material for specified name or Graphic3d_NOM_DEFAULT if name is unknown.
|
||||
static Graphic3d_NameOfMaterial MaterialFromName (const Standard_CString theName)
|
||||
{
|
||||
Graphic3d_NameOfMaterial aMat = Graphic3d_NOM_DEFAULT;
|
||||
MaterialFromName (theName, aMat);
|
||||
return aMat;
|
||||
}
|
||||
Standard_EXPORT static Graphic3d_NameOfMaterial MaterialFromName (const Standard_CString theName);
|
||||
|
||||
public:
|
||||
|
||||
@@ -99,11 +87,9 @@ public:
|
||||
}
|
||||
|
||||
//! Returns the diffuse color of the surface.
|
||||
//! WARNING! This method does NOT return color for Graphic3d_MATERIAL_ASPECT material (color is defined by Graphic3d_Aspects::InteriorColor()).
|
||||
const Quantity_Color& Color() const { return myColors[Graphic3d_TOR_DIFFUSE]; }
|
||||
|
||||
//! Modifies the ambient and diffuse color of the surface.
|
||||
//! WARNING! Has no effect for Graphic3d_MATERIAL_ASPECT material (color should be set to Graphic3d_Aspects::SetInteriorColor()).
|
||||
Standard_EXPORT void SetColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Returns the transparency coefficient of the surface (1.0 - Alpha); 0.0 means opaque.
|
||||
@@ -146,6 +132,34 @@ public:
|
||||
//! Modifies the emissive color of the surface.
|
||||
Standard_EXPORT void SetEmissiveColor (const Quantity_Color& theColor);
|
||||
|
||||
//! Returns the reflection properties of the surface.
|
||||
Standard_ShortReal Ambient() const { return myColorCoef[Graphic3d_TOR_AMBIENT]; }
|
||||
|
||||
//! Modifies the reflection properties of the surface.
|
||||
//! Warning: Raises MaterialDefinitionError if given value is a negative value or greater than 1.0.
|
||||
Standard_EXPORT void SetAmbient (const Standard_ShortReal theValue);
|
||||
|
||||
//! Returns the reflection properties of the surface.
|
||||
Standard_ShortReal Diffuse() const { return myColorCoef[Graphic3d_TOR_DIFFUSE]; }
|
||||
|
||||
//! Modifies the reflection properties of the surface.
|
||||
//! Warning: Raises MaterialDefinitionError if given value is a negative value or greater than 1.0.
|
||||
Standard_EXPORT void SetDiffuse (const Standard_ShortReal theValue);
|
||||
|
||||
//! Returns the reflection properties of the surface.
|
||||
Standard_ShortReal Specular() const { return myColorCoef[Graphic3d_TOR_SPECULAR]; }
|
||||
|
||||
//! Modifies the reflection properties of the surface.
|
||||
//! Warning: Raises MaterialDefinitionError if given value is a negative value or greater than 1.0.
|
||||
Standard_EXPORT void SetSpecular (const Standard_ShortReal theValue);
|
||||
|
||||
//! Returns the emissive coefficient of the surface.
|
||||
Standard_ShortReal Emissive() const { return myColorCoef[Graphic3d_TOR_EMISSION]; }
|
||||
|
||||
//! Modifies the reflection properties of the surface.
|
||||
//! Warning: Raises MaterialDefinitionError if given value is a negative value or greater than 1.0.
|
||||
Standard_EXPORT void SetEmissive (const Standard_ShortReal theValue);
|
||||
|
||||
//! Returns the luminosity of the surface.
|
||||
Standard_ShortReal Shininess() const { return myShininess; }
|
||||
|
||||
@@ -173,11 +187,26 @@ public:
|
||||
//! Returns TRUE if the reflection mode is active, FALSE otherwise.
|
||||
Standard_Boolean ReflectionMode (const Graphic3d_TypeOfReflection theType) const
|
||||
{
|
||||
return !myColors[theType].IsEqual (Quantity_NOC_BLACK);
|
||||
return myReflActivity[theType];
|
||||
}
|
||||
|
||||
//! Returns material type.
|
||||
Graphic3d_TypeOfMaterial MaterialType() const { return myMaterialType; }
|
||||
//! Activates or deactivates the reflective properties of the surface with specified reflection type.
|
||||
//!
|
||||
//! Disabling diffuse and specular reflectance is useful for efficient visualization
|
||||
//! of large amounts of data as definition of normals for graphic primitives is not needed
|
||||
//! when only "all-directional" reflectance is active.
|
||||
//!
|
||||
//! NOTE: Disabling all four reflection modes also turns off the following effects:
|
||||
//! 1. Lighting. Colors of primitives are not affected by the material properties when lighting is off.
|
||||
//! 2. Transparency.
|
||||
Standard_EXPORT void SetReflectionMode (const Graphic3d_TypeOfReflection theType,
|
||||
const Standard_Boolean theValue);
|
||||
|
||||
//! Activates the reflective properties of the surface with specified reflection type.
|
||||
void SetReflectionModeOn (const Graphic3d_TypeOfReflection theType) { SetReflectionMode (theType, Standard_True); }
|
||||
|
||||
//! Deactivates the reflective properties of the surface with specified reflection type.
|
||||
void SetReflectionModeOff (const Graphic3d_TypeOfReflection theType) { SetReflectionMode (theType, Standard_False); }
|
||||
|
||||
//! Returns TRUE if type of this material is equal to specified type.
|
||||
Standard_Boolean MaterialType (const Graphic3d_TypeOfMaterial theType) const { return myMaterialType == theType; }
|
||||
@@ -194,39 +223,27 @@ public:
|
||||
//! Returns TRUE if this material is identical to specified one.
|
||||
Standard_Boolean IsEqual (const Graphic3d_MaterialAspect& theOther) const
|
||||
{
|
||||
return myTransparencyCoef == theOther.myTransparencyCoef
|
||||
return myColorCoef[Graphic3d_TOR_AMBIENT] == theOther.myColorCoef[Graphic3d_TOR_AMBIENT]
|
||||
&& myColorCoef[Graphic3d_TOR_DIFFUSE] == theOther.myColorCoef[Graphic3d_TOR_DIFFUSE]
|
||||
&& myColorCoef[Graphic3d_TOR_SPECULAR] == theOther.myColorCoef[Graphic3d_TOR_SPECULAR]
|
||||
&& myColorCoef[Graphic3d_TOR_EMISSION] == theOther.myColorCoef[Graphic3d_TOR_EMISSION]
|
||||
&& myTransparencyCoef == theOther.myTransparencyCoef
|
||||
&& myRefractionIndex == theOther.myRefractionIndex
|
||||
&& myBSDF == theOther.myBSDF
|
||||
&& myShininess == theOther.myShininess
|
||||
&& myColors[Graphic3d_TOR_AMBIENT] == theOther.myColors[Graphic3d_TOR_AMBIENT]
|
||||
&& myColors[Graphic3d_TOR_DIFFUSE] == theOther.myColors[Graphic3d_TOR_DIFFUSE]
|
||||
&& myColors[Graphic3d_TOR_SPECULAR] == theOther.myColors[Graphic3d_TOR_SPECULAR]
|
||||
&& myColors[Graphic3d_TOR_EMISSION] == theOther.myColors[Graphic3d_TOR_EMISSION];
|
||||
&& myColors[Graphic3d_TOR_AMBIENT] == theOther.myColors[Graphic3d_TOR_AMBIENT]
|
||||
&& myColors[Graphic3d_TOR_DIFFUSE] == theOther.myColors[Graphic3d_TOR_DIFFUSE]
|
||||
&& myColors[Graphic3d_TOR_SPECULAR] == theOther.myColors[Graphic3d_TOR_SPECULAR]
|
||||
&& myColors[Graphic3d_TOR_EMISSION] == theOther.myColors[Graphic3d_TOR_EMISSION]
|
||||
&& myReflActivity[Graphic3d_TOR_AMBIENT] == theOther.myReflActivity[Graphic3d_TOR_AMBIENT]
|
||||
&& myReflActivity[Graphic3d_TOR_DIFFUSE] == theOther.myReflActivity[Graphic3d_TOR_DIFFUSE]
|
||||
&& myReflActivity[Graphic3d_TOR_SPECULAR] == theOther.myReflActivity[Graphic3d_TOR_SPECULAR]
|
||||
&& myReflActivity[Graphic3d_TOR_EMISSION] == theOther.myReflActivity[Graphic3d_TOR_EMISSION];
|
||||
}
|
||||
|
||||
//! Returns TRUE if this material is identical to specified one.
|
||||
Standard_Boolean operator== (const Graphic3d_MaterialAspect& theOther) const { return IsEqual (theOther); }
|
||||
|
||||
public:
|
||||
|
||||
//! Deactivates the reflective properties of the surface with specified reflection type.
|
||||
Standard_DEPRECATED("Deprecated method, specific material component should be zerroed instead")
|
||||
void SetReflectionModeOff (const Graphic3d_TypeOfReflection theType)
|
||||
{
|
||||
if (!ReflectionMode (theType))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (theType)
|
||||
{
|
||||
case Graphic3d_TOR_AMBIENT: SetAmbientColor (Quantity_NOC_BLACK); break;
|
||||
case Graphic3d_TOR_DIFFUSE: SetDiffuseColor (Quantity_NOC_BLACK); break;
|
||||
case Graphic3d_TOR_SPECULAR: SetSpecularColor(Quantity_NOC_BLACK); break;
|
||||
case Graphic3d_TOR_EMISSION: SetEmissiveColor(Quantity_NOC_BLACK); break;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! Initialize the standard material.
|
||||
@@ -237,18 +254,16 @@ private:
|
||||
{
|
||||
// if a component of a "standard" material change, the
|
||||
// result is no more standard (a blue gold is not a gold)
|
||||
if (myMaterialName != Graphic3d_NOM_UserDefined)
|
||||
{
|
||||
myMaterialName = Graphic3d_NOM_UserDefined;
|
||||
myStringName = "UserDefined";
|
||||
}
|
||||
myMaterialName = Graphic3d_NOM_UserDefined;
|
||||
myStringName = "UserDefined";
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Graphic3d_BSDF myBSDF;
|
||||
TCollection_AsciiString myStringName;
|
||||
Quantity_Color myColors[Graphic3d_TypeOfReflection_NB];
|
||||
Quantity_Color myColors [Graphic3d_TypeOfReflection_NB];
|
||||
Standard_ShortReal myColorCoef[Graphic3d_TypeOfReflection_NB];
|
||||
Standard_ShortReal myTransparencyCoef;
|
||||
Standard_ShortReal myRefractionIndex;
|
||||
Standard_ShortReal myShininess;
|
||||
@@ -257,6 +272,8 @@ private:
|
||||
Graphic3d_NameOfMaterial myMaterialName;
|
||||
Graphic3d_NameOfMaterial myRequestedMaterialName;
|
||||
|
||||
Standard_Boolean myReflActivity[Graphic3d_TypeOfReflection_NB];
|
||||
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_MaterialAspect_HeaderFile
|
||||
|