0024893: CLang warnings -Wlogical-not-parentheses for gce_Done comparisons
[occt.git] / src / GC / GC_MakeSegment.cxx
CommitLineData
b311480e 1// Created on: 1992-10-02
2// Created by: Remi GILET
3// Copyright (c) 1992-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
17#include <GC_MakeSegment.ixx>
18#include <GC_MakeLine.hxx>
19#include <Geom_Line.hxx>
20#include <StdFail_NotDone.hxx>
21#include <ElCLib.hxx>
22
23GC_MakeSegment::GC_MakeSegment(const gp_Pnt& P1 ,
24 const gp_Pnt& P2 )
25{
26 Standard_Real dist = P1.Distance(P2);
27 Handle(Geom_Line) L = GC_MakeLine(P1,P2);
28 TheSegment = new Geom_TrimmedCurve(L,0.,dist,Standard_True);
29 TheError = gce_Done;
30}
31
32GC_MakeSegment::GC_MakeSegment(const gp_Lin& Line ,
33 const gp_Pnt& Point ,
34 const Standard_Real U )
35{
36 Standard_Real Ufirst = ElCLib::Parameter(Line,Point);
37 Handle(Geom_Line) L = new Geom_Line(Line);
38 TheSegment=new Geom_TrimmedCurve(L,Ufirst,U,Standard_True);
39 TheError = gce_Done;
40}
41
42GC_MakeSegment::GC_MakeSegment(const gp_Lin& Line ,
43 const gp_Pnt& P1 ,
44 const gp_Pnt& P2 )
45{
46 Standard_Real Ufirst = ElCLib::Parameter(Line,P1);
47 Standard_Real Ulast = ElCLib::Parameter(Line,P2);
48 Handle(Geom_Line) L = new Geom_Line(Line);
49 TheSegment = new Geom_TrimmedCurve(L,Ufirst,Ulast,Standard_True);
50 TheError = gce_Done;
51}
52
53GC_MakeSegment::GC_MakeSegment(const gp_Lin& Line ,
54 const Standard_Real U1 ,
55 const Standard_Real U2 )
56{
57 Handle(Geom_Line) L = new Geom_Line(Line);
58 TheSegment = new Geom_TrimmedCurve(L,U1,U2,Standard_True);
59 TheError = gce_Done;
60}
61
62const Handle(Geom_TrimmedCurve)& GC_MakeSegment::Value() const
63{
82fc327c 64 StdFail_NotDone_Raise_if(TheError != gce_Done,"");
7fd59977 65 return TheSegment;
66}
67
68const Handle(Geom_TrimmedCurve)& GC_MakeSegment::Operator() const
69{
70 return Value();
71}
72
73GC_MakeSegment::operator Handle(Geom_TrimmedCurve) () const
74{
75 return Value();
76}
77