// Author: Vitaly SMETANNIKOV
#include "SketcherPrs_Angle.h"
-#include "SketcherPrs_Tools.h"
#include "SketcherPrs_DimensionStyleListener.h"
+#include "SketcherPrs_Tools.h"
#include <SketchPlugin_ConstraintAngle.h>
#include <SketchPlugin_Constraint.h>
SetMeasuredGeometry(myFirstPoint, myCenterPoint, mySecondPoint);
#ifndef COMPILATION_CORRECTION
bool isReversedPlanes = isAnglePlaneReversedToSketchPlane();
- SetType(!isReversedPlanes ? AIS_TypeOfAngle::AIS_TOA_Exterior
- : AIS_TypeOfAngle::AIS_TOA_Interior);
+ SetType(!isReversedPlanes ? AIS_TOA_Exterior : AIS_TOA_Interior);
#endif
}
break;
gp_Vec(myCenterPoint, myFirstPoint).Normalized() * (-anEdge1Length));
SetMeasuredGeometry(aFirstPoint, myCenterPoint, mySecondPoint);
#ifndef COMPILATION_CORRECTION
- SetType(AIS_TypeOfAngle::AIS_TOA_Interior);
+ SetType(AIS_TOA_Interior);
#endif
}
break;
case SketcherPrs_Tools::ANGLE_BACKWARD: {
#ifndef COMPILATION_CORRECTION
- SetArrowsVisibility(AIS_TypeOfAngleArrowVisibility::AIS_TOAV_Second);
+ SetArrowsVisibility(AIS_TOAV_Second);
#endif
SetMeasuredGeometry(myFirstPoint, myCenterPoint, mySecondPoint);
bool isReversedPlanes = isAnglePlaneReversedToSketchPlane();
#ifndef COMPILATION_CORRECTION
- SetType(isReversedPlanes ? AIS_TypeOfAngle::AIS_TOA_Exterior
- : AIS_TypeOfAngle::AIS_TOA_Interior);
+ SetType(isReversedPlanes ? AIS_TOA_Exterior : AIS_TOA_Interior);
#endif
}
break;
#include <AIS_DisplaySpecialSymbol.hxx>
+/// Creates an aspect to be shown in length/radius dimension presentations
+/// \return an instance of aspect
+Handle(Prs3d_DimensionAspect) createDimensionAspect()
+{
+ Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect();
+ anAspect->MakeArrows3d(false);
+ anAspect->MakeText3d(false);
+ anAspect->MakeTextShaded(false);
+ anAspect->MakeUnitsDisplayed(false);
+ anAspect->TextAspect()->SetHeight(SketcherPrs_Tools::getDefaultTextHeight());
+ anAspect->ArrowAspect()->SetLength(SketcherPrs_Tools::getArrowSize());
+
+ return anAspect;
+}
+
+/// Update variable aspect parameters (depending on viewer scale)
+/// \param theDimAspect an aspect to be changed
+/// \param theDimValue an arrow value
+/// \param theTextSize an arrow value
+void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect,
+ double theDimValue, double theTextSize)
+{
+ double anArrowLength = theDimAspect->ArrowAspect()->Length();
+ // This is not realy correct way to get viewer scale.
+ double aViewerScale = (double) SketcherPrs_Tools::getDefaultArrowSize() / anArrowLength;
+
+ if(theTextSize > ((theDimValue - 3 * SketcherPrs_Tools::getArrowSize()) * aViewerScale)) {
+ theDimAspect->SetTextHorizontalPosition(Prs3d_DTHP_Left);
+ theDimAspect->SetArrowOrientation(Prs3d_DAO_External);
+ theDimAspect->SetExtensionSize(
+ (theTextSize / aViewerScale + SketcherPrs_Tools::getArrowSize()) / 2.0);
+ } else {
+ theDimAspect->SetTextHorizontalPosition(Prs3d_DTHP_Center);
+ theDimAspect->SetArrowOrientation(Prs3d_DAO_Internal);
+ }
+ theDimAspect->SetArrowTailSize(theDimAspect->ArrowAspect()->Length());
+ // The value of vertical aligment is sometimes changed
+ theDimAspect->TextAspect()->SetVerticalJustification(Graphic3d_VTA_CENTER);
+}
+
+
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));
myDistance(1),
myValue(0., false, "")
{
- // PORTING_TO_SALOME_8
- // SetDimensionAspect(SketcherPrs_Tools::createDimensionAspect());
+ SetDimensionAspect(createDimensionAspect());
myStyleListener = new SketcherPrs_DimensionStyleListener();
}
double aTextSize = 0.0;
GetValueString(aTextSize);
- // PORTING_TO_SALOME_8
- //SketcherPrs_Tools::updateArrows(DimensionAspect(), GetValue(), aTextSize);
+ updateArrows(DimensionAspect(), GetValue(), aTextSize);
// Update text visualization: parameter value or parameter text
myStyleListener->updateDimensions(this, myValue);
#include <gp_Circ.hxx>
+/// Creates an aspect to be shown in length/radius dimension presentations
+/// \return an instance of aspect
+extern Handle(Prs3d_DimensionAspect) createDimensionAspect();
+
+/// Update variable aspect parameters (depending on viewer scale)
+/// \param theDimAspect an aspect to be changed
+/// \param theDimValue an arrow value
+/// \param theTextSize an arrow value
+extern void updateArrows(Handle_Prs3d_DimensionAspect theDimAspect,
+ double theDimValue, double theTextSize);
+
+
static const gp_Circ MyDefCirc(gp_Ax2(gp_Pnt(0,0,0), gp_Dir(0,0,1)), 1);
IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Radius, AIS_RadiusDimension);
myAnchorPoint(gp_Pnt(0, 0, 2)),
myValue(1, false, "")
{
- // PORTING_TO_SALOME_8
- // SetDimensionAspect(SketcherPrs_Tools::createDimensionAspect());
+ SetDimensionAspect(createDimensionAspect());
myStyleListener = new SketcherPrs_DimensionStyleListener();
}
// Update variable aspect parameters (depending on viewer scale)
double aTextSize = 0.0;
GetValueString(aTextSize);
- // PORTING_TO_SALOME_8
- //SketcherPrs_Tools::updateArrows(DimensionAspect(), GetValue(), aTextSize);
+ updateArrows(DimensionAspect(), GetValue(), aTextSize);
AIS_RadiusDimension::Compute(thePresentationManager, thePresentation, theMode);
//**************************************************************
// PORTING_TO_SALOME_8
-/*//! Definition of call back
-OpenGl_Element* SymbolPrsCallBack(const CALL_DEF_USERDRAW * theUserDraw)
+//! Definition of call back
+/*OpenGl_Element* SymbolPrsCallBack(const CALL_DEF_USERDRAW * theUserDraw)
{
Handle(SketcherPrs_SymbolPrs) anIObj = (SketcherPrs_SymbolPrs*)theUserDraw->Data;
if (anIObj.IsNull()) {
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
-//#include <Prs3d_DimensionAspect.hxx>
+#include <Prs3d_DimensionAspect.hxx>
#include <BRep_Tool.hxx>
#include <Precision.hxx>
Events_Loop::loop()->flush(anId);
}
-/*Handle(Prs3d_DimensionAspect) createDimensionAspect()
-{
- Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect();
- anAspect->MakeArrows3d(false);
- anAspect->MakeText3d(false);
- anAspect->MakeTextShaded(false);
- anAspect->MakeUnitsDisplayed(false);
- anAspect->TextAspect()->SetHeight(SketcherPrs_Tools::getDefaultTextHeight());
- anAspect->ArrowAspect()->SetLength(SketcherPrs_Tools::getArrowSize());
-
- return anAspect;
-}
-
-void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect,
- double theDimValue, double theTextSize)
-{
- double anArrowLength = theDimAspect->ArrowAspect()->Length();
- // This is not realy correct way to get viewer scale.
- double aViewerScale = (double) SketcherPrs_Tools::getDefaultArrowSize() / anArrowLength;
-
- if(theTextSize > ((theDimValue - 3 * SketcherPrs_Tools::getArrowSize()) * aViewerScale)) {
- theDimAspect->SetTextHorizontalPosition(Prs3d_DTHP_Left);
- theDimAspect->SetArrowOrientation(Prs3d_DAO_External);
- theDimAspect->SetExtensionSize(
- (theTextSize / aViewerScale + SketcherPrs_Tools::getArrowSize()) / 2.0);
- } else {
- theDimAspect->SetTextHorizontalPosition(Prs3d_DTHP_Center);
- theDimAspect->SetArrowOrientation(Prs3d_DAO_Internal);
- }
- theDimAspect->SetArrowTailSize(theDimAspect->ArrowAspect()->Length());
- // The value of vertical aligment is sometimes changed
- theDimAspect->TextAspect()->SetVerticalJustification(Graphic3d_VTA_CENTER);
-}*/
-
void sendEmptyPresentationError(ModelAPI_Feature* theFeature, const std::string theError)
{
Events_InfoMessage("SketcherPrs_Tools",
#include <Events_Loop.h>
#include <Events_Message.h>
-// PORTING_TO_SALOME_8
-//class Handle_Prs3d_DimensionAspect;
-
class GeomDataAPI_Point2D;
class AIS_Dimension;
/// \param theState a new state
SKETCHERPRS_EXPORT void sendExpressionShownEvent(const bool& theState);
- /// Creates an aspect to be shown in length/radius dimension presentations
- /// \return an instance of aspect
- //SKETCHERPRS_EXPORT Handle_Prs3d_DimensionAspect createDimensionAspect();
-
- /// Update variable aspect parameters (depending on viewer scale)
- /// \param theDimAspect an aspect to be changed
- /// \param theDimValue an arrow value
- /// \param theTextSize an arrow value
- //SKETCHERPRS_EXPORT void updateArrows(Handle_Prs3d_DimensionAspect theDimAspect,
- // double theDimValue, double theTextSize);
-
/// Throws an exception(in debug mode) and sends a signal about necessity to hide the object
/// \param theFeature a feature where AIS presentation is empty
/// \param theError a debug error information