1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
mkv
97c092f27b 0026587: Infinite calculations of BRepOffset_MakeOffset 2015-09-10 16:47:01 +03:00
18 changed files with 311 additions and 1095 deletions

View File

@@ -597,14 +597,9 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
Quantity_Length anArrowLength = aDimensionAspect->ArrowAspect()->Length();
TCollection_ExtendedString aLabelString = GetTextLabel();
// Text sizes
Standard_Real aLabelWidth = 0.0;
Standard_Real aLabelHeight = 0.0;
Standard_Real aSymbolWidth = 0.0;
Standard_Real aSymbolHeight = 0.0;
getLabelSizes (aLabelString, aLabelWidth, aLabelHeight, aSymbolWidth, aSymbolHeight);
// prepare label string and compute its geometrical width
Standard_Real aLabelWidth;
TCollection_ExtendedString aLabelString = GetValueString (aLabelWidth);
// add margins to label width
if (aDimensionAspect->IsText3d())
@@ -1164,15 +1159,8 @@ const gp_Pnt AIS_AngleDimension::GetTextPosition() const
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
// Prepare label string and compute its geometrical width
TCollection_ExtendedString aLabelString = GetTextLabel();
// Text sizes
Standard_Real aLabelWidth = 0.0;
Standard_Real aLabelHeight = 0.0;
Standard_Real aSymbolWidth = 0.0;
Standard_Real aSymbolHeight = 0.0;
getLabelSizes (aLabelString, aLabelWidth, aLabelHeight, aSymbolWidth, aSymbolHeight);
Standard_Real aLabelWidth;
TCollection_ExtendedString aLabelString = GetValueString (aLabelWidth);
gp_Pnt aFirstAttach = myCenterPoint.Translated (gp_Vec(myCenterPoint, myFirstPoint).Normalized() * GetFlyout());
gp_Pnt aSecondAttach = myCenterPoint.Translated (gp_Vec(myCenterPoint, mySecondPoint).Normalized() * GetFlyout());
@@ -1351,15 +1339,8 @@ void AIS_AngleDimension::FitTextAlignment (const Prs3d_DimensionTextHorizontalPo
Quantity_Length anArrowLength = aDimensionAspect->ArrowAspect()->Length();
// Prepare label string and compute its geometrical width
TCollection_ExtendedString aLabelString = GetTextLabel();
// Text sizes
Standard_Real aLabelWidth = 0.0;
Standard_Real aLabelHeight = 0.0;
Standard_Real aSymbolWidth = 0.0;
Standard_Real aSymbolHeight = 0.0;
getLabelSizes (aLabelString, aLabelWidth, aLabelHeight, aSymbolWidth, aSymbolHeight);
Standard_Real aLabelWidth;
TCollection_ExtendedString aLabelString = GetValueString (aLabelWidth);
// add margins to label width
if (aDimensionAspect->IsText3d())

View File

@@ -35,11 +35,10 @@ namespace
//function : Constructor
//purpose :
//=======================================================================
AIS_DiameterDimension::AIS_DiameterDimension (const gp_Circ& theCircle,
const Standard_Real theParameter)
AIS_DiameterDimension::AIS_DiameterDimension (const gp_Circ& theCircle)
: AIS_Dimension (AIS_KOD_DIAMETER)
{
SetMeasuredGeometry (theCircle, theParameter);
SetMeasuredGeometry (theCircle);
SetSpecialSymbol (THE_DIAMETER_SYMBOL);
SetDisplaySpecialSymbol (AIS_DSS_Before);
SetFlyout (0.0);
@@ -106,8 +105,7 @@ gp_Pnt AIS_DiameterDimension::AnchorPoint()
//function : SetMeasuredGeometry
//purpose :
//=======================================================================
void AIS_DiameterDimension::SetMeasuredGeometry (const gp_Circ& theCircle,
const Standard_Real theParameter)
void AIS_DiameterDimension::SetMeasuredGeometry (const gp_Circ& theCircle)
{
myCircle = theCircle;
myGeometryType = GeometryType_Edge;
@@ -122,7 +120,7 @@ void AIS_DiameterDimension::SetMeasuredGeometry (const gp_Circ& theCircle,
else if (!myIsPlaneCustom)
{
ComputePlane();
myAnchorPoint = ElCLib::Value (theParameter, myCircle);
myAnchorPoint = ElCLib::Value (0.0, myCircle);
}
SetToUpdate();
@@ -294,7 +292,7 @@ void AIS_DiameterDimension::Compute (const Handle(PrsMgr_PresentationManager3d)&
gp_Pnt aSecondPnt (gp::Origin());
ComputeSidePoints (myCircle, aFirstPnt, aSecondPnt);
DrawLinearDimension (thePresentation, theMode, aFirstPnt, aSecondPnt, Standard_False, myToDrawDimensionLine);
DrawLinearDimension (thePresentation, theMode, aFirstPnt, aSecondPnt);
}
//=======================================================================

View File

@@ -59,9 +59,7 @@ public:
//! Construct diameter dimension for the circle.
//! @param theCircle [in] the circle to measure.
//! @param theParameter [in] the value of parameter for parametric representation of the input circle
//! that defines the point where the dimension is to be attached.
Standard_EXPORT AIS_DiameterDimension (const gp_Circ& theCircle, const Standard_Real theParameter = 0.0);
Standard_EXPORT AIS_DiameterDimension (const gp_Circ& theCircle);
//! Construct diameter dimension for the circle and orient it correspondingly
//! to the passed plane.
@@ -108,9 +106,7 @@ public:
//! The dimension will become invalid if the diameter of the circle
//! is less than Precision::Confusion().
//! @param theCircle [in] the circle to measure.
//! @param theParameter [in] the value of parameter for parametric representation of the input circle
//! that defines the point where the dimension is to be attached.
Standard_EXPORT void SetMeasuredGeometry (const gp_Circ& theCircle, const Standard_Real theParameter = 0);
Standard_EXPORT void SetMeasuredGeometry (const gp_Circ& theCircle);
//! Measure diameter on the passed shape, if applicable.
//! The dimension will become invalid if the passed shape is not

File diff suppressed because it is too large Load Diff

View File

@@ -196,12 +196,10 @@ protected:
LabelPosition_HCenter = 0x04,
LabelPosition_HMask = LabelPosition_Left | LabelPosition_Right | LabelPosition_HCenter,
LabelPosition_Above = 0x0010,
LabelPosition_FirstLine = 0x0020,
LabelPosition_Below = 0x0040,
LabelPosition_LastLine = 0x0080,
LabelPosition_VCenter = 0x0100,
LabelPosition_VMask = LabelPosition_Above | LabelPosition_Below | LabelPosition_VCenter | LabelPosition_FirstLine | LabelPosition_LastLine
LabelPosition_Above = 0x10,
LabelPosition_Below = 0x20,
LabelPosition_VCenter = 0x40,
LabelPosition_VMask = LabelPosition_Above | LabelPosition_Below | LabelPosition_VCenter
};
public:
@@ -227,7 +225,10 @@ public:
//! compute it on its own in model space coordinates.
//! @return the dimension value (in model units) which is used
//! during display of the presentation.
Standard_EXPORT Standard_Real GetValue() const;
Standard_Real GetValue() const
{
return myIsValueCustom ? myCustomValue : ComputeValue();
}
//! Sets user-defined dimension value.
//! The user-defined dimension value is specified in model space,
@@ -235,14 +236,6 @@ public:
//! @param theValue [in] the user-defined value to display.
Standard_EXPORT void SetCustomValue (const Standard_Real theValue);
//! Sets multiline text for dimension label.
//! @param theValue [in] multiline string of Unicode symbols.
//! Can be used along with spectial symbol (like radius and diameter symbol)
Standard_EXPORT void SetTextLabel (const TCollection_ExtendedString& theValue);
//! @return the text for text label.
Standard_EXPORT TCollection_ExtendedString GetTextLabel() const;
//! Get the dimension plane in which the 2D dimension presentation is computed.
//! By default, if plane is not defined by user, it is computed automatically
//! after dimension geometry is computed.
@@ -383,26 +376,6 @@ public:
return myIsGeometryValid && CheckPlane (GetPlane());
}
//! @return state that shows if the radius inner segment
//! is to be displayed.
Standard_EXPORT const Standard_Boolean ToDrawDimensionLine() const;
//! Sets the flag that defines whether the dimenion line segment is displayed
//! @warning Dimension line won't be displayed only if arrows and label are moved
//! outside on dimension line extensions
Standard_EXPORT void SetToDrawDimensionLine (const Standard_Boolean theToDrawInnerSegment);
Standard_EXPORT void SetToAlignText (const Standard_Boolean theToAlign,
const gp_Dir& theAlignmentDir = gp_Dir (1.0, 0.0, 0.0));
Standard_EXPORT const Standard_Boolean IsTextAligned() const;
Standard_EXPORT const gp_Dir& TextAlignmentDir() const;
Standard_EXPORT void SetLeaderSegment (const Standard_Real theLength);
Standard_EXPORT void UnsetLeaderSegment();
public:
DEFINE_STANDARD_RTTI(AIS_Dimension, AIS_InteractiveObject)
@@ -411,9 +384,10 @@ protected:
Standard_EXPORT Standard_Real ValueToDisplayUnits() const;
Standard_EXPORT void getLabelSizes (const TCollection_ExtendedString& theLabel,
Standard_Real& theWidth, Standard_Real& theHeight,
Standard_Real& theSymbolWidth, Standard_Real& theSymbolHeight) const;
//! Get formatted value string and its model space width.
//! @param theWidth [out] the model space with of the string.
//! @return formatted dimension value string.
Standard_EXPORT TCollection_ExtendedString GetValueString (Standard_Real& theWidth) const;
//! Performs drawing of 2d or 3d arrows on the working plane
//! @param theLocation [in] the location of the arrow tip.
@@ -461,15 +435,11 @@ protected:
//! @param theFirstPoint [in] the first attach point of linear dimension.
//! @param theSecondPoint [in] the second attach point of linear dimension.
//! @param theIsOneSide [in] specifies whether the dimension has only one flyout line.
//! @param theToDrawDimensionLine [in] specifies whether the dimension line is to be displayed.
//! @warning Dimension line won't be displayed only if arrows and label are moved
//! outside on dimension line extensions
Standard_EXPORT void DrawLinearDimension (const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode,
const gp_Pnt& theFirstPoint,
const gp_Pnt& theSecondPoint,
const Standard_Boolean theIsOneSide = Standard_False,
const Standard_Boolean theToDrawDimensionLine = Standard_True);
const Standard_Boolean theIsOneSide = Standard_False);
//! Compute selection sensitives for linear dimension flyout lines (length, diameter, radius).
//! Please note that this method uses base dimension properties: working plane and flyout length.
@@ -681,57 +651,29 @@ protected: //! @name Selection geometry
Standard_Real mySelToleranceForText2d; //!< Sensitive point tolerance for 2d text selection.
protected:
protected: //! @name Value properties
enum TypeOfLabel
{
TOL_Computed = 0, //< is default
TOL_Value = 1,
TOL_Text
};
protected: //! @name Label properties
TypeOfLabel myTypeOfLabel;
Standard_Real myCustomValue; //!< Value of the dimension (computed or user-defined).
TCollection_ExtendedString myLabel; //!< Label text. Sets the user defined multiline text
Standard_Real myCustomValue; //!< Value of the dimension (computed or user-defined).
Standard_Boolean myIsValueCustom; //!< Is user-defined value.
protected: //! @name Fixed text position properties
gp_Pnt myFixedTextPosition; //!< Stores text position fixed by user.
Standard_Boolean myIsTextPositionFixed; //!< Is the text label position fixed by user.
gp_Pnt myFixedTextPosition; //!< Stores text position fixed by user.
Standard_Boolean myIsTextPositionFixed; //!< Is the text label position fixed by user.
protected: //! @name Units properties
Standard_ExtCharacter mySpecialSymbol; //!< Special symbol.
AIS_DisplaySpecialSymbol myDisplaySpecialSymbol; //!< Special symbol display options.
protected:
//! Shows if the dimension line is to be drawn
//! It is used only if the text is placed on the one of the dimension line extensions.
//! By default it is TRUE
//! @warning Dimension line won't be displayed only if arrows and label are moved
//! outside on dimension line extensions
Standard_Boolean myToDrawDimensionLine;
protected: //! @name Geometrical properties
GeometryType myGeometryType; //!< defines type of shapes on which the dimension is to be built.
gp_Pln myPlane; //!< Plane where dimension will be built (computed or user defined).
Standard_Boolean myIsPlaneCustom; //!< Is plane defined by user (otherwise it will be computed automatically).
Standard_Real myFlyout; //!< Flyout distance.
//! Shows if the text label is aligned to user-defined direction myTextDir
//! Otherwise it is alligned to the dimension line extension direction
//! @warning Only for text placed outside of the dimension line
Standard_Boolean myIsTextAligned;
gp_Dir myTextDir; //!< Alignment direction for the text
Standard_Real myLeaderSegmentLength; //!< Length of leader line segment aligned with text to myTextDir direction
Standard_Boolean myIsGeometryValid; //!< Is dimension geometry properly defined.
gp_Pln myPlane; //!< Plane where dimension will be built (computed or user defined).
Standard_Boolean myIsPlaneCustom; //!< Is plane defined by user (otherwise it will be computed automatically).
Standard_Real myFlyout; //!< Flyout distance.
Standard_Boolean myIsGeometryValid; //!< Is dimension geometry properly defined.
private:

View File

@@ -31,25 +31,15 @@ namespace
//function : Constructor
//purpose :
//=======================================================================
void AIS_RadiusDimension::init()
AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle)
: AIS_Dimension (AIS_KOD_RADIUS)
{
SetMeasuredGeometry (theCircle);
SetSpecialSymbol (THE_RADIUS_SYMBOL);
SetDisplaySpecialSymbol (AIS_DSS_Before);
SetFlyout (0.0);
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle,
const Standard_Real theParameter)
: AIS_Dimension (AIS_KOD_RADIUS)
{
init();
SetMeasuredGeometry (theCircle, theParameter);
}
//=======================================================================
//function : Constructor
//purpose :
@@ -58,8 +48,10 @@ AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle,
const gp_Pnt& theAttachPoint)
: AIS_Dimension (AIS_KOD_RADIUS)
{
init();
SetMeasuredGeometry (theCircle, theAttachPoint);
SetSpecialSymbol (THE_RADIUS_SYMBOL);
SetDisplaySpecialSymbol (AIS_DSS_Before);
SetFlyout (0.0);
}
//=======================================================================
@@ -69,21 +61,22 @@ AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle,
AIS_RadiusDimension::AIS_RadiusDimension (const TopoDS_Shape& theShape)
: AIS_Dimension (AIS_KOD_RADIUS)
{
init();
SetMeasuredGeometry (theShape);
SetSpecialSymbol (THE_RADIUS_SYMBOL);
SetDisplaySpecialSymbol (AIS_DSS_Before);
SetFlyout (0.0);
}
//=======================================================================
//function : SetMeasuredGeometry
//purpose :
//=======================================================================
void AIS_RadiusDimension::SetMeasuredGeometry (const gp_Circ& theCircle,
const Standard_Real theParameter)
void AIS_RadiusDimension::SetMeasuredGeometry (const gp_Circ& theCircle)
{
myCircle = theCircle;
myGeometryType = GeometryType_Edge;
myShape = BRepLib_MakeEdge (theCircle);
myAnchorPoint = ElCLib::Value (theParameter, myCircle);
myAnchorPoint = ElCLib::Value (0, myCircle);
myIsGeometryValid = IsValidCircle (myCircle);
if (myIsGeometryValid)
@@ -135,33 +128,6 @@ void AIS_RadiusDimension::SetMeasuredGeometry (const TopoDS_Shape& theShape)
SetToUpdate();
}
//=======================================================================
//function : Circle
//purpose :
//=======================================================================
const gp_Circ& AIS_RadiusDimension::Circle() const
{
return myCircle;
}
//=======================================================================
//function : AnchorPoint
//purpose :
//=======================================================================
const gp_Pnt& AIS_RadiusDimension::AnchorPoint() const
{
return myAnchorPoint;
}
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
const TopoDS_Shape& AIS_RadiusDimension::Shape() const
{
return myShape;
}
//=======================================================================
//function : CheckPlane
//purpose :
@@ -262,7 +228,7 @@ void AIS_RadiusDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /
return;
}
DrawLinearDimension (thePresentation, theMode, myAnchorPoint, myCircle.Location(), Standard_True, myToDrawDimensionLine);
DrawLinearDimension (thePresentation, theMode, myAnchorPoint, myCircle.Location(), Standard_True);
}
//=======================================================================

