Edge/vertex selection modes for the line.
boost::shared_ptr<GeomAPI_Shape> aPreview = aPreviewOp->preview(theFeature);
if (aPreview) {
aDisplayer->RedisplayInLocalContext(theFeature, aPreview->impl<TopoDS_Shape>(),
- aPreviewOp->getSelectionMode(theFeature));
+ aPreviewOp->getSelectionModes(theFeature));
}
}
else {
{
}
-int PartSet_OperationSketch::getSelectionMode(boost::shared_ptr<ModelAPI_Feature> theFeature) const
+std::list<int> PartSet_OperationSketch::getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const
{
- int aMode = TopAbs_FACE;
- if (isEditMode())
- aMode = TopAbs_VERTEX;
- return aMode;
+ std::list<int> aModes;
+ if (!isEditMode())
+ aModes.push_back(TopAbs_FACE);
+ return aModes;
}
void PartSet_OperationSketch::setSelectedShapes(const NCollection_List<TopoDS_Shape>& theList)
/// Returns the operation local selection mode
/// \param theFeature the feature object to get the selection mode
/// \return the selection mode
- virtual int getSelectionMode(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
+ virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
/// Gives the current selected objects to be processed by the operation
/// \param theList a list of interactive selected shapes
/// Returns the operation local selection mode
/// \param theFeature the feature object to get the selection mode
/// \return the selection mode
- virtual int getSelectionMode(boost::shared_ptr<ModelAPI_Feature> theFeature) const = 0;
+ virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const = 0;
/// Gives the current selected objects to be processed by the operation
/// \param theList a list of interactive selected shapes
return true;
}
-int PartSet_OperationSketchLine::getSelectionMode(boost::shared_ptr<ModelAPI_Feature> theFeature) const
+std::list<int> PartSet_OperationSketchLine::getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const
{
- int aMode = 0;
+ std::list<int> aModes;
if (theFeature != feature())
- aMode = TopAbs_VERTEX;
- return aMode;
+ aModes.push_back(TopAbs_VERTEX);
+ return aModes;
}
void PartSet_OperationSketchLine::mouseReleased(const gp_Pnt& thePoint)
myPointSelectionMode = SM_FirstPoint;
document()->abortOperation();
}
+ else
+ myPointSelectionMode = SM_FirstPoint;
}
break;
default:
/// Returns the operation local selection mode
/// \param theFeature the feature object to get the selection mode
/// \return the selection mode
- virtual int getSelectionMode(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
+ virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
/// Gives the current selected objects to be processed by the operation
/// \param thePoint a point clicked in the viewer
void XGUI_Displayer::RedisplayInLocalContext(boost::shared_ptr<ModelAPI_Feature> theFeature,
const TopoDS_Shape& theShape,
- const int theMode, const bool isUpdateViewer)
+ const std::list<int>& theModes, const bool isUpdateViewer)
{
Handle(AIS_InteractiveContext) aContext = AISContext();
// Activate selection of objects from prs
if (!anAIS.IsNull()) {
if (anAIS->IsKind(STANDARD_TYPE(AIS_Shape))) {
- ic->Display(anAIS, 0/*display mode*/, AIS_Shape::SelectionMode((TopAbs_ShapeEnum)theMode),
- false/*update viewer*/, true/*allow decomposition*/);
- /*if (theMode == TopAbs_VERTEX) {
- ic->ActivateStandardMode(TopAbs_EDGE);
- ic->ActivateStandardMode(TopAbs_VERTEX);
- }*/
+ ic->Display(anAIS, false);
+ ic->Load(anAIS, -1, true/*allow decomposition*/);
+ std::list<int>::const_iterator anIt = theModes.begin(), aLast = theModes.end();
+ for (; anIt != aLast; anIt++)
+ ic->Activate(anAIS, AIS_Shape::SelectionMode((TopAbs_ShapeEnum)*anIt));
}
}
if (isUpdateViewer)
#include <map>
#include <vector>
+#include <list>
class XGUI_Viewer;
class ModelAPI_Feature;
/// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
void RedisplayInLocalContext(boost::shared_ptr<ModelAPI_Feature> theFeature,
const TopoDS_Shape& theShape,
- const int theMode, const bool isUpdateViewer = true);
+ const std::list<int>& theMode, const bool isUpdateViewer = true);
/// Erase the feature and a shape.
/// \param theFeature a feature instance