Commit a9cdca16 authored by David Thompson's avatar David Thompson
Browse files

Add the code used to create XML color maps ...

... from the palettes in the `vtkColorSeries` class.

Change-Id: Ic71b63b5cdeca855f25be49496f582f18e867016
parent a2dd2fc2
......@@ -410,6 +410,7 @@ else()
ThirdParty/protobuf
ThirdParty/QtTesting
Utilities/ProcessXML
Utilities/ColorSeriesToXML
Utilities/VisItBridge/databases
Utilities/VisItBridge/Library
Utilities/WrapClientServer
......
#==========================================================================
#
# Program: ParaView
#
# Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
# All rights reserved.
#
# ParaView is a free software; you can redistribute it and/or modify it
# under the terms of the ParaView license version 1.2.
#
# See License_v1.2.txt for the full ParaView license.
# A copy of this license can be obtained by contacting
# Kitware Inc.
# 28 Corporate Drive
# Clifton Park, NY 12065
# USA
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#==========================================================================
vtk_module_impl()
vtk_module_export("")
include(vtkForwardingExecutable)
if (NOT CMAKE_CROSSCOMPILING)
add_executable(vtkColorSeriesToXML ColorSeriesToXML.cxx)
target_link_libraries(vtkColorSeriesToXML
vtkCommonCore
vtkCommonExecutionModel
vtkCommonColor
)
if (UNIX)
# setup install rpath correctly so that vtkColorSeriesToXML can file needed libraries
# at runtime.
set (_temp_prefix "/tmp")
set (_bin "${_temp_prefix}/${VTK_INSTALL_RUNTIME_DIR}")
set (_so "${_temp_prefix}/${VTK_INSTALL_LIBRARY_DIR}")
file (RELATIVE_PATH relative_path "${_bin}" "${_so}")
set_target_properties(vtkColorSeriesToXML PROPERTIES
INSTALL_RPATH "\$ORIGIN/${relative_path}")
endif()
vtk_compile_tools_target(vtkColorSeriesToXML)
endif()
/*=========================================================================
Program: Visualization Toolkit
Module: GeneratePVColorSeries.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkLookupTable.h"
#include "vtkColorSeries.h"
#include "vtkColor.h"
#include "vtkDoubleArray.h"
#include "vtkImageData.h"
#include "vtkPointData.h"
#include "vtkSmartPointer.h"
#include "vtkTrivialProducer.h"
#include "vtkUnsignedCharArray.h"
#include <cstdio> // For EXIT_SUCCESS
#define VTK_CREATE(type, name) \
vtkSmartPointer<type> name = vtkSmartPointer<type>::New()
// This program generates discrete color maps to be inserted
// into the Qt/Components/Resources/XML/ColorMaps.xml file.
int main( int argc, char* argv[] )
{
int valResult = 1;
VTK_CREATE(vtkColorSeries,palettes);
vtkColor3ub color;
cout.precision( 16 );
int np = palettes->GetNumberOfColorSchemes();
for ( int p = 0; p < np; ++ p )
{
palettes->SetColorScheme( p );
int nc = palettes->GetNumberOfColors(); // in the current scheme
cout << " <ColorMap name=\"" << palettes->GetColorSchemeName() << "\" space=\"HSV\" indexedLookup=\"true\">\n";
double x;
for ( int c = 0; c < nc; ++ c )
{
x = c / (nc - 1.);
color = palettes->GetColorRepeating( c );
cout
<< " <Point"
<< " x=\"" << x << "\""
<< " r=\"" << color.Red() / 255. << "\""
<< " g=\"" << color.Green() / 255. << "\""
<< " b=\"" << color.Blue() / 255. << "\""
<< " o=\"1.0\"/>\n";
}
cout
<< " <NaN"
<< " r=\"" << color.Red() / 255. << "\""
<< " g=\"" << color.Green() / 255. << "\""
<< " b=\"" << color.Blue() / 255. << "\""
<< "/>\n";
cout
<< " </ColorMap>\n";
}
return valResult ? EXIT_SUCCESS : EXIT_FAILURE;
}
vtk_module(vtkUtilitiesColorSeriesToXML
DEPENDS
vtkCommonCore
vtkCommonExecutionModel
vtkCommonColor
EXCLUDE_FROM_WRAPPING)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment