1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0028060: Samples - Objects in Geometry/Viewer2d have incorrect color

Broken custom presentations Sample2D_Text and ISession_Text
have been replaced by AIS_TextLabel.

ISession2D_Curve::Compute() - fixed defining the group without presentation aspects.
GeomSources - fixed assigning custom attributes.
This commit is contained in:
kgv
2016-11-08 12:30:31 +03:00
committed by apn
parent 63dbfc04f8
commit 0e5ef9264f
32 changed files with 187 additions and 783 deletions

View File

@@ -8,6 +8,7 @@
#include "MainFrm.h"
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
GeomSources::GeomSources()
{
}
@@ -104,35 +105,43 @@ void GeomSources::AddSeparator(CGeometryDoc* /*aDoc*/,TCollection_AsciiString& a
{
aMessage+= "------------------------------------------------------------------------\n";
}
void GeomSources::DisplayPoint(CGeometryDoc* aDoc,
const gp_Pnt2d& aPoint,
const char* aText,
Standard_Boolean UpdateViewer,
Standard_Real anXoffset,
Standard_Real anYoffset,
Standard_Real TextScale)
void GeomSources::DisplayPoint (CGeometryDoc* theDoc,
const gp_Pnt2d& thePoint,
const char* theText,
Standard_Boolean theToUpdateViewer,
Standard_Real theXoffset,
Standard_Real theYoffset,
Standard_Real theTextScale)
{
Handle(ISession_Point) aGraphicPoint = new ISession_Point(aPoint);
aDoc->GetISessionContext()->Display(aGraphicPoint,UpdateViewer);
Handle(ISession_Text) aGraphicText = new ISession_Text(aText,aPoint.X()+anXoffset,aPoint.Y()+anYoffset);
aGraphicText->SetScale (TextScale);
aDoc->GetISessionContext()->Display(aGraphicText,UpdateViewer);
Handle(ISession_Point) aGraphicPoint = new ISession_Point (thePoint);
theDoc->GetISessionContext()->Display (aGraphicPoint, Standard_False);
Handle(AIS_TextLabel) aLabel = new AIS_TextLabel();
aLabel->SetText (theText);
aLabel->SetPosition (gp_Pnt (thePoint.X() + theXoffset, thePoint.Y() + theYoffset, 0.0));
//aLabel->SetHeight (theTextScale);
(void )theTextScale;
theDoc->GetISessionContext()->Display (aLabel, theToUpdateViewer);
}
void GeomSources::DisplayPoint(CGeometryDoc* aDoc,
const gp_Pnt& aPoint,
const char* aText,
Standard_Boolean UpdateViewer,
Standard_Real anXoffset,
Standard_Real anYoffset,
Standard_Real aZoffset,
Standard_Real TextScale)
void GeomSources::DisplayPoint (CGeometryDoc* theDoc,
const gp_Pnt& thePoint,
const char* theText,
Standard_Boolean theToUpdateViewer,
Standard_Real theXoffset,
Standard_Real theYoffset,
Standard_Real theZoffset,
Standard_Real theTextScale)
{
Handle(ISession_Point) aGraphicPoint = new ISession_Point(aPoint);
aDoc->GetAISContext()->Display(aGraphicPoint,UpdateViewer);
Handle(ISession_Text) aGraphicText = new ISession_Text(aText,aPoint.X()+anXoffset,aPoint.Y()+anYoffset,aPoint.Z()+aZoffset);
aGraphicText->SetScale (TextScale);
aDoc->GetAISContext()->Display(aGraphicText,UpdateViewer);
Handle(ISession_Point) aGraphicPoint = new ISession_Point (thePoint);
theDoc->GetAISContext()->Display (aGraphicPoint, Standard_False);
Handle(AIS_TextLabel) aLabel = new AIS_TextLabel();
aLabel->SetText (theText);
aLabel->SetPosition (gp_Pnt (thePoint.X() + theXoffset, thePoint.Y() + theYoffset, thePoint.Z() + theZoffset));
//aLabel->SetHeight (theTextScale);
(void )theTextScale;
theDoc->GetAISContext()->Display (aLabel, theToUpdateViewer);
}
void GeomSources::DisplayCurve(CGeometryDoc* aDoc,
@@ -157,15 +166,14 @@ void GeomSources::DisplayCurveAndCurvature(CGeometryDoc* aDoc,
aDoc->GetISessionContext()->Display(aGraphicCurve,UpdateViewer);
}
void GeomSources::DisplayCurve(CGeometryDoc* aDoc,
Handle(Geom_Curve) aCurve,
Quantity_NameOfColor aNameOfColor,
Standard_Boolean UpdateViewer)
void GeomSources::DisplayCurve (CGeometryDoc* theDoc,
Handle(Geom_Curve) theCurve,
Quantity_NameOfColor theNameOfColor,
Standard_Boolean theToUpdateViewer)
{
Handle(ISession_Curve) aGraphicCurve = new ISession_Curve(aCurve);
aDoc->GetAISContext()->SetColor(aGraphicCurve,aNameOfColor, Standard_False);
aGraphicCurve->Attributes()->LineAspect()->SetColor(aNameOfColor);
aDoc->GetAISContext()->Display(aGraphicCurve,UpdateViewer);
Handle(ISession_Curve) aGraphicCurve = new ISession_Curve (theCurve);
aGraphicCurve->Attributes()->SetLineAspect (new Prs3d_LineAspect (theNameOfColor, Aspect_TOL_SOLID, 1.0));
theDoc->GetAISContext()->Display (aGraphicCurve, theToUpdateViewer);
}
void GeomSources::DisplayCurve(CGeometryDoc* aDoc,
@@ -176,20 +184,26 @@ void GeomSources::DisplayCurve(CGeometryDoc* aDoc,
aDoc->GetAISContext()->Display(aGraphicCurve,UpdateViewer);
}
void GeomSources::DisplaySurface(CGeometryDoc* aDoc,
Handle(Geom_Surface) aSurface,
Quantity_NameOfColor aNameOfColor,
Standard_Boolean UpdateViewer)
void GeomSources::DisplaySurface (CGeometryDoc* theDoc,
Handle(Geom_Surface) theSurface,
Quantity_NameOfColor theNameOfColor,
Standard_Boolean theToUpdateViewer)
{
Handle(ISession_Surface) aGraphicalSurface = new ISession_Surface(aSurface);
aDoc->GetAISContext()->SetColor(aGraphicalSurface,aNameOfColor, Standard_False);
aGraphicalSurface->Attributes()->FreeBoundaryAspect()->SetColor(aNameOfColor);
aGraphicalSurface->Attributes()->UIsoAspect()->SetColor(aNameOfColor);
aGraphicalSurface->Attributes()->VIsoAspect()->SetColor(aNameOfColor);
aDoc->GetAISContext()->Display(aGraphicalSurface,UpdateViewer);
const Handle(AIS_InteractiveContext)& aCtx = theDoc->GetAISContext();
Handle(Prs3d_ShadingAspect) aShadeAspect = new Prs3d_ShadingAspect();
Handle(Prs3d_LineAspect) aLineAspect = new Prs3d_LineAspect (theNameOfColor, Aspect_TOL_SOLID, 1.0);
Handle(Prs3d_IsoAspect) anIsoAspect = new Prs3d_IsoAspect (theNameOfColor, Aspect_TOL_SOLID, 1.0,
aCtx->DefaultDrawer()->UIsoAspect()->Number());
aShadeAspect->SetColor (theNameOfColor);
Handle(ISession_Surface) aGraphicalSurface = new ISession_Surface (theSurface);
const Handle(Prs3d_Drawer)& aDrawer = aGraphicalSurface->Attributes();
aDrawer->SetShadingAspect (aShadeAspect);
aDrawer->SetLineAspect (aLineAspect);
aDrawer->SetFreeBoundaryAspect (aLineAspect);
aDrawer->SetUIsoAspect (anIsoAspect);
aDrawer->SetVIsoAspect (anIsoAspect);
aCtx->Display (aGraphicalSurface, theToUpdateViewer);
}
void GeomSources::DisplaySurface(CGeometryDoc* aDoc,

View File

@@ -10,12 +10,10 @@
IMPLEMENT_STANDARD_RTTIEXT(ISession2D_Curve,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 ;
@@ -28,10 +26,13 @@ ISession2D_Curve::ISession2D_Curve(const Handle(Geom2d_Curve) aGeom2dCurve,
myradiusratio = 1;
}
void ISession2D_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer /*aMode*/)
void ISession2D_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& ,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer )
{
Handle(Graphic3d_Group) aPrsGroup = Prs3d_Root::CurrentGroup (thePrs);
aPrsGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());
aPrsGroup->SetGroupPrimitivesAspect (myDrawer->PointAspect()->Aspect());
Geom2dAdaptor_Curve anAdaptor(myGeom2dCurve);
GCPnts_QuasiUniformDeflection anEdgeDistrib(anAdaptor,1.e-2);
@@ -42,7 +43,7 @@ void ISession2D_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPr
for(Standard_Integer i=1;i<=anEdgeDistrib.NbPoints();++i)
aCurve->AddVertex(anEdgeDistrib.Value(i));
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aCurve);
aPrsGroup->AddPrimitiveArray (aCurve);
}
if (myDisplayPole)
@@ -56,7 +57,7 @@ void ISession2D_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPr
gp_Pnt2d CurrentPoint = aBezier->Pole(i);
anArrayOfVertex->AddVertex(CurrentPoint.X(),CurrentPoint.Y(),0.);
}
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(anArrayOfVertex);
aPrsGroup->AddPrimitiveArray (anArrayOfVertex);
}
if (anAdaptor.GetType() == GeomAbs_BSplineCurve )
@@ -71,7 +72,7 @@ void ISession2D_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPr
gp_Pnt2d CurrentPoint = aBSpline->Pole(i);
anArrayOfVertex->AddVertex(CurrentPoint.X(),CurrentPoint.Y(),0.);
}
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(anArrayOfVertex);
aPrsGroup->AddPrimitiveArray (anArrayOfVertex);
}
}
@@ -108,7 +109,7 @@ void ISession2D_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPr
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);
aPrsGroup->AddPrimitiveArray (aSegment);
}
}
t += step;
@@ -116,10 +117,3 @@ void ISession2D_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPr
}
}
}
void ISession2D_Curve::ComputeSelection(const Handle(SelectMgr_Selection)& /*aSelection*/,
const Standard_Integer /*aMode*/)
{
}

