Tensor results: Add function to create arrow indices

This commit is contained in:
Unknown 2018-03-02 08:09:42 +01:00
parent 82a394d588
commit 6bb06ce53c
3 changed files with 26 additions and 11 deletions

View File

@ -168,6 +168,7 @@ void RivTensorResultPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicLi
tensorVisualizations.push_back(TensorVisualization(
cvf::Vec3f(displayCoord), -result2, faceNormal, isPressure(elmPrincipals[1][elmIdx]), 2, elmPrincipals[1][elmIdx]));
}
if (isDrawable(result3, m_rimReservoirView->tensorResults()->showPrincipal3()))
{
tensorVisualizations.push_back(TensorVisualization(
@ -304,14 +305,10 @@ cvf::ref<cvf::Part> RivTensorResultPartMgr::createPart(const std::vector<TensorV
vertices.push_back(vertex);
}
indices.push_back(counter);
indices.push_back(counter + 1);
indices.push_back(counter + 2);
indices.push_back(counter + 3);
indices.push_back(counter + 3);
indices.push_back(counter + 4);
indices.push_back(counter + 4);
indices.push_back(counter + 2);
for (const uint& index : createArrowIndices(counter))
{
indices.push_back(index);
}
counter += 5;
}
@ -562,3 +559,22 @@ std::array<cvf::Vec3f, 5> RivTensorResultPartMgr::createArrowVertices(const Tens
return vertices;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::array<uint, 8> RivTensorResultPartMgr::createArrowIndices(uint startIndex) const
{
std::array<uint, 8> indices;
indices[0] = startIndex;
indices[1] = startIndex + 1;
indices[2] = startIndex + 2;
indices[3] = startIndex + 3;
indices[4] = startIndex + 3;
indices[5] = startIndex + 4;
indices[6] = startIndex + 4;
indices[7] = startIndex + 2;
return indices;
}

View File

@ -101,7 +101,8 @@ private:
static bool isPressure(float principalValue);
bool isDrawable(cvf::Vec3f resultVector, bool showPrincipal) const;
std::array<cvf::Vec3f, 5> createArrowVertices(const TensorVisualization &tensorVisualization) const;
std::array<cvf::Vec3f, 5> createArrowVertices(const TensorVisualization &tensorVisualization) const;
std::array<uint, 8> createArrowIndices(uint startIndex) const;
private:
caf::PdmPointer<RimGeoMechView> m_rimReservoirView;

View File

@ -224,7 +224,6 @@ void RimTensorResults::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
{
if (changedField == &m_resultPositionTypeUiField)
{
std::vector<std::string> fieldCompNames = getResultMetaDataForUIFieldSetting();
if (m_resultPositionTypeUiField() == m_resultPositionType())
{
m_resultFieldNameUiField = uiFieldName(m_resultFieldName());
@ -284,7 +283,6 @@ QList<caf::PdmOptionItemInfo> RimTensorResults::calculateValueOptions(const caf:
{
options.push_back(caf::PdmOptionItemInfo(QString::fromStdString(fieldCompNames[oIdx]), QString::fromStdString(fieldCompNames[oIdx])));
}
}
return options;