0031456: Visualization - move out Dimensions and Relations from package AIS to PrsDims
[occt.git] / dox / dev_guides / upgrade / upgrade.md
index 1846d04..9f70d21 100644 (file)
@@ -439,7 +439,7 @@ class TColStd_Array1OfReal; -> #include <TColStd_Array1OfReal.hxx>
 ~~~~~
 Handle_Class -> Handle(Class)
 ~~~~~
-  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 http://doc.qt.io/qt-4.8/signalsandslots.html).
+  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).
   The file is considered as defining a Qt object if it contains strings *Q_OBJECT* and either *slots:* or *signals:*. 
 
 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:
@@ -736,9 +736,9 @@ If you like to preserve the compatibility of your application code with OCCT ver
 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.
 This is a non-trivial effort; the required actions would depend strongly on the structure of the code and used CDL features.
 
-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](http://git.dev.opencascade.org/gitweb/?p=occt-wok.git;a=log;h=refs/heads/CR0_700_2).
+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).
 
-[Contact us](http://www.opencascade.com/contact/) if you need more help.
+[Contact us](https://www.opencascade.com/contact/) if you need more help.
 
 @subsection upgrade_occt700_bspline Separation of BSpline cache
 
@@ -1584,10 +1584,6 @@ To use the custom printer in OCAF, it can be either added to default messenger o
 @subsection upgrade_740_BRepPrimAPI_MakeRevol Changes in BRepPrimAPI_MakeRevol algorithm
 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.
 
-@subsection upgrade_740_extremaalgo Changes in behavior of Extrema algorithms
-
-Since OCCT 7.4.0 exception is thrown on the attempt of taking points in case of infinite number of solution (IsParallel status). Request of distances is available as before. Method NbExt() always returns 1 in such cases. 
-
 @subsection upgrade_740_removed Removed features
 * The following methods of the class *BRepAlgoAPI_BooleanOperation* have been removed as obsolete or replaced:
   - *BuilderCanWork* can be replaced with *IsDone* or *HasErrors* method.
@@ -1716,6 +1712,75 @@ aGroup->SetPrimitivesAspect (myDrawer->LineAspect()->Aspect()); //!< next array
 aGroup->AddPrimitiveArray (aLines);
 ~~~~
 
+@subsection upgrade_740_materials Material definition
+
+Decomposition of Ambient, Diffuse, Specular and Emissive properties has been eliminated within *Graphic3d_MaterialAspect* definition.
+As result, the following methods of *Graphic3d_MaterialAspect* class have been removed: SetReflectionMode(), SetReflectionModeOn(), Ambient(), Diffuse(), Emissive(), Specular(), SetAmbient(), SetDiffuse(), SetSpecular(), SetEmissive().
+
+Previously, computation of final value required the following code:
+~~~~
+Graphic3d_MaterialAspect theMaterial; Quantity_Color theInteriorColor;
+Graphic3d_Vec3 anAmbient (0.0f);
+if (theMaterial.ReflectionMode (Graphic3d_TOR_AMBIENT))
+{
+  anAmbient = theMaterial.MaterialType (Graphic3d_MATERIAL_ASPECT)
+            ? (Graphic3d_Vec3 )theInteriorColor           * theMaterial.Ambient()
+            : (Graphic3d_Vec3 )theMaterial.AmbientColor() * theMaterial.Ambient();
+}
+~~~~
+
+New code looks like this:
+~~~~
+Graphic3d_MaterialAspect theMaterial; Quantity_Color theInteriorColor;
+Graphic3d_Vec3 anAmbient = theMaterial.AmbientColor();
+if (theMaterial.MaterialType (Graphic3d_MATERIAL_ASPECT)) { anAmbient *= (Graphic3d_Vec3 )theInteriorColor; }
+~~~~
+
+Existing code should be updated to:
+- Replace Graphic3d_MaterialAspect::SetReflectionModeOff() with setting black color; SetReflectionModeOn() calls can be simply removed.
+  R.g. theMaterial.SetAmbientColor(Quantity_NOC_BLACK).
+- Replace Graphic3d_MaterialAspect::Ambient(), SetAmbient(), Diffuse(), SetDiffuse(), Specular(), SetSpecular(), Emissive(), SetEmissive() with methods working with pre-multiplied color.
+  E.g. theMaterial.SetAmbientColor(Graphic3d_Vec3 (1.0f, 0.0f, 0.0f) * 0.2f).
+- Avoid using Graphic3d_MaterialAspect::Color() and SetColor() with non-physical materials (Graphic3d_MATERIAL_ASPECT).
+  These materials do not include color definition, because it is taken from Graphic3d_Aspects::InteriorColor() - this has not been changed.
+  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);
+  now SetColor() explicitly ignores call for Graphic3d_MATERIAL_ASPECT materials and Color() returns DiffuseColor() multiplication coefficients.
+
+@subsection upgrade_740_text Changes in Graphic3d_Text and OpenGl_Text API
+
+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*.
+
+The previous code:
+~~~~
+Standard_Real x, y, z;
+theAttachmentPoint.Coord(x,y,z);
+theGroup->Text (theText,
+                Graphic3d_Vertex(x,y,z),
+                theAspect->Height(),
+                theAspect->Angle(),
+                theAspect->Orientation(),
+                theAspect->HorizontalJustification(),
+                theAspect->VerticalJustification());
+~~~~
+should be replaced by the new code:
+~~~~
+Handle(Graphic3d_Text) aText = new Graphic3d_Text (theAspect->Height());
+aText->SetText (theText.ToExtString());
+aText->SetPosition (theAttachmentPoint);
+aText->SetHorizontalAlignment (theAspect->HorizontalJustification());
+aText->SetVerticalAlignment (theAspect->VerticalJustification());
+theGroup->AddText (aText);
+~~~~
+
+*OpenGl_Text* contains *Graphic3d_Text* field.
+
+*OpenGl_TextParam* struct is removed. Constructor and *Init* of *OpenGl_Text* with *OpenGl_TextParam* are also removed.
+Instead of using them, change *OpenGl_Text*.
+
+Please, note, that after modifying *OpenGl_Text*, *Reset* of *OpenGl_Text* should be called.
+
+*FormatParams* of *OpenGl_Text* is replaced by *Text*.
+
 @subsection upgrade_740_prsupdate Presentation invalidation
 
 Historically AIS_InteractiveObject provided two independent mechanisms invalidating presentation (asking presentation manager to recompute specific display mode or all modes):
@@ -1738,8 +1803,124 @@ or updating presentation without recomputation (see *AIS_InteractiveObject::Sync
 * *Aspect_IS_HIDDENLINE* does not implicitly enables drawing mesh edges anymore.
   Specify Graphic3d_AspectFillArea3d::SetDrawEdges(true) with Graphic3d_AspectFillArea3d::SetInteriorStyle(Aspect_IS_HIDDENLINE) to get previous behavior of Aspect_IS_HIDDENLINE style.
 
+@subsection upgrade_740_modedprs PrsMgr and SelectMgr hierarchy clean up
+
+Proxy classes *Prs3d_Presentation*, *PrsMgr_ModedPresentation* and *PrsMgr_Prs* have been removed.
+Code iterating through the list of low-level structures AIS_InteractiveObject::Presentations() should be updated to access PrsMgr_Presentation directly.
+Forward declarations of *Prs3d_Presentation* should be corrected, since it is now a typedef to *Graphic3d_Structure*.
+
+Proxy classes *SelectBasics_SensitiveEntity* and *SelectBasics_EntityOwner* have been removed - *Select3D_SensitiveEntity* and *SelectMgr_EntityOwner* should be now used directly instead.
+
+@subsection upgrade_740_offset Polygon offset defaults
+
+*Graphic3d_PolygonOffset* default constructor has been corrected to define Units=1 instead of Units=0.
+Default polygon offset settings Mode=Aspect_POM_Fill + Factor=1 + Units=1 are intended to push triangulation
+(Shaded presentation) a little bit behind of lines (Wireframe and Face Edges)
+for reducing z-fighting effect of Shaded+Wireframe combination.
+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).
+
+Application observing unexpected visual difference on this change should consider customizing this property within AIS_InteractiveContext default attributes
+or on per-presentation basis via *Graphic3d_Aspects::SetPolygonOffset()* methods.
+
+@subsection upgrade_740_zlayer Adding ZLayers in given position
+
+Interface of insertion ZLayer in the viewer has been improved with ability to insert new layer before or after existing one.
+Previously undocumented behavior of *V3d_Viewer::AddZlayer()* method has been corrected to insert new layer before *Graphic3d_ZLayerId_Top*.
+Applications might need revising their custom layers creation code and specify precisely their order with new methods *V3d_Viewer::InsertLayerBefore()* and *V3d_Viewer::InsertLayerAfter()*.
+
+@subsection upgrade_740_enum_changed Modified enumerations
+
+Applications using integer values of the following enumerations in persistence
+should be corrected as these enumerations have been modified:
+
+| Name |
+| :----- |
+| AIS_TypeOfAttribute |
+| Aspect_InteriorStyle |
+| Font_FontAspect |
+
 @subsection upgrade_740_geproj Custom defines within env.bat
 
 *env.bat* produced by Visual Studio project generator *genproj.bat* has been modified so that *%CSF_DEFINES%* variable is reset to initial state.
 Custom building environment relying on old behavior and setting extra macros within *%CSF_DEFINES%* before env.bat should be updated
 to either modify custom.bat or setup new variable *%CSF_DEFINES_EXTRA%* instead.
+
+@subsection upgrade_740_BVH_in_BOP Switching Boolean Operations algorithm to use BVH tree instead of UB tree
+
+Since OCCT 7.4.0 Boolean Operations algorithm uses BVH tree instead of UBTree to find the pairs of entities with interfering bounding boxes.
+The following API changes have been made:
+* BOPTools_BoxBndTree and BOPTools_BoxBndTreeSelector have been removed. Use the BOPTools_BoxTree and BOPTools_BoxTreeSelector instead.
+* BOPTools_BoxSelector::SetBox() method now accepts the BVH_Box instead of Bnd_Box.
+* Methods BOPTools_BoxSelector::Reject and BOPTools_BoxSelector::Accept have been removed as unused.
+* 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.
+
+@subsection upgrade_740_stdnamespace Standard_Stream.hxx no more has "using std::" statements
+*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.
+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.
+
+@section upgrade_occt750 Upgrade to OCCT 7.5.0
+
+@subsection upgrade_750_srgb_color RGB color definition
+
+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.
+This change affects texture mapping, material definition and color definition.
+
+Previously *Quantity_Color* definition was provided with unspecified RGB color space.
+In practice, mixed color spaces have been actually used, with non-linear sRGB prevailing in general.
+Since OCCT 7.5.0, *Quantity_Color* now specifies that components are defined in linear RGB color space.
+
+This change affects following parts:
+* Standard colors defined by *Quantity_NameOfColor* enumeration have been converted into linear RGB values within Quantity_Color construction.
+* Application may use new enumeration value *Quantity_TOC_sRGB* for passing/fetching colors in sRGB color space,
+  which can be useful for interoperation with color picking widgets (returning 8-bit integer values within [0..255] range)
+  or for porting colors constants within old application code without manual conversion.
+* *Graphic3d_MaterialAspect* color components are now expected in linear RGB color space,
+  and standard OCCT materials within *Graphic3d_NameOfMaterial* enumeration have been updated accordingly.
+* Texture mapping now handles new *Graphic3d_TextureRoot::IsColorMap()* for interpreting content in linear RGB or sRGB color space.
+  It is responsibility of user specifying this flag correctly. The flag value is TRUE by default.
+* Method *Image_PixMap::PixelColor()* has been extended with a new Boolean flag for performing linearization of non-linear sRGB.
+  This flag is FALSE by default; application should consider passing TRUE instead for further handling *Quantity_Color* properly as linear RGB values.
+
+@subsection upgrade_750_aspectwindow Aspect_Window interface change
+
+Unexpected const-ness of Aspect_Window::DoResize() method has been removed, so that application classes implementing this interface should be updated accordingly.
+
+@subsection upgrade_750_rename Renaming of types
+
+Enumeration BRepOffset_Type is renamed to ChFiDS_TypeOfConcavity.
+
+@subsection upgrade_750_hlrangle Prs3d_Drawer deviation angle
+
+Properties Prs3d_Drawer::HLRAngle() and Prs3d_Drawer::HLRDeviationCoefficient() have been removed from classes *Prs3d_Drawer*, *AIS_Shape* and *AIS_InteractiveContext*.
+Prs3d_Drawer::DeviationAngle() should be now used instead of Prs3d_Drawer::HLRAngle() and Prs3d_Drawer::DeviationCoefficient() instead of Prs3d_Drawer::HLRDeviationCoefficient().
+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.
+
+@subsection upgrade_750_hlrprs Changes in HLR presentation API
+
+Methods computing HLR presentation within *PrsMgr_PresentableObject::Compute()* have been renamed to *PrsMgr_PresentableObject::computeHLR()*
+and now accept *Graphic3d_Camera* object instead of removed *Prs3d_Projector*.
+
+@subsection upgrade_750_dimensions Dimension and Relation presentations moved from AIS to PrsDim
+
+Presentation classes displaying Dimensions and Relations have been moved from *AIS* package to *PrsDim*.
+Corresponding classes should be renamed in application code (like *AIS_LengthDimension* -> *PrsDim_LengthDimension*).
+
+@subsection upgrade_750_sensitiveEntity Select3D_SensitiveEntity interface change
+
+The method Select3D_SensitiveEntity::NbSubElements() has been changed to be constant. Select3D_SensitiveEntity subclasses at application level should be updated accordingly.
+
+
+@subsection upgrade_750_Booleans Changes in Boolean operations algorithm
+
+* TreatCompound method has been moved from *BOPAlgo_Tools* to *BOPTools_AlgoTools*. Additionally, the map parameter became optional:
+~~~~
+void BOPTools_AlgoTools::TreatCompound (const TopoDS_Shape& theS,
+                                        TopTools_ListOfShape& theLS,
+                                        TopTools_MapOfShape* theMap = NULL);
+~~~~
+
+@subsection upgrade_750_Adaptor2d_OffsetCurve  Offset direction change
+
+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:
+
+Adaptor2d_OffsetCurve aOC(BaseCurve, Offset) --> Adaptor2d_OffsetCurve aOC(BaseCurve, -Offset)