#include <ViewerTest.hxx>
#include <ViewerTest_CmdParser.hxx>
+#include <Draw.hxx>
#include <TopLoc_Location.hxx>
#include <TopTools_HArray1OfShape.hxx>
#include <TColStd_HArray1OfTransient.hxx>
return Standard_False;
}
+//=======================================================================
+//function : GetSelectedShapes
+//purpose :
+//=======================================================================
+void ViewerTest::GetSelectedShapes (TopTools_ListOfShape& theSelectedShapes)
+{
+ for (GetAISContext()->InitSelected(); GetAISContext()->MoreSelected(); GetAISContext()->NextSelected())
+ {
+ TopoDS_Shape aShape = GetAISContext()->SelectedShape();
+ if (!aShape.IsNull())
+ {
+ theSelectedShapes.Append (aShape);
+ }
+ }
+}
+
+//=======================================================================
+//function : ParseLineType
+//purpose :
+//=======================================================================
+Standard_Boolean ViewerTest::ParseLineType (Standard_CString theArg,
+ Aspect_TypeOfLine& theType)
+{
+ TCollection_AsciiString aTypeStr (theArg);
+ aTypeStr.LowerCase();
+ if (aTypeStr == "empty")
+ {
+ theType = Aspect_TOL_EMPTY;
+ }
+ else if (aTypeStr == "solid")
+ {
+ theType = Aspect_TOL_SOLID;
+ }
+ else if (aTypeStr == "dot")
+ {
+ theType = Aspect_TOL_DOT;
+ }
+ else if (aTypeStr == "dash")
+ {
+ theType = Aspect_TOL_DASH;
+ }
+ else if (aTypeStr == "dotdash")
+ {
+ theType = Aspect_TOL_DOTDASH;
+ }
+ else
+ {
+ const int aTypeInt = Draw::Atoi (theArg);
+ if (aTypeInt < -1 || aTypeInt >= Aspect_TOL_USERDEFINED)
+ {
+ return Standard_False;
+ }
+ theType = (Aspect_TypeOfLine )aTypeInt;
+ }
+ return Standard_True;
+}
+
//=======================================================================
//function : GetTypeNames
//purpose :
Handle(AIS_InteractiveObject) anOldObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (theName));
if (!anOldObj.IsNull())
{
- aCtx->Remove (anOldObj, Standard_True);
+ aCtx->Remove (anOldObj, theObject.IsNull() && theToUpdate);
}
aMap.UnBind2 (theName);
}
void ViewerTest::Clear()
{
if ( !a3DView().IsNull() ) {
- if (TheAISContext()->HasOpenedContext())
- TheAISContext()->CloseLocalContext();
ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it(GetMapOfAIS());
while ( it.More() ) {
cout << "Remove " << it.Key2() << endl;
//purpose : Activate a selection mode, vertex, edge, wire ..., in a local
// Context
//==============================================================================
+Standard_DISABLE_DEPRECATION_WARNINGS
void ViewerTest::StandardModeActivation(const Standard_Integer mode )
{
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if(mode==0) {
if (TheAISContext()->HasOpenedContext())
+ {
aContext->CloseLocalContext();
+ }
} else {
if(!aContext->HasOpenedContext()) {
// Open a local Context in order to be able to select subshape from
// the selected shape if any or for all if there is no selection
if (!aContext->FirstSelectedObject().IsNull()){
- aContext->OpenLocalContext(Standard_False);
+ aContext->OpenLocalContext(Standard_False);
for(aContext->InitSelected();aContext->MoreSelected();aContext->NextSelected()){
aContext->Load( aContext->SelectedInteractive(),-1,Standard_True);
}
}
else
- aContext->OpenLocalContext();
+ {
+ aContext->OpenLocalContext();
+ }
}
const char *cmode="???";
}
if(theactivatedmodes.Contains(mode))
- { // Desactivate
- aContext->DeactivateStandardMode(AIS_Shape::SelectionType(mode));
- theactivatedmodes.Remove(mode);
- cout<<"Mode "<< cmode <<" OFF"<<endl;
- }
+ { // Desactivate
+ aContext->DeactivateStandardMode(AIS_Shape::SelectionType(mode));
+ theactivatedmodes.Remove(mode);
+ cout<<"Mode "<< cmode <<" OFF"<<endl;
+ }
else
- { // Activate
- aContext->ActivateStandardMode(AIS_Shape::SelectionType(mode));
- theactivatedmodes.Add(mode);
- cout<<"Mode "<< cmode << " ON" << endl;
- }
+ { // Activate
+ aContext->ActivateStandardMode(AIS_Shape::SelectionType(mode));
+ theactivatedmodes.Add(mode);
+ cout<<"Mode "<< cmode << " ON" << endl;
+ }
}
}
+Standard_ENABLE_DEPRECATION_WARNINGS
//==============================================================================
//function : CopyIsoAspect
CurDrawer->SetVIsoAspect(CopyIsoAspect(aVIso, aNbVIsos));
TheAISContext()->SetLocalAttributes
(aShape, CurDrawer, Standard_False);
- TheAISContext()->Redisplay(aShape);
+ TheAISContext()->Redisplay (aShape, Standard_False);
} else {
di << "Number of isos for " << argv[i] << " : "
<< aUIso->Number() << " " << aVIso->Number() << "\n";
}
Image_AlienPixMap aPixMap;
-
- bool isBigEndian = Image_PixMap::IsBigEndianHost();
Image_PixMap::ImgFormat aFormat = Image_PixMap::ImgUNKNOWN;
switch (aParams.BufferType)
{
- case Graphic3d_BT_RGB: aFormat = isBigEndian ? Image_PixMap::ImgRGB : Image_PixMap::ImgBGR; break;
- case Graphic3d_BT_RGBA: aFormat = isBigEndian ? Image_PixMap::ImgRGBA : Image_PixMap::ImgBGRA; break;
+ case Graphic3d_BT_RGB: aFormat = Image_PixMap::ImgRGB; break;
+ case Graphic3d_BT_RGBA: aFormat = Image_PixMap::ImgRGBA; break;
case Graphic3d_BT_Depth: aFormat = Image_PixMap::ImgGrayF; break;
}
}
Image_PixMap aPixMapL, aPixMapR;
- aPixMapL.InitWrapper (aFormat, aPixMap.ChangeData(),
+ aPixMapL.InitWrapper (aPixMap.Format(), aPixMap.ChangeData(),
aParams.Width, aParams.Height, aPixMap.SizeRowBytes());
- aPixMapR.InitWrapper (aFormat, aPixMap.ChangeData() + aPixMap.SizeRowBytes() * aParams.Height,
+ aPixMapR.InitWrapper (aPixMap.Format(), aPixMap.ChangeData() + aPixMap.SizeRowBytes() * aParams.Height,
aParams.Width, aParams.Height, aPixMap.SizeRowBytes());
aParams.StereoOptions = V3d_SDO_LEFT_EYE;
IO = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
if (!IO.IsNull()) {
if(On==1)
- Ctx->SubIntensityOn(IO);
+ Ctx->SubIntensityOn(IO, Standard_True);
else
- Ctx->SubIntensityOff(IO);
+ Ctx->SubIntensityOff(IO, Standard_True);
}
}
else return 1;
theDI.PrintHelp (theArgVec[0]);
return 1;
}
- Standard_Integer anInterStyle = Aspect_IS_SOLID;
+ Aspect_InteriorStyle anInterStyle = Aspect_IS_SOLID;
TCollection_AsciiString aStyleArg (theArgVec[anArgIter++]);
aStyleArg.LowerCase();
if (aStyleArg == "empty")
{
- anInterStyle = 0;
+ anInterStyle = Aspect_IS_EMPTY;
}
else if (aStyleArg == "hollow")
{
- anInterStyle = 1;
+ anInterStyle = Aspect_IS_HOLLOW;
}
else if (aStyleArg == "hatch")
{
- anInterStyle = 2;
+ anInterStyle = Aspect_IS_HATCH;
}
else if (aStyleArg == "solid")
{
- anInterStyle = 3;
+ anInterStyle = Aspect_IS_SOLID;
}
else if (aStyleArg == "hiddenline")
{
- anInterStyle = 4;
+ anInterStyle = Aspect_IS_HIDDENLINE;
}
- else
+ else if (aStyleArg == "point")
{
- anInterStyle = aStyleArg.IntegerValue();
+ anInterStyle = Aspect_IS_POINT;
}
- if (anInterStyle < Aspect_IS_EMPTY
- || anInterStyle > Aspect_IS_HIDDENLINE)
+ else
{
- std::cout << "Error: style must be within a range [0 (Aspect_IS_EMPTY), "
- << Aspect_IS_HIDDENLINE << " (Aspect_IS_HIDDENLINE)]\n";
- return 1;
+ const Standard_Integer anIntStyle = aStyleArg.IntegerValue();
+ if (anIntStyle < Aspect_IS_EMPTY
+ || anIntStyle > Aspect_IS_POINT)
+ {
+ std::cout << "Error: style must be within a range [0 (Aspect_IS_EMPTY), "
+ << Aspect_IS_POINT << " (Aspect_IS_POINT)]\n";
+ return 1;
+ }
+ anInterStyle = (Aspect_InteriorStyle )anIntStyle;
}
if (!aName.IsEmpty()
return 1;
}
- if (aCtx->HasOpenedContext())
- {
- aCtx->CloseLocalContext();
- }
for (ViewTest_PrsIter anIter (aName); anIter.More(); anIter.Next())
{
const Handle(AIS_InteractiveObject)& anIO = anIter.Current();
const Handle(Prs3d_Drawer)& aDrawer = anIO->Attributes();
Handle(Prs3d_ShadingAspect) aShadingAspect = aDrawer->ShadingAspect();
Handle(Graphic3d_AspectFillArea3d) aFillAspect = aShadingAspect->Aspect();
- aFillAspect->SetInteriorStyle ((Aspect_InteriorStyle )anInterStyle);
+ aFillAspect->SetInteriorStyle (anInterStyle);
+ if (anInterStyle == Aspect_IS_HATCH
+ && aFillAspect->HatchStyle().IsNull())
+ {
+ aFillAspect->SetHatchStyle (Aspect_HS_VERTICAL);
+ }
aCtx->RecomputePrsOnly (anIO, Standard_False, Standard_True);
}
}
Standard_Integer SelectionMode;
Standard_Integer Sensitivity;
+ Standard_Integer ToSetHatch;
+ Standard_Integer StdHatchStyle;
+ TCollection_AsciiString PathToHatchPattern;
+
//! Empty constructor
ViewerTest_AspectsChangeSet()
: ToSetVisibility (0),
MaxParamValue (500000),
ToSetSensitivity (0),
SelectionMode (-1),
- Sensitivity (-1) {}
+ Sensitivity (-1),
+ ToSetHatch (0),
+ StdHatchStyle (-1)
+ {}
//! @return true if no changes have been requested
Standard_Boolean IsEmpty() const
&& ToSetFreeBoundaryColor == 0
&& ToSetFreeBoundaryWidth == 0
&& ToSetMaxParamValue == 0
- && ToSetSensitivity == 0;
+ && ToSetSensitivity == 0
+ && ToSetHatch == 0;
}
//! @return true if properties are valid
std::cout << "Error: sensitivity parameter value should be positive (specified " << Sensitivity << ")\n";
isOk = Standard_False;
}
+ if (ToSetHatch == 1 && StdHatchStyle < 0 && PathToHatchPattern == "")
+ {
+ std::cout << "Error: hatch style must be specified\n";
+ isOk = Standard_False;
+ }
return isOk;
}
std::cout << "Error: wrong syntax at " << anArg << "\n";
return 1;
}
-
- TCollection_AsciiString aValue (theArgVec[anArgIter]);
- aValue.LowerCase();
-
- if (aValue.IsEqual ("solid"))
- {
- aChangeSet->TypeOfLine = Aspect_TOL_SOLID;
- }
- else if (aValue.IsEqual ("dot"))
- {
- aChangeSet->TypeOfLine = Aspect_TOL_DOT;
- }
- else if (aValue.IsEqual ("dash"))
- {
- aChangeSet->TypeOfLine = Aspect_TOL_DASH;
- }
- else if (aValue.IsEqual ("dotdash"))
- {
- aChangeSet->TypeOfLine = Aspect_TOL_DOTDASH;
- }
- else
+ if (!ViewerTest::ParseLineType (theArgVec[anArgIter], aChangeSet->TypeOfLine))
{
std::cout << "Error: wrong syntax at " << anArg << "\n";
return 1;
aChangeSet->FreeBoundaryColor = DEFAULT_FREEBOUNDARY_COLOR;
aChangeSet->ToSetFreeBoundaryWidth = -1;
aChangeSet->FreeBoundaryWidth = 1.0;
+ aChangeSet->ToSetHatch = -1;
+ aChangeSet->StdHatchStyle = -1;
+ aChangeSet->PathToHatchPattern.Clear();
}
else if (anArg == "-isoontriangulation"
|| anArg == "-isoontriang")
aChangeSet->SelectionMode = Draw::Atoi (theArgVec[++anArgIter]);
aChangeSet->Sensitivity = Draw::Atoi (theArgVec[++anArgIter]);
}
+ else if (anArg == "-sethatch")
+ {
+ if (isDefaults)
+ {
+ std::cout << "Error: wrong syntax. -setHatch can not be used together with -defaults call!\n";
+ return 1;
+ }
+
+ if (aNames.IsEmpty())
+ {
+ std::cout << "Error: object should be specified explicitly when -setHatch is used!\n";
+ return 1;
+ }
+
+ aChangeSet->ToSetHatch = 1;
+ TCollection_AsciiString anArgHatch (theArgVec[++anArgIter]);
+ if (anArgHatch.Length() <= 2)
+ {
+ const Standard_Integer anIntStyle = Draw::Atoi (anArgHatch.ToCString());
+ if (anIntStyle < 0
+ || anIntStyle >= Aspect_HS_NB)
+ {
+ std::cout << "Error: hatch style is out of range [0, " << (Aspect_HS_NB - 1) << "]!\n";
+ return 1;
+ }
+ aChangeSet->StdHatchStyle = anIntStyle;
+ }
+ else
+ {
+ aChangeSet->PathToHatchPattern = anArgHatch;
+ }
+ }
else
{
std::cout << "Error: wrong syntax at " << anArg << "\n";
isFirst = Standard_False;
}
- if (aCtx->HasOpenedContext())
- {
- aCtx->CloseLocalContext();
- }
-
// special case for -defaults parameter.
// all changed values will be set to DefaultDrawer.
if (isDefaults)
{
aDrawer->SetMaximalParameterValue (aChangeSet->MaxParamValue);
}
+ if (aChangeSet->ToSetHatch != 0)
+ {
+ if (!aDrawer->HasOwnShadingAspect())
+ {
+ aDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
+ *aDrawer->ShadingAspect()->Aspect() = *aCtx->DefaultDrawer()->ShadingAspect()->Aspect();
+ }
+
+ Handle(Graphic3d_AspectFillArea3d) anAsp = aDrawer->ShadingAspect()->Aspect();
+ if (aChangeSet->ToSetHatch == -1)
+ {
+ anAsp->SetInteriorStyle (Aspect_IS_SOLID);
+ }
+ else
+ {
+ anAsp->SetInteriorStyle (Aspect_IS_HATCH);
+ if (!aChangeSet->PathToHatchPattern.IsEmpty())
+ {
+ Handle(Image_AlienPixMap) anImage = new Image_AlienPixMap();
+ if (anImage->Load (TCollection_AsciiString (aChangeSet->PathToHatchPattern.ToCString())))
+ {
+ anAsp->SetHatchStyle (new Graphic3d_HatchStyle (anImage));
+ }
+ else
+ {
+ std::cout << "Error: cannot load the following image: " << aChangeSet->PathToHatchPattern << std::endl;
+ return 1;
+ }
+ }
+ else if (aChangeSet->StdHatchStyle != -1)
+ {
+ anAsp->SetHatchStyle (new Graphic3d_HatchStyle ((Aspect_HatchStyle)aChangeSet->StdHatchStyle));
+ }
+ }
+ toRedisplay = Standard_True;
+ }
}
for (aChangesIter.Next(); aChangesIter.More(); aChangesIter.Next())
return 1;
}
+ Standard_DISABLE_DEPRECATION_WARNINGS
if (aCtx->HasOpenedContext())
{
aCtx->CloseLocalContext();
}
+ Standard_ENABLE_DEPRECATION_WARNINGS
Standard_Integer anArgIter = 1;
for (; anArgIter < theArgNb; ++anArgIter)
return 1;
}
+ Standard_DISABLE_DEPRECATION_WARNINGS
if (toRemoveLocal && !aCtx->HasOpenedContext())
{
std::cerr << "Error: local selection context is not open.\n";
{
aCtx->CloseAllContexts (Standard_False);
}
+ Standard_ENABLE_DEPRECATION_WARNINGS
NCollection_List<TCollection_AsciiString> anIONameList;
if (toRemoveAll)
// Close local context if it is empty
TColStd_MapOfTransient aLocalIO;
+ Standard_DISABLE_DEPRECATION_WARNINGS
if (aCtx->HasOpenedContext()
&& !aCtx->LocalContext()->DisplayedObjects (aLocalIO))
{
aCtx->CloseAllContexts (Standard_False);
}
+ Standard_ENABLE_DEPRECATION_WARNINGS
return 0;
}
return 1;
}
+ Standard_DISABLE_DEPRECATION_WARNINGS
if (toEraseLocal && !aCtx->HasOpenedContext())
{
std::cerr << "Error: local selection context is not open.\n";
{
aCtx->CloseAllContexts (Standard_False);
}
+ Standard_ENABLE_DEPRECATION_WARNINGS
if (!aNamesOfEraseIO.IsEmpty())
{
return 1;
}
+ Standard_DISABLE_DEPRECATION_WARNINGS
if (toDisplayLocal && !aCtx->HasOpenedContext())
{
std::cerr << "Error: local selection context is not open.\n";
{
aCtx->CloseLocalContext (Standard_False);
}
+ Standard_ENABLE_DEPRECATION_WARNINGS
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anIter (GetMapOfAIS());
anIter.More(); anIter.Next())
const Standard_Integer theDispMode,
const TCollection_AsciiString& theName,
const ViewerTest_BndAction theAction,
- const Handle(Graphic3d_HighlightStyle)& theStyle)
+ const Handle(Prs3d_Drawer)& theStyle)
{
switch (theAction)
{
case BndAction_Hide:
{
- theMgr->Unhighlight (theObj, theDispMode);
+ theMgr->Unhighlight (theObj);
break;
}
case BndAction_Show:
ViewerTest_BndAction anAction = BndAction_Show;
Standard_Integer aMode = -1;
- Handle(Graphic3d_HighlightStyle) aStyle;
+ Handle(Prs3d_Drawer) aStyle;
Standard_Integer anArgIter = 1;
for (; anArgIter < theArgNb; ++anArgIter)
}
if (anAction == BndAction_Show)
- aStyle = new Graphic3d_HighlightStyle (Aspect_TOHM_BOUNDBOX, Quantity_NOC_GRAY99, 0.0);
+ {
+ aStyle = new Prs3d_Drawer();
+ aStyle->SetMethod (Aspect_TOHM_BOUNDBOX);
+ aStyle->SetColor (Quantity_NOC_GRAY99);
+ }
Standard_Integer aHighlightedMode = -1;
if (anArgIter < theArgNb)
anAISContext->SetDisplayMode (aTexturedIO, AIS_Shaded, Standard_False);
if (aPreviousMode == 3)
{
- anAISContext->RecomputePrsOnly (aTexturedIO);
+ anAISContext->RecomputePrsOnly (aTexturedIO, Standard_False);
}
anAISContext->Display (aTexturedIO, Standard_True);
if (aTexturedIO->DisplayMode() == 3 || aPreviousMode == 3)
{
- anAISContext->RecomputePrsOnly (aTexturedIO);
+ anAISContext->RecomputePrsOnly (aTexturedIO, Standard_True);
}
else
{
}
// Prepare context for display
+ Standard_DISABLE_DEPRECATION_WARNINGS
if (toDisplayLocal && !aCtx->HasOpenedContext())
{
aCtx->OpenLocalContext (Standard_False);
{
aCtx->CloseAllContexts (Standard_False);
}
+ Standard_ENABLE_DEPRECATION_WARNINGS
// Display interactive objects
for (Standard_Integer anIter = 1; anIter <= aNamesOfDisplayIO.Length(); ++anIter)
if (aSelMode == -1)
{
- aCtx->Erase (aShape);
+ aCtx->Erase (aShape, Standard_False);
}
aCtx->Display (aShape, aDispMode, aSelMode,
Standard_False, aShape->AcceptShapeDecomposition(),
return 0;
}
-//==============================================================================
-//function : VPerf
-//purpose : Test the annimation of an object along a
-// predifined trajectory
-//Draw arg : vperf ShapeName 1/0(Transfo/Location) 1/0(Primitives sensibles ON/OFF)
-//==============================================================================
-
-static int VPerf(Draw_Interpretor& di, Standard_Integer , const char** argv) {
-
- OSD_Timer myTimer;
- if (TheAISContext()->HasOpenedContext())
- TheAISContext()->CloseLocalContext();
-
- Standard_Real Step=4*M_PI/180;
- Standard_Real Angle=0;
-
- Handle(AIS_InteractiveObject) aIO;
- if (GetMapOfAIS().IsBound2(argv[1]))
- aIO = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(argv[1]));
- if (aIO.IsNull())
- return 1;
-
- Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(aIO);
-
- myTimer.Start();
-
- if (Draw::Atoi(argv[3])==1 ) {
- di<<" Primitives sensibles OFF\n";
- TheAISContext()->Deactivate(aIO);
- }
- else {
- di<<" Primitives sensibles ON\n";
- }
- // Movement par transformation
- if(Draw::Atoi(argv[2]) ==1) {
- di<<" Calcul par Transformation\n";
- for (Standard_Real myAngle=0;Angle<10*2*M_PI; myAngle++) {
-
- Angle=Step*myAngle;
- gp_Trsf myTransfo;
- myTransfo.SetRotation(gp_Ax1(gp_Pnt(0,0,0),gp_Dir(0,0,1) ) ,Angle );
- TheAISContext()->SetLocation(aShape,myTransfo);
- TheAISContext() ->UpdateCurrentViewer();
-
- }
- }
- else {
- di<<" Calcul par Locations\n";
- gp_Trsf myAngleTrsf;
- myAngleTrsf.SetRotation(gp_Ax1(gp_Pnt(0,0,0),gp_Dir(0,0,1) ), Step );
- TopLoc_Location myDeltaAngle (myAngleTrsf);
- TopLoc_Location myTrueLoc;
-
- for (Standard_Real myAngle=0;Angle<10*2*M_PI; myAngle++) {
-
- Angle=Step*myAngle;
- myTrueLoc=myTrueLoc*myDeltaAngle;
- TheAISContext()->SetLocation(aShape,myTrueLoc );
- TheAISContext() ->UpdateCurrentViewer();
- }
- }
- if (Draw::Atoi(argv[3])==1 ){
- // On reactive la selection des primitives sensibles
- TheAISContext()->Activate(aIO,0);
- }
- a3DView() -> Redraw();
- myTimer.Stop();
- di<<" Temps ecoule \n";
- myTimer.Show();
- return 0;
-}
-
-
-//==================================================================================
-// Function : VAnimation
-//==================================================================================
-static int VAnimation (Draw_Interpretor& di, Standard_Integer argc, const char** argv) {
- if (argc != 5) {
- di<<"Use: "<<argv[0]<<" CrankArmFile CylinderHeadFile PropellerFile EngineBlockFile\n";
- return 1;
- }
-
- Standard_Real thread = 4;
- Standard_Real angleA=0;
- Standard_Real angleB;
- Standard_Real X;
- gp_Ax1 Ax1(gp_Pnt(0,0,0),gp_Vec(0,0,1));
-
- BRep_Builder B;
- TopoDS_Shape CrankArm;
- TopoDS_Shape CylinderHead;
- TopoDS_Shape Propeller;
- TopoDS_Shape EngineBlock;
-
- //BRepTools::Read(CrankArm,"/dp_26/Indus/ege/assemblage/CrankArm.rle",B);
- //BRepTools::Read(CylinderHead,"/dp_26/Indus/ege/assemblage/CylinderHead.rle",B);
- //BRepTools::Read(Propeller,"/dp_26/Indus/ege/assemblage/Propeller.rle",B);
- //BRepTools::Read(EngineBlock,"/dp_26/Indus/ege/assemblage/EngineBlock.rle",B);
- BRepTools::Read(CrankArm,argv[1],B);
- BRepTools::Read(CylinderHead,argv[2],B);
- BRepTools::Read(Propeller,argv[3],B);
- BRepTools::Read(EngineBlock,argv[4],B);
-
- if (CrankArm.IsNull() || CylinderHead.IsNull() || Propeller.IsNull() || EngineBlock.IsNull()) {di<<" Syntaxe error:loading failure.\n";}
-
-
- OSD_Timer myTimer;
- myTimer.Start();
-
- Handle(AIS_Shape) myAisCylinderHead = new AIS_Shape (CylinderHead);
- Handle(AIS_Shape) myAisEngineBlock = new AIS_Shape (EngineBlock);
- Handle(AIS_Shape) myAisCrankArm = new AIS_Shape (CrankArm);
- Handle(AIS_Shape) myAisPropeller = new AIS_Shape (Propeller);
-
- GetMapOfAIS().Bind(myAisCylinderHead,"a");
- GetMapOfAIS().Bind(myAisEngineBlock,"b");
- GetMapOfAIS().Bind(myAisCrankArm,"c");
- GetMapOfAIS().Bind(myAisPropeller,"d");
-
- myAisCylinderHead->SetMutable (Standard_True);
- myAisEngineBlock ->SetMutable (Standard_True);
- myAisCrankArm ->SetMutable (Standard_True);
- myAisPropeller ->SetMutable (Standard_True);
-
- TheAISContext()->SetColor (myAisCylinderHead, Quantity_NOC_INDIANRED);
- TheAISContext()->SetColor (myAisEngineBlock, Quantity_NOC_RED);
- TheAISContext()->SetColor (myAisPropeller, Quantity_NOC_GREEN);
-
- TheAISContext()->Display (myAisCylinderHead, Standard_False);
- TheAISContext()->Display (myAisEngineBlock, Standard_False);
- TheAISContext()->Display (myAisCrankArm, Standard_False);
- TheAISContext()->Display (myAisPropeller, Standard_False);
-
- TheAISContext()->Deactivate(myAisCylinderHead);
- TheAISContext()->Deactivate(myAisEngineBlock );
- TheAISContext()->Deactivate(myAisCrankArm );
- TheAISContext()->Deactivate(myAisPropeller );
-
- // Boucle de mouvement
- for (Standard_Real myAngle = 0;angleA<2*M_PI*10.175 ;myAngle++) {
-
- angleA = thread*myAngle*M_PI/180;
- X = Sin(angleA)*3/8;
- angleB = atan(X / Sqrt(-X * X + 1));
- Standard_Real decal(25*0.6);
-
-
- //Build a transformation on the display
- gp_Trsf aPropellerTrsf;
- aPropellerTrsf.SetRotation(Ax1,angleA);
- TheAISContext()->SetLocation(myAisPropeller,aPropellerTrsf);
-
- gp_Ax3 base(gp_Pnt(3*decal*(1-Cos(angleA)),-3*decal*Sin(angleA),0),gp_Vec(0,0,1),gp_Vec(1,0,0));
- gp_Trsf aCrankArmTrsf;
- aCrankArmTrsf.SetTransformation( base.Rotated(gp_Ax1(gp_Pnt(3*decal,0,0),gp_Dir(0,0,1)),angleB));
- TheAISContext()->SetLocation(myAisCrankArm,aCrankArmTrsf);
-
- TheAISContext()->UpdateCurrentViewer();
- }
-
- TopoDS_Shape myNewCrankArm =myAisCrankArm ->Shape().Located( myAisCrankArm ->Transformation() );
- TopoDS_Shape myNewPropeller =myAisPropeller->Shape().Located( myAisPropeller->Transformation() );
-
- myAisCrankArm ->ResetTransformation();
- myAisPropeller->ResetTransformation();
-
- myAisCrankArm -> Set(myNewCrankArm );
- myAisPropeller -> Set(myNewPropeller);
-
- TheAISContext()->Activate(myAisCylinderHead,0);
- TheAISContext()->Activate(myAisEngineBlock,0 );
- TheAISContext()->Activate(myAisCrankArm ,0 );
- TheAISContext()->Activate(myAisPropeller ,0 );
-
- myTimer.Stop();
- myTimer.Show();
- myTimer.Start();
-
- TheAISContext()->Redisplay(myAisCrankArm ,Standard_False);
- TheAISContext()->Redisplay(myAisPropeller,Standard_False);
-
- TheAISContext()->UpdateCurrentViewer();
- a3DView()->Redraw();
-
- myTimer.Stop();
- myTimer.Show();
-
- return 0;
-
-}
-
//==============================================================================
//function : VShading
//purpose : Sharpen or roughten the quality of the shading
// Verifications
const Standard_Boolean HaveToSet = (strcasecmp(argv[0],"vsetshading") == 0);
-
- if (TheAISContext()->HasOpenedContext())
- TheAISContext()->CloseLocalContext();
-
if (argc < 3) {
myDevCoef = 0.0008;
} else {
else
TheAISContext()->SetDeviationCoefficient(TheAisIO,0.0008,Standard_True);
- TheAISContext()->Redisplay(TheAisIO);
+ TheAISContext()->Redisplay (TheAisIO, Standard_True);
return 0;
}
//==============================================================================
if (argc<2||argc>3) { di<<" Syntaxe error\n";return 1;}
ThereIsName = (argc == 3);
}
- else {
+ else
+ {
+ Standard_DISABLE_DEPRECATION_WARNINGS
// vunsetam
if (argc>1) {di<<" Syntaxe error\n";return 1;}
else {
di<<" R.A.Z de tous les modes de selecion\n";
di<<" Fermeture du Context local\n";
if (TheAISContext()->HasOpenedContext())
+ {
TheAISContext()->CloseLocalContext();
+ }
}
+ Standard_ENABLE_DEPRECATION_WARNINGS
}
// IL n'y a aps de nom de shape passe en argument
}
}
+ Standard_DISABLE_DEPRECATION_WARNINGS
TheAISContext()->OpenLocalContext(Standard_False);
+ Standard_ENABLE_DEPRECATION_WARNINGS
ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName
it (GetMapOfAIS());
while(it.More()){
}
if( !TheAISContext()->HasOpenedContext() ) {
+ Standard_DISABLE_DEPRECATION_WARNINGS
TheAISContext()->OpenLocalContext(Standard_False);
+ Standard_ENABLE_DEPRECATION_WARNINGS
// On charge tous les objets de la map
ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it (GetMapOfAIS());
while(it.More()){
if (toPrintEntities)
{
theDI << "Detected entities:\n";
+ Standard_DISABLE_DEPRECATION_WARNINGS
Handle(StdSelect_ViewerSelector3d) aSelector = aCtx->HasOpenedContext() ? aCtx->LocalSelector() : aCtx->MainSelector();
+ Standard_ENABLE_DEPRECATION_WARNINGS
SelectMgr_SelectingVolumeManager aMgr = aSelector->GetManager();
for (Standard_Integer aPickIter = 1; aPickIter <= aSelector->NbPicked(); ++aPickIter)
{
}
NCollection_Map<Handle(AIS_InteractiveObject)> aDetected;
+ Standard_DISABLE_DEPRECATION_WARNINGS
for (aCtx->InitDetected(); aCtx->MoreDetected(); aCtx->NextDetected())
{
aDetected.Add (aCtx->DetectedCurrentObject());
}
+ Standard_ENABLE_DEPRECATION_WARNINGS
const Standard_Boolean toShowAll = (theArgNb >= 2 && *theArgVec[1] == '*');
if (theArgNb >= 2
theDI << "\n";
}
printLocalSelectionInfo (aCtx, theDI);
+ Standard_DISABLE_DEPRECATION_WARNINGS
if (aCtx->HasOpenedContext())
printLocalSelectionInfo (aCtx->LocalContext(), theDI);
+ Standard_ENABLE_DEPRECATION_WARNINGS
return 0;
}
const Standard_Integer MaxPick)
{
Handle(AIS_InteractiveObject) IO;
+ Standard_DISABLE_DEPRECATION_WARNINGS
Standard_Integer curindex = (TheType == AIS_KOI_None) ? 0 : TheAISContext()->OpenLocalContext();
+ Standard_ENABLE_DEPRECATION_WARNINGS
// step 1: prepare the data
if(curindex !=0){
arr->SetValue(i,IO2);
}
-
- if(curindex>0)
+ Standard_DISABLE_DEPRECATION_WARNINGS
+ if (curindex > 0)
+ {
TheAISContext()->CloseLocalContext(curindex);
+ }
+ Standard_ENABLE_DEPRECATION_WARNINGS
return Standard_True;
}
const Standard_Integer MaxPick)
{
Handle(AIS_InteractiveObject) IO;
+ Standard_DISABLE_DEPRECATION_WARNINGS
Standard_Integer curindex = (TheType == AIS_KOI_None) ? 0 : TheAISContext()->OpenLocalContext();
+ Standard_ENABLE_DEPRECATION_WARNINGS
// step 1: prepare the data
IO = TheAISContext()->SelectedInteractive();
}
- if(curindex!=0)
+ Standard_DISABLE_DEPRECATION_WARNINGS
+ if (curindex != 0)
+ {
TheAISContext()->CloseLocalContext(curindex);
+ }
+ Standard_ENABLE_DEPRECATION_WARNINGS
return IO;
}
{
// step 1: prepare the data
-
+ Standard_DISABLE_DEPRECATION_WARNINGS
Standard_Integer curindex = TheAISContext()->OpenLocalContext();
+ Standard_ENABLE_DEPRECATION_WARNINGS
TopoDS_Shape result;
if(TheType==TopAbs_SHAPE){
else{
Handle(StdSelect_ShapeTypeFilter) TF = new StdSelect_ShapeTypeFilter(TheType);
TheAISContext()->AddFilter(TF);
+ Standard_DISABLE_DEPRECATION_WARNINGS
TheAISContext()->ActivateStandardMode(TheType);
-
+ Standard_ENABLE_DEPRECATION_WARNINGS
}
}
}
- if(curindex>0)
+ Standard_DISABLE_DEPRECATION_WARNINGS
+ if (curindex > 0)
+ {
TheAISContext()->CloseLocalContext(curindex);
+ }
+ Standard_ENABLE_DEPRECATION_WARNINGS
return result;
}
cout<<" WARNING : Pick with Shift+ MB1 for Selection of more than 1 object\n";
// step 1: prepare the data
+ Standard_DISABLE_DEPRECATION_WARNINGS
Standard_Integer curindex = TheAISContext()->OpenLocalContext();
+ Standard_ENABLE_DEPRECATION_WARNINGS
if(TheType==TopAbs_SHAPE){
Handle(AIS_TypeFilter) F1 = new AIS_TypeFilter(AIS_KOI_Shape);
TheAISContext()->AddFilter(F1);
else{
Handle(StdSelect_ShapeTypeFilter) TF = new StdSelect_ShapeTypeFilter(TheType);
TheAISContext()->AddFilter(TF);
+ Standard_DISABLE_DEPRECATION_WARNINGS
TheAISContext()->ActivateStandardMode(TheType);
-
+ Standard_ENABLE_DEPRECATION_WARNINGS
}
// step 2 : wait for the selection...
}
}
+ Standard_DISABLE_DEPRECATION_WARNINGS
TheAISContext()->CloseLocalContext(curindex);
+ Standard_ENABLE_DEPRECATION_WARNINGS
return Standard_True;
}
Handle(AIS_Shape) newsh = new AIS_Shape(PickSh);
GetMapOfAIS().Bind(newsh, name);
- TheAISContext()->Display(newsh);
+ TheAISContext()->Display (newsh, Standard_True);
di<<"Nom de la shape pickee : "<<name.ToCString()<<"\n";
}
Handle(AIS_Shape) newsh = new AIS_Shape(PickSh);
GetMapOfAIS().Bind(newsh, name);
di<<"display of picke shape #"<<i<<" - nom : "<<name.ToCString()<<"\n";
- TheAISContext()->Display(newsh);
+ TheAISContext()->Display (newsh, Standard_False);
}
+ TheAISContext()->UpdateCurrentViewer();
}
}
return 0;
Handle(AIS_Shape) aNewShape = new AIS_Shape (aShape);
GetMapOfAIS().Bind (aNewShape, aCurrentName);
- TheAISContext()->Display (aNewShape);
+ TheAISContext()->Display (aNewShape, Standard_False);
}
+ TheAISContext()->UpdateCurrentViewer();
+
return 0;
}
DBRep::Set(a[1], shape);
Handle(AIS_InteractiveContext) Ctx = ViewerTest::GetAISContext();
Handle(AIS_Shape) ais = new AIS_Shape(shape);
- Ctx->Display(ais);
+ Ctx->Display (ais, Standard_True);
return 0;
}
}
// Prepare context
+ Standard_DISABLE_DEPRECATION_WARNINGS
if (isLocal && !aCtx->HasOpenedContext())
{
aCtx->OpenLocalContext (Standard_False);
{
aCtx->CloseAllContexts (Standard_False);
}
+ Standard_ENABLE_DEPRECATION_WARNINGS
// Load selection of interactive objects
for (Standard_Integer anIter = 1; anIter <= aNamesOfIO.Length(); ++anIter)
"\n\t\t: [-isoontriangulation 0|1]"
"\n\t\t: [-setMaxParamValue {value}]"
"\n\t\t: [-setSensitivity {selection_mode} {value}]"
+ "\n\t\t: [-setHatch HatchStyle]"
"\n\t\t: Manage presentation properties of all, selected or named objects."
"\n\t\t: When -subshapes is specified than following properties will be"
"\n\t\t: assigned to specified sub-shapes."
"vsensera : erase active entities",
__FILE__,VClearSensi,group);
- theCommands.Add("vperf",
- "vperf: vperf ShapeName 1/0(Transfo/Location) 1/0(Primitives sensibles ON/OFF)"
- "\n\t\t: Tests the animation of an object along a predefined trajectory.",
- __FILE__,VPerf,group);
-
- theCommands.Add("vanimation",
- "vanimation CrankArmFile CylinderHeadFile PropellerFile EngineBlockFile",
- __FILE__,VAnimation,group);
-
theCommands.Add("vsetshading",
"vsetshading : vsetshading name Quality(default=0.0008) "
"\n\t\t: Sets deflection coefficient that defines the quality of the shape representation in the shading mode.",