#include <set>
-#include <iostream>
-
//#define DEBUG_DO_NOT_BY_ENTER
//#define DEBUG_SKETCHER_ENTITIES
//#define DEBUG_SKETCH_ENTITIES_ON_MOVE
void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
{
- std::wcout << "PartSet_SketcherMgr::onMousePressed BEGIN" << std::endl;
-
MyModeByDrag = isDragModeCreation();
// Clear dragging mode
myMousePoint.setX(theEvent->x());
myMousePoint.setY(theEvent->y());
- if (myModule->sketchReentranceMgr()->processMousePressed(theWnd, theEvent)) {
- std::wcout << "PartSet_SketcherMgr::onMousePressed END A" << std::endl;
+ if (myModule->sketchReentranceMgr()->processMousePressed(theWnd, theEvent))
return;
- }
//get2dPoint(theWnd, theEvent, myClickedPoint);
- if (!(theEvent->buttons() & Qt::LeftButton)) {
- std::wcout << "PartSet_SketcherMgr::onMousePressed END B" << std::endl;
+ if (!(theEvent->buttons() & Qt::LeftButton))
return;
- }
ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
ModuleBase_IViewer* aViewer = aWorkshop->viewer();
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
(getCurrentOperation());
- if (!aFOperation) {
- std::wcout << "PartSet_SketcherMgr::onMousePressed END C" << std::endl;
+ if (!aFOperation)
return;
- }
bool isEditing = aFOperation->isEditOperation();
bool aCanDrag = aViewer->canDragByMouse();
if (isEditing) {
// If the current widget is a selector, do nothing, it processes the mouse press
ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
- if(anActiveWidget && anActiveWidget->isViewerSelector()) {
- std::wcout << "PartSet_SketcherMgr::onMousePressed END D" << std::endl;
+ if(anActiveWidget && anActiveWidget->isViewerSelector())
return;
- }
}
// Use only for sketch operations
if (myCurrentSketch) {
- if (!PartSet_Tools::sketchPlane(myCurrentSketch)) {
- std::wcout << "PartSet_SketcherMgr::onMousePressed END E" << std::endl;
+ if (!PartSet_Tools::sketchPlane(myCurrentSketch))
return;
- }
bool isSketcher = isSketchOperation(aFOperation);
bool isSketchOpe = isNestedSketchOperation(aFOperation);
// Avoid non-sketch operations
- if ((!isSketchOpe) && (!isSketcher)) {
- std::wcout << "PartSet_SketcherMgr::onMousePressed END F" << std::endl;
+ if ((!isSketchOpe) && (!isSketcher))
return;
- }
// Ignore creation sketch operation
if ((!isSketcher) && (!isEditing)) {
aProcessor->mouseReleased(theWnd, theEvent);
}
}
- std::wcout << "PartSet_SketcherMgr::onMousePressed END G" << std::endl;
return;
}
bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
if (!aFOperation->commit())
aFOperation->abort();
- std::wcout << "PartSet_SketcherMgr::onMousePressed END H" << std::endl;
return;
}
// Init flyout point for radius rotation
}
}
}
- std::wcout << "PartSet_SketcherMgr::onMousePressed END LAST" << std::endl;
}
void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
{
- std::wcout << "PartSet_SketcherMgr::onMouseMoved START" << std::endl;
#ifdef DEBUG_SKETCH_ENTITIES_ON_MOVE
CompositeFeaturePtr aSketch = activeSketch();
if (aSketch.get()) {
}
#endif
- if (myModule->sketchReentranceMgr()->processMouseMoved(theWnd, theEvent)) {
- std::wcout << "PartSet_SketcherMgr::onMouseMoved END A" << std::endl;
+ if (myModule->sketchReentranceMgr()->processMouseMoved(theWnd, theEvent))
return;
- }
ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
// mouse press signal in the viewer(it call Select for AIS context and the dragged objects are
// deselected). This flag should be restored in the slot, processed the mouse release signal.
ModuleBase_Operation* aCurrentOperation = getCurrentOperation();
- if (!aCurrentOperation) {
- std::wcout << "PartSet_SketcherMgr::onMouseMoved END B" << std::endl;
+ if (!aCurrentOperation)
return;
- }
- if (isSketchOperation(aCurrentOperation)) {
- std::wcout << "PartSet_SketcherMgr::onMouseMoved END C" << std::endl;
+ if (isSketchOperation(aCurrentOperation))
return; // No edit operation activated
- }
-
#ifdef DRAGGING_DEBUG
QTime t;
t.start();
get2dPoint(theWnd, theEvent, aMousePnt, true /*theSnap*/);
myCurrentPoint = aMousePnt;
}
-
- std::wcout << "PartSet_SketcherMgr::onMouseMoved END LAST" << std::endl;
}
void PartSet_SketcherMgr::onMouseDoubleClick(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
#include <cfloat>
#include <climits>
-#include <iostream>
-
const double MaxCoordinate = 1e12;
static QStringList MyFeaturesForCoincedence;
bool PartSet_WidgetPoint2D::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& theValue)
{
- std::wcout << "PartSet_WidgetPoint2D::isValidSelectionCustom BEGIN" << std::endl;
-
PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
if (aModule->sketchReentranceMgr()->isInternalEditActive())
return true; /// when internal edit is started a new feature is created. I has not results, AIS
const ModuleBase_ViewerPrsPtr& theValue,
const AttributePtr& theAttribute)
{
- std::wcout << "PartSet_WidgetPoint2D::isValidSelectionForAttribute_ BEGIN" << std::endl;
-
bool aValid = false;
// stores the current values of the widget attribute
bool PartSet_WidgetPoint2D::setSelectionCustom(const ModuleBase_ViewerPrsPtr& theValue)
{
- std::wcout << "PartSet_WidgetPoint2D::setSelectionCustom BEGIN" << std::endl;
-
bool isDone = false;
GeomShapePtr aShape = theValue->shape();
if (aShape.get() && !aShape->isNull()) {
bool PartSet_WidgetPoint2D::resetCustom()
{
- std::wcout << "PartSet_WidgetPoint2D::resetCustom BEGIN" << std::endl;
-
bool aDone = false;
if (!isUseReset() || isComputedDefault()
/*|| myXSpin->hasVariable() || myYSpin->hasVariable()*/) {
bool PartSet_WidgetPoint2D::setSelection(QList<ModuleBase_ViewerPrsPtr>& theValues,
const bool theToValidate)
{
- std::wcout << "PartSet_WidgetPoint2D::setSelection BEGIN" << std::endl;
-
bool isDone = false;
if (theValues.empty())
return isDone;
bool PartSet_WidgetPoint2D::setPoint(double theX, double theY)
{
- std::wcout << "PartSet_WidgetPoint2D::setPoint BEGIN" << std::endl;
-
if (fabs(theX) >= MaxCoordinate)
return false;
if (fabs(theY) >= MaxCoordinate)
bool PartSet_WidgetPoint2D::storeValueCustom()
{
- std::wcout << "PartSet_WidgetPoint2D::storeValueCustom BEGIN" << std::endl;
-
std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
if (!aData || !aData->isValid()) // can be on abort of sketcher element
return false;
bool PartSet_WidgetPoint2D::restoreValueCustom()
{
- std::wcout << "PartSet_WidgetPoint2D::restoreValueCustom BEGIN" << std::endl;
-
std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
AttributePoint2DPtr aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(attributeID()));
void PartSet_WidgetPoint2D::storeCurentValue()
{
- std::wcout << "PartSet_WidgetPoint2D::storeCurentValue BEGIN" << std::endl;
-
// do not use cash if a variable is used
//if (myXSpin->hasVariable() || myYSpin->hasVariable())
// return;
bool PartSet_WidgetPoint2D::restoreCurentValue()
{
- std::wcout << "PartSet_WidgetPoint2D::restoreCurentValue BEGIN" << std::endl;
-
bool aRestoredAndHidden = true;
bool isVisible = myIsFeatureVisibleInCash;
QList<QWidget*> PartSet_WidgetPoint2D::getControls() const
{
- std::wcout << "PartSet_WidgetPoint2D::getControls BEGIN" << std::endl;
-
QList<QWidget*> aControls;
aControls.append(myXSpin);
aControls.append(myYSpin);
//********************************************************************
void PartSet_WidgetPoint2D::selectionModes(int& theModuleSelectionModes, QIntList& theModes)
{
- std::wcout << "PartSet_WidgetPoint2D::selectionModes BEGIN" << std::endl;
-
theModuleSelectionModes = -1;
theModes << TopAbs_VERTEX;
theModes << TopAbs_EDGE;
//********************************************************************
void PartSet_WidgetPoint2D::activateCustom()
{
- std::wcout << "PartSet_WidgetPoint2D::activateCustom BEGIN" << std::endl;
-
if (!isEditingMode()) {
FeaturePtr aFeature = feature();
if (aFeature.get() && aFeature->getKind() == SketchPlugin_Point::ID())
void PartSet_WidgetPoint2D::deactivate()
{
- std::wcout << "PartSet_WidgetPoint2D::deactivate BEGIN" << std::endl;
-
// the value of the control should be stored to model if it was not
// initialized yet. It is important when we leave this control by Tab key.
// It should not be performed by the widget activation as the preview
bool PartSet_WidgetPoint2D::setConstraintToPoint(double theClickedX, double theClickedY,
const std::shared_ptr<ModuleBase_ViewerPrs>& theValue)
{
- std::wcout << "PartSet_WidgetPoint2D::setConstraintToPoint BEGIN" << std::endl;
-
AttributeRefAttrPtr aRefAttr = attributeRefAttr();
if (aRefAttr.get())
fillRefAttribute(theClickedX, theClickedY, theValue);
bool PartSet_WidgetPoint2D::setConstraintToObject(const ObjectPtr& theObject)
{
- std::wcout << "PartSet_WidgetPoint2D::setConstraintToObject BEGIN" << std::endl;
-
AttributeRefAttrPtr aRefAttr = attributeRefAttr();
if (aRefAttr.get()) {
fillRefAttribute(theObject);
void PartSet_WidgetPoint2D::processSelection(const ModuleBase_ViewerPrsPtr& theValue,
double theX, double theY)
{
- std::wcout << "PartSet_WidgetPoint2D::processSelection BEGIN" << std::endl;
-
if (!setPoint(theX, theY))
return;
// if we have selection and use it
ModuleBase_IViewWindow* theWnd,
QMouseEvent* theEvent)
{
- std::wcout << "PartSet_WidgetPoint2D::setPreSelection BEGIN" << std::endl;
-
myPreSelected = thePreSelected;
mouseReleased(theWnd, theEvent);
}
void PartSet_WidgetPoint2D::mouseMoved(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent)
{
- std::wcout << "PartSet_WidgetPoint2D:::mouseMoved BEGIN" << std::endl;
-
PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
- if (isEditingMode() || aModule->sketchReentranceMgr()->isInternalEditActive()) {
- std::wcout << "PartSet_WidgetPoint2D:::mouseMoved if (isEditingMode() || aModule->sketchReentranceMgr()->isInternalEditActive()) BEGIN" << std::endl;
+ if (isEditingMode() || aModule->sketchReentranceMgr()->isInternalEditActive())
return;
- }
double aX = 0, aY = 0; // Coords at sketch plane.
bool success = PartSet_MouseProcessor::convertPointToLocal(myWorkshop, mySketch, theWindow, theEvent->pos(), aX, aY, true, true, true);
bool PartSet_WidgetPoint2D::isFeatureContainsPoint(const FeaturePtr& theFeature,
double theX, double theY)
{
- std::wcout << "PartSet_WidgetPoint2D:::isFeatureContainsPoint BEGIN" << std::endl;
-
bool aPointIsFound = false;
if (feature()->getKind() != SketchPlugin_Line::ID())