return Standard_False;
}
- //! Find1
+ //! Find the Key1 and return Key2 value.
+ //! Raises an exception if Key1 was not bound.
const TheKey2Type& Find1(const TheKey1Type& theKey1) const
{
Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_DoubleMap::Find1");
throw Standard_NoSuchObject("NCollection_DoubleMap::Find1");
}
- //! Find2
+ //! Find the Key1 and return Key2 value (by copying its value).
+ //! @param [in] theKey1 Key1 to find
+ //! @param [out] theKey2 Key2 to return
+ //! @return TRUE if Key1 has been found
+ Standard_Boolean Find1 (const TheKey1Type& theKey1,
+ TheKey2Type& theKey2) const
+ {
+ for (DoubleMapNode* aNode1 = !IsEmpty() ? (DoubleMapNode* )myData1[Hasher1::HashCode (theKey1, NbBuckets())] : NULL;
+ aNode1 != NULL; aNode1 = (DoubleMapNode* )aNode1->Next())
+ {
+ if (Hasher1::IsEqual (aNode1->Key1(), theKey1))
+ {
+ theKey2 = aNode1->Key2();
+ return Standard_True;
+ }
+ }
+ return Standard_False;
+ }
+
+ //! Find the Key2 and return Key1 value.
+ //! Raises an exception if Key2 was not bound.
const TheKey1Type& Find2(const TheKey2Type& theKey2) const
{
Standard_NoSuchObject_Raise_if (IsEmpty(), "NCollection_DoubleMap::Find2");
throw Standard_NoSuchObject("NCollection_DoubleMap::Find2");
}
+ //! Find the Key2 and return Key1 value (by copying its value).
+ //! @param [in] theKey2 Key2 to find
+ //! @param [out] theKey1 Key1 to return
+ //! @return TRUE if Key2 has been found
+ Standard_Boolean Find2 (const TheKey2Type& theKey2,
+ TheKey1Type& theKey1) const
+ {
+ for (DoubleMapNode* aNode2 = !IsEmpty() ? (DoubleMapNode* )myData2[Hasher2::HashCode (theKey2, NbBuckets())] : NULL;
+ aNode2 != NULL; aNode2 = (DoubleMapNode* )aNode2->Next2())
+ {
+ if (Hasher2::IsEqual (aNode2->Key2(), theKey2))
+ {
+ theKey1 = aNode2->Key1();
+ return Standard_True;
+ }
+ }
+ return Standard_False;
+ }
+
//! Clear data. If doReleaseMemory is false then the table of
//! buckets is not released and will be reused.
void Clear(const Standard_Boolean doReleaseMemory = Standard_True)
Standard_Boolean IsBound = GetMapOfAIS().IsBound2(name);
if (IsBound) {
// on recupere la shape dans la map des objets displayes
- Handle(AIS_InteractiveObject) aShape =
- Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
+ Handle(AIS_InteractiveObject) aShape = GetMapOfAIS().Find2(name);
// On verifie que l'AIS InteraciveObject est bien
// un AIS_PlaneTrihedron
Handle(AIS_InteractiveObject) AISObj;
Standard_Integer SelectMode = Draw::Atoi(argv[2]);
-
- if(!aMap.IsBound2(aName)) {
+ if (!aMap.Find2 (aName, AISObj)
+ || AISObj.IsNull())
+ {
di << "Use 'vdisplay' before\n";
return 1;
- } else {
- AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap.Find2(aName));
- if(AISObj.IsNull()){
- di << argv[1] << " : No interactive object\n";
- return 1;
- }
- aContext->Erase(AISObj, updateviewer);
- aContext->UpdateCurrentViewer();
- aContext->SetAutoActivateSelection (Standard_False);
- aContext->Display(AISObj, updateviewer);
- aContext->Activate (AISObj, SelectMode);
- aContext->UpdateCurrentViewer();
}
+
+ aContext->Erase(AISObj, updateviewer);
+ aContext->UpdateCurrentViewer();
+ aContext->SetAutoActivateSelection (Standard_False);
+ aContext->Display(AISObj, updateviewer);
+ aContext->Activate (AISObj, SelectMode);
+ aContext->UpdateCurrentViewer();
return 0;
}
TCollection_AsciiString aName(argv[1]);
Handle(AIS_InteractiveObject) AISObj;
-
- if(!aMap.IsBound2(aName)) {
+ if (!aMap.Find2(aName, AISObj)
+ || AISObj.IsNull())
+ {
di << "Use 'vdisplay' before\n";
return 1;
- } else {
- AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap.Find2(aName));
- if(AISObj.IsNull()){
- di << argv[1] << " : No interactive object\n";
- return 1;
- }
- TColStd_ListOfInteger anActivatedModes;
- aContext->ActivatedModes (AISObj, anActivatedModes);
- Standard_Integer aMode = anActivatedModes.IsEmpty() ? -1 : anActivatedModes.Last();
- di << aMode << "\n";
}
+ TColStd_ListOfInteger anActivatedModes;
+ aContext->ActivatedModes (AISObj, anActivatedModes);
+ Standard_Integer aMode = anActivatedModes.IsEmpty() ? -1 : anActivatedModes.Last();
+ di << aMode << "\n";
return 0;
}
TCollection_AsciiString aName(argv[1]);
Handle(AIS_InteractiveObject) AISObj;
- if(!aMap.IsBound2(aName)) {
+ if (!aMap.Find2 (aName, AISObj)
+ || AISObj.IsNull())
+ {
di << "Use 'vdisplay' before\n";
return 1;
- } else {
- AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap.Find2(aName));
- if(AISObj.IsNull()){
- di << argv[1] << " : No interactive object\n";
- return 1;
- }
- AISObj->ResetTransformation();
-
- aContext->Erase(AISObj, updateviewer);
- aContext->UpdateCurrentViewer();
- aContext->Display(AISObj, updateviewer);
- aContext->UpdateCurrentViewer();
}
+
+ AISObj->ResetTransformation();
+
+ aContext->Erase(AISObj, updateviewer);
+ aContext->UpdateCurrentViewer();
+ aContext->Display(AISObj, updateviewer);
+ aContext->UpdateCurrentViewer();
return 0;
}
Standard_Boolean IsBound = GetMapOfAIS().IsBound2(name);
if (IsBound) {
// on recupere la shape dans la map des objets displayes
- Handle(AIS_InteractiveObject) aShape = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
+ Handle(AIS_InteractiveObject) aShape = GetMapOfAIS().Find2(name);
// On verifie que l'AIS InteraciveObject est bien
// un AIS_PlaneTrihedron
return 0;
}
-#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
-#include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
-#include <SelectMgr_Selection.hxx>
-#include <StdSelect_BRepOwner.hxx>
-#include <SelectBasics_SensitiveEntity.hxx>
-#if ! defined(_WIN32)
-extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
-#else
-Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
-#endif
-
-static Standard_Integer OCC137 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
- if(aContext.IsNull()) {
- di << argv[0] << "ERROR : use 'vinit' command before \n";
- return 1;
- }
- if ( argc < 2 || argc > 3) {
- di << "ERROR : Usage : " << argv[0] << " highlight_mode [shape]\n";
- return 1;
- }
-
- ViewerTest_DoubleMapOfInteractiveAndName aMap ;
- if(argc != 3) {
- aMap.Assign(GetMapOfAIS());
- } else {
- ViewerTest_DoubleMapOfInteractiveAndName& aMap1 = GetMapOfAIS();
- TCollection_AsciiString aName(argv[2]);
- Handle(AIS_InteractiveObject) AISObj;
- if(!aMap1.IsBound2(aName)) {
- di << "Use 'vdisplay' before\n";
- return 1;
- } else {
- AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap1.Find2(aName));
- if(AISObj.IsNull()){
- di << argv[2] << " : No interactive object\n";
- return 1;
- }
- aMap.Bind(AISObj,aName);
- }
- }
- ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it(GetMapOfAIS());
- while ( it.More() ) {
- Handle(AIS_InteractiveObject) AISObj = Handle(AIS_InteractiveObject)::DownCast(it.Key1());
- AISObj->SetHilightMode(Draw::Atoi(argv[1]));
- if(AISObj->HasSelection(4)) {
- //Handle(SelectMgr_Selection)& aSelection = AISObj->Selection(4);
- const Handle(SelectMgr_Selection)& aSelection = AISObj->Selection(4);
- if(!aSelection.IsNull())
- {
- for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator aSelEntIter (aSelection->Entities()); aSelEntIter.More(); aSelEntIter.Next())
- {
- Handle(StdSelect_BRepOwner) aO = Handle(StdSelect_BRepOwner)::DownCast(aSelEntIter.Value()->BaseSensitive()->OwnerId());
- aO->SetHilightMode(Draw::Atoi(argv[1]));
- }
- }
- }
- it.Next();
- }
-
- return 0;
-}
-
#include <GccEnt_Position.hxx>
#include <Geom2dGcc_QualifiedCurve.hxx>
#include <Geom2dGcc_Circ2d2TanRad.hxx>
const char *group = "QABugs";
theCommands.Add ("BUC60857", "BUC60857", __FILE__, BUC60857, group);
- theCommands.Add("OCC137","OCC137 mode [shape]",__FILE__,OCC137,group);
theCommands.Add("OCC24303", "OCC24303 SolID ", __FILE__, OCC24303,group);
return;
return Standard_False;
}
- Handle(AIS_InteractiveObject) anOldObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (theName));
- if (!anOldObj.IsNull())
+ if (Handle(AIS_InteractiveObject) anOldObj = aMap.Find2 (theName))
{
aCtx->Remove (anOldObj, theObject.IsNull() && theToUpdate);
}
//==============================================================================
Handle(AIS_Shape) GetAISShapeFromName(const char* name)
{
- Handle(AIS_Shape) retsh;
-
- if(GetMapOfAIS().IsBound2(name)){
- const Handle(AIS_InteractiveObject) IO =
- Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
- if (!IO.IsNull()) {
- if(IO->Type()==AIS_KOI_Shape) {
- if(IO->Signature()==0){
- retsh = Handle(AIS_Shape)::DownCast (IO);
- }
- else
- cout << "an Object which is not an AIS_Shape "
- "already has this name!!!"<<endl;
- }
+ Handle(AIS_InteractiveObject) aPrs;
+ if (GetMapOfAIS().Find2 (name, aPrs)
+ && !aPrs.IsNull())
+ {
+ if (Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast (aPrs))
+ {
+ return aShapePrs;
}
- return retsh;
- }
+ std::cout << "an Object which is not an AIS_Shape already has this name!!!\n";
+ return Handle(AIS_Shape)();
+ }
- TopoDS_Shape S = GetShapeFromName(name);
- if ( !S.IsNull() ) {
- retsh = new AIS_Shape(S);
+ TopoDS_Shape aShape = GetShapeFromName (name);
+ if (!aShape.IsNull())
+ {
+ return new AIS_Shape(aShape);
}
- return retsh;
+ return Handle(AIS_Shape)();
}
NCollection_Sequence<Handle(AIS_InteractiveObject)> aListRemoved;
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anObjIter (GetMapOfAIS()); anObjIter.More(); anObjIter.Next())
{
- const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anObjIter.Key1());
+ const Handle(AIS_InteractiveObject) anObj = anObjIter.Key1();
if (anObj->GetContext() != TheAISContext())
{
continue;
Standard_Integer i;
- for (i = 1; i <= aLastInd; i++) {
+ for (i = 1; i <= aLastInd; i++)
+ {
TCollection_AsciiString name(argv[i]);
- Standard_Boolean IsBound = GetMapOfAIS().IsBound2(name);
-
- if (IsBound) {
- const Handle(Standard_Transient) anObj = GetMapOfAIS().Find2(name);
- if (anObj->IsKind(STANDARD_TYPE(AIS_InteractiveObject))) {
- const Handle(AIS_InteractiveObject) aShape =
- Handle(AIS_InteractiveObject)::DownCast (anObj);
- Handle(Prs3d_Drawer) CurDrawer = aShape->Attributes();
- Handle(Prs3d_IsoAspect) aUIso = CurDrawer->UIsoAspect();
- Handle(Prs3d_IsoAspect) aVIso = CurDrawer->VIsoAspect();
-
- if (isChanged) {
- CurDrawer->SetUIsoAspect(CopyIsoAspect(aUIso, aNbUIsos));
- CurDrawer->SetVIsoAspect(CopyIsoAspect(aVIso, aNbVIsos));
- TheAISContext()->SetLocalAttributes
- (aShape, CurDrawer, Standard_False);
- TheAISContext()->Redisplay (aShape, Standard_False);
- } else {
- di << "Number of isos for " << argv[i] << " : "
- << aUIso->Number() << " " << aVIso->Number() << "\n";
- }
- } else {
- di << argv[i] << ": Not an AIS interactive object!\n";
- }
- } else {
- di << argv[i] << ": Use 'vdisplay' before\n";
+ Handle(AIS_InteractiveObject) aShape;
+ GetMapOfAIS().Find2(name, aShape);
+ if (aShape.IsNull())
+ {
+ std::cout << "Syntax error: object '" << name << "' is not found\n";
+ return 1;
+ }
+
+ Handle(Prs3d_Drawer) CurDrawer = aShape->Attributes();
+ Handle(Prs3d_IsoAspect) aUIso = CurDrawer->UIsoAspect();
+ Handle(Prs3d_IsoAspect) aVIso = CurDrawer->VIsoAspect();
+ if (isChanged)
+ {
+ CurDrawer->SetUIsoAspect(CopyIsoAspect(aUIso, aNbUIsos));
+ CurDrawer->SetVIsoAspect(CopyIsoAspect(aVIso, aNbVIsos));
+ TheAISContext()->SetLocalAttributes (aShape, CurDrawer, Standard_False);
+ TheAISContext()->Redisplay (aShape, Standard_False);
+ }
+ else
+ {
+ di << "Number of isos for " << argv[i] << " : "
+ << aUIso->Number() << " " << aVIso->Number() << "\n";
}
}
else
{
TCollection_AsciiString aName = argv[1];
- if (GetMapOfAIS().IsBound2 (aName))
+ Handle(AIS_InteractiveObject) aPrs;
+ if (GetMapOfAIS().Find2 (aName, aPrs)
+ && !aPrs.IsNull())
{
- Handle(AIS_InteractiveObject) aPrs = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2 (aName));
- if (!aPrs.IsNull())
- {
- VwrTst_DispErase (aPrs, -1, TypeOfDispOperation_UnsetDispMode, Standard_True);
- }
+ VwrTst_DispErase (aPrs, -1, TypeOfDispOperation_UnsetDispMode, Standard_True);
}
}
}
{
Handle(AIS_InteractiveObject) aPrs;
TCollection_AsciiString aName (argv[1]);
- if (GetMapOfAIS().IsBound2 (aName))
- {
- aPrs = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2 (aName));
- }
- if (!aPrs.IsNull())
+ if (GetMapOfAIS().Find2 (aName, aPrs)
+ && !aPrs.IsNull())
{
VwrTst_DispErase (aPrs, Draw::Atoi(argv[2]), aType, Standard_True);
}
else {
Handle(AIS_InteractiveObject) IO;
TCollection_AsciiString name = argv[2];
- if(GetMapOfAIS().IsBound2(name)){
- IO = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
- if (!IO.IsNull()) {
- if(On==1)
- Ctx->SubIntensityOn(IO, Standard_True);
- else
- Ctx->SubIntensityOff(IO, Standard_True);
- }
+ if (GetMapOfAIS().Find2 (name, IO)
+ && !IO.IsNull())
+ {
+ if(On==1)
+ Ctx->SubIntensityOn(IO, Standard_True);
+ else
+ Ctx->SubIntensityOff(IO, Standard_True);
}
else return 1;
}
for (; anArgIter < theArgNb; ++anArgIter)
{
TCollection_AsciiString aName = theArgVec[anArgIter];
- if (GetMapOfAIS().IsBound2 (aName))
+ Handle(AIS_InteractiveObject) aShape;
+ if (GetMapOfAIS().Find2 (aName, aShape)
+ && !aShape.IsNull())
{
- const Handle(AIS_InteractiveObject) aShape = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aName));
- if (!aShape.IsNull())
- {
- aCtx->Display (aShape, Standard_False);
- aDispSet.Add (aShape);
- }
+ aCtx->Display (aShape, Standard_False);
+ aDispSet.Add (aShape);
}
}
}
continue;
}
- const Handle(AIS_InteractiveObject) aShape = Handle(AIS_InteractiveObject)::DownCast (anIter.Key1());
- if (!aShape.IsNull())
+ if (Handle(AIS_InteractiveObject) aShape = anIter.Key1())
{
aCtx->Erase (aShape, Standard_False);
}
for (; anArgIter < theArgNb; ++anArgIter)
{
TCollection_AsciiString aName = theArgVec[anArgIter];
- if (!GetMapOfAIS().IsBound2 (aName))
+ Handle(AIS_InteractiveObject) anIO;
+ if (!GetMapOfAIS().Find2 (aName, anIO))
{
- theDI << aName.ToCString() << " was not bound to some object.\n";
+ theDI << aName << " was not bound to some object.\n";
continue;
}
- const Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aName));
if (anIO->GetContext() != aCtx)
{
- theDI << aName.ToCString() << " was not displayed in current context.\n";
+ theDI << aName << " was not displayed in current context.\n";
theDI << "Please activate view with this object displayed and try again.\n";
continue;
}
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anIter (GetMapOfAIS());
anIter.More(); anIter.Next())
{
- const Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (anIter.Key1());
- if (!aCtx->IsSelected (anIO))
+ if (!aCtx->IsSelected (anIter.Key1()))
{
continue;
}
for (NCollection_List<TCollection_AsciiString>::Iterator anIter (anIONameList);
anIter.More(); anIter.Next())
{
- const Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (anIter.Value()));
+ const Handle(AIS_InteractiveObject) anIO = GetMapOfAIS().Find2 (anIter.Value());
aCtx->Remove (anIO, Standard_False);
if (toPrintInfo)
{
- theDI << anIter.Value().ToCString() << " was removed\n";
+ theDI << anIter.Value() << " was removed\n";
}
if (!isContextOnly)
{
for (Standard_Integer anIter = 1; anIter <= aNamesOfEraseIO.Length(); ++anIter)
{
TCollection_AsciiString aName = aNamesOfEraseIO.Value (anIter);
- if (!GetMapOfAIS().IsBound2 (aName))
+ Handle(AIS_InteractiveObject) anIO;
+ if (!GetMapOfAIS().Find2 (aName, anIO))
{
continue;
}
- const Handle(Standard_Transient) anObj = GetMapOfAIS().Find2 (aName);
- const Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (anObj);
- theDI << aName.ToCString() << " ";
+ theDI << aName << " ";
if (!anIO.IsNull())
{
if (toEraseInView)
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anIter (GetMapOfAIS());
anIter.More(); anIter.Next())
{
- const Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (anIter.Key1());
+ const Handle(AIS_InteractiveObject) anIO = anIter.Key1();
if (!anIO.IsNull()
&& aCtx->IsSelected (anIO))
{
- theDI << anIter.Key2().ToCString() << " ";
+ theDI << anIter.Key2() << " ";
if (toEraseInView)
{
aCtx->SetViewAffinity (anIO, aView, Standard_False);
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anIter (GetMapOfAIS());
anIter.More(); anIter.Next())
{
- const Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (anIter.Key1());
+ Handle(AIS_InteractiveObject) anIO = anIter.Key1();
if (!anIO.IsNull())
{
if (toEraseInView)
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anIter (GetMapOfAIS());
anIter.More(); anIter.Next())
{
- const Handle(AIS_InteractiveObject) aShape = Handle(AIS_InteractiveObject)::DownCast (anIter.Key1());
- aCtx->Erase (aShape, Standard_False);
+ aCtx->Erase (anIter.Key1(), Standard_False);
}
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anIter (GetMapOfAIS());
anIter.More(); anIter.Next())
{
- const Handle(AIS_InteractiveObject) aShape = Handle(AIS_InteractiveObject)::DownCast (anIter.Key1());
- aCtx->Display (aShape, Standard_False);
+ aCtx->Display (anIter.Key1(), Standard_False);
}
return 0;
}
for (; anArgIter < theArgNb; ++anArgIter)
{
TCollection_AsciiString aName = theArgVec[anArgIter];
- if (!GetMapOfAIS().IsBound2 (aName))
+ Handle(AIS_InteractiveObject) anIO;
+ if (!GetMapOfAIS().Find2 (aName, anIO))
{
std::cout << "Error: presentation " << aName << " does not exist\n";
return 1;
}
- Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aName));
aHighlightedMode = checkMode (aCtx, anIO, aMode);
if (aHighlightedMode == -1)
{
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anIter (GetMapOfAIS());
anIter.More(); anIter.Next())
{
- Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (anIter.Key1());
+ Handle(AIS_InteractiveObject) anIO = anIter.Key1();
aHighlightedMode = checkMode (aCtx, anIO, aMode);
if (aHighlightedMode != -1)
{
for (Standard_Integer anIter = 1; anIter <= aNamesOfDisplayIO.Length(); ++anIter)
{
const TCollection_AsciiString& aName = aNamesOfDisplayIO.Value(anIter);
-
- if (!GetMapOfAIS().IsBound2 (aName))
+ Handle(AIS_InteractiveObject) aShape;
+ if (!GetMapOfAIS().Find2 (aName, aShape))
{
// create the AIS_Shape from a name
- const Handle(AIS_InteractiveObject) aShape = GetAISShapeFromName (aName.ToCString());
+ aShape = GetAISShapeFromName (aName.ToCString());
if (!aShape.IsNull())
{
if (isMutable != -1)
continue;
}
- Handle(AIS_InteractiveObject) aShape = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aName));
if (isMutable != -1)
{
aShape->SetMutable (isMutable == 1);
return 1;
}
- const ViewerTest_DoubleMapOfInteractiveAndName& anAISMap = GetMapOfAIS();
-
AIS_ListOfInteractive aListOfIO;
-
for (int anArgIt = 1; anArgIt < theArgsNb; ++anArgIt)
{
TCollection_AsciiString aName = TCollection_AsciiString (theArgVec[anArgIt]);
Handle(AIS_InteractiveObject) anAISObj;
- if (anAISMap.IsBound2 (aName))
- {
- anAISObj = Handle(AIS_InteractiveObject)::DownCast (anAISMap.Find2 (aName));
- }
-
+ GetMapOfAIS().Find2 (aName, anAISObj);
if (anAISObj.IsNull())
{
std::cout << theArgVec[0] << ": no AIS interactive object named \"" << aName << "\".\n";
}
TCollection_AsciiString name=argv[1];
- if (GetMapOfAIS().IsBound2(name ))
- TheAisIO = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
+ GetMapOfAIS().Find2(name, TheAisIO);
if (TheAisIO.IsNull())
- TheAisIO=GetAISShapeFromName((const char *)name.ToCString());
+ TheAisIO=GetAISShapeFromName(name.ToCString());
if (HaveToSet)
TheAISContext()->SetDeviationCoefficient(TheAisIO,myDevCoef,Standard_True);
//! Auxiliary method to print Interactive Object information
static void objInfo (const NCollection_Map<Handle(AIS_InteractiveObject)>& theDetected,
- const Handle(Standard_Transient)& theObject,
+ const Handle(AIS_InteractiveObject)& theObj,
Draw_Interpretor& theDI)
{
- const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theObject);
- if (anObj.IsNull())
+ if (theObj.IsNull())
{
- theDI << theObject->DynamicType()->Name() << " is not AIS presentation\n";
+ theDI << "NULL presentation\n";
return;
}
- theDI << (TheAISContext()->IsDisplayed (anObj) ? "Displayed" : "Hidden ")
- << (TheAISContext()->IsSelected (anObj) ? " Selected" : " ")
- << (theDetected.Contains (anObj) ? " Detected" : " ")
+ theDI << (TheAISContext()->IsDisplayed (theObj) ? "Displayed" : "Hidden ")
+ << (TheAISContext()->IsSelected (theObj) ? " Selected" : " ")
+ << (theDetected.Contains (theObj) ? " Detected" : " ")
<< " Type: ";
- if (anObj->Type() == AIS_KOI_Datum)
+ if (theObj->Type() == AIS_KOI_Datum)
{
// AIS_Datum
- if (anObj->Signature() == 3) { theDI << " AIS_Trihedron"; }
- else if (anObj->Signature() == 2) { theDI << " AIS_Axis"; }
- else if (anObj->Signature() == 6) { theDI << " AIS_Circle"; }
- else if (anObj->Signature() == 5) { theDI << " AIS_Line"; }
- else if (anObj->Signature() == 7) { theDI << " AIS_Plane"; }
- else if (anObj->Signature() == 1) { theDI << " AIS_Point"; }
- else if (anObj->Signature() == 4) { theDI << " AIS_PlaneTrihedron"; }
+ if (theObj->Signature() == 3) { theDI << " AIS_Trihedron"; }
+ else if (theObj->Signature() == 2) { theDI << " AIS_Axis"; }
+ else if (theObj->Signature() == 6) { theDI << " AIS_Circle"; }
+ else if (theObj->Signature() == 5) { theDI << " AIS_Line"; }
+ else if (theObj->Signature() == 7) { theDI << " AIS_Plane"; }
+ else if (theObj->Signature() == 1) { theDI << " AIS_Point"; }
+ else if (theObj->Signature() == 4) { theDI << " AIS_PlaneTrihedron"; }
}
// AIS_Shape
- else if (anObj->Type() == AIS_KOI_Shape
- && anObj->Signature() == 0)
+ else if (theObj->Type() == AIS_KOI_Shape
+ && theObj->Signature() == 0)
{
theDI << " AIS_Shape";
}
- else if (anObj->Type() == AIS_KOI_Relation)
+ else if (theObj->Type() == AIS_KOI_Relation)
{
// AIS_Dimention and AIS_Relation
- Handle(AIS_Relation) aRelation = Handle(AIS_Relation)::DownCast (anObj);
+ Handle(AIS_Relation) aRelation = Handle(AIS_Relation)::DownCast (theObj);
switch (aRelation->KindOfDimension())
{
case AIS_KOD_PLANEANGLE: theDI << " AIS_AngleDimension"; break;
{
theDI << " UserPrs";
}
- theDI << " (" << theObject->DynamicType()->Name() << ")";
+ theDI << " (" << theObj->DynamicType()->Name() << ")";
}
//! Print information about locally selected sub-shapes
for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
{
const TCollection_AsciiString anObjName = theArgVec[anArgIter];
- if (!GetMapOfAIS().IsBound2 (anObjName))
+ Handle(AIS_InteractiveObject) anObj;
+ if (!GetMapOfAIS().Find2 (anObjName, anObj))
{
theDI << anObjName << " doesn't exist!\n";
continue;
}
- const Handle(Standard_Transient) anObjTrans = GetMapOfAIS().Find2 (anObjName);
TCollection_AsciiString aName = anObjName;
aName.LeftJustify (20, ' ');
theDI << " " << aName << " ";
- objInfo (aDetected, anObjTrans, theDI);
+ objInfo (aDetected, anObj, theDI);
theDI << "\n";
}
return 0;
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anObjIter (GetMapOfAIS());
anObjIter.More(); anObjIter.Next())
{
- Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anObjIter.Key1());
- if (anObj.IsNull())
+ if (anObjIter.Key1().IsNull())
{
continue;
}
TCollection_AsciiString aName = anObjIter.Key2();
aName.LeftJustify (20, ' ');
theDI << " " << aName << " ";
- objInfo (aDetected, anObj, theDI);
+ objInfo (aDetected, anObjIter.Key1(), theDI);
theDI << "\n";
}
printLocalSelectionInfo (aCtx, theDI);
// check viewer update mode
ViewerTest_AutoUpdater anUpdateTool (ViewerTest::GetAISContext(), ViewerTest::CurrentView());
-
for (Standard_Integer anArgIter = 1; anArgIter < theArgsNb; ++anArgIter)
{
if (anUpdateTool.parseRedrawMode (theArgVec[anArgIter]))
}
}
- TCollection_AsciiString aName (aCmd.Arg ("", 0).c_str());
-
// find object
- ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
- if (!aMap.IsBound2 (aName) )
+ TCollection_AsciiString aName (aCmd.Arg ("", 0).c_str());
+ Handle(AIS_InteractiveObject) anIObj;
+ if (!GetMapOfAIS().Find2 (aName, anIObj))
{
std::cerr << "Use 'vdisplay' before\n";
return 1;
}
- Handle(AIS_InteractiveObject) anIObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (aName));
Graphic3d_MaterialAspect aMaterial = anIObj->Attributes()->ShadingAspect()->Material();
Graphic3d_BSDF aBSDF = aMaterial.BSDF();
const TCollection_AsciiString& aName = aNamesOfIO.Value (anIter);
Handle(AIS_InteractiveObject) aShape;
- if (GetMapOfAIS().IsBound2 (aName))
- aShape = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aName));
- else
+ if (!GetMapOfAIS().Find2 (aName, aShape))
+ {
aShape = GetAISShapeFromName (aName.ToCString());
+ }
if (!aShape.IsNull())
{
Ctx->Display(ais, Standard_False);
const char *Name = "draft1";
- Standard_Boolean IsBound = GetMapOfAIS().IsBound2(Name);
- if (IsBound) {
- Handle(AIS_InteractiveObject) an_object =
- Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(Name));
- if (!an_object.IsNull()) {
- Ctx->Remove(an_object,
- Standard_True) ;
- GetMapOfAIS().UnBind2(Name) ;
+ Handle(AIS_InteractiveObject) an_object;
+ if (GetMapOfAIS().Find2(Name, an_object))
+ {
+ if (!an_object.IsNull())
+ {
+ Ctx->Remove (an_object, Standard_True);
}
+ GetMapOfAIS().UnBind2 (Name);
}
GetMapOfAIS().Bind(ais, Name);
// DBRep::Set("draft", ais->Shape());
#include <TCollection_AsciiString.hxx>
#include <NCollection_DoubleMap.hxx>
-typedef NCollection_DoubleMap<Handle(Standard_Transient),TCollection_AsciiString,TColStd_MapTransientHasher,TCollection_AsciiString> ViewerTest_DoubleMapOfInteractiveAndName;
-typedef NCollection_DoubleMap<Handle(Standard_Transient),TCollection_AsciiString,TColStd_MapTransientHasher,TCollection_AsciiString>::Iterator ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName;
-
+class AIS_InteractiveObject;
+typedef NCollection_DoubleMap<Handle(AIS_InteractiveObject),TCollection_AsciiString,TColStd_MapTransientHasher,TCollection_AsciiString> ViewerTest_DoubleMapOfInteractiveAndName;
+typedef NCollection_DoubleMap<Handle(AIS_InteractiveObject),TCollection_AsciiString,TColStd_MapTransientHasher,TCollection_AsciiString>::Iterator ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName;
#endif
NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString> aStringParams;
Handle(AIS_Trihedron) aTrihedron;
- if (GetMapOfAIS().IsBound2 (aName))
+ Handle(AIS_InteractiveObject) anObject;
+ if (GetMapOfAIS().Find2 (aName, anObject))
{
- Handle(AIS_InteractiveObject) anObject = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aName));
aTrihedron = Handle(AIS_Trihedron)::DownCast (anObject);
if (aTrihedron.IsNull())
{
while ( it.More() ) {
- Handle(AIS_InteractiveObject) aShape=
- Handle(AIS_InteractiveObject)::DownCast(it.Key1());
+ Handle(AIS_InteractiveObject) aShape = it.Key1();
if (!aShape.IsNull() && TheAISContext()->IsSelected(aShape) )
{
TCollection_AsciiString name=argv[1];
// on verifie que ce nom correspond bien a une shape
- Standard_Boolean IsBound= GetMapOfAIS().IsBound2(name);
-
- if (IsBound) {
-
- // on recupere la shape dans la map des objets displayes
- Handle(AIS_InteractiveObject) aShape =
- Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
-
+ Handle(AIS_InteractiveObject) aShape;
+ if (GetMapOfAIS().Find2(name, aShape))
+ {
// On verifie que l'AIS InteraciveObject est bien
// un AIS_Trihedron
if (!aShape.IsNull() &&
// There are some arguments
if (hasArg)
{
- if (!GetMapOfAIS().IsBound2(argv[2] ))
+ Handle(AIS_InteractiveObject) aShapeA;
+ if (!GetMapOfAIS().Find2 (argv[2], aShapeA))
{
std::cout<<"vplane: error 1st name doesn't exist in the GetMapOfAIS()\n";
return 1;
}
- // Get shape from map
- Handle(AIS_InteractiveObject) aShapeA =
- Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2(argv[2] ));
// The first argument is an AIS_Point
if (!aShapeA.IsNull() &&
aShapeA->Signature()==1)
{
// The second argument must also be an AIS_Point
- if (argc<5 || !GetMapOfAIS().IsBound2(argv[3]))
+ Handle(AIS_InteractiveObject) aShapeB;
+ if (argc<5 || !GetMapOfAIS().Find2 (argv[3], aShapeB))
{
std::cout<<"vplane: error 2nd name doesn't exist in the GetMapOfAIS()\n";
return 1;
}
- // Get shape from map
- Handle(AIS_InteractiveObject) aShapeB =
- Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2(argv[3]));
// If B is not an AIS_Point
if (aShapeB.IsNull() ||
(!(aShapeB->Type()==AIS_KOI_Datum && aShapeB->Signature()==1)))
return 1;
}
// The third object is an AIS_Point
- if (!GetMapOfAIS().IsBound2(argv[4]) )
+ Handle(AIS_InteractiveObject) aShapeC;
+ if (!GetMapOfAIS().Find2(argv[4], aShapeC))
{
std::cout<<"vplane: error 3d name doesn't exist in the GetMapOfAIS().\n";
return 1;
}
- // Get shape from map
- Handle(AIS_InteractiveObject) aShapeC =
- Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2(argv[4]));
// If C is not an AIS_Point
if (aShapeC.IsNull() ||
(!(aShapeC->Type()==AIS_KOI_Datum && aShapeC->Signature()==1)))
// Creation of a plane orthogonal to the axis through a point
else if (aShapeA->Type()==AIS_KOI_Datum && aShapeA->Signature()==2 ) {
// The second argument should be an AIS_Point
- if (argc!=4 || !GetMapOfAIS().IsBound2(argv[3] ) )
+ Handle(AIS_InteractiveObject) aShapeB;
+ if (argc!=4 || !GetMapOfAIS().Find2 (argv[3], aShapeB))
{
std::cout<<"vplane: error 2d name doesn't exist in the GetMapOfAIS()\n";
return 1;
}
- // Get shape from map
- Handle(AIS_InteractiveObject) aShapeB =
- Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2(argv[3]));
// If B is not an AIS_Point
if (aShapeB.IsNull() ||
(!(aShapeB->Type()==AIS_KOI_Datum && aShapeB->Signature()==1)))
else if (aShapeA->Type()==AIS_KOI_Datum && aShapeA->Signature()==7)
{
// The second argument should be an AIS_Point
- if (argc!=4 || !GetMapOfAIS().IsBound2(argv[3]))
+ Handle(AIS_InteractiveObject) aShapeB;
+ if (argc!=4 || !GetMapOfAIS().Find2 (argv[3], aShapeB))
{
std::cout<<"vplane: error 2d name doesn't exist in the GetMapOfAIS()\n";
return 1;
}
- // Get shape from map
- Handle(AIS_InteractiveObject) aShapeB =
- Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2(argv[3]));
// B should be an AIS_Point
if (aShapeB.IsNull() ||
(!(aShapeB->Type()==AIS_KOI_Datum && aShapeB->Signature()==1)))
// Parametres: AIS_Point AIS_Point
// ===============================
if (argc==4) {
- theShapeA=
- Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2(argv[2]));
+ GetMapOfAIS().Find2 (argv[2], theShapeA);
// On verifie que c'est bien une AIS_Point
if (!theShapeA.IsNull() &&
theShapeA->Type()==AIS_KOI_Datum && theShapeA->Signature()==1) {
// on recupere le deuxieme AIS_Point
- theShapeB=
- Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2(argv[3]));
- if (theShapeA.IsNull() ||
+ GetMapOfAIS().Find2 (argv[3], theShapeB);
+ if (theShapeB.IsNull() ||
(!(theShapeB->Type()==AIS_KOI_Datum && theShapeB->Signature()==1)))
{
di <<"vline error: wrong type of 2de argument.\n";
// and remove it from context
if (GetMapOfAIS().IsBound2(theName))
{
- Handle(Standard_Transient) anObj = GetMapOfAIS().Find2(theName);
- Handle(AIS_InteractiveObject) anInterObj =
- Handle(AIS_InteractiveObject)::DownCast(anObj);
+ Handle(AIS_InteractiveObject) anInterObj = GetMapOfAIS().Find2(theName);
TheAISContext()->Remove(anInterObj, Standard_False);
GetMapOfAIS().UnBind2(theName);
}
TCollection_AsciiString aName(argv[1]);
Standard_Boolean isFilled = Draw::Atoi(argv[5]) != 0;
- Handle(AIS_InteractiveObject) theShapeA;
- Handle(AIS_InteractiveObject) theShapeB;
-
- theShapeA =
- Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(argv[2]));
- theShapeB =
- Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(argv[3]));
-
+ Handle(AIS_InteractiveObject) theShapeA, theShapeB;
+ GetMapOfAIS().Find2 (argv[2], theShapeA);
+ GetMapOfAIS().Find2 (argv[3], theShapeB);
// Arguments: AIS_Point AIS_Point AIS_Point
// ========================================
return 1; // TCL_ERROR
}
// The third object must be a point
- Handle(AIS_InteractiveObject) theShapeC =
- Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(argv[4]));
+ Handle(AIS_InteractiveObject) theShapeC;
+ GetMapOfAIS().Find2 (argv[4], theShapeC);
if (theShapeC.IsNull() ||
theShapeC->Type()!=AIS_KOI_Datum || theShapeC->Signature()!=1 )
{
else if (anObj.IsNull())
{
const TCollection_AsciiString aName (theArgVec[anArgIter]);
- const ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
- if (aMap.IsBound2 (aName))
- {
- anObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (aName));
- }
+ GetMapOfAIS().Find2 (aName, anObj);
if (anObj.IsNull())
{
std::cout << "Error: object '" << aName << "' is not displayed!\n";
}
const TCollection_AsciiString aName2 (theArgVec[anArgIter + 1]);
- const ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
Handle(AIS_InteractiveObject) anObj2;
- if (aMap.IsBound2 (aName2))
- {
- anObj2 = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (aName2));
- }
+ GetMapOfAIS().Find2 (aName2, anObj2);
if (anObj2.IsNull())
{
std::cout << "Error: object '" << aName2 << "' is not displayed!\n";
std::cout << "vconnect error: equal names for connected objects\n";
continue;
}
- if (GetMapOfAIS().IsBound2 (anOriginObjectName))
+ if (GetMapOfAIS().Find2 (anOriginObjectName, anObject))
{
- Handle(Standard_Transient) anObj = GetMapOfAIS().Find2 (anOriginObjectName);
- anObject = Handle(AIS_InteractiveObject)::DownCast(anObj);
if (anObject.IsNull())
{
std::cout << "Object " << anOriginObjectName << " is used for non AIS viewer\n";
// Check if there is another object with given name
// and remove it from context
- if(GetMapOfAIS().IsBound2(aName))
+ Handle(AIS_InteractiveObject) anObj;
+ if (GetMapOfAIS().Find2 (aName, anObj))
{
- Handle(AIS_InteractiveObject) anObj =
- Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(aName));
TheAISContext()->Remove(anObj, Standard_False);
GetMapOfAIS().UnBind2(aName);
}
std::cout << "vconnect error: equal names for connected objects\n";
return 1; // TCL_ERROR
}
- if (GetMapOfAIS().IsBound2 (anOriginObjectName))
+ if (GetMapOfAIS().Find2 (anOriginObjectName, anOriginObject))
{
- Handle(Standard_Transient) anObj = GetMapOfAIS().Find2 (anOriginObjectName);
- anOriginObject = Handle(AIS_InteractiveObject)::DownCast(anObj);
if (anOriginObject.IsNull())
{
std::cout << "Object " << anOriginObjectName << " is used for non AIS viewer\n";
// Check if there is another object with given name
// and remove it from context
- if(GetMapOfAIS().IsBound2(aName))
+ Handle(AIS_InteractiveObject) anObj;
+ if (GetMapOfAIS().Find2 (aName, anObj))
{
- Handle(AIS_InteractiveObject) anObj =
- Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(aName));
- TheAISContext()->Remove(anObj, Standard_False);
+ TheAISContext()->Remove (anObj, Standard_False);
GetMapOfAIS().UnBind2(aName);
}
}
Handle(AIS_InteractiveObject) anIObj;
- if (!aMap.IsBound2 (anObject))
+ if (!aMap.Find2 (anObject, anIObj))
{
// try to interpret second argument as child number
if (anObjectNumber > 0 && anObjectNumber <= anAssembly->Children().Size())
}
}
- // if object was found by name
- if (anIObj.IsNull())
- {
- anIObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (anObject));
- }
-
aContext->Disconnect (anAssembly, anIObj);
aContext->UpdateCurrentViewer();
-
return 0;
}
}
Handle(AIS_InteractiveObject) anIObj;
- if (!aMap.IsBound2 (anObject))
+ if (!aMap.Find2 (anObject, anIObj))
{
std::cout << "Use 'vdisplay' before\n";
return 1;
}
- anIObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (anObject));
-
gp_Trsf aTrsf;
aTrsf.SetTranslation (gp_Vec (aX, aY, aZ));
Standard_Integer aCounter = 1;
for (PrsMgr_ListOfPresentableObjectsIter anIter (anAssembly->Children()); anIter.More(); anIter.Next())
{
- if (GetMapOfAIS().IsBound1 (anIter.Value()))
+ Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anIter.Value());
+ if (GetMapOfAIS().IsBound1 (anObj))
{
- TCollection_AsciiString aCuurrentName = GetMapOfAIS().Find1 (anIter.Value());
+ TCollection_AsciiString aCuurrentName = GetMapOfAIS().Find1 (anObj);
std::cout << aCounter << ") " << aCuurrentName << " (" << anIter.Value()->DynamicType()->Name() << ")";
}
{
const TCollection_AsciiString& aNameIO = anObjIter.Value();
Handle(AIS_InteractiveObject) anIO;
- if (GetMapOfAIS().IsBound2 (aNameIO))
- {
- anIO = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aNameIO));
- }
-
+ GetMapOfAIS().Find2 (aNameIO, anIO);
if (anIO.IsNull())
{
std::cout << "Syntax error: undefined presentable object " << aNameIO << "\n";
// find object
TCollection_AsciiString aName (argv[2]);
- ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
- if (!aMap.IsBound2 (aName))
- {
- di << "Use 'vdisplay' before\n";
- return 1;
- }
-
- // find interactive object
- Handle(Standard_Transient) anObj = GetMapOfAIS().Find2 (aName);
- Handle(AIS_InteractiveObject) anInterObj =
- Handle(AIS_InteractiveObject)::DownCast (anObj);
+ Handle(AIS_InteractiveObject) anInterObj;
+ GetMapOfAIS().Find2 (aName, anInterObj);
if (anInterObj.IsNull())
{
- di << "Not an AIS interactive object!\n";
+ std::cout << "Syntax error: object '" << aName << "' is not displayed\n";
return 1;
}
if (argc >= 2)
{
TCollection_AsciiString aName (argv[1]);
- ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
- if (!aMap.IsBound2 (aName))
+ if (!GetMapOfAIS().Find2 (aName, anInterObj)
+ || anInterObj.IsNull())
{
- std::cout << "Use 'vdisplay' before" << std::endl;
- return 1;
- }
-
- // find interactive object
- Handle(Standard_Transient) anObj = GetMapOfAIS().Find2 (aName);
- anInterObj = Handle(AIS_InteractiveObject)::DownCast (anObj);
- if (anInterObj.IsNull())
- {
- std::cout << "Not an AIS interactive object!" << std::endl;
+ std::cout << "Syntax error: object '" << aName << "' is not displayed\n";
return 1;
}
}
// if name is empty - apply attributes for default aspect
if (!aName.IsEmpty ())
{
- ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS ();
- if (!aMap.IsBound2 (aName))
+ if (!GetMapOfAIS().Find2 (aName, anInterObj)
+ || anInterObj.IsNull())
{
std::cout << "Use 'vdisplay' on " << aName << " before" << std::endl;
return 1;
}
-
- // find interactive object
- Handle(Standard_Transient) anObj = GetMapOfAIS ().Find2 (aName);
- anInterObj = Handle(AIS_InteractiveObject)::DownCast (anObj);
- if (anInterObj.IsNull ())
- {
- std::cout << "Not an AIS interactive object!" << std::endl;
- return 1;
- }
}
const Handle(Prs3d_Drawer)& aDrawer = (aName.IsEmpty ()) ?
// Get shape name
TCollection_AsciiString aName(theArgs[1]);
- if (!GetMapOfAIS().IsBound2 (aName))
+ Handle(AIS_InteractiveObject) anObject;
+ if (!GetMapOfAIS().Find2 (aName, anObject))
{
theDI << theArgs[0] << " error: wrong object name.\n";
return 1;
}
- Handle(AIS_InteractiveObject) anObject =
- Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(aName));
-
// Enable triangle edge mode
if (!anObject->Attributes()->HasOwnShadingAspect())
{
// Get shape name
TCollection_AsciiString aName (theArgs[1]);
- if (!GetMapOfAIS().IsBound2 (aName))
+ Handle(AIS_InteractiveObject) anObject;
+ if (!GetMapOfAIS().Find2 (aName, anObject))
{
theDI << theArgs[0] << " error: wrong object name.\n";
return 1;
}
- Handle(AIS_InteractiveObject) anObject =
- Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2(aName));
-
// Enable trianle edge mode
anObject->Attributes()->ShadingAspect()->Aspect()->SetEdgeOff();
for (Standard_Integer aCount = 3; aCount < theArgNum; aCount++)
{
TCollection_AsciiString aName (theArgs[aCount]);
- if (!GetMapOfAIS().IsBound2 (aName))
+ if (!GetMapOfAIS().Find2 (aName, anObject))
{
theDI << "Warning: wrong object name ignored - " << theArgs[0] << "\n";
continue;
}
- anObject = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2(aName));
anObjs.Append (anObject);
}
return 0;
}
- if (theArgNum > 2)
+ Handle(AIS_InteractiveObject) anObject;
+ if (theArgNum > 2
+ || !GetMapOfAIS().Find2 (aParam, anObject))
{
std::cout << "Error: invalid number of arguments" << std::endl;
- std::cout << "Type 'help vvertexmode' for usage hints" << std::endl;
return 1;
}
// One argument (object name) --> print the current vertex draw mode for the object
- Handle(AIS_InteractiveObject) anObject =
- Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aParam));
Prs3d_VertexDrawMode aCurrMode = anObject->Attributes()->VertexDrawMode();
theDI << "Object's vertex draw mode: " << (aCurrMode == Prs3d_VDM_Isolated ? "'isolated'" : "'all'") << "\n";
return 0;
TCollection_AsciiString aName (theArgs[anArgIter]);
Handle(AIS_InteractiveObject) anIObj;
- if (GetMapOfAIS().IsBound2 (aName))
- {
- anIObj = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aName));
- }
-
+ GetMapOfAIS().Find2 (aName, anIObj);
if (anIObj.IsNull())
{
std::cout << "Error: the object '" << theArgs[1] << "' is not displayed" << std::endl;
else if (!anArg.StartsWith ("-")
&& GetMapOfAIS().IsBound2 (theArgVec[anArgIter]))
{
- Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (theArgVec[anArgIter]));
+ Handle(AIS_InteractiveObject) anIO = GetMapOfAIS().Find2 (theArgVec[anArgIter]);
if (anIO.IsNull())
{
std::cerr << "Syntax error: " << theArgVec[anArgIter] << " is not an AIS object\n";
{
break;
}
- anIO = Handle(AIS_InteractiveObject)::DownCast (aGlobalPrsIter.Key1());
+ anIO = aGlobalPrsIter.Key1();
aGlobalPrsIter.Next();
if (anIO.IsNull())
{
{
anAISObject = new AIS_Shape (aShape);
}
- else
+ else if (!GetMapOfAIS().Find2 (anArgString, anAISObject)
+ || anAISObject.IsNull())
{
- if (!GetMapOfAIS().IsBound2 (anArgString))
- {
- std::cerr << "Error: shape with name '" << aStr << "' is not found.\n";
- return 1;
- }
-
- anAISObject = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (anArgString));
- if (anAISObject.IsNull())
- {
- std::cerr << "Error: " << aStr <<" is not a shape.\n";
- return 1;
- }
+ std::cerr << "Error: shape with name '" << aStr << "' is not found.\n";
+ return 1;
}
theShapeList->Append (anAISObject);
}
NCollection_DataMap<TCollection_AsciiString, Standard_Real> aRealParams;
NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString> aStringParams;
- if (!GetMapOfAIS().IsBound2 (aName))
+ Handle(AIS_InteractiveObject) anObject;
+ if (!GetMapOfAIS().Find2 (aName, anObject))
{
theDi << theArgVec[0] << "error: no object with this name.\n";
return 1;
}
-
- Handle(AIS_InteractiveObject) anObject = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2 (aName));
- if (anObject->Type() != AIS_KOI_Dimension)
+ Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast (anObject);
+ if (aDim.IsNull())
{
theDi << theArgVec[0] << "error: no dimension with this name.\n";
return 1;
}
- Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast (anObject);
Handle(Prs3d_DimensionAspect) anAspect = aDim->DimensionAspect();
if (ParseDimensionParams (theArgNum, theArgVec, 2, anAspect,
}
TCollection_AsciiString aName (theArgVec[1]);
- if (!GetMapOfAIS().IsBound2 (aName))
+ Handle(AIS_InteractiveObject) anObject;
+ if (!GetMapOfAIS().Find2 (aName, anObject))
{
std::cout << theArgVec[0] << "error: no object with this name.\n";
return 1;
}
- Handle(AIS_InteractiveObject) anObject = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2 (aName));
- if (anObject->Type() != AIS_KOI_Dimension)
- {
- std::cout << theArgVec[0] << "error: no dimension with this name.\n";
- return 1;
- }
-
Handle(AIS_LengthDimension) aLengthDim = Handle(AIS_LengthDimension)::DownCast (anObject);
if (aLengthDim.IsNull())
{
Standard_Boolean toUpdate = Standard_True;
NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString> aStringParams;
-
- if (!GetMapOfAIS().IsBound2 (aName))
+ Handle(AIS_InteractiveObject) anObject;
+ if (!GetMapOfAIS().Find2 (aName, anObject))
{
theDi << theArgVec[0] << "error: no object with this name.\n";
return 1;
}
- Handle(AIS_InteractiveObject) anObject = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2 (aName));
- if (anObject->Type() != AIS_KOI_Dimension)
+ Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast (anObject);
+ if (aDim.IsNull())
{
theDi << theArgVec[0] << "error: no dimension with this name.\n";
return 1;
}
- Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast (anObject);
Handle(Prs3d_DimensionAspect) anAspect = aDim->DimensionAspect();
-
if (ParseAngleDimensionParams (theArgNum, theArgVec, 2, aStringParams))
{
return 1;
if (isNameSet)
{
TCollection_AsciiString aName (theArgVec[1]);
- if (!GetMapOfAIS().IsBound2 (aName))
+ if (!GetMapOfAIS().Find2 (aName, aPickedObj)
+ || aPickedObj.IsNull())
{
theDi << theArgVec[0] << " error: no object with this name.\n";
return 1;
}
- aPickedObj = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aName));
-
- if (aPickedObj.IsNull())
- {
- theDi << theArgVec[0] << " error: the object with this name is not valid.\n";
- return 1;
- }
-
if (aPickedObj->Type() != AIS_KOI_Dimension && aPickedObj->Type() != AIS_KOI_Relation)
{
theDi << theArgVec[0] << " error: no dimension or relation with this name.\n";
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anObjIter (GetMapOfAIS());
anObjIter.More(); anObjIter.Next())
{
- Handle(PrsMgr_PresentableObject) aPrs = Handle(PrsMgr_PresentableObject)::DownCast (anObjIter.Key1());
+ const Handle(AIS_InteractiveObject)& aPrs = anObjIter.Key1();
if (aPrs.IsNull()
|| aPrs->ZLayer() != aLayerId)
{
TCollection_AsciiString anObjName (theArgVec[anArgIter]);
const ViewerTest_DoubleMapOfInteractiveAndName& aMapOfAIS = GetMapOfAIS();
- if (!aMapOfAIS.IsBound2 (anObjName))
+ Handle(AIS_InteractiveObject) anObject;
+ if (!aMapOfAIS.Find2 (anObjName, anObject))
{
std::cout << "Syntax error: wrong object name at " << anArg << "\n";
return 1;
}
- Handle(AIS_InteractiveObject) anObject = Handle(AIS_InteractiveObject)::DownCast (aMapOfAIS.Find2 (anObjName));
gp_Trsf aTrsfs [2] = { anObject->LocalTransformation(), anObject->LocalTransformation() };
gp_Quaternion aRotQuats[2] = { aTrsfs[0].GetRotation(), aTrsfs[1].GetRotation() };
gp_XYZ aLocPnts [2] = { aTrsfs[0].TranslationPart(), aTrsfs[1].TranslationPart() };
return 1;
}
//get AIS_Shape:
- Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
- ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
TCollection_AsciiString aName(argv[1]);
Handle(AIS_InteractiveObject) anAISObject;
-
- if(!aMap.IsBound2(aName))
+ if (!GetMapOfAIS().Find2 (aName, anAISObject)
+ || anAISObject.IsNull())
{
di<<"Use 'vdisplay' before";
return 1;
}
- else
- {
- anAISObject = Handle(AIS_InteractiveObject)::DownCast(aMap.Find2(aName));
- if(anAISObject.IsNull()){
- di<<"No interactive object \n";
- return 1;
- }
- aContext->AddOrRemoveSelected(anAISObject, Standard_True);
- }
+ ViewerTest::GetAISContext()->AddOrRemoveSelected(anAISObject, Standard_True);
return 0;
}
for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anIObjIt (GetMapOfAIS());
anIObjIt.More(); anIObjIt.Next())
{
- Handle(PrsMgr_PresentableObject) aPrs = Handle(PrsMgr_PresentableObject)::DownCast (anIObjIt.Key1());
+ const Handle(AIS_InteractiveObject)& aPrs = anIObjIt.Key1();
aPrs->RemoveClipPlane (aClipPlane);
}
}
else if (GetMapOfAIS().IsBound2 (anEntityName))
{
- Handle(AIS_InteractiveObject) aIObj = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (anEntityName));
+ Handle(AIS_InteractiveObject) aIObj = GetMapOfAIS().Find2 (anEntityName);
if (toSet)
{
aIObj->AddClipPlane (aClipPlane);
// find object
ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
Handle(AIS_InteractiveObject) anIObj;
- if (!aMap.IsBound2 (aName) )
+ if (!aMap.Find2 (aName, anIObj))
{
di << "Use 'vdisplay' before\n";
return 1;
}
- else
- {
- anIObj = Handle(AIS_InteractiveObject)::DownCast (aMap.Find2 (aName));
- gp_Trsf aTransform;
- aTransform.SetRotation (gp_Ax1 (gp_Pnt (0.0, 0.0, 0.0), gp_Vec (1.0, 0.0, 0.0)), anAngle);
- aTransform.SetTranslationPart (anIObj->LocalTransformation().TranslationPart());
-
- aContext->SetLocation (anIObj, aTransform);
- aContext->UpdateCurrentViewer();
- }
+ gp_Trsf aTransform;
+ aTransform.SetRotation (gp_Ax1 (gp_Pnt (0.0, 0.0, 0.0), gp_Vec (1.0, 0.0, 0.0)), anAngle);
+ aTransform.SetTranslationPart (anIObj->LocalTransformation().TranslationPart());
+ aContext->SetLocation (anIObj, aTransform);
+ aContext->UpdateCurrentViewer();
return 0;
}
}
TCollection_AsciiString anObjName (aCmd.Arg ("attach", 0).c_str());
- if (!aMapAIS.IsBound2 (anObjName))
+ Handle(AIS_InteractiveObject) anObject;
+ if (!aMapAIS.Find2 (anObjName, anObject))
{
std::cerr << theArgVec[0] << " error: AIS object \"" << anObjName << "\" does not exist.\n";
return 1;
}
- Handle(AIS_InteractiveObject) anObject = Handle(AIS_InteractiveObject)::DownCast (aMapAIS.Find2 (anObjName));
- ViewerTest_MapOfAISManipulators::Iterator anIt (GetMapOfAISManipulators());
- for (; anIt.More(); anIt.Next())
+ for (ViewerTest_MapOfAISManipulators::Iterator anIt (GetMapOfAISManipulators()); anIt.More(); anIt.Next())
{
if (anIt.Value()->IsAttached()
&& anIt.Value()->Object() == anObject)
+++ /dev/null
-puts "========================"
-puts "OCC137"
-puts "========================"
-###############################################################
-#Patch description:
-#
-#MIT010717 : 3D selection management
-#>>> MIT010717 : Selection management
-#
-# * Package OpenGl (OpenGl_execstruct.c)
-#
-# @ Avoid drawing quality problem on selected face,
-# enable/disable Z offset on highlighted faces.
-#
-#>>> MIT010717 : drawing management
-#
-# * Package OpenGl (OpenGl_indexpolygon.c, ...)
-#
-# @ Avoid to undraw faces with confused points
-###############################################################
-puts "========================"
-
-vinit
-box b 10 10 10
-vdisplay b
-vfit
-vsetdispmode 1
-
-puts "Whole shape should be highlighted."
-
-OCC137 1
-
-set x_coord 105
-set y_coord 100
-
-vmoveto $x_coord $y_coord
-
-checkcolor $x_coord $y_coord 0 1 1
-
-checkview -screenshot -3d -path ${imagedir}/${test_image}.png
-
+++ /dev/null
-puts "================"
-puts "OCC137"
-puts "================"
-#
-# The patch "patch-MITUTOYO-USA-05112001.zip" has to be converted to Open Cascade 4.0
-#
-puts "IT IS NECESSARY TO CHECK SELECTED FACE SHADING"
-puts ""
-
-pload XDE
-
-igesbrep [locate_data_file OCC137-ANC101-Solid.igs] a *
-tpcompound a
-vinit
-vdisplay a
-vfit
-vsetdispmode 1
-
-# FACE ON
-vselmode 4 1
-
-set x 170
-set y 80
-vselect $x $y
-
-checkview -screenshot -3d -path ${imagedir}/${test_image}.png
+++ /dev/null
-puts "================"
-puts "OCC137"
-puts "================"
-#
-# The patch "patch-MITUTOYO-USA-05112001.zip" has to be converted to Open Cascade 4.0
-#
-puts "IT IS NECESSARY TO CHECK SELECTED FACE SHADING"
-puts ""
-
-pload XDE
-
-stepread [locate_data_file OCC137-ANC101-Solid.stp] a *
-tpcompound a
-vinit
-vdisplay a
-vfit
-vsetdispmode 1
-
-# FACE ON
-vselmode 4 1
-
-set x 170
-set y 80
-vselect $x $y
-
-checkview -screenshot -3d -path ${imagedir}/${test_image}.png
+++ /dev/null
-
-puts "========================"
-puts "OCC137"
-puts "========================"
-###############################################################
-#Patch description:
-#
-#MIT010717 : 3D selection management
-#>>> MIT010717 : Selection management
-#
-# * Package OpenGl (OpenGl_execstruct.c)
-#
-# @ Avoid drawing quality problem on selected face,
-# enable/disable Z offset on highlighted faces.
-#
-#>>> MIT010717 : drawing management
-#
-# * Package OpenGl (OpenGl_indexpolygon.c, ...)
-#
-# @ Avoid to undraw faces with confused points
-###############################################################
-puts "========================"
-
-vinit
-box b 10 10 10
-vdisplay b
-vfit
-vsetdispmode 1
-
-puts "Only top face should be highlighted."
-
-vselmode 4 1
-
-OCC137 1
-
-set x_coord 105
-set y_coord 100
-
-vmoveto $x_coord $y_coord
-
-checkcolor $x_coord $y_coord 0 1 1
-
-set x_coord 105
-set y_coord 340
-
-checkcolor $x_coord $y_coord 0.78 0.54 0.09
-
-checkview -screenshot -3d -path ${imagedir}/${test_image}.png
+++ /dev/null
-
-puts "========================"
-puts "OCC137"
-puts "========================"
-###############################################################
-#Patch description:
-#
-#MIT010717 : 3D selection management
-#>>> MIT010717 : Selection management
-#
-# * Package OpenGl (OpenGl_execstruct.c)
-#
-# @ Avoid drawing quality problem on selected face,
-# enable/disable Z offset on highlighted faces.
-#
-#>>> MIT010717 : drawing management
-#
-# * Package OpenGl (OpenGl_indexpolygon.c, ...)
-#
-# @ Avoid to undraw faces with confused points
-###############################################################
-puts "========================"
-
-vinit
-box b 10 10 10
-vdisplay b
-vfit
-vsetdispmode 1
-
-puts "Only top face should be highlighted."
-
-OCC137 1
-
-vselmode 4 1
-
-set x_coord 105
-set y_coord 100
-
-vmoveto $x_coord $y_coord
-
-checkcolor $x_coord $y_coord 0 1 1
-
-set x_coord 105
-set y_coord 340
-
-checkcolor $x_coord $y_coord 0.78 0.54 0.09
-
-checkview -screenshot -3d -path ${imagedir}/${test_image}.png
+++ /dev/null
-puts "================"
-puts "OCC137"
-puts "================"
-#
-# The patch "patch-MITUTOYO-USA-05112001.zip" has to be converted to Open Cascade 4.0
-#
-puts "IT IS NECESSARY TO CHECK SHAPE SHADING"
-puts ""
-
-restore [locate_data_file OCC137-ANC101-Solid.brep] a
-vinit
-vdisplay a
-vfit
-vsetdispmode 1
-
-checkview -screenshot -3d -path ${imagedir}/${test_image}.png
+++ /dev/null
-#INTERFACE IGES
-puts "================"
-puts "OCC137"
-puts "================"
-#
-# The patch "patch-MITUTOYO-USA-05112001.zip" has to be converted to Open Cascade 4.0
-#
-puts "IT IS NECESSARY TO CHECK SHAPE SHADING"
-puts ""
-
-pload XDE
-
-igesbrep [locate_data_file OCC137-ANC101-Solid.igs] a *
-tpcompound a
-vinit
-vdisplay a
-vfit
-vsetdispmode 1
-
-checkview -screenshot -3d -path ${imagedir}/${test_image}.png
+++ /dev/null
-puts "================"
-puts "OCC137"
-puts "================"
-#
-# The patch "patch-MITUTOYO-USA-05112001.zip" has to be converted to Open Cascade 4.0
-#
-puts "IT IS NECESSARY TO CHECK SHAPE SHADING"
-puts ""
-
-pload XDE
-
-stepread [locate_data_file OCC137-ANC101-Solid.stp] a *
-tpcompound a
-vinit
-vdisplay a
-vfit
-vsetdispmode 1
-
-checkview -screenshot -3d -path ${imagedir}/${test_image}.png
+++ /dev/null
-puts "================"
-puts "OCC137"
-puts "================"
-#
-# The patch "patch-MITUTOYO-USA-05112001.zip" has to be converted to Open Cascade 4.0
-#
-puts "IT IS NECESSARY TO CHECK SELECTED FACE SHADING"
-puts ""
-
-restore [locate_data_file OCC137-ANC101-Solid.brep] a
-vinit
-vdisplay a
-vfit
-vsetdispmode 1
-
-# FACE ON
-vselmode 4 1
-
-set x 170
-set y 80
-vselect $x $y
-
-checkview -screenshot -3d -path ${imagedir}/${test_image}.png
anItemNamesToSelect.Append (TInspectorAPI_PluginParameters::ParametersToString (aShape));
}
// search prsentations with given name
- if (GetMapOfAIS().IsBound2 (theArgs[anIt]))
+ Handle(AIS_InteractiveObject) anIO;
+ GetMapOfAIS().Find2 (theArgs[anIt], anIO);
+ if (!anIO.IsNull())
{
- Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast
- (GetMapOfAIS().Find2 (theArgs[anIt]));
- if (!anIO.IsNull())
anObjectsToSelect.Append (anIO);
}
// give parameters as a container of names