12 #include "vtkCellArray.h"
13 #include "vtkCellData.h"
14 #include "vtkFloatArray.h"
15 #include "vtkInformation.h"
16 #include "vtkInformationVector.h"
17 #include "vtkObjectFactory.h"
18 #include "vtkPointData.h"
19 #include "vtkPoints.h"
20 #include "vtkPolyData.h"
21 #include "vtkStreamingDemandDrivenPipeline.h"
26 this->SetNumberOfInputPorts(0);
30 vtkInformation *vtkNotUsed(request),
31 vtkInformationVector **vtkNotUsed(inputVector),
32 vtkInformationVector *outputVector) {
34 vtkInformation *outInfo = outputVector->GetInformationObject(0);
37 vtkPolyData *output = vtkPolyData::SafeDownCast(
38 outInfo->Get(vtkDataObject::DATA_OBJECT()));
40 int numPolys = 6, numPts = 8;
41 vtkIdType pts[4], pts_[2];
43 vtkCellArray *newPolys;
44 vtkCellArray *newLines;
49 newPoints = vtkPoints::New(VTK_DOUBLE);
50 newPoints->SetNumberOfPoints(numPts);
51 double bounds[6] = {-0.5, 0.5, -0.5, 0.5, -0.5, 0.5};
52 newPoints->SetPoint(0, bounds[0], bounds[2], bounds[4]);
53 newPoints->SetPoint(1, bounds[1], bounds[2], bounds[4]);
54 newPoints->SetPoint(2, bounds[1], bounds[3], bounds[4]);
55 newPoints->SetPoint(3, bounds[0], bounds[3], bounds[4]);
56 newPoints->SetPoint(4, bounds[0], bounds[2], bounds[5]);
57 newPoints->SetPoint(5, bounds[1], bounds[2], bounds[5]);
58 newPoints->SetPoint(6, bounds[1], bounds[3], bounds[5]);
59 newPoints->SetPoint(7, bounds[0], bounds[3], bounds[5]);
62 newPolys = vtkCellArray::New();
63 newPolys->Allocate(newPolys->EstimateSize(numPolys, 4));
68 newPolys->InsertNextCell(4, pts);
73 newPolys->InsertNextCell(4, pts);
78 newPolys->InsertNextCell(4, pts);
83 newPolys->InsertNextCell(4, pts);
88 newPolys->InsertNextCell(4, pts);
93 newPolys->InsertNextCell(4, pts);
96 newLines = vtkCellArray::New();
97 newLines->Allocate(newLines->EstimateSize(12, 2));
100 newLines->InsertNextCell(2, pts_);
103 newLines->InsertNextCell(2, pts_);
106 newLines->InsertNextCell(2, pts_);
109 newLines->InsertNextCell(2, pts_);
112 newLines->InsertNextCell(2, pts_);
115 newLines->InsertNextCell(2, pts_);
118 newLines->InsertNextCell(2, pts_);
121 newLines->InsertNextCell(2, pts_);
124 newLines->InsertNextCell(2, pts_);
127 newLines->InsertNextCell(2, pts_);
130 newLines->InsertNextCell(2, pts_);
133 newLines->InsertNextCell(2, pts_);
138 output->SetPoints(newPoints);
140 output->SetLines(newLines);
143 output->SetPolys(newPolys);
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
vtkStandardNewMacro(vtkAnnotationBoxSource)