From: kgv Date: Thu, 11 May 2017 15:10:53 +0000 (+0300) Subject: 0028726: Quantity_NameOfColor should be replaced by Quantity_Color in function input... X-Git-Tag: V7_2_0_beta~125 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=87432b82788a53706060abffdb4591d1f0757822 0028726: Quantity_NameOfColor should be replaced by Quantity_Color in function input argument AIS_InteractiveObject, virtual methods ::SetColor(), ::Color() returning/accepting Quantity_NameOfColor have been removed. Virtual method ::SetMaterial() accepting Graphic3d_NameOfMaterial has been also removed. V3d_View, V3d_Viewer, V3d_AmbientLight, V3d_DirectionalLight, V3d_Light, V3d_PositionalLight, V3d_SpotLight, Aspect_Window, methods accepting Quantity_NameOfColor have been removed (duplicates) or color argument(s) replaced with Quantity_Color. --- diff --git a/dox/dev_guides/upgrade/upgrade.md b/dox/dev_guides/upgrade/upgrade.md index 7d716d0b63..b9980240bd 100644 --- a/dox/dev_guides/upgrade/upgrade.md +++ b/dox/dev_guides/upgrade/upgrade.md @@ -1230,6 +1230,12 @@ The following Grid management methods within class V3d_Viewer do not implicitly ActivateGrid, DeactivateGrid, SetRectangularGridValues, SetCircularGridValues, RectangularGridGraphicValues, CircularGridGraphicValues, SetPrivilegedPlane, DisplayPrivilegedPlane. +@subsection upgrade_720_v3d_colorname Elimination of Quantity_NameOfColor from TKV3d interface classes + +The duplicating interface methods accepting *Quantity_NameOfColor* (in addition to methods accepting *Quantity_Color*) of TKV3d toolkit have been removed. +In most cases this change should be transparent, however applications implementing such interface methods should also remove them +(compiler will automatically highlight this issue for methods marked with Standard_OVERRIDE keyword). + @subsection upgrade_720_Result_Of_BOP_On_Containers Result of Boolean operations on containers * The result of Boolean operations on arguments of collection types (WIRE/SHELL/COMPSOLID) is now filtered from duplicating containers. diff --git a/samples/CSharp/OCCTProxy/OCCTProxy.cpp b/samples/CSharp/OCCTProxy/OCCTProxy.cpp index 8d2d3fd61a..1d316df167 100644 --- a/samples/CSharp/OCCTProxy/OCCTProxy.cpp +++ b/samples/CSharp/OCCTProxy/OCCTProxy.cpp @@ -489,7 +489,7 @@ public: Quantity_Color aCol = Quantity_Color(theR/255.,theG/255.,theB/255.,Quantity_TOC_RGB); for (; myAISContext()->MoreSelected(); myAISContext()->NextSelected()) { - myAISContext()->SetColor (myAISContext()->SelectedInteractive(), aCol.Name(), Standard_False); + myAISContext()->SetColor (myAISContext()->SelectedInteractive(), aCol, Standard_False); } myAISContext()->UpdateCurrentViewer(); } @@ -527,7 +527,6 @@ public: theGreen=255; theBlue=255; Handle(AIS_InteractiveObject) aCurrent ; - Quantity_Color anObjCol; myAISContext()->InitSelected(); if (!myAISContext()->MoreSelected()) { @@ -536,7 +535,8 @@ public: aCurrent = myAISContext()->SelectedInteractive(); if ( aCurrent->HasColor () ) { - anObjCol = myAISContext()->Color(aCurrent); + Quantity_Color anObjCol; + myAISContext()->Color (aCurrent, anObjCol); Quantity_Parameter r1, r2, r3; anObjCol.Values(r1, r2, r3, Quantity_TOC_RGB); theRed=(int)r1*255; diff --git a/samples/CSharp/OCCTProxy_D3D/OCCTProxyD3D.cpp b/samples/CSharp/OCCTProxy_D3D/OCCTProxyD3D.cpp index c8bd4f1a5b..677c7e94f0 100644 --- a/samples/CSharp/OCCTProxy_D3D/OCCTProxyD3D.cpp +++ b/samples/CSharp/OCCTProxy_D3D/OCCTProxyD3D.cpp @@ -492,7 +492,7 @@ public: Quantity_Color aCol (theR / 255.0, theG / 255.0, theB / 255.0, Quantity_TOC_RGB); for (; myAISContext()->MoreSelected(); myAISContext()->NextSelected()) { - myAISContext()->SetColor (myAISContext()->SelectedInteractive(), aCol.Name(), false); + myAISContext()->SetColor (myAISContext()->SelectedInteractive(), aCol, false); } myAISContext()->UpdateCurrentViewer(); } @@ -549,7 +549,8 @@ public: Handle(AIS_InteractiveObject) aCurrent = myAISContext()->SelectedInteractive(); if (aCurrent->HasColor()) { - Quantity_Color anObjCol = myAISContext()->Color (aCurrent); + Quantity_Color anObjCol; + myAISContext()->Color (aCurrent, anObjCol); theRed = int(anObjCol.Red() * 255.0); theGreen = int(anObjCol.Green() * 255.0); theBlue = int(anObjCol.Blue() * 255.0); diff --git a/samples/mfc/standard/04_Viewer3d/src/Viewer3dDoc.cpp b/samples/mfc/standard/04_Viewer3d/src/Viewer3dDoc.cpp index 62fd159ecc..1afa1680f4 100755 --- a/samples/mfc/standard/04_Viewer3d/src/Viewer3dDoc.cpp +++ b/samples/mfc/standard/04_Viewer3d/src/Viewer3dDoc.cpp @@ -517,7 +517,7 @@ void CViewer3dDoc::InputEvent(const Standard_Integer /*x*/, Handle(AIS_InteractiveObject) Current = myAISContext->SelectedInteractive(); if (Current->HasColor()) { - CSFColor = myAISContext->Color (Current); + myAISContext->Color (Current, CSFColor); MSColor = RGB (CSFColor.Red()*255.0, CSFColor.Green()*255.0, CSFColor.Blue()*255.0); } else @@ -535,7 +535,7 @@ void CViewer3dDoc::InputEvent(const Standard_Integer /*x*/, Quantity_TOC_RGB); Handle(AIS_InteractiveObject) aSelectedObject = myAISContext->SelectedInteractive(); - Handle(User_Cylinder)::DownCast (aSelectedObject)->SetColor (CSFColor.Name()); + Handle(User_Cylinder)::DownCast (aSelectedObject)->SetColor (CSFColor); myAISContext->Redisplay (aSelectedObject, Standard_True); myState = -1; @@ -543,24 +543,14 @@ void CViewer3dDoc::InputEvent(const Standard_Integer /*x*/, } myCResultDialog.SetTitle("Change face color"); - myCResultDialog.SetText(" TopoDS_Shape S = myAISContext->SelectedShape(); \n" - " \n" - " Handle(Geom_Surface) Surface = BRep_Tool::Surface(TopoDS::Face(S));" - " if (Surface->IsKind(STANDARD_TYPE(Geom_Plane))) \n" - " Handle(User_Cylinder)::DownCast(myAISContext->Current())->SetPlanarFaceColor(CSFColor.Name()); \n" - " else \n" - " Handle(User_Cylinder)::DownCast(myAISContext->Current())->SetCylindricalFaceColor(CSFColor.Name()); \n" - " \n" - " myAISContext->Redisplay(myAISContext->Current()); \n" - " \n" - " myAISContext->CloseLocalContext(); \n" + myCResultDialog.SetText( " Handle(AIS_InteractiveObject) aSelectedObject = myAISContext->SelectedInteractive(); \n" + " Handle(User_Cylinder)::DownCast(aSelectedObject)->SetColor (CSFColor); \n" + " myAISContext->Redisplay (myAISContext->Current(), Standard_True); \n" " \n" " \n" " NOTE: a User_Cylinder is an object defined by the user. \n" " The User_Cylinder class inherit from the AIS_InteractiveObject \n" " Cascade class, it's use is the same as an AIS_InteractiveObject. \n" - " Methods SetPlanarFaceColor and SetCylindricalFaceColor are also \n" - " defined in the User_Cylinder class. \n" " \n"); SetTitle (L"Change face color"); } diff --git a/samples/mfc/standard/Common/OCC_3dBaseDoc.cpp b/samples/mfc/standard/Common/OCC_3dBaseDoc.cpp index c52214a5ef..10e44ba79b 100755 --- a/samples/mfc/standard/Common/OCC_3dBaseDoc.cpp +++ b/samples/mfc/standard/Common/OCC_3dBaseDoc.cpp @@ -259,12 +259,12 @@ void OCC_3dBaseDoc::OnObjectColor() { Handle(AIS_InteractiveObject) Current ; COLORREF MSColor ; - Quantity_Color CSFColor ; myAISContext->InitSelected(); Current = myAISContext->SelectedInteractive(); if ( Current->HasColor () ) { - CSFColor = myAISContext->Color(Current); + Quantity_Color CSFColor; + myAISContext->Color (Current, CSFColor); MSColor = RGB (CSFColor.Red()*255.,CSFColor.Green()*255.,CSFColor.Blue()*255.); } else { @@ -275,10 +275,9 @@ void OCC_3dBaseDoc::OnObjectColor() if (dlgColor.DoModal() == IDOK) { MSColor = dlgColor.GetColor(); - CSFColor = Quantity_Color (GetRValue(MSColor)/255.,GetGValue(MSColor)/255., - GetBValue(MSColor)/255.,Quantity_TOC_RGB); + Quantity_Color CSFColor (GetRValue(MSColor)/255., GetGValue(MSColor)/255., GetBValue(MSColor)/255., Quantity_TOC_RGB); for (;myAISContext->MoreSelected ();myAISContext->NextSelected ()) - myAISContext->SetColor (myAISContext->SelectedInteractive(),CSFColor.Name(), Standard_False); + myAISContext->SetColor (myAISContext->SelectedInteractive(), CSFColor, Standard_False); myAISContext->UpdateCurrentViewer(); } } diff --git a/samples/qt/Common/src/DocumentCommon.cxx b/samples/qt/Common/src/DocumentCommon.cxx index 8556ee2467..19aaac6b3f 100755 --- a/samples/qt/Common/src/DocumentCommon.cxx +++ b/samples/qt/Common/src/DocumentCommon.cxx @@ -179,12 +179,12 @@ void DocumentCommon::onShading() void DocumentCommon::onColor() { QColor aColor ; - Quantity_Color aShapeColor; myContext->InitSelected(); Handle(AIS_InteractiveObject) Current = myContext->SelectedInteractive() ; if ( Current->HasColor () ) { - aShapeColor = myContext->Color( Current ); + Quantity_Color aShapeColor; + myContext->Color( Current, aShapeColor ); aColor.setRgb( aShapeColor.Red() * 255, aShapeColor.Green() * 255, aShapeColor.Blue() * 255 ); } else @@ -196,7 +196,7 @@ void DocumentCommon::onColor() Quantity_Color color( aRetColor.red() / 255., aRetColor.green() / 255., aRetColor.blue() / 255., Quantity_TOC_RGB ); for (; myContext->MoreSelected(); myContext->NextSelected() ) - myContext->SetColor( myContext->SelectedInteractive(), color.Name(), Standard_False); + myContext->SetColor( myContext->SelectedInteractive(), color, Standard_False); myContext->UpdateCurrentViewer(); } } diff --git a/src/AIS/AIS_AttributeFilter.cxx b/src/AIS/AIS_AttributeFilter.cxx index 3419c44f4d..6ae5601c4e 100644 --- a/src/AIS/AIS_AttributeFilter.cxx +++ b/src/AIS/AIS_AttributeFilter.cxx @@ -47,7 +47,11 @@ Standard_Boolean AIS_AttributeFilter::IsOk(const Handle(SelectMgr_EntityOwner)& Standard_Boolean okstat = Standard_True; if( hasC && aSelectable->HasColor() ) - okstat = (myCol == aSelectable->Color()); + { + Quantity_Color aColor; + aSelectable->Color (aColor); + okstat = (myCol == aColor.Name()); + } if( hasW && aSelectable->HasWidth() ) okstat = (myWid == aSelectable->Width()) && okstat; diff --git a/src/AIS/AIS_Axis.cxx b/src/AIS/AIS_Axis.cxx index e116b135e4..3aa1600972 100644 --- a/src/AIS/AIS_Axis.cxx +++ b/src/AIS/AIS_Axis.cxx @@ -14,8 +14,8 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - #include + #include #include #include @@ -85,7 +85,7 @@ myIsXYZAxis(Standard_True) aLength = 0.1; } DA->SetAxisLength(aLength,aLength,aLength); - Quantity_NameOfColor col = Quantity_NOC_TURQUOISE; + Quantity_Color col (Quantity_NOC_TURQUOISE); DA->LineAspect(Prs3d_DP_XAxis)->SetColor(col); DA->LineAspect(Prs3d_DP_YAxis)->SetColor(col); DA->LineAspect(Prs3d_DP_ZAxis)->SetColor(col); @@ -209,15 +209,8 @@ void AIS_Axis::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, //======================================================================= //function : SetColor -//purpose : +//purpose : //======================================================================= - - -void AIS_Axis::SetColor(const Quantity_NameOfColor aCol) -{ - SetColor(Quantity_Color(aCol)); -} - void AIS_Axis::SetColor(const Quantity_Color &aCol) { hasOwnColor=Standard_True; diff --git a/src/AIS/AIS_Axis.hxx b/src/AIS/AIS_Axis.hxx index 11db6d5cae..2e52738617 100644 --- a/src/AIS/AIS_Axis.hxx +++ b/src/AIS/AIS_Axis.hxx @@ -17,33 +17,16 @@ #ifndef _AIS_Axis_HeaderFile #define _AIS_Axis_HeaderFile -#include -#include - -#include +#include #include -#include #include -#include -#include -#include -#include -#include +#include #include -#include -#include + class Geom_Line; +class Geom_Axis1Placement; class Geom_Axis2Placement; class Prs3d_LineAspect; -class Geom_Axis1Placement; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; -class Quantity_Color; - - -class AIS_Axis; -DEFINE_STANDARD_HANDLE(AIS_Axis, AIS_InteractiveObject) //! Locates the x, y and z axes in an Interactive Object. //! These are used to orient it correctly in presentations @@ -53,34 +36,30 @@ DEFINE_STANDARD_HANDLE(AIS_Axis, AIS_InteractiveObject) //! then situated relative to one of the axes of the view. class AIS_Axis : public AIS_InteractiveObject { - + DEFINE_STANDARD_RTTIEXT(AIS_Axis, AIS_InteractiveObject) public: - //! Initializes the line aComponent Standard_EXPORT AIS_Axis(const Handle(Geom_Line)& aComponent); - + //! initializes the axis2 position //! aComponent. The coordinate system used is right-handed. Standard_EXPORT AIS_Axis(const Handle(Geom_Axis2Placement)& aComponent, const AIS_TypeOfAxis anAxisType); - + //! Initializes the axis1 position anAxis. Standard_EXPORT AIS_Axis(const Handle(Geom_Axis1Placement)& anAxis); - //! Returns the axis entity aComponent and identifies it //! as a component of a shape. - const Handle(Geom_Line)& Component() const; - + const Handle(Geom_Line)& Component() const { return myComponent; } + //! Sets the coordinates of the lin aComponent. Standard_EXPORT void SetComponent (const Handle(Geom_Line)& aComponent); - //! Returns the position of axis2 and positions it by //! identifying it as the x, y, or z axis and giving its //! direction in 3D space. The coordinate system used is right-handed. - const Handle(Geom_Axis2Placement)& Axis2Placement() const; - + const Handle(Geom_Axis2Placement)& Axis2Placement() const { return myAx2; } //! Allows you to provide settings for aComponent:the //! position and direction of an axis in 3D space. The @@ -91,19 +70,17 @@ public: Standard_EXPORT void SetAxis1Placement (const Handle(Geom_Axis1Placement)& anAxis); //! Returns the type of axis. - AIS_TypeOfAxis TypeOfAxis() const; - + AIS_TypeOfAxis TypeOfAxis() const { return myTypeOfAxis; } - //! Constructs the entity aTypeAxis to stock information + //! Constructs the entity theTypeAxis to stock information //! concerning type of axis. - void SetTypeOfAxis (const AIS_TypeOfAxis aTypeAxis); - + void SetTypeOfAxis (const AIS_TypeOfAxis theTypeAxis) { myTypeOfAxis = theTypeAxis; } //! Returns a signature of 2 for axis datums. When you //! activate mode 2 by a signature, you pick AIS objects //! of type AIS_Axis. - Standard_Boolean IsXYZAxis() const; - + Standard_Boolean IsXYZAxis() const { return myIsXYZAxis; } + //! Returns true if the interactive object accepts the display mode aMode. Standard_EXPORT Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE; @@ -115,13 +92,11 @@ public: //! WARNING : must be applied //! to the object to display before computation !!! Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - - virtual Standard_Integer Signature() const Standard_OVERRIDE; - - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE; - - Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE; - + + virtual Standard_Integer Signature() const Standard_OVERRIDE { return 2; } + + virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; } + Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE; Standard_EXPORT void SetWidth (const Standard_Real aValue) Standard_OVERRIDE; @@ -130,19 +105,8 @@ public: Standard_EXPORT void UnsetWidth() Standard_OVERRIDE; - - - - DEFINE_STANDARD_RTTIEXT(AIS_Axis,AIS_InteractiveObject) - -protected: - - - - private: - Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; @@ -151,6 +115,8 @@ private: Standard_EXPORT void ComputeFields(); +private: + Handle(Geom_Line) myComponent; Handle(Geom_Axis2Placement) myAx2; gp_Pnt myPfirst; @@ -162,14 +128,8 @@ private: Standard_CString myText; Handle(Prs3d_LineAspect) myLineAspect; - }; - -#include - - - - +DEFINE_STANDARD_HANDLE(AIS_Axis, AIS_InteractiveObject) #endif // _AIS_Axis_HeaderFile diff --git a/src/AIS/AIS_Axis.lxx b/src/AIS/AIS_Axis.lxx deleted file mode 100644 index 9840b77f63..0000000000 --- a/src/AIS/AIS_Axis.lxx +++ /dev/null @@ -1,69 +0,0 @@ -// Created on: 1997-03-03 -// Created by: Jean-Pierre COMBE -// Copyright (c) 1997-1999 Matra Datavision -// Copyright (c) 1999-2014 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. - -//======================================================================= -//function : Component -//purpose : -//======================================================================= - -inline const Handle(Geom_Line)& AIS_Axis::Component() const -{ - return myComponent; -} - -//======================================================================= -//function : Axis2Placement -//purpose : -//======================================================================= - -inline const Handle(Geom_Axis2Placement)& AIS_Axis::Axis2Placement() const -{ - return myAx2; -} - -//======================================================================= -//function : TypeOfAxis: -//purpose : -//======================================================================= -inline AIS_TypeOfAxis AIS_Axis::TypeOfAxis() const -{ - return myTypeOfAxis; -} - -//======================================================================= -//function : SetTypeOfAxis -//purpose : -//======================================================================= - -inline void AIS_Axis::SetTypeOfAxis(const AIS_TypeOfAxis aTypeAxis) -{ - myTypeOfAxis = aTypeAxis; -} - -//======================================================================= -//function : IsXYZAxis -//purpose : -//======================================================================= -inline Standard_Boolean AIS_Axis::IsXYZAxis() const -{ - return myIsXYZAxis; -} -inline AIS_KindOfInteractive AIS_Axis::Type() const -{return AIS_KOI_Datum;} - - -inline Standard_Integer AIS_Axis::Signature() const -{return 2;} diff --git a/src/AIS/AIS_Circle.cxx b/src/AIS/AIS_Circle.cxx index 4ab0ccacb4..0c07482fef 100644 --- a/src/AIS/AIS_Circle.cxx +++ b/src/AIS/AIS_Circle.cxx @@ -14,8 +14,8 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. - #include + #include #include #include @@ -112,17 +112,6 @@ void AIS_Circle::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, } - -//======================================================================= -//function : SetColor -//purpose : -//======================================================================= - -void AIS_Circle::SetColor(const Quantity_NameOfColor aCol) -{ - SetColor(Quantity_Color(aCol)); -} - //======================================================================= //function : SetColor //purpose : diff --git a/src/AIS/AIS_Circle.hxx b/src/AIS/AIS_Circle.hxx index 327bf01f4c..7e49f5abab 100644 --- a/src/AIS/AIS_Circle.hxx +++ b/src/AIS/AIS_Circle.hxx @@ -17,35 +17,17 @@ #ifndef _AIS_Circle_HeaderFile #define _AIS_Circle_HeaderFile -#include -#include - -#include -#include #include -#include -#include -#include -#include -#include -class Geom_Circle; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; -class Quantity_Color; - -class AIS_Circle; -DEFINE_STANDARD_HANDLE(AIS_Circle, AIS_InteractiveObject) +class Geom_Circle; //! Constructs circle datums to be used in construction of //! composite shapes. class AIS_Circle : public AIS_InteractiveObject { - + DEFINE_STANDARD_RTTIEXT(AIS_Circle, AIS_InteractiveObject) public: - //! Initializes this algorithm for constructing AIS circle //! datums initializes the circle aCircle Standard_EXPORT AIS_Circle(const Handle(Geom_Circle)& aCircle); @@ -66,31 +48,39 @@ public: Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; //! Returns index 6 by default. - virtual Standard_Integer Signature() const Standard_OVERRIDE; - + virtual Standard_Integer Signature() const Standard_OVERRIDE { return 6; } + //! Indicates that the type of Interactive Object is a datum. - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE; - + virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; } + //! Returns the circle component defined in SetCircle. - const Handle(Geom_Circle)& Circle() const; - + const Handle(Geom_Circle)& Circle() const { return myComponent; } //! Constructs instances of the starting point and the end - //! point parameters, u1 and u2. - void Parameters (Standard_Real& u1, Standard_Real& u2) const; - + //! point parameters, theU1 and theU2. + void Parameters (Standard_Real& theU1, Standard_Real& theU2) const + { + theU1 = myUStart; + theU2 = myUEnd; + } + //! Allows you to provide settings for the circle datum aCircle. - void SetCircle (const Handle(Geom_Circle)& aCircle); - - //! Allows you to set the parameter u for the starting point of an arc. - void SetFirstParam (const Standard_Real u); - - //! Allows you to provide the parameter u for the end point of an arc. - void SetLastParam (const Standard_Real u); - - //! Assigns the color aColor to the solid line boundary of the circle datum. - Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE; - + void SetCircle (const Handle(Geom_Circle)& theCircle) { myComponent = theCircle; } + + //! Allows you to set the parameter theU for the starting point of an arc. + void SetFirstParam (const Standard_Real theU) + { + myUStart = theU; + myCircleIsArc = Standard_True; + } + + //! Allows you to provide the parameter theU for the end point of an arc. + void SetLastParam (const Standard_Real theU) + { + myUEnd = theU; + myCircleIsArc = Standard_True; + } + Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE; //! Assigns the width aValue to the solid line boundary of the circle datum. @@ -103,25 +93,14 @@ public: Standard_EXPORT void UnsetWidth() Standard_OVERRIDE; //! Returns the type of sensitivity for the circle; - Standard_Boolean IsFilledCircleSens() const; - + Standard_Boolean IsFilledCircleSens() const { return myIsFilledCircleSens; } + //! Sets the type of sensitivity for the circle. If theIsFilledCircleSens set to Standard_True //! then the whole circle will be detectable, otherwise only the boundary of the circle. - void SetFilledCircleSens (const Standard_Boolean theIsFilledCircleSens); - - - - - DEFINE_STANDARD_RTTIEXT(AIS_Circle,AIS_InteractiveObject) - -protected: - - - + void SetFilledCircleSens (const Standard_Boolean theIsFilledCircleSens) { myIsFilledCircleSens = theIsFilledCircleSens; } private: - Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; @@ -136,20 +115,16 @@ private: Standard_EXPORT void ComputeArcSelection (const Handle(SelectMgr_Selection)& aSelection); +private: + Handle(Geom_Circle) myComponent; Standard_Real myUStart; Standard_Real myUEnd; Standard_Boolean myCircleIsArc; Standard_Boolean myIsFilledCircleSens; - }; - -#include - - - - +DEFINE_STANDARD_HANDLE(AIS_Circle, AIS_InteractiveObject) #endif // _AIS_Circle_HeaderFile diff --git a/src/AIS/AIS_Circle.lxx b/src/AIS/AIS_Circle.lxx deleted file mode 100644 index 544a3add68..0000000000 --- a/src/AIS/AIS_Circle.lxx +++ /dev/null @@ -1,47 +0,0 @@ -// Created on: 1997-03-06 -// Created by: Robert COUBLANC -// Copyright (c) 1997-1999 Matra Datavision -// Copyright (c) 1999-2014 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. - -inline AIS_KindOfInteractive AIS_Circle::Type() const -{return AIS_KOI_Datum;} - - -inline Standard_Integer AIS_Circle::Signature() const -{return 6;} - -inline const Handle(Geom_Circle)& -AIS_Circle::Circle() const -{return myComponent;} - -inline void AIS_Circle::Parameters(Standard_Real& U1,Standard_Real& U2) const -{U1=myUStart;U2=myUEnd;} - -inline void AIS_Circle::SetCircle(const Handle(Geom_Circle)& C) -{myComponent=C;} - -inline void AIS_Circle::SetFirstParam(const Standard_Real U) -{myUStart=U;myCircleIsArc = Standard_True;} -inline void AIS_Circle::SetLastParam(const Standard_Real U) -{myUEnd=U; myCircleIsArc = Standard_True;} - -inline Standard_Boolean AIS_Circle::IsFilledCircleSens() const -{ - return myIsFilledCircleSens; -} - -inline void AIS_Circle::SetFilledCircleSens (const Standard_Boolean theIsFilledCircleSens) -{ - myIsFilledCircleSens = theIsFilledCircleSens; -} diff --git a/src/AIS/AIS_ColoredShape.cxx b/src/AIS/AIS_ColoredShape.cxx index 223864d672..b3b3816397 100644 --- a/src/AIS/AIS_ColoredShape.cxx +++ b/src/AIS/AIS_ColoredShape.cxx @@ -94,7 +94,9 @@ AIS_ColoredShape::AIS_ColoredShape (const Handle(AIS_Shape)& theShape) } if (theShape->HasColor()) { - SetColor (theShape->Color()); + Quantity_Color aColor; + theShape->Color (aColor); + SetColor (aColor); } if (theShape->HasWidth()) { diff --git a/src/AIS/AIS_InteractiveContext.cxx b/src/AIS/AIS_InteractiveContext.cxx index f0df76bf7e..3fcae94326 100644 --- a/src/AIS/AIS_InteractiveContext.cxx +++ b/src/AIS/AIS_InteractiveContext.cxx @@ -1763,17 +1763,6 @@ void AIS_InteractiveContext::redisplayPrsModes (const Handle(AIS_InteractiveObje } } -//======================================================================= -//function : SetColor -//purpose : -//======================================================================= -void AIS_InteractiveContext::SetColor (const Handle(AIS_InteractiveObject)& theIObj, - const Quantity_NameOfColor theColor, - const Standard_Boolean theToUpdateViewer) -{ - SetColor (theIObj, Quantity_Color(theColor), theToUpdateViewer); -} - //======================================================================= //function : SetColor //purpose : @@ -2015,15 +2004,6 @@ Standard_Boolean AIS_InteractiveContext::HasColor (const Handle(AIS_InteractiveO return theIObj->HasColor(); } -//======================================================================= -//function : Color -//purpose : -//======================================================================= -Quantity_NameOfColor AIS_InteractiveContext::Color (const Handle(AIS_InteractiveObject)& theIObj) const -{ - return theIObj->Color(); -} - //======================================================================= //function : Color //purpose : @@ -2098,7 +2078,7 @@ void AIS_InteractiveContext::UnsetWidth (const Handle(AIS_InteractiveObject)& th //purpose : //======================================================================= void AIS_InteractiveContext::SetMaterial (const Handle(AIS_InteractiveObject)& theIObj, - const Graphic3d_NameOfMaterial theName, + const Graphic3d_MaterialAspect& theMaterial, const Standard_Boolean theToUpdateViewer) { if (theIObj.IsNull()) @@ -2107,7 +2087,7 @@ void AIS_InteractiveContext::SetMaterial (const Handle(AIS_InteractiveObject)& t } setContextToObject (theIObj); - theIObj->SetMaterial (theName); + theIObj->SetMaterial (theMaterial); redisplayPrsRecModes (theIObj, theToUpdateViewer); } @@ -2735,7 +2715,7 @@ void AIS_InteractiveContext::InitAttributes() Handle(Prs3d_DatumAspect) aTrihAspect = myDefaultDrawer->DatumAspect(); const Standard_Real aLength = 100.0; aTrihAspect->SetAxisLength (aLength, aLength, aLength); - const Quantity_NameOfColor aColor = Quantity_NOC_LIGHTSTEELBLUE4; + const Quantity_Color aColor = Quantity_NOC_LIGHTSTEELBLUE4; aTrihAspect->LineAspect(Prs3d_DP_XAxis)->SetColor (aColor); aTrihAspect->LineAspect(Prs3d_DP_YAxis)->SetColor (aColor); aTrihAspect->LineAspect(Prs3d_DP_ZAxis)->SetColor (aColor); diff --git a/src/AIS/AIS_InteractiveContext.hxx b/src/AIS/AIS_InteractiveContext.hxx index 7a55ce726b..d9b070a5a9 100644 --- a/src/AIS/AIS_InteractiveContext.hxx +++ b/src/AIS/AIS_InteractiveContext.hxx @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -439,11 +438,6 @@ public: //! default facing model is Aspect_TOFM_TWO_SIDE. This mean that attributes is //! applying both on the front and back face. Standard_EXPORT void SetCurrentFacingModel (const Handle(AIS_InteractiveObject)& aniobj, const Aspect_TypeOfFacingModel aModel = Aspect_TOFM_BOTH_SIDE); - - Standard_EXPORT void SetColor (const Handle(AIS_InteractiveObject)& theIObj, - const Quantity_NameOfColor theColor, - const Standard_Boolean theToUpdateViewer); - //! Sets the color of the selected entity. //! If a local context is open and if updateviewer equals @@ -484,14 +478,12 @@ public: //! Provides the type of material setting for the view of //! the entity aniobj. - //! The range of settings includes: BRASS, BRONZE, - //! GOLD, PEWTER, SILVER, STONE. //! If a local context is open and if updateviewer equals //! Standard_False, the presentation of the Interactive //! Object activates the selection mode; the object is //! displayed but no viewer will be updated. Standard_EXPORT void SetMaterial (const Handle(AIS_InteractiveObject)& theIObj, - const Graphic3d_NameOfMaterial theName, + const Graphic3d_MaterialAspect& theMaterial, const Standard_Boolean theToUpdateViewer); @@ -648,9 +640,6 @@ public: //! Returns true if a view of the Interactive Object aniobj has color. Standard_EXPORT Standard_Boolean HasColor (const Handle(AIS_InteractiveObject)& aniobj) const; - - Standard_EXPORT Quantity_NameOfColor Color (const Handle(AIS_InteractiveObject)& aniobj) const; - //! Returns the color Color of the entity aniobj in the interactive context. Standard_EXPORT void Color (const Handle(AIS_InteractiveObject)& aniobj, Quantity_Color& acolor) const; diff --git a/src/AIS/AIS_InteractiveObject.cxx b/src/AIS/AIS_InteractiveObject.cxx index 52ef7c6cd6..fba30b6cf0 100644 --- a/src/AIS/AIS_InteractiveObject.cxx +++ b/src/AIS/AIS_InteractiveObject.cxx @@ -53,7 +53,6 @@ AIS_InteractiveObject::AIS_InteractiveObject (const PrsMgr_TypeOfPresentation3d : SelectMgr_SelectableObject (aTypeOfPresentation3d), myCTXPtr (NULL), myOwnWidth (0.0), - myOwnMaterial (Graphic3d_NOM_DEFAULT), myCurrentFacingModel (Aspect_TOFM_BOTH_SIDE), myInfiniteState (Standard_False), hasOwnColor (Standard_False), @@ -180,16 +179,6 @@ Aspect_TypeOfFacingModel AIS_InteractiveObject::CurrentFacingModel() const { //purpose : //======================================================================= -void AIS_InteractiveObject::SetColor(const Quantity_NameOfColor aColor) -{ - SetColor(Quantity_Color(aColor)); -} - -//======================================================================= -//function : SetColor -//purpose : -//======================================================================= - void AIS_InteractiveObject::SetColor(const Quantity_Color& theColor) { myDrawer->SetColor (theColor); @@ -223,29 +212,18 @@ void AIS_InteractiveObject::UnsetWidth() myOwnWidth = 0.; } - //======================================================================= -//function : SetMaterial +//function : Material //purpose : //======================================================================= -void AIS_InteractiveObject::SetMaterial (const Graphic3d_NameOfMaterial theName) +Graphic3d_NameOfMaterial AIS_InteractiveObject::Material() const { - if (!myDrawer->HasOwnShadingAspect()) - { - myDrawer->SetShadingAspect (new Prs3d_ShadingAspect()); - if (myDrawer->HasLink()) - { - *myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect(); - } - } - myDrawer->ShadingAspect()->SetMaterial (theName); - myOwnMaterial = theName; - hasOwnMaterial = Standard_True; + return myDrawer->ShadingAspect()->Material().Name(); } //======================================================================= //function : SetMaterial -//purpose : +//purpose : //======================================================================= void AIS_InteractiveObject::SetMaterial (const Graphic3d_MaterialAspect& theMaterial) { @@ -257,6 +235,7 @@ void AIS_InteractiveObject::SetMaterial (const Graphic3d_MaterialAspect& theMate *myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect(); } } + myDrawer->ShadingAspect()->SetMaterial (theMaterial); hasOwnMaterial = Standard_True; } diff --git a/src/AIS/AIS_InteractiveObject.hxx b/src/AIS/AIS_InteractiveObject.hxx index f561de9d21..17f7b07530 100644 --- a/src/AIS/AIS_InteractiveObject.hxx +++ b/src/AIS/AIS_InteractiveObject.hxx @@ -119,17 +119,12 @@ public: //! Returns the current facing model which is in effect. Standard_EXPORT Aspect_TypeOfFacingModel CurrentFacingModel() const; - - Standard_EXPORT virtual void SetColor (const Quantity_Color& aColor); - - //! only the interactive obj knowns which Drawer attribute - //! is affected by the color (ex: for a wire, it's the - //! wireaspect field of the drawer, but for a vertex, only - //! the point aspect field is affected by the color) - //! WARNING : Do not forget to set the corresponding fields - //! here (hasOwnColor and myDrawer->SetColor()) - Standard_EXPORT virtual void SetColor (const Quantity_NameOfColor aColor); - + + //! Only the interactive object knowns which Drawer attribute is affected by the color, if any + //! (ex: for a wire,it's the wireaspect field of the drawer, but for a vertex, only the point aspect field is affected by the color). + //! WARNING : Do not forget to set the corresponding fields here (hasOwnColor and myDrawer->SetColor()) + Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor); + //! Removes color settings. Only the Interactive Object //! knows which Drawer attribute is affected by the color //! setting. For a wire, for example, wire aspect is the @@ -285,8 +280,6 @@ public: Standard_Boolean HasColor() const { return hasOwnColor; } //! Returns the color setting of the Interactive Object. - virtual Quantity_NameOfColor Color() const { return myDrawer->Color().Name(); } - virtual void Color (Quantity_Color& theColor) const { theColor = myDrawer->Color(); } //! Returns true if the Interactive Object has width. @@ -306,14 +299,8 @@ public: //! - Pewter //! - Silver //! - Stone. - virtual Graphic3d_NameOfMaterial Material() const { return myOwnMaterial; } + Standard_EXPORT virtual Graphic3d_NameOfMaterial Material() const; - //! Sets the name aName for material defining this - //! display attribute for the interactive object. - //! Material aspect determines shading aspect, color and - //! transparency of visible entities. - Standard_EXPORT virtual void SetMaterial (const Graphic3d_NameOfMaterial aName); - //! Sets the material aMat defining this display attribute //! for the interactive object. //! Material aspect determines shading aspect, color and @@ -424,7 +411,6 @@ protected: TColStd_ListOfInteger myToRecomputeModes; Standard_Real myOwnWidth; - Graphic3d_NameOfMaterial myOwnMaterial; Aspect_TypeOfFacingModel myCurrentFacingModel; Standard_Boolean myInfiniteState; Standard_Boolean hasOwnColor; diff --git a/src/AIS/AIS_Line.cxx b/src/AIS/AIS_Line.cxx index 730f3b3c3f..fceb20d93b 100644 --- a/src/AIS/AIS_Line.cxx +++ b/src/AIS/AIS_Line.cxx @@ -14,9 +14,9 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#include #include -#include #include #include #include @@ -152,17 +152,10 @@ void AIS_Line::ComputeSelection(const Handle(SelectMgr_Selection)& theSelection, } } - //======================================================================= //function : SetColor -//purpose : +//purpose : //======================================================================= - -void AIS_Line::SetColor(const Quantity_NameOfColor aCol) -{ - SetColor(Quantity_Color(aCol)); -} - void AIS_Line::SetColor(const Quantity_Color &aCol) { hasOwnColor=Standard_True; diff --git a/src/AIS/AIS_Line.hxx b/src/AIS/AIS_Line.hxx index b0afd0a25c..05abbcf078 100644 --- a/src/AIS/AIS_Line.hxx +++ b/src/AIS/AIS_Line.hxx @@ -17,43 +17,26 @@ #ifndef _AIS_Line_HeaderFile #define _AIS_Line_HeaderFile -#include -#include - -#include #include -#include -#include -#include #include -#include -#include + class Geom_Line; class Geom_Point; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; -class Quantity_Color; - - -class AIS_Line; -DEFINE_STANDARD_HANDLE(AIS_Line, AIS_InteractiveObject) //! Constructs line datums to be used in construction of //! composite shapes. class AIS_Line : public AIS_InteractiveObject { - + DEFINE_STANDARD_RTTIEXT(AIS_Line, AIS_InteractiveObject) public: - //! Initializes the line aLine. Standard_EXPORT AIS_Line(const Handle(Geom_Line)& aLine); - + //! Initializes a starting point aStartPoint //! and a finishing point aEndPoint for the line. Standard_EXPORT AIS_Line(const Handle(Geom_Point)& aStartPoint, const Handle(Geom_Point)& aEndPoint); - + //! computes the presentation according to a point of view //! given by . //! To be Used when the associated degenerated Presentations @@ -62,56 +45,53 @@ public: //! WARNING : must be applied //! to the object to display before computation !!! Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - + //! Returns the signature 5. - virtual Standard_Integer Signature() const Standard_OVERRIDE; - + virtual Standard_Integer Signature() const Standard_OVERRIDE { return 5; } + //! Returns the type Datum. - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE; - + virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; } + //! Constructs an infinite line. - const Handle(Geom_Line)& Line() const; - - //! Returns the starting point PStart and the end point - //! PEnd of the line set by SetPoints. - void Points (Handle(Geom_Point)& PStart, Handle(Geom_Point)& PEnd) const; - + const Handle(Geom_Line)& Line() const { return myComponent; } + + //! Returns the starting point thePStart and the end point thePEnd of the line set by SetPoints. + void Points (Handle(Geom_Point)& thePStart, Handle(Geom_Point)& thePEnd) const + { + thePStart = myStartPoint; + thePEnd = myEndPoint; + } + //! instantiates an infinite line. - void SetLine (const Handle(Geom_Line)& L); - + void SetLine (const Handle(Geom_Line)& theLine) + { + myComponent = theLine; + myLineIsSegment = Standard_False; + } - //! Sets the starting point P1 and ending point P2 of the + //! Sets the starting point thePStart and ending point thePEnd of the //! infinite line to create a finite line segment. - void SetPoints (const Handle(Geom_Point)& P1, const Handle(Geom_Point)& P2); - - //! Provides a new color setting aColor for the line in the - //! drawing tool, or "Drawer". - Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE; - + void SetPoints (const Handle(Geom_Point)& thePStart, const Handle(Geom_Point)& thePEnd) + { + myStartPoint = thePStart; + myEndPoint = thePEnd; + myLineIsSegment = Standard_True; + } + + //! Provides a new color setting aColor for the line in the drawing tool, or "Drawer". Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE; - + //! Provides the new width setting aValue for the line in //! the drawing tool, or "Drawer". Standard_EXPORT void SetWidth (const Standard_Real aValue) Standard_OVERRIDE; - + //! Removes the color setting and returns the original color. Standard_EXPORT void UnsetColor() Standard_OVERRIDE; - + //! Removes the width setting and returns the original width. Standard_EXPORT void UnsetWidth() Standard_OVERRIDE; - - - - DEFINE_STANDARD_RTTIEXT(AIS_Line,AIS_InteractiveObject) - -protected: - - - - private: - Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; @@ -127,19 +107,15 @@ private: Standard_EXPORT void ComputeSegmentLineSelection (const Handle(SelectMgr_Selection)& aSelection); +private: + Handle(Geom_Line) myComponent; Handle(Geom_Point) myStartPoint; Handle(Geom_Point) myEndPoint; Standard_Boolean myLineIsSegment; - }; - -#include - - - - +DEFINE_STANDARD_HANDLE(AIS_Line, AIS_InteractiveObject) #endif // _AIS_Line_HeaderFile diff --git a/src/AIS/AIS_Line.lxx b/src/AIS/AIS_Line.lxx deleted file mode 100644 index 62a76b56de..0000000000 --- a/src/AIS/AIS_Line.lxx +++ /dev/null @@ -1,37 +0,0 @@ -// Created on: 1997-03-06 -// Created by: Robert COUBLANC -// Copyright (c) 1997-1999 Matra Datavision -// Copyright (c) 1999-2014 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. - -inline AIS_KindOfInteractive AIS_Line::Type() const -{return AIS_KOI_Datum;} - - -inline Standard_Integer AIS_Line::Signature() const -{return 5;} - -inline const Handle(Geom_Line)& AIS_Line::Line() const -{return myComponent;} -inline void AIS_Line::Points( Handle(Geom_Point)& PStart, - Handle(Geom_Point)& PEnd) const -{ PStart = myStartPoint; PEnd = myEndPoint;} -inline void AIS_Line::SetLine(const Handle(Geom_Line)& L) -{myComponent =L;myLineIsSegment=Standard_False;} -inline void AIS_Line::SetPoints(const Handle(Geom_Point)& PStart, - const Handle(Geom_Point)& PEnd) -{ - myStartPoint=PStart; - myEndPoint = PEnd; - myLineIsSegment=Standard_True; -} diff --git a/src/AIS/AIS_Plane.cxx b/src/AIS/AIS_Plane.cxx index 23fde864db..a2b9510efd 100644 --- a/src/AIS/AIS_Plane.cxx +++ b/src/AIS/AIS_Plane.cxx @@ -14,9 +14,9 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#include #include -#include #include #include #include @@ -435,18 +435,10 @@ Standard_Boolean AIS_Plane::Size(Standard_Real& X,Standard_Real& Y) const return Abs(X-Y)<=Precision::Confusion(); } - //======================================================================= //function : SetColor //purpose : //======================================================================= - - -void AIS_Plane::SetColor(const Quantity_NameOfColor aCol) -{ - SetColor(Quantity_Color(aCol)); -} - void AIS_Plane::SetColor(const Quantity_Color &aCol) { // if the plane already has its proper size, there is an already created planeaspect @@ -496,8 +488,7 @@ void AIS_Plane::UnsetColor() else{ const Handle(Prs3d_PlaneAspect) PA = myDrawer->HasLink() ? myDrawer->Link()->PlaneAspect() : new Prs3d_PlaneAspect(); -// const Handle(Prs3d_DatumAspect)& DA = myDrawer->Link()->DatumAspect(); - Quantity_NameOfColor Col = PA->EdgesAspect()->Aspect()->Color().Name(); + Quantity_Color Col = PA->EdgesAspect()->Aspect()->Color(); myDrawer->PlaneAspect()->EdgesAspect()->SetColor(Col); myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(Col); diff --git a/src/AIS/AIS_Plane.hxx b/src/AIS/AIS_Plane.hxx index b5419082de..73364aec10 100644 --- a/src/AIS/AIS_Plane.hxx +++ b/src/AIS/AIS_Plane.hxx @@ -17,41 +17,22 @@ #ifndef _AIS_Plane_HeaderFile #define _AIS_Plane_HeaderFile -#include -#include - -#include -#include +#include #include +#include #include -#include -#include -#include -#include -#include -#include -#include + class Geom_Plane; class Geom_Axis2Placement; class gp_Pnt; -class AIS_InteractiveContext; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; -class Quantity_Color; - - -class AIS_Plane; -DEFINE_STANDARD_HANDLE(AIS_Plane, AIS_InteractiveObject) //! Constructs plane datums to be used in construction of //! composite shapes. class AIS_Plane : public AIS_InteractiveObject { - + DEFINE_STANDARD_RTTIEXT(AIS_Plane, AIS_InteractiveObject) public: - //! initializes the plane aComponent. If //! the mode aCurrentMode equals true, the drawing //! tool, "Drawer" is not initialized. @@ -82,16 +63,16 @@ public: Standard_EXPORT void UnsetSize(); Standard_EXPORT Standard_Boolean Size (Standard_Real& X, Standard_Real& Y) const; - - Standard_Boolean HasOwnSize() const; - + + Standard_Boolean HasOwnSize() const { return myHasOwnSize; } + Standard_EXPORT virtual Standard_Integer Signature() const Standard_OVERRIDE; Standard_EXPORT virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE; //! Returns the component specified in SetComponent. - const Handle(Geom_Plane)& Component(); - + const Handle(Geom_Plane)& Component() { return myComponent; } + //! Creates an instance of the plane aComponent. Standard_EXPORT void SetComponent (const Handle(Geom_Plane)& aComponent); @@ -104,14 +85,13 @@ public: //! for the selected plane. These include: center point //! aCenter, maximum aPmax and minimum aPmin. Standard_EXPORT void SetPlaneAttributes (const Handle(Geom_Plane)& aComponent, const gp_Pnt& aCenter, const gp_Pnt& aPmin, const gp_Pnt& aPmax); - + //! Returns the coordinates of the center point. - const gp_Pnt& Center() const; - + const gp_Pnt& Center() const { return myCenter; } + + //! Provides settings for the center theCenter other than (0, 0, 0). + void SetCenter (const gp_Pnt& theCenter) { myCenter = theCenter; } - //! Provides settings for the center aCenter other than (0, 0, 0). - void SetCenter (const gp_Pnt& aCenter); - //! Allows you to provide settings for the position and //! direction of one of the plane's axes, aComponent, in //! 3D space. The coordinate system used is @@ -128,31 +108,30 @@ public: Standard_EXPORT Handle(Geom_Axis2Placement) Axis2Placement(); //! Returns the type of plane - xy, yz, xz or unknown. - AIS_TypeOfPlane TypeOfPlane(); - + AIS_TypeOfPlane TypeOfPlane() { return myTypeOfPlane; } + //! Returns the type of plane - xy, yz, or xz. - Standard_Boolean IsXYZPlane(); - + Standard_Boolean IsXYZPlane() { return myIsXYZPlane; } + //! Returns the non-default current display mode set by SetCurrentMode. - Standard_Boolean CurrentMode(); - + Standard_Boolean CurrentMode() { return myCurrentMode; } //! Allows you to provide settings for a non-default //! current display mode. - void SetCurrentMode (const Standard_Boolean aCurrentMode); - + void SetCurrentMode (const Standard_Boolean theCurrentMode) { myCurrentMode = theCurrentMode; } + //! Returns true if the display mode selected, aMode, is valid for planes. Standard_EXPORT virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE; //! connection to default drawer implies a recomputation of Frame values. Standard_EXPORT virtual void SetContext (const Handle(AIS_InteractiveContext)& aCtx) Standard_OVERRIDE; - + //! Returns the type of sensitivity for the plane; - Select3D_TypeOfSensitivity TypeOfSensitivity() const; - + Select3D_TypeOfSensitivity TypeOfSensitivity() const { return myTypeOfSensitivity; } + //! Sets the type of sensitivity for the plane. - void SetTypeOfSensitivity (const Select3D_TypeOfSensitivity& theTypeOfSensitivity); - + void SetTypeOfSensitivity (Select3D_TypeOfSensitivity theTypeOfSensitivity) { myTypeOfSensitivity = theTypeOfSensitivity; } + //! computes the presentation according to a point of view //! given by . //! To be Used when the associated degenerated Presentations @@ -163,26 +142,13 @@ public: Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, const Standard_Integer theMode) Standard_OVERRIDE; - - Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE; - - Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE; - - Standard_EXPORT void UnsetColor() Standard_OVERRIDE; - - - - - DEFINE_STANDARD_RTTIEXT(AIS_Plane,AIS_InteractiveObject) - -protected: - + Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE; + Standard_EXPORT void UnsetColor() Standard_OVERRIDE; private: - Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; @@ -193,6 +159,8 @@ private: Standard_EXPORT void InitDrawerAttributes(); +private: + Handle(Geom_Plane) myComponent; Handle(Geom_Axis2Placement) myAx2; gp_Pnt myCenter; @@ -205,14 +173,8 @@ private: Standard_Boolean myHasOwnSize; Select3D_TypeOfSensitivity myTypeOfSensitivity; - }; - -#include - - - - +DEFINE_STANDARD_HANDLE(AIS_Plane, AIS_InteractiveObject) #endif // _AIS_Plane_HeaderFile diff --git a/src/AIS/AIS_Plane.lxx b/src/AIS/AIS_Plane.lxx deleted file mode 100644 index 90df73229e..0000000000 --- a/src/AIS/AIS_Plane.lxx +++ /dev/null @@ -1,56 +0,0 @@ -// Created on: 1997-03-06 -// Created by: Robert COUBLANC -// Copyright (c) 1997-1999 Matra Datavision -// Copyright (c) 1999-2014 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. - -inline Standard_Boolean AIS_Plane::HasOwnSize() const -{return myHasOwnSize;} - -inline const Handle(Geom_Plane)& AIS_Plane::Component() -{return myComponent;} - -inline AIS_TypeOfPlane AIS_Plane::TypeOfPlane() -{return myTypeOfPlane;} - -inline Standard_Boolean AIS_Plane::IsXYZPlane() -{ - return myIsXYZPlane; -} - - -inline Standard_Boolean AIS_Plane::CurrentMode() -{return myCurrentMode;} - -inline void AIS_Plane::SetCurrentMode(const Standard_Boolean aCurrentMode) -{myCurrentMode = aCurrentMode;} - -inline const gp_Pnt& AIS_Plane::Center() const -{ - return myCenter; -} - -inline void AIS_Plane::SetCenter(const gp_Pnt& aCenter) -{ - myCenter = aCenter; -} - -inline Select3D_TypeOfSensitivity AIS_Plane::TypeOfSensitivity() const -{ - return myTypeOfSensitivity; -} - -inline void AIS_Plane::SetTypeOfSensitivity (const Select3D_TypeOfSensitivity& theTypeOfSensitivity) -{ - myTypeOfSensitivity = theTypeOfSensitivity; -} diff --git a/src/AIS/AIS_PlaneTrihedron.cxx b/src/AIS/AIS_PlaneTrihedron.cxx index 2c6e7023c6..b2edcb404f 100644 --- a/src/AIS/AIS_PlaneTrihedron.cxx +++ b/src/AIS/AIS_PlaneTrihedron.cxx @@ -68,7 +68,7 @@ AIS_PlaneTrihedron::AIS_PlaneTrihedron(const Handle(Geom_Plane)& aPlane) //POP Standard_Real aLength = UnitsAPI::CurrentFromLS (100. ,"LENGTH"); Standard_Real aLength = UnitsAPI::AnyToLS (100. ,"mm"); DA->SetAxisLength(aLength,aLength,aLength); - Quantity_NameOfColor col = Quantity_NOC_ROYALBLUE1; + Quantity_Color col (Quantity_NOC_ROYALBLUE1); DA->LineAspect(Prs3d_DP_XAxis)->SetColor(col); DA->LineAspect(Prs3d_DP_YAxis)->SetColor(col); DA->SetDrawDatumAxes(Prs3d_DA_XYAxis); @@ -242,11 +242,6 @@ void AIS_PlaneTrihedron::ComputeSelection(const Handle(SelectMgr_Selection)& aSe } } -void AIS_PlaneTrihedron::SetColor(const Quantity_NameOfColor aCol) -{ - SetColor(Quantity_Color(aCol)); -} - void AIS_PlaneTrihedron::SetColor(const Quantity_Color &aCol) { hasOwnColor=Standard_True; diff --git a/src/AIS/AIS_PlaneTrihedron.hxx b/src/AIS/AIS_PlaneTrihedron.hxx index 215c568c64..44393bbc1f 100644 --- a/src/AIS/AIS_PlaneTrihedron.hxx +++ b/src/AIS/AIS_PlaneTrihedron.hxx @@ -17,31 +17,12 @@ #ifndef _AIS_PlaneTrihedron_HeaderFile #define _AIS_PlaneTrihedron_HeaderFile -#include -#include - -#include #include -#include -#include -#include -#include -#include -#include -#include -class Geom_Plane; -class AIS_InteractiveObject; +#include + class AIS_Line; class AIS_Point; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; -class Quantity_Color; -class TCollection_AsciiString; - - -class AIS_PlaneTrihedron; -DEFINE_STANDARD_HANDLE(AIS_PlaneTrihedron, AIS_InteractiveObject) +class Geom_Plane; //! To construct a selectable 2d axis system in a 3d //! drawing. This can be placed anywhere in the 3d @@ -62,10 +43,9 @@ DEFINE_STANDARD_HANDLE(AIS_PlaneTrihedron, AIS_InteractiveObject) //! trihedra. Change these values and recalculate the presentation. class AIS_PlaneTrihedron : public AIS_InteractiveObject { - + DEFINE_STANDARD_RTTIEXT(AIS_PlaneTrihedron, AIS_InteractiveObject) public: - //! Initializes the plane aPlane. The plane trihedron is //! constructed from this and an axis. Standard_EXPORT AIS_PlaneTrihedron(const Handle(Geom_Plane)& aPlane); @@ -103,52 +83,37 @@ public: //! to the object to display before computation !!! Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - virtual Standard_Integer Signature() const Standard_OVERRIDE; - - //! Returns datum as the type of Interactive Object. - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE; - - //! Allows you to provide settings for the color aColor. - Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE; - - Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE; - - void SetXLabel (const TCollection_AsciiString& aLabel); - - void SetYLabel (const TCollection_AsciiString& aLabel); + virtual Standard_Integer Signature() const Standard_OVERRIDE { return 4; } + //! Returns datum as the type of Interactive Object. + virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; } + //! Allows you to provide settings for the color aColor. + Standard_EXPORT void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE; + void SetXLabel (const TCollection_AsciiString& theLabel) { myXLabel = theLabel; } - DEFINE_STANDARD_RTTIEXT(AIS_PlaneTrihedron,AIS_InteractiveObject) + void SetYLabel (const TCollection_AsciiString& theLabel) { myYLabel = theLabel; } protected: - Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; - - private: - Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - + Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE; +private: + Handle(Geom_Plane) myPlane; Handle(AIS_InteractiveObject) myShapes[3]; TCollection_AsciiString myXLabel; TCollection_AsciiString myYLabel; - }; - -#include - - - - +DEFINE_STANDARD_HANDLE(AIS_PlaneTrihedron, AIS_InteractiveObject) #endif // _AIS_PlaneTrihedron_HeaderFile diff --git a/src/AIS/AIS_PlaneTrihedron.lxx b/src/AIS/AIS_PlaneTrihedron.lxx deleted file mode 100644 index 048c4c121e..0000000000 --- a/src/AIS/AIS_PlaneTrihedron.lxx +++ /dev/null @@ -1,34 +0,0 @@ -// Created on: 1997-03-06 -// Created by: Robert COUBLANC -// Copyright (c) 1997-1999 Matra Datavision -// Copyright (c) 1999-2014 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. - -inline AIS_KindOfInteractive AIS_PlaneTrihedron::Type() const -{return AIS_KOI_Datum;} - - -inline Standard_Integer AIS_PlaneTrihedron::Signature() const -{return 4;} - - -inline void AIS_PlaneTrihedron::SetXLabel(const TCollection_AsciiString& aLabel) -{ - myXLabel = aLabel; -} - - -inline void AIS_PlaneTrihedron::SetYLabel(const TCollection_AsciiString& aLabel) -{ - myYLabel = aLabel; -} diff --git a/src/AIS/AIS_Point.cxx b/src/AIS/AIS_Point.cxx index 20878ff445..345c4462a4 100644 --- a/src/AIS/AIS_Point.cxx +++ b/src/AIS/AIS_Point.cxx @@ -14,9 +14,9 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#include #include -#include #include #include #include @@ -130,14 +130,8 @@ void AIS_Point::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, //======================================================================= //function : SetColor -//purpose : +//purpose : //======================================================================= - -void AIS_Point::SetColor(const Quantity_NameOfColor aCol) -{ - SetColor(Quantity_Color(aCol)); -} - void AIS_Point::SetColor (const Quantity_Color& theCol) { hasOwnColor=Standard_True; diff --git a/src/AIS/AIS_Point.hxx b/src/AIS/AIS_Point.hxx index db994a0742..baf842d611 100644 --- a/src/AIS/AIS_Point.hxx +++ b/src/AIS/AIS_Point.hxx @@ -17,47 +17,29 @@ #ifndef _AIS_Point_HeaderFile #define _AIS_Point_HeaderFile -#include -#include - -#include #include #include -#include -#include -#include -#include -#include + class Geom_Point; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; -class Quantity_Color; class TopoDS_Vertex; - -class AIS_Point; -DEFINE_STANDARD_HANDLE(AIS_Point, AIS_InteractiveObject) - //! Constructs point datums to be used in construction of //! composite shapes. The datum is displayed as the plus marker +. class AIS_Point : public AIS_InteractiveObject { - + DEFINE_STANDARD_RTTIEXT(AIS_Point, AIS_InteractiveObject) public: - - //! Initializes the point aComponent from which the point //! datum will be built. Standard_EXPORT AIS_Point(const Handle(Geom_Point)& aComponent); //! Returns index 1, the default index for a point. - virtual Standard_Integer Signature() const Standard_OVERRIDE; - + virtual Standard_Integer Signature() const Standard_OVERRIDE { return 1; } + //! Indicates that a point is a datum. - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE; - + virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; } + //! Returns the component specified in SetComponent. Standard_EXPORT Handle(Geom_Point) Component(); @@ -75,12 +57,10 @@ public: //! WARNING : must be applied //! to the object to display before computation !!! Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - - //! Allows you to provide settings for the cp;pr aColor. - Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE; - - Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE; - + + //! Allows you to provide settings for the Color. + Standard_EXPORT void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE; + //! Allows you to remove color settings. Standard_EXPORT void UnsetColor() Standard_OVERRIDE; @@ -94,44 +74,31 @@ public: Standard_EXPORT void UnsetMarker(); //! Returns true if the point datum has a marker. - Standard_Boolean HasMarker() const; - + Standard_Boolean HasMarker() const { return myHasTOM; } + //! Converts a point into a vertex. Standard_EXPORT TopoDS_Vertex Vertex() const; - - - - DEFINE_STANDARD_RTTIEXT(AIS_Point,AIS_InteractiveObject) - protected: - Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; - - private: - Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - + Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE; - + Standard_EXPORT void UpdatePointValues(); +private: + Handle(Geom_Point) myComponent; Standard_Boolean myHasTOM; Aspect_TypeOfMarker myTOM; - }; - -#include - - - - +DEFINE_STANDARD_HANDLE(AIS_Point, AIS_InteractiveObject) #endif // _AIS_Point_HeaderFile diff --git a/src/AIS/AIS_Point.lxx b/src/AIS/AIS_Point.lxx deleted file mode 100644 index f8782392ea..0000000000 --- a/src/AIS/AIS_Point.lxx +++ /dev/null @@ -1,25 +0,0 @@ -// Created on: 1997-03-06 -// Created by: Robert COUBLANC -// Copyright (c) 1997-1999 Matra Datavision -// Copyright (c) 1999-2014 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. - -inline AIS_KindOfInteractive AIS_Point::Type() const -{return AIS_KOI_Datum;} - - -inline Standard_Integer AIS_Point::Signature() const -{return 1;} - -inline Standard_Boolean AIS_Point::HasMarker() const -{return myHasTOM;} diff --git a/src/AIS/AIS_PointCloud.cxx b/src/AIS/AIS_PointCloud.cxx index f603024f8d..a0df6dd2c8 100644 --- a/src/AIS/AIS_PointCloud.cxx +++ b/src/AIS/AIS_PointCloud.cxx @@ -140,15 +140,6 @@ void AIS_PointCloud::SetPoints (const Handle(TColgp_HArray1OfPnt)& theCoords myBndBox = getBoundingBox (myPoints); } -//======================================================================= -//function : SetColor -//purpose : -//======================================================================= -void AIS_PointCloud::SetColor (const Quantity_NameOfColor theColor) -{ - SetColor (Quantity_Color (theColor)); -} - //======================================================================= //function : SetColor //purpose : @@ -292,15 +283,6 @@ void AIS_PointCloud::UnsetColor() } } -//======================================================================= -//function : SetMaterial -//purpose : -//======================================================================= -void AIS_PointCloud::SetMaterial (const Graphic3d_NameOfMaterial theMatName) -{ - SetMaterial (Graphic3d_MaterialAspect (theMatName)); -} - //======================================================================= //function : SetMaterial //purpose : diff --git a/src/AIS/AIS_PointCloud.hxx b/src/AIS/AIS_PointCloud.hxx index 1671755c8c..83f3f9a88c 100644 --- a/src/AIS/AIS_PointCloud.hxx +++ b/src/AIS/AIS_PointCloud.hxx @@ -93,18 +93,12 @@ public: public: - //! Setup custom color. Affects presentation only when no per-point color attribute has been assigned. - Standard_EXPORT virtual void SetColor (const Quantity_NameOfColor theColor) Standard_OVERRIDE; - //! Setup custom color. Affects presentation only when no per-point color attribute has been assigned. Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE; //! Restore default color. Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE; - //! Setup custom material. Affects presentation only when normals are defined. - Standard_EXPORT virtual void SetMaterial (const Graphic3d_NameOfMaterial theMatName) Standard_OVERRIDE; - //! Setup custom material. Affects presentation only when normals are defined. Standard_EXPORT virtual void SetMaterial (const Graphic3d_MaterialAspect& theMat) Standard_OVERRIDE; diff --git a/src/AIS/AIS_Relation.cxx b/src/AIS/AIS_Relation.cxx index 04e15f38d0..a2cb41c38a 100644 --- a/src/AIS/AIS_Relation.cxx +++ b/src/AIS/AIS_Relation.cxx @@ -208,12 +208,6 @@ void AIS_Relation::ComputeProjVertexPresentation(const Handle(Prs3d_Presentation //function : SetColor //purpose : //======================================================================= - -void AIS_Relation::SetColor(const Quantity_NameOfColor aCol) -{ - SetColor(Quantity_Color(aCol)); -} - void AIS_Relation::SetColor(const Quantity_Color &aCol) { if(hasOwnColor && myDrawer->Color() == aCol) return; diff --git a/src/AIS/AIS_Relation.hxx b/src/AIS/AIS_Relation.hxx index 594f2f9ed7..2ccd6db16e 100644 --- a/src/AIS/AIS_Relation.hxx +++ b/src/AIS/AIS_Relation.hxx @@ -17,41 +17,26 @@ #ifndef _AIS_Relation_HeaderFile #define _AIS_Relation_HeaderFile -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include #include -#include #include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include +#include + +class Geom_Curve; class Geom_Plane; class Geom_Surface; -class Quantity_Color; -class TopoDS_Shape; -class gp_Pnt; -class TCollection_ExtendedString; -class Prs3d_Presentation; class TopoDS_Edge; -class Geom_Curve; class TopoDS_Vertex; - -class AIS_Relation; -DEFINE_STANDARD_HANDLE(AIS_Relation, AIS_InteractiveObject) - //! One of the four types of interactive object in //! AIS,comprising dimensions and constraints. Serves //! as the abstract class for the seven relation classes as @@ -63,82 +48,86 @@ DEFINE_STANDARD_HANDLE(AIS_Relation, AIS_InteractiveObject) //! The connection takes the form of an edge between the two shapes. class AIS_Relation : public AIS_InteractiveObject { - + DEFINE_STANDARD_RTTIEXT(AIS_Relation, AIS_InteractiveObject) public: - - //! Allows you to provide settings for the color aColor + //! Allows you to provide settings for the color theColor //! of the lines representing the relation between the two shapes. - Standard_EXPORT void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE; - - Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE; - + Standard_EXPORT void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE; + //! Allows you to remove settings for the color of the //! lines representing the relation between the two shapes. Standard_EXPORT void UnsetColor() Standard_OVERRIDE; - - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE; + + virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Relation; } //! Indicates that the type of dimension is unknown. Standard_EXPORT virtual AIS_KindOfDimension KindOfDimension() const; //! Returns true if the interactive object is movable. Standard_EXPORT virtual Standard_Boolean IsMovable() const; - - const TopoDS_Shape& FirstShape() const; - + + const TopoDS_Shape& FirstShape() const { return myFShape; } + Standard_EXPORT virtual void SetFirstShape (const TopoDS_Shape& aFShape); - + //! Returns the second shape. - const TopoDS_Shape& SecondShape() const; - + const TopoDS_Shape& SecondShape() const { return mySShape; } + //! Allows you to identify the second shape aSShape //! relative to the first. Standard_EXPORT virtual void SetSecondShape (const TopoDS_Shape& aSShape); - - void SetBndBox (const Standard_Real Xmin, const Standard_Real Ymin, const Standard_Real Zmin, const Standard_Real Xmax, const Standard_Real Ymax, const Standard_Real Zmax); - - void UnsetBndBox(); - + + void SetBndBox (const Standard_Real theXmin, const Standard_Real theYmin, const Standard_Real theZmin, + const Standard_Real theXmax, const Standard_Real theYmax, const Standard_Real theZmax) + { + myBndBox.Update (theXmin, theYmin, theZmin, theXmax, theYmax, theZmax); + myIsSetBndBox = Standard_True; + } + + void UnsetBndBox() { myIsSetBndBox = Standard_False; } + //! Returns the plane. - const Handle(Geom_Plane)& Plane() const; - + const Handle(Geom_Plane)& Plane() const { return myPlane; } - //! Allows you to set the plane aPlane. This is used to + //! Allows you to set the plane thePlane. This is used to //! define relations and dimensions in several daughter classes. - void SetPlane (const Handle(Geom_Plane)& aPlane); - + void SetPlane (const Handle(Geom_Plane)& thePlane) { myPlane = thePlane; } + //! Returns the value of each object in the relation. - Standard_Real Value() const; - - //! Allows you to provide settings for the value aVal for - //! each object in the relation. - void SetValue (const Standard_Real aVal); - + Standard_Real Value() const { return myVal; } + + //! Allows you to provide settings for the value theVal for each object in the relation. + void SetValue (const Standard_Real theVal) { myVal = theVal; } + //! Returns the position set using SetPosition. - const gp_Pnt& Position() const; - + const gp_Pnt& Position() const { return myPosition; } //! Allows you to provide the objects in the relation with //! settings for a non-default position. - void SetPosition (const gp_Pnt& aPosition); - + void SetPosition (const gp_Pnt& thePosition) + { + myPosition = thePosition; + myAutomaticPosition = Standard_False; + } + //! Returns settings for text aspect. - const TCollection_ExtendedString& Text() const; - - //! Allows you to provide the settings aText for text aspect. - void SetText (const TCollection_ExtendedString& aText); - + const TCollection_ExtendedString& Text() const { return myText; } + + //! Allows you to provide the settings theText for text aspect. + void SetText (const TCollection_ExtendedString& theText) { myText = theText; } //! Returns the value for the size of the arrow identifying //! the relation between the two shapes. - Standard_Real ArrowSize() const; - + Standard_Real ArrowSize() const { return myArrowSize; } //! Allows you to provide settings for the size of the - //! arrow anArrowsize identifying the relation between the two shapes. - void SetArrowSize (const Standard_Real anArrowSize); - + //! arrow theArrowSize identifying the relation between the two shapes. + void SetArrowSize (const Standard_Real theArrowSize) + { + myArrowSize = theArrowSize; + myArrowSizeIsDefined = Standard_True; + } //! Returns the value of the symbol presentation. This will be one of: //! - AS_NONE - none @@ -150,12 +139,10 @@ public: //! - AS_BOTHPT - both points //! - AS_FIRSTAR_LASTPT - first arrow, last point //! - AS_FIRSTPT_LASTAR - first point, last arrow - DsgPrs_ArrowSide SymbolPrs() const; - + DsgPrs_ArrowSide SymbolPrs() const { return mySymbolPrs; } //! Allows you to provide settings for the symbol presentation. - void SetSymbolPrs (const DsgPrs_ArrowSide aSymbolPrs); - + void SetSymbolPrs (const DsgPrs_ArrowSide theSymbolPrs) { mySymbolPrs = theSymbolPrs; } //! Allows you to set the status of the extension shape by //! the index aIndex. @@ -163,12 +150,10 @@ public: //! - 0 - there is no connection to a shape; //! - 1 - there is a connection to the first shape; //! - 2 - there is a connection to the second shape. - void SetExtShape (const Standard_Integer aIndex); - + void SetExtShape (const Standard_Integer theIndex) { myExtShape = theIndex; } //! Returns the status index of the extension shape. - Standard_Integer ExtShape() const; - + Standard_Integer ExtShape() const { return myExtShape; } //! Returns true if the display mode aMode is accepted //! for the Interactive Objects in the relation. @@ -185,34 +170,30 @@ public: //! aProjTOL : TypeOfLine from Aspect = Aspect_TOL_DASH; //! aCallTOL : TypeOfLine from Aspect = Aspect_TOL_DOT) Standard_EXPORT virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE; - - void SetAutomaticPosition (const Standard_Boolean aStatus); - - Standard_Boolean AutomaticPosition() const; - - + void SetAutomaticPosition (const Standard_Boolean theStatus) { myAutomaticPosition = theStatus; } - DEFINE_STANDARD_RTTIEXT(AIS_Relation,AIS_InteractiveObject) + Standard_Boolean AutomaticPosition() const { return myAutomaticPosition; } protected: - Standard_EXPORT AIS_Relation(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView); - + //! Calculates the presentation aPres of the the edge //! anEdge and the curve it defines, ProjCurve. The later //! is also specified by the first point FirstP and the last point LastP. //! The presentation includes settings for color aColor, //! type - aProjTOL and aCallTOL - and width of line, aWidth. Standard_EXPORT void ComputeProjEdgePresentation (const Handle(Prs3d_Presentation)& aPres, const TopoDS_Edge& anEdge, const Handle(Geom_Curve)& ProjCurve, const gp_Pnt& FirstP, const gp_Pnt& LastP, const Quantity_NameOfColor aColor = Quantity_NOC_PURPLE, const Standard_Real aWidth = 2, const Aspect_TypeOfLine aProjTOL = Aspect_TOL_DASH, const Aspect_TypeOfLine aCallTOL = Aspect_TOL_DOT) const; - + //! Calculates the presentation aPres of the the vertex //! aVertex and the point it defines, ProjPoint. //! The presentation includes settings for color aColor, //! type - aProjTOM and aCallTOL - and width of line, aWidth. Standard_EXPORT void ComputeProjVertexPresentation (const Handle(Prs3d_Presentation)& aPres, const TopoDS_Vertex& aVertex, const gp_Pnt& ProjPoint, const Quantity_NameOfColor aColor = Quantity_NOC_PURPLE, const Standard_Real aWidth = 2, const Aspect_TypeOfMarker aProjTOM = Aspect_TOM_PLUS, const Aspect_TypeOfLine aCallTOL = Aspect_TOL_DOT) const; +protected: + TopoDS_Shape myFShape; TopoDS_Shape mySShape; Handle(Geom_Plane) myPlane; @@ -235,19 +216,8 @@ protected: Standard_Boolean myIsSetBndBox; Standard_Boolean myArrowSizeIsDefined; - -private: - - - - }; - -#include - - - - +DEFINE_STANDARD_HANDLE(AIS_Relation, AIS_InteractiveObject) #endif // _AIS_Relation_HeaderFile diff --git a/src/AIS/AIS_Relation.lxx b/src/AIS/AIS_Relation.lxx deleted file mode 100644 index b5fd89949e..0000000000 --- a/src/AIS/AIS_Relation.lxx +++ /dev/null @@ -1,224 +0,0 @@ -// Created on: 1996-12-05 -// Created by: Odile Olivier -// Copyright (c) 1996-1999 Matra Datavision -// Copyright (c) 1999-2014 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. - -//======================================================================= -//function : FirstShape -//purpose : -//======================================================================= - -inline const TopoDS_Shape& AIS_Relation::FirstShape() const -{ - return myFShape; -} - - -//======================================================================= -//function : SecondShape -//purpose : -//======================================================================= - -inline const TopoDS_Shape& AIS_Relation::SecondShape() const -{ - return mySShape; -} - - -//======================================================================= -//function : SetBndBox -//purpose : -//======================================================================= - -inline void AIS_Relation::SetBndBox( const Standard_Real Xmin, - const Standard_Real Ymin, - const Standard_Real Zmin, - const Standard_Real Xmax, - const Standard_Real Ymax, - const Standard_Real Zmax ) -{ - myBndBox.Update( Xmin, Ymin, Zmin, Xmax, Ymax, Zmax ); - myIsSetBndBox = Standard_True; -} - -inline void AIS_Relation::UnsetBndBox() -{ - myIsSetBndBox = Standard_False; -} - -//======================================================================= -//function : :Plane -//purpose : -//======================================================================= - -inline const Handle(Geom_Plane)& AIS_Relation::Plane() const -{ - return myPlane; -} - -//======================================================================= -//function : SetPlane -//purpose : -//======================================================================= - -inline void AIS_Relation::SetPlane(const Handle(Geom_Plane)& aPlane) -{ - myPlane = aPlane; -} - -//======================================================================= -//function : Value -//purpose : -//======================================================================= - -inline Standard_Real AIS_Relation::Value() const -{ - return myVal; -} - -//======================================================================= -//function : SetValue -//purpose : -//======================================================================= - -inline void AIS_Relation::SetValue(const Standard_Real aVal) -{ - myVal = aVal; -} - -//======================================================================= -//function : Position -//purpose : -//======================================================================= - -inline const gp_Pnt& AIS_Relation::Position() const -{ - return myPosition; -} - - -//======================================================================= -//function : SetPosition -//purpose : -//======================================================================= - -inline void AIS_Relation::SetPosition(const gp_Pnt& aPosition) -{ - myPosition = aPosition; - myAutomaticPosition = Standard_False; -} - -//======================================================================= -//function : Text -//purpose : -//======================================================================= - -inline const TCollection_ExtendedString& AIS_Relation::Text() const -{ - return myText; -} - -//======================================================================= -//function : SetText -//purpose : -//======================================================================= - -inline void AIS_Relation::SetText(const TCollection_ExtendedString& aText) -{ - myText = aText; -} - -//======================================================================= -//function : ArrowSize -//purpose : -//======================================================================= - -inline Standard_Real AIS_Relation::ArrowSize() const -{ - return myArrowSize; -} - -//======================================================================= -//function : SetArrowSize -//purpose : -//======================================================================= - -inline void AIS_Relation::SetArrowSize(const Standard_Real anArrowSize) -{ - myArrowSize = anArrowSize; - myArrowSizeIsDefined = Standard_True; -} - -//======================================================================= -//function : SymbolPrs -//purpose : -//======================================================================= - -inline DsgPrs_ArrowSide AIS_Relation::SymbolPrs() const -{ - return mySymbolPrs; -} - -//======================================================================= -//function : SetSymbolPrs -//purpose : -//======================================================================= -inline void AIS_Relation::SetSymbolPrs(const DsgPrs_ArrowSide aSymbolPrs) -{ - mySymbolPrs = aSymbolPrs; -} - - - -//======================================================================= -//function : KindOfInteractive -//purpose : -//======================================================================= -inline AIS_KindOfInteractive AIS_Relation::Type() const -{return AIS_KOI_Relation;} - - -//======================================================================= -//function : SetExtShape -//purpose : -//======================================================================= -inline void AIS_Relation::SetExtShape(const Standard_Integer ExtSh) -{myExtShape = ExtSh;} - - -//======================================================================= -//function : ExtShape -//purpose : -//======================================================================= -inline Standard_Integer AIS_Relation::ExtShape() const -{return myExtShape;} - - -//======================================================================= -//function : SetAutomaticPosition -//purpose : -//======================================================================= -inline void AIS_Relation::SetAutomaticPosition ( const Standard_Boolean aStatus ) -{ - myAutomaticPosition = aStatus ; -} - -//======================================================================= -//function : AutomaticPosition -//purpose : -//======================================================================= -inline Standard_Boolean AIS_Relation::AutomaticPosition () const -{ - return myAutomaticPosition; -} diff --git a/src/AIS/AIS_Shape.cxx b/src/AIS/AIS_Shape.cxx index 715cc4529d..1d3cdfc023 100644 --- a/src/AIS/AIS_Shape.cxx +++ b/src/AIS/AIS_Shape.cxx @@ -14,10 +14,10 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#include #include #include -#include #include #include #include @@ -411,12 +411,6 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, StdSelect::SetDrawerForBRepOwner(aSelection,myDrawer); } -Quantity_NameOfColor AIS_Shape::Color() const { -Quantity_Color aColor; - Color(aColor); - return aColor.Name(); -} - void AIS_Shape::Color( Quantity_Color& aColor ) const { aColor = myDrawer->ShadingAspect()->Color(myCurrentFacingModel); } @@ -429,16 +423,6 @@ Standard_Real AIS_Shape::Transparency() const { return myDrawer->ShadingAspect()->Transparency(myCurrentFacingModel); } -//======================================================================= -//function : SetColor -//purpose : -//======================================================================= - -void AIS_Shape::SetColor(const Quantity_NameOfColor aCol) -{ - SetColor(Quantity_Color(aCol)); -} - //======================================================================= //function : setColor //purpose : @@ -830,16 +814,6 @@ void AIS_Shape::setMaterial (const Handle(Prs3d_Drawer)& theDrawer, } } -//======================================================================= -//function : SetMaterial -//purpose : -//======================================================================= - -void AIS_Shape::SetMaterial(const Graphic3d_NameOfMaterial aMat) -{ - SetMaterial(Graphic3d_MaterialAspect(aMat)); -} - //======================================================================= //function : SetMaterial //purpose : diff --git a/src/AIS/AIS_Shape.hxx b/src/AIS/AIS_Shape.hxx index 0c355e265b..78ab8c6f9a 100644 --- a/src/AIS/AIS_Shape.hxx +++ b/src/AIS/AIS_Shape.hxx @@ -17,35 +17,16 @@ #ifndef _AIS_Shape_HeaderFile #define _AIS_Shape_HeaderFile -#include -#include - -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include +#include #include +#include #include +#include + class TopoDS_Shape; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; -class Quantity_Color; -class Graphic3d_MaterialAspect; class Bnd_Box; - -class AIS_Shape; -DEFINE_STANDARD_HANDLE(AIS_Shape, AIS_InteractiveObject) - //! A framework to manage presentation and selection of shapes. //! AIS_Shape is the interactive object which is used the //! most by applications. There are standard functions @@ -70,10 +51,9 @@ DEFINE_STANDARD_HANDLE(AIS_Shape, AIS_InteractiveObject) //! for the specific object. class AIS_Shape : public AIS_InteractiveObject { - + DEFINE_STANDARD_RTTIEXT(AIS_Shape, AIS_InteractiveObject) public: - //! Initializes construction of the shape shap from wires, //! edges and vertices. Standard_EXPORT AIS_Shape(const TopoDS_Shape& shap); @@ -87,12 +67,16 @@ public: //! Returns true if the Interactive Object accepts shape decomposition. Standard_EXPORT virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE; - //! Constructs an instance of the shape object ashape. - void Set (const TopoDS_Shape& ashap); - + //! Constructs an instance of the shape object theShape. + void Set (const TopoDS_Shape& theShape) + { + myshape = theShape; + myCompBB = Standard_True; + } + //! Returns this shape object. - const TopoDS_Shape& Shape() const; - + const TopoDS_Shape& Shape() const { return myshape; } + //! Sets a local value for deviation coefficient for this specific shape. Standard_EXPORT Standard_Boolean SetOwnDeviationCoefficient(); @@ -153,11 +137,11 @@ public: Standard_EXPORT Standard_Boolean OwnHLRDeviationAngle (Standard_Real& anAngle, Standard_Real& aPreviousAngle) const; //! Sets the type of HLR algorithm used by the shape - void SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR); - + void SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR) { myDrawer->SetTypeOfHLR (theTypeOfHLR); } + //! Gets the type of HLR algorithm - Prs3d_TypeOfHLR TypeOfHLR() const; - + Prs3d_TypeOfHLR TypeOfHLR() const { return myDrawer->TypeOfHLR(); } + //! Sets the color aColor in the reconstructed //! compound shape. Acts via the Drawer methods below on the appearance of: //! - free boundaries: @@ -171,10 +155,8 @@ public: //! Prs3d_Drawer_SeenLineAspect //! - hidden line color in hidden line mode: //! Prs3d_Drawer_HiddenLineAspect. - Standard_EXPORT virtual void SetColor (const Quantity_NameOfColor aColor) Standard_OVERRIDE; - - Standard_EXPORT virtual void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE; - + Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE; + //! Removes settings for color in the reconstructed compound shape. Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE; @@ -185,9 +167,7 @@ public: //! Removes the setting for line width in the reconstructed compound shape. Standard_EXPORT virtual void UnsetWidth() Standard_OVERRIDE; - - Standard_EXPORT virtual void SetMaterial (const Graphic3d_NameOfMaterial aName) Standard_OVERRIDE; - + //! Allows you to provide settings for the material aName //! in the reconstructed compound shape. Standard_EXPORT virtual void SetMaterial (const Graphic3d_MaterialAspect& aName) Standard_OVERRIDE; @@ -209,10 +189,6 @@ public: //! which is not the same as above; keep it visible. using AIS_InteractiveObject::BoundingBox; - //! Returns the NameOfColor attributes of the shape accordingly to - //! the current facing model; - Standard_EXPORT virtual Quantity_NameOfColor Color() const Standard_OVERRIDE; - //! Returns the Color attributes of the shape accordingly to //! the current facing model; Standard_EXPORT virtual void Color (Quantity_Color& aColor) const Standard_OVERRIDE; @@ -242,14 +218,8 @@ public: //! - mode 8 - Compound Standard_EXPORT static Standard_Integer SelectionMode (const TopAbs_ShapeEnum aShapeType); - - - - DEFINE_STANDARD_RTTIEXT(AIS_Shape,AIS_InteractiveObject) - protected: - Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; @@ -268,26 +238,22 @@ protected: Standard_EXPORT void setMaterial (const Handle(Prs3d_Drawer)& theDrawer, const Graphic3d_MaterialAspect& theMaterial, const Standard_Boolean theToKeepColor, const Standard_Boolean theToKeepTransp) const; +protected: + TopoDS_Shape myshape; Bnd_Box myBB; Standard_Boolean myCompBB; - private: - Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation, const TopoDS_Shape& ashape); - Standard_Real myInitAng; +private: + Standard_Real myInitAng; }; - -#include - - - - +DEFINE_STANDARD_HANDLE(AIS_Shape, AIS_InteractiveObject) #endif // _AIS_Shape_HeaderFile diff --git a/src/AIS/AIS_Shape.lxx b/src/AIS/AIS_Shape.lxx deleted file mode 100644 index 2837f1a966..0000000000 --- a/src/AIS/AIS_Shape.lxx +++ /dev/null @@ -1,39 +0,0 @@ -// Created on: 1997-01-08 -// Created by: Robert COUBLANC -// Copyright (c) 1997-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include - -inline void AIS_Shape::Set(const TopoDS_Shape& ashap) -{ - myshape = ashap; - myCompBB = Standard_True; -} - -inline const TopoDS_Shape& -AIS_Shape::Shape() const -{ - return myshape; -} - -inline void AIS_Shape::SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR) -{ - myDrawer->SetTypeOfHLR (theTypeOfHLR); -} - -inline Prs3d_TypeOfHLR AIS_Shape::TypeOfHLR ( ) const -{ - return myDrawer->TypeOfHLR(); -} diff --git a/src/AIS/AIS_TextLabel.hxx b/src/AIS/AIS_TextLabel.hxx index 3b3562bb5b..2641044959 100644 --- a/src/AIS/AIS_TextLabel.hxx +++ b/src/AIS/AIS_TextLabel.hxx @@ -35,18 +35,12 @@ public: //! Setup color of entire text. Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE; - //! Setup color of entire text. - virtual void SetColor (const Quantity_NameOfColor theColor) Standard_OVERRIDE { SetColor (Quantity_Color (theColor)); } - //! Setup transparency within [0, 1] range. Standard_EXPORT virtual void SetTransparency (const Standard_Real theValue) Standard_OVERRIDE; //! Removes the transparency setting. virtual void UnsetTransparency() Standard_OVERRIDE { SetTransparency (0.0); } - //! Material has no effect for text label. - virtual void SetMaterial (const Graphic3d_NameOfMaterial ) Standard_OVERRIDE {} - //! Material has no effect for text label. virtual void SetMaterial (const Graphic3d_MaterialAspect& ) Standard_OVERRIDE {} diff --git a/src/AIS/AIS_Trihedron.hxx b/src/AIS/AIS_Trihedron.hxx index 41afd9bb6c..1e06df8914 100644 --- a/src/AIS/AIS_Trihedron.hxx +++ b/src/AIS/AIS_Trihedron.hxx @@ -104,12 +104,6 @@ public: //! Indicates that the type of Interactive Object is datum. virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; } - //! Sets the color theColor for this trihedron object, it changes color of axes. - void SetColor (const Quantity_NameOfColor theColor) Standard_OVERRIDE - { - return SetColor (Quantity_Color (theColor)); - } - //! Sets the color theColor for this trihedron object, it changes color of axes. Standard_EXPORT void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE; diff --git a/src/AIS/FILES b/src/AIS/FILES index d4302fa794..e424026e96 100644 --- a/src/AIS/FILES +++ b/src/AIS/FILES @@ -15,7 +15,6 @@ AIS_AttributeFilter.hxx AIS_AttributeFilter.lxx AIS_Axis.cxx AIS_Axis.hxx -AIS_Axis.lxx AIS_BadEdgeFilter.cxx AIS_BadEdgeFilter.hxx AIS_C0RegularityFilter.cxx @@ -28,7 +27,6 @@ AIS_Chamf3dDimension.hxx AIS_Chamf3dDimension.lxx AIS_Circle.cxx AIS_Circle.hxx -AIS_Circle.lxx AIS_ClearMode.hxx AIS_ColoredDrawer.hxx AIS_ColoredShape.cxx @@ -96,7 +94,6 @@ AIS_LengthDimension.cxx AIS_LengthDimension.hxx AIS_Line.cxx AIS_Line.hxx -AIS_Line.lxx AIS_ListIteratorOfListOfInteractive.hxx AIS_ListOfInteractive.hxx AIS_LocalContext.cxx @@ -134,20 +131,16 @@ AIS_PerpendicularRelation.cxx AIS_PerpendicularRelation.hxx AIS_Plane.cxx AIS_Plane.hxx -AIS_Plane.lxx AIS_PlaneTrihedron.cxx AIS_PlaneTrihedron.hxx -AIS_PlaneTrihedron.lxx AIS_Point.cxx AIS_Point.hxx -AIS_Point.lxx AIS_PointCloud.cxx AIS_PointCloud.hxx AIS_RadiusDimension.cxx AIS_RadiusDimension.hxx AIS_Relation.cxx AIS_Relation.hxx -AIS_Relation.lxx AIS_RubberBand.hxx AIS_RubberBand.cxx AIS_Selection.cxx @@ -157,7 +150,6 @@ AIS_SequenceOfDimension.hxx AIS_SequenceOfInteractive.hxx AIS_Shape.cxx AIS_Shape.hxx -AIS_Shape.lxx AIS_SignatureFilter.cxx AIS_SignatureFilter.hxx AIS_StandardDatum.hxx diff --git a/src/Aspect/Aspect_Window.cxx b/src/Aspect/Aspect_Window.cxx index 5fa8abecca..9024c9f295 100644 --- a/src/Aspect/Aspect_Window.cxx +++ b/src/Aspect/Aspect_Window.cxx @@ -74,11 +74,6 @@ void Aspect_Window::SetBackground (const Aspect_Background& theBackground) SetBackground (theBackground.Color()); } -void Aspect_Window::SetBackground (const Quantity_NameOfColor theNameOfColor) -{ - MyBackground.SetColor (theNameOfColor); -} - void Aspect_Window::SetBackground (const Quantity_Color& theColor) { MyBackground.SetColor (theColor); diff --git a/src/Aspect/Aspect_Window.hxx b/src/Aspect/Aspect_Window.hxx index e5cd1134da..136e1a367d 100644 --- a/src/Aspect/Aspect_Window.hxx +++ b/src/Aspect/Aspect_Window.hxx @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -34,10 +34,8 @@ class Aspect_WindowDefinitionError; class Aspect_WindowError; class Aspect_Background; -class Quantity_Color; class Aspect_GradientBackground; - class Aspect_Window; DEFINE_STANDARD_HANDLE(Aspect_Window, MMgt_TShared) @@ -49,10 +47,7 @@ public: //! Modifies the window background. Standard_EXPORT void SetBackground (const Aspect_Background& ABack); - - //! Modifies the window background from a Named Color. - Standard_EXPORT void SetBackground (const Quantity_NameOfColor theNameOfColor); - + //! Modifies the window background. Standard_EXPORT void SetBackground (const Quantity_Color& color); @@ -117,27 +112,16 @@ public: protected: - //! Initializes the datas of a Window. Standard_EXPORT Aspect_Window(); +protected: + Aspect_Background MyBackground; Aspect_GradientBackground MyGradientBackground; Aspect_FillMethod MyBackgroundFillMethod; Standard_Boolean MyIsVirtual; - -private: - - - - }; - - - - - - #endif // _Aspect_Window_HeaderFile diff --git a/src/Prs3d/Prs3d_ArrowAspect.hxx b/src/Prs3d/Prs3d_ArrowAspect.hxx index f4e355db4b..42c5e99ffe 100644 --- a/src/Prs3d/Prs3d_ArrowAspect.hxx +++ b/src/Prs3d/Prs3d_ArrowAspect.hxx @@ -21,7 +21,6 @@ #include #include #include -#include //! A framework for displaying arrows in representations of dimensions and relations. class Prs3d_ArrowAspect : public Prs3d_BasicAspect @@ -55,8 +54,6 @@ public: Quantity_Length Length() const { return myLength; } void SetColor (const Quantity_Color& theColor) { myArrowAspect->SetColor (theColor); } - - void SetColor (const Quantity_NameOfColor theColor) { SetColor (Quantity_Color (theColor)); } const Handle(Graphic3d_AspectLine3d)& Aspect() const { return myArrowAspect; } diff --git a/src/Prs3d/Prs3d_IsoAspect.hxx b/src/Prs3d/Prs3d_IsoAspect.hxx index 3f4ab0df89..dafc204042 100644 --- a/src/Prs3d/Prs3d_IsoAspect.hxx +++ b/src/Prs3d/Prs3d_IsoAspect.hxx @@ -33,13 +33,6 @@ public: //! - the type of line aType //! - the width value aWidth //! - aNumber, the number of isoparameters to be displayed. - Prs3d_IsoAspect (const Quantity_NameOfColor theColor, - const Aspect_TypeOfLine theType, - const Standard_Real theWidth, - const Standard_Integer theNumber) - : Prs3d_LineAspect (theColor, theType, theWidth), - myNumber (theNumber) {} - Prs3d_IsoAspect (const Quantity_Color& theColor, const Aspect_TypeOfLine theType, const Standard_Real theWidth, diff --git a/src/Prs3d/Prs3d_LineAspect.cxx b/src/Prs3d/Prs3d_LineAspect.cxx index 48391dd3ba..b648b1026a 100644 --- a/src/Prs3d/Prs3d_LineAspect.cxx +++ b/src/Prs3d/Prs3d_LineAspect.cxx @@ -27,15 +27,3 @@ Prs3d_LineAspect::Prs3d_LineAspect (const Quantity_Color& theColor, { // } - -// ======================================================================= -// function : Prs3d_LineAspect -// purpose : -// ======================================================================= -Prs3d_LineAspect::Prs3d_LineAspect (const Quantity_NameOfColor theColor, - const Aspect_TypeOfLine theType, - const Standard_Real theWidth) -: myAspect (new Graphic3d_AspectLine3d (Quantity_Color (theColor), theType, theWidth)) -{ - // -} diff --git a/src/Prs3d/Prs3d_LineAspect.hxx b/src/Prs3d/Prs3d_LineAspect.hxx index f91edf1da5..cb20cfb647 100644 --- a/src/Prs3d/Prs3d_LineAspect.hxx +++ b/src/Prs3d/Prs3d_LineAspect.hxx @@ -40,18 +40,14 @@ public: //! - the type of line aType and //! - the line thickness aWidth. //! Type of line refers to whether the line is solid or dotted, for example. - Standard_EXPORT Prs3d_LineAspect (const Quantity_NameOfColor theColor, const Aspect_TypeOfLine theType, const Standard_Real theWidth); - Standard_EXPORT Prs3d_LineAspect (const Quantity_Color& theColor, const Aspect_TypeOfLine theType, const Standard_Real theWidth); Prs3d_LineAspect(const Handle(Graphic3d_AspectLine3d)& theAspect) : myAspect (theAspect) {} - void SetColor (const Quantity_Color& theColor) { myAspect->SetColor (theColor); } - //! Sets the line color defined at the time of construction. //! Default value: Quantity_NOC_YELLOW - void SetColor (const Quantity_NameOfColor theColor) { myAspect->SetColor (Quantity_Color (theColor)); } - + void SetColor (const Quantity_Color& theColor) { myAspect->SetColor (theColor); } + //! Sets the type of line defined at the time of construction. //! This could, for example, be solid, dotted or made up of dashes. //! Default value: Aspect_TOL_SOLID diff --git a/src/Prs3d/Prs3d_PointAspect.cxx b/src/Prs3d/Prs3d_PointAspect.cxx index 9a06ed46af..b69b01689f 100644 --- a/src/Prs3d/Prs3d_PointAspect.cxx +++ b/src/Prs3d/Prs3d_PointAspect.cxx @@ -28,18 +28,6 @@ Prs3d_PointAspect::Prs3d_PointAspect (const Aspect_TypeOfMarker theType, // } -// ======================================================================= -// function : Prs3d_PointAspect -// purpose : -// ======================================================================= -Prs3d_PointAspect::Prs3d_PointAspect (const Aspect_TypeOfMarker theType, - const Quantity_NameOfColor theColor, - const Standard_Real theScale) -: myAspect (new Graphic3d_AspectMarker3d (theType, Quantity_Color(theColor), theScale)) -{ - // -} - // ======================================================================= // function : Prs3d_PointAspect // purpose : diff --git a/src/Prs3d/Prs3d_PointAspect.hxx b/src/Prs3d/Prs3d_PointAspect.hxx index 4be436b307..7c2fcd3c70 100644 --- a/src/Prs3d/Prs3d_PointAspect.hxx +++ b/src/Prs3d/Prs3d_PointAspect.hxx @@ -30,8 +30,6 @@ class Prs3d_PointAspect : public Prs3d_BasicAspect public: Standard_EXPORT Prs3d_PointAspect(const Aspect_TypeOfMarker theType, const Quantity_Color& theColor, const Standard_Real theScale); - - Standard_EXPORT Prs3d_PointAspect(const Aspect_TypeOfMarker theType, const Quantity_NameOfColor theColor, const Standard_Real theScale); //! Defines the user defined marker point. Standard_EXPORT Prs3d_PointAspect (const Quantity_Color& theColor, @@ -41,12 +39,10 @@ public: Prs3d_PointAspect (const Handle(Graphic3d_AspectMarker3d)& theAspect) : myAspect (theAspect) {} - void SetColor (const Quantity_Color& theColor) { myAspect->SetColor (theColor); } - //! defines the color to be used when drawing a point. //! Default value: Quantity_NOC_YELLOW - void SetColor (const Quantity_NameOfColor theColor) { myAspect->SetColor (Quantity_Color (theColor)); } - + void SetColor (const Quantity_Color& theColor) { myAspect->SetColor (theColor); } + //! defines the type of representation to be used when drawing a point. //! Default value: Aspect_TOM_PLUS void SetTypeOfMarker (const Aspect_TypeOfMarker theType) { myAspect->SetType (theType); } diff --git a/src/Prs3d/Prs3d_ShadingAspect.hxx b/src/Prs3d/Prs3d_ShadingAspect.hxx index 95b529aa8d..8510621a31 100644 --- a/src/Prs3d/Prs3d_ShadingAspect.hxx +++ b/src/Prs3d/Prs3d_ShadingAspect.hxx @@ -40,22 +40,10 @@ public: //! Change the polygons interior color and material ambient color. Standard_EXPORT void SetColor (const Quantity_Color& aColor, const Aspect_TypeOfFacingModel aModel = Aspect_TOFM_BOTH_SIDE); - - //! Change the polygons interior color and material ambient color. - void SetColor (const Quantity_NameOfColor theColor, - const Aspect_TypeOfFacingModel theModel = Aspect_TOFM_BOTH_SIDE) - { - SetColor (Quantity_Color (theColor), theModel); - } //! Change the polygons material aspect. Standard_EXPORT void SetMaterial (const Graphic3d_MaterialAspect& aMaterial, const Aspect_TypeOfFacingModel aModel = Aspect_TOFM_BOTH_SIDE); - void SetMaterial (const Graphic3d_NameOfMaterial theMaterial, const Aspect_TypeOfFacingModel theModel = Aspect_TOFM_BOTH_SIDE) - { - SetMaterial (Graphic3d_MaterialAspect (theMaterial), theModel); - } - //! Change the polygons transparency value. //! Warning : aValue must be in the range 0,1. 0 is the default (NO transparent) Standard_EXPORT void SetTransparency (const Standard_Real aValue, const Aspect_TypeOfFacingModel aModel = Aspect_TOFM_BOTH_SIDE); diff --git a/src/Prs3d/Prs3d_TextAspect.hxx b/src/Prs3d/Prs3d_TextAspect.hxx index cfc1d7f751..9c986a5e2f 100644 --- a/src/Prs3d/Prs3d_TextAspect.hxx +++ b/src/Prs3d/Prs3d_TextAspect.hxx @@ -35,12 +35,10 @@ public: Standard_EXPORT Prs3d_TextAspect(); Standard_EXPORT Prs3d_TextAspect(const Handle(Graphic3d_AspectText3d)& theAspect); - - void SetColor (const Quantity_Color& theColor) { myTextAspect->SetColor (theColor); } - + //! Sets the color of the type used in text display. - void SetColor (const Quantity_NameOfColor theColor) { myTextAspect->SetColor (Quantity_Color (theColor)); } - + void SetColor (const Quantity_Color& theColor) { myTextAspect->SetColor (theColor); } + //! Sets the font used in text display. void SetFont (const Standard_CString theFont) { myTextAspect->SetFont (theFont); } diff --git a/src/TPrsStd/TPrsStd_AISPresentation.cxx b/src/TPrsStd/TPrsStd_AISPresentation.cxx index f64a36a7ae..5da1459164 100644 --- a/src/TPrsStd/TPrsStd_AISPresentation.cxx +++ b/src/TPrsStd/TPrsStd_AISPresentation.cxx @@ -386,8 +386,17 @@ void TPrsStd_AISPresentation::SetColor(const Quantity_NameOfColor theColor) { Backup(); if ( getData()->HasOwnColor() && getData()->Color() == theColor ) - if ( !myAIS.IsNull() && myAIS->HasColor() && myAIS->Color() == theColor ) - return; + { + if (!myAIS.IsNull() && myAIS->HasColor()) + { + Quantity_Color aColor; + myAIS->Color (aColor); + if (aColor.Name() == theColor) + { + return; + } + } + } getData()->SetColor(theColor); @@ -396,8 +405,15 @@ void TPrsStd_AISPresentation::SetColor(const Quantity_NameOfColor theColor) if ( !myAIS.IsNull() ) { - if ( myAIS->HasColor() && myAIS->Color() == theColor ) - return; // AIS has already had that color + if (myAIS->HasColor()) + { + Quantity_Color aColor; + myAIS->Color (aColor); + if (aColor.Name() == theColor) + { + return; // AIS has already had that color + } + } Handle(AIS_InteractiveContext) aContext = getAISContext(); @@ -801,7 +817,9 @@ void TPrsStd_AISPresentation::AISUpdate() if ( HasOwnColor() ) { Quantity_NameOfColor aColor = Color(); - if ( !(myAIS->HasColor()) || (myAIS->HasColor() && myAIS->Color() != aColor) ) + Quantity_Color aPrsColor; + myAIS->Color (aPrsColor); + if ( !(myAIS->HasColor()) || (myAIS->HasColor() && aPrsColor.Name() != aColor) ) { if ( !aContext.IsNull() ) aContext->SetColor(myAIS, aColor, Standard_False); diff --git a/src/TPrsStd/TPrsStd_ConstraintDriver.cxx b/src/TPrsStd/TPrsStd_ConstraintDriver.cxx index 23cf0ac9b1..d51087b79e 100644 --- a/src/TPrsStd/TPrsStd_ConstraintDriver.cxx +++ b/src/TPrsStd/TPrsStd_ConstraintDriver.cxx @@ -50,7 +50,12 @@ Standard_Boolean TPrsStd_ConstraintDriver::Update (const TDF_Label& aLabel, if (!anAISObject.IsNull() && anAISObject->HasInteractiveContext()) { if (!apConstraint->Verified()) { TPrsStd_ConstraintTools::UpdateOnlyValue(apConstraint,anAISObject); - if (anAISObject->Color() != Quantity_NOC_RED) anAISObject->SetColor(Quantity_NOC_RED); + Quantity_Color aColor; + anAISObject->Color (aColor); + if (aColor.Name() != Quantity_NOC_RED) + { + anAISObject->SetColor(Quantity_NOC_RED); + } return Standard_True; } } @@ -180,16 +185,17 @@ Standard_Boolean TPrsStd_ConstraintDriver::Update (const TDF_Label& aLabel, } if (anAISObject->HasInteractiveContext()) { - Quantity_NameOfColor originColor = anAISObject->Color(); + Quantity_Color originColor; + anAISObject->Color (originColor); if (!apConstraint->Verified()) { - if (originColor != Quantity_NOC_RED) + if (originColor.Name() != Quantity_NOC_RED) anAISObject->SetColor(Quantity_NOC_RED); } else if (apConstraint->IsDimension() && apConstraint->GetValue()->IsCaptured()) { - if (originColor != Quantity_NOC_PURPLE) + if (originColor.Name() != Quantity_NOC_PURPLE) anAISObject->SetColor(Quantity_NOC_PURPLE); } - else if (!apConstraint->IsPlanar() && (originColor != Quantity_NOC_YELLOW)) + else if (!apConstraint->IsPlanar() && (originColor.Name() != Quantity_NOC_YELLOW)) anAISObject->SetColor(Quantity_NOC_YELLOW); } else { diff --git a/src/V3d/V3d_AmbientLight.cxx b/src/V3d/V3d_AmbientLight.cxx index 33ba1a199e..761711422d 100644 --- a/src/V3d/V3d_AmbientLight.cxx +++ b/src/V3d/V3d_AmbientLight.cxx @@ -24,7 +24,7 @@ IMPLEMENT_STANDARD_RTTIEXT(V3d_AmbientLight,V3d_Light) // purpose : // ======================================================================= V3d_AmbientLight::V3d_AmbientLight (const Handle(V3d_Viewer)& theViewer, - const Quantity_NameOfColor theColor) + const Quantity_Color& theColor) : V3d_Light (theViewer) { SetType (V3d_AMBIENT); diff --git a/src/V3d/V3d_AmbientLight.hxx b/src/V3d/V3d_AmbientLight.hxx index d312069637..72451eca31 100644 --- a/src/V3d/V3d_AmbientLight.hxx +++ b/src/V3d/V3d_AmbientLight.hxx @@ -32,7 +32,7 @@ public: //! Constructs an ambient light source in the viewer. //! The default Color of this light source is WHITE. Standard_EXPORT V3d_AmbientLight (const Handle(V3d_Viewer)& theViewer, - const Quantity_NameOfColor theColor = Quantity_NOC_WHITE); + const Quantity_Color& theColor = Quantity_NOC_WHITE); DEFINE_STANDARD_RTTIEXT(V3d_AmbientLight,V3d_Light) }; diff --git a/src/V3d/V3d_DirectionalLight.cxx b/src/V3d/V3d_DirectionalLight.cxx index 335a42da40..323ae58454 100644 --- a/src/V3d/V3d_DirectionalLight.cxx +++ b/src/V3d/V3d_DirectionalLight.cxx @@ -60,7 +60,7 @@ IMPLEMENT_STANDARD_RTTIEXT(V3d_DirectionalLight,V3d_PositionLight) // ======================================================================= V3d_DirectionalLight::V3d_DirectionalLight (const Handle(V3d_Viewer)& theViewer, const V3d_TypeOfOrientation theDirection, - const Quantity_NameOfColor theColor, + const Quantity_Color& theColor, const Standard_Boolean theIsHeadlight) : V3d_PositionLight (theViewer) { @@ -85,7 +85,7 @@ V3d_DirectionalLight::V3d_DirectionalLight (const Handle(V3d_Viewer)& theViewer, const Standard_Real theXp, const Standard_Real theYp, const Standard_Real theZp, - const Quantity_NameOfColor theColor, + const Quantity_Color& theColor, const Standard_Boolean theIsHeadlight) : V3d_PositionLight (theViewer) { @@ -272,7 +272,6 @@ void V3d_DirectionalLight::Display (const Handle(V3d_View)& theView, Standard_Real X0,Y0,Z0,VX,VY,VZ; Standard_Real X1,Y1,Z1; Standard_Real DXRef,DYRef,DZRef,DXini,DYini,DZini; - Standard_Real R1,G1,B1; V3d_TypeOfRepresentation Pres; // Creation of a structure of markable elements (position of the @@ -312,8 +311,7 @@ void V3d_DirectionalLight::Display (const Handle(V3d_View)& theView, //Display of the position of the light. - this->Color(Quantity_TOC_RGB,R1,G1,B1); - Quantity_Color Col1(R1,G1,B1,Quantity_TOC_RGB); + const Quantity_Color Col1 = this->Color(); Handle(Graphic3d_AspectLine3d) Asp1 = new Graphic3d_AspectLine3d(); Asp1->SetColor(Col1); glight->SetPrimitivesAspect(Asp1); diff --git a/src/V3d/V3d_DirectionalLight.hxx b/src/V3d/V3d_DirectionalLight.hxx index 576092f4ba..ab68c739d0 100644 --- a/src/V3d/V3d_DirectionalLight.hxx +++ b/src/V3d/V3d_DirectionalLight.hxx @@ -32,7 +32,7 @@ public: //! Creates a directional light source in the viewer. Standard_EXPORT V3d_DirectionalLight (const Handle(V3d_Viewer)& theViewer, const V3d_TypeOfOrientation theDirection = V3d_XposYposZpos, - const Quantity_NameOfColor theColor = Quantity_NOC_WHITE, + const Quantity_Color& theColor = Quantity_NOC_WHITE, const Standard_Boolean theIsHeadlight = Standard_False); //! Creates a directional light source in the viewer. @@ -46,7 +46,7 @@ public: const V3d_Coordinate theXp, const V3d_Coordinate theYp, const V3d_Coordinate theZp, - const Quantity_NameOfColor theColor = Quantity_NOC_WHITE, + const Quantity_Color& theColor = Quantity_NOC_WHITE, const Standard_Boolean theIsHeadlight = Standard_False); //! Defines the direction of the light source by a predefined orientation. diff --git a/src/V3d/V3d_Light.cxx b/src/V3d/V3d_Light.cxx index 67be8f5deb..b852e4202e 100644 --- a/src/V3d/V3d_Light.cxx +++ b/src/V3d/V3d_Light.cxx @@ -54,31 +54,6 @@ void V3d_Light::SetType (const V3d_TypeOfLight theType) myLight.Type = (Graphic3d_TypeOfLightSource)theType; } -// ======================================================================= -// function : SetColor -// purpose : -// ======================================================================= -void V3d_Light::SetColor (const Quantity_TypeOfColor theType, - const Standard_Real theValue1, - const Standard_Real theValue2, - const Standard_Real theValue3) -{ - Standard_Real aValue1 = Max (0., Min (1., theValue1)); - Standard_Real aValue2 = Max (0., Min (1., theValue2)); - Standard_Real aValue3 = Max (0., Min (1., theValue3)); - Quantity_Color aColor (aValue1, aValue2, aValue3, theType); - SetColor (aColor); -} - -// ======================================================================= -// function : SetColor -// purpose : -// ======================================================================= -void V3d_Light::SetColor (const Quantity_NameOfColor theName) -{ - SetColor (Quantity_Color (theName)); -} - // ======================================================================= // function : SetColor // purpose : @@ -90,39 +65,6 @@ void V3d_Light::SetColor (const Quantity_Color& theColor) myLight.Color.b() = static_cast (theColor.Blue()); } -// ======================================================================= -// function : Color -// purpose : -// ======================================================================= -void V3d_Light::Color (const Quantity_TypeOfColor theType, - Standard_Real& theValue1, - Standard_Real& theValue2, - Standard_Real& theValue3) const -{ - Color().Values (theValue1, theValue2, theValue3, theType); -} - -// ======================================================================= -// function : Color -// purpose : -// ======================================================================= -void V3d_Light::Color (Quantity_NameOfColor& theName) const -{ - theName = Color().Name(); -} - -// ======================================================================= -// function : Color -// purpose : -// ======================================================================= -Quantity_Color V3d_Light::Color() const -{ - return Quantity_Color (Standard_Real (myLight.Color.r()), - Standard_Real (myLight.Color.g()), - Standard_Real (myLight.Color.b()), - Quantity_TOC_RGB); -} - // ======================================================================= // function : Type // purpose : diff --git a/src/V3d/V3d_Light.hxx b/src/V3d/V3d_Light.hxx index 43d77acb23..3849ca96d0 100644 --- a/src/V3d/V3d_Light.hxx +++ b/src/V3d/V3d_Light.hxx @@ -20,9 +20,8 @@ #include #include #include -#include +#include #include -#include #include #include #include @@ -32,7 +31,6 @@ #include class Graphic3d_Structure; -class Quantity_Color; class V3d_Viewer; class V3d_Light; @@ -44,31 +42,11 @@ class V3d_Light : public MMgt_TShared { public: - //! Defines the color of a light source according to the type of color - //! definition and the three corresponding values. - Standard_EXPORT void SetColor (const Quantity_TypeOfColor theType, - const Quantity_Parameter theValue1, - const Quantity_Parameter theValue2, - const Quantity_Parameter theValue3); - - //! Defines the color of a light source by giving - //! the name of the color in the form Quantity_NOC_xxxx. - Standard_EXPORT void SetColor (const Quantity_NameOfColor theName); - //! Defines the color of a light source by giving the basic color. Standard_EXPORT void SetColor (const Quantity_Color& theColor); - //! Returns the color of the light source depending of the color type. - Standard_EXPORT void Color (const Quantity_TypeOfColor theType, - Quantity_Parameter& theValue1, - Quantity_Parameter& theValue2, - Quantity_Parameter& theValue3) const; - - //! Returns the color of the light source. - Standard_EXPORT void Color (Quantity_NameOfColor& theName) const; - //! Returns the color of the light source. - Standard_EXPORT Quantity_Color Color() const; + Quantity_Color Color() const { return Quantity_Color (myLight.Color.rgb()); } //! Returns the Type of the Light Standard_EXPORT V3d_TypeOfLight Type() const; diff --git a/src/V3d/V3d_PositionLight.cxx b/src/V3d/V3d_PositionLight.cxx index 4a5a6e43d0..5443156f2c 100644 --- a/src/V3d/V3d_PositionLight.cxx +++ b/src/V3d/V3d_PositionLight.cxx @@ -169,7 +169,6 @@ void V3d_PositionLight::Display (const Handle(V3d_View)& theView, const V3d_Type Standard_Real X0,Y0,Z0,VX,VY,VZ; Standard_Real X1,Y1,Z1; Standard_Real DXRef,DYRef,DZRef,DXini,DYini,DZini; - Standard_Real R1,G1,B1; V3d_TypeOfRepresentation Pres; // Creation of a structure of markable elements (position of the @@ -217,8 +216,7 @@ void V3d_PositionLight::Display (const Handle(V3d_View)& theView, const V3d_Type // Display of the light position. - this->Color(Quantity_TOC_RGB,R1,G1,B1); - Quantity_Color Col1(R1,G1,B1,Quantity_TOC_RGB); + const Quantity_Color Col1 = this->Color(); Handle(Graphic3d_AspectLine3d) Asp1 = new Graphic3d_AspectLine3d(); Asp1->SetColor(Col1); glight->SetPrimitivesAspect(Asp1); diff --git a/src/V3d/V3d_PositionalLight.cxx b/src/V3d/V3d_PositionalLight.cxx index f6cfc5ea9d..76884fc3ea 100644 --- a/src/V3d/V3d_PositionalLight.cxx +++ b/src/V3d/V3d_PositionalLight.cxx @@ -63,13 +63,13 @@ V3d_PositionalLight::V3d_PositionalLight (const Handle(V3d_Viewer)& theViewer, const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ, - const Quantity_NameOfColor theColor, + const Quantity_Color& theColor, const Standard_Real theConstAttenuation, const Standard_Real theLinearAttenuation) : V3d_PositionLight (theViewer) { SetType (V3d_POSITIONAL); - SetColor (Quantity_Color (theColor)); + SetColor (theColor); SetTarget (0., 0., 0.); SetPosition (theX, theY, theZ); SetAttenuation (theConstAttenuation, theLinearAttenuation); @@ -86,13 +86,13 @@ V3d_PositionalLight::V3d_PositionalLight (const Handle(V3d_Viewer)& theViewer, const Standard_Real theXp, const Standard_Real theYp, const Standard_Real theZp, - const Quantity_NameOfColor theColor, + const Quantity_Color& theColor, const Standard_Real theConstAttenuation, const Standard_Real theLinearAttenuation) : V3d_PositionLight (theViewer) { SetType (V3d_POSITIONAL); - SetColor (Quantity_Color (theColor)); + SetColor (theColor); SetTarget (theXt, theYt, theZt); SetPosition (theXp, theYp, theZp); SetAttenuation (theConstAttenuation, theLinearAttenuation); @@ -231,7 +231,6 @@ void V3d_PositionalLight::Display (const Handle(V3d_View)& theView, Standard_Real X0,Y0,Z0,VX,VY,VZ; Standard_Real X1,Y1,Z1; Standard_Real DXRef,DYRef,DZRef,DXini,DYini,DZini; - Standard_Real R1,G1,B1; V3d_TypeOfRepresentation Pres; // Creation of a structure slight of markable elements (position of the @@ -278,8 +277,7 @@ void V3d_PositionalLight::Display (const Handle(V3d_View)& theView, // Display of the position of the light. - this->Color(Quantity_TOC_RGB,R1,G1,B1); - Quantity_Color Col1(R1,G1,B1,Quantity_TOC_RGB); + const Quantity_Color Col1 = this->Color(); Handle(Graphic3d_AspectLine3d) Asp1 = new Graphic3d_AspectLine3d(); Asp1->SetColor(Col1); glight->SetPrimitivesAspect(Asp1); diff --git a/src/V3d/V3d_PositionalLight.hxx b/src/V3d/V3d_PositionalLight.hxx index 0feede310d..a3953166b4 100644 --- a/src/V3d/V3d_PositionalLight.hxx +++ b/src/V3d/V3d_PositionalLight.hxx @@ -43,7 +43,7 @@ public: const V3d_Coordinate theX, const V3d_Coordinate theY, const V3d_Coordinate theZ, - const Quantity_NameOfColor theColor = Quantity_NOC_WHITE, + const Quantity_Color& theColor = Quantity_NOC_WHITE, const Quantity_Coefficient theConstAttenuation = 1.0, const Quantity_Coefficient theLinearAttenuation = 0.0); @@ -65,7 +65,7 @@ public: const V3d_Coordinate theXp, const V3d_Coordinate theYp, const V3d_Coordinate theZp, - const Quantity_NameOfColor theColor = Quantity_NOC_WHITE, + const Quantity_Color& theColor = Quantity_NOC_WHITE, const Quantity_Coefficient theConstAttenuation = 1.0, const Quantity_Coefficient theLinearAttenuation = 0.0); diff --git a/src/V3d/V3d_SpotLight.cxx b/src/V3d/V3d_SpotLight.cxx index 0fa5b8ff6a..e35a4a9c2a 100644 --- a/src/V3d/V3d_SpotLight.cxx +++ b/src/V3d/V3d_SpotLight.cxx @@ -59,7 +59,7 @@ V3d_SpotLight::V3d_SpotLight (const Handle(V3d_Viewer)& theViewer, const Standard_Real theY, const Standard_Real theZ, const V3d_TypeOfOrientation theDirection, - const Quantity_NameOfColor theColor, + const Quantity_Color& theColor, const Standard_Real theConstAttenuation, const Standard_Real theLinearAttenuation, const Standard_Real theConcentration, @@ -88,7 +88,7 @@ V3d_SpotLight::V3d_SpotLight (const Handle(V3d_Viewer)& theViewer, const Standard_Real theXp, const Standard_Real theYp, const Standard_Real theZp, - const Quantity_NameOfColor theColor, + const Quantity_Color& theColor, const Standard_Real theConstAttenuation, const Standard_Real theLinearAttenuation, const Standard_Real theConcentration, @@ -269,7 +269,6 @@ void V3d_SpotLight::Display (const Handle(V3d_View)& theView, Standard_Real X0,Y0,Z0,VX,VY,VZ; Standard_Real X1,Y1,Z1; Standard_Real DXRef,DYRef,DZRef,DXini,DYini,DZini; - Standard_Real R1,G1,B1; V3d_TypeOfRepresentation Pres; // Creation of a structure slight of markable elements (position of the @@ -316,8 +315,7 @@ void V3d_SpotLight::Display (const Handle(V3d_View)& theView, //Display of the position of the light. - this->Color(Quantity_TOC_RGB,R1,G1,B1); - Quantity_Color Col1(R1,G1,B1,Quantity_TOC_RGB); + const Quantity_Color Col1 = this->Color(); Handle(Graphic3d_AspectLine3d) Asp1 = new Graphic3d_AspectLine3d(); Asp1->SetColor(Col1); glight->SetPrimitivesAspect(Asp1); diff --git a/src/V3d/V3d_SpotLight.hxx b/src/V3d/V3d_SpotLight.hxx index 931d2eb63a..9034a5e96e 100644 --- a/src/V3d/V3d_SpotLight.hxx +++ b/src/V3d/V3d_SpotLight.hxx @@ -47,7 +47,7 @@ public: const V3d_Coordinate theY, const V3d_Coordinate theZ, const V3d_TypeOfOrientation theDirection = V3d_XnegYnegZpos, - const Quantity_NameOfColor theColor = Quantity_NOC_WHITE, + const Quantity_Color& theColor = Quantity_NOC_WHITE, const Quantity_Coefficient theConstAttenuation = 1.0, const Quantity_Coefficient theLinearAttenuation = 0.0, const Quantity_Coefficient theConcentration = 1.0, @@ -67,7 +67,7 @@ public: const V3d_Coordinate theXp, const V3d_Coordinate theYp, const V3d_Coordinate theZp, - const Quantity_NameOfColor theColor = Quantity_NOC_WHITE, + const Quantity_Color& theColor = Quantity_NOC_WHITE, const Quantity_Coefficient theConstAttenuation = 1.0, const Quantity_Coefficient theLinearAttenuation = 0.0, const Quantity_Coefficient theConcentration = 1.0, diff --git a/src/V3d/V3d_View.cxx b/src/V3d/V3d_View.cxx index 00413cd4bd..7db3ad078f 100644 --- a/src/V3d/V3d_View.cxx +++ b/src/V3d/V3d_View.cxx @@ -442,15 +442,6 @@ void V3d_View::SetBackgroundColor (const Quantity_Color& theColor) } } -//============================================================================= -//function : SetBackgroundColor -//purpose : -//============================================================================= -void V3d_View::SetBackgroundColor (const Quantity_NameOfColor theName) -{ - SetBackgroundColor (Quantity_Color (theName)); -} - //============================================================================= //function : SetBgGradientColors //purpose : @@ -470,21 +461,6 @@ void V3d_View::SetBgGradientColors (const Quantity_Color& theColor1, } } -//============================================================================= -//function : SetBgGradientColors -//purpose : -//============================================================================= -void V3d_View::SetBgGradientColors (const Quantity_NameOfColor theColor1, - const Quantity_NameOfColor theColor2, - const Aspect_GradientFillMethod theFillStyle, - const Standard_Boolean theToUpdate) -{ - Quantity_Color aColor1 (theColor1); - Quantity_Color aColor2 (theColor2); - - SetBgGradientColors (aColor1, aColor2, theFillStyle, theToUpdate); -} - //============================================================================= //function : SetBgGradientStyle //purpose : diff --git a/src/V3d/V3d_View.hxx b/src/V3d/V3d_View.hxx index 81cbb46212..778fb122b2 100644 --- a/src/V3d/V3d_View.hxx +++ b/src/V3d/V3d_View.hxx @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include @@ -214,9 +213,6 @@ public: //! Defines the background color of the view. Standard_EXPORT void SetBackgroundColor (const Quantity_Color& theColor); - //! Defines the background color of the view by supplying the color name in the form Quantity_NOC_xxxx. - Standard_EXPORT void SetBackgroundColor (const Quantity_NameOfColor theName); - //! Defines the gradient background colors of the view by supplying the colors //! and the fill method (horizontal by default). Standard_EXPORT void SetBgGradientColors (const Quantity_Color& theColor1, @@ -224,13 +220,6 @@ public: const Aspect_GradientFillMethod theFillStyle = Aspect_GFM_HOR, const Standard_Boolean theToUpdate = Standard_False); - //! Defines the gradient background colors of the view by supplying the color names - //! and the fill method (horizontal by default). - Standard_EXPORT void SetBgGradientColors (const Quantity_NameOfColor theColor1, - const Quantity_NameOfColor theColor2, - const Aspect_GradientFillMethod theFillStyle = Aspect_GFM_HOR, - const Standard_Boolean theToUpdate = Standard_False); - //! Defines the gradient background fill method of the view. Standard_EXPORT void SetBgGradientStyle (const Aspect_GradientFillMethod theMethod = Aspect_GFM_HOR, const Standard_Boolean theToUpdate = Standard_False); @@ -284,9 +273,9 @@ public: //! position comes out of the view //! AxisDiametr - diameter relatively to axis length //! NbFacettes - number of facets of cylinders and cones - Standard_EXPORT void ZBufferTriedronSetup (const Quantity_NameOfColor theXColor = Quantity_NOC_RED, - const Quantity_NameOfColor theYColor = Quantity_NOC_GREEN, - const Quantity_NameOfColor theZColor = Quantity_NOC_BLUE1, + Standard_EXPORT void ZBufferTriedronSetup (const Quantity_Color& theXColor = Quantity_NOC_RED, + const Quantity_Color& theYColor = Quantity_NOC_GREEN, + const Quantity_Color& theZColor = Quantity_NOC_BLUE1, const Standard_Real theSizeRatio = 0.8, const Standard_Real theAxisDiametr = 0.05, const Standard_Integer theNbFacettes = 12); @@ -295,7 +284,7 @@ public: //! Initialize position, color and length of Triedron axes. //! The scale is a percent of the window width. Standard_EXPORT void TriedronDisplay (const Aspect_TypeOfTriedronPosition thePosition = Aspect_TOTP_CENTER, - const Quantity_NameOfColor theColor = Quantity_NOC_WHITE, + const Quantity_Color& theColor = Quantity_NOC_WHITE, const Standard_Real theScale = 0.02, const V3d_TypeOfVisualization theMode = V3d_WIREFRAME); diff --git a/src/V3d/V3d_View_4.cxx b/src/V3d/V3d_View_4.cxx index 3dafe81df4..6f3b5f43f2 100644 --- a/src/V3d/V3d_View_4.cxx +++ b/src/V3d/V3d_View_4.cxx @@ -267,12 +267,12 @@ Graphic3d_Vertex V3d_View::Compute (const Graphic3d_Vertex & AVertex) const //function : ZBufferTriedronSetup //purpose : //============================================================================= -void V3d_View::ZBufferTriedronSetup(const Quantity_NameOfColor theXColor, - const Quantity_NameOfColor theYColor, - const Quantity_NameOfColor theZColor, - const Standard_Real theSizeRatio, - const Standard_Real theAxisDiametr, - const Standard_Integer theNbFacettes) +void V3d_View::ZBufferTriedronSetup(const Quantity_Color& theXColor, + const Quantity_Color& theYColor, + const Quantity_Color& theZColor, + const Standard_Real theSizeRatio, + const Standard_Real theAxisDiametr, + const Standard_Integer theNbFacettes) { myTrihedron->SetArrowsColor (theXColor, theYColor, theZColor); myTrihedron->SetSizeRatio (theSizeRatio); @@ -285,7 +285,7 @@ void V3d_View::ZBufferTriedronSetup(const Quantity_NameOfColor theXColor, //purpose : //============================================================================= void V3d_View::TriedronDisplay (const Aspect_TypeOfTriedronPosition thePosition, - const Quantity_NameOfColor theColor, + const Quantity_Color& theColor, const Standard_Real theScale, const V3d_TypeOfVisualization theMode) { diff --git a/src/V3d/V3d_Viewer.cxx b/src/V3d/V3d_Viewer.cxx index 3dc9aa8a6c..d2c5798a01 100644 --- a/src/V3d/V3d_Viewer.cxx +++ b/src/V3d/V3d_Viewer.cxx @@ -67,7 +67,7 @@ V3d_Viewer::V3d_Viewer (const Handle(Graphic3d_GraphicDriver)& theDriver, const Standard_CString , const Standard_Real theViewSize, const V3d_TypeOfOrientation theViewProj, - const Quantity_NameOfColor theViewBackground, + const Quantity_Color& theViewBackground, const V3d_TypeOfVisualization theVisualization, const V3d_TypeOfShadingModel theShadingModel, const Standard_Boolean theComputedMode, diff --git a/src/V3d/V3d_Viewer.hxx b/src/V3d/V3d_Viewer.hxx index 148c340743..dfebeea0d1 100644 --- a/src/V3d/V3d_Viewer.hxx +++ b/src/V3d/V3d_Viewer.hxx @@ -138,27 +138,12 @@ public: //! Set default Rendering Parameters. void SetDefaultRenderingParams (const Graphic3d_RenderingParams& theParams) { myDefaultRenderingParams = theParams; } - //! Defines the default background colour of views - //! attached to the viewer by supplying the name of the - //! colour under the form Quantity_NOC_xxxx . - void SetDefaultBackgroundColor (const Quantity_NameOfColor theName) { myBackground.SetColor (Quantity_Color (theName)); } - //! Defines the default background colour of views //! attached to the viewer by supplying the color object void SetDefaultBackgroundColor (const Quantity_Color& theColor) { myBackground.SetColor (theColor); } //! Returns the gradient background of the view. const Aspect_GradientBackground& GetGradientBackground() const { return myGradientBackground; } - - //! Defines the default gradient background colours of view - //! attached to the viewer by supplying the name of the - //! colours under the form Quantity_NOC_xxxx . - void SetDefaultBgGradientColors (const Quantity_NameOfColor theName1, - const Quantity_NameOfColor theName2, - const Aspect_GradientFillMethod theFillStyle = Aspect_GFM_HOR) - { - myGradientBackground.SetColors (Quantity_Color (theName1), Quantity_Color (theName2), theFillStyle); - } //! Defines the default gradient background colours of views //! attached to the viewer by supplying the colour objects @@ -434,7 +419,7 @@ public: //! @name deprecated methods const Standard_CString theDomain = "", const Quantity_Length theViewSize = 1000.0, const V3d_TypeOfOrientation theViewProj = V3d_XposYnegZpos, - const Quantity_NameOfColor theViewBackground = Quantity_NOC_GRAY30, + const Quantity_Color& theViewBackground = Quantity_NOC_GRAY30, const V3d_TypeOfVisualization theVisualization = V3d_ZBUFFER, const V3d_TypeOfShadingModel theShadingModel = V3d_GOURAUD, const Standard_Boolean theComputedMode = Standard_True, diff --git a/src/ViewerTest/ViewerTest_ObjectCommands.cxx b/src/ViewerTest/ViewerTest_ObjectCommands.cxx index 0ce0dc122b..d0cdf8863a 100644 --- a/src/ViewerTest/ViewerTest_ObjectCommands.cxx +++ b/src/ViewerTest/ViewerTest_ObjectCommands.cxx @@ -614,7 +614,7 @@ static int VSize (Draw_Interpretor& di, Standard_Integer argc, const char** argv Standard_Real value; Standard_Boolean hascol; - Quantity_NameOfColor col = Quantity_NOC_BLACK ; + Quantity_Color col = Quantity_NOC_BLACK; // Verification des arguments if ( argc>3 ) {di<Type()==AIS_KOI_Datum && aShape->Signature()==3) { - if (aShape->HasColor()) { - hascol=Standard_True; + if (aShape->HasColor()) + { + hascol = Standard_True; // On recupere la couleur de aShape - col=aShape->Color();} - - else hascol=Standard_False; + aShape->Color (col); + } + else + { + hascol = Standard_False; + } // On downcast aShape de AIS_InteractiveObject a AIS_Trihedron // pour lui appliquer la methode SetSize() @@ -711,14 +715,17 @@ static int VSize (Draw_Interpretor& di, Standard_Integer argc, const char** argv if (!aShape.IsNull() && aShape->Type()==AIS_KOI_Datum && aShape->Signature()==3) { - - if (aShape->HasColor()) { + if (aShape->HasColor()) + { hascol=Standard_True; // On recupere la couleur de aShape - col=aShape->Color();} - - else hascol=Standard_False; + aShape->Color (col); + } + else + { + hascol = Standard_False; + } // On downcast aShape de AIS_InteractiveObject a AIS_Trihedron // pour lui appliquer la methode SetSize() diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx index d1bfe2092e..cd751ea231 100644 --- a/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx +++ b/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx @@ -735,8 +735,8 @@ static Standard_Integer meshcolors( Draw_Interpretor& di, if( !aMesh.IsNull() ) { TCollection_AsciiString aMode = TCollection_AsciiString (argv[2]); - Quantity_Color aColor1( (Quantity_NameOfColor)( Quantity_NOC_BLUE1 ) ); - Quantity_Color aColor2( (Quantity_NameOfColor)( Quantity_NOC_RED1 ) ); + Quantity_Color aColor1(Quantity_NOC_BLUE1); + Quantity_Color aColor2(Quantity_NOC_RED1); if( aMode.IsEqual("elem1") || aMode.IsEqual("elem2") || aMode.IsEqual("nodal") || aMode.IsEqual("nodaltex") || aMode.IsEqual("none") ) { Handle(MeshVS_PrsBuilder) aTempBuilder;