Salome HOME
projects
/
modules
/
shaper.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'Dev_0.6.1' of newgeom:newgeom into Dev_0.6.1
[modules/shaper.git]
/
src
/
Model
/
Model_FeatureValidator.cpp
diff --git
a/src/Model/Model_FeatureValidator.cpp
b/src/Model/Model_FeatureValidator.cpp
index bcc09d11e13002fbef87b969afac32f1fba66894..b3b1b821687f13ebdadaed93bc9ed4772fde4f02 100644
(file)
--- a/
src/Model/Model_FeatureValidator.cpp
+++ b/
src/Model/Model_FeatureValidator.cpp
@@
-1,3
+1,5
@@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
// File: Model_FeatureValidator.cpp
// Created: 8 Jul 2014
// Author: Vitaly SMETANNIKOV
// File: Model_FeatureValidator.cpp
// Created: 8 Jul 2014
// Author: Vitaly SMETANNIKOV
@@
-9,14
+11,16
@@
#include <ModelAPI_Object.h>
#include <list>
#include <ModelAPI_Object.h>
#include <list>
-#include <
boost/shared_ptr.hpp
>
+#include <
memory
>
-bool Model_FeatureValidator::isValid(const
boost
::shared_ptr<ModelAPI_Feature>& theFeature,
+bool Model_FeatureValidator::isValid(const
std
::shared_ptr<ModelAPI_Feature>& theFeature,
const std::list<std::string>& theArguments) const
{
const std::list<std::string>& theArguments) const
{
- boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
- if (!aData)
- return false;
+ std::shared_ptr<ModelAPI_Data> aData = theFeature->data();
+ // "Action" features has no data, but still valid. e.g "Remove Part"
+ if (!aData) {
+ return theFeature->isAction();
+ }
if (!aData->isValid())
return false;
const std::string kAllTypes = "";
if (!aData->isValid())
return false;
const std::string kAllTypes = "";
@@
-24,10
+28,10
@@
bool Model_FeatureValidator::isValid(const boost::shared_ptr<ModelAPI_Feature>&
std::list<std::string>::iterator it = aLtAttributes.begin();
for (; it != aLtAttributes.end(); it++) {
AttributePtr anAttr = aData->attribute(*it);
std::list<std::string>::iterator it = aLtAttributes.begin();
for (; it != aLtAttributes.end(); it++) {
AttributePtr anAttr = aData->attribute(*it);
- if (!anAttr->isInitialized()) {
+ if (!anAttr->isInitialized()) {
// attribute is not initialized
std::map<std::string, std::set<std::string> >::const_iterator aFeatureFind =
myNotObligatory.find(theFeature->getKind());
std::map<std::string, std::set<std::string> >::const_iterator aFeatureFind =
myNotObligatory.find(theFeature->getKind());
- if (aFeatureFind == myNotObligatory.end() ||
+ if (aFeatureFind == myNotObligatory.end() ||
// and it is obligatory for filling
aFeatureFind->second.find(*it) == aFeatureFind->second.end()) {
return false;
}
aFeatureFind->second.find(*it) == aFeatureFind->second.end()) {
return false;
}
@@
-41,3
+45,9
@@
void Model_FeatureValidator::registerNotObligatory(std::string theFeature, std::
std::set<std::string>& anAttrs = myNotObligatory[theFeature];
anAttrs.insert(theAttribute);
}
std::set<std::string>& anAttrs = myNotObligatory[theFeature];
anAttrs.insert(theAttribute);
}
+
+bool Model_FeatureValidator::isNotObligatory(std::string theFeature, std::string theAttribute)
+{
+ std::set<std::string>& anAttrs = myNotObligatory[theFeature];
+ return anAttrs.find(theAttribute) != anAttrs.end();
+}