--- /dev/null
+linelength=100
+filter=-whitespace,+whitespace/line_length,-readability,-build,-runtime
+root=src
//#define DEBUG_CURSOR
/// Fills attribute and result lists by the selected owner. In case if the attribute is found,
-/// by the owner shape, it is put to the list. Otherwise if type of owner shape is edge, put the function
-/// result as is to the list of results.
+/// by the owner shape, it is put to the list. Otherwise if type of owner shape is edge,
+/// put the function result as is to the list of results.
/// \param theOwner a viewer selected owner
/// \param theFeature a feature, where the attribute is searched
/// \param theSketch a current sketch
myModule->sketchReentranceMgr()->updateInternalEditActiveState();
return;
}
- // it is necessary to restore current selection in order to restore it after the values are modified
+ // it is necessary to restore current selection in order to restore it after values are modified
restoreSelection();
myCurrentSelection.clear();
// the feature is to be erased here, but it is correct to call canDisplayObject because
// there can be additional check (e.g. editor widget in distance constraint)
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
- (getCurrentOperation());
+ (getCurrentOperation());
if (aFOperation) {
FeaturePtr aFeature = aFOperation->feature();
visualizeFeature(aFeature, aFOperation->isEditOperation(), canDisplayObject(aFeature));
//myClickedPoint.clear();
if (myIsDragging) {
- // 1. the current selection is saved in the mouse press method in order to restore it after moving
+ // 1. the current selection is saved in the mouse press method in order to restore it after
+ // moving
// 2. the enable selection in the viewer should be temporary switched off in order to ignore
// mouse press signal in the viewer(it call Select for AIS context and the dragged objects are
// deselected). This flag should be restored in the slot, processed the mouse release signal.
#ifndef DEBUG_DO_NOT_BY_ENTER
if (isNestedCreateOperation(getCurrentOperation(), activeSketch())) {
ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
- ModuleBase_WidgetEditor* anEditorWdg = anActiveWidget ? dynamic_cast<ModuleBase_WidgetEditor*>(anActiveWidget) : 0;
- // the active widget editor should not influence here. The presentation should be visible always
- // when this widget is active.
+ ModuleBase_WidgetEditor* anEditorWdg =
+ anActiveWidget ? dynamic_cast<ModuleBase_WidgetEditor*>(anActiveWidget) : 0;
+ // the active widget editor should not influence here. The presentation should be visible
+ // always when this widget is active.
if (!anEditorWdg && !myIsPopupMenuActive) {
- // during a nested create operation, the feature is redisplayed only if the mouse over view
+ // during a nested create operation, the feature is redisplayed only
+ // if the mouse over view
// of there was a value modified in the property panel after the mouse left the view
aCanDisplay = canDisplayCurrentCreatedFeature();
}
SelectMgr_IndexedMapOfOwner aSelectedOwners;
aConnector->workshop()->selector()->selection()->entityOwners(anAISIO, aSelectedOwners);
for ( Standard_Integer i = 1, n = aSelectedOwners.Extent(); i <= n; i++ ) {
- Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast(aSelectedOwners(i));
+ Handle(StdSelect_BRepOwner) anOwner =
+ Handle(StdSelect_BRepOwner)::DownCast(aSelectedOwners(i));
if ( anOwner.IsNull() || !anOwner->HasShape() )
continue;
const TopoDS_Shape& aShape = anOwner->Shape();
TopAbs_ShapeEnum aShapeType = aShape.ShapeType();
if (aShapeType == TopAbs_VERTEX) {
- AttributePtr aPntAttr = PartSet_Tools::findAttributeBy2dPoint(theFeature, aShape, theSketch);
+ AttributePtr aPntAttr =
+ PartSet_Tools::findAttributeBy2dPoint(theFeature, aShape, theSketch);
if (aPntAttr.get() != NULL &&
aSelectedAttributes.find(aPntAttr) != aSelectedAttributes.end()) {
theOwnersToSelect.Add(anOwner);
}
}
-void PartSet_SketcherMgr::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect)
+void PartSet_SketcherMgr::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget,
+ const bool isToConnect)
{
if (isToConnect) {
connect(theWidget, SIGNAL(beforeValuesChanged()),
// 1. it is necessary to save current selection in order to restore it after the features moving
myCurrentSelection.clear();
- QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = aStoredPrs.begin(), aLast = aStoredPrs.end();
+ QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = aStoredPrs.begin(),
+ aLast = aStoredPrs.end();
CompositeFeaturePtr aSketch = activeSketch();
for (; anIt != aLast; anIt++) {
std::set<AttributePtr> aSelectedAttributes;
std::set<ResultPtr> aSelectedResults;
if (myCurrentSelection.find(aFeature) != myCurrentSelection.end()) {
- std::pair<std::set<AttributePtr>, std::set<ResultPtr> > aPair = myCurrentSelection.find(aFeature).value();
+ std::pair<std::set<AttributePtr>, std::set<ResultPtr> > aPair =
+ myCurrentSelection.find(aFeature).value();
aSelectedAttributes = aPair.first;
aSelectedResults = aPair.second;
}
// 3. External objects (violet color)
// 4. Auxiliary segments (dotted)
// StdSelect_BRepSelectionTool::Load uses priority calculating:
- // Standard_Integer aPriority = (thePriority == -1) ? GetStandardPriority (theShape, theType) : thePriority;
+ // Standard_Integer aPriority =
+ // (thePriority == -1) ? GetStandardPriority (theShape, theType) : thePriority;
// Priority of Vertex is 8, edge(segment) is 7.
// It might be not corrected as provides the condition above.
bool isExternal = aSPFeature->isExternal();
ModelAPI_ValidatorsFactory::Validators::iterator aValidatorIt = aValidators.begin();
for (; aValidatorIt != aValidators.end(); ++aValidatorIt) {
const ModuleBase_SelectionValidator* aSelValidator =
- dynamic_cast<const ModuleBase_SelectionValidator*>(aFactory->validator(aValidatorIt->first));
+ dynamic_cast<const ModuleBase_SelectionValidator*>
+ (aFactory->validator(aValidatorIt->first));
if (aSelValidator)
setActionEnabled(aId, aSelValidator->isValid(aSelection, theOperation));
}
}
break;
case Preview: {
- aResult = ModuleBase_Tools::createAction(QIcon(), tr("See preview"), aParent, 0, 0, "Compute preview");
+ aResult = ModuleBase_Tools::createAction(QIcon(), tr("See preview"),
+ aParent, 0, 0, "Compute preview");
aResult->setStatusTip(aResult->toolTip());
}
break;
void XGUI_ActionsMgr::setNestedStackEnabled(ModuleBase_Operation* theOperation)
{
- ModuleBase_OperationFeature* anOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+ ModuleBase_OperationFeature* anOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if(!anOperation || !anOperation->feature())
return;
FeaturePtr aFeature = anOperation->feature();
QStringList XGUI_ActionsMgr::allNestedCommands(ModuleBase_Operation* theOperation)
{
QStringList aFeatures;
- ModuleBase_OperationFeature* anOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+ ModuleBase_OperationFeature* anOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if(!anOperation || !anOperation->feature())
return aFeatures;
FeaturePtr aFeature = anOperation->feature();
/// Return an action by the given id, if it was registered in the manager
QAction* action(const QString& theId);
- /// Return info (icon, text, etc) about the action by the given id, if it was registered in the manager
+ /// Return info (icon, text, etc) about the action by the given id,
+ /// if it was registered in the manager
ActionInfo actionInfoById(const QString& theId);
private:
bool containsValues(std::map<int, std::vector<int> >& theColorMap, std::vector<int>& theValues)
{
- std::map<int, std::vector<int> >::const_iterator anIt = theColorMap.begin(), aLast = theColorMap.end();
+ std::map<int, std::vector<int> >::const_iterator anIt = theColorMap.begin(),
+ aLast = theColorMap.end();
bool isFound = false;
for (; anIt != aLast && !isFound; anIt++) {
std::vector<int> aValues = anIt->second;
/**
* \ingroup GUI
* A class of dialog to chose a color. The color can be set in two ways: use a random value or
-* a certain color. There is a radio button to provide this choice. The color button is visualized to
-* select a certain color.
+* a certain color. There is a radio button to provide this choice. The color button is
+* visualized to select a certain color.
*/
class XGUI_ColorDialog : public QDialog
{
/// \param theValue an RGB components value
void setColor(const std::vector<int>& theValue);
- /// Returns a container with the current color value. These are tree int values for RGB definition.
- /// These value is depend on the random choice and eighter a next random color or a certain color.
+ /// Returns a container with the current color value.
+ /// These are tree int values for RGB definition.
+ /// These value is depend on the random choice and eighter
+ /// a next random color or a certain color.
/// \return a vector of values
std::vector<int> getColor() const;
- /// Returns a container with the current color value. These are tree int values for RGB definition.
+ /// Returns a container with the current color value.
+ /// These are tree int values for RGB definition.
/// It returns the next random color.
/// \return a vector of values
std::vector<int> getRandomColor() const;
XGUI_SelectionMgr* aSelMgr = myWorkshop->selector();
XGUI_Displayer* aDisplayer = myWorkshop->displayer();
- QList<ModuleBase_ViewerPrsPtr> aPrsList = aSelMgr->selection()->getSelected(ModuleBase_ISelection::Viewer);
+ QList<ModuleBase_ViewerPrsPtr> aPrsList =
+ aSelMgr->selection()->getSelected(ModuleBase_ISelection::Viewer);
if (aPrsList.size() > 0) {
bool isVisible = false;
bool isShading = false;
if (aRes && aRes->isDisplayed()) {
isVisible = true;
canBeShaded = myWorkshop->displayer()->canBeShaded(aObject);
- isShading = (myWorkshop->displayer()->displayMode(aObject) == XGUI_Displayer::Shading);
+ isShading =
+ (myWorkshop->displayer()->displayMode(aObject) == XGUI_Displayer::Shading);
break;
}
}
void XGUI_ContextMenuMgr::addViewerMenu(QMenu* theMenu) const
{
XGUI_SelectionMgr* aSelMgr = myWorkshop->selector();
- QList<ModuleBase_ViewerPrsPtr> aPrsList = aSelMgr->selection()->getSelected(ModuleBase_ISelection::Viewer);
+ QList<ModuleBase_ViewerPrsPtr> aPrsList =
+ aSelMgr->selection()->getSelected(ModuleBase_ISelection::Viewer);
int aSelected = aPrsList.size();
QActionsList aActions;
{
theColor.clear();
// get color from the attribute of the result
- if (theResult.get() != NULL && theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() != NULL) {
+ if (theResult.get() != NULL &&
+ theResult->data()->attribute(ModelAPI_Result::COLOR_ID()).get() != NULL) {
AttributeIntArrayPtr aColorAttr = theResult->data()->intArray(ModelAPI_Result::COLOR_ID());
if (aColorAttr.get() && aColorAttr->size()) {
theColor.push_back(aColorAttr->value(0));
SessionPtr aMgr = ModelAPI_Session::get();
if (aMgr->activeDocument() != theResult->document()) {
QColor aQColor(aColor[0], aColor[1], aColor[2]);
- QColor aNewColor = QColor::fromHsvF(aQColor.hueF(), aQColor.saturationF()/3., aQColor.valueF());
+ QColor aNewColor =
+ QColor::fromHsvF(aQColor.hueF(), aQColor.saturationF()/3., aQColor.valueF());
aColor[0] = aNewColor.red();
aColor[1] = aNewColor.green();
aColor[2] = aNewColor.blue();
{
if (aObj->groupName() == ModelAPI_ResultParameter::group()) {
ModelAPI_ResultParameter* aParam = dynamic_cast<ModelAPI_ResultParameter*>(aObj);
- AttributeDoublePtr aValueAttribute = aParam->data()->real(ModelAPI_ResultParameter::VALUE());
+ AttributeDoublePtr aValueAttribute =
+ aParam->data()->real(ModelAPI_ResultParameter::VALUE());
QString aVal = QString::number(aValueAttribute->value());
QString aTitle = QString(aObj->data()->name().c_str());
return aTitle + " = " + aVal;
}
} else {
// Check for composite object
- ModelAPI_CompositeFeature* aCompFeature = dynamic_cast<ModelAPI_CompositeFeature*>(aParentObj);
+ ModelAPI_CompositeFeature* aCompFeature =
+ dynamic_cast<ModelAPI_CompositeFeature*>(aParentObj);
if (aCompFeature) {
aIndex = objectIndex(aCompFeature->subFeature(theRow));
} else {
- ModelAPI_ResultCompSolid* aCompRes = dynamic_cast<ModelAPI_ResultCompSolid*>(aParentObj);
+ ModelAPI_ResultCompSolid* aCompRes =
+ dynamic_cast<ModelAPI_ResultCompSolid*>(aParentObj);
if (aCompRes)
aIndex = objectIndex(aCompRes->subResult(theRow));
}
* - Non Valid Index - root index
* - An index with internal Id == -1 is a folder of root document
* - An index which contains internal pointer as ModelAPI_Object its the object
- * - An index which contains internal pointer as ModelAPI_Document is a folder which belongs to this document
+ * - An index which contains internal pointer as ModelAPI_Document is
+ * a folder which belongs to this document
*/
class XGUI_EXPORT XGUI_DataModel : public QAbstractItemModel, public Events_Listener
{
/// \param theParent a parent model index
virtual int columnCount(const QModelIndex& theParent = QModelIndex()) const;
- /// Returns the index of the item in the model specified by the given row, column and parent index.
+ /// Returns the index of the item in the model specified by the given row,
+ /// column and parent index.
/// \param theRow a row
/// \param theColumn a column
/// \param theParent a parent model index
/// \param theDoc the document object
QModelIndex findDocumentRootIndex(const ModelAPI_Document* theDoc) const;
- /// Returns number of folders in document. Considered folders which has to be shown only if they are not empty.
- /// \param theDoc document which has to be checked. If 0 then Root document will be considered
+ /// Returns number of folders in document.
+ /// Considered folders which has to be shown only if they are not empty.
+ /// \param theDoc document which has to be checked. If 0 then Root document will be considered
int foldersCount(ModelAPI_Document* theDoc = 0) const;
/// Retrurns indexes of folders which can not be shown because they are empty
/// \param theDoc document which has to be checked. If 0 then Root document will be considered
QIntList missedFolderIndexes(ModelAPI_Document* theDoc = 0) const;
- /// Returns Id (row) of a folder taking into consideration folders which can not be shown non empty
+ /// Returns Id (row) of a folder taking into consideration
+ /// folders which can not be shown non empty
/// \param theType Type of the folder
/// \param theDoc a document which contains this folder
int folderId(std::string theType, ModelAPI_Document* theDoc = 0);
#include <set>
-const int MOUSE_SENSITIVITY_IN_PIXEL = 10; ///< defines the local context mouse selection sensitivity
+/// defines the local context mouse selection sensitivity
+const int MOUSE_SENSITIVITY_IN_PIXEL = 10;
//#define DEBUG_ACTIVATE_OBJECTS
//#define DEBUG_DEACTIVATE
bool aDisplayed = false;
if (isVisible(theObject)) {
#ifdef DEBUG_COMPOSILID_DISPLAY
- ResultCompSolidPtr aCompsolidResult = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(theObject);
+ ResultCompSolidPtr aCompsolidResult =
+ std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(theObject);
if (aCompsolidResult.get()) {
for(int i = 0; i < aCompsolidResult->numberOfSubs(); i++) {
ResultPtr aSubResult = aCompsolidResult->subResult(i);
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
if (aResult.get() != NULL) {
#ifdef DEBUG_COMPOSILID_DISPLAY
- ResultCompSolidPtr aCompsolidResult = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(theObject);
+ ResultCompSolidPtr aCompsolidResult =
+ std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(theObject);
if (aCompsolidResult.get()) {
for(int i = 0; i < aCompsolidResult->numberOfSubs(); i++) {
ResultPtr aSubResult = aCompsolidResult->subResult(i);
std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
if (aShapePtr.get() != NULL) {
anAIS = AISObjectPtr(new GeomAPI_AISObject());
- Handle(AIS_InteractiveObject) anAISPrs = myWorkshop->module()->createPresentation(aResult);
+ Handle(AIS_InteractiveObject) anAISPrs =
+ myWorkshop->module()->createPresentation(aResult);
if (anAISPrs.IsNull())
anAISPrs = new ModuleBase_ResultPrs(aResult);
else {
bool isCustomized = customizeObject(theObject);
#ifdef DEBUG_FEATURE_REDISPLAY
qDebug(QString("Redisplay: %1, isEqualShapes=%2, isCustomized=%3").
- arg(!isEqualShapes || isCustomized).arg(isEqualShapes).arg(isCustomized).toStdString().c_str());
+ arg(!isEqualShapes || isCustomized).arg(isEqualShapes)
+ .arg(isCustomized).toStdString().c_str());
#endif
if (!isEqualShapes || isCustomized) {
/// if shapes are equal and presentation are customized, selection should be restored
deactivateAIS(anAIS);
// the selection from the previous activation modes should be cleared manually (#26172)
aContext->LocalContext()->ClearOutdatedSelection(anAIS, true);
- ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::deactivate -- ClearOutdatedSelection");
+ ModuleBase_Tools::selectionInfo(aContext,
+ "XGUI_Displayer::deactivate -- ClearOutdatedSelection");
if (theUpdateViewer)
updateViewer();
}
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
if (aPrs.get() || aResult.get()) {
aVisible = theDisplayer->isVisible(theObject);
- // compsolid is not visualized in the viewer, but should have presentation when all sub solids are
+ // compsolid is not visualized in the viewer,
+ // but should have presentation when all sub solids are
// visible. It is useful for highlight presentation where compsolid shape is selectable
if (!aVisible && aResult.get() && aResult->groupName() == ModelAPI_ResultCompSolid::group()) {
- ResultCompSolidPtr aCompsolidResult = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aResult);
+ ResultCompSolidPtr aCompsolidResult =
+ std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aResult);
if (aCompsolidResult.get() != NULL) { // change colors for all sub-solids
bool anAllSubsVisible = aCompsolidResult->numberOfSubs() > 0;
for(int i = 0; i < aCompsolidResult->numberOfSubs() && anAllSubsVisible; i++) {
}
-void XGUI_Displayer::setSelected(const QList<ModuleBase_ViewerPrsPtr>& theValues, bool theUpdateViewer)
+void XGUI_Displayer::setSelected(const QList<ModuleBase_ViewerPrsPtr>& theValues,
+ bool theUpdateViewer)
{
Handle(AIS_InteractiveContext) aContext = AISContext();
if (aContext.IsNull())
if (aContext->HasOpenedContext()) {
aContext->UnhilightSelected(false);
aContext->ClearSelected(false);
- NCollection_DataMap<TopoDS_Shape, NCollection_Map<Handle(AIS_InteractiveObject)>> aShapesToBeSelected;
+ NCollection_DataMap<TopoDS_Shape, NCollection_Map<Handle(AIS_InteractiveObject)>>
+ aShapesToBeSelected;
foreach (ModuleBase_ViewerPrsPtr aPrs, theValues) {
const GeomShapePtr& aGeomShape = aPrs->shape();
}
}
}
- ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::setSelected -- AddOrRemoveSelected/UnhilightCurrents(no local context)");
+ ModuleBase_Tools::selectionInfo(aContext,
+ "XGUI_Displayer::setSelected -- AddOrRemoveSelected/UnhilightCurrents(no local context)");
if (theUpdateViewer)
updateViewer();
}
if (theIO->Width() > 1) {
double aPrecision = theIO->Width() + 2;
if (theMode == getSelectionMode(TopAbs_VERTEX))
- aPrecision = ModuleBase_Preferences::resourceMgr()->doubleValue("Viewer", "point-selection-sensitivity", 20);
- else if ((theMode == getSelectionMode(TopAbs_EDGE)) || (theMode == getSelectionMode(TopAbs_WIRE)))
+ aPrecision = ModuleBase_Preferences::resourceMgr()->doubleValue("Viewer",
+ "point-selection-sensitivity",
+ 20);
+ else if ((theMode == getSelectionMode(TopAbs_EDGE)) ||
+ (theMode == getSelectionMode(TopAbs_WIRE)))
aPrecision = theIO->Width() +
- ModuleBase_Preferences::resourceMgr()->doubleValue("Viewer", "edge-selection-sensitivity", 2);
+ ModuleBase_Preferences::resourceMgr()->doubleValue("Viewer",
+ "edge-selection-sensitivity", 2);
aContext->SetSelectionSensitivity(theIO, theMode, aPrecision);
}
ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::activateAIS -- Activate");
#ifdef DEBUG_ACTIVATE_AIS
ObjectPtr anObject = getObject(theIO);
anInfo.append(ModuleBase_Tools::objectInfo((*anIt)));
- qDebug(QString("activateAIS: theMode = %1, object = %2").arg(theMode).arg(anInfo).toStdString().c_str());
+ qDebug(QString("activateAIS: theMode = %1, object = %2").arg(theMode)
+ .arg(anInfo).toStdString().c_str());
#endif
if (theUpdateViewer)
updateViewer();
}
}
-void XGUI_Displayer::deactivateAIS(const Handle(AIS_InteractiveObject)& theIO, const int theMode) const
+void XGUI_Displayer::deactivateAIS(const Handle(AIS_InteractiveObject)& theIO,
+ const int theMode) const
{
Handle(AIS_InteractiveContext) aContext = AISContext();
if (!aContext.IsNull()) {
#ifdef DEBUG_DEACTIVATE_AIS
ObjectPtr anObject = getObject(theIO);
anInfo.append(ModuleBase_Tools::objectInfo((*anIt)));
- qDebug(QString("deactivateAIS: theMode = %1, object = %2").arg(theMode).arg(anInfo).toStdString().c_str());
+ qDebug(QString("deactivateAIS: theMode = %1, object = %2").arg(theMode)
+ .arg(anInfo).toStdString().c_str());
#endif
}
}
aCompositeFilter->Remove(theFilter);
#ifdef DEBUG_SELECTION_FILTERS
int aCount = aCompositeFilter->StoredFilters().Extent();
- qDebug(QString("removeSelectionFilter: filters.count() = %1").arg(aCount).toStdString().c_str());
+ qDebug(QString("removeSelectionFilter: filters.count() = %1")
+ .arg(aCount).toStdString().c_str());
#endif
}
}
// If the selection problem happens again, it is possible to write a test scenario and create
// a bug. The bug steps are the following:
// Create two IO, activate them in 5 modes, select the first IO, deactivate 3 modes for both,
- // with clicked SHIFT select the second object. The result is the selection of the first IO is lost.
+ // with clicked SHIFT select the second object.
+ // The result is the selection of the first IO is lost.
TColStd_ListOfInteger aTColModes;
aContext->ActivatedModes(theIO, aTColModes);
TColStd_ListIteratorOfListOfInteger itr( aTColModes );
// the selection from the previous activation modes should be cleared manually (#26172)
theIO->ClearSelected();
aContext->LocalContext()->ClearOutdatedSelection(theIO, true);
- ModuleBase_Tools::selectionInfo(aContext, "XGUI_Displayer::activate -- ClearSelected/ClearOutdatedSelection");
+ ModuleBase_Tools::selectionInfo(aContext,
+ "XGUI_Displayer::activate -- ClearSelected/ClearOutdatedSelection");
// For performance issues
//if (theUpdateViewer)
// updateViewer();
}
-QColor XGUI_Displayer::setObjectColor(ObjectPtr theObject, const QColor& theColor, bool theUpdateViewer)
+QColor XGUI_Displayer::setObjectColor(ObjectPtr theObject,
+ const QColor& theColor,
+ bool theUpdateViewer)
{
if (!isVisible(theObject))
return Qt::black;
/// \return true if the object visibility state is changed
bool display(ObjectPtr theObject, bool theUpdateViewer = true);
- /// Display the given AIS object. This object is not added to the displayer internal map of objects
- /// So, it can not be obtained from displayer. This is just a wrap method of OCC display in order
- /// to perform the display with correct flags.
+ /// Display the given AIS object.
+ /// This object is not added to the displayer internal map of objects
+ /// So, it can not be obtained from displayer. This is just a wrap method of OCC display in
+ /// order to perform the display with correct flags.
/// \param theAIS AIOS object to display
/// \param toActivateInSelectionModes boolean value whether the presentation should be
/// activated in the current selection modes
/// empty, select it, otherwise select the result.
/// \param theValues a list of presentation to be selected
/// \param theUpdateViewer the parameter whether the viewer should be update immediatelly
- void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues, bool theUpdateViewer = true);
+ void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
+ bool theUpdateViewer = true);
/// Unselect all objects
/// \param theUpdateViewer the parameter whether the viewer should be update immediatelly
/// Sets a flag to the displayer whether the internal viewer can be updated by
/// the updateViewer method call. If it is not enabled, this method do nothing.
/// This state maintain recurse, if the update is blocked twice or three times, the
- /// viewer will not be updated until it is unblocked necessary times(twice or three in the example).
+ /// viewer will not be updated until it is unblocked necessary times
+ /// (twice or three in the example).
/// \param isEnabled a boolean value
bool enableUpdateViewer(const bool isEnabled);
void activateAIS(const Handle(AIS_InteractiveObject)& theIO, const int theMode,
const bool theUpdateViewer) const;
- /// Activate interactive context. It is necessary to call ClearOutdatedSelection after deactivation
+ /// Activate interactive context. It is necessary to call ClearOutdatedSelection
+ /// after deactivation
/// \param theIO an interactive object
/// \param theMode a mode to deactivate. When theMode=-1 then all modes will be deactivated
void deactivateAIS(const Handle(AIS_InteractiveObject)& theIO, const int theMode = -1) const;
/// in OCCT but improved for performance. The modification is to iterates by a list
/// of owners in the context only once.
/// \param theContext a viewer context. It has opened local context
- /// \param theShapesToBeSelected a map of shapes. Owner's shape is searched in the map and the owner
- /// is selected if it is found there. Only first owner is processed(according to OCCT logic)
+ /// \param theShapesToBeSelected a map of shapes. Owner's shape is searched in the map and the
+ /// owner is selected if it is found there.
+ /// Only first owner is processed(according to OCCT logic)
static void AddOrRemoveSelectedShapes(Handle(AIS_InteractiveContext) theContext,
const NCollection_DataMap<TopoDS_Shape,
NCollection_Map<Handle(AIS_InteractiveObject)>>& theShapesToBeSelected);
- //const NCollection_Map<TopoDS_Shape>& theShapesToBeSelected);
-
protected:
/// Reference to workshop
XGUI_Workshop* myWorkshop;
/// A container for selection filters
Handle(SelectMgr_AndFilter) myAndFilter;
- /// A default custom presentation, which is used if the displayed feature is not a custom presentation
+ /// A default custom presentation, which is used if the displayed feature is not
+ /// a custom presentation
GeomCustomPrsPtr myCustomPrs;
/// Definition of a type of map which defines correspondance between objects and presentations
QString anError = "";
/// to allow the module have the button always enabled
- bool isActionStateEnabled = myWorkshop->module()->isActionEnableStateFixed(XGUI_ActionsMgr::AcceptAll);
+ bool isActionStateEnabled =
+ myWorkshop->module()->isActionEnableStateFixed(XGUI_ActionsMgr::AcceptAll);
if (!isActionStateEnabled) {
anError = myWorkshop->module()->getFeatureError(theFeature);
if (anError.isEmpty()) {
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
/*
* XGUI_HistoryMenu.cpp
*
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
/*
* XGUI_HistoryMenu.h
*
private:
std::string myName; /// a name of the workbench
- std::list<std::shared_ptr<Config_FeatureMessage> > myFeatureInfo; /// container of existing features
+
+ /// container of existing features
+ std::list<std::shared_ptr<Config_FeatureMessage> > myFeatureInfo;
};
#endif /* XGUI_MENUGROUP_H_ */
void XGUI_MenuMgr::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
//A message to start feature creation received.
- if (theMessage->eventID() == Events_Loop::loop()->eventByName(Config_FeatureMessage::GUI_EVENT())) {
+ if (theMessage->eventID() ==
+ Events_Loop::loop()->eventByName(Config_FeatureMessage::GUI_EVENT())) {
std::shared_ptr<Config_FeatureMessage> aFeatureMsg =
std::dynamic_pointer_cast<Config_FeatureMessage>(theMessage);
if (!aFeatureMsg->isInternal()) {
aResultWorkbench = aWorkbench;
}
if (!aResultWorkbench) {
- aResultWorkbench = std::shared_ptr<XGUI_MenuWorkbench>(new XGUI_MenuWorkbench(theWorkbenchName));
+ aResultWorkbench =
+ std::shared_ptr<XGUI_MenuWorkbench>(new XGUI_MenuWorkbench(theWorkbenchName));
myWorkbenches.push_back(aResultWorkbench);
}
return aResultWorkbench;
for (; aGIt != aGLast; aGIt++) {
const std::shared_ptr<XGUI_MenuGroup> aGroup = *aGIt;
std::string aGName = aGroup->getName();
- const std::list<std::shared_ptr<Config_FeatureMessage> >& aFeaturesInfo = aGroup->featuresInfo();
- std::list<std::shared_ptr<Config_FeatureMessage> >::const_iterator aFIt = aFeaturesInfo.begin(),
- aFLast = aFeaturesInfo.end();
+ const std::list<std::shared_ptr<Config_FeatureMessage> >& aFeaturesInfo =
+ aGroup->featuresInfo();
+ std::list<std::shared_ptr<Config_FeatureMessage> >::const_iterator aFIt =
+ aFeaturesInfo.begin(), aFLast = aFeaturesInfo.end();
int aFSize = aFeaturesInfo.size();
for(int i = 0; aFIt != aFLast; aFIt++, i++) {
std::shared_ptr<Config_FeatureMessage> aMessage = *aFIt;
private:
XGUI_Workshop* myWorkshop; ///< the current workshop
- std::list< std::shared_ptr<XGUI_MenuWorkbench> > myWorkbenches; ///< container of existing workbenchs
+
+ /// container of existing workbenchs
+ std::list< std::shared_ptr<XGUI_MenuWorkbench> > myWorkbenches;
};
#endif /* XGUI_MENUMGR_H_ */
XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr();
if (anOperationMgr->startOperation(theOperation)) {
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+ ModuleBase_OperationFeature* aFOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if (aFOperation) {
workshop()->propertyPanel()->updateContentWidget(aFOperation->feature());
workshop()->propertyPanel()->createContentPanel(aFOperation->feature());
public:
/// Constructor
/// \param theParent a parent of the delegate
- XGUI_TreeViewItemDelegate(XGUI_DataTree* theParent):QStyledItemDelegate(theParent), myTreedView(theParent) {}
+ XGUI_TreeViewItemDelegate(XGUI_DataTree* theParent):QStyledItemDelegate(theParent),
+ myTreedView(theParent) {}
/// Set data for item editor (name of the item)
/// \param editor a widget of editor
{
static int aEntrance = 0;
if (aEntrance == 0) {
- // We have to check number of enter and exit of this function because it can be called recursively by Qt
- // in order to avoid double modifying of a data
+ // We have to check number of enter and exit of this function because it can be called
+ // recursively by Qt in order to avoid double modifying of a data
aEntrance = 1;
QLineEdit* aEditor = dynamic_cast<QLineEdit*>(theEditor);
if (aEditor) {
QPainter* thePainter, const QWidget* theWidget) const
{
if ((theElement == QStyle::PE_PanelItemViewRow) || (theElement == QStyle::PE_PanelItemViewItem)) {
- const QStyleOptionViewItemV4* aOptions = qstyleoption_cast<const QStyleOptionViewItemV4 *>(theOption);
+ const QStyleOptionViewItemV4* aOptions =
+ qstyleoption_cast<const QStyleOptionViewItemV4 *>(theOption);
if (myIndex.isValid() && ((myIndex.flags() & Qt::ItemIsSelectable) == 0)) {
QStyle::State aState = aOptions->state;
if ((aState & QStyle::State_MouseOver) != 0)
QColor aHighlightText = aPalet.highlightedText().color();
myPreSelectionStyle = "QLabel {background-color: ";
- myPreSelectionStyle += "qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 white, stop:1 " + aHighlight.lighter(170).name() + ");";
+ myPreSelectionStyle += "qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 white, stop:1 " +
+ aHighlight.lighter(170).name() + ");";
myPreSelectionStyle += "border: 1px solid lightblue; border-radius: 2px }";
QString aName = aPalet.color(QPalette::Base).name();
{
QStringList result;
foreach(ModuleBase_Operation* eachOperation, myOperations) {
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(eachOperation);
+ ModuleBase_OperationFeature* aFOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(eachOperation);
if (aFOperation) {
FeaturePtr aFeature = aFOperation->feature();
if(aFeature) {
{
XGUI_ErrorMgr* anErrorMgr = XGUI_Tools::workshop(myWorkshop)->errorMgr();
if (theOperation) {
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+ ModuleBase_OperationFeature* aFOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if (aFOperation)
anErrorMgr->updateAcceptAllAction(aFOperation->feature());
}
DocumentPtr aDoc = aMgr->activeDocument();
bool aIsOp = aMgr->isOperation();
if (!aIsOp)
- aMgr->startOperation(QString("Set current feature: %1").arg(theFeature->getKind().c_str()).toStdString());
+ aMgr->startOperation(QString("Set current feature: %1")
+ .arg(theFeature->getKind().c_str()).toStdString());
aDoc->setCurrentFeature(theFeature, false);
if (!aIsOp)
aMgr->finishOperation();
return;
/// Set current feature and remeber old current feature
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(aCurrentOperation);
+ ModuleBase_OperationFeature* aFOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(aCurrentOperation);
if (aFOperation) {
SessionPtr aMgr = ModelAPI_Session::get();
DocumentPtr aDoc = aMgr->activeDocument();
- // the parameter of current feature should be false, we should use all feature, not only visible
- // in order to correctly save the previous feature of the nested operation, where the
+ // the parameter of current feature should be false, we should use all feature, not only
+ // visible in order to correctly save the previous feature of the nested operation, where the
// features can be not visible in the tree. The problem case is Edit sketch entitity(line)
// in the Sketch, created in ExtrusionCut operation. The entity disappears by commit.
// When sketch entity operation started, the sketch should be cashed here as the current.
// Otherwise(the flag is true), the ExtrusionCut is cashed, when commit happens, the sketch
// is disabled, sketch entity is disabled as extrusion cut is created earliest then sketch.
- // As a result the sketch disappears from the viewer. However after commit it is displayed back.
+ // As a result the sketch disappears from the viewer.
+ // However after commit it is displayed back.
aFOperation->setPreviousCurrentFeature(aDoc->currentFeature(false));
#ifdef DEBUG_CURRENT_FEATURE
.arg(ModuleBase_Tools::objectInfo(aFeature)).toStdString().c_str());
qDebug(QString("\tdocument->currentFeature(false) = %1").arg(
- ModuleBase_Tools::objectInfo(ModelAPI_Session::get()->activeDocument()->currentFeature(false))).toStdString().c_str());
+ ModuleBase_Tools::objectInfo(
+ ModelAPI_Session::get()->activeDocument()->currentFeature(false)))
+ .toStdString().c_str());
#endif
if (aFOperation->isEditOperation()) {// it should be performed by the feature edit only
// in create operation, the current feature is changed by addFeature()
aDoc->setCurrentFeature(aFOperation->feature(), false);
- // this is the only place where flushes must be called after setCurrentFeature for the current
- // moment: after this the opertion is not finished, so, the ObjectBrowser state may be corrupted
- // (issue #1457)
+ // this is the only place where flushes must be called after setCurrentFeature for the
+ // current moment: after this the opertion is not finished, so, the ObjectBrowser
+ // state may be corrupted (issue #1457)
static Events_Loop* aLoop = Events_Loop::loop();
static Events_ID aCreateEvent = aLoop->eventByName(EVENT_OBJECT_CREATED);
aLoop->flush(aCreateEvent);
#ifdef DEBUG_CURRENT_FEATURE
qDebug("\tdocument->setCurrentFeature");
qDebug(QString("\tdocument->currentFeature(false) = %1").arg(
- ModuleBase_Tools::objectInfo(ModelAPI_Session::get()->activeDocument()->currentFeature(false))).toStdString().c_str());
+ ModuleBase_Tools::objectInfo(
+ ModelAPI_Session::get()->activeDocument()->currentFeature(false)))
+ .toStdString().c_str());
#endif
}
}
return;
/// Restore the previous current feature
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(aCurrentOperation);
+ ModuleBase_OperationFeature* aFOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(aCurrentOperation);
if (aFOperation) {
#ifdef DEBUG_CURRENT_FEATURE
QString aKind = aFOperation->feature()->getKind().c_str();
.arg(ModuleBase_Tools::objectInfo(aFOperation->feature())).toStdString().c_str());
qDebug(QString("\tdocument->currentFeature(false) = %1").arg(
- ModuleBase_Tools::objectInfo(ModelAPI_Session::get()->activeDocument()->currentFeature(false))).toStdString().c_str());
+ ModuleBase_Tools::objectInfo(
+ ModelAPI_Session::get()->activeDocument()->currentFeature(false)))
+ .toStdString().c_str());
#endif
if (aFOperation->isEditOperation()) {
setCurrentFeature(aFOperation->previousCurrentFeature());
}
else { // create operation
- // the Top created feature should stays the current. In nested operations, like Line in the Sketch or
- // Sketch in ExtrusionCut, a previous feature should be restored on commit. It is performed here
+ // the Top created feature should stays the current. In nested operations,
+ // like Line in the Sketch or
+ // Sketch in ExtrusionCut, a previous feature should be restored on commit.
+ // It is performed here
// in order to perform it in the current transaction without opening a new one.
if (myOperations.front() != aFOperation)
setCurrentFeature(aFOperation->previousCurrentFeature());
#ifdef DEBUG_CURRENT_FEATURE
qDebug("\tdocument->setCurrentFeature");
qDebug(QString("\tdocument->currentFeature(false) = %1").arg(
- ModuleBase_Tools::objectInfo(ModelAPI_Session::get()->activeDocument()->currentFeature(false))).toStdString().c_str());
+ ModuleBase_Tools::objectInfo(
+ ModelAPI_Session::get()->activeDocument()->currentFeature(false)))
+ .toStdString().c_str());
#endif
ModuleBase_IModule* aModule = myWorkshop->module();
if (aModule)
bool isAborted = false;
if (!anActiveWgt) {
QWidget* aFocusWidget = aPanel->focusWidget();
- QToolButton* aCancelBtn = dynamic_cast<XGUI_PropertyPanel*>(aPanel)->findButton(PROP_PANEL_CANCEL);
+ QToolButton* aCancelBtn =
+ dynamic_cast<XGUI_PropertyPanel*>(aPanel)->findButton(PROP_PANEL_CANCEL);
if (aFocusWidget && aCancelBtn && aFocusWidget == aCancelBtn) {
abortOperation(aOperation);
isAccepted = true;
if (!isAborted) {
isAccepted = anActiveWgt && anActiveWgt->processEnter();
if (!isAccepted) {
- isAccepted = myWorkshop->module()->processEnter(anActiveWgt ? anActiveWgt->attributeID() : "");
+ isAccepted =
+ myWorkshop->module()->processEnter(anActiveWgt ? anActiveWgt->attributeID() : "");
if (!isAccepted) {
/// functionality is similar to Apply click
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(currentOperation());
- if (!aFOperation || myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty()) {
- // key released is emitted to apply the current value to the model if it was modified in PP
+ ModuleBase_OperationFeature* aFOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(currentOperation());
+ if (!aFOperation ||
+ myWorkshop->module()->getFeatureError(aFOperation->feature()).isEmpty()) {
+ // key released is emitted to apply the current value to the model
+ // if it was modified in PP
emit keyEnterReleased();
commitOperation();
isAccepted = true;
// sketch multi rotation -> single/full point)
// it is important to check the widget visibility to do not check of the next widget visible
// state if the current is not shown. (example: sketch circle re-entrant operation after mouse
- // release in the viewer, next, radius, widget should be activated but the first is not visualized)
+ // release in the viewer, next, radius,
+ // widget should be activated but the first is not visualized)
bool isVisible = theWidget->isVisible();
activateNextWidget(theWidget, isVisible);
}
if (aWidget)
aWidgetTypes.append(aWidget->objectName());
}
- QString anInfo = QString("theWidgets[%1]: %2").arg(theWidgets.count()).arg(aWidgetTypes.join(","));
+ QString anInfo = QString("theWidgets[%1]: %2")
+ .arg(theWidgets.count()).arg(aWidgetTypes.join(","));
qDebug(anInfo.toStdString().c_str());
}
#endif
#include "XGUI_QtEvents.h"
-QEvent::Type PostponeMessageQtEvent::PostponeMessageQtEventType = QEvent::Type(QEvent::registerEventType());
+QEvent::Type PostponeMessageQtEvent::PostponeMessageQtEventType =
+ QEvent::Type(QEvent::registerEventType());
std::shared_ptr<Events_Message> PostponeMessageQtEvent::postponedMessage()
//! \param isAddSeparator boolean flag about adding separator after the action
//! returns created action
virtual QAction* addFeature(const QString& theWBName, const QString& theId,
- const QString& theTitle, const QString& theTip, const QIcon& theIcon,
- const QKeySequence& theKeys, bool isCheckable, const bool isAddSeparator,
+ const QString& theTitle, const QString& theTip,
+ const QIcon& theIcon,
+ const QKeySequence& theKeys, bool isCheckable,
+ const bool isAddSeparator,
const QString& theStatusTip) = 0;
//! Creates a feature (command) in SALOME desktop
// for one feature
Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
if( !aBRO.IsNull() && aBRO->HasShape() ) {
- // the located method is called in the context to obtain the shape by the SelectedShape() method,
- // so the shape is located by the same rules
+ // the located method is called in the context to obtain the shape by the SelectedShape()
+ // method, so the shape is located by the same rules
TopoDS_Shape aShape = aBRO->Shape().Located (aBRO->Location() * aBRO->Shape().Location());
#ifndef DEBUG_DELIVERY
if (aShape.IsNull())
aShape = findAxisShape(anIO);
#endif
if (!aShape.IsNull()) {
- std::shared_ptr<GeomAPI_Shape> aGeomShape = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> aGeomShape =
+ std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
aGeomShape->setImpl(new TopoDS_Shape(aShape));
thePrs->setShape(aGeomShape);
}
aPrs->setInteractive(anIO);
ObjectPtr aResult = aDisplayer->getObject(anIO);
- // we should not check the appearance of this feature because there can be some selected shapes
- // for one feature
+ // we should not check the appearance of this feature because there can be some selected
+ // shapes for one feature
aPrs->setObject(aResult);
if (aContext->HasOpenedContext()) {
TopoDS_Shape aShape = aContext->DetectedShape();
if (!aShape.IsNull()) {
- std::shared_ptr<GeomAPI_Shape> aGeomShape = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> aGeomShape =
+ std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
aGeomShape->setImpl(new TopoDS_Shape(aShape));
aPrs->setShape(aGeomShape);
}
/// Returns a list of viewer selected presentations
/// \return list of presentations
- virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getSelected(const SelectionPlace& thePlace = Browser) const;
+ virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>>
+ getSelected(const SelectionPlace& thePlace = Browser) const;
/// Fills the viewer presentation parameters by the parameters from the owner
/// \param thePrs a container for selection
aContext->AddOrRemoveSelected(anOwner, isUpdateViewer);
}
}
- ModuleBase_Tools::selectionInfo(aContext, "XGUI_SelectionMgr::setSelectedOwners -- AddOrRemoveSelected");
+ ModuleBase_Tools::selectionInfo(aContext,
+ "XGUI_SelectionMgr::setSelectedOwners -- AddOrRemoveSelected");
}
//**************************************************************
FeaturePtr aFeature;
Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
if (!aContext.IsNull()) {
- QList<ModuleBase_ViewerPrsPtr> aPresentations = selection()->getSelected(ModuleBase_ISelection::Viewer);
+ QList<ModuleBase_ViewerPrsPtr> aPresentations =
+ selection()->getSelected(ModuleBase_ISelection::Viewer);
foreach(ModuleBase_ViewerPrsPtr aPrs, aPresentations) {
if (aPrs->object().get()) {
if (!aFeatures.contains(aPrs->object()))
QString file(const QString& path, bool withExt)
{
QString fPath = path;
- while (!fPath.isEmpty() && (fPath[fPath.length() - 1] == '\\' || fPath[fPath.length() - 1] == '/'))
+ while (!fPath.isEmpty() && (fPath[fPath.length() - 1] == '\\' ||
+ fPath[fPath.length() - 1] == '/'))
fPath.remove(fPath.length() - 1, 1);
if (withExt)
if (ModelAPI_Tools::findVariable(theObject->document(),
FeaturePtr(), qPrintable(theName), aValue, aParam)) {
QString aErrMsg(QObject::tr("Selected parameter can not be renamed to: %1. \
- There is a parameter with the same name. Its value is: %2.").arg(qPrintable(theName)).arg(aValue));
- // We can not use here a dialog box for message - it will crash editing process in ObjectBrowser
+ There is a parameter with the same name. Its value is: %2.")
+ .arg(qPrintable(theName)).arg(aValue));
+ // We can not use here a dialog box for message -
+ // it will crash editing process in ObjectBrowser
Events_InfoMessage("XGUI_Tools", aErrMsg.toStdString()).send();
return false;
}
Config_Prop::Color, ModelAPI_ResultBody::DEFAULT_COLOR());
Config_PropManager::registerProp("Visualization", "result_group_color", "Group color",
Config_Prop::Color, ModelAPI_ResultGroup::DEFAULT_COLOR());
- Config_PropManager::registerProp("Visualization", "result_construction_color", "Construction color",
- Config_Prop::Color, ModelAPI_ResultConstruction::DEFAULT_COLOR());
+ Config_PropManager::registerProp("Visualization", "result_construction_color",
+ "Construction color",
+ Config_Prop::Color,
+ ModelAPI_ResultConstruction::DEFAULT_COLOR());
Config_PropManager::registerProp("Visualization", "result_part_color", "Part color",
Config_Prop::Color, ModelAPI_ResultPart::DEFAULT_COLOR());
- Config_PropManager::registerProp("Visualization", "body_deflection", "Body deflection coefficient",
- Config_Prop::Double, ModelAPI_ResultBody::DEFAULT_DEFLECTION());//"0.001");
+ Config_PropManager::registerProp("Visualization", "body_deflection",
+ "Body deflection coefficient",
+ Config_Prop::Double,
+ ModelAPI_ResultBody::DEFAULT_DEFLECTION());//"0.001");
- Config_PropManager::registerProp("Visualization", "construction_deflection", "Construction deflection coefficient",
- Config_Prop::Double, ModelAPI_ResultConstruction::DEFAULT_DEFLECTION());//"0.0001");
+ Config_PropManager::registerProp("Visualization", "construction_deflection",
+ "Construction deflection coefficient",
+ Config_Prop::Double,
+ ModelAPI_ResultConstruction::DEFAULT_DEFLECTION());//"0.0001");
if (ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "face-selection", true))
myViewerSelMode.append(TopAbs_FACE);
QAction* aAction = salomeConnector()->addDesktopCommand("UNDO_CMD", tr("Undo"),
tr("Undo last command"),
QIcon(":pictures/undo.png"),
- QKeySequence::Undo, false, "MEN_DESK_EDIT");
+ QKeySequence::Undo, false,
+ "MEN_DESK_EDIT");
QString aToolBarTitle = tr( "INF_DESK_TOOLBAR_STANDARD" );
salomeConnector()->addActionInToolbar( aAction,aToolBarTitle );
addHistoryMenu(aAction, SIGNAL(updateRedoHistory(const QList<ActionInfo>&)), SLOT(onRedo(int)));
salomeConnector()->addDesktopMenuSeparator("MEN_DESK_EDIT");
- //aAction = salomeConnector()->addDesktopCommand("REBUILD_CMD", tr("Rebuild"), tr("Rebuild data objects"),
+ //aAction = salomeConnector()->addDesktopCommand("REBUILD_CMD", tr("Rebuild"),
+ // tr("Rebuild data objects"),
// QIcon(":pictures/rebuild.png"), QKeySequence(),
// false, "MEN_DESK_EDIT");
//salomeConnector()->addActionInToolbar( aAction, aToolBarTitle );
//connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onRebuild()));
//salomeConnector()->addDesktopMenuSeparator("MEN_DESK_EDIT");
- aAction = salomeConnector()->addDesktopCommand("SAVEAS_CMD", tr("Export native..."), tr("Export the current document into a native file"),
+ aAction = salomeConnector()->addDesktopCommand("SAVEAS_CMD", tr("Export native..."),
+ tr("Export the current document into a native file"),
QIcon(), QKeySequence(),
false, "MEN_DESK_FILE");
connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onSaveAs()));
- aAction = salomeConnector()->addDesktopCommand("OPEN_CMD", tr("Import native..."), tr("Import native file"),
+ aAction = salomeConnector()->addDesktopCommand("OPEN_CMD", tr("Import native..."),
+ tr("Import native file"),
QIcon(), QKeySequence(),
false, "MEN_DESK_FILE");
connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onOpen()));
void XGUI_Workshop::fillPropertyPanel(ModuleBase_Operation* theOperation)
{
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+ ModuleBase_OperationFeature* aFOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if (!aFOperation)
return;
if (!aWidget->attributeID().empty() && !aFeature->attribute(aWidget->attributeID()).get()) {
std::string anErrorMsg = "The feature '%1' has no attribute '%2' used by widget '%3'.";
Events_InfoMessage("XGUI_Workshop", anErrorMsg)
- .arg(aFeatureKind).arg(aWidget->attributeID()).arg(aWidget->metaObject()->className()).send();
+ .arg(aFeatureKind).arg(aWidget->attributeID())
+ .arg(aWidget->metaObject()->className()).send();
myPropertyPanel->cleanContent();
return;
}
// update visible state of Preview button
#ifdef HAVE_SALOME
- bool anIsAutoPreview = mySalomeConnector->featureInfo(aFeatureKind.c_str())->isAutoPreview();
+ bool anIsAutoPreview =
+ mySalomeConnector->featureInfo(aFeatureKind.c_str())->isAutoPreview();
#else
AppElements_MainMenu* aMenuBar = mainWindow()->menuObject();
AppElements_Command* aCommand = aMenuBar->feature(aFeatureKind.c_str());
myPropertyPanel->setWindowTitle(theOperation->getDescription()->description());
#else
std::string aFeatureName = aFeature->name();
- myPropertyPanel->setWindowTitle(QString("%1: %2").arg(theOperation->getDescription()->description())
- .arg(aFeatureName.c_str()));
+ myPropertyPanel->setWindowTitle(QString("%1: %2")
+ .arg(theOperation->getDescription()->description())
+ .arg(aFeatureName.c_str()));
#endif
myErrorMgr->setPropertyPanel(myPropertyPanel);
void XGUI_Workshop::setGrantedFeatures(ModuleBase_Operation* theOperation)
{
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+ ModuleBase_OperationFeature* aFOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if (!aFOperation)
return;
if (aDir.exists() && !aDir.entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries).isEmpty()) {
int answer = QMessageBox::question(
desktop(),
- //: Title of the dialog which asks user if he wants to save study in existing non-empty folder
+ // Title of the dialog which asks user if he wants to save study
+ // in existing non-empty folder
tr("Save"),
tr("The directory already contains some files, save anyway?"),
QMessageBox::Save | QMessageBox::Cancel);
{
// the viewer update should be blocked in order to avoid the features blinking. For the created
// feature a results are created, the flush of the created signal caused the viewer redisplay for
- // each created result. After a redisplay signal is flushed. So, the viewer update is blocked until
- // redo of all possible objects happens
+ // each created result. After a redisplay signal is flushed. So, the viewer update is blocked
+ // until redo of all possible objects happens
bool isUpdateEnabled = myDisplayer->enableUpdateViewer(false);
objectBrowser()->treeView()->setCurrentIndex(QModelIndex());
QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent)
{
QDockWidget* aObjDock = new QDockWidget(theParent);
- aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
+ aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea |
+ Qt::RightDockWidgetArea |
+ Qt::BottomDockWidgetArea);
aObjDock->setWindowTitle(tr("Object browser"));
aObjDock->setStyleSheet(
"::title { position: relative; padding-left: 5px; text-align: left center }");
aDesktop->addDockWidget(Qt::LeftDockWidgetArea, aObjDock);
myPropertyPanel = new XGUI_PropertyPanel(aDesktop, myOperationMgr);
myPropertyPanel->setupActions(myActionsMgr);
- myPropertyPanel->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
+ myPropertyPanel->setAllowedAreas(Qt::LeftDockWidgetArea |
+ Qt::RightDockWidgetArea |
+ Qt::BottomDockWidgetArea);
aDesktop->addDockWidget(Qt::LeftDockWidgetArea, myPropertyPanel);
hidePropertyPanel(); ///<! Invisible by default
hideObjectBrowser();
anInfo.append(aFeature->name().c_str());
}
QString anInfoStr = anInfo.join(";\t");
- qDebug(QString("cleanHistory for: [%1] - %2").arg(aFeatures.size()).arg(anInfoStr).toStdString().c_str());
+ qDebug(QString("cleanHistory for: [%1] - %2").
+ arg(aFeatures.size()).arg(anInfoStr).toStdString().c_str());
#endif
std::map<FeaturePtr, std::set<FeaturePtr> > aReferences;
ModelAPI_Tools::findAllReferences(aFeatures, aReferences, true, false);
- // find for each object whether all reference values are in the map as key, that means that there is
- // no other reference in the model to this object, so it might be removed by cleaning history
+ // find for each object whether all reference values are in the map as key, that means that there
+ // is no other reference in the model to this object, so it might be removed by cleaning history
// sk_1(ext_1, vertex_1) + (sk_3, bool_1) - cann't be deleted, dependency to bool_1
// ext_1(bool_1, sk_3) - cann't be deleted, dependency to bool_1
// vertex_1()
for (; aMainIt != aMainLast; aMainIt++) {
FeaturePtr aMainListFeature = aMainIt->first;
std::set<FeaturePtr> aMainRefList = aMainIt->second;
- std::set<FeaturePtr>::const_iterator aRefIt = aMainRefList.begin(), aRefLast = aMainRefList.end();
+ std::set<FeaturePtr>::const_iterator aRefIt = aMainRefList.begin(),
+ aRefLast = aMainRefList.end();
bool aFeatureOutOfTheList = false;
for (; aRefIt != aRefLast && !aFeatureOutOfTheList; aRefIt++) {
FeaturePtr aRefFeature = *aRefIt;
FeaturePtr aFeature = *aFIt;
anInfo.append(aFeature->name().c_str());
}
- qDebug(QString("unused objects: [%1] - %2").arg(anInfo.size()).arg(anInfo.join(";\t")).toStdString().c_str());
+ qDebug(QString("unused objects: [%1] - %2").
+ arg(anInfo.size()).arg(anInfo.join(";\t")).toStdString().c_str());
#endif
// warn about the references remove, break the delete operation if the user chose it
aMessageBox.setStandardButtons(QMessageBox::No | QMessageBox::Yes);
aMessageBox.setDefaultButton(QMessageBox::No);
- QString aText = QString(tr("Unused features are the following: %1.\nThese features will be deleted.\nWould you like to continue?")
- .arg(anUnusedNames));
+ QString aText = QString(tr("Unused features are the following: \
+%1.\nThese features will be deleted.\nWould you like to continue?").arg(anUnusedNames));
aMessageBox.setText(aText);
if (aMessageBox.exec() == QMessageBox::No)
return;
// 1. start operation
- aDescription += "by deleting of " + aDescription.arg(XGUI_Tools::unionOfObjectNames(anObjects, ", "));
+ aDescription += "by deleting of " +
+ aDescription.arg(XGUI_Tools::unionOfObjectNames(anObjects, ", "));
ModuleBase_OperationAction* anOpAction = new ModuleBase_OperationAction(aDescription, module());
operationMgr()->startOperation(anOpAction);
DocumentPtr aDocument = theObject->document();
std::list<FeaturePtr> anAllFeatures = allFeatures(aDocument);
// find the object iterator
- std::list<FeaturePtr>::iterator aObjectIt = std::find(anAllFeatures.begin(), anAllFeatures.end(), theObject);
+ std::list<FeaturePtr>::iterator aObjectIt =
+ std::find(anAllFeatures.begin(), anAllFeatures.end(), theObject);
if (aObjectIt == anAllFeatures.end())
return aResult;
// find the current feature iterator
- std::list<FeaturePtr>::iterator aCurrentIt = std::find(anAllFeatures.begin(), anAllFeatures.end(), aDocument->currentFeature(true));
+ std::list<FeaturePtr>::iterator aCurrentIt =
+ std::find(anAllFeatures.begin(), anAllFeatures.end(), aDocument->currentFeature(true));
if (aCurrentIt == anAllFeatures.end())
return aResult;
// check the right order
- if (std::distance(aObjectIt, anAllFeatures.end()) <= std::distance(aCurrentIt, anAllFeatures.end()))
+ if (std::distance(aObjectIt, anAllFeatures.end()) <=
+ std::distance(aCurrentIt, anAllFeatures.end()))
return aResult;
// exclude the object
std::advance(aObjectIt, 1);
foreach(ObjectPtr anObj, theObjects) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
if (aResult.get() != NULL) {
- ResultCompSolidPtr aCompsolidResult = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aResult);
+ ResultCompSolidPtr aCompsolidResult =
+ std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aResult);
if (aCompsolidResult.get() != NULL) { // change colors for all sub-solids
for(int i = 0; i < aCompsolidResult->numberOfSubs(); i++) {
- setColor(aCompsolidResult->subResult(i), !isRandomColor ? aColorResult : aDlg->getRandomColor());
+ setColor(aCompsolidResult->subResult(i), !isRandomColor ? aColorResult :
+ aDlg->getRandomColor());
}
}
setColor(aResult, !isRandomColor ? aColorResult : aDlg->getRandomColor());
foreach(ObjectPtr anObj, theObjects) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
if (aResult.get() != NULL) {
- ResultCompSolidPtr aCompsolidResult = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aResult);
+ ResultCompSolidPtr aCompsolidResult =
+ std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aResult);
if (aCompsolidResult.get() != NULL) { // change colors for all sub-solids
for(int i = 0; i < aCompsolidResult->numberOfSubs(); i++) {
setDeflection(aCompsolidResult->subResult(i), aDeflection);
/// Has to be called in order to display objects with visibility status = true
void synchronizeViewer();
- /// Has to be called in order to display objects from a cpecifed group with visibility status = true
+ /// Has to be called in order to display objects from a specifed group
+ /// with visibility status = true
/// \param theDoc the document for objects synchronisation
/// \param theGroup the group name
/// \param theUpdateViewer update viewer flag
- void synchronizeGroupInViewer(const DocumentPtr& theDoc, const std::string& theGroup, bool theUpdateViewer);
+ void synchronizeGroupInViewer(const DocumentPtr& theDoc,
+ const std::string& theGroup,
+ bool theUpdateViewer);
/// Update the property panel content by the XML description of the operation and set the panel
/// into the operation
} else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_UPDATE_BY_WIDGET_SELECTION)) {
ModuleBase_ModelWidget* aWidget = workshop()->propertyPanel()->activeWidget();
if (aWidget) {
- ModuleBase_WidgetSelector* aWidgetSelector = dynamic_cast<ModuleBase_WidgetSelector*>(aWidget);
+ ModuleBase_WidgetSelector* aWidgetSelector =
+ dynamic_cast<ModuleBase_WidgetSelector*>(aWidget);
if (aWidgetSelector)
myWorkshop->setSelected(aWidgetSelector->getAttributeSelection());
}
aDisplayer->enableUpdateViewer(true);
} else {
//Show error dialog if error message received.
- std::shared_ptr<Events_InfoMessage> anIngfoMsg = std::dynamic_pointer_cast<Events_InfoMessage>(theMessage);
+ std::shared_ptr<Events_InfoMessage> anIngfoMsg =
+ std::dynamic_pointer_cast<Events_InfoMessage>(theMessage);
if (anIngfoMsg) {
emit errorOccurred(anIngfoMsg);
}
anInfo.append(ModuleBase_Tools::objectInfo((*aIt)));
}
QString anInfoStr = anInfo.join(";\t");
- qDebug(QString("onFeatureUpdatedMsg: %1, %2").arg(anObjects.size()).arg(anInfoStr).toStdString().c_str());
+ qDebug(QString("onFeatureUpdatedMsg: %1, %2")
+ .arg(anObjects.size()).arg(anInfoStr).toStdString().c_str());
#endif
std::set<ObjectPtr> aFeatures = theMsg->objects();
XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr();
}
//******************************************************
-void XGUI_WorkshopListener::onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
+void XGUI_WorkshopListener::
+ onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
{
std::set<ObjectPtr> anObjects = theMsg->objects();
std::set<ObjectPtr>::const_iterator aIt;
anInfo.append(ModuleBase_Tools::objectInfo((*aIt)));
}
QString anInfoStr = anInfo.join(";\t");
- qDebug(QString("onFeatureRedisplayMsg: %1, %2").arg(anObjects.size()).arg(anInfoStr).toStdString().c_str());
+ qDebug(QString("onFeatureRedisplayMsg: %1, %2")
+ .arg(anObjects.size()).arg(anInfoStr).toStdString().c_str());
#endif
XGUI_Workshop* aWorkshop = workshop();
if (aRes.get()) {
ResultCompSolidPtr aCompSolidRes = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aRes);
if (aCompSolidRes.get()) {
- qDebug(QString("COMPSOLID, numberOfSubs = %1").arg(aCompSolidRes->numberOfSubs()).toStdString().c_str());
+ qDebug(QString("COMPSOLID, numberOfSubs = %1")
+ .arg(aCompSolidRes->numberOfSubs()).toStdString().c_str());
}
if (ModelAPI_Tools::compSolidOwner(aRes))
qDebug("COMPSOLID sub-object");
}
#endif
if (aHide) {
- //we should provide objects which are hidden in the viewer, e.g. sketch always should visualizes
- // all sub-features, if some features are to be hidden, sould be proposed may be to removed #1223
- //aHiddenObjects.push_back(aObj);
+ //we should provide objects which are hidden in the viewer, e.g. sketch always should
+ // visualizes all sub-features, if some features are to be hidden, sould be proposed may
+ // be to removed #1223
+ // aHiddenObjects.push_back(aObj);
aRedisplayed = aDisplayer->erase(aObj, false) || aRedisplayed;
#ifdef DEBUG_FEATURE_REDISPLAY
// Redisplay the visible object or the object of the current operation
bool isVisibleObject = aDisplayer->isVisible(aObj);
QString anObjInfo = ModuleBase_Tools::objectInfo((aObj));
- //qDebug(QString("visible=%1 : erase = %2").arg(isVisibleObject).arg(anObjInfo).toStdString().c_str());
#endif
}
else {
bool isVisibleObject = aDisplayer->isVisible(aObj);
#ifdef DEBUG_FEATURE_REDISPLAY
QString anObjInfo = ModuleBase_Tools::objectInfo((aObj));
- //qDebug(QString("visible=%1 : display= %2").arg(isVisibleObject).arg(anObjInfo).toStdString().c_str());
#endif
if (isVisibleObject) { // redisplay visible object
}
//******************************************************
-void XGUI_WorkshopListener::onFeatureCreatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
+void XGUI_WorkshopListener::
+ onFeatureCreatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
{
std::set<ObjectPtr> anObjects = theMsg->objects();
std::set<ObjectPtr>::const_iterator aIt;
anInfo.append(ModuleBase_Tools::objectInfo((*aIt)));
}
QString anInfoStr = anInfo.join(";\t");
- qDebug(QString("onFeatureCreatedMsg: %1, %2").arg(anObjects.size()).arg(anInfoStr).toStdString().c_str());
+ qDebug(QString("onFeatureCreatedMsg: %1, %2")
+ .arg(anObjects.size()).arg(anInfoStr).toStdString().c_str());
#endif
bool aFirstVisualizedBody = false;
if (aRes.get()) {
ResultCompSolidPtr aCompSolidRes = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aRes);
if (aCompSolidRes.get()) {
- qDebug(QString("COMPSOLID, numberOfSubs = %1").arg(aCompSolidRes->numberOfSubs()).toStdString().c_str());
+ qDebug(QString("COMPSOLID, numberOfSubs = %1")
+ .arg(aCompSolidRes->numberOfSubs()).toStdString().c_str());
}
if (ModelAPI_Tools::compSolidOwner(aRes))
qDebug("COMPSOLID sub-object");
anInfo.append(ModuleBase_Tools::objectInfo((*aIt)));
}
QString anInfoStr = anInfo.join(";\t");
- qDebug(QString("onFeatureEmptyPresentationMsg: %1, %2").arg(anObjects.size()).arg(anInfoStr).toStdString().c_str());
+ qDebug(QString("onFeatureEmptyPresentationMsg: %1, %2")
+ .arg(anObjects.size()).arg(anInfoStr).toStdString().c_str());
#endif
XGUI_Workshop* aWorkshop = workshop();
/// Displaus object and fit all viewer if the object is first (update viewer will not be called)
/// Asks the module whether the object can be displayed
/// \param theObj an object
- /// \param theFirstVisualizedBody an output state whether there are not object displayed in the view
- /// and the displayed object is a body
+ /// \param theFirstVisualizedBody an output state whether there are not object displayed in the
+ /// view and the displayed object is a body
/// \return true if the object is displayed
bool displayObject(ObjectPtr theObj, bool& theFirstVisualizedBody);
/// Calls the module method of cusomize object for the feature of the current operation
/// Perform cusomize if the force redisplay flag is true or the list of objects contains the
/// current operation feature
- /// \param theObjects a list of objects to find current operation feature if forced redisplay is false
+ /// \param theObjects a list of objects to find current operation feature
+ /// if forced redisplay is false
/// \param theForceRedisplay a flag to customize object even always
/// \return true if the object is modified
bool customizeCurrentObject(const std::set<ObjectPtr>& theObjects, bool theForceRedisplay);