1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

0023776: Redesign of MFC samples after V2d viewer removing

This commit is contained in:
aba
2013-03-12 09:19:35 +04:00
parent fad8962a72
commit 5c1f974e17
212 changed files with 9053 additions and 19513 deletions

View File

@@ -6,37 +6,12 @@
IMPLEMENT_STANDARD_HANDLE(ISession2D_Curve,AIS_InteractiveObject)
IMPLEMENT_STANDARD_RTTIEXT(ISession2D_Curve,AIS_InteractiveObject)
#include <Graphic2d_SetOfCurves.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Bnd_Box2d.hxx>
#include <BndLib_Add2dCurve.hxx>
#include <Precision.hxx>
#include <Select2D_SensitiveBox.hxx>
#include <Select2D_SensitiveSegment.hxx>
#include <gp_Circ2d.hxx>
#include <gp_Dir2d.hxx>
#include <gp_Ax2d.hxx>
#include <Select2D_SensitiveArc.hxx>
#include <Geom2d_Curve.hxx>
#include <GeomTools_Curve2dSet.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <gp_Pnt2d.hxx>
#include <GCE2d_MakeSegment.hxx>
#include <gp_Vec2d.hxx>
#include <OSD_Environment.hxx>
#include <Graphic2d_Array1OfVertex.hxx>
#include <Graphic2d_PolyLine.hxx>
#include <SelectMgr_Selection.hxx>
#include <Graphic2d_Segment.hxx>
#include <GeomAbs_CurveType.hxx>
#include <Graphic2d_Vertex.hxx>
#include <Geom2d_BezierCurve.hxx>
ISession2D_Curve::ISession2D_Curve(const Handle_Geom2d_Curve aGeom2dCurve,
const Aspect_TypeOfLine aTypeOfLine,
const Aspect_WidthOfLine aWidthOfLine,
const Standard_Integer aColorIndex)
:AIS_InteractiveObject()
ISession2D_Curve::ISession2D_Curve(const Handle_Geom2d_Curve aGeom2dCurve,
const Aspect_TypeOfLine aTypeOfLine,
const Aspect_WidthOfLine aWidthOfLine,
const Standard_Integer aColorIndex)
:AIS_InteractiveObject()
{
myGeom2dCurve = aGeom2dCurve;
myTypeOfLine = aTypeOfLine ;
@@ -49,51 +24,52 @@ IMPLEMENT_STANDARD_RTTIEXT(ISession2D_Curve,AIS_InteractiveObject)
myradiusratio = 1;
}
void ISession2D_Curve::Compute(const Handle(PrsMgr_PresentationManager2d)& aPresentationManager,
const Handle(Graphic2d_GraphicObject)& aGrObj,
const Standard_Integer aMode)
void ISession2D_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode)
{
Handle(Graphic2d_SetOfCurves) segment;
segment = new Graphic2d_SetOfCurves(aGrObj);
segment->Add(myGeom2dCurve);
segment->SetColorIndex (myColorIndex);
segment->SetWidthIndex (myWidthOfLine + 1);
segment->SetTypeIndex (myTypeOfLine + 1);
Geom2dAdaptor_Curve anAdaptor(myGeom2dCurve);
GCPnts_QuasiUniformDeflection anEdgeDistrib(anAdaptor,1.e-2);
if(anEdgeDistrib.IsDone())
{
Handle(Graphic3d_ArrayOfPolylines) aCurve =
new Graphic3d_ArrayOfPolylines(anEdgeDistrib.NbPoints());
for(Standard_Integer i=1;i<=anEdgeDistrib.NbPoints();++i)
aCurve->AddVertex(anEdgeDistrib.Value(i));
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aCurve);
}
if (myDisplayPole)
{
{
if (anAdaptor.GetType() == GeomAbs_BezierCurve )
{
Handle(Geom2d_BezierCurve) aBezier = anAdaptor.Bezier();
Graphic2d_Array1OfVertex anArrayOfVertex(1,aBezier->NbPoles());
Handle(Graphic3d_ArrayOfPolylines) anArrayOfVertex = new Graphic3d_ArrayOfPolylines(aBezier->NbPoles());
for(int i=1;i<=aBezier->NbPoles();i++)
{
gp_Pnt2d CurrentPoint = aBezier->Pole(i);
Graphic2d_Vertex aVertex(CurrentPoint.X(),CurrentPoint.Y());
anArrayOfVertex(i)=aVertex;
}
Handle(Graphic2d_Polyline) aPolyline = new Graphic2d_Polyline(aGrObj,anArrayOfVertex);
{
gp_Pnt2d CurrentPoint = aBezier->Pole(i);
anArrayOfVertex->AddVertex(CurrentPoint.X(),CurrentPoint.Y(),0.);
}
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(anArrayOfVertex);
}
if (anAdaptor.GetType() == GeomAbs_BSplineCurve )
{
Handle(Geom2d_BSplineCurve) aBSpline = anAdaptor.BSpline();
Graphic2d_Array1OfVertex anArrayOfVertex(1,aBSpline->NbPoles());
Handle(Graphic3d_ArrayOfPolylines) anArrayOfVertex =
new Graphic3d_ArrayOfPolylines(aBSpline->NbPoles());
for(int i=1;i<=aBSpline->NbPoles();i++)
{
gp_Pnt2d CurrentPoint = aBSpline->Pole(i);
Graphic2d_Vertex aVertex(CurrentPoint.X(),CurrentPoint.Y());
anArrayOfVertex(i)=aVertex;
}
Handle(Graphic2d_Polyline) aPolyline = new Graphic2d_Polyline(aGrObj,anArrayOfVertex);
{
gp_Pnt2d CurrentPoint = aBSpline->Pole(i);
anArrayOfVertex->AddVertex(CurrentPoint.X(),CurrentPoint.Y(),0.);
}
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(anArrayOfVertex);
}
}
if (myDisplayCurbure && (anAdaptor.GetType() != GeomAbs_Line))
{
@@ -106,37 +82,39 @@ void ISession2D_Curve::Compute(const Handle(PrsMgr_PresentationManager2d)& aPres
gp_Pnt2d P1, P2;
for (intrv = 1; intrv <= nbintv; intrv++)
{
Standard_Real t = TI(intrv);
Standard_Real step = (TI(intrv+1) - t) / GetDiscretisation();
Standard_Real LRad, ratio;
for (ii = 1; ii <= myDiscretisation; ii++)
{
LProp.SetParameter(t);
{
Standard_Real t = TI(intrv);
Standard_Real step = (TI(intrv+1) - t) / GetDiscretisation();
Standard_Real LRad, ratio;
for (ii = 1; ii <= myDiscretisation; ii++)
{
LProp.SetParameter(t);
if (LProp.IsTangentDefined())
{
Curvature = Abs(LProp.Curvature());
if ( Curvature > Resolution)
{
myGeom2dCurve->D0(t, P1);
LRad = 1./Curvature;
ratio = ( ( LRad > myradiusmax) ? myradiusmax/LRad : 1 );
ratio *= myradiusratio;
LProp.CentreOfCurvature(P2);
gp_Vec2d V(P1, P2);
gp_Pnt2d P3 = P1.Translated(ratio*V);
Handle(Graphic2d_Segment) aSegment = new Graphic2d_Segment(aGrObj,P1.X(),P1.Y(),P3.X(),P3.Y());
}
}
t += step;
}
{
Curvature = Abs(LProp.Curvature());
if ( Curvature > Resolution)
{
myGeom2dCurve->D0(t, P1);
LRad = 1./Curvature;
ratio = ( ( LRad > myradiusmax) ? myradiusmax/LRad : 1 );
ratio *= myradiusratio;
LProp.CentreOfCurvature(P2);
gp_Vec2d V(P1, P2);
gp_Pnt2d P3 = P1.Translated(ratio*V);
Handle(Graphic3d_ArrayOfPolylines) aSegment = new Graphic3d_ArrayOfPolylines(2);
aSegment->AddVertex(P1.X(),P1.Y(),0.);
aSegment->AddVertex(P3.X(),P3.Y(),0.);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aSegment);
}
}
t += step;
}
}
}
}
void ISession2D_Curve::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer aMode)
const Standard_Integer aMode)
{
}

