mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-05 18:16:23 +03:00
0025783: Visualization - allow Z-layer to draw 2D objects and to make it alternative to Overlay and Underlay
Add one more pre-defined Z-layer Graphic3d_ZLayerId_BotOSD. Define new Transformation Persistence flags Graphic3d_TMF_2d and Graphic3d_TMF_2d_IsTopDown for displaying objects in screen coordinates. Anchor point defines angle of the screen to display the object in similar way as for Graphic3d_TMF_TriedronPers. Extend Draw Harness command vdisplay with new options: -overlay as alias for -toposd. -underlay and -botosd. -noselect to prevent automatic selection activation. -dispMode and -highMode to define displaying and highlighting modes. -2d, -2dtopdown and -3d to manage displaying in screen coordinates. -trsfPers and -trsfPersPos for Transformation Persistence options. Drop command vsettransmode, replaced by vdisplay. Correction of test-case bugs vis bug641
This commit is contained in:
parent
ce77f9998a
commit
af65fb1941
@ -138,7 +138,10 @@ static Standard_Integer transform(Draw_Interpretor& di,Standard_Integer n,const
|
||||
for (Standard_Integer i = 1; i < last; i++) {
|
||||
TopoDS_Shape S = DBRep::Get(a[i]);
|
||||
if (S.IsNull())
|
||||
di << a[i] << " is not a valid shape\n";
|
||||
{
|
||||
std::cerr << "Error: " << a[i] << " is not a valid shape\n";
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
DBRep::Set(a[i],S.Located(L));
|
||||
}
|
||||
@ -148,7 +151,8 @@ static Standard_Integer transform(Draw_Interpretor& di,Standard_Integer n,const
|
||||
for (Standard_Integer i = 1; i < last; i++) {
|
||||
TopoDS_Shape S = DBRep::Get(a[i]);
|
||||
if (S.IsNull()) {
|
||||
di << a[i] << " is not a valid shape\n";
|
||||
std::cerr << "Error: " << a[i] << " is not a valid shape\n";
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
trf.Perform(S);
|
||||
|
@ -24,6 +24,8 @@ enum {
|
||||
Graphic3d_TMF_ZoomPers = 0x0002,
|
||||
Graphic3d_TMF_RotatePers = 0x0008,
|
||||
Graphic3d_TMF_TriedronPers = 0x0020,
|
||||
Graphic3d_TMF_2d = 0x0040,
|
||||
Graphic3d_TMF_2d_IsTopDown = 0x0041,
|
||||
Graphic3d_TMF_FullPers = Graphic3d_TMF_PanPers | Graphic3d_TMF_ZoomPers | Graphic3d_TMF_RotatePers
|
||||
};
|
||||
|
||||
|
@ -27,7 +27,8 @@ enum
|
||||
Graphic3d_ZLayerId_Default = 0, //!< default Z-layer for main presentations
|
||||
Graphic3d_ZLayerId_Top = -2, //!< overlay for 3D presentations which inherits Depth from previous ZLayer
|
||||
Graphic3d_ZLayerId_Topmost = -3, //!< overlay for 3D presentations with independent Depth
|
||||
Graphic3d_ZLayerId_TopOSD = -4 //!< overlay for 2D presentations (On-Screen-Display)
|
||||
Graphic3d_ZLayerId_TopOSD = -4, //!< overlay for 2D presentations (On-Screen-Display)
|
||||
Graphic3d_ZLayerId_BotOSD = -5 //!< underlay for 2D presentations (On-Screen-Display)
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_ZLayerId_HeaderFile
|
||||
|
@ -410,7 +410,7 @@ void OpenGl_GraduatedTrihedron::renderAxis (const Handle(OpenGl_Workspace)& theW
|
||||
aTransMode.pointY = anArrowVec.y();
|
||||
aTransMode.pointZ = anArrowVec.z();
|
||||
|
||||
theWorkspace->ActiveView()->BeginTransformPersistence (aContext, &aTransMode);
|
||||
theWorkspace->ActiveView()->BeginTransformPersistence (aContext, &aTransMode, theWorkspace->Width(), theWorkspace->Height());
|
||||
|
||||
// NOTE:
|
||||
// OpenGl_View applies Transform Persistence only in Projection Matrix.
|
||||
|
@ -33,6 +33,9 @@ OpenGl_LayerList::OpenGl_LayerList (const Standard_Integer theNbPriorities)
|
||||
myImmediateNbStructures (0)
|
||||
{
|
||||
// insert default priority layers
|
||||
myLayers.Append (OpenGl_Layer (myNbPriorities));
|
||||
myLayerIds.Bind (Graphic3d_ZLayerId_BotOSD, myLayers.Upper());
|
||||
|
||||
myLayers.Append (OpenGl_Layer (myNbPriorities));
|
||||
myLayerIds.Bind (Graphic3d_ZLayerId_Default, myLayers.Upper());
|
||||
|
||||
|
@ -656,7 +656,7 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
|
||||
const TEL_TRANSFORM_PERSISTENCE *aTransPersistence = NULL;
|
||||
if ( myTransPers && myTransPers->mode != 0 )
|
||||
{
|
||||
aTransPersistence = theWorkspace->ActiveView()->BeginTransformPersistence (aCtx, myTransPers);
|
||||
aTransPersistence = theWorkspace->ActiveView()->BeginTransformPersistence (aCtx, myTransPers, theWorkspace->Width(), theWorkspace->Height());
|
||||
}
|
||||
|
||||
// Take into account transform persistence
|
||||
@ -790,7 +790,7 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) con
|
||||
// Restore transform persistence
|
||||
if ( myTransPers && myTransPers->mode != 0 )
|
||||
{
|
||||
theWorkspace->ActiveView()->BeginTransformPersistence (aCtx, aTransPersistence);
|
||||
theWorkspace->ActiveView()->BeginTransformPersistence (aCtx, aTransPersistence, theWorkspace->Width(), theWorkspace->Height());
|
||||
}
|
||||
|
||||
// Apply highlight box
|
||||
|
@ -269,6 +269,7 @@ void OpenGl_View::EndTransformPersistence(const Handle(OpenGl_Context)& theCtx)
|
||||
theCtx->ProjectionState.Pop();
|
||||
|
||||
theCtx->ApplyProjectionMatrix();
|
||||
theCtx->ApplyWorldViewMatrix();
|
||||
|
||||
myIsTransPers = Standard_False;
|
||||
}
|
||||
@ -278,7 +279,9 @@ void OpenGl_View::EndTransformPersistence(const Handle(OpenGl_Context)& theCtx)
|
||||
|
||||
//transform_persistence_begin
|
||||
const TEL_TRANSFORM_PERSISTENCE* OpenGl_View::BeginTransformPersistence (const Handle(OpenGl_Context)& theCtx,
|
||||
const TEL_TRANSFORM_PERSISTENCE* theTransPers)
|
||||
const TEL_TRANSFORM_PERSISTENCE* theTransPers,
|
||||
Standard_Integer theWidth,
|
||||
Standard_Integer theHeight)
|
||||
{
|
||||
const TEL_TRANSFORM_PERSISTENCE* aTransPersPrev = myTransPers;
|
||||
myTransPers = theTransPers;
|
||||
@ -296,6 +299,7 @@ const TEL_TRANSFORM_PERSISTENCE* OpenGl_View::BeginTransformPersistence (const H
|
||||
|
||||
const GLdouble aViewportW = (GLdouble )aViewport[2];
|
||||
const GLdouble aViewportH = (GLdouble )aViewport[3];
|
||||
|
||||
if (myIsTransPers)
|
||||
{
|
||||
// pop matrix stack - it will be overridden later
|
||||
@ -307,6 +311,56 @@ const TEL_TRANSFORM_PERSISTENCE* OpenGl_View::BeginTransformPersistence (const H
|
||||
myIsTransPers = Standard_True;
|
||||
}
|
||||
|
||||
if (theTransPers->mode & TPF_2D)
|
||||
{
|
||||
GLfloat aLeft = -static_cast<GLfloat> (theWidth / 2);
|
||||
GLfloat aRight = static_cast<GLfloat> (theWidth / 2);
|
||||
GLfloat aBottom = -static_cast<GLfloat> (theHeight / 2);
|
||||
GLfloat aTop = static_cast<GLfloat> (theHeight / 2);
|
||||
GLfloat aGap = static_cast<GLfloat> (theTransPers->pointZ);
|
||||
if (theTransPers->pointX > 0)
|
||||
{
|
||||
aLeft -= static_cast<GLfloat> (theWidth / 2) - aGap;
|
||||
aRight -= static_cast<GLfloat> (theWidth / 2) - aGap;
|
||||
}
|
||||
else if (theTransPers->pointX < 0)
|
||||
{
|
||||
aLeft += static_cast<GLfloat> (theWidth / 2) - aGap;
|
||||
aRight += static_cast<GLfloat> (theWidth / 2) - aGap;
|
||||
}
|
||||
if (theTransPers->pointY > 0)
|
||||
{
|
||||
aBottom -= static_cast<GLfloat> (theHeight / 2) - aGap;
|
||||
aTop -= static_cast<GLfloat> (theHeight / 2) - aGap;
|
||||
}
|
||||
else if (theTransPers->pointY < 0)
|
||||
{
|
||||
aBottom += static_cast<GLfloat> (theHeight / 2) - aGap;
|
||||
aTop += static_cast<GLfloat> (theHeight / 2) - aGap;
|
||||
}
|
||||
if (theTransPers->mode == TPF_2D_ISTOPDOWN)
|
||||
{
|
||||
const GLfloat aTemp = aTop;
|
||||
aTop = aBottom;
|
||||
aBottom = aTemp;
|
||||
}
|
||||
|
||||
OpenGl_Mat4 aProjectMat;
|
||||
OpenGl_Utils::Ortho2D<Standard_ShortReal> (aProjectMat,
|
||||
aLeft, aRight,
|
||||
aBottom, aTop);
|
||||
|
||||
theCtx->WorldViewState.Push();
|
||||
theCtx->ProjectionState.Push();
|
||||
|
||||
theCtx->WorldViewState.SetIdentity();
|
||||
theCtx->ProjectionState.SetCurrent (aProjectMat);
|
||||
|
||||
theCtx->ApplyWorldViewMatrix();
|
||||
theCtx->ApplyProjectionMatrix();
|
||||
return aTransPersPrev;
|
||||
}
|
||||
|
||||
// push matrices into stack and reset them
|
||||
theCtx->WorldViewState.Push();
|
||||
theCtx->ProjectionState.Push();
|
||||
|
@ -120,7 +120,9 @@ class OpenGl_View : public MMgt_TShared
|
||||
Standard_Integer Backfacing () const { return myBackfacing; }
|
||||
|
||||
const TEL_TRANSFORM_PERSISTENCE * BeginTransformPersistence (const Handle(OpenGl_Context)& theCtx,
|
||||
const TEL_TRANSFORM_PERSISTENCE *theTransPers);
|
||||
const TEL_TRANSFORM_PERSISTENCE *theTransPers,
|
||||
Standard_Integer theWidth,
|
||||
Standard_Integer theHeight);
|
||||
void EndTransformPersistence (const Handle(OpenGl_Context)& theCtx);
|
||||
|
||||
//! Add structure to display list with specified priority.
|
||||
|
@ -19,7 +19,9 @@ enum TP_FLAGS
|
||||
TPF_PAN = 0x001,
|
||||
TPF_ZOOM = 0x002,
|
||||
TPF_ROTATE = 0x008,
|
||||
TPF_TRIEDRON = 0x020
|
||||
TPF_TRIEDRON = 0x020,
|
||||
TPF_2D = 0x040,
|
||||
TPF_2D_ISTOPDOWN = 0x041
|
||||
};
|
||||
|
||||
#endif /*OPENGL_TRANSFORM_PERSISTENCE_H*/
|
||||
|
@ -174,7 +174,7 @@ is
|
||||
-- - combination (Graphic3d_TMF_PanPers | Graphic3d_TMF_ZoomPers);
|
||||
-- - combination (Graphic3d_TMF_PanPers | Graphic3d_TMF_RotatePers);
|
||||
-- - combination (Graphic3d_TMF_ZoomPers | Graphic3d_TMF_RotatePers).
|
||||
-- If Graphic3d_TMF_TriedronPers persistence mode selected APoint coordinates X and Y means:
|
||||
-- If Graphic3d_TMF_TriedronPers or Graphic3d_TMF_2d persistence mode selected APoint coordinates X and Y means:
|
||||
-- - X = 0.0, Y = 0.0 - center of view window;
|
||||
-- - X > 0.0, Y > 0.0 - right upper corner of view window;
|
||||
-- - X > 0.0, Y < 0.0 - right lower corner of view window;
|
||||
|
@ -3174,6 +3174,42 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! Auxiliary method to parse transformation persistence flags
|
||||
inline Standard_Boolean parseTrsfPersFlag (const TCollection_AsciiString& theFlagString,
|
||||
Standard_Integer& theFlags)
|
||||
{
|
||||
if (theFlagString == "pan")
|
||||
{
|
||||
theFlags |= Graphic3d_TMF_PanPers;
|
||||
}
|
||||
else if (theFlagString == "zoom")
|
||||
{
|
||||
theFlags |= Graphic3d_TMF_ZoomPers;
|
||||
}
|
||||
else if (theFlagString == "rotate")
|
||||
{
|
||||
theFlags |= Graphic3d_TMF_RotatePers;
|
||||
}
|
||||
else if (theFlagString == "trihedron")
|
||||
{
|
||||
theFlags = Graphic3d_TMF_TriedronPers;
|
||||
}
|
||||
else if (theFlagString == "full")
|
||||
{
|
||||
theFlags = Graphic3d_TMF_FullPers;
|
||||
}
|
||||
else if (theFlagString == "none")
|
||||
{
|
||||
theFlags = Graphic3d_TMF_None;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
//function : VDisplay2
|
||||
//author : ege
|
||||
@ -3202,6 +3238,12 @@ static int VDisplay2 (Draw_Interpretor& theDI,
|
||||
Graphic3d_ZLayerId aZLayer = Graphic3d_ZLayerId_UNKNOWN;
|
||||
Standard_Boolean toDisplayLocal = Standard_False;
|
||||
Standard_Boolean toReDisplay = Standard_False;
|
||||
Standard_Integer isSelectable = -1;
|
||||
Standard_Integer anObjDispMode = -2;
|
||||
Standard_Integer anObjHighMode = -2;
|
||||
Standard_Boolean toSetTrsfPers = Standard_False;
|
||||
Graphic3d_TransModeFlags aTrsfPersFlags = Graphic3d_TMF_None;
|
||||
gp_Pnt aTPPosition;
|
||||
TColStd_SequenceOfAsciiString aNamesOfDisplayIO;
|
||||
AIS_DisplayStatus aDispStatus = AIS_DS_None;
|
||||
Standard_Integer toDisplayInView = Standard_False;
|
||||
@ -3232,10 +3274,126 @@ static int VDisplay2 (Draw_Interpretor& theDI,
|
||||
aZLayer = Graphic3d_ZLayerId_Topmost;
|
||||
}
|
||||
else if (aNameCase == "-osd"
|
||||
|| aNameCase == "-toposd")
|
||||
|| aNameCase == "-toposd"
|
||||
|| aNameCase == "-overlay")
|
||||
{
|
||||
aZLayer = Graphic3d_ZLayerId_TopOSD;
|
||||
}
|
||||
else if (aNameCase == "-botosd"
|
||||
|| aNameCase == "-underlay")
|
||||
{
|
||||
aZLayer = Graphic3d_ZLayerId_BotOSD;
|
||||
}
|
||||
else if (aNameCase == "-select"
|
||||
|| aNameCase == "-selectable")
|
||||
{
|
||||
isSelectable = 1;
|
||||
}
|
||||
else if (aNameCase == "-noselect"
|
||||
|| aNameCase == "-noselection")
|
||||
{
|
||||
isSelectable = 0;
|
||||
}
|
||||
else if (aNameCase == "-dispmode"
|
||||
|| aNameCase == "-displaymode")
|
||||
{
|
||||
if (++anArgIter >= theArgNb)
|
||||
{
|
||||
std::cerr << "Error: wrong syntax at " << aName << ".\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
anObjDispMode = Draw::Atoi (theArgVec [anArgIter]);
|
||||
}
|
||||
else if (aNameCase == "-highmode"
|
||||
|| aNameCase == "-highlightmode")
|
||||
{
|
||||
if (++anArgIter >= theArgNb)
|
||||
{
|
||||
std::cerr << "Error: wrong syntax at " << aName << ".\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
anObjHighMode = Draw::Atoi (theArgVec [anArgIter]);
|
||||
}
|
||||
else if (aNameCase == "-3d")
|
||||
{
|
||||
toSetTrsfPers = Standard_True;
|
||||
aTrsfPersFlags = Graphic3d_TMF_None;
|
||||
}
|
||||
else if (aNameCase == "-2d")
|
||||
{
|
||||
toSetTrsfPers = Standard_True;
|
||||
aTrsfPersFlags = Graphic3d_TMF_2d;
|
||||
}
|
||||
else if (aNameCase == "-2dtopdown")
|
||||
{
|
||||
toSetTrsfPers = Standard_True;
|
||||
aTrsfPersFlags = Graphic3d_TMF_2d | Graphic3d_TMF_2d_IsTopDown;
|
||||
}
|
||||
else if (aNameCase == "-trsfpers"
|
||||
|| aNameCase == "-pers")
|
||||
{
|
||||
if (++anArgIter >= theArgNb)
|
||||
{
|
||||
std::cerr << "Error: wrong syntax at " << aName << ".\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
toSetTrsfPers = Standard_True;
|
||||
aTrsfPersFlags = Graphic3d_TMF_None;
|
||||
TCollection_AsciiString aPersFlags (theArgVec [anArgIter]);
|
||||
aPersFlags.LowerCase();
|
||||
for (Standard_Integer aParserPos = aPersFlags.Search ("|");; aParserPos = aPersFlags.Search ("|"))
|
||||
{
|
||||
if (aParserPos == -1)
|
||||
{
|
||||
if (!parseTrsfPersFlag (aPersFlags, aTrsfPersFlags))
|
||||
{
|
||||
std::cerr << "Error: wrong transform persistence flags " << theArgVec [anArgIter] << ".\n";
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
TCollection_AsciiString anOtherFlags = aPersFlags.Split (aParserPos - 1);
|
||||
if (!parseTrsfPersFlag (aPersFlags, aTrsfPersFlags))
|
||||
{
|
||||
std::cerr << "Error: wrong transform persistence flags " << theArgVec [anArgIter] << ".\n";
|
||||
return 1;
|
||||
}
|
||||
aPersFlags = anOtherFlags;
|
||||
}
|
||||
}
|
||||
else if (aNameCase == "-trsfperspos"
|
||||
|| aNameCase == "-perspos")
|
||||
{
|
||||
if (anArgIter + 2 >= theArgNb)
|
||||
{
|
||||
std::cerr << "Error: wrong syntax at " << aName << ".\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aX (theArgVec[++anArgIter]);
|
||||
TCollection_AsciiString aY (theArgVec[++anArgIter]);
|
||||
TCollection_AsciiString aZ = "0";
|
||||
if (!aX.IsIntegerValue()
|
||||
|| !aY.IsIntegerValue())
|
||||
{
|
||||
std::cerr << "Error: wrong syntax at " << aName << ".\n";
|
||||
return 1;
|
||||
}
|
||||
if (anArgIter + 1 < theArgNb)
|
||||
{
|
||||
TCollection_AsciiString aTemp = theArgVec[anArgIter + 1];
|
||||
if (aTemp.IsIntegerValue())
|
||||
{
|
||||
aZ = aTemp;
|
||||
++anArgIter;
|
||||
}
|
||||
}
|
||||
aTPPosition.SetCoord (aX.IntegerValue(), aY.IntegerValue(), aZ.IntegerValue());
|
||||
}
|
||||
else if (aNameCase == "-layer")
|
||||
{
|
||||
if (++anArgIter >= theArgNb)
|
||||
@ -3308,6 +3466,18 @@ static int VDisplay2 (Draw_Interpretor& theDI,
|
||||
{
|
||||
aShape->SetZLayer (aZLayer);
|
||||
}
|
||||
if (toSetTrsfPers)
|
||||
{
|
||||
aShape->SetTransformPersistence (aTrsfPersFlags, aTPPosition);
|
||||
}
|
||||
if (anObjDispMode != -2)
|
||||
{
|
||||
aShape->SetDisplayMode (anObjDispMode);
|
||||
}
|
||||
if (anObjHighMode != -2)
|
||||
{
|
||||
aShape->SetHilightMode (anObjHighMode);
|
||||
}
|
||||
GetMapOfAIS().Bind (aShape, aName);
|
||||
|
||||
Standard_Integer aDispMode = aShape->HasDisplayMode()
|
||||
@ -3315,8 +3485,14 @@ static int VDisplay2 (Draw_Interpretor& theDI,
|
||||
: (aShape->AcceptDisplayMode (aCtx->DisplayMode())
|
||||
? aCtx->DisplayMode()
|
||||
: 0);
|
||||
Standard_Integer aSelMode = aShape->HasSelectionMode() && aCtx->GetAutoActivateSelection()
|
||||
? aShape->SelectionMode() : -1;
|
||||
Standard_Integer aSelMode = -1;
|
||||
if ( isSelectable == 1
|
||||
|| (isSelectable == -1
|
||||
&& aCtx->GetAutoActivateSelection()
|
||||
&& aShape->GetTransformPersistenceMode() == 0))
|
||||
{
|
||||
aSelMode = aShape->HasSelectionMode() ? aShape->SelectionMode() : -1;
|
||||
}
|
||||
|
||||
aCtx->Display (aShape, aDispMode, aSelMode,
|
||||
Standard_False, aShape->AcceptShapeDecomposition(),
|
||||
@ -3330,6 +3506,10 @@ static int VDisplay2 (Draw_Interpretor& theDI,
|
||||
aCtx->SetViewAffinity (aShape, ViewerTest::CurrentView(), Standard_True);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Error: object with name '" << aName << "' does not exist!\n";
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -3345,14 +3525,31 @@ static int VDisplay2 (Draw_Interpretor& theDI,
|
||||
{
|
||||
aShape->SetZLayer (aZLayer);
|
||||
}
|
||||
|
||||
if (toSetTrsfPers)
|
||||
{
|
||||
aShape->SetTransformPersistence (aTrsfPersFlags, aTPPosition);
|
||||
}
|
||||
if (anObjDispMode != -2)
|
||||
{
|
||||
aShape->SetDisplayMode (anObjDispMode);
|
||||
}
|
||||
if (anObjHighMode != -2)
|
||||
{
|
||||
aShape->SetHilightMode (anObjHighMode);
|
||||
}
|
||||
Standard_Integer aDispMode = aShape->HasDisplayMode()
|
||||
? aShape->DisplayMode()
|
||||
: (aShape->AcceptDisplayMode (aCtx->DisplayMode())
|
||||
? aCtx->DisplayMode()
|
||||
: 0);
|
||||
Standard_Integer aSelMode = aShape->HasSelectionMode() && aCtx->GetAutoActivateSelection()
|
||||
? aShape->SelectionMode() : -1;
|
||||
Standard_Integer aSelMode = -1;
|
||||
if ( isSelectable == 1
|
||||
|| (isSelectable == -1
|
||||
&& aCtx->GetAutoActivateSelection()
|
||||
&& aShape->GetTransformPersistenceMode() == 0))
|
||||
{
|
||||
aSelMode = aShape->HasSelectionMode() ? aShape->SelectionMode() : -1;
|
||||
}
|
||||
|
||||
if (aShape->Type() == AIS_KOI_Datum)
|
||||
{
|
||||
@ -3378,6 +3575,10 @@ static int VDisplay2 (Draw_Interpretor& theDI,
|
||||
aCtx->Redisplay (aShape, Standard_False);
|
||||
}
|
||||
|
||||
if (aSelMode == -1)
|
||||
{
|
||||
aCtx->Erase (aShape);
|
||||
}
|
||||
aCtx->Display (aShape, aDispMode, aSelMode,
|
||||
Standard_False, aShape->AcceptShapeDecomposition(),
|
||||
aDispStatus);
|
||||
@ -4720,73 +4921,6 @@ static int VDisplayType(Draw_Interpretor& , Standard_Integer argc, const char**
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
//function : VSetTransMode
|
||||
//purpose :
|
||||
//Draw arg : vsettransmode shape flag1 [flag2] [flag3] [X Y Z]
|
||||
//==============================================================================
|
||||
|
||||
static int VSetTransMode ( Draw_Interpretor& di, Standard_Integer argc, const char** argv ) {
|
||||
// Verification des arguments
|
||||
if ( a3DView().IsNull() ) {
|
||||
ViewerTest::ViewerInit();
|
||||
di << "La commande vinit n'a pas ete appele avant" << "\n";
|
||||
}
|
||||
|
||||
if ( argc < 3 || argc > 8 ) {
|
||||
di << argv[0] << " Invalid number of arguments" << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TCollection_AsciiString shapeName;
|
||||
shapeName = argv[1];
|
||||
Standard_Integer persFlag1 = Draw::Atoi(argv[2]);
|
||||
Standard_Integer persFlag2 = 0;
|
||||
Standard_Integer persFlag3 = 0;
|
||||
gp_Pnt origin = gp_Pnt( 0.0, 0.0, 0.0 );
|
||||
if ( argc == 4 || argc == 5 || argc == 7 || argc == 8 ) {
|
||||
persFlag2 = Draw::Atoi(argv[3]);
|
||||
}
|
||||
if ( argc == 5 || argc == 8 ) {
|
||||
persFlag3 = Draw::Atoi(argv[4]);
|
||||
}
|
||||
if ( argc >= 6 ) {
|
||||
origin.SetX( Draw::Atof(argv[argc - 3]) );
|
||||
origin.SetY( Draw::Atof(argv[argc - 2]) );
|
||||
origin.SetZ( Draw::Atof(argv[argc - 1]) );
|
||||
}
|
||||
|
||||
Standard_Boolean IsBound = GetMapOfAIS().IsBound2(shapeName);
|
||||
Handle(Standard_Transient) anObj;
|
||||
if ( IsBound ) {
|
||||
anObj = GetMapOfAIS().Find2(shapeName);
|
||||
if ( anObj->IsKind(STANDARD_TYPE(AIS_InteractiveObject)) ) {
|
||||
Handle(AIS_InteractiveObject) aShape = Handle(AIS_InteractiveObject)::DownCast(anObj);
|
||||
aShape->SetTransformPersistence( (persFlag1 | persFlag2 | persFlag3), origin );
|
||||
if ( persFlag1 == 0 && persFlag2 == 0 && persFlag3 == 0 ) {
|
||||
di << argv[0] << " All persistence modifiers were removed" << "\n";
|
||||
}
|
||||
} else {
|
||||
di << argv[0] << " Wrong object type" << "\n";
|
||||
return 1;
|
||||
}
|
||||
} else { // Create the AIS_Shape from a name
|
||||
const Handle(AIS_InteractiveObject) aShape = GetAISShapeFromName((const char* )shapeName.ToCString());
|
||||
if ( !aShape.IsNull() ) {
|
||||
GetMapOfAIS().Bind( aShape, shapeName );
|
||||
aShape->SetTransformPersistence( (persFlag1 | persFlag2 | persFlag3), origin );
|
||||
TheAISContext()->Display( aShape, Standard_False );
|
||||
} else {
|
||||
di << argv[0] << " Object not found" << "\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Upadate the screen and redraw the view
|
||||
TheAISContext()->UpdateCurrentViewer();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer vr(Draw_Interpretor& , Standard_Integer , const char** a)
|
||||
{
|
||||
ifstream s(a[1]);
|
||||
@ -4946,13 +5080,22 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
|
||||
__FILE__, visos, group);
|
||||
|
||||
theCommands.Add("vdisplay",
|
||||
"vdisplay [-noupdate|-update] [-local] [-mutable] name1 [name2] ... [name n]"
|
||||
"vdisplay [-noupdate|-update] [-local] [-mutable] [-overlay|-underlay]"
|
||||
"\n\t\t: [-trsfPers flags] [-trsfPersPos X Y [Z]] [-3d|-2d|-2dTopDown]"
|
||||
"\n\t\t: [-dispMode mode] [-highMode mode]"
|
||||
"\n\t\t: name1 [name2] ... [name n]"
|
||||
"\n\t\t: Displays named objects."
|
||||
"\n\t\t: Option -local enables displaying of objects in local"
|
||||
"\n\t\t: selection context. Local selection context will be opened"
|
||||
"\n\t\t: if there is not any."
|
||||
"\n\t\t: Option -noupdate suppresses viewer redraw call."
|
||||
"\n\t\t: Option -mutable enables optimizations for mutable objects.",
|
||||
"\n\t\t: -noupdate suppresses viewer redraw call."
|
||||
"\n\t\t: -mutable enables optimizations for mutable objects."
|
||||
"\n\t\t: -overlay draws objects in overlay."
|
||||
"\n\t\t: -underlay draws objects in underlay."
|
||||
"\n\t\t: -selectable|-noselect controls selection of objects."
|
||||
"\n\t\t: -trsfPers sets a transform persistence flags."
|
||||
"\n\t\t: -trsfPersPos sets an anchor point for transform persistence."
|
||||
"\n\t\t: -2d|-2dTopDown displays object in screen coordinates.",
|
||||
__FILE__, VDisplay2, group);
|
||||
|
||||
theCommands.Add ("vupdate",
|
||||
@ -5217,10 +5360,6 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
|
||||
"vtypes : list of known types and signatures in AIS - To be Used in vpickobject command for selection with filters",
|
||||
VIOTypes,group);
|
||||
|
||||
theCommands.Add("vsettransmode",
|
||||
"vsettransmode : vsettransmode shape flag1 [flag2] [flag3] [X Y Z]",
|
||||
__FILE__,VSetTransMode,group);
|
||||
|
||||
theCommands.Add("vr", "vr : reading of the shape",
|
||||
__FILE__,vr, group);
|
||||
|
||||
|
@ -88,6 +88,13 @@ myZLayerGenId (1, IntegerLast())
|
||||
MyGraphicDriver = theDriver;
|
||||
|
||||
// default layers are always presented in display layer sequence it can not be removed
|
||||
Graphic3d_ZLayerSettings anUnderlaySettings;
|
||||
anUnderlaySettings.Flags = 0;
|
||||
anUnderlaySettings.IsImmediate = false;
|
||||
myLayerIds.Add (Graphic3d_ZLayerId_BotOSD);
|
||||
myLayerSeq.Append (Graphic3d_ZLayerId_BotOSD);
|
||||
myMapOfZLayerSettings.Bind (Graphic3d_ZLayerId_BotOSD, anUnderlaySettings);
|
||||
|
||||
Graphic3d_ZLayerSettings aDefSettings;
|
||||
aDefSettings.Flags = Graphic3d_ZLayerDepthTest
|
||||
| Graphic3d_ZLayerDepthWrite;
|
||||
|
@ -2,7 +2,7 @@ puts "============="
|
||||
puts "FRA62523"
|
||||
puts "============="
|
||||
|
||||
igesbrep [locate_data_file fra62523a.igs] a *
|
||||
igesbrep [locate_data_file fra62523a.igs] a_1 *
|
||||
|
||||
# tpcompound b
|
||||
# checkshape a_1
|
||||
|
@ -23,7 +23,7 @@ set nb_compound_good 0
|
||||
set nb_shape_good 503
|
||||
|
||||
vinit
|
||||
vdisplay res
|
||||
vdisplay result
|
||||
vsetdispmode 1
|
||||
vfit
|
||||
|
||||
|
@ -6,7 +6,7 @@ puts ""
|
||||
|
||||
restore [locate_data_file buc60967.draw] bs2
|
||||
|
||||
to3d result bs2
|
||||
to3d res bs2
|
||||
|
||||
set 3dviewer 0
|
||||
|
||||
|
@ -14,8 +14,8 @@ set BugNumber OCC22910
|
||||
|
||||
catch { pload MODELING }
|
||||
|
||||
restore [locate_data_file s.rle] result
|
||||
set exception_status [ catch { uiso u result 0.5 } ]
|
||||
restore [locate_data_file s.rle] res
|
||||
set exception_status [ catch { uiso u res 0.5 } ]
|
||||
|
||||
if { ${exception_status} == 0 } {
|
||||
puts "OK ${BugNumber}"
|
||||
|
@ -10,7 +10,7 @@ puts ""
|
||||
######################################################
|
||||
cpulimit 60
|
||||
vinit
|
||||
set out [OCC2569 26 result]
|
||||
set out [OCC2569 26 res]
|
||||
if {[string compare $out "\n Degree = 25\n"] == 0} {
|
||||
puts "OCC2569: OK"
|
||||
} else {
|
||||
|
@ -11,7 +11,7 @@ set BugNumber OCC6474
|
||||
restore [locate_data_file OCC6474-s1.draw] s1
|
||||
restore [locate_data_file OCC6474-s2.draw] s2
|
||||
|
||||
intersect result s1 s2
|
||||
intersect res s1 s2
|
||||
|
||||
if {[llength [directory res*]] != 1} {
|
||||
puts "Faulty ${BugNumber}: more than 1 intersection line is got"
|
||||
|
@ -10,11 +10,8 @@ box b1 10 20 30
|
||||
box b2 10 20 30
|
||||
ttranslate b2 50 50 0
|
||||
vinit
|
||||
vdisplay b1
|
||||
# This line breaks normal rendering
|
||||
# of all subsequently displayed presentations
|
||||
vsettransmode b1 32 0 0 0 0 0
|
||||
# This box is drawn incorrectly due to the bug
|
||||
vdisplay b1 -trsfPers trihedron
|
||||
|
||||
vdisplay b2
|
||||
vfit
|
||||
vsetdispmode 1
|
||||
@ -31,4 +28,3 @@ if { $stat != 1 } {
|
||||
}
|
||||
|
||||
set only_screen 1
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
puts "================"
|
||||
puts "OCC23120"
|
||||
puts "================"
|
||||
puts ""
|
||||
######################################
|
||||
# Transform persistence is not restored
|
||||
######################################
|
||||
|
||||
set BugNumber OCC23120
|
||||
|
||||
catch {pload XDE}
|
||||
|
||||
box b1 10 20 30
|
||||
box b2 10 20 30
|
||||
ttranslate b2 50 50 0
|
||||
vinit
|
||||
vdisplay b1
|
||||
vsettransmode b1 32 0 0 0 0 0
|
||||
vdisplay b2
|
||||
vfit
|
||||
vsetdispmode 1
|
||||
vzoom 0.5
|
||||
vpan 100 0
|
||||
|
||||
set only_screen 1
|
||||
|
41
tests/bugs/vis/bug25783_1
Normal file
41
tests/bugs/vis/bug25783_1
Normal file
@ -0,0 +1,41 @@
|
||||
puts "============"
|
||||
puts "OCC25783_1"
|
||||
puts "Draw 2D objects."
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
vinit View1
|
||||
vclear
|
||||
vaxo
|
||||
|
||||
# display polyline in overlay
|
||||
text2brep tcc "Center" Times-Roman 30
|
||||
vdisplay tcc -2d -osd
|
||||
polyline lcc -50 -50 0 -50 50 0 50 50 0 50 0 0 0 -50 0 -50 -50 0
|
||||
vdisplay lcc -2d -overlay
|
||||
|
||||
# display polyline in overlay in the bottom left corner of the view
|
||||
text2brep tbl "Bottom-Left" Times-Roman 30
|
||||
vdisplay tbl -2d -trsfPersPos -1 -1 5 -osd
|
||||
polyline lbl 0 0 0 0 100 0 100 100 0 100 50 0 50 0 0 0 0 0
|
||||
vdisplay lbl -2d -trsfPersPos -1 -1 3 -overlay
|
||||
|
||||
# display polyline in overlay in the top left corner of the view
|
||||
text2brep ttl "Top-Left" Times-Roman 30 x=-27 y=0
|
||||
vdisplay ttl -2d -trsfPersPos -1 1 30 -osd
|
||||
polyline ltl 0 -100 0 0 0 0 100 0 0 100 -50 0 50 -100 0 0 -100 0
|
||||
vdisplay ltl -2d -trsfPersPos -1 1 3 -overlay
|
||||
|
||||
# display polyline in overlay in the top right corner of the view
|
||||
text2brep ttr "Top-Right" Times-Roman 30 x=-100 y=0
|
||||
vdisplay ttr -2d -trsfPersPos 1 1 30 -osd
|
||||
polyline ltr -100 -100 0 -100 0 0 0 0 0 0 -50 0 -50 -100 0 -100 -100 0
|
||||
vdisplay ltr -2d -trsfPersPos 1 1 3 -overlay
|
||||
|
||||
# display polyline in overlay in the bottom right corner of the view
|
||||
text2brep tbr "Bottom-Right" Times-Roman 30 x=-165 y=0
|
||||
vdisplay tbr -2d -trsfPersPos 1 -1 5 -osd
|
||||
polyline lbr -100 0 0 -100 100 0 0 100 0 0 50 0 -50 0 0 -100 0 0
|
||||
vdisplay lbr -2d -trsfPersPos 1 -1 3 -overlay
|
||||
|
||||
vdump ${imagedir}/${casename}.png
|
41
tests/bugs/vis/bug25783_2
Normal file
41
tests/bugs/vis/bug25783_2
Normal file
@ -0,0 +1,41 @@
|
||||
puts "============"
|
||||
puts "OCC25783_1"
|
||||
puts "Draw 2d objects in top-down mode."
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
vinit View1
|
||||
vclear
|
||||
vaxo
|
||||
|
||||
# display polyline in overlay
|
||||
text2brep tcc "Center" Times-Roman 30
|
||||
vdisplay tcc -2dTopDown -osd
|
||||
polyline lcc -50 -50 0 -50 50 0 50 50 0 50 0 0 0 -50 0 -50 -50 0
|
||||
vdisplay lcc -2dTopDown -overlay
|
||||
|
||||
# display polyline in overlay in the top left corner of the view
|
||||
text2brep ttl "Top-Left" Times-Roman 30
|
||||
vdisplay ttl -2dTopDown -trsfPersPos -1 -1 5 -osd
|
||||
polyline ltl 0 0 0 0 100 0 100 100 0 100 50 0 50 0 0 0 0 0
|
||||
vdisplay ltl -2dTopDown -trsfPersPos -1 -1 3 -overlay
|
||||
|
||||
# display polyline in overlay in the bottom left corner of the view
|
||||
text2brep tbl "Bottom-Left" Times-Roman 30 x=-27 y=0
|
||||
vdisplay tbl -2dTopDown -trsfPersPos -1 1 30 -osd
|
||||
polyline lbl 0 -100 0 0 0 0 100 0 0 100 -50 0 50 -100 0 0 -100 0
|
||||
vdisplay lbl -2dTopDown -trsfPersPos -1 1 3 -overlay
|
||||
|
||||
# display polyline in overlay in the bottom right corner of the view
|
||||
text2brep tbr Bottom-Right Times-Roman 30 x=-145 y=0
|
||||
vdisplay tbr -2dTopDown -trsfPersPos 1 1 30 -osd
|
||||
polyline lbr -100 -100 0 -100 0 0 0 0 0 0 -50 0 -50 -100 0 -100 -100 0
|
||||
vdisplay lbr -2dTopDown -trsfPersPos 1 1 3 -overlay
|
||||
|
||||
# display polyline in overlay in the top right corner of the view
|
||||
text2brep ttr "Top-Right" Times-Roman 30 x=-130 y=0
|
||||
vdisplay ttr -2dTopDown -trsfPersPos 1 -1 5 -osd
|
||||
polyline ltr -100 0 0 -100 100 0 0 100 0 0 50 0 -50 0 0 -100 0 0
|
||||
vdisplay ltr -2dTopDown -trsfPersPos 1 -1 3 -overlay
|
||||
|
||||
vdump ${imagedir}/${casename}.png
|
@ -11,11 +11,10 @@ set anImage2 $imagedir/${casename}_2.png
|
||||
vinit
|
||||
box b1 -1 -1 -1 3 3 3
|
||||
box b2 4 4 4 30 20 20
|
||||
vdisplay b1 b2
|
||||
vsettransmode b2 2 0 0 0
|
||||
vdisplay b1
|
||||
vdisplay b2 -trsfPers zoom -trsfPersPos 0 0 0
|
||||
vfit
|
||||
vdump $anImage1
|
||||
|
||||
vsettransmode b2 2 1 1 1
|
||||
vdisplay b2 -trsfPers zoom -trsfPersPos 1 1 1
|
||||
vdump $anImage2
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
puts "TODO OCC641 ALL: An exception was caught"
|
||||
puts "TODO OCC641 ALL: \\*\\* Exception \\*\\*.*"
|
||||
puts "TODO OCC641 ALL: Error : result shape is displayed wrongly"
|
||||
|
||||
puts "================"
|
||||
puts "OCC641"
|
||||
puts "SAM1559"
|
||||
@ -13,13 +17,13 @@ vinit
|
||||
vdisplay a
|
||||
vfit
|
||||
|
||||
copy a b
|
||||
copy a result
|
||||
|
||||
if [catch {tmirror result 0 0 0 0 1 0 } res] {
|
||||
puts "Error : function tmirror works wrongly"
|
||||
} else {
|
||||
if [catch { vdisplay result } res] {
|
||||
puts "Error : result shape is displaed wrongly"
|
||||
puts "Error : result shape is displayed wrongly"
|
||||
}
|
||||
vfit
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user