Commit 3870bf95 authored by hrchilds's avatar hrchilds

Store opacities of colors in session files.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@11808 18c085ea-50e0-402c-830e-de6fd14e8384
parent d1f48422
......@@ -43,14 +43,11 @@
#include <map>
#include <ColorControlPointList.h>
// Type map format string
const char *ColorTableAttributes::TypeMapFormatString = "s*a*ss";
// ****************************************************************************
// Method: ColorTableAttributes::ColorTableAttributes
//
// Purpose:
// Constructor for the ColorTableAttributes class.
// Init utility for the ColorTableAttributes class.
//
// Note: Autogenerated by xml2atts.
//
......@@ -61,18 +58,19 @@ const char *ColorTableAttributes::TypeMapFormatString = "s*a*ss";
//
// ****************************************************************************
ColorTableAttributes::ColorTableAttributes() :
AttributeSubject(ColorTableAttributes::TypeMapFormatString)
void ColorTableAttributes::Init()
{
activeContinuous = "hot";
activeDiscrete = "levels";
ColorTableAttributes::SelectAll();
}
// ****************************************************************************
// Method: ColorTableAttributes::ColorTableAttributes
//
// Purpose:
// Copy constructor for the ColorTableAttributes class.
// Copy utility for the ColorTableAttributes class.
//
// Note: Autogenerated by xml2atts.
//
......@@ -83,8 +81,7 @@ ColorTableAttributes::ColorTableAttributes() :
//
// ****************************************************************************
ColorTableAttributes::ColorTableAttributes(const ColorTableAttributes &obj) :
AttributeSubject(ColorTableAttributes::TypeMapFormatString)
void ColorTableAttributes::Copy(const ColorTableAttributes &obj)
{
AttributeGroupVector::const_iterator pos;
......@@ -107,7 +104,96 @@ ColorTableAttributes::ColorTableAttributes(const ColorTableAttributes &obj) :
activeContinuous = obj.activeContinuous;
activeDiscrete = obj.activeDiscrete;
SelectAll();
ColorTableAttributes::SelectAll();
}
// Type map format string
const char *ColorTableAttributes::TypeMapFormatString = COLORTABLEATTRIBUTES_TMFS;
const AttributeGroup::private_tmfs_t ColorTableAttributes::TmfsStruct = {COLORTABLEATTRIBUTES_TMFS};
// ****************************************************************************
// Method: ColorTableAttributes::ColorTableAttributes
//
// Purpose:
// Default constructor for the ColorTableAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
ColorTableAttributes::ColorTableAttributes() :
AttributeSubject(ColorTableAttributes::TypeMapFormatString)
{
ColorTableAttributes::Init();
}
// ****************************************************************************
// Method: ColorTableAttributes::ColorTableAttributes
//
// Purpose:
// Constructor for the derived classes of ColorTableAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
ColorTableAttributes::ColorTableAttributes(private_tmfs_t tmfs) :
AttributeSubject(tmfs.tmfs)
{
ColorTableAttributes::Init();
}
// ****************************************************************************
// Method: ColorTableAttributes::ColorTableAttributes
//
// Purpose:
// Copy constructor for the ColorTableAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
ColorTableAttributes::ColorTableAttributes(const ColorTableAttributes &obj) :
AttributeSubject(ColorTableAttributes::TypeMapFormatString)
{
ColorTableAttributes::Copy(obj);
}
// ****************************************************************************
// Method: ColorTableAttributes::ColorTableAttributes
//
// Purpose:
// Copy constructor for derived classes of the ColorTableAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
ColorTableAttributes::ColorTableAttributes(const ColorTableAttributes &obj, private_tmfs_t tmfs) :
AttributeSubject(tmfs.tmfs)
{
ColorTableAttributes::Copy(obj);
}
// ****************************************************************************
......@@ -153,28 +239,9 @@ ColorTableAttributes&
ColorTableAttributes::operator = (const ColorTableAttributes &obj)
{
if (this == &obj) return *this;
AttributeGroupVector::const_iterator pos;
names = obj.names;
// *** Copy the colorTables field ***
// Delete the AttributeGroup objects and clear the vector.
for(pos = colorTables.begin(); pos != colorTables.end(); ++pos)
delete *pos;
colorTables.clear();
if(obj.colorTables.size() > 0)
colorTables.reserve(obj.colorTables.size());
// Duplicate the colorTables from obj.
for(pos = obj.colorTables.begin(); pos != obj.colorTables.end(); ++pos)
{
ColorControlPointList *oldColorControlPointList = (ColorControlPointList *)(*pos);
ColorControlPointList *newColorControlPointList = new ColorControlPointList(*oldColorControlPointList);
colorTables.push_back(newColorControlPointList);
}
activeContinuous = obj.activeContinuous;
activeDiscrete = obj.activeDiscrete;
ColorTableAttributes::Copy(obj);
SelectAll();
return *this;
}
......@@ -418,6 +485,9 @@ ColorTableAttributes::CreateSubAttributeGroup(int)
// Brad Whitlock, Fri Dec 14 16:07:50 PST 2007
// Made it use ids.
//
// Hank Childs, Thu Jul 1 14:20:26 PDT 2010
// Write out opacities.
//
// ****************************************************************************
bool
......@@ -453,6 +523,7 @@ ColorTableAttributes::CreateNode(DataNode *parentNode, bool, bool)
// Add the control points to the vector that we'll save out.
floatVector fvec;
ctNode->AddNode(new DataNode("colorsHaveOpacity", true));
for(int j = 0; j < ccpl.GetNumControlPoints(); ++j)
{
const ColorControlPoint &cp = ccpl.operator[](j);
......@@ -460,6 +531,7 @@ ColorTableAttributes::CreateNode(DataNode *parentNode, bool, bool)
fvec.push_back(float(cp.GetColors()[0]));
fvec.push_back(float(cp.GetColors()[1]));
fvec.push_back(float(cp.GetColors()[2]));
fvec.push_back(float(cp.GetColors()[3]));
}
ctNode->AddNode(new DataNode("controlPts", fvec));
node->AddNode(ctNode);
......@@ -491,6 +563,9 @@ ColorTableAttributes::CreateNode(DataNode *parentNode, bool, bool)
// Brad Whitlock, Wed Nov 20 12:26:24 PDT 2002
// I made it work with discrete color tables.
//
// Hank Childs, Thu Jul 1 14:20:26 PDT 2010
// Add support for opacities.
//
// ****************************************************************************
void
......@@ -518,6 +593,10 @@ ColorTableAttributes::SetFromNode(DataNode *parentNode)
{
DataNode *nameNode = node->GetNode("ctName");
DataNode *pointNode = node->GetNode("controlPts");
DataNode *colorsHaveOpacity = node->GetNode("colorsHaveOpacity");
bool readAlpha = false;
if (colorsHaveOpacity != NULL)
readAlpha = true;
// If we have the name node and the pointNode, we can add a
// color table.
......@@ -537,16 +616,21 @@ ColorTableAttributes::SetFromNode(DataNode *parentNode)
// Set the color control points.
floatVector fvec = pointNode->AsFloatVector();
for(size_t j = 0; j < fvec.size() / 4; ++j)
int nvalsPerColor = 4;
if (readAlpha)
nvalsPerColor = 5;
for(size_t j = 0; j < fvec.size() / nvalsPerColor; ++j)
{
// Create a control point based on the values
// in the float vector.
int index = j * 4;
int index = j * nvalsPerColor;
ColorControlPoint cpt(fvec[index],
(unsigned char)(fvec[index+1]),
(unsigned char)(fvec[index+2]),
(unsigned char)(fvec[index+3]),
255);
(readAlpha
? (unsigned char)(fvec[index+4])
: 255));
ccpl.AddControlPoints(cpt);
}
......
......@@ -320,6 +320,9 @@ Definition:
// Brad Whitlock, Fri Dec 14 16:07:50 PST 2007
// Made it use ids.
//
// Hank Childs, Thu Jul 1 14:20:26 PDT 2010
// Write out opacities.
//
// ****************************************************************************
bool
......@@ -355,6 +358,7 @@ ColorTableAttributes::CreateNode(DataNode *parentNode, bool, bool)
// Add the control points to the vector that we'll save out.
floatVector fvec;
ctNode->AddNode(new DataNode("colorsHaveOpacity", true));
for(int j = 0; j < ccpl.GetNumControlPoints(); ++j)
{
const ColorControlPoint &cp = ccpl.operator[](j);
......@@ -362,6 +366,7 @@ ColorTableAttributes::CreateNode(DataNode *parentNode, bool, bool)
fvec.push_back(float(cp.GetColors()[0]));
fvec.push_back(float(cp.GetColors()[1]));
fvec.push_back(float(cp.GetColors()[2]));
fvec.push_back(float(cp.GetColors()[3]));
}
ctNode->AddNode(new DataNode("controlPts", fvec));
node->AddNode(ctNode);
......@@ -399,6 +404,9 @@ Definition:
// Brad Whitlock, Wed Nov 20 12:26:24 PDT 2002
// I made it work with discrete color tables.
//
// Hank Childs, Thu Jul 1 14:20:26 PDT 2010
// Add support for opacities.
//
// ****************************************************************************
void
......@@ -426,6 +434,10 @@ ColorTableAttributes::SetFromNode(DataNode *parentNode)
{
DataNode *nameNode = node->GetNode("ctName");
DataNode *pointNode = node->GetNode("controlPts");
DataNode *colorsHaveOpacity = node->GetNode("colorsHaveOpacity");
bool readAlpha = false;
if (colorsHaveOpacity != NULL)
readAlpha = true;
// If we have the name node and the pointNode, we can add a
// color table.
......@@ -445,16 +457,21 @@ ColorTableAttributes::SetFromNode(DataNode *parentNode)
// Set the color control points.
floatVector fvec = pointNode->AsFloatVector();
for(size_t j = 0; j < fvec.size() / 4; ++j)
int nvalsPerColor = 4;
if (readAlpha)
nvalsPerColor = 5;
for(size_t j = 0; j < fvec.size() / nvalsPerColor; ++j)
{
// Create a control point based on the values
// in the float vector.
int index = j * 4;
int index = j * nvalsPerColor;
ColorControlPoint cpt(fvec[index],
(unsigned char)(fvec[index+1]),
(unsigned char)(fvec[index+2]),
(unsigned char)(fvec[index+3]),
255);
(readAlpha
? (unsigned char)(fvec[index+4])
: 255));
ccpl.AddControlPoints(cpt);
}
......
......@@ -41,6 +41,7 @@
#include <state_exports.h>
#include <string>
#include <AttributeSubject.h>
class ColorControlPointList;
// ****************************************************************************
......@@ -61,13 +62,23 @@ class ColorControlPointList;
class STATE_API ColorTableAttributes : public AttributeSubject
{
public:
// These constructors are for objects of this class
ColorTableAttributes();
ColorTableAttributes(const ColorTableAttributes &obj);
protected:
// These constructors are for objects derived from this class
ColorTableAttributes(private_tmfs_t tmfs);
ColorTableAttributes(const ColorTableAttributes &obj, private_tmfs_t tmfs);
public:
virtual ~ColorTableAttributes();
virtual ColorTableAttributes& operator = (const ColorTableAttributes &obj);
virtual bool operator == (const ColorTableAttributes &obj) const;
virtual bool operator != (const ColorTableAttributes &obj) const;
private:
void Init();
void Copy(const ColorTableAttributes &obj);
public:
virtual const std::string TypeName() const;
virtual bool CopyAttributes(const AttributeGroup *);
......@@ -132,7 +143,8 @@ public:
ID_names = 0,
ID_colorTables,
ID_activeContinuous,
ID_activeDiscrete
ID_activeDiscrete,
ID__LAST
};
protected:
......@@ -145,6 +157,8 @@ private:
// Static class format string for type map.
static const char *TypeMapFormatString;
static const private_tmfs_t TmfsStruct;
};
#define COLORTABLEATTRIBUTES_TMFS "s*a*ss"
#endif
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>VisIt 2.0.2 Release Notes</title>
</head>
<body>
<center><b><font size="6">VisIt 2.0.2 Release Notes</font></b></center>
<p>Welcome to VisIt's release notes page. Release 2.0.2 is primarily a bug fix release to release 2.0. It fixes additional bugs in release 2.0. Look <a href="relnotes2.0.0.html">here</a> to see a complete list of changes in release 2.0. Look <a href="relnotes2.0.1.html">here</a> to see fixes to 2.0 in release 2.0.1.</p>
<p><b><font size="4">Bugs fixed in version 2.0.2</font></b></p>
<ul>
<li>Color tables that include transparency can now be saved in a session and restored properly.</li>
</ul>
<p><b><font size="4">Enhancements in version 2.0.2</font></b></p>
<ul>
<li>None</li>
</ul>
<p>Click the following link to view the release notes for the previous version of VisIt: <a href="relnotes2.0.0.html">VisIt 2.0 Release Notes</a>.</p>
</body>
</html>
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