View File

@@ -10,9 +10,7 @@
#include <Aspect_WidthOfline.hxx>
#include <Standard_Integer.hxx>
#include <SelectMgr_SelectableObject.hxx>
#include <Handle_PrsMgr_PresentationManager2d.hxx>
#include <Handle_Graphic2d_GraphicObject.hxx>
#include <Handle_SelectMgr_Selection.hxx>
#include <SelectMgr_Selection.hxx>
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
#include <Standard_CString.hxx>
@@ -21,7 +19,6 @@ class TColGeom2d_HSequenceOfCurve;
class PrsMgr_PresentationManager2d;
class Graphic2d_GraphicObject;
class SelectMgr_Selection;
class ISession2D_ObjectOwner;
#include "Geom2d_Curve.hxx"
@@ -32,81 +29,56 @@ class ISession2D_Curve : public AIS_InteractiveObject {
public:
// Methods PUBLIC
//
// Methods PUBLIC
//
ISession2D_Curve
(const Handle_Geom2d_Curve aGeom2dCurve,
const Aspect_TypeOfLine aTypeOfline = Aspect_TOL_SOLID,
const Aspect_WidthOfLine aWidthOfLine = Aspect_WOL_MEDIUM,
const Standard_Integer aColorIndex = 4);
ISession2D_Curve
(const Handle_Geom2d_Curve aGeom2dCurve,
const Aspect_TypeOfLine aTypeOfline = Aspect_TOL_SOLID,
const Aspect_WidthOfLine aWidthOfLine = Aspect_WOL_MEDIUM,
const Standard_Integer aColorIndex = 4);
inline Standard_Integer NbPossibleSelection() const;
inline Standard_Integer NbPossibleSelection() const;
inline Aspect_TypeOfLine GetTypeOfLine
() const;
inline void SetTypeOfLine
(const Aspect_TypeOfLine aNewTypeOfLine) ;
inline Aspect_WidthOfLine GetWidthOfLine
() const;
inline void SetWidthOfLine
(const Aspect_WidthOfLine aNewWidthOfLine) ;
inline Standard_Integer GetColorIndex
() const;
inline void SetColorIndex
(const Standard_Integer aNewColorIndex) ;
inline Aspect_TypeOfLine GetTypeOfLine() const;
inline void SetTypeOfLine(const Aspect_TypeOfLine aNewTypeOfLine);
inline Standard_Boolean GetDisplayPole
() const;
inline void SetDisplayPole
(const Standard_Boolean aNewDisplayPole) ;
inline Aspect_WidthOfLine GetWidthOfLine() const;
inline void SetWidthOfLine(const Aspect_WidthOfLine aNewWidthOfLine);
inline Standard_Boolean ISession2D_Curve::GetDisplayCurbure
() const;
inline void ISession2D_Curve::SetDisplayCurbure
(const Standard_Boolean aNewDisplayCurbure);
inline Standard_Integer GetColorIndex() const;
inline void SetColorIndex(const Standard_Integer aNewColorIndex) ;
inline Standard_Boolean GetDisplayPole() const;
inline void SetDisplayPole(const Standard_Boolean aNewDisplayPole) ;
inline Standard_Real GetDiscretisation
() const;
inline void SetDiscretisation
(const Standard_Real aNewDiscretisation) ;
inline Standard_Boolean ISession2D_Curve::GetDisplayCurbure() const;
inline void ISession2D_Curve::SetDisplayCurbure
(const Standard_Boolean aNewDisplayCurbure);
inline Standard_Real GetDiscretisation() const;
inline void SetDiscretisation(const Standard_Real aNewDiscretisation) ;
DEFINE_STANDARD_RTTI(ISession2D_Curve)
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
DEFINE_STANDARD_RTTI(ISession2D_Curve)
private:
// Methods PRIVATE
//
virtual void Compute(const Handle(PrsMgr_PresentationManager2d)& aPresentationManager,const Handle(Graphic2d_GraphicObject)& aGrObj,const Standard_Integer aMode = 0) ;
void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,const Standard_Integer aMode) ;
// Fields PRIVATE
//
Handle_Geom2d_Curve myGeom2dCurve;
Aspect_TypeOfLine myTypeOfLine;
Aspect_WidthOfLine myWidthOfLine;
Standard_Integer myColorIndex;
Standard_Boolean myDisplayPole;
Standard_Boolean myDisplayCurbure;
Standard_Real myDiscretisation;
Standard_Real myradiusmax ;
Standard_Real myradiusratio ;
// Methods PRIVATE
//
virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0) ;
void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,const Standard_Integer aMode) ;
// Fields PRIVATE
//
Handle_Geom2d_Curve myGeom2dCurve;
Aspect_TypeOfLine myTypeOfLine;
Aspect_WidthOfLine myWidthOfLine;
Standard_Integer myColorIndex;
Standard_Boolean myDisplayPole;
Standard_Boolean myDisplayCurbure;
Standard_Real myDiscretisation;
Standard_Real myradiusmax ;
Standard_Real myradiusratio ;
};
@@ -116,14 +88,14 @@ Standard_Real myradiusratio ;
inline Standard_Integer ISession2D_Curve::NbPossibleSelection() const
{
return 1;
return 1;
}
inline Aspect_TypeOfLine ISession2D_Curve::GetTypeOfLine() const
{
return myTypeOfLine ;
}
inline void ISession2D_Curve::SetTypeOfLine(const Aspect_TypeOfLine aNewTypeOfLine)
{
myTypeOfLine = aNewTypeOfLine;
@@ -150,37 +122,37 @@ inline void ISession2D_Curve::SetColorIndex(const Standard_Integer aNewColorInd
}
inline Standard_Boolean ISession2D_Curve::GetDisplayPole
() const
() const
{
return myDisplayPole;
return myDisplayPole;
}
inline void ISession2D_Curve::SetDisplayPole
(const Standard_Boolean aNewDisplayPole)
(const Standard_Boolean aNewDisplayPole)
{
myDisplayPole = aNewDisplayPole;
myDisplayPole = aNewDisplayPole;
}
inline Standard_Boolean ISession2D_Curve::GetDisplayCurbure
() const
() const
{
return myDisplayCurbure;
return myDisplayCurbure;
}
inline void ISession2D_Curve::SetDisplayCurbure
(const Standard_Boolean aNewDisplayCurbure)
(const Standard_Boolean aNewDisplayCurbure)
{
myDisplayCurbure = aNewDisplayCurbure;
myDisplayCurbure = aNewDisplayCurbure;
}
inline Standard_Real ISession2D_Curve::GetDiscretisation
() const
() const
{
return myDiscretisation;
return myDiscretisation;
}
inline void ISession2D_Curve::SetDiscretisation
(const Standard_Real aNewDiscretisation)
(const Standard_Real aNewDiscretisation)
{
myDiscretisation = aNewDiscretisation;
myDiscretisation = aNewDiscretisation;
}

View File

@@ -1,166 +0,0 @@
#include "stdafx.h"
#include <ISession2D_InteractiveContext.h>
IMPLEMENT_STANDARD_HANDLE(ISession2D_InteractiveContext,MMgt_TShared)
IMPLEMENT_STANDARD_RTTIEXT(ISession2D_InteractiveContext,MMgt_TShared)
#include <Aspect_Window.hxx>
#include <Aspect_Background.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_SelectionManager.hxx>
#include <V2d_Viewer.hxx>
#include <V2d_View.hxx>
#include <PrsMgr_PresentationManager2d.hxx>
#include <StdSelect_ViewerSelector2d.hxx>
#include <SelectMgr_SelectableObject.hxx>
#include <TColStd_MapIteratorOfMapOfTransient.hxx>
ISession2D_InteractiveContext::ISession2D_InteractiveContext()
{
}
ISession2D_InteractiveContext::ISession2D_InteractiveContext(const Handle(V2d_Viewer)& aViewer)
{
Initialize(aViewer);
}
void ISession2D_InteractiveContext::Initialize(const Handle(V2d_Viewer)& aViewer)
{
myViewer = aViewer;
myPrsmgr = new PrsMgr_PresentationManager2d(myViewer->View());
mySelectionManager = new SelectMgr_SelectionManager();
mySelector = new StdSelect_ViewerSelector2d();
mySelector->Set(3);
// set Sensitivity very very important for SensitiveCurve !!
mySelector->SetSensitivity (0.5); // en mm
mySelectionManager->Add(mySelector);
}
void ISession2D_InteractiveContext::Display(const Handle(AIS_InteractiveObject)& anObject,
const Standard_Boolean Redraw)
{
myMapOfObject.Add(anObject);
myPrsmgr->Display(anObject);//,anObject->DisplayMode());
mySelectionManager->Load(anObject,mySelector);
mySelectionManager->Activate(anObject,0,mySelector);
if (Redraw) myViewer->Update();
}
void ISession2D_InteractiveContext::Erase(const Handle(AIS_InteractiveObject)& anObject,
const Standard_Boolean Redraw)
{
if (!anObject.IsNull())
{
myPrsmgr->Erase(anObject);//,anObject->DisplayMode());
mySelectionManager
->Deactivate(anObject,mySelector);
if (Redraw) myViewer->Update();
}
}
void ISession2D_InteractiveContext::Move(const Handle(V2d_View)& aView,
const Standard_Integer x1,
const Standard_Integer y1)
{
if (!aBuffer.IsNull())
{
aBuffer->UnPost();
aBuffer->Clear();
}
if (myViewer->IsActive()) // A propos de la grille !!!
{
aView->ShowHit(x1,y1);
}
aBuffer =new Graphic2d_Buffer(aView->View(),0,0,3,5);
mySelector->Pick(x1,y1,aView);
Handle(SelectMgr_SelectableObject) aSelectableObject;
mySelector->Init();
while (mySelector->More())
{
aSelectableObject = Handle(SelectMgr_SelectableObject)::DownCast(mySelector->Picked()->Selectable());
myPrsmgr->Dump(aBuffer,aSelectableObject) ;
aBuffer->Post();
mySelector->Next();
}
}
void ISession2D_InteractiveContext::Pick(const Handle(V2d_View)& aView,
const Standard_Integer x1,
const Standard_Integer y1)
{
if (myViewer->IsActive()) // A propos de la grille !!!
{
aView->ShowHit(x1,y1);
}
mySelector->Pick(x1,y1,aView);
Handle(SelectMgr_SelectableObject) aSelectableObject;
mySelector->Init();
while (mySelector->More())
{
Handle(SelectMgr_EntityOwner) aOwn= mySelector->Picked();
aSelectableObject = Handle(SelectMgr_SelectableObject)::DownCast(aOwn->Selectable());
myPrsmgr->ColorHighlight(aSelectableObject,5,0) ;
mySelector->Next();
}
if (myViewer->IsActive()) // A propos de la grille !!!
{
aView->ShowHit(x1,y1);
}
}
void ISession2D_InteractiveContext::DisplayAreas()
{
myViewer->InitActiveViews();
while(myViewer->MoreActiveViews())
{
Handle(V2d_View) aView = myViewer->ActiveView();
mySelector->DisplayAreas(aView);
myViewer->NextActiveViews();
}
myViewer->Update();
}
void ISession2D_InteractiveContext::ClearAreas()
{
mySelector->ClearAreas();
myViewer->Update();
}
void ISession2D_InteractiveContext::EraseAll()
{
TColStd_MapIteratorOfMapOfTransient anIterator(myMapOfObject);
for (;anIterator.More();anIterator.Next())
{
Handle(Standard_Transient) aTransient = anIterator.Key();
Handle(AIS_InteractiveObject) anObject = Handle(AIS_InteractiveObject)::DownCast(aTransient);
if (!anObject.IsNull())
{
myPrsmgr->Erase(anObject);
mySelectionManager
->Deactivate(Handle(AIS_InteractiveObject)::DownCast(anObject),mySelector);
}
else
{
Standard_CString ObjectTypeName = aTransient->DynamicType()->Name();
}
}
myViewer->Update();
}

View File

@@ -1,98 +0,0 @@
// File generated by CPPExt (Transient)
//
// Copyright (C) 1991,1995 by
//
// MATRA DATAVISION, FRANCE
//
// This software is furnished in accordance with the terms and conditions
// of the contract and with the inclusion of the above copyright notice.
// This software or any other copy thereof may not be provided or otherwise
// be made available to any other person. No title to an ownership of the
// software is hereby transferred.
//
// At the termination of the contract, the software and all copies of this
// software must be deleted.
//
#ifndef _ISession2D_InteractiveContext_HeaderFile
#define _ISession2D_InteractiveContext_HeaderFile
#include <Standard_Macro.hxx>
#include <Standard_DefineHandle.hxx>
#include <Handle_V2d_Viewer.hxx>
#include <Handle_PrsMgr_PresentationManager2d.hxx>
#include <Handle_SelectMgr_SelectionManager.hxx>
#include <Handle_StdSelect_ViewerSelector2d.hxx>
#include <MMgt_TShared.hxx>
#include <Handle_SelectMgr_SelectableObject.hxx>
#include <Standard_Boolean.hxx>
#include <Handle_V2d_View.hxx>
#include <Graphic2d_Buffer.hxx>
class V2d_Viewer;
class PrsMgr_PresentationManager2d;
class SelectMgr_SelectionManager;
#include <StdSelect_ViewerSelector2d.hxx>
class SelectMgr_SelectableObject;
class V2d_View;
#include "TColStd_MapOfTransient.hxx"
DEFINE_STANDARD_HANDLE(ISession2D_InteractiveContext,MMgt_TShared)
class ISession2D_InteractiveContext : public MMgt_TShared {
public:
void EraseAll();
// Methods PUBLIC
//
ISession2D_InteractiveContext();
ISession2D_InteractiveContext(const Handle(V2d_Viewer)& aViewer);
void Initialize(const Handle(V2d_Viewer)& aViewer) ;
void Display(const Handle(AIS_InteractiveObject)& anObject,const Standard_Boolean Redraw = Standard_True) ;
void Erase(const Handle(AIS_InteractiveObject)& anObject,const Standard_Boolean Redraw = Standard_True) ;
virtual void Move(const Handle(V2d_View)& aView,const Standard_Integer x1,const Standard_Integer y1) ;
void Pick(const Handle(V2d_View)& aView,
const Standard_Integer x1,
const Standard_Integer y1);
void DisplayAreas() ;
void ClearAreas() ;
DEFINE_STANDARD_RTTI(ISession2D_InteractiveContext)
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
TColStd_MapOfTransient myMapOfObject;
// Methods PRIVATE
//
// Fields PRIVATE
//
Handle(V2d_Viewer) myViewer;
Handle_PrsMgr_PresentationManager2d myPrsmgr;
Handle_SelectMgr_SelectionManager mySelectionManager;
Handle_StdSelect_ViewerSelector2d mySelector;
// for dynamic selection
Handle(Graphic2d_Buffer) aBuffer;
};
// other inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@@ -4,17 +4,8 @@
#include <ISession2D_SensitiveCurve.h>
IMPLEMENT_STANDARD_HANDLE(ISession2D_SensitiveCurve,Select2D_SensitiveEntity)
IMPLEMENT_STANDARD_RTTIEXT(ISession2D_SensitiveCurve,Select2D_SensitiveEntity)
#include <Bnd_Box2d.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Dir2d.hxx>
#include <gp_Vec2d.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <SelectBasics_BasicTool.hxx>
#include "GCPnts_TangentialDeflection.hxx"
#include "Geom2dAdaptor_Curve.hxx"
IMPLEMENT_STANDARD_HANDLE(ISession2D_SensitiveCurve,Select3D_SensitiveEntity)
IMPLEMENT_STANDARD_RTTIEXT(ISession2D_SensitiveCurve,Select3D_SensitiveEntity)
//=====================================================
// Function : Create
@@ -27,7 +18,7 @@ ISession2D_SensitiveCurve(const Handle(SelectBasics_EntityOwner)& OwnerId,
const Handle(Geom2d_Curve)& C,
const Standard_Real CDeflect,
const Standard_Integer MaxRect):
Select2D_SensitiveEntity(OwnerId),
Select3D_SensitiveEntity(OwnerId),
myMaxRect(MaxRect),
myCurve(C),
myCDeflect(CDeflect)

View File

@@ -21,8 +21,8 @@
#include <Standard_Integer.hxx>
#include <gp_Pnt2d.hxx>
#include <Select2D_SensitiveEntity.hxx>
#include <Handle_SelectBasics_EntityOwner.hxx>
#include <Select3D_SensitiveEntity.hxx>
#include <SelectBasics_EntityOwner.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Real.hxx>
class SelectBasics_EntityOwner;
@@ -32,57 +32,38 @@ class gp_Pnt2d;
#include <Geom2d_Curve.hxx>
DEFINE_STANDARD_HANDLE(ISession2D_SensitiveCurve,Select2D_SensitiveEntity)
class ISession2D_SensitiveCurve : public Select2D_SensitiveEntity {
DEFINE_STANDARD_HANDLE(ISession2D_SensitiveCurve,Select3D_SensitiveEntity)
class ISession2D_SensitiveCurve : public Select3D_SensitiveEntity {
public:
// Methods PUBLIC
//
Standard_EXPORT ISession2D_SensitiveCurve(const Handle(SelectBasics_EntityOwner)& OwnerId,
const Handle(Geom2d_Curve)& C,
const Standard_Real CDeflect,
const Standard_Integer MaxRect = 3);
inline void SetMaxBoxes(const Standard_Integer MaxRect) ;
inline virtual Standard_Integer MaxBoxes() const;
Standard_EXPORT ISession2D_SensitiveCurve(const Handle(SelectBasics_EntityOwner)& OwnerId,
const Handle(Geom2d_Curve)& C,
const Standard_Real CDeflect,
const Standard_Integer MaxRect = 3);
inline void SetMaxBoxes(const Standard_Integer MaxRect) ;
inline virtual Standard_Integer MaxBoxes() const;
inline void SetCurve(const Handle(Geom2d_Curve) aCurve) ;
inline Handle(Geom2d_Curve) GetCurve() ;
inline void SetCurve(const Handle(Geom2d_Curve) aCurve) ;
inline Handle(Geom2d_Curve) GetCurve() ;
void Compute();
void Compute();
Standard_EXPORT void Areas(SelectBasics_ListOfBox2d& aSeq) ;
Standard_EXPORT Standard_Boolean Matches(const Standard_Real XMin,const Standard_Real YMin,const Standard_Real XMax,const Standard_Real YMax,const Standard_Real aTol) ;
Standard_EXPORT Standard_Boolean Matches(const Standard_Real X,const Standard_Real Y,const Standard_Real aTol,Standard_Real& DMin) ;
Handle(TColgp_HArray1OfPnt2d) SensitivePolygon();
Standard_EXPORT void Areas(SelectBasics_ListOfBox2d& aSeq) ;
Standard_EXPORT Standard_Boolean Matches(const Standard_Real XMin,const Standard_Real YMin,const Standard_Real XMax,const Standard_Real YMax,const Standard_Real aTol) ;
Standard_EXPORT Standard_Boolean Matches(const Standard_Real X,const Standard_Real Y,const Standard_Real aTol,Standard_Real& DMin) ;
Handle(TColgp_HArray1OfPnt2d) SensitivePolygon();
DEFINE_STANDARD_RTTI(ISession2D_SensitiveCurve)
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
DEFINE_STANDARD_RTTI(ISession2D_SensitiveCurve)
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
Standard_Real myCDeflect;
Standard_Integer myMaxRect;
Handle(Geom2d_Curve) myCurve;
Standard_Real myCDeflect;
Standard_Integer myMaxRect;
Handle(Geom2d_Curve) myCurve;
Handle(TColgp_HArray1OfPnt2d) myPolyP2d;
};
@@ -102,8 +83,4 @@ inline Handle(Geom2d_Curve) ISession2D_SensitiveCurve::
GetCurve()
{return myCurve;}
// other inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@@ -9,9 +9,6 @@
IMPLEMENT_STANDARD_HANDLE(ISession_Curve,AIS_InteractiveObject)
IMPLEMENT_STANDARD_RTTIEXT(ISession_Curve,AIS_InteractiveObject)
#include "StdPrs_Curve.hxx"
#include "GeomAdaptor_Curve.hxx"
#include "StdPrs_PoleCurve.hxx"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;

View File

@@ -16,16 +16,18 @@ DEFINE_STANDARD_HANDLE(ISession_Curve,AIS_InteractiveObject)
class ISession_Curve : public AIS_InteractiveObject
{
public:
ISession_Curve(Handle(Geom_Curve)& aCurve);
virtual ~ISession_Curve();
DEFINE_STANDARD_RTTI(ISession_Curve)
ISession_Curve(Handle(Geom_Curve)& aCurve);
virtual ~ISession_Curve();
DEFINE_STANDARD_RTTI(ISession_Curve)
private:
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0) ;
Standard_EXPORT virtual void Compute(const Handle(Prs3d_Projector)& aProjector,const Handle(Prs3d_Presentation)& aPresentation) ;
void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,const Standard_Integer aMode) ;
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0) ;
Standard_EXPORT virtual void Compute(const Handle(Prs3d_Projector)& aProjector,const Handle(Prs3d_Presentation)& aPresentation) ;
void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,const Standard_Integer aMode) ;
Handle(Geom_Curve) myCurve;
Handle(Geom_Curve) myCurve;
};
#endif // !defined(AFX_ISESSION_CURVE_H__F981CB93_A3CC_11D1_8DA3_0800369C8A03__INCLUDED_)

