MCPcopy Create free account
hub / github.com/Kitware/VTK / Paint

Method Paint

Charts/Core/vtkPlotParallelCoordinates.cxx:75–163  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

73
74//------------------------------------------------------------------------------
75bool vtkPlotParallelCoordinates::Paint(vtkContext2D* painter)
76{
77 // This is where everything should be drawn, or dispatched to other methods.
78 vtkDebugMacro(<< "Paint event called in vtkPlotParallelCoordinates.");
79
80 if (!this->Visible)
81 {
82 return false;
83 }
84
85 painter->ApplyPen(this->Pen);
86
87 if (this->Storage->empty())
88 {
89 return false;
90 }
91
92 size_t cols = this->Storage->size();
93 size_t rows = this->Storage->at(0).size();
94 std::vector<vtkVector2f> line(cols);
95
96 // Update the axis positions
97 vtkChartParallelCoordinates* parent = vtkChartParallelCoordinates::SafeDownCast(this->Parent);
98
99 for (size_t i = 0; i < cols; ++i)
100 {
101 this->Storage->AxisPos[i] =
102 parent->GetAxis(int(i)) ? parent->GetAxis(int(i))->GetPoint1()[0] : 0;
103 }
104
105 vtkIdType selection = 0;
106 vtkIdType id = 0;
107 if (this->Selection)
108 {
109 vtkIdType selectionSize = this->Selection->GetNumberOfTuples();
110 if (selectionSize)
111 {
112 this->Selection->GetTypedTuple(selection, &id);
113 }
114 }
115
116 // Draw all of the lines
117 painter->ApplyPen(this->Pen);
118 int ncComps(0);
119 if (this->ScalarVisibility && this->Colors)
120 {
121 ncComps = this->Colors->GetNumberOfComponents();
122 }
123 if (this->ScalarVisibility && this->Colors && ncComps == 4)
124 {
125 for (size_t i = 0, nc = 0; i < rows; ++i, nc += ncComps)
126 {
127 for (size_t j = 0; j < cols; ++j)
128 {
129 line[j].Set(this->Storage->AxisPos[j], (*this->Storage)[j][i]);
130 }
131 painter->GetPen()->SetColor(this->Colors->GetPointer(static_cast<vtkIdType>(nc)));
132 painter->DrawPoly(line[0].GetData(), static_cast<int>(cols));

Callers

nothing calls this directly

Calls 15

ApplyPenMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
atMethod · 0.45
GetAxisMethod · 0.45
GetPoint1Method · 0.45
GetNumberOfTuplesMethod · 0.45
GetTypedTupleMethod · 0.45
GetNumberOfComponentsMethod · 0.45
SetMethod · 0.45
SetColorMethod · 0.45
GetPenMethod · 0.45

Tested by

no test coverage detected