#include <QABugs.hxx>
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <ViewerTest.hxx>
-#include <V3d_View.hxx>
-#include <TopoDS_Shape.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_LocalContext.hxx>
#include <AIS_TexturedShape.hxx>
-#include <Image_PixMap.hxx>
-#include <Image_Color.hxx>
-
-#include <gp_Pnt2d.hxx>
-#include <gp_Ax1.hxx>
-#include <gp_Quaternion.hxx>
-#include <GCE2d_MakeSegment.hxx>
-#include <Geom2d_TrimmedCurve.hxx>
-#include <DrawTrSurf.hxx>
-
-#include <Precision.hxx>
-
-#include <cstdio>
-#include <cmath>
-#include <iostream>
-#include <OSD_Timer.hxx>
-#include <OSD_Parallel.hxx>
-#include <OSD_PerfMeter.hxx>
+#include <BRepAlgoAPI_Cut.hxx>
+#include <BRepOffsetAPI_MakePipe.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <BRepPrimAPI_MakeSphere.hxx>
-#include <BRepAlgo_Cut.hxx>
-#include <NCollection_Map.hxx>
+#include <DBRep.hxx>
+#include <Draw_Interpretor.hxx>
+#include <DrawTrSurf.hxx>
+#include <GCE2d_MakeSegment.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
+#include <GeomFill_Trihedron.hxx>
+#include <Graphic3d_ArrayOfTriangles.hxx>
+#include <gp_Ax1.hxx>
+#include <gp_Pnt2d.hxx>
+#include <gp_Quaternion.hxx>
+#include <Image_Color.hxx>
+#include <Image_PixMap.hxx>
#include <NCollection_Handle.hxx>
#include <NCollection_IncAllocator.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <GeomFill_Trihedron.hxx>
-#include <BRepOffsetAPI_MakePipe.hxx>
-#include <TopExp_Explorer.hxx>
-
+#include <NCollection_Map.hxx>
+#include <OSD_Parallel.hxx>
+#include <OSD_PerfMeter.hxx>
+#include <OSD_Timer.hxx>
+#include <Precision.hxx>
+#include <Prs3d_ShadingAspect.hxx>
+#include <Prs3d_Text.hxx>
#include <SelectMgr_Filter.hxx>
+#include <Standard_Version.hxx>
#include <StdSelect_BRepOwner.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS_Shape.hxx>
+#include <V3d_View.hxx>
+#include <ViewerTest.hxx>
+#include <XmlDrivers_DocumentRetrievalDriver.hxx>
+#include <XmlDrivers_DocumentStorageDriver.hxx>
-#include <Standard_Version.hxx>
+#include <cstdio>
+#include <cmath>
+#include <iostream>
#define QCOMPARE(val1, val2) \
di << "Checking " #val1 " == " #val2 << \
// do some operation that will take considerable time compared with time of starting / stopping timers
BRepPrimAPI_MakeBox aBox (10., 10., 10.);
BRepPrimAPI_MakeSphere aSphere (10.);
- BRepAlgo_Cut aCutter (aBox.Shape(), aSphere.Shape());
+ BRepAlgoAPI_Cut aCutter (aBox.Shape(), aSphere.Shape());
aTM.Stop();
aPM.Stop();
}
#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);
{
TopoDS_Shape rshape = anormpro.Projection();
Handle(AIS_InteractiveObject) myShape = new AIS_Shape (rshape);
- myAISContext->SetColor(myShape, Quantity_Color(Quantity_NOC_YELLOW));
- myAISContext->Display(myShape, Standard_True);
+ myAISContext->SetColor (myShape, Quantity_Color(Quantity_NOC_YELLOW), Standard_False);
+ myAISContext->Display (myShape, Standard_True);
}
return 0;
TDataStd_Name::Set(labelA0, "ASSEMBLY");
TDF_Label component01 = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main ())->AddComponent (labelA0, lab1, location0);
+ XCAFDoc_DocumentTool::ShapeTool (aDoc->Main ())->UpdateAssemblies();
Quantity_Color yellow(1,1,0, Quantity_TOC_RGB);
XCAFDoc_DocumentTool::ColorTool (labelA0)->SetColor (component01, yellow, XCAFDoc_ColorGen);
aTextureTypeArg.UpperCase();
if (aTextureTypeArg == "1D")
{
- anImage->InitWrapper (Image_PixMap::ImgRGB, (Standard_Byte*)aBitmap, 8, 1);
+ anImage->InitWrapper (Image_Format_RGB, (Standard_Byte*)aBitmap, 8, 1);
}
else if (aTextureTypeArg == "2D")
{
- anImage->InitTrash (Image_PixMap::ImgRGB, 8, 8);
+ anImage->InitTrash (Image_Format_RGB, 8, 8);
for (Standard_Integer aRow = 0; aRow < 8; ++aRow)
{
for (Standard_Integer aCol = 0; aCol < 8; ++aCol)
Handle(AIS_TexturedShape) aTexturedShape = new AIS_TexturedShape (aBlankShape);
aTexturedShape->SetTexturePixMap (anImage);
- anAISContext->Display (aTexturedShape, 3, 0);
+ anAISContext->Display (aTexturedShape, 3, 0, Standard_True);
return 0;
}
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 :
BRepBuilderAPI_MakeEdge anEdgeBuilder (aStart, anEnd);
TopoDS_Edge anEdge = anEdgeBuilder.Edge();
Handle(AIS_Shape) aTestAISShape = new AIS_Shape (anEdge);
- anAISContext->Display (aTestAISShape);
+ anAISContext->Display (aTestAISShape, Standard_True);
// 2. activate it in selection modes
TColStd_SequenceOfInteger aModes;
aModes.Append (AIS_Shape::SelectionMode ((TopAbs_ShapeEnum) TopAbs_VERTEX));
aModes.Append (AIS_Shape::SelectionMode ((TopAbs_ShapeEnum) TopAbs_EDGE));
+ Standard_DISABLE_DEPRECATION_WARNINGS
anAISContext->OpenLocalContext();
+ Standard_ENABLE_DEPRECATION_WARNINGS
anAISContext->Deactivate (aTestAISShape);
anAISContext->Load (aTestAISShape, -1, true);
for (Standard_Integer anIt = 1; anIt <= aModes.Length(); ++anIt)
// select entities in vertex selection mode
Handle(SelectMgr_Selection) aSelection = aTestAISShape->Selection (aModes (1));
+ Standard_DISABLE_DEPRECATION_WARNINGS
for (aSelection->Init(); aSelection->More(); aSelection->Next())
{
Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive();
anAISContext->LocalContext()->AddOrRemoveSelected (anOwner);
}
+ Standard_ENABLE_DEPRECATION_WARNINGS
// select entities in edge selection mode
aSelection = aTestAISShape->Selection (aModes (2));
+ Standard_DISABLE_DEPRECATION_WARNINGS
for (aSelection->Init(); aSelection->More(); aSelection->Next())
{
Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive();
anAISContext->LocalContext()->AddOrRemoveSelected (anOwner);
}
+ Standard_ENABLE_DEPRECATION_WARNINGS
// deactivate vertex mode and check clearing of outdated selection
anAISContext->Deactivate (aTestAISShape, aModes (1));
+ Standard_DISABLE_DEPRECATION_WARNINGS
anAISContext->LocalContext()->ClearOutdatedSelection (aTestAISShape, true);
+ Standard_ENABLE_DEPRECATION_WARNINGS
return 0;
}
BRepPrimAPI_MakeSphere aSphereBuilder (gp_Pnt (0.0, 0.0, 0.0), 1.0);
Handle(AIS_Shape) aSphere = new AIS_Shape (aSphereBuilder.Shape());
- anAISContext->Display (aSphere);
+ anAISContext->Display (aSphere, Standard_False);
for (Standard_Integer aChildIdx = 0; aChildIdx < 5; ++aChildIdx)
{
BRepPrimAPI_MakeSphere aBuilder (gp_Pnt (1.0 + aChildIdx, 1.0 + aChildIdx, 1.0 + aChildIdx), 1.0);
Handle(AIS_Shape) aChild = new AIS_Shape (aBuilder.Shape());
aSphere->AddChild (aChild);
- anAISContext->Display (aChild);
+ anAISContext->Display (aChild, Standard_False);
}
anAISContext->RecomputeSelectionOnly (aSphere);
+ anAISContext->UpdateCurrentViewer();
return 0;
}
Standard_Boolean toPrint = Standard_False;
if (theArgNb % 2 == 0)
{
- toPrint = Draw::Atoi (theArgVec[theArgNb - 1]);
+ toPrint = Draw::Atoi (theArgVec[theArgNb - 1]) != 0;
}
SelectMgr_SelectingVolumeManager* aMgr = new SelectMgr_SelectingVolumeManager();
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()));
Handle(AIS_InteractiveObject) aBox2 = new AIS_Shape (aBuilder2.Shape());
const Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
- aCtx->OpenLocalContext();
- aCtx->Display (aBox1, 0, 2);
- aCtx->Display (aBox2, 0, 2);
+ aCtx->Display (aBox1, 0, 2, Standard_False);
+ aCtx->Display (aBox2, 0, 2, Standard_False);
ViewerTest::CurrentView()->FitAll();
- aCtx->SetWidth (aBox1, 3);
- aCtx->SetWidth (aBox2, 3);
+ aCtx->SetWidth (aBox1, 3, Standard_False);
+ aCtx->SetWidth (aBox2, 3, Standard_False);
- aCtx->MoveTo (305, 322, ViewerTest::CurrentView());
- aCtx->ShiftSelect();
- aCtx->MoveTo (103, 322, ViewerTest::CurrentView());
- aCtx->ShiftSelect();
+ aCtx->MoveTo (305, 322, ViewerTest::CurrentView(), Standard_False);
+ aCtx->ShiftSelect (Standard_False);
+ aCtx->MoveTo (103, 322, ViewerTest::CurrentView(), Standard_False);
+ aCtx->ShiftSelect (Standard_False);
if (aCtx->NbSelected() != 0)
{
theDI << "ERROR: no boxes must be selected!\n";
aCtx->SetSelectionSensitivity (aBox1, 2, 5);
- aCtx->MoveTo (305, 322, ViewerTest::CurrentView());
- aCtx->ShiftSelect();
+ aCtx->MoveTo (305, 322, ViewerTest::CurrentView(), Standard_False);
+ aCtx->ShiftSelect (Standard_False);
if (aCtx->NbSelected() != 1)
{
theDI << "ERROR: b1 was not selected\n";
return 1;
}
- aCtx->MoveTo (103, 322, ViewerTest::CurrentView());
- aCtx->ShiftSelect();
+ aCtx->MoveTo (103, 322, ViewerTest::CurrentView(), Standard_False);
+ aCtx->ShiftSelect (Standard_True);
if (aCtx->NbSelected() != 1)
{
theDI << "ERROR: b2 is selected after b1's tolerance increased\n";
// visualization of the box in the local mode with possibility to
// select box vertices
+ Standard_DISABLE_DEPRECATION_WARNINGS
aContext->OpenLocalContext();
+ Standard_ENABLE_DEPRECATION_WARNINGS
int aDispMode = 0;// wireframe
anAISIO->SetDisplayMode(aDispMode);
Standard_Integer Xp,Yp;
myV3dView->Convert(Xv,Yv,Xp,Yp);
- aContext->MoveTo(Xp,Yp, myV3dView);
- aContext->Select();
+ aContext->MoveTo (Xp, Yp, myV3dView, Standard_False);
+ aContext->Select (Standard_False);
bool aHasSelected = false;
for (aContext->InitSelected(); aContext->MoreSelected() && !aHasSelected; aContext->NextSelected()) {
Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive();
aContext->AddFilter(aFilter);
// update previous selection by hand
+ Standard_DISABLE_DEPRECATION_WARNINGS
aContext->LocalContext()->ClearOutdatedSelection(anAISIO, true);
+ Standard_ENABLE_DEPRECATION_WARNINGS
// check that there are no selected vertices
- aContext->Select();
+ aContext->Select (Standard_True);
aHasSelected = false;
for (aContext->InitSelected(); aContext->MoreSelected() && !aHasSelected; aContext->NextSelected()) {
Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive();
}
const TopAbs_ShapeEnum aSelType = AIS_Shape::SelectionType (Draw::Atoi (theArgv[1]));
+ Standard_DISABLE_DEPRECATION_WARNINGS
Standard_Integer aLocalCtxIdx = aCtx->OpenLocalContext();
aCtx->ActivateStandardMode (aSelType);
+ Standard_ENABLE_DEPRECATION_WARNINGS
theDI << aLocalCtxIdx;
return 0;
}
const Standard_Integer aCtxToClose = Draw::Atoi (theArgv[1]);
+ Standard_DISABLE_DEPRECATION_WARNINGS
aCtx->CloseLocalContext (aCtxToClose);
+ Standard_ENABLE_DEPRECATION_WARNINGS
return 0;
}
BRepBuilderAPI_MakeEdge anEdgeBuilder (aStart, anEnd);
TopoDS_Edge anEdge = anEdgeBuilder.Edge();
Handle(AIS_InteractiveObject) aTestAISShape = new AIS_Shape (anEdge);
- anAISContext->Display (aTestAISShape);
+ anAISContext->Display (aTestAISShape, Standard_False);
// 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);
Handle(AIS_Shape)::DownCast (aTestAISShape)->Set (aVertexShape);
aTestAISShape->Redisplay();
- anAISContext->AddOrRemoveSelected (aTestAISShape);
+ anAISContext->AddOrRemoveSelected (aTestAISShape, Standard_True);
bool aValidShapeType = false;
for (anAISContext->InitSelected(); anAISContext->MoreSelected(); anAISContext->NextSelected())
return 0;
}
+//========================================================================
+//function : OCC27700
+//purpose : glPolygonMode() used for frame drawing affects label text shading
+//========================================================================
+
+class OCC27700_Text : public AIS_InteractiveObject
+{
+public:
+
+ DEFINE_STANDARD_RTTI_INLINE (OCC27700_Text, AIS_InteractiveObject)
+
+ virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePresentationManager*/,
+ const Handle(Prs3d_Presentation)& thePresentation,
+ const Standard_Integer /*theMode*/) Standard_OVERRIDE
+ {
+ Handle(Graphic3d_ArrayOfTriangles) aFrame = new Graphic3d_ArrayOfTriangles (6, 6);
+ aFrame->AddVertex (gp_Pnt (-1, 0, 0));
+ aFrame->AddVertex (gp_Pnt (-1, 1, 0));
+ aFrame->AddVertex (gp_Pnt ( 3, 1, 0));
+ aFrame->AddVertex (gp_Pnt ( 3, 0, 0));
+
+ aFrame->AddEdge (1);
+ aFrame->AddEdge (2);
+ aFrame->AddEdge (3);
+
+ aFrame->AddEdge (2);
+ aFrame->AddEdge (3);
+ aFrame->AddEdge (4);
+
+ Handle(Graphic3d_AspectFillArea3d) aFillAspect =
+ new Graphic3d_AspectFillArea3d (*myDrawer->ShadingAspect()->Aspect().get());
+ aFillAspect->SetInteriorStyle (Aspect_IS_POINT);
+
+ // create separate group for frame elements
+ Handle(Graphic3d_Group) aFrameGroup = Prs3d_Root::NewGroup (thePresentation);
+ aFrameGroup->AddPrimitiveArray (aFrame);
+ aFrameGroup->SetGroupPrimitivesAspect (aFillAspect);
+
+ // create separate group for text elements
+ Handle(Graphic3d_Group) aTextGroup = Prs3d_Root::NewGroup (thePresentation);
+ TCollection_ExtendedString aString ("YOU SHOULD SEE THIS TEXT", Standard_True);
+ Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (thePresentation), myDrawer->TextAspect(), aString, gp_Ax2 (gp::Origin(), gp::DZ()));
+ }
+
+ virtual void ComputeSelection (const Handle(SelectMgr_Selection)& /*theSelection*/,
+ const Standard_Integer /*theMode*/) Standard_OVERRIDE {}
+};
+
+static Standard_Integer OCC27700 (Draw_Interpretor& /*theDI*/, Standard_Integer /*theArgNb*/, const char** /*theArgVec*/)
+{
+ Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+ if (aContext.IsNull())
+ {
+ std::cout << "Error: no view available, call 'vinit' before!" << std::endl;
+ return 1;
+ }
+ Handle(OCC27700_Text) aPresentation = new OCC27700_Text();
+ aContext->Display (aPresentation, Standard_True);
+ return 0;
+}
+
+//========================================================================
+//function : OCC27757
+//purpose : Creates a box that has a sphere as child object and displays it
+//========================================================================
+static Standard_Integer OCC27757 (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.0, 20.0, 20.0).Shape();
+ TopoDS_Shape aSphere = BRepPrimAPI_MakeSphere (10.0).Shape();
+ gp_Trsf aTrsf;
+ aTrsf.SetTranslationPart (gp_Vec (20.0, 20.0, 0.0));
+ aSphere.Located (TopLoc_Location (aTrsf));
+
+
+ Handle(AIS_Shape) aBoxObj = new AIS_Shape (aBox);
+ Handle(AIS_Shape) aSphereObj = new AIS_Shape (aSphere);
+ aBoxObj->AddChild (aSphereObj);
+ aCtx->Display (aBoxObj, 1, 0, Standard_False);
+ aCtx->UpdateCurrentViewer();
+
+ return 0;
+}
+
+//========================================================================
+//function : OCC27818
+//purpose : Creates three boxes and highlights one of them with own style
+//========================================================================
+static Standard_Integer OCC27818 (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;
+ }
+
+ Handle(AIS_Shape) aBoxObjs[3];
+ for (Standard_Integer aBoxIdx = 0; aBoxIdx < 3; ++aBoxIdx)
+ {
+ TopoDS_Shape aBox = BRepPrimAPI_MakeBox (20.0, 20.0, 20.0).Shape();
+ aBoxObjs[aBoxIdx] = new AIS_Shape (aBox);
+ gp_Trsf aTrsf;
+ aTrsf.SetTranslationPart (gp_Vec (30.0 * aBoxIdx, 30.0 * aBoxIdx, 0.0));
+ aBoxObjs[aBoxIdx]->SetLocalTransformation (aTrsf);
+ aBoxObjs[aBoxIdx]->SetHilightMode (AIS_Shaded);
+ }
+
+ {
+ Handle(Prs3d_Drawer) aHiStyle = new Prs3d_Drawer();
+ aBoxObjs[1]->SetDynamicHilightAttributes (aHiStyle);
+ aHiStyle->SetDisplayMode (AIS_Shaded);
+ aHiStyle->SetColor (Quantity_NOC_RED);
+ aHiStyle->SetTransparency (0.8f);
+ }
+ {
+ Handle(Prs3d_Drawer) aSelStyle = new Prs3d_Drawer();
+ aBoxObjs[2]->SetHilightAttributes (aSelStyle);
+ aSelStyle->SetDisplayMode (AIS_Shaded);
+ aSelStyle->SetColor (Quantity_NOC_RED);
+ aSelStyle->SetTransparency (0.0f);
+ aSelStyle->SetZLayer (Graphic3d_ZLayerId_Topmost);
+ }
+
+ for (Standard_Integer aBoxIdx = 0; aBoxIdx < 3; ++aBoxIdx)
+ {
+ aCtx->Display (aBoxObjs[aBoxIdx], AIS_Shaded, 0, Standard_False);
+ }
+
+ aCtx->UpdateCurrentViewer();
+
+ return 0;
+}
+
+//========================================================================
+//function : OCC27893
+//purpose : Creates a box and selects it via AIS_InteractiveContext API
+//========================================================================
+static Standard_Integer OCC27893 (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 (10.0, 10.0, 10.0).Shape();
+ Handle(AIS_InteractiveObject) aBoxObj = new AIS_Shape (aBox);
+ aCtx->Display (aBoxObj, AIS_Shaded, 0, Standard_False);
+ aCtx->SetSelected (aBoxObj, Standard_True);
+
+ return 0;
+}
+
+//========================================================================
+//function : OCC28310
+//purpose : Tests validness of iterator in AIS_InteractiveContext after
+// an removing object from it
+//========================================================================
+static Standard_Integer OCC28310 (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 (10.0, 10.0, 10.0).Shape();
+ Handle(AIS_InteractiveObject) aBoxObj = new AIS_Shape (aBox);
+ aCtx->Display (aBoxObj, AIS_Shaded, 0, Standard_False);
+ ViewerTest::CurrentView()->FitAll();
+ aCtx->MoveTo (200, 200, ViewerTest::CurrentView(), Standard_True);
+ aCtx->Select(Standard_True);
+
+ aCtx->Remove (aBoxObj, Standard_True);
+ // nullify the object explicitly to simulate situation in project,
+ // when ::Remove is called from another method and the object is destroyed
+ // before ::DetectedInteractive is called
+ aBoxObj.Nullify();
+
+ for (aCtx->InitDetected(); aCtx->MoreDetected(); aCtx->NextDetected())
+ {
+ Handle(AIS_InteractiveObject) anObj = aCtx->DetectedInteractive();
+ }
+
+ return 0;
+}
+
+//========================================================================
+//function : Commands_19
+//purpose :
+//========================================================================
+
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);
theCommands.Add ("OCC27523",
"OCC27523: Checks recomputation of deactivated selection mode after object's redisplaying",
__FILE__, OCC27523, group);
-
+ theCommands.Add ("OCC27700",
+ "OCC27700: Checks drawing text after setting interior style",
+ __FILE__, OCC27700, group);
+ theCommands.Add ("OCC27757",
+ "OCC27757: Creates a box that has a sphere as child object and displays it",
+ __FILE__, OCC27757, group);
+ theCommands.Add ("OCC27818",
+ "OCC27818: Creates three boxes and highlights one of them with own style",
+ __FILE__, OCC27818, group);
+ theCommands.Add ("OCC27893",
+ "OCC27893: Creates a box and selects it via AIS_InteractiveContext API",
+ __FILE__, OCC27893, group);
+ theCommands.Add("OCC28310",
+ "OCC28310: Tests validness of iterator in AIS_InteractiveContext after an removing object from it",
+ __FILE__, OCC28310, group);
return;
}