1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0029740: Draw Harness - eliminate redundant casts to AIS_InteractiveObject

NCollecton_DoubleMap has been extended with two new methods Find1() and Find2()
performing lookup and returning found key withoout throwing an exception
(similar to NCollection_DataMap::Find()).

ViewerTest_DoubleMapOfInteractiveAndName has been redeclared to define
Handle(AIS_InteractiveObject) key instead of Handle(Standard_Transient).
This commit is contained in:
kgv 2018-07-23 21:12:13 +03:00 committed by bugmaster
parent a6df1715ed
commit 8f521168b4
21 changed files with 289 additions and 761 deletions

View File

@ -398,7 +398,8 @@ public:
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");
@ -413,7 +414,27 @@ public:
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");
@ -428,6 +449,25 @@ public:
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)

View File

@ -204,8 +204,7 @@ static Standard_Integer OCC10bug (Draw_Interpretor& di, Standard_Integer argc, c
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
@ -293,23 +292,19 @@ static Standard_Integer OCC74bug_set (Draw_Interpretor& di, Standard_Integer arg
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;
}
@ -330,22 +325,17 @@ static Standard_Integer OCC74bug_get (Draw_Interpretor& di, Standard_Integer arg
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;
}

View File

@ -1591,22 +1591,19 @@ static Standard_Integer OCC708 (Draw_Interpretor& di, Standard_Integer argc, con
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;
}

View File

@ -276,7 +276,7 @@ static Standard_Integer OCC218bug (Draw_Interpretor& di, Standard_Integer argc,
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

View File

@ -66,70 +66,6 @@ static Standard_Integer BUC60857 (Draw_Interpretor& di, Standard_Integer /*argc*
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>
@ -207,7 +143,6 @@ void QABugs::Commands_9(Draw_Interpretor& theCommands) {
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;

View File

@ -508,8 +508,7 @@ Standard_Boolean ViewerTest::Display (const TCollection_AsciiString& theNa
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);
}
@ -658,30 +657,25 @@ static TopoDS_Shape GetShapeFromName(const char* name)
//==============================================================================
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)();
}
@ -699,7 +693,7 @@ void ViewerTest::Clear()
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;
@ -802,34 +796,31 @@ static int visos (Draw_Interpretor& di, Standard_Integer argc, const char** argv
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);
Handle(AIS_InteractiveObject) aShape;
GetMapOfAIS().Find2(name, aShape);
if (aShape.IsNull())
{
std::cout << "Syntax error: object '" << name << "' is not found\n";
return 1;
}
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(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";
}
}
@ -1256,13 +1247,11 @@ static int VDispMode (Draw_Interpretor& , Standard_Integer argc, const char** ar
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);
}
}
}
@ -1284,11 +1273,8 @@ static int VDispMode (Draw_Interpretor& , Standard_Integer argc, const char** ar
{
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);
}
@ -1328,14 +1314,13 @@ static int VSubInt(Draw_Interpretor& di, Standard_Integer argc, const char** arg
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;
}
@ -2932,14 +2917,12 @@ static int VDonly2 (Draw_Interpretor& ,
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);
}
}
}
@ -2952,8 +2935,7 @@ static int VDonly2 (Draw_Interpretor& ,
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);
}
@ -3032,16 +3014,16 @@ int VRemove (Draw_Interpretor& theDI,
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;
}
@ -3055,8 +3037,7 @@ int VRemove (Draw_Interpretor& theDI,
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;
}
@ -3070,11 +3051,11 @@ int VRemove (Draw_Interpretor& theDI,
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)
{
@ -3138,14 +3119,13 @@ int VErase (Draw_Interpretor& theDI,
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)
@ -3165,11 +3145,11 @@ int VErase (Draw_Interpretor& theDI,
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);
@ -3188,7 +3168,7 @@ int VErase (Draw_Interpretor& theDI,
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)
@ -3246,15 +3226,13 @@ static int VDisplayAll (Draw_Interpretor& ,
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;
}
@ -3403,13 +3381,13 @@ int VBounding (Draw_Interpretor& theDI,
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)
{
@ -3439,7 +3417,7 @@ int VBounding (Draw_Interpretor& theDI,
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)
{
@ -4325,11 +4303,11 @@ static int VDisplay2 (Draw_Interpretor& theDI,
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)
@ -4382,7 +4360,6 @@ static int VDisplay2 (Draw_Interpretor& theDI,
continue;
}
Handle(AIS_InteractiveObject) aShape = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aName));
if (isMutable != -1)
{
aShape->SetMutable (isMutable == 1);
@ -4507,20 +4484,13 @@ static int VUpdate (Draw_Interpretor& /*theDi*/, Standard_Integer theArgsNb, con
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";
@ -4560,10 +4530,9 @@ static int VShading(Draw_Interpretor& ,Standard_Integer argc, const char** argv)
}
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);
@ -4576,41 +4545,40 @@ static int VShading(Draw_Interpretor& ,Standard_Integer argc, const char** argv)
//! 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;
@ -4627,7 +4595,7 @@ static void objInfo (const NCollection_Map<Handle(AIS_InteractiveObject)>& theDe
{
theDI << " UserPrs";
}
theDI << " (" << theObject->DynamicType()->Name() << ")";
theDI << " (" << theObj->DynamicType()->Name() << ")";
}
//! Print information about locally selected sub-shapes
@ -4807,17 +4775,17 @@ static Standard_Integer VState (Draw_Interpretor& theDI,
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;
@ -4851,8 +4819,7 @@ static Standard_Integer VState (Draw_Interpretor& theDI,
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;
}
@ -4860,7 +4827,7 @@ static Standard_Integer VState (Draw_Interpretor& theDI,
TCollection_AsciiString aName = anObjIter.Key2();
aName.LeftJustify (20, ' ');
theDI << " " << aName << " ";
objInfo (aDetected, anObj, theDI);
objInfo (aDetected, anObjIter.Key1(), theDI);
theDI << "\n";
}
printLocalSelectionInfo (aCtx, theDI);
@ -5409,7 +5376,6 @@ static int VBsdf (Draw_Interpretor& 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]))
@ -5418,17 +5384,15 @@ static int VBsdf (Draw_Interpretor& theDI,
}
}
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();
@ -5690,10 +5654,10 @@ static Standard_Integer VLoadSelection (Draw_Interpretor& /*theDi*/,
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())
{
@ -6203,15 +6167,14 @@ static Standard_Integer TDraft(Draw_Interpretor& di, Standard_Integer argc, cons
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());

View File

@ -23,8 +23,8 @@
#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

View File

@ -588,9 +588,9 @@ static int VTrihedron (Draw_Interpretor& ,
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())
{
@ -668,8 +668,7 @@ static int VSize (Draw_Interpretor& di, Standard_Integer argc, const char** argv
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) )
{
@ -729,14 +728,9 @@ static int VSize (Draw_Interpretor& di, Standard_Integer argc, const char** argv
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() &&
@ -1124,14 +1118,12 @@ static Standard_Integer VPlaneBuilder (Draw_Interpretor& /*di*/,
// 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() &&
@ -1139,14 +1131,12 @@ static Standard_Integer VPlaneBuilder (Draw_Interpretor& /*di*/,
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)))
@ -1155,14 +1145,12 @@ static Standard_Integer VPlaneBuilder (Draw_Interpretor& /*di*/,
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)))
@ -1242,14 +1230,12 @@ static Standard_Integer VPlaneBuilder (Draw_Interpretor& /*di*/,
// 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)))
@ -1301,14 +1287,12 @@ static Standard_Integer VPlaneBuilder (Draw_Interpretor& /*di*/,
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)))
@ -1761,15 +1745,13 @@ static int VLineBuilder(Draw_Interpretor& di, Standard_Integer argc, const char*
// 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";
@ -1988,9 +1970,7 @@ void DisplayCircle (Handle (Geom_Circle) theGeomCircle,
// 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);
}
@ -2019,14 +1999,9 @@ static int VCircleBuilder(Draw_Interpretor& /*di*/, Standard_Integer argc, const
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
// ========================================
@ -2039,8 +2014,8 @@ static int VCircleBuilder(Draw_Interpretor& /*di*/, Standard_Integer argc, const
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 )
{
@ -3619,11 +3594,7 @@ static Standard_Integer VSetLocation (Draw_Interpretor& theDI,
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";
@ -3645,12 +3616,8 @@ static Standard_Integer VSetLocation (Draw_Interpretor& theDI,
}
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";
@ -3980,10 +3947,8 @@ static Standard_Integer VConnect (Draw_Interpretor& /*di*/,
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";
@ -4033,10 +3998,9 @@ static Standard_Integer VConnect (Draw_Interpretor& /*di*/,
// 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);
}
@ -4086,10 +4050,8 @@ static Standard_Integer VConnectTo (Draw_Interpretor& /*di*/,
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";
@ -4128,11 +4090,10 @@ static Standard_Integer VConnectTo (Draw_Interpretor& /*di*/,
// 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);
}
@ -4200,7 +4161,7 @@ static Standard_Integer VDisconnect (Draw_Interpretor& di,
}
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())
@ -4223,15 +4184,8 @@ static Standard_Integer VDisconnect (Draw_Interpretor& di,
}
}
// 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;
}
@ -4279,14 +4233,12 @@ static Standard_Integer VAddConnected (Draw_Interpretor& di,
}
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));
@ -4342,9 +4294,10 @@ static Standard_Integer VListConnected (Draw_Interpretor& /*di*/,
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() << ")";
}
@ -4442,11 +4395,7 @@ static Standard_Integer VSetSelectionMode (Draw_Interpretor& /*di*/,
{
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";
@ -4607,20 +4556,11 @@ static Standard_Integer VObjZLayer (Draw_Interpretor& di,
// 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;
}
@ -4665,19 +4605,10 @@ static Standard_Integer VPolygonOffset(Draw_Interpretor& /*di*/,
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;
}
}
@ -4773,21 +4704,12 @@ static Standard_Integer VShowFaceBoundary (Draw_Interpretor& /*di*/,
// 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 ()) ?
@ -5443,15 +5365,13 @@ static int VSetEdgeType (Draw_Interpretor& theDI,
// 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())
{
@ -5553,15 +5473,13 @@ static int VUnsetEdgeType (Draw_Interpretor& theDI,
// 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();
@ -5655,12 +5573,11 @@ static int VVertexMode (Draw_Interpretor& theDI,
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);
}
@ -5678,16 +5595,15 @@ static int VVertexMode (Draw_Interpretor& theDI,
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;
@ -5967,11 +5883,7 @@ static int VPriority (Draw_Interpretor& theDI,
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;

View File

@ -712,7 +712,7 @@ static Standard_Integer VShaderProg (Draw_Interpretor& /*theDI*/,
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";
@ -790,7 +790,7 @@ static Standard_Integer VShaderProg (Draw_Interpretor& /*theDI*/,
{
break;
}
anIO = Handle(AIS_InteractiveObject)::DownCast (aGlobalPrsIter.Key1());
anIO = aGlobalPrsIter.Key1();
aGlobalPrsIter.Next();
if (anIO.IsNull())
{

View File

@ -296,20 +296,11 @@ static int ParseDimensionParams (Standard_Integer theArgNum,
{
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);
}
@ -1578,20 +1569,19 @@ static int VDimParam (Draw_Interpretor& theDi, Standard_Integer theArgNum, const
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,
@ -1636,19 +1626,13 @@ static int VLengthParam (Draw_Interpretor&, Standard_Integer theArgNum, const ch
}
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())
{
@ -1744,23 +1728,21 @@ static int VAngleParam (Draw_Interpretor& theDi, Standard_Integer theArgNum, con
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;
@ -1808,20 +1790,13 @@ static int VMoveDim (Draw_Interpretor& theDi, Standard_Integer theArgNum, const
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";

View File

@ -4850,7 +4850,7 @@ static int VZLayer (Draw_Interpretor& theDI,
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)
{
@ -7456,13 +7456,13 @@ static Standard_Integer VAnimation (Draw_Interpretor& theDI,
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() };
@ -7804,26 +7804,16 @@ static Standard_Integer VChangeSelected (Draw_Interpretor& di,
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;
}
@ -8160,7 +8150,7 @@ namespace
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);
}
@ -8728,7 +8718,7 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
}
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);
@ -11101,23 +11091,18 @@ static Standard_Integer VXRotate (Draw_Interpretor& di,
// 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;
}
@ -11332,15 +11317,14 @@ static int VManipulator (Draw_Interpretor& theDi,
}
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)

View File

@ -1,41 +0,0 @@
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

View File

@ -1,26 +0,0 @@
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

View File

@ -1,26 +0,0 @@
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

View File

@ -1,48 +0,0 @@
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

View File

@ -1,48 +0,0 @@
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

View File

@ -1,16 +0,0 @@
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

View File

@ -1,20 +0,0 @@
#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

View File

@ -1,19 +0,0 @@
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

View File

@ -1,23 +0,0 @@
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

View File

@ -231,11 +231,10 @@ static int tinspector (Draw_Interpretor& di, Standard_Integer theArgsNb, const c
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