From 9b5bf407d33d50563fa7cbcc024e538b9c77c25e Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Wed, 2 Mar 2016 08:12:31 +0100
Subject: [PATCH] Substitute and remove searchByMaterialIDs.

---
 .../DataView/MeshElementRemovalDialog.cpp     |  2 +-
 MeshLib/MeshSearch/ElementSearch.cpp          | 20 -------------------
 MeshLib/MeshSearch/ElementSearch.h            |  3 ---
 3 files changed, 1 insertion(+), 24 deletions(-)

diff --git a/Applications/DataExplorer/DataView/MeshElementRemovalDialog.cpp b/Applications/DataExplorer/DataView/MeshElementRemovalDialog.cpp
index dd8cc1c3256..688b5088226 100644
--- a/Applications/DataExplorer/DataView/MeshElementRemovalDialog.cpp
+++ b/Applications/DataExplorer/DataView/MeshElementRemovalDialog.cpp
@@ -74,7 +74,7 @@ void MeshElementRemovalDialog::accept()
 	{
 		QList<QListWidgetItem*> items = this->materialListWidget->selectedItems();
 		for (int i=0; i<items.size(); ++i)
-			ex.searchByMaterialID(items[i]->text().toInt());
+			ex.searchByPropertyValue(items[i]->text().toInt());
 		anything_checked = true;
 	}
 	if (this->boundingBoxCheckBox->isChecked())
diff --git a/MeshLib/MeshSearch/ElementSearch.cpp b/MeshLib/MeshSearch/ElementSearch.cpp
index 7fe5bb27490..f8d30092812 100644
--- a/MeshLib/MeshSearch/ElementSearch.cpp
+++ b/MeshLib/MeshSearch/ElementSearch.cpp
@@ -21,26 +21,6 @@ ElementSearch::ElementSearch(const MeshLib::Mesh &mesh)
 {
 }
 
-std::size_t ElementSearch::searchByMaterialID(int const matID)
-{
-	boost::optional<MeshLib::PropertyVector<int> const&> opt_pv(
-		this->_mesh.getProperties().getPropertyVector<int>("MaterialIDs")
-	);
-	if (!opt_pv)
-		return 0;
-
-	MeshLib::PropertyVector<int> const& pv(opt_pv.get());
-
-	std::vector<std::size_t> matchedIDs;
-	for (std::size_t i(0); i<pv.getNumberOfTuples(); ++i) {
-		if (pv[i]==matID)
-			matchedIDs.push_back(i);
-	}
-
-	this->updateUnion(matchedIDs);
-	return matchedIDs.size();
-}
-
 template <typename Container, typename Predicate>
 std::vector<std::size_t> filter(Container const& container, Predicate const& p)
 {
diff --git a/MeshLib/MeshSearch/ElementSearch.h b/MeshLib/MeshSearch/ElementSearch.h
index b2c6672388d..98e38e60cfd 100644
--- a/MeshLib/MeshSearch/ElementSearch.h
+++ b/MeshLib/MeshSearch/ElementSearch.h
@@ -73,9 +73,6 @@ public:
 		return matchedIDs.size();
 	}
 
-	/// Marks all elements with the given Material ID.
-	std::size_t searchByMaterialID(int const matID);
-
 	/// Marks all elements of the given element type.
 	std::size_t searchByElementType(MeshElemType eleType);
 
-- 
GitLab