Commit a2dc7965 authored by bonnell's avatar bonnell

Remove avt dependency from PickAttributes

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@7322 18c085ea-50e0-402c-830e-de6fd14e8384
parent df5f7fef
......@@ -266,7 +266,7 @@ avtPickQuery::PostExecute(void)
"list. Please check the requested variables list and try again.");
}
}
pickAtts.SetMeshCoordType(GetInput()->GetInfo().GetAttributes().GetMeshCoordType());
pickAtts.SetMeshCoordType((PickAttributes::CoordinateType)GetInput()->GetInfo().GetAttributes().GetMeshCoordType());
}
......
......@@ -256,7 +256,7 @@ main(int argc, char *argv[])
}
else if(ARG("-version"))
{
printf("%s\n", VERSION);
printf("%s\n", VISIT_VERSION);
return 0;
}
else if(ARG("-gui"))
......@@ -630,7 +630,7 @@ ReadKeyFromRoot(HKEY which_root, const char *key, char **keyval)
/*
* Try and read the key from the system registry.
*/
sprintf(regkey, "VISIT%s", VERSION);
sprintf(regkey, "VISIT%s", VISIT_VERSION);
if (*keyval == 0)
*keyval = (char *)malloc(500);
......@@ -871,7 +871,7 @@ AddEnvironment(int useShortFileName)
if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL,
SHGFP_TYPE_CURRENT, szPath)))
{
SNPRINTF(visituserpath, 512, "%s\\VisIt %s", szPath, VERSION);
SNPRINTF(visituserpath, 512, "%s\\VisIt %s", szPath, VISIT_VERSION);
haveVISITUSERHOME = 1;
}
......@@ -1647,8 +1647,8 @@ TestForConfigFiles(const char *component)
char rcNamegui[512];
char rcNamecli[512];
// Has this version of visit already been run and this question asked?
sprintf(rcNamegui, "%s\\state%s.txt", visItUserHome, VERSION);
sprintf(rcNamecli, "%s\\clistate%s.txt", visItUserHome, VERSION);
sprintf(rcNamegui, "%s\\state%s.txt", visItUserHome, VISIT_VERSION);
sprintf(rcNamecli, "%s\\clistate%s.txt", visItUserHome, VISIT_VERSION);
if ((_access(rcNamegui, 0) == 0) || (_access(rcNamecli, 0) == 0))
{
......@@ -1665,7 +1665,7 @@ TestForConfigFiles(const char *component)
char msg[512];
string userHome = GetUserHomeDir();
if (GetPathToOlderConfigFiles(userHome.c_str(), VERSION, oldVersion, msg))
if (GetPathToOlderConfigFiles(userHome.c_str(), VISIT_VERSION, oldVersion, msg))
{
if (strcmp(component, "gui") == 0)
{
......@@ -1674,7 +1674,7 @@ TestForConfigFiles(const char *component)
if (msgboxID == IDYES)
{
MigrateConfigFiles(userHome.c_str(), VERSION, oldVersion);
MigrateConfigFiles(userHome.c_str(), VISIT_VERSION, oldVersion);
}
}
else
......@@ -1684,7 +1684,7 @@ TestForConfigFiles(const char *component)
std::cin >> copyConfigs;
if (copyConfigs == 'y' || copyConfigs == 'Y')
{
MigrateConfigFiles(userHome.c_str(), VERSION, oldVersion);
MigrateConfigFiles(userHome.c_str(), VISIT_VERSION, oldVersion);
}
// Create the clistate file. Cannot use state.txt, as that is
// needed by the gui to determine whether or not release notes
......
......@@ -40,7 +40,6 @@
#include <DataNode.h>
#include <stdio.h>
#include <float.h>
#include <avtTypes.h>
#include <cstring>
#include <PickVarInfo.h>
......@@ -83,6 +82,44 @@ PickAttributes::PickType_FromString(const std::string &s, PickAttributes::PickTy
return false;
}
//
// Enum conversion methods for PickAttributes::CoordinateType
//
static const char *CoordinateType_strings[] = {
"XY", "RZ", "ZR"
};
std::string
PickAttributes::CoordinateType_ToString(PickAttributes::CoordinateType t)
{
int index = int(t);
if(index < 0 || index >= 3) index = 0;
return CoordinateType_strings[index];
}
std::string
PickAttributes::CoordinateType_ToString(int t)
{
int index = (t < 0 || t >= 3) ? 0 : t;
return CoordinateType_strings[index];
}
bool
PickAttributes::CoordinateType_FromString(const std::string &s, PickAttributes::CoordinateType &val)
{
val = PickAttributes::XY;
for(int i = 0; i < 3; ++i)
{
if(s == CoordinateType_strings[i])
{
val = (CoordinateType)i;
return true;
}
}
return false;
}
// Type map format string
const char *PickAttributes::TypeMapFormatString = "s*bbbbbbbbbsbiiii*iissDDDDDDsii*s*s*s*s*s*ba*s*bsbbbbbbssi*bbbbbii*bbbiibiibssb";
......@@ -163,7 +200,7 @@ PickAttributes::PickAttributes() :
hasMixedGhostTypes = -1;
linesData = false;
inputTopoDim = -1;
meshCoordType = 0;
meshCoordType = XY;
createSpreadsheet = false;
floatFormat = "%g";
timePreserveCoord = true;
......@@ -1467,7 +1504,7 @@ PickAttributes::SetInputTopoDim(int inputTopoDim_)
}
void
PickAttributes::SetMeshCoordType(int meshCoordType_)
PickAttributes::SetMeshCoordType(PickAttributes::CoordinateType meshCoordType_)
{
meshCoordType = meshCoordType_;
Select(ID_meshCoordType, (void *)&meshCoordType);
......@@ -2027,10 +2064,10 @@ PickAttributes::GetInputTopoDim() const
return inputTopoDim;
}
int
PickAttributes::CoordinateType
PickAttributes::GetMeshCoordType() const
{
return meshCoordType;
return CoordinateType(meshCoordType);
}
bool
......@@ -2609,7 +2646,7 @@ PickAttributes::GetFieldType(int index) const
case ID_hasMixedGhostTypes: return FieldType_int;
case ID_linesData: return FieldType_bool;
case ID_inputTopoDim: return FieldType_int;
case ID_meshCoordType: return FieldType_int;
case ID_meshCoordType: return FieldType_enum;
case ID_createSpreadsheet: return FieldType_bool;
case ID_subsetName: return FieldType_string;
case ID_floatFormat: return FieldType_string;
......@@ -2700,7 +2737,7 @@ PickAttributes::GetFieldTypeName(int index) const
case ID_hasMixedGhostTypes: return "int";
case ID_linesData: return "bool";
case ID_inputTopoDim: return "int";
case ID_meshCoordType: return "int";
case ID_meshCoordType: return "enum";
case ID_createSpreadsheet: return "bool";
case ID_subsetName: return "string";
case ID_floatFormat: return "string";
......@@ -3231,9 +3268,9 @@ PickAttributes::PrintSelf(ostream &os)
else if (cellPoint[0] != FLT_MAX)
{
os << "PickedPoint: ";
if (meshCoordType == AVT_RZ)
if (meshCoordType == RZ)
os << "(Z,R) ";
else if (meshCoordType == AVT_ZR)
else if (meshCoordType == ZR)
os << "(R,Z) ";
if (needTransformMessage)
{
......@@ -3489,9 +3526,9 @@ PickAttributes::CreateOutputString(std::string &os, bool withLetter)
}
std::string point = "Point";
if (meshCoordType == AVT_RZ)
if (meshCoordType == RZ)
point += " (Z,R)";
else if (meshCoordType == AVT_ZR)
else if (meshCoordType == ZR)
point += " (R,Z)";
if (pickType == CurveNode)
......@@ -3767,6 +3804,9 @@ PickAttributes::CreateOutputString(std::string &os, bool withLetter)
// Kathleen Bonnell, Tue Feb 13 12:41:28 PST 2007
// Reset meshCoordType.
//
// Brad Whitlock, Tue Jan 20 16:42:30 PST 2009
// Changed to using local CoordinateType enum.
//
// ****************************************************************************
void
......@@ -3783,7 +3823,7 @@ PickAttributes::PrepareForNewPick()
needTransformMessage = false;
ghostType = 0;
hasMixedGhostTypes = -1;
meshCoordType = AVT_XY;
meshCoordType = XY;
if (!incidentElements.empty())
incidentElements.clear();
......
......@@ -117,9 +117,9 @@ PickAttributes::PrintSelf(ostream &os)
else if (cellPoint[0] != FLT_MAX)
{
os << "PickedPoint: ";
if (meshCoordType == AVT_RZ)
if (meshCoordType == RZ)
os << "(Z,R) ";
else if (meshCoordType == AVT_ZR)
else if (meshCoordType == ZR)
os << "(R,Z) ";
if (needTransformMessage)
{
......@@ -378,9 +378,9 @@ PickAttributes::CreateOutputString(std::string &os, bool withLetter)
}
std::string point = "Point";
if (meshCoordType == AVT_RZ)
if (meshCoordType == RZ)
point += " (Z,R)";
else if (meshCoordType == AVT_ZR)
else if (meshCoordType == ZR)
point += " (R,Z)";
if (pickType == CurveNode)
......@@ -659,6 +659,9 @@ Definition:
// Kathleen Bonnell, Tue Feb 13 12:41:28 PST 2007
// Reset meshCoordType.
//
// Brad Whitlock, Tue Jan 20 16:42:30 PST 2009
// Changed to using local CoordinateType enum.
//
// ****************************************************************************
void
......@@ -675,7 +678,7 @@ PickAttributes::PrepareForNewPick()
needTransformMessage = false;
ghostType = 0;
hasMixedGhostTypes = -1;
meshCoordType = AVT_XY;
meshCoordType = XY;
if (!incidentElements.empty())
incidentElements.clear();
......
......@@ -71,6 +71,12 @@ public:
DomainZone,
DomainNode
};
enum CoordinateType
{
XY,
RZ,
ZR
};
PickAttributes();
PickAttributes(const PickAttributes &obj);
......@@ -177,7 +183,7 @@ public:
void SetHasMixedGhostTypes(int hasMixedGhostTypes_);
void SetLinesData(bool linesData_);
void SetInputTopoDim(int inputTopoDim_);
void SetMeshCoordType(int meshCoordType_);
void SetMeshCoordType(CoordinateType meshCoordType_);
void SetCreateSpreadsheet(bool createSpreadsheet_);
void SetSubsetName(const std::string &subsetName_);
void SetFloatFormat(const std::string &floatFormat_);
......@@ -271,7 +277,7 @@ public:
int GetHasMixedGhostTypes() const;
bool GetLinesData() const;
int GetInputTopoDim() const;
int GetMeshCoordType() const;
CoordinateType GetMeshCoordType() const;
bool GetCreateSpreadsheet() const;
const std::string &GetSubsetName() const;
std::string &GetSubsetName();
......@@ -301,6 +307,11 @@ public:
protected:
static std::string PickType_ToString(int);
public:
static std::string CoordinateType_ToString(CoordinateType);
static bool CoordinateType_FromString(const std::string &, CoordinateType &);
protected:
static std::string CoordinateType_ToString(int);
public:
// Keyframing methods
virtual std::string GetFieldName(int index) const;
......
......@@ -8,6 +8,11 @@
DomainZone
DomainNode
</Enum>
<Enum name="CoordinateType">
XY
RZ
ZR
</Enum>
<Field name="variables" label="variables" type="stringVector">
default
</Field>
......@@ -191,8 +196,8 @@
<Field name="inputTopoDim" label="inputTopoDim" type="int" internal="true">
-1
</Field>
<Field name="meshCoordType" label="meshCoordType" type="int">
0
<Field name="meshCoordType" label="meshCoordType" type="enum" subtype="CoordinateType">
XY
</Field>
<Field name="createSpreadsheet" label="Create Spreadsheet of Pick" type="bool">
false
......@@ -230,9 +235,6 @@
<Include file="source" quoted="false">
float.h
</Include>
<Include file="source" quoted="false">
avtTypes.h
</Include>
<Include file="source" quoted="false">
cstring
</Include>
......
......@@ -66,6 +66,10 @@ public class PickAttributes extends AttributeSubject
public final static int PICKTYPE_DOMAINZONE = 4;
public final static int PICKTYPE_DOMAINNODE = 5;
public final static int COORDINATETYPE_XY = 0;
public final static int COORDINATETYPE_RZ = 1;
public final static int COORDINATETYPE_ZR = 2;
public PickAttributes()
{
......@@ -155,7 +159,7 @@ public class PickAttributes extends AttributeSubject
hasMixedGhostTypes = -1;
linesData = false;
inputTopoDim = -1;
meshCoordType = 0;
meshCoordType = COORDINATETYPE_XY;
createSpreadsheet = false;
subsetName = new String("");
floatFormat = new String("%g");
......@@ -1494,7 +1498,14 @@ public class PickAttributes extends AttributeSubject
str = str + intToString("hasMixedGhostTypes", hasMixedGhostTypes, indent) + "\n";
str = str + boolToString("linesData", linesData, indent) + "\n";
str = str + intToString("inputTopoDim", inputTopoDim, indent) + "\n";
str = str + intToString("meshCoordType", meshCoordType, indent) + "\n";
str = str + indent + "meshCoordType = ";
if(meshCoordType == COORDINATETYPE_XY)
str = str + "COORDINATETYPE_XY";
if(meshCoordType == COORDINATETYPE_RZ)
str = str + "COORDINATETYPE_RZ";
if(meshCoordType == COORDINATETYPE_ZR)
str = str + "COORDINATETYPE_ZR";
str = str + "\n";
str = str + boolToString("createSpreadsheet", createSpreadsheet, indent) + "\n";
str = str + stringToString("subsetName", subsetName, indent) + "\n";
str = str + stringToString("floatFormat", floatFormat, indent) + "\n";
......
......@@ -51,7 +51,7 @@
// Note: Autogenerated by xml2python. Do not modify by hand!
//
// Programmer: xml2python
// Creation: Fri Aug 15 13:44:23 PST 2008
// Creation: Wed May 13 09:40:21 PDT 2009
//
// ****************************************************************************
......@@ -172,8 +172,25 @@ PyPickAttributes_ToString(const PickAttributes *atts, const char *prefix)
else
SNPRINTF(tmpStr, 1000, "%sreusePickLetter = 0\n", prefix);
str += tmpStr;
SNPRINTF(tmpStr, 1000, "%smeshCoordType = %d\n", prefix, atts->GetMeshCoordType());
str += tmpStr;
const char *meshCoordType_names = "XY, RZ, ZR";
switch (atts->GetMeshCoordType())
{
case PickAttributes::XY:
SNPRINTF(tmpStr, 1000, "%smeshCoordType = %sXY # %s\n", prefix, prefix, meshCoordType_names);
str += tmpStr;
break;
case PickAttributes::RZ:
SNPRINTF(tmpStr, 1000, "%smeshCoordType = %sRZ # %s\n", prefix, prefix, meshCoordType_names);
str += tmpStr;
break;
case PickAttributes::ZR:
SNPRINTF(tmpStr, 1000, "%smeshCoordType = %sZR # %s\n", prefix, prefix, meshCoordType_names);
str += tmpStr;
break;
default:
break;
}
if(atts->GetCreateSpreadsheet())
SNPRINTF(tmpStr, 1000, "%screateSpreadsheet = 1\n", prefix);
else
......@@ -665,7 +682,16 @@ PickAttributes_SetMeshCoordType(PyObject *self, PyObject *args)
return NULL;
// Set the meshCoordType in the object.
obj->data->SetMeshCoordType((int)ival);
if(ival >= 0 && ival < 3)
obj->data->SetMeshCoordType(PickAttributes::CoordinateType(ival));
else
{
fprintf(stderr, "An invalid meshCoordType value was given. "
"Valid values are in the range of [0,2]. "
"You can also use the following names: "
"XY, RZ, ZR.");
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
......@@ -865,6 +891,13 @@ PickAttributes_getattr(PyObject *self, char *name)
return PickAttributes_GetReusePickLetter(self, NULL);
if(strcmp(name, "meshCoordType") == 0)
return PickAttributes_GetMeshCoordType(self, NULL);
if(strcmp(name, "XY") == 0)
return PyInt_FromLong(long(PickAttributes::XY));
if(strcmp(name, "RZ") == 0)
return PyInt_FromLong(long(PickAttributes::RZ));
if(strcmp(name, "ZR") == 0)
return PyInt_FromLong(long(PickAttributes::ZR));
if(strcmp(name, "createSpreadsheet") == 0)
return PickAttributes_GetCreateSpreadsheet(self, NULL);
if(strcmp(name, "floatFormat") == 0)
......@@ -955,7 +988,11 @@ PickAttributes_str(PyObject *v)
//
// The doc string for the class.
//
#if PY_MAJOR_VERSION > 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 5)
static const char *PickAttributes_Purpose = "This class contains attributes used for pick.";
#else
static char *PickAttributes_Purpose = "This class contains attributes used for pick.";
#endif
//
// The type description structure
......
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