1 // Created on: 1997-04-15
2 // Created by: Joelle CHAUVET
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
22 #include <GeomliteTest.hxx>
23 #include <DrawTrSurf.hxx>
25 #include <Draw_Interpretor.hxx>
26 #include <Draw_Appli.hxx>
27 #include <Draw_Display.hxx>
29 #include <Precision.hxx>
30 #include <GeomLib.hxx>
34 //#define strcasecmp strcmp Already defined
38 //=======================================================================
39 //function : extendcurve
41 //=======================================================================
43 static Standard_Integer extendcurve (Draw_Interpretor& di, Standard_Integer n, const char** a)
47 Handle(Geom_BoundedCurve) GB =
48 Handle(Geom_BoundedCurve)::DownCast(DrawTrSurf::GetCurve(a[1]));
50 di << "extendcurve needs a Bounded curve";
55 if ( !DrawTrSurf::GetPoint(a[2],P)) return 1;
56 Standard_Boolean apres = Standard_True;
58 if (strcmp(a[4], "B") == 0) {
59 apres = Standard_False ;
62 Standard_Integer cont=Draw::Atoi(a[3]);
63 GeomLib::ExtendCurveToPoint(GB,P,cont,apres);
64 DrawTrSurf::Set(a[1],GB);
68 //=======================================================================
69 //function : extendsurf
71 //=======================================================================
73 static Standard_Integer extendsurf (Draw_Interpretor& di, Standard_Integer n, const char** a)
77 Handle(Geom_BoundedSurface) GB =
78 Handle(Geom_BoundedSurface)::DownCast(DrawTrSurf::GetSurface(a[1]));
80 di << "extendsurf needs a Bounded surface";
83 Standard_Real chord=Draw::Atof(a[2]);
84 Standard_Integer cont=Draw::Atoi(a[3]);
85 Standard_Boolean enU = Standard_True, apres = Standard_True;
87 if (strcmp(a[4], "V") == 0) {
88 enU = Standard_False ;
90 if (strcmp(a[4], "B") == 0) {
91 apres = Standard_False ;
95 if (strcmp(a[5], "B") == 0) {
96 apres = Standard_False ;
101 GeomLib::ExtendSurfByLength(GB,chord,cont,enU,apres);
102 DrawTrSurf::Set(a[1],GB);
108 //=======================================================================
109 //function : samerange
111 //=======================================================================
113 static Standard_Integer samerange (Draw_Interpretor& /*di*/, Standard_Integer n, const char** a)
116 Handle(Geom2d_Curve) C = DrawTrSurf::GetCurve2d(a[2]);
117 Handle(Geom2d_Curve) Res;
118 Standard_Real f, l, rf, rl;
119 f = Draw::Atof(a[3]);
120 l = Draw::Atof(a[4]);
121 rf = Draw::Atof(a[5]);
122 rl = Draw::Atof(a[6]);
124 GeomLib::SameRange(Precision::PConfusion(), C,
127 DrawTrSurf::Set(a[1],Res);
133 //=======================================================================
134 //function : ModificationCommands
136 //=======================================================================
139 void GeomliteTest::ModificationCommands(Draw_Interpretor& theCommands)
141 static Standard_Boolean loaded = Standard_False;
143 loaded = Standard_True;
145 DrawTrSurf::BasicCommands(theCommands);
149 g = "GEOMETRY Curves and Surfaces modification";
152 theCommands.Add("extendcurve",
153 "extendcurve name point cont [A(fter)/B(efore)]",
158 theCommands.Add("extendsurf",
159 "extendsurf name length cont [U/V] [A(fter)/B(efore)]",
164 theCommands.Add("chgrange",
165 "chgrange newname curve2d first last RequestedFirst RequestedLast ]",