View File

@@ -64,9 +64,9 @@ public:
private:
// Methods PRIVATE
//
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const { return theMode == 0; }
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) ;
void ComputeSelection(const Handle(SelectMgr_Selection)& ,const Standard_Integer ) {}
// Fields PRIVATE
//

View File

@@ -14,48 +14,23 @@ IMPLEMENT_STANDARD_RTTIEXT(ISession_Curve,AIS_InteractiveObject)
static char THIS_FILE[]=__FILE__;
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
ISession_Curve::ISession_Curve(const Handle(Geom_Curve)& aCurve)
:AIS_InteractiveObject(),myCurve(aCurve)
void ISession_Curve::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
}
ISession_Curve::~ISession_Curve()
{
}
void ISession_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode)
{
GeomAdaptor_Curve anAdaptorCurve(myCurve);
Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer();
aDrawer->LineAspect()->SetColor(Quantity_NOC_RED);
switch (aMode)
GeomAdaptor_Curve anAdaptorCurve (myCurve);
switch (theMode)
{
case 1:
{
case 1 :
StdPrs_PoleCurve::Add(aPresentation, anAdaptorCurve,aDrawer);
case 0 :
StdPrs_Curve::Add( aPresentation, anAdaptorCurve ,myDrawer);
break;
Handle(Prs3d_Drawer) aPoleDrawer = new Prs3d_Drawer();
aPoleDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_RED, Aspect_TOL_SOLID, 1.0));
StdPrs_PoleCurve::Add (thePrs, anAdaptorCurve, aPoleDrawer);
}
case 0:
{
StdPrs_Curve::Add (thePrs, anAdaptorCurve, myDrawer);
break;
}
}
}
void ISession_Curve::Compute(const Handle(Prs3d_Projector)& /*aProjector*/,
const Handle(Prs3d_Presentation)& /*aPresentation*/)
{
}
void ISession_Curve::ComputeSelection(const Handle(SelectMgr_Selection)& /*aSelection*/,
const Standard_Integer /*aMode*/)
{
}

