//=======================================================================
Standard_Integer AIS_ColorScale::TextWidth (const TCollection_ExtendedString& theText) const
{
- Standard_Integer aWidth, anAscent, aDescent;
+ Standard_Integer aWidth = 0, anAscent = 0, aDescent = 0;
TextSize (theText, myTextHeight, aWidth, anAscent, aDescent);
return aWidth;
}
//=======================================================================
Standard_Integer AIS_ColorScale::TextHeight (const TCollection_ExtendedString& theText) const
{
- Standard_Integer aWidth, anAscent, aDescent;
+ Standard_Integer aWidth = 0, anAscent = 0, aDescent = 0;
TextSize (theText, myTextHeight, aWidth, anAscent, aDescent);
return anAscent + aDescent;
}
Standard_Integer& theAscent,
Standard_Integer& theDescent) const
{
- if (!HasInteractiveContext())
+ Standard_ShortReal aWidth = 10.0f, anAscent = 1.0f, aDescent = 1.0f;
+ if (HasInteractiveContext())
{
- return;
+ const TCollection_AsciiString aText (theText);
+ const Handle(V3d_Viewer)& aViewer = GetContext()->CurrentViewer();
+ const Handle(Graphic3d_CView)& aView = aViewer->ActiveViewIterator().Value()->View();
+ aViewer->Driver()->TextSize (aView, aText.ToCString(), (Standard_ShortReal)theHeight, aWidth, anAscent, aDescent);
}
-
- Standard_ShortReal aWidth = 10.0f;
- Standard_ShortReal anAscent = 1.0f;
- Standard_ShortReal aDescent = 1.0f;
- const TCollection_AsciiString aText (theText);
-
- const Handle(V3d_Viewer)& aViewer = GetContext()->CurrentViewer();
- const Handle(Graphic3d_CView)& aView = aViewer->ActiveViewIterator().Value()->View();
- aViewer->Driver()->TextSize (aView, aText.ToCString(), (Standard_ShortReal)theHeight, aWidth, anAscent, aDescent);
theWidth = (Standard_Integer)aWidth;
theAscent = (Standard_Integer)anAscent;
theDescent = (Standard_Integer)aDescent;
Font_Rect& theBndBox) const
{
if (theIndex < 0 || theIndex >= Corners().Size())
+ {
return Standard_False;
+ }
const NCollection_Vec2<Standard_ShortReal>& aLeftCorner = BottomLeft (theIndex);
- if (theIndex + 1 < myCorners.Length()) // not the last symbol
+ theBndBox.Left = aLeftCorner.x();
+ theBndBox.Right = aLeftCorner.x() + myLastSymbolWidth;
+ theBndBox.Bottom = aLeftCorner.y();
+ theBndBox.Top = theBndBox.Bottom + myLineSpacing;
+ if (theIndex + 1 >= myCorners.Length())
{
- const NCollection_Vec2<Standard_ShortReal>& aNextLeftCorner = BottomLeft (theIndex + 1);
- theBndBox.Left = aLeftCorner.x();
- theBndBox.Bottom = aLeftCorner.y();
- theBndBox.Top = theBndBox.Bottom + myLineSpacing;
- if (Abs (aLeftCorner.y() - aNextLeftCorner.y()) < Precision::Confusion()) // in the same row
- {
- theBndBox.Right = aNextLeftCorner.x();
- }
- else
- {
- // the next symbol is on the next row either by '\n' or by wrapping
- Standard_ShortReal aLineWidth = LineWidth (LineIndex (theIndex));
- theBndBox.Left = aLeftCorner.x();
- switch (myAlignX)
- {
- case Graphic3d_HTA_LEFT: theBndBox.Right = aLineWidth; break;
- case Graphic3d_HTA_RIGHT: theBndBox.Right = myBndWidth; break;
- case Graphic3d_HTA_CENTER: theBndBox.Right = 0.5f * (myBndWidth + aLineWidth); break;
- }
- }
+ // the last symbol
+ return Standard_True;
+ }
+
+ const NCollection_Vec2<Standard_ShortReal>& aNextLeftCorner = BottomLeft (theIndex + 1);
+ if (Abs (aLeftCorner.y() - aNextLeftCorner.y()) < Precision::Confusion()) // in the same row
+ {
+ theBndBox.Right = aNextLeftCorner.x();
}
- else // the last symbol
+ else
{
+ // the next symbol is on the next row either by '\n' or by wrapping
+ Standard_ShortReal aLineWidth = LineWidth (LineIndex (theIndex));
theBndBox.Left = aLeftCorner.x();
- theBndBox.Right = aLeftCorner.x() + myLastSymbolWidth;
- theBndBox.Bottom = aLeftCorner.y();
- theBndBox.Top = theBndBox.Bottom + myLineSpacing;
+ switch (myAlignX)
+ {
+ case Graphic3d_HTA_LEFT: theBndBox.Right = aLineWidth; break;
+ case Graphic3d_HTA_RIGHT: theBndBox.Right = myBndWidth; break;
+ case Graphic3d_HTA_CENTER: theBndBox.Right = 0.5f * (myBndWidth + aLineWidth); break;
+ }
}
return Standard_True;
}
{
Font_Rect aBndBox;
if (!GlyphBoundingBox (theIndex, aBndBox))
+ {
return Standard_False;
+ }
return Abs (aBndBox.Right - aBndBox.Left) < Precision::Confusion();
}
Standard_Integer Font_TextFormatter::LineIndex (const Standard_Integer theIndex) const
{
if (myLineSpacing < 0.0f)
+ {
return 0;
+ }
return (Standard_Integer)Abs((BottomLeft (theIndex).y() + myAscender) / myLineSpacing);
}
Standard_ShortReal Font_TextFormatter::LineWidth (const Standard_Integer theIndex) const
{
if (theIndex < 0)
+ {
return 0;
+ }
if (theIndex < myNewLines.Length())
+ {
return theIndex == 0 ? myNewLines[0] : myNewLines[theIndex] - myNewLines[theIndex -1];
+ }
if (theIndex == myNewLines.Length()) // the last line
+ {
return theIndex == 0 ? myPen.x() : myPen.x() - myNewLines[theIndex -1];
+ }
return 0;
}
#include <Message.hxx>
#include <Standard_Mutex.hxx>
+#include <Standard_WarningDisableFunctionCast.hxx>
+
#if defined(__APPLE__)
#import <TargetConditionals.h>
#endif
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <TopOpeBRep_LineInter.hxx>
#include <Adaptor2d_Curve2d.hxx>
#include <BRepAdaptor_Curve2d.hxx>
#include <TopOpeBRep.hxx>
#include <TopOpeBRep_Bipoint.hxx>
#include <TopOpeBRep_FFTransitionTool.hxx>
-#include <TopOpeBRep_LineInter.hxx>
#include <TopOpeBRep_VPointInter.hxx>
#include <TopOpeBRep_VPointInterIterator.hxx>
#include <TopOpeBRep_WPointInter.hxx>
//=======================================================================
//function : Period
-//purpose :
+//purpose :
//=======================================================================
-
Standard_Real TopOpeBRep_LineInter::Period() const
{
- Standard_Real f,l;
- Bounds(f,l);
- return (l - f);
+ Standard_Real aFirst = 0.0, aLast = 0.0;
+ Bounds (aFirst, aLast);
+ return (aLast - aFirst);
}
//=======================================================================
//function : Bounds
-//purpose :
+//purpose :
//=======================================================================
-
-void TopOpeBRep_LineInter::Bounds(Standard_Real& First,Standard_Real& Last) const
+void TopOpeBRep_LineInter::Bounds (Standard_Real& theFirst, Standard_Real& theLast) const
{
- if ( myILG.IsNull() ) {
- TopOpeBRep_LineInter* p = (TopOpeBRep_LineInter*)this; // NYI deconst
- p->SetOK(Standard_False);
+ theFirst = 0.0; theLast = 0.0;
+ if (myILG.IsNull())
+ {
+ TopOpeBRep_LineInter* aPtr = const_cast<TopOpeBRep_LineInter*>(this); // NYI deconst
+ aPtr->SetOK (Standard_False);
return;
}
-
- First = 0.; Last = 0.;
- if ( IsPeriodic() )
- Last = Curve()->Period();
-
- if ( myILG->HasFirstPoint() )
- First = myILG->FirstPoint().ParameterOnLine();
- if ( myILG->HasLastPoint() )
- Last = myILG->LastPoint().ParameterOnLine();
+ if (IsPeriodic())
+ {
+ theLast = Curve()->Period();
+ }
+
+ if (myILG->HasFirstPoint())
+ {
+ theFirst = myILG->FirstPoint().ParameterOnLine();
+ }
+
+ if (myILG->HasLastPoint())
+ {
+ theLast = myILG->LastPoint().ParameterOnLine();
+ }
}
//=======================================================================
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <TopOpeBRepDS_BuildTool.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
-#include <TopOpeBRepDS_BuildTool.hxx>
#include <TopOpeBRepDS_Curve.hxx>
#include <TopOpeBRepDS_DataStructure.hxx>
#include <TopOpeBRepDS_Dumper.hxx>
// newtol *= 1.5;
- TopoDS_Vertex Vmin,Vmax; Standard_Real parmin,parmax;
- GetOrientedEdgeVertices(E,Vmin,Vmax,parmin,parmax);
-
+ TopoDS_Vertex Vmin, Vmax;
+ Standard_Real parmin = 0.0, parmax = 0.0;
+ GetOrientedEdgeVertices (E, Vmin, Vmax, parmin, parmax);
+
Standard_Real tolmin=BRep_Tool::Tolerance(Vmin);
if(newtol>tolmin) tolmin=newtol;
Standard_Real tolmax=BRep_Tool::Tolerance(Vmax);
// Vmin,Vmax = bounding vertices of edge <E>
// and their parameters parmin,parmax .
- TopoDS_Vertex Vmin,Vmax;Standard_Real parmin,parmax;
- GetOrientedEdgeVertices(E,Vmin,Vmax,parmin,parmax);
+ TopoDS_Vertex Vmin, Vmax;
+ Standard_Real parmin = 0.0, parmax = 0.0;
+ GetOrientedEdgeVertices (E, Vmin, Vmax, parmin, parmax);
Handle(Geom_Curve) C3Dnew;
Handle(Geom2d_Curve) PC1new;
Handle(Geom2d_Curve) PC2new;
- Standard_Real tolreached3d,tolreached2d;
-
+ Standard_Real tolreached3d = 0.0, tolreached2d = 0.0;
Standard_Boolean approxMade = myCurveTool.MakeCurves(parmin,parmax,
C3D,PC1,PC2,F1,F2,
C3Dnew,PC1new,PC2new,
tolreached3d,tolreached2d);
- Standard_Real newtol,newparmin,newparmax;
+ Standard_Real newtol = 0.0, newparmin = 0.0, newparmax = 0.0;
// MSV Nov 12, 2001: if approx failed than leave old curves of degree 1
if (!approxMade) {
newtol = BRep_Tool::Tolerance(E);
// get bounding vertices Vmin,Vmax supported by the new edge <E>
// and their corresponding parameters parmin,parmax .
-
- TopoDS_Vertex Vmin,Vmax;Standard_Real parmin,parmax;
- GetOrientedEdgeVertices(E,Vmin,Vmax,parmin,parmax);
-
- Handle(Geom2d_Curve) PC1new;
- Handle(Geom2d_Curve) PC2new;
-
- if(C3D.IsNull()) {
- Standard_Real tolreached2d1 = Precision::Confusion(), tolreached2d2 = Precision::Confusion(), r1, r2, tol=Precision::Confusion();
+ TopoDS_Vertex Vmin, Vmax;
+ Standard_Real parmin = 0.0, parmax = 0.0;
+ GetOrientedEdgeVertices (E, Vmin, Vmax, parmin, parmax);
+
+ Handle(Geom2d_Curve) PC1new, PC2new;
+ if(C3D.IsNull())
+ {
+ Standard_Real tolreached2d1 = Precision::Confusion(), tolreached2d2 = Precision::Confusion(), tol=Precision::Confusion();
if (comppc1) PC1new = myCurveTool.MakePCurveOnFace(F1,C3D,tolreached2d1);
if (comppc2) PC2new = myCurveTool.MakePCurveOnFace(F2,C3D,tolreached2d2);
- r1 = TopOpeBRepTool_ShapeTool::Resolution3d(F1,tolreached2d1);
- r2 = TopOpeBRepTool_ShapeTool::Resolution3d(F2,tolreached2d2);
+ Standard_Real r1 = TopOpeBRepTool_ShapeTool::Resolution3d(F1,tolreached2d1);
+ Standard_Real r2 = TopOpeBRepTool_ShapeTool::Resolution3d(F2,tolreached2d2);
tol = Max(tol,r1);
tol = Max(tol,r2);
newC.Tolerance(tol);
// Vmin,Vmax = bounding vertices of edge <E>
// and their parameters parmin,parmax .
- TopoDS_Vertex Vmin,Vmax; Standard_Real parmin,parmax;
- ::GetOrientedEdgeVertices(E,Vmin,Vmax,parmin,parmax);
+ TopoDS_Vertex Vmin, Vmax;
+ Standard_Real parmin = 0.0, parmax = 0.0;
+ ::GetOrientedEdgeVertices (E, Vmin, Vmax, parmin, parmax);
-
Handle(Geom_Curve) C3Dnew;
Handle(Geom2d_Curve) PC1new;
Handle(Geom2d_Curve) PC2new;
// get bounding vertices Vmin,Vmax supported by the new edge <E>
// and their corresponding parameters parmin,parmax .
-
- TopoDS_Vertex Vmin,Vmax; Standard_Real parmin,parmax;
- ::GetOrientedEdgeVertices(E,Vmin,Vmax,parmin,parmax);
+ TopoDS_Vertex Vmin, Vmax;
+ Standard_Real parmin = 0.0, parmax = 0.0;
+ ::GetOrientedEdgeVertices (E, Vmin, Vmax, parmin, parmax);
if ( C3D->IsPeriodic() ) {
// ellipse on cone : periodize parmin,parmax
if (!PC1new.IsNull()) C2.Curve1(PC1new);
if (!PC2new.IsNull()) C2.Curve2(PC2new);
}*/ // - merge 04-07-97
-
-