#include <OSD_Environment.hxx>
#include <Precision.hxx>
#include <SelectMgr_ViewerSelector.hxx>
-#include <SelectMgr_CompareResults.hxx>
#include <SelectBasics_EntityOwner.hxx>
#include <SelectBasics_SensitiveEntity.hxx>
#include <SelectBasics_PickResult.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_SortCriterion.hxx>
#include <SelectMgr_SensitiveEntitySet.hxx>
-#include <SortTools_QuickSortOfInteger.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_ListOfInteger.hxx>
-IMPLEMENT_STANDARD_HANDLE (SelectMgr_ViewerSelector, MMgt_TShared)
-IMPLEMENT_STANDARD_RTTIEXT(SelectMgr_ViewerSelector, MMgt_TShared)
+#include <algorithm>
+
+namespace {
+ // Comparison operator for sorting selection results
+ class CompareResults
+ {
+ public:
+
+ CompareResults (const SelectMgr_IndexedDataMapOfOwnerCriterion& aMapOfCriterion)
+ : myMapOfCriterion (aMapOfCriterion)
+ {
+ }
+
+ Standard_Boolean operator() (Standard_Integer theLeft, Standard_Integer theRight) const
+ {
+ return myMapOfCriterion.FindFromIndex(theLeft) > myMapOfCriterion.FindFromIndex(theRight);
+ }
+
+ private:
+ void operator = (const CompareResults&);
+
+ private:
+ const SelectMgr_IndexedDataMapOfOwnerCriterion& myMapOfCriterion;
+ };
+}
//=======================================================================
// function: SelectMgr_ToleranceMap
const Standard_Integer theEntityIdx,
SelectMgr_SelectingVolumeManager& theMgr)
{
- const Handle(SelectMgr_EntityOwner)& anOwner =
- Handle(SelectMgr_EntityOwner)::DownCast (theEntity->OwnerId());
+ Handle(SelectMgr_EntityOwner) anOwner (Handle(SelectMgr_EntityOwner)::DownCast (theEntity->OwnerId()));
SelectBasics_PickResult aPickResult;
if (theEntity->Matches (theMgr, aPickResult))
{
Standard_Integer RankInMap = myIndexes->Value (myCurRank);
const Handle(SelectBasics_EntityOwner)& toto = mystored.FindKey(RankInMap);
- Handle(SelectMgr_EntityOwner) Ownr = *((Handle(SelectMgr_EntityOwner)*) &toto);
+ Handle(SelectMgr_EntityOwner) Ownr = Handle(SelectMgr_EntityOwner)::DownCast (toto);
return Ownr;
}
if(More()){
Standard_Integer RankInMap = myIndexes->Value (myIndexes->Lower());
const Handle(SelectBasics_EntityOwner)& toto = mystored.FindKey(RankInMap);
- Handle(SelectMgr_EntityOwner) Ownr = *((Handle(SelectMgr_EntityOwner)*) &toto);
+ Handle(SelectMgr_EntityOwner) Ownr = Handle(SelectMgr_EntityOwner)::DownCast (toto);
return Ownr;
}
for (I=1; I <= anExtent; I++)
thearr(I)=I;
- SortTools_QuickSortOfInteger::Sort (thearr,
- SelectMgr_CompareResults(mystored));
+ std::sort (thearr.begin(), thearr.end(), CompareResults (mystored));
+
}
//=======================================================================