namespace ModelGeomAlgo_Point2D {
std::shared_ptr<GeomDataAPI_Point2D> getPointOfRefAttr(ModelAPI_Feature* theFeature,
- const std::string& theAttribute,
- const std::string& theObjectFeatureKind,
- const std::string& theObjectFeatureAttribute)
+ const std::string& theAttribute,
+ const std::string& theObjectFeatureKind,
+ const std::string& theObjectFeatureAttribute)
{
std::shared_ptr<GeomDataAPI_Point2D> aPointAttr;
}
std::string getPontAttributesInfo(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const std::set<std::shared_ptr<ModelAPI_Attribute> >& theAttributesOnly)
+ const std::set<std::shared_ptr<ModelAPI_Attribute> >& theAttributesOnly)
{
std::string anInfo;
std::string aValue = "not defined";
std::string aType = theAttribute->attributeType();
if (aType == GeomDataAPI_Point2D::typeId()) {
- std::shared_ptr<GeomDataAPI_Point2D> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
- theAttribute);
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(theAttribute);
if (aPoint.get() && aPoint->isInitialized()) {
- aValue = std::string("(" + doubleToString(aPoint->x()) + ", "+ doubleToString(aPoint->y()) + ")");
+ aValue = std::string("(" + doubleToString(aPoint->x()) + ", "+
+ doubleToString(aPoint->y()) + ")");
}
}
anInfo.append(theAttribute->id() + ": " + aValue);
/// Fills container of point 2D attributes, which refer to the feature through the references
/// features with the given kind
/// \param theObject an object where references should be searched (e.g. a sketch line or result)
- /// \param theReferenceFeatureKind a kind of the feature to be processed (e.g. coincidence constraint)
+ /// \param theReferenceFeatureKind a kind of the feature to be processed
+ /// (e.g. coincidence constraint)
/// \param theAttributes a container of found point 2D attributes
/// \param theObjectFeatureKind a feature kind in object of attribute that satisfies the search
/// \param theObjectFeatureAttribute a feature attribute in object that satisfies the search
/// should be skipped
/// \returns found point attribute or NULL
MODELGEOMALGO_EXPORT void getPointsOfReference(const std::shared_ptr<ModelAPI_Object>& theObject,
- const std::string& theReferenceFeatureKind,
- std::set<std::shared_ptr<GeomDataAPI_Point2D> >& theAttributes,
- const std::string& theObjectFeatureKind = "",
- const std::string& theObjectFeatureAttribute = "",
- const bool isSkipFeatureAttributes = true);
+ const std::string& theReferenceFeatureKind,
+ std::set<std::shared_ptr<GeomDataAPI_Point2D> >& theAttributes,
+ const std::string& theObjectFeatureKind = "",
+ const std::string& theObjectFeatureAttribute = "",
+ const bool isSkipFeatureAttributes = true);
/// Removes attributes which points are out of the base shape
/// \param theBaseShape a shape of check
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Double.cpp
// Purpose:
//
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Double.h
// Purpose:
//
return isOk;
}
-bool ModelHighAPI_Dumper::process(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite, bool isForce)
+bool ModelHighAPI_Dumper::process(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite,
+ bool isForce)
{
// increase composite features stack
++gCompositeStackDepth;
return isOk;
}
-bool ModelHighAPI_Dumper::processSubs(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite,
- bool theDumpModelDo)
+bool ModelHighAPI_Dumper::processSubs(
+ const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite,
+ bool theDumpModelDo)
{
bool isOk = true;
// dump all sub-features;
}
// set result deflection
if (!isDefaultDeflection(*aResIt)) {
- AttributeDoublePtr aDeflectionAttr = (*aResIt)->data()->real(ModelAPI_Result::DEFLECTION_ID());
+ AttributeDoublePtr aDeflectionAttr =
+ (*aResIt)->data()->real(ModelAPI_Result::DEFLECTION_ID());
if(aDeflectionAttr.get() && aDeflectionAttr->isInitialized()) {
*this << *aResIt;
myDumpBuffer << ".setDeflection(" << aDeflectionAttr->value() << ")" << std::endl;
FeaturePtr aFeature = ModelAPI_Feature::feature(theResult);
int anIndex = 0;
std::list<ResultPtr> aResults = aFeature->results();
- for(std::list<ResultPtr>::const_iterator anIt = aResults.cbegin(); anIt != aResults.cend(); ++anIt, ++anIndex) {
+ for(std::list<ResultPtr>::const_iterator
+ anIt = aResults.cbegin(); anIt != aResults.cend(); ++anIt, ++anIndex) {
if(theResult->isSame(*anIt)) {
break;
}
return *this;
}
- myDumpBuffer << "\"" << aShape->shapeTypeStr() << "\", \"" << theAttrSelect->namingName() << "\")";
+ myDumpBuffer << "\"" << aShape->shapeTypeStr() << "\", \"" <<
+ theAttrSelect->namingName() << "\")";
return *this;
}
} else {
isAdded = true;
}
- myDumpBuffer << "model.selection(\"" << aShape->shapeTypeStr() << "\", \"" << anAttribute->namingName() << "\")";
+ myDumpBuffer << "model.selection(\"" <<
+ aShape->shapeTypeStr() << "\", \"" << anAttribute->namingName() << "\")";
}
myDumpBuffer << "]";
/// Add module to list of imported modules
/// \param theModuleName name of the module to be imported
- /// \param theObject name of the entity to be imported from the module (if empty, while module will be imported)
+ /// \param theObject name of the entity to be imported
+ /// from the module (if empty, while module will be imported)
MODELHIGHAPI_EXPORT
void importModule(const std::string& theModuleName,
const std::string& theObject = std::string());
/// Returns name of specified entity
/// \param theEntity [in] named entity
- /// \param theSaveNotDumped [in] if \c true, the entity should be stored as not dumped (will be dumped automatically)
- /// \param theUseEntityName [in] if \c true, the entity name should be used "as is" without changing default name
+ /// \param theSaveNotDumped [in]
+ /// if \c true, the entity should be stored as not dumped (will be dumped automatically)
+ /// \param theUseEntityName [in]
+ /// if \c true, the entity name should be used "as is" without changing default name
/// \return name of the entity
MODELHIGHAPI_EXPORT
- const std::string& name(const EntityPtr& theEntity, bool theSaveNotDumped = true, bool theUseEntityName = false);
+ const std::string& name(const EntityPtr& theEntity, bool theSaveNotDumped = true,
+ bool theUseEntityName = false);
/// Returns name of parent composite feature for specified entity
MODELHIGHAPI_EXPORT
friend
MODELHIGHAPI_EXPORT
ModelHighAPI_Dumper& operator<<(ModelHighAPI_Dumper& theDumper,
- std::basic_ostream<char>& (*theEndl)(std::basic_ostream<char>&));
+ std::basic_ostream<char>& (*theEndl)(std::basic_ostream<char>&));
/// Dump GeomAPI_Pnt in the following form:
/// "GeomAPI_Pnt(X, Y, Z)"
ModelHighAPI_Dumper& operator<<(const ResultPtr& theResult);
/// Dump Attribute
- MODELHIGHAPI_EXPORT
- ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_Attribute>& theAttr);
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ operator<<(const std::shared_ptr<ModelAPI_Attribute>& theAttr);
/// Dump Object
- MODELHIGHAPI_EXPORT
- ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_Object>& theObject);
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ operator<<(const std::shared_ptr<ModelAPI_Object>& theObject);
/// Dump AttributeRefAttr
- MODELHIGHAPI_EXPORT
- ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeRefAttr>& theRefAttr);
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ operator<<(const std::shared_ptr<ModelAPI_AttributeRefAttr>& theRefAttr);
/// Dump AttributeRefAttrList as follows:
/// "[obj1, obj2, obj3, ...]"
- MODELHIGHAPI_EXPORT
- ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeRefAttrList>& theRefAttrList);
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ operator<<(const std::shared_ptr<ModelAPI_AttributeRefAttrList>& theRefAttrList);
/// Dump AttributeRefList as follows:
/// "[obj1, obj2, obj3, ...]"
- MODELHIGHAPI_EXPORT
- ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeRefList>& theRefList);
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ operator<<(const std::shared_ptr<ModelAPI_AttributeRefList>& theRefList);
/// Dump AttributeSelection
- MODELHIGHAPI_EXPORT
- ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeSelection>& theAttrSelect);
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ operator<<(const std::shared_ptr<ModelAPI_AttributeSelection>& theAttrSelect);
/// Dump AttributeSelectionList
- MODELHIGHAPI_EXPORT
- ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeSelectionList>& theAttrSelList);
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ operator<<(const std::shared_ptr<ModelAPI_AttributeSelectionList>& theAttrSelList);
/// Dump AttributeReference
- MODELHIGHAPI_EXPORT
- ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeReference>& theReference);
+ MODELHIGHAPI_EXPORT ModelHighAPI_Dumper&
+ operator<<(const std::shared_ptr<ModelAPI_AttributeReference>& theReference);
/// Clear dump buffer
MODELHIGHAPI_EXPORT
bool process(const std::shared_ptr<ModelAPI_Document>& theDoc);
/// Dump composite feature and all it sub-features
- bool process(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite, bool isForce = false);
+ bool process(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite,
+ bool isForce = false);
/// Iterate all features in composite feature and dump them into intermediate buffer
/// \param theComposite [in] parent composite feature
/// \param theDumpModelDo [in] shows that command "model.do()" should be written at the end
MODELHIGHAPI_EXPORT
- bool processSubs(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite, bool theDumpModelDo = false);
+ bool processSubs(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite,
+ bool theDumpModelDo = false);
/// Check the entity is already dumped
bool isDumped(const EntityPtr& theEntity) const;
struct LastDumpedEntity {
EntityPtr myEntity; ///< last dumped entity
bool myUserName; ///< the entity hase user-defined name
- std::list<ResultPtr> myResults; ///< results of this entity, which has user-defined names or specific colors
+ /// results of this entity, which has user-defined names or specific colors
+ std::list<ResultPtr> myResults;
- LastDumpedEntity(EntityPtr theEntity, bool theUserName, const std::list<ResultPtr>& theResults)
+ LastDumpedEntity(EntityPtr theEntity, bool theUserName,
+ const std::list<ResultPtr>& theResults)
: myEntity(theEntity), myUserName(theUserName), myResults(theResults)
{}
};
NbFeaturesMap myFeatureCount; ///< number of features of each kind
protected:
- std::set<EntityPtr> myNotDumpedEntities; ///< list of entities, used by other features but not dumped yet
+ /// list of entities, used by other features but not dumped yet
+ std::set<EntityPtr> myNotDumpedEntities;
friend class SketchAPI_Sketch;
};
void ModelHighAPI_FeatureStore::storeData(std::shared_ptr<ModelAPI_Data> theData,
std::map<std::string, std::string>& theAttrs)
{
- theAttrs["__name__"] = theData->name(); // store name to keep also this information and output if needed
+ // store name to keep also this information and output if needed
+ theAttrs["__name__"] = theData->name();
std::list<std::shared_ptr<ModelAPI_Attribute> > allAttrs = theData->attributes("");
std::list<std::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = allAttrs.begin();
for(; anAttr != allAttrs.end(); anAttr++) {
return "";
}
-static void dumpArray(std::ostringstream& theOutput, const double theArray[], int theSize, int thePrecision = PRECISION)
+static void dumpArray(std::ostringstream& theOutput, const double theArray[],
+ int theSize, int thePrecision = PRECISION)
{
for (int i = 0; i < theSize; ++i) {
if (i > 0)
}
// output the main characteristics
if (GeomAlgoAPI_ShapeTools::volume(theShape) > 1.e-7) {
- aResult<<"Volume: "<<std::fixed<<setprecision(3)<<GeomAlgoAPI_ShapeTools::volume(theShape)<<std::endl;
+ aResult<<"Volume: "<<
+ std::fixed<<setprecision(3)<<GeomAlgoAPI_ShapeTools::volume(theShape)<<std::endl;
}
std::shared_ptr<GeomAPI_Pnt> aCenter = GeomAlgoAPI_ShapeTools::centreOfMass(theShape);
aResult<<"Center of mass: ";
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Integer.cpp
// Purpose:
//
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Integer.h
// Purpose:
//
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Interface.cpp
// Purpose:
//
#include "ModelHighAPI_Selection.h"
//--------------------------------------------------------------------------------------
-ModelHighAPI_Interface::ModelHighAPI_Interface(const std::shared_ptr<ModelAPI_Feature> & theFeature)
+ModelHighAPI_Interface::ModelHighAPI_Interface(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
: myFeature(theFeature)
{
std::shared_ptr<ModelHighAPI_Interface> ModelHighAPI_Interface::subFeature(const int theIndex) const
{
- CompositeFeaturePtr aCompositeFeature = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
+ CompositeFeaturePtr aCompositeFeature =
+ std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
if(!aCompositeFeature.get()) {
return InterfacePtr();
}
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Interface.h
// Purpose:
//
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Macro.h
// Purpose:
//
public:
//--------------------------------------------------------------------------------------
-// Used in INTERFACE_N inside START_INIT/END_INIT for set variable with attribute received from feature
+// Used in INTERFACE_N inside START_INIT/END_INIT for
+// set variable with attribute received from feature
#define SET_ATTRIBUTE(NAME, TYPE, ATT_NAME) \
VAR_NAME(NAME) = std::dynamic_pointer_cast<TYPE>(feature()->attribute(ATT_NAME)); \
if (!VAR_NAME(NAME)) \
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_RefAttr.cpp
// Purpose:
//
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_RefAttr.h
// Purpose:
//
virtual ~ModelHighAPI_RefAttr();
/// Fill attribute values
- MODELHIGHAPI_EXPORT
- virtual void fillAttribute(const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute) const;
+ MODELHIGHAPI_EXPORT virtual
+ void fillAttribute(const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute) const;
/// Append to list attribute
- MODELHIGHAPI_EXPORT
- virtual void appendToList(const std::shared_ptr<ModelAPI_AttributeRefAttrList> & theAttribute) const;
+ MODELHIGHAPI_EXPORT virtual
+ void appendToList(const std::shared_ptr<ModelAPI_AttributeRefAttrList> & theAttribute) const;
/// Check the object is empty
MODELHIGHAPI_EXPORT
virtual ~ModelHighAPI_Reference();
/// Fill attribute values
- MODELHIGHAPI_EXPORT
- virtual void fillAttribute(const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute) const;
+ MODELHIGHAPI_EXPORT virtual
+ void fillAttribute(const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute) const;
/// Append to list attribute
MODELHIGHAPI_EXPORT
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Selection.cpp
// Purpose:
//
{
switch(myVariantType) {
case VT_Empty: return;
- case VT_ResultSubShapePair: theAttribute->setValue(myResultSubShapePair.first, myResultSubShapePair.second); return;
- case VT_TypeSubShapeNamePair: theAttribute->selectSubShape(myTypeSubShapeNamePair.first, myTypeSubShapeNamePair.second); return;
+ case VT_ResultSubShapePair:
+ theAttribute->setValue(myResultSubShapePair.first, myResultSubShapePair.second);
+ return;
+ case VT_TypeSubShapeNamePair:
+ theAttribute->selectSubShape(myTypeSubShapeNamePair.first, myTypeSubShapeNamePair.second);
+ return;
}
}
{
switch(myVariantType) {
case VT_Empty: return;
- case VT_ResultSubShapePair: theAttribute->append(myResultSubShapePair.first, myResultSubShapePair.second); return;
+ case VT_ResultSubShapePair:
+ theAttribute->append(myResultSubShapePair.first, myResultSubShapePair.second);
+ return;
case VT_TypeSubShapeNamePair:
// Note: the reverse order (first - type, second - sub-shape name)
theAttribute->append(myTypeSubShapeNamePair.second, myTypeSubShapeNamePair.first);
if (myVariantType != VT_ResultSubShapePair)
return;
- AttributeDoublePtr aDeflectionAttr = myResultSubShapePair.first->data()->real(ModelAPI_Result::DEFLECTION_ID());
+ AttributeDoublePtr aDeflectionAttr =
+ myResultSubShapePair.first->data()->real(ModelAPI_Result::DEFLECTION_ID());
aDeflectionAttr->setValue(theValue);
}
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Selection.h
// Purpose:
//
class ModelAPI_AttributeSelectionList;
class ModelAPI_Result;
//--------------------------------------------------------------------------------------
-typedef std::pair<std::shared_ptr<ModelAPI_Result>, std::shared_ptr<GeomAPI_Shape> > ResultSubShapePair;
+typedef std::pair<std::shared_ptr<ModelAPI_Result>, std::shared_ptr<GeomAPI_Shape> >
+ ResultSubShapePair;
typedef std::pair<std::string, std::string> TypeSubShapeNamePair;
//--------------------------------------------------------------------------------------
/**\class ModelHighAPI_Selection
/// Constructor for result and sub-shape
MODELHIGHAPI_EXPORT
ModelHighAPI_Selection(const std::shared_ptr<ModelAPI_Result>& theContext,
- const std::shared_ptr<GeomAPI_Shape>& theSubShape = std::shared_ptr<GeomAPI_Shape>());
+ const std::shared_ptr<GeomAPI_Shape>& theSubShape =
+ std::shared_ptr<GeomAPI_Shape>());
/// Constructor for sub-shape by the textual Name
MODELHIGHAPI_EXPORT
ModelHighAPI_Selection(const std::string& theType,
virtual ~ModelHighAPI_Selection();
/// Fill attribute values
- MODELHIGHAPI_EXPORT
- virtual void fillAttribute(const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute) const;
+ MODELHIGHAPI_EXPORT virtual
+ void fillAttribute(const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute) const;
/// Append to list attribute
- MODELHIGHAPI_EXPORT
- virtual void appendToList(const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute) const;
+ MODELHIGHAPI_EXPORT virtual
+ void appendToList(const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute) const;
/// \return variant type.
MODELHIGHAPI_EXPORT
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Services.cpp
// Purpose:
//
return std::string("XOZ");
}
// YOZ
- else if (fabs(theNormal->x() - 1.0) < aTol && fabs(theNormal->y()) < aTol && fabs(theNormal->z()) < aTol &&
- fabs(theDirX->x()) < aTol && fabs(theDirX->y() - 1.0) < aTol && fabs(theDirX->z()) < aTol)
+ else if (fabs(theNormal->x() - 1.0) < aTol &&
+ fabs(theNormal->y()) < aTol && fabs(theNormal->z()) < aTol &&
+ fabs(theDirX->x()) < aTol && fabs(theDirX->y() - 1.0) < aTol &&
+ fabs(theDirX->z()) < aTol)
return std::string("YOZ");
return std::string();
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Services.h
// Purpose:
//
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Tools.cpp
// Purpose:
//
{
GeomAPI_Shape::ShapeType aShapeType = GeomAPI_Shape::SHAPE;
- std::transform(theShapeTypeStr.begin(), theShapeTypeStr.end(), theShapeTypeStr.begin(), ::tolower);
+ std::transform(theShapeTypeStr.begin(), theShapeTypeStr.end(),
+ theShapeTypeStr.begin(), ::tolower);
if(theShapeTypeStr == "compound") {
aShapeType = GeomAPI_Shape::COMPOUND;
ModelAPI_Tools::allResults(aFeat, allResults);
std::list<ResultPtr>::iterator aRes = allResults.begin();
for(; aRes != allResults.end(); aRes++) {
- if ((*aRes)->groupName() == ModelAPI_ResultPart::group()) { // recoursively store features of sub-documents
+ // recoursively store features of sub-documents
+ if ((*aRes)->groupName() == ModelAPI_ResultPart::group()) {
DocumentPtr aDoc = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aRes)->partDoc();
if (aDoc.get()) {
std::string anError = storeFeatures((*aRes)->data()->name(), aDoc, theStore, theCompare);
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
// Name : ModelHighAPI_Tools.h
// Purpose:
//
// VSR 01/07/2010: Disable thousands separator for spin box
// (to avoid inconsistency of double-2-string and string-2-double conversion)
QLocale loc;
- loc.setNumberOptions(loc.numberOptions() | QLocale::OmitGroupSeparator | QLocale::RejectGroupSeparator);
+ loc.setNumberOptions(loc.numberOptions() |
+ QLocale::OmitGroupSeparator |
+ QLocale::RejectGroupSeparator);
setLocale(loc);
- // MPV 15/09/2014: this must be set before setDecimals; otherwise in release mode setDecimals may crash
+ // MPV 15/09/2014: this must be set before setDecimals;
+ // otherwise in release mode setDecimals may crash
myPrecision = thePrecision;
// Use precision equal to default Qt decimals
if (overhead == 0)
state = v.validate(str, pos);
else {
- if ((uint)(str.length()) >= overhead && str.startsWith(pref) && str.right(suff.length()) == suff) {
+ if ((uint)(str.length()) >= overhead &&
+ str.startsWith(pref) &&
+ str.right(suff.length()) == suff) {
QString core = str.mid(pref.length(), str.length() - overhead);
int corePos = pos - pref.length();
state = v.validate(core, corePos);
IMPLEMENT_STANDARD_HANDLE(ModuleBase_FilterValidated, SelectMgr_Filter);
IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_FilterValidated, SelectMgr_Filter);
-Standard_Boolean ModuleBase_FilterValidated::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
+Standard_Boolean ModuleBase_FilterValidated::
+ IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
{
bool aValid = true;
ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation();
void ModuleBase_IModule::launchOperation(const QString& theCmdId)
{
/// selection should be obtained from workshop before ask if the operation can be started as
- /// the canStartOperation method performs commit/abort of previous operation. Sometimes commit/abort
- /// may cause selection clear(Sketch operation) as a result it will be lost and is not used for preselection.
+ /// the canStartOperation method performs commit/abort of previous operation.
+ /// Sometimes commit/abort may cause selection clear(Sketch operation) as a result
+ /// it will be lost and is not used for preselection.
ModuleBase_ISelection* aSelection = myWorkshop->selection();
- QList<ModuleBase_ViewerPrsPtr> aPreSelected = aSelection->getSelected(ModuleBase_ISelection::AllControls);
+ QList<ModuleBase_ViewerPrsPtr> aPreSelected =
+ aSelection->getSelected(ModuleBase_ISelection::AllControls);
if (!myWorkshop->canStartOperation(theCmdId))
return;
}
bool ModuleBase_IModule::customizeObject(ObjectPtr theObject,
- const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
- const bool theUpdateViewer)
+ const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer)
{
return false;
}
if (isUseAttributesInfo) {
std::set<std::shared_ptr<ModelAPI_Attribute> > anAttributes;
std::string aPointsInfo = ModelGeomAlgo_Point2D::getPontAttributesInfo(aFeature,
- anAttributes).c_str();
+ anAttributes).c_str();
if (!aPointsInfo.empty())
- aFeatureStr.append(QString(", attributes: %1").arg(aPointsInfo.c_str()).toStdString().c_str());
+ aFeatureStr.append(QString(", attributes: %1")
+ .arg(aPointsInfo.c_str()).toStdString().c_str());
}
}
return aValue;
}
-QString selectedOwners(Handle(AIS_InteractiveContext)& theContext, const bool theShapeInfoOnly = true)
+QString selectedOwners(Handle(AIS_InteractiveContext)& theContext,
+ const bool theShapeInfoOnly = true)
{
QStringList anObjects;
if (theContext.IsNull())
ObjectPtr anObject;
std::string anAttrType = theAttribute->attributeType();
if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) {
- AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
+ AttributeRefAttrPtr anAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
if (anAttr != NULL && anAttr->isObject())
anObject = anAttr->object();
}
if (anAttrType == ModelAPI_AttributeSelection::typeId()) {
- AttributeSelectionPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
+ AttributeSelectionPtr anAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
if (anAttr != NULL)
anObject = anAttr->context();
}
if (anAttrType == ModelAPI_AttributeReference::typeId()) {
- AttributeReferencePtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
+ AttributeReferencePtr anAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
if (anAttr.get() != NULL)
anObject = anAttr->value();
}
}
}
-std::string findGreedAttribute(ModuleBase_IWorkshop* theWorkshop, const FeaturePtr& theFeature)
+std::string findGreedAttribute(ModuleBase_IWorkshop* theWorkshop,
+ const FeaturePtr& theFeature)
{
std::string anAttributeId;
std::string aType = theAttribute->attributeType();
if (aType == ModelAPI_AttributeReference::typeId()) {
- AttributeReferencePtr aRef = std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
+ AttributeReferencePtr aRef =
+ std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
ObjectPtr aObject = aRef->value();
aHasObject = aObject && aObject->isSame(theObject);
//if (!(aObject && aObject->isSame(theObject))) {
// aRef->setValue(theObject);
//}
} else if (aType == ModelAPI_AttributeRefAttr::typeId()) {
- AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
+ AttributeRefAttrPtr aRefAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
AttributePtr anAttribute = theWorkshop->module()->findAttribute(theObject, theShape);
if (anAttribute.get()) {
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
aHasObject = aSelectionListAttr->isInList(aResult, theShape, theTemporarily);
- //if (!theCheckIfAttributeHasObject || !aSelectionListAttr->isInList(aResult, theShape, theTemporarily))
- // aSelectionListAttr->append(aResult, theShape, theTemporarily);
}
else if (aType == ModelAPI_AttributeRefList::typeId()) {
- AttributeRefListPtr aRefListAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
+ AttributeRefListPtr aRefListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
aHasObject = aRefListAttr->isInList(theObject);
//if (!theCheckIfAttributeHasObject || !aRefListAttr->isInList(theObject))
// aRefListAttr->append(theObject);
}
else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
- AttributeRefAttrListPtr aRefAttrListAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttrList>(theAttribute);
+ AttributeRefAttrListPtr aRefAttrListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttrList>(theAttribute);
AttributePtr anAttribute = theWorkshop->module()->findAttribute(theObject, theShape);
if (anAttribute.get()) {
bool isDone = true;
std::string aType = theAttribute->attributeType();
if (aType == ModelAPI_AttributeReference::typeId()) {
- AttributeReferencePtr aRef = std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
+ AttributeReferencePtr aRef =
+ std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
ObjectPtr aObject = aRef->value();
if (!(aObject && aObject->isSame(theObject))) {
aRef->setValue(theObject);
}
} else if (aType == ModelAPI_AttributeRefAttr::typeId()) {
- AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
+ AttributeRefAttrPtr aRefAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
AttributePtr anAttribute = theWorkshop->module()->findAttribute(theObject, theShape);
if (anAttribute.get())
AttributeSelectionListPtr aSelectionListAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
- if (!theCheckIfAttributeHasObject || !aSelectionListAttr->isInList(aResult, theShape, theTemporarily))
+ if (!theCheckIfAttributeHasObject ||
+ !aSelectionListAttr->isInList(aResult, theShape, theTemporarily))
aSelectionListAttr->append(aResult, theShape, theTemporarily);
}
else if (aType == ModelAPI_AttributeRefList::typeId()) {
- AttributeRefListPtr aRefListAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
+ AttributeRefListPtr aRefListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
if (!theCheckIfAttributeHasObject || !aRefListAttr->isInList(theObject)) {
if (theObject.get())
aRefListAttr->append(theObject);
}
}
else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
- AttributeRefAttrListPtr aRefAttrListAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttrList>(theAttribute);
+ AttributeRefAttrListPtr aRefAttrListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttrList>(theAttribute);
AttributePtr anAttribute = theWorkshop->module()->findAttribute(theObject, theShape);
if (anAttribute.get()) {
std::string aType = theAttribute->attributeType();
if (aType == ModelAPI_AttributeReference::typeId()) {
} else if (aType == ModelAPI_AttributeRefAttr::typeId()) {
- AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
+ AttributeRefAttrPtr aRefAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
if (aRefAttr.get() && !aRefAttr->isObject()) {
AttributePtr anAttribute = aRefAttr->attr();
aShape = theWorkshop->module()->findShape(anAttribute);
}
//**************************************************************
-void refsToFeatureInFeatureDocument(const ObjectPtr& theObject, std::set<FeaturePtr>& theRefFeatures)
+void refsToFeatureInFeatureDocument(const ObjectPtr& theObject,
+ std::set<FeaturePtr>& theRefFeatures)
{
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
if (aFeature.get()) {
std::string aNotActivatedNames;
if (!ModelAPI_Tools::allDocumentsActivated(aNotActivatedNames)) {
if (ModuleBase_Tools::hasModuleDocumentFeature(theFeatures))
- aNotActivatedDocWrn = QObject::tr("Selected objects can be used in Part documents which are not loaded:%1.\n")
+ aNotActivatedDocWrn =
+ QObject::tr("Selected objects can be used in Part documents which are not loaded:%1.\n")
.arg(aNotActivatedNames.c_str());
}
if (!thePrefixInfo.empty())
aText = thePrefixInfo.c_str();
QString aSep = ", ";
- if (!aPartFeatureNames.empty())
- aText += QString(QObject::tr("The following parts will be deleted: %1.\n")).arg(aPartFeatureNames.join(aSep));
+ if (!aPartFeatureNames.empty()) {
+ aText += QString(QObject::tr("The following parts will be deleted: %1.\n"))
+ .arg(aPartFeatureNames.join(aSep));
+ }
if (!aNotActivatedDocWrn.isEmpty())
aText += aNotActivatedDocWrn;
- if (!anOtherFeatureNames.empty())
- aText += QString(QObject::tr("Features are used in the following features: %1.\nThese features will be deleted.\n"))
+ if (!anOtherFeatureNames.empty()) {
+ const char* aMsg = "Features are used in the following features: %1.\nThese \
+ features will be deleted.\n";
+ aText += QString(QObject::tr(aMsg))
.arg(anOtherFeatureNames.join(aSep));
+ }
if (!aParamFeatureNames.empty()) {
- aText += QString(QObject::tr("Parameters are used in the following features: %1.\nThese features will be deleted.\nOr parameters could be replaced by their values.\n"))
+ const char* aMsg = "Parameters are used in the following features: %1.\nThese features will \
+ be deleted.\nOr parameters could be replaced by their values.\n";
+ aText += QString(QObject::tr(aMsg))
.arg(aParamFeatureNames.join(aSep));
- QPushButton *aReplaceButton = aMessageBox.addButton(QObject::tr("Replace"), QMessageBox::ActionRole);
+ QPushButton *aReplaceButton =
+ aMessageBox.addButton(QObject::tr("Replace"), QMessageBox::ActionRole);
}
if (!aText.isEmpty()) {
ModelAPI_ReplaceParameterMessage::send(aObj, 0);
}
else
- theReferencesToDelete.insert(aFeaturesRefsToParameterOnly.begin(), aFeaturesRefsToParameterOnly.end());
+ theReferencesToDelete.insert(aFeaturesRefsToParameterOnly.begin(),
+ aFeaturesRefsToParameterOnly.end());
}
return true;
}
aPixMap = new Image_AlienPixMap();
if(!aPixMap->Load(aFile.c_str())) {
// The icon for constraint is not found
- static const std::string aMsg = "Error: Point market not found by path: \"" + aFile + "\". Falling back.";
+ static const std::string aMsg =
+ "Error: Point market not found by path: \"" + aFile + "\". Falling back.";
//Events_InfoMessage("ModuleBase_Tools::setPointBallHighlighting", aMsg).send();
}
}
/// Generates the pixmap lighter than the resources pixmap.
/// Pixmap \a theIcon is lighted according to the given value.
/// If the lighter value is greater than 100, this functions returns a lighter pixmap.
-/// Setting lighter value to 150 returns a color that is 50% brighter. If the factor is less than 100,
+/// Setting lighter value to 150 returns a color that is 50% brighter.
+/// If the factor is less than 100,
/// the return pixmap is darker. If the factor is 0 or negative, the return pixmap is unspecified.
/// \param resource text of the pixmap
/// \param theObj an object
/// \param isUseAttributesInfo a flag whether the attribute values information is used
/// \return a string
-MODULEBASE_EXPORT QString objectInfo(const ObjectPtr& theObj, const bool isUseAttributesInfo = false);
+MODULEBASE_EXPORT QString objectInfo(const ObjectPtr& theObj,
+ const bool isUseAttributesInfo = false);
/// Converts the AIS context information in a string information.
/// \param theContext a viewer context
// and set in the sub-solid AIS. ViewerPrs of these fictive owners are accepted as equal
// as they use the same shape and result(of compsolid)
Handle(StdSelect_BRepOwner) aCSolidOwner1 = Handle(StdSelect_BRepOwner)::DownCast(myOwner);
- Handle(StdSelect_BRepOwner) aCSolidOwner2 = Handle(StdSelect_BRepOwner)::DownCast(thePrs->owner());
+ Handle(StdSelect_BRepOwner) aCSolidOwner2 =
+ Handle(StdSelect_BRepOwner)::DownCast(thePrs->owner());
isEqualIO = !aCSolidOwner1.IsNull() && !aCSolidOwner2.IsNull();
if (!aCSolidOwner1.IsNull() && !aCSolidOwner2.IsNull())
isEqualOwner = (aCSolidOwner1->Shape().IsNull() && aCSolidOwner2->Shape().IsNull()) ||
// and set in the sub-solid AIS. ViewerPrs of these fictive owners are accepted as equal
// as they use the same shape and result(of compsolid)
Handle(StdSelect_BRepOwner) aCSolidOwner1 = Handle(StdSelect_BRepOwner)::DownCast(myOwner);
- Handle(StdSelect_BRepOwner) aCSolidOwner2 = Handle(StdSelect_BRepOwner)::DownCast(thePrs.owner());
+ Handle(StdSelect_BRepOwner) aCSolidOwner2 =
+ Handle(StdSelect_BRepOwner)::DownCast(thePrs.owner());
isEqualIO = !aCSolidOwner1.IsNull() && !aCSolidOwner2.IsNull();
if (!aCSolidOwner1.IsNull() && !aCSolidOwner1.IsNull())
isEqualOwner = (aCSolidOwner1->Shape().IsNull() && aCSolidOwner2->Shape().IsNull()) ||
/// Destructor
virtual ~ModuleBase_WidgetEditor();
- /// Set focus to the first control of the current widget. The focus policy of the control is checked.
+ /// Set focus to the first control of the current widget.
+ /// The focus policy of the control is checked.
/// If the widget has the NonFocus focus policy, it is skipped.
/// \return the state whether the widget can accept the focus
virtual bool focusTo();
/**
* \ingroup GUI
- Provides for an attribute backup of values. It is possible to store/ restore the attribute values.
+ Provides for an attribute backup of values.
+ It is possible to store/ restore the attribute values.
*/
class ModuleBase_WidgetSelectorStore
{
private:
/// backup parameters of the model attribute. The class processes three types of attribute:
- /// Reference, RefAttr and Selection. Depending on the attribute type, only the attribute parameter
+ /// Reference, RefAttr and Selection.
+ /// Depending on the attribute type, only the attribute parameter
/// values are reserved in the backup
/// An attribute object
ObjectPtr myObject;
myInvalidPrs.clear();
}
-bool ModuleBase_WidgetValidator::getValidState(const ModuleBase_ViewerPrsPtr& theValue, bool& theValid)
+bool ModuleBase_WidgetValidator::getValidState(const ModuleBase_ViewerPrsPtr& theValue,
+ bool& theValid)
{
bool aValidPrs = myValidPrs.contains(theValue);
bool anInvalidPrs = myInvalidPrs.contains(theValue);
}
//********************************************************************
-void ModuleBase_WidgetValidator::storeValidState(const ModuleBase_ViewerPrsPtr& theValue, const bool theValid)
+void ModuleBase_WidgetValidator::storeValidState(const ModuleBase_ViewerPrsPtr& theValue,
+ const bool theValid)
{
bool aValidPrs = myInvalidPrs.contains(theValue);
bool anInvalidPrs = myInvalidPrs.contains(theValue);
// myValidPrs.removeOne(theValue);
}
#ifdef DEBUG_VALID_STATE
- qDebug(QString("storeValidState: myValidPrs.size() = %1, myInvalidPrs.size() = %2").arg(myValidPrs.count())
+ qDebug(QString("storeValidState: myValidPrs.size() = %1, myInvalidPrs.size() = %2")
+ .arg(myValidPrs.count())
.arg(myInvalidPrs.count()).toStdString().c_str());
#endif
}