#include <GeomFill_Trihedron.hxx>
#include <BRepOffsetAPI_MakePipe.hxx>
#include <TopExp_Explorer.hxx>
-
#include <SelectMgr_Filter.hxx>
+#include <StdSelect_BRepOwner.hxx>
#include <Standard_Version.hxx>
+#include <XmlDrivers_DocumentRetrievalDriver.hxx>
+#include <XmlDrivers_DocumentStorageDriver.hxx>
#define QCOMPARE(val1, val2) \
di << "Checking " #val1 " == " #val2 << \
}
#include <TDocStd_Application.hxx>
-#include <XCAFApp_Application.hxx>
#include <TDocStd_Document.hxx>
#include <XCAFDoc_ShapeTool.hxx>
#include <XCAFDoc_DocumentTool.hxx>
#include <TDF_Label.hxx>
#include <TDataStd_Name.hxx>
+#include <DDocStd.hxx>
static Standard_Integer OCC23595 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
{
- Handle(TDocStd_Application) anApp = XCAFApp_Application::GetApplication();
+ Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
Handle(TDocStd_Document) aDoc;
anApp->NewDocument ("XmlXCAF", aDoc);
QCOMPARE (!aDoc.IsNull(), Standard_True);
return 0;
}
-#include <Extrema_FuncExtPS.hxx>
+#include <Extrema_FuncPSNorm.hxx>
#include <math_FunctionSetRoot.hxx>
#include <math_Vector.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
gp_Pnt aPnt = BRep_Tool::Pnt (aVert), aRes;
- Extrema_FuncExtPS anExtFunc;
+ Extrema_FuncPSNorm anExtFunc;
math_FunctionSetRoot aRoot (anExtFunc, aNbIts);
math_Vector aTolUV (1, 2), aUVinf (1, 2), aUVsup (1, 2), aFromUV (1, 2);
return aComp;
}
-#include <AppStd_Application.hxx>
#include <TDataStd_Integer.hxx>
#include <TNaming_Builder.hxx>
static Standard_Integer OCC24931 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
TCollection_ExtendedString aFileName (argv[1]);
PCDM_StoreStatus aSStatus = PCDM_SS_Failure;
- Handle(TDocStd_Application) anApp = new AppStd_Application;
+ Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
{
Handle(TDocStd_Document) aDoc;
anApp->NewDocument ("XmlOcaf", aDoc);
return 0;
}
-#include <AppStdL_Application.hxx>
-#include <TDocStd_Application.hxx>
-#include <TDataStd_Integer.hxx>
#include <TDF_AttributeIterator.hxx>
//=======================================================================
//function : OCC24755
return 1;
}
- Handle(TDocStd_Application) anApp = new AppStdL_Application;
+ Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
Handle(TDocStd_Document) aDoc;
anApp->NewDocument ("BinOcaf", aDoc);
TDF_Label aLab = aDoc->Main();
{
public:
- static void initGlobalPluginMap (const TCollection_AsciiString& thePlugin,
- const TCollection_AsciiString& theSaver,
- const TCollection_AsciiString& theLoader)
- {
- const Handle(Resource_Manager)& aManager = Plugin::AdditionalPluginMap();
- aManager->SetResource ((theSaver + ".Location").ToCString(), thePlugin.ToCString());
- aManager->SetResource ((theLoader + ".Location").ToCString(), thePlugin.ToCString());
- }
-
- Test_TDocStd_Application (const TCollection_AsciiString& thePlugin,
- const TCollection_AsciiString& theSaver,
- const TCollection_AsciiString& theLoader)
+ Test_TDocStd_Application ()
{
- initGlobalPluginMap (thePlugin, theSaver, theLoader);
-
// explicitly initialize resource manager
myResources = new Resource_Manager ("");
myResources->SetResource ("xml.FileFormat", THE_QATEST_DOC_FORMAT);
myResources->SetResource (THE_QATEST_DOC_FORMAT ".Description", "Test XML Document");
myResources->SetResource (THE_QATEST_DOC_FORMAT ".FileExtension", "xml");
- myResources->SetResource (THE_QATEST_DOC_FORMAT ".StoragePlugin", theSaver.ToCString());
- myResources->SetResource (THE_QATEST_DOC_FORMAT ".RetrievalPlugin", theLoader.ToCString());
}
- virtual Standard_CString ResourcesName() { return ""; }
- virtual void Formats (TColStd_SequenceOfExtendedString& theFormats) { theFormats.Clear(); }
+ virtual Handle(PCDM_Reader) ReaderFromFormat (const TCollection_ExtendedString&) Standard_OVERRIDE
+ {
+ return new XmlDrivers_DocumentRetrievalDriver ();
+ }
+ virtual Handle(PCDM_StorageDriver) WriterFromFormat (const TCollection_ExtendedString&) Standard_OVERRIDE
+ {
+ return new XmlDrivers_DocumentStorageDriver ("Test");
+ }
+ virtual Standard_CString ResourcesName() Standard_OVERRIDE { return ""; }
};
//=======================================================================
PCDM_StoreStatus aSStatus = PCDM_SS_Failure;
PCDM_ReaderStatus aRStatus = PCDM_RS_OpenError;
- Handle(TDocStd_Application) anApp = new Test_TDocStd_Application (aPlugin, aSaver, aLoader);
+ Handle(TDocStd_Application) anApp = new Test_TDocStd_Application ();
{
Handle(TDocStd_Document) aDoc;
anApp->NewDocument (THE_QATEST_DOC_FORMAT, aDoc);
return 0;
}
-//=======================================================================
-//function : OCC23010
-//purpose :
-//=======================================================================
-#include <STEPCAFControl_Reader.hxx>
-
-class mOcafApplication : public TDocStd_Application
-{
- void Formats(TColStd_SequenceOfExtendedString& Formats)
- {
- Formats.Append(TCollection_ExtendedString("mOcafApplication"));
- }
- Standard_CString ResourcesName()
- {
- return Standard_CString("Resources");
- }
-};
-
-static Standard_Integer OCC23010 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- if (argc != 2) {
- di << "Usage: " << argv[0] << " invalid number of arguments\n";
- return 1;
- }
- std::string fileName=argv[1];
- mOcafApplication *mCasApp = new mOcafApplication();
- Handle(TDocStd_Document) doc;
- mCasApp->NewDocument("BinXCAF", doc);
- STEPCAFControl_Reader stepReader;
- IFSelect_ReturnStatus status = stepReader.ReadFile (fileName.c_str());
- if (status != IFSelect_RetDone)
- return false;
- stepReader.SetColorMode(Standard_True);
- stepReader.SetLayerMode(Standard_True);
- stepReader.SetNameMode(Standard_True);
- stepReader.Transfer(doc); // ERROR HERE!!!
- delete mCasApp;
- return 0;
-}
-
//=======================================================================
//function : OCC25202
//purpose :
aMgr->BuildSelectingVolume (aPxPnt1);
}
const gp_Pnt* aVerts = aMgr->GetVertices();
- gp_Pnt aNearPnt = aMgr->GetNearPnt();
- gp_Pnt aFarPnt = aMgr->GetFarPnt();
+ gp_Pnt aNearPnt = aMgr->GetNearPickedPnt();
+ gp_Pnt aFarPnt = aMgr->GetFarPickedPnt();
BRepBuilderAPI_MakePolygon aWireBldrs[4];
aWireBldrs[0].Add (gp_Pnt (aVerts[0].X(), aVerts[0].Y(), aVerts[0].Z()));
return 0;
}
+//========================================================================
+//function : OCC27065
+//purpose : Tests overloaded method "Generated" of BRepOffsetAPI_MakePipe
+//========================================================================
+static Standard_Integer OCC27065(Draw_Interpretor& di,
+ Standard_Integer n, const char** a)
+{
+ if (n < 3) return 1;
+ BRep_Builder BB;
+
+ TopoDS_Shape SpineShape = DBRep::Get(a[1],TopAbs_WIRE);
+ if ( SpineShape.IsNull()) return 1;
+ TopoDS_Wire Spine = TopoDS::Wire(SpineShape);
+
+ TopoDS_Shape Profile = DBRep::Get(a[2]);
+ if ( Profile.IsNull()) return 1;
+
+ BRepOffsetAPI_MakePipe aPipeBuilder(Spine, Profile);
+ if (!aPipeBuilder.IsDone())
+ {
+ di << "Error: failed to create pipe\n";
+ return 1;
+ }
+
+ TopExp_Explorer Explo(Profile, TopAbs_SHELL);
+ TopoDS_Shape aShape;
+ TopTools_ListIteratorOfListOfShape itl;
+ if (Explo.More())
+ {
+ aShape = Explo.Current();
+ TopoDS_Compound res1;
+ BB.MakeCompound(res1);
+ itl.Initialize(aPipeBuilder.Generated(aShape));
+ for (; itl.More(); itl.Next())
+ BB.Add(res1, itl.Value());
+ DBRep::Set("res_shell", res1);
+ }
+
+ Explo.Init(Profile, TopAbs_FACE);
+ if (Explo.More())
+ {
+ aShape = Explo.Current();
+ TopoDS_Compound res2;
+ BB.MakeCompound(res2);
+ itl.Initialize(aPipeBuilder.Generated(aShape));
+ for (; itl.More(); itl.Next())
+ BB.Add(res2, itl.Value());
+ DBRep::Set("res_face", res2);
+ }
+
+ Explo.Init(Profile, TopAbs_WIRE);
+ if (Explo.More())
+ {
+ aShape = Explo.Current();
+ TopoDS_Compound res3;
+ BB.MakeCompound(res3);
+ itl.Initialize(aPipeBuilder.Generated(aShape));
+ for (; itl.More(); itl.Next())
+ BB.Add(res3, itl.Value());
+ DBRep::Set("res_wire", res3);
+ }
+
+ Explo.Init(Profile, TopAbs_EDGE);
+ if (Explo.More())
+ {
+ aShape = Explo.Current();
+ TopoDS_Compound res4;
+ BB.MakeCompound(res4);
+ itl.Initialize(aPipeBuilder.Generated(aShape));
+ for (; itl.More(); itl.Next())
+ BB.Add(res4, itl.Value());
+ DBRep::Set("res_edge", res4);
+ }
+
+ Explo.Init(Profile, TopAbs_VERTEX);
+ if (Explo.More())
+ {
+ aShape = Explo.Current();
+ TopoDS_Compound res5;
+ BB.MakeCompound(res5);
+ itl.Initialize(aPipeBuilder.Generated(aShape));
+ for (; itl.More(); itl.Next())
+ BB.Add(res5, itl.Value());
+ DBRep::Set("res_vertex", res5);
+ }
+
+ return 0;
+}
+
+//========================================================================
+//function : OCC27318
+//purpose : Creates a box that is not listed in map of AIS objects of ViewerTest
+//========================================================================
+static Standard_Integer OCC27318 (Draw_Interpretor& /*theDI*/, Standard_Integer /*theArgc*/, const char** theArgv)
+{
+ const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
+ if (aCtx.IsNull())
+ {
+ std::cout << "No interactive context. Use 'vinit' command before " << theArgv[0] << "\n";
+ return 1;
+ }
+
+ TopoDS_Shape aBox = BRepPrimAPI_MakeBox (20, 20, 20).Shape();
+ Handle(AIS_Shape) aBoxObj = new AIS_Shape (aBox);
+ aCtx->Display (aBoxObj, Standard_True);
+
+ return 0;
+}
+
+//========================================================================
+//function : OCC27523
+//purpose : Checks recomputation of deactivated selection mode after object's redisplaying
+//========================================================================
+static Standard_Integer OCC27523 (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
+{
+ if (theArgNb != 1)
+ {
+ std::cerr << "Error: wrong number of arguments! See usage:\n";
+ theDI.PrintHelp (theArgVec[0]);
+ return 1;
+ }
+
+ Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext();
+ if(anAISContext.IsNull())
+ {
+ std::cerr << "Error: no active view. Please call vinit.\n";
+ return 1;
+ }
+
+ gp_Pnt aStart (100, 100, 100);
+ gp_Pnt anEnd (300, 400, 600);
+ BRepBuilderAPI_MakeEdge anEdgeBuilder (aStart, anEnd);
+ TopoDS_Edge anEdge = anEdgeBuilder.Edge();
+ Handle(AIS_InteractiveObject) aTestAISShape = new AIS_Shape (anEdge);
+ anAISContext->Display (aTestAISShape);
+
+ // activate it in selection modes
+ TColStd_SequenceOfInteger aModes;
+ aModes.Append (AIS_Shape::SelectionMode ((TopAbs_ShapeEnum) TopAbs_VERTEX));
+
+ anAISContext->OpenLocalContext();
+ anAISContext->Deactivate (aTestAISShape);
+ anAISContext->Load (aTestAISShape, -1, true);
+ anAISContext->Activate (aTestAISShape, 0);
+ anAISContext->Deactivate (aTestAISShape, 0);
+
+ // activate in vertices mode
+ for (Standard_Integer anIt = 1; anIt <= aModes.Length(); ++anIt)
+ {
+ anAISContext->Activate (aTestAISShape, aModes (anIt));
+ }
+
+ TopoDS_Shape aVertexShape = BRepBuilderAPI_MakeVertex (gp_Pnt (75, 0, 0));
+ TopAbs_ShapeEnum aVertexShapeType = aVertexShape.ShapeType();
+ Handle(AIS_Shape)::DownCast (aTestAISShape)->Set (aVertexShape);
+ aTestAISShape->Redisplay();
+
+ anAISContext->AddOrRemoveSelected (aTestAISShape);
+
+ bool aValidShapeType = false;
+ for (anAISContext->InitSelected(); anAISContext->MoreSelected(); anAISContext->NextSelected())
+ {
+ Handle(SelectMgr_EntityOwner) anOwner = anAISContext->SelectedOwner();
+ Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast (anOwner);
+ if (!aBRO.IsNull() && aBRO->HasShape())
+ {
+ TopoDS_Shape aShape = aBRO->Shape();
+
+ aValidShapeType = aShape.ShapeType() == aVertexShapeType;
+ }
+ }
+
+ if (!aValidShapeType)
+ {
+ std::cerr << "Error: shape type is invalid.\n";
+ return 1;
+ }
+
+ return 0;
+}
+
void QABugs::Commands_19(Draw_Interpretor& theCommands) {
const char *group = "QABugs";
"OCC24925 filename [pluginLib=TKXml storageGuid retrievalGuid]"
"\nOCAF persistence without setting environment variables",
__FILE__, OCC24925, group);
- theCommands.Add ("OCC23010", "OCC23010 STEP_file", __FILE__, OCC23010, group);
theCommands.Add ("OCC25043", "OCC25043 shape", __FILE__, OCC25043, group);
theCommands.Add ("OCC24826,", "This test performs simple saxpy test.\n Usage: OCC24826 length", __FILE__, OCC24826, group);
theCommands.Add ("OCC24606", "OCC24606 : Tests ::FitAll for V3d view ('vfit' is for NIS view)", __FILE__, OCC24606, group);
"OCC27048 surf U V N\nCalculate value of surface N times in the point (U, V)",
__FILE__, OCC27048, group);
+ theCommands.Add ("OCC27065",
+ "OCC27065 spine profile",
+ __FILE__, OCC27065, group);
+
+ theCommands.Add ("OCC27318",
+ "OCC27318: Creates a box that is not listed in map of AIS objects of ViewerTest",
+ __FILE__, OCC27318, group);
+ theCommands.Add ("OCC27523",
+ "OCC27523: Checks recomputation of deactivated selection mode after object's redisplaying",
+ __FILE__, OCC27523, group);
+
return;
}