mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0024430: vviewlist draw command does not added name of viewer created by XShow draw command
Remove ViewerTest_Tool, keep only one unified way to create viewer using ViewerTest - ViewerTest::ViewerInit(). Remove test case bugs/vis/buc60851 and command BUC60851. Added test case bugs/xde/bug24430
This commit is contained in:
@@ -34,12 +34,6 @@ uses
|
||||
|
||||
is
|
||||
|
||||
class Tool;
|
||||
---Purpose: to build a context and set a given context as current
|
||||
-- for ViewerTest.
|
||||
|
||||
|
||||
|
||||
class EventManager;
|
||||
---Purpose: used to manage mouse event (move,select,shiftselect)
|
||||
-- By default the events are transmitted to interactive context.
|
||||
@@ -79,8 +73,14 @@ is
|
||||
GetCurrentViewName returns AsciiString from TCollection;
|
||||
|
||||
---Category: Delete the viewer....
|
||||
RemoveView (theViewName:AsciiString from TCollection;
|
||||
isContextRemoved:Boolean from Standard= Standard_True);
|
||||
RemoveView (theViewName : AsciiString from TCollection;
|
||||
theToRemoveContext : Boolean from Standard = Standard_True);
|
||||
---Purpose: Removes view and clear all maps
|
||||
-- with information about its resources if neccessary
|
||||
|
||||
---Category: Delete the viewer....
|
||||
RemoveView (theView : View from V3d;
|
||||
theToRemoveContext : Boolean from Standard = Standard_True);
|
||||
---Purpose: Removes view and clear all maps
|
||||
-- with information about its resources if neccessary
|
||||
|
||||
|
@@ -2419,7 +2419,6 @@ static int VCircleBuilder(Draw_Interpretor& /*di*/, Standard_Integer argc, const
|
||||
#include <Font_NameOfFont.hxx>
|
||||
|
||||
#include <Visual3d_ViewManager.hxx>
|
||||
#include <ViewerTest_Tool.ixx>
|
||||
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
|
||||
|
@@ -1,39 +0,0 @@
|
||||
-- Created on: 1998-10-15
|
||||
-- Created by: Denis PASCAL
|
||||
-- Copyright (c) 1998-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
--
|
||||
-- This file is part of Open CASCADE Technology software library.
|
||||
--
|
||||
-- This library is free software; you can redistribute it and/or modify it under
|
||||
-- the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
-- by the Free Software Foundation, with special exception defined in the file
|
||||
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
-- distribution for complete text of the license and disclaimer of any warranty.
|
||||
--
|
||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||
-- commercial license or contractual agreement.
|
||||
|
||||
class Tool from ViewerTest
|
||||
|
||||
---Purpose: to build and initialize ViewerTest static variables.
|
||||
-- ====================================================
|
||||
|
||||
uses Viewer from V3d,
|
||||
InteractiveContext from AIS
|
||||
|
||||
|
||||
is
|
||||
|
||||
MakeViewer (myclass; title : CString from Standard)
|
||||
---Purpose: create a new <context>. ViewerTest variables are not initialized;
|
||||
returns Viewer from V3d;
|
||||
|
||||
MakeContext (myclass; title : CString from Standard)
|
||||
---Purpose: create a new <context>. ViewerTest variables are not initialized;
|
||||
returns InteractiveContext from AIS;
|
||||
|
||||
InitViewerTest (myclass; current : InteractiveContext from AIS);
|
||||
---Purpose: init variables of ViewerTest with <current>
|
||||
|
||||
end Tool;
|
@@ -1,141 +0,0 @@
|
||||
// Created on: 1998-10-15
|
||||
// Created by: Denis PASCAL
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifdef WNT
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <ViewerTest_Tool.ixx>
|
||||
|
||||
#include <V3d_View.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <ViewerTest.hxx>
|
||||
#include <string.h>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <Draw.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <V3d.hxx>
|
||||
#include <AIS_DisplayMode.hxx>
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <AIS_MapOfInteractive.hxx>
|
||||
#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
|
||||
#include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
|
||||
#include <ViewerTest_EventManager.hxx>
|
||||
#include <Draw_Window.hxx>
|
||||
#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
||||
#include <AIS_ListOfInteractive.hxx>
|
||||
#include <Aspect_Window.hxx>
|
||||
#include <Aspect_DisplayConnection.hxx>
|
||||
#include <Graphic3d.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
#include <WNT_WClass.hxx>
|
||||
#include <WNT_Window.hxx>
|
||||
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
#include <Cocoa_Window.hxx>
|
||||
#else
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <Xw_Window.hxx>
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
// GLOBAL VARIABLES
|
||||
//==============================================================================
|
||||
#define ZCLIPWIDTH 1.
|
||||
|
||||
static Handle(Aspect_DisplayConnection)& GetDisplayConnection()
|
||||
{
|
||||
static Handle(Aspect_DisplayConnection) aDisplayConnection;
|
||||
static Standard_Boolean isFirst = Standard_True;
|
||||
if (isFirst)
|
||||
{
|
||||
aDisplayConnection = new Aspect_DisplayConnection();
|
||||
isFirst = Standard_False;
|
||||
}
|
||||
return aDisplayConnection;
|
||||
}
|
||||
|
||||
Standard_IMPORT Standard_Boolean Draw_VirtualWindows;
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeViewer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(V3d_Viewer) ViewerTest_Tool::MakeViewer (const Standard_CString theTitle)
|
||||
{
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
Handle(Aspect_Window) window = new WNT_Window (theTitle,
|
||||
Handle(WNT_WClass)::DownCast (ViewerTest::WClass()),
|
||||
WS_OVERLAPPEDWINDOW, 0, 460, 409, 409, Quantity_NOC_BLACK);
|
||||
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
|
||||
Handle(Aspect_Window) window = new Cocoa_Window (theTitle, 0, 460, 409, 409);
|
||||
#else
|
||||
Handle(Aspect_Window) window = new Xw_Window (GetDisplayConnection(), theTitle, 0, 460, 409, 409);
|
||||
#endif
|
||||
window->SetVirtual (Draw_VirtualWindows);
|
||||
window->Map();
|
||||
|
||||
// Viewer
|
||||
Handle(Graphic3d_GraphicDriver) aDriver = Graphic3d::InitGraphicDriver (GetDisplayConnection());
|
||||
TCollection_ExtendedString NameOfWindow("Visu3D");
|
||||
Handle(V3d_Viewer) a3DViewer = new V3d_Viewer(aDriver,NameOfWindow.ToExtString());
|
||||
|
||||
a3DViewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK);
|
||||
a3DViewer->SetDefaultLights();
|
||||
a3DViewer->SetLightOn();
|
||||
|
||||
// View
|
||||
Handle (V3d_View) V = a3DViewer->CreateView();
|
||||
V->SetWindow(window);
|
||||
V->SetZClippingDepth(0.5);
|
||||
V->SetZClippingWidth(ZCLIPWIDTH/2.);
|
||||
|
||||
return a3DViewer;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeContext
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(AIS_InteractiveContext) ViewerTest_Tool::MakeContext (const Standard_CString title)
|
||||
{
|
||||
return new AIS_InteractiveContext (MakeViewer(title));
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : InitViewerTest
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
// ********* next method is defined in ViewerTest_ViewerCommands.hxx ****
|
||||
extern void ViewerTest_InitViewerTest (const Handle(AIS_InteractiveContext)&);
|
||||
// **********************************************************************
|
||||
|
||||
void ViewerTest_Tool::InitViewerTest (const Handle(AIS_InteractiveContext)& context)
|
||||
{
|
||||
ViewerTest_InitViewerTest (context);
|
||||
}
|
||||
|
@@ -1010,6 +1010,22 @@ void ActivateView (const TCollection_AsciiString& theViewName)
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
//function : RemoveView
|
||||
//purpose :
|
||||
//==============================================================================
|
||||
void ViewerTest::RemoveView (const Handle(V3d_View)& theView,
|
||||
const Standard_Boolean theToRemoveContext)
|
||||
{
|
||||
if (!ViewerTest_myViews.IsBound2 (theView))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const TCollection_AsciiString aViewName = ViewerTest_myViews.Find2 (theView);
|
||||
RemoveView (aViewName, theToRemoveContext);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
//function : RemoveView
|
||||
//purpose : Close and remove view from display, clear maps if neccessary
|
||||
@@ -2526,38 +2542,6 @@ while (ViewerMainLoop( argc, argv)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
//function : InitViewerTest
|
||||
//purpose : initialisation de toutes les variables static de ViewerTest (dp)
|
||||
//==============================================================================
|
||||
|
||||
void ViewerTest_InitViewerTest (const Handle(AIS_InteractiveContext)& theContext)
|
||||
{
|
||||
Handle(V3d_Viewer) aViewer = theContext->CurrentViewer();
|
||||
ViewerTest::SetAISContext(theContext);
|
||||
aViewer->InitActiveViews();
|
||||
Handle(V3d_View) aView = aViewer->ActiveView();
|
||||
if (aViewer->MoreActiveViews()) ViewerTest::CurrentView(aView);
|
||||
ViewerTest::ResetEventManager();
|
||||
Handle(Aspect_Window) aWindow = aView->Window();
|
||||
#if !defined(_WIN32) && !defined(__WIN32__) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
|
||||
// X11
|
||||
VT_GetWindow() = Handle(Xw_Window)::DownCast(aWindow);
|
||||
OSWindowSetup();
|
||||
static int aFirst = 1;
|
||||
if ( aFirst ) {
|
||||
#if TCL_MAJOR_VERSION < 8
|
||||
Tk_CreateFileHandler((void*)XConnectionNumber(GetDisplayConnection()->GetDisplay()),
|
||||
TK_READABLE, VProcessEvents, (ClientData) 0);
|
||||
#else
|
||||
Tk_CreateFileHandler(XConnectionNumber(GetDisplayConnection()->GetDisplay()),
|
||||
TK_READABLE, VProcessEvents, (ClientData) 0);
|
||||
#endif
|
||||
aFirst = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
//function : VSetBg
|
||||
//purpose : Load image as background
|
||||
|
Reference in New Issue
Block a user