View File

@@ -39,21 +39,13 @@ DEFINE_STANDARD_HANDLE (AIS_RadiusDimension,AIS_Dimension)
//! In case if the dimension is built on the arbitrary shape,
//! it can be considered as invalid if the shape does not contain
//! circle geometry.
//! Use IsValid() method to check that created dimension is valid.
class AIS_RadiusDimension : public AIS_Dimension
{
protected:
//! Setting of default construction parameters
void init();
public:
//! Create radius dimension for the circle geometry.
//! @param theCircle [in] the circle to measure.
//! @param theParameter [in] the value of parameter for parametric representation of the input circle
//! that defines the point where the dimension is to be attached.
Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle, const Standard_Real theParameter = 0);
Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle);
//! Create radius dimension for the circle geometry and define its
//! orientation by location of the first point on that circle.
@@ -70,13 +62,22 @@ public:
public:
//! @return measured geometry circle.
Standard_EXPORT const gp_Circ& Circle() const;
const gp_Circ& Circle() const
{
return myCircle;
}
//! @return anchor point on circle for radius dimension.
Standard_EXPORT const gp_Pnt& AnchorPoint() const;
const gp_Pnt& AnchorPoint() const
{
return myAnchorPoint;
}
//! @return the measured shape.
Standard_EXPORT const TopoDS_Shape& Shape() const;
const TopoDS_Shape& Shape() const
{
return myShape;
}
public:
@@ -84,9 +85,7 @@ public:
//! The dimension will become invalid if the radius of the circle
//! is less than Precision::Confusion().
//! @param theCircle [in] the circle to measure.
//! @param theParameter [in] the value of parameter for parametric representation of the input circle
//! that defines the point where the dimension is to be attached.
Standard_EXPORT void SetMeasuredGeometry (const gp_Circ& theCircle, const Standard_Real theParameter = 0);
Standard_EXPORT void SetMeasuredGeometry (const gp_Circ& theCircle);
//! Measure radius of the circle and orient the dimension so
//! the dimension lines attaches to anchor point on the circle.
@@ -123,16 +122,16 @@ public:
protected:
Standard_EXPORT virtual void ComputePlane() Standard_OVERRIDE;
Standard_EXPORT virtual void ComputePlane();
//! Checks if anchor point and the center of the circle are on the plane.
Standard_EXPORT virtual Standard_Boolean CheckPlane (const gp_Pln& thePlane) const Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Boolean CheckPlane (const gp_Pln& thePlane) const;
Standard_EXPORT virtual Standard_Real ComputeValue() const Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Real ComputeValue() const;
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode = 0) Standard_OVERRIDE;
const Standard_Integer theMode = 0);
protected:

