0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / dox / upgrade / upgrade.md
1 Upgrade from older OCCT versions  {#occt__upgrade}
2 ================================
3
4 @tableofcontents
5
6 @section upgrade_intro Introduction
7
8 This document provides technical details on changes made in particular versions of OCCT. It can help to upgrade user applications based on previous versions of OCCT to newer ones.
9
10 @ref upgrade_occt780 "SEEK TO THE LAST CHAPTER (UPGRADE TO 7.8.0)"
11
12 @subsection upgrade_intro_precautions Precautions
13
14 Back-up your code before the upgrade.
15 We strongly recommend using version control system during the upgrade process and saving one or several commits at each step of upgrade, until the overall result is verified.
16 This will facilitate identification and correction of possible problems that can occur at the intermediate steps of upgrade.
17 It is advisable to document each step carefully to be able to repeat it if necessary.
18
19 @subsection upgrade_intro_disclaim Disclaimer
20
21 This document describes known issues that have been encountered during porting of OCCT and some applications and approaches that have helped to resolve these issues in known cases.
22 It does not pretend to cover all possible migration issues that can appear in your application.
23 Take this document with discretion; apply your expertise and knowledge of your application to ensure the correct result. 
24
25 The automatic upgrade tool is provided as is, without warranty of any kind, and we explicitly disclaim any liability for possible errors that may appear due to use of this tool. 
26 It is your responsibility to ensure that the changes you made in your code are correct. 
27 When you upgrade the code by an automatic script, make sure to carefully review the introduced changes at each step before committing them.
28
29 @section upgrade_65 Upgrade to OCCT 6.5.0
30
31 Porting of user applications from an earlier OCCT version to version 6.5 requires taking into account the following major changes:
32 * If you are not comfortable with dependence on Intel TBB, FreeImage, or Gl2Ps libraries, you will need to (re)build OCCT with these dependencies disabled.
33 * The low-level format version of OCAF binary and XML persistence has been incremented. Hence, the files saved by OCCT 6.5 to OCAF binary or XML format will not be readable by previous versions of OCCT.
34 * The *BRepMesh* triangulation algorithm has been seriously revised and now tries hard to fulfill the requested deflection and angular tolerance parameters. If you experience any problems with performance or triangulation quality (in particular, display of shapes in shading mode), consider revising the values of these parameters used in your application.
35 * If you were using method *ToPixMap()* of class *V3d_View* to get a buffer for passing to Windows API functions (e.g. *BitBlt*), this will not work anymore. You will need to use method *Image_PixMap::AccessBuffer()* to get the raw buffer data that can be further passed to WinAPI functions.
36 * As the processing of message gravity parameter in *Message* package has been improved, some application messages (especially the ones generated by IGES or STEP translators) can be suppressed or new messages appear in the application. Use relevant message level parameter to tune this behavior.
37
38 @section upgrade_651 Upgrade to OCCT 6.5.1
39
40 Porting of user applications from an earlier OCCT version to version 6.5.1 requires taking into account the following major changes:
41
42 *       Method *Graphic3d_Structure::Groups()* now returns *Graphic3d_SequenceOfGroup*. If this method has been used, the application code should be updated to iterate another collection type or, if *Graphic3d_HSetOfGroup* is required, to fill its own collection:
43 ~~~~{.cpp}
44 const Graphic3d_SequenceOfGroup& aGroupsSeq = theStructure.Groups();
45 Handle(Graphic3d_HSetOfGroup) aGroupSet = new Graphic3d_HSetOfGroup();
46 Standard_Integer aLen = aGroupsSeq.Length();
47 for (Standard_Integer aGr = 1; aGr <= aLen; ++aGr)
48 {
49  aGroupSet->Add (aGroupsSeq.Value (aGr));
50 }
51 ~~~~
52
53 * All occurrences of *Select3D_Projector* in the application code (if any) should be replaced with *Handle(Select3D_Projector)*.
54 * The code of inheritors of *Select3D_SensitiveEntity* should be updated if they override <i>Matches()</i> (this is probable, if clipping planes are used).
55 * Constructor for *V3d_Plane* has been changed, so the extra argument should be removed if used in the application. It is necessary to add a new plane using method *V3d_Viewer::AddPlane()* if *V3d_Viewer* has been used to manage clipping planes list (this does not affect clipping planes representation). Have a look at the source code for new DRAWEXE *vclipplane* command in *ViewerTest_ObjectsCommands.cxx, VClipPlane* to see how clipping planes can be managed in the application.
56
57 @section upgrade_652 Upgrade to OCCT 6.5.2
58
59 Porting of user applications from an earlier OCCT version to version 6.5.2 requires taking into account the following major changes:
60 * Any code that has been generated by WOK from CDL generic classes *Tcollection_DataMap* and *Tcollection_IndexedDataMap* needs to be regenerated by WOK to take into account the change in the interface of these classes.
61 * The enumerations *CDF_StoreStatus* and *CDF_RetrievableStatus* have been replaced by the enumerations *PCDM_StoreStatus* and *PCDM_ReaderStatus*. Correspondingly, the methods *Open, Save* and *SaveAs* of the class *TDocStd_Application* have changed their return value. Any code, which uses these enumerations, needs to be updated.
62 * *BRepLib_MakeFace* has been modified to receive tolerance value for resolution of degenerated edges. This tolerance parameter has no default value to ensure that the client code takes care of passing a meaningful value, not just *Precision::Confusion*, so some porting overheads are expected. 
63 * If the callback mechanism in call_togl_redraw function was used in the application code, it is necessary to revise it to take into account the new callback execution and provide a check of reason value of Aspect_GraphicCallbackStruct in callback methods to confirm that the callback code is executed at the right moment. Now the callbacks are executed before redrawing the underlayer, before redrawing the overlayer and at the end of redrawing. The information about the moment when the callback is invoked is provided with the reason value in form of an additional bit flag <i>(OCC_PRE_REDRAW, OCC_PRE_OVERLAY)</i>. The state of OpenGl changed in callback methods will not be restored automatically, which might lead to unwanted behavior in redrawing procedure.
64 * The print method used in the application code might need to be revised to take into account the ability to choose between print algorithms: tile and stretch. The stretch algorithm will be selected by default during porting.
65 * It is recommended to *BRepMesh_DiscretFactory* users, to check *BRepMesh_DiscretFactory::SetDefault()* return value to determine plugin availability / validity. *BRepMesh_DiscretFactory::Discret()* method now returns handle instead of pointer. The code should be updated in the following manner:
66 ~~~~{.cpp}
67 Handle(BRepMesh_DiscretRoot) aMeshAlgo = BRepMesh_DiscretFactory::Get().Discret (theShape, theDeflection, theAngularToler);
68  if (!aMeshAlgo.IsNull())  {}
69 ~~~~
70
71 * The default state of *BRepMesh* parallelization has been turned off. The user should switch this flag explicitly:
72     *   by using methods *BRepMesh_IncrementalMesh::SetParallel(Standard_True)* for each *BRepMesh_IncrementalMesh* instance before <i>Perform()</i>;
73     *   by calling *BRepMesh_IncrementalMesh::SetParallelDefault(Standard_True)* when *BRepMesh_DiscretFactory* is used to retrieve the meshing tool (this also affects auto-triangulation in *AIS*).
74
75 @section upgrade_653 Upgrade to OCCT 6.5.3
76
77 Porting of user applications from an earlier OCCT version to version 6.5.3 requires taking into account the following major changes:
78 * As a result of code clean-up and redesign of *TKOpenGl* driver, some obsolete functions and rendering primitives <i>(TriangleMesh, TriangleSet, Bezier, Polyline, Polygon, PolygonHoles, QuadrangleMesh</i> and *QuadrangleSet*) have been removed. Instead, the application developers should use primitive arrays that provide the same functionality but are hardware-accelerated. The details can be found in OCCT Visualization User's Guide, “Primitive Arrays” chapter.
79 * Applications should not call *AIS_InteractiveObject::SetPolygonOffsets()* method for an instance of *AIS_TexturedShape* class after it has been added to *AIS_InteractiveContext*. More generally, modification of *Graphic3d_AspectFillArea3d* parameters for the computed groups of any *AIS_InteractiveObject* subclass that uses texture mapping should be avoided, because this results in broken texture mapping (see issue 23118). It is still possible to apply non-default polygon offsets to *AIS_TexturedShape* by calling *SetPolygonOffsets()* before displaying the shape.
80 * The applications that might have used internal functions provided by *TKOpenGl* or removed primitives will need to be updated.
81 * In connection with the implementation of Z-layers it might be necessary to revise the application code or revise the custom direct descendant classes of *Graphic3d_GraphicDriver* and *Graphic3d_StructureManager* to use the Z-layer feature.
82 * Global variables *Standard_PI* and *PI* have been eliminated (use macro *M_PI* instead). 
83 * Method *HashCode()* has been removed from class *Standard_Transient*. It is advisable to use global function <i>HashCode()</i> for Handle objects instead. 
84 * Declaration of operators new/delete for classes has become consistent and is encapsulated in macros.
85 * Memory management has been changed to use standard heap <i>(MMGT_OPT=0)</i> and reentrant mode <i>(MMGT_REENTRANT=1)</i> by default.
86 * Map classes in *NCollection* package now receive one more argument defining a hash tool.
87
88 @section upgrade_654 Upgrade to OCCT 6.5.4
89
90 Porting of user applications from an earlier OCCT version to version 6.5.4 requires taking into account the following major changes:
91 * The code using obsolete classes *Aspect_PixMap, Xw_PixMap* and *WNT_PixMap* should be rewritten implementing class *Image_PixMap*, which is now retrieved by *ToPixMap* methods as argument. A sample code using *ToPixMap* is given below:
92 ~~~~{.cpp}
93 #include <Image_AlienPixMap.hxx>
94 void dump (Handle(V3d_View)& theView3D)
95 {
96   Standard_Integer aWndSizeX = 0;
97   Standard_Integer aWndSizeY = 0;
98   theView3D->Window()->Size (aWndSizeX, aWndSizeY);
99   Image_AlienPixMap aPixMap;
100   theView3D->ToPixMap (aPixMap, aWndSizeX, aWndSizeY);
101   aPixMap.Save ("c:\\image.png");
102 }
103 ~~~~
104 * Now OpenGL resources related to Interactive Objects are automatically freed when the last view (window) is removed from graphical driver. 
105 To avoid presentation data loss, the application should replace an old view with a new one in the proper order: first the new view is created and activated and only then the old one is detached and removed. 
106 * It is recommended to use *NCollection* containers with hasher parameter (introduced in 6.5.3) instead of global definition <i>IsEqual()/HashCode()</i> as well as to use explicit namespaces to avoid name collision.
107
108
109 @section upgrade_660 Upgrade to OCCT 6.6.0
110
111 Porting of user applications from an earlier OCCT version to version 6.6.0 requires taking into account the following major changes:
112 * Due to the changes in the implementation of Boolean Operations, the order of sub-shapes resulting from the same operation performed with OCCT 6.5.x and OCCT 6.6.0 can be different. 
113 It is necessary to introduce the corresponding changes in the applications for which the order of sub-shapes resulting from a Boolean operation is important. It is strongly recommended to use identification methods not relying on the order of sub-shapes (e.g. OCAF naming).
114 * If you need to use OCCT on Mac OS X with X11 (without Cocoa), build OCCT with defined pre-processor macro *CSF_MAC_USE_GLX11*. XLib front-end (previously the only way for unofficial OCCT builds on Mac OS X) is now disabled by default on this platform. If your application has no support for Cocoa framework you may build OCCT with XLib front-end adding *MACOSX_USE_GLX* macro to compiler options (you may check the appropriate option in WOK configuration GUI and in CMake configuration). Notice that XQuartz (XLib implementation for Mac OS X) now is an optional component and does not provide a sufficient level of integrity with native (Cocoa-based) applications in the system. It is not possible to build OCCT with both XLib and Cocoa at the same time due to symbols conflict in OpenGL functions. 
115 * Animation mode and degeneration presentation mode (simplified presentation for animation) and associated methods have been removed from 3D viewer functionality.
116 Correspondingly, the code using methods *SetAnimationModeOn(), SetAnimationModeOff(), AnimationModeIsOn(), AnimationMode(), Tumble(), SetDegenerateModeOn(), SetDegenerateModeOff()* and *DegenerateModeIsOn()* of classes *V3d_View* and *Visual3d_View* will need to be removed or redesigned. Hidden Line Removal presentation was not affected; however, the old code that used methods *V3d_View::SetDegenerateModeOn* or *V3d_View::SetDegenerateModeOff* to control HLR presentation should be updated to use *V3d_View::SetComputedMode* method instead.
117 * Calls of *Graphic3d_Group::BeginPrimitives()* and *Graphic3d_Group::EndPrimitives()* should be removed from the application code.
118 * Application functionality for drawing 2D graphics that was formerly based on *TKV2d* API should be migrated to *TKV3d* API. The following changes are recommended for this migration:
119    * A 2D view can be implemented as a *V3d_View* instance belonging to *V3d_Viewer* managed by *AIS_InteractiveContext* instance. To turn *V3d_View* into a 2D view, the necessary view orientation should be set up at the view initialization stage using *V3d_View::SetProj()* method, and view rotation methods simply should not be called.
120    * Any 2D graphic entity (formerly represented with *AIS2D_InteractiveObject*) should become a class derived from *AIS_InteractiveObject* base. These entities should be manipulated in a view using *AIS_InteractiveContext* class API.
121    * All drawing code should be put into *Compute()* virtual method of a custom interactive object class and use API of *Graphic3d* package. In particular, all geometry should be drawn using class hierarchy derived from *Graphic3d_ArrayOfPrimitives*. Normally, the Z coordinate for 2D geometry should be constant, unless the application implements some advanced 2D drawing techniques like e.g. multiple "Z layers" of drawings.
122    * Interactive selection of 2D presentations should be set up inside *ComputeSelection()* virtual method of a custom interactive object class, using standard sensitive entities from *Select3D* package and standard or custom entity owners derived from *SelectMgr_EntityOwner* base.
123 Refer to the Visualization User's Guide for further details concerning OCCT 3D visualization and selection classes. See also *Viewer2D* OCCT sample application, which shows how 2D drawing can be implemented using TKV3d API.
124 * Run-time graphic driver library loading mechanism based on *CSF_GraphicShr* environment variable usage has been replaced by explicit linking against *TKOpenGl* library. The code sample below shows how the graphic driver should be created and initialized in the application code: 
125 ~~~~{.cpp}
126 // initialize a new viewer with OpenGl graphic driver
127 Handle(Graphic3d_GraphicDriver) aGraphicDriver = 
128 new OpenGl_GraphicDriver ("TKOpenGl");
129   aGraphicDriver->Begin (new Aspect_DisplayConnection());
130   TCollection_ExtendedString aNameOfViewer ("Visu3D");
131   Handle(V3d_Viewer) aViewer 
132 = new V3d_Viewer (aGraphicDriver, aNameOfViewer.ToExtString());
133   aViewer->Init();
134
135 // create a new window or a wrapper over the existing window, 
136 // provided by a 3rd-party framework (Qt, MFC, C# or Cocoa)
137 #if defined(_WIN32) || defined(__WIN32__)
138   Aspect_Handle aWindowHandle = (Aspect_Handle )winId();
139   Handle(WNT_Window) aWindow = new WNT_Window (winId());
140 #elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
141   NSView* aViewHandle = (NSView* )winId();
142   Handle(Cocoa_Window) aWindow = new Cocoa_Window (aViewHandle);
143 #else
144  Aspect_Handle aWindowHandle = (Aspect_Handle )winId();
145   Handle(Xw_Window) aWindow = 
146      new Xw_Window (aGraphicDriver->GetDisplayConnection(), aWindowHandle);
147 #endif // WNT
148
149 // setup the window for a new view
150   Handle(V3d_View) aView = aViewer->CreateView();
151   aView->SetWindow (aWindow);
152 ~~~~
153
154 * The following changes should be made in the application-specific implementations of texture aspect:
155     * *Graphic3d_TextureRoot* inheritors now should return texture image by overloading of *Graphic3d_TextureRoot::GetImage()* method instead of the old logic.
156     * Now you can decide if the application should store the image copy as a field of property or reload it dynamically each time (to optimize the memory usage). The default implementation (which loads the image content from the provided file path) does not hold an extra copy since it will be uploaded to the graphic memory when first used.
157     * Notice that the image itself should be created within *Image_PixMap* class from *AlienImage* package, while *Image_Image* class is no more supported and will be removed in the next OCCT release.
158         
159 @section upgrade_670 Upgrade to OCCT 6.7.0
160
161 Porting of user applications from an earlier OCCT version to version 6.7.0 requires taking into account the following major changes.
162
163 @subsection upgrade_670_clipping Object-level clipping and capping algorithm. 
164
165 * It might be necessary to revise and port code related to management of view-level clipping to use *Graphic3d_ClipPlane* instead of *V3d_Plane* instances. Note that *V3d_Plane* class has been preserved -- as previously, it can be used as plane representation. Another approach to represent *Graphic3d_ClipPlane* in a view is to use custom presentable object.
166 * The list of arguments of *Select3D_SensitiveEntity::Matches()* method for picking detection has changed. Since now, for correct selection clipping, the implementations should perform a depth clipping check and return (as output argument) minimum depth value found at the detected part of sensitive. Refer to CDL / Doxygen documentation to find descriptive hints and snippets.
167 * *Select3D_SensitiveEntity::ComputeDepth()* abstract method has been removed. Custom implementations should provide depth checks by method *Matches()* instead -- all data required for it is available within a scope of single method.
168 * It might be necessary to revise the code of custom sensitive entities and port *Matches()* and *ComputeDepth()* methods to ensure proper selection clipping. Note that obsolete signature of *Matches* is not used anymore by the selector. If your class inheriting *Select3D_SensitiveEntity* redefines the method with old signature the code should not compile as the return type has been changed. This is done to prevent override of removed methods.
169
170 @subsection upgrade_670_markers Redesign of markers presentation
171
172 * Due to the redesign of *Graphic3d_AspectMarker3d* class the code of custom markers initialization should be updated. Notice that you can reuse old markers definition code as *TColStd_HArray1OfByte*; however, *Image_PixMap* is now the preferred way (and supports full-color images on modern hardware).
173 * Logics and arguments of methods *AIS_InteractiveContext::Erase()* and *AIS_InteractiveContext::EraseAll()* have been changed. Now these methods do not remove resources from *Graphic3d_Structure*; they simply change the visibility flag in it. Therefore, the code that deletes and reсomputes resources should be revised.
174 * *Graphic3d_Group::MarkerSet()* has been removed. *Graphic3d_Group::AddPrimitiveArray()* should be used instead to specify marker(s) array.
175
176 @subsection upgrade_670_views Default views are not created automatically 
177
178 As the obsolete methods *Init(), DefaultOrthographicView()* and *DefaultPerspectiveView()* have been removed from *V3d_Viewer* class, the two default views are no longer created automatically. It is obligatory to create *V3d_View* instances explicitly, either directly by operator new or by calling *V3d_Viewer::CreateView()*. 
179
180 The call *V3d_Viewer::SetDefaultLights()* should also be done explicitly at the application level, if the application prefers to use the default light source configuration. Otherwise, the application itself should set up the light sources to obtain a correct 3D scene.
181
182 @subsection upgrade_670_dimensions Improved dimensions implementation
183
184 * It might be necessary to revise and port code related to management of *AIS_LengthDimension, AIS_AngleDimension* and *AIS_DiameterDimension* presentations. There is no more need to compute value of dimension and pass it as string to constructor argument. The value is computed internally. The custom value can be set with *SetCustomValue()* method.
185 * The definition of units and general aspect properties is now provided by *Prs3d_DimensionUnits* and *Prs3d_DimensionApsect* classes.
186 * It might be also necessary to revise code of your application related to usage of *AIS_DimensionDisplayMode enumeration*. If it used for specifying the selection mode, then it should be replaced by a more appropriate enumeration *AIS_DimensionSelectionMode*.
187
188 @subsection upgrade_670_list_collection NCollection_Set replaced by List collection 
189
190 It might be necessary to revise your application code, which uses non-ordered *Graphic3d_SetOfHClipPlane* collection type and replace its occurrences by ordered *Graphic3d_SequenceOfHClipPlane* collection type.
191
192
193 @section upgrade_680 Upgrade to OCCT 6.8.0
194
195 Porting of user applications from an earlier OCCT version to version 6.8.0 requires taking into account the following major changes.
196
197 @subsection upgrade_680_ncollection Changes in NCollection classes
198
199 Method *Assign()* in *NCollection* classes does not allow any more copying between different collection types. Such copying should be done manually.
200
201 List and map classes in *NCollection* package now require that their items be copy-constructible, but do not require items to have default constructor. Thus the code using *NCollection* classes for non-copy-constructible objects needs be updated. One option is to provide copy constructor; another possibility is to use Handle or other smart pointer.
202
203 @subsection upgrade_680_view_camera 3D View Camera
204
205 If *ViewMapping* and *ViewOrientation* were used directly, this functionality has to be ported to the new camera model. The following methods should be considered as an alternative to the obsolete *Visual3d* services (all points and directions are supposed to be in world coordinates):
206 * *Graphic3d_Camera::ViewDimensions()* or *V3d_View::Size()/ZSize()* -- returns view width, height and depth (or "Z size"). Since the view is symmetric now, you can easily compute top, bottom, left and right limits. *Graphic3d_Camera::ZNear()/ZFar()* can be used to obtain the near and far clipping distances with respect to the eye.
207 * *Graphic3d_Camera::Up()* or *V3d_View::Up()* -- returns Y direction of the view.
208 * *Graphic3d_Camera::Direction()* returns the reverse view normal directed from the eye, *V3d_View::Proj()* returns the old-style view normal.
209 * *Graphic3d_Camera::Eye()* or *V3d_View::Eye()* -- returns the camera position (same as projection reference point in old implementation).
210 * *Graphic3d_Camera::Center()* or *V3d_View::At()* -- returns the point the camera looks at (or view reference point according to old terminology).
211
212 The current perspective model is not fully backward compatible, so the old perspective-related functionality needs to be reviewed.
213
214 Revise application-specific custom presentations to provide a proper bounding box, otherwise the object might become erroneously clipped by automatic *ZFit* or frustum culling algorithms enabled by default.
215
216 @subsection upgrade_680_connected_objects Redesign of Connected Interactive Objects
217
218 The new implementation of connected Interactive Objects makes it necessary to take the following steps if you use connected Interactive Objects in your application.
219 * Use new *PrsMgr_PresentableObject* transformation API.
220 * Call *RemoveChild()* from the original object after connect if you need the original object and *AIS_ConnectedInteractive* to move independently.
221 * Access instances of objects connected to *AIS_MultiplyConnectedInteractive* with *Children()* method.
222 * For *PrsMgr_PresentableObject* transformation:
223    * *SetLocation (TopLoc_Location) -> SetLocalTransformation (gp_Trsf)*
224    * *Location -> LocalTransformation*
225    * *HasLocation -> HasTransformation*
226    * *ResetLocation -> ResetTransformation*
227    
228 @subsection upgrade_680_unicode Support of UNICODE Characters 
229
230 Support of UNICODE characters introduced in OCCT breaks backward compatibility with applications, which currently use filenames in extended ASCII encoding bound to the current locale. Such applications should be updated to convert such strings to UTF-8 format.
231
232 The conversion from UTF-8 to wchar_t is made using little-endian approach. Thus, this code will not work correctly on big-endian platforms. It is needed to complete this in the way similar as it is done for binary persistence (see the macro *DO_INVERSE* in *FSD_FileHeader.hxx).*
233
234 @subsection upgrade_680_projection_shift Elimination of Projection Shift Concept
235
236 It might be necessary to revise the application code, which deals with *Center()* method of *V3d_View*. 
237
238 This method was used to pan a *V3d* view by virtually moving the screen center with respect to the projection ray passed through Eye and At points. There is no more need to derive the panning from the Center parameter to get a camera-like eye position and look at the coordinates. *Eye()* and *At()* now return these coordinates directly. When porting code dealing with *Center()*, the parameters *Eye()* and *At()* can be adjusted instead. Also *V3d_View::SetCenter(Xpix, Ypix)* method can be used instead of *V3d_View::Center(X, Y)* to center the view at the given point. However, if the center coordinates X and Y come from older OCCT releases, calling *V3d_View::Panning(-X, -Y)* can be recommended to compensate missing projection shift effect.
239
240 There are several changes introduced to *Graphic3d_Camera*. The internal data structure of the camera is based on *Standard_Real* data types to avoid redundant application-level conversions and precision errors. The transformation matrices now can be evaluated both for *Standard_Real* and *Standard_ShortReal* value types. *ZNear* and *ZFar* planes can be either negative or positive for orthographic camera projection, providing a trade-off between the camera distance and the range of *ZNear* or *ZFar* to reduce difference of exponents of values composing the orientation matrix - to avoid calculation errors. The negative values can be specified to avoid Z-clipping if the reference system of camera goes inside of the model when decreasing camera distance.
241
242 The auto z fit mode, since now, has a parameter defining Z-range margin (the one which is usually passed as argument to *ZFitAll()* method). The methods *SetAutoZFitMode(), AutoZFitScaleFactor()* and *ZFitAll()* from class *V3d_View* deal with the new parameter.
243
244 The class *Select3D_Projector* now supports both orientation and projection transformation matrices, which can be naturally set for the projector. The definition of projector was revised in *StdSelect_ViewerSelector3d*: perspective and orthographic projection parameters are handled properly. Orthographic projector is based only on direction of projection - no more *Center* property. This makes it possible to avoid unnecessary re-projection of sensitive while panning, zooming or moving along the projection ray of the view. These operations do not affect the orthographic projection.
245
246
247 @section upgrade_690 Upgrade to OCCT 6.9.0
248
249 Porting of user applications from an earlier OCCT version to version 6.9.0 requires taking into account the following major changes.
250
251 @subsection upgrade_690_shaders 3D Viewer initialization
252
253 3D Viewer now uses GLSL programs for managing frame buffer and stereoscopic output.
254 For proper initialization, application should configure **CSF_ShadersDirectory** environment variable pointing to a folder with GLSL resources - files from folder **CASROOT**/src/Shaders.
255 *Note that **CSF_ShadersDirectory** become optional since OCCT 7.1.0 release*.
256
257 @subsection upgrade_690_selection Changes in Selection
258
259 Selection mechanism of 3D Viewer has been redesigned to use 3-level BVH tree traverse directly in 3D space instead of projection onto 2D screen space (updated on each rotation). This architectural redesign may require appropriate changes at application level in case if custom Interactive Objects are used.
260
261 #### Standard selection
262 Usage of standard OCCT selection entities would require only minor updates.
263
264 Custom Interactive Objects should implement new virtual method *SelectMgr_SelectableObject::BoundingBox().*
265
266 Now the method *SelectMgr_Selection::Sensitive()* does not return *SelectBasics_SensitiveEntity*. It returns an instance of *SelectMgr_SensitiveEntity*, which belongs to a different class hierarchy (thus *DownCast()* will fail). To access base sensitive it is necessary to use method *SelectMgr_SensitiveEntity::BaseSensitive()*. For example:
267
268 ~~~~{.cpp}
269 Handle(SelectMgr_Selection) aSelection = anInteractiveObject->Selection (aMode);
270 for (aSelection->Init(); aSelection->More(); aSelection->Next())
271 {
272    Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive();
273 }
274 ~~~~
275
276 #### Custom sensitive entities
277
278 Custom sensitive entities require more complex changes, since the selection algorithm has been redesigned and requires different output from the entities. 
279
280 The method *SelectBasics_SensitiveEntity::Matches()* of the base class should be overridden following the new signature:
281
282 *Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr, SelectBasics_PickResult& thePickResult)*, where *theMgr* contains information about the currently selected frustum or set of frustums (see *SelectMgr_RectangularFrustum, SelectMgr_TrangularFrustum, SelectMgr_TriangularFrustumSet)* and *SelectBasics_PickResult* is an output parameter, containing information about the depth of the detected entity and distance to its center of geometry.
283
284 In the overridden method it is necessary to implement an algorithm of overlap and inclusion detection (the active mode is returned by *theMgr.IsOverlapAllowed()*) with triangular and rectangular frustums.
285
286 The depth and distance to the center of geometry must be calculated for the 3D projection of user-picked screen point in the world space. You may use already implemented overlap and inclusion detection methods for different primitives from *SelectMgr_RectangularFrustum* and *SelectMgr_TriangularFrustum*, including triangle, point, axis-aligned box, line segment and planar polygon. 
287
288 Here is an example of overlap/inclusion test for a box:
289
290 ~~~~{.cpp}
291 if (!theMgr.IsOverlapAllowed()) // check for inclusion
292 {
293   Standard_Boolean isInside = Standard_True;
294   return theMgr.Overlaps (myBox.CornerMin(), myBox.CornerMax(), &isInside) && isInside;
295 }
296
297 Standard_Real aDepth;
298 if (!theMgr.Overlaps (myBox, aDepth)) // check for overlap
299 {
300   return Standard_False;
301 }
302
303 thePickResult =
304 SelectBasics_PickResult (aDepth, theMgr.DistToGeometryCenter (myCenter3d));
305 ~~~~
306
307 The interface of *SelectBasics_SensitiveEntity* now contains four new pure virtual functions that should be implemented by each custom sensitive:
308 * <i>BoundingBox()</i> – returns a bounding box of the entity;
309 * <i>Clear()</i> – clears up all the resources and memory allocated for complex sensitive entities;
310 * <i>BVH()</i> – builds a BVH tree for complex sensitive entities, if it is needed;
311 * <i>NbSubElements()</i> – returns atomic sub-entities of a complex sensitive entity, which will be used as primitives for BVH building. If the entity is simple and no BVH is required, this method returns 1.
312
313 Each sensitive entity now has its own tolerance, which can be overridden by method *SelectBasics_SensitiveEntity::SetSensitivityFactor()* called from constructor.
314
315
316 @subsection upgrade_690_adaptor3d-curve Changes in Adaptor3d_Curve class
317
318 All classes inheriting *Adaptor3d_Curve* (directly or indirectly) must be updated in application code to use new signature of methods *Intervals()* and *NbIntervals()*. Note that no compiler warning will be generated if this is not done.
319
320 @subsection upgrade_690_v3d_view Changes in V3d_View class
321
322 The methods *V3d_View::Convert* and *V3d_View::ConvertWithProj()* have ceased to return point on the active grid. It might be necessary to revise the code of your application so that *V3d_View::ConvertToGrid()* was called explicitly for the values returned by *V3d_View::Convert* to get analogous coordinates on the grid. The methods *V3d_View::Convert* and *V3d_View::ConvertWithProj* convert point into reference plane of the view corresponding to the intersection with the projection plane of the eye/view point vector.
323
324 @section upgrade_700 Upgrade to OCCT 7.0.0
325
326 Porting of user applications from an earlier OCCT version to version 7.0.0 requires taking into account the following major changes.
327
328 Building OCCT now requires compiler supporting some C++11 features.
329 The supported compilers are:
330 - MSVC: version 10 (Visual Studio 2010) or later
331 - GCC: version 4.3 or later
332 - CLang: version 3.6 or later
333 - ICC: version XE 2013 SP 1 or later
334
335 When compiling code that uses OCCT with GCC and CLang compilers, it is necessary to use compiler option -std=c++0x (or its siblings) to enable C++11 features.
336
337 @subsection upgrade_700_persist Removal of legacy persistence
338
339 Legacy persistence for shapes and OCAF data based on *Storage_Schema* (toolkits *TKPShape*, *TKPLCAF*, *TKPCAF*, *TKShapeShcema, TLStdLSchema, TKStdSchema*, and *TKXCAFSchema*) has been removed in OCCT 7.0.0.
340 The applications that used these data persistence tools need to be updated to use other persistence mechanisms.
341
342 @note For compatibility with previous versions, the possibility to read standard OCAF data (*TKLCAF* and *TKCAF*) from  files stored in the old format is preserved (toolkits *TKStdL* and *TKStd*).
343
344 The existing data files in standard formats can be converted using OCCT 6.9.1 or a previous version, as follows.
345
346 @note Reading / writing custom files capability from OCCT 6.9.1 is restored in OCCT 7.2.0. See details in @ref upgrade_720_persistence section.
347
348 #### CSFDB files
349
350 Files in *CSFDB* format (usually with extension .csfdb) contain OCCT shape data that can be converted to BRep format. 
351 The easiest way to do that is to use ImportExport sample provided with OCCT 6.9.0 (or earlier):
352
353 - Start ImportExport sample;
354 - Select File / New;
355 - Select File / Import / CSFDB... and specify the file to be converted;
356 - Drag the mouse with the right button pressed across the view to select all shapes by the rectangle;
357 - Select File / Export / BREP... and specify the location and name for the resulting file
358
359 #### OCAF and XCAF documents
360
361 Files containing OCAF data saved in the old format usually have extensions <i>.std, .sgd</i> or <i>.dxc</i> (XDE documents).
362 These files can be converted to XML or binary OCAF formats using DRAW Test Harness commands.
363 Note that if the file contains only attributes defined in *TKLCAF* and *TKCAF*, this action can be performed in OCCT 7.0; otherwise OCCT 6.9.1 or earlier should be used.
364
365 For that, start *DRAWEXE* and perform the following commands: 
366
367   * To convert <i>*.std</i> and <i>*.sgd</i> file formats to binary format <i>*.cbf</i> (The created document should be in *BinOcaf* format instead of *MDTV-Standard*):
368
369   @code
370   Draw[]> pload ALL
371   Draw[]> Open [path to *.std or *.sgd file] Doc
372   Draw[]> Format Doc BinOcaf
373   Draw[]> SaveAs Doc [path to the new file]
374   @endcode
375
376   * To convert <i>*.dxc</i> file format to binary format <i>*.xbf</i> (The created document should be in *BinXCAF* format instead of *MDTV-XCAF*):
377
378   @code
379   Draw[]> pload ALL
380   Draw[]> XOpen [path to *.dxc file] Doc
381   Draw[]> Format Doc BinXCAF
382   Draw[]> XSave Doc [path to the new file]
383   @endcode
384
385 On Windows, it is necessary to replace back slashes in the file path by  direct slashes or pairs of back slashes.
386
387 Use *XmlOcaf* or *XmlXCAF* instead of *BinOcaf* and *BinXCAF*, respectively, to save in XML format instead of binary one.
388
389 @subsection upgrade_occt700_cdl Removal of CDL and WOK
390
391 OCCT code has been completely refactored in version 7.0 to get rid of obsolete technologies used since its inception: CDL (Cas.Cade Definition Language) and WOK (Workshop Organization Kit).
392
393 C++ code previously generated by WOK from CDL declarations is now included directly in OCCT sources.
394
395 This modification did not change names, API, and behavior of existing OCCT classes, thus in general the code based on OCCT 6.x should compile and work fine with OCCT 7.0.
396 However, due to redesign of basic mechanisms (CDL generic classes, Handles and RTTI) using C++ templates, some changes may be necessary in the code when porting to OCCT 7.0, as described below.
397
398 WOK is not necessary anymore for building OCCT from sources, though it still can be used in a traditional way -- auxiliary files required for that are preserved.
399 The recommended method for building OCCT 7.x is CMake, see @ref build_occt_win_cmake.
400 The alternative solution is to use project files generated by OCCT legacy tool **genproj**, see @ref build_occt_genproj.
401
402 @subsubsection upgrade_occt700_cdl_auto Automatic upgrade
403
404 Most of typical changes required for upgrading code for OCCT 7.0 can be done automatically using the *upgrade* tool included in OCCT 7.0.
405 This tool is a Tcl script, thus Tcl should be available on your workstation to run it.
406
407 Example:
408 ~~~~{.php}
409  $ tclsh
410  % source <path_to_occt>/adm/upgrade.tcl
411  % upgrade -recurse -all -src=<path_to_your_sources>
412 ~~~~
413
414 On Windows, the helper batch script *upgrade.bat* can be used, provided that Tcl is either available in *PATH*, or configured via *custom.bat* script (for instance, if you use OCCT installed from Windows installer package). Start it from the command prompt:
415
416 ~~~~
417 cmd> <path_to_occt>\upgrade.bat -recurse -all -inc=<path_to_occt>\inc -src=<path_to_your_sources> [options]
418 ~~~~
419
420 Run the upgrade tool without arguments to see the list of available options.
421
422 The upgrade tool performs the following changes in the code.
423
424 1. Replaces macro *DEFINE_STANDARD_RTTI* by *DEFINE_STANDARD_RTTIEXT*, with second argument indicating base class for the main argument class (if inheritance is recognized by the script):
425 ~~~~{.cpp}
426 DEFINE_STANDARD_RTTI(Class) -> DEFINE_STANDARD_RTTIEXT(Class, Base)
427 ~~~~
428
429    @note If macro *DEFINE_STANDARD_RTTI* with two arguments (used in intermediate development versions of OCCT 7.0) is found, the script will convert it to either *DEFINE_STANDARD_RTTIEXT* or *DEFINE_STANDARD_RTTI_INLINE*. 
430    The former case is used if current file is header and source file with the same name is found in the same folder. 
431    In this case, macro *IMPLEMENT_STANDARD_RTTI* is injected in the corresponding source file.
432    The latter variant defines all methods for RTTI as inline, and does not require *IMPLEMENT_STANDARD_RTTIEXT* macro. 
433
434 2. Replaces forward declarations of collection classes previously generated from CDL generics (defined in *TCollection* package) by inclusion of the corresponding header:
435 ~~~~{.cpp}
436 class TColStd_Array1OfReal; -> #include <TColStd_Array1OfReal.hxx>
437 ~~~~
438
439 3. Replaces underscored names of *Handle* classes by usage of a macro:
440 ~~~~{.cpp}
441 Handle_Class -> Handle(Class)
442 ~~~~
443   This change is not applied if the source or header file is recognized as containing the definition of Qt class with signals or slots, to avoid possible compilation errors of MOC files caused by inability of MOC to recognize macros (see https://doc.qt.io/qt-4.8/signalsandslots.html).
444   The file is considered as defining a Qt object if it contains strings *Q_OBJECT* and either *slots:* or *signals:*. 
445
446 4. Removes forward declarations of classes with names <i>Handle(C)</i> or *Handle_C*, replacing them either by forward declaration of its argument class, or (for files defining Qt objects) <i>\#include</i> statement for a header with the name of the argument class and extension .hxx:
447 ~~~~{.cpp}
448 class Handle(TColStd_HArray1OfReal); -> #include <TColStd_HArray1OfReal.hxx>
449 ~~~~
450
451 5. Removes <i> \#includes </i> of files <i>Handle_...hxx</i> that have disappeared in OCCT 7.0:
452 ~~~~{.cpp}
453 #include <Handle_Geom_Curve.hxx> ->
454 ~~~~
455
456 6. Removes *typedef* statements that use *Handle* macro to generate the name:
457 ~~~~{.cpp}
458 typedef NCollection_Handle<Message_Msg> Handle(Message_Msg); ->
459 ~~~~
460
461 7. Converts C-style casts applied to Handles into calls to <i>DownCast()</i> method:
462 ~~~~{.cpp}
463     ((Handle(A)&)b)     -> Handle(A)::DownCast(b)
464     (Handle(A)&)b       -> Handle(A)::DownCast(b)
465     (*((Handle(A)*)&b)) -> Handle(A)::DownCast(b)
466     *((Handle(A)*)&b)   -> Handle(A)::DownCast(b)
467     (*(Handle(A)*)&b)   -> Handle(A)::DownCast(b)
468 ~~~~
469
470 8. Moves <i>Handle()</i> macro out of namespace scope:
471 ~~~~{.cpp}
472 Namespace::Handle(Class) -> Handle(Namespace::Class)
473 ~~~~
474
475 9. Converts local variables of reference type, which are initialized by a temporary object returned by call to <i>DownCast()</i>, to the variables of non-reference type (to avoid using references to destroyed memory):
476 ~~~~{.cpp}
477     const Handle(A)& a = Handle(B)::DownCast (b); -> Handle(A) a (Handle(B)::DownCast (b));
478 ~~~~
479
480 10. Adds  <i>\#include</i> for all classes used as argument to macro <i>STANDARD_TYPE()</i>, except for already included ones;
481
482 11. Removes uses of obsolete macros *IMPLEMENT_DOWNCAST* and *IMPLEMENT_STANDARD_*..., except *IMPLEMENT_STANDARD_RTTIEXT*.
483
484     @note If you plan to keep compatibility of your code with older versions of OCCT, add option <i>-compat</i> to avoid this change. See also @ref upgrade_occt700_cdl_compat.
485
486 .
487
488 As long as the upgrade routine runs, some information messages are sent to the standard output. 
489 In some cases the warnings or errors like the following may appear:
490
491 ~~~~
492   Error in {HEADER_FILE}: Macro DEFINE_STANDARD_RTTI used for class {CLASS_NAME} whose declaration is not found in this file, cannot fix
493 ~~~~
494
495 Be sure to check carefully all reported errors and warnings, as the corresponding code will likely require manual corrections.
496 In some cases these messages may help you to detect errors in your code, for instance, cases where *DEFINE_STANDARD_RTTI* macro is used with incorrect class name as an argument.
497
498 @subsubsection upgrade_occt700_cdl_compiler Possible compiler errors
499
500 Some situations requiring upgrade cannot be detected and / or handled by the automatic procedure.
501 If you get compiler errors or warnings when trying to build the upgraded code, you will need to fix them manually. 
502 The following paragraphs list known situations of this kind.
503
504 #### Missing header files
505
506 The use of handle objects (construction, comparison using operators == or !=, use of function <i>STANDRAD_TYPE()</i> and method <i>DownCast()</i>) now requires the type of the object pointed by Handle to be completely known at compile time. Thus it may be necessary to include header of the corresponding class to make the code compilable.
507
508 For example, the following lines will fail to compile if *Geom_Line.hxx* is not included:
509
510 ~~~~{.cpp}
511 Handle(Geom_Line) aLine = 0;
512 if (aLine != aCurve) {...} 
513 if (aCurve->IsKind(STANDARD_TYPE(Geom_Line)) {...}
514 aLine = Handle(Geom_Line)::DownCast (aCurve);
515 ~~~~
516
517 Note that it is not necessary to include header of the class to declare Handle to it.
518 However, if you define a class *B* that uses Handle(*A*) in its fields, or contains a method returning Handle(*A*), it is advisable to have header defining *A* included in the header of *B*.
519 This will eliminate the need to include the header *A* in each source file where class *B* is used.
520
521 #### Ambiguity of calls to overloaded functions
522
523 This issue appears in the compilers that do not support default arguments in template functions (known cases are Visual C++ 10 and 11): the compiler reports an ambiguity error if a handle is used in the argument of a call to the function that has two or more overloaded versions, receiving handles to different types. 
524 The problem is that operator  <i> const handle<T2>& </i> is defined for any type *T2*, thus the compiler cannot make the right choice.
525
526 Example:
527 ~~~~{.cpp}
528 void func (const Handle(Geom_Curve)&);
529 void func (const Handle(Geom_Surface)&);
530
531 Handle(Geom_TrimmedCurve) aCurve = new Geom_TrimmedCurve (...);
532 func (aCurve); // ambiguity error in VC++ 10
533 ~~~~
534
535 Note that this problem can be avoided in many cases if macro *OCCT_HANDLE_NOCAST* is used, see @ref upgrade_occt700_cdl_nocast "below".
536
537 To resolve this ambiguity, change your code so that argument type should correspond exactly to the function signature. 
538 In some cases this can be done by using the relevant type for the corresponding variable, like in the example above:
539
540 ~~~~{.cpp}
541 Handle(Geom_Curve) aCurve = new Geom_TrimmedCurve (...);  
542 ~~~~
543
544 Other variants consist in assigning the argument to a local variable of the correct type and using the direct cast or constructor:
545
546 ~~~~{.cpp}
547 const Handle(Geom_Curve)& aGCurve (aTrimmedCurve);
548 func (aGCurve); // OK - argument has exact type
549 func (static_cast(aCurve)); // OK - direct cast 
550 func (Handle(Geom_Curve)(aCurve)); // OK - temporary handle is constructed
551 ~~~~
552
553 Another possibility consists in defining additional template variant of the overloaded function causing ambiguity, and using *SFINAE* to resolve the ambiguity.
554 This technique can be illustrated by the definition of the template variant of method <i>IGESData_IGESWriter::Send()</i>.
555
556 #### Lack of implicit cast to base type
557
558 As the cast of a handle to the reference to another handle to the base type has become a user-defined operation, the conversions that require this cast together with another user-defined cast will not be resolved automatically by the compiler.
559
560 For example:
561
562 ~~~~{.cpp}
563 Handle(Geom_Geometry) aC = GC_MakeLine (p, v); // compiler error
564 ~~~~
565
566 The problem is that the class *GC_MakeLine* has a user-defined conversion to <i>const Handle(Geom_TrimmedCurve)&,</i> which is not the same as the type of the local variable *aC*.
567
568 To resolve this, use method <i>Value()</i>:
569
570 ~~~~{.cpp}
571 Handle(Geom_Geometry) aC = GC_MakeLine (p, v).Value(); // ok
572 ~~~~
573
574 or use variable of the appropriate type:
575
576 ~~~~{.cpp}
577 Handle(Geom_TrimmedCurve) aC = GC_MakeLine (p, v); // ok
578 ~~~~
579
580 A similar problem appears with GCC compiler, when *const* handle to derived type is used to construct handle to base type via assignment (and in some cases in return statement), for instance:
581
582 ~~~~{.cpp}
583   const Handle(Geom_Line) aLine;
584   Handle(Geom_Curve) c1 = aLine; // GCC error 
585   Handle(Geom_Curve) c2 (aLine); // ok
586 ~~~~
587
588 This problem is specific to GCC and it does not appear if macro *OCCT_HANDLE_NOCAST* is used, see @ref upgrade_occt700_cdl_nocast "below".
589
590 #### Incorrect use of STANDARD_TYPE and Handle macros
591
592 You might need to clean your code from incorrect use of macros *STANDARD_TYPE*() and *Handle*().
593
594 1. Explicit definitions of static functions with names generated by macro *STANDARD_TYPE()*, which are artifacts of old implementation of RTTI, should be removed.
595    
596    Example:
597 ~~~~{.cpp}
598 const Handle(Standard_Type)& STANDARD_TYPE(math_GlobOptMin)
599 {
600   static Handle(Standard_Type) _atype = new Standard_Type ("math_GlobOptMin", sizeof (math_GlobOptMin));
601   return _atype;
602 }
603 ~~~~
604
605 2. Incorrect location of closing parenthesis of *Handle()* macro that was not detectable in OCCT 6.x will cause a compiler error and must be corrected.
606
607    Example (note misplaced closing parenthesis):
608 ~~~~{.cpp}
609 aBSpline = Handle( Geom2d_BSplineCurve::DownCast(BS->Copy()) );
610 ~~~~
611
612 #### Use of class Standard_AncestorIterator
613
614 Class *Standard_AncestorIterator* has been removed; use method *Parent()* of *Standard_Type* class to parse the inheritance chain.
615
616 #### Absence of cast to Standard_Transient*
617
618 Handles in OCCT 7.0 do not have the operator of conversion to <i>Standard_Transient*,</i> which was present in earlier versions.
619 This is done to prevent possible unintended errors like this:
620
621 ~~~~{.cpp}
622 Handle(Geom_Line) aLine = ...;
623 Handle(Geom_Surface) aSurf = ...;
624 ...
625 if (aLine == aSurf) {...} // will cause a compiler error in OCCT 7.0, but not OCCT 6.x
626 ~~~~
627
628 The places where this implicit cast has been used should be corrected manually.
629 The typical situation is when Handle is passed to stream:
630
631 ~~~~{.cpp}
632 Handle(Geom_Line) aLine = ...;
633 os << aLine; // in OCCT 6.9.0, resolves to operator << (void*) 
634 ~~~~
635
636 Call method <i>get()</i> explicitly to output the address of the Handle.
637
638 #### Method DownCast for non-base types
639
640 Method *DownCast()* in OCCT 7.0 is made templated; if its argument is not a base class, "deprecated" compiler warning is generated.
641 This is done to prevent possible unintended errors like this:
642
643 ~~~~{.cpp}
644 Handle(Geom_Surface) aSurf = ;
645 Handle(Geom_Line) aLine = 
646   Handle(Geom_Line)::DownCast (aSurf); // will cause a compiler warning in OCCT 7.0, but not OCCT 6.x
647 ~~~~
648
649 The places where this cast has been used should be corrected manually.
650
651 If down casting is used in a template context where the argument can have the same or unrelated type so that *DownCast()* may be not available in all cases, use C++ *dynamic_cast<>* instead, e.g.: 
652
653 ~~~~{.cpp}
654 template <class T>
655 bool CheckLine (const Handle(T) theArg)
656 {
657   Handle(Geom_Line) aLine = dynamic_cast<Geom_Line> (theArg.get());
658   ...
659 }
660 ~~~~
661
662 @subsubsection upgrade_occt700_cdl_runtime Possible runtime problems
663
664 Here is the list of known possible problems at run time after the upgrade to OCCT 7.0.
665
666 #### References to temporary objects
667
668 In previous versions, the compiler was able to detect the situation when a local variable of a "reference to a Handle" type is initialized by temporary object, and ensured that lifetime of that object is longer than that of the variable. 
669 In OCCT 7.0 with default options, it will not work if types of the temporary object and variable are different (due to involvement of user-defined type cast), thus such temporary object will be destroyed immediately.
670
671 This problem does not appear if macro *OCCT_HANDLE_NOCAST* is used during compilation, see below.
672
673 Example:
674
675 ~~~~{.cpp}
676 // note that DownCast() returns new temporary object!
677 const Handle(Geom_BoundedCurve)& aBC =
678 Handle(Geom_TrimmedCurve)::DownCast(aCurve);
679 aBC->Transform (T); // access violation in OCCT 7.0
680 ~~~~
681
682 @subsubsection upgrade_occt700_cdl_nocast Option to avoid cast of handle to reference to base type
683
684 In OCCT 6.x and earlier versions the handle classes formed a hierarchy echoing the hierarchy of the corresponding object classes .
685 This automatically enabled the possibility to use the handle to a derived class in all contexts where the handle to a base class was needed, e.g. to pass it in a function by reference without copying:
686
687 ~~~~{.cpp}
688 Standard_Boolean GetCurve (Handle(Geom_Curve)& theCurve);
689 ....
690 Handle(Geom_Line) aLine;
691 if (GetCurve (aLine)) {
692   // use aLine, unsafe
693 }
694 ~~~~
695
696 This feature was used in multiple places in OCCT and dependent projects.
697 However it is potentially unsafe: in the above example no checks are done at compile time or at run time to ensure that the type assigned to the argument handle is compatible with the type of the handle passed as argument. 
698 If an object of incompatible type (e.g. Geom_Circle) is assigned to *theCurve*, the behavior will be unpredictable. 
699
700 For compatibility with the existing code, OCCT 7.0 keeps this possibility by default, providing operators of type cast to the handle to a base type. However, this feature is unsafe and in specific situations it may cause compile-time or run-time errors as described above.
701
702 To provide a safer behavior, this feature can be disabled by a compile-time macro *OCCT_HANDLE_NOCAST*.
703 When it is used, constructors and assignment operators are defined (instead of type cast operators) to convert handles to a derived type into handles to a base type.
704 This implies creation of temporary objects and hence may be more expensive at run time in some circumstances, however this way is more standard, safer, and in general recommended.
705
706 The code that relies on the possibility of casting to base should be amended to always use the handle of argument type in function call and to use *DownCast()* to safely convert the result to the desired type.
707 For instance, the code from the example below can be changed as follows:
708
709 ~~~~{.cpp}
710 Handle(Geom_Line) aLine;
711 Handle(Geom_Curve) aCurve;
712 if (GetCurve (aCure) && !(aLine = Handle(Geom_Line)::DownCast (aCurve)).IsNull()) {
713   // use aLine safely
714 }
715 ~~~~
716
717 @subsubsection upgrade_occt700_cdl_compat Preserving compatibility with OCCT 6.x
718
719 If you like to preserve the compatibility of your application code with OCCT versions 6.x even after the upgrade to 7.0, consider the following suggestions:
720
721 1. If your code used sequences of macros *IMPLEMENT_STANDARD_*... generated by WOK, replace them by single macro *IMPLEMENT_STANDARD_RTTIEXT*
722
723 2. When running automatic upgrade tool, add option <i>-compat</i>.
724
725 3. Define macros *DEFINE_STANDARD_RTTIEXT* and *DEFINE_STANDARD_RTTI_INLINE* when building with previous versions of OCCT, resolving to *DEFINE_STANDARD_RTTI* with single argument 
726
727    Example:
728 ~~~~{.cpp}
729 #if OCC_VERSION_HEX < 0x070000
730   #define DEFINE_STANDARD_RTTIEXT(C1,C2) DEFINE_STANDARD_RTTI(C1)
731   #define DEFINE_STANDARD_RTTI_INLINE(C1,C2) DEFINE_STANDARD_RTTI(C1)
732 #endif
733 ~~~~
734
735 @subsubsection upgrade_occt700_cdl_wok Applications based on CDL and WOK
736
737 If your application is essentially based on CDL, and you need to upgrade it to OCCT 7.0, you will very likely need to convert your application code to non-CDL form.
738 This is a non-trivial effort; the required actions would depend strongly on the structure of the code and used CDL features.
739
740 The upgrade script and sources of a specialized WOK version used for OCCT code upgrade can be found in WOK Git repository in branch [CR0_700_2](https://git.dev.opencascade.org/gitweb/?p=occt-wok.git;a=log;h=refs/heads/CR0_700_2).
741
742 [Contact us](https://www.opencascade.com/contact/) if you need more help.
743
744 @subsection upgrade_occt700_bspline Separation of BSpline cache
745
746 Implementation of NURBS curves and surfaces has been revised: the cache of polynomial coefficients, which is used to accelerate the calculation of values of a B-spline, has been separated from data objects *Geom2d_BSplineCurve, Geom_BSplineCurve* and *Geom_BSplineSurface* into the dedicated classes *BSplCLib_Cache* and *BSplSLib_Cache*. 
747
748 The benefits of this change are:
749 * Reduced memory footprint of OCCT shapes (up to 20% on some cases)
750 * Possibility to evaluate the same B-Spline concurrently in parallel threads without data races and mutex locks 
751
752 The drawback is that direct evaluation of B-Splines using methods of curves and surfaces becomes slower due to the absence of cache. The slow-down can be avoided by using adaptor classes *Geom2dAdaptor_Curve, GeomAdaptor_Curve* and *GeomAdaptor_Surface*, which now use cache when the curve or surface is a B-spline.
753
754 OCCT algorithms have been changed to use adaptors for B-spline calculations instead of direct methods for  curves and surfaces.
755 The same changes (use of adaptors instead of direct call to curve and surface methods) should be implemented in relevant places in the applications based on OCCT to get the maximum performance.
756
757 @subsection upgrade_occt700_booleanresult Structural result of Boolean operations
758
759 The result of Boolean operations became structured according to the structure of the input shapes. Therefore it may impact old applications that always iterate on direct children of the result compound assuming to obtain solids as iteration items, regardless of the structure of the input shapes. In order to get always solids as iteration items it is recommended to use TopExp_Explorer instead of TopoDS_Iterator.
760
761 @subsection upgrade_occt700_brepextrema BRepExtrema_ExtCC finds one solution only
762
763 Extrema computation between non-analytical curves in shape-shape distance calculation algorithm has been changed in order to return only one solution. So, if e.g. two edges are created on parallel b-spline curves the algorithm BRepExtrema_DistShapeShape will return only one solution instead of enormous number of solutions. There is no way to get algorithm working in old manner.
764
765 @subsection upgrade_occt700_sorttools Removal of SortTools package
766
767 Package *SortTools* has been removed. 
768 The code that used the tools provided by that package should be corrected manually.
769 The recommended approach is to use sorting algorithms provided by STL.
770
771 For instance:
772 ~~~~{.cpp}
773 #include <SortTools_StraightInsertionSortOfReal.hxx>
774 #include <SortTools_ShellSortOfReal.hxx>
775 #include <TCollection_CompareOfReal.hxx>
776 ...
777 TCollection_Array1OfReal aValues = ...;
778 ...
779 TCollection_CompareOfReal aCompReal;
780 SortTools_StraightInsertionSortOfReal::Sort(aValues, aCompReal);
781 ~~~~
782 can be replaced by:
783 ~~~~{.cpp}
784 #include <algorithm>
785 ...
786 TCollection_Array1OfReal aValues = ...;
787 ...
788 std::stable_sort (aValues.begin(), aValues.end());
789 ~~~~
790
791 @subsection upgrade_occt700_2dlayers On-screen objects and ColorScale
792
793 The old mechanism for rendering Underlay and Overlay on-screen 2D objects based on *Visual3d_Layer* and immediate drawing model (uncached and thus slow) has been removed.
794 Classes *Aspect_Clayer2d, OpenGl_GraphicDriver_Layer, Visual3d_Layer, Visual3d_LayerItem, V3d_LayerMgr* and *V3d_LayerMgrPointer* have been deleted.
795 The following auxiliary definition have been removed as well: Aspect_TypeOfPrimitive, Aspect_TypeOfLayer, Aspect_TypeOfEdge, Aspect_TypeOfDrawMode, Aspect_TypeOfConstraint, Aspect_DriverDefinitionError, Aspect_BadAccess.
796
797 General AIS interactive objects with transformation persistence flag *Graphic3d_TMF_2d* can be used as a replacement of *Visual3d_LayerItem*.
798 The anchor point specified for transformation persistence defines the window corner of  (or center in case of (0, 0) point).
799 To keep on-screen 2D objects on top of the main screen, they can be assigned to the appropriate Z-layer.
800 Predefined Z-layers *Graphic3d_ZLayerId_TopOSD* and *Graphic3d_ZLayerId_BotOSD* are intended to replace Underlay and Overlay layers within the old API.
801
802 *ColorScale* object previously implemented using *Visual3d_LayerItem* has been moved to a new class *AIS_ColorScale*, with width and height specified explicitly.
803 The property of *V3d_View* storing the global *ColorScale* object has been removed with associated methods *V3d_View::ColorScaleDisplay(), V3d_View::ColorScaleErase(), V3d_View::ColorScaleIsDisplayed()* and *V3d_View::ColorScale()* as well as the classes *V3d_ColorScale, V3d_ColorScaleLayerItem* and *Aspect_ColorScale*.
804 Here is an example of creating *ColorScale* using the updated API:
805
806 ~~~~{.cpp}
807 Handle(AIS_ColorScale) aCS = new AIS_ColorScale();
808 // configuring
809 Standard_Integer aWidth, aHeight;
810 aView->Window()->Size (aWidth, aHeight);
811 aCS->SetSize              (aWidth, aHeight);
812 aCS->SetRange             (0.0, 10.0);
813 aCS->SetNumberOfIntervals (10);
814 // displaying
815 aCS->SetZLayer (Graphic3d_ZLayerId_TopOSD);
816 aCS->SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt (-1,-1,0));
817 aCS->SetToUpdate();
818 theContextAIS->Display (aCS);
819 ~~~~
820
821 To see how 2d objects are implemented in OCCT you can call Draw commands *vcolorscale, vlayerline* or *vdrawtext* (with <i>-2d</i> option).
822 Draw command *vcolorscale* now requires the name of *ColorScale* object as argument.
823 To display this object use command *vdisplay*. For example:
824
825 ~~~~{.php}
826 pload VISUALIZATION
827 vinit
828 vcolorscale cs -demo
829 pload MODELING
830 box b 100 100 100
831 vdisplay b
832 vsetdispmode 1
833 vfit
834 vlayerline 0 300 300 300 10
835 vdrawtext t "2D-TEXT" -2d -pos 0 150 0 -color red
836 ~~~~
837
838 Here is a small example in C++ illustrating how to display a custom AIS object in 2d:
839 ~~~~{.cpp}
840 Handle(AIS_InteractiveContext) aContext = ...;
841 Handle(AIS_InteractiveObject) anObj =...; // create an AIS object
842 anObj->SetZLayer(Graphic3d_ZLayerId_TopOSD); // display object in overlay
843 anObj->SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt (-1,-1,0)); // set 2d flag, coordinate origin is set to down-left corner
844 aContext->Display (anObj); // display the object
845 ~~~~
846
847 @subsection upgrade_occt700_userdraw UserDraw and Visual3d
848
849 #### Visual3d package
850
851 Package *Visual3d* implementing the intermediate layer between high-level *V3d* classes
852 and low-level OpenGl classes for views and graphic structures management has been dropped.
853
854 The *OpenGl_View* inherits from the new class *Graphic3d_CView*.
855 *Graphic3d_CView* is an interface class that declares abstract methods for managing displayed structures,
856 display properties and a base layer code that implements computation
857 and management of HLR (or more broadly speaking view-depended) structures.
858
859 In the new implementation it takes place of the eliminated *Visual3d_View*.
860 As before the instance of *Graphic3d_CView* is still completely managed by *V3d_View* classes.
861 It can be accessed through *V3d_View* interface but normally it should not be required as all its methods are completely wrapped.
862
863 In more details, a concrete specialization of *Graphic3d_CView* is created and returned by the graphical driver on request.
864 Right after the creation the views are directly used for setting rendering properties and adding graphical structures to be displayed.
865
866 The rendering of graphics is possible after mapping a window and activating the view.
867 The direct setting of properties obsoletes the use of intermediate structures with display parameter
868 like *Visual3d_ContextView*, etc. This means that the whole package *Visual3d* becomes redundant.
869
870 The functionality previously provided by *Visual3d* package has been redesigned in the following way :
871 - The management of display of structures has been moved from *Visual3d_ViewManager* into *Graphic3d_StructureManager*.
872 - The class *Visual3d_View* has been removed. The management of computed structures has been moved into the base layer of *Graphi3d_CView*.
873 - All intermediate structures for storing view parameters, e.g. *Visual3d_ContextView*, have been removed.
874   The settings are now kept by instances of *Graphic3d_CView*.
875 - The intermediate class *Visual3d_Light* has been removed. All light properties are stored in *Graphic3d_CLight* structure, which is directly accessed by instances of *V3d_Light* classes.
876 - All necessary enumerations have been moved into *Graphic3d* package.
877
878 #### Custom OpenGL rendering and UserDraw
879
880 Old APIs based on global callback functions for creating *UserDraw* objects and for performing custom OpenGL rendering within the view have been dropped.
881 *UserDraw* callbacks are no more required since *OpenGl_Group* now inherits *Graphic3d_Group* and thus can be accessed directly from *AIS_InteractiveObject*:
882
883 ~~~~{.cpp}
884 //! Class implementing custom OpenGL element.
885 class UserDrawElement : public OpenGl_Element {};
886
887 //! Implementation of virtual method AIS_InteractiveObject::Compute().
888 void UserDrawObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
889                               const Handle(Prs3d_Presentation)& thePrs,
890                               const Standard_Integer theMode)
891 {
892   Graphic3d_Vec4 aBndMin (myCoords[0], myCoords[1], myCoords[2], 1.0f);
893   Graphic3d_Vec4 aBndMax (myCoords[3], myCoords[4], myCoords[5], 1.0f);
894
895   // casting to OpenGl_Group should be always true as far as application uses OpenGl_GraphicDriver for rendering
896   Handle(OpenGl_Group) aGroup = Handle(OpenGl_Group)::DownCast (thePrs->NewGroup());
897   aGroup->SetMinMaxValues (aBndMin.x(), aBndMin.y(), aBndMin.z(),
898                            aBndMax.x(), aBndMax.y(), aBndMax.z());
899   UserDrawElement* anElem = new UserDrawElement (this);
900   aGroup->AddElement(anElem);
901
902   // invalidate bounding box of the scene
903   thePrsMgr->StructureManager()->Update();
904 }
905 ~~~~
906
907 To perform a custom OpenGL code within the view, it is necessary to inherit from class *OpenGl_View*.
908 See the following code sample:
909
910 ~~~~{.cpp}
911 //! Custom view.
912 class UserView : public OpenGl_View
913 {
914 public:
915   //! Override rendering into the view.
916   virtual void render (Graphic3d_Camera::Projection theProjection,
917                        OpenGl_FrameBuffer*          theReadDrawFbo,
918                        const Standard_Boolean       theToDrawImmediate)
919   {
920     OpenGl_View::render (theProjection, theReadDrawFbo, theToDrawImmediate);
921     if (theToDrawImmediate)
922     {
923       return;
924     }
925
926     // perform custom drawing
927     const Handle(OpenGl_Context)& aCtx = myWorkspace->GetGlContext();
928     GLfloat aVerts[3] = { 0.0f, 0,0f, 0,0f };
929     aCtx->core20->glEnableClientState(GL_VERTEX_ARRAY);
930     aCtx->core20->glVertexPointer(3, GL_FLOAT, 0, aVerts);
931     aCtx->core20->glDrawArrays(GL_POINTS, 0, 1);
932     aCtx->core20->glDisableClientState(GL_VERTEX_ARRAY);
933   }
934
935 };
936
937 //! Custom driver for creating UserView.
938 class UserDriver : public OpenGl_GraphicDriver
939 {
940 public:
941   //! Create instance of own view.
942   virtual Handle(Graphic3d_CView) CreateView (const Handle(Graphic3d_StructureManager)& theMgr) Standard_OVERRIDE
943   {
944     Handle(UserView) aView = new UserView (theMgr, this, myCaps, myDeviceLostFlag, &myStateCounter);
945     myMapOfView.Add (aView);
946     for (TColStd_SequenceOfInteger::Iterator aLayerIt (myLayerSeq); aLayerIt.More(); aLayerIt.Next())
947     {
948       const Graphic3d_ZLayerId        aLayerID  = aLayerIt.Value();
949       const Graphic3d_ZLayerSettings& aSettings = myMapOfZLayerSettings.Find (aLayerID);
950       aView->AddZLayer         (aLayerID);
951       aView->SetZLayerSettings (aLayerID, aSettings);
952     }
953     return aView;
954   }
955 };
956
957 ~~~~
958
959 @subsection upgrade_occt700_localcontext Deprecation of Local Context
960
961 The conception of Local Context has been deprecated.
962 The related classes, e.g. *AIS_LocalContext*, and methods ( <i>AIS_InteractiveContext::OpenLocalContext()</i> and others) will be removed in a future OCCT release.
963
964 The main functionality provided by Local Context - selection of object subparts - can be now used within Neutral Point without opening any Local Context.
965
966 The property *SelectionMode()* has been removed from the class *AIS_InteractiveObject*.
967 This property contradicts to selection logic, since it is allowed to activate several Selection modes at once.
968 Therefore keeping one selection mode as object field makes no sense.
969 Applications that used this method should implement selection mode caching at application level, if it is necessary for some reason.
970
971 @subsection upgrade_occt700_separate_caf_visualisation Separation of visualization part from TKCAF
972
973 Visualization CAF attributes have been moved into a new toolkit *TKVCAF*. 
974 If your application uses the classes from *TPrsStd* package then add link to *TKVCAF* library.
975
976 Version numbers of *BinOCAF* and *XmlOCAF* formats are incremented; new files cannot be read by earlier versions of OCCT.
977
978 Before loading the OCAF files saved by previous versions and containing *TPrsStd_AISPresentation* attribute it is necessary to define the environment variable *CSF_MIGRATION_TYPES*, pointing to file *src/StdResources/MigrationSheet.txt*.
979 When using documents loaded from a file, make sure to call method *TPrsStd_AISViewer::New()* prior to accessing *TPrsStd_AISPresentation* attributes in this document as that method creates them.
980
981 @subsection upgrade_euler_angles Correction of interpretation of Euler angles in gp_Quaternion
982
983 Conversion of *gp_Quaternion* to and from intrinsic Tait-Bryan angles (including *gp_YawPitchRoll*) is fixed.
984
985 Before that fix the sequence of rotation axes was opposite to the intended; e.g. *gp_YawPitchRoll* (equivalent to *gp_Intrinsic_ZYX*) actually  defined intrinsic rotations around X, then Y, then Z. Now the rotations are made in the correct order.
986
987 The applications that use *gp_Quaternion* to convert Yaw-Pitch-Roll angles (or other intrinsic Tait-Bryan sequences) may need to be updated to take this change into account.
988
989 @subsection upgrade_zoom_persistent_selection Zoom Persistent Selection
990
991 Zoom persistent selection introduces a new structure *Graphic3d_TransformPers* to transform persistence methods and parameters and a new class *Graphic3d_WorldViewProjState* to refer to the camera transformation state. You might need to update your code to deal with the new classes if you were using the related features. Keep in mind the following: 
992 * *Graphic3d_Camera::ModelViewState* has been renamed to *Graphic3d_Camera::WorldViewState*.
993 * Transformation matrix utilities from *OpenGl_Utils* namespace have been moved to *Graphic3d_TransformUtils* and *Graphic3d_TransformUtils.hxx* header respectively.
994 * Matrix stack utilities from *OpenGl_Utils* namespace have been moved to *OpenGl_MatrixStack* class and *OpenGl_MatrixStack.hxx* header respectively.
995 * *OpenGl_View* methods *Begin/EndTransformPersistence* have been removed. Use *Graphic3d_TransformPers::Apply()* instead to apply persistence to perspective and world-view projection matrices.
996
997 @subsection upgrade_occt700_correction_of_texture Texture mapping of objects
998
999 Textured objects now have the priority over the environment mapping.
1000
1001 Redundant enumerations *V3d_TypeOfSurface* and *Graphic3d_TypeOfSurface*, class *OpenGl_SurfaceDetailState*, the corresponding methods from *Graphic3d_CView, OpenGl_ShaderManager, OpenGl_View, V3d_View* and *V3d_Viewer* have been deleted.
1002 Draw command *VSetTextureMode* has been deleted.
1003
1004 @subsection upgrade_occt700_wfshape Shape presentation builders
1005
1006 Presentation tools for building Wireframe presentation have been refactored to eliminate duplicated code and interfaces.
1007 Therefore, the following classes have been modified:
1008 * *StdPrs_WFDeflectionShape* and *Prs3d_WFShape* have been removed. *StdPrs_WFShape* should be used instead.
1009 * *StdPrs_ToolShadedShape* has been renamed to *StdPrs_ToolTriangulatedShape*.
1010
1011 @section upgrade_occt710 Upgrade to OCCT 7.1.0
1012
1013 @subsection upgrade_710_aspects Presentation attributes
1014
1015 This section should be considered if application defines custom presentations, i.e. inherited from *AIS_InteractiveObject*.
1016 The previous versions of OCCT have three levels for defining presentation properties (e.g. colors, materials, etc.):
1017
1018 1. For the entire structure - *Graphic3d_Structure* / *Prs3d_Presentation*.
1019 2. For a specific group of primitives - *Graphic3d_Group::SetGroupPrimitivesAspect()* overriding structure aspects.
1020 3. For a specific primitive array within the graphic group - *Graphic3d_Group::SetPrimitivesAspect()*.
1021
1022 The structure level has de facto not been used for a long time since OCCT presentations always define aspects at the graphic group level (overriding any structure aspects).
1023 Within this OCCT release, structure level of aspects has been completely removed. In most cases the application code should just remove missing methods. In those rare cases, when this functionality was intentionally used, the application should explicitly define aspects to the  appropriate graphic groups.
1024
1025 Note that defining several different aspects within the same graphic group should also be avoided in the application code since it is a deprecated functionality which can be removed in further releases.
1026 *Graphic3d_Group::SetGroupPrimitivesAspect()* should be the main method defining presentation attributes.
1027
1028 The implementation of *Graphic3d_Group::SetGroupPrimitivesAspect()* has been changed from copying aspect values to keeping the passed object.
1029 Although it was not documented, previously it was possible to modify a single aspect instance, like *Graphic3d_AspectFillArea3d* and set it to multiple groups.
1030 Now such code would produce an unexpected result and therefore should be updated to create the dedicated aspect instance.
1031
1032 @subsection upgrade_710_types Typedefs
1033
1034 The following type definitions in OCCT has been modified to use C++11 types:
1035 - *Standard_Boolean* is now *bool* (previously *unsigned int*).
1036 - *Standard_ExtCharacter* is now *char16_t* (previously *short*).
1037 - *Standard_ExtString;* is now *const char16_t* (previously *const short*).
1038 - *Standard_Utf16Char* is now *char16_t* (previously *uint16_t* for compatibility with old compilers).
1039 - *Standard_Utf32Char* is now *char32_t* (previously *uint32_t* for compatibility with old compilers).
1040
1041 For most applications this change should be transparent on the level of source code. Binary compatibility is not maintained, as *bool* has a different size in comparison with *unsigned int*.
1042
1043 @subsection upgrade_710_ffp Programmable Pipeline
1044
1045 Fixed-function pipeline has been already deprecated since OCCT 7.0.0.
1046 Release 7.1.0 disables this functionality by default in favor of Programmable Pipeline (based on GLSL programs).
1047
1048 Method *V3d_View::Export()*, based on *gl2ps* library, requires fixed pipeline and will return error if used with default settings.
1049 Applications should explicitly enable fixed pipeline by setting *OpenGl_Caps::ffpEnable* flag to TRUE within *OpenGl_GraphicDriver::ChangeOptions()* before creating the viewer to use *V3d_View::Export()*.
1050 This method is declared as deprecated and will be removed in one of the next OCCT releases.
1051 The recommended way to generate a vector image of a 3D model or scene is to use an application-level solution independent from OpenGL.
1052
1053 @subsection upgrade_710_trsfpers Transformation persistence
1054
1055 The behavior of transformation persistence flags *Graphic3d_TMF_ZoomPers* and *Graphic3d_TMF_TriedronPers* has been changed for consistency with a textured fixed-size 2D text.
1056 An object with these flags is considered as defined in pixel units, and the presentation is no more scaled depending on the view height.
1057 The applications that need to scale such objects depending on viewport size should update them manually.
1058
1059 Flags *Graphic3d_TMF_PanPers* and *Graphic3d_TMF_FullPers* have been removed.
1060 *Graphic3d_TMF_TriedronPers* or *Graphic3d_TMF_2d* can be used instead depending on the context.
1061
1062 *Graphic3d_TransModeFlags* is not an integer bitmask anymore - enumeration values should be specified instead.
1063 Several transformation persistence methods in *PrsMgr_PresentableObject* have been marked deprecated.
1064 Transformation persistence should be defined using  *Graphic3d_TransformPers* constructor directly and passed by a handle, not value.
1065
1066 @subsection upgrade_710_selprops Dynamic highlight and selection properties
1067
1068 Release 7.1.0 introduces *Graphic3d_HighlightStyle* - an entity that allows flexible customization of highlighting parameters (such as highlighting method, color, and transparency). Therefore, the signatures of the following methods related to highlighting:
1069 - *AIS_InteractiveContext::Hilight()*;
1070 - *AIS_InteractiveContext::HilightWithColor()*;
1071 - *PrsMgr_PresentationManager::Color()*;
1072 - *SelectMgr_EntityOwner::HilightWithColor()*;
1073 have been changed to receive *Graphic3d_HighlightStyle* instead of *Quantity_Color*.
1074
1075 Method *AIS_InteractiveContext::Hilight* is now deprecated and highlights the interactive object with selection style.
1076
1077 A group of methods *AIS_InteractiveContext::IsHilighted* has changed its behavior - now they only check highlight flags of the object or the owner in the global status. If the highlight color is required on the application level, it is necessary to use overloaded methods *AIS_InteractiveContext::HighlightStyle* for the owner and the object.
1078
1079 The following methods have been replaced in *AIS_InteractiveContext* class:
1080 - *HilightColor* and *SetHilightColor* by *HighlightStyle* and *SetHighlightStyle*;
1081 - *SelectionColor* setter and getter by *SelectionStyle* and *SetSelectionStyle*.
1082
1083 The API of *Prs3d_Drawer* has been extended to allow setting up styles for both dynamic selection and highlighting. Therefore, it is possible to change the highlight style of a particular object on the application level via *SelectMgr_SelectableObject::HilightAttributes()* and process it in the entity owner.
1084
1085 @subsection upgrade_occt710_correction_of_TObj_Model Correction in TObj_Model class
1086
1087 Methods *TObj_Model::SaveAs* and *TObj_Model::Load* now receive *TCollection_ExtendedString* filename arguments instead of char*. UTF-16 encoding can be used to pass file names containing Unicode symbols.
1088
1089 @subsection upgrade_710_env Redundant environment variables
1090
1091 The following environment variables have become redundant:
1092
1093 * *CSF_UnitsLexicon* and *CSF_UnitsDefinition* are no more used.  Units definition (*UnitsAPI/Lexi_Expr.dat* and *UnitsAPI/Units.dat*) is now embedded into source code.
1094 * *CSF_XSMessage* and *CSF_XHMessage* are now optional.
1095   English messages (XSMessage/\*XSTEP.us* and SHMessage/\*SHAPE.us*) are now embedded into source code
1096   and automatically loaded when environment variables are not set.
1097 * *CSF_ShadersDirectory* is not required any more, though it still can be used to load custom shaders.
1098   Mandatory GLSL resources are now embedded into source code.
1099 * *CSF_PluginDefaults* and other variables pointing to OCAF plugin resources (*CSF_StandardDefaults*, *CSF_XCAFDefaults*, *CSF_StandardLiteDefaults* and *CSF_XmlOcafResource*) are not necessary if method *TDocStd_Application::DefineFormat()* is used to enable persistence of OCAF documents.
1100
1101 Other environment variables still can be used to customize behavior of relevant algorithms but are not necessary any more (all required resources are embedded).
1102
1103 @subsection upgrade_710_removed Removed features
1104
1105 The following obsolete features have been removed:
1106 * Anti-aliasing API *V3d_View::SetAntialiasingOn()*. This method was intended to activate deprecated OpenGL functionality *GL_POLYGON_SMOOTH, GL_LINE_SMOOTH* and *GL_POINT_SMOOTH*.
1107   Instead of the old API, the application should request MSAA buffers for anti-aliasing by assigning *Graphic3d_RenderingParams::NbMsaaSamples* property of the structure returned by *V3d_View::ChangeRenderingParams()*.
1108 * *Prs3d_Drawer::ShadingAspectGlobal()* flag has been removed as not used. The corresponding calls can be removed safely from the application code.
1109 * The methods managing ZClipping planes and ZCueing: *V3d_View::SetZClippingType()*, *V3d_View::SetZCueingOn()*, etc. have been removed.  ZClipping planes can be replaced by general-purpose clipping planes (the application should update plane definition manually).
1110 * The 3D viewer printing API *V3d_View::Print()* has been removed. This functionality was available on Windows platforms only. The applications should use the general image dump API *V3d_View::ToPixMap()* and manage printing using a platform-specific API at the application level.
1111   Text resolution can be managed by rendering parameter *Graphic3d_RenderingParams::Resolution*, returned by *V3d_View::ChangeRenderingParams()*.
1112 * Methods *PrsMgr_PresentationManager::BoundBox*, *PrsMgr_PresentationManager::Hilight* and *SelectMgr_EntityOwner::Hilight* have been removed as not used. The corresponding method in custom implementations of *SelectMgr_EntityOwner* can be removed safely. *PrsMgr_PresentationManager::Color* with the corresponding style must be used instead.
1113 * Class *NCollection_QuickSort* has been removed. The code that used the tools provided by that class should be corrected manually. The recommended approach is to use sorting algorithms provided by STL (std::sort). See also @ref upgrade_occt700_sorttools above.
1114
1115 * Package *Dico*. The code that used the tools provided by that package should be corrected manually.  The recommended approach is to use *NCollection_DataMap* and *NCollection_IndexedDataMap* classes.
1116
1117 @subsection upgrade_710_changed_methods Other changes
1118
1119 The following classes have been changed:
1120
1121 * *BVH_Sorter* class has become abstract. The list of arguments of both  *Perform* methods has been changed and the methods became pure virtual.
1122 * *Extrema_FuncExtPS* has been renamed to *Extrema_FuncPSNorm*.
1123 * The default constructor and the constructor taking a point and a surface have been removed from class *Extrema_GenLocateExtPS*. Now the only constructor takes the surface and optional tolerances in U and V directions. The new method *Perform* takes the point with the start solution and processes it. The class has become not assignable and not copy-constructable.
1124 * Constructors with arguments *(const gp_Ax22d& D, const gp_Pnt2d& F)* have been removed from *GCE2d_MakeParabola*, *gce_MakeParab2d* and *gp_Parab2d*.  The objects created with some constructors of class *gp_Parab2d*  may differ from the previous version (see the comments in *gp_Parab2d.hxx*). The result returned by *gp_Parab2d::Directrix()* method has an opposite direction in comparison with the previous OCCT versions.
1125 * *BRepTools_Modifier* class now has two modes of work. They are defined by the boolean parameter *MutableInput*, which is turned off by default. This means that the algorithm always makes a copy of a sub-shape (e.g. vertex) if its tolerance is to be increased in the output shape. The old mode corresponds to *MutableInput* turned on. This change may impact an application if it implements a class derived from *BRepTools_Modifier*.
1126 * The second parameter *theIsOuterWire* of method *ShapeAnalysis_Wire::CheckSmallArea* has been removed.
1127 * In class *GeomPlate_CurveConstraint*, two constructors taking boundary curves of different types have been replaced with one constructor taking the curve of an abstract type.
1128 * The last optional argument *RemoveInvalidFaces* has been removed from the constructor of class  *BRepOffset_MakeOffset* and method *Initialize*.
1129 * The public method *BOPDS_DS::VerticesOnIn* has been renamed into *SubShapesOnIn* and the new output parameter *theCommonPB* has been added.
1130
1131 @section upgrade_occt720 Upgrade to OCCT 7.2.0
1132
1133 @subsection upgrade_720_removed Removed features
1134
1135 The following obsolete features have been removed:
1136 * *AIS_InteractiveContext::PreSelectionColor()*, *DefaultColor()*, *WasCurrentTouched()*, *ZDetection()*.
1137   These properties were unused, and therefore application should remove occurrences of these methods.
1138 * *AIS_InteractiveObject::SelectionPriority()*.
1139   These property was not implemented.
1140 * The class *LocOpe_HBuilder* has been removed as obsolete.
1141 * The package *TestTopOpe* has been removed;
1142 * The package *TestTopOpeDraw* has been removed;
1143 * The package *TestTopOpeTools* has been removed.
1144 * The packages *QANewModTopOpe*, *QANewBRepNaming* and *QANewDBRepNaming* have been removed as containing obsolete features.
1145 * The following methods of the *IntPolyh_Triangle* class have been removed as unused:
1146   - *CheckCommonEdge*
1147   - *SetEdgeandOrientation*
1148   - *MultipleMiddleRefinement2*.
1149 * The method *IntPolyh_Triangle::TriangleDeflection* has been renamed to *IntPolyh_Triangle::ComputeDeflection*.
1150 * The following methods of the *IntPolyh_MaillageAffinage* class have been removed as unused:
1151   - *LinkEdges2Triangles*;
1152   - *TriangleEdgeContact2*;
1153   - *StartingPointsResearch2*;
1154   - *NextStartingPointsResearch2*;
1155   - *TriangleComparePSP*;
1156   - *StartPointsCalcul*.
1157 * The method PerformAdvanced of the *ShapeConstruct_ProjectCurveOnSurface* class has been removed as unused.
1158 * The method Perform of the *ShapeConstruct_ProjectCurveOnSurface* class is modified:
1159   - input arguments *continuity*, *maxdeg*, *nbinterval* have been removed as unused;
1160   - input arguments *TolFirst*, *TolLast* have been added at the end of arguments' list.
1161 * Typedefs Quantity_Factor, Quantity_Parameter, Quantity_Ratio, Quantity_Coefficient, Quantity_PlaneAngle, Quantity_Length, V3d_Parameter and V3d_Coordinate have been removed; Standard_Real should be used instead.
1162
1163 @subsection upgrade_occt720_reshape_oriented_removed Corrections in BRepOffset API
1164
1165 In classes *BRepTools_ReShape* and *ShapeBuild_ReShape*, the possibility to process shapes different only by orientation in different ways has been removed.
1166 Thus methods *Remove()* and *Replace()* do not have any more the last argument 'oriented'; they work always as if *Standard_False* was passed before (default behavior).
1167 Methods *ModeConsiderLo()* and *Apply()* with three arguments have been removed.
1168
1169 @subsection upgrade_occt720_correction_of_Offset_API Corrections in BRepOffset API
1170
1171 Class *BRepOffsetAPI_MakeOffsetShape*:
1172 * *BRepOffsetAPI_MakeOffsetShape::BRepOffsetAPI_MakeOffsetShape()* - constructor with parameters has been deleted.
1173 * *BRepOffsetAPI_MakeOffsetShape::PerformByJoin()* - method has been added. This method is old algorithm behaviour. 
1174
1175 The code below shows new calling procedure:
1176 ~~~~{.cpp}
1177     BRepOffsetAPI_MakeOffsetShape OffsetMaker;
1178     OffsetMaker.PerformByJoin(Shape, OffsetValue, Tolerance);
1179     NewShape = OffsetMaker.Shape();
1180 ~~~~
1181
1182 Class *BRepOffsetAPI_MakeThickSolid*:
1183 * *BRepOffsetAPI_MakeThickSolid::BRepOffsetAPI_MakeThickSolid()* - constructor with parameters has been deleted.
1184 * *BRepOffsetAPI_MakeThickSolid::MakeThickSolidByJoin()* - method has been added. This method is old algorithm behaviour. 
1185
1186 The code below shows new calling procedure:
1187 ~~~~{.cpp}
1188     BRepOffsetAPI_MakeThickSolid BodyMaker;
1189     BodyMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3);
1190     myBody = BodyMaker.Shape();
1191 ~~~~
1192
1193 @subsection upgrade_720_highlight Highlight style
1194
1195 Management of highlight attributes has been revised and might require modifications from application side:
1196 * New class *Graphic3d_PresentationAttributes* defining basic presentation attributes has been introduced.
1197   It's definition includes properties previously defined by class Graphic3d_HighlightStyle (*Color*, *Transparency*),
1198   and new properties (*Display mode*, *ZLayer*, optional *FillArea aspect*).
1199 * Class *Prs3d_Drawer* now inherits class *Graphic3d_PresentationAttributes*.
1200   So that overall presentation attributes are now split into two parts - Basic attributes and Detailed attributes.
1201 * Class *Graphic3d_HighlightStyle* has been dropped.
1202   It is now defined as a typedef to *Prs3d_Drawer*.
1203   Therefore, highlight style now also includes not only Basic presentation attributes, but also Detailed attributes
1204   which can be used by custom presentation builders.
1205 * Highlighting style defined by class *Graphic3d_PresentationAttributes* now provides more options:
1206   - *Graphic3d_PresentationAttributes::BasicFillAreaAspect()* property providing complete Material definition.
1207     This option, when defined, can be used instead of the pair Object Material + Highlight Color.
1208   - *Graphic3d_PresentationAttributes::ZLayer()* property specifying the Layer where highlighted presentation should be shown.
1209     This property can be set to Graphic3d_ZLayerId_UNKNOWN, which means that ZLayer of main presentation should be used instead.
1210   - *Graphic3d_PresentationAttributes::DisplayMode()* property specifying Display Mode for highlight presentation.
1211 * Since Highlight and Selection styles within *AIS_InteractiveContext* are now defined by *Prs3d_Drawer* inheriting from *Graphic3d_PresentationAttributes*,
1212   it is now possible to customize default highlight attributes like *Display Mode* and *ZLayer*, which previously could be defined only on Object level.
1213 * Properties *Prs3d_Drawer::HighlightStyle()* and *Prs3d_Drawer::SelectionStyle()* have been removed.
1214   Instead, *AIS_InteractiveObject* now defines *DynamicHilightAttributes()* for dynamic highlighting in addition to *HilightAttributes()* used for highlighting in selected state.
1215   Note that *AIS_InteractiveObject::HilightAttributes()* and *AIS_InteractiveObject::DynamicHilightAttributes()* override highlighting properties for both - entire object and for part coming from decomposition.
1216   This includes Z-layer settings, which will be the same when overriding properties through AIS_InteractiveObject, while *AIS_InteractiveContext::HighlightStyle()* allows customizing properties for local and global selection independently
1217   (with Graphic3d_ZLayerId_Top used for dynamic highlighting of entire object and Graphic3d_ZLayerId_Topmost for dynamic highlighting of object part by default).
1218 * The following protected fields have been removed from class *AIS_InteractiveObject*:
1219   - *myOwnColor*, replaced by *myDrawer->Color()*
1220   - *myTransparency*, replaced by *myDrawer->Transparency()*
1221   - *myZLayer*, replaced by *myDrawer->ZLayer()*
1222 * The method *PrsMgr_PresentationManager::Unhighlight()* taking Display Mode as an argument has been marked deprecated.
1223   Implementation now performs unhighlighting of all highlighted presentation mode.
1224 * The methods taking/returning *Quantity_NameOfColor* (predefined list of colors) and duplicating methods operating with *Quantity_Color* (definition of arbitrary RGB color) in AIS have been removed.
1225   *Quantity_Color* should be now used instead.
1226
1227 @subsection upgrade_720_implicit_viewer_update Elimination of implicit 3D Viewer updates
1228
1229 Most AIS_InteractiveContext methods are defined with a flag to update viewer immediately or not.
1230 Within previous version of OCCT, this argument had default value TRUE.
1231 While immediate viewer updates are useful for beginners (the result is displayed as soon as possible),
1232 this approach is inefficient for batch viewer updates, and having default value as TRUE
1233 lead to non-intended accidental updates which are difficult to find.
1234
1235 To avoid such issues, the interface has been modified and default value has been removed.
1236 Therefore, old application code should be updated to set the flag theToUpdateViewer explicitly
1237 to desired value (TRUE to preserve old previous behavior), if it was not already set.
1238
1239 The following AIS_InteractiveContext methods have been changed:
1240   Display, Erase, EraseAll, DisplayAll, EraseSelected, DisplaySelected, ClearPrs, Remove, RemoveAll, Hilight,
1241   HilightWithColor, Unhilight, Redisplay, RecomputePrsOnly, Update, SetDisplayMode, UnsetDisplayMode, SetColor,
1242   UnsetColor, SetWidth, UnsetWidth, SetMaterial, UnsetMaterial, SetTransparency, UnsetTransparency,
1243   SetLocalAttributes, UnsetLocalAttributes, SetPolygonOffsets, SetTrihedronSize, SetPlaneSize, SetPlaneSize,
1244   SetDeviationCoefficient, SetDeviationAngle, SetAngleAndDeviation, SetHLRDeviationCoefficient,
1245   SetHLRDeviationAngle, SetHLRAngleAndDeviation, SetSelectedAspect, MoveTo, Select, ShiftSelect, SetSelected,
1246   UpdateSelected, AddOrRemoveSelected, HilightSelected, UnhilightSelected, ClearSelected, ResetOriginalState,
1247   SubIntensityOn, SubIntensityOff, FitSelected, EraseGlobal, ClearGlobal, ClearGlobalPrs.
1248
1249 In addition, the API for immediate viewer update has been removed from V3d_View and Graphic3d_StructureManager classes
1250 (enumerations *Aspect_TypeOfUpdate* and *V3d_TypeOfUpdate*):
1251   V3d::SetUpdateMode(), V3d::UpdateMode(), Graphic3d_StructureManager::SetUpdateMode(), Graphic3d_StructureManager::UpdateMode().
1252
1253 The argument theUpdateMode has been removed from methods Graphic3d_CView::Display(), Erase(), Update().
1254 Method Graphic3d_CView::Update() does not redraw the view and does not re-compute structures anymore.
1255
1256 The following Grid management methods within class V3d_Viewer do not implicitly redraw the viewer:
1257   ActivateGrid, DeactivateGrid, SetRectangularGridValues, SetCircularGridValues,
1258   RectangularGridGraphicValues, CircularGridGraphicValues, SetPrivilegedPlane, DisplayPrivilegedPlane.
1259
1260 @subsection upgrade_720_v3d_colorname Elimination of Quantity_NameOfColor from TKV3d interface classes
1261
1262 The duplicating interface methods accepting *Quantity_NameOfColor* (in addition to methods accepting *Quantity_Color*) of TKV3d toolkit have been removed.
1263 In most cases this change should be transparent, however applications implementing such interface methods should also remove them
1264 (compiler will automatically highlight this issue for methods marked with Standard_OVERRIDE keyword).
1265
1266 @subsection upgrade_720_Result_Of_BOP_On_Containers Result of Boolean operations on containers
1267
1268 * The result of Boolean operations on arguments of collection types (WIRE/SHELL/COMPSOLID) is now filtered from duplicating containers.
1269
1270 @subsection upgrade_720_changes_methods Other changes
1271
1272 * *MMgt_TShared* class definition has been removed - Standard_Transient should be used instead (MMgt_TShared is marked as deprecated typedef of Standard_Transient for smooth migration).
1273 * Class GeomPlate_BuildPlateSurface accepts base class Adaptor3d_HCurve (instead of inherited Adaptor3d_HCurveOnSurface accepted earlier).
1274 * Types GeomPlate_Array1OfHCurveOnSurface and GeomPlate_HArray1OfHCurveOnSurface have been replaced with GeomPlate_Array1OfHCurve and GeomPlate_HArray1OfHCurve correspondingly (accept base class Adaptor3d_HCurve instead of Adaptor3d_HCurveOnSurface).
1275 * Enumeration *Image_PixMap::ImgFormat*, previously declared as nested enumeration within class *Image_PixMap*, has been moved to global namespace as *Image_Format* following OCCT coding rules.
1276   The enumeration values have suffix Image_Format_ and preserve previous name scheme for easy renaming of old values - e.g. Image_PixMap::ImgGray become Image_Format_Gray.
1277   Old definitions are preserved as depreacated aliases to the new ones;
1278 * Methods *Image_PixMap::PixelColor()* and *Image_PixMap::SetPixelColor()* now take/return Quantity_ColorRGBA instead of Quantity_Color/NCollection_Vec4.
1279 * The method BOPAlgo_Builder::Origins() returns BOPCol_DataMapOfShapeListOfShape instead of BOPCol_DataMapOfShapeShape.
1280 * The methods BOPDS_DS::IsToSort(const Handle(BOPDS_CommonBlock)&, Standard_Integer&) and BOPDS_DS::SortPaveBlocks(const Handle(BOPDS_CommonBlock)&) have been removed. The sorting is now performed during the addition of the Pave Blocks into Common Block.
1281 * The methods BOPAlgo_Tools::MakeBlocks() and BOPAlgo_Tools::MakeBlocksCnx() have been replaced with the single template method BOPAlgo_Tools::MakeBlocks(). The chains of connected elements are now stored into the list of list instead of data map.
1282 * The methods BOPAlgo_Tools::FillMap() have been replaced with the single template method BOPAlgo_Tools::FillMap().
1283 * Package BVH now uses opencascade::handle instead of NCollection_Handle (for classes BVH_Properties, BVH_Builder, BVH_Tree, BVH_Object).
1284   Application code using BVH package directly should be updated accordingly.
1285 * AIS_Shape now computes UV texture coordinates for AIS_Shaded presentation in case if texture mapping is enabled within Shaded Attributes.
1286   Therefore, redundant class *AIS_TexturedShape is now deprecated* - applications can use *AIS_Shape* directly (texture mapping should be defined through AIS_Shape::Attributes()).
1287 * Methods for managing active texture within OpenGl_Workspace class (ActiveTexture(), DisableTexture(), EnableTexture()) have been moved to *OpenGl_Context::BindTextures()*.
1288
1289 @subsection upgrade_720_BOP_DataStructure BOP - Pairs of interfering indices
1290
1291 * The classes *BOPDS_PassKey* and *BOPDS_PassKeyBoolean* are too excessive and not used any more in Boolean Operations. To replace them the new *BOPDS_Pair* class has been implemented. Thus:
1292   - The method *BOPDS_DS::Interferences()* now returns the *BOPDS_MapOfPair*;
1293   - The method *BOPDS_Iterator::Value()* takes now only two parameters - the indices of interfering sub-shapes.
1294
1295 @subsection upgrade_720_Removal_Of_Old_Boolean_Operations_Draw Removal of the Draw commands based on old Boolean operations
1296
1297 * The commands *fubl* and *cubl* have been removed. The alternative for these commands are the commands *bfuseblend* and *bcutblend* respectively.
1298 * The command *ksection* has been removed. The alternative for this command is the command *bsection*.
1299
1300 @subsection upgrade_720_Change_Of_FaceFace_Intersection Change of Face/Face intersection in Boolean operations
1301
1302 * Previously, the intersection tolerance for all section curves between pair of faces has been calculated as the maximal tolerance among all curves.
1303   Now, each curve has its own valid tolerance calculated as the maximal deviation of the 3D curve from its 2D curves or surfaces in case there are no 2D curves.
1304 * The methods *IntTools_FaceFace::TolReached3d()*, *IntTools_FaceFace::TolReal()* and *IntTools_FaceFace::TolReached2d()* have been removed.
1305 * Intersection tolerances of the curve can be obtained from the curve itself:
1306   - *IntTools_Curve::Tolerance()* - returns the valid tolerance for the curve;
1307   - *IntTools_Curve::TangentialTolerance()* - returns the tangential tolerance, which reflects the size of the common between faces.
1308 * 2d tolerance (*IntTools_FaceFace::TolReached2d()*) has been completely removed from the algorithm as unused.
1309
1310
1311 @subsection upgrade_720_persistence Restore OCCT 6.9.1 persistence
1312
1313 The capability of reading / writing files in old format using *Storage_ShapeSchema* functionality from OCCT 6.9.1 has been restored in OCCT 7.2.0.
1314
1315 One can use this functionality in two ways:
1316 - invoke DRAW Test Harness commands *fsdread / fsdwrite* for shapes;
1317 - call *StdStorage* class *Read / Write* functions in custom code.
1318
1319 The code example below demonstrates how to read shapes from a storage driver using *StdStorage* class.
1320
1321 ~~~~{.cpp}
1322 // aDriver should be created and opened for reading
1323 Handle(StdStorage_Data) aData;
1324
1325 // Read data from the driver
1326 // StdStorage::Read creates aData instance automatically if it is null
1327 Storage_Error anError = StdStorage::Read(*aDriver, aData);
1328 if (anError != Storage_VSOk)
1329 {
1330   // Error processing
1331 }
1332
1333 // Get root objects
1334 Handle(StdStorage_RootData) aRootData = aData->RootData();
1335 Handle(StdStorage_HSequenceOfRoots) aRoots = aRootData->Roots();
1336 if (!aRoots.IsNull())
1337 {
1338   // Iterator over the sequence of root objects
1339   for (StdStorage_HSequenceOfRoots::Iterator anIt(*aRoots); anIt.More(); anIt.Next())
1340   {
1341     Handle(StdStorage_Root)& aRoot = anIt.ChangeValue();
1342         // Get a persistent root's object
1343     Handle(StdObjMgt_Persistent) aPObject = aRoot->Object();
1344     if (!aPObject.IsNull())
1345     {
1346       Handle(ShapePersistent_TopoDS::HShape) aHShape = Handle(ShapePersistent_TopoDS::HShape)::DownCast(aPObject);
1347       if (aHShape) // Downcast to an expected type to import transient data
1348       {
1349         TopoDS_Shape aShape = aHShape->Import();
1350         shapes.Append(aShape);
1351       }
1352     }
1353   }
1354 }
1355 ~~~~
1356
1357 The following code demonstrates how to write shapes in OCCT 7.2.0 using *StdStorage* class.
1358
1359 ~~~~{.cpp}
1360 // Create a file driver
1361 NCollection_Handle<Storage_BaseDriver> aFileDriver(new FSD_File());
1362
1363 // Try to open the file driver for writing
1364 try
1365 {
1366   OCC_CATCH_SIGNALS
1367   PCDM_ReadWriter::Open (*aFileDriver, TCollection_ExtendedString(theFilename), Storage_VSWrite);
1368 }
1369 catch (Standard_Failure& e)
1370 {
1371   // Error processing
1372 }
1373
1374 // Create a storage data instance
1375 Handle(StdStorage_Data) aData = new StdStorage_Data();
1376 // Set an axiliary application name (optional)
1377 aData->HeaderData()->SetApplicationName(TCollection_ExtendedString("Application"));
1378
1379 // Provide a map to track sharing
1380 StdObjMgt_TransientPersistentMap aMap;
1381 // Iterator over a collection of shapes
1382 for (Standard_Integer i = 1; i <= shapes.Length(); ++i)
1383 {
1384   TopoDS_Shape aShape = shapes.Value(i);
1385   // Translate a shape to a persistent object
1386   Handle(ShapePersistent_TopoDS::HShape) aPShape =
1387     ShapePersistent_TopoDS::Translate(aShape, aMap, ShapePersistent_WithTriangle);
1388   if (aPShape.IsNull())
1389   {
1390     // Error processing
1391   }
1392
1393   // Construct a root name
1394   TCollection_AsciiString aName = TCollection_AsciiString("Shape_") + i;
1395
1396   // Add a root to storage data
1397   Handle(StdStorage_Root) aRoot = new StdStorage_Root(aName, aPShape);
1398   aData->RootData()->AddRoot(aRoot);
1399 }
1400
1401 // Write storage data to the driver
1402 Storage_Error anError = StdStorage::Write(*aFileDriver, aData);
1403 if (anError != Storage_VSOk)
1404 {
1405   // Error processing
1406 }
1407 ~~~~
1408
1409 @subsection upgrade_720_Change_In_BRepLib_MakeFace_Algo Change in BRepLib_MakeFace algorithm
1410
1411 Previously, *BRepLib_MakeFace* algorithm changed orientation of the source wire in order to avoid creation of face as a hole (i.e. it is impossible to create the entire face as a hole; the hole can be created in context of another face only). New algorithm does not reverse the wire if it is open. Material of the face for the open wire will be located on the left side from the source wire.
1412
1413 @subsection upgrade_720_Change_In_BRepFill_OffsetWire Change in BRepFill_OffsetWire algorithm
1414
1415 From now on, the offset  will always be directed to the outer region in case of positive offset value and to the inner region in case of negative offset value.
1416 Inner/Outer region for an open wire is defined by the following rule:
1417 when we go along the wire (taking into account edges orientation) the outer region will be on the right side, the inner region will be on the left side.
1418 In case of a closed wire, the inner region will always be inside the wire (at that, the edges orientation is not taken into account).
1419
1420 @subsection upgrade_720_Change_In_GeomAdaptor_Curve Change in Geom(2d)Adaptor_Curve::IsPeriodic
1421
1422 Since 7.2.0 version, method *IsPeriodic()* returns the corresponding status of periodicity of the basis curve regardless of closure status of the adaptor curve (see method *IsClosed()*).
1423 Method *IsClosed()* for adaptor can return false even on periodic curve, in the case if its parametric range is not full period, e.g. for adaptor on circle in range [0, @f$ \pi @f$].
1424 In previous versions, *IsPeriodic()* always returned false if *IsClosed()* returned false.
1425
1426 @subsection upgrade_720_UnifySameDomain Change in algorithm ShapeUpgrade_UnifySameDomain
1427
1428 The history of the changing of the initial shape was corrected:
1429 * all shapes created by the algorithm are considered as modified shapes instead of generated ones;
1430 * method Generated was removed and its calls should be replaced by calls of method History()->Modified.
1431
1432 @subsection upgrade_720_Change_In_RWStl Changes in STL Reader / Writer
1433
1434 Class RWStl now uses class Poly_Triangulation for storing triangular mesh instead of StlMesh data classes; the latter have been removed.
1435
1436 @subsection upgrade_720_New_Error_Warning_system_in_BOA Refactoring of the Error/Warning reporting system in Boolean Component
1437
1438 The Error/Warning reporting system of the algorithms in Boolean Component (in all BOPAlgo_* and BRepAlgoAPI_* algorithms) has been refactored.
1439 The methods returning the status of errors and warnings of the algorithms (ErrorStatus() and WarningStatus()) have been removed.
1440 Instead use methods HasErrors() and HasWarnings() to check for presence of errors and warnings, respectively.
1441 The full list of errors and warnings, with associated data such as problematic sub-shapes, can be obtained by method GetReport().
1442
1443 @section upgrade_occt721 Upgrade to OCCT 7.2.1
1444
1445 @subsection upgrade_721_Changes_In_USD Changes in ShapeUpgrade_UnifySameDomain
1446
1447 The following public methods in the class ShapeUpgrade_UnifySameDomain became protected:
1448 * *UnifyFaces*
1449 * *UnifyEdges*
1450
1451 The following public method has been removed:
1452 * *UnifyFacesAndEdges*
1453
1454 @subsection upgrade_721_Move_BuildPCurveForEdgeOnPlane Moving BuildPCurveForEdgeOnPlane from BOPTools_AlgoTools2D to BRepLib
1455
1456 The methods BuildPCurveForEdgeOnPlane and BuildPCurveForEdgesOnPlane have been moved from the class BOPTools_AlgoTools2D
1457 to the more lower level class BRepLib.
1458
1459 @subsection upgrade_721_removed Removed features
1460
1461 The following obsolete features have been removed:
1462 * The package BOPCol has been fully removed:
1463   - *BOPCol_BaseAllocator* is replaced with *Handle(NCollection_BaseAllocator)*;
1464   - *BOPCol_BoxBndTree* is replaced with *BOPTools_BoxBndTree*;
1465   - *BOPCol_Box2DBndTree* is removed as unused;
1466   - *BOPCol_DataMapOfIntegerInteger* is replaced with *TColStd_DataMapOfIntegerInteger*;
1467   - *BOPCol_DataMapOfIntegerListOfInteger* is replaced with *TColStd_DataMapOfIntegerListOfInteger*;
1468   - *BOPCol_DataMapOfIntegerListOfShape* is replaced with *TopTools_DataMapOfIntegerListOfShape*;
1469   - *BOPCol_DataMapOfIntegerMapOfInteger.hxx* is removed as unused;
1470   - *BOPCol_DataMapOfIntegerReal* is replaced with *TColStd_DataMapOfIntegerReal*;
1471   - *BOPCol_DataMapOfIntegerShape* is replaced with *TopTools_DataMapOfIntegerShape*;
1472   - *BOPCol_DataMapOfShapeBox* is replaced with *TopTools_DataMapOfShapeBox*;
1473   - *BOPCol_DataMapOfShapeInteger* is replaced with *TopTools_DataMapOfShapeInteger*;
1474   - *BOPCol_DataMapOfShapeListOfShape* is replaced with *TopTools_DataMapOfShapeListOfShape*;
1475   - *BOPCol_DataMapOfShapeReal* is replaced with *TopTools_DataMapOfShapeReal*;
1476   - *BOPCol_DataMapOfShapeShape* is replaced with *TopTools_DataMapOfShapeShape*;
1477   - *BOPCol_DataMapOfTransientAddress* is removed as unused;
1478   - *BOPCol_IndexedDataMapOfIntegerListOfInteger* is removed as unused;
1479   - *BOPCol_IndexedDataMapOfShapeBox* is removed as unused;
1480   - *BOPCol_IndexedDataMapOfShapeInteger* is removed as unused;
1481   - *BOPCol_IndexedDataMapOfShapeListOfShape* is replaced with *TopTools_IndexedDataMapOfShapeListOfShape*;
1482   - *BOPCol_IndexedDataMapOfShapeReal* is removed as unused;
1483   - *BOPCol_IndexedDataMapOfShapeShape* is replaced with *TopTools_IndexedDataMapOfShapeShape*;
1484   - *BOPCol_IndexedMapOfInteger* is replaced with *TColStd_IndexedMapOfInteger*;
1485   - *BOPCol_IndexedMapOfOrientedShape* is replaced with *TopTools_IndexedMapOfOrientedShape*;
1486   - *BOPCol_IndexedMapOfShape* is replaced with *TopTools_IndexedMapOfShape*;
1487   - *BOPCol_ListOfInteger* is replaced with *TColStd_ListOfInteger*;
1488   - *BOPCol_ListOfListOfShape* is replaced with *TopTools_ListOfListOfShape*;
1489   - *BOPCol_ListOfShape* is replaced with *TopTools_ListOfShape*;
1490   - *BOPCol_MapOfInteger* is replaced with *TColStd_MapOfInteger*;
1491   - *BOPCol_MapOfOrientedShape* is replaced with *TopTools_MapOfOrientedShape*;
1492   - *BOPCol_MapOfShape* is replaced with *TopTools_MapOfShape*;
1493   - *BOPCol_PListOfInteger* is removed as unused;
1494   - *BOPCol_PInteger* is removed as unused
1495   - *BOPCol_SequenceOfPnt2d* is replaced with *TColgp_SequenceOfPnt2d*;
1496   - *BOPCol_SequenceOfReal* is replaced with *TColStd_SequenceOfReal*;
1497   - *BOPCol_SequenceOfShape* is replaced with *TopTools_SequenceOfShape*;
1498   - *BOPCol_Parallel* is replaced with *BOPTools_Parallel*;
1499   - *BOPCol_NCVector* is replaced with *NCollection_Vector*;
1500 * The class *BOPDS_PassKey* and containers for it have been removed as unused.
1501 * The unused containers from *IntTools* package have been removed:
1502   - *IntTools_DataMapOfShapeAddress* is removed as unused;
1503   - *IntTools_IndexedDataMapOfTransientAddress* is removed as unused;
1504 * The container *BiTgte_DataMapOfShapeBox* is replaced with *TopTools_DataMapOfShapeBox*;
1505 * The class *BOPTools* has been removed as duplicate of the class *TopExp*;
1506 * The method *BOPAlgo_Builder::Splits()* has been removed as excessive. The method *BOPAlgo_Builder::Images()* can be used instead.
1507 * The method *BOPTools_AlgoTools::CheckSameGeom()* has been removed as excessive. The method *BOPTools_AlgoTools::AreFacesSameDomain()* can be used instead.
1508
1509 @section upgrade_occt730 Upgrade to OCCT 7.3.0
1510
1511 @subsection upgrade_730_lights Light sources
1512
1513 Multiple changes have been applied to lights management within *TKV3d* and *TKOpenGl*:
1514 * *V3d_Light* class is now an alias to *Graphic3d_CLight*.
1515   *Graphic3d_CLight* is now a Handle class with refactored methods for managing light source parameters.
1516   Most methods of *V3d_Light* sub-classes have been preserved to simplify porting.
1517 * Obsolete debugging functionality for drawing a light source has been removed from *V3d_Light*.
1518   Methods and constructors that take parameters for debug display and do not affect the light definition itself have also been removed.
1519 * Light constructors taking *V3d_Viewer* have been marked as deprecated.
1520   Use method *AddLight()* of the class *V3d_Viewer* or *V3d_View* to add new light sources to a scene or a single view, respectively.
1521 * The upper limit of 8 light sources has been removed.
1522 * The classes for specific light source types: *V3d_AmbientLight, V3d_DirectionalLight, V3d_PositionalLight* and *V3d_SpotLight* have been preserved, but it is now possible to define the light of any type by creating base class *Graphic3d_CLight* directly. The specific classes only hide unrelated light properties depending on the type of light source.
1523 * It is no more required to call *V3d_Viewer::UpdateLights()* after modifying the properties of light sources (color, position, etc.)
1524
1525 @subsection upgrade_730_shadingmodels Shading Models
1526
1527 *Graphic3d_AspectFillArea3d* has been extended by a new property *ShadingModel()*, which previously has been defined globally for the entire View.
1528
1529 Previously, a triangle array without normal vertex attributes was implicitly considered as unshaded,
1530 but now such array will be shaded using *Graphic3d_TOSM_FACET* model (e.g. by computing per-triangle normals).
1531 Therefore, *Graphic3d_TOSM_UNLIT* should be explicitly specified to disable shading of triangles array.
1532 Alternatively, a material without reflectance properties can be used to disable shading (as before).
1533
1534 @subsection upgrade_730_tkopengl Custom low-level OpenGL elements
1535
1536 The following API changes should be considered while porting custom *OpenGl_Element* objects:
1537 * *OpenGl_ShaderManager::BindFaceProgram()*, *BindLineProgram()*, *BindMarkerProgram()* now take enumeration arguments instead of Boolean flags.
1538
1539 @subsection upgrade_730_BOPAlgo_Section Changes in BOPAlgo_Section
1540
1541 The public method *BuildSection()* in the class *BOPAlgo_Section* has become protected. The methods *Perform()* or *PerformWithFiller()* should be called for construction of the result of SECTION operation.
1542
1543 @subsection upgrade_730_BRepAdaptor_CompCurve Changes in BRepAdaptor_CompCurve
1544
1545 The method *BRepAdaptor_CompCurve::SetPeriodic* has been eliminated.
1546 Since the new version, the method *BRepAdaptor_CompCurve::IsPeriodic()* will always return FALSE. Earlier, it could return TRUE in case if the wire contained only one edge based on a periodic curve. 
1547
1548 @subsection upgrade_730_removed Removed features
1549 * The methods *SetDeflection*, *SetEpsilonT*, *SetDiscretize* of the class *IntTools_EdgeFace* have been removed as redundant.
1550 * Deprecated functionality *V3d_View::Export()*, related enumerations Graphic3d_ExportFormat, Graphic3d_SortType
1551   as well as optional dependency from gl2ps library have been removed.
1552
1553 @subsection upgrade_730_BuilderSolid Boolean Operations - Solid Builder algorithm
1554
1555 Previously, the unclassified faces of *BOPAlgo_BuilderSolid* algorithm (i.e. the faces not used for solids creation and located outside of all created solids) were used to form an additional (not closed) solid with INTERNAL orientation.
1556 Since the new version, these unclassified faces are no longer added into the resulting solids. Instead, the @ref specification__boolean_ers "warning" with a list of these faces appears.
1557
1558 The following public methods of the *BOPAlgo_BuilderSolid* class have been removed as redundant:
1559 * *void SetSolid(const TopoDS_Solid& theSolid);*
1560 * *const TopoDS_Solid& Solid() const;*
1561
1562 @subsection upgrade_730_BRepAlgoBO Boolean Operation classes in BRepAlgo are deprecated
1563
1564 The API classes in the package BRepAlgo providing access to old Boolean operations are marked as deprecated:
1565 * BRepAlgo_Fuse
1566 * BRepAlgo_Common
1567 * BRepAlgo_Cut
1568 * BRepAlgo_Section
1569 Corresponding classes from the package BRepAlgoAPI should be used instead.
1570
1571 @subsection upgrade_730_replace_CDM_MessageDriver_interface_by_Message_Messenger Unification of the Error/Warning reporting system of Application Framework
1572
1573 Class *CDM_MessageDriver* and its descendants have been removed; class *Message_Messenger* is used instead in all OCAF packages.
1574 By default, messenger returned by *Message::DefaultMessenger()* is used, thus all messages generated by OCAF are directed in the common message queue of OCCT.
1575
1576 In classes implementing OCAF persistence for custom attributes (those inheriting from *BinMDF_ADriver*, *XmlMDF_ADriver*), uses of method *WriteMessage()* should be replaced by call to method *Send()* of the inherited field *myMessageDriver*. Note that this method takes additional argument indicating the gravity of the message (Trace, Info, Warning, Alarm, or Fail).
1577
1578 Class *Message_PrinterOStream* can be used instead of *CDM_COutMessageDriver* to direct all messages to a stream.
1579 If custom driver class is used in the application, that class shall be reimplemented inheriting from *Message_Printer* instead of *CDM_MessageDriver*.
1580 Method *Send()* should be redefined instead of method *Write()* of *CDM_MessageDriver*.
1581 To use the custom printer in OCAF, it can be either added to default messenger or set into the custom *Message_Messenger* object created in the method *MessageDriver()* of a class inheriting *CDF_Application*.
1582
1583 @section upgrade_occt740 Upgrade to OCCT 7.4.0
1584
1585 @subsection upgrade_740_BRepPrimAPI_MakeRevol Changes in BRepPrimAPI_MakeRevol algorithm
1586 Previously the algorithm could create a shape with the same degenerated edge shared between some faces. Now it is prevented. The algorithm creates the different copy of this edge for each face. The method *Generated(...)* has been changed in order to apply restriction to the input shape: input shape can be only of type VERTEX, EDGE, FACE or SOLID. For input shape of another type the method always returns empty list.
1587
1588 @subsection upgrade_740_removed Removed features
1589 * The following methods of the class *BRepAlgoAPI_BooleanOperation* have been removed as obsolete or replaced:
1590   - *BuilderCanWork* can be replaced with *IsDone* or *HasErrors* method.
1591   - *FuseEdges* removed as obsolete.
1592   - *RefineEdges* replaced with new method *SimplifyResult*.
1593 * The method *ImagesResult* of the class *BOPAlgo_BuilderShape* has been removed as unused. The functionality of this method can be completely replaced by the history methods *Modified* and *IsDeleted*.
1594 * The method *TrackHistory* of the classes *BOPAlgo_RemoveFeatures* and *BRepAlgoAPI_Defeaturing* has been renamed to *SetToFillHistory*.
1595 * The method *GetHistory* of the class *BRepAlgoAPI_Defeaturing* has been renamed to *History*.
1596 * The classes *BRepAlgo_BooleanOperations* and *BRepAlgo_DSAccess* have been removed as obsolete. Please use the BRepAlgoAPI_* classes to perform Boolean operations.
1597 * *BRepAlgo_DataMapOfShapeBoolean* has been removed as unused.
1598 * *BRepAlgo_DataMapOfShapeInterference* has been removed as unused.
1599 * *BRepAlgo_EdgeConnector* has been removed as unused.
1600 * *BRepAlgo_SequenceOfSequenceOfInteger* has been removed as unused.
1601
1602 @subsection upgrade_740_localcontext Local Context removal
1603
1604 Previously deprecated Local Context functionality has been removed from AIS package,
1605 so that related methods have been removed from AIS_InteractiveContext interface:
1606 *HasOpenedContext()*, *HighestIndex()*, *LocalContext()*, *LocalSelector()*, *OpenLocalContext()*, *CloseLocalContext()*,
1607 *IndexOfCurrentLocal()*, *CloseAllContexts()*, *ResetOriginalState()*, *ClearLocalContext()*, *UseDisplayedObjects()*, *NotUseDisplayedObjects()*,
1608 *SetShapeDecomposition()*, *SetTemporaryAttributes()*, *ActivateStandardMode()*, *DeactivateStandardMode()*, *KeepTemporary()*,
1609 *SubIntensityOn()*, *SubIntensityOff()*, *ActivatedStandardModes()*, *IsInLocal()*, *AddOrRemoveSelected()* taking TopoDS_Shape.
1610
1611 A set of deprecated methods previously related to Local Context and now redirecting to other methods has been preserved to simplify porting; they will be removed in next release.
1612
1613 @subsection upgrade_740_geomconvert Changes in behavior of Convert algorithms
1614
1615 Now methods *GeomConvert::ConcatG1*, *GeomConvert::ConcatC1*, *Geom2dConvert::ConcatG1*, *Geom2dConvert::ConcatC1* modify the input argument representing the flag of closedness.
1616
1617 @subsection upgrade_740_selection Changes in selection API and picked point calculation algorithm.
1618
1619 *SelectBasics_PickResult* structure has been extended, so that it now defines a 3D point on the detected entity in addition to Depth value along picking ray.
1620 *SelectMgr_SelectingVolumeManager::Overlap()* methods have been corrected to fill in *SelectBasics_PickResult* structure (depth and 3D point) instead of only depth value, so that custom *Select3D_SensitiveEntity* implementation should be updated accordingly (including *Select3D_SensitiveSet* subclasses).
1621
1622 @subsection upgrade_740_ocafpersistence Document format version management improvement.
1623
1624 Previously Document format version restored by *DocumentRetrievalDriver* was propagated using static methods of the corresponding units (like *MDataStd* or *MNaming*) to static variables of these units and after that became accessible to Drivers of these units.
1625 Now Document format version is available to drivers via *RelocationTable*. The Relocation table now keeps *HeaderData* of the document and a format version can be extracted in the following way: *theRelocTable.GetHeaderData()->StorageVersion()*.
1626 Obsolete methods: *static void SetDocumentVersion (const Standard_Integer DocVersion)* and *static Standard_Integer DocumentVersion()* have been removed from *BinMDataStd*, *BinMNaming*, *XmlMDataStd* and *XmlMNaming*.
1627
1628 @subsection upgrade_740_changed_api_of_brepmesh BRepMesh - revision of the data model
1629
1630 The entire structure of *BRepMesh* component has been revised and separated into several logically connected classes.
1631
1632 In new version, deflection is controlled more accurately, this may be necessary to tune parameters of call of the BRepMesh algorithm on the application side to obtain the same quality of presentation and/or performance as before.
1633
1634 *BRepMesh_FastDiscret* and *BRepMesh_FastDiscretFace* classes have been removed.
1635
1636 The following changes have been introduced in the API of *BRepMesh_IncrementalMesh*, component entry point:
1637 * Due to revised logic, *adaptiveMin* parameter of the constructor has been removed as meaningless;
1638 * *BRepMesh_FastDiscret::Parameters* has been moved to a separate structure called *IMeshTools_Parameters*; the signatures of related methods have been changed correspondingly.
1639
1640 * Interface of *BRepMesh_Delaun* class has been changed.
1641
1642 Example of usage:
1643 Case 1 (explicit parameters):
1644 ~~~~{.cpp}
1645 #include <IMeshData_Status.hxx>
1646 #include <IMeshTools_Parameters.hxx>
1647 #include <BRepMesh_IncrementalMesh.hxx>
1648
1649 Standard_Boolean meshing_explicit_parameters()
1650 {
1651   BRepMesh_IncrementalMesh aMesher (aShape, 0.1, Standard_False, 0.5, Standard_True);
1652   const Standard_Integer aStatus = aMesher.GetStatusFlags();
1653   return !aStatus;
1654 }
1655
1656 Standard_Boolean meshing_new()
1657 {
1658   IMeshTools_Parameters aMeshParams;
1659   aMeshParams.Deflection               = 0.1;
1660   aMeshParams.Angle                    = 0.5;
1661   aMeshParams.Relative                 = Standard_False;
1662   aMeshParams.InParallel               = Standard_True;
1663   aMeshParams.MinSize                  = Precision::Confusion();
1664   aMeshParams.InternalVerticesMode     = Standard_True;
1665   aMeshParams.ControlSurfaceDeflection = Standard_True;
1666
1667   BRepMesh_IncrementalMesh aMesher (aShape, aMeshParams);
1668   const Standard_Integer aStatus = aMesher.GetStatusFlags();
1669   return !aStatus;
1670 }
1671 ~~~~
1672
1673 @subsection upgrade_740_chamfer Changes in API of Chamfer algorithms
1674
1675 Some public methods of the class BRepFilletAPI_MakeChamfer are released from excess arguments:
1676 - method Add for symmetric chamfer now takes only 2 arguments: distance and edge;
1677 - method GetDistAngle now takes only 3 arguments: index of contour, distance and angle.
1678
1679 @subsection upgrade_740_aspects Aspects unification
1680
1681 Fill Area, Line and Marker aspects (classes *Graphic3d_AspectFillArea3d*, *Graphic3d_AspectLine3d*, *Graphic3d_AspectMarker3d* and *Graphic3d_AspectText3d*)
1682 have been merged into new class *Graphic3d_Aspects* providing a single state for rendering primitives of any type.
1683 The old per-primitive type aspect classes have been preserved as sub-classes of *Graphic3d_Aspects* with default values close to the previous behavior.
1684 All aspects except Graphic3d_AspectFillArea3d define Graphic3d_TOSM_UNLIT shading model.
1685
1686 The previous approach with dedicated aspects per primitive type was handy in simplified case, but lead to confusion otherwise.
1687 In fact, drawing points or lines with lighting applied is a valid use case, but only *Graphic3d_AspectFillArea3d* previously defined necessary material properties.
1688
1689 As aspects for different primitive types have been merged, Graphic3d_Group does no more provide per-type aspect properties.
1690 Existing code relying on old behavior and putting interleaved per-type aspects into single Graphic3d_Group should be updated.
1691 For example, the following pseudo-code will not work anymore, because all *SetGroupPrimitivesAspect* calls will setup the same property:
1692 ~~~~{.cpp}
1693 Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
1694 aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
1695 aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());    //!< overrides previous aspect
1696
1697 Handle(Graphic3d_ArrayOfSegments) aLines = new Graphic3d_ArrayOfSegments (2);
1698 Handle(Graphic3d_ArrayOfTriangles) aTris = new Graphic3d_ArrayOfTriangles (3);
1699 aGroup->AddPrimitiveArray (aLines); //!< both arrays will use the same aspect
1700 aGroup->AddPrimitiveArray (aTris);
1701 ~~~~
1702
1703 To solve the problem, the code should be modified to either put primitives into dedicated groups (preferred approach), or using *SetPrimitivesAspect* in proper order:
1704 ~~~~{.cpp}
1705 Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
1706
1707 aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
1708 Handle(Graphic3d_ArrayOfTriangles) aTris = new Graphic3d_ArrayOfTriangles (3);
1709 aGroup->AddPrimitiveArray (aTris);
1710
1711 Handle(Graphic3d_ArrayOfSegments) aLines = new Graphic3d_ArrayOfSegments (2);
1712 aGroup->SetPrimitivesAspect (myDrawer->LineAspect()->Aspect()); //!< next array will use the new aspect
1713 aGroup->AddPrimitiveArray (aLines);
1714 ~~~~
1715
1716 @subsection upgrade_740_materials Material definition
1717
1718 Decomposition of Ambient, Diffuse, Specular and Emissive properties has been eliminated within *Graphic3d_MaterialAspect* definition.
1719 As result, the following methods of *Graphic3d_MaterialAspect* class have been removed: SetReflectionMode(), SetReflectionModeOn(), Ambient(), Diffuse(), Emissive(), Specular(), SetAmbient(), SetDiffuse(), SetSpecular(), SetEmissive().
1720
1721 Previously, computation of final value required the following code:
1722 ~~~~{.cpp}
1723 Graphic3d_MaterialAspect theMaterial; Quantity_Color theInteriorColor;
1724 Graphic3d_Vec3 anAmbient (0.0f);
1725 if (theMaterial.ReflectionMode (Graphic3d_TOR_AMBIENT))
1726 {
1727   anAmbient = theMaterial.MaterialType (Graphic3d_MATERIAL_ASPECT)
1728             ? (Graphic3d_Vec3 )theInteriorColor           * theMaterial.Ambient()
1729             : (Graphic3d_Vec3 )theMaterial.AmbientColor() * theMaterial.Ambient();
1730 }
1731 ~~~~
1732
1733 New code looks like this:
1734 ~~~~{.cpp}
1735 Graphic3d_MaterialAspect theMaterial; Quantity_Color theInteriorColor;
1736 Graphic3d_Vec3 anAmbient = theMaterial.AmbientColor();
1737 if (theMaterial.MaterialType (Graphic3d_MATERIAL_ASPECT)) { anAmbient *= (Graphic3d_Vec3 )theInteriorColor; }
1738 ~~~~
1739
1740 Existing code should be updated to:
1741 - Replace Graphic3d_MaterialAspect::SetReflectionModeOff() with setting black color; SetReflectionModeOn() calls can be simply removed.
1742   R.g. theMaterial.SetAmbientColor(Quantity_NOC_BLACK).
1743 - Replace Graphic3d_MaterialAspect::Ambient(), SetAmbient(), Diffuse(), SetDiffuse(), Specular(), SetSpecular(), Emissive(), SetEmissive() with methods working with pre-multiplied color.
1744   E.g. theMaterial.SetAmbientColor(Graphic3d_Vec3 (1.0f, 0.0f, 0.0f) * 0.2f).
1745 - Avoid using Graphic3d_MaterialAspect::Color() and SetColor() with non-physical materials (Graphic3d_MATERIAL_ASPECT).
1746   These materials do not include color definition, because it is taken from Graphic3d_Aspects::InteriorColor() - this has not been changed.
1747   However, previously it was possible storing the color with SetColor() call and then fetching it with Color() by application code (the rendering ignored this value);
1748   now SetColor() explicitly ignores call for Graphic3d_MATERIAL_ASPECT materials and Color() returns DiffuseColor() multiplication coefficients.
1749
1750 @subsection upgrade_740_text Changes in Graphic3d_Text and OpenGl_Text API
1751
1752 Parameters of *Text* in *Graphic3d_Group* are moved into a new *Graphic3d_Text* class. *AddText* of *Graphic3d_Group* should be used instead of the previous *Text*.
1753
1754 The previous code:
1755 ~~~~{.cpp}
1756 Standard_Real x, y, z;
1757 theAttachmentPoint.Coord(x,y,z);
1758 theGroup->Text (theText,
1759                 Graphic3d_Vertex(x,y,z),
1760                 theAspect->Height(),
1761                 theAspect->Angle(),
1762                 theAspect->Orientation(),
1763                 theAspect->HorizontalJustification(),
1764                 theAspect->VerticalJustification());
1765 ~~~~
1766 should be replaced by the new code:
1767 ~~~~{.cpp}
1768 Handle(Graphic3d_Text) aText = new Graphic3d_Text (theAspect->Height());
1769 aText->SetText (theText.ToExtString());
1770 aText->SetPosition (theAttachmentPoint);
1771 aText->SetHorizontalAlignment (theAspect->HorizontalJustification());
1772 aText->SetVerticalAlignment (theAspect->VerticalJustification());
1773 theGroup->AddText (aText);
1774 ~~~~
1775
1776 *OpenGl_Text* contains *Graphic3d_Text* field.
1777
1778 *OpenGl_TextParam* struct is removed. Constructor and *Init* of *OpenGl_Text* with *OpenGl_TextParam* are also removed.
1779 Instead of using them, change *OpenGl_Text*.
1780
1781 Please, note, that after modifying *OpenGl_Text*, *Reset* of *OpenGl_Text* should be called.
1782
1783 *FormatParams* of *OpenGl_Text* is replaced by *Text*.
1784
1785 @subsection upgrade_740_prsupdate Presentation invalidation
1786
1787 Historically AIS_InteractiveObject provided two independent mechanisms invalidating presentation (asking presentation manager to recompute specific display mode or all modes):
1788
1789 1. *AIS_InteractiveObject::SetToUpdate()*, marking existing presentation for update.
1790    This is main invalidation API, which is expected to be followed by *AIS_InteractiveContext::Update()* call.
1791 2. *AIS_InteractiveObject::myToRecomputeModes* + *myRecomputeEveryPrs*.
1792    This is auxiliary invalidation API, used internally by AIS_InteractiveContext::SetColor()/UnsetColor() and similar modification methods.
1793
1794 The latter one has been removed to avoid confusion and unexpected behavior.
1795 In addition, two methods *AIS_InteractiveObject::Update()* have been deprecated in favor of new *AIS_InteractiveObject::UpdatePresentations()* recomputing only invalidated presentations.
1796
1797 Custom presentations implementing interface methods *AIS_InteractiveObject::SetColor()* and others should be revised to use *AIS_InteractiveObject::SetToUpdate()*
1798 or updating presentation without recomputation (see *AIS_InteractiveObject::SynchronizeAspects()* and *AIS_InteractiveObject::replaceAspects()*).
1799
1800 @subsection upgrade_740_interiorstyles Interior styles
1801
1802 * *Aspect_IS_HOLLOW* is now an alias to *Aspect_IS_EMPTY* and does not implicitly enables drawing mesh edges anymore.
1803   Specify Graphic3d_AspectFillArea3d::SetDrawEdges(true) with Graphic3d_AspectFillArea3d::SetInteriorStyle(Aspect_IS_EMPTY) to get previous behavior of Aspect_IS_HOLLOW style.
1804 * *Aspect_IS_HIDDENLINE* does not implicitly enables drawing mesh edges anymore.
1805   Specify Graphic3d_AspectFillArea3d::SetDrawEdges(true) with Graphic3d_AspectFillArea3d::SetInteriorStyle(Aspect_IS_HIDDENLINE) to get previous behavior of Aspect_IS_HIDDENLINE style.
1806
1807 @subsection upgrade_740_modedprs PrsMgr and SelectMgr hierarchy clean up
1808
1809 Proxy classes *Prs3d_Presentation*, *PrsMgr_ModedPresentation* and *PrsMgr_Prs* have been removed.
1810 Code iterating through the list of low-level structures AIS_InteractiveObject::Presentations() should be updated to access PrsMgr_Presentation directly.
1811 Forward declarations of *Prs3d_Presentation* should be corrected, since it is now a typedef to *Graphic3d_Structure*.
1812
1813 Proxy classes *SelectBasics_SensitiveEntity* and *SelectBasics_EntityOwner* have been removed - *Select3D_SensitiveEntity* and *SelectMgr_EntityOwner* should be now used directly instead.
1814
1815 @subsection upgrade_740_offset Polygon offset defaults
1816
1817 *Graphic3d_PolygonOffset* default constructor has been corrected to define Units=1 instead of Units=0.
1818 Default polygon offset settings Mode=Aspect_POM_Fill + Factor=1 + Units=1 are intended to push triangulation
1819 (Shaded presentation) a little bit behind of lines (Wireframe and Face Edges)
1820 for reducing z-fighting effect of Shaded+Wireframe combination.
1821 The change in defaults (Units changed from 0 to 1) is intended to cover scenario when camera direction is perpendicular to model plane (like 2D view).
1822
1823 Application observing unexpected visual difference on this change should consider customizing this property within AIS_InteractiveContext default attributes
1824 or on per-presentation basis via *Graphic3d_Aspects::SetPolygonOffset()* methods.
1825
1826 @subsection upgrade_740_zlayer Adding ZLayers in given position
1827
1828 Interface of insertion ZLayer in the viewer has been improved with ability to insert new layer before or after existing one.
1829 Previously undocumented behavior of *V3d_Viewer::AddZlayer()* method has been corrected to insert new layer before *Graphic3d_ZLayerId_Top*.
1830 Applications might need revising their custom layers creation code and specify precisely their order with new methods *V3d_Viewer::InsertLayerBefore()* and *V3d_Viewer::InsertLayerAfter()*.
1831
1832 @subsection upgrade_740_enum_changed Modified enumerations
1833
1834 Applications using integer values of the following enumerations in persistence
1835 should be corrected as these enumerations have been modified:
1836
1837 | Name |
1838 | :----- |
1839 | AIS_TypeOfAttribute |
1840 | Aspect_InteriorStyle |
1841 | Font_FontAspect |
1842
1843 @subsection upgrade_740_geproj Custom defines within env.bat
1844
1845 *env.bat* produced by Visual Studio project generator *genproj.bat* has been modified so that *%CSF_DEFINES%* variable is reset to initial state.
1846 Custom building environment relying on old behavior and setting extra macros within *%CSF_DEFINES%* before env.bat should be updated
1847 to either modify custom.bat or setup new variable *%CSF_DEFINES_EXTRA%* instead.
1848
1849 @subsection upgrade_740_BVH_in_BOP Switching Boolean Operations algorithm to use BVH tree instead of UB tree
1850
1851 Since OCCT 7.4.0 Boolean Operations algorithm uses BVH tree instead of UBTree to find the pairs of entities with interfering bounding boxes.
1852 The following API changes have been made:
1853 * BOPTools_BoxBndTree and BOPTools_BoxBndTreeSelector have been removed. Use the BOPTools_BoxTree and BOPTools_BoxTreeSelector instead.
1854 * BOPTools_BoxSelector::SetBox() method now accepts the BVH_Box instead of Bnd_Box.
1855 * Methods BOPTools_BoxSelector::Reject and BOPTools_BoxSelector::Accept have been removed as unused.
1856 * The RunParallel flag has been removed from the list of parameters of BOPAlgo_Tools::IntersectVertices method. Earlier, it performed selection from the UB tree in parallel mode. Now all interfering pairs are found in one pass, using pair traverse of the same BVH tree.
1857
1858 @subsection upgrade_740_stdnamespace Standard_Stream.hxx no more has "using std::" statements
1859 *Standard_Stream.hxx* header, commonly included by other OCCT header files, does no more add entities from *std namespace* related to streams (like *std::cout*, *std::istream* and others) into global namespace.
1860 The application code relying on this matter should be updated to either specify std namespace explicitly (like std::cout) or add "using std::" statements locally.
1861
1862 @section upgrade_occt750 Upgrade to OCCT 7.5.0
1863
1864 @subsection upgrade_750_srgb_color RGB color definition
1865
1866 OCCT 3D Viewer has been improved to properly perform lighting using in linear RGB color space and then convert result into non-linear gamma-shifted sRGB color space before displaying on display.
1867 This change affects texture mapping, material definition and color definition.
1868
1869 Previously *Quantity_Color* definition was provided with unspecified RGB color space.
1870 In practice, mixed color spaces have been actually used, with non-linear sRGB prevailing in general.
1871 Since OCCT 7.5.0, *Quantity_Color* now specifies that components are defined in linear RGB color space.
1872
1873 This change affects following parts:
1874 * Standard colors defined by *Quantity_NameOfColor* enumeration have been converted into linear RGB values within Quantity_Color construction.
1875 * Application may use new enumeration value *Quantity_TOC_sRGB* for passing/fetching colors in sRGB color space,
1876   which can be useful for interoperation with color picking widgets (returning 8-bit integer values within [0..255] range)
1877   or for porting colors constants within old application code without manual conversion.
1878 * *Graphic3d_MaterialAspect* color components are now expected in linear RGB color space,
1879   and standard OCCT materials within *Graphic3d_NameOfMaterial* enumeration have been updated accordingly.
1880 * Texture mapping now handles new *Graphic3d_TextureRoot::IsColorMap()* for interpreting content in linear RGB or sRGB color space.
1881   It is responsibility of user specifying this flag correctly. The flag value is TRUE by default.
1882 * Method *Image_PixMap::PixelColor()* has been extended with a new Boolean flag for performing linearization of non-linear sRGB.
1883   This flag is FALSE by default; application should consider passing TRUE instead for further handling *Quantity_Color* properly as linear RGB values.
1884
1885 @subsection upgrade_750_aspectwindow Aspect_Window interface change
1886
1887 Unexpected const-ness of Aspect_Window::DoResize() method has been removed, so that application classes implementing this interface should be updated accordingly.
1888
1889 @subsection upgrade_750_rename Renaming of types
1890
1891 Enumeration BRepOffset_Type is renamed to ChFiDS_TypeOfConcavity.
1892
1893 @subsection upgrade_750_BRepOffset_MakeOffset change in construction of offset faces
1894
1895 Now by default offset faces of non-planar faces may be planar faces if their originals can be approximated by planes.
1896
1897 @subsection upgrade_750_tkv3d TKV3d/TKService toolkits changes
1898
1899 The following changes could be highlighted while porting:
1900 * *Prs3d::GetDeflection()* has been moved to *StdPrs_ToolTriangulatedShape::GetDeflection()*.
1901 * *Prs3d_ShapeTool* has been moved to *StdPrs_ShapeTool*.
1902 * *StdSelect_ViewerSelector3d* has been moved to *SelectMgr_ViewerSelector3d*.
1903 * *Font_BRepFont* has been moved to *StdPrs_BRepFont*.
1904 * Visualization classes now use *TopLoc_Datum3D* (from *TKMath*) instead of *Geom_Transformation* (from *TKG3d*) as smart pointer to *gp_Trsf*.
1905   This is rather an internal change, but some applications might need to be updated.
1906
1907 @subsection upgrade_750_hlrangle Prs3d_Drawer deviation angle
1908
1909 Properties Prs3d_Drawer::HLRAngle() and Prs3d_Drawer::HLRDeviationCoefficient() have been removed from classes *Prs3d_Drawer*, *AIS_Shape* and *AIS_InteractiveContext*.
1910 Prs3d_Drawer::DeviationAngle() should be now used instead of Prs3d_Drawer::HLRAngle() and Prs3d_Drawer::DeviationCoefficient() instead of Prs3d_Drawer::HLRDeviationCoefficient().
1911 The default value of Prs3d_Drawer::DeviationAngle() property has been changed from 12 to 20 degrees to match removed Prs3d_Drawer::HLRAngle(), previously used as input for triangulation algorithm.
1912
1913 @subsection upgrade_750_hlrprs Changes in HLR presentation API
1914
1915 Methods computing HLR presentation within *PrsMgr_PresentableObject::Compute()* have been renamed to *PrsMgr_PresentableObject::computeHLR()*
1916 and now accept *Graphic3d_Camera* object instead of removed *Prs3d_Projector*.
1917
1918 @subsection upgrade_750_dimensions Dimension and Relation presentations moved from AIS to PrsDim
1919
1920 Presentation classes displaying Dimensions and Relations have been moved from *AIS* package to *PrsDim*.
1921 Corresponding classes should be renamed in application code (like *AIS_LengthDimension* -> *PrsDim_LengthDimension*).
1922
1923 @subsection upgrade_750_sensitiveEntity Select3D_SensitiveEntity interface change
1924
1925 The method Select3D_SensitiveEntity::NbSubElements() has been changed to be constant. Select3D_SensitiveEntity subclasses at application level should be updated accordingly.
1926
1927
1928 @subsection upgrade_750_Booleans Changes in Boolean operations algorithm
1929
1930 * TreatCompound method has been moved from *BOPAlgo_Tools* to *BOPTools_AlgoTools*. Additionally, the map parameter became optional:
1931 ~~~~{.cpp}
1932 void BOPTools_AlgoTools::TreatCompound (const TopoDS_Shape& theS,
1933                                         TopTools_ListOfShape& theLS,
1934                                         TopTools_MapOfShape* theMap = NULL);
1935 ~~~~
1936
1937 @subsection upgrade_750_Adaptor2d_OffsetCurve  Offset direction change
1938
1939 Offset direction, which used in class Adaptor2d_OffsetCurve for evaluating values and derivatives of offset curve is unified for offset direction used in class Geom2d_OffsetCurve: now offset direction points to outer ("right") side of base curve instead of the previously used inner ("left") side. Old usage of class in any application should be changed something like that:
1940
1941 Adaptor2d_OffsetCurve aOC(BaseCurve, Offset) --> Adaptor2d_OffsetCurve aOC(BaseCurve, -Offset)
1942
1943 @subsection upgrade_750_ProgressIndicator Change of progress indication API
1944
1945 The progress indication mechanism has been revised to eliminate its weak points in 
1946 previous design (leading to implementation mistakes).
1947 Redesign also allows using progress indicator in multi-threaded algorithms 
1948 in more straight-forward way with minimal overhead.
1949 Note however, that multi-threaded algorithm should pre-allocate per-task 
1950 progress ranges in advance to ensure thread-safety - 
1951 see examples in documentation of class Message_ProgressScope for details.
1952
1953 Classes Message_ProgressSentry and Message_ProgressScale have been removed.
1954 New classes Message_ProgressScope and Message_ProgressRange should be used as main 
1955 API classes to organize progress indication in the algorithms.
1956 Instances of the class Message_ProgressRange are used to pass the progress capability to
1957 nested levels of the algorithm, and an instance of the class Message_ProgressScope is to
1958 be created (preferably as local variable) to manage progress at each level of the algorithm.
1959 The instance of Message_ProgressIndicator is not passed anymore to sub-algorithms.
1960 See documentation of the class Message_ProgressScope for more details and examples.
1961
1962 Methods to deal with progress scopes and to advance progress are removed from class 
1963 Message_ProgressIndicator; now it only provides interface to the application-level progress indicator.
1964 Virtual method Message_ProgressIndicator::Show() has changed its signature and should be 
1965 updated accordingly in descendants of Message_ProgressIndicator.
1966 The scope passed as argument to this method can be used to obtain information on context 
1967 of the current process (instead of calling method GetScope() in previous implementation).
1968 Methods Show(), UserBreak(), and Reset() are made protected in class Message_ProgressIndicator; 
1969 methods More() or UserBreak() of classes Message_ProgressScope or Message_ProgressRange should 
1970 be used to know if the cancel event has come.
1971 See documentation of the class Message_ProgressIndicator for more details and implementation 
1972 of Draw_ProgressIndicator for an example.
1973
1974 Let's take a look onto typical algorithm using an old API:
1975 @code
1976 class MyAlgo
1977 {
1978 public:
1979   //! Algorithm entry point taking an optional Progress Indicator.
1980   bool Perform (const TCollection_AsciiString& theFileName,
1981                 const Handle(Message_ProgressIndicator)& theProgress = Handle(Message_ProgressIndicator)())
1982   {
1983     Message_ProgressSentry aPSentry (theProgress, (TCollection_AsciiString("Processing ") + theFileName).ToCString(), 2);
1984     {
1985       Message_ProgressSentry aPSentry1 (theProgress, "Stage 1", 0, 153, 1);
1986       for (int anIter = 0; anIter < 153; ++anIter, aPSentry1.Next())
1987       { 
1988         if (!aPSentry1.More()) { return false; } 
1989         // do some job here...
1990       }
1991     }
1992     aPSentry.Next();
1993     {
1994       perform2 (theProgress);
1995     }
1996     aPSentry.Next();
1997     bool wasAborted = !theProgress.IsNull() && theProgress->UserBreak();
1998     return !wasAborted;
1999   }
2000
2001 private:
2002   //! Nested sub-algorithm taking Progress Indicator.
2003   bool perform2 (const Handle(Message_ProgressIndicator)& theProgress)
2004   {
2005     Message_ProgressSentry aPSentry2 (theProgress, "Stage 2", 0, 100, 1);
2006     for (int anIter = 0; anIter < 100 && aPSentry2.More(); ++anIter, aPSentry2.Next()) {}
2007     return !aPSentry2.UserBreak();
2008   }
2009 };
2010
2011 // application executing an algorithm
2012 Handle(Message_ProgressIndicator) aProgress = new MyProgress();
2013 MyAlgo anAlgo;
2014 anAlgo.Perform ("FileName", aProgress);
2015 @endcode
2016
2017 The following guidance can be used to update such code:
2018 - Replace `const Handle(Message_ProgressIndicator)&` with `const Message_ProgressRange&` 
2019   in arguments of the methods that support progress indication.
2020   Message_ProgressIndicator object should be now created only at place where application starts algorithms.
2021 - Replace `Message_ProgressSentry` with `Message_ProgressScope`.
2022   Take note that Message_ProgressScope has less arguments (no "minimal value").
2023   In other aspects, Message_ProgressScope mimics an iterator-style interface 
2024   (with methods More() and Next()) close to the old Message_ProgressSentry (pay attention 
2025   to extra functionality of Message_ProgressScope::Next() method below).
2026   Note that method Message_ProgressScope::Close() is equivalent of the method 
2027   Relieve() of Message_ProgressSentry in previous version.
2028   Class Message_ProgressSentry is still defined (marked as deprecated) providing
2029   API more close to old one, and can be still used to reduce porting efforts.
2030 - Each Message_ProgressScope should take the next Range object to work with.
2031   Within old API, Message_ProgressSentry received the root Progress Indicator 
2032   object which maintained the sequence of ranges internally.
2033   Message_ProgressScope in new API takes Message_ProgressRange, which should be
2034   returned by Message_ProgressScope::Next() method of the parent scope.
2035   Do not use the same Range passed to the algorithm for all sub-Scopes like 
2036   it was possible in old API; each range object may be used only once.
2037
2038 Take a look onto ported code and compare with code above to see differences:
2039
2040 @code
2041 class MyAlgo
2042 {
2043 public:
2044   //! Algorithm entry point taking an optional Progress Range.
2045   bool Perform (const TCollection_AsciiString& theFileName,
2046                 const Message_ProgressRange& theProgress = Message_ProgressRange())
2047   {
2048     Message_ProgressScope aPSentry (theProgress, TCollection_AsciiString("Processing ") + theFileName, 2);
2049     {
2050       Message_ProgressScope aPSentry1 (aPSentry.Next(), "Stage 1", 153);
2051       for (int anIter = 0; anIter < 153; ++anIter, aPSentry1.Next())
2052       { 
2053         if (!aPSentry1.More()) { return false; };
2054         // do some job here...
2055       }
2056     }
2057     {
2058       perform2 (aPSentry.Next());
2059     }
2060     bool wasAborted = aPSentry.UserBreak();
2061     return !wasAborted;
2062   }
2063
2064   //! Nested sub-algorithm taking Progress sub-Range.
2065   bool perform2 (const Message_ProgressRange& theProgress)
2066   {
2067     Message_ProgressScope aPSentry2 (theProgress, "Stage 2", 100);
2068     for (int anIter = 0; anIter < 100 && aPSentry2.More(); ++anIter, aPSentry2.Next()) {}
2069     return !aPSentry2.UserBreak();
2070   }
2071 };
2072
2073 // application executing an algorithm
2074 Handle(Message_ProgressIndicator) aProgress = new MyProgress();
2075 MyAlgo anAlgo;
2076 anAlgo.Perform ("FileName", aProgress->Start());
2077 @endcode
2078
2079 @subsection upgrade_750_message_messenger Message_Messenger interface change
2080
2081 Operators << with left argument *Handle(Message_Messenger)*, used to output messages with
2082 a stream-like interface,  have been removed.
2083 This functionality is provided now by separate class *Message_Messenger::StreamBuffer*.
2084 That class contains a stringstream buffer which can be filled using standard stream
2085 operators. The string is sent to a messenger on destruction of the buffer object,
2086 call of its method Flush(), or using operator << with one of ostream manipulators 
2087 (*std::endl, std::flush, std::ends*). Manipulator *Message_EndLine* has been removed,
2088 *std::endl* should be used instead.
2089
2090 New methods *SendFail(), SendAlarm(), SendWarning(), SendInfo()*, and *SendTrace()* are
2091 provided in both *Message_Messenger* class and as static functions in *Message* package
2092 (short-cuts to default messenger), returning buffer object for the output of
2093 corresponding type of the message.
2094
2095 The code that used operator << for messenger, should be ported as follows.
2096
2097 Before the change:
2098 ~~~~{.cpp}
2099   Handle(Message_Messenger) theMessenger = ...;
2100   theMessenger << "Value = " << anInteger << Message_EndLine;
2101 ~~~~
2102
2103 After the change, single-line variant:
2104 ~~~~{.cpp}
2105   Handle(Message_Messenger) theMessenger = ...;
2106   theMessenger->SendInfo() << "Value = " << anInteger << std::endl;
2107 ~~~~
2108
2109 After the change, extended variant:
2110 ~~~~{.cpp}
2111   Handle(Message_Messenger) theMessenger = ...;
2112   Message_Messenger::StreamBuffer aSender = theMessenger->SendInfo();
2113   aSender << "Array: [ ";
2114   for (int i = 0; i < aNb; ++i) { aSender << anArray[i] << " "; }
2115   aSender << "]" << std::endl; // aSender can be used further for other messages
2116 ~~~~
2117
2118 @subsection upgrade_750_message_printer Message_Printer interface change
2119
2120 Previously, sub-classes of *Message_Printer* have to provide a triplet of *Message_Printer::Send()* methods accepting different string representations: TCollection_AsciiString, TCollection_ExtendedString and Standard_CString.
2121 *Message_Printer* interface has been changed, so that sub-classes now have to implement only single method *Message_Printer::send()* accepting TCollection_AsciiString argument and having no Endl flag, which has been removed.
2122 Old three Message_Printer::Send() methods remain defined virtual with unused last argument and redirecting to new send() method by default.
2123
2124 @subsection upgrade_750_prd3d_root Prs3d_Root deprecation
2125
2126 Redundant class Prs3d_Root has been marked as deprecated - Prs3d_Presentation::NewGroup() should be called directly.
2127
2128 @subsection upgrade_750_cdf_session Support of multiple OCAF application instances
2129
2130 Class *CDF_Session* has been removed.
2131 That class was used to store global instance of OCAF application (object of class *CDM_Application* or descendant, typically *TDataStd_Application*).
2132 Global directory of all opened OCAF documents has been removed as well; such directory is maintained now by each instance of the *CDM_Application* class.
2133
2134 This allows creating programs that work with different OCAF documents concurrently in parallel threads,
2135 provided that each thread deals with its own instance of *TDataStd_Application* and documents managed by this instance.
2136
2137 Note that neither *TDataStd_Application* nor *TDocStd_Document* is protected from concurrent access from several threads.
2138 Such protection, if necessary, shall be implemented on the application level.
2139 For an example, access to labels and attributes could be protected by mutex if there is a probability that different threads access the same labels / attributes:
2140 ~~~~{.cpp}
2141   {
2142     Standard_Mutex::Sentry aSentry (myMainLabelAccess);
2143     TDF_Label aChildLab = aDocument->Main().NewChild();
2144     TDataStd_Integer::Set(aChildLab, 0);
2145   }
2146 ~~~~
2147
2148 @subsection upgrade_750_draw_hotkeys Draw Harness hotkeys
2149
2150 Draw Harness hotkeys **W** (Wireframe) and **S** (Shaded) have been re-mapped to **Ctrl+W** and **Ctrl+S**.
2151 Hotkey **A** has been remapped to **Backspace**.
2152 Hotkeys WASD and Arrays are now mapped for walk-through navigation in 3D Viewer.
2153
2154 @subsection upgrade_750_msgfile_utf8 Utf-8 encoding for message files
2155
2156 Message files (with extension .msg) are now expected to be in UTF-8 encoding (unless they have UTF-16 BOM in which case UTF-16 is expected).
2157 This allows using arbitrary Unicode symbols for localization of messages.
2158
2159 Existing message files containing 8-bit characters (previously interpreted as characters from Latin-1 code block) should be converted to UTF-8.
2160
2161 @section upgrade_occt760 Upgrade to OCCT 7.6.0
2162
2163 @subsection upgrade_760_handle_adaptors Simplification of surface/curve adaptor
2164
2165 Interfaces *Adaptor2d_Curve2d*, *Adaptor3d_Curve* and *Adaptor3d_Surface* now inherit Standard_Transient and can be Handle-managed.
2166 No more necessary parallel hiererchy of classes *Adaptor2d_HCurve2d*, *Adaptor3d_HCurve* and *Adaptor3d_HSurface* (generated from generic templates by WOK) has been eliminated.
2167 Existing code using old Handle classes should be updated to:
2168 * Rename occurrences of old names (remove H suffix); upgrade.bat could be used for that purpose.
2169 * Replace redundant calls to previously declared methods .GetCurve2d()/.GetCurve()/.GetSurface() with the common operator->() syntax.
2170 * Pay attention on code calling GetSurface()/GetCurve() methods of removed handle classes. Such places should be replaced with Handle dereference.
2171
2172 @subsection upgrade_760_extendedstring_cout Output of TCollection_ExtendedString to stream
2173
2174 Behavior of the method TCollection_ExtendedString::Print(Standard_OStream&) and corresponding operator << has changed.
2175 Previously it printed all Latin-1 symbols (those in range 0x80-0xff) as '\0' (effectively losing them); symbols above 0xff were converted to hex representation (formatted like XML Numeric Character Reference).
2176 Now all symbols are sent to stream as UTF-8 byte sequences.
2177 Existing code relying on old behavior, if any, shall be rewritten.
2178
2179 @subsection upgrade_760_trimming_surface Trimming surface
2180
2181 Geom_RectangularTrimmedSurface sequentially trimming in U and V directions already no longer loses the first trim.
2182 For example:
2183 ~~~~{.cpp}
2184   Handle(Geom_RectangularTrimmedSurface) ST  = new Geom_RectangularTrimmedSurface (Sbase, u1, u2, Standard_True); // trim along U
2185   Handle(Geom_RectangularTrimmedSurface) ST1 = new Geom_RectangularTrimmedSurface (ST, v1, v2, Standard_False); // trim along V
2186 ~~~~
2187 gives different result.
2188 In current version ST1 - surface trimmed only along V, U trim is removed;
2189 After modification ST1 - surface trimmed along U and V, U trim is kept.
2190
2191 @subsection upgrade_760_storageformatversion Storage format version of OCAF document
2192
2193 The methods *XmlLDrivers::StorageVersion()* and *BinLDrivers::StorageVersion()* were removed.
2194 Since now *TDocStd_Document* manipulates the storage format version of a document for both XML and binary file formats.
2195 For this the methods *StorageFormatVersion()* and *ChangeStorageFormatVersion()* were moved from *CDM_Document* to *TDocStd_Document*.
2196 The methods are used to get and set the storage format version of a document.
2197 A new enumeration *TDocStd_FormatVersion* lists the storage format versions of a document. By default, the document uses the latest (current) storage format version.
2198 In order to save a document in an older storage format version, call the method *ChangeStorageFormatVersion()* with one of the values from the enumeration.
2199 This value will be used by storage drivers of a corresponding OCAF file format (XML or binary) and the document will be saved
2200 following the rules of the specified storage format version (corresponding to an older version of Open CASCADE Technology).
2201 This way an application based on an old version of Open CASCADE Technology may read documents saved by new applications (based on newer version of Open CASCADE Technology).
2202
2203 @subsection upgrade_760_createdocument New OCAF document
2204
2205 A new OCAF document may be created only by means of the method *NewDocument()* from CDF_Application (redefined in TDocStd_Application). The methods *CreateDocument()* are deleted in all retrieval drivers.
2206
2207 @subsection upgrade_760_changesInStorageOfShapes Changes in storage of shapes
2208
2209 Information about per-vertex triangulations normals is now stored in BinOCAF and XmlOCAF document,
2210 BRep and Binary BRep Shape formats (only in case of triangulation-only Faces, with no analytical geometry to restore normals).
2211
2212 Versions of formats have been changed (11 for BinOCAF, 10 for XmlOCAF, 4 for BRep Shape and 3 for Binary BRep Shape).
2213 Files written with the new version will not be readable by applications of old versions.
2214
2215 @subsection upgrade_760_changesBinaryFormat Changes in storage of binary document format
2216
2217 All kinds of binary document formats since the new version 12 saved with support of partial reading (sub-set of labels and sub-set of attributes).
2218 For that the shapes data structures are stored with the related NamedShape attributes in the file, not in the particular section in the start of the document.
2219 Also, size allocated for each label is stored in the file. This allows to skip big parts of document in partial reading mode if needed.
2220
2221 As a result, the new binary files become some smaller, but default reading and writing of documents may take some more time (depenging on the environment), up to 15 percents slower in the worse cases.
2222 Backward compatibility (loading of old documents in the newer version) is still fully supported, as well as writing the older versions of the document.
2223
2224 @subsection upgrade_occt760_poly Changes in *Poly* package and *Poly_Triangulation* class
2225
2226 *Poly_Triangulation* does no more provide access to internal array structures: methods Nodes(), ChangeNode(), Triangles(), ChangeTriangle(), UVNodes(), ChangeUVNode(), Normals() have been removed.
2227 Methods of *Poly_Triangulation* for accessing individual nodal properties / triangles by index and implementing copy semantics should be used instead.
2228 The same is applicable to *Poly_PolygonOnTriangulation* interface.
2229
2230 @subsection upgrade_occt760_glsl Custom GLSL programs
2231
2232 Accessors to standard materials have been modified within *Declarations.glsl* (*occFrontMaterial_Diffuse()* -> *occMaterial_Diffuse(bool)* and similar).
2233 Applications defining custom GLSL programs should take into account syntax changes.
2234
2235 @subsection upgrade_occt760_noral_colors Nodal color modulation
2236
2237 Nodal color vertex attribute is now modulated in the same way as a color texture - color is multiplied by material coefficients (diffuse/ambient/specular in case of a common material definition).
2238 Existing code defining nodal colors should be updated to:
2239 - Use *Graphic3d_TOSM_UNLIT* shading model when lighting is not needed.
2240 - Adjust diffuse/ambient material coefficients, which have been previously ignored.
2241 - Remove code multiplying nodal colors, intended to compensate over-brightness due to addition of specular color from material definition, as specular component is now also modulated by a vertex color.
2242
2243 @subsection upgrade_occt760_tkopengles TKOpenGles library
2244
2245 OCCT now provides two separate toolkits - *TKOpenGl* depending on desktop OpenGL and *TKOpenGles* depending on OpenGL ES.
2246 Both libraries can be now built simultaneously on systems providing both APIs (like desktop Linux).
2247
2248 Existing applications depending on OpenGL ES (mobile projects first of all) should be adjusted to link against *TKOpenGles*.
2249 Note that both *TKOpenGl* and *TKOpenGles* keep exporting classes with the same name, so applications should not attempt to link both libraries simultaneously.
2250
2251 @subsection upgrade_occt760_fast_access_to_labels Fast access to OCAF label
2252
2253 Access to an OCAF label via its entry is accelerated. In order to activate it, call *TDF_Data::SetAccessByEntries()*.
2254 The method *TDF_Tool::Label()*, which returns a label by an entry, becomes faster for about 10 .. 20 times.
2255 It has sense for applications, which use an entry as a unique key to access the data in OCAF tree.
2256 Also, the method *TDF_Tool::Entry()*, which returns an entry for a label, is accelerated as well.
2257
2258 @subsection upgrade_occt760_bop_progress_indicator Progress indicator in Boolean operations
2259
2260 Method SetProgressIndicator() has been removed due to Progress indicator mechanism refactoring.
2261 To enable progress indicator and user break in Boolean operations user has to pass progress range as a parameter to Perform or Build method.
2262 For example:
2263 ~~~~
2264 Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(di, 1);
2265 BRepAlgoApi_Cut(S1, S2, aProgress->Start()); // method Start() creates range for usage in cut algorithm
2266 ~~~~
2267
2268 @subsection upgrade_occt760_change_check_to_adaptors Changes in BRepLib_CheckCurveOnSurface & GeomLib_CheckCurveOnSurface interfaces
2269
2270 Now the classes accept adaptors instead objects as input parameters.
2271 *BRepLib_CheckCurveOnSurface* does no more provide access to curves, surface and parameters: methods PCurve(), PCurve2(), Surface() and Range() have been removed.
2272 *BRepLib_CheckCurveOnSurface*: the default value of the *isMultiThread* parameter of the *Perform()* function has been changed from *true* to *false*
2273 *GeomLib_CheckCurveOnSurface* does no more provide access to curve, surface and parameters: methods Curve(), Surface() and Range() have been removed.
2274 *GeomLib_CheckCurveOnSurface*: the default value of the *isMultiThread* parameter of the *Perform()* function has been changed from *true* to *false*
2275
2276 The following functions in *GeomLib_CheckCurveOnSurface* have been modified:
2277 ~~~~{.cpp}
2278 GeomLib_CheckCurveOnSurface(const Handle(Adaptor3d_Curve)& theCurve,
2279                             const Standard_Real theTolRange);
2280
2281 void Init (const Handle(Adaptor3d_Curve)& theCurve, const Standard_Real theTolRange);
2282
2283 void Perform(const Handle(Adaptor3d_CurveOnSurface)& theCurveOnSurface,
2284              const Standard_Boolean isMultiThread);
2285 ~~~~
2286
2287 @subsection upgrade_occt760_old_bop_removed Removal of old Boolean operations algorithm (BRepAlgo_BooleanOperation)
2288
2289 * The method *BRepAlgo_Tool::Deboucle3D* has been removed as duplicating. The corresponding method from *BRepOffset_Tool* class has to be used instead.
2290 * The API classes from *BRepAlgo* package performing old Boolean operations algorithm have been removed:
2291   - *BRepAlgo_BooleanOperation*
2292   - *BRepAlgo_Fuse*
2293   - *BRepAlgo_Common*
2294   - *BRepAlgo_Cut*
2295   - *BRepAlgo_Section*
2296   The corresponding classes from the *BRepAlgoAPI* package have to be used instead.
2297   
2298 @section upgrade_occt770 Upgrade to OCCT 7.7.0
2299
2300 Building OCCT now requires C++11-compliant compiler, so that some legacy compilers (Visual Studio 2010 and 2012) are no more supported.
2301 It is recommended using Visual Studio 2015 or newer for building OCCT on Windows platform.
2302
2303 @subsection upgrade_770_removed_features Removed features
2304
2305 * One of the constructors of the BRepExtrema_DistanceSS class (the one without deflection parameter) has been removed as excessive. The remaining constructor has to be used instead.
2306
2307 @subsection upgrade_occt770_parallel_flag_removed Removed parameter theIsParallel from Put/Compute/Perform
2308
2309 theIsParallel parameter has been removed from Put/Compute/Perform from the next classes:
2310  - BRepCheck_Analyzer
2311  - BRepCheck_Edge
2312  - BRepLib_ValidateEdge
2313  - GeomLib_CheckCurveOnSurface
2314  - BRepLib_CheckCurveOnSurface
2315
2316 Now, to set this flag, it is necessary to use method SetParallel()
2317 For example:
2318 ~~~~{.cpp}
2319 BRepLib_ValidateEdge aValidateEdge(myHCurve, ACS, SameParameter);
2320 aValidateEdge.SetParallel(toRunParallel);
2321 aValidateEdge.Process();
2322 ~~~~
2323
2324 @subsection upgrade_occt770_drawer_aspects Prs3d_Drawer aspects
2325
2326 `Prs3d_Drawer` getters no more implicitly create "default" aspects.
2327 If specific property has not been set before to this drawer instance nor to linked drawer instance, then NULL property will be returned.
2328 Make sure to set property beforehand or to call `SetOwn*` / `SetupOwn*` methods to derive from defaults.
2329
2330 @subsection upgrade_occt770_opengl OpenGL functions
2331
2332 Applications extending OCCT 3D Viewer and calling OpenGL functions directly (like @c @::glEnable(), e.g. using global namespace) might be affected by changes in `OpenGl_GlFunctions.hxx`.
2333 This header, as well as `OpenGl_GlCore20.hxx` and similar, no more include system OpenGL / OpenGL ES headers to define function table.
2334 Application code calling OpenGL functions directly should be changed to either use `OpenGl_Context::core11fwd` (as designed)
2335 or to include system OpenGL headers in advance (with help of `OpenGl_GlNative.hxx`).
2336
2337 @subsection upgrade_occt770_tooltriangulatedshape StdPrs_ToolTriangulatedShape
2338
2339 Method `StdPrs_ToolTriangulatedShape::Normal()` has been removed.
2340 Please use `BRepLib_ToolTriangulatedShape::ComputeNormals()` to fill in normal attributes in triangulation and fetch them directly using `Poly_Triangulation::Normal()`.
2341
2342 @subsection upgrade_occt770_shapeproximity BRepExtrema_ShapeProximity
2343
2344 A new way of using the `BRepExtrema_ShapeProximity` class was provided for computing a proximity value between two shapes.
2345 If at initialization of the `BRepExtrema_ShapeProximity` class the *theTolerance* parameter is not defined (Precision::Infinite() by default), the proximity value will be computed.
2346
2347 @section upgrade_occt780 Upgrade to OCCT 7.8.0
2348
2349 @subsection upgrade_780_recommendations New Features and Recommendations
2350
2351 The NCollection containers have been modernized to work with move semantics through the new `Move operator` and `Move constructor`. It is recommended to leverage this functionality in the development process.<br />
2352 Backward compatibility with STL allocators has been implemented to use the OCCT memory manager with STL allocators (NCollection_Allocator, NCollection_OccAllocator).<br />
2353 Additionally, utilities have been introduced to work with `shared_ptr` and `unique_ptr` using the OCCT memory manager (`Standard_MemoryUtils.hxx`).
2354
2355 @subsection upgrade_780_ncollection_update Change in Default Clear Behavior for Containers
2356
2357 NCollection container's `Clear(const bool theReleaseMemory = true)` have been changed to `Clear(const bool theReleaseMemory = false)`.<br />
2358 Impacted classes include `IndexedMap`, `IndexedDataMap`, `Map`, `DataMap`, `DynamicArray(Vector)`, `IncAllocator`.<br />
2359 This means that allocated memory for the container will be reused. In this case, it's necessary to be careful with `IncAllocator::Reset()` to control owners of memory blocks.
2360
2361 @subsection upgrade_780_hash_utils Reworked Hash Mechanism for Hash Map (NCollection's map)
2362
2363 The `HashCode(value, upperBound)` static method has been removed and `IsEqual(value1, value2)` is no longer used in the map.<br />
2364 NCollection's map now operates on an STL-like hash mechanism: a struct with a public operator `size_t operator()(object&) const` and `bool operator(object&, object&) const`.<br />
2365 The difference between STL and OCCT is that the hash struct and comparator are combined into a single struct to reduce conflicts on OCCT's user side.<br />
2366 Hash utils have been implemented to hash objects, returning `uint32_t` and `uint64_t` depending on the template (`Standard_HashUtils.hxx`). Algorithms used are `MurmurHash` and `FNVHash`.<br />
2367 Benefits:
2368 * x64 using 8 bytes to store the hash instead of 4 bytes.
2369 * OCCT classes will now be usable as elements in STL `unordered_map` and `unordered_set`.
2370
2371 The migration problem will occur at compile time. Make sure that `int HashCode` has been changed anywhere to `size operator` and `bool IsEqual` to `bool operator`.
2372
2373 @subsection upgrade_780_removed_files Removed Hash Specialization Classes
2374
2375 The majority of include files containing only specialized hashes have been removed.
2376 Their functionality has been consolidated into the hashed object include file (in the "std" namespace).<br />
2377 It is guaranteed that each removed hash class has been transferred to the native hash mechanism of the hashed class.
2378
2379 The migration problem may arise at compile time. Ensure that you remove any files that have been deprecated.
2380
2381 @subsection upgrade_780_tk_rework Reorganized DE TK
2382
2383 DE TK components have been combined or separated based on specific CAD formats to support plug-in ability.
2384 * Components now have a "TKDE" prefix. The available list includes `TKDESTEP`, `TKDEOBJ`, `TKDEIGES`, `TKDEGLTF`, `TKDEVRML`, `TKDEPLY`, `TKDESTL`.
2385 * The DE DRAW TK has been updated in a similar way: DRAW components now have a "TKXSDRAW" prefix. The available list includes `TKXSDRAWSTEP`, `TKXSDRAWOBJ`, `TKXSDRAWIGES`, `TKXSDRAWGLTF`, `TKXSDRAWVRML`, `TKXSDRAWPLY`, `TKXSDRAWSTL`.
2386
2387 Migration problems may occur during configuration time or compile time. Ensure that you update your project configuration accordingly.
2388
2389 @subsection upgrade_780_step_thread_safety Implemented STEP Thread-safety Interface
2390
2391 The STEP interface now uses Static_Interface to extract exchange settings.<br />
2392 A new ability has been implemented to determine parameters in STEP, avoiding Static_Interface.
2393 * For reading, use an additional argument with STEP's parameters in `ReadFile` or `Perform`.
2394 * For writing, use an additional argument with STEP's parameters in `Transfer` or `Perform`.
2395
2396 @subsection upgrade_780_new_memory_manager New Memory Management Functionality
2397
2398 `Standard.hxx` has a new method `AllocateOptimal` for allocating without post-processing (cleaning).<br />
2399 New profiles to allocate memory (defined at configuration time):
2400 * `Native` - allocates with standard `malloc` and `calloc` functionality, performance depends on the OS.
2401 * `TBB` - allocates with TBB's `scalable` allocator functionality.
2402 * `JeMalloc` - allocates with `jemalloc` functions.
2403 * `Flexible` - old-way allocation which defines allocation method in real-time by environment variables.<br />
2404
2405 The most recommended manager is `JeMalloc`. To use it with a plugin system, like `DRAW`, please ensure that JeMalloc was built with the `--disable-initial-exec-tls` flag. For more details, visit [JeMalloc](http://jemalloc.net/).
2406
2407 @subsection upgrade_780_optimization_profiles New CMake Variable for Optimization Profiles
2408
2409 `BUILD_OPT_PROFILE` is a new variable to define optimization level. Available profiles:
2410 * `Default` - specializes only in quality-dependent parameters for the compiler.
2411 * `Production` - specializes in performance and quality-dependent parameters for the compiler and linker.