// Created on: 2002-03-18
// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
+// Copyright (c) 2002-2014 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.
+// This file is part of Open CASCADE Technology software library.
//
-// 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.
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
//
-// 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.
-
-
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
#include <QABugs.hxx>
+#include <Draw.hxx>
#include <Draw_Interpretor.hxx>
#include <DBRep.hxx>
#include <DrawTrSurf.hxx>
#include <gp_Ax2.hxx>
#include <Geom_Circle.hxx>
#include <AIS_Circle.hxx>
-#include <V3d_View.hxx>
#include <TopoDS.hxx>
#include <Geom_Plane.hxx>
#include <gp_Pln.hxx>
#include <AIS_AngleDimension.hxx>
+#include <Aspect_Window.hxx>
+#include <V3d_View.hxx>
+
#include <TopExp_Explorer.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <GC_MakePlane.hxx>
#include <ShapeFix_Wireframe.hxx>
#include <ShapeBuild_ReShape.hxx>
-#include <ViewerTest_Tool.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
//#include <QAModTopOpe_ReShaper.hxx>
return 0;
}
-static Standard_Integer BUC60774(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+//=======================================================================
+//function : BUC60774
+//purpose :
+//=======================================================================
+static Standard_Integer BUC60774 (Draw_Interpretor& theDi,
+ Standard_Integer theArgNb,
+ const char** theArgv)
{
- if(argc!=1)
+ if (theArgNb != 1)
{
- di << "Usage : " << argv[0] << "\n";
+ std::cout << "Usage : " << theArgv[0] << "\n";
return -1;
}
- Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
- if(myAISContext.IsNull())
+ const Handle(AIS_InteractiveContext)& anAISContext = ViewerTest::GetAISContext();
+ if (anAISContext.IsNull())
{
- di << "use 'vinit' command before " << argv[0] << "\n";
+ std::cout << "use 'vinit' command before " << theArgv[0] << "\n";
return -1;
}
- Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
-
- double Xc,Yc,Width, Height;
- myV3dView->Center(Xc,Yc);
- myV3dView-> Size (Width, Height);
-
- double Xmin,Ymin;
- Xmin=Xc-Width/2;
- Ymin=Yc-Height/2;
- double Xmax,Ymax;
- Xmax=Xc+Width/2;
- Ymax=Yc+Height/2;
-
- Standard_Integer XPmin,YPmin;
- myV3dView->Convert(Xmin,Ymin,XPmin,YPmin);
-// cout<<Xmin<<"\t"<<Ymin<<endl;
-// cout<<XPmin<<"\t"<<YPmin<<endl;
-
- Standard_Integer XPmax,YPmax;
- myV3dView->Convert(Xmax,Ymax,XPmax,YPmax);
-// cout<<Xmax<<"\t"<<Ymax<<endl;
-// cout<<XPmax<<"\t"<<YPmax<<endl;
-
- AIS_StatusOfPick status;
- if ((status=myAISContext->Select(XPmin,YPmin,XPmax,YPmax,myV3dView))==AIS_SOP_NothingSelected)
- di << "status = AIS_SOP_NothingSelected : OK" << "\n";
- else di << "status = AIS_SOP_NothingSelected : bugged - Faulty " << "\n";
-
- di.Eval("box b 10 10 10");
- di.Eval(" vdisplay b");
+ const Handle(V3d_View)& aV3dView = ViewerTest::CurrentView();
- if ((status=myAISContext->Select(XPmin,YPmin,XPmax,YPmax,myV3dView))==AIS_SOP_OneSelected)
- di << "status = AIS_SOP_OneSelected : OK" << "\n";
- else di << "status = AIS_SOP_OneSelected : bugged - Faulty " << "\n";
+ Standard_Integer aWinWidth = 0;
+ Standard_Integer aWinHeight = 0;
+ aV3dView->Window()->Size (aWinWidth, aWinHeight);
- di.Eval("box w 20 20 20 20 20 20");
- di.Eval(" vdisplay w");
+ Standard_Integer aXPixMin = 0;
+ Standard_Integer aYPixMin = 0;
+ Standard_Integer aXPixMax = aWinWidth;
+ Standard_Integer aYPixMax = aWinHeight;
- if ((status=myAISContext->Select(XPmin,YPmin,XPmax,YPmax,myV3dView))==AIS_SOP_SeveralSelected)
- di << "status = AIS_SOP_SeveralSelected : OK" << "\n";
- else di << "status = AIS_SOP_SeveralSelected : bugged - Faulty " << "\n";
-
- return 0;
+ AIS_StatusOfPick aPickStatus = anAISContext->Select (aXPixMin, aYPixMin, aXPixMax, aYPixMax, aV3dView);
+ theDi << (aPickStatus == AIS_SOP_NothingSelected
+ ? "status = AIS_SOP_NothingSelected : OK"
+ : "status = AIS_SOP_NothingSelected : bugged - Faulty ");
+ theDi << "\n";
+
+ theDi.Eval ("box b 10 10 10");
+ theDi.Eval (" vdisplay b");
+
+ aPickStatus = anAISContext->Select (aXPixMin, aYPixMin, aXPixMax, aYPixMax, aV3dView);
+ theDi << (aPickStatus == AIS_SOP_OneSelected
+ ? "status = AIS_SOP_OneSelected : OK"
+ : "status = AIS_SOP_OneSelected : bugged - Faulty ");
+ theDi << "\n";
-}
+ theDi.Eval ("box w 20 20 20 20 20 20");
+ theDi.Eval (" vdisplay w");
+
+ aPickStatus = anAISContext->Select (aXPixMin, aYPixMin, aXPixMax, aYPixMax, aV3dView);
+ theDi << (aPickStatus == AIS_SOP_SeveralSelected
+ ? "status = AIS_SOP_SeveralSelected : OK"
+ : "status = AIS_SOP_SeveralSelected : bugged - Faulty ");
+ theDi << "\n";
+
+ return 0;
+}
static Standard_Integer BUC60972 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
TCollection_ExtendedString aText(argv[5]);
//Standard_ExtString ExtString_aText = aText.ToExtString();
- //di << ExtString_aText << " " << atof(argv[4]) << "\n";
- di << argv[5] << " " << atof(argv[4]) << "\n";
+ //di << ExtString_aText << " " << Draw::Atof(argv[4]) << "\n";
+ di << argv[5] << " " << Draw::Atof(argv[4]) << "\n";
- Handle(AIS_AngleDimension) aDim = new AIS_AngleDimension(aFirst, aSecond, aPlane, atof(argv[4]), aText);
+ Handle(AIS_AngleDimension) aDim = new AIS_AngleDimension(aFirst, aSecond);
aContext->Display(aDim);
return 0;
bsplc1->LastParameter() > l1 + Precision::PConfusion()) {
Handle(Geom_BSplineCurve) aBstmp = Handle(Geom_BSplineCurve)::DownCast(bsplc1->Copy());
aBstmp->Segment(f1,l1);
- gp_Pnt p1 = aBstmp->Pole(1);
- gp_Pnt p2 = aBstmp->Pole(aBstmp->NbPoles());
bsplc1 =aBstmp;
}
if(bsplc2->FirstParameter() < f2 - Precision::PConfusion() ||
bsplc2->LastParameter() > l2 + Precision::PConfusion()) {
Handle(Geom_BSplineCurve) aBstmp = Handle(Geom_BSplineCurve)::DownCast(bsplc2->Copy());
aBstmp->Segment(f2,l2);
- gp_Pnt p1 = aBstmp->Pole(1);
- gp_Pnt p2 = aBstmp->Pole(aBstmp->NbPoles());
bsplc2 =aBstmp;
}
gp_Pnt pmid = 0.5 * ( bsplc1->Pole(bsplc1->NbPoles()).XYZ() + bsplc2->Pole(1).XYZ() );
//QAModTopOpe_ModeOfLimitation ModeOfLimitation = QAModTopOpe_Forward;
QANewModTopOpe_ModeOfLimitation ModeOfLimitation = QANewModTopOpe_Forward;
if(argc==5) {
- Standard_Integer ModeOfLimitationInteger = atoi(argv[4]);
+ Standard_Integer ModeOfLimitationInteger = Draw::Atoi(argv[4]);
if(!(ModeOfLimitationInteger == 0 || ModeOfLimitationInteger == 1 || ModeOfLimitationInteger == 2)) {
di << "Usage : " << argv[0] << " result part tool [ModeOfLimitation=0/1/2]" << "\n";
return 1;
Standard_Boolean AllowCutting = Standard_False;
if(argc==5) {
- Standard_Integer AllowCuttingInteger = atoi(argv[4]);
+ Standard_Integer AllowCuttingInteger = Draw::Atoi(argv[4]);
if(!( AllowCuttingInteger == 0 || AllowCuttingInteger == 1)) {
di << "Usage : " << argv[0] << " result part tool [AllowCutting=0/1]" << "\n";
return 1;
Standard_Integer mode = 2;
Standard_Real tolang = M_PI/2;
if(argc > k)
- tol = atof(argv[k++]);
+ tol = Draw::Atof(argv[k++]);
if(argc > k)
- mode= atoi(argv[k++]);
+ mode= Draw::Atoi(argv[k++]);
if(argc > k)
- tolang = atof(argv[k++]);
+ tolang = Draw::Atof(argv[k++]);
Handle(ShapeFix_Wireframe) aSfwr = new ShapeFix_Wireframe();
static Standard_Integer OCC301 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
{
- //Handle(AIS_InteractiveContext) context= ViewerTest_Tool::MakeContext ("OCC301");
- //ViewerTest_Tool::InitViewerTest (context);
Handle(AIS_InteractiveContext) context = ViewerTest::GetAISContext();
if(context.IsNull()) {
di << "use 'vinit' command before " << argv[0] << "\n";
return 1;
}
- if ( argc != 5 ) {
- di << "Usage : " << argv[0] << " X Y Z ArrowSize" << "\n";
+ if ( argc != 3 ) {
+ di << "Usage : " << argv[0] << " ArcRadius ArrowSize" << "\n";
return 1;
}
- Standard_Real X = atof(argv[1]);
- Standard_Real Y = atof(argv[2]);
- Standard_Real Z = atof(argv[3]);
- Standard_Real ArrowSize = atof(argv[4]);
+ Standard_Real aRadius = Draw::Atof(argv[1]);
+ Standard_Real anArrowSize = Draw::Atof(argv[2]);
gp_Pnt p1 = gp_Pnt(10.,10.,0.);
gp_Pnt p2 = gp_Pnt(50.,10.,0.);
gp_Dir plndir(0, 0, 1);
Handle(Geom_Plane) pln = new Geom_Plane(plnpt,plndir);
- Handle(AIS_AngleDimension) AngleDimension = new AIS_AngleDimension(E2, E1, pln, -3.14/2., "Angle");
-
- AngleDimension->SetPosition(gp_Pnt(X, Y, Z));
- AngleDimension->SetArrowSize(ArrowSize);
-
- context->Display(AngleDimension);
+ Handle(AIS_AngleDimension) anAngleDimension = new AIS_AngleDimension (p1.Mirrored (p2), p2, p3);
+
+ Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect;
+ anAspect->MakeArrows3d (Standard_True);
+ anAspect->ArrowAspect()->SetLength (anArrowSize);
+ anAspect->SetTextHorizontalPosition (Prs3d_DTHP_Right);
+ anAspect->TextAspect ()->SetColor (Quantity_NOC_YELLOW);
+ anAngleDimension->SetDimensionAspect (anAspect);
+ // Another position of dimension
+ anAngleDimension->SetFlyout (aRadius);
+ context->Display (anAngleDimension, 0);
return 0;
}
return 1;
}
- Standard_Integer xmin = atoi(argv[1]);
- Standard_Integer ymin = atoi(argv[2]);
- Standard_Integer xmax = atoi(argv[3]);
- Standard_Integer ymax = atoi(argv[4]);
+ Standard_Integer xmin = Draw::Atoi(argv[1]);
+ Standard_Integer ymin = Draw::Atoi(argv[2]);
+ Standard_Integer xmax = Draw::Atoi(argv[3]);
+ Standard_Integer ymax = Draw::Atoi(argv[4]);
Handle(V3d_View) V3dView = ViewerTest::CurrentView();
TColgp_Array1OfPnt2d Polyline(1,np);
j = 1;
for (i = 1; i <= np; i++) {
- Polyline(i) = gp_Pnt2d(atof(argv[j]), atof(argv[j+1]));
+ Polyline(i) = gp_Pnt2d(Draw::Atof(argv[j]), Draw::Atof(argv[j+1]));
j += 2;
}
di << " Shape is null" << "\n";
return 1;
}
- Standard_Boolean nonmanifmode = (atoi(argv[3]) != 0);
+ Standard_Boolean nonmanifmode = (Draw::Atoi(argv[3]) != 0);
Handle(ShapeFix_Shell) SFSh = new ShapeFix_Shell;
SFSh->FixFaceOrientation(TopoDS::Shell(S),Standard_True,nonmanifmode);
DBRep::Set(argv[1],SFSh->Shape());
}
void QABugs::Commands_16(Draw_Interpretor& theCommands) {
- char *group = "QABugs";
+ const char *group = "QABugs";
theCommands.Add ("BUC60848", "BUC60848 shape", __FILE__, BUC60848, group);
theCommands.Add ("BUC60828", "BUC60828", __FILE__, BUC60828, group);
theCommands.Add ("OCC307", "OCC307 result part tool [AllowCutting=0/1]", __FILE__, OCC307, group);
theCommands.Add ("OCC395", "OCC395 edge_result edge1 edge2", __FILE__, OCC395, group);
theCommands.Add ("OCC394", "OCC394 edge_result edge [tol [mode [tolang]]]", __FILE__, OCC394, group);
- theCommands.Add ("OCC301", "OCC301 X Y Z ArrowSize", __FILE__, OCC301, group);
+ theCommands.Add ("OCC301", "OCC301 ArcRadius ArrowSize", __FILE__, OCC301, group);
theCommands.Add ("OCC294", "OCC294 shape_result shape edge", __FILE__, OCC294, group);
theCommands.Add ("OCC60", "OCC60 xmin ymin xmax ymax; selection window", __FILE__, OCC60, group);
theCommands.Add ("OCC70", "OCC70 x1 y1 x2 y2 x3 y3 [x y ...]; polygon of selection", __FILE__, OCC70, group);