diff options
author | Todd Stinson <stinson@lindenlab.com> | 2012-01-27 18:03:04 -0800 |
---|---|---|
committer | Todd Stinson <stinson@lindenlab.com> | 2012-01-27 18:03:04 -0800 |
commit | 58f299fb8ab409545b5ea386eb60965486e3d380 (patch) | |
tree | 27d453d686d92dd7ac2fd332cb427e965871085a | |
parent | 8330e111597c6dbbc3ede2a2a05fa20eda8ceb5f (diff) |
PATH-187: Moving the filtered pathfinding linksets class into its own file.
-rw-r--r-- | indra/newview/CMakeLists.txt | 6 | ||||
-rw-r--r-- | indra/newview/llfilteredpathfindinglinksets.cpp | 313 | ||||
-rw-r--r-- | indra/newview/llfilteredpathfindinglinksets.h | 111 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindinglinksets.cpp | 306 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindinglinksets.h | 120 | ||||
-rw-r--r-- | indra/newview/llpathfindinglinkset.cpp (renamed from indra/newview/llpathfindinglinksets.cpp) | 2 | ||||
-rw-r--r-- | indra/newview/llpathfindinglinkset.h (renamed from indra/newview/llpathfindinglinksets.h) | 8 |
7 files changed, 471 insertions, 395 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 194c7d35bb..2e4c537942 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -162,6 +162,7 @@ set(viewer_SOURCE_FILES llfavoritesbar.cpp llfeaturemanager.cpp llfilepicker.cpp + llfilteredpathfindinglinksets.cpp llfilteredwearablelist.cpp llfirstuse.cpp llflexibleobject.cpp @@ -415,7 +416,7 @@ set(viewer_SOURCE_FILES llparcelselection.cpp llparticipantlist.cpp llpatchvertexarray.cpp - llpathfindinglinksets.cpp + llpathfindinglinkset.cpp llphysicsmotion.cpp llphysicsshapebuilderutil.cpp llplacesinventorybridge.cpp @@ -722,6 +723,7 @@ set(viewer_HEADER_FILES llfavoritesbar.h llfeaturemanager.h llfilepicker.h + llfilteredpathfindinglinksets.h llfilteredwearablelist.h llfirstuse.h llflexibleobject.h @@ -964,7 +966,7 @@ set(viewer_HEADER_FILES llparcelselection.h llparticipantlist.h llpatchvertexarray.h - llpathfindinglinksets.h + llpathfindinglinkset.h llphysicsmotion.h llphysicsshapebuilderutil.h llplacesinventorybridge.h diff --git a/indra/newview/llfilteredpathfindinglinksets.cpp b/indra/newview/llfilteredpathfindinglinksets.cpp new file mode 100644 index 0000000000..c956a5752b --- /dev/null +++ b/indra/newview/llfilteredpathfindinglinksets.cpp @@ -0,0 +1,313 @@ +/**
+ * @file llfilteredpathfindinglinksets.h
+ * @author William Todd Stinson
+ * @brief Class to implement the filtering of a set of pathfinding linksets
+ *
+ * $LicenseInfo:firstyear=2002&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include <string>
+#include <map>
+
+#include "llsd.h"
+#include "lluuid.h"
+#include "llpathfindinglinkset.h"
+#include "llfilteredpathfindinglinksets.h"
+
+//---------------------------------------------------------------------------
+// FilterString
+//---------------------------------------------------------------------------
+
+FilterString::FilterString()
+ : mFilter(),
+ mUpperFilter()
+{
+}
+
+FilterString::FilterString(const std::string& pFilter)
+ : mFilter(pFilter),
+ mUpperFilter()
+{
+ LLStringUtil::trim(mFilter);
+ mUpperFilter = mFilter;
+ if (!mUpperFilter.empty())
+ {
+ LLStringUtil::toUpper(mUpperFilter);
+ }
+}
+
+FilterString::~FilterString()
+{
+}
+
+const std::string& FilterString::get() const
+{
+ return mFilter;
+}
+
+bool FilterString::set(const std::string& pFilter)
+{
+ std::string newFilter(pFilter);
+ LLStringUtil::trim(newFilter);
+ bool didFilterChange = (mFilter.compare(newFilter) != 0);
+ if (didFilterChange)
+ {
+ mFilter = newFilter;
+ mUpperFilter = newFilter;
+ LLStringUtil::toUpper(mUpperFilter);
+ }
+
+ return didFilterChange;
+}
+
+void FilterString::clear()
+{
+ mFilter.clear();
+ mUpperFilter.clear();
+}
+
+bool FilterString::isActive() const
+{
+ return !mFilter.empty();
+}
+
+bool FilterString::doesMatch(const std::string& pTestString) const
+{
+ bool doesMatch = true;
+
+ if (isActive())
+ {
+ std::string upperTestString(pTestString);
+ LLStringUtil::toUpper(upperTestString);
+ doesMatch = (upperTestString.find(mUpperFilter) != std::string::npos);
+ }
+
+ return doesMatch;
+}
+
+//---------------------------------------------------------------------------
+// LLFilteredPathfindingLinksets
+//---------------------------------------------------------------------------
+
+LLFilteredPathfindingLinksets::LLFilteredPathfindingLinksets()
+ : mAllLinksets(),
+ mFilteredLinksets(),
+ mIsFiltersDirty(false),
+ mNameFilter(),
+ mDescriptionFilter(),
+ mIsWalkableFilter(true),
+ mIsObstacleFilter(true),
+ mIsIgnoredFilter(true)
+{
+}
+
+LLFilteredPathfindingLinksets::LLFilteredPathfindingLinksets(const LLSD& pNavMeshData)
+ : mAllLinksets(),
+ mFilteredLinksets(),
+ mIsFiltersDirty(false),
+ mNameFilter(),
+ mDescriptionFilter(),
+ mIsWalkableFilter(true),
+ mIsObstacleFilter(true),
+ mIsIgnoredFilter(true)
+{
+ setPathfindingLinksets(pNavMeshData);
+}
+
+LLFilteredPathfindingLinksets::LLFilteredPathfindingLinksets(const LLFilteredPathfindingLinksets& pOther)
+ : mAllLinksets(pOther.mAllLinksets),
+ mFilteredLinksets(pOther.mFilteredLinksets),
+ mIsFiltersDirty(pOther.mIsFiltersDirty),
+ mNameFilter(pOther.mNameFilter),
+ mDescriptionFilter(pOther.mDescriptionFilter),
+ mIsWalkableFilter(pOther.mIsWalkableFilter),
+ mIsObstacleFilter(pOther.mIsObstacleFilter),
+ mIsIgnoredFilter(pOther.mIsIgnoredFilter)
+{
+}
+
+LLFilteredPathfindingLinksets::~LLFilteredPathfindingLinksets()
+{
+ clearPathfindingLinksets();
+}
+
+void LLFilteredPathfindingLinksets::setPathfindingLinksets(const LLSD& pNavMeshData)
+{
+ clearPathfindingLinksets();
+
+ for (LLSD::map_const_iterator navMeshDataIter = pNavMeshData.beginMap();
+ navMeshDataIter != pNavMeshData.endMap(); ++navMeshDataIter)
+ {
+ const std::string& uuid(navMeshDataIter->first);
+ const LLSD& linksetData = navMeshDataIter->second;
+ LLPathfindingLinkset linkset(uuid, linksetData);
+
+ mAllLinksets.insert(std::pair<std::string, LLPathfindingLinkset>(uuid, linkset));
+ }
+
+ mIsFiltersDirty = true;
+}
+
+void LLFilteredPathfindingLinksets::updatePathfindingLinksets(const LLSD& pNavMeshData)
+{
+ for (LLSD::map_const_iterator navMeshDataIter = pNavMeshData.beginMap();
+ navMeshDataIter != pNavMeshData.endMap(); ++navMeshDataIter)
+ {
+ const std::string& uuid(navMeshDataIter->first);
+ const LLSD& linksetData = navMeshDataIter->second;
+ LLPathfindingLinkset linkset(uuid, linksetData);
+
+ PathfindingLinksetMap::iterator linksetIter = mAllLinksets.find(uuid);
+ if (linksetIter == mAllLinksets.end())
+ {
+ mAllLinksets.insert(std::pair<std::string, LLPathfindingLinkset>(uuid, linkset));
+ }
+ else
+ {
+ linksetIter->second = linkset;
+ }
+ }
+
+ mIsFiltersDirty = true;
+}
+
+void LLFilteredPathfindingLinksets::clearPathfindingLinksets()
+{
+ mAllLinksets.clear();
+ mFilteredLinksets.clear();
+ mIsFiltersDirty = false;
+}
+
+const LLFilteredPathfindingLinksets::PathfindingLinksetMap& LLFilteredPathfindingLinksets::getAllLinksets() const
+{
+ return mAllLinksets;
+}
+
+const LLFilteredPathfindingLinksets::PathfindingLinksetMap& LLFilteredPathfindingLinksets::getFilteredLinksets()
+{
+ if (!isFiltersActive())
+ {
+ return mAllLinksets;
+ }
+ else
+ {
+ applyFilters();
+ return mFilteredLinksets;
+ }
+}
+
+BOOL LLFilteredPathfindingLinksets::isFiltersActive() const
+{
+ return (mNameFilter.isActive() || mDescriptionFilter.isActive() || !mIsWalkableFilter || !mIsObstacleFilter || !mIsIgnoredFilter);
+}
+
+void LLFilteredPathfindingLinksets::setNameFilter(const std::string& pNameFilter)
+{
+ mIsFiltersDirty = (mNameFilter.set(pNameFilter) || mIsFiltersDirty);
+}
+
+const std::string& LLFilteredPathfindingLinksets::getNameFilter() const
+{
+ return mNameFilter.get();
+}
+
+void LLFilteredPathfindingLinksets::setDescriptionFilter(const std::string& pDescriptionFilter)
+{
+ mIsFiltersDirty = (mDescriptionFilter.set(pDescriptionFilter) || mIsFiltersDirty);
+}
+
+const std::string& LLFilteredPathfindingLinksets::getDescriptionFilter() const
+{
+ return mDescriptionFilter.get();
+}
+
+void LLFilteredPathfindingLinksets::setWalkableFilter(BOOL pWalkableFilter)
+{
+ mIsFiltersDirty = (mIsFiltersDirty || (mIsWalkableFilter == pWalkableFilter));
+ mIsWalkableFilter = pWalkableFilter;
+}
+
+BOOL LLFilteredPathfindingLinksets::isWalkableFilter() const
+{
+ return mIsWalkableFilter;
+}
+
+void LLFilteredPathfindingLinksets::setObstacleFilter(BOOL pObstacleFilter)
+{
+ mIsFiltersDirty = (mIsFiltersDirty || (mIsObstacleFilter == pObstacleFilter));
+ mIsObstacleFilter = pObstacleFilter;
+}
+
+BOOL LLFilteredPathfindingLinksets::isObstacleFilter() const
+{
+ return mIsObstacleFilter;
+}
+
+void LLFilteredPathfindingLinksets::setIgnoredFilter(BOOL pIgnoredFilter)
+{
+ mIsFiltersDirty = (mIsFiltersDirty || (mIsIgnoredFilter == pIgnoredFilter));
+ mIsIgnoredFilter = pIgnoredFilter;
+}
+
+BOOL LLFilteredPathfindingLinksets::isIgnoredFilter() const
+{
+ return mIsIgnoredFilter;
+}
+
+void LLFilteredPathfindingLinksets::clearFilters()
+{
+ mNameFilter.clear();
+ mDescriptionFilter.clear();
+ mIsWalkableFilter = true;
+ mIsObstacleFilter = true;
+ mIsIgnoredFilter = true;
+ mIsFiltersDirty = false;
+}
+
+void LLFilteredPathfindingLinksets::applyFilters()
+{
+ mFilteredLinksets.clear();
+
+ for (PathfindingLinksetMap::const_iterator linksetIter = mAllLinksets.begin();
+ linksetIter != mAllLinksets.end(); ++linksetIter)
+ {
+ const std::string& uuid(linksetIter->first);
+ const LLPathfindingLinkset& linkset(linksetIter->second);
+ if (doesMatchFilters(linkset))
+ {
+ mFilteredLinksets.insert(std::pair<std::string, LLPathfindingLinkset>(uuid, linkset));
+ }
+ }
+
+ mIsFiltersDirty = false;
+}
+
+BOOL LLFilteredPathfindingLinksets::doesMatchFilters(const LLPathfindingLinkset& pLinkset) const
+{
+ return (((mIsWalkableFilter && (pLinkset.getPathState() == LLPathfindingLinkset::kWalkable)) ||
+ (mIsObstacleFilter && (pLinkset.getPathState() == LLPathfindingLinkset::kObstacle)) ||
+ (mIsIgnoredFilter && (pLinkset.getPathState() == LLPathfindingLinkset::kIgnored))) &&
+ (!mNameFilter.isActive() || mNameFilter.doesMatch(pLinkset.getName())) &&
+ (!mDescriptionFilter.isActive() || mDescriptionFilter.doesMatch(pLinkset.getDescription())));
+}
diff --git a/indra/newview/llfilteredpathfindinglinksets.h b/indra/newview/llfilteredpathfindinglinksets.h new file mode 100644 index 0000000000..afd2b2b01d --- /dev/null +++ b/indra/newview/llfilteredpathfindinglinksets.h @@ -0,0 +1,111 @@ +/**
+ * @file llfilteredpathfindinglinksets.h
+ * @author William Todd Stinson
+ * @brief Class to implement the filtering of a set of pathfinding linksets
+ *
+ * $LicenseInfo:firstyear=2002&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_FILTEREDPATHFINDINGLINKSETS_H
+#define LL_FILTEREDPATHFINDINGLINKSETS_H
+
+#include <string>
+#include <map>
+
+class LLSD;
+class LLPathfindingLinkset;
+
+class FilterString
+{
+public:
+ FilterString();
+ FilterString(const std::string& pFilter);
+ virtual ~FilterString();
+
+ const std::string& get() const;
+ bool set(const std::string& pFilter);
+ void clear();
+
+ bool isActive() const;
+ bool doesMatch(const std::string& pTestString) const;
+
+protected:
+
+private:
+ std::string mFilter;
+ std::string mUpperFilter;
+};
+
+class LLFilteredPathfindingLinksets
+{
+public:
+ typedef std::map<std::string, LLPathfindingLinkset> PathfindingLinksetMap;
+
+ LLFilteredPathfindingLinksets();
+ LLFilteredPathfindingLinksets(const LLSD& pNavMeshData);
+ LLFilteredPathfindingLinksets(const LLFilteredPathfindingLinksets& pOther);
+ virtual ~LLFilteredPathfindingLinksets();
+
+ void setPathfindingLinksets(const LLSD& pNavMeshData);
+ void updatePathfindingLinksets(const LLSD& pNavMeshData);
+ void clearPathfindingLinksets();
+
+ const PathfindingLinksetMap& getAllLinksets() const;
+ const PathfindingLinksetMap& getFilteredLinksets();
+
+ BOOL isFiltersActive() const;
+
+ void setNameFilter(const std::string& pNameFilter);
+ const std::string& getNameFilter() const;
+
+ void setDescriptionFilter(const std::string& pDescriptionFilter);
+ const std::string& getDescriptionFilter() const;
+
+ void setWalkableFilter(BOOL pWalkableFilter);
+ BOOL isWalkableFilter() const;
+
+ void setObstacleFilter(BOOL pObstacleFilter);
+ BOOL isObstacleFilter() const;
+
+ void setIgnoredFilter(BOOL pIgnoredFilter);
+ BOOL isIgnoredFilter() const;
+
+ void clearFilters();
+
+protected:
+
+private:
+ PathfindingLinksetMap mAllLinksets;
+ PathfindingLinksetMap mFilteredLinksets;
+
+ bool mIsFiltersDirty;
+ FilterString mNameFilter;
+ FilterString mDescriptionFilter;
+ BOOL mIsWalkableFilter;
+ BOOL mIsObstacleFilter;
+ BOOL mIsIgnoredFilter;
+
+ void applyFilters();
+ BOOL doesMatchFilters(const LLPathfindingLinkset& pLinkset) const;
+};
+
+#endif // LL_FILTEREDPATHFINDINGLINKSETS_H
diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index 433e3c9866..e2846d36f3 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -45,7 +45,8 @@ #include "llviewerregion.h"
#include "llhttpclient.h"
#include "lluuid.h"
-#include "llpathfindinglinksets.h"
+#include "llpathfindinglinkset.h"
+#include "llfilteredpathfindinglinksets.h"
#define XUI_PATH_STATE_WALKABLE 1
#define XUI_PATH_STATE_OBSTACLE 2
@@ -92,289 +93,6 @@ private: };
//---------------------------------------------------------------------------
-// FilterString
-//---------------------------------------------------------------------------
-
-FilterString::FilterString()
- : mFilter(),
- mUpperFilter()
-{
-}
-
-FilterString::FilterString(const std::string& pFilter)
- : mFilter(pFilter),
- mUpperFilter()
-{
- LLStringUtil::trim(mFilter);
- mUpperFilter = mFilter;
- if (!mUpperFilter.empty())
- {
- LLStringUtil::toUpper(mUpperFilter);
- }
-}
-
-FilterString::FilterString(const FilterString& pOther)
- : mFilter(pOther.mFilter),
- mUpperFilter(pOther.mUpperFilter)
-{
-}
-
-FilterString::~FilterString()
-{
-}
-
-const std::string& FilterString::get() const
-{
- return mFilter;
-}
-
-bool FilterString::set(const std::string& pFilter)
-{
- std::string newFilter(pFilter);
- LLStringUtil::trim(newFilter);
- bool didFilterChange = (mFilter.compare(newFilter) != 0);
- if (didFilterChange)
- {
- mFilter = newFilter;
- mUpperFilter = newFilter;
- LLStringUtil::toUpper(mUpperFilter);
- }
-
- return didFilterChange;
-}
-
-void FilterString::clear()
-{
- mFilter.clear();
- mUpperFilter.clear();
-}
-
-bool FilterString::isActive() const
-{
- return !mFilter.empty();
-}
-
-bool FilterString::doesMatch(const std::string& pTestString) const
-{
- bool doesMatch = true;
-
- if (isActive())
- {
- std::string upperTestString(pTestString);
- LLStringUtil::toUpper(upperTestString);
- doesMatch = (upperTestString.find(mUpperFilter) != std::string::npos);
- }
-
- return doesMatch;
-}
-
-//---------------------------------------------------------------------------
-// PathfindingLinksets
-//---------------------------------------------------------------------------
-
-PathfindingLinksets::PathfindingLinksets()
- : mAllLinksets(),
- mFilteredLinksets(),
- mIsFiltersDirty(false),
- mNameFilter(),
- mDescriptionFilter(),
- mIsWalkableFilter(true),
- mIsObstacleFilter(true),
- mIsIgnoredFilter(true)
-{
-}
-
-PathfindingLinksets::PathfindingLinksets(const LLSD& pNavMeshData)
- : mAllLinksets(),
- mFilteredLinksets(),
- mIsFiltersDirty(false),
- mNameFilter(),
- mDescriptionFilter(),
- mIsWalkableFilter(true),
- mIsObstacleFilter(true),
- mIsIgnoredFilter(true)
-{
- setNavMeshData(pNavMeshData);
-}
-
-PathfindingLinksets::PathfindingLinksets(const PathfindingLinksets& pOther)
- : mAllLinksets(pOther.mAllLinksets),
- mFilteredLinksets(pOther.mFilteredLinksets),
- mIsFiltersDirty(pOther.mIsFiltersDirty),
- mNameFilter(pOther.mNameFilter),
- mDescriptionFilter(pOther.mDescriptionFilter),
- mIsWalkableFilter(pOther.mIsWalkableFilter),
- mIsObstacleFilter(pOther.mIsObstacleFilter),
- mIsIgnoredFilter(pOther.mIsIgnoredFilter)
-{
-}
-
-PathfindingLinksets::~PathfindingLinksets()
-{
- clearLinksets();
-}
-
-void PathfindingLinksets::setNavMeshData(const LLSD& pNavMeshData)
-{
- clearLinksets();
-
- for (LLSD::map_const_iterator navMeshDataIter = pNavMeshData.beginMap();
- navMeshDataIter != pNavMeshData.endMap(); ++navMeshDataIter)
- {
- const std::string& uuid(navMeshDataIter->first);
- const LLSD& linksetData = navMeshDataIter->second;
- LLPathfindingLinkset linkset(uuid, linksetData);
-
- mAllLinksets.insert(std::pair<std::string, LLPathfindingLinkset>(uuid, linkset));
- }
-
- mIsFiltersDirty = true;
-}
-
-void PathfindingLinksets::updateNavMeshData(const LLSD& pNavMeshData)
-{
- for (LLSD::map_const_iterator navMeshDataIter = pNavMeshData.beginMap();
- navMeshDataIter != pNavMeshData.endMap(); ++navMeshDataIter)
- {
- const std::string& uuid(navMeshDataIter->first);
- const LLSD& linksetData = navMeshDataIter->second;
- LLPathfindingLinkset linkset(uuid, linksetData);
-
- PathfindingLinksetMap::iterator linksetIter = mAllLinksets.find(uuid);
- if (linksetIter == mAllLinksets.end())
- {
- mAllLinksets.insert(std::pair<std::string, LLPathfindingLinkset>(uuid, linkset));
- }
- else
- {
- linksetIter->second = linkset;
- }
- }
-
- mIsFiltersDirty = true;
-}
-
-void PathfindingLinksets::clearLinksets()
-{
- mAllLinksets.clear();
- mFilteredLinksets.clear();
- mIsFiltersDirty = false;
-}
-
-const PathfindingLinksets::PathfindingLinksetMap& PathfindingLinksets::getAllLinksets() const
-{
- return mAllLinksets;
-}
-
-const PathfindingLinksets::PathfindingLinksetMap& PathfindingLinksets::getFilteredLinksets()
-{
- if (!isFiltersActive())
- {
- return mAllLinksets;
- }
- else
- {
- applyFilters();
- return mFilteredLinksets;
- }
-}
-
-BOOL PathfindingLinksets::isFiltersActive() const
-{
- return (mNameFilter.isActive() || mDescriptionFilter.isActive() || !mIsWalkableFilter || !mIsObstacleFilter || !mIsIgnoredFilter);
-}
-
-void PathfindingLinksets::setNameFilter(const std::string& pNameFilter)
-{
- mIsFiltersDirty = (mNameFilter.set(pNameFilter) || mIsFiltersDirty);
-}
-
-const std::string& PathfindingLinksets::getNameFilter() const
-{
- return mNameFilter.get();
-}
-
-void PathfindingLinksets::setDescriptionFilter(const std::string& pDescriptionFilter)
-{
- mIsFiltersDirty = (mDescriptionFilter.set(pDescriptionFilter) || mIsFiltersDirty);
-}
-
-const std::string& PathfindingLinksets::getDescriptionFilter() const
-{
- return mDescriptionFilter.get();
-}
-
-void PathfindingLinksets::setWalkableFilter(BOOL pWalkableFilter)
-{
- mIsFiltersDirty = (mIsFiltersDirty || (mIsWalkableFilter == pWalkableFilter));
- mIsWalkableFilter = pWalkableFilter;
-}
-
-BOOL PathfindingLinksets::isWalkableFilter() const
-{
- return mIsWalkableFilter;
-}
-
-void PathfindingLinksets::setObstacleFilter(BOOL pObstacleFilter)
-{
- mIsFiltersDirty = (mIsFiltersDirty || (mIsObstacleFilter == pObstacleFilter));
- mIsObstacleFilter = pObstacleFilter;
-}
-
-BOOL PathfindingLinksets::isObstacleFilter() const
-{
- return mIsObstacleFilter;
-}
-
-void PathfindingLinksets::setIgnoredFilter(BOOL pIgnoredFilter)
-{
- mIsFiltersDirty = (mIsFiltersDirty || (mIsIgnoredFilter == pIgnoredFilter));
- mIsIgnoredFilter = pIgnoredFilter;
-}
-
-BOOL PathfindingLinksets::isIgnoredFilter() const
-{
- return mIsIgnoredFilter;
-}
-
-void PathfindingLinksets::clearFilters()
-{
- mNameFilter.clear();
- mDescriptionFilter.clear();
- mIsWalkableFilter = true;
- mIsObstacleFilter = true;
- mIsIgnoredFilter = true;
- mIsFiltersDirty = false;
-}
-
-void PathfindingLinksets::applyFilters()
-{
- mFilteredLinksets.clear();
-
- for (PathfindingLinksetMap::const_iterator linksetIter = mAllLinksets.begin();
- linksetIter != mAllLinksets.end(); ++linksetIter)
- {
- const std::string& uuid(linksetIter->first);
- const LLPathfindingLinkset& linkset(linksetIter->second);
- if (doesMatchFilters(linkset))
- {
- mFilteredLinksets.insert(std::pair<std::string, LLPathfindingLinkset>(uuid, linkset));
- }
- }
-
- mIsFiltersDirty = false;
-}
-
-BOOL PathfindingLinksets::doesMatchFilters(const LLPathfindingLinkset& pLinkset) const
-{
- return (((mIsWalkableFilter && (pLinkset.getPathState() == LLPathfindingLinkset::kWalkable)) ||
- (mIsObstacleFilter && (pLinkset.getPathState() == LLPathfindingLinkset::kObstacle)) ||
- (mIsIgnoredFilter && (pLinkset.getPathState() == LLPathfindingLinkset::kIgnored))) &&
- (!mNameFilter.isActive() || mNameFilter.doesMatch(pLinkset.getName())) &&
- (!mDescriptionFilter.isActive() || mDescriptionFilter.doesMatch(pLinkset.getDescription())));
-}
-
-//---------------------------------------------------------------------------
// LLFloaterPathfindingLinksets
//---------------------------------------------------------------------------
@@ -557,7 +275,7 @@ void LLFloaterPathfindingLinksets::sendNavMeshDataGetRequest() else
{
setMessagingState(kMessagingFetchStarting);
- mPathfindingLinksets.clearLinksets();
+ mPathfindingLinksets.clearPathfindingLinksets();
updateLinksetsList();
std::string navMeshDataURL = getCapabilityURL();
@@ -593,7 +311,7 @@ void LLFloaterPathfindingLinksets::sendNavMeshDataPutRequest(const LLSD& pPostDa void LLFloaterPathfindingLinksets::handleNavMeshDataGetReply(const LLSD& pNavMeshData)
{
setMessagingState(kMessagingFetchReceived);
- mPathfindingLinksets.setNavMeshData(pNavMeshData);
+ mPathfindingLinksets.setPathfindingLinksets(pNavMeshData);
updateLinksetsList();
setMessagingState(kMessagingComplete);
}
@@ -601,7 +319,7 @@ void LLFloaterPathfindingLinksets::handleNavMeshDataGetReply(const LLSD& pNavMes void LLFloaterPathfindingLinksets::handleNavMeshDataGetError(const std::string& pURL, const std::string& pErrorReason)
{
setMessagingState(kMessagingFetchError);
- mPathfindingLinksets.clearLinksets();
+ mPathfindingLinksets.clearPathfindingLinksets();
updateLinksetsList();
llwarns << "Error fetching object navmesh properties from URL '" << pURL << "' because " << pErrorReason << llendl;
}
@@ -609,7 +327,7 @@ void LLFloaterPathfindingLinksets::handleNavMeshDataGetError(const std::string& void LLFloaterPathfindingLinksets::handleNavMeshDataPutReply(const LLSD& pModifiedData)
{
setMessagingState(kMessagingModifyReceived);
- mPathfindingLinksets.updateNavMeshData(pModifiedData);
+ mPathfindingLinksets.updatePathfindingLinksets(pModifiedData);
updateLinksetsList();
setMessagingState(kMessagingComplete);
}
@@ -729,9 +447,9 @@ void LLFloaterPathfindingLinksets::updateLinksetsList() updateLinksetsStatusMessage();
const LLVector3& avatarPosition = gAgent.getPositionAgent();
- const PathfindingLinksets::PathfindingLinksetMap& linksetMap = mPathfindingLinksets.getFilteredLinksets();
+ const LLFilteredPathfindingLinksets::PathfindingLinksetMap& linksetMap = mPathfindingLinksets.getFilteredLinksets();
- for (PathfindingLinksets::PathfindingLinksetMap::const_iterator linksetIter = linksetMap.begin();
+ for (LLFilteredPathfindingLinksets::PathfindingLinksetMap::const_iterator linksetIter = linksetMap.begin();
linksetIter != linksetMap.end(); ++linksetIter)
{
const LLPathfindingLinkset& linkset(linksetIter->second);
@@ -905,8 +623,8 @@ void LLFloaterPathfindingLinksets::updateEditFields() {
LLScrollListItem *firstItem = selectedItems.front();
- const PathfindingLinksets::PathfindingLinksetMap &linksetsMap = mPathfindingLinksets.getAllLinksets();
- PathfindingLinksets::PathfindingLinksetMap::const_iterator linksetIter = linksetsMap.find(firstItem->getUUID().asString());
+ const LLFilteredPathfindingLinksets::PathfindingLinksetMap &linksetsMap = mPathfindingLinksets.getAllLinksets();
+ LLFilteredPathfindingLinksets::PathfindingLinksetMap::const_iterator linksetIter = linksetsMap.find(firstItem->getUUID().asString());
const LLPathfindingLinkset &linkset(linksetIter->second);
setPathState(linkset.getPathState());
@@ -936,7 +654,7 @@ void LLFloaterPathfindingLinksets::applyEditFields() S32 dValue = static_cast<S32>(atoi(dString.c_str()));
BOOL isPhantom = mEditPhantom->getValue();
- const PathfindingLinksets::PathfindingLinksetMap &linksetsMap = mPathfindingLinksets.getAllLinksets();
+ const LLFilteredPathfindingLinksets::PathfindingLinksetMap &linksetsMap = mPathfindingLinksets.getAllLinksets();
LLSD editData;
for (std::vector<LLScrollListItem*>::const_iterator itemIter = selectedItems.begin();
@@ -945,7 +663,7 @@ void LLFloaterPathfindingLinksets::applyEditFields() const LLScrollListItem *listItem = *itemIter;
LLUUID uuid = listItem->getUUID();
- const PathfindingLinksets::PathfindingLinksetMap::const_iterator linksetIter = linksetsMap.find(uuid.asString());
+ const LLFilteredPathfindingLinksets::PathfindingLinksetMap::const_iterator linksetIter = linksetsMap.find(uuid.asString());
const LLPathfindingLinkset &linkset = linksetIter->second;
LLSD itemData = linkset.getAlteredFields(pathState, aValue, bValue, cValue, dValue, isPhantom);
diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h index 739e52ccef..bb37987160 100644 --- a/indra/newview/llfloaterpathfindinglinksets.h +++ b/indra/newview/llfloaterpathfindinglinksets.h @@ -32,7 +32,8 @@ #include "v3math.h"
#include "llfloater.h"
#include "lluuid.h"
-#include "llpathfindinglinksets.h"
+#include "llpathfindinglinkset.h"
+#include "llfilteredpathfindinglinksets.h"
class LLTextBase;
class LLScrollListCtrl;
@@ -41,75 +42,6 @@ class LLCheckBoxCtrl; class LLRadioGroup;
class LLButton;
-class FilterString
-{
-public:
- FilterString();
- FilterString(const std::string& pFilter);
- FilterString(const FilterString& pOther);
- virtual ~FilterString();
-
- const std::string& get() const;
- bool set(const std::string& pFilter);
- void clear();
-
- bool isActive() const;
- bool doesMatch(const std::string& pTestString) const;
-
-protected:
-
-private:
- std::string mFilter;
- std::string mUpperFilter;
-};
-
-class PathfindingLinksets
-{
-public:
- typedef std::map<std::string, LLPathfindingLinkset> PathfindingLinksetMap;
-
- PathfindingLinksets();
- PathfindingLinksets(const LLSD& pNavMeshData);
- PathfindingLinksets(const PathfindingLinksets& pOther);
- virtual ~PathfindingLinksets();
-
- void setNavMeshData(const LLSD& pNavMeshData);
- void updateNavMeshData(const LLSD& pNavMeshData);
- void clearLinksets();
-
- const PathfindingLinksetMap& getAllLinksets() const;
- const PathfindingLinksetMap& getFilteredLinksets();
-
- BOOL isFiltersActive() const;
- void setNameFilter(const std::string& pNameFilter);
- const std::string& getNameFilter() const;
- void setDescriptionFilter(const std::string& pDescriptionFilter);
- const std::string& getDescriptionFilter() const;
- void setWalkableFilter(BOOL pWalkableFilter);
- BOOL isWalkableFilter() const;
- void setObstacleFilter(BOOL pObstacleFilter);
- BOOL isObstacleFilter() const;
- void setIgnoredFilter(BOOL pIgnoredFilter);
- BOOL isIgnoredFilter() const;
- void clearFilters();
-
-protected:
-
-private:
- PathfindingLinksetMap mAllLinksets;
- PathfindingLinksetMap mFilteredLinksets;
-
- bool mIsFiltersDirty;
- FilterString mNameFilter;
- FilterString mDescriptionFilter;
- BOOL mIsWalkableFilter;
- BOOL mIsObstacleFilter;
- BOOL mIsIgnoredFilter;
-
- void applyFilters();
- BOOL doesMatchFilters(const LLPathfindingLinkset& pLinkset) const;
-};
-
class LLFloaterPathfindingLinksets
: public LLFloater
{
@@ -144,30 +76,30 @@ public: protected:
private:
- PathfindingLinksets mPathfindingLinksets;
- EMessagingState mMessagingState;
- LLScrollListCtrl *mLinksetsScrollList;
- LLTextBase *mLinksetsStatus;
- LLLineEditor *mFilterByName;
- LLLineEditor *mFilterByDescription;
- LLCheckBoxCtrl *mFilterByWalkable;
- LLCheckBoxCtrl *mFilterByObstacle;
- LLCheckBoxCtrl *mFilterByIgnored;
- LLRadioGroup *mEditPathState;
- LLUICtrl *mEditPathStateWalkable;
- LLUICtrl *mEditPathStateObstacle;
- LLUICtrl *mEditPathStateIgnored;
- LLTextBase *mLabelWalkabilityCoefficients;
- LLTextBase *mLabelEditA;
- LLTextBase *mLabelEditB;
- LLTextBase *mLabelEditC;
- LLTextBase *mLabelEditD;
- LLLineEditor *mEditA;
- LLLineEditor *mEditB;
- LLLineEditor *mEditC;
- LLLineEditor *mEditD;
- LLCheckBoxCtrl *mEditPhantom;
- LLButton *mApplyEdits;
+ LLFilteredPathfindingLinksets mPathfindingLinksets;
+ EMessagingState mMessagingState;
+ LLScrollListCtrl *mLinksetsScrollList;
+ LLTextBase *mLinksetsStatus;
+ LLLineEditor *mFilterByName;
+ LLLineEditor *mFilterByDescription;
+ LLCheckBoxCtrl *mFilterByWalkable;
+ LLCheckBoxCtrl *mFilterByObstacle;
+ LLCheckBoxCtrl *mFilterByIgnored;
+ LLRadioGroup *mEditPathState;
+ LLUICtrl *mEditPathStateWalkable;
+ LLUICtrl *mEditPathStateObstacle;
+ LLUICtrl *mEditPathStateIgnored;
+ LLTextBase *mLabelWalkabilityCoefficients;
+ LLTextBase *mLabelEditA;
+ LLTextBase *mLabelEditB;
+ LLTextBase *mLabelEditC;
+ LLTextBase *mLabelEditD;
+ LLLineEditor *mEditA;
+ LLLineEditor *mEditB;
+ LLLineEditor *mEditC;
+ LLLineEditor *mEditD;
+ LLCheckBoxCtrl *mEditPhantom;
+ LLButton *mApplyEdits;
// Does its own instance management, so clients not allowed
// to allocate or destroy.
diff --git a/indra/newview/llpathfindinglinksets.cpp b/indra/newview/llpathfindinglinkset.cpp index 57623e0e43..bfe851d8ee 100644 --- a/indra/newview/llpathfindinglinksets.cpp +++ b/indra/newview/llpathfindinglinkset.cpp @@ -26,7 +26,7 @@ */
#include "llviewerprecompiledheaders.h"
-#include "llpathfindinglinksets.h"
+#include "llpathfindinglinkset.h"
#include "llsd.h"
#include "v3math.h"
#include "lluuid.h"
diff --git a/indra/newview/llpathfindinglinksets.h b/indra/newview/llpathfindinglinkset.h index e632be5257..c6165907d0 100644 --- a/indra/newview/llpathfindinglinksets.h +++ b/indra/newview/llpathfindinglinkset.h @@ -1,5 +1,5 @@ /**
- * @file llpathfindinglinksets.h
+ * @file llpathfindinglinkset.h
* @author William Todd Stinson
* @brief Definition of a pathfinding linkset that contains various properties required for havok pathfinding.
*
@@ -25,8 +25,8 @@ * $/LicenseInfo$
*/
-#ifndef LL_LLPATHFINDINGLINKSETS_H
-#define LL_LLPATHFINDINGLINKSETS_H
+#ifndef LL_LLPATHFINDINGLINKSET_H
+#define LL_LLPATHFINDINGLINKSET_H
#include "v3math.h"
#include "lluuid.h"
@@ -105,4 +105,4 @@ private: S32 mWalkabilityCoefficientD;
};
-#endif // LL_LLFLOATERPATHFINDINGLINKSETS_H
+#endif // LL_LLPATHFINDINGLINKSET_H
|