1 // Created on: 1991-09-17
2 // Created by: NW,JPB,CAL
3 // Copyright (c) 1991-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Visual3d_View_HeaderFile
18 #define _Visual3d_View_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Visual3d_ViewManagerPtr.hxx>
24 #include <Graphic3d_CView.hxx>
25 #include <Visual3d_ContextView.hxx>
26 #include <Graphic3d_SequenceOfStructure.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <Aspect_Background.hxx>
29 #include <Aspect_GradientBackground.hxx>
30 #include <Graphic3d_MapOfStructure.hxx>
31 #include <Graphic3d_GraduatedTrihedron.hxx>
32 #include <Graphic3d_Camera.hxx>
33 #include <Standard_Real.hxx>
34 #include <Graphic3d_NMapOfTransient.hxx>
35 #include <Graphic3d_DataStructureManager.hxx>
36 #include <Standard_Integer.hxx>
37 #include <Standard_CString.hxx>
38 #include <Aspect_FillMethod.hxx>
39 #include <Aspect_GradientFillMethod.hxx>
40 #include <Visual3d_TypeOfBackfacingModel.hxx>
41 #include <Aspect_RenderingContext.hxx>
42 #include <Aspect_GraphicCallbackProc.hxx>
43 #include <Standard_Address.hxx>
44 #include <Aspect_TypeOfUpdate.hxx>
45 #include <Quantity_NameOfColor.hxx>
46 #include <Aspect_TypeOfTriedronPosition.hxx>
47 #include <Aspect_TypeOfTriedronEcho.hxx>
48 #include <Visual3d_TypeOfAnswer.hxx>
49 #include <Graphic3d_TypeOfStructure.hxx>
50 #include <Graphic3d_ZLayerId.hxx>
51 #include <Graphic3d_ZLayerSettings.hxx>
52 #include <Aspect_TypeOfHighlightMethod.hxx>
53 #include <TColStd_Array2OfReal.hxx>
54 #include <Aspect_Handle.hxx>
55 #include <Aspect_PrintAlgo.hxx>
56 #include <Graphic3d_PtrFrameBuffer.hxx>
57 #include <Image_PixMap.hxx>
58 #include <Graphic3d_BufferType.hxx>
59 #include <Graphic3d_ExportFormat.hxx>
60 #include <Graphic3d_SortType.hxx>
62 class Graphic3d_GraphicDriver;
63 class Visual3d_TransformError;
64 class Visual3d_ViewDefinitionError;
65 class Visual3d_ViewManager;
67 class Aspect_Background;
68 class Aspect_GradientBackground;
69 class Visual3d_ContextView;
71 class Graphic3d_Structure;
75 DEFINE_STANDARD_HANDLE(Visual3d_View, Graphic3d_DataStructureManager)
77 //! Creation and edition of a view in a 3D visualiser.
78 //! A 3D view is composed of an "orientation" part defined
79 //! by the position of the observer, the direction of view,
80 //! and a "mapping" part defined by the type of projection
81 //! (parallel or perspective) and by the window-viewport
82 //! couple which allows passage from the projected coordinate
83 //! space into the screen space.
84 //! Summary of 3D Viewing
85 //! To define a view, you must define:
86 //! - The view orientation transformation
87 //! - The view mapping transformation
88 //! - The view representation.
89 //! To activate a view, you must define:
90 //! - The associated window.
91 class Visual3d_View : public Graphic3d_DataStructureManager
97 //! Creates a view in the viewer <AManager> with a default
98 //! orientation and a default mapping.
99 Standard_EXPORT Visual3d_View(const Handle(Visual3d_ViewManager)& AManager);
101 //! Activates the view <me>.
102 //! Map the associated window on the screen and
103 //! post the view in this window.
104 //! Category: Methods to modify the class definition
105 //! Warning: Raises ViewDefinitionError if the associated
106 //! window isn't defined.
107 Standard_EXPORT void Activate();
109 //! Deactivates the view <me>.
110 //! Unmap the associated window on the screen and
111 //! unpost the view in this window.
112 //! Category: Methods to modify the class definition
113 //! Warning: Raises ViewDefinitionError if the associated
114 //! window isn't defined.
115 Standard_EXPORT void Deactivate();
117 //! Deletes and erases the view <me>.
118 Standard_EXPORT virtual void Destroy() Standard_OVERRIDE;
124 //! Updates screen in all cases.
125 Standard_EXPORT void Redraw();
127 //! Updates layer of immediate presentations.
128 Standard_EXPORT void RedrawImmediate();
130 //! Updates screen area in all cases.
131 //! area is given by his xy min corner and size in pixel coordinates
132 Standard_EXPORT void Redraw (const Standard_Integer x, const Standard_Integer y, const Standard_Integer width, const Standard_Integer height);
134 //! Updates screen in all cases.
135 Standard_EXPORT void Redraw (const Handle(Visual3d_Layer)& AnUnderLayer, const Handle(Visual3d_Layer)& AnOverLayer);
137 //! Updates layer of immediate presentations.
138 Standard_EXPORT void RedrawImmediate (const Handle(Visual3d_Layer)& theUnderLayer, const Handle(Visual3d_Layer)& theOverLayer);
140 //! Invalidates view content but does not redraw it.
141 Standard_EXPORT void Invalidate();
143 //! Returns true if cached view content has been invalidated.
144 Standard_EXPORT Standard_Boolean IsInvalidated() const;
146 //! Updates screen area in all cases.
147 //! area is given by his xy min corner and size in pixel coordinates
148 Standard_EXPORT void Redraw (const Handle(Visual3d_Layer)& AnUnderLayer, const Handle(Visual3d_Layer)& AnOverLayer, const Standard_Integer x, const Standard_Integer y, const Standard_Integer width, const Standard_Integer height);
150 //! Deletes and erases the view <me>.
151 //! Warning: No more graphic operations in <me> after this call.
152 Standard_EXPORT void Remove();
154 //! Updates the view <me> after the modification
155 //! of the associated window.
156 //! Category: Methods to modify the class definition
157 //! Warning: Raises ViewDefinitionError if the associated
158 //! window isn't defined.
159 Standard_EXPORT void Resized();
161 //! Modifies the default window background.
162 //! Category: Methods to modify the class definition
163 //! Warning: Raises ViewDefinitionError if the associated
164 //! window isn't defined.
165 Standard_EXPORT void SetBackground (const Aspect_Background& ABack);
168 //! Category: Methods to modify the class definition
169 //! Warning: Raises ViewDefinitionError if the associated
170 //! window isn't defined.
171 Standard_EXPORT void SetBackgroundImage (const Standard_CString FileName, const Aspect_FillMethod FillStyle, const Standard_Boolean update);
174 //! Category: Methods to modify the class definition
175 //! Warning: Raises ViewDefinitionError if the associated
176 //! window isn't defined.
177 Standard_EXPORT void SetBgImageStyle (const Aspect_FillMethod FillStyle, const Standard_Boolean update);
179 //! Modifies the gradient window background.
180 //! Category: Methods to modify the class definition
181 //! Warning: Raises ViewDefinitionError if the associated
182 //! window isn't defined.
183 Standard_EXPORT void SetGradientBackground (const Aspect_GradientBackground& ABack, const Standard_Boolean update);
186 //! Category: Methods to modify the class definition
187 //! Warning: Raises ViewDefinitionError if the associated
188 //! window isn't defined.
189 Standard_EXPORT void SetBgGradientStyle (const Aspect_GradientFillMethod FillStyle, const Standard_Boolean update);
191 //! Manages display of the back faces
192 Standard_EXPORT void SetBackFacingModel (const Visual3d_TypeOfBackfacingModel aModel);
194 //! Returns current state of the back faces display
195 Standard_EXPORT Visual3d_TypeOfBackfacingModel BackFacingModel() const;
197 //! Sets the context <CTX> in the view <me>.
198 Standard_EXPORT void SetContext (const Visual3d_ContextView& CTX);
200 //! Saves the current mapping which will be the
201 //! reference value for the reset of the mapping
202 //! done by the ViewmappingReset method.
203 Standard_EXPORT void SetViewMappingDefault();
205 //! Saves the current orientation which will be the
206 //! reference value for the reset of the orientation
207 //! done by the ViewOrientationReset method.
208 Standard_EXPORT void SetViewOrientationDefault();
210 //! Associates the window <AWindow> to the view <me>.
211 //! No new association if the window is already defined.
212 //! Category: Methods to modify the class definition
213 //! Warning: Raises ViewDefinitionError if it is impossible
214 //! to associate a view and a window.
215 //! (association already done or another problem)
216 //! Modifies the viewmapping of the associated view
217 //! when it calls the SetRatio method.
219 //! After this call, each view is mapped in an unique window.
221 //! Programming example :
223 //! An example when we have 1 view and 1 window
224 //! -------------------------------------------
226 //! Handle(Aspect_DisplayConnection) aDisplayConnection;
228 //! // Display connection initialization only needed on Linux platform
229 //! // and on Mac OS X, in cases when you use Xlib for windows drawing.
230 //! aDisplayConnection = new Aspect_DisplayConnection();
232 //! // Graphic driver initialization
233 //! Handle(Graphic3d_GraphicDriver) aGraphicDriver =
234 //! Graphic3d::InitGraphicDriver (aDisplayConnection);
236 //! // Define a view manager
237 //! Handle(Visual3d_ViewManager) aVisualManager = new Visual3d_ViewManager (aGraphicDriver);
240 //! Handle(Visual3d_View) aView = new Visual3d_View (aVisaulManager);
242 //! // Define a window
243 //! Handle(Xw_Window) aWindow = new Xw_Window
244 //! (aDisplayConnection, "Graphic View 1", 0.695, 0.695, 0.600, 0.600, Quantity_NOC_MATRAGRAY);
246 //! // Associate the view and the window
247 //! aView->SetWindow (aWindow);
249 //! // Map the window
252 //! // Activate the view
253 //! aView->Activate ();
254 Standard_EXPORT void SetWindow (const Handle(Aspect_Window)& AWindow);
256 //! Associates the window <AWindow> and context <AContext>
257 //! to the view <me>.
258 //! If <AContext> is not NULL the graphic context is used
259 //! directly to draw something in this view.
260 //! Otherwise an internal context is created.
261 //! If <ADisplayCB> is not NULL then a user display CB is
262 //! call at the end of the OCC graphic traversal and just
263 //! before the swap of buffers. The <aClientData> is pass
264 //! to this call back.
265 //! No new association if the window is already defined.
266 //! Category: Methods to modify the class definition
267 //! Warning: Raises ViewDefinitionError if it is impossible
268 //! to associate a view and a window.
269 //! (association already done or another problem)
270 //! Modifies the viewmapping of the associated view
271 //! when it calls the SetRatio method.
273 //! After this call, each view is mapped in an unique window.
274 Standard_EXPORT void SetWindow (const Handle(Aspect_Window)& AWindow, const Aspect_RenderingContext AContext, const Aspect_GraphicCallbackProc& ADisplayCB, const Standard_Address AClientData);
276 //! Updates screen in function of modifications of
278 Standard_EXPORT void Update (const Aspect_TypeOfUpdate theUpdateMode);
280 //! Updates screen in function of modifications of
282 Standard_EXPORT void Update (const Handle(Visual3d_Layer)& AnUnderLayer, const Handle(Visual3d_Layer)& AnOverLayer);
284 //! Sets the automatic z-fit mode and its parameters.
285 //! The auto z-fit has extra parameters which can controlled from application level
286 //! to ensure that the size of viewing volume will be sufficiently large to cover
287 //! the depth of unmanaged objects, for example, transformation persistent ones.
288 //! @param theScaleFactor [in] the scale factor for Z-range.
289 //! The range between Z-min, Z-max projection volume planes
290 //! evaluated by z fitting method will be scaled using this coefficient.
291 //! Program error exception is thrown if negative or zero value
293 Standard_EXPORT void SetAutoZFitMode (const Standard_Boolean theIsOn, const Standard_Real theScaleFactor = 1.0);
295 //! returns TRUE if automatic z-fit mode is turned on.
296 Standard_EXPORT Standard_Boolean AutoZFitMode() const;
298 //! returns scale factor parameter of automatic z-fit mode.
299 Standard_EXPORT Standard_Real AutoZFitScaleFactor() const;
301 //! If automatic z-range fitting is turned on, adjusts Z-min and Z-max
302 //! projection volume planes with call to ZFitAll.
303 Standard_EXPORT void AutoZFit();
305 //! Change Z-min and Z-max planes of projection volume to match the
306 //! displayed objects.
307 Standard_EXPORT void ZFitAll (const Standard_Real theScaleFactor = 1.0);
309 //! Sets the value of the mapping to be the same as
310 //! the mapping saved by the SetViewMappingDefaut method.
311 Standard_EXPORT void ViewMappingReset();
313 //! Sets the value of the orientation to be the same as the
314 //! orientation saved by the SetViewOrientationDefaut method.
315 Standard_EXPORT void ViewOrientationReset();
317 //! Switches computed HLR mode in the view
318 Standard_EXPORT void SetComputedMode (const Standard_Boolean aMode);
320 //! Returns the computed HLR mode state
321 Standard_EXPORT Standard_Boolean ComputedMode() const;
323 //! Customization of the ZBUFFER Triedron.
324 //! Initializes Colors of X Y and axis
325 //! Scale ratio defines decreasing of trihedron size when
326 //! its position is out of a View
327 Standard_EXPORT void ZBufferTriedronSetup (const Quantity_NameOfColor XColor = Quantity_NOC_RED, const Quantity_NameOfColor YColor = Quantity_NOC_GREEN, const Quantity_NameOfColor ZColor = Quantity_NOC_BLUE1, const Standard_Real SizeRatio = 0.8, const Standard_Real AxisDiametr = 0.05, const Standard_Integer NbFacettes = 12);
329 //! Display of the Triedron.
330 //! Initialize position, color and length of Triedron axes.
331 //! The scale is a percent of the window width.
332 //! If AsWireframe is FALSE triedron is shown in shaded mode
333 //! AColor is not considered for ZBUFFER mode
334 Standard_EXPORT void TriedronDisplay (const Aspect_TypeOfTriedronPosition APosition = Aspect_TOTP_CENTER, const Quantity_NameOfColor AColor = Quantity_NOC_WHITE, const Standard_Real AScale = 0.02, const Standard_Boolean AsWireframe = Standard_True);
336 //! Erases the Triedron.
337 Standard_EXPORT void TriedronErase();
339 //! Highlights the echo zone of the Triedron.
340 Standard_EXPORT void TriedronEcho (const Aspect_TypeOfTriedronEcho AType = Aspect_TOTE_NONE);
342 //! Returns data of a graduated trihedron
343 Standard_EXPORT const Graphic3d_GraduatedTrihedron& GetGraduatedTrihedron() const;
345 //! Displays a graduated trihedron.
346 Standard_EXPORT void GraduatedTrihedronDisplay (const Graphic3d_GraduatedTrihedron& theTrigedronData);
348 //! Erases a graduated trihedron from the view.
349 Standard_EXPORT void GraduatedTrihedronErase();
351 //! Returns the value of the default window background.
352 Standard_EXPORT Aspect_Background Background() const;
354 //! Returns the value of the window background.
355 Standard_EXPORT Aspect_GradientBackground GradientBackground() const;
357 //! Returns Standard_True if one of the structures
358 //! displayed in the view <me> contains Polygons,
359 //! Triangles or Quadrangles.
360 Standard_EXPORT Standard_Boolean ContainsFacet() const;
362 //! Returns Standard_True if one of the structures
363 //! in the set <ASet> contains Polygons, Triangles
365 Standard_EXPORT Standard_Boolean ContainsFacet (const Graphic3d_MapOfStructure& ASet) const;
367 //! Returns the current context of the view <me>.
368 Standard_EXPORT const Visual3d_ContextView& Context() const;
370 //! Returns the set of structures displayed in
372 Standard_EXPORT void DisplayedStructures (Graphic3d_MapOfStructure& SG) const;
374 //! Returns the activity flag of the view <me>.
375 Standard_EXPORT Standard_Boolean IsActive() const;
377 //! Returns True if the window associated to the view
379 Standard_EXPORT Standard_Boolean IsDefined() const;
381 //! Returns Standard_True is the view <me> is deleted.
382 //! <me> is deleted after the call Remove (me).
383 Standard_EXPORT Standard_Boolean IsDeleted() const;
385 //! Returns the coordinates of the boundary box of all
386 //! structures displayed in the view <me>.
387 //! If <theToIgnoreInfiniteFlag> is TRUE, then the boundary box
388 //! also includes minimum and maximum limits of graphical elements
389 //! forming parts of infinite structures.
390 Standard_EXPORT Bnd_Box MinMaxValues (const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const;
392 //! Returns the coordinates of the boundary box of all
393 //! structures in the set <theSet>.
394 //! If <theToIgnoreInfiniteFlag> is TRUE, then the boundary box
395 //! also includes minimum and maximum limits of graphical elements
396 //! forming parts of infinite structures.
397 Standard_EXPORT Bnd_Box MinMaxValues (const Graphic3d_MapOfStructure& theSet, const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const;
399 //! Returns number of displayed structures in
401 Standard_EXPORT Standard_Integer NumberOfDisplayedStructures() const;
403 //! Returns the coordinates of the projection of the
404 //! 3d coordinates <AX>, <AY>, <AZ>.
405 Standard_EXPORT void Projects (const Standard_Real AX, const Standard_Real AY, const Standard_Real AZ, Standard_Real& APX, Standard_Real& APY, Standard_Real& APZ) const;
407 //! @return the default camera of <me>.
408 Standard_EXPORT const Handle(Graphic3d_Camera)& DefaultCamera() const;
410 //! @return the camera of <me>.
411 Standard_EXPORT const Handle(Graphic3d_Camera)& Camera() const;
413 //! Set camera object to provide orientation and projection matrices
414 //! for graphic driver.
415 Standard_EXPORT void SetCamera (const Handle(Graphic3d_Camera)& theCamera);
417 //! Returns the window associated to the view <me>.
418 //! Warning: Raises ViewDefinitionError if the associated
419 //! window isn't defined.
420 Standard_EXPORT Handle(Aspect_Window) Window() const;
422 //! Returns the MAX number of light associated to the view <me>.
423 Standard_EXPORT Standard_Integer LightLimit() const;
425 //! Returns the MAX number of clipping planes
426 //! associated to the view <me>.
427 Standard_EXPORT Standard_Integer PlaneLimit() const;
429 //! Returns the view manager handle which manage this view
430 Standard_EXPORT Handle(Visual3d_ViewManager) ViewManager() const;
432 //! Computes the new presentation of the
433 //! structure <AStructure> displayed in <me>
434 //! with the type Graphic3d_TOS_COMPUTED.
435 Standard_EXPORT void ReCompute (const Handle(Graphic3d_Structure)& AStructure);
437 //! Add structure to the list of immediate presentations.
438 //! @return true if structure has not been registered in this view
439 Standard_EXPORT Standard_Boolean DisplayImmediate (const Handle(Graphic3d_Structure)& theStructure, const Standard_Boolean theIsSingleView = Standard_True);
441 //! Removes the structure from the list of immediate presentations.
442 //! @return true if structure has been registered in view
443 Standard_EXPORT Standard_Boolean EraseImmediate (const Handle(Graphic3d_Structure)& theStructure);
445 //! Clears list of immediate presentations.
446 //! @return true if list was not empty
447 Standard_EXPORT Standard_Boolean ClearImmediate();
449 //! Returns the identification number of the view <me>.
450 Standard_EXPORT Standard_Integer Identification() const;
452 //! Returns the c structure associated to <me>.
453 Standard_EXPORT Standard_Address CView() const;
455 //! Returns the associated GraphicDriver.
456 Standard_EXPORT const Handle(Graphic3d_GraphicDriver)& GraphicDriver() const;
458 //! print the contents of all layers of the view to the printer.
459 //! <hPrnDC> : Pass the PrinterDeviceContext (HDC),
460 //! <showBackground> : When set to FALSE then print the view without background color
461 //! (background is white)
462 //! else set to TRUE for printing with current background color.
463 //! <filename>: If != NULL, then the view will be printed to a file.
464 //! <printAlgo>: Select print algorithm: stretch, tile.
465 //! <theScaleFactor>: Scaling coefficient, used internally to scale the
466 //! printings accordingly to the scale factor selected in the printer
467 //! properties dialog.
468 //! Returns Standard_True if the data is passed to the printer, otherwise
469 //! Standard_False if the print operation failed due to printer error
470 //! or insufficient memory.
471 //! Warning: Works only under Windows.
472 Standard_EXPORT Standard_Boolean Print (const Handle(Visual3d_Layer)& AnUnderLayer, const Handle(Visual3d_Layer)& AnOverLayer, const Aspect_Handle hPrnDC, const Standard_Boolean showBackground, const Standard_CString filename, const Aspect_PrintAlgo printAlgorithm = Aspect_PA_STRETCH, const Standard_Real theScaleFactor = 1.0) const;
474 //! print the contents of the view to printer.
475 //! <hPrnDC> : Pass the PrinterDeviceContext (HDC),
476 //! <showBackground> : When set to FALSE then print the view without background color
477 //! (background is white)
478 //! else set to TRUE for printing with current background color.
479 //! <filename>: If != NULL, then the view will be printed to a file.
480 //! <printAlgo>: Select print algorithm: stretch, tile.
481 //! <theScaleFactor>: Scaling coefficient, used internally to scale the
482 //! printings accordingly to the scale factor selected in the printer
483 //! properties dialog.
484 //! Returns Standard_True if the data is passed to the printer, otherwise
485 //! Standard_False if the print operation failed due to printer error
486 //! or insufficient memory.
487 //! Warning: Works only under Windows.
488 Standard_EXPORT Standard_Boolean Print (const Aspect_Handle hPrnDC, const Standard_Boolean showBackground, const Standard_CString filename, const Aspect_PrintAlgo printAlgorithm = Aspect_PA_STRETCH, const Standard_Real theScaleFactor = 1.0) const;
490 //! Returns the underlay of the view <me>.
491 Standard_EXPORT const Handle(Visual3d_Layer)& UnderLayer() const;
493 //! Returns the underlay of the view <me>.
494 Standard_EXPORT const Handle(Visual3d_Layer)& OverLayer() const;
496 //! Reads depths of shown pixels of the given rectangle
497 Standard_EXPORT void ReadDepths (const Standard_Integer x, const Standard_Integer y, const Standard_Integer width, const Standard_Integer height, const Standard_Address buffer) const;
499 //! Generate offscreen FBO in the graphic library
500 Standard_EXPORT Graphic3d_PtrFrameBuffer FBOCreate (const Standard_Integer width, const Standard_Integer height);
502 //! Remove offscreen FBO from the graphic library
503 Standard_EXPORT void FBORelease (Graphic3d_PtrFrameBuffer& fboPtr);
505 //! Read offscreen FBO configuration.
506 Standard_EXPORT void FBOGetDimensions (const Graphic3d_PtrFrameBuffer fboPtr, Standard_Integer& width, Standard_Integer& height, Standard_Integer& widthMax, Standard_Integer& heightMax);
508 //! Change offscreen FBO viewport.
509 Standard_EXPORT void FBOChangeViewport (Graphic3d_PtrFrameBuffer& fboPtr, const Standard_Integer width, const Standard_Integer height);
511 //! Dump active rendering buffer into specified memory buffer.
512 Standard_EXPORT Standard_Boolean BufferDump (Image_PixMap& theImage, const Graphic3d_BufferType& theBufferType);
514 //! turns on/off opengl lighting, currently used in triedron displaying
515 Standard_EXPORT void EnableGLLight (const Standard_Boolean enable) const;
517 //! returns the current state of the gl lighting
518 //! currently used in triedron displaying
519 Standard_EXPORT Standard_Boolean IsGLLightEnabled() const;
522 //! Export scene into the one of the Vector graphics formats (SVG, PS, PDF...).
523 //! In contrast to Bitmaps, Vector graphics is scalable (so you may got quality benefits on printing to laser printer).
524 //! Notice however that results may differ a lot and do not contain some elements.
525 Standard_EXPORT Standard_Boolean Export (const Standard_CString theFileName, const Graphic3d_ExportFormat theFormat, const Graphic3d_SortType theSortType = Graphic3d_ST_BSP_Tree, const Standard_Real thePrecision = 0.005, const Standard_Address theProgressBarFunc = NULL, const Standard_Address theProgressObject = NULL) const;
527 //! Returns map of objects hidden within this specific view (not viewer-wise).
528 Standard_EXPORT const Handle(Graphic3d_NMapOfTransient)& HiddenObjects() const;
530 //! Returns map of objects hidden within this specific view (not viewer-wise).
531 Standard_EXPORT Handle(Graphic3d_NMapOfTransient)& ChangeHiddenObjects();
533 friend class Visual3d_ViewManager;
536 DEFINE_STANDARD_RTTI(Visual3d_View,Graphic3d_DataStructureManager)
546 //! Is it possible to display the structure in the view?
547 Standard_EXPORT Visual3d_TypeOfAnswer acceptDisplay (const Graphic3d_TypeOfStructure theStructType) const;
549 //! Computes the new presentation of the
550 //! Structures displayed in <me> with the type
551 //! Graphic3d_TOS_COMPUTED.
552 Standard_EXPORT void Compute();
554 //! Changes the display priority of the structure <AStructure>.
555 Standard_EXPORT void ChangeDisplayPriority (const Handle(Graphic3d_Structure)& AStructure, const Standard_Integer OldPriority, const Standard_Integer NewPriority);
557 //! Sets the settings for a single Z layer of specified view.
558 Standard_EXPORT void SetZLayerSettings (const Graphic3d_ZLayerId theLayerId, const Graphic3d_ZLayerSettings& theSettings);
560 //! Add a new top-level Z layer to the view with ID
561 //! <theLayerId>. The z layer mechanism allows to display
562 //! structures in higher layers in overlay of structures in lower layers.
563 //! The layers in a particular view should be managed centrally
564 //! by its view manager so to avoid IDs mismatching and provide correct
565 //! display of graphics in all views.
566 Standard_EXPORT void AddZLayer (const Graphic3d_ZLayerId theLayerId);
568 //! Remove z layer from the view by its ID.
569 Standard_EXPORT void RemoveZLayer (const Graphic3d_ZLayerId theLayerId);
571 //! Change Z layer of already displayed structure in the view.
572 Standard_EXPORT void ChangeZLayer (const Handle(Graphic3d_Structure)& theStructure, const Graphic3d_ZLayerId theLayerId);
574 //! Clears the structure <AStructure> to the view <me>.
575 Standard_EXPORT void Clear (const Handle(Graphic3d_Structure)& AStructure, const Standard_Boolean WithDestruction);
577 //! Connects the structures <AMother> and <ADaughter>.
578 Standard_EXPORT void Connect (const Handle(Graphic3d_Structure)& AMother, const Handle(Graphic3d_Structure)& ADaughter);
580 //! Disconnects the structures <AMother> and <ADaughter>.
581 Standard_EXPORT void Disconnect (const Handle(Graphic3d_Structure)& AMother, const Handle(Graphic3d_Structure)& ADaughter);
583 //! Display the structure <AStructure> to the view <me>.
584 Standard_EXPORT void Display (const Handle(Graphic3d_Structure)& AStructure);
586 //! Display the structure <AStructure> to the view <me>.
587 Standard_EXPORT void Display (const Handle(Graphic3d_Structure)& AStructure, const Aspect_TypeOfUpdate AnUpdateMode);
589 //! Erases the structure <AStructure> from the view <me>.
590 Standard_EXPORT void Erase (const Handle(Graphic3d_Structure)& AStructure);
592 //! Erases the structure <AStructure> from the view <me>.
593 Standard_EXPORT void Erase (const Handle(Graphic3d_Structure)& AStructure, const Aspect_TypeOfUpdate AnUpdateMode);
595 //! Highlights the structure <AStructure> in the view <me>.
596 Standard_EXPORT void Highlight (const Handle(Graphic3d_Structure)& AStructure, const Aspect_TypeOfHighlightMethod AMethod);
598 //! Transforms the structure <AStructure> in the view <me>.
599 Standard_EXPORT void SetTransform (const Handle(Graphic3d_Structure)& AStructure, const TColStd_Array2OfReal& ATrsf);
601 //! Suppress the highlighting on the structure <AStructure>
602 //! in the view <me>.
603 Standard_EXPORT void UnHighlight (const Handle(Graphic3d_Structure)& AStructure);
605 //! Returns an index != 0 if the structure <AStructure>
606 //! have another structure computed for the view <me>.
607 Standard_EXPORT Standard_Integer IsComputed (const Handle(Graphic3d_Structure)& AStructure) const;
609 //! Returns true if the structure <AStructure> is
610 //! displayed in the view <me>.
611 Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(Graphic3d_Structure)& AStructure) const;
613 //! Modifies the aspect ratio of the view <me> when the
614 //! associated window is defined or resized.
615 Standard_EXPORT void SetRatio();
617 //! Updates the lights when the associated window is defined
618 //! and when the view is activated.
619 Standard_EXPORT void UpdateLights();
621 //! Updates the planes when the associated window is defined
622 //! and when the view is activated.
623 Standard_EXPORT void UpdatePlanes();
625 //! Updates the associated c structure before a call to the
627 Standard_EXPORT void UpdateView();
629 //! Returns an index != 0 if the structure <AStructure>
630 //! have the same owner than another structure in the
631 //! sequence of the computed structures.
632 Standard_EXPORT Standard_Integer HaveTheSameOwner (const Handle(Graphic3d_Structure)& AStructure) const;
634 Visual3d_ViewManagerPtr myViewManager;
635 Graphic3d_CView MyCView;
636 Visual3d_ContextView MyContext;
637 Handle(Aspect_Window) MyWindow;
638 Graphic3d_SequenceOfStructure myStructsToCompute;
639 Graphic3d_SequenceOfStructure myStructsComputed;
640 Standard_Boolean myIsInComputedMode;
641 Handle(Graphic3d_GraphicDriver) myGraphicDriver;
642 Aspect_Background MyBackground;
643 Aspect_GradientBackground MyGradientBackground;
644 Graphic3d_MapOfStructure myStructsDisplayed;
645 Graphic3d_MapOfStructure myImmediateStructures;
646 Graphic3d_GraduatedTrihedron myGTrihedron;
647 Handle(Graphic3d_Camera) myDefaultCamera;
648 Standard_Boolean myAutoZFitIsOn;
649 Standard_Real myAutoZFitScaleFactor;
650 Standard_Boolean myStructuresUpdated;
651 Handle(Graphic3d_NMapOfTransient) myHiddenObjects;
662 #endif // _Visual3d_View_HeaderFile