View File

@@ -464,38 +464,3 @@ Standard_Boolean Font_BRepFont::renderGlyph (const Standard_Utf32Char theChar,
myCache.Bind (theChar, theShape);
return !theShape.IsNull();
}
// =======================================================================
// function : BoundingBox
// purpose :
// =======================================================================
Font_FTFont::Rect Font_BRepFont::BoundingBox (const NCollection_String& theString,
const Graphic3d_HorizontalTextAlignment theHAlign,
const Graphic3d_VerticalTextAlignment theVAlign)
{
Rect aBox;
aBox.Left = 0.0f;
aBox.Right = 0.0f;
aBox.Bottom = 0.0f;
aBox.Top = static_cast<float> (Ascender());
// Initialize text formatter
Font_TextFormatter aFormatter;
aFormatter.Reset();
aFormatter.SetupAlignment (theHAlign, theVAlign);
aFormatter.Append (theString, *(reinterpret_cast<Font_FTFont*> (this)));
aFormatter.Format();
// Get bounding box
aFormatter.BndBox (aBox);
// Apply BRepFont scale to box limits
Standard_Real aScaleUnits = Scale();
aBox.Left = aBox.Left * aScaleUnits;
aBox.Top = aBox.Top * aScaleUnits;
aBox.Right = aBox.Right * aScaleUnits;
aBox.Bottom = aBox.Bottom * aScaleUnits;
return aBox;
}

