1 /*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkOutlineCornerFilter.cxx
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14 =========================================================================*/
15 #include "vtkOutlineCornerFilter.h"
16
17 #include "vtkDataSet.h"
18 #include "vtkInformation.h"
19 #include "vtkInformationVector.h"
20 #include "vtkObjectFactory.h"
21 #include "vtkOutlineCornerSource.h"
22 #include "vtkPolyData.h"
23
24 vtkStandardNewMacro(vtkOutlineCornerFilter);
25
vtkOutlineCornerFilter()26 vtkOutlineCornerFilter::vtkOutlineCornerFilter ()
27 {
28 this->CornerFactor = 0.2;
29 this->OutlineCornerSource = vtkOutlineCornerSource::New();
30 }
31
~vtkOutlineCornerFilter()32 vtkOutlineCornerFilter::~vtkOutlineCornerFilter ()
33 {
34 if (this->OutlineCornerSource != nullptr)
35 {
36 this->OutlineCornerSource->Delete ();
37 this->OutlineCornerSource = nullptr;
38 }
39 }
40
RequestData(vtkInformation * vtkNotUsed (request),vtkInformationVector ** inputVector,vtkInformationVector * outputVector)41 int vtkOutlineCornerFilter::RequestData(
42 vtkInformation *vtkNotUsed(request),
43 vtkInformationVector **inputVector,
44 vtkInformationVector *outputVector)
45 {
46 // get the info objects
47 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
48 vtkInformation *outInfo = outputVector->GetInformationObject(0);
49
50 // get the input and output
51 vtkDataSet *input = vtkDataSet::SafeDownCast(
52 inInfo->Get(vtkDataObject::DATA_OBJECT()));
53 vtkPolyData *output = vtkPolyData::SafeDownCast(
54 outInfo->Get(vtkDataObject::DATA_OBJECT()));
55
56 vtkDebugMacro(<< "Creating dataset outline");
57
58 //
59 // Let OutlineCornerSource do all the work
60 //
61 this->OutlineCornerSource->SetBounds(input->GetBounds());
62 this->OutlineCornerSource->SetCornerFactor(this->GetCornerFactor());
63 this->OutlineCornerSource->Update();
64
65 output->CopyStructure(this->OutlineCornerSource->GetOutput());
66
67 return 1;
68 }
69
FillInputPortInformation(int,vtkInformation * info)70 int vtkOutlineCornerFilter::FillInputPortInformation(int, vtkInformation *info)
71 {
72 info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkDataSet");
73 return 1;
74 }
75
PrintSelf(ostream & os,vtkIndent indent)76 void vtkOutlineCornerFilter::PrintSelf(ostream& os, vtkIndent indent)
77 {
78 this->Superclass::PrintSelf(os,indent);
79 os << indent << "CornerFactor: " << this->CornerFactor << "\n";
80 }
81