23 #ifndef OCCVIEWER_VIEWMODEL_H
24 #define OCCVIEWER_VIEWMODEL_H
36 #include <V3d_View.hxx>
37 #include <AIS_Trihedron.hxx>
38 #include <AIS_InteractiveContext.hxx>
39 #include <AIS_ListOfInteractive.hxx>
40 #include <Graphic3d_SequenceOfHClipPlane.hxx>
55 #pragma warning( disable:4251 )
69 LastGradient = Corner4Gradient
79 static QString
Type() {
return "OCCViewer"; }
81 static void stereoData( QStringList&,
QIntList&);
95 void getSelectedObjects(AIS_ListOfInteractive& theList);
96 void setObjectsSelected(
const AIS_ListOfInteractive& theList);
99 void performSelectionChanged();
102 void setDefaultLights();
104 QColor backgroundColor()
const;
105 void setBackgroundColor(
const QColor& );
109 QColor backgroundColor(
int theViewId)
const;
110 void setBackgroundColor(
int theViewId,
const QColor& );
117 void toggleTrihedron();
118 bool isTrihedronVisible()
const;
119 virtual void setTrihedronShown(
const bool );
121 double trihedronSize()
const;
122 virtual void setTrihedronSize(
const double ,
bool isRelative =
true);
127 bool computeTrihedronSize(
double& theNewSize,
double& theSize );
128 virtual double computeSceneSize(
const Handle(V3d_View)&)
const;
130 void updateTrihedron();
136 Handle(V3d_Viewer) getViewer3d()
const {
return myV3dViewer;}
137 Handle(AIS_InteractiveContext) getAISContext()
const {
return myAISContext; }
138 Handle(AIS_Trihedron) getTrihedron()
const {
return myTrihedron; }
142 int interactionStyle()
const;
143 void setInteractionStyle(
const int );
145 int projectionType()
const;
146 void setProjectionType(
const int );
147 int stereoType()
const;
148 void setStereoType(
const int );
150 int anaglyphFilter()
const;
151 void setAnaglyphFilter(
const int );
153 void setStereographicFocus(
const int,
const double );
154 int stereographicFocusType()
const;
155 double stereographicFocusValue()
const;
157 void setInterocularDistance(
const int,
const double );
158 int interocularDistanceType()
const;
159 double interocularDistanceValue()
const;
161 bool isReverseStereo()
const;
162 void setReverseStereo(
const bool );
164 bool isVSync()
const;
165 void setVSync(
const bool );
167 bool isQuadBufferSupport()
const;
168 void setQuadBufferSupport(
const bool );
169 int zoomingStyle()
const;
170 void setZoomingStyle(
const int );
172 void enablePreselection(
bool isEnabled);
173 bool isPreselectionEnabled()
const;
175 void enableSelection(
bool isEnabled);
176 bool isSelectionEnabled()
const;
178 void setSelectionOptions(
bool,
bool );
180 void enableMultiselection(
bool isEnable);
183 bool enableDrawMode(
bool on );
185 void setClippingColor(
const QColor& );
186 QColor clippingColor()
const;
188 void setClippingTextureParams(
const bool,
const QString&,
const bool,
const double );
189 bool isDefaultTextureUsed()
const;
190 QString clippingTexture()
const;
191 bool isTextureModulated()
const;
192 double clippingTextureScale()
const;
194 int getSelectionCount()
const {
return (!myAISContext.IsNull())? myAISContext->NbSelected():0; }
196 void setStaticTrihedronDisplayed(
const bool on);
199 Handle(Graphic3d_ClipPlane) createClipPlane(
const gp_Pln& thePlane,
const Standard_Boolean theIsOn);
210 bool unHighlightAll(
bool=true,
bool=true );
211 bool isInViewer( const
Handle(AIS_InteractiveObject)&,
bool=false );
212 bool isVisible( const
Handle(AIS_InteractiveObject)& );
214 void setColor( const
Handle(AIS_InteractiveObject)&, const QColor&,
bool=true );
215 void switchRepresentation( const
Handle(AIS_InteractiveObject)&,
int,
bool=true );
216 void setTransparency( const
Handle(AIS_InteractiveObject)&,
float,
bool=true );
217 void setIsos( const
int u, const
int v );
218 void isos(
int& u,
int& v ) const;
223 void selectionChanged();
228 virtual
void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
229 virtual
void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
230 virtual
void onKeyPress(SUIT_ViewWindow*, QKeyEvent*);
232 virtual
void onViewMapped(OCCViewer_ViewPort3d*);
235 void onChangeBackground();
239 Handle(V3d_Viewer) myV3dViewer;
241 Handle(AIS_Trihedron) myTrihedron;
242 Handle(AIS_InteractiveContext) myAISContext;
244 int myInteractionStyle;
246 int myProjectionType;
248 int myAnaglyphFilter;
249 int myStereographicFocusType;
250 int myInterocularDistanceType;
252 double myStereographicFocusValue;
253 double myInterocularDistanceValue;
255 bool myPreselectionEnabled;
256 bool mySelectionEnabled;
257 bool myMultiSelectionEnabled;
259 bool myToReverseStereo;
261 bool myQuadBufferSupport;
266 QPoint myStartPnt, myEndPnt, myCurPnt;
268 double myTrihedronSize;
270 QVector<
Qtx::BackgroundData> myBackgrounds;
275 Graphic3d_SequenceOfHClipPlane myInternalClipPlanes;
277 QColor myClippingColor;
278 bool myDefaultTextureUsed;
279 QString myClippingTexture;
280 bool myTextureModulated;
281 double myClippingTextureScale;
286 #pragma warning( default:4251 )