Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
third-party
visit
Commits
de971ea5
Commit
de971ea5
authored
Mar 31, 2007
by
hrchilds
Browse files
Update from October 23, 2003
git-svn-id:
http://visit.ilight.com/svn/visit/trunk/src@106
18c085ea-50e0-402c-830e-de6fd14e8384
parent
735933d9
Changes
45
Hide whitespace changes
Inline
Side-by-side
common/state/ColorControlPointList.C
View file @
de971ea5
...
...
@@ -11,7 +11,7 @@
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -34,7 +34,7 @@ ColorControlPointList::ColorControlPointList() : AttributeSubject("a*bbbb")
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -76,7 +76,7 @@ ColorControlPointList::ColorControlPointList(const ColorControlPointList &obj) :
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -100,7 +100,7 @@ ColorControlPointList::~ColorControlPointList()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -143,7 +143,7 @@ ColorControlPointList::operator = (const ColorControlPointList &obj)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -180,7 +180,7 @@ ColorControlPointList::operator == (const ColorControlPointList &obj) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -201,7 +201,7 @@ ColorControlPointList::operator != (const ColorControlPointList &obj) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -222,7 +222,7 @@ ColorControlPointList::TypeName() const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -250,7 +250,7 @@ ColorControlPointList::CopyAttributes(const AttributeGroup *atts)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -276,7 +276,7 @@ ColorControlPointList::CreateCompatible(const std::string &tname) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -303,7 +303,7 @@ ColorControlPointList::NewInstance(bool copy) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -328,7 +328,7 @@ ColorControlPointList::SelectAll()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -353,7 +353,7 @@ ColorControlPointList::CreateSubAttributeGroup(int)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -423,7 +423,9 @@ ColorControlPointList::CreateNode(DataNode *parentNode, bool forceAdd)
// Creation: Wed Jul 23 11:29:47 PDT 2003
//
// Modifications:
//
// Brad Whitlock, Tue Oct 21 16:22:31 PST 2003
// I added support for reading in colors and positions in their compact form.
//
// ****************************************************************************
void
...
...
@@ -441,16 +443,48 @@ ColorControlPointList::SetFromNode(DataNode *parentNode)
// Clear all the ColorControlPoints.
ClearColorControlPoints
();
// Go through all of the children and construct a new
// ColorControlPoint for each one of them.
children
=
searchNode
->
GetChildren
();
for
(
int
i
=
0
;
i
<
searchNode
->
GetNumChildren
();
++
i
)
//
// Try setting the colors from the compact color and position vectors.
//
bool
colorsAreSet
=
false
;
DataNode
*
compactColorNode
=
searchNode
->
GetNode
(
"compactColors"
);
DataNode
*
compactPositionNode
=
searchNode
->
GetNode
(
"compactPositions"
);
if
(
compactColorNode
!=
0
&&
compactPositionNode
!=
0
)
{
const
unsignedCharVector
&
colors
=
compactColorNode
->
AsUnsignedCharVector
();
const
floatVector
&
positions
=
compactPositionNode
->
AsFloatVector
();
int
npts
=
colors
.
size
()
/
4
;
if
(
npts
>
positions
.
size
())
npts
=
positions
.
size
();
if
(
npts
>
0
)
{
for
(
int
i
=
0
;
i
<
npts
;
++
i
)
{
int
index
=
i
<<
2
;
AddColorControlPoint
(
ColorControlPoint
(
positions
[
i
],
colors
[
index
],
colors
[
index
+
1
],
colors
[
index
+
2
],
colors
[
index
+
3
]));
}
colorsAreSet
=
true
;
}
}
if
(
!
colorsAreSet
)
{
if
(
children
[
i
]
->
GetKey
()
==
std
::
string
(
"ColorControlPoint"
))
// Go through all of the children and construct a new
// ColorControlPoint for each one of them.
children
=
searchNode
->
GetChildren
();
for
(
int
i
=
0
;
i
<
searchNode
->
GetNumChildren
();
++
i
)
{
ColorControlPoint
temp
;
temp
.
SetFromNode
(
children
[
i
]);
AddColorControlPoint
(
temp
);
if
(
children
[
i
]
->
GetKey
()
==
std
::
string
(
"ColorControlPoint"
))
{
ColorControlPoint
temp
;
temp
.
SetFromNode
(
children
[
i
]);
AddColorControlPoint
(
temp
);
}
}
}
...
...
@@ -463,7 +497,6 @@ ColorControlPointList::SetFromNode(DataNode *parentNode)
if
((
node
=
searchNode
->
GetNode
(
"externalFlag"
))
!=
0
)
SetExternalFlag
(
node
->
AsBool
());
}
///////////////////////////////////////////////////////////////////////////////
// Set property methods
///////////////////////////////////////////////////////////////////////////////
...
...
@@ -559,7 +592,7 @@ ColorControlPointList::SelectControlPoints()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -584,7 +617,7 @@ ColorControlPointList::AddColorControlPoint(const ColorControlPoint &obj)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -612,7 +645,7 @@ ColorControlPointList::ClearColorControlPoints()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -647,7 +680,7 @@ ColorControlPointList::RemoveColorControlPoint(int index)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -668,7 +701,7 @@ ColorControlPointList::GetNumColorControlPoints() const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -689,7 +722,7 @@ ColorControlPointList::GetColorControlPoint(int i)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -710,7 +743,7 @@ ColorControlPointList::GetColorControlPoint(int i) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -731,7 +764,7 @@ ColorControlPointList::operator [] (int i)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -756,7 +789,7 @@ ColorControlPointList::operator [] (int i) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -785,7 +818,7 @@ ColorControlPointList::GetFieldName(int index) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -814,7 +847,7 @@ ColorControlPointList::GetFieldType(int index) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -843,7 +876,7 @@ ColorControlPointList::GetFieldTypeName(int index) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -1188,3 +1221,89 @@ ColorControlPointList::GetColors(unsigned char *rgb, int ncolors) const
delete
[]
newPts_b
;
}
// ****************************************************************************
// Method: ColorControlPointList::CompactCreateNode
//
// Purpose:
// This method creates a compact DataNode representation of the object so
// it can be saved to a config file.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: Brad Whitlock
// Creation: Tue Oct 21 16:13:44 PST 2003
//
// Modifications:
//
// ****************************************************************************
bool
ColorControlPointList
::
CompactCreateNode
(
DataNode
*
parentNode
,
bool
forceAdd
)
{
if
(
parentNode
==
0
)
return
false
;
ColorControlPointList
defaultObject
;
bool
addToParent
=
false
;
// Create a node for ColorControlPointList.
DataNode
*
node
=
new
DataNode
(
"ColorControlPointList"
);
//
// Save out the color control points as vectors of uchar and float.
//
int
npts
=
GetNumColorControlPoints
();
if
(
npts
>
0
)
{
unsignedCharVector
compactColors
;
floatVector
compactPositions
;
compactColors
.
reserve
(
npts
<<
2
);
compactPositions
.
reserve
(
npts
);
for
(
int
i
=
0
;
i
<
npts
;
++
i
)
{
const
ColorControlPoint
&
cpt
=
GetColorControlPoint
(
i
);
const
unsigned
char
*
c
=
cpt
.
GetColors
();
compactColors
.
push_back
(
c
[
0
]);
compactColors
.
push_back
(
c
[
1
]);
compactColors
.
push_back
(
c
[
2
]);
compactColors
.
push_back
(
c
[
3
]);
compactPositions
.
push_back
(
cpt
.
GetPosition
());
}
node
->
AddNode
(
new
DataNode
(
"compactColors"
,
compactColors
));
node
->
AddNode
(
new
DataNode
(
"compactPositions"
,
compactPositions
));
addToParent
=
true
;
}
if
(
!
FieldsEqual
(
1
,
&
defaultObject
))
{
addToParent
=
true
;
node
->
AddNode
(
new
DataNode
(
"smoothingFlag"
,
smoothingFlag
));
}
if
(
!
FieldsEqual
(
2
,
&
defaultObject
))
{
addToParent
=
true
;
node
->
AddNode
(
new
DataNode
(
"equalSpacingFlag"
,
equalSpacingFlag
));
}
if
(
!
FieldsEqual
(
3
,
&
defaultObject
))
{
addToParent
=
true
;
node
->
AddNode
(
new
DataNode
(
"discreteFlag"
,
discreteFlag
));
}
if
(
!
FieldsEqual
(
4
,
&
defaultObject
))
{
addToParent
=
true
;
node
->
AddNode
(
new
DataNode
(
"externalFlag"
,
externalFlag
));
}
// Add the node to the parent node.
if
(
addToParent
||
forceAdd
)
parentNode
->
AddNode
(
node
);
else
delete
node
;
return
(
addToParent
||
forceAdd
);
}
common/state/ColorControlPointList.code
View file @
de971ea5
...
...
@@ -286,3 +286,182 @@ ColorControlPointList::GetColors(unsigned char *rgb, int ncolors) const
delete [] newPts_g;
delete [] newPts_b;
}
Function: CompactCreateNode
Declaration: bool CompactCreateNode(DataNode *parentNode, bool forceAdd);
Definition:
// ****************************************************************************
// Method: ColorControlPointList::CompactCreateNode
//
// Purpose:
// This method creates a compact DataNode representation of the object so
// it can be saved to a config file.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: Brad Whitlock
// Creation: Tue Oct 21 16:13:44 PST 2003
//
// Modifications:
//
// ****************************************************************************
bool
ColorControlPointList::CompactCreateNode(DataNode *parentNode, bool forceAdd)
{
if(parentNode == 0)
return false;
ColorControlPointList defaultObject;
bool addToParent = false;
// Create a node for ColorControlPointList.
DataNode *node = new DataNode("ColorControlPointList");
//
// Save out the color control points as vectors of uchar and float.
//
int npts = GetNumColorControlPoints();
if(npts > 0)
{
unsignedCharVector compactColors;
floatVector compactPositions;
compactColors.reserve(npts << 2);
compactPositions.reserve(npts);
for(int i = 0; i < npts; ++i)
{
const ColorControlPoint &cpt = GetColorControlPoint(i);
const unsigned char *c = cpt.GetColors();
compactColors.push_back(c[0]);
compactColors.push_back(c[1]);
compactColors.push_back(c[2]);
compactColors.push_back(c[3]);
compactPositions.push_back(cpt.GetPosition());
}
node->AddNode(new DataNode("compactColors", compactColors));
node->AddNode(new DataNode("compactPositions", compactPositions));
addToParent = true;
}
if(!FieldsEqual(1, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("smoothingFlag", smoothingFlag));
}
if(!FieldsEqual(2, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("equalSpacingFlag", equalSpacingFlag));
}
if(!FieldsEqual(3, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("discreteFlag", discreteFlag));
}
if(!FieldsEqual(4, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("externalFlag", externalFlag));
}
// Add the node to the parent node.
if(addToParent || forceAdd)
parentNode->AddNode(node);
else
delete node;
return (addToParent || forceAdd);
}
Function: SetFromNode
Declaration: bool SetFromNode(DataNode *parentNode);
Definition:
// ****************************************************************************
// Method: ColorControlPointList::SetFromNode
//
// Purpose:
// This method sets attributes in this object from values in a DataNode representation of the object.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Wed Jul 23 11:29:47 PDT 2003
//
// Modifications:
// Brad Whitlock, Tue Oct 21 16:22:31 PST 2003
// I added support for reading in colors and positions in their compact form.
//
// ****************************************************************************
void
ColorControlPointList::SetFromNode(DataNode *parentNode)
{
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("ColorControlPointList");
if(searchNode == 0)
return;
DataNode *node;
DataNode **children;
// Clear all the ColorControlPoints.
ClearColorControlPoints();
//
// Try setting the colors from the compact color and position vectors.
//
bool colorsAreSet = false;
DataNode *compactColorNode = searchNode->GetNode("compactColors");
DataNode *compactPositionNode = searchNode->GetNode("compactPositions");
if(compactColorNode != 0 && compactPositionNode != 0)
{
const unsignedCharVector &colors = compactColorNode->AsUnsignedCharVector();
const floatVector &positions = compactPositionNode->AsFloatVector();
int npts = colors.size() / 4;
if(npts > positions.size())
npts = positions.size();
if(npts > 0)
{
for(int i = 0; i < npts; ++i)
{
int index = i << 2;
AddColorControlPoint(ColorControlPoint(positions[i],
colors[index],
colors[index+1],
colors[index+2],
colors[index+3]));
}
colorsAreSet = true;
}
}
if(!colorsAreSet)
{
// Go through all of the children and construct a new
// ColorControlPoint for each one of them.
children = searchNode->GetChildren();
for(int i = 0; i < searchNode->GetNumChildren(); ++i)
{
if(children[i]->GetKey() == std::string("ColorControlPoint"))
{
ColorControlPoint temp;
temp.SetFromNode(children[i]);
AddColorControlPoint(temp);
}
}
}
if((node = searchNode->GetNode("smoothingFlag")) != 0)
SetSmoothingFlag(node->AsBool());
if((node = searchNode->GetNode("equalSpacingFlag")) != 0)
SetEqualSpacingFlag(node->AsBool());
if((node = searchNode->GetNode("discreteFlag")) != 0)
SetDiscreteFlag(node->AsBool());
if((node = searchNode->GetNode("externalFlag")) != 0)
SetExternalFlag(node->AsBool());
}
common/state/ColorControlPointList.h
View file @
de971ea5
...
...
@@ -13,7 +13,7 @@ class ColorControlPoint;
// Notes: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Wed Jul 23 11:29:47
P
D
T 2003
// Creation:
Tue Oct 21 17:17:15
P
S
T 2003
//
// Modifications:
//
...
...
@@ -79,6 +79,7 @@ public:
// User-defined methods
void
GetColors
(
unsigned
char
*
rgb
,
int
ncolors
)
const
;
bool
CompactCreateNode
(
DataNode
*
parentNode
,
bool
forceAdd
);
protected:
AttributeGroup
*
CreateSubAttributeGroup
(
int
index
);
private:
...
...
common/state/ColorControlPointList.xml
View file @
de971ea5
...
...
@@ -6,4 +6,6 @@
<Field
name=
"discreteFlag"
type=
"bool"
>
false
</Field>
<Field
name=
"externalFlag"
type=
"bool"
>
false
</Field>
<Function
name=
"GetColors"
user=
"true"
member=
"true"
></Function>
<Function
name=
"SetFromNode"
user=
"false"
member=
"true"
></Function>
<Function
name=
"CompactCreateNode"
user=
"true"
member=
"true"
></Function>
</Attribute>
common/state/View2DAttributes.C
View file @
de971ea5
...
...
@@ -10,13 +10,13 @@
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Fri Aug 15 08:33
:4
8
PDT 2003
// Creation:
Thu Oct 16 11:42
:4
1
PDT 2003
//
// Modifications:
//
// ****************************************************************************
View2DAttributes
::
View2DAttributes
()
:
AttributeSubject
(
"DD"
)
View2DAttributes
::
View2DAttributes
()
:
AttributeSubject
(
"DD
b
"
)
{
windowCoords
[
0
]
=
0
;
windowCoords
[
1
]
=
0
;
...
...
@@ -26,6 +26,7 @@ View2DAttributes::View2DAttributes() : AttributeSubject("DD")
viewportCoords
[
1
]
=
0
.
1
;
viewportCoords
[
2
]
=
0
.
9
;
viewportCoords
[
3
]
=
0
.
9
;
fullFrame
=
false
;
}
// ****************************************************************************
...
...
@@ -37,13 +38,13 @@ View2DAttributes::View2DAttributes() : AttributeSubject("DD")
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation:
Fri Aug 15 08:33
:4
8
PDT 2003
// Creation:
Thu Oct 16 11:42
:4
1
PDT 2003
//
// Modifications:
//
// ****************************************************************************
View2DAttributes
::
View2DAttributes
(
const
View2DAttributes
&
obj
)
:
AttributeSubject
(
"DD"
)
View2DAttributes
::
View2DAttributes
(
const
View2DAttributes
&
obj
)
:
AttributeSubject
(
"DD
b
"
)
{
int
i
;
...
...
@@ -53,6 +54,7 @@ View2DAttributes::View2DAttributes(const View2DAttributes &obj) : AttributeSubje
for
(
i
=
0
;
i
<
4
;
++
i
)
viewportCoords
[
i
]
=
obj
.
viewportCoords
[
i
];
fullFrame
=
obj
.
fullFrame
;
SelectAll
();
}
...
...
@@ -66,7 +68,7 @@ View2DAttributes::View2DAttributes(const View2DAttributes &obj) : AttributeSubje
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts