V3d_View::GetGraduatedTrihedron() - return configuration structure directly.
OpenGl_View::TriedronDisplay() - do not re-create trihedron on each Display call.
OpenGl_Trihedron::Setup() - eliminate global variables.
OpenGl_PrimitiveArray::buildVBO() - release old VBOs before initialization.
ViewerTest.hxx - move out package header from .cdl file.
ViewerTest::ParseColor() - add new method to parse color arguments in common way.
vzbufftrihedron - improve command syntax.
vgraduatedtrihedron - add options -drawgrid and -drawaxes.
Graphic3d_AxisAspect (const TCollection_ExtendedString theName = "", const Quantity_Color theNameColor = Quantity_NOC_BLACK,
const Quantity_Color theColor = Quantity_NOC_BLACK,
const Standard_Integer theValuesOffset = 10, const Standard_Integer theNameOffset = 30,
- const Standard_Integer theTickmarkNumber = 5, const Standard_Integer theTickmarkLength = 10,
+ const Standard_Integer theTickmarksNumber = 5, const Standard_Integer theTickmarksLength = 10,
const Standard_Boolean theToDrawName = Standard_True,
const Standard_Boolean theToDrawValues = Standard_True,
const Standard_Boolean theToDrawTickmarks = Standard_True)
myToDrawTickmarks (theToDrawTickmarks),
myToDrawValues (theToDrawValues),
myNameColor (theNameColor),
- myTickmarkNumber (theTickmarkNumber),
- myTickmarkLength (theTickmarkLength),
+ myTickmarksNumber (theTickmarksNumber),
+ myTickmarksLength (theTickmarksLength),
myColor (theColor),
myValuesOffset (theValuesOffset),
myNameOffset (theNameOffset)
const TCollection_ExtendedString& Name() const { return myName; }
const Standard_Boolean ToDrawName() const { return myToDrawName; }
- void SetToDrawName (const Standard_Boolean theToDraw) { myToDrawName = theToDraw; }
+ void SetDrawName (const Standard_Boolean theToDraw) { myToDrawName = theToDraw; }
const Standard_Boolean ToDrawTickmarks() const { return myToDrawTickmarks; }
- void SetToDrawTickmarks (const Standard_Boolean theToDraw) { myToDrawTickmarks = theToDraw; }
+ void SetDrawTickmarks (const Standard_Boolean theToDraw) { myToDrawTickmarks = theToDraw; }
const Standard_Boolean ToDrawValues() const { return myToDrawValues; }
- void SetToDrawValues (const Standard_Boolean theToDraw) { myToDrawValues = theToDraw; }
+ void SetDrawValues (const Standard_Boolean theToDraw) { myToDrawValues = theToDraw; }
const Quantity_Color& NameColor() const { return myNameColor; }
void SetNameColor (const Quantity_Color& theColor) { myNameColor = theColor; }
//! Sets color of axis and values
void SetColor (const Quantity_Color& theColor) { myColor = theColor; }
- const Standard_Integer TickmarkNumber() const { return myTickmarkNumber; }
- void SetTickmarkNumber (const Standard_Integer theValue) { myTickmarkNumber = theValue; }
+ const Standard_Integer TickmarksNumber() const { return myTickmarksNumber; }
+ void SetTickmarksNumber (const Standard_Integer theValue) { myTickmarksNumber = theValue; }
- const Standard_Integer TickmarkLength() const { return myTickmarkLength; }
- void SetTickmarkLength (const Standard_Integer theValue) { myTickmarkLength = theValue; }
+ const Standard_Integer TickmarksLength() const { return myTickmarksLength; }
+ void SetTickmarksLength (const Standard_Integer theValue) { myTickmarksLength = theValue; }
const Standard_Integer ValuesOffset() const { return myValuesOffset; }
void SetValuesOffset (const Standard_Integer theValue) { myValuesOffset = theValue; }
Quantity_Color myNameColor;
- Standard_Integer myTickmarkNumber; //!< Number of splits along axes
- Standard_Integer myTickmarkLength; //!< Length of tickmarks
- Quantity_Color myColor; //!< Color of axis and values
+ Standard_Integer myTickmarksNumber; //!< Number of splits along axes
+ Standard_Integer myTickmarksLength; //!< Length of tickmarks
+ Quantity_Color myColor; //!< Color of axis and values
- Standard_Integer myValuesOffset; //!< Offset for drawing values
- Standard_Integer myNameOffset; //!< Offset for drawing name of axis
+ Standard_Integer myValuesOffset; //!< Offset for drawing values
+ Standard_Integer myNameOffset; //!< Offset for drawing name of axis
};
//! Defines the class of a graduated trihedron.
//! Default constructor
//! Constructs the default graduated trihedron with grid, X, Y, Z axes, and tickmarks
Graphic3d_GraduatedTrihedron (const TCollection_AsciiString& theNamesFont = "Arial",
- const Font_FontAspect& theNameStyle = Font_FA_Bold, const Standard_Integer theNamesSize = 12,
+ const Font_FontAspect& theNamesStyle = Font_FA_Bold, const Standard_Integer theNamesSize = 12,
const TCollection_AsciiString& theValuesFont = "Arial",
const Font_FontAspect& theValuesStyle = Font_FA_Regular, const Standard_Integer theValuesSize = 12,
- const Standard_ShortReal theArrowLength = 30.0f, const Quantity_Color theGridColor = Quantity_NOC_WHITE,
+ const Standard_ShortReal theArrowsLength = 30.0f, const Quantity_Color theGridColor = Quantity_NOC_WHITE,
const Standard_Boolean theToDrawGrid = Standard_True, const Standard_Boolean theToDrawAxes = Standard_True)
: myNamesFont (theNamesFont),
- myNamesStyle (theNameStyle),
+ myNamesStyle (theNamesStyle),
myNamesSize (theNamesSize),
myValuesFont (theValuesFont),
myValuesStyle (theValuesStyle),
myValuesSize (theValuesSize),
- myArrowLength (theArrowLength),
+ myArrowsLength (theArrowsLength),
myGridColor (theGridColor),
myToDrawGrid (theToDrawGrid),
myToDrawAxes (theToDrawAxes),
return myAxes (theIndex);
}
- const Standard_ShortReal ArrowLength() const { return myArrowLength; }
- void SetArrowLength (const Standard_ShortReal theValue) { myArrowLength = theValue; }
+ const Standard_ShortReal ArrowsLength() const { return myArrowsLength; }
+ void SetArrowsLength (const Standard_ShortReal theValue) { myArrowsLength = theValue; }
const Quantity_Color& GridColor() const { return myGridColor; }
void SetGridColor (const Quantity_Color& theColor) {myGridColor = theColor; }
const Standard_Boolean ToDrawGrid() const { return myToDrawGrid; }
- void SetToDrawTickmarks (const Standard_Boolean theToDraw) { myToDrawGrid = theToDraw; }
+ void SetDrawGrid (const Standard_Boolean theToDraw) { myToDrawGrid = theToDraw; }
const Standard_Boolean ToDrawAxes() const { return myToDrawAxes; }
- void SetToDrawAxes (const Standard_Boolean theToDraw) { myToDrawAxes = theToDraw; }
+ void SetDrawAxes (const Standard_Boolean theToDraw) { myToDrawAxes = theToDraw; }
const TCollection_AsciiString& NamesFont() const { return myNamesFont; }
void SetNamesFont (const TCollection_AsciiString& theFont) { myNamesFont = theFont; }
protected:
- Standard_ShortReal myArrowLength;
+ Standard_ShortReal myArrowsLength;
Quantity_Color myGridColor;
Standard_Boolean myToDrawGrid;
----------------------------------------
ZBufferTriedronSetup ( me : mutable;
+ theCView : CView from Graphic3d;
XColor : NameOfColor from Quantity = Quantity_NOC_RED;
YColor : NameOfColor from Quantity = Quantity_NOC_GREEN;
ZColor : NameOfColor from Quantity = Quantity_NOC_BLUE1;
Standard_EXPORT void SetAspect (const CALL_DEF_CONTEXTLINE& theAspect);
- const TEL_COLOUR & Color() const { return myColor; }
- Aspect_TypeOfLine Type() const { return myType; }
+ const TEL_COLOUR& Color() const { return myColor; }
+ TEL_COLOUR& ChangeColor() { return myColor; }
+ Aspect_TypeOfLine Type() const { return myType; }
float Width() const { return myWidth; }
//! Init and return OpenGl shader program resource.
#include <OpenGl_Cylinder.hxx>
#include <Precision.hxx>
+namespace
+{
+ static const OpenGl_TextParam THE_LABEL_PARAMS =
+ {
+ 16, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM
+ };
+}
+
// =======================================================================
// function : Constructor
// purpose :
// =======================================================================
-OpenGl_GraduatedTrihedron::OpenGl_GraduatedTrihedron (const Graphic3d_GraduatedTrihedron& theData)
+OpenGl_GraduatedTrihedron::OpenGl_GraduatedTrihedron()
: myMin (0.0f, 0.0f, 0.0f),
- myMax (100.0f, 100.0f, 100.0f),
- myData (theData)
+ myMax (100.0f, 100.0f, 100.0f)
+{
+ //
+}
+
+// =======================================================================
+// function : SetValues
+// purpose :
+// =======================================================================
+void OpenGl_GraduatedTrihedron::SetValues (const Handle(OpenGl_Context)& theCtx,
+ const Graphic3d_GraduatedTrihedron& theData)
{
+ Release (theCtx.operator->());
+ myData = theData;
+
// Initialize text label parameters for x, y, and z axes
myAxes[0] = Axis (myData.XAxisAspect(), OpenGl_Vec3 (1.0f, 0.0f, 0.0f));
myAxes[1] = Axis (myData.YAxisAspect(), OpenGl_Vec3 (0.0f, 1.0f, 0.0f));
myAxes[2] = Axis (myData.ZAxisAspect(), OpenGl_Vec3 (0.0f, 0.0f, 1.0f));
// Initialize constant primitives: text, arrows.
-
- myAxes[0].InitArrow (NULL, myData.ArrowLength(), OpenGl_Vec3 (0.0f, 0.0f, 1.0f));
-
- myAxes[1].InitArrow (NULL, myData.ArrowLength(), OpenGl_Vec3 (0.0f, 0.0f, 1.0f));
-
- myAxes[2].InitArrow (NULL, myData.ArrowLength(), OpenGl_Vec3 (1.0f, 0.0f, 0.0f));
-
+ myAxes[0].InitArrow (theCtx, myData.ArrowsLength(), OpenGl_Vec3 (0.0f, 0.0f, 1.0f));
+ myAxes[1].InitArrow (theCtx, myData.ArrowsLength(), OpenGl_Vec3 (0.0f, 0.0f, 1.0f));
+ myAxes[2].InitArrow (theCtx, myData.ArrowsLength(), OpenGl_Vec3 (1.0f, 0.0f, 0.0f));
for (Standard_Integer anIt = 0; anIt < 3; ++anIt)
{
- myAxes[anIt].Label.SetFontSize (NULL, theData.NamesSize());
+ myAxes[anIt].Label.SetFontSize (theCtx, theData.NamesSize());
}
- myLabelValues.SetFontSize (NULL, theData.ValuesSize());
+ myLabelValues.SetFontSize (theCtx, theData.ValuesSize());
myAspectLabels.SetFontAspect (theData.NamesFontAspect());
myAspectLabels.ChangeFontName() = theData.NamesFont();
myAspectValues.ChangeFontName() = theData.ValuesFont();
// Grid aspect
- Graphic3d_CAspectLine anAspect;
- anAspect.IsDef = 1;
- anAspect.IsSet = 1;
- anAspect.Width = 1.0f;
- anAspect.LineType = Aspect_TOL_SOLID;
- anAspect.Color.r = (Standard_ShortReal) theData.GridColor().Red();
- anAspect.Color.g = (Standard_ShortReal) theData.GridColor().Green();
- anAspect.Color.b = (Standard_ShortReal) theData.GridColor().Blue();
- myGridLineAspect.SetAspect (anAspect);
+ myGridLineAspect.ChangeColor().rgb[0] = (Standard_ShortReal) theData.GridColor().Red();
+ myGridLineAspect.ChangeColor().rgb[1] = (Standard_ShortReal) theData.GridColor().Green();
+ myGridLineAspect.ChangeColor().rgb[2] = (Standard_ShortReal) theData.GridColor().Blue();
}
// =======================================================================
// function : renderLine
// purpose :
// =======================================================================
-void OpenGl_GraduatedTrihedron::renderLine (const OpenGl_PrimitiveArray* theLine,
+void OpenGl_GraduatedTrihedron::renderLine (const OpenGl_PrimitiveArray& theLine,
const Handle(OpenGl_Workspace)& theWorkspace,
const OpenGl_Mat4& theMat,
const Standard_ShortReal theXt,
OpenGl_Utils::Translate (aMat, theXt, theYt, theZt);
aContext->WorldViewState.SetCurrent (aMat);
aContext->ApplyWorldViewMatrix();
- theLine->Render (theWorkspace);
+ theLine.Render (theWorkspace);
}
// =======================================================================
OpenGl_Mat4& theMat) const
{
const Graphic3d_AxisAspect& aCurAspect = myData.AxisAspect (theIndex);
- if (aCurAspect.TickmarkNumber() <= 0)
+ if (aCurAspect.TickmarksNumber() <= 0)
{
return;
}
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
Standard_ShortReal aStep = theGridAxes.Axes[theIndex].GetData()[theIndex]
- * (myMax.GetData()[theIndex] - myMin.GetData()[theIndex]) / aCurAspect.TickmarkNumber();
+ * (myMax.GetData()[theIndex] - myMin.GetData()[theIndex]) / aCurAspect.TickmarksNumber();
// NOTE:
- // Get two other axes directions and draw lines Axis.TickmarkNumber times.
+ // Get two other axes directions and draw lines Axis.TickmarksNumber times.
// Combining together from three axes, these lines will make a grid.
for (Standard_Integer anIter = 1; anIter <= 2; ++anIter)
{
aContext->ApplyWorldViewMatrix();
const OpenGl_Vec3 aStepVec (myAxes[theIndex].Direction * aStep);
- for (Standard_Integer anIt = myData.ToDrawAxes() ? 1 : 0; anIt < aCurAspect.TickmarkNumber(); ++anIt)
+ for (Standard_Integer anIt = myData.ToDrawAxes() ? 1 : 0; anIt < aCurAspect.TickmarksNumber(); ++anIt)
{
OpenGl_Utils::Translate (aMat, aStepVec.x(), aStepVec.y(), aStepVec.z());
aContext->WorldViewState.SetCurrent (aMat);
aContext->ApplyWorldViewMatrix();
- anAxis.Line->Render (theWorkspace);
+ anAxis.Line.Render (theWorkspace);
}
}
}
aProjMat .Convert (aContext->ProjectionState.Current());
// Get the window's (fixed) coordinates for before matrixes modifications
- OpenGl_Vec3 aEndPoint = -anAxis.Direction * myData.ArrowLength();
+ OpenGl_Vec3 aEndPoint = -anAxis.Direction * myData.ArrowsLength();
OpenGl_Vec3 aWinPoint;
OpenGl_Utils::Project<Standard_ShortReal> (aEndPoint.x(), aEndPoint.y(), aEndPoint.z(),
aModelMat, aProjMat, aViewport,
aWinPoint.x(), aWinPoint.y(), aWinPoint.z());
- anAxis.Arrow->Render (theWorkspace);
+ anAxis.Arrow.Render (theWorkspace);
theWorkspace->ActiveView()->EndTransformPersistence (aContext);
// Get current Model-View and Projection states after the end of Transform Persistence
aContext->WorldViewState.SetCurrent (aModelMat);
aContext->ApplyWorldViewMatrix();
- anAxis.Line->Render (theWorkspace);
+ anAxis.Line.Render (theWorkspace);
}
// =======================================================================
const Axis& anAxis = myAxes[theIndex];
const OpenGl_Vec3 aSizeVec (myMax - myMin);
Standard_ShortReal aStep = theGridAxes.Axes[theIndex].GetData()[theIndex]
- * (myMax.GetData()[theIndex] - myMin.GetData()[theIndex]) / aCurAspect.TickmarkNumber();
+ * (myMax.GetData()[theIndex] - myMin.GetData()[theIndex]) / aCurAspect.TickmarksNumber();
OpenGl_Vec3 aDir = (theGridAxes.Ticks[theIndex] - theGridAxes.Origin).Normalized();
const Handle(OpenGl_Context)& aContext = theWorkspace->GetGlContext();
- if (aCurAspect.ToDrawTickmarks() && aCurAspect.TickmarkNumber() > 0)
+ if (aCurAspect.ToDrawTickmarks() && aCurAspect.TickmarksNumber() > 0)
{
theWorkspace->SetAspectLine (&myGridLineAspect);
OpenGl_Mat4 aModelMat (theMat);
- anAxis.InitTickmark (aContext, aDir * (Standard_ShortReal) aCurAspect.TickmarkLength() * theDpix);
+ anAxis.InitTickmark (aContext, aDir * (Standard_ShortReal) aCurAspect.TickmarksLength() * theDpix);
OpenGl_Utils::Translate (aModelMat, theGridAxes.Ticks[theIndex].x(),
theGridAxes.Ticks[theIndex].y(),
theGridAxes.Ticks[theIndex].z());
aContext->WorldViewState.SetCurrent (aModelMat);
aContext->ApplyWorldViewMatrix();
OpenGl_Vec3 aStepVec = anAxis.Direction * aStep;
- for (Standard_Integer anIter = 0; anIter <= aCurAspect.TickmarkNumber(); ++anIter)
+ for (Standard_Integer anIter = 0; anIter <= aCurAspect.TickmarksNumber(); ++anIter)
{
- anAxis.Tickmark->Render (theWorkspace);
+ anAxis.Tickmark.Render (theWorkspace);
OpenGl_Utils::Translate (aModelMat, aStepVec.x(), aStepVec.y(), aStepVec.z());
aContext->WorldViewState.SetCurrent (aModelMat);
aContext->ApplyWorldViewMatrix();
if (aCurAspect.ToDrawName())
{
- Standard_Real anOffset = aCurAspect.NameOffset() + aCurAspect.TickmarkLength();
+ Standard_Real anOffset = aCurAspect.NameOffset() + aCurAspect.TickmarksLength();
OpenGl_Vec3 aMiddle (theGridAxes.Ticks[theIndex] + aSizeVec * theGridAxes.Axes[theIndex] * 0.5f + aDir * (Standard_ShortReal)(theDpix * anOffset));
anAxis.Label.Render (theWorkspace);
}
- if (aCurAspect.ToDrawValues() && aCurAspect.TickmarkNumber() > 0)
+ if (aCurAspect.ToDrawValues() && aCurAspect.TickmarksNumber() > 0)
{
myAspectValues.ChangeColor() = anAxis.LineAspect.Color();
theWorkspace->SetAspectText (&myAspectValues);
- Standard_Real anOffset = aCurAspect.ValuesOffset() + aCurAspect.TickmarkLength();
+ Standard_Real anOffset = aCurAspect.ValuesOffset() + aCurAspect.TickmarksLength();
- for (Standard_Integer anIt = 0; anIt <= aCurAspect.TickmarkNumber(); ++anIt)
+ for (Standard_Integer anIt = 0; anIt <= aCurAspect.TickmarksNumber(); ++anIt)
{
sprintf (aTextValue, "%g", theGridAxes.Ticks[theIndex].GetData()[theIndex] + anIt * aStep);
OpenGl_Vec3 aPos (theGridAxes.Ticks[theIndex] + anAxis.Direction* (Standard_ShortReal) (anIt * aStep) + aDir * (Standard_ShortReal) (theDpix * anOffset));
if (myData.CubicAxesCallback)
{
myData.CubicAxesCallback (myData.PtrVisual3dView);
- if (myAxes[0].Line == NULL || myAxes[1].Line == NULL || myAxes[2].Line == NULL
- || OpenGl_Vec3 (anOldMin - myMin).Modulus() > Precision::Confusion()
- || OpenGl_Vec3 (anOldMax - myMax).Modulus() > Precision::Confusion())
+ if (!myAxes[0].Line.IsInitialized()
+ || !myAxes[1].Line.IsInitialized()
+ || !myAxes[2].Line.IsInitialized()
+ || OpenGl_Vec3 (anOldMin - myMin).Modulus() > Precision::Confusion()
+ || OpenGl_Vec3 (anOldMax - myMax).Modulus() > Precision::Confusion())
{
- myAxes[0].InitLine (aContext, OpenGl_Vec3 (myMax.x() - myMin.x(), 0.0f, 0.0f));
- myAxes[1].InitLine (aContext, OpenGl_Vec3 (0.0f, myMax.y() - myMin.y(), 0.0f));
- myAxes[2].InitLine (aContext, OpenGl_Vec3 (0.0f, 0.0f, myMax.z() - myMin.z()));
+ myAxes[0].InitLine (aContext, OpenGl_Vec3 (myMax.x() - myMin.x(), 0.0f, 0.0f));
+ myAxes[1].InitLine (aContext, OpenGl_Vec3 (0.0f, myMax.y() - myMin.y(), 0.0f));
+ myAxes[2].InitLine (aContext, OpenGl_Vec3 (0.0f, 0.0f, myMax.z() - myMin.z()));
}
}
// =======================================================================
// method : OpenGl_GraduatedTrihedron::Axis constructor
-// purpose :
+// purpose :
// =======================================================================
OpenGl_GraduatedTrihedron::Axis::Axis (const Graphic3d_AxisAspect& theAspect,
- const OpenGl_Vec3& theDirection)
+ const OpenGl_Vec3& theDirection)
: Direction (theDirection),
- Label (NCollection_String ((Standard_Utf16Char* )theAspect.Name().ToExtString()).ToCString(),
- Direction, THE_LABEL_PARAMS)
+ Label (NCollection_String ((Standard_Utf16Char* )theAspect.Name().ToExtString()).ToCString(), theDirection, THE_LABEL_PARAMS),
+ Tickmark (NULL),
+ Line (NULL),
+ Arrow (NULL)
{
NameColor.rgb[0] = (Standard_ShortReal) theAspect.NameColor().Red();
NameColor.rgb[1] = (Standard_ShortReal) theAspect.NameColor().Green();
NameColor.rgb[2] = (Standard_ShortReal) theAspect.NameColor().Blue();
NameColor.rgb[3] = 1.0f;
- // Fill aspect
- Graphic3d_CAspectLine anAspect;
- anAspect.IsDef = 1;
- anAspect.IsSet = 1;
- anAspect.Width = 1.0f;
- anAspect.LineType = Aspect_TOL_SOLID;
- anAspect.Color.r = (Standard_ShortReal) theAspect.Color().Red();
- anAspect.Color.g = (Standard_ShortReal) theAspect.Color().Green();
- anAspect.Color.b = (Standard_ShortReal) theAspect.Color().Blue();
- LineAspect.SetAspect (anAspect);
-
- // Create primitives
- Line = new OpenGl_PrimitiveArray (NULL, Graphic3d_TOPA_SEGMENTS, NULL, NULL, NULL);
- Tickmark = new OpenGl_PrimitiveArray (NULL, Graphic3d_TOPA_SEGMENTS, NULL, NULL, NULL);
- Arrow = new OpenGl_PrimitiveArray (NULL, Graphic3d_TOPA_POLYLINES, NULL, NULL, NULL);
+ LineAspect.ChangeColor().rgb[0] = (Standard_ShortReal) theAspect.Color().Red();
+ LineAspect.ChangeColor().rgb[1] = (Standard_ShortReal) theAspect.Color().Green();
+ LineAspect.ChangeColor().rgb[2] = (Standard_ShortReal) theAspect.Color().Blue();
}
// =======================================================================
-// method : OpenGl_GraduatedTrihedron::Axis operator =
-// purpose :
+// method : OpenGl_GraduatedTrihedron::Axis::~Axis
+// purpose :
// =======================================================================
-OpenGl_GraduatedTrihedron::Axis&
- OpenGl_GraduatedTrihedron::Axis::operator= (const Axis& theOther)
+OpenGl_GraduatedTrihedron::Axis::~Axis()
{
- Direction = theOther.Direction;
- NameColor = theOther.NameColor;
+ //
+}
+
+// =======================================================================
+// method : OpenGl_GraduatedTrihedron::Axis operator=
+// purpose :
+// =======================================================================
+OpenGl_GraduatedTrihedron::Axis& OpenGl_GraduatedTrihedron::Axis::operator= (const Axis& theOther)
+{
+ Direction = theOther.Direction;
+ NameColor = theOther.NameColor;
LineAspect = theOther.LineAspect;
- Label = theOther.Label;
+ Label = theOther.Label;
- Line->InitBuffers (NULL, Graphic3d_TOPA_SEGMENTS, theOther.Line->Indices(), theOther.Line->Attributes(), theOther.Line->Bounds());
- Tickmark->InitBuffers (NULL, Graphic3d_TOPA_SEGMENTS, theOther.Tickmark->Indices(), theOther.Tickmark->Attributes(), theOther.Tickmark->Bounds());
- Arrow->InitBuffers (NULL, Graphic3d_TOPA_POLYLINES, theOther.Arrow->Indices(), theOther.Arrow->Attributes(), theOther.Arrow->Bounds());
+ Line .InitBuffers (NULL, Graphic3d_TOPA_SEGMENTS, theOther.Line.Indices(), theOther.Line.Attributes(), theOther.Line.Bounds());
+ Tickmark.InitBuffers (NULL, Graphic3d_TOPA_SEGMENTS, theOther.Tickmark.Indices(), theOther.Tickmark.Attributes(), theOther.Tickmark.Bounds());
+ Arrow .InitBuffers (NULL, Graphic3d_TOPA_POLYLINES, theOther.Arrow.Indices(), theOther.Arrow.Attributes(), theOther.Arrow.Bounds());
return *this;
}
// =======================================================================
// method : InitArrow
-// purpose :
+// purpose :
// =======================================================================
void OpenGl_GraduatedTrihedron::Axis::InitArrow (const Handle(OpenGl_Context)& theContext,
const Standard_ShortReal theLength,
anArray->AddVertex (aPoint3);
anArray->AddVertex (aPoint1);
- Arrow->InitBuffers (theContext, Graphic3d_TOPA_POLYLINES,
- anArray->Indices(), anArray->Attributes(), anArray->Bounds());
+ Arrow.InitBuffers (theContext, Graphic3d_TOPA_POLYLINES,
+ anArray->Indices(), anArray->Attributes(), anArray->Bounds());
}
// =======================================================================
Handle(Graphic3d_ArrayOfSegments) anArray = new Graphic3d_ArrayOfSegments (2);
anArray->AddVertex (0.0f, 0.0f, 0.0f);
anArray->AddVertex (theDir);
- Tickmark->InitBuffers (theContext, Graphic3d_TOPA_SEGMENTS,
- anArray->Indices(), anArray->Attributes(), anArray->Bounds());
+ Tickmark.InitBuffers (theContext, Graphic3d_TOPA_SEGMENTS,
+ anArray->Indices(), anArray->Attributes(), anArray->Bounds());
}
anArray->AddVertex (0.0f, 0.0f, 0.0f);
anArray->AddVertex (theDir);
- Line->InitBuffers (theContext, Graphic3d_TOPA_SEGMENTS,
- anArray->Indices(), anArray->Attributes(), anArray->Bounds());
+ Line.InitBuffers (theContext, Graphic3d_TOPA_SEGMENTS,
+ anArray->Indices(), anArray->Attributes(), anArray->Bounds());
}
// =======================================================================
// =======================================================================
void OpenGl_GraduatedTrihedron::Axis::Release (OpenGl_Context* theCtx)
{
- Label.Release (theCtx);
- Tickmark->Release (theCtx);
- Line->Release (theCtx);
- Arrow->Release (theCtx);
+ Label .Release (theCtx);
+ Tickmark.Release (theCtx);
+ Line .Release (theCtx);
+ Arrow .Release (theCtx);
}
class Visual3d_View;
class OpenGl_View;
-static const OpenGl_TextParam THE_LABEL_PARAMS =
-{
- 16, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM
-};
-
//! This class allows to render Graduated Trihedron, i.e. trihedron with grid.
//! it is based on Graphic3d_GraduatedTrihedron parameters and support its customization
//! on construction level only.
public:
- OpenGl_GraduatedTrihedron (const Graphic3d_GraduatedTrihedron& theData);
+ //! Default constructor.
+ OpenGl_GraduatedTrihedron();
+
+ //! Destructor.
+ virtual ~OpenGl_GraduatedTrihedron();
+ //! Draw the element.
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
+ //! Release OpenGL resources.
virtual void Release (OpenGl_Context* theCtx);
+ //! Setup configuration.
+ void SetValues (const Handle(OpenGl_Context)& theCtx,
+ const Graphic3d_GraduatedTrihedron& theData);
+
//! Sets up-to-date values of scene bounding box.
//! Can be used in callback mechanism to get up-to-date values.
//! @sa Graphic3d_GraduatedTrihedron::CubicAxesCallback
- void SetMinMax (const OpenGl_Vec3& theMin, const OpenGl_Vec3& theMax);
-
-protected:
-
- virtual ~OpenGl_GraduatedTrihedron();
+ void SetMinMax (const OpenGl_Vec3& theMin,
+ const OpenGl_Vec3& theMax);
private:
TEL_COLOUR NameColor;
OpenGl_AspectLine LineAspect;
mutable OpenGl_Text Label;
- mutable OpenGl_PrimitiveArray* Tickmark;
- mutable OpenGl_PrimitiveArray* Line;
- mutable OpenGl_PrimitiveArray* Arrow;
+ mutable OpenGl_PrimitiveArray Tickmark;
+ mutable OpenGl_PrimitiveArray Line;
+ mutable OpenGl_PrimitiveArray Arrow;
public:
Axis (const Graphic3d_AxisAspect& theAspect = Graphic3d_AxisAspect(),
const OpenGl_Vec3& theDirection = OpenGl_Vec3 (1.0f, 0.0f, 0.0f));
- Axis& operator= (const Axis& theOther);
+ ~Axis();
- ~Axis()
- {
- OpenGl_Element::Destroy (NULL, Line);
- OpenGl_Element::Destroy (NULL, Tickmark);
- OpenGl_Element::Destroy (NULL, Arrow);
- }
+ Axis& operator= (const Axis& theOther);
void InitArrow (const Handle(OpenGl_Context)& theContext,
const Standard_ShortReal theLength,
const OpenGl_Vec3& theDir) const;
void Release (OpenGl_Context* theCtx);
+
};
private:
//! @param thaTx the X for vector of translation
//! @param thaTy the Y for vector of translation
//! @param thaTz the Z for vector of translation
- void renderLine (const OpenGl_PrimitiveArray* theLine,
- const Handle(OpenGl_Workspace)& theWorkspace,
- const OpenGl_Mat4& theMat,
- const Standard_ShortReal theXt,
- const Standard_ShortReal theYt,
- const Standard_ShortReal theZt) const;
+ void renderLine (const OpenGl_PrimitiveArray& theLine,
+ const Handle(OpenGl_Workspace)& theWorkspace,
+ const OpenGl_Mat4& theMat,
+ const Standard_ShortReal theXt,
+ const Standard_ShortReal theYt,
+ const Standard_ShortReal theZt) const;
//! Render grid lines perpendecular the axis of input index
//! @param theWorkspace [in] the OpenGl Workspace
const GridAxes& theGridAxes,
const Standard_ShortReal theDpix) const;
-
protected: //! @name Scene bounding box values
OpenGl_Vec3 myMin;
// function : ZBufferTriedronSetup
// purpose :
// =======================================================================
-void OpenGl_GraphicDriver::ZBufferTriedronSetup (const Quantity_NameOfColor theXColor,
+void OpenGl_GraphicDriver::ZBufferTriedronSetup (const Graphic3d_CView& theCView,
+ const Quantity_NameOfColor theXColor,
const Quantity_NameOfColor theYColor,
const Quantity_NameOfColor theZColor,
const Standard_Real theSizeRatio,
const Standard_Real theAxisDiametr,
- const Standard_Integer theNbFacettes)
+ const Standard_Integer theNbFacets)
{
- OpenGl_Trihedron::Setup (theXColor, theYColor, theZColor, theSizeRatio, theAxisDiametr, theNbFacettes);
+ const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
+ if (aCView == NULL)
+ {
+ return;
+ }
+
+ OpenGl_Trihedron& aTrih = aCView->View->ChangeTrihedron();
+ aTrih.SetArrowsColors (theXColor, theYColor, theZColor);
+ aTrih.SetSizeRatio (theSizeRatio);
+ aTrih.SetNbFacets (theNbFacets);
+ aTrih.SetArrowDiameter (theAxisDiametr);
}
// =======================================================================
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
if (aCView != NULL)
{
- aCView->View->TriedronDisplay (aCView->WS->GetGlContext(), thePosition, theColor, theScale, theAsWireframe);
+ aCView->View->TriedronDisplay (thePosition, theColor, theScale, theAsWireframe);
}
}
// purpose :
// =======================================================================
void OpenGl_GraphicDriver::GraduatedTrihedronMinMaxValues (const Graphic3d_CView& theView,
- const Graphic3d_Vec3 theMin,
- const Graphic3d_Vec3 theMax)
+ const Graphic3d_Vec3 theMin,
+ const Graphic3d_Vec3 theMax)
{
const OpenGl_CView* aCView = (const OpenGl_CView* )theView.ptrView;
if (aCView != NULL)
{
- aCView->View->GraduatedTrihedron()->SetMinMax (theMin, theMax);
+ aCView->View->ChangeGraduatedTrihedron().SetMinMax (theMin, theMax);
}
}
Standard_EXPORT void SetVisualisation (const Graphic3d_CView& ACView);
Standard_EXPORT Standard_Boolean View (Graphic3d_CView& ACView);
Standard_EXPORT void Environment (const Graphic3d_CView& ACView);
- Standard_EXPORT void ZBufferTriedronSetup (const Quantity_NameOfColor XColor = Quantity_NOC_RED, const Quantity_NameOfColor YColor = Quantity_NOC_GREEN, const Quantity_NameOfColor ZColor = Quantity_NOC_BLUE1, const Standard_Real SizeRatio = 0.8, const Standard_Real AxisDiametr = 0.05, const Standard_Integer NbFacettes = 12);
+ Standard_EXPORT void ZBufferTriedronSetup (const Graphic3d_CView& theCView,
+ const Quantity_NameOfColor XColor = Quantity_NOC_RED,
+ const Quantity_NameOfColor YColor = Quantity_NOC_GREEN,
+ const Quantity_NameOfColor ZColor = Quantity_NOC_BLUE1,
+ const Standard_Real SizeRatio = 0.8,
+ const Standard_Real AxisDiametr = 0.05,
+ const Standard_Integer NbFacettes = 12);
Standard_EXPORT void TriedronDisplay (const Graphic3d_CView& ACView, const Aspect_TypeOfTriedronPosition APosition = Aspect_TOTP_CENTER, const Quantity_NameOfColor AColor = Quantity_NOC_WHITE, const Standard_Real AScale = 0.02, const Standard_Boolean AsWireframe = Standard_True);
Standard_EXPORT void TriedronErase (const Graphic3d_CView& ACView);
Standard_EXPORT void TriedronEcho (const Graphic3d_CView& ACView, const Aspect_TypeOfTriedronEcho AType = Aspect_TOTE_NONE);
const Standard_Boolean theToKeepData) const
{
bool isNormalMode = theCtx->ToUseVbo();
+ clearMemoryGL (theCtx);
if (myAttribs.IsNull()
|| myAttribs->IsEmpty()
|| myAttribs->NbElements < 1
//! Notice that this flag does not indicate VBOs validity.
Standard_Boolean IsInitialized() const { return myIsVboInit; }
+ //! Invalidate VBO content without destruction.
+ void Invalidate() const { myIsVboInit = Standard_False; }
+
//! @return primitive type (GL_LINES, GL_TRIANGLES and others)
GLint DrawMode() const { return myDrawMode; }
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <OpenGl_View.hxx>
#include <OpenGl_Workspace.hxx>
+#include <Precision.hxx>
-static const OpenGl_TextParam THE_LABEL_PARAMS =
+namespace
{
- 16, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM
-};
-
-static const CALL_DEF_CONTEXTLINE myDefaultContextLine =
-{
- 1, //IsDef
- 1, //IsSet
- { 1.F, 1.F, 1.F }, //Color
- Aspect_TOL_SOLID, //LineType
- 1.F //Width
-};
-
-static const CALL_DEF_CONTEXTTEXT myDefaultContextText =
-{
- 1, //IsDef
- 1, //IsSet
- "Courier", //Font
- 0.3F, //Space
- 1.0F, //Expan
- { 1.F, 1.F, 1.F }, //Color
- Aspect_TOST_NORMAL, //Style
- Aspect_TODT_NORMAL, //DisplayType
- { 1.F, 1.F, 1.F }, //ColorSubTitle
- 0, //TextZoomable
- 0.F, //TextAngle
- Font_FA_Regular //TextFontAspect
-};
-
-static TEL_COLOUR theXColor = {{ 1.F, 0.F, 0.F, 0.6F }};
-static TEL_COLOUR theYColor = {{ 0.F, 1.F, 0.F, 0.6F }};
-static TEL_COLOUR theZColor = {{ 0.F, 0.F, 1.F, 0.6F }};
-static float theRatio = 0.8f;
-static float theDiameter = 0.05f;
-static int theNbFacettes = 12;
+ static const OpenGl_TextParam THE_LABEL_PARAMS =
+ {
+ 16, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM
+ };
+}
// =======================================================================
// function : resetTransformations
anCircleArray->Attributes(), anCircleArray->Bounds());
}
- if (!myDisk.IsDefined())
+ if (!myDisk.IsInitialized())
{
myDisk.Init (0.0, static_cast<GLfloat> (aConeDiametr), myNbFacettes, 1);
}
- if (!myCone.IsDefined())
+ if (!myCone.IsInitialized())
{
myCone.Init (static_cast<GLfloat> (aConeDiametr), 0.0f, static_cast<GLfloat> (aConeLength), myNbFacettes, 1);
}
OpenGl_AspectFace anAspectY;
OpenGl_AspectFace anAspectZ;
OpenGl_AspectLine anAspectLine;
- memcpy (anAspectX.ChangeIntFront().matcol.rgb, myXColor.rgb, sizeof (TEL_COLOUR));
- memcpy (anAspectY.ChangeIntFront().matcol.rgb, myYColor.rgb, sizeof (TEL_COLOUR));
- memcpy (anAspectZ.ChangeIntFront().matcol.rgb, myZColor.rgb, sizeof (TEL_COLOUR));
+ memcpy (anAspectX.ChangeIntFront().matcol.rgb, myXColor.GetData(), sizeof (TEL_COLOUR));
+ memcpy (anAspectY.ChangeIntFront().matcol.rgb, myYColor.GetData(), sizeof (TEL_COLOUR));
+ memcpy (anAspectZ.ChangeIntFront().matcol.rgb, myZColor.GetData(), sizeof (TEL_COLOUR));
OpenGl_Mat4d aModelMatrix;
aModelMatrix.Convert (aContext->WorldViewState.Current());
OpenGl_Mat4d aModelViewX (aModelMatrix);
// Set line aspect
const OpenGl_AspectLine* aCurrentAspectLine = theWorkspace->AspectLine (Standard_True);
CALL_DEF_CONTEXTLINE aLineAspect = {1, 1, { 1.F, 1.F, 1.F }, aCurrentAspectLine->Type(), aCurrentAspectLine->Width()};
- aLineAspect.Color.r = myZColor.rgb[0];
- aLineAspect.Color.g = myZColor.rgb[1];
- aLineAspect.Color.b = myZColor.rgb[2];
+ aLineAspect.Color.r = myZColor.r();
+ aLineAspect.Color.g = myZColor.g();
+ aLineAspect.Color.b = myZColor.b();
anAspectLine.SetAspect (aLineAspect);
// Disable depth test and face culling
aContext->WorldViewState.SetCurrent<Standard_Real> (aModelViewX);
aContext->ApplyWorldViewMatrix();
- aLineAspect.Color.r = myXColor.rgb[0];
- aLineAspect.Color.g = myXColor.rgb[1];
- aLineAspect.Color.b = myXColor.rgb[2];
+ aLineAspect.Color.r = myXColor.r();
+ aLineAspect.Color.g = myXColor.g();
+ aLineAspect.Color.b = myXColor.b();
anAspectLine.SetAspect (aLineAspect);
theWorkspace->SetAspectLine (&anAspectLine);
myLine.Render (theWorkspace);
aContext->WorldViewState.SetCurrent<Standard_Real> (aModelViewY);
aContext->ApplyWorldViewMatrix();
- aLineAspect.Color.r = myYColor.rgb[0];
- aLineAspect.Color.g = myYColor.rgb[1];
- aLineAspect.Color.b = myYColor.rgb[2];
+ aLineAspect.Color.r = myYColor.r();
+ aLineAspect.Color.g = myYColor.g();
+ aLineAspect.Color.b = myYColor.b();
anAspectLine.SetAspect (aLineAspect);
theWorkspace->SetAspectLine (&anAspectLine);
myLine.Render (theWorkspace);
// =======================================================================
void OpenGl_Trihedron::redrawZBuffer (const Handle(OpenGl_Workspace)& theWorkspace) const
{
- Handle(OpenGl_Context) aContext = theWorkspace->GetGlContext();
+ Handle(OpenGl_Context) aContext = theWorkspace->GetGlContext();
aContext->WorldViewState.Push();
aContext->ProjectionState.Push();
resetTransformations (theWorkspace);
- GLdouble aScale = myScale;
- aScale *= myRatio;
+ const GLdouble aScale = myScale * myRatio;
const OpenGl_AspectLine* anAspectLine = theWorkspace->AspectLine (Standard_True);
const TEL_COLOUR& aLineColor = anAspectLine->Color();
// Position des Axes
GLdouble aTriedronAxeX[3] = { aScale, 0.0, 0.0 };
GLdouble aTriedronAxeY[3] = { 0.0, aScale, 0.0 };
- if (!myDisk.IsDefined())
+ if (!myDisk.IsInitialized())
{
myDisk.Init (static_cast<GLfloat> (aCylinderDiametr),
static_cast<GLfloat> (aConeDiametr),
myNbFacettes, 1);
}
- if (!mySphere.IsDefined())
+ if (!mySphere.IsInitialized())
{
mySphere.Init (static_cast<GLfloat> (aCylinderDiametr * 2.0), myNbFacettes, myNbFacettes);
}
- if (!myCone.IsDefined())
+ if (!myCone.IsInitialized())
{
myCone.Init (static_cast<GLfloat> (aConeDiametr), 0.0f, static_cast<GLfloat> (aConeLength), myNbFacettes, 1);
}
- if (!myCylinder.IsDefined())
+ if (!myCylinder.IsInitialized())
{
myCylinder.Init (static_cast<GLfloat> (aCylinderDiametr),
static_cast<GLfloat> (aCylinderDiametr),
OpenGl_AspectFace anAspectX;
OpenGl_AspectFace anAspectY;
OpenGl_AspectFace anAspectZ;
- memcpy (anAspectX.ChangeIntFront().matcol.rgb, myXColor.rgb, sizeof (TEL_COLOUR));
- memcpy (anAspectY.ChangeIntFront().matcol.rgb, myYColor.rgb, sizeof (TEL_COLOUR));
- memcpy (anAspectZ.ChangeIntFront().matcol.rgb, myZColor.rgb, sizeof (TEL_COLOUR));
- memcpy (anAspectC.ChangeIntFront().matcol.rgb, aLineColor.rgb, sizeof (TEL_COLOUR));
+ memcpy (anAspectX.ChangeIntFront().matcol.rgb, myXColor.GetData(), sizeof (TEL_COLOUR));
+ memcpy (anAspectY.ChangeIntFront().matcol.rgb, myYColor.GetData(), sizeof (TEL_COLOUR));
+ memcpy (anAspectZ.ChangeIntFront().matcol.rgb, myZColor.GetData(), sizeof (TEL_COLOUR));
+ memcpy (anAspectC.ChangeIntFront().matcol.rgb, aLineColor.rgb, sizeof (TEL_COLOUR));
OpenGl_Mat4d aModelMatrix;
aModelMatrix.Convert (aContext->WorldViewState.Current());
// function : OpenGl_Trihedron
// purpose :
// =======================================================================
-OpenGl_Trihedron::OpenGl_Trihedron (const Aspect_TypeOfTriedronPosition thePosition,
- const Quantity_NameOfColor theColor,
- const Standard_Real theScale,
- const Standard_Boolean theAsWireframe)
-: myPos (thePosition),
- myScale (theScale),
- myIsWireframe (theAsWireframe),
+OpenGl_Trihedron::OpenGl_Trihedron()
+: myPos (Aspect_TOTP_LEFT_LOWER),
+ myScale (1.0),
+ myIsWireframe (Standard_False),
+ myXColor (1.0f, 0.0f, 0.0f, 0.6f),
+ myYColor (0.0f, 1.0f, 0.0f, 0.6f),
+ myZColor (0.0f, 0.0f, 1.0f, 0.6f),
+ myRatio (0.8f),
+ myDiameter (0.05f),
+ myNbFacettes (12),
myLabelX ("X", OpenGl_Vec3(1.0f, 0.0f, 0.0f), THE_LABEL_PARAMS),
myLabelY ("Y", OpenGl_Vec3(0.0f, 1.0f, 0.0f), THE_LABEL_PARAMS),
myLabelZ ("Z", OpenGl_Vec3(0.0f, 0.0f, 1.0f), THE_LABEL_PARAMS),
myLine (NULL), // do not register arrays UID - trihedron is not intended to be drawn by Ray Tracing engine
myCircle (NULL)
{
- Standard_Real R,G,B;
- Quantity_Color aColor (theColor);
- aColor.Values (R, G, B, Quantity_TOC_RGB);
-
- CALL_DEF_CONTEXTLINE aLineAspect = myDefaultContextLine;
- aLineAspect.Color.r = (float)R;
- aLineAspect.Color.g = (float)G;
- aLineAspect.Color.b = (float)B;
- myAspectLine.SetAspect (aLineAspect);
-
- CALL_DEF_CONTEXTTEXT aTextAspect = myDefaultContextText;
- aTextAspect.Color.r = (float)R;
- aTextAspect.Color.g = (float)G;
- aTextAspect.Color.b = (float)B;
- myAspectText.SetAspect (aTextAspect);
-
- myXColor = theXColor;
- myYColor = theYColor;
- myZColor = theZColor;
-
- myRatio = theRatio;
- myDiameter = theDiameter;
- myNbFacettes = theNbFacettes;
+ const TEL_COLOUR aWhiteColor = {{ 1.0f, 1.0f, 1.0f, 1.0f }};
+ myAspectLine.ChangeColor() = aWhiteColor;
+ myAspectText.ChangeColor() = aWhiteColor;
+ myAspectText.ChangeFontName() = "Courier";
}
// =======================================================================
myCircle.Release (theCtx);
}
+// =======================================================================
+// function : invalidate
+// purpose :
+// =======================================================================
+void OpenGl_Trihedron::invalidate()
+{
+ myCone .Invalidate();
+ myDisk .Invalidate();
+ mySphere .Invalidate();
+ myCylinder.Invalidate();
+ myLine .Invalidate();
+ myCircle .Invalidate();
+}
+
+// =======================================================================
+// function : SetScale
+// purpose :
+// =======================================================================
+void OpenGl_Trihedron::SetScale (const Standard_Real theScale)
+{
+ if (Abs (myScale - theScale) > Precision::Confusion())
+ {
+ invalidate();
+ }
+ myScale = theScale;
+}
+
+// =======================================================================
+// function : SetSizeRatio
+// purpose :
+// =======================================================================
+void OpenGl_Trihedron::SetSizeRatio (const Standard_Real theRatio)
+{
+ if (Abs (Standard_Real(myRatio) - theRatio) > Precision::Confusion())
+ {
+ invalidate();
+ }
+ myRatio = float(theRatio);
+}
+
+// =======================================================================
+// function : SetArrowDiameter
+// purpose :
+// =======================================================================
+void OpenGl_Trihedron::SetArrowDiameter (const Standard_Real theDiam)
+{
+ if (Abs (Standard_Real(myDiameter) - theDiam) > Precision::Confusion())
+ {
+ invalidate();
+ }
+ myDiameter = float(theDiam);
+}
+
+// =======================================================================
+// function : SetNbFacets
+// purpose :
+// =======================================================================
+void OpenGl_Trihedron::SetNbFacets (const Standard_Integer theNbFacets)
+{
+ if (Abs (myNbFacettes - theNbFacets) > 0)
+ {
+ invalidate();
+ }
+ myNbFacettes = theNbFacets;
+}
+
+// =======================================================================
+// function : SetLabelsColor
+// purpose :
+// =======================================================================
+void OpenGl_Trihedron::SetLabelsColor (const Quantity_Color& theColor)
+{
+ myAspectText.ChangeColor().rgb[0] = float(theColor.Red());
+ myAspectText.ChangeColor().rgb[1] = float(theColor.Green());
+ myAspectText.ChangeColor().rgb[2] = float(theColor.Blue());
+}
+
+// =======================================================================
+// function : SetArrowsColors
+// purpose :
+// =======================================================================
+void OpenGl_Trihedron::SetArrowsColors (const Quantity_Color& theColorX,
+ const Quantity_Color& theColorY,
+ const Quantity_Color& theColorZ)
+{
+ myXColor = OpenGl_Vec4 (float(theColorX.Red()), float(theColorX.Green()), float(theColorX.Blue()), 0.6f);
+ myYColor = OpenGl_Vec4 (float(theColorY.Red()), float(theColorY.Green()), float(theColorY.Blue()), 0.6f);
+ myZColor = OpenGl_Vec4 (float(theColorZ.Red()), float(theColorZ.Green()), float(theColorZ.Blue()), 0.6f);
+}
+
// =======================================================================
// function : Render
// purpose :
theWorkspace->SetAspectText (aPrevAspectText);
theWorkspace->SetAspectLine (aPrevAspectLine);
}
-
-/*----------------------------------------------------------------------*/
-//call_ztriedron_setup
-void OpenGl_Trihedron::Setup (const Quantity_NameOfColor XColor, const Quantity_NameOfColor YColor, const Quantity_NameOfColor ZColor,
- const Standard_Real SizeRatio, const Standard_Real AxisDiametr, const Standard_Integer NbFacettes)
-{
- Standard_Real R,G,B;
-
- Quantity_Color(XColor).Values(R, G, B, Quantity_TOC_RGB);
- theXColor.rgb[0] = float (R);
- theXColor.rgb[1] = float (G);
- theXColor.rgb[2] = float (B);
-
- Quantity_Color(YColor).Values(R, G, B, Quantity_TOC_RGB);
- theYColor.rgb[0] = float (R);
- theYColor.rgb[1] = float (G);
- theYColor.rgb[2] = float (B);
-
- Quantity_Color(ZColor).Values(R, G, B, Quantity_TOC_RGB);
- theZColor.rgb[0] = float (R);
- theZColor.rgb[1] = float (G);
- theZColor.rgb[2] = float (B);
-
- theRatio = float (SizeRatio);
- theDiameter = float (AxisDiametr);
- theNbFacettes = NbFacettes;
-}
{
public:
- static void Setup(const Quantity_NameOfColor theXColor,
- const Quantity_NameOfColor theYColor,
- const Quantity_NameOfColor theZColor,
- const Standard_Real theSizeRatio,
- const Standard_Real theAxisDiametr,
- const Standard_Integer theNbFacettes);
+ //! Default constructor.
+ OpenGl_Trihedron();
+
+ //! Destructor.
+ virtual ~OpenGl_Trihedron();
+
+ //! Render the element.
+ virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
+
+ //! Release OpenGL resources.
+ virtual void Release (OpenGl_Context* theCtx);
public:
- OpenGl_Trihedron(const Aspect_TypeOfTriedronPosition thePosition,
- const Quantity_NameOfColor theColor,
- const Standard_Real theScale,
- const Standard_Boolean theAsWireframe);
+ //! Switch wireframe / shaded trihedron.
+ void SetWireframe (const Standard_Boolean theAsWireframe) { myIsWireframe = theAsWireframe; }
+
+ //! Setup the corner to draw the trihedron.
+ void SetPosition (const Aspect_TypeOfTriedronPosition thePosition) { myPos = thePosition; }
+
+ //! Setup the scale factor.
+ void SetScale (const Standard_Real theScale);
- virtual void Render(const Handle(OpenGl_Workspace)& theWorkspace) const;
- virtual void Release(OpenGl_Context* theCtx);
+ //! Setup the size ratio factor.
+ void SetSizeRatio (const Standard_Real theRatio);
+
+ //! Setup the arrow diameter.
+ void SetArrowDiameter (const Standard_Real theDiam);
+
+ //! Setup the number of facets for tessellation.
+ void SetNbFacets (const Standard_Integer theNbFacets);
+
+ //! Setup color of text labels.
+ void SetLabelsColor (const Quantity_Color& theColor);
+
+ //! Setup per-arrow color.
+ void SetArrowsColors (const Quantity_Color& theColorX,
+ const Quantity_Color& theColorY,
+ const Quantity_Color& theColorZ);
protected:
- virtual ~OpenGl_Trihedron();
+ //! Invalidate Primitve Arrays.
+ void invalidate();
void redraw(const Handle(OpenGl_Workspace)& theWorkspace) const;
void redrawZBuffer(const Handle(OpenGl_Workspace)& theWorkspace) const;
- //! Resets current model-view and projection transfprmations and sets
+ //! Resets current model-view and projection transformations and sets
//! translation for trihedron position
//! @sa Aspect_TypeOfTriedronPosition
void resetTransformations (const Handle(OpenGl_Workspace)& theWorkspace) const;
Aspect_TypeOfTriedronPosition myPos;
Standard_Real myScale;
Standard_Boolean myIsWireframe;
- // Parameters for z-buffered mode
- TEL_COLOUR myXColor;
- TEL_COLOUR myYColor;
- TEL_COLOUR myZColor;
+ OpenGl_Vec4 myXColor;
+ OpenGl_Vec4 myYColor;
+ OpenGl_Vec4 myZColor;
float myRatio;
float myDiameter;
int myNbFacettes;
myZClip(myDefaultZClip),
myCamera(AContext.Camera),
myFog(myDefaultFog),
- myTrihedron(NULL),
- myGraduatedTrihedron(NULL),
+ myToShowTrihedron (false),
+ myToShowGradTrihedron (false),
myVisualization(AContext.Visualization),
myShadingModel ((Visual3d_TypeOfModel )AContext.Model),
myAntiAliasing(Standard_False),
OpenGl_View::~OpenGl_View()
{
ReleaseGlResources (NULL); // ensure ReleaseGlResources() was called within valid context
- OpenGl_Element::Destroy (NULL, myTrihedron);
- OpenGl_Element::Destroy (NULL, myGraduatedTrihedron);
OpenGl_Element::Destroy (NULL, myBgGradientArray);
OpenGl_Element::Destroy (NULL, myBgTextureArray);
OpenGl_Element::Destroy (NULL, myTextureParams);
void OpenGl_View::ReleaseGlResources (const Handle(OpenGl_Context)& theCtx)
{
- if (myTrihedron != NULL)
- {
- myTrihedron->Release (theCtx.operator->());
- }
- if (myGraduatedTrihedron != NULL)
- {
- myGraduatedTrihedron->Release (theCtx.operator->());
- }
+ myTrihedron .Release (theCtx.operator->());
+ myGraduatedTrihedron.Release (theCtx.operator->());
if (!myTextureEnv.IsNull())
{
/*----------------------------------------------------------------------*/
-void OpenGl_View::TriedronDisplay (const Handle(OpenGl_Context)& theCtx,
- const Aspect_TypeOfTriedronPosition thePosition,
+void OpenGl_View::TriedronDisplay (const Aspect_TypeOfTriedronPosition thePosition,
const Quantity_NameOfColor theColor,
const Standard_Real theScale,
const Standard_Boolean theAsWireframe)
{
- OpenGl_Element::Destroy (theCtx.operator->(), myTrihedron);
- myTrihedron = new OpenGl_Trihedron (thePosition, theColor, theScale, theAsWireframe);
+ myToShowTrihedron = true;
+ myTrihedron.SetWireframe (theAsWireframe);
+ myTrihedron.SetPosition (thePosition);
+ myTrihedron.SetScale (theScale);
+ myTrihedron.SetLabelsColor (theColor);
}
/*----------------------------------------------------------------------*/
void OpenGl_View::TriedronErase (const Handle(OpenGl_Context)& theCtx)
{
- OpenGl_Element::Destroy (theCtx.operator->(), myTrihedron);
+ myToShowTrihedron = false;
+ myTrihedron.Release (theCtx.operator->());
}
/*----------------------------------------------------------------------*/
-void OpenGl_View::GraduatedTrihedronDisplay (const Handle(OpenGl_Context)& theCtx,
+void OpenGl_View::GraduatedTrihedronDisplay (const Handle(OpenGl_Context)& theCtx,
const Graphic3d_GraduatedTrihedron& theData)
{
- OpenGl_Element::Destroy (theCtx.operator->(), myGraduatedTrihedron);
- myGraduatedTrihedron = new OpenGl_GraduatedTrihedron (theData);
+ myToShowGradTrihedron = true;
+ myGraduatedTrihedron.SetValues (theCtx, theData);
}
/*----------------------------------------------------------------------*/
void OpenGl_View::GraduatedTrihedronErase (const Handle(OpenGl_Context)& theCtx)
{
- OpenGl_Element::Destroy (theCtx.operator->(), myGraduatedTrihedron);
+ myToShowGradTrihedron = false;
+ myGraduatedTrihedron.Release (theCtx.operator->());
}
/*----------------------------------------------------------------------*/
#include <OpenGl_LayerList.hxx>
#include <OpenGl_Light.hxx>
#include <OpenGl_LineAttributes.hxx>
+#include <OpenGl_Trihedron.hxx>
+#include <OpenGl_GraduatedTrihedron.hxx>
#include <Handle_OpenGl_Context.hxx>
#include <Handle_OpenGl_GraphicDriver.hxx>
};
struct OpenGl_Matrix;
-class OpenGl_GraduatedTrihedron;
class OpenGl_Structure;
-class OpenGl_Trihedron;
class Handle(OpenGl_PrinterContext);
class OpenGl_StateCounter;
void SetFog (const Graphic3d_CView& theCView, const Standard_Boolean theFlag);
- void TriedronDisplay (const Handle(OpenGl_Context)& theCtx,
- const Aspect_TypeOfTriedronPosition thePosition,
+ OpenGl_Trihedron& ChangeTrihedron() { return myTrihedron; }
+ void TriedronDisplay (const Aspect_TypeOfTriedronPosition thePosition,
const Quantity_NameOfColor theColor,
const Standard_Real theScale,
const Standard_Boolean theAsWireframe);
void TriedronErase (const Handle(OpenGl_Context)& theCtx);
- OpenGl_GraduatedTrihedron* GraduatedTrihedron() const { return myGraduatedTrihedron; }
+ OpenGl_GraduatedTrihedron& ChangeGraduatedTrihedron() { return myGraduatedTrihedron; }
void GraduatedTrihedronDisplay (const Handle(OpenGl_Context)& theCtx,
const Graphic3d_GraduatedTrihedron& theCubic);
void GraduatedTrihedronErase (const Handle(OpenGl_Context)& theCtx);
Handle(Graphic3d_Camera) myCamera;
OPENGL_FOG myFog;
- OpenGl_Trihedron* myTrihedron;
- OpenGl_GraduatedTrihedron* myGraduatedTrihedron;
+ OpenGl_Trihedron myTrihedron;
+ OpenGl_GraduatedTrihedron myGraduatedTrihedron;
+ bool myToShowTrihedron;
+ bool myToShowGradTrihedron;
//View_LABViewContext
int myVisualization;
void OpenGl_View::RedrawTrihedron (const Handle(OpenGl_Workspace) &theWorkspace)
{
// display global trihedron
- if (myTrihedron != NULL)
+ if (myToShowTrihedron)
{
- myTrihedron->Render (theWorkspace);
+ myTrihedron.Render (theWorkspace);
}
- if (myGraduatedTrihedron != NULL)
+ if (myToShowGradTrihedron)
{
- myGraduatedTrihedron->Render (theWorkspace);
+ myGraduatedTrihedron.Render (theWorkspace);
}
}
---Category: Graduated trihedron
---------------------------------
- GetGraduatedTrihedron(me;
- theTrigedronData: out GraduatedTrihedron from Graphic3d)
+ GetGraduatedTrihedron (me)
+ returns GraduatedTrihedron from Graphic3d
---Purpose: Returns data of a graduated trihedron.
+ ---C++: return const&
is static;
GraduatedTrihedronDisplay(me : mutable;
MyView->TriedronEcho (AType);
}
-void V3d_View::GetGraduatedTrihedron (Graphic3d_GraduatedTrihedron& theTrihedronData) const
+const Graphic3d_GraduatedTrihedron& V3d_View::GetGraduatedTrihedron() const
{
- MyView->GetGraduatedTrihedron (theTrihedronData);
+ return MyView->GetGraduatedTrihedron();
}
void V3d_View::GraduatedTrihedronDisplay(const Graphic3d_GraduatedTrihedron& theTrihedronData)
ViewerTest_VoxelCommands.cxx
ViewerTest_OpenGlCommands.cxx
ViewerTest_ViewerCommands_1.mm
+ViewerTest.hxx
+ViewerTest.cxx
MapTransientHasher from TColStd,
AsciiString from TCollection);
-
- -- ----------------------------------------------------------------------
- -- Package methods
- -- ----------------------------------------------------------------------
-
- Factory (theDI : out Interpretor from Draw);
- ---Purpose: Loads all Draw commands of V2d & V3d. Used for plugin.
-
- ---Category: Create the viewer....
-
- ViewerInit ( thePxLeft, thePxTop : Integer from Standard = 0;
- thePxWidth, thePxHeight : Integer from Standard = 0;
- theViewName : CString from Standard = "";
- theDisplayName : CString from Standard = "")
- returns AsciiString from TCollection;
- ---Purpose: Creates view with default or custom name
- -- and add this name in map to manage muliple views
- -- implemented in ViewerTest_ViewerCommands.cxx
-
- ---Category: Manage the name of views
- RemoveViewName (theName: AsciiString from TCollection);
-
- InitViewName (theName: AsciiString from TCollection;
- theView: View from V3d);
-
- GetCurrentViewName returns AsciiString from TCollection;
-
- ---Category: Delete the viewer....
- RemoveView (theViewName : AsciiString from TCollection;
- theToRemoveContext : Boolean from Standard = Standard_True);
- ---Purpose: Removes view and clear all maps
- -- with information about its resources if neccessary
-
- ---Category: Delete the viewer....
- RemoveView (theView : View from V3d;
- theToRemoveContext : Boolean from Standard = Standard_True);
- ---Purpose: Removes view and clear all maps
- -- with information about its resources if neccessary
-
- ---Category: Selection in the viewer....
-
- WClass returns TShared from MMgt is private;
- ---C++: return const &
- ---Purpose: Returns a window class that implements standard behavior of
- -- all windows of the ViewerTest. This includes usual Open CASCADE
- -- view conventions for mouse buttons (e.g. Ctrl+MB1 for zoom,
- -- Ctrl+MB2 for pan, etc) and keyboard shortcuts.
- -- This method is relevant for MS Windows only and respectively
- -- returns WNT_WClass handle.
-
- PickShape (aType : ShapeEnum from TopAbs;
- MaxPick : Integer from Standard = 5) returns Shape from TopoDS;
- ---Purpose: waits until a shape of type <aType> is picked in the AIS Viewer and returns it.
- -- if <aType> == TopAbs_Shape, any shape can be picked...
- -- MaxPick is the Max number before exiting, if no pick is successfull
-
-
- PickShapes (aType : ShapeEnum from TopAbs;
- thepicked : in out HArray1OfShape from TopTools;
- MaxPick : Integer from Standard = 5)
- returns Boolean from Standard;
- ---Purpose: wait until the array is filled with picked shapes.
- -- returns True if the array is filled.
- -- exit if number of unsuccesfull picks = <MaxPick>
-
- PickObject(Type : KindOfInteractive from AIS = AIS_KOI_None;
- Signature : Integer from Standard = -1;
- MaxPick : Integer from Standard = 5)
- returns InteractiveObject from AIS;
- ---Purpose: waits until an interactive object of a given Type
- -- and signature is picked (defaut values authorize
- -- selection of any Interactive Object)
- -- exit if number of unsuccesfull picks = <MaxPick>
-
- PickObjects(thepicked : in out HArray1OfTransient from TColStd;
- Type : KindOfInteractive from AIS = AIS_KOI_None;
- Signature : Integer from Standard = -1;
- MaxPick : Integer from Standard = 5)
- returns Boolean from Standard;
- ---Purpose: selection of several interactive objects. Number is given
- -- by the size of <thepicked>
- -- exit if number of unsuccesfull picks = <MaxPick>
-
-
- Commands (theCommands : in out Interpretor from Draw);
- AviCommands(theCommands :in out Interpretor from Draw);
- ViewerCommands(theCommands :in out Interpretor from Draw);
- MyCommands (theCommands : in out Interpretor from Draw); -- My Own Com-s
- RelationCommands(theCommands :in out Interpretor from Draw);
- ObjectCommands(theCommands :in out Interpretor from Draw);
- FilletCommands(theCommands :in out Interpretor from Draw);
- VoxelCommands(theCommands :in out Interpretor from Draw);
- OpenGlCommands(theCommands :in out Interpretor from Draw);
-
- GetMousePosition(xpix,ypix: out Integer from Standard);
-
- GetViewerFromContext returns Viewer from V3d;
-
- GetCollectorFromContext returns Viewer from V3d;
-
- GetAISContext returns InteractiveContext from AIS;
- ---C++: return const &
- GetNISContext returns InteractiveContext from NIS;
- ---C++: return &
-
- SetAISContext (aContext: InteractiveContext from AIS);
-
- SetNISContext (aContext: InteractiveContext from NIS);
-
- CurrentView returns View from V3d;
- ---C++: return const &
-
- CurrentView (aViou:View from V3d);
-
- Clear ;
-
- ---Category: Change behaviour on move,select,... events.
-
- SetEventManager (aMgr:EventManager from ViewerTest);
- ---Purpose: puts <aMgr> as current eventmanager (the
- -- move,select,...will be applied to <aMgr>
-
- UnsetEventManager;
- ---Purpose: removes the last EventManager from the list.
-
- ResetEventManager;
- ---Purpose: clear the list of EventManagers and
- -- sets the default EventManager as current
-
- CurrentEventManager returns EventManager from ViewerTest;
-
-
- ---Category: privateMethods...
-
-
- RemoveSelected;
-
- StandardModeActivation(Mode : Integer from Standard);
-
- GetColorFromName(name: CString from Standard)
- returns NameOfColor from Quantity;
-
- RedrawAllViews;
- ---Purpose: redraws all defined views.
-
- SplitParameter (theString : AsciiString from TCollection;
- theName : out AsciiString from TCollection;
- theValue : out AsciiString from TCollection)
- returns Boolean from Standard;
- ---Purpose: Splits "parameter=value" string into separate
- -- parameter and value strings.
- -- @return TRUE if the string matches pattern "<string>=<empty or string>"
end;
return aColor;
}
+//=======================================================================
+//function : ParseColor
+//purpose :
+//=======================================================================
+
+Standard_Integer ViewerTest::ParseColor (Standard_Integer theArgNb,
+ const char** theArgVec,
+ Quantity_Color& theColor)
+{
+ Quantity_NameOfColor aColor = Quantity_NOC_BLACK;
+ if (theArgNb >= 1
+ && Quantity_Color::ColorFromName (theArgVec[0], aColor))
+ {
+ theColor = aColor;
+ return 1;
+ }
+ else if (theArgNb >= 3)
+ {
+ const TCollection_AsciiString anRgbStr[3] =
+ {
+ theArgVec[0],
+ theArgVec[1],
+ theArgVec[2]
+ };
+ if (!anRgbStr[0].IsRealValue()
+ || !anRgbStr[1].IsRealValue()
+ || !anRgbStr[2].IsRealValue())
+ {
+ return 0;
+ }
+
+ Graphic3d_Vec4d anRgb;
+ anRgb.x() = anRgbStr[0].RealValue();
+ anRgb.y() = anRgbStr[1].RealValue();
+ anRgb.z() = anRgbStr[2].RealValue();
+ if (anRgb.x() < 0.0 || anRgb.x() > 1.0
+ || anRgb.y() < 0.0 || anRgb.y() > 1.0
+ || anRgb.z() < 0.0 || anRgb.z() > 1.0)
+ {
+ std::cout << "Error: RGB color values should be within range 0..1!\n";
+ return 0;
+ }
+
+ theColor.SetValues (anRgb.x(), anRgb.y(), anRgb.z(), Quantity_TOC_RGB);
+ return 3;
+ }
+
+ return 0;
+}
+
//=======================================================================
//function : GetTypeNames
//purpose :
--- /dev/null
+// Copyright (c) 1997-1999 Matra Datavision
+// Copyright (c) 1999-2015 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 _ViewerTest_HeaderFile
+#define _ViewerTest_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Macro.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <Standard_Integer.hxx>
+#include <Standard_CString.hxx>
+#include <Handle_V3d_View.hxx>
+#include <Standard_Boolean.hxx>
+#include <Handle_MMgt_TShared.hxx>
+#include <TopAbs_ShapeEnum.hxx>
+#include <Handle_TopTools_HArray1OfShape.hxx>
+#include <Handle_AIS_InteractiveObject.hxx>
+#include <AIS_KindOfInteractive.hxx>
+#include <Handle_TColStd_HArray1OfTransient.hxx>
+#include <Handle_V3d_Viewer.hxx>
+#include <Handle_AIS_InteractiveContext.hxx>
+#include <NIS_InteractiveContext.hxx>
+#include <Handle_ViewerTest_EventManager.hxx>
+#include <Quantity_NameOfColor.hxx>
+
+class TCollection_AsciiString;
+class V3d_View;
+class MMgt_TShared;
+class TopoDS_Shape;
+class TopTools_HArray1OfShape;
+class AIS_InteractiveObject;
+class TColStd_HArray1OfTransient;
+class V3d_Viewer;
+class AIS_InteractiveContext;
+class ViewerTest_EventManager;
+class ViewerTest_EventManager;
+class ViewerTest_DoubleMapOfInteractiveAndName;
+class ViewerTest_DoubleMapNodeOfDoubleMapOfInteractiveAndName;
+class ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName;
+class Quantity_Color;
+
+class ViewerTest
+{
+public:
+
+ DEFINE_STANDARD_ALLOC
+
+ //! Loads all Draw commands of V2d & V3d. Used for plugin.
+ Standard_EXPORT static void Factory (Draw_Interpretor& theDI);
+
+ //! Creates view with default or custom name
+ //! and add this name in map to manage muliple views
+ //! implemented in ViewerTest_ViewerCommands.cxx
+ Standard_EXPORT static TCollection_AsciiString ViewerInit (const Standard_Integer thePxLeft = 0,
+ const Standard_Integer thePxTop = 0,
+ const Standard_Integer thePxWidth = 0,
+ const Standard_Integer thePxHeight = 0,
+ const Standard_CString theViewName = "",
+ const Standard_CString theDisplayName = "");
+
+ Standard_EXPORT static void RemoveViewName (const TCollection_AsciiString& theName);
+
+ Standard_EXPORT static void InitViewName (const TCollection_AsciiString& theName,
+ const Handle(V3d_View)& theView);
+
+ Standard_EXPORT static TCollection_AsciiString GetCurrentViewName();
+
+ //! Removes view and clear all maps
+ //! with information about its resources if necessary
+ Standard_EXPORT static void RemoveView (const TCollection_AsciiString& theViewName,
+ const Standard_Boolean theToRemoveContext = Standard_True);
+
+ //! Removes view and clear all maps
+ //! with information about its resources if necessary
+ Standard_EXPORT static void RemoveView (const Handle(V3d_View)& theView,
+ const Standard_Boolean theToRemoveContext = Standard_True);
+
+ //! waits until a shape of type <aType> is picked in the AIS Viewer and returns it.
+ //! if <aType> == TopAbs_Shape, any shape can be picked...
+ //! MaxPick is the Max number before exiting, if no pick is successful
+ Standard_EXPORT static TopoDS_Shape PickShape (const TopAbs_ShapeEnum aType,
+ const Standard_Integer MaxPick = 5);
+
+ //! wait until the array is filled with picked shapes.
+ //! returns True if the array is filled.
+ //! exit if number of unsuccessful picks = <MaxPick>
+ Standard_EXPORT static Standard_Boolean PickShapes (const TopAbs_ShapeEnum aType,
+ Handle(TopTools_HArray1OfShape)& thepicked,
+ const Standard_Integer MaxPick = 5);
+
+ //! waits until an interactive object of a given Type
+ //! and signature is picked (default values authorize
+ //! selection of any Interactive Object)
+ //! exit if number of unsuccessful picks = <MaxPick>
+ Standard_EXPORT static Handle(AIS_InteractiveObject) PickObject (const AIS_KindOfInteractive Type = AIS_KOI_None,
+ const Standard_Integer Signature = -1,
+ const Standard_Integer MaxPick = 5);
+
+ //! selection of several interactive objects.
+ //! Number is given by the size of <thepicked>
+ //! exit if number of unsuccesfull picks = <MaxPick>
+ Standard_EXPORT static Standard_Boolean PickObjects (Handle(TColStd_HArray1OfTransient)& thepicked,
+ const AIS_KindOfInteractive Type = AIS_KOI_None,
+ const Standard_Integer Signature = -1,
+ const Standard_Integer MaxPick = 5);
+
+ Standard_EXPORT static void Commands (Draw_Interpretor& theCommands);
+
+ Standard_EXPORT static void AviCommands (Draw_Interpretor& theCommands);
+
+ Standard_EXPORT static void ViewerCommands (Draw_Interpretor& theCommands);
+
+ Standard_EXPORT static void MyCommands (Draw_Interpretor& theCommands);
+
+ Standard_EXPORT static void RelationCommands (Draw_Interpretor& theCommands);
+
+ Standard_EXPORT static void ObjectCommands (Draw_Interpretor& theCommands);
+
+ Standard_EXPORT static void FilletCommands (Draw_Interpretor& theCommands);
+
+ Standard_EXPORT static void VoxelCommands (Draw_Interpretor& theCommands);
+
+ Standard_EXPORT static void OpenGlCommands (Draw_Interpretor& theCommands);
+
+ Standard_EXPORT static void GetMousePosition (Standard_Integer& xpix, Standard_Integer& ypix);
+
+ Standard_EXPORT static Handle(V3d_Viewer) GetViewerFromContext();
+
+ Standard_EXPORT static Handle(V3d_Viewer) GetCollectorFromContext();
+
+ Standard_EXPORT static const Handle(AIS_InteractiveContext)& GetAISContext();
+
+ Standard_EXPORT static NIS_InteractiveContext& GetNISContext();
+
+ Standard_EXPORT static void SetAISContext (const Handle(AIS_InteractiveContext)& aContext);
+
+ Standard_EXPORT static void SetNISContext (const NIS_InteractiveContext& aContext);
+
+ Standard_EXPORT static const Handle(V3d_View)& CurrentView();
+
+ Standard_EXPORT static void CurrentView (const Handle(V3d_View)& aViou);
+
+ Standard_EXPORT static void Clear();
+
+ //! puts theMgr as current eventmanager (the move,select,...will be applied to theMgr)
+ Standard_EXPORT static void SetEventManager (const Handle(ViewerTest_EventManager)& theMgr);
+
+ //! removes the last EventManager from the list.
+ Standard_EXPORT static void UnsetEventManager();
+
+ //! clear the list of EventManagers and
+ //! sets the default EventManager as current
+ Standard_EXPORT static void ResetEventManager();
+
+ Standard_EXPORT static Handle(ViewerTest_EventManager) CurrentEventManager();
+
+ Standard_EXPORT static void RemoveSelected();
+
+ Standard_EXPORT static void StandardModeActivation (const Standard_Integer Mode);
+
+ Standard_EXPORT static Quantity_NameOfColor GetColorFromName (const Standard_CString name);
+
+ //! Parses color argument(s) specified within theArgVec[0], theArgVec[1] and theArgVec[2].
+ //! Handles either color specified by name (single argument)
+ //! or by RGB components (3 arguments) in range 0..1.
+ //! The result is stored in theColor on success.
+ //! Returns number of handled arguments (1 or 3) or 0 on syntax error.
+ Standard_EXPORT static Standard_Integer ParseColor (Standard_Integer theArgNb,
+ const char** theArgVec,
+ Quantity_Color& theColor);
+
+ //! redraws all defined views.
+ Standard_EXPORT static void RedrawAllViews();
+
+ //! Splits "parameter=value" string into separate
+ //! parameter and value strings.
+ //! @return TRUE if the string matches pattern "<string>=<empty or string>"
+ Standard_EXPORT static Standard_Boolean SplitParameter (const TCollection_AsciiString& theString,
+ TCollection_AsciiString& theName,
+ TCollection_AsciiString& theValue);
+
+private:
+
+ //! Returns a window class that implements standard behavior of
+ //! all windows of the ViewerTest. This includes usual Open CASCADE
+ //! view conventions for mouse buttons (e.g. Ctrl+MB1 for zoom,
+ //! Ctrl+MB2 for pan, etc) and keyboard shortcuts.
+ //! This method is relevant for MS Windows only and respectively
+ //! returns WNT_WClass handle.
+ Standard_EXPORT static const Handle(MMgt_TShared)& WClass();
+
+friend class ViewerTest_EventManager;
+friend class ViewerTest_DoubleMapOfInteractiveAndName;
+friend class ViewerTest_DoubleMapNodeOfDoubleMapOfInteractiveAndName;
+friend class ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName;
+
+};
+
+#endif // _ViewerTest_HeaderFile
return 0;
}
//==============================================================================
-//function : VTestZBuffTrihedron
-//purpose : Displays a V3d_ZBUFFER'ed or V3d_WIREFRAME'd trihedron
+//function : VZBuffTrihedron
+//purpose :
//==============================================================================
-static int VTestZBuffTrihedron(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+static int VZBuffTrihedron (Draw_Interpretor& /*theDI*/,
+ Standard_Integer theArgNb,
+ const char** theArgVec)
{
- Handle(V3d_View) V3dView = ViewerTest::CurrentView();
- if ( V3dView.IsNull() ) return 1;
+ Handle(V3d_View) aView = ViewerTest::CurrentView();
+ if (aView.IsNull())
+ {
+ std::cout << "Error: no active viewer!\n";
+ return 1;
+ }
- V3dView->ZBufferTriedronSetup();
+ ViewerTest_AutoUpdater anUpdateTool (ViewerTest::GetAISContext(), aView);
- if ( argc == 1 ) {
- // Set up default trihedron parameters
- V3dView->TriedronDisplay( Aspect_TOTP_LEFT_LOWER, Quantity_NOC_WHITE, 0.1, V3d_ZBUFFER );
- } else
- if ( argc == 7 )
+ Aspect_TypeOfTriedronPosition aPosition = Aspect_TOTP_LEFT_LOWER;
+ V3d_TypeOfVisualization aVisType = V3d_ZBUFFER;
+ Quantity_Color aLabelsColor = Quantity_NOC_WHITE;
+ Quantity_Color anArrowColorX = Quantity_NOC_RED;
+ Quantity_Color anArrowColorY = Quantity_NOC_GREEN;
+ Quantity_Color anArrowColorZ = Quantity_NOC_BLUE1;
+ Standard_Real aScale = 0.1;
+ Standard_Real aSizeRatio = 0.8;
+ Standard_Real anArrowDiam = 0.05;
+ Standard_Integer aNbFacets = 12;
+ for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
{
- Aspect_TypeOfTriedronPosition aPosition = Aspect_TOTP_LEFT_LOWER;
- const char* aPosType = argv[1];
-
- if ( strcmp(aPosType, "center") == 0 )
+ Standard_CString anArg = theArgVec[anArgIter];
+ TCollection_AsciiString aFlag (anArg);
+ aFlag.LowerCase();
+ if (anUpdateTool.parseRedrawMode (aFlag))
{
- aPosition = Aspect_TOTP_CENTER;
- } else
- if (strcmp(aPosType, "left_lower") == 0)
+ continue;
+ }
+ else if (aFlag == "-on")
{
- aPosition = Aspect_TOTP_LEFT_LOWER;
- } else
- if (strcmp(aPosType, "left_upper") == 0)
+ continue;
+ }
+ else if (aFlag == "-off")
{
- aPosition = Aspect_TOTP_LEFT_UPPER;
- } else
- if (strcmp(aPosType, "right_lower") == 0)
+ aView->TriedronErase();
+ return 0;
+ }
+ else if (aFlag == "-pos"
+ || aFlag == "-position"
+ || aFlag == "-corner")
{
- aPosition = Aspect_TOTP_RIGHT_LOWER;
- } else
- if (strcmp(aPosType, "right_upper") == 0)
+ if (++anArgIter >= theArgNb)
+ {
+ std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ return 1;
+ }
+
+ TCollection_AsciiString aPosName (theArgVec[anArgIter]);
+ aPosName.LowerCase();
+ if (aPosName == "center")
+ {
+ aPosition = Aspect_TOTP_CENTER;
+ }
+ else if (aPosName == "left_lower"
+ || aPosName == "lower_left"
+ || aPosName == "leftlower"
+ || aPosName == "lowerleft")
+ {
+ aPosition = Aspect_TOTP_LEFT_LOWER;
+ }
+ else if (aPosName == "left_upper"
+ || aPosName == "upper_left"
+ || aPosName == "leftupper"
+ || aPosName == "upperleft")
+ {
+ aPosition = Aspect_TOTP_LEFT_UPPER;
+ }
+ else if (aPosName == "right_lower"
+ || aPosName == "lower_right"
+ || aPosName == "rightlower"
+ || aPosName == "lowerright")
+ {
+ aPosition = Aspect_TOTP_RIGHT_LOWER;
+ }
+ else if (aPosName == "right_upper"
+ || aPosName == "upper_right"
+ || aPosName == "rightupper"
+ || aPosName == "upperright")
+ {
+ aPosition = Aspect_TOTP_RIGHT_UPPER;
+ }
+ else
+ {
+ std::cerr << "Error: wrong syntax at '" << anArg << "' - unknown position '" << aPosName << "'\n";
+ return 1;
+ }
+ }
+ else if (aFlag == "-type")
{
- aPosition = Aspect_TOTP_RIGHT_UPPER;
- } else
+ if (++anArgIter >= theArgNb)
+ {
+ std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ return 1;
+ }
+
+ TCollection_AsciiString aTypeName (theArgVec[anArgIter]);
+ aTypeName.LowerCase();
+ if (aTypeName == "wireframe"
+ || aTypeName == "wire")
+ {
+ aVisType = V3d_WIREFRAME;
+ }
+ else if (aTypeName == "zbuffer"
+ || aTypeName == "shaded")
+ {
+ aVisType = V3d_ZBUFFER;
+ }
+ else
+ {
+ std::cerr << "Error: wrong syntax at '" << anArg << "' - unknown type '" << aTypeName << "'\n";
+ }
+ }
+ else if (aFlag == "-scale")
{
- di << argv[1] << " Invalid type of alignment" << "\n";
- di << "Must be one of [ center, left_lower," << "\n";
- di << "left_upper, right_lower, right_upper ]" << "\n";
- return 1;
+ if (++anArgIter >= theArgNb)
+ {
+ std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ return 1;
+ }
+
+ aScale = Draw::Atof (theArgVec[anArgIter]);
}
+ else if (aFlag == "-size"
+ || aFlag == "-sizeratio")
+ {
+ if (++anArgIter >= theArgNb)
+ {
+ std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ return 1;
+ }
- Standard_Real R = Draw::Atof(argv[2])/255.;
- Standard_Real G = Draw::Atof(argv[3])/255.;
- Standard_Real B = Draw::Atof(argv[4])/255.;
- Quantity_Color aColor(R, G, B, Quantity_TOC_RGB);
+ aSizeRatio = Draw::Atof (theArgVec[anArgIter]);
+ }
+ else if (aFlag == "-arrowdiam"
+ || aFlag == "-arrowdiameter")
+ {
+ if (++anArgIter >= theArgNb)
+ {
+ std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ return 1;
+ }
- Standard_Real aScale = Draw::Atof(argv[5]);
+ anArrowDiam = Draw::Atof (theArgVec[anArgIter]);
+ }
+ else if (aFlag == "-nbfacets")
+ {
+ if (++anArgIter >= theArgNb)
+ {
+ std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ return 1;
+ }
- if( aScale <= 0.0 )
+ aNbFacets = Draw::Atoi (theArgVec[anArgIter]);
+ }
+ else if (aFlag == "-colorlabel"
+ || aFlag == "-colorlabels")
{
- di << argv[5] << " Invalid value. Must be > 0" << "\n";
- return 1;
+ Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
+ theArgVec + anArgIter + 1,
+ aLabelsColor);
+ if (aNbParsed == 0)
+ {
+ std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ return 1;
+ }
+ anArgIter += aNbParsed;
}
-
- V3d_TypeOfVisualization aPresentation = V3d_ZBUFFER;
- const char* aPresType = argv[6];
-
- if ( strcmp(aPresType, "wireframe") == 0 )
+ else if (aFlag == "-colorarrowx")
{
- aPresentation = V3d_WIREFRAME;
- } else
- if (strcmp(aPresType, "zbuffer") == 0)
+ Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
+ theArgVec + anArgIter + 1,
+ anArrowColorX);
+ if (aNbParsed == 0)
+ {
+ std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ return 1;
+ }
+ anArgIter += aNbParsed;
+ }
+ else if (aFlag == "-colorarrowy")
{
- aPresentation = V3d_ZBUFFER;
- } else
+ Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
+ theArgVec + anArgIter + 1,
+ anArrowColorY);
+ if (aNbParsed == 0)
+ {
+ std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ return 1;
+ }
+ anArgIter += aNbParsed;
+ }
+ else if (aFlag == "-colorarrowz")
{
- di << argv[6] << " Invalid type of visualization" << "\n";
- di << "Must be one of [ wireframe, zbuffer ]" << "\n";
+ Standard_Integer aNbParsed = ViewerTest::ParseColor (theArgNb - anArgIter - 1,
+ theArgVec + anArgIter + 1,
+ anArrowColorZ);
+ if (aNbParsed == 0)
+ {
+ std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
+ return 1;
+ }
+ anArgIter += aNbParsed;
+ }
+ else
+ {
+ std::cerr << "Error: wrong syntax at '" << anArg << "'\n";
return 1;
}
-
- V3dView->TriedronDisplay( aPosition, aColor.Name(), aScale, aPresentation );
-
- } else
- {
- di << argv[0] << " Invalid number of arguments" << "\n";
- return 1;
}
- V3dView->View()->ZFitAll();
- V3dView->Redraw();
-
+ aView->ZBufferTriedronSetup (anArrowColorX.Name(), anArrowColorY.Name(), anArrowColorZ.Name(),
+ aSizeRatio, anArrowDiam, aNbFacets);
+ aView->TriedronDisplay (aPosition, aLabelsColor.Name(), aScale, aVisType);
+ aView->View()->ZFitAll();
return 0;
}
// On/off arguments
if ((aKey.IsEqual ("xdrawname") || aKey.IsEqual ("ydrawname") || aKey.IsEqual ("zdrawname")
|| aKey.IsEqual ("xdrawticks") || aKey.IsEqual ("ydrawticks") || aKey.IsEqual ("zdrawticks")
- || aKey.IsEqual ("xdrawvalues") || aKey.IsEqual ("ydrawvalues") || aKey.IsEqual ("zdrawvalues"))
+ || aKey.IsEqual ("xdrawvalues") || aKey.IsEqual ("ydrawvalues") || aKey.IsEqual ("zdrawvalues")
+ || aKey.IsEqual ("drawgrid") || aKey.IsEqual ("drawaxes"))
&& anArgs->Length() == 1 && (anArgs->Value(1).IsEqual ("on") || anArgs->Value(1).IsEqual ("off")))
{
continue;
}
if (aMapOfArgs.Find ("xdrawname", aValues))
{
- aTrihedronData.ChangeXAxisAspect().SetToDrawName (aValues->Value(1).IsEqual ("on"));
+ aTrihedronData.ChangeXAxisAspect().SetDrawName (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("ydrawname", aValues))
{
- aTrihedronData.ChangeYAxisAspect().SetToDrawName (aValues->Value(1).IsEqual ("on"));
+ aTrihedronData.ChangeYAxisAspect().SetDrawName (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("zdrawname", aValues))
{
- aTrihedronData.ChangeZAxisAspect().SetToDrawName (aValues->Value(1).IsEqual ("on"));
+ aTrihedronData.ChangeZAxisAspect().SetDrawName (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("xnameoffset", aValues))
{
// TICKMARKS
if (aMapOfArgs.Find ("xticks", aValues))
{
- aTrihedronData.ChangeXAxisAspect().SetTickmarkNumber (aValues->Value(1).IntegerValue());
+ aTrihedronData.ChangeXAxisAspect().SetTickmarksNumber (aValues->Value(1).IntegerValue());
}
if (aMapOfArgs.Find ("yticks", aValues))
{
- aTrihedronData.ChangeYAxisAspect().SetTickmarkNumber (aValues->Value(1).IntegerValue());
+ aTrihedronData.ChangeYAxisAspect().SetTickmarksNumber (aValues->Value(1).IntegerValue());
}
if (aMapOfArgs.Find ("zticks", aValues))
{
- aTrihedronData.ChangeZAxisAspect().SetTickmarkNumber (aValues->Value(1).IntegerValue());
+ aTrihedronData.ChangeZAxisAspect().SetTickmarksNumber (aValues->Value(1).IntegerValue());
}
if (aMapOfArgs.Find ("xticklength", aValues))
{
- aTrihedronData.ChangeXAxisAspect().SetTickmarkLength (aValues->Value(1).IntegerValue());
+ aTrihedronData.ChangeXAxisAspect().SetTickmarksLength (aValues->Value(1).IntegerValue());
}
if (aMapOfArgs.Find ("yticklength", aValues))
{
- aTrihedronData.ChangeYAxisAspect().SetTickmarkLength (aValues->Value(1).IntegerValue());
+ aTrihedronData.ChangeYAxisAspect().SetTickmarksLength (aValues->Value(1).IntegerValue());
}
if (aMapOfArgs.Find ("zticklength", aValues))
{
- aTrihedronData.ChangeZAxisAspect().SetTickmarkLength (aValues->Value(1).IntegerValue());
+ aTrihedronData.ChangeZAxisAspect().SetTickmarksLength (aValues->Value(1).IntegerValue());
}
if (aMapOfArgs.Find ("xdrawticks", aValues))
{
- aTrihedronData.ChangeXAxisAspect().SetToDrawTickmarks (aValues->Value(1).IsEqual ("on"));
+ aTrihedronData.ChangeXAxisAspect().SetDrawTickmarks (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("ydrawticks", aValues))
{
- aTrihedronData.ChangeYAxisAspect().SetToDrawTickmarks (aValues->Value(1).IsEqual ("on"));
+ aTrihedronData.ChangeYAxisAspect().SetDrawTickmarks (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("zdrawticks", aValues))
{
- aTrihedronData.ChangeZAxisAspect().SetToDrawTickmarks (aValues->Value(1).IsEqual ("on"));
+ aTrihedronData.ChangeZAxisAspect().SetDrawTickmarks (aValues->Value(1).IsEqual ("on"));
}
// VALUES
if (aMapOfArgs.Find ("xdrawvalues", aValues))
{
- aTrihedronData.ChangeXAxisAspect().SetToDrawValues (aValues->Value(1).IsEqual ("on"));
+ aTrihedronData.ChangeXAxisAspect().SetDrawValues (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("ydrawvalues", aValues))
{
- aTrihedronData.ChangeYAxisAspect().SetToDrawValues (aValues->Value(1).IsEqual ("on"));
+ aTrihedronData.ChangeYAxisAspect().SetDrawValues (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("zdrawvalues", aValues))
{
- aTrihedronData.ChangeZAxisAspect().SetToDrawValues (aValues->Value(1).IsEqual ("on"));
+ aTrihedronData.ChangeZAxisAspect().SetDrawValues (aValues->Value(1).IsEqual ("on"));
}
if (aMapOfArgs.Find ("xvaluesoffset", aValues))
{
// ARROWS
if (aMapOfArgs.Find ("arrowlength", aValues))
{
- aTrihedronData.SetArrowLength ((Standard_ShortReal) aValues->Value(1).RealValue());
+ aTrihedronData.SetArrowsLength ((Standard_ShortReal) aValues->Value(1).RealValue());
}
// FONTS
aTrihedronData.SetValuesFont (aValues->Value(1));
}
+ if (aMapOfArgs.Find ("drawgrid", aValues))
+ {
+ aTrihedronData.SetDrawGrid (aValues->Value(1).IsEqual ("on"));
+ }
+ if (aMapOfArgs.Find ("drawaxes", aValues))
+ {
+ aTrihedronData.SetDrawAxes (aValues->Value(1).IsEqual ("on"));
+ }
+
// The final step: display of erase trihedron
if (toDisplay)
{
"vscale : vscale X Y Z",
__FILE__,VScale,group);
theCommands.Add("vzbufftrihedron",
- "vzbufftrihedron [center|left_lower|left_upper|right_lower|right_upper"
- " textR=255 textG=255 textB=255 scale=0.1 wireframe|zbuffer]"
- " : Displays a V3d_ZBUFFER'ed or V3d_WIREFRAME'd trihedron",
- __FILE__,VTestZBuffTrihedron,group);
+ "vzbufftrihedron [{-on|-off}=-on] [-type {wireframe|zbuffer}=zbuffer]"
+ "\n\t\t: [-position center|left_lower|left_upper|right_lower|right_upper]"
+ "\n\t\t: [-scale value=0.1] [-size value=0.8] [-arrowDiam value=0.05]"
+ "\n\t\t: [-colorArrowX color=RED] [-colorArrowY color=GREEN] [-colorArrowZ color=BLUE]"
+ "\n\t\t: [-nbfacets value=12] [-colorLabels color=WHITE]"
+ "\n\t\t: Displays a trihedron",
+ __FILE__,VZBuffTrihedron,group);
theCommands.Add("vrotate",
"vrotate [[-mouseStart X Y] [-mouseMove X Y]]|[AX AY AZ [X Y Z]]"
"\n : Option -mouseStart starts rotation according to the mouse position"
"\t[-xdrawticks on/off] [-ydrawticks on/off] [-zdrawticks on/off]\n"
"\t[-xticks Number] [-yticks Number] [-zticks Number]\n"
"\t[-xticklength IntVal] [-yticklength IntVal] [-zticklength IntVal]\n"
+ "\t[-drawgrid on/off] [-drawaxes on/off]\n"
" - Displays or erases graduated trihedron"
" - xname, yname, zname - names of axes, default: X, Y, Z\n"
" - namefont - font of axes names. Default: Arial\n"
---Category: Graduated trihedron
------------------------------------------
- GetGraduatedTrihedron(me;
- theTrigedronData: out GraduatedTrihedron from Graphic3d)
- returns Boolean from Standard
+ GetGraduatedTrihedron (me)
+ returns GraduatedTrihedron from Graphic3d
is static;
- ---Purpose: Returns data of a graduated trihedron if displayed (return value is True)
+ ---Purpose: Returns data of a graduated trihedron
+ ---C++: return const&
GraduatedTrihedronDisplay(me : mutable;
theTrigedronData: in GraduatedTrihedron from Graphic3d)
const Standard_Real theAxisDiametr,
const Standard_Integer theNbFacettes)
{
- myGraphicDriver->ZBufferTriedronSetup (theXColor, theYColor, theZColor,
+ myGraphicDriver->ZBufferTriedronSetup (MyCView, theXColor, theYColor, theZColor,
theSizeRatio, theAxisDiametr, theNbFacettes);
}
// function : GetGraduatedTrihedron
// purpose :
// =======================================================================
-Standard_Boolean Visual3d_View::GetGraduatedTrihedron (Graphic3d_GraduatedTrihedron& theTrihedronData) const
+const Graphic3d_GraduatedTrihedron& Visual3d_View::GetGraduatedTrihedron() const
{
- if (!myGTrihedron.PtrVisual3dView)
- {
- return Standard_False;
- }
-
- theTrihedronData = myGTrihedron;
- return Standard_True;
+ return myGTrihedron;
}
// =======================================================================
set BugNumber OCC22483
-vinit
-vzbufftrihedron left_lower 255 255 255 0.1 zbuffer
+vinit View1
+vzbufftrihedron -position left_lower -scale 0.1 -type zbuffer -colorLabels WHITE
set only_screen 1
-
set BugNumber OCC22483
-vinit
-vzbufftrihedron right_upper 200 50 255 0.2 zbuffer
+vinit View1
+vzbufftrihedron -position right_upper -scale 0.2 -type zbuffer -colorLabels 0.78 0.20 1.0
set only_screen 1
-
-
set BugNumber OCC22483
-vinit
-vzbufftrihedron center 0 150 255 0.1 wireframe
+vinit View1
+vzbufftrihedron -position center -scale 0.1 -type wireframe -colorLabels 0.0 0.59 1.0
set only_screen 1
-
-
vfit
vaxo
-vzbufftrihedron left_lower 255 255 255 0.1 wireframe
+vzbufftrihedron -scale 0.1 -type wireframe -position left_lower
vdump $anImage1
-vzbufftrihedron center 255 255 255 0.1 wireframe
+vzbufftrihedron -scale 0.1 -type wireframe -position center
vdump $anImage2
vclear