mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-05-26 00:20:48 +05:00
setDeflection added
This commit is contained in:
parent
fae04bb13f
commit
04d5e7f09a
@ -63,11 +63,14 @@
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <AIS_ListOfInteractive.hxx>
|
||||
#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
|
||||
// IDL Headers
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(GEOM_Gen)
|
||||
|
||||
#include <vtkRenderer.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@ -483,6 +486,69 @@ void GEOM_Swig::setTransparency(const char* theEntry, float transp)
|
||||
}
|
||||
|
||||
|
||||
void GEOM_Swig::setDeflection(const char* theEntry, float theDeflect)
|
||||
{
|
||||
class TEvent: public SALOME_Event {
|
||||
std::string myEntry;
|
||||
float myParam;
|
||||
public:
|
||||
TEvent(const char* theEntryArg, float theParam):
|
||||
myEntry(theEntryArg), myParam(theParam)
|
||||
{}
|
||||
virtual void Execute() {
|
||||
SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
|
||||
if (!anApp) return;
|
||||
|
||||
Handle(SALOME_InteractiveObject) anIO =
|
||||
new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
|
||||
|
||||
if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
|
||||
vtkActorCollection* aActors = aViewWindow->getRenderer()->GetActors();
|
||||
aActors->InitTraversal();
|
||||
while (vtkActor* aAct = aActors->GetNextActor()) {
|
||||
if (GEOM_Actor* aGeomActor = dynamic_cast<GEOM_Actor*>(aAct)) {
|
||||
if (aGeomActor->hasIO()) {
|
||||
Handle(SALOME_InteractiveObject) aNextIO = aGeomActor->getIO();
|
||||
if (aNextIO->isSame(anIO)) {
|
||||
aGeomActor->setDeflection(myParam);
|
||||
aViewWindow->Repaint();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// aView->SetTransparency(anIO, myParam);
|
||||
//aView->Repaint();
|
||||
} else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
|
||||
Handle(AIS_InteractiveContext) aContext = occViewer->getAISContext();
|
||||
AIS_ListOfInteractive aAISList;
|
||||
aContext->DisplayedObjects(aAISList);
|
||||
AIS_ListIteratorOfListOfInteractive it(aAISList);
|
||||
for (; it.More(); it.Next()) {
|
||||
Handle(SALOME_InteractiveObject) aObj =
|
||||
Handle(SALOME_InteractiveObject)::DownCast(it.Value()->GetOwner());
|
||||
if ((!aObj.IsNull()) && aObj->hasEntry() && aObj->isSame(anIO)) {
|
||||
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(it.Value());
|
||||
if (!aShape.IsNull()) {
|
||||
Handle(AIS_Drawer) aDrawer = aShape->Attributes();
|
||||
if (aDrawer.IsNull())
|
||||
aDrawer = new AIS_Drawer();
|
||||
aDrawer->SetDeviationCoefficient(myParam);
|
||||
aShape->SetAttributes(aDrawer);
|
||||
aContext->Redisplay(aShape, true, true);
|
||||
aContext->UpdateCurrentViewer();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ProcessVoidEvent(new TEvent (theEntry, theDeflect));
|
||||
}
|
||||
|
||||
|
||||
class TInitGeomGenEvent: public SALOME_Event {
|
||||
public:
|
||||
typedef bool TResult;
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
void setDisplayMode(const char* Entry, int mode);
|
||||
void setColor(const char* Entry, int red, int green, int blue);
|
||||
void setTransparency(const char* Entry, float transp);
|
||||
void setDeflection(const char* Entry, float deflect);
|
||||
|
||||
int getIndexTopology(const char *SubEntry, const char *Entry);
|
||||
const char* getShapeTypeString(const char *Entry);
|
||||
|
@ -44,6 +44,7 @@ class GEOM_Swig
|
||||
void setDisplayMode(const char* Entry, int mode);
|
||||
void setColor(const char* Entry, int red, int green, int blue);
|
||||
void setTransparency(const char* Entry, float transp);
|
||||
void setDeflection(const char* Entry, float deflect);
|
||||
const char* getShapeTypeIcon(const char *Ior);
|
||||
|
||||
bool initGeomGen();
|
||||
|
Loading…
x
Reference in New Issue
Block a user