本文整理汇总了C++中idataarray::Pointer::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::setName方法的具体用法?C++ Pointer::setName怎么用?C++ Pointer::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idataarray::Pointer
的用法示例。
在下文中一共展示了Pointer::setName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void CopyAttributeArray::dataCheck()
{
setErrorCondition(0);
if(m_NewArrayName.isEmpty() == true)
{
setErrorCondition(-11009);
QString ss = QObject::tr("The new Attribute Array name must be set");
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
return;
}
QString daName = getSelectedArrayPath().getDataArrayName();
IDataArray::Pointer dataArray = getDataContainerArray()->getPrereqIDataArrayFromPath<IDataArray, AbstractFilter>(this, getSelectedArrayPath());
if(getErrorCondition() < 0) { return; }
DataArrayPath path(getSelectedArrayPath().getDataContainerName(), getSelectedArrayPath().getAttributeMatrixName(), "");
AttributeMatrix::Pointer attrMat = getDataContainerArray()->getAttributeMatrix(path);
IDataArray::Pointer pNew = dataArray->deepCopy();
pNew->setName(m_NewArrayName); // Set the name of the array
int32_t err = attrMat->addAttributeArray(m_NewArrayName, pNew);
if (0 != err)
{
setErrorCondition(err);
QString ss = QObject::tr("Attempt to copy Attribute Array '%1' to '%2' failed").arg(daName).arg(m_NewArrayName);
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
}
}
示例2: addAttributeArray
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int AttributeMatrix::addAttributeArray(const QString& name, IDataArray::Pointer data)
{
if (data->getName().compare(name) != 0)
{
qDebug() << "Adding Attribute Array with different array name than key name" << "\n";
qDebug() << "Key name: " << name << "\n";
qDebug() << "Array Name:" << data->getName() << "\n";
data->setName(name);
}
if(getNumTuples() != data->getNumberOfTuples())
{
qDebug() << "AttributeMatrix::Name: " << getName() << " dataArray::name: " << data->getName() << " Type: " << data->getTypeAsString();
qDebug() << "getNumTuples(): " << getNumTuples() << " data->getNumberOfTuples(): " << data->getNumberOfTuples();
}
Q_ASSERT(getNumTuples() == data->getNumberOfTuples());
m_AttributeArrays[name] = data;
return 0;
}
示例3: renameAttributeArray
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
RenameErrorCodes AttributeMatrix::renameAttributeArray(const QString& oldname, const QString& newname, bool overwrite)
{
QMap<QString, IDataArray::Pointer>::iterator itOld;
QMap<QString, IDataArray::Pointer>::iterator itNew;
itNew = m_AttributeArrays.find(newname);
// If new name doesn't exist or we want to overwrite one that does exist...
if (itNew == m_AttributeArrays.end() || overwrite == true)
{
itOld = m_AttributeArrays.find(oldname);
// If old name doesn't exist...
if (itOld == m_AttributeArrays.end())
{
return OLD_DOES_NOT_EXIST;
}
IDataArray::Pointer p = itOld.value();
p->setName(newname);
removeAttributeArray(oldname);
addAttributeArray(newname, p);
return SUCCESS;
}
return NEW_EXISTS;
}
示例4: execute
//.........这里部分代码省略.........
// Validate that the selected InArray has tuples equal to the largest
// Feature Id; the filter would not crash otherwise, but the user should
// be notified of unanticipated behavior ; this cannot be done in the dataCheck since
// we don't have acces to the data yet
int32_t numFeatures = static_cast<int32_t>(m_InArrayPtr.lock()->getNumberOfTuples());
bool mismatchedFeatures = false;
int32_t largestFeature = 0;
size_t totalPoints = m_FeatureIdsPtr.lock()->getNumberOfTuples();
for (size_t i = 0; i < totalPoints; i ++)
{
if (m_FeatureIds[i] > largestFeature)
{
largestFeature = m_FeatureIds[i];
if (largestFeature >= numFeatures)
{
mismatchedFeatures = true;
break;
}
}
}
if (mismatchedFeatures == true)
{
QString ss = QObject::tr("The number of Features in the InArray array (%1) is larger than the largest Feature Id in the FeatureIds array").arg(numFeatures);
setErrorCondition(-5555);
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
return;
}
if (largestFeature != (numFeatures - 1))
{
QString ss = QObject::tr("The number of Features in the InArray array (%1) does not match the largest Feature Id in the FeatureIds array").arg(numFeatures);
setErrorCondition(-5555);
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
return;
}
IDataArray::Pointer p = IDataArray::NullPointer();
if (TemplateHelpers::CanDynamicCast<Int8ArrayType>()(m_InArrayPtr.lock()))
{
p = copyData<int8_t>(m_InArrayPtr.lock(), totalPoints, m_FeatureIds);
}
else if (TemplateHelpers::CanDynamicCast<UInt8ArrayType>()(m_InArrayPtr.lock()))
{
p = copyData<uint8_t>(m_InArrayPtr.lock(), totalPoints, m_FeatureIds);
}
else if (TemplateHelpers::CanDynamicCast<Int16ArrayType>()(m_InArrayPtr.lock()))
{
p = copyData<int16_t>(m_InArrayPtr.lock(), totalPoints, m_FeatureIds);
}
else if (TemplateHelpers::CanDynamicCast<UInt16ArrayType>()(m_InArrayPtr.lock()))
{
p = copyData<uint16_t>(m_InArrayPtr.lock(), totalPoints, m_FeatureIds);
}
else if (TemplateHelpers::CanDynamicCast<Int32ArrayType>()(m_InArrayPtr.lock()))
{
p = copyData<int32_t>(m_InArrayPtr.lock(), totalPoints, m_FeatureIds);
}
else if (TemplateHelpers::CanDynamicCast<UInt32ArrayType>()(m_InArrayPtr.lock()))
{
p = copyData<uint32_t>(m_InArrayPtr.lock(), totalPoints, m_FeatureIds);
}
else if (TemplateHelpers::CanDynamicCast<Int64ArrayType>()(m_InArrayPtr.lock()))
{
p = copyData<int64_t>(m_InArrayPtr.lock(), totalPoints, m_FeatureIds);
}
else if (TemplateHelpers::CanDynamicCast<UInt64ArrayType>()(m_InArrayPtr.lock()))
{
p = copyData<uint64_t>(m_InArrayPtr.lock(), totalPoints, m_FeatureIds);
}
else if (TemplateHelpers::CanDynamicCast<FloatArrayType>()(m_InArrayPtr.lock()))
{
p = copyData<float>(m_InArrayPtr.lock(), totalPoints, m_FeatureIds);
}
else if (TemplateHelpers::CanDynamicCast<DoubleArrayType>()(m_InArrayPtr.lock()))
{
p = copyData<double>(m_InArrayPtr.lock(), totalPoints, m_FeatureIds);
}
else if (TemplateHelpers::CanDynamicCast<BoolArrayType>()(m_InArrayPtr.lock()))
{
p = copyData<bool>(m_InArrayPtr.lock(), totalPoints, m_FeatureIds);
}
else
{
QString ss = QObject::tr("The selected array was of unsupported type. The path is %1").arg(m_SelectedFeatureArrayPath.serialize());
setErrorCondition(-14000);
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
}
if (p.get() != NULL)
{
p->setName(getCreatedArrayName());
AttributeMatrix::Pointer am = getDataContainerArray()->getAttributeMatrix(getFeatureIdsArrayPath());
am->addAttributeArray(p->getName(), p);
}
notifyStatusMessage(getHumanLabel(), "Complete");
}