From 6a866b326846decf97ff0a1ad5581b3da55e4641 Mon Sep 17 00:00:00 2001 From: kgv Date: Thu, 19 Dec 2013 08:53:37 +0400 Subject: [PATCH] 0024483: Visualization - drop unused class StdSelect_BRepHilighter --- src/StdSelect/StdSelect.cdl | 23 +- src/StdSelect/StdSelect_BRepHilighter.cdl | 101 ------- src/StdSelect/StdSelect_BRepHilighter.cxx | 311 ---------------------- 3 files changed, 3 insertions(+), 432 deletions(-) delete mode 100644 src/StdSelect/StdSelect_BRepHilighter.cdl delete mode 100644 src/StdSelect/StdSelect_BRepHilighter.cxx diff --git a/src/StdSelect/StdSelect.cdl b/src/StdSelect/StdSelect.cdl index 50ca3f1ece..0a5742f424 100644 --- a/src/StdSelect/StdSelect.cdl +++ b/src/StdSelect/StdSelect.cdl @@ -106,33 +106,16 @@ is -- the hilight-unhilight methods are empty and -- must be redefined by each User... + ---Category: Shape Filters - - - ---Category: Some classes... - - - class BRepHilighter; - ---Purpose: manages hilight of picked shapes in a ViewerSelector. - -- to be called after each pick of the selection... - - - - - - - ---Category: Shape Filters - class EdgeFilter; class FaceFilter; class ShapeTypeFilter; - - + ---Category: Private Classes - private class Prs; - + private class Shape; private class IndexedDataMapOfOwnerPrs instantiates IndexedDataMap from TCollection diff --git a/src/StdSelect/StdSelect_BRepHilighter.cdl b/src/StdSelect/StdSelect_BRepHilighter.cdl deleted file mode 100644 index 5bfd67d285..0000000000 --- a/src/StdSelect/StdSelect_BRepHilighter.cdl +++ /dev/null @@ -1,101 +0,0 @@ --- Created on: 1995-03-22 --- Created by: Robert COUBLANC --- Copyright (c) 1995-1999 Matra Datavision --- Copyright (c) 1999-2014 OPEN CASCADE SAS --- --- This file is part of Open CASCADE Technology software library. --- --- This library is free software; you can redistribute it and / or modify it --- under the terms of the GNU Lesser General Public version 2.1 as published --- by the Free Software Foundation, with special exception defined in the file --- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT --- distribution for complete text of the license and disclaimer of any warranty. --- --- Alternatively, this file may be used under the terms of Open CASCADE --- commercial license or contractual agreement. - -class BRepHilighter from StdSelect - - ---Purpose: Tool to manage hilight of BRepOwners during the selection process - -- -> Built with a ViewSelector3d. - -- -> Can hilight all the detected elements at the mouse position or - -- just the closest one. - -- How Use It: - -- TheSelector -> SelectPix (Xmouse,YMouse); - -- TheBRepHilighter->Process (); - -- - -- When good choice - -- - -- toto = TheSelector->LastPicked(); - -uses - NameOfColor from Quantity, - ViewerSelector3d from StdSelect, - Viewer from V3d, - View from V3d, - Drawer from Prs3d, - MapOfInteger from TColStd, - IndexedDataMapOfOwnerPrs, - TypeOfResult from StdSelect, - OStream, - TransientManager from Visual3d -is - - Create returns BRepHilighter; - - Create (aSelector : ViewerSelector3d from StdSelect; - aViewer : Viewer from V3d; - acolor : NameOfColor from Quantity = Quantity_NOC_INDIANRED3; - aType : TypeOfResult from StdSelect = StdSelect_TOR_SIMPLE) - returns BRepHilighter; - - Set(me:in out; aSelector : ViewerSelector3d from StdSelect) is static; - - Set(me:in out; aViewer : Viewer from V3d) is static; - - Set(me:in out; acolor : NameOfColor from Quantity) is static; - - Set(me:in out; atype : TypeOfResult from StdSelect) is static; - - Process(me : in out) is static; - ---Purpose: updates the viewer with the selection. - - Process(me:in out; aView : View from V3d; DoubleBuffer: Boolean = Standard_False) is static; - ---Purpose: updates only the view with the selection. - -- The updating will be made using immediate drawing which is far quicker. - - Clear(me:in out ) is static; - ---Level: Public - ---Purpose: Clears the hilight structures - -- which were created during the selection action; - -- must me called after each selection loop; - -- - - Update(me:in out) is static private; - - Update(me:in out; aView : View from V3d; DoubleBuffer: Boolean = Standard_False) is static private; - - - ---Category: Internal Methods - -- - -- - - Drawer(me) - ---C++: return const & - returns any Drawer from Prs3d; - -fields - - myselector : ViewerSelector3d from StdSelect; - myviewer : Viewer from V3d; - mycolor : NameOfColor from Quantity; - mydrwr : Drawer from Prs3d; - mytype : TypeOfResult from StdSelect; - - myold : MapOfInteger from TColStd; - mynew : MapOfInteger from TColStd; - myhimap : IndexedDataMapOfOwnerPrs; - - mylastindex : Integer; - myManager : TransientManager from Visual3d; -end BRepHilighter; diff --git a/src/StdSelect/StdSelect_BRepHilighter.cxx b/src/StdSelect/StdSelect_BRepHilighter.cxx deleted file mode 100644 index 115fe6de1c..0000000000 --- a/src/StdSelect/StdSelect_BRepHilighter.cxx +++ /dev/null @@ -1,311 +0,0 @@ -// Created on: 1995-03-22 -// Created by: Robert COUBLANC -// Copyright (c) 1995-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and / or modify it -// under the terms of the GNU Lesser General Public version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -static TColStd_MapIteratorOfMapOfInteger it; -static Standard_Boolean ImmediateIsEnable; -static Standard_Boolean ImmediateIsEnableIsDef= Standard_False; -//================================================== -// Function: -// Purpose : -//================================================== - -StdSelect_BRepHilighter:: -StdSelect_BRepHilighter():mylastindex(0) -,myManager(new Visual3d_TransientManager){} - -//================================================== -// Function: -// Purpose : -//================================================== - -StdSelect_BRepHilighter:: -StdSelect_BRepHilighter(const Handle(StdSelect_ViewerSelector3d)& aSelector, - const Handle(V3d_Viewer)& aViewer, - const Quantity_NameOfColor aColor, - const StdSelect_TypeOfResult aTOR): -myselector(aSelector), -myviewer(aViewer), -mycolor(aColor), -mydrwr(new Prs3d_Drawer()), -mytype(aTOR), -mylastindex(0), -myManager(new Visual3d_TransientManager) - -{ - Handle(Prs3d_PointAspect) PA = new Prs3d_PointAspect(Aspect_TOM_O,Quantity_NOC_INDIANRED3,3.); - mydrwr->SetPointAspect(PA); -} -//================================================== -// Function: -// Purpose : -//================================================== - -void StdSelect_BRepHilighter:: -Set(const Handle(StdSelect_ViewerSelector3d)& aSelector) -{myselector=aSelector;} -//================================================== -// Function: -// Purpose : -//================================================== - -void StdSelect_BRepHilighter:: -Set(const StdSelect_TypeOfResult aTOR) -{mytype =aTOR;} - -//================================================== -// Function: Set -// Purpose : -//================================================== - -void StdSelect_BRepHilighter:: -Set(const Handle(V3d_Viewer)& aViewer) -{myviewer=aViewer;} -//================================================== -// Function: -// Purpose : -//================================================== - -void StdSelect_BRepHilighter:: -Set(const Quantity_NameOfColor aColor) -{mycolor=aColor;} -//================================================== -// Function: -// Purpose : -//================================================== -void StdSelect_BRepHilighter:: -Process() -{ - Update(); - myviewer->Update(); -} -//================================================== -// Function: -// Purpose : -//================================================== -void StdSelect_BRepHilighter:: -Process(const Handle(V3d_View)& aViou,const Standard_Boolean DoubleBuffer) -{ - if(aViou->Viewer() == myviewer){ - Update(aViou,DoubleBuffer); -// aViou->Update(); - } -} - -//================================================== -// Function: -// Purpose : -//================================================== - -void StdSelect_BRepHilighter:: -Update() -{ - myselector->Init(); - - switch(mytype){ - case StdSelect_TOR_MULTIPLE:{ - TColStd_MapIteratorOfMapOfInteger aIt; - if(!myselector->More()) - { - for(aIt.Initialize(myold);aIt.More();aIt.Next()) - {myhimap.FindFromIndex(aIt.Key())->UnHighlight(); - myhimap.FindFromIndex(aIt.Key())->SetVisible(Standard_False); - } - myold.Clear(); - mynew.Clear(); - } - else{ - - for (;myselector->More();myselector->Next()) - { - const Handle(SelectBasics_EntityOwner)& OO = myselector->Picked(); - if (!myhimap.Contains(OO)) - { - if(!Handle(StdSelect_BRepOwner)::DownCast(OO).IsNull()){ - Handle(StdSelect_Prs) NiouPrs = new StdSelect_Prs - (myviewer->Viewer()); - - StdPrs_WFShape::Add(NiouPrs, - Handle(StdSelect_BRepOwner)::DownCast(OO)->Shape(), - mydrwr); - NiouPrs->Display(); - myhimap.Add(OO,NiouPrs); - mynew.Add(myhimap.FindIndex(OO)); - if(myold.Contains(myhimap.FindIndex(OO))) - myold.Remove(myhimap.FindIndex(OO)); - } - } - } - for(aIt.Initialize(myold);aIt.More();aIt.Next()){ - myhimap.FindFromIndex(aIt.Key())->UnHighlight(); - myhimap.FindFromIndex(aIt.Key())->SetVisible(Standard_False); - } - - myold = mynew; - mynew.Clear(); - for(aIt.Initialize(myold);aIt.More();aIt.Next()){ - myhimap.FindFromIndex(aIt.Key())->SetVisible(Standard_True); - myhimap.FindFromIndex(aIt.Key())->SetDisplayPriority(10); - myhimap.FindFromIndex(aIt.Key())->Color(mycolor); - } - } - break; - } - - case StdSelect_TOR_SIMPLE: - { - if(myselector->More()){ - const Handle(SelectBasics_EntityOwner)& OO = myselector->OnePicked(); - if(!Handle(StdSelect_BRepOwner)::DownCast(OO).IsNull()){ - if (!myhimap.Contains(OO)){ - Handle(StdSelect_Prs) NiouPrs = new StdSelect_Prs - (myviewer->Viewer()); - StdPrs_WFShape::Add(NiouPrs, - Handle(StdSelect_BRepOwner)::DownCast(OO)->Shape(), - mydrwr); - NiouPrs->Display(); - myhimap.Add(OO,NiouPrs); - } - } - if(mylastindex!=myhimap.FindIndex(OO)) - { - if(mylastindex!=0) - { - myhimap.FindFromIndex(mylastindex)->UnHighlight(); - myhimap.FindFromIndex(mylastindex)->SetVisible(Standard_False); - } - mylastindex = myhimap.FindIndex(OO); - myhimap.FindFromIndex(mylastindex)->SetVisible(Standard_True); - myhimap.FindFromIndex(mylastindex)->SetDisplayPriority(10); - myhimap.FindFromIndex(mylastindex)->Color(mycolor); - } - } - else { - if(mylastindex!=0) - { - myhimap.FindFromIndex(mylastindex)->UnHighlight(); - myhimap.FindFromIndex(mylastindex)->SetVisible(Standard_False); - mylastindex=0; - } - for (it.Initialize(myold);it.More();it.Next()){ - myhimap.FindFromIndex(it.Key())->UnHighlight(); - myhimap.FindFromIndex(it.Key())->SetVisible(Standard_False);} - myold.Clear(); - } - } - } -} - -void StdSelect_BRepHilighter:: -Update(const Handle(V3d_View)& aView,const Standard_Boolean DoubleBuffer) -{ - if(!ImmediateIsEnableIsDef) { - ImmediateIsEnable = aView->TransientManagerBeginDraw(); - ImmediateIsEnableIsDef = Standard_True; - Visual3d_TransientManager::EndDraw(); - } - if(!ImmediateIsEnable) { - Update(); - } - else { - myselector->Init(); - mynew.Clear(); - - switch(mytype){ - case StdSelect_TOR_MULTIPLE:{ - - for (;myselector->More();myselector->Next()) { - const Handle(SelectBasics_EntityOwner)& OO = myselector->Picked(); - if(!Handle(StdSelect_BRepOwner)::DownCast(OO).IsNull()){ - if (!myhimap.Contains(OO)) { - Handle(StdSelect_Prs) NiouPrs = new StdSelect_Prs(myviewer->Viewer()); - - StdPrs_WFShape::Add(NiouPrs,Handle(StdSelect_BRepOwner)::DownCast(OO)->Shape(),mydrwr); - NiouPrs->Color(mycolor); - myhimap.Add(OO,NiouPrs); - } - mynew.Add(myhimap.FindIndex(OO)); - } - } - break; - } - - case StdSelect_TOR_SIMPLE: { - - if(myselector->More()){ - const Handle(SelectBasics_EntityOwner)& OO = myselector->OnePicked(); - if(!Handle(StdSelect_BRepOwner)::DownCast(OO).IsNull()){ - if (!myhimap.Contains(OO)){ - Handle(StdSelect_Prs) NiouPrs = new StdSelect_Prs(myviewer->Viewer()); - StdPrs_WFShape::Add(NiouPrs,Handle(StdSelect_BRepOwner)::DownCast(OO)->Shape(),mydrwr); - NiouPrs->Color(mycolor); - myhimap.Add(OO,NiouPrs); - } - mynew.Add(myhimap.FindIndex(OO)); - } - } - } - break; - } - Standard_Boolean First = Standard_True; // to avoid begindraw if there is nothing (expensive) - - for(it.Initialize(mynew);it.More();it.Next()){ - - if(First) { - aView->TransientManagerBeginDraw(DoubleBuffer); - First = Standard_False; - } - - Visual3d_TransientManager::DrawStructure(myhimap.FindFromIndex(it.Key())); - } - - if(!First) - Visual3d_TransientManager::EndDraw(); - } -} - -void StdSelect_BRepHilighter::Clear() -{ - if(!myhimap.IsEmpty()){ - for (Standard_Integer i=1;i<=myhimap.Extent();i++){ - myhimap.FindFromIndex(i)->UnHighlight(); - myhimap.FindFromIndex(i)->Erase(); - myhimap.FindFromIndex(i)->Clear(); - } - myold.Clear(); - mynew.Clear(); - mylastindex=0; - } - myhimap.Clear(); -} - -const Handle(Prs3d_Drawer)& StdSelect_BRepHilighter::Drawer() const -{ - return mydrwr; -} -