View File

@@ -96,12 +96,6 @@ public:
//! Notice that altering this flag clears currently accumulated cache!
Standard_EXPORT void SetCompositeCurveMode (const Standard_Boolean theToConcatenate);
//! Compute bounding rectangle of resultant BRep text shape from input string
//! @return bounding rectangle
Standard_EXPORT Font_FTFont::Rect BoundingBox (const NCollection_String& theString,
const Graphic3d_HorizontalTextAlignment theHAlign = Graphic3d_HTA_LEFT,
const Graphic3d_VerticalTextAlignment theVAlign = Graphic3d_VTA_BOTTOM);
public:
//! @return vertical distance from the horizontal baseline to the highest character coordinate.
@@ -170,8 +164,6 @@ public:
return myMutex;
}
protected:
//! Render single glyph as TopoDS_Shape. This method does not lock the mutex.

View File

@@ -25,9 +25,7 @@
enum Prs3d_DimensionTextVerticalPosition
{
Prs3d_DTVP_Above,
Prs3d_DTVP_FirstLine,
Prs3d_DTVP_Below,
Prs3d_DTVP_LastLine,
Prs3d_DTVP_Center
};

View File

@@ -38,7 +38,6 @@
#include <Draw_Appli.hxx>
#include <Draw_Window.hxx>
#include <DBRep.hxx>
#include <ElCLib.hxx>
#include <ElSLib.hxx>
#include <Font_FontMgr.hxx>
#include <GC_MakePlane.hxx>
@@ -170,21 +169,16 @@ static Standard_Boolean Get3DPointAtMousePosition (const gp_Pnt& theFirstPoint,
// length, angle, radius and diameter dimension.
//
//draw args: -text [3d|2d] [wf|sh|wireframe|shading] [Size]
// -label [left|right|hcenter|hfit] [top|bottom|vcenter|firstline|lastline|vfit]
// -label [left|right|hcenter|hfit] [top|bottom|vcenter|vfit]
// -arrow [external|internal|fit] [Length(int)]
// -arrowangle ArrowAngle(degrees)
// -plane xoy|yoz|zox
// -flyout FloatValue -extension FloatValue
// -value CustomNumberValue
// -valuetext CustomText
// -dispunits DisplayUnitsString
// -modelunits ModelUnitsString
// -showunits (DEFAULT)
// -showunits
// -hideunits
// -drawdimline (DEFAULT)
// -hidedimline
// -aligntext DirX DirY DirZ
// -segment Length
//
// Warning! flyout is not an aspect value, it is for dimension parameter
// likewise text position, but text position override other paramaters.
@@ -197,8 +191,6 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
Standard_Boolean& theIsCustomPlane, gp_Pln& thePlane,
NCollection_DataMap<TCollection_AsciiString, Standard_Real>& theRealParams,
NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>& theStringParams,
NCollection_DataMap<TCollection_AsciiString, Standard_Boolean>& theBooleanParams,
Standard_Boolean& theIsTextAligned, gp_Dir& theTextDir,
NCollection_List<Handle(AIS_InteractiveObject)>* theShapeList = NULL)
{
theRealParams.Clear();
@@ -217,7 +209,7 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
continue;
}
// BOOLEAN flags
// Boolean flags
if (aParam.IsEqual ("-showunits"))
{
theAspect->MakeUnitsDisplayed (Standard_True);
@@ -229,25 +221,14 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
continue;
}
if (aParam.IsEqual ("-drawdimline"))
{
theBooleanParams.Bind ("drawdimline", Standard_True);
continue;
}
else if (aParam.IsEqual ("-hidedimline"))
{
theBooleanParams.Bind ("drawdimline", Standard_False);
continue;
}
// Before all NON-BOOLEAN flags parsing check if a flag have at least one value.
// Before all non-boolean flags parsing check if a flag have at least one value.
if (anIt + 1 >= theArgNum)
{
std::cerr << "Error: "<< aParam <<" flag should have value.\n";
return 1;
}
// NON-BOOLEAN flags
// Non-boolean flags
if (aParam.IsEqual ("-shape")
|| aParam.IsEqual ("-shapes"))
{
@@ -335,15 +316,13 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
TCollection_AsciiString aParamValue (theArgVec[anIt]);
aParamValue.LowerCase();
if (aParamValue == "left") { theAspect->SetTextHorizontalPosition (Prs3d_DTHP_Left); }
else if (aParamValue == "right") { theAspect->SetTextHorizontalPosition (Prs3d_DTHP_Right); }
else if (aParamValue == "hcenter") { theAspect->SetTextHorizontalPosition (Prs3d_DTHP_Center); }
else if (aParamValue == "hfit") { theAspect->SetTextHorizontalPosition (Prs3d_DTHP_Fit); }
else if (aParamValue == "above") { theAspect->SetTextVerticalPosition (Prs3d_DTVP_Above); }
else if (aParamValue == "below") { theAspect->SetTextVerticalPosition (Prs3d_DTVP_Below); }
else if (aParamValue == "vcenter") { theAspect->SetTextVerticalPosition (Prs3d_DTVP_Center); }
else if (aParamValue == "firstline") { theAspect->SetTextVerticalPosition (Prs3d_DTVP_FirstLine); }
else if (aParamValue == "lastline") { theAspect->SetTextVerticalPosition (Prs3d_DTVP_LastLine); }
if (aParamValue == "left") { theAspect->SetTextHorizontalPosition (Prs3d_DTHP_Left); }
else if (aParamValue == "right") { theAspect->SetTextHorizontalPosition (Prs3d_DTHP_Right); }
else if (aParamValue == "hcenter") { theAspect->SetTextHorizontalPosition (Prs3d_DTHP_Center);}
else if (aParamValue == "hfit") { theAspect->SetTextHorizontalPosition (Prs3d_DTHP_Fit); }
else if (aParamValue == "above") { theAspect->SetTextVerticalPosition (Prs3d_DTVP_Above); }
else if (aParamValue == "below") { theAspect->SetTextVerticalPosition (Prs3d_DTVP_Below); }
else if (aParamValue == "vcenter") { theAspect->SetTextVerticalPosition (Prs3d_DTVP_Center);}
else
{
std::cerr << "Error: invalid label position: '" << aParamValue << "'.\n";
@@ -366,7 +345,7 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
TCollection_AsciiString aValue (theArgVec[++anIt]);
if (!aValue.IsRealValue())
{
std::cerr << "Error: arrow length should be float degree value.\n";
std::cerr << "Error: arrow lenght should be float degree value.\n";
return 1;
}
theAspect->ArrowAspect()->SetLength (Draw::Atof (aValue.ToCString()));
@@ -420,20 +399,6 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
return 1;
}
}
else if (aParam.IsEqual ("-aligntext"))
{
theIsTextAligned = Standard_True;
TCollection_AsciiString aParam1 (theArgVec[++anIt]);
TCollection_AsciiString aParam2 (theArgVec[++anIt]);
TCollection_AsciiString aParam3 (theArgVec[++anIt]);
if (!aParam1.IsRealValue() || !aParam2.IsRealValue() || !aParam3.IsRealValue())
{
std::cerr << "Error: direction coordinate should be real value.\n";
return 1;
}
theTextDir.SetCoord (aParam1.RealValue(), aParam2.RealValue(), aParam3.RealValue());
}
// REAL parameters
else if (aParam.IsEqual ("-flyout"))
{
TCollection_AsciiString aParam (theArgVec[++anIt]);
@@ -448,43 +413,13 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
else if (aParam.IsEqual ("-value"))
{
TCollection_AsciiString aParam (theArgVec[++anIt]);
// Custom real value
if (!aParam.IsRealValue())
{
std::cerr << "Error: custom value should be real value.\n";
std::cerr << "Error: dimension value for dimension should be real value.\n";
return 1;
}
theRealParams.Bind ("value", Draw::Atof (aParam.ToCString()));
}
else if (aParam.IsEqual ("-circleparam"))
{
TCollection_AsciiString aParam (theArgVec[++anIt]);
if (!aParam.IsRealValue())
{
std::cerr << "Error: circle parameter should be real value.\n";
return 1;
}
theRealParams.Bind ("circleparam", aParam.RealValue());
}
else if (aParam.IsEqual ("-segment"))
{
TCollection_AsciiString aParam (theArgVec[++anIt]);
if (!aParam.IsRealValue() || aParam.RealValue() < 0.0)
{
std::cerr << "Error: segment length should be positive real value.\n";
return 1;
}
theRealParams.Bind ("segment", aParam.RealValue());
}
// STRING parameters
else if (aParam.IsEqual ("-valuetext"))
{
TCollection_AsciiString aParam (theArgVec[++anIt]);
theStringParams.Bind ("valuetext", aParam);
}
else if (aParam.IsEqual ("-modelunits"))
{
@@ -514,8 +449,7 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
//=======================================================================
static void SetDimensionParams (const Handle(AIS_Dimension)& theDim,
const NCollection_DataMap<TCollection_AsciiString, Standard_Real>& theRealParams,
const NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>& theStringParams,
const NCollection_DataMap<TCollection_AsciiString, Standard_Boolean>& theBooleanParams)
const NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>& theStringParams)
{
if (theRealParams.IsBound ("flyout"))
{
@@ -526,10 +460,6 @@ static void SetDimensionParams (const Handle(AIS_Dimension)& theDim,
{
theDim->SetCustomValue (theRealParams.Find ("value"));
}
else if (theStringParams.IsBound ("valuetext"))
{
theDim->SetTextLabel (theStringParams.Find ("valuetext"));
}
if (theStringParams.IsBound ("modelunits"))
{
@@ -540,16 +470,6 @@ static void SetDimensionParams (const Handle(AIS_Dimension)& theDim,
{
theDim->SetDisplayUnits (theStringParams.Find ("dispunits"));
}
if (theBooleanParams.IsBound ("drawdimline"))
{
theDim->SetToDrawDimensionLine (theBooleanParams.Find ("drawdimline"));
}
if (theRealParams.IsBound ("segment"))
{
theDim->SetLeaderSegment (theRealParams.Find ("segment"));
}
}
//=======================================================================
@@ -574,12 +494,9 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect;
Standard_Boolean isPlaneCustom = Standard_False;
gp_Pln aWorkingPlane;
Standard_Boolean isTextAligned = Standard_False;
gp_Dir aTextDir (1.0, 0.0, 0.0);
NCollection_DataMap<TCollection_AsciiString, Standard_Real> aRealParams;
NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString> aStringParams;
NCollection_DataMap<TCollection_AsciiString, Standard_Boolean> aBoolParams;
TCollection_AsciiString aDimType(theArgs[2]);
aDimType.LowerCase();
@@ -609,7 +526,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
if (ParseDimensionParams (theArgsNb, theArgs, 3,
anAspect,isPlaneCustom,aWorkingPlane,
aRealParams, aStringParams, aBoolParams, isTextAligned, aTextDir, &aShapes))
aRealParams, aStringParams, &aShapes))
{
return 1;
}
@@ -750,15 +667,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
{
Handle(AIS_Circle) aShape = Handle(AIS_Circle)::DownCast (aShapes.First());
gp_Circ aCircle = aShape->Circle()->Circ();
Standard_Real aParam = 0;
// Check if circle parameter is set
if (aRealParams.IsBound ("circleparam"))
{
aParam = aRealParams.Find ("circleparam");
}
aDim = new AIS_RadiusDimension (aCircle, aParam);
aDim = new AIS_RadiusDimension (aCircle);
}
else
{
@@ -787,16 +696,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
{
Handle(AIS_Circle) aShape = Handle(AIS_Circle)::DownCast (aShapes.First());
gp_Circ aCircle = aShape->Circle()->Circ();
Standard_Real aParam = 0;
// Check if circle parameter is set
if (aRealParams.IsBound ("circleparam"))
{
aParam = aRealParams.Find ("circleparam");
}
aDim = new AIS_DiameterDimension (aCircle, aParam);
aDim = new AIS_DiameterDimension (aCircle);
}
else
{
@@ -824,11 +724,6 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
}
}
if (isTextAligned)
{
aDim->SetToAlignText (isTextAligned, aTextDir);
}
// Check dimension geometry
if (!aDim->IsValid())
{
@@ -839,7 +734,7 @@ static int VDimBuilder (Draw_Interpretor& /*theDi*/,
aDim->SetDimensionAspect (anAspect);
SetDimensionParams (aDim, aRealParams, aStringParams, aBoolParams);
SetDimensionParams (aDim, aRealParams, aStringParams);
VDisplayAISObject (aName,aDim);
@@ -2651,13 +2546,10 @@ static int VDimParam (Draw_Interpretor& theDi, Standard_Integer theArgNum, const
TCollection_AsciiString aName (theArgVec[1]);
gp_Pln aWorkingPlane;
Standard_Boolean isCustomPlane = Standard_False;
Standard_Boolean isTextAligned = Standard_False;
gp_Dir aTextDir (1.0, 0.0, 0.0);
Standard_Boolean toUpdate = Standard_True;
NCollection_DataMap<TCollection_AsciiString, Standard_Real> aRealParams;
NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString> aStringParams;
NCollection_DataMap<TCollection_AsciiString, Standard_Boolean> aBoolParams;
if (!GetMapOfAIS().IsBound2 (aName))
{
@@ -2668,7 +2560,7 @@ static int VDimParam (Draw_Interpretor& theDi, Standard_Integer theArgNum, const
Handle(AIS_InteractiveObject) anObject = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2 (aName));
if (anObject->Type() != AIS_KOI_Dimension)
{
theDi << theArgVec[0] << "error: no dimension with the name: " << aName.ToCString() << ".\n";
theDi << theArgVec[0] << "error: no dimension with this name.\n";
return 1;
}
@@ -2677,7 +2569,7 @@ static int VDimParam (Draw_Interpretor& theDi, Standard_Integer theArgNum, const
if (ParseDimensionParams (theArgNum, theArgVec, 2, anAspect,
isCustomPlane, aWorkingPlane,
aRealParams, aStringParams, aBoolParams, isTextAligned, aTextDir))
aRealParams, aStringParams))
{
return 1;
}
@@ -2687,12 +2579,7 @@ static int VDimParam (Draw_Interpretor& theDi, Standard_Integer theArgNum, const
aDim->SetCustomPlane (aWorkingPlane);
}
if (isTextAligned)
{
aDim->SetToAlignText (isTextAligned, aTextDir);
}
SetDimensionParams (aDim, aRealParams, aStringParams, aBoolParams);
SetDimensionParams (aDim, aRealParams, aStringParams);
if (!aDim->IsValid())
{
@@ -2887,20 +2774,16 @@ void ViewerTest::RelationCommands(Draw_Interpretor& theCommands)
"vdimension name {-angle|-length|-radius|-diameter} -shapes shape1 [shape2 [shape3]]\n"
"[-text 3d|2d wf|sh|wireframe|shading IntegerSize]\n"
"[-font FontName]\n"
"[-label left|right|hcenter|hfit above|below|vcenter|vfit]\n"
"[-label left|right|hcenter|hfit top|bottom|vcenter|vfit]\n"
"[-arrow external|internal|fit]\n"
"[{-arrowlength|-arlen} RealArrowLength]\n"
"[{-arrowangle|-arangle} ArrowAngle(degrees)]\n"
"[-plane xoy|yoz|zox]\n"
"[-flyout FloatValue -extension FloatValue]\n"
"[-value CustomNumberValue] OR [-valuetext CustomMultilineLabel]\n"
"[-value CustomNumberValue]\n"
"[-dispunits DisplayUnitsString]\n"
"[-modelunits ModelUnitsString]\n"
"[-showunits | -hideunits]\n"
"[-drawdimline] <- dimension line is displayed by default\n"
"[-hidedimline]/n"
"[-aligntext DirX DirY DirZ]\n"
"[-segment Length\n"
" -Builds angle, length, radius and diameter dimensions.\n"
" -See also: vdimparam, vmovedim.\n",
__FILE__,VDimBuilder,group);
@@ -2919,11 +2802,6 @@ void ViewerTest::RelationCommands(Draw_Interpretor& theCommands)
"[-dispunits DisplayUnitsString]\n"
"[-modelunits ModelUnitsString]\n"
"[-showunits | -hideunits]\n"
"[-drawdimline] <- dimension line is displayed by default\n"
"[-hidedimline]/n"
"[-aligntext DirX DirY DirZ]\n"
"[-segment Length\n"
" -Builds angle, length, radius and diameter dimensions.\n"
" -Sets parameters for angle, length, radius and diameter dimensions.\n"
" -See also: vmovedim, vdimension.\n",
__FILE__,VDimParam,group);

View File

@@ -0,0 +1,24 @@
puts "========"
puts "OCC26587"
puts "========"
puts ""
#######################################################
# Infinite calculations of BRepOffset_MakeOffset
#######################################################
smallview
restore [locate_data_file bug26587_plate.brep] plate
offsetparameter 1e-7 p i
offsetload plate 50
decho off
offsetperform r
decho on
fit
set only_screen_axo 1

View File

@@ -1,28 +0,0 @@
puts "================================================================"
puts "CR26507"
puts "Visualization - Improved presentations of dimensions"
puts "================================================================"
puts ""
puts "Radius dimension line not continued to the center of a circle"
#set anImage1 $imagedir/${casename}_1.png
vinit Viewer1/View
vright
vpoint aCircleP1 0 0 60
vpoint aCircleP2 60 0 0
vpoint aCircleP3 120 0 60
vcircle aCircle aCircleP1 aCircleP2 aCircleP3 0
#Check all text and arrow positions
vdimension aDim1 -radius -shapes aCircle -text 3d -plane zox -label hfit -arrow external -hidedimline
vdimension aDim2 -radius -shapes aCircle -circleparam 20 -text 3d -plane zox -label right -arrow external -hidedimline
vdimension aDim3 -radius -shapes aCircle -circleparam 40 -text 3d -plane zox -label hfit -arrow internal -hidedimline
vdimension aDim4 -radius -shapes aCircle -circleparam 60 -text 2d -flyout -30 -plane zox -label right -arrow external -hidedimline
vdimparam aDim4 -text 20
vfit
#finalize and dump
set only_screen 1

View File

@@ -1,34 +0,0 @@
puts "================================================================"
puts "CR26507"
puts "Visualization - Improved presentations of dimensions"
puts "================================================================"
puts ""
puts "User-defined orientation of text label"
puts "Line segment aligned with text"
#set anImage1 $imagedir/${casename}_1.png
vinit Viewer1/View
vbottom
vpoint lengthP1 0 0 0
vpoint lengthP2 50 100 0
vpoint lengthP3 -50 100 0
vpoint lengthP4 0 200 0
# Text in center - custom aligment does not taken into account
vdimension dim1 -length -plane xoy -shapes lengthP1 lengthP2 -text 3d -aligntext 1.0 0.0 0.0 -flyout -10
# Text on the right side - it is aligned
vdimension dim2 -length -plane xoy -shapes lengthP1 lengthP3 -text 3d -aligntext 1.0 0.0 0.0 -segment 0 -label right
# Text on the left side - it is aligned
vdimension dim3 -length -plane xoy -shapes lengthP2 lengthP3 -text 3d -flyout -10 -aligntext 1.0 0.0 0.0 -segment 5 -label left
# Text on the left side - it is aligned
vdimension dim4 -length -plane xoy -shapes lengthP2 lengthP4 -text 3d -flyout -10 -aligntext 1.0 0.0 0.0 -segment 25 -label right
# Text on the left side - it is aligned
vdimension dim5 -length -plane xoy -shapes lengthP4 lengthP3 -text 3d -flyout -10 -aligntext 1.0 0.0 0.0 -label left above -segment 10
vfit
#finalize and dump
set only_screen 1

View File

@@ -1,28 +0,0 @@
puts "================================================================"
puts "CR26507"
puts "Visualization - Improved presentations of dimensions"
puts "================================================================"
puts ""
puts "Multi-line custom text label"
#set anImage1 $imagedir/${casename}_1.png
vinit Viewer1/View
vbottom
vpoint lengthP1 0 0 0
vpoint lengthP2 50 100 0
vpoint lengthP3 -50 100 0
# Text in center - custom aligment does not taken into account
vdimension dim1 -length -plane xoy -shapes lengthP1 lengthP2 -valuetext "+2.0\n-3.0\nThickness" -text 2d -aligntext 1.0 0.0 0.0 -segment 15 -flyout -10 -label left firstline
# Text on the right side - it is aligned
vdimension dim2 -length -plane xoy -shapes lengthP1 lengthP3 -valuetext "+3.0\n-15.0\nThickness" -text 2d -aligntext 1.0 0.0 0.0 -segment 15 -label right
# Text on the left side - it is aligned
vdimension dim3 -length -plane xoy -shapes lengthP2 lengthP3 -text 2d -valuetext "+3.0\n-15.0" -flyout -10 -aligntext 1.0 0.0 0.0 -segment 10
vfit
#finalize and dump
set only_screen 1

View File

@@ -1,32 +0,0 @@
puts "================================================================"
puts "CR26507"
puts "Visualization - Improved presentations of dimensions"
puts "================================================================"
puts ""
puts "Radius dimension with multiline custom text"
#set anImage1 $imagedir/${casename}_1.png
vinit Viewer1/View
vright
vpoint aCircleP1 0 0 60
vpoint aCircleP2 60 0 0
vpoint aCircleP3 120 0 60
vcircle aCircle aCircleP1 aCircleP2 aCircleP3 0
#Check all text and arrow positions
vdimension aDim1 -radius -shapes aCircle -circleparam 10 -text 3d -label right -arrow external -hidedimline -valuetext "+2.0\n -3.0\nThickness" -aligntext 1.0 0.0 0.0 -segment 15 -label left firstline
vdimension aDim2 -diameter -shapes aCircle -circleparam 5 -text 3d -label left -arrow external -hidedimline -valuetext "+4.0\n -6.0" -aligntext 1.0 0.0 0.0 -segment 15 -label left firstline
vdimension aDim3 -radius -shapes aCircle -circleparam 20 -text 3d -plane zox -label right -arrow external -hidedimline
vdimension aDim4 -radius -shapes aCircle -circleparam 30 -text 3d -plane zox -label vcenter -arrow internal -hidedimline
vdimension aDim5 -radius -shapes aCircle -circleparam 40 -text 2d -label right -arrow external -hidedimline -valuetext "+2.0\n -3.0\nThickness" -aligntext 1.0 0.0 0.0 -segment 15 -label left firstline
vdimparam aDim1 -text 6
vdimparam aDim3 -text 6
vfit
#finalize and dump
set only_screen 1

View File

@@ -1,34 +0,0 @@
puts "================================================================"
puts "CR26507"
puts "Visualization - Improved presentations of dimensions"
puts "================================================================"
puts ""
puts "User-defined orientation of text label"
puts "Line segment aligned with text"
#set anImage1 $imagedir/${casename}_1.png
vinit Viewer1/View
vbottom
vpoint lengthP1 0 0 0
vpoint lengthP2 100 0 0
vpoint lengthP3 100 100 0
vpoint lengthP4 0 100 0
# Text in center - custom aligment does not taken into account
#vdimension dim1 -length -plane xoy -shapes lengthP1 lengthP2 -text 3d -aligntext 1.0 0.0 0.0 -flyout -10
# Text on the right side - it is aligned
vdimension dim2 -length -plane xoy -shapes lengthP1 lengthP3 -text 3d -aligntext 1.0 0.0 0.0 -segment 0 -label right
# Text on the left side - it is aligned
vdimension dim3 -length -plane xoy -shapes lengthP2 lengthP3 -text 3d -flyout -10 -aligntext 1.0 0.0 0.0 -segment 5 -label left
# Text on the left side - it is aligned
vdimension dim4 -length -plane xoy -shapes lengthP4 lengthP1 -text 3d -valuetext "0.6\n1.58\nTHICKNESS" -flyout -10 -aligntext 1.0 0.0 0.0 -segment 10 -label right vcenter
# Text on the left side - it is aligned
vdimension dim5 -length -plane xoy -shapes lengthP4 lengthP3 -text 3d -flyout -10 -aligntext 1.0 0.0 0.0 -label left above -segment 10
vfit
#finalize and dump
set only_screen 1

View File

@@ -1,27 +0,0 @@
puts "================================================================"
puts "CR26507"
puts "Visualization - Improved presentations of dimensions"
puts "================================================================"
puts ""
puts "Radius dimension vertical alignment with multiline custom text"
#set anImage1 $imagedir/${casename}_1.png
vinit Viewer1/View
vright
vpoint aCircleP1 0 0 100
vpoint aCircleP2 100 0 0
vpoint aCircleP3 200 0 100
vcircle aCircle aCircleP1 aCircleP2 aCircleP3 0
#Check all text and arrow positions
vdimension aDim1 -radius -shapes aCircle -circleparam 10 -text 3d -label right -arrow external -hidedimline -valuetext "+2.0\n -3.0\nThickness" -aligntext 1.0 0.0 0.0 -segment 15 -label left firstline
vdimension aDim2 -radius -shapes aCircle -circleparam 20 -text 3d -label right -arrow external -hidedimline -valuetext "Thickness\n+3.0\n -4.0" -aligntext 1.0 0.0 0.0 -segment 15 -label left lastline
vdimension aDim3 -radius -shapes aCircle -circleparam 30 -text 3d -label right -arrow external -hidedimline -valuetext "+4.0\n -5.0\nThickness" -aligntext 1.0 0.0 0.0 -flyout -70 -segment 15 -label left vcenter
vdimension aDim4 -radius -shapes aCircle -circleparam 15 -text 3d -label right -arrow external -hidedimline -valuetext "+0.5\n -0.5" -aligntext 1.0 0.0 0.0 -segment 15 -label left lastline
vfit
#finalize and dump
set only_screen 1