#include <ModelAPI_Session.h>
#include <ModelAPI_Events.h>
+#include <ModelGeomAlgo_Point2D.h>
+
#include <TopoDS_Iterator.hxx>
#include <GeomDataAPI_Point2D.h>
.c_str());
}
if (isUseAttributesInfo) {
- std::list<AttributePtr> anAttrs = aFeature->data()->attributes("");
- std::list<AttributePtr>::const_iterator anIt = anAttrs.begin(), aLast = anAttrs.end();
- QStringList aValues;
- for(; anIt != aLast; anIt++) {
- AttributePtr anAttr = *anIt;
- QString aValue = "not defined";
- std::string aType = anAttr->attributeType();
- if (aType == GeomDataAPI_Point2D::typeId()) {
- std::shared_ptr<GeomDataAPI_Point2D> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
- anAttr);
- if (aPoint.get())
- aValue = QString("(%1, %2)").arg(aPoint->x()).arg(aPoint->y());
- }
- else if (aType == ModelAPI_AttributeRefAttr::typeId()) {
- }
-
- aValues.push_back(QString("%1: %2").arg(anAttr->id().c_str()).arg(aValue).toStdString().c_str());
- }
- if (!aValues.empty())
- aFeatureStr.append(QString(", attributes: %1").arg(aValues.join(", ").toStdString().c_str()));
+ std::set<std::shared_ptr<ModelAPI_Attribute> > anAttributes;
+ std::string aPointsInfo = ModelGeomAlgo_Point2D::getPontAttributesInfo(aFeature,
+ anAttributes).c_str();
+ if (!aPointsInfo.empty())
+ 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();
}
}