-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: PartSet_SketcherMgr.cpp
-// Created: 19 Dec 2014
-// Author: Vitaly SMETANNIKOV
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
#include "PartSet_SketcherMgr.h"
#include "PartSet_SketcherReentrantMgr.h"
#include "PartSet_WidgetEditor.h"
#include "PartSet_ResultSketchPrs.h"
#include "PartSet_ExternalPointsMgr.h"
+#include "PartSet_PreviewSketchPlane.h"
#include <XGUI_ModuleConnector.h>
#include <XGUI_Displayer.h>
#include <SketchPlugin_MultiRotation.h>
#include <SketchPlugin_MultiTranslation.h>
#include <SketchPlugin_IntersectionPoint.h>
+#include <SketchPlugin_Projection.h>
#include <SketcherPrs_Tools.h>
myIsConstraintsShown[PartSet_Tools::Geometrical] = true;
myIsConstraintsShown[PartSet_Tools::Dimensional] = true;
myIsConstraintsShown[PartSet_Tools::Expressions] = false;
+
+ mySketchPlane = new PartSet_PreviewSketchPlane();
}
PartSet_SketcherMgr::~PartSet_SketcherMgr()
gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), aView);
Point aMousePnt;
get2dPoint(theWnd, theEvent, aMousePnt);
-#ifndef SUPPORT_NEW_MOVE
- double dX = aMousePnt.myCurX - myCurrentPoint.myCurX;
- double dY = aMousePnt.myCurY - myCurrentPoint.myCurY;
-#else
+
std::shared_ptr<GeomAPI_Pnt2d> anOriginalPosition = std::shared_ptr<GeomAPI_Pnt2d>(
new GeomAPI_Pnt2d(myCurrentPoint.myCurX, myCurrentPoint.myCurY));
std::shared_ptr<GeomAPI_Pnt2d> aCurrentPosition = std::shared_ptr<GeomAPI_Pnt2d>(
new GeomAPI_Pnt2d(aMousePnt.myCurX, aMousePnt.myCurY));
-#endif
+
ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(aAttrId));
if (aPoint.get() != NULL) {
bool isImmutable = aPoint->setImmutable(true);
-#ifndef SUPPORT_NEW_MOVE
- aPoint->move(dX, dY);
- ModelAPI_EventCreator::get()->sendUpdated(aFeature, aMoveEvent);
-#else
+
std::shared_ptr<ModelAPI_ObjectMovedMessage> aMessage = std::shared_ptr
<ModelAPI_ObjectMovedMessage>(new ModelAPI_ObjectMovedMessage(this));
aMessage->setMovedAttribute(aPoint);
aMessage->setOriginalPosition(anOriginalPosition);
aMessage->setCurrentPosition(aCurrentPosition);
Events_Loop::loop()->send(aMessage);
-#endif
+
isModified = true;
aPoint->setImmutable(isImmutable);
}
std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
if (aSketchFeature) {
-#ifndef SUPPORT_NEW_MOVE
- aSketchFeature->move(dX, dY);
- ModelAPI_EventCreator::get()->sendUpdated(aSketchFeature, aMoveEvent);
-#else
std::shared_ptr<ModelAPI_ObjectMovedMessage> aMessage = std::shared_ptr
<ModelAPI_ObjectMovedMessage>(new ModelAPI_ObjectMovedMessage(this));
aMessage->setMovedObject(aFeature);
aMessage->setOriginalPosition(anOriginalPosition);
aMessage->setCurrentPosition(aCurrentPosition);
Events_Loop::loop()->send(aMessage);
-#endif
isModified = true;
}
}
FeaturePtr aFeature = myCurrentSelection.begin().key();
std::shared_ptr<SketchPlugin_Feature> aSPFeature =
std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
- if (aSPFeature && (!aSPFeature->isExternal())) {
- myModule->editFeature(aSPFeature);
+ if (aSPFeature) {
+ if (!aSPFeature->isExternal())
+ myModule->editFeature(aSPFeature);
+ else {
+ FeaturePtr aProjectionFeature = PartSet_Tools::findRefsToMeFeature(aFeature,
+ SketchPlugin_Projection::ID());
+ if (aProjectionFeature.get())
+ myModule->editFeature(aProjectionFeature);
+ }
}
}
}
// Display all sketcher sub-Objects
myCurrentSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFOperation->feature());
+ mySketchPlane->createSketchPlane(myCurrentSketch, myModule->workshop());
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
// Hide sketcher result
XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
// The sketch was aborted
myCurrentSketch = CompositeFeaturePtr();
+ mySketchPlane->eraseSketchPlane(myModule->workshop());
// TODO: move this outside of if-else
myModule->workshop()->viewer()->removeSelectionFilter(myCirclePointFilter);
myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter);
myCurrentSketch->setDisplayed(true);
myCurrentSketch = CompositeFeaturePtr();
+ mySketchPlane->eraseSketchPlane(myModule->workshop());
myModule->workshop()->viewer()->removeSelectionFilter(myCirclePointFilter);
myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter);
Events_Loop::loop()->flush(aDispEvent);
}
- myModule->overconstraintListener()->setActive(false);
// restore the module selection modes, which were changed on startSketch
aConnector->activateModuleSelectionModes();
}
void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOperation)
{
+ previewSketchPlane()->updatePlaneSize(activeSketch(), myModule->workshop());
myIsMouseOverViewProcessed = true;
operationMgr()->onValidateOperation();
// when sketch nested operation is stopped the cursor should be restored unconditionally