View File

@@ -2,33 +2,27 @@
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_ISESSION_CURVE_H__F981CB93_A3CC_11D1_8DA3_0800369C8A03__INCLUDED_)
#define AFX_ISESSION_CURVE_H__F981CB93_A3CC_11D1_8DA3_0800369C8A03__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include <Standard_Macro.hxx>
#include <Standard_DefineHandle.hxx>
#include "AIS_InteractiveObject.hxx"
class ISession_Curve;
DEFINE_STANDARD_HANDLE(ISession_Curve,AIS_InteractiveObject)
class ISession_Curve : public AIS_InteractiveObject
{
public:
ISession_Curve(const Handle(Geom_Curve)& aCurve);
virtual ~ISession_Curve();
DEFINE_STANDARD_RTTIEXT(ISession_Curve,AIS_InteractiveObject)
public:
ISession_Curve(const Handle(Geom_Curve)& theCurve) : myCurve (theCurve) {}
virtual ~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) ;
virtual void Compute(const Handle(Prs3d_Projector)& ,const Handle(Prs3d_Presentation)& ) {}
virtual void ComputeSelection (const Handle(SelectMgr_Selection)& ,const Standard_Integer ) {}
private:
Handle(Geom_Curve) myCurve;
};
#endif // !defined(AFX_ISESSION_CURVE_H__F981CB93_A3CC_11D1_8DA3_0800369C8A03__INCLUDED_)
DEFINE_STANDARD_HANDLE(ISession_Curve,AIS_InteractiveObject)

