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

Method GetSignificantPartFromValues

Rendering/Annotation/vtkPolarAxesActor.cxx:1954–2000  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1952
1953//------------------------------------------------------------------------------
1954void vtkPolarAxesActor::GetSignificantPartFromValues(
1955 vtkStringArray* valuesStr, std::list<double>& valuesList)
1956{
1957 if (!valuesStr || valuesList.empty())
1958 {
1959 return;
1960 }
1961
1962 valuesStr->SetNumberOfValues(static_cast<vtkIdType>(valuesList.size()));
1963
1964 std::list<double>::iterator itList;
1965 vtkIdType i = 0;
1966 for (itList = valuesList.begin(); itList != valuesList.end(); ++i, ++itList)
1967 {
1968 char label[64];
1969 if (this->ExponentLocation == VTK_EXPONENT_LABELS)
1970 {
1971 VTK_FORMAT_IF_ERROR_RETURN(
1972 auto result = vtk::format_to_n(label, sizeof(label), this->PolarLabelFormat, *itList);
1973 *result.out = '\0', );
1974 valuesStr->SetValue(i, label);
1975 }
1976 else
1977 {
1978 std::stringstream ss;
1979 if (*itList == 0.0)
1980 {
1981 ss << std::fixed << std::setw(1) << std::setprecision(0) << 0.0;
1982 valuesStr->SetValue(i, ss.str().c_str());
1983 continue;
1984 }
1985
1986 // get pow of ten of the value to set the precision of the label
1987 int exponent = static_cast<int>(std::floor(log10(fabs(*itList))));
1988 if (exponent < 0)
1989 {
1990 ss << std::fixed << std::setw(1) << setprecision(-exponent) << *itList;
1991 }
1992 else
1993 {
1994 ss << std::fixed << setprecision(1) << *itList;
1995 }
1996
1997 valuesStr->SetValue(i, ss.str().c_str());
1998 }
1999 }
2000}
2001
2002//------------------------------------------------------------------------------
2003void vtkPolarAxesActor::AutoScale(vtkViewport* viewport)

Callers 2

Calls 10

floorFunction · 0.50
log10Function · 0.50
emptyMethod · 0.45
SetNumberOfValuesMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
SetValueMethod · 0.45
c_strMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected