Last change
on this file since 3680 was
3680,
checked in by ldelgass, 11 years ago
|
Improved cloud support in vtkvis: handle ugrids with no cells as well as
polydata clouds, add cloudstyle options to some graphics objects.
|
-
Property svn:eol-style set to
native
|
File size:
1.3 KB
|
Rev | Line | |
---|
[3154] | 1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
| 2 | /* |
---|
[3177] | 3 | * Copyright (C) 2004-2012 HUBzero Foundation, LLC |
---|
[3154] | 4 | * |
---|
| 5 | * Author: Leif Delgass <ldelgass@purdue.edu> |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include <vtkPolyDataMapper.h> |
---|
| 9 | #include <vtkActor.h> |
---|
| 10 | #include <vtkCylinderSource.h> |
---|
[3680] | 11 | #include <vtkReverseSense.h> |
---|
[3154] | 12 | |
---|
[3616] | 13 | #include "Cylinder.h" |
---|
[3154] | 14 | #include "Trace.h" |
---|
| 15 | |
---|
[3615] | 16 | using namespace VtkVis; |
---|
[3154] | 17 | |
---|
| 18 | Cylinder::Cylinder() : |
---|
| 19 | Shape() |
---|
| 20 | { |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | Cylinder::~Cylinder() |
---|
| 24 | { |
---|
| 25 | TRACE("Deleting Cylinder"); |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | void Cylinder::update() |
---|
| 29 | { |
---|
| 30 | if (_cylinder == NULL) { |
---|
| 31 | _cylinder = vtkSmartPointer<vtkCylinderSource>::New(); |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | if (_pdMapper == NULL) { |
---|
| 35 | _pdMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); |
---|
| 36 | _pdMapper->SetResolveCoincidentTopologyToPolygonOffset(); |
---|
| 37 | _pdMapper->ScalarVisibilityOff(); |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | _pdMapper->SetInputConnection(_cylinder->GetOutputPort()); |
---|
| 41 | |
---|
| 42 | initProp(); |
---|
| 43 | |
---|
| 44 | getActor()->SetMapper(_pdMapper); |
---|
| 45 | _pdMapper->Update(); |
---|
| 46 | } |
---|
[3680] | 47 | |
---|
| 48 | void Cylinder::flipNormals(bool state) |
---|
| 49 | { |
---|
| 50 | if (_cylinder == NULL || _pdMapper == NULL) |
---|
| 51 | return; |
---|
| 52 | |
---|
| 53 | if (state) { |
---|
| 54 | vtkSmartPointer<vtkReverseSense> filter = vtkSmartPointer<vtkReverseSense>::New(); |
---|
| 55 | filter->SetInputConnection(_cylinder->GetOutputPort()); |
---|
| 56 | |
---|
| 57 | _pdMapper->SetInputConnection(filter->GetOutputPort()); |
---|
| 58 | } else { |
---|
| 59 | _pdMapper->SetInputConnection(_cylinder->GetOutputPort()); |
---|
| 60 | } |
---|
| 61 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.