____
+.. image:: ../../../../src/OCCViewer/resources/occ_view_rect_style.png
+ :align: center
+
+**Advanced selection by polygon** - enables advanced selection by polygon.
+
+____
+
+.. image:: ../../../../src/OCCViewer/resources/occ_view_circle_style.png
+ :align: center
+
+**Advanced selection by polygon** - enables advanced selection by circle.
+
+____
+
.. image:: ../../../../src/OCCViewer/resources/occ_view_fitall.png
:align: center
- **Enable preselection** - switches preselection on/off.
- **Enable selection** - switches selection on/off.
+ - **Advanced selection** - switches default advanced selection style by Polygon or by Circle.
- **Clipping parameters** - specifies the default clipping plane parameters.
resMgr->doubleValue( "OCCViewer", "focus_value", vm->stereographicFocusValue() ));
vm->setInterocularDistance( resMgr->integerValue( "OCCViewer", "iod_type", vm->interocularDistanceType() ),
resMgr->doubleValue( "OCCViewer", "iod_value", vm->interocularDistanceValue() ));
+ vm->setSelectionStyle( resMgr->integerValue( "OCCViewer", "adv_selection_mode", vm->selectionStyle() ) );
vm->setReverseStereo( resMgr->booleanValue( "OCCViewer", "reverse_stereo", vm->isReverseStereo() ) );
vm->setVSync( resMgr->booleanValue( "OCCViewer", "enable_vsync", vm->isVSync() ) );
// ... "Selection" group <<start>>
int occSelectionGroup = pref->addPreference( tr( "PREF_GROUP_SELECTION" ), occGroup );
- pref->setItemProperty( "columns", 2, occSelectionGroup );
+ pref->setItemProperty( "columns", 3, occSelectionGroup );
// .... -> enable preselection
pref->addPreference( tr( "PREF_ENABLE_PRESELECTION" ), occSelectionGroup,
LightApp_Preferences::Bool, "OCCViewer", "enable_preselection" );
// .... -> enable selection
pref->addPreference( tr( "PREF_ENABLE_SELECTION" ), occSelectionGroup,
LightApp_Preferences::Bool, "OCCViewer", "enable_selection" );
+ // .... -> selection style
+ int aSeleStyle = pref->addPreference( tr( "PREF_SELECTION_STYLE" ), occSelectionGroup,
+ LightApp_Preferences::Selector, "OCCViewer", "adv_selection_mode" );
+ aValuesList.clear();
+ anIndicesList.clear();
+ aValuesList << tr("PREF_POLYGON_SELECTION") << tr("PREF_CIRCLE_SELECTION");
+ anIndicesList << 0 << 1;
+ pref->setItemProperty( "strings", aValuesList, aSeleStyle);
+ pref->setItemProperty( "indexes", anIndicesList, aSeleStyle);
// ... "Selection" group <<end>>
// ... "Clipping" group <<start>>
}
#endif
+
+#ifndef DISABLE_OCCVIEWER
+ if (sec == QString("OCCViewer") && param == QString("adv_selection_mode"))
+ {
+ int mode = resMgr->integerValue("OCCViewer", "adv_selection_mode", 0);
+ QList<SUIT_ViewManager*> lst;
+ viewManagers(OCCViewer_Viewer::Type(), lst);
+ QListIterator<SUIT_ViewManager*> it(lst);
+ while (it.hasNext())
+ {
+ SUIT_ViewModel* vm = it.next()->getViewModel();
+ if (!vm || !vm->inherits("OCCViewer_Viewer"))
+ continue;
+
+ OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm;
+ occVM->setSelectionStyle(mode);
+ }
+ }
+#endif
+
+
#ifndef DISABLE_OCCVIEWER
if ( sec == QString( "OCCViewer" ) && param == QString( "stereo_type" ) )
{
<!-- OCC viewer preferences -->
<parameter name="projection_mode" value="0"/>
<parameter name="stereo_type" value="0"/>
+ <parameter name="adv_selection_mode" value="0"/>
<parameter name="anaglyph_filter" value="0"/>
<parameter name="focus_type" value="1"/>
<parameter name="focus_value" value="1.0"/>
<source>PREF_PERSPECTIVE</source>
<translation>Perspective</translation>
</message>
+ <message>
+ <source>PREF_POLYGON_SELECTION</source>
+ <translation>Polygon</translation>
+ </message>
+ <message>
+ <source>PREF_CIRCLE_SELECTION</source>
+ <translation>Circle</translation>
+ </message>
+ <message>
+ <source>PREF_SELECTION_STYLE</source>
+ <translation>Advanced selection</translation>
+ </message>
<message>
<source>PREF_NAVIGATION</source>
<translation>Navigation style</translation>
<source>PREF_PERSPECTIVE</source>
<translation>Perspective</translation>
</message>
+ <message>
+ <source>PREF_POLYGON_SELECTION</source>
+ <translation>Polygon</translation>
+ </message>
+ <message>
+ <source>PREF_CIRCLE_SELECTION</source>
+ <translation>Circle</translation>
+ </message>
+ <message>
+ <source>PREF_SELECTION_STYLE</source>
+ <translation>Advanced selection</translation>
+ </message>
<message>
<source>PREF_NAVIGATION</source>
<translation>Navigation:</translation>
<source>PREF_PERSPECTIVE</source>
<translation>遠近法</translation>
</message>
+ <message>
+ <source>PREF_POLYGON_SELECTION</source>
+ <translation>Polygon</translation>
+ </message>
+ <message>
+ <source>PREF_CIRCLE_SELECTION</source>
+ <translation>Circle</translation>
+ </message>
+ <message>
+ <source>PREF_SELECTION_STYLE</source>
+ <translation>Advanced selection</translation>
+ </message>
<message>
<source>PREF_NAVIGATION</source>
<translation>ナビゲーション スタイル</translation>
}
}
+//**************************************************************************************
+int OCCViewer_ViewFrame::selectionStyle() const
+{
+ return getView(MAIN_VIEW)->selectionStyle();
+}
+
+//**************************************************************************************
+void OCCViewer_ViewFrame::setSelectionStyle(int t)
+{
+ foreach(OCCViewer_ViewWindow* aView, myViews) {
+ aView->setSelectionStyle(t);
+ }
+}
+
//**************************************************************************************
int OCCViewer_ViewFrame::stereoType() const
{
virtual int projectionType() const;
virtual void setProjectionType( int );
+ virtual int selectionStyle() const;
+ virtual void setSelectionStyle(int);
+
virtual int stereoType() const;
virtual void setStereoType( const int );
// set projection type to orthographic
myProjectionType = 0;
+ mySelectionStyle = 0;
// set stereo parameters
myStereoType = 0;
myAnaglyphFilter = 0;
view->initSketchers();
view->setInteractionStyle( interactionStyle() );
view->setProjectionType( projectionType() );
+ view->setSelectionStyle( selectionStyle() );
view->setStereoType( stereoType() );
view->setAnaglyphFilter( anaglyphFilter() );
view->setStereographicFocus( stereographicFocusType(), stereographicFocusValue() );
}
}
+
+int OCCViewer_Viewer::selectionStyle() const
+{
+ return mySelectionStyle;
+}
+
+void OCCViewer_Viewer::setSelectionStyle(const int theMode)
+{
+ if (mySelectionStyle != theMode) {
+ mySelectionStyle = theMode;
+ if (!myViewManager)
+ return;
+
+ QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
+ for (int i = 0; i < (int)wins.count(); i++)
+ {
+ OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>(wins.at(i));
+ if (win)
+ win->setSelectionStyle(theMode);
+ }
+ }
+}
+
+
+
/*!
\return stereo type
*/
int stereoType() const;
void setStereoType( const int );
+ int selectionStyle() const;
+ void setSelectionStyle(const int);
+
int anaglyphFilter() const;
void setAnaglyphFilter( const int );
int myAnaglyphFilter;
int myStereographicFocusType;
int myInterocularDistanceType;
+ int mySelectionStyle;
double myStereographicFocusValue;
double myInterocularDistanceValue;
virtual bool eventFilter( QObject*, QEvent* );
virtual void setSketcherMode(int theMode) {}
+ virtual int sketcherMode() const { return 0; }
private slots:
void onDrawViewPort();
virtual ~OCCViewer_PolygonSketcher();
virtual void setSketcherMode(int theMode);
+ virtual int sketcherMode() const {
+ return myMode;
+ }
protected:
virtual bool onKey( QKeyEvent* );
toolMgr()->registerAction( aAction, SwitchZoomingStyleId );
// Switch advanced selection style (poligone/circle)
- aAction = new QtxAction(tr("MNU_SELECTION_STYLE_SWITCH"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_RECT_STYLE" ) ),
- tr( "MNU_SELECTION_STYLE_SWITCH" ), 0, this);
- aAction->setStatusTip(tr("DSC_SELECTION_STYLE_SWITCH"));
+ aAction = new QtxAction(tr("MNU_RECTANGLE_SELECTION_STYLE"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_RECT_STYLE" ) ),
+ tr( "MNU_RECTANGLE_SELECTION_STYLE" ), 0, this);
+ aAction->setStatusTip(tr("DSC_RECTANGLE_SELECTION_STYLE"));
aAction->setCheckable(true);
- connect(aAction, SIGNAL(toggled(bool)), this, SLOT(onSwitchSelectionStyle(bool)));
- toolMgr()->registerAction( aAction, SwitchSelectionStyleId);
+ toolMgr()->registerAction( aAction, RectangleSelectionStyleId);
+
+ aAction = new QtxAction(tr("MNU_CIRCLE_SELECTION_STYLE"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CIRCLE_STYLE" ) ),
+ tr( "MNU_CIRCLE_SELECTION_STYLE" ), 0, this);
+ aAction->setStatusTip(tr("DSC_CIRCLE_SELECTION_STYLE"));
+ aAction->setCheckable(true);
+ toolMgr()->registerAction( aAction, CircleSelectionStyleId);
+
+ // - add exclusive action group
+ QActionGroup* aSelectionGroup = new QActionGroup(this);
+ aSelectionGroup->addAction(toolMgr()->action(RectangleSelectionStyleId));
+ aSelectionGroup->addAction(toolMgr()->action(CircleSelectionStyleId));
+ connect(aSelectionGroup, SIGNAL(triggered(QAction*)), this, SLOT(onSwitchSelectionStyle(QAction*)));
// Maximized view
aAction = new QtxAction(tr("MNU_MINIMIZE_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_MINIMIZE" ) ),
toolMgr()->append( SwitchZoomingStyleId, tid );
toolMgr()->append( SwitchPreselectionId, tid );
toolMgr()->append( SwitchSelectionId, tid );
- toolMgr()->append(SwitchSelectionStyleId, tid );
+ toolMgr()->append(RectangleSelectionStyleId, tid );
+ toolMgr()->append(CircleSelectionStyleId, tid );
if( myModel->trihedronActivated() )
toolMgr()->append( TrihedronShowId, tid );
}
}
-void OCCViewer_ViewWindow::onSwitchSelectionStyle(bool on)
+/*!
+ \brief Switches style of advanced multiple selection by Poligon/Circle
+*/
+void OCCViewer_ViewWindow::onSwitchSelectionStyle(QAction* theAction)
{
// selection
- QtxAction* a = dynamic_cast<QtxAction*>( toolMgr()->action(SwitchSelectionStyleId) );
- if (a) {
- if (a->isChecked() != on) {
- a->setChecked(on);
+ OCCViewer_ViewSketcher* aSkecher = getSketcher(Polygon);
+ if (aSkecher) {
+ if (theAction == toolMgr()->action(RectangleSelectionStyleId)) {
+ aSkecher->setSketcherMode(OCCViewer_PolygonSketcher::Poligone);
+ }
+ else if (theAction == toolMgr()->action(CircleSelectionStyleId)) {
+ aSkecher->setSketcherMode(OCCViewer_PolygonSketcher::Circle);
}
- SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- QPixmap aIcon = on ? aResMgr->loadPixmap("OCCViewer", tr("ICON_OCCVIEWER_CIRCLE_STYLE")) :
- aResMgr->loadPixmap("OCCViewer", tr("ICON_OCCVIEWER_RECT_STYLE"));
- a->setIcon(aIcon);
}
+}
+
+int OCCViewer_ViewWindow::selectionStyle() const
+{
+ OCCViewer_ViewSketcher* aSkecher = getSketcher(Polygon);
+ if (aSkecher) {
+ return aSkecher->sketcherMode();
+ }
+ return 0;
+}
+
+void OCCViewer_ViewWindow::setSelectionStyle(int theMode)
+{
OCCViewer_ViewSketcher* aSkecher = getSketcher(Polygon);
if (aSkecher) {
- aSkecher->setSketcherMode(on ? OCCViewer_PolygonSketcher::Circle :
- OCCViewer_PolygonSketcher::Poligone);
+ aSkecher->setSketcherMode(theMode);
+ if (theMode == 0) {
+ toolMgr()->action(RectangleSelectionStyleId)->setChecked(true);
+ toolMgr()->action(CircleSelectionStyleId)->setChecked(false);
+ }
+ else {
+ toolMgr()->action(RectangleSelectionStyleId)->setChecked(false);
+ toolMgr()->action(CircleSelectionStyleId)->setChecked(true);
+ }
}
}
}
}
-OCCViewer_ViewSketcher* OCCViewer_ViewWindow::getSketcher( const int typ )
+OCCViewer_ViewSketcher* OCCViewer_ViewWindow::getSketcher( const int typ ) const
{
OCCViewer_ViewSketcher* sketcher = 0;
- QList<OCCViewer_ViewSketcher*>::Iterator it;
- for ( it = mySketchers.begin(); it != mySketchers.end() && !sketcher; ++it )
+ QList<OCCViewer_ViewSketcher*>::ConstIterator it;
+ for ( it = mySketchers.cbegin(); it != mySketchers.cend() && !sketcher; ++it )
{
OCCViewer_ViewSketcher* sk = (*it);
if ( sk->type() == typ )
SwitchPreselectionId, SwitchSelectionId,
MaximizedId, SynchronizeId, ReturnTo3dViewId,
OrthographicId, PerspectiveId, StereoId, RayTracingId, EnvTextureId, LightSourceId,
- SwitchSelectionStyleId,
+ RectangleSelectionStyleId, CircleSelectionStyleId,
UserId };
enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE,
virtual void setVisualParameters( const QString& parameters );
virtual void initSketchers();
- virtual OCCViewer_ViewSketcher* getSketcher( const int );
+ virtual OCCViewer_ViewSketcher* getSketcher( const int ) const;
virtual void activateSketching( int );
virtual int projectionType() const;
virtual void setProjectionType( int );
+ virtual int selectionStyle() const;
+ virtual void setSelectionStyle(int);
+
virtual int stereoType() const;
virtual void setStereoType( const int );
virtual void onSwitchZoomingStyle( bool on );
virtual void onSwitchPreselection( bool on );
virtual void onSwitchSelection( bool on );
- virtual void onSwitchSelectionStyle( bool on );
+ virtual void onSwitchSelectionStyle(QAction* theAction);
virtual void onRayTracing();
virtual void onEnvTexture();
virtual void onLightSource();
<source>MNU_ZOOMING_STYLE_SWITCH</source>
<translation>Zooming style switch</translation>
</message>
- <message>
- <source>MNU_SELECTION_STYLE_SWITCH</source>
- <translation>Advanced selection style switch</translation>
- </message>
<message>
<source>DSC_ZOOMING_STYLE_SWITCH</source>
<translation>Zooming style switch</translation>
</message>
<message>
- <source>DSC_SELECTION_STYLE_SWITCH</source>
- <translation>Advanced selection style switch</translation>
+ <source>MNU_RECTANGLE_SELECTION_STYLE</source>
+ <translation>Advanced selection by polygon</translation>
+ </message>
+ <message>
+ <source>DSC_RECTANGLE_SELECTION_STYLE</source>
+ <translation>Advanced selection by polygon</translation>
+ </message>
+ <message>
+ <source>MNU_CIRCLE_SELECTION_STYLE</source>
+ <translation>Advanced selection by circle</translation>
+ </message>
+ <message>
+ <source>DSC_CIRCLE_SELECTION_STYLE</source>
+ <translation>Advanced selection by circle</translation>
</message>
<message>
<source>MNU_ENABLE_PRESELECTION</source>
<source>MNU_ZOOMING_STYLE_SWITCH</source>
<translation>Changer le style de zoom</translation>
</message>
- <message>
- <source>MNU_SELECTION_STYLE_SWITCH</source>
- <translation>Advanced selection style switch</translation>
- </message>
<message>
<source>DSC_ZOOMING_STYLE_SWITCH</source>
<translation>Changer le style de zoom</translation>
</message>
<message>
- <source>DSC_SELECTION_STYLE_SWITCH</source>
- <translation>Advanced selection style switch</translation>
+ <source>MNU_RECTANGLE_SELECTION_STYLE</source>
+ <translation>Advanced selection by polygon</translation>
+ </message>
+ <message>
+ <source>DSC_RECTANGLE_SELECTION_STYLE</source>
+ <translation>Advanced selection by polygon</translation>
+ </message>
+ <message>
+ <source>MNU_CIRCLE_SELECTION_STYLE</source>
+ <translation>Advanced selection by circle</translation>
+ </message>
+ <message>
+ <source>DSC_CIRCLE_SELECTION_STYLE</source>
+ <translation>Advanced selection by circle</translation>
</message>
<message>
<source>MNU_ENABLE_PRESELECTION</source>
<source>MNU_ZOOMING_STYLE_SWITCH</source>
<translation>ズームのスタイルを変更します。</translation>
</message>
- <message>
- <source>MNU_SELECTION_STYLE_SWITCH</source>
- <translation>Advanced selection style switch</translation>
- </message>
<message>
<source>DSC_ZOOMING_STYLE_SWITCH</source>
<translation>ズームのスタイルを変更します。</translation>
</message>
<message>
- <source>DSC_SELECTION_STYLE_SWITCH</source>
- <translation>Advanced selection style switch</translation>
+ <source>MNU_RECTANGLE_SELECTION_STYLE</source>
+ <translation>Advanced selection by polygon</translation>
+ </message>
+ <message>
+ <source>DSC_RECTANGLE_SELECTION_STYLE</source>
+ <translation>Advanced selection by polygon</translation>
+ </message>
+ <message>
+ <source>MNU_CIRCLE_SELECTION_STYLE</source>
+ <translation>Advanced selection by circle</translation>
+ </message>
+ <message>
+ <source>DSC_CIRCLE_SELECTION_STYLE</source>
+ <translation>Advanced selection by circle</translation>
</message>
<message>
<source>MNU_ENABLE_PRESELECTION</source>