aSelMgr->selectedObjects( selected );
if ( selected.IsEmpty() )
return;
-
- Handle(SALOME_InteractiveObject) FirstIOS = selected.First();
- if ( FirstIOS.IsNull() )
- return;
-
+
SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
if ( !vtkVW )
return;
+
+ SALOME_View* view = GEOM_Displayer::GetActiveView();
+
+ vtkActorCollection* aCollection = vtkActorCollection::New();
- SVTK_View* aView = vtkVW->getView();
- vtkActorCollection* aCollection = aView->getRenderer()->GetActors();
-
+ for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
+ Handle(SALOME_InteractiveObject) anIObject = It.Value();
+ SALOME_Prs* aPrs = view->CreatePrs( anIObject->getEntry() );
+ SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( aPrs );
+ if ( vtkPrs ) {
+ vtkActorCollection* anActors = vtkPrs->GetObjects();
+ anActors->InitTraversal();
+ vtkActor* anAct = anActors->GetNextActor();
+ aCollection->AddItem(anAct);
+ }
+ }
+
+ if(aCollection)
+ aCollection->InitTraversal();
+ else
+ return;
+
int UIso = 0;
int VIso = 0;
- if(aCollection){
- aCollection->InitTraversal();
- }
- vtkActor *anAct = aCollection->GetNextActor();
- if(GEOM_Actor *anActor = dynamic_cast<GEOM_Actor*>(anAct)){
+ vtkActor* anAct = aCollection->GetNextActor();
+ if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct))
anActor->GetNbIsos(UIso,VIso);
- }
-
+ else
+ return;
- GEOMToolsGUI_NbIsosDlg * NbIsosDlg =
+ GEOMToolsGUI_NbIsosDlg* NbIsosDlg =
new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() );
NbIsosDlg->setU( UIso );
if ( NbIsosDlg->exec() ) {
SUIT_OverrideCursor();
- while(anAct = aCollection->GetNextActor()) {
- if(GEOM_Actor *anActor = dynamic_cast<GEOM_Actor*>(anAct)){
+ while( anAct!=NULL ) {
+ if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)){
// There are no casting to needed actor.
UIso = NbIsosDlg->getU();
VIso = NbIsosDlg->getV();
int aIsos[2]={UIso,VIso};
anActor->SetNbIsos(aIsos);
}
+ anAct = aCollection->GetNextActor();
}
}
} // end vtkviewer
#include <vtkMath.h>
#include <vtkCamera.h>
+#include "utilities.h"
+
//vtkStandardNewMacro(GEOM_Actor);
#ifndef MYDEBUG
{
#ifdef MYDEBUG
- cout <<this<< " GEOM_Actor::GEOM_Actor"<<endl;
+ MESSAGE (this<< " GEOM_Actor::GEOM_Actor");
#endif
myPolyDataMapper->SetInput(myAppendFilter->GetOutput());
GEOM_Actor::~GEOM_Actor()
{
#ifdef MYDEBUG
- cout <<this<< " ~GEOM_Actor::GEOM_Actor"<<endl;
+ MESSAGE (this<< " ~GEOM_Actor::GEOM_Actor");
#endif
myHighlightProp->Delete();
myPreHighlightProp->Delete();
void Write(vtkPolyData* theDataSet, const char* theFileName){
vtkPolyDataWriter* aWriter = vtkPolyDataWriter::New();
- cout<<"Write - "<<theFileName<<"' : "<<theDataSet->GetNumberOfPoints()<<"; "<<theDataSet->GetNumberOfCells()<<endl;
+ MESSAGE ("Write - "<<theFileName<<"' : "<<theDataSet->GetNumberOfPoints()<<"; "<<theDataSet->GetNumberOfCells());
aWriter->SetInput(theDataSet);
aWriter->SetFileName(theFileName);
//aWriter->Write();
setDisplayMode(int theMode)
{
#ifdef MYDEBUG
- cout << "GEOM_Actor::SetDisplayMode = "<<theMode <<endl;
+ MESSAGE ( "GEOM_Actor::SetDisplayMode = "<<theMode );
#endif
VTKViewer_Actor::setDisplayMode(theMode);
SetVisibility(GetVisibility());
SetSelected(bool theIsSelected)
{
#ifdef MYDEBUG
- cout << "GEOM_Actor::SetSelected = "<<theIsSelected <<endl;
+ MESSAGE ( "GEOM_Actor::SetSelected = "<<theIsSelected );
#endif
myIsSelected = theIsSelected;
SetVisibility(int theVisibility)
{
#ifdef MYDEBUG
- cout << "GEOM_Actor::SetVisibility = "<<theVisibility <<" myIsSelected="<< myIsSelected
- << " theVisibility="<<theVisibility<<" myIsPreselected="<<myIsPreselected<<endl;
+ MESSAGE ( "GEOM_Actor::SetVisibility = "<<theVisibility <<" myIsSelected="<< myIsSelected
+ << " theVisibility="<<theVisibility<<" myIsPreselected="<<myIsPreselected );
#endif
SALOME_Actor::SetVisibility(theVisibility);
myOneFaceEdgeActor->SetVisibility(theVisibility && myDisplayMode == (int)eWireframe && !myIsSelected);
myIsolatedEdgeActor->SetVisibility(theVisibility && !myIsSelected);
- myVertexActor->SetVisibility(false);// must be added new mode points
+// myVertexActor->SetVisibility(false);// must be added new mode points
+ myVertexActor->SetVisibility(theVisibility);
}
GEOM_Actor
::SetNbIsos(const int theNb[2])
{
- myNbIsos[0] = theNb[0];
- myNbIsos[1] = theNb[1];
+ myWireframeFaceSource->SetNbIso(theNb);
}
void
GEOM_Actor
::GetNbIsos(int &theNbU,int &theNbV)
{
- theNbU = myNbIsos[0];
- theNbV = myNbIsos[1];
+ myWireframeFaceSource->GetNbIso(theNbU, theNbV);
}
static
// OLD METHODS
void GEOM_Actor::setDeflection(double adef) {
#ifdef MYDEBUG
- cout << "GEOM_Actor::setDeflection"<<endl;
+ MESSAGE ( "GEOM_Actor::setDeflection" );
#endif
SetDeflection((float)adef,GetIsRelative());
}
void GEOM_Actor::SetHighlightProperty(vtkProperty* Prop)
{
#ifdef MYDEBUG
- cout << "GEOM_Actor::SetHighlightProperty"<<endl;
+ MESSAGE ( "GEOM_Actor::SetHighlightProperty" );
#endif
this->myHighlightActor->GetProperty()->DeepCopy(Prop);
void GEOM_Actor::SetWireframeProperty(vtkProperty* Prop)
{
#ifdef MYDEBUG
- cout << this << " GEOM_Actor::SetWireframeProperty"<<endl;
+ MESSAGE ( this << " GEOM_Actor::SetWireframeProperty" );
#endif
// must be filled
myWireframeFaceActor->SetProperty(Prop);
void GEOM_Actor::SetShadingProperty(vtkProperty* Prop)
{
#ifdef MYDEBUG
- cout << "GEOM_Actor::SetShadingProperty"<<endl;
+ MESSAGE ( "GEOM_Actor::SetShadingProperty" );
#endif
myShadingFaceProp->DeepCopy(Prop);
}
void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *theMapper)
{
#ifdef MYDEBUG
- cout << "GEOM_Actor::Render"<<endl;
+ MESSAGE ( "GEOM_Actor::Render" );
#endif
if(!GetVisibility())
void GEOM_Actor::ReleaseGraphicsResources(vtkWindow *)
{
#ifdef MYDEBUG
- cout << "GEOM_Actor::ReleaseGraphicsResources"<<endl;
+ MESSAGE ( "GEOM_Actor::ReleaseGraphicsResources" );
#endif
}
void GEOM_Actor::ShallowCopy(vtkProp *prop)
{
#ifdef MYDEBUG
- cout << "GEOM_Actor::ShallowCopy"<<endl;
+ MESSAGE ( "GEOM_Actor::ShallowCopy" );
#endif
GEOM_Actor *f = GEOM_Actor::SafeDownCast(prop);
if ( f != NULL )
const TopoDS_Shape& GEOM_Actor::getTopo() {
#ifdef MYDEBUG
- cout << "GEOM_Actor::getTopo"<<endl;
+ MESSAGE ( "GEOM_Actor::getTopo" );
#endif
return myShape;
}
int imode, bool isVector)
{
#ifdef MYDEBUG
- cout << "GEOM_Actor::setInputShape"<<endl;
+ MESSAGE ( "GEOM_Actor::setInputShape" );
#endif
}
double GEOM_Actor::getDeflection()
{
#ifdef MYDEBUG
- cout << "GEOM_Actor::getDeflection"<<endl;
+ MESSAGE ( "GEOM_Actor::getDeflection" );
#endif
return (double) GetDeflection();
}
double GEOM_Actor::isVector()
{
#ifdef MYDEBUG
- cout << "GEOM_Actor::isVector"<<endl;
+ MESSAGE ( "GEOM_Actor::isVector" );
#endif
return 0;
}
void GEOM_Actor::SubShapeOn()
{
#ifdef MYDEBUG
- cout << "GEOM_Actor::SubShapeOn"<<endl;
+ MESSAGE ( "GEOM_Actor::SubShapeOn" );
#endif
}
void GEOM_Actor::SubShapeOff()
{
#ifdef MYDEBUG
- cout << "GEOM_Actor::SubShapeOff"<<endl;
+ MESSAGE ( "GEOM_Actor::SubShapeOff" );
#endif
}
void GEOM_Actor::highlight(bool highlight)
{
#ifdef MYDEBUG
- cout << this << " GEOM_Actor::highlight highlight="<<highlight<<endl;
+ MESSAGE ( this << " GEOM_Actor::highlight highlight="<<highlight );
#endif
SALOME_Actor::highlight(highlight);
}
{
myIsSelected = theIsHighlight;
#ifdef MYDEBUG
- cout << this << " GEOM_Actor::Highlight myIsSelected="<<myIsSelected<<endl;
+ MESSAGE ( this << " GEOM_Actor::Highlight myIsSelected="<<myIsSelected );
#endif
SALOME_Actor::Highlight(theIsHighlight); // this method call ::highlight(theIsHighlight) in the end
bool theIsHighlight)
{
#ifdef MYDEBUG
- cout << this<<" GEOM_Actor::PreHighlight (3) theIsHighlight="<<theIsHighlight<<endl;
+ MESSAGE ( this<<" GEOM_Actor::PreHighlight (3) theIsHighlight="<<theIsHighlight );
#endif
if ( !GetPickable() )
{
// define the selection of object
#ifdef MYDEBUG
- cout << endl << this << " GEOM_Actor::Highlight (3) myIsSelected="<<myIsSelected<<endl;
+ MESSAGE ( std::endl << this << " GEOM_Actor::Highlight (3) myIsSelected="<<myIsSelected );
#endif
bool aRet = SALOME_Actor::Highlight(theInteractorStyle,theSelectionEvent,theIsHighlight);
SetSelected(theIsHighlight);
vtkStandardNewMacro(GEOM_WireframeFace);
GEOM_WireframeFace::GEOM_WireframeFace():
- NbIso(1),
- Discret(15)
+ Discret(15)
{
+ NbIso[0] = 1;
+ NbIso[1] = 1;
}
GEOM_WireframeFace::~GEOM_WireframeFace()
}
}
+void GEOM_WireframeFace::SetNbIso(const int theNb[2])
+{
+ if ( theNb[0] == NbIso[0] && theNb[1] == NbIso[1])
+ return;
+
+ NbIso[0] = theNb[0];
+ NbIso[1] = theNb[1];
+
+ Modified();
+}
+
+void GEOM_WireframeFace::GetNbIso(int &theNbU,int &theNbV)
+{
+ theNbU = NbIso[0];
+ theNbV = NbIso[1];
+}
+
void
GEOM_WireframeFace::
OCC2VTK(const TopoDS_Face& theFace,
vtkPolyData* thePolyData,
vtkPoints* thePts,
- const int theNbIso,
+ const int theNbIso[2],
const int theDiscret)
{
TopoDS_Face aFace = theFace;
void
GEOM_WireframeFace::
CreateIso(const TopoDS_Face& theFace,
- const int theNbIso,
+ const int theNbIso[2],
const int theDiscret,
vtkPolyData* thePolyData,
vtkPoints* thePts)
Standard_False);
Standard_Real anUMin, anUMax, aVMin, aVMax;
- TColStd_Array1OfReal anUPrm(1, theNbIso), aVPrm(1, theNbIso);
- TColStd_Array1OfInteger anUInd(1, theNbIso), aVInd(1, theNbIso);
+ TColStd_Array1OfReal anUPrm(1, theNbIso[0]), aVPrm(1, theNbIso[1]);
+ TColStd_Array1OfInteger anUInd(1, theNbIso[0]), aVInd(1, theNbIso[1]);
anUInd.Init(0);
aVInd.Init(0);
Standard_Real confusion = Min(DeltaU, DeltaV) * HATHCER_CONFUSION_3D ;
aHatcher.Confusion3d (confusion) ;
- Standard_Real StepU = DeltaU / (Standard_Real)theNbIso;
+ Standard_Real StepU = DeltaU / (Standard_Real)theNbIso[0];
if(StepU > confusion){
Standard_Real UPrm = anUMin + StepU / 2.;
gp_Dir2d Dir(0., 1.) ;
- for(IIso = 1 ; IIso <= theNbIso ; IIso++) {
+ for(IIso = 1 ; IIso <= theNbIso[0] ; IIso++) {
anUPrm(IIso) = UPrm ;
gp_Pnt2d Ori (UPrm, 0.) ;
Geom2dAdaptor_Curve HCur (new Geom2d_Line (Ori, Dir)) ;
}
}
- Standard_Real StepV = DeltaV / (Standard_Real) theNbIso ;
+ Standard_Real StepV = DeltaV / (Standard_Real) theNbIso[1] ;
if(StepV > confusion){
Standard_Real VPrm = aVMin + StepV / 2.;
gp_Dir2d Dir(1., 0.);
- for(IIso = 1 ; IIso <= theNbIso ; IIso++){
+ for(IIso = 1 ; IIso <= theNbIso[1] ; IIso++){
aVPrm(IIso) = VPrm;
gp_Pnt2d Ori (0., VPrm);
Geom2dAdaptor_Curve HCur(new Geom2d_Line (Ori, Dir));
aHatcher.Trim() ;
Standard_Integer aNbDom = 0 ; // for debug purpose
- for(IIso = 1 ; IIso <= theNbIso ; IIso++){
- Standard_Integer Index ;
+ Standard_Integer Index ;
+ for(IIso = 1 ; IIso <= theNbIso[0] ; IIso++){
Index = anUInd(IIso) ;
if(Index != 0){
if(aHatcher.TrimDone(Index) && !aHatcher.TrimFailed(Index)){
aNbDom = aHatcher.NbDomains (Index);
}
}
+ }
+ for(IIso = 1 ; IIso <= theNbIso[1] ; IIso++){
Index = aVInd(IIso);
if(Index != 0){
if(aHatcher.TrimDone (Index) && !aHatcher.TrimFailed(Index)){
CreateIso__(theSurface, theIsoType, aLocalU , theV, theStep/2, thePolyData, thePts);
}
}
-}
\ No newline at end of file
+}
vtkTypeMacro(GEOM_WireframeFace,GEOM_FaceSource);
static GEOM_WireframeFace* New();
- vtkSetMacro(NbIso,int);
- vtkGetMacro(NbIso,int);
+ /* vtkSetMacro(NbIso,int);
+ vtkGetMacro(NbIso,int);*/
vtkSetMacro(Discret,int);
vtkGetMacro(Discret,int);
void OCC2VTK(const TopoDS_Face& theFace,
vtkPolyData* thePolyData,
vtkPoints* thePts,
- int theNbIso = 1,
- int theDiscret = 15);
-
+ const int theNbIso[2],
+ const int theDiscret = 15);
+
+ //! IsoLines management
+ // theNb[0] - number of U lines
+ // theNb[1] - number of V lines
+ virtual void SetNbIso(const int theNb[2]);
+ virtual void GetNbIso(int &theNbU,int &theNbV);
+
protected:
- int NbIso, Discret;
+ int NbIso[2], Discret;
static
void
CreateIso(const TopoDS_Face& theFace,
- const int theNbIso,
+ const int theNbIso[2],
const int theDiscret,
vtkPolyData* thePolyData,
vtkPoints* thePts);