SHAPER 9.16.0
ModelAPI_FiltersArgs.h
1// Copyright (C) 2014-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef ModelAPI_FiltersArgs_H_
21#define ModelAPI_FiltersArgs_H_
22
23#include "ModelAPI_FiltersFeature.h"
24
25#include <map>
26
28static const std::string kFilterSeparator = "__";
29
33 std::map<std::string, AttributePtr> myMap;
34 std::string myCurrentFilter;
35 FiltersFeaturePtr myFeature;
36public:
38
40 void setFilter(const std::string& theFilterID) {
41 myCurrentFilter = theFilterID;
42 }
43
45 void setFeature(const FiltersFeaturePtr theFeature) {
46 myFeature = theFeature;
47 }
48
50 void add(AttributePtr theAttribute) {
51 myMap[theAttribute->id()] = theAttribute;
52 }
53
55 AttributePtr argument(const std::string& theID) const {
56 return myMap.find(myCurrentFilter + kFilterSeparator + theID)->second;
57 }
59 std::shared_ptr<ModelAPI_Attribute> initAttribute(
60 const std::string& theID, const std::string theAttrType) {
61 AttributePtr aR = myFeature->data()->addFloatingAttribute(theID, theAttrType, myCurrentFilter);
62 aR->setIsArgument(false); // to avoid parametric update
63 return aR;
64 }
65};
66
67#endif
definition of arguments of filters: id of the argument to attributes
Definition: ModelAPI_FiltersArgs.h:31
std::shared_ptr< ModelAPI_Attribute > initAttribute(const std::string &theID, const std::string theAttrType)
adds an attribute of the filter
Definition: ModelAPI_FiltersArgs.h:59
void add(AttributePtr theAttribute)
Appends an argument of a filter.
Definition: ModelAPI_FiltersArgs.h:50
AttributePtr argument(const std::string &theID) const
returns the argument of the current filter by the argument id
Definition: ModelAPI_FiltersArgs.h:55
void setFilter(const std::string &theFilterID)
Sets the current filter ID.
Definition: ModelAPI_FiltersArgs.h:40
void setFeature(const FiltersFeaturePtr theFeature)
Sets the current feature.
Definition: ModelAPI_FiltersArgs.h:45