View File

@@ -18,50 +18,30 @@ static char THIS_FILE[]=__FILE__;
IMPLEMENT_STANDARD_RTTIEXT(ISession_Surface,AIS_InteractiveObject)
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
ISession_Surface::ISession_Surface(const Handle(Geom_Surface)& aSurface)
:AIS_InteractiveObject(),mySurface(aSurface)
void ISession_Surface::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
}
GeomAdaptor_Surface anAdaptorSurface (mySurface);
Handle(GeomAdaptor_HSurface) anAdaptorHSurface = new GeomAdaptor_HSurface (mySurface);
ISession_Surface::~ISession_Surface()
{
}
void ISession_Surface::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode)
{
GeomAdaptor_Surface anAdaptorSurface(mySurface);
Handle(GeomAdaptor_HSurface) anAdaptorHSurface = new GeomAdaptor_HSurface(mySurface);
Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer();
aDrawer->LineAspect()->SetColor(Quantity_NOC_YELLOW3);
switch (aMode)
Handle(Prs3d_Drawer) aPoleDrawer = new Prs3d_Drawer();
aPoleDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_YELLOW3, Aspect_TOL_SOLID, 1.0));
switch (theMode)
{
case 2:
{
case 2:
StdPrs_ShadedSurface::Add(aPresentation,anAdaptorSurface,myDrawer);
break;
case 1 :
StdPrs_WFPoleSurface::Add(aPresentation,anAdaptorSurface,aDrawer);
case 0 :
StdPrs_WFSurface::Add(aPresentation,anAdaptorHSurface,myDrawer);
break;
StdPrs_ShadedSurface::Add (thePrs, anAdaptorSurface, myDrawer);
break;
}
case 1:
{
StdPrs_WFPoleSurface::Add (thePrs, anAdaptorSurface, aPoleDrawer);
}
case 0:
{
StdPrs_WFSurface::Add (thePrs, anAdaptorHSurface, myDrawer);
break;
}
}
}
void ISession_Surface::Compute(const Handle(Prs3d_Projector)& /*aProjector*/,
const Handle(Prs3d_Presentation)& /*aPresentation*/)
{
}
void ISession_Surface::ComputeSelection(const Handle(SelectMgr_Selection)& /*aSelection*/,
const Standard_Integer /*aMode*/)
{
}

View File

@@ -2,33 +2,29 @@
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_ISESSION_SURFACE_H__27F86F5A_A6A4_11D1_8DA4_0800369C8A03__INCLUDED_)
#define AFX_ISESSION_SURFACE_H__27F86F5A_A6A4_11D1_8DA4_0800369C8A03__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include <Standard_Macro.hxx>
#include <Standard_DefineHandle.hxx>
class ISession_Surface;
DEFINE_STANDARD_HANDLE(ISession_Surface,AIS_InteractiveObject)
class ISession_Surface : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(ISession_Surface,AIS_InteractiveObject)
public:
ISession_Surface();
ISession_Surface(const Handle(Geom_Surface)& aSurface);
virtual ~ISession_Surface();
DEFINE_STANDARD_RTTIEXT(ISession_Surface,AIS_InteractiveObject)
ISession_Surface (const Handle(Geom_Surface)& theSurface) : mySurface (theSurface) {}
virtual ~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);
virtual void Compute (const Handle(Prs3d_Projector)& ,const Handle(Prs3d_Presentation)& ) {}
virtual void ComputeSelection (const Handle(SelectMgr_Selection)& ,const Standard_Integer ) {}
Handle(Geom_Surface) mySurface;
private:
Handle(Geom_Surface) mySurface;
};
#endif // !defined(AFX_ISESSION_SURFACE_H__27F86F5A_A6A4_11D1_8DA4_0800369C8A03__INCLUDED_)
DEFINE_STANDARD_HANDLE(ISession_Surface, AIS_InteractiveObject)

View File

@@ -1,79 +0,0 @@
// ISession_Text.cpp: implementation of the ISession_Text class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "..\\GeometryApp.h"
#include "ISession_Text.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
//#define new DEBUG_NEW
#endif
IMPLEMENT_STANDARD_RTTIEXT(ISession_Text,AIS_InteractiveObject)
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
ISession_Text::ISession_Text()
{
}
ISession_Text::ISession_Text
(const TCollection_AsciiString& aText,
const Standard_Real anX , // = 0
const Standard_Real anY , // = 0
const Standard_Real aZ , // = 0
const Quantity_PlaneAngle anAngle, // = 0.0
const Standard_Real aslant, // = 0.0
const Standard_Integer aColorIndex, // = 0
const Standard_Integer aFontIndex, // = 1
const Quantity_Factor aScale) // = 1
:AIS_InteractiveObject(),MyText(aText),MyX(anX),MyY(anY),MyZ(aZ),
MyAngle(anAngle),MySlant(aslant),MyFontIndex(aFontIndex),
MyColorIndex(aColorIndex),MyScale(aScale),MyWidth(0),MyHeight(0)
{
}
ISession_Text::ISession_Text
(const TCollection_AsciiString& aText,
gp_Pnt& aPoint,
const Quantity_PlaneAngle anAngle, // = 0.0
const Standard_Real aslant, // = 0.0
const Standard_Integer aColorIndex, // = 0
const Standard_Integer aFontIndex, // = 1
const Quantity_Factor aScale) // = 1
:AIS_InteractiveObject(),MyText(aText),MyX(aPoint.X()),MyY(aPoint.Y()),MyZ(aPoint.Z()),
MyAngle(anAngle),MySlant(aslant),MyFontIndex(aFontIndex),
MyColorIndex(aColorIndex),MyScale(aScale),MyWidth(0),MyHeight(0)
{
}
ISession_Text::~ISession_Text()
{
}
void ISession_Text::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer /*aMode*/)
{
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (aPresentation), myDrawer->TextAspect(), MyText, gp_Pnt(MyX, MyY, MyZ));
}
void ISession_Text::Compute(const Handle(Prs3d_Projector)& /*aProjector*/,
const Handle(Prs3d_Presentation)& /*aPresentation*/)
{
}
void ISession_Text::ComputeSelection(const Handle(SelectMgr_Selection)& /*aSelection*/,
const Standard_Integer /*unMode*/)
{
}

View File

@@ -1,147 +0,0 @@
// ISession_Text.h: interface for the ISession_Text class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_ISESSION_TEXT_H__A9B277C4_A69E_11D1_8DA4_0800369C8A03__INCLUDED_)
#define AFX_ISESSION_TEXT_H__A9B277C4_A69E_11D1_8DA4_0800369C8A03__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include <Standard_Macro.hxx>
#include <Standard_DefineHandle.hxx>
#include <TCollection_AsciiString.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <Quantity_Factor.hxx>
#include <Quantity_PlaneAngle.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 SelectMgr_Selection;
class ISession_Text;
DEFINE_STANDARD_HANDLE(ISession_Text,AIS_InteractiveObject)
class ISession_Text : public AIS_InteractiveObject
{
public:
ISession_Text();
ISession_Text (const TCollection_AsciiString& aText,
const Standard_Real anX = 0 ,
const Standard_Real anY = 0 ,
const Standard_Real aZ = 0 ,
const Quantity_PlaneAngle anAngle = 0.0 ,
const Standard_Real aSlant = 0.0 ,
const Standard_Integer aColorIndex = 1 ,
const Standard_Integer aFontIndex = 1 ,
const Quantity_Factor aScale = 0.1 );
ISession_Text
(const TCollection_AsciiString& aText,
gp_Pnt& aPoint,
const Quantity_PlaneAngle anAngle = 0.0 ,
const Standard_Real aSlant = 0.0 ,
const Standard_Integer aColorIndex = 1 ,
const Standard_Integer aFontIndex = 1 ,
const Quantity_Factor aScale = 0.1 );
virtual ~ISession_Text();
inline Standard_Integer NbPossibleSelection() const;
inline TCollection_AsciiString GetText() const;
inline void SetText(const TCollection_AsciiString& atext) ;
inline void GetCoord(Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const ;
inline void SetCoord(const Standard_Real X, const Standard_Real Y, const Standard_Real Z=0);
inline Standard_Real GetAngle() const;
inline void SetAngle(const Standard_Real aNewAngle) ;
inline Standard_Real GetSlant() const;
inline void SetSlant(const Standard_Real aNewSlant) ;
inline Standard_Integer GetColorIndex() const;
inline void SetColorIndex(const Standard_Integer aNewColorIndex) ;
inline Standard_Integer GetFontIndex() const;
inline void SetFontIndex(const Standard_Integer aNewFontIndex) ;
inline Quantity_Factor GetScale() const;
inline void SetScale (const Quantity_Factor aNewScale) ;
DEFINE_STANDARD_RTTIEXT(ISession_Text,AIS_InteractiveObject)
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 ComputeSelection (const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer unMode) ;
// Fields PRIVATE
//
TCollection_AsciiString MyText ;
Standard_Real MyX ;
Standard_Real MyY ;
Standard_Real MyZ ;
Standard_Real MyAngle ;
Standard_Real MySlant ;
Standard_Integer MyColorIndex ;
Standard_Integer MyFontIndex ;
Quantity_Factor MyScale ;
Standard_Real MyWidth ;
Standard_Real MyHeight ;
};
inline Standard_Integer ISession_Text::NbPossibleSelection() const
{ return 1; }
inline TCollection_AsciiString ISession_Text::GetText() const
{ return MyText ; }
inline void ISession_Text::SetText(const TCollection_AsciiString& atext)
{ MyText = atext; }
inline void ISession_Text::GetCoord(Standard_Real& X, Standard_Real& Y, Standard_Real& Z) const
{ X = MyX; Y = MyY; Z = MyZ;}
inline void ISession_Text::SetCoord(const Standard_Real X, const Standard_Real Y, const Standard_Real Z)
{ MyX = X ; MyY = Y ; MyZ = Z ;}
inline Standard_Real ISession_Text::GetAngle() const
{ return MyAngle; }
inline void ISession_Text::SetAngle(const Standard_Real aNewAngle)
{ MyAngle = aNewAngle; }
inline Standard_Real ISession_Text::GetSlant() const
{ return MySlant; }
inline void ISession_Text::SetSlant(const Standard_Real aNewSlant)
{ MySlant = aNewSlant; }
inline Standard_Integer ISession_Text::GetColorIndex() const
{ return MyColorIndex; }
inline void ISession_Text::SetColorIndex(const Standard_Integer aNewColorIndex)
{ MyColorIndex = aNewColorIndex; }
inline Standard_Integer ISession_Text::GetFontIndex() const
{ return MyFontIndex; }
inline void ISession_Text::SetFontIndex(const Standard_Integer aNewFontIndex)
{ MyFontIndex = aNewFontIndex; }
inline Quantity_Factor ISession_Text::GetScale() const
{ return MyScale; }
inline void ISession_Text::SetScale(const Quantity_Factor aNewScale)
{ MyScale = aNewScale; }
#endif // !defined(AFX_ISESSION_TEXT_H__A9B277C4_A69E_11D1_8DA4_0800369C8A03__INCLUDED_)

View File

@@ -80,6 +80,7 @@
#include <AIS_InteractiveContext.hxx>
#include <AIS_Shape.hxx>
#include <AIS_Point.hxx>
#include <AIS_TextLabel.hxx>
#include <Aspect_Grid.hxx>
#include <Aspect_Window.hxx>
#include <Aspect_Background.hxx>
@@ -270,7 +271,6 @@
#include "ISession_Direction.h"
#include "ISession_Curve.h"
#include "ISession_Surface.h"
#include "ISession_Text.h"
#include "ISession_Point.h"
#include <UnitsAPI.hxx>