------------------------------------------------------------------------------
| 1896 | |
| 1897 | //------------------------------------------------------------------------------ |
| 1898 | int vtkColorTransferFunction::AdjustRange(double range[2]) |
| 1899 | { |
| 1900 | if (!range) |
| 1901 | { |
| 1902 | return 0; |
| 1903 | } |
| 1904 | |
| 1905 | double* function_range = this->GetRange(); |
| 1906 | |
| 1907 | // Make sure we have points at each end of the range |
| 1908 | |
| 1909 | double rgb[3]; |
| 1910 | if (function_range[0] < range[0]) |
| 1911 | { |
| 1912 | this->GetColor(range[0], rgb); |
| 1913 | this->AddRGBPoint(range[0], rgb[0], rgb[1], rgb[2]); |
| 1914 | } |
| 1915 | else |
| 1916 | { |
| 1917 | this->GetColor(function_range[0], rgb); |
| 1918 | this->AddRGBPoint(range[0], rgb[0], rgb[1], rgb[2]); |
| 1919 | } |
| 1920 | |
| 1921 | if (function_range[1] > range[1]) |
| 1922 | { |
| 1923 | this->GetColor(range[1], rgb); |
| 1924 | this->AddRGBPoint(range[1], rgb[0], rgb[1], rgb[2]); |
| 1925 | } |
| 1926 | else |
| 1927 | { |
| 1928 | this->GetColor(function_range[1], rgb); |
| 1929 | this->AddRGBPoint(range[1], rgb[0], rgb[1], rgb[2]); |
| 1930 | } |
| 1931 | |
| 1932 | // Remove all points out-of-range |
| 1933 | int done; |
| 1934 | |
| 1935 | done = 0; |
| 1936 | while (!done) |
| 1937 | { |
| 1938 | done = 1; |
| 1939 | |
| 1940 | this->Internal->FindNodeOutOfRange.X1 = range[0]; |
| 1941 | this->Internal->FindNodeOutOfRange.X2 = range[1]; |
| 1942 | |
| 1943 | std::vector<vtkCTFNode*>::iterator iter = std::find_if(this->Internal->Nodes.begin(), |
| 1944 | this->Internal->Nodes.end(), this->Internal->FindNodeOutOfRange); |
| 1945 | |
| 1946 | if (iter != this->Internal->Nodes.end()) |
| 1947 | { |
| 1948 | delete *iter; |
| 1949 | this->Internal->Nodes.erase(iter); |
| 1950 | this->Modified(); |
| 1951 | done = 0; |
| 1952 | } |
| 1953 | } |
| 1954 | |
| 1955 | this->SortAndUpdateRange(); |
nothing calls this directly
no test coverage detected