-// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <QtxActionToolMgr.h>
#include <SALOME_AISShape.hxx>
+#include <Standard_Version.hxx>
#include <SelectMgr_ListIteratorOfListOfFilter.hxx>
#include <QMouseEvent>
#include <QContextMenuEvent>
+#include <QTimer>
-#define SALOME_PATCH_FOR_CTRL_WHEEL
+#if OCC_VERSION_HEX < 0x070400
+ #define SALOME_PATCH_FOR_CTRL_WHEEL
+#endif
SHAPERGUI_SalomeView::SHAPERGUI_SalomeView(OCCViewer_Viewer* theViewer)
: ModuleBase_IViewWindow(), myCurrentView(0)
myWindowScale.insert(aView->getViewPort()->getView(),
aView->getViewPort()->getView()->Camera()->Scale());
- emit viewCreated(myView);
+ QTimer::singleShot(10, this, SLOT(onAfterViewCreated()));
+ emit viewCreated(myView);
+}
+//**********************************************
+void SHAPERGUI_SalomeViewer::onAfterViewCreated()
+{
+ // Update trihedron and dimension arrows
+ emit onViewTransformed(OCCViewer_ViewWindow::ZOOMVIEW);
}
+
//**********************************************
void SHAPERGUI_SalomeViewer::onActivated(SUIT_ViewManager* theMgr)
{
aView3d->SetProj(theX, theY, theZ);
aView3d->SetTwist( theTwist );
aView3d->FitAll(0.01, false);
- aView3d->SetZSize(0.);
+ //aView3d->SetZSize(0.);
if (aView3d->Depth() < 0.1)
aView3d->DepthFitAll();
}
}
}
+bool SHAPERGUI_SalomeViewer::isColorScaleVisible() const
+{
+ if (mySelector) {
+ return mySelector->viewer()->isColorScaleVisible();
+ }
+ return false;
+}
+
+void SHAPERGUI_SalomeViewer::setColorScaleShown(bool on)
+{
+ if (mySelector) {
+ mySelector->viewer()->setColorScaleShown(on);
+ }
+}
+
+void SHAPERGUI_SalomeViewer::setColorScalePosition(double theX, double theY)
+{
+ if (mySelector) {
+ QWidget* aWindow = activeViewPort();
+ mySelector->viewer()->getColorScale()->SetPosition(aWindow->width() * theX,
+ aWindow->height() * theY);
+ }
+}
+
+void SHAPERGUI_SalomeViewer::setColorScaleSize(double theW, double theH)
+{
+ if (mySelector) {
+ QWidget* aWindow = activeViewPort();
+ mySelector->viewer()->getColorScale()->SetSize(aWindow->width() * theW,
+ aWindow->height() * theH);
+ }
+}
+
+void SHAPERGUI_SalomeViewer::setColorScaleRange(double theMin, double theMax)
+{
+ if (mySelector) {
+ mySelector->viewer()->getColorScale()->SetRange(theMin, theMax);
+ }
+}
+
+void SHAPERGUI_SalomeViewer::setColorScaleIntervals(int theNb)
+{
+ if (mySelector) {
+ mySelector->viewer()->getColorScale()->SetNumberOfIntervals(theNb);
+ }
+}
+
+void SHAPERGUI_SalomeViewer::setColorScaleTextHeigth(int theH)
+{
+ if (mySelector) {
+ mySelector->viewer()->getColorScale()->SetTextHeight(theH);
+ }
+}
+
+void SHAPERGUI_SalomeViewer::setColorScaleTextColor(const QColor& theColor)
+{
+ if (mySelector) {
+ Quantity_Color aColor(theColor.redF(), theColor.greenF(), theColor.blueF(), Quantity_TOC_RGB);
+ mySelector->viewer()->getColorScale()->SetColor(aColor);
+ }
+}
+
+void SHAPERGUI_SalomeViewer::setColorScaleTitle(const QString& theText)
+{
+ if (mySelector) {
+ mySelector->viewer()->getColorScale()->SetTitle(theText.toStdString().c_str());
+ }
+}
+
+void SHAPERGUI_SalomeViewer::setFitter(OCCViewer_Fitter* theFitter)
+{
+ if (mySelector)
+ mySelector->viewer()->setFitter(theFitter);
+}
+
+OCCViewer_Fitter* SHAPERGUI_SalomeViewer::fitter() const
+{
+ if (mySelector)
+ return mySelector->viewer()->fitter();
+ return 0;
+}
+
+
//void SHAPERGUI_SalomeViewer::Zfitall()
//{
// if (!mySelector || !mySelector->viewer())