-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement region highlighting from table for 3D view
- Loading branch information
1 parent
13b3e4a
commit c847597
Showing
8 changed files
with
139 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "RegionHighlight3D.h" | ||
|
||
#include <vtkActor.h> | ||
#include <vtkDiskSource.h> | ||
#include <vtkLookupTable.h> | ||
#include <vtkFollower.h> | ||
#include <vtkPolyDataMapper.h> | ||
#include <vtkProperty.h> | ||
#include <vtkRenderer.h> | ||
|
||
#include "Region.h" | ||
|
||
RegionHighlight3D::RegionHighlight3D(Region* inputRegion, double color[3], double width) { | ||
region = inputRegion; | ||
|
||
double r = region->GetLength() / 2; | ||
double ir = r; | ||
double or = ir + width; | ||
|
||
vtkSmartPointer<vtkDiskSource> disk = vtkSmartPointer<vtkDiskSource>::New(); | ||
disk->SetInnerRadius(ir); | ||
disk->SetOuterRadius(or); | ||
disk->SetCircumferentialResolution(32); | ||
|
||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New(); | ||
mapper->ScalarVisibilityOff(); | ||
mapper->SetInputConnection(disk->GetOutputPort()); | ||
|
||
actor = vtkSmartPointer<vtkFollower>::New(); | ||
actor->SetMapper(mapper); | ||
actor->GetProperty()->SetColor(color); | ||
actor->GetProperty()->SetDiffuse(0.0); | ||
actor->GetProperty()->SetAmbient(1.0); | ||
actor->GetProperty()->SetSpecular(0.0); | ||
actor->GetProperty()->SetOpacity(0.5); | ||
actor->SetPosition(region->GetCenter()); | ||
} | ||
|
||
RegionHighlight3D::~RegionHighlight3D() { | ||
while (actor->GetNumberOfConsumers() > 0) { | ||
vtkRenderer::SafeDownCast(actor->GetConsumer(0))->RemoveActor(actor); | ||
} | ||
} | ||
|
||
void RegionHighlight3D::SetCamera(vtkCamera* camera) { | ||
actor->SetCamera(camera); | ||
} | ||
|
||
vtkSmartPointer<vtkActor> RegionHighlight3D::GetActor() { | ||
return actor; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef RegionHighlight3D_H | ||
#define RegionHighlight3D_H | ||
|
||
#include "vtkSmartPointer.h" | ||
|
||
class vtkActor; | ||
class vtkCamera; | ||
class vtkFollower; | ||
|
||
class Region; | ||
|
||
class RegionHighlight3D { | ||
public: | ||
RegionHighlight3D(Region* inputRegion, double color[3], double width); | ||
~RegionHighlight3D(); | ||
|
||
void SetCamera(vtkCamera* camera); | ||
|
||
vtkSmartPointer<vtkActor> GetActor(); | ||
|
||
protected: | ||
Region* region; | ||
|
||
vtkSmartPointer<vtkFollower> actor; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters