From 545fb9af2e7ff2640157173275c0bbacd94537d9 Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 3 Jun 2015 18:26:38 +0300 Subject: [PATCH] Porting on SALOME 7.6.0 --- env_Salome.bat | 16 +-- src/GeomAPI/GeomAPI_AISObject.cpp | 10 +- src/ModuleBase/ModuleBase_ResultPrs.cpp | 1 - src/SketcherPrs/CMakeLists.txt | 1 + src/SketcherPrs/SketcherPrs_Coincident.cpp | 1 - src/SketcherPrs/SketcherPrs_Rigid.cpp | 1 - .../SketcherPrs_SensitivePoint.cpp | 101 ++++-------------- src/SketcherPrs/SketcherPrs_SensitivePoint.h | 48 +++------ src/SketcherPrs/SketcherPrs_SymbolPrs.cpp | 3 - src/SketcherPrs/SketcherPrs_SymbolPrs.h | 4 +- src/XGUI/XGUI_Displayer.cpp | 26 +---- src/XGUI/XGUI_Selection.cpp | 8 +- 12 files changed, 57 insertions(+), 163 deletions(-) diff --git a/env_Salome.bat b/env_Salome.bat index 86b26cfbc..6f145aa30 100644 --- a/env_Salome.bat +++ b/env_Salome.bat @@ -57,20 +57,14 @@ cd %ROOT_DIR% @REM ------------------------- @REM ------------------------- -@REM Create launch path -rem @SET PATH=%LIBXML2_ROOT_DIR%\bin;%PATH% -rem @SET PATH=%PDIR%\tbb\bin;%PATH% -rem @SET PATH=%PDIR%\freeimage-3.15.4\bin;%PATH% -rem @SET PATH=%PDIR%\ftgl-2.1.3\bin;%PATH% -rem @SET PATH=%PDIR%\freetype-2.4.11\bin;%PATH% -rem @SET PATH=%PDIR%\gl2ps-1.3.8\bin;%PATH% -rem @SET PATH=%PDIR%\qwt-5.2.1\lib;%PATH% -rem @SET PATH=%SOLVESPACE_ROOT_DIR%\lib;%PATH% +@SET PYTHONHOME=%PYTHON_ROOT_DIR% +@SET PYTHON_INCLUDE=%PYTHONHOME%\include @REM ------------------------- + @REM ------------------------- -@SET PYTHONHOME=%PYTHON_ROOT_DIR% -@SET PYTHON_INCLUDE=%PYTHONHOME%\include +@REM Some OCCT headers include FREETYPE headers +@SET FREETYPE_DIR=%PDIR%\freetype-2.4.11 @REM ------------------------- @SET PATH=%GEOM_ROOT_DIR%\lib\salome;%PATH% diff --git a/src/GeomAPI/GeomAPI_AISObject.cpp b/src/GeomAPI/GeomAPI_AISObject.cpp index 57d192bba..c09d9a421 100644 --- a/src/GeomAPI/GeomAPI_AISObject.cpp +++ b/src/GeomAPI/GeomAPI_AISObject.cpp @@ -353,8 +353,8 @@ void GeomAPI_AISObject::setPointMarker(int theType, double theScale) { Handle(AIS_InteractiveObject) anAIS = impl(); if (!anAIS.IsNull()) { - Handle(AIS_Drawer) aDrawer = anAIS->Attributes(); - if (aDrawer->HasPointAspect()) { + Handle(Prs3d_Drawer) aDrawer = anAIS->Attributes(); + if (aDrawer->HasOwnPointAspect()) { Handle(Prs3d_PointAspect) aPA = aDrawer->PointAspect(); aPA->SetTypeOfMarker((Aspect_TypeOfMarker)theType); aPA->SetScale(theScale); @@ -370,14 +370,14 @@ bool GeomAPI_AISObject::setLineStyle(int theStyle) bool isChanged = false; Handle(AIS_InteractiveObject) anAIS = impl(); if (!anAIS.IsNull()) { - Handle(AIS_Drawer) aDrawer = anAIS->Attributes(); + Handle(Prs3d_Drawer) aDrawer = anAIS->Attributes(); Handle(Prs3d_LineAspect) aLineAspect; Aspect_TypeOfLine aType = (Aspect_TypeOfLine)theStyle; - if (aDrawer->HasLineAspect()) { + if (aDrawer->HasOwnLineAspect()) { aLineAspect = aDrawer->LineAspect(); } - if (aDrawer->HasWireAspect()) { + if (aDrawer->HasOwnWireAspect()) { aLineAspect = aDrawer->WireAspect(); } Quantity_Color aCurrentColor; diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index 2f85e9a99..211fdde73 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -11,7 +11,6 @@ #include #include -#include #include #include diff --git a/src/SketcherPrs/CMakeLists.txt b/src/SketcherPrs/CMakeLists.txt index fb508fed7..b67e917de 100644 --- a/src/SketcherPrs/CMakeLists.txt +++ b/src/SketcherPrs/CMakeLists.txt @@ -83,6 +83,7 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/GeomDataAPI ${PROJECT_SOURCE_DIR}/src/SketchPlugin ${CAS_INCLUDE_DIRS} + $ENV{FREETYPE_DIR}/include ) TARGET_LINK_LIBRARIES(SketcherPrs ${PROJECT_LIBRARIES}) diff --git a/src/SketcherPrs/SketcherPrs_Coincident.cpp b/src/SketcherPrs/SketcherPrs_Coincident.cpp index 7bd3d30ef..8b533fdba 100644 --- a/src/SketcherPrs/SketcherPrs_Coincident.cpp +++ b/src/SketcherPrs/SketcherPrs_Coincident.cpp @@ -18,7 +18,6 @@ #include -#include #include #include #include diff --git a/src/SketcherPrs/SketcherPrs_Rigid.cpp b/src/SketcherPrs/SketcherPrs_Rigid.cpp index 109d3a687..7ef19eef9 100644 --- a/src/SketcherPrs/SketcherPrs_Rigid.cpp +++ b/src/SketcherPrs/SketcherPrs_Rigid.cpp @@ -17,7 +17,6 @@ #include -#include #include #include diff --git a/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp b/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp index ac89d78a6..f9a49e9d1 100644 --- a/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp +++ b/src/SketcherPrs/SketcherPrs_SensitivePoint.cpp @@ -7,12 +7,10 @@ #include "SketcherPrs_SensitivePoint.h" -#include #include #include #include #include -#include IMPLEMENT_STANDARD_HANDLE(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity); IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity); @@ -22,103 +20,50 @@ SketcherPrs_SensitivePoint::SketcherPrs_SensitivePoint(const Handle(SelectBasics int theId) :Select3D_SensitiveEntity(anOwner), myId(theId), myPntArray(thePntArray) { - SetSensitivityFactor(4.); + SetSensitivityFactor(12.); } -void SketcherPrs_SensitivePoint::Project (const Handle(Select3D_Projector)& aProj) +Standard_Boolean SketcherPrs_SensitivePoint::Matches (SelectBasics_SelectingVolumeManager& theMgr, + SelectBasics_PickResult& thePickResult) { - gp_Pnt2d aPoint2d; - gp_Pnt aPnt = Point(); - if(!HasLocation()) - aProj->Project(aPnt, aPoint2d); - else - { - gp_Pnt aP(aPnt.X(), aPnt.Y(), aPnt.Z()); - aProj->Project(aP.Transformed(Location().Transformation()), aPoint2d); - } - myprojpt = aPoint2d; -} - -void SketcherPrs_SensitivePoint::Areas(SelectBasics_ListOfBox2d& boxes) -{ - Bnd_Box2d abox; - abox.Set(myprojpt); - boxes.Append(abox); -} - -Standard_Boolean SketcherPrs_SensitivePoint::Matches(const SelectBasics_PickArgs& thePickArgs, - Standard_Real& theMatchDMin, - Standard_Real& theMatchDepth) -{ - // check coordinate matching - Standard_Real aDist = gp_Pnt2d (thePickArgs.X(), thePickArgs.Y()).Distance (myprojpt); - if (aDist > thePickArgs.Tolerance() * SensitivityFactor()) - { - return Standard_False; - } - - Standard_Real aDepth = ComputeDepth (thePickArgs.PickLine()); - if (thePickArgs.IsClipped (aDepth)) + Standard_Real aDepth = RealLast(); + Standard_Real aDistToCOG = RealLast(); + gp_Pnt aPnt = myPntArray->Vertice(myId); + if (!theMgr.Overlaps (aPnt, aDepth)) { + thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG); return Standard_False; } - theMatchDMin = aDist; - theMatchDepth = aDepth; + aDistToCOG = aDepth; + thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG); return Standard_True; } -Standard_Boolean SketcherPrs_SensitivePoint::Matches(const Standard_Real XMin, - const Standard_Real YMin, - const Standard_Real XMax, - const Standard_Real YMax, - const Standard_Real aTol) -{ - Bnd_Box2d B; - B.Update(Min(XMin,XMax),Min(YMin,YMax),Max(XMin,XMax),Max(YMin,YMax)); - B.Enlarge(aTol); - return !B.IsOut(myprojpt); -} - -Standard_Boolean SketcherPrs_SensitivePoint::Matches(const TColgp_Array1OfPnt2d& aPoly, - const Bnd_Box2d& aBox, - const Standard_Real aTol) -{ - Standard_Real Umin,Vmin,Umax,Vmax; - aBox.Get(Umin,Vmin,Umax,Vmax); - CSLib_Class2d aClassifier2d(aPoly,aTol,aTol,Umin,Vmin,Umax,Vmax); - - Standard_Integer RES = aClassifier2d.SiDans(myprojpt); - if(RES==1) return Standard_True; - - return Standard_False; -} - gp_Pnt SketcherPrs_SensitivePoint::Point() const { return myPntArray->Vertice(myId); } -Handle(Select3D_SensitiveEntity) SketcherPrs_SensitivePoint::GetConnected(const TopLoc_Location& aLoc) +Handle(Select3D_SensitiveEntity) SketcherPrs_SensitivePoint::GetConnected() { - Handle(SketcherPrs_SensitivePoint) NiouEnt = new SketcherPrs_SensitivePoint(myOwnerId,myPntArray,myId); - if(HasLocation()) NiouEnt->SetLocation(Location()); - NiouEnt->UpdateLocation(aLoc); - return NiouEnt; + Handle(SketcherPrs_SensitivePoint) aNewEntity = new SketcherPrs_SensitivePoint (myOwnerId, myPntArray, myId); + return aNewEntity; } -void SketcherPrs_SensitivePoint::Dump(Standard_OStream& S,const Standard_Boolean /*FullDump*/) const +gp_Pnt SketcherPrs_SensitivePoint::CenterOfGeometry() const { - gp_Pnt aPnt = Point(); - S<<"\tSensitivePoint 3D :"; - if(HasLocation()) - S<<"\t\tExisting Location"<Vertice(myId); + return Select3D_BndBox3d (SelectMgr_Vec3 (aPnt.X(), aPnt.Y(), aPnt.Z()), + SelectMgr_Vec3 (aPnt.X(), aPnt.Y(), aPnt.Z())); } -Standard_Real SketcherPrs_SensitivePoint::ComputeDepth(const gp_Lin& EyeLine) const +Standard_Integer SketcherPrs_SensitivePoint::NbSubElements() { - return ElCLib::Parameter(EyeLine, Point()); + return 1; } diff --git a/src/SketcherPrs/SketcherPrs_SensitivePoint.h b/src/SketcherPrs/SketcherPrs_SensitivePoint.h index ca30fe434..31cad7bb2 100644 --- a/src/SketcherPrs/SketcherPrs_SensitivePoint.h +++ b/src/SketcherPrs/SketcherPrs_SensitivePoint.h @@ -9,7 +9,6 @@ #include #include -#include #include @@ -28,46 +27,33 @@ public: Standard_EXPORT SketcherPrs_SensitivePoint(const Handle(SelectBasics_EntityOwner)& OwnerId, const Handle(Graphic3d_ArrayOfPoints)& thePntArray, int theId); - //! Converts the stored 3D point into a 2D point according - //! to ; this method is called by the selection Manager. - Standard_EXPORT void Project (const Handle(Select3D_Projector)& aProjector) ; - - //! stores in the 2D sensitive box which represents - //! the point area in the selection process. - Standard_EXPORT void Areas (SelectBasics_ListOfBox2d& aresult) ; - + Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE; + //! Update location of the point //! \param aLocation a new location - Standard_EXPORT Handle(Select3D_SensitiveEntity) GetConnected (const TopLoc_Location& aLocation) ; - - //! Checks whether the sensitive entity matches the picking - //! detection area (close to the picking line). - //! For details please refer to base class declaration. - Standard_EXPORT Standard_Boolean Matches (const SelectBasics_PickArgs& thePickArgs, Standard_Real& theMatchDMin, Standard_Real& theMatchDepth) ; - - /// Returns true if the current point is matches with given rectangle - /// \param XMin an X min coordinate - /// \param YMin an Y min coordinate - /// \param XMax an X max coordinate - /// \param YMax an Y max coordinate - /// \param aTol a tolerance - Standard_EXPORT Standard_Boolean Matches (const Standard_Real XMin, const Standard_Real YMin, const Standard_Real XMax, const Standard_Real YMax, const Standard_Real aTol) ; - - Standard_EXPORT virtual Standard_Boolean Matches (const TColgp_Array1OfPnt2d& Polyline, const Bnd_Box2d& aBox, const Standard_Real aTol) ; - - Standard_EXPORT Standard_Real ComputeDepth (const gp_Lin& EyeLine) const; - + Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected() Standard_OVERRIDE; + + //! Checks whether the point overlaps current selecting volume + Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr, + SelectBasics_PickResult& thePickResult) Standard_OVERRIDE; + //! Returns the point used at the time of construction. - Standard_EXPORT gp_Pnt Point() const; + Standard_EXPORT gp_Pnt Point() const; + + //! Returns center of point. If location transformation + //! is set, it will be applied + Standard_EXPORT virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE; - Standard_EXPORT virtual void Dump (Standard_OStream& S, const Standard_Boolean FullDump = Standard_True) const; + //! Returns bounding box of the point. If location + //! transformation is set, it will be applied + Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE; + DEFINE_STANDARD_RTTI(SketcherPrs_SensitivePoint) private: int myId; Handle(Graphic3d_ArrayOfPoints) myPntArray; - Select3D_Pnt2d myprojpt; }; diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp index 224a4b1dc..a039cd119 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -37,8 +36,6 @@ #include #include #include -#include -#include #ifdef WIN32 # define FSEP "\\" diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.h b/src/SketcherPrs/SketcherPrs_SymbolPrs.h index d2202bacf..d03bb437b 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.h +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.h @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include @@ -144,7 +144,7 @@ private: mutable Handle(OpenGl_VertexBuffer) myVboAttribs; - Select3D_SensitiveEntitySequence mySPoints; + Select3D_EntitySequence mySPoints; }; #endif \ No newline at end of file diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index a3d8b3f9f..be4b2cee5 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -47,7 +47,7 @@ const int MOUSE_SENSITIVITY_IN_PIXEL = 10; ///< defines the local context mouse selection sensitivity //#define DEBUG_DISPLAY -//#define DEBUG_ACTIVATE +#define DEBUG_ACTIVATE //#define DEBUG_FEATURE_REDISPLAY //#define DEBUG_SELECTION_FILTERS //#define DEBUG_USE_CLEAR_OUTDATED_SELECTION @@ -149,13 +149,8 @@ void XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS, if (!anAISIO.IsNull()) { appendResultObject(theObject, theAIS); - bool aCanBeShaded = ::canBeShaded(anAISIO); // In order to avoid extra closing/opening context SelectMgr_IndexedMapOfOwner aSelectedOwners; - if (aCanBeShaded) { - myWorkshop->selector()->selection()->selectedOwners(aSelectedOwners); - closeLocalContexts(false); - } aContext->Display(anAISIO, false); aContext->SetDisplayMode(anAISIO, isShading? Shading : Wireframe, false); if (isShading) @@ -166,13 +161,7 @@ void XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS, if (isCustomized) aContext->Redisplay(anAISIO, false); - if (aCanBeShaded) { - openLocalContext(); - activateObjects(myActiveSelectionModes); - myWorkshop->selector()->setSelectedOwners(aSelectedOwners, false); - } - else - activate(anAISIO, myActiveSelectionModes); + activate(anAISIO, myActiveSelectionModes); } if (isUpdateViewer) updateViewer(); @@ -701,21 +690,10 @@ void XGUI_Displayer::setDisplayMode(ObjectPtr theObject, DisplayMode theMode, bo return; Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl(); - bool aCanBeShaded = ::canBeShaded(aAISIO); - // In order to avoid extra closing/opening context SelectMgr_IndexedMapOfOwner aSelectedOwners; - if (aCanBeShaded) { - myWorkshop->selector()->selection()->selectedOwners(aSelectedOwners); - closeLocalContexts(false); - } aContext->SetDisplayMode(aAISIO, theMode, false); // Redisplay in order to update new mode because it could be not computed before aContext->Redisplay(aAISIO, false); - if (aCanBeShaded) { - openLocalContext(); - activateObjects(myActiveSelectionModes); - myWorkshop->selector()->setSelectedOwners(aSelectedOwners, false); - } if (toUpdate) updateViewer(); } diff --git a/src/XGUI/XGUI_Selection.cpp b/src/XGUI/XGUI_Selection.cpp index 3f93b29ac..ea99308aa 100644 --- a/src/XGUI/XGUI_Selection.cpp +++ b/src/XGUI/XGUI_Selection.cpp @@ -14,10 +14,6 @@ #include -#include -#include - -#include #include #include @@ -227,11 +223,11 @@ void XGUI_Selection::entityOwners(const Handle(AIS_InteractiveObject)& theObject Handle(SelectMgr_Selection) aSelection = theObject->Selection(aMode); for (aSelection->Init(); aSelection->More(); aSelection->Next()) { - Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive(); + Handle(SelectMgr_SensitiveEntity) anEntity = aSelection->Sensitive(); if (anEntity.IsNull()) continue; Handle(SelectMgr_EntityOwner) anOwner = - Handle(SelectMgr_EntityOwner)::DownCast(anEntity->OwnerId()); + Handle(SelectMgr_EntityOwner)::DownCast(anEntity->BaseSensitive()->OwnerId()); if (!anOwner.IsNull()) theOwners.Add(anOwner); } -- 2.39.2