Commit 6d120f27 authored by David Thompson's avatar David Thompson Committed by Kitware Robot

Merge topic 'mesh-phrases'

9bdd7c40 Preliminary mesh support in the resource tree.
3d042810 Eliminate warnings.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !1324
parents d35a443b 9bdd7c40
Pipeline #122805 passed with stage
in 0 seconds
......@@ -100,6 +100,7 @@ typedef smtk::shared_ptr<smtk::extension::qtSelectionManager> qtSelectionManager
namespace mesh
{
class Collection;
class Component;
class Interface;
class Allocator;
class BufferedCellAllocator;
......@@ -279,6 +280,7 @@ namespace mesh
{
typedef smtk::shared_ptr<smtk::mesh::Collection> CollectionPtr;
typedef smtk::shared_ptr<const smtk::mesh::Collection> ConstCollectionPtr;
typedef smtk::shared_ptr<smtk::mesh::Component> ComponentPtr;
typedef smtk::shared_ptr<smtk::mesh::Interface> InterfacePtr;
typedef smtk::shared_ptr<smtk::mesh::Allocator> AllocatorPtr;
typedef smtk::shared_ptr<smtk::mesh::BufferedCellAllocator> BufferedCellAllocatorPtr;
......
smtk/extension/qt/icons/generic_entity.png

1.55 KB | W: | H:

smtk/extension/qt/icons/generic_entity.png

475 Bytes | W: | H:

smtk/extension/qt/icons/generic_entity.png
smtk/extension/qt/icons/generic_entity.png
smtk/extension/qt/icons/generic_entity.png
smtk/extension/qt/icons/generic_entity.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -23,6 +23,7 @@
#include "smtk/model/StringData.h"
#include "smtk/mesh/core/Collection.h"
#include "smtk/mesh/core/Component.h"
#include "smtk/attribute/Attribute.h"
#include "smtk/attribute/ComponentItem.h"
......@@ -508,6 +509,7 @@ QIcon qtDescriptivePhraseModel::lookupIconForPhraseFlags(
double lightness = 0.2126 * color.redF() + 0.7152 * color.greenF() + 0.0722 * color.blueF();
auto modelComp = dynamic_pointer_cast<smtk::model::Entity>(item->relatedComponent());
auto attComp = dynamic_pointer_cast<smtk::attribute::Attribute>(item->relatedComponent());
auto meshComp = dynamic_pointer_cast<smtk::mesh::Component>(item->relatedComponent());
std::ostringstream resourceName;
resourceName << ":/icons/entityTypes/";
if (modelComp)
......@@ -566,6 +568,19 @@ QIcon qtDescriptivePhraseModel::lookupIconForPhraseFlags(
{
resourceName << "attribute";
}
else if (meshComp)
{
resourceName << "meshset";
// lightness controls black/white ico
if (lightness >= 0.179)
{
resourceName << "_b";
}
else // if (lightness < 0.179)
{
resourceName << "_w";
}
}
else if (item->relatedComponent() == nullptr)
{
// Lets check the resource
......@@ -577,6 +592,10 @@ QIcon qtDescriptivePhraseModel::lookupIconForPhraseFlags(
{
resourceName << "attributeResource";
}
else if (dynamic_pointer_cast<smtk::mesh::Collection>(item->relatedResource()))
{
resourceName << "meshResource";
}
else
{
resourceName << "invalid";
......
......@@ -16,6 +16,9 @@
<file alias = "modelResource.png">icons/modelResource.png</file>
<file alias = "group.png">icons/group.png</file>
<file alias = "aux_geom.png">icons/aux_geom.png</file>
<file alias = "meshset_b.png">icons/meshset_b.png</file>
<file alias = "meshset_w.png">icons/meshset_w.png</file>
<file alias = "meshResource.png">icons/meshResource.png</file>
</qresource>
<qresource prefix="/icons/display">
......
......@@ -83,7 +83,6 @@ int main(int argc, char* argv[])
std::cout << "number of meshes: " << numMeshes << std::endl;
test(numMeshes != 0, "dataset once loaded should have more than zero meshes");
smtk::common::UUID collectionID = c->entity();
vtkNew<vtkActor> act;
vtkNew<vtkMeshMultiBlockSource> src;
vtkNew<vtkCompositePolyDataMapper2> map;
......
......@@ -48,7 +48,6 @@ int main(int argc, char* argv[])
std::cout << "number of meshes in twoassm_out is: " << numMeshes << std::endl;
test(numMeshes != 0, "dataset once loaded should have more than zero meshes");
smtk::common::UUID collectionID = c->entity();
vtkNew<vtkActor> act;
vtkNew<vtkMeshMultiBlockSource> src;
vtkNew<vtkCompositePolyDataMapper2> map;
......
......@@ -282,7 +282,6 @@ Model A, vertex 6 ff3c9b49-bf3f-4fd1-a906-3d40db14736b
}
*/
smtk::common::UUID collectionID = mc->entity();
vtkNew<vtkActor> act;
vtkNew<vtkMeshMultiBlockSource> src;
vtkNew<vtkCompositePolyDataMapper2> map;
......
......@@ -123,7 +123,6 @@ int main(int argc, char* argv[])
test((mc->meshes(smtk::mesh::Dims1)).size() == 10, "Expecting 10 edge mesh");
test((mc->meshes(smtk::mesh::Dims0)).size() == 7, "Expecting 7 vertex mesh");
smtk::common::UUID collectionID = mc->entity();
vtkNew<vtkActor> act;
vtkNew<vtkMeshMultiBlockSource> src;
vtkNew<vtkCompositePolyDataMapper2> map;
......
......@@ -16,6 +16,10 @@
#include "smtk/attribute/IntItem.h"
#include "smtk/attribute/StringItem.h"
#include "smtk/mesh/core/CellSet.h"
#include "smtk/mesh/core/Component.h"
#include "smtk/mesh/core/MeshSet.h"
#include "smtk/model/Entity.h"
#include "smtk/model/EntityRef.h"
#include "smtk/model/operators/SetProperty.h"
......@@ -80,37 +84,30 @@ std::string ComponentPhraseContent::stringValue(ContentType attr) const
{
case PhraseContent::TITLE:
{
auto modelComp = dynamic_pointer_cast<smtk::model::Entity>(m_component);
if (modelComp)
{
return modelComp->referenceAs<smtk::model::EntityRef>().name();
}
auto attrComp = dynamic_pointer_cast<smtk::attribute::Attribute>(m_component);
if (attrComp)
{
return attrComp->name();
}
// We don't know what type of component it is, but we know it's resource type and UUID:
std::ostringstream txt;
txt << m_component->resource()->typeName() << " " << m_component->id().toString();
return txt.str();
return m_component->name();
}
break;
case PhraseContent::SUBTITLE:
{
auto modelComp = dynamic_pointer_cast<smtk::model::Entity>(m_component);
auto modelComp = m_component->as<smtk::model::Entity>();
if (modelComp)
{
return modelComp->flagSummary();
}
auto attrComp = dynamic_pointer_cast<smtk::attribute::Attribute>(m_component);
auto attrComp = m_component->as<smtk::attribute::Attribute>();
if (attrComp)
{
return attrComp->type();
}
auto meshComp = m_component->as<smtk::mesh::Component>();
if (meshComp)
{
std::ostringstream meshSummary;
meshSummary << meshComp->mesh().cells().size() << " cells";
return meshSummary.str();
}
return std::string();
}
break;
......
......@@ -21,6 +21,9 @@
#include "smtk/model/Resource.h"
#include "smtk/model/UseEntity.h"
#include "smtk/mesh/core/Collection.h"
#include "smtk/mesh/core/Component.h"
#include "smtk/attribute/Attribute.h"
#include "smtk/attribute/Resource.h"
......@@ -152,7 +155,7 @@ void SubphraseGenerator::componentsOfResource(
{
auto modelRsrc = dynamic_pointer_cast<smtk::model::Resource>(rsrc);
auto attrRsrc = dynamic_pointer_cast<smtk::attribute::Resource>(rsrc);
//auto meshRsrc = dynamic_pointer_cast<smtk::mesh::Resource>(rsrc);
auto meshRsrc = dynamic_pointer_cast<smtk::mesh::Collection>(rsrc);
if (modelRsrc)
{
// By default, make model component names and colors editable but not visibility
......@@ -175,9 +178,13 @@ void SubphraseGenerator::componentsOfResource(
result.push_back(ComponentPhraseContent::createPhrase(attr, 0, src));
}
}
// else if (meshRsrc)
// {
// }
else if (meshRsrc)
{
smtk::resource::Component::Visitor visitor = [&](const smtk::resource::Component::Ptr& entry) {
result.push_back(ComponentPhraseContent::createPhrase(entry, 0, src));
};
meshRsrc->visit(visitor);
}
}
void SubphraseGenerator::itemsOfAttribute(
......
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