/// Signal emited on selection changed
void contextMenuRequested(QContextMenuEvent*);
+
+ /// Signal emitted on transformation of view point in view window
+ /// \param theTransformation type of transformation (see AppElements_ViewWindow::OperationType)
+ void viewTransformed(int theTransformation);
};
#endif
GeomAPI
GeomValidators
GeomDataAPI
+ SketcherPrs
${QT_LIBRARIES}
${CAS_KERNEL}
${CAS_SHAPE}
${CMAKE_SOURCE_DIR}/src/GeomDataAPI
${CMAKE_SOURCE_DIR}/src/GeomAlgoAPI
${CMAKE_SOURCE_DIR}/src/SketchPlugin
+ ${CMAKE_SOURCE_DIR}/src/SketcherPrs
${CMAKE_SOURCE_DIR}/src/FeaturesPlugin
${CMAKE_SOURCE_DIR}/src/GeomAPI
${CMAKE_SOURCE_DIR}/src/GeomValidators
#include <SketchPlugin_ConstraintParallel.h>
#include <SketchPlugin_ConstraintPerpendicular.h>
#include <SketchPlugin_ConstraintRadius.h>
-//#include <SketchPlugin_ConstraintRigid.h>
+
+#include <SketcherPrs_SymbolPrs.h>
+#include <SketcherPrs_Tools.h>
#include <Events_Loop.h>
#include <Config_PropManager.h>
: ModuleBase_IModule(theWshop),
myRestartingMode(RM_None), myVisualLayerId(0)
{
- //myWorkshop = dynamic_cast<XGUI_Workshop*>(theWshop);
mySketchMgr = new PartSet_SketcherMgr(this);
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(theWshop);
ModuleBase_IViewer* aViewer = theWshop->viewer();
connect(aViewer, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*)),
this, SLOT(onKeyRelease(ModuleBase_IViewWindow*, QKeyEvent*)));
+ connect(aViewer, SIGNAL(viewTransformed(int)),
+ SLOT(onViewTransformed(int)));
createActions();
}
{
Handle(AIS_InteractiveObject) anAIS = theAIS->impl<Handle(AIS_InteractiveObject)>();
if (!anAIS.IsNull()) {
+ Handle(AIS_InteractiveContext) aCtx = anAIS->GetContext();
Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(anAIS);
if (!aDim.IsNull()) {
- Handle(AIS_InteractiveContext) aCtx = anAIS->GetContext();
aCtx->SetZLayer(aDim, myVisualLayerId);
+ } else {
+ Handle(SketcherPrs_SymbolPrs) aCons = Handle(SketcherPrs_SymbolPrs)::DownCast(anAIS);
+ if (!aCons.IsNull())
+ aCtx->SetZLayer(aCons, myVisualLayerId);
}
}
}
+void PartSet_Module::onViewTransformed(int theTrsfType)
+{
+ // Set length of arrows constant in pixel size
+ // if the operation is panning or rotate or panglobal then do nothing
+ if ((theTrsfType == 1) || (theTrsfType == 3) || (theTrsfType == 4))
+ return;
+
+ ModuleBase_IViewer* aViewer = myWorkshop->viewer();
+ Handle(V3d_View) aView = aViewer->activeView();
+
+ XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
+ XGUI_Workshop* aWorkshop = aConnector->workshop();
+ XGUI_Displayer* aDisplayer = aWorkshop->displayer();
+ Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+
+ double aLen = aView->Convert(25);
+
+ SketcherPrs_Tools::setArrowSize(aLen);
+ bool isModified = false;
+ QList<AISObjectPtr> aPrsList = aDisplayer->displayedPresentations();
+ foreach (AISObjectPtr aAIS, aPrsList) {
+ Handle(AIS_InteractiveObject) aAisObj = aAIS->impl<Handle(AIS_InteractiveObject)>();
+
+ Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(aAisObj);
+ if (!aDim.IsNull()) {
+ aDim->DimensionAspect()->ArrowAspect()->SetLength(aLen);
+ aContext->Redisplay(aDim, false);
+ isModified = true;
+ }
+ }
+ if (isModified)
+ aDisplayer->updateViewer();
+}
/// if it is a sketch operation
/// \param theObject a model object
virtual bool canDisplayObject(const ObjectPtr& theObject) const;
+
/// Add menu atems for viewer into the given menu
/// \param theMenu a popup menu to be shown in the viewer
virtual void addViewerItems(QMenu* theMenu) const;
/// Processing of vertex selected
void onVertexSelected();
+ /// Called on transformation in current viewer
+ /// \param theTrsfType type of tranformation
+ void onViewTransformed(int theTrsfType = 2);
+
private:
/// Breaks sequense of automatically resterted operations
void breakOperationSequence();
#include <ModelAPI_Data.h>
-const int CONSTRAINT_TEXT_HEIGHT = 20; /// the text height of the constraint
-const int CONSTRAINT_TEXT_SELECTION_TOLERANCE = 20; /// the text selection tolerance
-
-
static const gp_Pnt MyDefStart(0,0,0);
static const gp_Pnt MyDefEnd(1,0,0);
static const gp_Pln MyDefPln(gp_Pnt(0,0,0), gp_Dir(0,0,1));
-
-
+static const double MyTextHeight = 20;
IMPLEMENT_STANDARD_HANDLE(SketcherPrs_LengthDimension, AIS_LengthDimension);
IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_LengthDimension, AIS_LengthDimension);
myAspect->MakeText3d(false);
myAspect->MakeTextShaded(false);
myAspect->MakeUnitsDisplayed(false);
+ myAspect->TextAspect()->SetHeight(MyTextHeight);
+ myAspect->ArrowAspect()->SetLength(SketcherPrs_Tools::getArrowSize());
+ SetSelToleranceForText2d(MyTextHeight);
SetDimensionAspect(myAspect);
- SetSelToleranceForText2d(CONSTRAINT_TEXT_SELECTION_TOLERANCE);
}
aFlyout = aDist;
SetFlyout(aFlyout);
- myAspect->TextAspect()->SetHeight(CONSTRAINT_TEXT_HEIGHT);
- myAspect->ArrowAspect()->SetLength(CONSTRAINT_TEXT_HEIGHT * 2);
-
SetMeasuredGeometry(aPnt1, aPnt2, myPlane->impl<gp_Ax3>());
AIS_LengthDimension::Compute(thePresentationManager, thePresentation, theMode);
}
// Author: Vitaly SMETANNIKOV
#include "SketcherPrs_Radius.h"
+#include "SketcherPrs_Tools.h"
#include <SketchPlugin_ConstraintRadius.h>
#include <SketchPlugin_Constraint.h>
#include <GeomAPI_XYZ.h>
#include <ModelAPI_AttributeDouble.h>
-const int CONSTRAINT_TEXT_HEIGHT = 20; /// the text height of the constraint
-const int CONSTRAINT_TEXT_SELECTION_TOLERANCE = 20; /// the text selection tolerance
-
-static gp_Circ MyDefCirc(gp_Ax2(gp_Pnt(0,0,0), gp_Dir(0,0,1)), 1);
+static const gp_Circ MyDefCirc(gp_Ax2(gp_Pnt(0,0,0), gp_Dir(0,0,1)), 1);
+static const double MyTextHeight = 20;
IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Radius, AIS_RadiusDimension);
IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Radius, AIS_RadiusDimension);
myAspect->MakeText3d(false);
myAspect->MakeTextShaded(false);
myAspect->MakeUnitsDisplayed(false);
+ myAspect->TextAspect()->SetHeight(MyTextHeight);
+ myAspect->ArrowAspect()->SetLength(SketcherPrs_Tools::getArrowSize());
SetDimensionAspect(myAspect);
- SetSelToleranceForText2d(CONSTRAINT_TEXT_SELECTION_TOLERANCE);
+ SetSelToleranceForText2d(MyTextHeight);
}
SetMeasuredGeometry(aCircle.impl<gp_Circ>(), anAnchor->impl<gp_Pnt>());
SetCustomValue(aRadius);
- myAspect->TextAspect()->SetHeight(CONSTRAINT_TEXT_HEIGHT);
- myAspect->ArrowAspect()->SetLength(CONSTRAINT_TEXT_HEIGHT * 2.);
AIS_RadiusDimension::Compute(thePresentationManager, thePresentation, theMode);
}
DEFINE_STANDARD_HANDLE(SketcherPrs_SensitivePoint, Select3D_SensitiveEntity)
+/**
+* \ingroup GUI
+* This sensitive point is done in order to optimize process of the sinzitive area update
+* It referes on point array directly and this lets to avoid procedure of the point synchronisation
+*/
class SketcherPrs_SensitivePoint : public Select3D_SensitiveEntity
{
public:
return aLin2d.project(thePoint);
}
+
+static double MyArrowSize = 40.;
+double getArrowSize()
+{
+ return MyArrowSize;
+}
+
+void setArrowSize(double theSize)
+{
+ MyArrowSize = theSize;
+}
+
};
\ No newline at end of file
SKETCHERPRS_EXPORT std::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(DataPtr theData,
const std::string& theAttribute);
+ SKETCHERPRS_EXPORT double getArrowSize();
+
+ SKETCHERPRS_EXPORT void setArrowSize(double theSize);
};
#endif
\ No newline at end of file
/// Returns list of displayed objects
QObjectPtrList displayedObjects() const { return myResult2AISObjectMap.keys(); }
+ /// Returns list of displayed objects
+ QList<AISObjectPtr> displayedPresentations() const { return myResult2AISObjectMap.values(); }
+
/// Returns true if the given object can be shown in shaded mode
/// \param theObject object to check
bool canBeShaded(ObjectPtr theObject) const;
connect(aViewer, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
connect(aViewer, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this,
SIGNAL(contextMenuRequested(QContextMenuEvent*)));
+
+ // TODO: Connect to ViewTransformation signal
} else {
AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer();
{
theWnd->viewPort()->installEventFilter(this);
+ connect(theWnd, SIGNAL(vpTransformationFinished(AppElements_ViewWindow::OperationType)),
+ this, SLOT(onViewTransformed(AppElements_ViewWindow::OperationType)));
+
emit viewCreated(theWnd);
}
return true;
}
}
+
+void XGUI_ViewerProxy::onViewTransformed(AppElements_ViewWindow::OperationType theType)
+{
+ emit viewTransformed((int) theType);
+}
\ No newline at end of file
#include "XGUI.h"
#include <ModuleBase_IViewer.h>
+#include <AppElements_ViewWindow.h>
class XGUI_Workshop;
-class AppElements_ViewWindow;
-
/**
* \ingroup GUI
* Proxy class which repersents or AppElements_Viewer or Salome Viewer
void onKeyPress(AppElements_ViewWindow*, QKeyEvent*);
void onKeyRelease(AppElements_ViewWindow*, QKeyEvent*);
+ void onViewTransformed(AppElements_ViewWindow::OperationType);
+
private:
XGUI_Workshop* myWorkshop;
};