View File

@@ -14,11 +14,6 @@ static char THIS_FILE[]=__FILE__;
IMPLEMENT_STANDARD_HANDLE(ISession_Direction,AIS_InteractiveObject)
IMPLEMENT_STANDARD_RTTIEXT(ISession_Direction,AIS_InteractiveObject)
#include "Graphic2d_SetOfSegments.hxx"
#include "gp_Vec2d.hxx"
#include "DsgPrs_LengthPresentation.hxx"
#include "Prs3d_ArrowAspect.hxx"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
@@ -84,31 +79,6 @@ void ISession_Direction::Compute(const Handle(Prs3d_Projector)& aProjector,
{
}
void ISession_Direction::Compute(const Handle(PrsMgr_PresentationManager2d)& aPresentationManager,
const Handle(Graphic2d_GraphicObject)& aGrObj,
const Standard_Integer aMode)
{
Handle(Graphic2d_SetOfSegments) segment;
segment = new Graphic2d_SetOfSegments(aGrObj);
segment->Add(myPnt.X(),
myPnt.Y(),
myPnt.X()+myLength*myDir.X(),
myPnt.Y()+myLength*myDir.Y());
gp_Dir2d aFirstDir = gp_Dir2d(myDir.X(),myDir.Y()).Rotated (200*M_PI/180) ;
segment->Add(myPnt.X()+myLength*myDir.X(),
myPnt.Y()+myLength*myDir.Y(),
myPnt.X()+myLength*myDir.X()+ myLength*aFirstDir.X()/5 ,
myPnt.Y()+myLength*myDir.Y()+ myLength*aFirstDir.Y()/5 );
gp_Dir2d aSecondDir = gp_Dir2d(myDir.X(),myDir.Y()).Rotated (-200*M_PI/180) ;
segment->Add(myPnt.X()+myLength*myDir.X(),
myPnt.Y()+myLength*myDir.Y(),
myPnt.X()+myLength*myDir.X()+ myLength*aSecondDir.X()/5 ,
myPnt.Y()+myLength*myDir.Y()+ myLength*aSecondDir.Y()/5 );
}
void ISession_Direction::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer aMode)
{

View File

@@ -14,17 +14,17 @@ DEFINE_STANDARD_HANDLE(ISession_Direction,AIS_InteractiveObject)
class ISession_Direction : public AIS_InteractiveObject
{
public:
TCollection_ExtendedString myText;
void SetText(TCollection_ExtendedString& aText);
ISession_Direction();
ISession_Direction(gp_Pnt& aPnt,gp_Dir& aDir,Standard_Real aLength=1,Standard_Real anArrowLength=1);
ISession_Direction(gp_Pnt& aPnt,gp_Vec& aVec,Standard_Real anArrowLength=1);
TCollection_ExtendedString myText;
void SetText(TCollection_ExtendedString& aText);
ISession_Direction();
ISession_Direction(gp_Pnt& aPnt,gp_Dir& aDir,Standard_Real aLength=1,Standard_Real anArrowLength=1);
ISession_Direction(gp_Pnt& aPnt,gp_Vec& aVec,Standard_Real anArrowLength=1);
ISession_Direction(gp_Pnt2d& aPnt2d,gp_Dir2d& aDir2d,Standard_Real aLength=1);
ISession_Direction(gp_Pnt2d& aPnt2d,gp_Vec2d& aVec2d);
ISession_Direction(gp_Pnt2d& aPnt2d,gp_Dir2d& aDir2d,Standard_Real aLength=1);
ISession_Direction(gp_Pnt2d& aPnt2d,gp_Vec2d& aVec2d);
virtual ~ISession_Direction();
DEFINE_STANDARD_RTTI(ISession_Direction)
virtual ~ISession_Direction();
DEFINE_STANDARD_RTTI(ISession_Direction)
private:
@@ -33,9 +33,6 @@ private:
const Standard_Integer aMode);
void Compute (const Handle(Prs3d_Projector)& aProjector,
const Handle(Prs3d_Presentation)& aPresentation) ;
virtual void Compute(const Handle(PrsMgr_PresentationManager2d)& aPresentationManager,
const Handle(Graphic2d_GraphicObject)& aGrObj,
const Standard_Integer aMode = 0) ;
void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,const Standard_Integer aMode) ;
gp_Pnt myPnt;

