Add property models for FEM

This commit is contained in:
David Carter
2024-03-04 00:50:32 -05:00
parent 6db79f02c4
commit de168aae27
23 changed files with 984 additions and 36 deletions

View File

@@ -39,11 +39,13 @@ ModelProperty::ModelProperty()
{}
ModelProperty::ModelProperty(const QString& name,
const QString& header,
const QString& type,
const QString& units,
const QString& url,
const QString& description)
: _name(name)
, _displayName(header)
, _propertyType(type)
, _units(units)
, _url(url)
@@ -52,6 +54,7 @@ ModelProperty::ModelProperty(const QString& name,
ModelProperty::ModelProperty(const ModelProperty& other)
: _name(other._name)
, _displayName(other._displayName)
, _propertyType(other._propertyType)
, _units(other._units)
, _url(other._url)
@@ -63,6 +66,14 @@ ModelProperty::ModelProperty(const ModelProperty& other)
}
}
const QString ModelProperty::getDisplayName() const
{
if (_displayName.isEmpty()) {
return getName();
}
return _displayName;
}
ModelProperty& ModelProperty::operator=(const ModelProperty& other)
{
if (this == &other) {
@@ -70,6 +81,7 @@ ModelProperty& ModelProperty::operator=(const ModelProperty& other)
}
_name = other._name;
_displayName = other._displayName;
_propertyType = other._propertyType;
_units = other._units;
_url = other._url;
@@ -89,7 +101,7 @@ bool ModelProperty::operator==(const ModelProperty& other) const
return true;
}
return (_name == other._name) && (_propertyType == other._propertyType)
return (_name == other._name) && (_displayName == other._displayName) && (_propertyType == other._propertyType)
&& (_units == other._units) && (_url == other._url) && (_description == other._description)
&& (_inheritance == other._inheritance);
}

View File

@@ -56,6 +56,7 @@ class MaterialsExport ModelProperty: public Base::BaseClass
public:
ModelProperty();
ModelProperty(const QString& name,
const QString& header,
const QString& type,
const QString& units,
const QString& url,
@@ -67,6 +68,7 @@ public:
{
return _name;
}
const QString getDisplayName() const;
const QString getPropertyType() const
{
return _propertyType;
@@ -96,6 +98,10 @@ public:
{
_name = name;
}
void setColumnHeader(const QString& header)
{
_displayName = header;
}
virtual void setPropertyType(const QString& type)
{
_propertyType = type;
@@ -139,6 +145,7 @@ public:
private:
QString _name;
QString _displayName;
QString _propertyType;
QString _units;
QString _url;

View File

@@ -254,6 +254,7 @@ void ModelLoader::addToTree(std::shared_ptr<ModelEntry> model,
if (exclude.count(QString::fromStdString(propName)) == 0) {
// showYaml(it->second);
auto yamlProp = yamlProperties[propName];
auto propDisplayName = yamlValue(yamlProp, "DisplayName", "");
auto propType = yamlValue(yamlProp, "Type", "");
auto propUnits = yamlValue(yamlProp, "Units", "");
auto propURL = yamlValue(yamlProp, "URL", "");
@@ -261,6 +262,7 @@ void ModelLoader::addToTree(std::shared_ptr<ModelEntry> model,
// auto inherits = yamlValue(yamlProp, "Inherits", "");
ModelProperty property(QString::fromStdString(propName),
propDisplayName,
propType,
propUnits,
propURL,
@@ -276,11 +278,13 @@ void ModelLoader::addToTree(std::shared_ptr<ModelEntry> model,
// Base::Console().Log("\tColumns '%s'\n", colName.c_str());
auto colProp = cols[colName];
auto colPropDisplayName = yamlValue(colProp, "DisplayName", "");
auto colPropType = yamlValue(colProp, "Type", "");
auto colPropUnits = yamlValue(colProp, "Units", "");
auto colPropURL = yamlValue(colProp, "URL", "");
auto colPropDescription = yamlValue(colProp, "Description", "");
ModelProperty colProperty(QString::fromStdString(colName),
colPropDisplayName,
colPropType,
colPropUnits,
colPropURL,