return isModified;
}
-bool PartSet_CustomPrs::erasePresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
- const bool theUpdateViewer)
+bool PartSet_CustomPrs::erasePresentation(
+ const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag,
+ const bool theUpdateViewer)
{
bool isErased = false;
XGUI_Workshop* aWorkshop = workshop();
return isErased;
}
-void PartSet_CustomPrs::clearPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag)
+void PartSet_CustomPrs::clearPresentation(
+ const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag)
{
AISObjectPtr aPresentation = getPresentation(theFlag, false);
if (aPresentation.get()) {
myPresentationIsEmpty = true; /// store state to analize it after display/erase is finished
}
-void PartSet_CustomPrs::initPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag)
+void PartSet_CustomPrs::initPresentation(
+ const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag)
{
AISObjectPtr anOperationPrs = AISObjectPtr(new GeomAPI_AISObject());
Handle(PartSet_OperationPrs) anAISPrs = new PartSet_OperationPrs(myWorkshop);
if (aFeature.get() != NULL) {
QObjectPtrList anObjects;
anObjects.append(aFeature);
- // the external feature should be removed with all references, composite sketch feature will be ignored
+ // the external feature should be removed with all references,
+ // composite sketch feature will be ignored
workshop(theWorkshop)->deleteFeatures(anObjects);
}
}
ResultPtr aResult = myWorkshop->selection()->getResult(aPrs);
// to filter infinite construction results
if (aResult.get() && aResult->groupName() == ModelAPI_ResultConstruction::group()) {
- ResultConstructionPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aResult);
+ ResultConstructionPtr aConstruction =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aResult);
if (aConstruction.get() && aConstruction->isInfinite()) {
Handle(StdSelect_BRepOwner) aBRepOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
if (!aBRepOwner.IsNull() && aBRepOwner->HasShape()) {
TopoDS_Shape aResultTopoShape = aResultShape->impl<TopoDS_Shape>();
aResultShapeType = aResultTopoShape.ShapeType();
}
- // for infinite object, the selection is possible only for shapes of owners, which are coincide
- // to the shape of corresponded AIS object. In other words, for axis, only edge can be selected
- // (vertices are not selectable), for planes, only faces can be selected (not edges or vertices)
+ // for infinite object, the selection is possible only
+ // for shapes of owners, which are coincide
+ // to the shape of corresponded AIS object.
+ // In other words, for axis, only edge can be selected
+ // (vertices are not selectable), for planes,
+ // only faces can be selected (not edges or vertices)
aValid = anOwnerShapeType == aResultShapeType;
}
}
/// Returns True if selected presentation can be selected
/// \param theOwner an owner of the persentation
- 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(PartSet_FilterInfinite)
ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj);
if (aObj) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
- // result of parts belongs to PartSet document and can be selected only when PartSet is active
- // in order to do not select the result of the active part.
+ // result of parts belongs to PartSet document and can be selected only when PartSet
+ // is active in order to do not select the result of the active part.
if (aResult.get() && aResult->groupName() == ModelAPI_ResultPart::group()) {
SessionPtr aMgr = ModelAPI_Session::get();
aValid = aMgr->activeDocument() == aMgr->moduleDocument();
IMPLEMENT_STANDARD_HANDLE(PartSet_CirclePointFilter, SelectMgr_Filter);
IMPLEMENT_STANDARD_RTTIEXT(PartSet_CirclePointFilter, SelectMgr_Filter);
-Standard_Boolean PartSet_CirclePointFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
+Standard_Boolean
+ PartSet_CirclePointFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
{
ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation();
if(!anOperation) {
return Standard_True;
}
- Handle(ModuleBase_ResultPrs) aResultPrs = Handle(ModuleBase_ResultPrs)::DownCast(theOwner->Selectable());
+ Handle(ModuleBase_ResultPrs) aResultPrs =
+ Handle(ModuleBase_ResultPrs)::DownCast(theOwner->Selectable());
if(aResultPrs.IsNull()) {
return Standard_True;
}
void PartSet_IconFactory::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
- 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()) {
std::string anAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID();
std::shared_ptr<ModelAPI_AttributeBoolean> anAuxiliaryAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(aSketchFeature->data()->attribute(anAttribute));
+ std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(
+ aSketchFeature->data()->attribute(anAttribute));
if (anAuxiliaryAttr)
anAuxiliaryAttr->setValue(isChecked);
}
// 1. change auxiliary type of a created feature
if (myModule->sketchMgr()->isNestedCreateOperation(anOperation, aSketch) &&
PartSet_SketcherMgr::isEntity(anOperation->id().toStdString()) ) {
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(anOperation);
+ ModuleBase_OperationFeature* aFOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(anOperation);
if (aFOperation)
anObjects.append(aFOperation->feature());
}
std::string anAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID();
std::shared_ptr<ModelAPI_AttributeBoolean> anAuxiliaryAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(aSketchFeature->data()->attribute(anAttribute));
+ std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(
+ aSketchFeature->data()->attribute(anAttribute));
if (anAuxiliaryAttr)
isNotAuxiliaryFound = !anAuxiliaryAttr->value();
}
Config_PropManager::registerProp("Visualization", "operation_highlight_color",
"Multi selector item color in operation", Config_Prop::Color,
PartSet_CustomPrs::OPERATION_HIGHLIGHT_COLOR());
-
- //Config_PropManager::registerProp(SKETCH_TAB_NAME, "disable_input_fields", "Disable input fields",
- // Config_Prop::Boolean, "true");
}
PartSet_Module::~PartSet_Module()
PLANE_SIZE);
Config_PropManager::registerProp(SKETCH_TAB_NAME, "planes_thickness", "Thickness",
Config_Prop::Integer, SKETCH_WIDTH);
- Config_PropManager::registerProp(SKETCH_TAB_NAME, "rotate_to_plane", "Rotate to plane when selected",
- Config_Prop::Boolean, "false");
+ Config_PropManager::registerProp(SKETCH_TAB_NAME, "rotate_to_plane",
+ "Rotate to plane when selected", Config_Prop::Boolean, "false");
}
-void PartSet_Module::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect)
+void PartSet_Module::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget,
+ const bool isToConnect)
{
mySketchMgr->connectToPropertyPanel(theWidget, isToConnect);
}
/// Restart sketcher operations automatically
if (!mySketchReentrantMgr->operationCommitted(theOperation)) {
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+ ModuleBase_OperationFeature* aFOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if (aFOperation && !aFOperation->isEditOperation()) {
// the selection is cleared after commit the create operation
// in order to do not use the same selected objects in the restarted operation
bool isOperationCommitted = false;
if (!aFOperation->isEditOperation()) {
std::string aGreedAttributeId = ModuleBase_Tools::findGreedAttribute(workshop(), aFeature);
- // if there is a greed attribute, automatic commit by preselection for this feature is prohibited
+ // if there is a greed attribute, automatic commit by preselection
+ // for this feature is prohibited
aFilledWidget = aFOperation->activateByPreselection(aGreedAttributeId);
if (currentOperation() != aFOperation)
isOperationCommitted = true;
else {
if (aGreedAttributeId.empty()) {
// a signal should be emitted before the next widget activation
- // because, the activation of the next widget will give a focus to the widget. As a result
- // the value of the widget is initialized. And commit may happens until the value is entered.
+ // because, the activation of the next widget will give a focus to the widget.
+ // As a result the value of the widget is initialized.
+ // And commit may happens until the value is entered.
if (aFilledWidget) {
if (mySketchReentrantMgr->canBeCommittedByPreselection())
isOperationCommitted = mySketchMgr->operationActivatedByPreselection();
void PartSet_Module::updatePresentationsOnStart(ModuleBase_Operation* theOperation)
{
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+ ModuleBase_OperationFeature* aFOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if (aFOperation) {
myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeArguments, true);
myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeResults, true);
{
ModuleBase_IModule::operationResumed(theOperation);
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+ ModuleBase_OperationFeature* aFOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if (aFOperation) {
myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeArguments, true);
myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeResults, true);
aDisplayer->updateViewer();
}
- QMap<PartSet_Tools::ConstraintVisibleState, bool>::const_iterator anIt = myHasConstraintShown.begin(),
- aLast = myHasConstraintShown.end();
+ QMap<PartSet_Tools::ConstraintVisibleState, bool>::const_iterator
+ anIt = myHasConstraintShown.begin(), aLast = myHasConstraintShown.end();
for (; anIt != aLast; anIt++) {
mySketchMgr->updateBySketchParameters(anIt.key(), anIt.value());
}
if (isSketchOp || isNestedOp) {
// in active sketch operation it is possible to activate operation object in selection
// in the edit operation, e.g. points of the line can be moved when the line is edited
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(anOperation);
+ ModuleBase_OperationFeature* aFOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(anOperation);
aCanActivate = aCanActivate || (aFOperation && aFOperation->isEditOperation());
}
return aCanActivate;
void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation)
{
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+ ModuleBase_OperationFeature* aFOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if (!aFOperation)
return;
{
bool aProcessed = false;
- ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+ ModuleBase_OperationFeature* aFOperation =
+ dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
XGUI_Workshop* aWorkshop = getWorkshop();
XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel();
if (mySketchMgr->activeSketch().get() && aFOperation && aPropertyPanel) {
FeaturePtr aFeature = ModelAPI_Feature::feature(anObject);
FeaturePtr anOpFeature = aFOperation->feature();
GeomShapePtr aShape = aSelectedPrs->shape();
- // click on the digit of dimension constrain comes here with an empty shape, so we need the check
+ // click on the digit of dimension constrain comes here
+ // with an empty shape, so we need the check
if (aFeature == anOpFeature && aShape.get() && !aShape->isNull()) {
const TopoDS_Shape& aTDShape = aShape->impl<TopoDS_Shape>();
AttributePtr anAttribute = PartSet_Tools::findAttributeBy2dPoint(anObject, aTDShape,
- mySketchMgr->activeSketch());
+ mySketchMgr->activeSketch());
if (anAttribute.get()) {
QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation();
ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), workshop());
anOpMgr->startOperation(anOpAction);
// WORKAROUND, should be done to avoid viewer highlight update after deletetion of objects
- // the problem is in AIS Dimensions recompute if a line and the dim are removed, line is the first
- // it causes the AIS recompute, where the base line is null, the result is empty AIS in the viewer
+ // the problem is in AIS Dimensions recompute
+ // if a line and the dim are removed, line is the first
+ // it causes the AIS recompute, where the base line is null,
+ // the result is empty AIS in the viewer
XGUI_Tools::workshop(myWorkshop)->selector()->clearSelection();
// 4. delete features
return myCustomPrs->isActive(theFlag);
}
-void PartSet_Module::activateCustomPrs(const FeaturePtr& theFeature, const ModuleBase_CustomizeFlag& theFlag,
+void PartSet_Module::activateCustomPrs(const FeaturePtr& theFeature,
+ const ModuleBase_CustomizeFlag& theFlag,
const bool theUpdateViewer)
{
myCustomPrs->activate(theFeature, theFlag, theUpdateViewer);
if (aOperation) {
ModuleBase_ModelWidget* anActiveWidget = activeWidget();
if (anActiveWidget) {
- ModuleBase_WidgetSelector* aWSelector = dynamic_cast<ModuleBase_WidgetSelector*>(anActiveWidget);
+ ModuleBase_WidgetSelector* aWSelector =
+ dynamic_cast<ModuleBase_WidgetSelector*>(anActiveWidget);
if (aWSelector)
aWSelector->activateSelectionAndFilters(true);
}
enum RestartingMode {
RM_None, /// the operation should not be restarted
RM_Forbided, /// the operation should not be restarted after there is no active widget
- RM_LastFeatureUsed, /// the operation is restarted and use the previous feature for own initialization
+ RM_LastFeatureUsed, /// the operation is restarted and use the previous feature
+ /// for own initialization
RM_EmptyFeatureUsed /// the operation is restarted and does not use the previous feature
};
/// Call back forlast tuning of property panel before operation performance
virtual void propertyPanelDefined(ModuleBase_Operation* theOperation);
- /// If there is found selected attribute, widgets are created and contains only a widget for the attribute
+ /// If there is found selected attribute, widgets are created and contains
+ /// only a widget for the attribute
/// It is important for Property Panel filling by sketch point attribute
/// \param theOperation a started operation
/// \param theWidgets a list of created widgets
/// Processing the mouse move event in the viewer
/// \param theWindow a view window
/// \param theEvent a mouse event
- PARTSET_EXPORT virtual void mouseMoved(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent) {}
+ PARTSET_EXPORT virtual void mouseMoved(ModuleBase_IViewWindow* theWindow,
+ QMouseEvent* theEvent) {}
/// Processing the mouse press event in the viewer
/// \param theWindow a view window
/// \param theEvent a mouse event
- PARTSET_EXPORT virtual void mousePressed(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent) {}
+ PARTSET_EXPORT virtual void mousePressed(ModuleBase_IViewWindow* theWindow,
+ QMouseEvent* theEvent) {}
/// Processing the mouse release event in the viewer
/// \param theWindow a view window
/// \param theEvent a mouse event
- PARTSET_EXPORT virtual void mouseReleased(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent) {}
+ PARTSET_EXPORT virtual void mouseReleased(ModuleBase_IViewWindow* theWindow,
+ QMouseEvent* theEvent) {}
/// Processing the mouse double click event in the viewer
/// \param theWindow a view window
/// \param theEvent a mouse event
- PARTSET_EXPORT virtual void mouseDoubleClick(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent) {}
+ PARTSET_EXPORT virtual void mouseDoubleClick(ModuleBase_IViewWindow* theWindow,
+ QMouseEvent* theEvent) {}
};
#endif
myUseAISWidth = true;
}
-void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
- const Handle(Prs3d_Presentation)& thePresentation,
- const Standard_Integer theMode)
+void PartSet_OperationPrs::Compute(
+ const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+ const Handle(Prs3d_Presentation)& thePresentation,
+ const Standard_Integer theMode)
{
#ifdef DEBUG_OPERATION_PRS
qDebug("PartSet_OperationPrs::Compute -- begin");
BRep_Builder aBuilder;
TopoDS_Compound aComp;
aBuilder.MakeCompound(aComp);
- for(NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)>::Iterator anIter(myShapeToPrsMap);
- anIter.More(); anIter.Next()) {
+ for(NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)>::Iterator
+ anIter(myShapeToPrsMap); anIter.More(); anIter.Next()) {
const TopoDS_Shape& aShape = anIter.Key();
aBuilder.Add(aComp, aShape);
// change deviation coefficient to provide more precise circle
if (theObject.get()) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
if (aResult.get()) {
- ResultCompSolidPtr aCompsolidResult = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(theObject);
+ ResultCompSolidPtr aCompsolidResult =
+ std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(theObject);
if (aCompsolidResult.get()) {
if (aCompsolidResult->numberOfSubs() > 0) {
for(int i = 0; i < aCompsolidResult->numberOfSubs(); i++) {
else {
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
if (aFeature.get()) {
- AttributeBooleanPtr aCopyAttr = aFeature->data()->boolean(SketchPlugin_SketchEntity::COPY_ID());
+ AttributeBooleanPtr aCopyAttr =
+ aFeature->data()->boolean(SketchPlugin_SketchEntity::COPY_ID());
if (aCopyAttr.get()) {
bool isCopy = aCopyAttr->value();
if (isCopy)
ObjectPtr anObject;
GeomShapePtr aShape;
if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) {
- AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(anAttribute);
+ AttributeRefAttrPtr anAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(anAttribute);
if (anAttr->isObject()) {
anObject = anAttr->object();
}
}
}
if (anAttrType == ModelAPI_AttributeSelection::typeId()) {
- AttributeSelectionPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(anAttribute);
+ AttributeSelectionPtr anAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(anAttribute);
anObject = anAttr->context();
aShape = anAttr->value();
}
if (anAttrType == ModelAPI_AttributeReference::typeId()) {
- AttributeReferencePtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeReference>(anAttribute);
+ AttributeReferencePtr anAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeReference>(anAttribute);
anObject = anAttr->value();
}
addValue(anObject, aShape, theFeature, theWorkshop, theObjectShapes);
}
void PartSet_OperationPrs::getHighlightedShapes(ModuleBase_IWorkshop* theWorkshop,
- QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes)
+ QMap<ObjectPtr,
+ QList<GeomShapePtr> >& theObjectShapes)
{
theObjectShapes.clear();
anAttrType == ModelAPI_AttributeReference::typeId();
}
-void PartSet_OperationPrs::fillShapeList(const QMap<ObjectPtr, QList<GeomShapePtr> >& theFeatureShapes,
+void PartSet_OperationPrs::fillShapeList(
+ const QMap<ObjectPtr, QList<GeomShapePtr> >& theFeatureShapes,
ModuleBase_IWorkshop* theWorkshop,
- NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)>& theShapeToPrsMap)
+ NCollection_DataMap<TopoDS_Shape,
+ Handle(AIS_InteractiveObject)>& theShapeToPrsMap)
{
theShapeToPrsMap.Clear();
NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)>& theShapeToPrsMap);
private:
- NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)> myShapeToPrsMap; /// list of visualized shapes
+ /// list of visualized shapes
+ NCollection_DataMap<TopoDS_Shape, Handle(AIS_InteractiveObject)> myShapeToPrsMap;
ModuleBase_IWorkshop* myWorkshop; /// current workshop
Quantity_Color myShapeColor; /// color of feature depended shapes
- bool myUseAISWidth; /// flag if the width of a shape object should be used for the shape visualization
+
+ /// flag if the width of a shape object should be used for the shape visualization
+ bool myUseAISWidth;
friend class PartSet_CustomPrs;
};
QString aCurrentInfoStr = getObjectsInfo(myConflictingObjects);
- qDebug(QString("PartSet_OverconstraintListener::processEvent: %1,\nobjects count = %2:%3\ncurrent objects count = %4:%5")
- .arg(isRepaired ? "REPAIRED" : "FAILED")
- .arg(aCount).arg(anInfoStr).arg(myConflictingObjects.size()).arg(aCurrentInfoStr).toStdString().c_str());
+ QString aMsg("PartSet_OverconstraintListener::processEvent: %1,\nobjects \
+ count = %2:%3\ncurrent objects count = %4:%5");
+ qDebug(aMsg.arg(isRepaired ? "REPAIRED" : "FAILED")
+ .arg(aCount).arg(anInfoStr).arg(myConflictingObjects.size())
+ .arg(aCurrentInfoStr).toStdString().c_str());
#endif
if (theMessage->eventID() == Events_Loop::eventByName(EVENT_SOLVER_FAILED)) {
}
bool PartSet_OverconstraintListener::appendConflictingObjects(
- const std::set<ObjectPtr>& theConflictingObjects)
+ const std::set<ObjectPtr>& theConflictingObjects)
{
std::set<ObjectPtr> aModifiedObjects;
std::vector<int> aColor;
getConflictingColor(aColor);
// set error state for new objects and append them in the internal map of objects
- std::set<ObjectPtr>::const_iterator anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end();
+ std::set<ObjectPtr>::const_iterator
+ anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end();
for (; anIt != aLast; anIt++) {
ObjectPtr anObject = *anIt;
if (myConflictingObjects.find(anObject) == myConflictingObjects.end()) { // it is not found
}
bool PartSet_OverconstraintListener::repairConflictingObjects(
- const std::set<ObjectPtr>& theConflictingObjects)
+ const std::set<ObjectPtr>& theConflictingObjects)
{
std::set<ObjectPtr> aModifiedObjects;
// erase error state of absent current objects in the parameter list
std::set<ObjectPtr>::const_iterator anIt, aLast;
- for (anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end() ; anIt != aLast; anIt++) {
+ for (anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end();
+ anIt != aLast; anIt++) {
ObjectPtr anObject = *anIt;
if (theConflictingObjects.find(anObject) != theConflictingObjects.end()) { // it is found
myConflictingObjects.erase(anObject);
ModuleBase_Tools::setPointBallHighlighting(this);
}
-void PartSet_ResultSketchPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
- const Handle(Prs3d_Presentation)& thePresentation,
- const Standard_Integer theMode)
+void PartSet_ResultSketchPrs::Compute(
+ const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+ const Handle(Prs3d_Presentation)& thePresentation,
+ const Standard_Integer theMode)
{
thePresentation->Clear();
}
if (!aReadyToDisplay) {
- Events_InfoMessage("PartSet_ResultSketchPrs", "An empty AIS presentation: PartSet_ResultSketchPrs").send();
+ Events_InfoMessage("PartSet_ResultSketchPrs",
+ "An empty AIS presentation: PartSet_ResultSketchPrs").send();
static const Events_ID anEvent = Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION);
ModelAPI_EventCreator::get()->sendUpdated(myResult, anEvent);
}
TopTools_IndexedMapOfShape aSubShapes;
TopExp::MapShapes (theShape, theType, aSubShapes);
- Standard_Boolean isComesFromDecomposition = !((aSubShapes.Extent() == 1) && (theShape == aSubShapes (1)));
+ Standard_Boolean
+ isComesFromDecomposition = !((aSubShapes.Extent() == 1) && (theShape == aSubShapes (1)));
int anExtent = aSubShapes.Extent();
for (Standard_Integer aShIndex = 1; aShIndex <= aSubShapes.Extent(); ++aShIndex)
{
DEFINE_STANDARD_RTTI(PartSet_ResultSketchPrs)
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
/// \param theShape a shape
/// \param theTypeOfSelection type of selection: VERTEX, EDGE, WIRE
void appendShapeSelection(const Handle(SelectMgr_Selection)& theSelection,
- const TopoDS_Shape& theShape, const TopAbs_ShapeEnum& theTypeOfSelection);
+ const TopoDS_Shape& theShape,
+ const TopAbs_ShapeEnum& theTypeOfSelection);
/// Sets color/line style/width of the presentation depending on the parameter state
/// \param isAuxiliary a boolean value if the properties are for auxiliary objects
bool isObjectOfSketch(const ObjectPtr& theObject) const;
/// Saves the current selection in the viewer into an internal container
- /// It obtains the selected attributes. The highlighted objects can be processes as the selected ones
+ /// It obtains the selected attributes.
+ /// The highlighted objects can be processes as the selected ones
/// \param theHighlightedOnly a boolean flag
void storeSelection(const bool theHighlightedOnly = false);
void onLeaveViewPort();
/// Listens to the value changed signal and display the current operation feature
void onBeforeValuesChangedInPropertyPanel();
- /// Listens to the signal about the modification of the values have been done in the property panel
+ /// Listens to the signal about the modification of the values
+ /// have been done in the property panel
void onAfterValuesChangedInPropertyPanel();
void onMousePressed(ModuleBase_IViewWindow*, QMouseEvent*);
/// Erase or display the feature of the current operation. If the mouse over the active view or
/// a current value is changed by property panel, the feature is displayed otherwise it is hidden
- /// \param theOperation an operation which feature is to be displayed, it is nested create operation
+ /// \param theOperation an operation which feature is to be displayed,
+ /// it is nested create operation
/// \param isToDisplay a flag about the display or erase the feature
void visualizeFeature(const FeaturePtr& theFeature, const bool isEditOperation,
const bool isToDisplay, const bool isFlushRedisplay = true);
bool myIsDragging;
bool myDragDone;
bool myIsMouseOverWindow; /// the state that the mouse over the view
- bool myIsMouseOverViewProcessed; /// the state whether the over view state is processed by mouseMove method
+ /// the state whether the over view state is processed by mouseMove method
+ bool myIsMouseOverViewProcessed;
bool myIsPopupMenuActive; /// the state of the popup menu is shown
Point myCurrentPoint;
//Point myClickedPoint;
myPreviousFeature = aFOperation->feature();
/// selection should be obtained from workshop before ask if the operation can be started as
- /// the canStartOperation method performs commit/abort of previous operation. Sometimes commit/abort
- /// may cause selection clear(Sketch operation) as a result it will be lost and is not used for preselection.
+ /// the canStartOperation method performs commit/abort of previous operation.
+ /// Sometimes commit/abort
+ /// may cause selection clear(Sketch operation) as a result
+ /// it will be lost and is not used for preselection.
ModuleBase_ISelection* aSelection = myWorkshop->selection();
- QList<ModuleBase_ViewerPrsPtr> aPreSelected = aSelection->getSelected(ModuleBase_ISelection::AllControls);
+ QList<ModuleBase_ViewerPrsPtr> aPreSelected =
+ aSelection->getSelected(ModuleBase_ISelection::AllControls);
restartOperation();
myPreviousFeature = FeaturePtr();
// fill the first widget by the mouse event point
// if the active widget is not the first, it means that the restarted operation is filled by
// the current preselection.
- PartSet_WidgetPoint2D* aPoint2DWdg = dynamic_cast<PartSet_WidgetPoint2D*>(module()->activeWidget());
+ PartSet_WidgetPoint2D* aPoint2DWdg =
+ dynamic_cast<PartSet_WidgetPoint2D*>(module()->activeWidget());
ModuleBase_ModelWidget* aFirstWidget = aPanel->findFirstAcceptingValueWidget();
if (aPoint2DWdg && aPoint2DWdg == aFirstWidget) {
if (!aPreSelected.empty())
if (aPreviousAttributeWidget == aPanel->activeWidget()) {
aPanel->activateWidget(NULL, false);
}
- // if there is no the next widget to be automatically activated, the Ok button in property
+ // if there is no the next widget to be automatically activated,
+ // the Ok button in property
// panel should accept the focus(example is parallel constraint on sketch lines)
- QToolButton* anOkBtn = dynamic_cast<XGUI_PropertyPanel*>(aPanel)->findButton(PROP_PANEL_OK);
+ QToolButton* anOkBtn =
+ dynamic_cast<XGUI_PropertyPanel*>(aPanel)->findButton(PROP_PANEL_OK);
if (anOkBtn)
anOkBtn->setFocus(Qt::TabFocusReason);
}
void PartSet_SketcherReetntrantMgr::deleteInternalFeature()
{
if (myInternalActiveWidget) {
- ModuleBase_WidgetSelector* aWSelector = dynamic_cast<ModuleBase_WidgetSelector*>(myInternalActiveWidget);
+ ModuleBase_WidgetSelector* aWSelector =
+ dynamic_cast<ModuleBase_WidgetSelector*>(myInternalActiveWidget);
if (aWSelector)
aWSelector->activateSelectionAndFilters(false);
myInternalActiveWidget = 0;
/// ('internal' edit operation), with the ability to simultaneously create the next entity
/// of same type (re-entrance of the operation).
/// OK valids the current edition and exits from the operation (no re-entrance).
-/// Cancel removes (undo) the entity currently edited and exits from the operation (no re-entrance).
+/// Cancel removes (undo) the entity currently edited and
+/// exits from the operation (no re-entrance).
class PARTSET_EXPORT PartSet_SketcherReetntrantMgr : public QObject
{
Q_OBJECT
enum RestartingMode {
RM_None, /// the operation should not be restarted
RM_Forbided, /// the operation should not be restarted after there is no active widget
- RM_LastFeatureUsed, /// the operation is restarted and use the previous feature for own initialization
+ RM_LastFeatureUsed, /// the operation is restarted and use
+ /// the previous feature for own initialization
RM_EmptyFeatureUsed /// the operation is restarted and does not use the previous feature
};
bool isTangentArc(ModuleBase_Operation* theOperation,
const std::shared_ptr<ModelAPI_CompositeFeature>& /*theSketch*/) const;
- /// Accept All action is enabled if an internal edit is started. It updates the state of the button
+ /// Accept All action is enabled if an internal edit is started.
+ /// It updates the state of the button
void updateAcceptAllAction();
/// Returns the workshop
}
-std::shared_ptr<GeomAPI_Pnt> PartSet_Tools::convertTo3D(const double theX, const double theY, FeaturePtr theSketch)
+std::shared_ptr<GeomAPI_Pnt> PartSet_Tools::convertTo3D(const double theX, const double theY,
+ FeaturePtr theSketch)
{
std::shared_ptr<ModelAPI_Data> aData = theSketch->data();
return aFeaturePoint;
}
-std::shared_ptr<GeomDataAPI_Point2D> PartSet_Tools::findFirstEqualPoint(const FeaturePtr& theFeature,
- const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+std::shared_ptr<GeomDataAPI_Point2D> PartSet_Tools::findFirstEqualPoint(
+ const FeaturePtr& theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
{
std::shared_ptr<GeomDataAPI_Point2D> aFPoint;
std::shared_ptr<ModelAPI_Data> aData = aMyFeature->data();
std::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
- std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Line::START_ID()));
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ aData->attribute(SketchPlugin_Line::START_ID()));
std::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
- std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Line::END_ID()));
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ aData->attribute(SketchPlugin_Line::END_ID()));
aPoint1->setValue(aPnt2d1);
aPoint2->setValue(aPnt2d2);
ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
// selection shape has no result owner => the trihedron axis
- // TODO: make reference to the real axes when they are implemented in the initialization plugin
+ // TODO: make reference to the real axes when
+ // they are implemented in the initialization plugin
if (!aRes.get()) {
ObjectPtr aPointObj = ModelAPI_Session::get()->moduleDocument()->objectByName(
ModelAPI_ResultConstruction::group(), "Origin");
(aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
- // if there is no object, it means that this is the origin point: search it in the module document
+ // if there is no object,
+ // it means that this is the origin point: search it in the module document
if (!aRes.get()) {
ObjectPtr aPointObj = ModelAPI_Session::get()->moduleDocument()->objectByName(
ModelAPI_ResultConstruction::group(), "Origin");
std::shared_ptr<GeomAPI_Pnt2d> aPnt2d = convertTo2D(theSketch, aPnt);
std::shared_ptr<GeomDataAPI_Point2D> aPoint =
- std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Point::COORD_ID()));
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ aData->attribute(SketchPlugin_Point::COORD_ID()));
aPoint->setValue(aPnt2d);
if ((aPnt->x() < Precision::Confusion()) &&
(aPnt->y() < Precision::Confusion()) &&
return false;
}
-ResultPtr PartSet_Tools::findExternalEdge(CompositeFeaturePtr theSketch, std::shared_ptr<GeomAPI_Edge> theEdge)
+ResultPtr PartSet_Tools::findExternalEdge(CompositeFeaturePtr theSketch,
+ std::shared_ptr<GeomAPI_Edge> theEdge)
{
for (int i = 0; i < theSketch->numberOfSubs(); i++) {
FeaturePtr aFeature = theSketch->subFeature(i);
}
-ResultPtr PartSet_Tools::findExternalVertex(CompositeFeaturePtr theSketch, std::shared_ptr<GeomAPI_Vertex> theVert)
+ResultPtr PartSet_Tools::findExternalVertex(CompositeFeaturePtr theSketch,
+ std::shared_ptr<GeomAPI_Vertex> theVert)
{
for (int i = 0; i < theSketch->numberOfSubs(); i++) {
FeaturePtr aFeature = theSketch->subFeature(i);
return aShape;
}
-std::shared_ptr<GeomAPI_Pnt2d> PartSet_Tools::getPoint(std::shared_ptr<ModelAPI_Feature>& theFeature,
- const std::string& theAttribute)
+std::shared_ptr<GeomAPI_Pnt2d> PartSet_Tools::getPoint(
+ std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::string& theAttribute)
{
std::shared_ptr<GeomDataAPI_Point2D> aPointAttr = ModelGeomAlgo_Point2D::getPointOfRefAttr(
theFeature.get(), theAttribute, SketchPlugin_Point::ID(),
return std::shared_ptr<GeomAPI_Pnt2d>();
}
-FeaturePtr findFirstCoincidenceByData(const DataPtr& theData, std::shared_ptr<GeomAPI_Pnt2d> thePoint)
+FeaturePtr findFirstCoincidenceByData(const DataPtr& theData,
+ std::shared_ptr<GeomAPI_Pnt2d> thePoint)
{
FeaturePtr aCoincident;
std::shared_ptr<GeomAPI_Pnt2d> PartSet_Tools::getCoincedencePoint(FeaturePtr theStartCoin)
{
std::shared_ptr<GeomAPI_Pnt2d> aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(),
- SketchPlugin_Constraint::ENTITY_A());
+ SketchPlugin_Constraint::ENTITY_A());
if (aPnt.get() == NULL)
aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(), SketchPlugin_Constraint::ENTITY_B());
return aPnt;
if (!aCurPoint->isInitialized())
continue;
- std::shared_ptr<GeomAPI_Pnt> aPnt = convertTo3D(aCurPoint->x(), aCurPoint->y(), theSketch);
+ std::shared_ptr<GeomAPI_Pnt> aPnt =
+ convertTo3D(aCurPoint->x(), aCurPoint->y(), theSketch);
if (aPnt && (aPnt->distance(aValue) < Precision::Confusion())) {
anAttribute = aCurPoint;
break;
/// \param theSketch the sketch feature
/// \param thePnt the 3D point in the viewer
/// \returns the converted point object
- static std::shared_ptr<GeomAPI_Pnt2d> convertTo2D(FeaturePtr theSketch, const std::shared_ptr<GeomAPI_Pnt>& thePnt);
+ static std::shared_ptr<GeomAPI_Pnt2d> convertTo2D(FeaturePtr theSketch,
+ const std::shared_ptr<GeomAPI_Pnt>& thePnt);
/// \brief Converts the 2D projected coodinates on the sketch plane to the 3D point.
/// \param theX the X coordinate
/// \param theY the Y coordinate
/// \param theSketch the sketch feature
- static std::shared_ptr<GeomAPI_Pnt> convertTo3D(const double theX, const double theY, FeaturePtr theSketch);
+ static std::shared_ptr<GeomAPI_Pnt> convertTo3D(const double theX, const double theY,
+ FeaturePtr theSketch);
/// Returns pointer to the root document.
static std::shared_ptr<ModelAPI_Document> document();
/// \param theView a 3D view
/// \param theX the output horizontal coordinate of the point
/// \param theY the output vertical coordinate of the point
- static bool hasVertexShape(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs, FeaturePtr theSketch,
+ static bool hasVertexShape(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
+ FeaturePtr theSketch,
Handle_V3d_View theView, double& theX, double& theY);
{
std::shared_ptr<GeomAPI_Pln> aEmptyPln;
if (theOperation) {
- ModuleBase_OperationFeature* aFeatureOp = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+ ModuleBase_OperationFeature* aFeatureOp =
+ dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
if (aFeatureOp) {
CompositeFeaturePtr aFeature =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFeatureOp->feature());
bool isEmptySelectionValid(ModuleBase_Operation* theOperation)
{
- ModuleBase_OperationFeature* aFeatureOp = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+ ModuleBase_OperationFeature* aFeatureOp =
+ dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
// during the create operation empty selection is always valid
if (!aFeatureOp->isEditOperation()) {
return true;
else
return false;
}
- else// in edit operation an empty selection is always valid, performed for re-entrant operrations
+ else
+ // in edit operation an empty selection is always valid, performed for re-entrant operrations
return true;
}
}
-bool PartSet_DistanceSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const
+bool PartSet_DistanceSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
{
if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
return isEmptySelectionValid(theOperation);
}
}
-bool PartSet_LengthSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const
+bool PartSet_LengthSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
{
if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
return isEmptySelectionValid(theOperation);
}
}
-bool PartSet_PerpendicularSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const
+bool PartSet_PerpendicularSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
{
if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
return isEmptySelectionValid(theOperation);
}
}
-bool PartSet_ParallelSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const
+bool PartSet_ParallelSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
{
if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
return isEmptySelectionValid(theOperation);
}
}
-bool PartSet_RadiusSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const
+bool PartSet_RadiusSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
{
if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
return isEmptySelectionValid(theOperation);
} else {
- QList<ModuleBase_ViewerPrsPtr> aList = theSelection->getSelected(ModuleBase_ISelection::Viewer);
+ QList<ModuleBase_ViewerPrsPtr> aList =
+ theSelection->getSelected(ModuleBase_ISelection::Viewer);
int aCount = 0;
foreach (ModuleBase_ViewerPrsPtr aPrs, aList) {
const GeomShapePtr& aShape = aPrs->shape();
}
}
-bool PartSet_RigidSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const
+bool PartSet_RigidSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
{
if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
return isEmptySelectionValid(theOperation);
} else {
- QList<ModuleBase_ViewerPrsPtr> aList = theSelection->getSelected(ModuleBase_ISelection::Viewer);
+ QList<ModuleBase_ViewerPrsPtr> aList =
+ theSelection->getSelected(ModuleBase_ISelection::Viewer);
return (aList.count() == 1);
}
}
-bool PartSet_CoincidentSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const
+bool PartSet_CoincidentSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
{
if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
return isEmptySelectionValid(theOperation);
}
}
-bool PartSet_HVDirSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const
+bool PartSet_HVDirSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
{
if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
return isEmptySelectionValid(theOperation);
}
}
-bool PartSet_FilletSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const
+bool PartSet_FilletSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
{
if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
return isEmptySelectionValid(theOperation);
}
}
-bool PartSet_TangentSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const
+bool PartSet_TangentSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
{
if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
return isEmptySelectionValid(theOperation);
}
}
-bool PartSet_AngleSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const
+bool PartSet_AngleSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
{
if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
return isEmptySelectionValid(theOperation);
}
}
-bool PartSet_EqualSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const
+bool PartSet_EqualSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
{
if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
return isEmptySelectionValid(theOperation);
} else {
- QList<ModuleBase_ViewerPrsPtr> aList = theSelection->getSelected(ModuleBase_ISelection::Viewer);
+ QList<ModuleBase_ViewerPrsPtr> aList =
+ theSelection->getSelected(ModuleBase_ISelection::Viewer);
int aCount = 0;
int aType = 0;
foreach (ModuleBase_ViewerPrsPtr aPrs, aList) {
}
}
-bool PartSet_CollinearSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const
+bool PartSet_CollinearSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
{
if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
return isEmptySelectionValid(theOperation);
}
}
-bool PartSet_MiddlePointSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const
+bool PartSet_MiddlePointSelection::isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const
{
if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0)
return isEmptySelectionValid(theOperation);
{
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
- // the type of validated attributes should be equal, attributes with different types are not validated
+ // the type of validated attributes should be equal, attributes with
+ // different types are not validated
// Check RefAttr attributes
std::string anAttrType = theAttribute->attributeType();
std::list<std::shared_ptr<ModelAPI_Attribute> > anAttrs;
if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) {
- AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
+ AttributeRefAttrPtr anAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
bool isObject = anAttr->isObject();
ObjectPtr anObject = anAttr->object();
for(; anAttrIter != anAttrs.end(); anAttrIter++) {
if ((*anAttrIter).get() && (*anAttrIter)->id() != theAttribute->id()) {
std::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
- std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttrIter);
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttrIter);
if (aRef->isObject() != isObject)
continue;
if (isObject) {
}
}
else if (anAttrType == ModelAPI_AttributeSelection::typeId()) {
- AttributeSelectionPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
+ AttributeSelectionPtr anAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
ResultPtr aContext = anAttr->context();
GeomShapePtr aShape = anAttr->value();
for(; anAttr != anAttrs.end(); anAttr++) {
if ((*anAttr).get() && (*anAttr)->id() != theAttribute->id()) {
std::shared_ptr<ModelAPI_AttributeSelection> aRef =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(*anAttr);
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(*anAttr);
// check the object is already presented
if (aRef->context() == aContext) {
bool aHasShape = aShape.get() != NULL;
}
}
else if (anAttrType == ModelAPI_AttributeReference::typeId()) {
- AttributeReferencePtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
+ AttributeReferencePtr anAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
ObjectPtr anObject = anAttr->value();
// Check selection attributes
anAttrs = aFeature->data()->attributes(ModelAPI_AttributeReference::typeId());
for(int j = 0; j < aRefSelList->size(); j++) {
std::shared_ptr<ModelAPI_AttributeSelection> aRefSel = aRefSelList->value(j);
ResultPtr aRefSelContext = aRefSel->context();
- ResultCompSolidPtr aRefSelCompSolidPtr = ModelAPI_Tools::compSolidOwner(aRefSelContext);
+ ResultCompSolidPtr aRefSelCompSolidPtr =
+ ModelAPI_Tools::compSolidOwner(aRefSelContext);
std::shared_ptr<GeomAPI_Shape> aRefSelCompSolid;
if(aRefSelCompSolidPtr.get()) {
aRefSelCompSolid = aRefSelCompSolidPtr->shape();
class PartSet_DistanceSelection : public ModuleBase_SelectionValidator
{
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
};
//! \ingroup Validators
class PartSet_LengthSelection : public ModuleBase_SelectionValidator
{
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
};
//! \ingroup Validators
class PartSet_PerpendicularSelection : public ModuleBase_SelectionValidator
{
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
};
//! \ingroup Validators
class PartSet_ParallelSelection : public ModuleBase_SelectionValidator
{
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
};
//! \ingroup Validators
class PartSet_RadiusSelection : public ModuleBase_SelectionValidator
{
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
};
//! \ingroup Validators
class PartSet_RigidSelection : public ModuleBase_SelectionValidator
{
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
};
class PartSet_CoincidentSelection : public ModuleBase_SelectionValidator
{
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
};
//! \ingroup Validators
class PartSet_HVDirSelection : public ModuleBase_SelectionValidator
{
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
};
//! \ingroup Validators
class PartSet_TangentSelection : public ModuleBase_SelectionValidator
{
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
};
//! \ingroup Validators
class PartSet_FilletSelection : public ModuleBase_SelectionValidator
{
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
};
//! \ingroup Validators
class PartSet_AngleSelection : public ModuleBase_SelectionValidator
{
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
};
//! \ingroup Validators
class PartSet_EqualSelection : public ModuleBase_SelectionValidator
{
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
};
//! \ingroup Validators
class PartSet_CollinearSelection : public ModuleBase_SelectionValidator
{
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
};
//! \ingroup Validators
class PartSet_MiddlePointSelection : public ModuleBase_SelectionValidator
{
public:
- PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const;
+ PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection,
+ ModuleBase_Operation* theOperation) const;
};
////////////// Attribute validators ////////////////
DataPtr aData = myFeature->data();
AttributeStringPtr aStringAttr = aData->string(ExchangePlugin_ExportFeature::FILE_PATH_ID());
- mySelectedFilter = formatToFilter(shortFormatToFullFormat(QString::fromStdString(aStringAttr->value())));
+ mySelectedFilter =
+ formatToFilter(shortFormatToFullFormat(QString::fromStdString(aStringAttr->value())));
return ModuleBase_WidgetFileSelector::restoreValueCustom();
}
aShape = aResult->shape();
}
if (aShape.get() != NULL && !aShape->isNull())
- anExternalObject = myExternalObjectMgr->externalObject(theObject, aShape, sketch(), myIsInValidate);
+ anExternalObject =
+ myExternalObjectMgr->externalObject(theObject, aShape, sketch(), myIsInValidate);
}
else {
anExternalObject = theObject;
ModuleBase_ParamSpinBox* myXSpin; ///< the spin box for the X coordinate
ModuleBase_ParamSpinBox* myYSpin; ///< the spin box for the Y coordinate
- std::shared_ptr<ModuleBase_ViewerPrs> myPreSelected; ///< value used as selection in mouse release method
- ///< it is important during restart operation
+ /// value used as selection in mouse release method
+ std::shared_ptr<ModuleBase_ViewerPrs> myPreSelected;
+
+ /// it is important during restart operation
CompositeFeaturePtr mySketch;
bool myValueIsCashed; /// boolean state if the value is cashed during value state change
}
}
-double PartSet_WidgetPoint2dDistance::computeValue(const std::shared_ptr<GeomAPI_Pnt2d>& theFirstPnt,
- const std::shared_ptr<GeomAPI_Pnt2d>& theCurrentPnt)
+double PartSet_WidgetPoint2dDistance::computeValue(
+ const std::shared_ptr<GeomAPI_Pnt2d>& theFirstPnt,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theCurrentPnt)
{
return theCurrentPnt->distance(theFirstPnt);
}
-void PartSet_WidgetPoint2dDistance::mouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
+void PartSet_WidgetPoint2dDistance::mouseReleased(ModuleBase_IViewWindow* theWnd,
+ QMouseEvent* theEvent)
{
// the contex menu release by the right button should not be processed by this widget
if (theEvent->button() != Qt::LeftButton)
emit focusOutWidget(this);
}
-void PartSet_WidgetPoint2dDistance::mouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
+void PartSet_WidgetPoint2dDistance::mouseMoved(ModuleBase_IViewWindow* theWnd,
+ QMouseEvent* theEvent)
{
if (isEditingMode())
return;
/// \return true if the widget current value is reset
virtual bool resetCustom();
- /// Set the second point which defines a value in the widget as a distance with a first point defined by feature
+ /// Set the second point which defines a value in the widget as
+ /// a distance with a first point defined by feature
void setPoint(FeaturePtr theFeature, const std::shared_ptr<GeomAPI_Pnt2d>& thePnt);
/// Compute the distance between points
bool aDone = false;
if (!startSketchOperation(theValues)) {
myIsCustomAttribute = true;
- QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
+ QList<ModuleBase_ViewerPrsPtr>::const_iterator
+ anIt = theValues.begin(), aLast = theValues.end();
bool aProcessed = false;
for (; anIt != aLast; anIt++) {
ModuleBase_ViewerPrsPtr aValue = *anIt;
emit valuesChanged();
updateObject(myFeature);
setVisibleSelectionControl(false);
- // manually deactivation because the widget was not activated as has no focus acceptin controls
+ // manually deactivation because the widget was
+ // not activated as has no focus acceptin controls
deactivate();
emit focusOutWidget(this);
}
{
}
-bool PartSet_WidgetSketchCreator::startSketchOperation(const QList<ModuleBase_ViewerPrsPtr>& theValues)
+bool PartSet_WidgetSketchCreator::startSketchOperation(
+ const QList<ModuleBase_ViewerPrsPtr>& theValues)
{
bool aSketchStarted = false;
/// sketch should not started by object(face) selected as global. If Local face is selected,
/// sketch is started
if (aResult.get() && aValue->shape().get() && aResult->shape()->isEqual(aValue->shape())) {
- ResultConstructionPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aResult);
+ ResultConstructionPtr aConstruction =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aResult);
if (!aConstruction.get() || !aConstruction->isInfinite())
return aSketchStarted;
}
return true;
}
else
- connect(myModule, SIGNAL(resumed(ModuleBase_Operation*)), SLOT(onResumed(ModuleBase_Operation*)));
+ connect(myModule, SIGNAL(resumed(ModuleBase_Operation*)),
+ SLOT(onResumed(ModuleBase_Operation*)));
return true;
}
XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop());
// TODO(spo): translate
QMessageBox::question(aWorkshop->desktop(), tr("Apply current feature"),
- tr("Sketch is invalid and will be deleted.\nError: %1").arg(anError.messageString().c_str()),
+ tr("Sketch is invalid and will be deleted.\nError: %1")
+ .arg(anError.messageString().c_str()),
QMessageBox::Ok);
}
return isValidPComposite;
}
-void PartSet_WidgetSketchCreator::setSketchObjectToList(const CompositeFeaturePtr& theCompositeFeature,
- const AttributePtr& theAttribute)
+void PartSet_WidgetSketchCreator::setSketchObjectToList(
+ const CompositeFeaturePtr& theCompositeFeature,
+ const AttributePtr& theAttribute)
{
if (!theCompositeFeature.get() || theCompositeFeature->numberOfSubs() != 1)
return;
}
ResultPtr aSketchRes = aSketchFeature->results().front();
- ResultConstructionPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aSketchRes);
+ ResultConstructionPtr aConstruction =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aSketchRes);
if(!aConstruction.get()) {
return;
}
/// \return a control list
virtual QList<QWidget*> getControls() const;
- /// 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();
myViewInverted = new QCheckBox(tr("Reversed"), aViewBox);
aViewLayout->addWidget(myViewInverted);
- QPushButton* aSetViewBtn = new QPushButton(QIcon(":icons/plane_view.png"), tr("Set plane view"), aViewBox);
+ QPushButton* aSetViewBtn =
+ new QPushButton(QIcon(":icons/plane_view.png"), tr("Set plane view"), aViewBox);
connect(aSetViewBtn, SIGNAL(clicked(bool)), this, SLOT(onSetPlaneView()));
aViewLayout->addWidget(aSetViewBtn);
}
}
-bool PartSet_WidgetSketchLabel::setSelectionInternal(const QList<ModuleBase_ViewerPrsPtr>& theValues,
- const bool theToValidate)
+bool PartSet_WidgetSketchLabel::setSelectionInternal(
+ const QList<ModuleBase_ViewerPrsPtr>& theValues,
+ const bool theToValidate)
{
bool aDone = false;
if (theValues.empty()) {
/// find the points in coincident features
PntToAttributesMap aRefAttributes = myCashedReferences[aBaseObject];
- PntToAttributesMap::const_iterator aRIt = aRefAttributes.begin(), aRLast = aRefAttributes.end();
+ PntToAttributesMap::const_iterator
+ aRIt = aRefAttributes.begin(), aRLast = aRefAttributes.end();
for (; aRIt != aRLast; aRIt++) {
std::shared_ptr<GeomDataAPI_Point2D> anAttribute = aRIt->first;
std::shared_ptr<GeomAPI_Pnt> aPoint = aRIt->second;