View File

@@ -14,9 +14,6 @@ static char THIS_FILE[]=__FILE__;
IMPLEMENT_STANDARD_HANDLE(ISession_Point,AIS_InteractiveObject)
IMPLEMENT_STANDARD_RTTIEXT(ISession_Point,AIS_InteractiveObject)
#include "Graphic2d_CircleMarker.hxx"
#include "StdPrs_Point.hxx"
#include "Geom_CartesianPoint.hxx"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
@@ -58,14 +55,6 @@ void ISession_Point::Compute(const Handle(Prs3d_Projector)& aProjector,
{
}
void ISession_Point::Compute(const Handle(PrsMgr_PresentationManager2d)& aPresentationManager,
const Handle(Graphic2d_GraphicObject)& aGrObj,
const Standard_Integer unMode)
{
Handle(Graphic2d_CircleMarker) aCircleMarker;
aCircleMarker = new Graphic2d_CircleMarker(aGrObj,myPoint.X(),myPoint.Y(),0,0,1);
}
void ISession_Point::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer unMode)
{

View File

@@ -17,28 +17,25 @@ DEFINE_STANDARD_HANDLE(ISession_Point,AIS_InteractiveObject)
class ISession_Point : public AIS_InteractiveObject
{
public:
ISession_Point();
ISession_Point(Standard_Real X,Standard_Real Y ,Standard_Real Z);
ISession_Point(gp_Pnt2d& aPoint,Standard_Real Elevation = 0);
ISession_Point(gp_Pnt& aPoint);
virtual ~ISession_Point();
DEFINE_STANDARD_RTTI(ISession_Point)
ISession_Point();
ISession_Point(Standard_Real X,Standard_Real Y ,Standard_Real Z);
ISession_Point(gp_Pnt2d& aPoint,Standard_Real Elevation = 0);
ISession_Point(gp_Pnt& aPoint);
virtual ~ISession_Point();
DEFINE_STANDARD_RTTI(ISession_Point)
private :
void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode);
void Compute (const Handle(Prs3d_Projector)& aProjector,
const Handle(Prs3d_Presentation)& aPresentation) ;
void Compute (const Handle(PrsMgr_PresentationManager2d)& aPresentationManager,
const Handle(Graphic2d_GraphicObject)& aGrObj,
const Standard_Integer unMode = 0) ;
void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer unMode) ;
void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode);
void Compute (const Handle(Prs3d_Projector)& aProjector,
const Handle(Prs3d_Presentation)& aPresentation);
gp_Pnt myPoint;
void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer unMode);
gp_Pnt myPoint;
};

View File

@@ -14,15 +14,6 @@ static char THIS_FILE[]=__FILE__;
IMPLEMENT_STANDARD_HANDLE(ISession_Surface,AIS_InteractiveObject)
IMPLEMENT_STANDARD_RTTIEXT(ISession_Surface,AIS_InteractiveObject)
#include "GeomAdaptor_Surface.hxx"
#include "StdPrs_WFSurface.hxx"
#include "StdPrs_WFPoleSurface.hxx"
#include "GeomAdaptor_HSurface.hxx"
#include "AIS_Drawer.hxx"
#include "Prs3d_IsoAspect.hxx"
#include "StdPrs_WFDeflectionShape.hxx"
#include "StdPrs_ShadedSurface.hxx"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

View File

@@ -23,9 +23,9 @@ public:
DEFINE_STANDARD_RTTI(ISession_Surface)
private:
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0) ;
Standard_EXPORT virtual void Compute(const Handle(Prs3d_Projector)& aProjector,const Handle(Prs3d_Presentation)& aPresentation) ;
void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,const Standard_Integer aMode) ;
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0);
Standard_EXPORT virtual void Compute(const Handle(Prs3d_Projector)& aProjector,const Handle(Prs3d_Presentation)& aPresentation);
void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,const Standard_Integer aMode);
Handle(Geom_Surface) mySurface;

View File

@@ -14,20 +14,6 @@ static char THIS_FILE[]=__FILE__;
IMPLEMENT_STANDARD_HANDLE(ISession_Text,AIS_InteractiveObject)
IMPLEMENT_STANDARD_RTTIEXT(ISession_Text,AIS_InteractiveObject)
#include <Graphic2d_Text.hxx>
#include <Select2D_SensitiveBox.hxx>
#include <Graphic2d_Segment.hxx>
#include <OSD_Environment.hxx>
#include <Graphic2d_View.hxx>
#include <Graphic2d_Drawer.hxx>
#include "PrsMgr_PresentationManager2d.hxx"
#include "SelectMgr_Selection.hxx"
#include "Graphic2d_Array1OfVertex.hxx"
#include "Graphic2d_Polyline.hxx"
#include "Graphic2d_Vertex.hxx"
#include "Graphic2d_DisplayList.hxx"
#include "Prs3d_Text.hxx"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
@@ -37,7 +23,6 @@ ISession_Text::ISession_Text()
}
ISession_Text::ISession_Text
(const TCollection_AsciiString& aText,
const Standard_Real anX , // = 0
@@ -52,7 +37,9 @@ ISession_Text::ISession_Text
:AIS_InteractiveObject(),MyText(aText),MyX(anX),MyY(anY),MyZ(aZ),
MyTypeOfText(aType),MyAngle(anAngle),MySlant(aslant),MyFontIndex(aFontIndex),
MyColorIndex(aColorIndex),MyScale(aScale),MyWidth(0),MyHeight(0)
{}
{
}
ISession_Text::ISession_Text
(const TCollection_AsciiString& aText,
@@ -66,9 +53,9 @@ ISession_Text::ISession_Text
:AIS_InteractiveObject(),MyText(aText),MyX(aPoint.X()),MyY(aPoint.Y()),MyZ(aPoint.Z()),
MyTypeOfText(aType),MyAngle(anAngle),MySlant(aslant),MyFontIndex(aFontIndex),
MyColorIndex(aColorIndex),MyScale(aScale),MyWidth(0),MyHeight(0)
{}
{
}
ISession_Text::~ISession_Text()
{
@@ -87,25 +74,6 @@ void ISession_Text::Compute(const Handle(Prs3d_Projector)& aProjector,
{
}
void ISession_Text::Compute(const Handle(PrsMgr_PresentationManager2d)& aPresentationManager,
const Handle(Graphic2d_GraphicObject)& aGrObj,
const Standard_Integer unMode)
{
Handle(Graphic2d_Text) text;
text = new Graphic2d_Text(aGrObj, MyText, MyX, MyY, MyAngle,MyTypeOfText,MyScale);
text->SetFontIndex(MyFontIndex);
text->SetColorIndex(MyColorIndex);
text->SetSlant(MySlant);
text->SetUnderline(Standard_False);
text->SetZoomable(Standard_True);
aGrObj->Display();
Quantity_Length anXoffset,anYoffset;
text->TextSize(MyWidth, MyHeight,anXoffset,anYoffset);
}
void ISession_Text::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer unMode)
{

View File

@@ -11,24 +11,20 @@
#include <Standard_Macro.hxx>
#include <Standard_DefineHandle.hxx>
#include <TCollection_AsciiString.hxx>
#include <Aspect_TypeOfText.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <Quantity_Factor.hxx>
#include <Quantity_PlaneAngle.hxx>
#include <Handle_PrsMgr_PresentationManager2d.hxx>
#include <Handle_Graphic2d_GraphicObject.hxx>
#include <Handle_SelectMgr_Selection.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
#include <SelectMgr_Selection.hxx>
#include <Standard_OStream.hxx>
#include <Standard_IStream.hxx>
#include <Standard_CString.hxx>
#include <SelectMgr_SelectableObject.hxx>
class TCollection_AsciiString;
class PrsMgr_PresentationManager2d;
class Graphic2d_GraphicObject;
class SelectMgr_Selection;
DEFINE_STANDARD_HANDLE(ISession_Text,AIS_InteractiveObject)
@@ -80,32 +76,15 @@ inline void SetScale (const Quantity_Factor aNewScale) ;
DEFINE_STANDARD_RTTI(ISession_Text)
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode);
void Compute (const Handle(Prs3d_Projector)& aProjector,
const Handle(Prs3d_Presentation)& aPresentation);
void Compute (const Handle(PrsMgr_PresentationManager2d)& aPresentationManager,
const Handle(Graphic2d_GraphicObject)& aGrObj,
const Standard_Integer unMode = 0) ;
void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer unMode) ;
void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode);
void Compute (const Handle(Prs3d_Projector)& aProjector,
const Handle(Prs3d_Presentation)& aPresentation);
void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer unMode) ;
// Fields PRIVATE