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

Method PositionColorLegend

Views/Infovis/vtkDendrogramItem.cxx:1210–1248  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1208
1209//------------------------------------------------------------------------------
1210void vtkDendrogramItem::PositionColorLegend()
1211{
1212 // bail out early if we don't have meaningful bounds yet.
1213 if (this->MinX > this->MaxX || this->MinY > this->MaxY)
1214 {
1215 return;
1216 }
1217
1218 int orientation = this->GetOrientation();
1219 switch (orientation)
1220 {
1221 case vtkDendrogramItem::DOWN_TO_UP:
1222 case vtkDendrogramItem::UP_TO_DOWN:
1223 this->ColorLegend->SetHorizontalAlignment(vtkChartLegend::RIGHT);
1224 this->ColorLegend->SetVerticalAlignment(vtkChartLegend::CENTER);
1225 this->ColorLegend->SetOrientation(vtkColorLegend::VERTICAL);
1226 this->ColorLegend->SetPoint(
1227 this->MinX - this->LeafSpacing, this->MinY + (this->MaxY - this->MinY) / 2.0);
1228 this->ColorLegend->SetTextureSize(
1229 this->ColorLegend->GetSymbolWidth(), this->MaxY - this->MinY);
1230 break;
1231
1232 case vtkDendrogramItem::RIGHT_TO_LEFT:
1233 case vtkDendrogramItem::LEFT_TO_RIGHT:
1234 default:
1235 this->ColorLegend->SetHorizontalAlignment(vtkChartLegend::CENTER);
1236 this->ColorLegend->SetVerticalAlignment(vtkChartLegend::TOP);
1237 this->ColorLegend->SetOrientation(vtkColorLegend::HORIZONTAL);
1238 this->ColorLegend->SetPoint(
1239 this->MinX + (this->MaxX - this->MinX) / 2.0, this->MinY - this->LeafSpacing);
1240 this->ColorLegend->SetTextureSize(
1241 this->MaxX - this->MinX, this->ColorLegend->GetSymbolWidth());
1242 break;
1243 }
1244 this->ColorLegend->Update();
1245 this->ColorLegend->SetVisible(true);
1246 this->Scene->SetDirty(true);
1247 this->LegendPositionSet = true;
1248}
1249
1250//------------------------------------------------------------------------------
1251void vtkDendrogramItem::SetOrientation(int orientation)

Callers 2

RebuildBuffersMethod · 0.95
SetColorArrayMethod · 0.95

Calls 6

GetOrientationMethod · 0.95
SetTextureSizeMethod · 0.80
SetDirtyMethod · 0.80
SetOrientationMethod · 0.45
SetPointMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected