myView = theViewer->Driver()->CreateView (theViewer->StructureManager());
myView->CopySettings (theView->View());
+ myDefaultViewPoint = theView->myDefaultViewPoint;
+ myDefaultViewAxis = theView->myDefaultViewAxis;
- myDefaultCamera = new Graphic3d_Camera();
+ myDefaultCamera = new Graphic3d_Camera (theView->DefaultCamera());
myImmediateUpdate = Standard_False;
SetAutoZFitMode (theView->AutoZFitMode(), theView->AutoZFitScaleFactor());
- SetAxis (0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
- SetViewMappingDefault();
- SetViewOrientationDefault();
theViewer->AddView (this);
Init();
myImmediateUpdate = Standard_True;
#include <Standard_CString.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Macro.hxx>
+#include <TCollection_AsciiString.hxx>
#include <TColStd_HArray1OfTransient.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_HArray1OfShape.hxx>
class AIS_InteractiveContext;
class AIS_InteractiveObject;
-class TCollection_AsciiString;
-class Standard_Transient;
class Image_PixMap;
class V3d_View;
class V3d_Viewer;
Standard_EXPORT static void Factory (Draw_Interpretor& theDI);
//! Creates view with default or custom name
- //! and add this name in map to manage muliple views
- //! implemented in ViewerTest_ViewerCommands.cxx
+ //! and adds this name in map to manage multiple views.
+ //! Implemented in ViewerTest_ViewerCommands.cxx.
+ //! @param thePxLeft left position of newly created window
+ //! @param thePxTop top position of newly created window
+ //! @param thePxWidth width of newly created window
+ //! @param thePxHeight height of newly created window
+ //! @param theViewName name of newly created View
+ //! @oaram theDisplayName display name
+ //! @param theViewToClone when specified, the new View will copy properties of existing one
Standard_EXPORT static TCollection_AsciiString ViewerInit (const Standard_Integer thePxLeft = 0,
const Standard_Integer thePxTop = 0,
const Standard_Integer thePxWidth = 0,
const Standard_Integer thePxHeight = 0,
- const Standard_CString theViewName = "",
- const Standard_CString theDisplayName = "");
+ const TCollection_AsciiString& theViewName = "",
+ const TCollection_AsciiString& theDisplayName = "",
+ const Handle(V3d_View)& theViewToClone = Handle(V3d_View)());
Standard_EXPORT static void RemoveViewName (const TCollection_AsciiString& theName);
const Standard_Integer thePxTop,
const Standard_Integer thePxWidth,
const Standard_Integer thePxHeight,
- Standard_CString theViewName,
- Standard_CString theDisplayName)
+ const TCollection_AsciiString& theViewName,
+ const TCollection_AsciiString& theDisplayName,
+ const Handle(V3d_View)& theViewToClone)
{
// Default position and dimension of the viewer window.
// Note that left top corner is set to be sufficiently small to have
Standard_Integer aPxWidth = 409;
Standard_Integer aPxHeight = 409;
Standard_Boolean toCreateViewer = Standard_False;
+ if (!theViewToClone.IsNull())
+ {
+ theViewToClone->Window()->Size (aPxWidth, aPxHeight);
+ }
Handle(OpenGl_GraphicDriver) aGraphicDriver;
ViewerTest_Names aViewNames(theViewName);
VT_GetWindow()->SetVirtual (Draw_VirtualWindows);
// View setup
- Handle(V3d_View) aView = a3DViewer->CreateView();
+ Handle(V3d_View) aView;
+ if (!theViewToClone.IsNull())
+ {
+ aView = new V3d_View (a3DViewer, theViewToClone);
+ }
+ else
+ {
+ aView = new V3d_View (a3DViewer, a3DViewer->DefaultTypeOfView());
+ }
+
aView->SetWindow (VT_GetWindow());
ViewerTest::GetAISContext()->RedrawImmediate (a3DViewer);
{
TCollection_AsciiString aViewName, aDisplayName;
Standard_Integer aPxLeft = 0, aPxTop = 0, aPxWidth = 0, aPxHeight = 0;
+ Handle(V3d_View) aCopyFrom;
TCollection_AsciiString aName, aValue;
for (Standard_Integer anArgIt = 1; anArgIt < theArgsNb; ++anArgIt)
{
{
aDisplayName = theArgVec[++anArgIt];
}
+ else if (!ViewerTest::CurrentView().IsNull()
+ && aCopyFrom.IsNull()
+ && (anArgCase == "-copy"
+ || anArgCase == "-clone"
+ || anArgCase == "-cloneactive"
+ || anArgCase == "-cloneactiveview"))
+ {
+ aCopyFrom = ViewerTest::CurrentView();
+ }
// old syntax
else if (ViewerTest::SplitParameter (anArg, aName, aValue))
{
}
TCollection_AsciiString aViewId = ViewerTest::ViewerInit (aPxLeft, aPxTop, aPxWidth, aPxHeight,
- aViewName.ToCString(),
- aDisplayName.ToCString());
+ aViewName, aDisplayName, aCopyFrom);
theDi << aViewId;
return 0;
}
? int(anImgRef->SizeY() * 2)
: int(anImgRef->SizeY());
TCollection_AsciiString aDisplayName;
- TCollection_AsciiString aViewId = ViewerTest::ViewerInit (aPxLeft, aPxTop,
- aWinSizeX, aWinSizeY,
- aViewName.ToCString(),
- aDisplayName.ToCString());
+ TCollection_AsciiString aViewId = ViewerTest::ViewerInit (aPxLeft, aPxTop, aWinSizeX, aWinSizeY,
+ aViewName, aDisplayName);
Standard_Real aRatio = anImgRef->Ratio();
Standard_Real aSizeX = 1.0;
const char *group = "ZeViewer";
theCommands.Add("vinit",
"vinit [-name viewName] [-left leftPx] [-top topPx] [-width widthPx] [-height heightPx]"
- "\n\t\t: [-exitOnClose] [-closeOnEscape]"
+ "\n\t\t: [-exitOnClose] [-closeOnEscape] [-cloneActive]"
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
"\n\t\t: [-display displayName]"
#endif
#endif
"\n\t\t: -left, -top pixel position of left top corner of the window."
"\n\t\t: -width, -height width and heigth of window respectively."
+ "\n\t\t: -cloneActive floag to copy camera and dimensions of active view."
"\n\t\t: -exitOnClose when specified, closing the view will exit application."
"\n\t\t: -closeOnEscape when specified, view will be closed on pressing Escape."
"\n\t\t: Additional commands for operations with views: vclose, vactivate, vviewlist.",