Commit cbe51a83 authored by hrchilds's avatar hrchilds
Browse files

Update from October 25, 2004

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@347 18c085ea-50e0-402c-830e-de6fd14e8384
parent 4aa948c1
......@@ -1413,7 +1413,7 @@ avtDatabase::GetExtentsFromAuxiliaryData(avtDataSpecification_p spec,
int nvals = 2;
if (strcmp(type, AUXILIARY_DATA_SPATIAL_EXTENTS) == 0)
nvals = 6;
for (int i = 0; i < 6; i++)
for (int i = 0; i < nvals; i++)
extents[i] = fextents[i];
return true;
......
This diff is collapsed.
......@@ -29,7 +29,10 @@ class QComboBox;
// Creation: October 10, 2004
//
// Modifications:
//
// Jeremy Meredith, Mon Oct 25 11:32:14 PDT 2004
// Reversed the sense of the "hidden" button. Added a list-box-index to
// expresion-list-index map so we didn't have to index expressions by name.
//
// ****************************************************************************
class GUI_API QvisExpressionsWindow : public QvisPostableWindowObserver
......@@ -55,7 +58,7 @@ class GUI_API QvisExpressionsWindow : public QvisPostableWindowObserver
void nameTextChanged(const QString&);
void definitionTextChanged();
void typeChanged(int);
void hiddenChanged();
void notHiddenChanged();
void displayAllVarsChanged();
void insertFunction(int);
......@@ -72,7 +75,7 @@ class GUI_API QvisExpressionsWindow : public QvisPostableWindowObserver
QLineEdit *nameEdit;
QComboBox *typeList;
QCheckBox *hidden;
QCheckBox *notHidden;
QMultiLineEdit *definitionEdit;
QPushButton *newButton;
......@@ -85,6 +88,7 @@ class GUI_API QvisExpressionsWindow : public QvisPostableWindowObserver
// State information
ExpressionList *exprList;
std::map<int,int> indexMap;
};
#endif
//
// Make sure that CREATE_LABEL defaults to SNPRINTF if we have not
// defined it.
//
#ifndef CREATE_LABEL
#define CREATE_LABEL SNPRINTF
#endif
vtkIdType nCells = input->GetNumberOfCells();
vtkIdType skipIncrement = 1;
//
// Look for the cell center array that the label filter calculated.
//
//vtkFloatArray *cellCenters = GetCellCenterArray();
//if(cellCenters == 0)
// return;
//
// Look for the original cell number array.
//
vtkUnsignedIntArray *originalCells = 0;
vtkDataArray *data = input->GetCellData()->GetArray("LabelFilterOriginalCellNumbers");
if(data == 0)
{
debug3 << "avtLabelRenderer could not find LabelFilterOriginalCellNumbers" << endl;
}
else if(!data->IsA("vtkUnsignedIntArray"))
{
debug3 << "avtLabelRenderer found LabelFilterOriginalCellNumbers but it "
"was not a vtkUnsignedIntArray. It was a " << data->GetClassName() << endl;
}
else
{
originalCells = (vtkUnsignedIntArray *)data;
}
//
// Look for the variable that we want to plot.
//
data = input->GetCellData()->GetArray(varname);
if(data != 0)
{
int numElements = data->GetNumberOfTuples();
if(numElements != nCells)
{
debug3 << "The number of vectors is: " << numElements
<< ", while the #cells is: " << nCells << endl;
}
if(data->GetNumberOfComponents() == 1)
{
debug3 << "Labelling cells with scalar data" << endl;
if(treatAsASCII)
{
for(vtkIdType id = 0; id < nCells; id += skipIncrement)
{
// float *vert = cellCenters->GetTuple3(id);
BEGIN_LABEL
unsigned char scalarVal = (unsigned char)data->GetTuple1(id);
CREATE_LABEL(labelString, MAX_LABEL_SIZE, "%c", scalarVal);
END_LABEL
}
}
else
{
for(vtkIdType id = 0; id < nCells; id += skipIncrement)
{
// float *vert = cellCenters->GetTuple3(id);
BEGIN_LABEL
float scalarVal = data->GetTuple1(id);
CREATE_LABEL(labelString, MAX_LABEL_SIZE, "%g", scalarVal);
END_LABEL
}
}
}
else if(data->GetNumberOfComponents() == 2)
{
debug3 << "Labelling cells with 2d vector data" << endl;
for(vtkIdType id = 0; id < nCells; id += skipIncrement)
{
// float *vert = cellCenters->GetTuple3(id);
BEGIN_LABEL
float *vectorVal = data->GetTuple2(id);
CREATE_LABEL(labelString, MAX_LABEL_SIZE, "<%g, %g>",
vectorVal[0], vectorVal[1]);
END_LABEL
}
}
else if(data->GetNumberOfComponents() == 3)
{
debug3 << "Labelling cells with 3d vector data" << endl;
for(vtkIdType id = 0; id < nCells; id += skipIncrement)
{
// float *vert = cellCenters->GetTuple3(id);
BEGIN_LABEL
float *vectorVal = data->GetTuple3(id);
CREATE_LABEL(labelString, MAX_LABEL_SIZE, "<%g, %g, %g>",
vectorVal[0], vectorVal[1], vectorVal[2]);
END_LABEL
}
}
else
{
debug3 << "The input vector has " << data->GetNumberOfComponents()
<< " components. We don't like that!" << endl;
}
}
else if(originalCells != 0)
{
debug3 << "Labelling cells with original cell indices: "
<< "nOriginalCells:" << originalCells->GetNumberOfTuples()
<< ", nCells=" << nCells
<< endl;
//
// Figure out the first real index in x,y,z. This only matters if we
// have ghost zones and structured indices.
//
unsigned int xbase = 0, ybase = 0, zbase = 0;
vtkDataArray *rDims = input->GetFieldData()->
GetArray("avtRealDims");
if(rDims != 0 &&
rDims->IsA("vtkIntArray") &&
rDims->GetNumberOfTuples() == 6)
{
const int *iptr2 = (const int *)rDims->GetVoidPointer(0);
xbase = iptr2[0];
ybase = iptr2[2];
zbase = iptr2[4];
}
vtkDataArray *sDims = input->GetFieldData()->
GetArray("avtOriginalStructuredDimensions");
if((atts.GetLabelDisplayFormat() == LabelAttributes::Natural ||
atts.GetLabelDisplayFormat() == LabelAttributes::LogicalIndex) &&
sDims != 0 &&
sDims->IsA("vtkUnsignedIntArray") &&
sDims->GetNumberOfTuples() == 3)
{
//
// Add the cell labels as structured indices.
//
const unsigned int *iptr = (const unsigned int *)sDims->GetVoidPointer(0);
unsigned int xdims = iptr[0]-1;
unsigned int ydims = iptr[1]-1;
unsigned int zdims = iptr[2]-1;
if(zdims == 0)
{
for(vtkIdType id = 0; id < nCells; id += skipIncrement)
{
// float *vert = cellCenters->GetTuple3(id);
BEGIN_LABEL
unsigned int realCellId = originalCells->GetValue(id);
unsigned int y = (realCellId / xdims) - ybase;
unsigned int x = (realCellId % xdims) - xbase;
CREATE_LABEL(labelString, MAX_LABEL_SIZE, "%d,%d", x, y);
END_LABEL
}
}
else
{
unsigned int xydims = xdims * ydims;
for(vtkIdType id = 0; id < nCells; id += skipIncrement)
{
// float *vert = cellCenters->GetTuple3(id);
BEGIN_LABEL
unsigned int realCellId = originalCells->GetValue(id);
unsigned int z = (realCellId / xydims) - zbase;
unsigned int offset = realCellId % xydims;
unsigned int y = (offset / xdims) - ybase;
unsigned int x = (offset % xdims) - xbase;
CREATE_LABEL(labelString, MAX_LABEL_SIZE, "%d,%d,%d", x, y, z);
END_LABEL
}
}
}
else
{
for(vtkIdType id = 0; id < nCells; id += skipIncrement)
{
// float *vert = cellCenters->GetTuple3(id);
BEGIN_LABEL
unsigned int realCellId = originalCells->GetValue(id);
CREATE_LABEL(labelString, MAX_LABEL_SIZE, "%d", realCellId);
END_LABEL
}
}
}
else
{
for(vtkIdType id = 0; id < nCells; id += skipIncrement)
{
// float *vert = cellCenters->GetTuple3(id);
BEGIN_LABEL
CREATE_LABEL(labelString, MAX_LABEL_SIZE, "%d", id);
END_LABEL
}
}
<?xml version="1.0"?>
<Plugin name="Label" type="plot" label="Label" version="1.0" enabled="true" vartype="mesh,scalar,vector" iconFile="Label.xpm">
<Files components="V">
avtLabelFilter.C
avtLabelRenderer.C
avtMesaLabelRenderer.C
avtOpenGLLabelRenderer.C
</Files>
<Files components="E">
avtLabelFilter.C
avtLabelRenderer.C
avtMesaLabelRenderer.C
avtOpenGLLabelRenderer.C
</Files>
<Attribute name="LabelAttributes" purpose="This class contains the fields that we need to set the attributes for the Label plot." persistent="true" exportAPI="" exportInclude="" codefile="LabelAttributes.code">
<Enum name="LabelIndexDisplay">
Natural
LogicalIndex
Index
</Enum>
<Enum name="LabelHorizontalAlignment">
HCenter
Left
Right
</Enum>
<Enum name="LabelVerticalAlignment">
VCenter
Top
Bottom
</Enum>
<Enum name="LabelDrawFacing">
Front
Back
FrontAndBack
</Enum>
<Field name="legendFlag" label="Legend" type="bool">
true
</Field>
<Field name="showNodes" label="Show nodes" type="bool">
false
</Field>
<Field name="showCells" label="Show cells" type="bool">
true
</Field>
<Field name="restrictNumberOfLabels" label="Restrict number of labels" type="bool">
true
</Field>
<Field name="drawLabelsFacing" label="Draw labels facing" type="enum" subtype="LabelDrawFacing">
Front
</Field>
<Field name="showSingleNode" label="Show single node" type="bool">
false
</Field>
<Field name="showSingleCell" label="Show single cell" type="bool">
false
</Field>
<Field name="useForegroundTextColor" label="Use foreground text color" type="bool">
true
</Field>
<Field name="labelDisplayFormat" label="Label display" type="enum" subtype="LabelIndexDisplay">
Natural
</Field>
<Field name="numberOfLabels" label="numberOfLabels" type="int">
200
</Field>
<Field name="textColor" label="Text color" type="color" enabler="useForegroundTextColor:true">
255
0
0
0
</Field>
<Field name="textHeight" label="textHeight" type="float">
0.020000
</Field>
<Field name="textLabel" label="textLabel" type="string">
*
</Field>
<Field name="horizontalJustification" label="Horizontal justification" type="enum" subtype="LabelHorizontalAlignment">
HCenter
</Field>
<Field name="verticalJustification" label="Vertical Justification" type="enum" subtype="LabelVerticalAlignment">
VCenter
</Field>
<Field name="singleNodeIndex" label="Single node index" type="int">
0
</Field>
<Field name="singleCellIndex" label="Single cell index" type="int">
0
</Field>
<Function name="ChangesRequireRecalculation" user="true" member="true">
</Function>
</Attribute>
</Plugin>
/* XPM */
static const char * Label_xpm[] = {
"32 32 25 1",
"_ c None",
". c #090808",
"+ c #3C3B3B",
"@ c #5B5A5A",
"# c #615E5E",
"$ c #656565",
"% c #EE0D0D",
"& c #7A7979",
"* c #CB1B1B",
"= c #969494",
"- c #B82222",
"; c #A1A0A0",
"> c #A23D3D",
", c #CFCFCF",
"' c #AA2828",
") c #2C2B2B",
"! c #824848",
"~ c #A8A8A8",
"{ c #3F1515",
"] c #AEAEAE",
"^ c #724E4E",
"/ c #494949",
"( c #1D1919",
": c #AE5A5A",
"< c #C68282",
"________________________________",
"_______________~~]______________",
"______________/##&]_____________",
"______________/@#,______________",
"_____________/+@,,,_____________",
"_____________/@#,__]______~~____",
"____________/+@,,;$&;___=+)@;___",
"____________/@@)...(&]_/...)=___",
"___________/+@))(.../~+...($~___",
"___________/@@,=&(..+/()@=;~____",
"___________/@#,]_+..(()$~_______",
"__________/+@,$=]@...(@;________",
"__________/@#,=;]&(..+=_________",
"_________/+@,$=~_;(..@~_________",
"_&,,,____/@@,=;]_@.../~_________",
"_$$,,,,<%%%%!:~_&(...);_________",
"_$###,$%%%%%%*<;)()..(=_________",
"_/++@#-%%%%%%*>(.+$(..$]________",
"__=+++-******-{.)&](../~________",
"___]=+''--'{...&&]_+..)&;]______",
"_____]>>>>{...+_,,_/....)$=_____",
"______:!!!{{{+@@$$,,@(()/&;_____",
"______/^^^^^^++@@##$,,,_]_______",
"_____/#@@,$$&=/++@@##$,,,_______",
"_____/##,]_]]__=+++@@##$$,,,,___",
"____/###,_______]=+++@####$,,___",
"____/@#,$=]_______]==+++@@##$&]_",
"___/+@,,_]___________==+++@@#&]_",
"___/@#,$=]_____________==+++@=__",
"___/#,,,_________________]===]__",
"____~]__________________________",
"________________________________"};
This diff is collapsed.
Function: ChangesRequireRecalculation
Declaration: virtual bool ChangesRequireRecalculation(const LabelAttributes &) const;
Definition:
bool
LabelAttributes::ChangesRequireRecalculation(const LabelAttributes &) const
{
return false;
}
#ifndef LABELATTRIBUTES_H
#define LABELATTRIBUTES_H
#include <string>
#include <AttributeSubject.h>
#include <ColorAttribute.h>
// ****************************************************************************
// Class: LabelAttributes
//
// Purpose:
// This class contains the fields that we need to set the attributes for the Label plot.
//
// Notes: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Oct 21 18:18:05 PST 2004
//
// Modifications:
//
// ****************************************************************************
class LabelAttributes : public AttributeSubject
{
public:
enum LabelIndexDisplay
{
Natural,
LogicalIndex,
Index
};
enum LabelHorizontalAlignment
{
HCenter,
Left,
Right
};
enum LabelVerticalAlignment
{
VCenter,
Top,
Bottom
};
enum LabelDrawFacing
{
Front,
Back,
FrontAndBack
};
LabelAttributes();
LabelAttributes(const LabelAttributes &obj);
virtual ~LabelAttributes();
virtual void operator = (const LabelAttributes &obj);
virtual bool operator == (const LabelAttributes &obj) const;
virtual bool operator != (const LabelAttributes &obj) const;
virtual const std::string TypeName() const;
virtual bool CopyAttributes(const AttributeGroup *);
virtual AttributeSubject *CreateCompatible(const std::string &) const;
virtual AttributeSubject *NewInstance(bool) const;
// Property selection methods
virtual void SelectAll();
void SelectTextColor();
void SelectTextLabel();
// Property setting methods
void SetLegendFlag(bool legendFlag_);
void SetShowNodes(bool showNodes_);
void SetShowCells(bool showCells_);
void SetRestrictNumberOfLabels(bool restrictNumberOfLabels_);
void SetDrawLabelsFacing(LabelDrawFacing drawLabelsFacing_);
void SetShowSingleNode(bool showSingleNode_);
void SetShowSingleCell(bool showSingleCell_);
void SetUseForegroundTextColor(bool useForegroundTextColor_);
void SetLabelDisplayFormat(LabelIndexDisplay labelDisplayFormat_);
void SetNumberOfLabels(int numberOfLabels_);
void SetTextColor(const ColorAttribute &textColor_);
void SetTextHeight(float textHeight_);
void SetTextLabel(const std::string &textLabel_);
void SetHorizontalJustification(LabelHorizontalAlignment horizontalJustification_);
void SetVerticalJustification(LabelVerticalAlignment verticalJustification_);
void SetSingleNodeIndex(int singleNodeIndex_);
void SetSingleCellIndex(int singleCellIndex_);
// Property getting methods
bool GetLegendFlag() const;
bool GetShowNodes() const;
bool GetShowCells() const;
bool GetRestrictNumberOfLabels() const;
LabelDrawFacing GetDrawLabelsFacing() const;
bool GetShowSingleNode() const;
bool GetShowSingleCell() const;
bool GetUseForegroundTextColor() const;
LabelIndexDisplay GetLabelDisplayFormat() const;
int GetNumberOfLabels() const;
const ColorAttribute &GetTextColor() const;
ColorAttribute &GetTextColor();
float GetTextHeight() const;
const std::string &GetTextLabel() const;
std::string &GetTextLabel();
LabelHorizontalAlignment GetHorizontalJustification() const;
LabelVerticalAlignment GetVerticalJustification() const;
int GetSingleNodeIndex() const;
int GetSingleCellIndex() const;
// Persistence methods
virtual bool CreateNode(DataNode *node, bool completeSave, bool forceAdd);
virtual void SetFromNode(DataNode *node);
// Enum conversion functions
static std::string LabelIndexDisplay_ToString(LabelIndexDisplay);
static bool LabelIndexDisplay_FromString(const std::string &, LabelIndexDisplay &);
protected:
static std::string LabelIndexDisplay_ToString(int);
public:
static std::string LabelHorizontalAlignment_ToString(LabelHorizontalAlignment);
static bool LabelHorizontalAlignment_FromString(const std::string &, LabelHorizontalAlignment &);
protected:
static std::string LabelHorizontalAlignment_ToString(int);
public:
static std::string LabelVerticalAlignment_ToString(LabelVerticalAlignment);
static bool LabelVerticalAlignment_FromString(const std::string &, LabelVerticalAlignment &);
protected:
static std::string LabelVerticalAlignment_ToString(int);
public:
static std::string LabelDrawFacing_ToString(LabelDrawFacing);
static bool LabelDrawFacing_FromString(const std::string &, LabelDrawFacing &);
protected:
static std::string LabelDrawFacing_ToString(int);
public:
// Keyframing methods
virtual std::string GetFieldName(int index) const;
virtual AttributeGroup::FieldType GetFieldType(int index) const;
virtual std::string GetFieldTypeName(int index) const;
virtual bool FieldsEqual(int index, const AttributeGroup *rhs) const;
// User-defined methods
virtual bool ChangesRequireRecalculation(const LabelAttributes &) const;
private:
bool legendFlag;
bool showNodes;
bool showCells;
bool restrictNumberOfLabels;
int drawLabelsFacing;
bool showSingleNode;
bool showSingleCell;
bool useForegroundTextColor;
int labelDisplayFormat;
int numberOfLabels;
ColorAttribute textColor;
float textHeight;
std::string textLabel;
int horizontalJustification;
int verticalJustification;
int singleNodeIndex;
int singleCellIndex;
};
#endif
package llnl.visit.plots;
import llnl.visit.AttributeSubject;
import llnl.visit.CommunicationBuffer;
import llnl.visit.Plugin;
import llnl.visit.ColorAttribute;
// ****************************************************************************
// Class: LabelAttributes
//
// Purpose:
// This class contains the fields that we need to set the attributes for the Label plot.
//
// Notes: Autogenerated by xml2java.
//
// Programmer: xml2java
// Creation: Thu Oct 21 18:18:08 PST 2004
//
// Modifications:
//
// ****************************************************************************
public class LabelAttributes extends AttributeSubject implements Plugin
{
// Enum values
public final static int LABELINDEXDISPLAY_NATURAL = 0;
public final static int LABELINDEXDISPLAY_LOGICALINDEX = 1;
public final static int LABELINDEXDISPLAY_INDEX = 2;
public final static int LABELHORIZONTALALIGNMENT_HCENTER = 0;
public final static int LABELHORIZONTALALIGNMENT_LEFT = 1;