1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0024425: Improve usage ergonomics of new dimension presentations

- Added format for value string.
- Construction and validness.
- Revise modification of properties and update of presentations.
- Units moved to Drawer; code revisions.
- Length and angle initialization was changed. Type of geometry filed was added to AIS_Dimension.
- Method for test case bugs/vis/buc60915 was corrected. Description of the dimension classes was corrected.
- Fixed initialization of angle and length.
This commit is contained in:
aba
2013-12-11 19:16:07 +04:00
committed by abv
parent e04db19958
commit 60bf98ae02
44 changed files with 5023 additions and 3212 deletions

View File

@@ -3,3 +3,5 @@ Prs3d_NListOfSequenceOfPnt.hxx
Prs3d_Point.hxx
Prs3d_WFShape.hxx
Prs3d_WFShape.cxx
Prs3d_DimensionUnits.hxx
Prs3d_DimensionUnits.cxx

View File

@@ -119,6 +119,7 @@ is
class PlaneAspect;
class DimensionAspect;
class DatumAspect;
imported DimensionUnits;
class Drawer;
---Purpose: qualifies how the presentation algorithms compute

View File

@@ -18,8 +18,9 @@
class DimensionAspect from Prs3d inherits BasicAspect from Prs3d
---Purpose: defines the attributes when drawing a Length Presentation.
uses
---Purpose: defines the attributes when drawing a Length Presentation.
uses
DimensionTextHorizontalPosition from Prs3d,
DimensionTextVerticalPosition from Prs3d,
DimensionArrowOrientation from Prs3d,
@@ -31,7 +32,8 @@ uses
Color from Quantity,
TypeOfLine from Aspect,
PlaneAngle from Quantity,
TypeOfLine from Aspect
TypeOfLine from Aspect,
AsciiString from TCollection
is
Create returns mutable DimensionAspect from Prs3d;
@@ -64,8 +66,15 @@ is
IsArrows3d(me) returns Boolean from Standard;
--- Purpose: Gets type of arrows.
MakeArrows3d (me:mutable; isArrows3d: Boolean from Standard);
---Purpose: Sets type of arrows.
MakeArrows3d (me : mutable; isArrows3d: Boolean from Standard);
---Purpose: Sets type of arrows.
IsUnitsDisplayed (me) returns Boolean from Standard;
---Purpose: Shows if Units are to be displayed along with dimension value.
MakeUnitsDisplayed (me : mutable; theIsDisplayed : Boolean from Standard);
---Purpose: Specifies whether the units string should be displayed
-- along with value label or not.
SetArrowOrientation(me: mutable; theArrowOrient: DimensionArrowOrientation from Prs3d);
--- Purpose: Sets orientation of arrows (external or internal).
@@ -95,15 +104,21 @@ is
SetCommonColor(me:mutable; theColor: Color from Quantity) is static;
---Purpose: Sets the same color for all parts of dimension: lines, arrows and text.
SetExtensionSize (me : mutable; theSize : Real from Standard) is static;
SetExtensionSize (me : mutable; theSize : Real from Standard);
---Purpose: Sets extension size.
ExtensionSize (me) returns Real from Standard;
---Purpose: Returns extension size.
SetValueStringFormat (me : mutable; theFormat : AsciiString from TCollection);
---Purpose: Sets "sprintf"-syntax format for formatting dimension value labels.
ValueStringFormat (me) returns AsciiString from TCollection;
---Purpose: Returns format.
fields
myLineAspect: LineAspect from Prs3d;
myLineAspect : LineAspect from Prs3d;
---Purpose: Text style. The size for 3d (or 2d) text is also inside here.
myTextAspect: TextAspect from Prs3d;
@@ -129,4 +144,12 @@ fields
---Purpose: Size of arrow extensions.
-- The length of arrow tails if arrows are located outside dimension line.
myValueStringFormat : AsciiString from TCollection;
---Purpose: "sprintf"-syntax format for formatting dimension value labels.
-- Default is "%g".
myToDisplayUnits : Boolean from Standard;
---Purpose: Defines if the units need to be displayed.
-- Default is FALSE.
end DimensionAspect from Prs3d;

View File

@@ -50,7 +50,9 @@ Prs3d_DimensionAspect::Prs3d_DimensionAspect()
myArrowAspect->SetColor (Quantity_NOC_LAWNGREEN);
myArrowAspect->SetAngle (M_PI * 20.0 / 180.0);
myArrowAspect->SetLength (6.0);
myExtensionSize = 6.0;
myExtensionSize = 6.0;
myValueStringFormat = "%g";
myToDisplayUnits = Standard_False;
}
//=======================================================================
@@ -58,7 +60,6 @@ Prs3d_DimensionAspect::Prs3d_DimensionAspect()
//purpose : Sets the same color for all parts of dimension:
// lines, arrows and text.
//=======================================================================
void Prs3d_DimensionAspect::SetCommonColor (const Quantity_Color& theColor)
{
myLineAspect->SetColor (theColor);
@@ -70,7 +71,6 @@ void Prs3d_DimensionAspect::SetCommonColor (const Quantity_Color& theColor)
//function : LineAspect
//purpose :
//=======================================================================
Handle(Prs3d_LineAspect) Prs3d_DimensionAspect::LineAspect () const
{
return myLineAspect;
@@ -80,7 +80,6 @@ Handle(Prs3d_LineAspect) Prs3d_DimensionAspect::LineAspect () const
//function : SetLineAspect
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetLineAspect(const Handle(Prs3d_LineAspect)& theAspect)
{
myLineAspect = theAspect;
@@ -90,7 +89,6 @@ void Prs3d_DimensionAspect::SetLineAspect(const Handle(Prs3d_LineAspect)& theAsp
//function : TextAspect
//purpose :
//=======================================================================
Handle(Prs3d_TextAspect) Prs3d_DimensionAspect::TextAspect () const
{
return myTextAspect;
@@ -100,7 +98,6 @@ Handle(Prs3d_TextAspect) Prs3d_DimensionAspect::TextAspect () const
//function : SetTextAspect
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect)
{
myTextAspect = theAspect;
@@ -110,12 +107,11 @@ void Prs3d_DimensionAspect::SetTextAspect (const Handle(Prs3d_TextAspect)& theAs
//function : MakeArrows3D
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::MakeArrows3d (const Standard_Boolean isArrows3d)
{
myIsArrows3d = isArrows3d;
}
//=======================================================================
//function : IsArrows3D
//purpose :
@@ -129,12 +125,11 @@ Standard_Boolean Prs3d_DimensionAspect::IsArrows3d () const
//function : MakeText3D
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::MakeText3d (const Standard_Boolean isText3d)
{
myIsText3d = isText3d;
}
//=======================================================================
//function : IsText3D
//purpose :
@@ -144,6 +139,24 @@ Standard_Boolean Prs3d_DimensionAspect::IsText3d () const
return myIsText3d;
}
//=======================================================================
//function : IsUnitsDisplayed
//purpose :
//=======================================================================
Standard_Boolean Prs3d_DimensionAspect::IsUnitsDisplayed () const
{
return myToDisplayUnits;
}
//=======================================================================
//function : MakeUnitsDisplayed
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::MakeUnitsDisplayed (const Standard_Boolean theIsDisplayed)
{
myToDisplayUnits = theIsDisplayed;
}
//=======================================================================
//function : IsTextShaded
//purpose :
@@ -157,7 +170,6 @@ Standard_Boolean Prs3d_DimensionAspect::IsTextShaded () const
//function : MakeTextShaded
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::MakeTextShaded (const Standard_Boolean isTextShaded)
{
myIsTextShaded = isTextShaded;
@@ -167,7 +179,6 @@ void Prs3d_DimensionAspect::MakeTextShaded (const Standard_Boolean isTextShaded)
//function : SetArrowOrientation
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetArrowOrientation (const Prs3d_DimensionArrowOrientation theArrowOrient)
{
myArrowOrientation = theArrowOrient;
@@ -177,7 +188,6 @@ void Prs3d_DimensionAspect::SetArrowOrientation (const Prs3d_DimensionArrowOrien
//function : GetArrowOrientation
//purpose :
//=======================================================================
Prs3d_DimensionArrowOrientation Prs3d_DimensionAspect::ArrowOrientation() const
{
return myArrowOrientation;
@@ -187,7 +197,6 @@ Prs3d_DimensionArrowOrientation Prs3d_DimensionAspect::ArrowOrientation() const
//function : SetTextVerticalPosition
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetTextVerticalPosition (const Prs3d_DimensionTextVerticalPosition thePosition)
{
myTextVPosition = thePosition;
@@ -197,7 +206,6 @@ void Prs3d_DimensionAspect::SetTextVerticalPosition (const Prs3d_DimensionTextVe
//function : TextVerticalPosition
//purpose :
//=======================================================================
Prs3d_DimensionTextVerticalPosition Prs3d_DimensionAspect::TextVerticalPosition() const
{
return myTextVPosition;
@@ -207,7 +215,6 @@ Prs3d_DimensionTextVerticalPosition Prs3d_DimensionAspect::TextVerticalPosition(
//function : SetTextHorizontalPosition
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetTextHorizontalPosition (const Prs3d_DimensionTextHorizontalPosition thePosition)
{
myTextHPosition = thePosition;
@@ -217,7 +224,6 @@ void Prs3d_DimensionAspect::SetTextHorizontalPosition (const Prs3d_DimensionText
//function : TextHorizontalPosition
//purpose :
//=======================================================================
Prs3d_DimensionTextHorizontalPosition Prs3d_DimensionAspect::TextHorizontalPosition() const
{
return myTextHPosition;
@@ -227,7 +233,6 @@ Prs3d_DimensionTextHorizontalPosition Prs3d_DimensionAspect::TextHorizontalPosit
//function : ArrowAspect
//purpose :
//=======================================================================
Handle(Prs3d_ArrowAspect) Prs3d_DimensionAspect::ArrowAspect () const
{
return myArrowAspect;
@@ -237,7 +242,6 @@ Handle(Prs3d_ArrowAspect) Prs3d_DimensionAspect::ArrowAspect () const
//function : SetArrowAspect
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect)
{
myArrowAspect = theAspect;
@@ -247,7 +251,6 @@ void Prs3d_DimensionAspect::SetArrowAspect (const Handle(Prs3d_ArrowAspect)& the
//function : SetExtensioSize
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetExtensionSize (const Standard_Real theSize)
{
myExtensionSize = theSize;
@@ -257,8 +260,25 @@ void Prs3d_DimensionAspect::SetExtensionSize (const Standard_Real theSize)
//function : ExtensionSize
//purpose :
//=======================================================================
Standard_Real Prs3d_DimensionAspect::ExtensionSize() const
{
return myExtensionSize;
}
//=======================================================================
//function : SetValueStringFormat
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetValueStringFormat (const TCollection_AsciiString& theFormat)
{
myValueStringFormat = theFormat;
}
//=======================================================================
//function : ValueStringFormat
//purpose :
//=======================================================================
TCollection_AsciiString Prs3d_DimensionAspect::ValueStringFormat() const
{
return myValueStringFormat;
}

View File

@@ -0,0 +1,38 @@
// Created on: 2013-11-11
// Created by: Anastasia BORISOVA
// Copyright (c) 2013 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <Prs3d_DimensionUnits.hxx>
//=======================================================================
//function : SetLengthUnits
//purpose :
//=======================================================================
void Prs3d_DimensionUnits::SetLengthUnits (const TCollection_AsciiString& theUnits)
{
myLengthUnits = theUnits;
}
//=======================================================================
//function : SetAngleUnits
//purpose :
//=======================================================================
void Prs3d_DimensionUnits::SetAngleUnits (const TCollection_AsciiString& theUnits)
{
myAngleUnits = theUnits;
}

View File

@@ -0,0 +1,61 @@
// Created on: 2013-11-11
// Created by: Anastasia BORISOVA
// Copyright (c) 2013 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef _Prs3d_DimensionUnits_Header
#define _Prs3d_DimensionUnits_Header
#include <TCollection_AsciiString.hxx>
//! This class provides units for two dimension groups:
//! - lengthes (length, radius, diameter)
//! - angles
class Prs3d_DimensionUnits
{
public:
//! Default constructor. Sets meters as default length units
//! and radians as default angle units.
Prs3d_DimensionUnits()
: myLengthUnits ("m"),
myAngleUnits ("rad")
{}
Prs3d_DimensionUnits (const Prs3d_DimensionUnits& theUnits)
: myLengthUnits (theUnits.GetLengthUnits()),
myAngleUnits (theUnits.GetAngleUnits())
{}
//! Sets angle units
Standard_EXPORT void SetAngleUnits (const TCollection_AsciiString& theUnits);
//! @return angle units
const TCollection_AsciiString& GetAngleUnits() const { return myAngleUnits; }
//! Sets length units
Standard_EXPORT void SetLengthUnits (const TCollection_AsciiString& theUnits);
//! @return length units
const TCollection_AsciiString& GetLengthUnits() const { return myLengthUnits; }
private:
TCollection_AsciiString myLengthUnits;
TCollection_AsciiString myAngleUnits;
};
#endif

View File

@@ -46,7 +46,10 @@ uses
NameOfColor from Quantity,
PlaneAngle from Quantity,
Length from Quantity,
TypeOfHLR from Prs3d
TypeOfHLR from Prs3d,
DimensionUnits from Prs3d,
AsciiString from TCollection,
Ax2 from gp
is
Create returns mutable Drawer from Prs3d;
@@ -472,27 +475,51 @@ is
is virtual;
---Purpose: Sets the modality anAspect for the display of datums.
DimensionAspect(me:mutable) returns mutable DimensionAspect from Prs3d
---Purpose: Returns settings for the appearance of dimensions.
is virtual;
DimensionAspect(me:mutable) returns mutable DimensionAspect from Prs3d is virtual;
---Purpose: Returns settings for the appearance of dimensions.
SetDimensionAspect(me:mutable; theAspect: DimensionAspect from Prs3d)
is virtual;
---Purpose: Sets the modality anAspect for display of dimensions.
SetDimensionAspect(me:mutable; theAspect: DimensionAspect from Prs3d) is virtual;
---Purpose: Sets the settings for the appearance of dimensions.
SectionAspect (me:mutable) returns mutable LineAspect from Prs3d
---Purpose: The LineAspect for the wire can be edited.
-- The default values are:
-- Color: Quantity_NOC_ORANGE
-- Type of line: Aspect_TOL_SOLID
-- Width: 1.
-- These attributes are used by the algorithm Prs3d_WFShape
is virtual;
SetDimLengthModelUnits (me: mutable; theUnits : AsciiString from TCollection) is virtual;
---Purpose: Sets dimension length model units for computing of dimension presentation.
SetDimAngleModelUnits (me: mutable; theUnits : AsciiString from TCollection) is virtual;
---Purpose: Sets dimension angle model units for computing of dimension presentation.
DimLengthModelUnits (me) returns AsciiString from TCollection is virtual;
---Purpose: Returns length model units for the dimension presentation.
---C++: return const &
DimAngleModelUnits (me) returns AsciiString from TCollection is virtual;
---Purpose: Returns angle model units for the dimension presentation.
---C++: return const &
SetDimLengthDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is virtual;
---Purpose: Sets length units in which value for dimension presentation is displayed.
SetDimAngleDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is virtual;
---Purpose: Sets angle units in which value for dimension presentation is displayed.
DimLengthDisplayUnits (me) returns AsciiString from TCollection is virtual;
---Purpose: Returns length units in which dimension presentation is displayed.
---C++: return const &
DimAngleDisplayUnits (me) returns AsciiString from TCollection is virtual;
---Purpose: Returns angle units in which dimension presentation is displayed.
---C++: return const &
SectionAspect (me : mutable) returns mutable LineAspect from Prs3d is virtual;
---Purpose: The LineAspect for the wire can be edited.
-- The default values are:
-- Color: Quantity_NOC_ORANGE
-- Type of line: Aspect_TOL_SOLID
-- Width: 1.
-- These attributes are used by the algorithm Prs3d_WFShape.
SetSectionAspect (me : mutable; theAspect: LineAspect from Prs3d) is virtual;
---Purpose: Sets the parameter theAspect for display attributes of sections.
SetSectionAspect(me:mutable;anAspect: LineAspect from Prs3d)
is virtual;
---Purpose: Sets the parameter anAspect for display attributes of sections.
SetFaceBoundaryDraw (me : mutable;
theIsEnabled : Boolean from Standard)
is virtual;
@@ -515,43 +542,49 @@ is
---Purpose: Returns line aspect of face boundaries.
fields
myUIsoAspect: IsoAspect from Prs3d is protected;
myVIsoAspect: IsoAspect from Prs3d is protected;
myNbPoints : Integer from Standard is protected;
myIsoOnPlane: Boolean from Standard is protected;
myFreeBoundaryAspect: LineAspect from Prs3d is protected;
myFreeBoundaryDraw: Boolean from Standard is protected;
myUnFreeBoundaryAspect: LineAspect from Prs3d is protected;
myUnFreeBoundaryDraw: Boolean from Standard is protected;
myWireAspect: LineAspect from Prs3d is protected;
myWireDraw: Boolean from Standard is protected;
myLineAspect: LineAspect from Prs3d is protected;
myTextAspect: TextAspect from Prs3d is protected;
myShadingAspect: ShadingAspect from Prs3d is protected;
myShadingAspectGlobal: Boolean from Standard is protected;
myChordialDeviation: Length from Quantity is protected;
myTypeOfDeflection: TypeOfDeflection from Aspect is protected;
myMaximalParameterValue: Real from Standard is protected;
myDeviationCoefficient: Real from Standard is protected;
myHLRDeviationCoefficient: Real from Standard is protected;
myDeviationAngle: Real from Standard is protected;
myHLRAngle: Real from Standard is protected;
myPointAspect: PointAspect from Prs3d is protected;
myPlaneAspect: PlaneAspect from Prs3d is protected;
myArrowAspect: ArrowAspect from Prs3d is protected;
myLineDrawArrow: Boolean from Standard is protected;
myDrawHiddenLine: Boolean from Standard is protected;
myHiddenLineAspect: LineAspect from Prs3d is protected;
mySeenLineAspect: LineAspect from Prs3d is protected;
myVectorAspect: LineAspect from Prs3d is protected;
myDatumAspect: DatumAspect from Prs3d is protected;
myDatumScale: Real from Standard is protected;
myDimensionAspect: DimensionAspect from Prs3d is protected;
mySectionAspect: LineAspect from Prs3d is protected;
myFaceBoundaryDraw : Boolean from Standard is protected;
myFaceBoundaryAspect : LineAspect from Prs3d is protected;
myTypeOfHLR : TypeOfHLR from Prs3d is protected;
myUIsoAspect: IsoAspect from Prs3d is protected;
myVIsoAspect: IsoAspect from Prs3d is protected;
myNbPoints : Integer from Standard is protected;
myIsoOnPlane: Boolean from Standard is protected;
myFreeBoundaryAspect: LineAspect from Prs3d is protected;
myFreeBoundaryDraw: Boolean from Standard is protected;
myUnFreeBoundaryAspect: LineAspect from Prs3d is protected;
myUnFreeBoundaryDraw: Boolean from Standard is protected;
myWireAspect: LineAspect from Prs3d is protected;
myWireDraw: Boolean from Standard is protected;
myLineAspect: LineAspect from Prs3d is protected;
myTextAspect: TextAspect from Prs3d is protected;
myShadingAspect: ShadingAspect from Prs3d is protected;
myShadingAspectGlobal: Boolean from Standard is protected;
myChordialDeviation: Length from Quantity is protected;
myTypeOfDeflection: TypeOfDeflection from Aspect is protected;
myMaximalParameterValue: Real from Standard is protected;
myDeviationCoefficient: Real from Standard is protected;
myHLRDeviationCoefficient: Real from Standard is protected;
myDeviationAngle: Real from Standard is protected;
myHLRAngle: Real from Standard is protected;
myPointAspect: PointAspect from Prs3d is protected;
myPlaneAspect: PlaneAspect from Prs3d is protected;
myArrowAspect: ArrowAspect from Prs3d is protected;
myLineDrawArrow: Boolean from Standard is protected;
myDrawHiddenLine: Boolean from Standard is protected;
myHiddenLineAspect: LineAspect from Prs3d is protected;
mySeenLineAspect: LineAspect from Prs3d is protected;
myVectorAspect: LineAspect from Prs3d is protected;
myDatumAspect: DatumAspect from Prs3d is protected;
myDatumScale: Real from Standard is protected;
myDimensionAspect : DimensionAspect from Prs3d is protected;
myDimensionModelUnits : DimensionUnits from Prs3d is protected;
myDimensionDisplayUnits : DimensionUnits from Prs3d is protected;
mySectionAspect : LineAspect from Prs3d is protected;
myFaceBoundaryDraw : Boolean from Standard is protected;
myFaceBoundaryAspect : LineAspect from Prs3d is protected;
myTypeOfHLR : TypeOfHLR from Prs3d is protected;
end Drawer;

View File

@@ -16,31 +16,37 @@
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#define BUC60488 //GG_10/10/99 Set correctly all fields
#include <Prs3d_Drawer.ixx>
Prs3d_Drawer::Prs3d_Drawer(): myNbPoints(30),myIsoOnPlane(Standard_False),
myFreeBoundaryDraw(Standard_True),
myUnFreeBoundaryDraw(Standard_True),
myWireDraw(Standard_True),
#ifdef BUC60488
myShadingAspect( new Prs3d_ShadingAspect()),
#endif
myShadingAspectGlobal(Standard_True),
myChordialDeviation(0.0001),
myTypeOfDeflection(Aspect_TOD_RELATIVE),
myMaximalParameterValue(500000.),
myDeviationCoefficient(0.001),
myHLRDeviationCoefficient(0.02),
myDeviationAngle(12*M_PI/180),
myHLRAngle(20*M_PI/180),
myLineDrawArrow(Standard_False),
myDrawHiddenLine(Standard_False),
myFaceBoundaryDraw(Standard_False),
myTypeOfHLR(Prs3d_TOH_PolyAlgo)
// =======================================================================
// function : Prs3d_Drawer
// purpose :
// =======================================================================
Prs3d_Drawer::Prs3d_Drawer()
: myNbPoints (30),
myIsoOnPlane (Standard_False),
myFreeBoundaryDraw (Standard_True),
myUnFreeBoundaryDraw (Standard_True),
myWireDraw (Standard_True),
myShadingAspect (new Prs3d_ShadingAspect()),
myShadingAspectGlobal (Standard_True),
myChordialDeviation (0.0001),
myTypeOfDeflection (Aspect_TOD_RELATIVE),
myMaximalParameterValue (500000.),
myDeviationCoefficient (0.001),
myHLRDeviationCoefficient (0.02),
myDeviationAngle (12.0 * M_PI / 180.0),
myHLRAngle (20.0 * M_PI / 180.0),
myLineDrawArrow (Standard_False),
myDrawHiddenLine (Standard_False),
myFaceBoundaryDraw (Standard_False),
myTypeOfHLR (Prs3d_TOH_PolyAlgo)
{
}
myDimensionModelUnits.SetLengthUnits ("m");
myDimensionModelUnits.SetAngleUnits ("rad");
myDimensionDisplayUnits.SetLengthUnits ("m");
myDimensionDisplayUnits.SetAngleUnits ("deg");
}
void Prs3d_Drawer::SetTypeOfDeflection(const Aspect_TypeOfDeflection aTypeOfDeflection){
@@ -397,30 +403,122 @@ void Prs3d_Drawer::SetPlaneAspect ( const Handle(Prs3d_PlaneAspect)& anAspect) {
myPlaneAspect = anAspect;
}
Handle (Prs3d_DimensionAspect) Prs3d_Drawer::DimensionAspect ()
// =======================================================================
// function : DimensionAspect
// purpose :
// =======================================================================
Handle(Prs3d_DimensionAspect) Prs3d_Drawer::DimensionAspect()
{
if (myDimensionAspect.IsNull())
{
myDimensionAspect = new Prs3d_DimensionAspect;
}
return myDimensionAspect;
}
void Prs3d_Drawer::SetDimensionAspect ( const Handle(Prs3d_DimensionAspect)& theAspect)
// =======================================================================
// function : SetDimensionAspect
// purpose :
// =======================================================================
void Prs3d_Drawer::SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theAspect)
{
myDimensionAspect = theAspect;
myDimensionAspect = theAspect;
}
// =======================================================================
// function : SetDimLengthModelUnits
// purpose :
// =======================================================================
void Prs3d_Drawer::SetDimLengthModelUnits (const TCollection_AsciiString& theUnits)
{
myDimensionModelUnits.SetLengthUnits (theUnits);
}
Handle (Prs3d_LineAspect) Prs3d_Drawer::SectionAspect () {
// =======================================================================
// function : SetDimAngleModelUnits
// purpose :
// =======================================================================
void Prs3d_Drawer::SetDimAngleModelUnits (const TCollection_AsciiString& theUnits)
{
myDimensionModelUnits.SetAngleUnits (theUnits);
}
// =======================================================================
// function : DimLengthModelUnits
// purpose :
// =======================================================================
const TCollection_AsciiString& Prs3d_Drawer::DimLengthModelUnits() const
{
return myDimensionModelUnits.GetLengthUnits();
}
// =======================================================================
// function : DimAngleModelUnits
// purpose :
// =======================================================================
const TCollection_AsciiString& Prs3d_Drawer::DimAngleModelUnits() const
{
return myDimensionModelUnits.GetAngleUnits();
}
// =======================================================================
// function : SetDimLengthDisplayUnits
// purpose :
// =======================================================================
void Prs3d_Drawer::SetDimLengthDisplayUnits (const TCollection_AsciiString& theUnits)
{
myDimensionDisplayUnits.SetLengthUnits (theUnits);
}
// =======================================================================
// function : SetDimAngleDisplayUnits
// purpose :
// =======================================================================
void Prs3d_Drawer::SetDimAngleDisplayUnits (const TCollection_AsciiString& theUnits)
{
myDimensionDisplayUnits.SetAngleUnits (theUnits);
}
// =======================================================================
// function : DimLengthDisplayUnits
// purpose :
// =======================================================================
const TCollection_AsciiString& Prs3d_Drawer::DimLengthDisplayUnits() const
{
return myDimensionDisplayUnits.GetLengthUnits();
}
// =======================================================================
// function : DimAngleDisplayUnits
// purpose :
// =======================================================================
const TCollection_AsciiString& Prs3d_Drawer::DimAngleDisplayUnits() const
{
return myDimensionDisplayUnits.GetAngleUnits();
}
// =======================================================================
// function : SectionAspect
// purpose :
// =======================================================================
Handle (Prs3d_LineAspect) Prs3d_Drawer::SectionAspect()
{
if (mySectionAspect.IsNull())
mySectionAspect = new Prs3d_LineAspect
(Quantity_NOC_ORANGE,Aspect_TOL_SOLID,1.);
{
mySectionAspect = new Prs3d_LineAspect (Quantity_NOC_ORANGE, Aspect_TOL_SOLID, 1.0);
}
return mySectionAspect;
}
void Prs3d_Drawer::SetSectionAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
mySectionAspect = anAspect;
// =======================================================================
// function : SetSectionAspect
// purpose :
// =======================================================================
void Prs3d_Drawer::SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect)
{
mySectionAspect = theAspect;
}
// =======================================================================
@@ -469,7 +567,6 @@ Handle_Prs3d_LineAspect Prs3d_Drawer::FaceBoundaryAspect ()
// function : SetTypeOfHLR
// purpose : set type of HLR algorithm
// =======================================================================
void Prs3d_Drawer::SetTypeOfHLR ( const Prs3d_TypeOfHLR theTypeOfHLR)
{
myTypeOfHLR = theTypeOfHLR;
@@ -479,7 +576,6 @@ void Prs3d_Drawer::SetTypeOfHLR ( const Prs3d_TypeOfHLR theTypeOfHLR)
// function : TypeOfHLR
// purpose : gets type of HLR algorithm
// =======================================================================
Prs3d_TypeOfHLR Prs3d_Drawer::TypeOfHLR ( ) const
{
return myTypeOfHLR;