From 0aeb8984188728f2e0838a66a852a6dc764585c5 Mon Sep 17 00:00:00 2001 From: kgv Date: Thu, 5 Nov 2020 17:34:08 +0300 Subject: [PATCH] 0031729: Visualization, Prs3d_DatumAspect - provide per axis text aspects Prs3d_DatumAspect::TextAspect() now takes Prs3d_DatumParts argument and defined separately for Prs3d_DatumParts_XAxis/Prs3d_DatumParts_YAxis/Prs3d_DatumParts_ZAxis. The method without arguments has been marked as deprecated. V3d_Trihedron now stores per-label text attributes. Added method V3d_View::Trihedron() returning V3d_Trihedron object for more straightforward definition. V3d_Trihedron::SetWireframe() - added missing invalidation. AIS_Trihedron::setOwnDatumAspect() implementation has been moved to Prs3d_DatumAspect::CopyAspectsFrom() and now used by Prs3d_Drawer::SetOwnDatumAspects(). OpenGl_Text::render() - added NULL-check. AIS_Trihedron::computePresentation() now takes into account Prs3d_Datum*Arrow shading/line aspects. Command vtrihedron has been extended by "-textColor XAxis|YAxis|ZAxis Color" syntax. Command vviewcube has been extended by "-xAxisTextColor|-yAxisTextColor|-zAxisTextColor" arguments. --- src/AIS/AIS_Trihedron.cxx | 77 ++++++++----- src/AIS/AIS_Trihedron.hxx | 10 +- src/AIS/AIS_ViewCube.cxx | 2 +- src/OpenGl/OpenGl_Text.cxx | 3 +- src/Prs3d/Prs3d_DatumAspect.cxx | 69 ++++++++++-- src/Prs3d/Prs3d_DatumAspect.hxx | 30 ++++-- src/Prs3d/Prs3d_Drawer.cxx | 5 + src/V3d/V3d_Trihedron.cxx | 85 ++++++++++----- src/V3d/V3d_Trihedron.hxx | 71 ++++++++++-- src/V3d/V3d_View.hxx | 3 + src/ViewerTest/ViewerTest_ObjectCommands.cxx | 53 ++++++++- src/ViewerTest/ViewerTest_ViewerCommands.cxx | 107 ++++++++++++------- tests/bugs/vis/bug27958 | 15 ++- 13 files changed, 397 insertions(+), 133 deletions(-) diff --git a/src/AIS/AIS_Trihedron.cxx b/src/AIS/AIS_Trihedron.cxx index 58432b1c39..b93257d83d 100644 --- a/src/AIS/AIS_Trihedron.cxx +++ b/src/AIS/AIS_Trihedron.cxx @@ -103,29 +103,9 @@ void AIS_Trihedron::setOwnDatumAspect() Handle(Prs3d_DatumAspect) aNewAspect = new Prs3d_DatumAspect(); myDrawer->SetDatumAspect (aNewAspect); - if (myDrawer->Link().IsNull()) + if (!myDrawer->Link().IsNull()) { - return; - } - - const Handle(Prs3d_DatumAspect)& aLinkAspect = myDrawer->Link()->DatumAspect(); - aNewAspect->SetDrawArrows (aLinkAspect->ToDrawArrows()); - aNewAspect->SetDrawLabels (aLinkAspect->ToDrawLabels()); - *aNewAspect->TextAspect()->Aspect() = *aLinkAspect->TextAspect()->Aspect(); - *aNewAspect->PointAspect()->Aspect() = *aLinkAspect->PointAspect()->Aspect(); - *aNewAspect->ArrowAspect()->Aspect() = *aLinkAspect->ArrowAspect()->Aspect(); - - for (int aPartIter = Prs3d_DatumParts_Origin; aPartIter <= Prs3d_DatumParts_XOZAxis; ++aPartIter) - { - const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter; - if (!aNewAspect->LineAspect (aPart).IsNull()) - { - *aNewAspect->LineAspect (aPart)->Aspect() = *aLinkAspect->LineAspect (aPart)->Aspect(); - } - if (!aNewAspect->ShadingAspect (aPart).IsNull()) - { - *aNewAspect->ShadingAspect (aPart)->Aspect() = *aLinkAspect->ShadingAspect (aPart)->Aspect(); - } + aNewAspect->CopyAspectsFrom (myDrawer->Link()->DatumAspect()); } } @@ -488,14 +468,21 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager anAxisGroup->AddPrimitiveArray (arrayOfPrimitives (aPart)); // draw arrow - Prs3d_DatumParts anArrowPart = anAspect->ArrowPartForAxis (aPart); + const Prs3d_DatumParts anArrowPart = Prs3d_DatumAspect::ArrowPartForAxis (aPart); if (!anAspect->DrawDatumPart (anArrowPart)) { continue; } Handle(Graphic3d_Group) anArrowGroup = thePrs->NewGroup(); - anArrowGroup->SetGroupPrimitivesAspect (anAspect->ArrowAspect()->Aspect()); + if (isShadingMode) + { + anArrowGroup->SetGroupPrimitivesAspect (anAspect->ShadingAspect (anArrowPart)->Aspect()); + } + else + { + anArrowGroup->SetGroupPrimitivesAspect (anAspect->LineAspect (anArrowPart)->Aspect()); + } anArrowGroup->AddPrimitiveArray (arrayOfPrimitives (anArrowPart)); } } @@ -525,7 +512,7 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager } Handle(Graphic3d_Group) aLabelGroup = thePrs->NewGroup(); const gp_Pnt aPoint = anOrigin.XYZ() + aDir.XYZ() * anAxisLength; - Prs3d_Text::Draw (aLabelGroup, anAspect->TextAspect(), aLabel, aPoint); + Prs3d_Text::Draw (aLabelGroup, anAspect->TextAspect (aPart), aLabel, aPoint); } } @@ -562,6 +549,17 @@ void AIS_Trihedron::SetDatumPartColor (const Prs3d_DatumParts thePart, } } +//======================================================================= +//function : SetTextColor +//purpose : +//======================================================================= +void AIS_Trihedron::SetTextColor (const Prs3d_DatumParts thePart, + const Quantity_Color& theColor) +{ + setOwnDatumAspect(); + myDrawer->DatumAspect()->TextAspect (thePart)->SetColor (theColor); +} + //======================================================================= //function : SetTextColor //purpose : @@ -569,7 +567,9 @@ void AIS_Trihedron::SetDatumPartColor (const Prs3d_DatumParts thePart, void AIS_Trihedron::SetTextColor (const Quantity_Color& theColor) { setOwnDatumAspect(); - myDrawer->DatumAspect()->TextAspect()->SetColor (theColor); + myDrawer->DatumAspect()->TextAspect (Prs3d_DatumParts_XAxis)->SetColor (theColor); + myDrawer->DatumAspect()->TextAspect (Prs3d_DatumParts_YAxis)->SetColor (theColor); + myDrawer->DatumAspect()->TextAspect (Prs3d_DatumParts_ZAxis)->SetColor (theColor); } //======================================================================= @@ -642,6 +642,20 @@ void AIS_Trihedron::SetColor (const Quantity_Color& theColor) SetDatumPartColor (Prs3d_DatumParts_ZAxis, theColor); } +//======================================================================= +//function : SetArrowColor +//purpose : +//======================================================================= +void AIS_Trihedron::SetArrowColor (const Prs3d_DatumParts thePart, + const Quantity_Color& theColor) +{ + setOwnDatumAspect(); + myHasOwnArrowColor = Standard_True; + const Prs3d_DatumParts anArrowPart = Prs3d_DatumAspect::ArrowPartForAxis (thePart); + myDrawer->DatumAspect()->ShadingAspect(anArrowPart)->SetColor (theColor); + myDrawer->DatumAspect()->LineAspect (anArrowPart)->SetColor (theColor); +} + //======================================================================= //function : SetArrowColor //purpose : @@ -652,6 +666,11 @@ void AIS_Trihedron::SetArrowColor (const Quantity_Color& theColor) myHasOwnArrowColor = Standard_True; myDrawer->DatumAspect()->ArrowAspect()->SetColor (theColor); + for (Standard_Integer anAxisIter = Prs3d_DatumParts_XArrow; anAxisIter <= Prs3d_DatumParts_ZArrow; ++anAxisIter) + { + myDrawer->DatumAspect()->ShadingAspect((Prs3d_DatumParts )anAxisIter)->SetColor (theColor); + myDrawer->DatumAspect()->LineAspect ((Prs3d_DatumParts )anAxisIter)->SetColor (theColor); + } } //======================================================================= @@ -660,7 +679,7 @@ void AIS_Trihedron::SetArrowColor (const Quantity_Color& theColor) //======================================================================= Quantity_Color AIS_Trihedron::TextColor() const { - return myDrawer->DatumAspect()->TextAspect()->Aspect()->Color(); + return myDrawer->DatumAspect()->TextAspect (Prs3d_DatumParts_XAxis)->Aspect()->Color(); } //======================================================================= @@ -807,7 +826,7 @@ void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect, myPrimitives[aPart] = aPrims; } - Prs3d_DatumParts anArrowPart = theAspect->ArrowPartForAxis(aPart); + const Prs3d_DatumParts anArrowPart = Prs3d_DatumAspect::ArrowPartForAxis (aPart); if (theAspect->DrawDatumPart(anArrowPart)) { myPrimitives[anArrowPart] = Prs3d_Arrow::DrawSegments (anAxisPoints.Find(aPart), anAxisDirs.Find(aPart), @@ -841,7 +860,7 @@ void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect, for (Standard_Integer anAxisIter = Prs3d_DatumParts_XAxis; anAxisIter <= Prs3d_DatumParts_ZAxis; ++anAxisIter) { const Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter; - const Prs3d_DatumParts anArrowPart = theAspect->ArrowPartForAxis(aPart); + const Prs3d_DatumParts anArrowPart = Prs3d_DatumAspect::ArrowPartForAxis (aPart); const bool aDrawArrow = theAspect->DrawDatumPart(anArrowPart); const Standard_Real anAxisLength = theAspect->AxisLength(aPart); const gp_Ax1 anAxis(theOrigin, anAxisDirs.Find(aPart)); diff --git a/src/AIS/AIS_Trihedron.hxx b/src/AIS/AIS_Trihedron.hxx index 327136df4a..0ad7f705dd 100644 --- a/src/AIS/AIS_Trihedron.hxx +++ b/src/AIS/AIS_Trihedron.hxx @@ -96,15 +96,23 @@ public: //! Sets color of label of trihedron axes. Standard_EXPORT void SetTextColor (const Quantity_Color& theColor); + //! Sets color of label of trihedron axis. + Standard_EXPORT void SetTextColor (const Prs3d_DatumParts thePart, + const Quantity_Color& theColor); + //! Returns true if trihedron has own arrow color Standard_Boolean HasArrowColor() const { return myHasOwnArrowColor; } //! Returns trihedron arrow color Standard_EXPORT Quantity_Color ArrowColor() const; - //! Sets color of arrow of trihedron axes. Used only in wireframe mode + //! Sets color of arrow of trihedron axes. Standard_EXPORT void SetArrowColor (const Quantity_Color& theColor); + //! Sets color of arrow of trihedron axes. + Standard_EXPORT void SetArrowColor (const Prs3d_DatumParts thePart, + const Quantity_Color& theColor); + //! Returns color of datum part: origin or some of trihedron axes. Standard_EXPORT Quantity_Color DatumPartColor (Prs3d_DatumParts thePart); diff --git a/src/AIS/AIS_ViewCube.cxx b/src/AIS/AIS_ViewCube.cxx index f1b39c0784..3edb4f14a1 100644 --- a/src/AIS/AIS_ViewCube.cxx +++ b/src/AIS/AIS_ViewCube.cxx @@ -614,7 +614,7 @@ void AIS_ViewCube::Compute (const Handle(PrsMgr_PresentationManager3d)& , gp_Pnt aTextOrigin = anAx1.Location().Translated (gp_Vec (anAx1.Direction().X() * (anAxisSize + anArrowLength), anAx1.Direction().Y() * (anAxisSize + anArrowLength), anAx1.Direction().Z() * (anAxisSize + anArrowLength))); - Prs3d_Text::Draw (anAxisLabelGroup, aDatumAspect->TextAspect(), TCollection_ExtendedString (anAxisLabel), aTextOrigin); + Prs3d_Text::Draw (anAxisLabelGroup, aDatumAspect->TextAspect (aPart), TCollection_ExtendedString (anAxisLabel), aTextOrigin); } } diff --git a/src/OpenGl/OpenGl_Text.cxx b/src/OpenGl/OpenGl_Text.cxx index 09c63975d1..bbdb8505ae 100644 --- a/src/OpenGl/OpenGl_Text.cxx +++ b/src/OpenGl/OpenGl_Text.cxx @@ -679,7 +679,8 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx, { myFont = FindFont (theCtx, theTextAspect, (Standard_Integer)myText->Height(), theResolution, aFontKey); } - if (!myFont->WasInitialized()) + if (myFont.IsNull() + || !myFont->WasInitialized()) { return; } diff --git a/src/Prs3d/Prs3d_DatumAspect.cxx b/src/Prs3d/Prs3d_DatumAspect.cxx index e90785864a..af8b95c96d 100644 --- a/src/Prs3d/Prs3d_DatumAspect.cxx +++ b/src/Prs3d/Prs3d_DatumAspect.cxx @@ -39,21 +39,32 @@ Prs3d_DatumAspect::Prs3d_DatumAspect() myAttributes[Prs3d_DatumAttribute_ShadingOriginRadiusPercent] = 0.015; myAttributes[Prs3d_DatumAttribute_ShadingNumberOfFacettes] = 12.0; + myPointAspect = new Prs3d_PointAspect (Aspect_TOM_EMPTY, aDefaultColor, 1.0); + myArrowAspect = new Prs3d_ArrowAspect(); for (int aPartIter = Prs3d_DatumParts_Origin; aPartIter <= Prs3d_DatumParts_XOZAxis; ++aPartIter) { const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter; + + Quantity_Color aColor = aDefaultColor; + if (aPart >= Prs3d_DatumParts_XArrow + && aPart <= Prs3d_DatumParts_ZArrow) + { + aColor = myArrowAspect->Aspect()->Color(); + } + if (aPart != Prs3d_DatumParts_Origin) // origin point is used only in shading mode { - myLineAspects[aPart] = new Prs3d_LineAspect (aDefaultColor, Aspect_TOL_SOLID, 1.0); + myLineAspects[aPart] = new Prs3d_LineAspect (aColor, Aspect_TOL_SOLID, 1.0); } Handle(Prs3d_ShadingAspect) aShadingAspect = new Prs3d_ShadingAspect(); - aShadingAspect->SetColor (aDefaultColor); + aShadingAspect->SetColor (aColor); myShadedAspects[aPart] = aShadingAspect; } - myTextAspect = new Prs3d_TextAspect(); - myPointAspect = new Prs3d_PointAspect (Aspect_TOM_EMPTY, aDefaultColor, 1.0); - myArrowAspect = new Prs3d_ArrowAspect(); + + myTextAspects[Prs3d_DatumParts_XAxis] = new Prs3d_TextAspect(); + myTextAspects[Prs3d_DatumParts_YAxis] = new Prs3d_TextAspect(); + myTextAspects[Prs3d_DatumParts_ZAxis] = new Prs3d_TextAspect(); } // ======================================================================= @@ -134,18 +145,48 @@ Standard_Real Prs3d_DatumAspect::AxisLength (Prs3d_DatumParts thePart) const // function : ArrowPartForAxis // purpose : // ======================================================================= -Prs3d_DatumParts Prs3d_DatumAspect::ArrowPartForAxis (Prs3d_DatumParts thePart) const +Prs3d_DatumParts Prs3d_DatumAspect::ArrowPartForAxis (Prs3d_DatumParts thePart) { switch (thePart) { + case Prs3d_DatumParts_XArrow: case Prs3d_DatumParts_XAxis: return Prs3d_DatumParts_XArrow; + case Prs3d_DatumParts_YArrow: case Prs3d_DatumParts_YAxis: return Prs3d_DatumParts_YArrow; + case Prs3d_DatumParts_ZArrow: case Prs3d_DatumParts_ZAxis: return Prs3d_DatumParts_ZArrow; default: break; } return Prs3d_DatumParts_None; } +//======================================================================= +//function : CopyAspectsFrom +//purpose : +//======================================================================= +void Prs3d_DatumAspect::CopyAspectsFrom (const Handle(Prs3d_DatumAspect)& theOther) +{ + myToDrawArrows = theOther->myToDrawArrows; + myToDrawLabels = theOther->myToDrawLabels; + *myPointAspect->Aspect() = *theOther->myPointAspect->Aspect(); + *myArrowAspect->Aspect() = *theOther->myArrowAspect->Aspect(); + *myTextAspects[Prs3d_DatumParts_XAxis]->Aspect() = *theOther->myTextAspects[Prs3d_DatumParts_XAxis]->Aspect(); + *myTextAspects[Prs3d_DatumParts_YAxis]->Aspect() = *theOther->myTextAspects[Prs3d_DatumParts_YAxis]->Aspect(); + *myTextAspects[Prs3d_DatumParts_ZAxis]->Aspect() = *theOther->myTextAspects[Prs3d_DatumParts_ZAxis]->Aspect(); + for (int aPartIter = Prs3d_DatumParts_Origin; aPartIter <= Prs3d_DatumParts_XOZAxis; ++aPartIter) + { + const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter; + if (!myLineAspects[aPart].IsNull()) + { + *myLineAspects[aPart]->Aspect() = *theOther->myLineAspects[aPart]->Aspect(); + } + if (!myShadedAspects[aPart].IsNull()) + { + *myShadedAspects[aPart]->Aspect() = *theOther->myShadedAspects[aPart]->Aspect(); + } + } +} + // ======================================================================= // function : DumpJson // purpose : @@ -154,9 +195,23 @@ void Prs3d_DatumAspect::DumpJson (Standard_OStream& theOStream, Standard_Integer { OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTextAspect.get()) OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myPointAspect.get()) OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myArrowAspect.get()) + for (Standard_Integer anIter = 0; anIter < Prs3d_DatumParts_NB; anIter++) + { + const Handle(Prs3d_ShadingAspect)& aShadingAspect = myShadedAspects[anIter]; + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aShadingAspect.get()) + } + for (Standard_Integer anIter = 0; anIter < Prs3d_DatumParts_NB; anIter++) + { + const Handle(Prs3d_LineAspect)& aLineAspect = myLineAspects[anIter]; + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aLineAspect.get()) + } + for (Standard_Integer anIter = Prs3d_DatumParts_XAxis; anIter <= Prs3d_DatumParts_ZAxis; anIter++) + { + const Handle(Prs3d_TextAspect)& aTextAspect = myTextAspects[anIter]; + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aTextAspect.get()) + } OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAxes) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToDrawLabels) diff --git a/src/Prs3d/Prs3d_DatumAspect.hxx b/src/Prs3d/Prs3d_DatumAspect.hxx index d4e364a635..1faabbe951 100644 --- a/src/Prs3d/Prs3d_DatumAspect.hxx +++ b/src/Prs3d/Prs3d_DatumAspect.hxx @@ -43,11 +43,16 @@ public: //! Returns shading aspect for specified part. const Handle(Prs3d_ShadingAspect)& ShadingAspect (Prs3d_DatumParts thePart) const { return myShadedAspects[thePart]; } - //! Returns the text attributes for rendering labels. - const Handle(Prs3d_TextAspect)& TextAspect() const { return myTextAspect; } + //! Returns the text attributes for rendering label of specified part (Prs3d_DatumParts_XAxis/Prs3d_DatumParts_YAxis/Prs3d_DatumParts_ZAxis). + const Handle(Prs3d_TextAspect)& TextAspect (Prs3d_DatumParts thePart) const { return myTextAspects[thePart]; } //! Sets text attributes for rendering labels. - void SetTextAspect (const Handle(Prs3d_TextAspect)& theTextAspect) { myTextAspect = theTextAspect; } + void SetTextAspect (const Handle(Prs3d_TextAspect)& theTextAspect) + { + myTextAspects[Prs3d_DatumParts_XAxis] = theTextAspect; + myTextAspects[Prs3d_DatumParts_YAxis] = theTextAspect; + myTextAspects[Prs3d_DatumParts_ZAxis] = theTextAspect; + } //! Returns the point aspect of origin wireframe presentation const Handle(Prs3d_PointAspect)& PointAspect() const { return myPointAspect; } @@ -55,7 +60,7 @@ public: //! Returns the point aspect of origin wireframe presentation void SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect) { myPointAspect = theAspect; } - //! Returns the arrow aspect of presentation + //! Returns the arrow aspect of presentation. const Handle(Prs3d_ArrowAspect)& ArrowAspect() const { return myArrowAspect; } //! Sets the arrow aspect of presentation @@ -100,14 +105,23 @@ public: //! Sets option to draw or not arrows for axes void SetDrawArrows (Standard_Boolean theToDraw) { myToDrawArrows = theToDraw; } - //! Returns type of arrow for a type of axis - Standard_EXPORT Prs3d_DatumParts ArrowPartForAxis (Prs3d_DatumParts thePart) const; + //! Performs deep copy of attributes from another aspect instance. + Standard_EXPORT void CopyAspectsFrom (const Handle(Prs3d_DatumAspect)& theOther); //! Dumps the content of me into the stream Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; public: + //! Returns type of arrow for a type of axis + Standard_EXPORT static Prs3d_DatumParts ArrowPartForAxis (Prs3d_DatumParts thePart); + +public: + + //! Returns the text attributes for rendering labels. + Standard_DEPRECATED("This method is deprecated - TextAspect() with axis parameter should be called instead") + const Handle(Prs3d_TextAspect)& TextAspect() const { return myTextAspects[Prs3d_DatumParts_XAxis]; } + //! Returns the attributes for display of the first axis. Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead") const Handle(Prs3d_LineAspect)& FirstAxisAspect() const { return myLineAspects[Prs3d_DatumParts_XAxis]; } @@ -152,11 +166,11 @@ public: Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead") Standard_Real ThirdAxisLength() const { return myAttributes[Prs3d_DatumAttribute_ZAxisLength]; } -private: +protected: Handle(Prs3d_ShadingAspect) myShadedAspects[Prs3d_DatumParts_NB]; Handle(Prs3d_LineAspect) myLineAspects[Prs3d_DatumParts_NB]; - Handle(Prs3d_TextAspect) myTextAspect; + Handle(Prs3d_TextAspect) myTextAspects[Prs3d_DatumParts_NB]; Handle(Prs3d_PointAspect) myPointAspect; Handle(Prs3d_ArrowAspect) myArrowAspect; Standard_Real myAttributes[Prs3d_DatumAttribute_NB]; diff --git a/src/Prs3d/Prs3d_Drawer.cxx b/src/Prs3d/Prs3d_Drawer.cxx index dbc32b8282..f652bfefd8 100644 --- a/src/Prs3d/Prs3d_Drawer.cxx +++ b/src/Prs3d/Prs3d_Drawer.cxx @@ -1252,6 +1252,11 @@ Standard_Boolean Prs3d_Drawer::SetOwnDatumAspects (const Handle(Prs3d_Drawer)& t { isUpdateNeeded = true; myDatumAspect = new Prs3d_DatumAspect(); + if (!aLink.IsNull() + && aLink->HasOwnDatumAspect()) + { + myDatumAspect->CopyAspectsFrom (aLink->DatumAspect()); + } myHasOwnDatumAspect = true; } return isUpdateNeeded; diff --git a/src/V3d/V3d_Trihedron.cxx b/src/V3d/V3d_Trihedron.cxx index d5964e93ff..bd6400725d 100644 --- a/src/V3d/V3d_Trihedron.cxx +++ b/src/V3d/V3d_Trihedron.cxx @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -97,34 +96,32 @@ V3d_Trihedron::V3d_Trihedron() for (Standard_Integer anIt = 0; anIt < 3; ++anIt) { myArrowShadingAspects[anIt] = new Prs3d_ShadingAspect(); - myArrowLineAspects[anIt] = new Prs3d_LineAspect (Quantity_NOC_WHITE, Aspect_TOL_SOLID, 1.0); + myTextAspects[anIt] = new Prs3d_TextAspect(); // mark texture map ON to actually disable environment map myArrowShadingAspects[anIt]->Aspect()->SetTextureMapOn(); myArrowShadingAspects[anIt]->Aspect()->SetInteriorStyle (Aspect_IS_SOLID); myArrowShadingAspects[anIt]->SetMaterial (aShadingMaterial); + + myTextAspects[anIt]->SetFont (Font_NOF_ASCII_MONO); + myTextAspects[anIt]->SetHeight (16); + myTextAspects[anIt]->SetHorizontalJustification (Graphic3d_HTA_LEFT); + myTextAspects[anIt]->SetVerticalJustification (Graphic3d_VTA_BOTTOM); } - myArrowShadingAspects[0]->SetColor (Quantity_NOC_RED); - myArrowLineAspects [0]->SetColor (Quantity_NOC_RED); - myArrowShadingAspects[1]->SetColor (Quantity_NOC_GREEN); - myArrowLineAspects [1]->SetColor (Quantity_NOC_GREEN); - myArrowShadingAspects[2]->SetColor (Quantity_NOC_BLUE1); - myArrowLineAspects [2]->SetColor (Quantity_NOC_BLUE1); + myArrowShadingAspects[V3d_X]->SetColor (Quantity_NOC_RED); + myArrowShadingAspects[V3d_Y]->SetColor (Quantity_NOC_GREEN); + myArrowShadingAspects[V3d_Z]->SetColor (Quantity_NOC_BLUE); + + myLabels[V3d_X] = "X"; + myLabels[V3d_Y] = "Y"; + myLabels[V3d_Z] = "Z"; mySphereShadingAspect = new Prs3d_ShadingAspect(); - mySphereLineAspect = new Prs3d_LineAspect (Quantity_NOC_WHITE, Aspect_TOL_SOLID, 1.0); - // mark texture map ON to actually disable environment map mySphereShadingAspect->Aspect()->SetTextureMapOn(); mySphereShadingAspect->Aspect()->SetInteriorStyle (Aspect_IS_SOLID); mySphereShadingAspect->SetMaterial (aShadingMaterial); mySphereShadingAspect->SetColor (Quantity_NOC_WHITE); - - myTextAspect = new Prs3d_TextAspect(); - myTextAspect->SetFont ("Courier"); - myTextAspect->SetHeight (16); - myTextAspect->SetHorizontalJustification (Graphic3d_HTA_LEFT); - myTextAspect->SetVerticalJustification (Graphic3d_VTA_BOTTOM); } // ============================================================================ @@ -142,7 +139,41 @@ V3d_Trihedron::~V3d_Trihedron() // ============================================================================ void V3d_Trihedron::SetLabelsColor (const Quantity_Color& theColor) { - myTextAspect->SetColor (theColor); + myTextAspects[V3d_X]->SetColor (theColor); + myTextAspects[V3d_Y]->SetColor (theColor); + myTextAspects[V3d_Z]->SetColor (theColor); +} + +// ============================================================================ +// function : SetLabels +// purpose : +// ============================================================================ +void V3d_Trihedron::SetLabels (const TCollection_AsciiString& theX, + const TCollection_AsciiString& theY, + const TCollection_AsciiString& theZ) +{ + if (!myLabels[V3d_X].IsEqual (theX) + || !myLabels[V3d_Y].IsEqual (theY) + || !myLabels[V3d_Z].IsEqual (theZ)) + { + invalidate(); + myLabels[V3d_X] = theX; + myLabels[V3d_Y] = theY; + myLabels[V3d_Z] = theZ; + } +} + +// ============================================================================ +// function : SetLabelsColor +// purpose : +// ============================================================================ +void V3d_Trihedron::SetLabelsColor (const Quantity_Color& theXColor, + const Quantity_Color& theYColor, + const Quantity_Color& theZColor) +{ + myTextAspects[V3d_X]->SetColor (theXColor); + myTextAspects[V3d_Y]->SetColor (theYColor); + myTextAspects[V3d_Z]->SetColor (theZColor); } // ============================================================================ @@ -157,7 +188,6 @@ void V3d_Trihedron::SetArrowsColor (const Quantity_Color& theXColor, for (Standard_Integer anIt = 0; anIt < 3; ++anIt) { myArrowShadingAspects[anIt]->SetColor (aColors[anIt]); - myArrowLineAspects [anIt]->SetColor (aColors[anIt]); } } @@ -306,7 +336,7 @@ void V3d_Trihedron::compute() anCircleArray->AddVertex (aRayon * Sin (THE_CIRCLE_SERMENTS_NB * THE_CIRCLE_SEGMENT_ANGLE), aRayon * Cos (THE_CIRCLE_SERMENTS_NB * THE_CIRCLE_SEGMENT_ANGLE), 0.0); - aSphereGroup->SetGroupPrimitivesAspect (mySphereLineAspect->Aspect()); + aSphereGroup->SetGroupPrimitivesAspect (mySphereShadingAspect->Aspect()); aSphereGroup->AddPrimitiveArray (anCircleArray); } else @@ -331,7 +361,7 @@ void V3d_Trihedron::compute() anArray->AddVertex (0.0f, 0.0f, 0.0f); anArray->AddVertex (anAxes[anIter].Direction().XYZ() * aCylinderLength); - anAxisGroup->SetGroupPrimitivesAspect (myArrowLineAspects[anIter]->Aspect()); + anAxisGroup->SetGroupPrimitivesAspect (myArrowShadingAspects[anIter]->Aspect()); anAxisGroup->AddPrimitiveArray (anArray); } @@ -349,13 +379,12 @@ void V3d_Trihedron::compute() // Display labels. { Handle(Graphic3d_Group) aLabelGroup = addGroup (myStructure, aGroupIter); - const TCollection_ExtendedString aLabels[3] = { "X", "Y", "Z" }; const gp_Pnt aPoints[3] = { gp_Pnt (aScale + 2.0 * aRayon, 0.0, -aRayon), gp_Pnt ( aRayon, aScale + 3.0 * aRayon, 2.0 * aRayon), gp_Pnt ( -2.0 * aRayon, 0.5 * aRayon, aScale + 3.0 * aRayon) }; for (Standard_Integer anAxisIter = 0; anAxisIter < 3; ++anAxisIter) { - Prs3d_Text::Draw (aLabelGroup, myTextAspect, aLabels[anAxisIter], aPoints[anAxisIter]); + Prs3d_Text::Draw (aLabelGroup, myTextAspects[anAxisIter], myLabels[anAxisIter], aPoints[anAxisIter]); } } } @@ -369,19 +398,17 @@ void V3d_Trihedron::DumpJson (Standard_OStream& theOStream, Standard_Integer the OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream) OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, mySphereShadingAspect.get()) - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, mySphereLineAspect.get()) - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTextAspect.get()) + for (Standard_Integer anIter = 0; anIter < 3; anIter++) + { + const Handle(Prs3d_TextAspect)& aTextAspect = myTextAspects[anIter]; + OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aTextAspect.get()) + } for (Standard_Integer anIter = 0; anIter < 3; anIter++) { const Handle(Prs3d_ShadingAspect)& anArrowShadinAspect = myArrowShadingAspects[anIter]; OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, anArrowShadinAspect.get()) } - for (Standard_Integer anIter = 0; anIter < 3; anIter++) - { - const Handle(Prs3d_LineAspect)& anArrowLineAspect = myArrowLineAspects[anIter]; - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, anArrowLineAspect.get()) - } OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myStructure.get()) OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTransformPers.get()) diff --git a/src/V3d/V3d_Trihedron.hxx b/src/V3d/V3d_Trihedron.hxx index 6ac0159d12..37028b0aed 100644 --- a/src/V3d/V3d_Trihedron.hxx +++ b/src/V3d/V3d_Trihedron.hxx @@ -23,10 +23,11 @@ #include #include #include +#include class V3d_View; -//! Class for presentation of zbuffer trihedron object. +//! Class for presentation of trihedron object. class V3d_Trihedron : public Standard_Transient { DEFINE_STANDARD_RTTIEXT(V3d_Trihedron, Standard_Transient) @@ -38,32 +39,91 @@ public: //! Destructor. Standard_EXPORT virtual ~V3d_Trihedron(); + //! Return TRUE if wireframe presentation is set; FALSE by default. + bool IsWireframe() const { return myIsWireframe; } + //! Switch wireframe / shaded trihedron. - void SetWireframe (const Standard_Boolean theAsWireframe) { myIsWireframe = theAsWireframe; } + void SetWireframe (const Standard_Boolean theAsWireframe) + { + if (myIsWireframe != theAsWireframe) + { + invalidate(); + myIsWireframe = theAsWireframe; + } + } + + //! Return trihedron position. + const Handle(Graphic3d_TransformPers) TransformPersistence() const { return myTransformPers; } //! Setup the corner to draw the trihedron. Standard_EXPORT void SetPosition (const Aspect_TypeOfTriedronPosition thePosition); + //! Return scale factor. + Standard_Real Scale() const { return myScale; } + //! Setup the scale factor. Standard_EXPORT void SetScale (const Standard_Real theScale); + //! Return size ratio factor. + Standard_Real SizeRatio() const { return myRatio; } + //! Setup the size ratio factor. Standard_EXPORT void SetSizeRatio (const Standard_Real theRatio); + //! Return arrow diameter. + Standard_Real ArrowDiameter() const { return myDiameter; } + //! Setup the arrow diameter. Standard_EXPORT void SetArrowDiameter (const Standard_Real theDiam); + //! Return number of facets for tessellation. + Standard_Integer NbFacets() const { return myNbFacettes; } + //! Setup the number of facets for tessellation. Standard_EXPORT void SetNbFacets (const Standard_Integer theNbFacets); + //! Return text aspect for specified axis. + //! @param theAxis [in] axis index + //! @return text aspect + const Handle(Prs3d_TextAspect)& LabelAspect (V3d_TypeOfAxe theAxis) const { return myTextAspects[theAxis]; } + + //! Setup per-label color. + Standard_EXPORT void SetLabelsColor (const Quantity_Color& theXColor, + const Quantity_Color& theYColor, + const Quantity_Color& theZColor); + //! Setup color of text labels. Standard_EXPORT void SetLabelsColor (const Quantity_Color& theColor); + //! Return shading aspect for specified axis. + //! @param theAxis [in] axis index + //! @return shading aspect + const Handle(Prs3d_ShadingAspect)& ArrowAspect (V3d_TypeOfAxe theAxis) const { return myArrowShadingAspects[theAxis]; } + //! Setup colors of arrows. Standard_EXPORT void SetArrowsColor (const Quantity_Color& theXColor, const Quantity_Color& theYColor, const Quantity_Color& theZColor); + //! Return shading aspect of origin sphere. + const Handle(Prs3d_ShadingAspect)& OriginAspect() const { return mySphereShadingAspect; } + + //! Return axis text. + //! @param theAxis [in] axis index + //! @return text of the label + const TCollection_AsciiString& Label (V3d_TypeOfAxe theAxis) const { return myLabels[theAxis]; } + + //! Setup per-axis text. + Standard_EXPORT void SetLabels (const TCollection_AsciiString& theX, + const TCollection_AsciiString& theY, + const TCollection_AsciiString& theZ); + + //! Display trihedron. + void Display (const Handle(V3d_View)& theView) + { + Display (*theView); + } + //! Display trihedron. Standard_EXPORT void Display (const V3d_View& theView); @@ -95,12 +155,9 @@ private: protected: Handle(Prs3d_ShadingAspect) mySphereShadingAspect; - Handle(Prs3d_LineAspect) mySphereLineAspect; - - Handle(Prs3d_TextAspect) myTextAspect; - + Handle(Prs3d_TextAspect) myTextAspects[3]; Handle(Prs3d_ShadingAspect) myArrowShadingAspects[3]; - Handle(Prs3d_LineAspect) myArrowLineAspects[3]; + TCollection_AsciiString myLabels[3]; Handle(Graphic3d_Structure) myStructure; Handle(Graphic3d_TransformPers) myTransformPers; diff --git a/src/V3d/V3d_View.hxx b/src/V3d/V3d_View.hxx index 053bb4347d..e240166e14 100644 --- a/src/V3d/V3d_View.hxx +++ b/src/V3d/V3d_View.hxx @@ -286,6 +286,9 @@ public: //! sets the immediate update mode and returns the previous one. Standard_EXPORT Standard_Boolean SetImmediateUpdate (const Standard_Boolean theImmediateUpdate); + //! Returns trihedron object. + const Handle(V3d_Trihedron)& Trihedron() const { return myTrihedron; } + //! Customization of the ZBUFFER Triedron. //! XColor,YColor,ZColor - colors of axis //! SizeRatio - ratio of decreasing of the trihedron size when its physical diff --git a/src/ViewerTest/ViewerTest_ObjectCommands.cxx b/src/ViewerTest/ViewerTest_ObjectCommands.cxx index e71edd7ccf..f8329e0059 100644 --- a/src/ViewerTest/ViewerTest_ObjectCommands.cxx +++ b/src/ViewerTest/ViewerTest_ObjectCommands.cxx @@ -426,24 +426,59 @@ namespace if (aMapOfArgs.Find ("textcolor", aValues)) { + Prs3d_DatumParts aDatumPart = Prs3d_DatumParts_None; + if (!aValues->IsEmpty() + && convertToDatumPart (aValues->First(), aDatumPart) + && aDatumPart >= Prs3d_DatumParts_XAxis + && aDatumPart <= Prs3d_DatumParts_ZAxis) + { + aValues->Remove (1); // datum part is processed + } + Quantity_Color aColor; if (!convertToColor (aValues, aColor)) { Message::SendFail ("Syntax error: -textcolor wrong parameters"); return Standard_False; } - theTrihedron->SetTextColor (aColor); + + if (aDatumPart != Prs3d_DatumParts_None) + { + theTrihedron->SetTextColor (aDatumPart, aColor); + } + else + { + theTrihedron->SetTextColor (aColor); + } } if (aMapOfArgs.Find ("arrowcolor", aValues)) { + Prs3d_DatumParts aDatumPart = Prs3d_DatumParts_None; + if (!aValues->IsEmpty() + && convertToDatumPart (aValues->First(), aDatumPart) + && ((aDatumPart >= Prs3d_DatumParts_XArrow && aDatumPart <= Prs3d_DatumParts_ZArrow) + || (aDatumPart >= Prs3d_DatumParts_XAxis && aDatumPart <= Prs3d_DatumParts_ZAxis))) + { + aValues->Remove (1); // datum part is processed + } + Quantity_Color aColor; if (!convertToColor (aValues, aColor)) { Message::SendFail ("Syntax error: -arrowcolor wrong parameters"); return Standard_False; } - theTrihedron->SetArrowColor (aColor); + + if (aDatumPart != Prs3d_DatumParts_None) + { + Prs3d_DatumParts anArrowPart = Prs3d_DatumAspect::ArrowPartForAxis (aDatumPart); + theTrihedron->SetArrowColor (anArrowPart, aColor); + } + else + { + theTrihedron->SetArrowColor (aColor); + } } if (aMapOfArgs.Find ("attribute", aValues)) @@ -582,6 +617,11 @@ static int VTrihedron2D (Draw_Interpretor& /*theDI*/, Standard_Integer theArgsNum, const char** theArgVec) { + if (ViewerTest::CurrentView().IsNull()) + { + Message::SendFail ("Error: no active viewer"); + return 1; + } if (theArgsNum != 2) { Message::SendFail() << "Syntax error: wrong number of arguments."; @@ -640,6 +680,11 @@ static int VTrihedron (Draw_Interpretor& , Standard_Integer theArgsNb, const char** theArgVec) { + if (ViewerTest::CurrentView().IsNull()) + { + Message::SendFail ("Error: no active viewer"); + return 1; + } if (theArgsNb < 2) { Message::SendFail ("Syntax error: the wrong number of input parameters"); @@ -6868,8 +6913,8 @@ void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands) "\n\t\t: |ShadingNumberOfFacettes} value]" "\n\t\t: [-color {Origin|XAxis|YAxis|ZAxis|XOYAxis|YOZAxis" "\n\t\t: |XOZAxis|Whole} {r g b | colorName}]" - "\n\t\t: [-textColor {r g b | colorName}]" - "\n\t\t: [-arrowColor {r g b | colorName}]" + "\n\t\t: [-textColor [XAxis|YAxis|ZAxis] {r g b | colorName}]" + "\n\t\t: [-arrowColor [XAxis|YAxis|ZAxis] {r g b | colorName}]" "\n\t\t: [-priority {Origin|XAxis|YAxis|ZAxis|XArrow" "\n\t\t: |YArrow|ZArrow|XOYAxis|YOZAxis" "\n\t\t: |XOZAxis|Whole} value]" diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index 00478aa5f5..aa5c53a00b 100644 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -63,6 +63,7 @@ #include #include #include +#include #include #include #include @@ -83,6 +84,7 @@ #include #include #include +#include #include @@ -3988,7 +3990,9 @@ static int VZBuffTrihedron (Draw_Interpretor& /*theDI*/, Aspect_TypeOfTriedronPosition aPosition = Aspect_TOTP_LEFT_LOWER; V3d_TypeOfVisualization aVisType = V3d_ZBUFFER; - Quantity_Color aLabelsColor = Quantity_NOC_WHITE; + Quantity_Color aLabelsColorX = Quantity_NOC_WHITE; + Quantity_Color aLabelsColorY = Quantity_NOC_WHITE; + Quantity_Color aLabelsColorZ = Quantity_NOC_WHITE; Quantity_Color anArrowColorX = Quantity_NOC_RED; Quantity_Color anArrowColorY = Quantity_NOC_GREEN; Quantity_Color anArrowColorZ = Quantity_NOC_BLUE1; @@ -4132,51 +4136,51 @@ static int VZBuffTrihedron (Draw_Interpretor& /*theDI*/, aNbFacets = Draw::Atoi (theArgVec[anArgIter]); } else if (aFlag == "-colorlabel" - || aFlag == "-colorlabels") + || aFlag == "-colorlabels" + || aFlag == "-colorlabelx" + || aFlag == "-colorlabely" + || aFlag == "-colorlabelz" + || aFlag == "-colorarrowx" + || aFlag == "-colorarrowy" + || aFlag == "-colorarrowz") { + Quantity_Color aColor; Standard_Integer aNbParsed = Draw::ParseColor (theArgNb - anArgIter - 1, theArgVec + anArgIter + 1, - aLabelsColor); + aColor); if (aNbParsed == 0) { Message::SendFail() << "Error: wrong syntax at '" << anArg << "'"; return 1; } - anArgIter += aNbParsed; - } - else if (aFlag == "-colorarrowx") - { - Standard_Integer aNbParsed = Draw::ParseColor (theArgNb - anArgIter - 1, - theArgVec + anArgIter + 1, - anArrowColorX); - if (aNbParsed == 0) + + if (aFlag == "-colorarrowx") { - Message::SendFail() << "Error: wrong syntax at '" << anArg << "'"; - return 1; + anArrowColorX = aColor; } - anArgIter += aNbParsed; - } - else if (aFlag == "-colorarrowy") - { - Standard_Integer aNbParsed = Draw::ParseColor (theArgNb - anArgIter - 1, - theArgVec + anArgIter + 1, - anArrowColorY); - if (aNbParsed == 0) + else if (aFlag == "-colorarrowy") { - Message::SendFail() << "Error: wrong syntax at '" << anArg << "'"; - return 1; + anArrowColorY = aColor; } - anArgIter += aNbParsed; - } - else if (aFlag == "-colorarrowz") - { - Standard_Integer aNbParsed = Draw::ParseColor (theArgNb - anArgIter - 1, - theArgVec + anArgIter + 1, - anArrowColorZ); - if (aNbParsed == 0) + else if (aFlag == "-colorarrowz") { - Message::SendFail() << "Error: wrong syntax at '" << anArg << "'"; - return 1; + anArrowColorZ = aColor; + } + else if (aFlag == "-colorlabelx") + { + aLabelsColorX = aColor; + } + else if (aFlag == "-colorlabely") + { + aLabelsColorY = aColor; + } + else if (aFlag == "-colorlabelz") + { + aLabelsColorZ = aColor; + } + else + { + aLabelsColorZ = aLabelsColorY = aLabelsColorX = aColor; } anArgIter += aNbParsed; } @@ -4187,9 +4191,17 @@ static int VZBuffTrihedron (Draw_Interpretor& /*theDI*/, } } - aView->ZBufferTriedronSetup (anArrowColorX, anArrowColorY, anArrowColorZ, - aSizeRatio, anArrowDiam, aNbFacets); - aView->TriedronDisplay (aPosition, aLabelsColor, aScale, aVisType); + const Handle(V3d_Trihedron)& aTrihedron = aView->Trihedron(); + aTrihedron->SetArrowsColor (anArrowColorX, anArrowColorY, anArrowColorZ); + aTrihedron->SetLabelsColor (aLabelsColorX, aLabelsColorY, aLabelsColorZ); + aTrihedron->SetSizeRatio (aSizeRatio); + aTrihedron->SetNbFacets (aNbFacets); + aTrihedron->SetArrowDiameter(anArrowDiam); + aTrihedron->SetScale (aScale); + aTrihedron->SetPosition (aPosition); + aTrihedron->SetWireframe (aVisType == V3d_WIREFRAME); + aTrihedron->Display (aView); + aView->ZFitAll(); return 0; } @@ -13743,7 +13755,10 @@ static int VViewCube (Draw_Interpretor& , || anArg == "-boxcornercolor" || anArg == "-cornercolor" || anArg == "-innercolor" - || anArg == "-textcolor") + || anArg == "-textcolor" + || anArg == "-xaxistextcolor" + || anArg == "-yaxistextcolor" + || anArg == "-zaxistextcolor") { Standard_Integer aNbParsed = Draw::ParseColor (theNbArgs - anArgIter - 1, theArgVec + anArgIter + 1, @@ -13784,6 +13799,18 @@ static int VViewCube (Draw_Interpretor& , { aViewCube->SetTextColor (aColorRgb); } + else if (anArg == "-xaxistextcolor" + || anArg == "-yaxistextcolor" + || anArg == "-zaxistextcolor") + { + Prs3d_DatumParts aDatum = anArg.Value (2) == 'x' + ? Prs3d_DatumParts_XAxis + : (anArg.Value (2) == 'y' + ? Prs3d_DatumParts_YAxis + : Prs3d_DatumParts_ZAxis); + aViewCube->Attributes()->SetOwnDatumAspects(); + aViewCube->Attributes()->DatumAspect()->TextAspect (aDatum)->SetColor (aColorRgb); + } else { aViewCube->SetColor (aColorRgb); @@ -14320,6 +14347,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands) "\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: [-colorLabelX color] [-colorLabelY color] [-colorLabelZ color]" "\n\t\t: Displays a trihedron", __FILE__,VZBuffTrihedron,group); theCommands.Add("vrotate", @@ -14978,7 +15006,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands) "\n\t\t: -reset reset geomertical and visual attributes'" "\n\t\t: -size Size adapted size of View Cube" "\n\t\t: -boxSize Size box size" - "\n\t\t: -axes {0|1 } show/hide axes (trihedron)" + "\n\t\t: -axes {0|1} show/hide axes (trihedron)" "\n\t\t: -edges {0|1} show/hide edges of View Cube" "\n\t\t: -vertices {0|1} show/hide vertices of View Cube" "\n\t\t: -Yup {0|1} -Zup {0|1} set Y-up or Z-up view orientation" @@ -14991,6 +15019,9 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands) "\n\t\t: -innerColor Color inner box color" "\n\t\t: -transparency Value transparency of object within [0, 1] range" "\n\t\t: -boxTransparency Value transparency of box within [0, 1] range" + "\n\t\t: -xAxisTextColor Color color of X axis label" + "\n\t\t: -yAxisTextColor Color color of Y axis label" + "\n\t\t: -zAxisTextColor Color color of Z axis label" "\n\t\t: -font Name font name" "\n\t\t: -fontHeight Value font height" "\n\t\t: -boxFacetExtension Value box facet extension" diff --git a/tests/bugs/vis/bug27958 b/tests/bugs/vis/bug27958 index 952e0f0f59..b704e0080a 100644 --- a/tests/bugs/vis/bug27958 +++ b/tests/bugs/vis/bug27958 @@ -7,6 +7,8 @@ pload VISUALIZATION vclear vinit View1 +vzbufftrihedron -colorLabelX RED -colorLabelY GREEN -colorLabelZ BLUE + vtrihedron t0 vtrihedron t1 @@ -23,15 +25,12 @@ vtrihedron t1 -xaxis 40 60 120 -zaxis -120 0 40 vtrihedron t1 -attribute TubeRadiusPercent 0.03 vtrihedron t1 -attribute ConeRadiusPercent|OriginRadiusPercent 0.05 -vtrihedron t1 -color XAxis Quantity_NOC_RED -vtrihedron t1 -color YAxis Quantity_NOC_GREEN -vtrihedron t1 -color ZAxis|Origin Quantity_NOC_BLUE - -vtrihedron t1 -textColor 1.0 1.0 1.0 -vtrihedron t1 -arrowColor 0.0 0.0 1.0 +vtrihedron t1 -color XAxis|XArrow RED -textColor XAxis RED +vtrihedron t1 -color YAxis|YArrow GREEN -textColor YAxis GREEN +vtrihedron t1 -color ZAxis|ZArrow|Origin BLUE -textColor ZAxis BLUE vtrihedron t2 -origin 0 0 -300 -vtrihedron t2 -color Whole Quantity_NOC_PEACHPUFF +vtrihedron t2 -color Whole PEACHPUFF vselmode t2 1 1 vselmode t2 2 1 vselmode t2 3 1 @@ -39,7 +38,7 @@ vselmode t2 3 1 vtrihedron t3 -dispMode shading -origin 200 200 -300 -color Whole 1.0 0.0 0.0 vtrihedron t3 -drawAxes XY -hideLabels on -vtrihedron t4 -origin -200 -200 300 -hideArrows +vtrihedron t4 -origin -200 -200 300 -hideArrows vfit