-// TEMPORARY COMMIT
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
/*
* ModuleBase_ActionInfo.cpp
*
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
/*
* ActionInfo.h
*
bool checked; //!< action's checked state
bool enabled; //!< action's enabled state
bool visible; //!< action's visibility state
- bool modal; //!< = true if the acton is a modal dialog box else property panel (==false by default)
+
+ //! = true if the acton is a modal dialog box else property panel (==false by default)
+ bool modal;
QIcon icon; //!< action's icon
QString text; //!< action's text
QString iconText; //!< action's descriptive icon text
ModuleBase_Filter* theFilter)
{
if (myIDs.find(theID) != myIDs.end()) {
- Events_InfoMessage("ModuleBase_FilterFactory", "Filter %1 is already registered").arg(theID).send();
+ Events_InfoMessage("ModuleBase_FilterFactory",
+ "Filter %1 is already registered").arg(theID).send();
} else {
myIDs[theID] = theFilter;
}
SelectMgr_Filter(), myWorkshop(theWorkshop) {}
/**
- * Returns true if the owner is computed from decomposition(it is global selection, not the sub-shapes)
- * of if the selected result is a construction and the result feature is composite and has sub-elements.
+ * Returns true if the owner is computed from decomposition
+ * (it is global selection, not the sub-shapes)
+ * of if the selected result is a construction and the result
+ * feature is composite and has sub-elements.
* \param theOwner the result of selection
* \return whether the owner is selectable in the viewer
*/
- Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
+ Standard_EXPORT virtual
+ Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
DEFINE_STANDARD_RTTI(ModuleBase_FilterValidated)
/// Creates custom widgets for property panel
/// \param theType a type of widget
/// \param theParent the parent object
- /// \param theWidgetApi the widget configuration. The attribute of the model widget is obtained from
- virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType, QWidget* theParent,
+ /// \param theWidgetApi the widget configuration.
+ /// The attribute of the model widget is obtained from
+ virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
+ QWidget* theParent,
Config_WidgetAPI* theWidgetApi)
{
return 0;
/// It is called as on clearing of property panel as on filling with new widgets
virtual void propertyPanelDefined(ModuleBase_Operation* theOperation) {}
- /// Have an opportunity to create widgets for the current operation instead of standard creation in workshop
+ /// Have an opportunity to create widgets for the current operation
+ /// instead of standard creation in workshop
/// \param theOperation a started operation
/// \param theWidgets a list of created widgets
/// \return boolean result, false by default
/// Return true if the custom presentation is activated
/// \param theFlag a flag of level of customization, which means that only part of sub-elements
/// \return boolean value
- virtual bool isCustomPrsActivated(const ModuleBase_CustomizeFlag& theFlag) const { return false; };
+ virtual bool isCustomPrsActivated(const ModuleBase_CustomizeFlag& theFlag) const
+ { return false; };
/// Activate custom presentation for the object. Default realization is empty.
/// \param theFeature a feature instance
const bool theUpdateViewer) {}
/// Modifies the given presentation in the custom way.
- virtual bool customisePresentation(std::shared_ptr<ModelAPI_Result> theResult, AISObjectPtr thePrs,
+ virtual bool customisePresentation(std::shared_ptr<ModelAPI_Result> theResult,
+ AISObjectPtr thePrs,
GeomCustomPrsPtr theCustomPrs) { return false; };
/// Update the object presentable properties such as color, lines width and other
#include <ModelAPI_Validator.h>
#include <ModelAPI_Session.h>
-ModuleBase_IPropertyPanel::ModuleBase_IPropertyPanel(QWidget* theParent) : QDockWidget(theParent), myIsEditing(false)
+ModuleBase_IPropertyPanel::ModuleBase_IPropertyPanel(QWidget* theParent)
+ : QDockWidget(theParent), myIsEditing(false)
{
}
}
ModuleBase_ModelWidget* ModuleBase_IPropertyPanel::findFirstAcceptingValueWidget(
- const QList<ModuleBase_ModelWidget*>& theWidgets)
+ const QList<ModuleBase_ModelWidget*>& theWidgets)
{
ModuleBase_ModelWidget* aFirstWidget = 0;
/// Returns a list of viewer selected presentations
/// \return list of presentations
- virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getSelected(const SelectionPlace& thePlace = Browser) const = 0;
+ virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>>
+ getSelected(const SelectionPlace& thePlace = Browser) const = 0;
- /// The values are appended to the first parameter list if the first list does not contain an item
- /// with the same object
+ /// The values are appended to the first parameter list if the first list does not contain
+ /// an item with the same object
/// \param theValues a list of new values
/// \param theValuesTo a list, that will be changed
static void appendSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>> theValues,
//! Return the IO from the viewer presentation.
//! \param thePrs a selected object
//! \return an interactive object
- virtual MODULEBASE_EXPORT Handle(AIS_InteractiveObject) getIO(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs) = 0;
+ virtual MODULEBASE_EXPORT
+ Handle(AIS_InteractiveObject) getIO(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs) = 0;
//! Wraps the object list into the viewer prs list
//! \param theObjects a list of objects
/// Removes selection items where owners have equal vertices. The first
/// owner with the qual vertex stays in the list.
static MODULEBASE_EXPORT void filterSelectionOnEqualPoints
- (QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theSelected);
+ (QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theSelected);
private:
/// Find vertex shape build by a Brep owner of the presentation if it exists
/// \param thePrs a viewer presentation
/// Remember a scale factor for the view object
/// \param theView a view object
/// \param theVal a scale factor
- void SetScale(const Handle(V3d_View)& theView, const double theVal) { myWindowScale[theView] = theVal; }
+ void SetScale(const Handle(V3d_View)& theView, const double theVal)
+ { myWindowScale[theView] = theVal; }
/// Method returns True if the viewer can process editing objects
/// by mouse drugging. If this is impossible thet it has to return False.
#ifdef DEBUG_ENABLE_SKETCH_INPUT_FIELDS
bool aCanDisable = false;
#else
- bool aCanDisable = true;//Config_PropManager::boolean(SKETCH_TAB_NAME, "disable_input_fields", "true");
+ //Config_PropManager::boolean(SKETCH_TAB_NAME, "disable_input_fields", "true");
+ bool aCanDisable = true;
#endif
if (aCanDisable)
anEnabled = false;
/**\class ModuleBase_ModelWidget
* \ingroup GUI
- * \brief An abstract custom widget class. This class realization is assumed to create some controls.
+ * \brief An abstract custom widget class. This class realization is assumed
+ * to create some controls.
* The controls values modification should send signal about values change.
*
* Common interface for widgets in the property panel.
enum EnableState { On, /// the widget value is always enabled
Off, /// the widget value is always disabled
- DefinedInPreferences }; /// the widget value enable state is defined in preferences
+ /// the widget value enable state is defined in preferences
+ DefinedInPreferences };
/// Constructor
/// \param theParent the parent object
/// \return the boolean result
bool isInternal() const { return myIsInternal; }
- /// Returns true, if the obligatory value of the widget is not defined in the XML or has true value
+ /// Returns true, if the obligatory value of the widget is
+ /// not defined in the XML or has true value
/// \return the boolean result
bool isObligatory() const { return myIsObligatory; }
- /// Returns true, if the widget value is enabled and might be modified manualy. It returns false if
- /// the application preferences allow having disabled value and the internal state tells to disable
+ /// Returns true, if the widget value is enabled and might be modified manualy.
+ /// It returns false if the application preferences allow having disabled value
+ /// and the internal state tells to disable
/// \return the boolean result
virtual bool isValueEnabled() const;
/// Checks if the selection presentation is valid in widget
/// \param theValue a selected presentation in the view
/// \return a boolean value
- virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue) { return true; }
+ virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue)
+ { return true; }
/// Returns widget validator, by default it is NULL. To be created in a child if necessary
ModuleBase_WidgetValidator* widgetValidator() { return myWidgetValidator; }
- /// Restore value from attribute data to the widget's control. Emits signals before and after store
+ /// Restore value from attribute data to the widget's control.
+ /// Emits signals before and after store
/// \return True in success
bool restoreValue();
/// \return True in success
bool storeValue();
- /// 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();
bool ModuleBase_OperationAction::commit()
{
- // the action is supposed to perform a single modification, so the operation returns modified state
+ // the action is supposed to perform a single modification,
+ // so the operation returns modified state
setIsModified(true);
return ModuleBase_Operation::commit();
}
#ifdef DEBUG_DO_NOT_ACTIVATE_SUB_FEATURE
if (aFeature->isMacro()) {
- // macro feature may refers to sub-features, which also should be deactivated when the operation
+ // macro feature may refers to sub-features,
+ // which also should be deactivated when the operation
// is active, e.g. rectangle'lines.
FeaturePtr anObjectFeature = ModelAPI_Feature::feature(theObj);
std::list<AttributePtr> anAttributes = aFeature->data()->attributes(
ModelAPI_AttributeRefList::typeId());
- std::list<AttributePtr>::const_iterator anIt = anAttributes.begin(), aLast = anAttributes.end();
+ std::list<AttributePtr>::const_iterator
+ anIt = anAttributes.begin(), aLast = anAttributes.end();
bool aFoundObject = false;
for (; anIt != aLast && !aFoundObject; anIt++) {
std::shared_ptr<ModelAPI_AttributeRefList> aCurSelList =
- std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(*anIt);
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(*anIt);
for (int i = 0, aNb = aCurSelList->size(); i < aNb && !aFoundObject; i++) {
ObjectPtr anObject = aCurSelList->object(i);
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anObject);
return myPreviousCurrentFeature;
}
-void ModuleBase_OperationFeature::initSelection(const QList<ModuleBase_ViewerPrsPtr>& thePreSelected)
+void ModuleBase_OperationFeature::initSelection(
+ const QList<ModuleBase_ViewerPrsPtr>& thePreSelected)
{
QObjectPtrList aCurrentFeatureResults;
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
/*
* ModuleBase_PageBase.cpp
*
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
/*
* ModuleBase_PageBase.h
*
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
/*
* ModuleBase_PageGroupBox.cpp
*
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
/*
* ModuleBase_PageGroupBox.h
*
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
/*
* ModuleBase_PageWidget.cpp
*
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
/*
* ModuleBase_PageWidget.h
*
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
/*
* ModuleBase_PagedContainer.cpp
*
#include <QVBoxLayout>
-ModuleBase_PagedContainer::ModuleBase_PagedContainer(QWidget* theParent, const Config_WidgetAPI* theData)
+ModuleBase_PagedContainer::ModuleBase_PagedContainer(QWidget* theParent,
+ const Config_WidgetAPI* theData)
: ModuleBase_ModelWidget(theParent, theData),
myIsFocusOnCurrentPage(false)
{
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
/*
* ModuleBase_PagedContainer.h
*
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
#include "ModuleBase_ParamIntSpinBox.h"
#include <ModelAPI_Session.h>
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
#ifndef ModuleBase_ParamIntSpinBox_H
#define ModuleBase_ParamIntSpinBox_H
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
#include "ModuleBase_ParamSpinBox.h"
#include <ModelAPI_Session.h>
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
#ifndef ModuleBase_ParamSpinBox_H
#define ModuleBase_ParamSpinBox_H
//**********************************************************
//**********************************************************
//**********************************************************
-ModuleBase_PreferencesDlg::ModuleBase_PreferencesDlg(SUIT_ResourceMgr* theResurces, QWidget* theParent)
+ModuleBase_PreferencesDlg::ModuleBase_PreferencesDlg(SUIT_ResourceMgr* theResurces,
+ QWidget* theParent)
: QDialog(theParent),
myIsChanged(false)
{
myPreferences->setItemProperty("columns", 1, aSizeGroup);
int aRowsNb = myPreferences->addItem(tr("Number of rows"), aSizeGroup,
- SUIT_PreferenceMgr::IntSpin, ModuleBase_Preferences::MENU_SECTION,
+ SUIT_PreferenceMgr::IntSpin,
+ ModuleBase_Preferences::MENU_SECTION,
"rows_number");
myPreferences->setItemProperty("min", 1, aRowsNb);
myPreferences->setItemProperty("max", 6, aRowsNb);
myAdditionalSelectionPriority = thePriority;
}
-void ModuleBase_ResultPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
- const Handle(Prs3d_Presentation)& thePresentation,
- const Standard_Integer theMode)
+void ModuleBase_ResultPrs::Compute(
+ const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+ const Handle(Prs3d_Presentation)& thePresentation,
+ const Standard_Integer theMode)
{
std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(myResult);
bool aReadyToDisplay = aShapePtr.get();
AIS_Shape::Compute(thePresentationManager, thePresentation, theMode);
if (!aReadyToDisplay) {
- Events_InfoMessage("ModuleBase_ResultPrs", "An empty AIS presentation: ModuleBase_ResultPrs").send();
+ Events_InfoMessage("ModuleBase_ResultPrs",
+ "An empty AIS presentation: ModuleBase_ResultPrs").send();
static const Events_ID anEvent = Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION);
ModelAPI_EventCreator::get()->sendUpdated(myResult, anEvent);
}
TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
int aPriority = StdSelect_BRepSelectionTool::GetStandardPriority(aShape, TopAbs_COMPSOLID);
/// It is important to have priority for the shape of comp solid result less than priority
- /// for the presentation shape which is a sub-result. Reason is to select the sub-objects before: #1592
+ /// for the presentation shape which is a sub-result.
+ /// Reason is to select the sub-objects before: #1592
aPriority = aPriority - 1;
double aDeflection = Prs3d::GetDeflection(aShape, myDrawer);
for (aSelection->Init(); aSelection->More(); aSelection->Next()) {
Handle(SelectMgr_EntityOwner) anOwner =
- Handle(SelectMgr_EntityOwner)::DownCast(aSelection->Sensitive()->BaseSensitive()->OwnerId());
+ Handle(SelectMgr_EntityOwner)
+ ::DownCast(aSelection->Sensitive()->BaseSensitive()->OwnerId());
anOwner->Set(this);
}
return;
if (myAdditionalSelectionPriority > 0) {
for (aSelection->Init(); aSelection->More(); aSelection->Next()) {
- Handle(SelectBasics_EntityOwner) aBasicsOwner = aSelection->Sensitive()->BaseSensitive()->OwnerId();
+ Handle(SelectBasics_EntityOwner) aBasicsOwner =
+ aSelection->Sensitive()->BaseSensitive()->OwnerId();
if (!aBasicsOwner.IsNull())
aBasicsOwner->Set(aBasicsOwner->Priority() + myAdditionalSelectionPriority);
}
Standard_EXPORT ModuleBase_ResultPrs(ResultPtr theResult);
//! Method which draws selected owners ( for fast presentation draw )
- Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM,
+ Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM,
const SelectMgr_SequenceOfOwner& theOwners);
//! Method which hilight an owner belonging to
//! this selectable object ( for fast presentation draw )
- Standard_EXPORT virtual void HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d)& thePM,
- const Quantity_NameOfColor theColor, const Handle(SelectMgr_EntityOwner)& theOwner);
+ Standard_EXPORT virtual void HilightOwnerWithColor(
+ const Handle(PrsMgr_PresentationManager3d)& thePM,
+ const Quantity_NameOfColor theColor, const Handle(SelectMgr_EntityOwner)& theOwner);
/// Returns result object
Standard_EXPORT ResultPtr getResult() const { return myResult; }
/// Returns selection priorities that will be added to created selection owner
/// \return integer value
- Standard_EXPORT int getAdditionalSelectionPriority() const { return myAdditionalSelectionPriority; }
+ Standard_EXPORT int getAdditionalSelectionPriority() const
+ { return myAdditionalSelectionPriority; }
/// Appends a special priority for the mode of selection
/// \param theSelectionMode a mode of selection, used in ComputeSelection
DEFINE_STANDARD_RTTI(ModuleBase_ResultPrs)
protected:
/// Redefinition of virtual function
- Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+ Standard_EXPORT virtual void Compute(
+ const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
/// Redefinition of virtual function
/// Original shape of the result object
TopoDS_Shape myOriginalShape;
- /// selection priority that will be added to the standard selection priority of the selection entity
+
+ /// selection priority that will be added to the standard
+ /// selection priority of the selection entity
int myAdditionalSelectionPriority;
};
#include <ModuleBase_SelectionValidator.h>
-bool ModuleBase_SelectionValidator::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const
+bool ModuleBase_SelectionValidator::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
{
return true;
}
/// Returns True if selection is valid
/// \param theSelection selection instance
/// \param theOperation - current operation (can be 0)
- virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
+ virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
};
#endif
/// \param theReferencesToDelete an out set for references features to be removed
/// \return true if in message box answer is Yes
bool MODULEBASE_EXPORT askToDelete(const std::set<FeaturePtr> aFeatures,
- const std::map<FeaturePtr, std::set<FeaturePtr> >& theReferences,
+ const std::map<FeaturePtr,
+ std::set<FeaturePtr> >& theReferences,
QWidget* theParent,
std::set<FeaturePtr>& theReferencesToDelete,
const std::string& thePrefixInfo = "");
/// of this parameter is to be removed
/// \param theObjects a list of objects
/// \param theFeatures an out conteiner of features
-void MODULEBASE_EXPORT convertToFeatures(const QObjectPtrList& theObjects, std::set<FeaturePtr>& theFeatures);
+void MODULEBASE_EXPORT convertToFeatures(const QObjectPtrList& theObjects,
+ std::set<FeaturePtr>& theFeatures);
/// Returns translation from the given data.
//TODO (VSV): Check bug in OCCT: Filter result is ignored (bug25340)
-Standard_Boolean ModuleBase_ShapeDocumentFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
+Standard_Boolean ModuleBase_ShapeDocumentFilter::IsOk(
+ const Handle(SelectMgr_EntityOwner)& theOwner) const
{
bool aValid = true;
IMPLEMENT_STANDARD_HANDLE(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter);
IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ShapeInPlaneFilter, SelectMgr_Filter);
-Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
+Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk(
+ const Handle(SelectMgr_EntityOwner)& theOwner) const
{
bool aValid = true;
public:
/// Constructor
/// \param theWorkshop instance of workshop interface
- Standard_EXPORT ModuleBase_ShapeDocumentFilter(ModuleBase_IWorkshop* theWorkshop): SelectMgr_Filter(),
+ Standard_EXPORT
+ ModuleBase_ShapeDocumentFilter(ModuleBase_IWorkshop* theWorkshop): SelectMgr_Filter(),
myWorkshop(theWorkshop) {}
/// Returns True if the given owner is acceptable for selection
/// \param theOwner the selected owner
- Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
+ Standard_EXPORT virtual
+ Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
DEFINE_STANDARD_RTTI(ModuleBase_ShapeDocumentFilter)
/// Returns True if the given owner is acceptable for selection
/// \param theOwner the selected owner
- Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
+ Standard_EXPORT virtual
+ Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
DEFINE_STANDARD_RTTI(ModuleBase_ShapeInPlaneFilter)
private:
return result;
}
-void ModuleBase_WidgetConcealedObjects::addViewRow(const std::shared_ptr<ModelAPI_Result>& theResult)
+void ModuleBase_WidgetConcealedObjects::addViewRow(
+ const std::shared_ptr<ModelAPI_Result>& theResult)
{
int anId = myView->rowCount();
myView->setRowCount(anId+1);
std::shared_ptr<ModuleBase_WidgetCreatorFactory> ModuleBase_WidgetCreatorFactory::get()
{
if (!MY_WIDGET_CREATOR_FACTORY) {
- MY_WIDGET_CREATOR_FACTORY = std::shared_ptr<ModuleBase_WidgetCreatorFactory>(new ModuleBase_WidgetCreatorFactory());
+ MY_WIDGET_CREATOR_FACTORY =
+ std::shared_ptr<ModuleBase_WidgetCreatorFactory>(new ModuleBase_WidgetCreatorFactory());
}
return MY_WIDGET_CREATOR_FACTORY;
}
myPanelToCreator[aKey] = theCreator;
else {
Events_InfoMessage("ModuleBase_WidgetCreatorFactory",
- "The %1 panel XML definition has been already used by another widget creator").arg(aKey).send();
+ "The %1 panel XML definition has been already used by another widget creator")
+ .arg(aKey).send();
}
}
myCreators[aKey] = theCreator;
else {
Events_InfoMessage("ModuleBase_WidgetCreatorFactory",
- "The %1 widget XML definition has been already used by another widget creator").arg(aKey).send();
+ "The %1 widget XML definition has been already used by another widget creator")
+ .arg(aKey).send();
}
}
myPageToCreator[aKey] = theCreator;
else {
Events_InfoMessage("ModuleBase_WidgetCreatorFactory",
- "The %1 page XML definition has been already used by another widget creator").arg(aKey).send();
+ "The %1 page XML definition has been already used by another widget creator")
+ .arg(aKey).send();
}
}
}
/**
* \ingroup GUI
-* A class for creation of widgets instances in for property panel using XML deskription of
+* A class for creation of widgets instances in for property panel using XML deskription of
* a feature
*/
class MODULEBASE_EXPORT ModuleBase_WidgetCreatorFactory
/// Destructor
virtual ~ModuleBase_WidgetCreatorFactory();
- /// The creator is added to the internal container to be used when the createWidgetByType is called
+ /// The creator is added to the internal container
+ /// to be used when the createWidgetByType is called
/// \param theCreator a new widget creator
void registerCreator(const WidgetCreatorPtr& theCreator);
/// Create page by its type
/// \param theType a type
/// \param theParent a parent widget
- /// \param theWidgetApi the widget configuration. The attribute of the model widget is obtained from XML
+ /// \param theWidgetApi the widget configuration.
+ /// The attribute of the model widget is obtained from XML
/// \return a created page or null
ModuleBase_PageBase* createPageByType(const std::string& theType,
QWidget* theParent,
/// Create widget by its type
/// \param theType a type
/// \param theParent a parent widget
- /// \param theWidgetApi the widget configuration. The attribute of the model widget is obtained from XML
+ /// \param theWidgetApi the widget configuration.
+ /// The attribute of the model widget is obtained from XML
/// \param theWorkshop a workshop object instance
/// \return a created widget or null
ModuleBase_ModelWidget* createWidgetByType(const std::string& theType,
QPen anOldpen = aPainter.pen();
aPainter.setPen( aColor );
lineRect.adjust(minLB, 0, 0, 0);
- QString elidedText = aFontMetrics.elidedText( myPlaceHolderText, Qt::ElideRight, lineRect.width() );
+ QString elidedText =
+ aFontMetrics.elidedText( myPlaceHolderText, Qt::ElideRight, lineRect.width() );
aPainter.drawText( lineRect, va, elidedText );
aPainter.setPen( anOldpen );
}
ModuleBase_PageBase* aPage = new ModuleBase_PageWidget(aWidget);
createWidget(aPage);
if (aWdgType == WDG_SWITCH || aWdgType == WDG_TOOLBOX) {
- ModuleBase_PagedContainer* aContainer = qobject_cast<ModuleBase_PagedContainer*>(aWidget);
+ ModuleBase_PagedContainer* aContainer =
+ qobject_cast<ModuleBase_PagedContainer*>(aWidget);
QString anIconPath = qs( myWidgetApi->getProperty( CONTAINER_PAGE_ICON ) );
QPixmap anIcon = ModuleBase_IconFactory::loadPixmap( anIconPath );
if (aFound) {
theTitle = QString::fromStdString(myWidgetApi->widgetLabel()).toStdString().c_str();
if (theTitle.empty())
- theTitle = QString::fromStdString(myWidgetApi->getProperty(CONTAINER_PAGE_NAME)).toStdString().c_str();
+ theTitle =
+ QString::fromStdString(myWidgetApi->getProperty(CONTAINER_PAGE_NAME)).toStdString().c_str();
}
}
QLabel* aListLabel = new QLabel(!aLabelText.empty() ? aLabelText.c_str()
: tr("Selected objects:"), this);
aMainLay->addWidget(aListLabel, 1, 0);
- // if the xml definition contains one type, an information label should be shown near to the latest
+ // if the xml definition contains one type, an information label
+ // should be shown near to the latest
if (aShapeTypes.size() <= 1) {
QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
if (!aLabelIcon.isEmpty()) {
if (isDone) // may be the feature's result is not displayed, but attributes should be
myWorkshop->module()->customizeObject(myFeature, ModuleBase_IModule::CustomizeArguments,
- true);/// hope that something is redisplayed by object updated
+ true);/// hope that something is redisplayed by object updated
return isDone;
}
// may be the feature's result is not displayed, but attributes should be
myWorkshop->module()->customizeObject(myFeature, ModuleBase_IModule::CustomizeArguments,
- true); /// hope that something is redisplayed by object updated
+ true); /// hope that something is redisplayed by object updated
}
// Restore selection
}
void ModuleBase_WidgetMultiSelector::convertIndicesToViewerSelection(std::set<int> theAttributeIds,
- QList<ModuleBase_ViewerPrsPtr>& theValues) const
+ QList<ModuleBase_ViewerPrsPtr>& theValues) const
{
if(myFeature.get() == NULL)
return;
}
else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
std::set<AttributePtr> anAttributes;
- QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
+ QList<ModuleBase_ViewerPrsPtr>::const_iterator
+ anIt = theValues.begin(), aLast = theValues.end();
ObjectPtr anObject;
GeomShapePtr aShape;
for (; anIt != aLast; anIt++) {
/// \param theAttributeIds indices in attribute list to be returned
/// \param theValues the result presentations, filled with object and shape of an attribute item
void convertIndicesToViewerSelection(std::set<int> theAttributeIds,
- QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues) const;
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues) const;
/// Iterates throgh the model attribute list and remove elements which do not present in the list
/// \param theValues the wrapped selection values
/// \return true if at least one object is removed
- virtual bool removeUnusedAttributeObjects(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
+ virtual bool removeUnusedAttributeObjects(
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
/// Converts viewer presentation selection list to objects and shapes map
/// \param theValues the wrapped selection values
QIntList ModuleBase_WidgetSelector::getShapeTypes() const
{
QIntList aShapeTypes = shapeTypes();
- if (/*aShapeTypes.contains(TopAbs_SOLID) ||*/ // this type should be mentioned in XML, poor selection otherwise
+ // this type should be mentioned in XML, poor selection otherwise
+ if (/*aShapeTypes.contains(TopAbs_SOLID) ||*/
aShapeTypes.contains(ModuleBase_ResultPrs::Sel_Result/*TopAbs_SHAPE*/)) {
// it should be selectable for both, "solids" and "objects" types
aShapeTypes.append(TopAbs_COMPSOLID);
getGeomSelection(thePrs, anObject, aShape);
// the last flag is to be depending on hasObject is called before. To be corrected later
- return ModuleBase_Tools::setObject(attribute(), anObject, aShape, myWorkshop, myIsInValidate, true);
+ return ModuleBase_Tools::setObject(attribute(), anObject, aShape,
+ myWorkshop, myIsInValidate, true);
}
//********************************************************************
}
else if (anAttribute->attributeType() == ModelAPI_AttributeSelectionList::typeId()) {
AttributeSelectionListPtr aSelectAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(anAttribute);
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(anAttribute);
aSelectAttr->removeTemporaryValues();
}
}
myShape = ModuleBase_Tools::getShape(theAttribute, theWorkshop);
myRefAttribute = AttributePtr();
myIsObject = false;
- AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
+ AttributeRefAttrPtr aRefAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
if (aRefAttr) {
myIsObject = aRefAttr->isObject();
myRefAttribute = aRefAttr->attr();
}
else {
ModuleBase_Tools::setObject(theAttribute, myObject, myShape, theWorkshop, true, true);
- AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
+ AttributeRefAttrPtr aRefAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
if (aRefAttr) {
if (!myIsObject)
aRefAttr->setAttr(myRefAttribute);
#include <QStackedLayout>
#include <QVBoxLayout>
-ModuleBase_WidgetSwitch::ModuleBase_WidgetSwitch(QWidget* theParent, const Config_WidgetAPI* theData)
+ModuleBase_WidgetSwitch::ModuleBase_WidgetSwitch(QWidget* theParent,
+ const Config_WidgetAPI* theData)
: ModuleBase_PagedContainer(theParent, theData)
{
QVBoxLayout* aMainLay = new QVBoxLayout(this);
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
/*
* ModuleBase_WidgetToolbox.cpp
*
#include <QVBoxLayout>
#include <QIcon>
-ModuleBase_WidgetToolbox::ModuleBase_WidgetToolbox(QWidget* theParent, const Config_WidgetAPI* theData)
+ModuleBase_WidgetToolbox::ModuleBase_WidgetToolbox(QWidget* theParent,
+ const Config_WidgetAPI* theData)
: ModuleBase_PagedContainer(theParent, theData)
{
QVBoxLayout* aMainLayout = new QVBoxLayout(this);
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
/*
* ModuleBase_WidgetToolbox.h
*
}
//********************************************************************
-bool ModuleBase_WidgetValidated::isValidSelectionForAttribute(const ModuleBase_ViewerPrsPtr& theValue,
- const AttributePtr& theAttribute)
+bool ModuleBase_WidgetValidated::isValidSelectionForAttribute(
+ const ModuleBase_ViewerPrsPtr& theValue,
+ const AttributePtr& theAttribute)
{
bool aValid = false;
}
//********************************************************************
-void ModuleBase_WidgetValidated::storeValidState(const ModuleBase_ViewerPrsPtr& theValue, const bool theValid)
+void ModuleBase_WidgetValidated::storeValidState(const ModuleBase_ViewerPrsPtr& theValue,
+ const bool theValid)
{
GeomShapePtr aShape = theValue.get() ? theValue->shape() : GeomShapePtr();
if (aShape.get()) {
}
}
#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
}
//********************************************************************
-bool ModuleBase_WidgetValidated::getValidState(const ModuleBase_ViewerPrsPtr& theValue, bool& theValid)
+bool ModuleBase_WidgetValidated::getValidState(const ModuleBase_ViewerPrsPtr& theValue,
+ bool& theValid)
{
if (!theValue.get())
return false;
for (; anIt != aLast; anIt++) {
const ModuleBase_ViewerPrsPtr& aViewerPrs = *anIt;
ObjectPtr anObject = aViewerPrs->object();
- ResultCompSolidPtr aResultCompSolid = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(anObject);
+ ResultCompSolidPtr aResultCompSolid =
+ std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(anObject);
if(aResultCompSolid.get()) {
aCompSolids.insert(aResultCompSolid);
}
bool isValidAttribute(const AttributePtr& theAttribute) const;
protected:
- /// Gets the validity state of the presentation in an internal map. Returns true if the valid state of value is stored
+ /// Gets the validity state of the presentation in an internal map.
+ /// Returns true if the valid state of value is stored
/// \param theValue a viewer presentation
/// \param theValid a valid state
bool getValidState(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue, bool& theValid);
private:
ObjectPtr myPresentedObject; /// back up of the filtered object
#ifdef LIST_OF_VALID_PRS
- QList<std::shared_ptr<ModuleBase_ViewerPrs>> myValidPrs; /// cash of valid selection presentations
- QList<std::shared_ptr<ModuleBase_ViewerPrs>> myInvalidPrs; /// cash of invalid selection presentations
+ /// cash of valid selection presentations
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>> myValidPrs;
+
+ /// cash of invalid selection presentations
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>> myInvalidPrs;
#else
// assume that one presentation selection presentation corresponds only one shape
NCollection_DataMap<TopoDS_Shape, std::shared_ptr<ModuleBase_ViewerPrs> > myValidPrs;
//! Clear all validated cash in the widget
void clearValidatedCash();
- /// Gets the validity state of the presentation in an internal map. Returns true if the valid state of value is stored
+ /// Gets the validity state of the presentation in an internal map.
+ /// Returns true if the valid state of value is stored
/// \param theValue a viewer presentation
/// \param theValid a valid state
bool getValidState(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue, bool& theValid);
ModuleBase_ModelWidget* myModelWidget; ///< the current widget to be validated
ModuleBase_IWorkshop* myWorkshop; ///< the active workshop
- QList<std::shared_ptr<ModuleBase_ViewerPrs>> myValidPrs; ///< cash of valid selection presentations
- QList<std::shared_ptr<ModuleBase_ViewerPrs>> myInvalidPrs; ///< cash of invalid selection presentations
+ /// cash of valid selection presentations
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>> myValidPrs;
+
+ /// cash of invalid selection presentations
+ QList<std::shared_ptr<ModuleBase_ViewerPrs>> myInvalidPrs;
};
#endif /* ModuleBase_WidgetValidator_H_ */
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
// Name : ParametersAPI_Parameter.cpp
// Purpose:
//
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
// Name : ParametersAPI_Parameter.h
// Purpose:
//
virtual ~ParametersAPI_Parameter();
INTERFACE_3(ParametersPlugin_Parameter::ID(),
- name, ParametersPlugin_Parameter::VARIABLE_ID(), ModelAPI_AttributeString, /** Name */,
- expression, ParametersPlugin_Parameter::EXPRESSION_ID(), ModelAPI_AttributeString, /** Expression */,
- comment, ParametersPlugin_Parameter::COMMENT_ID(), ModelAPI_AttributeString, /** Comment */
+ name, ParametersPlugin_Parameter::VARIABLE_ID(),
+ ModelAPI_AttributeString, /** Name */,
+ expression, ParametersPlugin_Parameter::EXPRESSION_ID(),
+ ModelAPI_AttributeString, /** Expression */,
+ comment, ParametersPlugin_Parameter::COMMENT_ID(),
+ ModelAPI_AttributeString, /** Comment */
)
/// Dump wrapped feature
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
/*
* ParametersPlugin_EvalListener.cpp
*
bool isValid = anError.empty();
if (isValid)
anAttribute->setCalculatedValue(aValue);
- anAttribute->setUsedParameters(isValid ? toSet(myInterp->compile(anAttribute->text())) : std::set<std::string>());
+ anAttribute->setUsedParameters(isValid ?
+ toSet(myInterp->compile(anAttribute->text())) : std::set<std::string>());
anAttribute->setExpressionInvalid(!isValid);
anAttribute->setExpressionError(anAttribute->text().empty() ? "" : anError);
} else
bool isValid = anError.empty();
if (isValid)
anAttribute->setCalculatedValue(aValue);
- anAttribute->setUsedParameters(isValid ? toSet(myInterp->compile(anAttribute->text())) : std::set<std::string>());
+ anAttribute->setUsedParameters(isValid ?
+ toSet(myInterp->compile(anAttribute->text())) : std::set<std::string>());
anAttribute->setExpressionInvalid(!isValid);
anAttribute->setExpressionError(anAttribute->text().empty() ? "" : anError);
} else
double aValue = evaluate(aParamFeature, aText[i], anError);
bool isValid = anError.empty();
if (isValid) aCalculatedValue[i] = aValue;
- anAttribute->setUsedParameters(i, isValid ? toSet(myInterp->compile(aText[i])) : std::set<std::string>());
+ anAttribute->setUsedParameters(i,
+ isValid ? toSet(myInterp->compile(aText[i])) : std::set<std::string>());
anAttribute->setExpressionInvalid(i, !isValid);
anAttribute->setExpressionError(i, aText[i].empty() ? "" : anError);
}
double aValue = evaluate(aParamFeature, aText[i], anError);
bool isValid = anError.empty();
if (isValid) aCalculatedValue[i] = aValue;
- anAttribute->setUsedParameters(i, isValid ? toSet(myInterp->compile(aText[i])) : std::set<std::string>());
+ anAttribute->setUsedParameters(i,
+ isValid ? toSet(myInterp->compile(aText[i])) : std::set<std::string>());
anAttribute->setExpressionInvalid(i, !isValid);
anAttribute->setExpressionError(i, aText[i].empty() ? "" : anError);
}
}
}
-void ParametersPlugin_EvalListener::renameInDependents(std::shared_ptr<ModelAPI_ResultParameter> theResultParameter,
- const std::string& theOldName,
- const std::string& theNewName)
+void ParametersPlugin_EvalListener::renameInDependents(
+ std::shared_ptr<ModelAPI_ResultParameter> theResultParameter,
+ const std::string& theOldName,
+ const std::string& theNewName)
{
std::set<std::shared_ptr<ModelAPI_Attribute> > anAttributes =
theResultParameter->data()->refsToMe();
// try to update the parameter feature according the new name
setParameterName(aResultParameter, aMessage->newName());
- // TODO(spo): replace with ModelAPI_Session::get()->validators()->validate(aParameter, ParametersPlugin_Parameter::VARIABLE_ID())
- // when ModelAPI_ValidatorsFactory::validate(const std::shared_ptr<ModelAPI_Feature>& theFeature, const std::string& theAttribute) const
+ // TODO(spo): replace with
+ // ModelAPI_Session::get()->validators()->validate(aParameter,
+ // ParametersPlugin_Parameter::VARIABLE_ID())
+ // when ModelAPI_ValidatorsFactory::validate(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ // const std::string& theAttribute) const
// is ready
if (!isValidAttribute(aParameter->string(ParametersPlugin_Parameter::VARIABLE_ID()))) {
setParameterName(aResultParameter, aMessage->oldName());
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
/*
* ParametersPlugin_EvalListener.h
*
PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_EvalListener();
/// Reimplemented from Events_Listener::processEvent().
- PARAMETERSPLUGIN_EXPORT virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
+ PARAMETERSPLUGIN_EXPORT
+ virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
protected:
/// Evaluates theExpression and returns its value.
aFactory->registerValidator("Parameters_ExpressionValidator",
new ParametersPlugin_ExpressionValidator);
- myEvalListener = std::shared_ptr<ParametersPlugin_EvalListener>(new ParametersPlugin_EvalListener());
+ myEvalListener =
+ std::shared_ptr<ParametersPlugin_EvalListener>(new ParametersPlugin_EvalListener());
}
FeaturePtr ParametersPlugin_Plugin::createFeature(std::string theFeatureID)
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
/*
* ParametersPlugin_PyInterp.cpp
*
}
PyObject *aCodePyObj =
- PyObject_CallMethod(aCodeopModule, (char*)"compile_command", (char*)"(s)", theExpression.c_str());
+ PyObject_CallMethod(aCodeopModule, (char*)"compile_command", (char*)"(s)",
+ theExpression.c_str());
if(!aCodePyObj || aCodePyObj == Py_None || !PyCode_Check(aCodePyObj)) {
Py_XDECREF(aCodePyObj);
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
/*
* ParametersPlugin_PyInterp.h
*
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
/*
* Parameters_VariableValidator.cpp
*
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
/*
* Parameters_VariableValidator.h
*
}
/////////////////////////////////////////////////////////////////////////////////////////////////
-void ParametersPlugin_TreeWidget::closeEditor(QWidget* theEditor, QAbstractItemDelegate::EndEditHint theHint)
+void ParametersPlugin_TreeWidget::closeEditor(QWidget* theEditor,
+ QAbstractItemDelegate::EndEditHint theHint)
{
if (theHint == QAbstractItemDelegate::EditNextItem) {
QModelIndex aCurrent = currentIndex();
/////////////////////////////////////////////////////////////////////////////////////////////////
-ParametersPlugin_WidgetParamsMgr::ParametersPlugin_WidgetParamsMgr(QWidget* theParent, const Config_WidgetAPI* theData)
+ParametersPlugin_WidgetParamsMgr::ParametersPlugin_WidgetParamsMgr(QWidget* theParent,
+ const Config_WidgetAPI* theData)
: ModuleBase_ModelDialogWidget(theParent, theData)
{
QVBoxLayout* aLayout = new QVBoxLayout(this);
QStringList aValNames;
aValNames << aReferenced->data()->name().c_str();
- AttributeDoublePtr aDouble = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(aAttr);
+ AttributeDoublePtr aDouble =
+ std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(aAttr);
if (aDouble.get()) {
aValNames << aDouble->text().c_str();
aValNames << QString::number(aDouble->value());
} else {
- AttributeIntegerPtr aInt = std::dynamic_pointer_cast<ModelAPI_AttributeInteger>(aAttr);
+ AttributeIntegerPtr aInt =
+ std::dynamic_pointer_cast<ModelAPI_AttributeInteger>(aAttr);
if (aInt.get()) {
aValNames << aInt->text().c_str();
aValNames << QString::number(aInt->value());
} else
aValues << aExpr.c_str();
- std::string aErr = aParameter->data()->string(ParametersPlugin_Parameter::EXPRESSION_ERROR_ID())->value();
+ std::string aErr =
+ aParameter->data()->string(ParametersPlugin_Parameter::EXPRESSION_ERROR_ID())->value();
if (aErr.empty()) {
AttributeDoublePtr aValueAttribute = aParam->data()->real(ModelAPI_ResultParameter::VALUE());
aValues << QString::number(aValueAttribute->value());
break;
case Col_Equation:
{
- AttributeStringPtr aStringAttr = aFeature->string(ParametersPlugin_Parameter::EXPRESSION_ID());
+ AttributeStringPtr aStringAttr =
+ aFeature->string(ParametersPlugin_Parameter::EXPRESSION_ID());
if (!aText.isEmpty()) {
if (aText != aStringAttr->value().c_str()) {
aStringAttr->setValue(aText.toStdString());
/// Enable or disable buttons for parameters managemnt
void enableButtons(bool theEnable);
- QList<QStringList> featuresItems(const QList<FeaturePtr>& theFeatures, QList<FeaturePtr>& theFeatureList) const;
+ QList<QStringList> featuresItems(const QList<FeaturePtr>& theFeatures,
+ QList<FeaturePtr>& theFeatureList) const;
QList<QStringList> parametersItems(const QList<FeaturePtr>& theFeatures) const;
void updateParametersFeatures();