From 0e5ef9264f14b7256bd252e71eed6880c14c8932 Mon Sep 17 00:00:00 2001 From: kgv Date: Tue, 8 Nov 2016 12:30:31 +0300 Subject: [PATCH] 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. --- .../mfc/standard/01_Geometry/CMakeLists.txt | 2 - .../01_Geometry/adm/win/vc10/Geometry.vcxproj | 19 --- .../adm/win/vc10/Geometry.vcxproj.filters | 6 - .../01_Geometry/adm/win/vc11/Geometry.vcxproj | 19 --- .../adm/win/vc11/Geometry.vcxproj.filters | 6 - .../01_Geometry/adm/win/vc12/Geometry.vcxproj | 19 --- .../adm/win/vc12/Geometry.vcxproj.filters | 6 - .../01_Geometry/adm/win/vc14/Geometry.vcxproj | 19 --- .../adm/win/vc14/Geometry.vcxproj.filters | 6 - .../standard/01_Geometry/src/GeomSources.cpp | 106 +++++++------ .../src/ISession2D/ISession2D_Curve.cpp | 26 ++-- .../src/ISession2D/ISession2D_Curve.h | 4 +- .../src/ISession2D/ISession_Curve.cpp | 57 ++----- .../src/ISession2D/ISession_Curve.h | 22 +-- .../src/ISession2D/ISession_Surface.cpp | 64 +++----- .../src/ISession2D/ISession_Surface.h | 28 ++-- .../src/ISession2D/ISession_Text.cpp | 79 ---------- .../src/ISession2D/ISession_Text.h | 147 ------------------ samples/mfc/standard/01_Geometry/src/StdAfx.h | 2 +- samples/mfc/standard/03_Viewer2d/src/StdAfx.h | 1 + .../standard/03_Viewer2d/src/Viewer2dDoc.cpp | 113 +++++++------- .../Common/Primitive/Sample2D_Text.cpp | 51 ------ .../standard/Common/Primitive/Sample2D_Text.h | 70 --------- samples/mfc/standard/mfcsample/CMakeLists.txt | 6 +- .../mfcsample/adm/win/vc10/mfcsample.vcxproj | 17 -- .../adm/win/vc10/mfcsample.vcxproj.filters | 6 - .../mfcsample/adm/win/vc11/mfcsample.vcxproj | 17 -- .../adm/win/vc11/mfcsample.vcxproj.filters | 6 - .../mfcsample/adm/win/vc12/mfcsample.vcxproj | 17 -- .../adm/win/vc12/mfcsample.vcxproj.filters | 6 - .../mfcsample/adm/win/vc14/mfcsample.vcxproj | 17 -- .../adm/win/vc14/mfcsample.vcxproj.filters | 6 - 32 files changed, 187 insertions(+), 783 deletions(-) delete mode 100755 samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Text.cpp delete mode 100755 samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Text.h delete mode 100755 samples/mfc/standard/Common/Primitive/Sample2D_Text.cpp delete mode 100755 samples/mfc/standard/Common/Primitive/Sample2D_Text.h diff --git a/samples/mfc/standard/01_Geometry/CMakeLists.txt b/samples/mfc/standard/01_Geometry/CMakeLists.txt index b7365dac7d..9c0eb68ea8 100644 --- a/samples/mfc/standard/01_Geometry/CMakeLists.txt +++ b/samples/mfc/standard/01_Geometry/CMakeLists.txt @@ -32,13 +32,11 @@ set (Geometry_ISESSION2D_HEADER_FILES ${Geometry_ISESSION2D_DIR}/ISession_Curve. ${Geometry_ISESSION2D_DIR}/ISession_Direction.h ${Geometry_ISESSION2D_DIR}/ISession_Point.h ${Geometry_ISESSION2D_DIR}/ISession_Surface.h - ${Geometry_ISESSION2D_DIR}/ISession_Text.h ${Geometry_ISESSION2D_DIR}/ISession2D_Curve.h) set (Geometry_ISESSION2D_SOURCE_FILES ${Geometry_ISESSION2D_DIR}/ISession_Curve.cpp ${Geometry_ISESSION2D_DIR}/ISession_Direction.cpp ${Geometry_ISESSION2D_DIR}/ISession_Point.cpp ${Geometry_ISESSION2D_DIR}/ISession_Surface.cpp - ${Geometry_ISESSION2D_DIR}/ISession_Text.cpp ${Geometry_ISESSION2D_DIR}/ISession2D_Curve.cpp) set (Geometry_RESOURCE_DIR ${MFC_STANDARD_SAMPLES_DIR}/01_Geometry/res) diff --git a/samples/mfc/standard/01_Geometry/adm/win/vc10/Geometry.vcxproj b/samples/mfc/standard/01_Geometry/adm/win/vc10/Geometry.vcxproj index 60a96455f7..73967fd048 100644 --- a/samples/mfc/standard/01_Geometry/adm/win/vc10/Geometry.vcxproj +++ b/samples/mfc/standard/01_Geometry/adm/win/vc10/Geometry.vcxproj @@ -529,24 +529,6 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - - Disabled - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - EnableFastChecks - true - Disabled - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - EnableFastChecks - true - MaxSpeed - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - MaxSpeed - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - @@ -574,7 +556,6 @@ - diff --git a/samples/mfc/standard/01_Geometry/adm/win/vc10/Geometry.vcxproj.filters b/samples/mfc/standard/01_Geometry/adm/win/vc10/Geometry.vcxproj.filters index 185f27ebaa..a56b5b8da7 100644 --- a/samples/mfc/standard/01_Geometry/adm/win/vc10/Geometry.vcxproj.filters +++ b/samples/mfc/standard/01_Geometry/adm/win/vc10/Geometry.vcxproj.filters @@ -66,9 +66,6 @@ Source Files\ISession2d - - Source Files\ISession2d - @@ -115,9 +112,6 @@ Header Files - - Header Files - Header Files diff --git a/samples/mfc/standard/01_Geometry/adm/win/vc11/Geometry.vcxproj b/samples/mfc/standard/01_Geometry/adm/win/vc11/Geometry.vcxproj index 12b31f9c87..a5be7ba353 100644 --- a/samples/mfc/standard/01_Geometry/adm/win/vc11/Geometry.vcxproj +++ b/samples/mfc/standard/01_Geometry/adm/win/vc11/Geometry.vcxproj @@ -533,24 +533,6 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - - Disabled - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - EnableFastChecks - true - Disabled - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - EnableFastChecks - true - MaxSpeed - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - MaxSpeed - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - @@ -578,7 +560,6 @@ - diff --git a/samples/mfc/standard/01_Geometry/adm/win/vc11/Geometry.vcxproj.filters b/samples/mfc/standard/01_Geometry/adm/win/vc11/Geometry.vcxproj.filters index 185f27ebaa..a56b5b8da7 100644 --- a/samples/mfc/standard/01_Geometry/adm/win/vc11/Geometry.vcxproj.filters +++ b/samples/mfc/standard/01_Geometry/adm/win/vc11/Geometry.vcxproj.filters @@ -66,9 +66,6 @@ Source Files\ISession2d - - Source Files\ISession2d - @@ -115,9 +112,6 @@ Header Files - - Header Files - Header Files diff --git a/samples/mfc/standard/01_Geometry/adm/win/vc12/Geometry.vcxproj b/samples/mfc/standard/01_Geometry/adm/win/vc12/Geometry.vcxproj index 5970f5fa85..563abf4e7c 100644 --- a/samples/mfc/standard/01_Geometry/adm/win/vc12/Geometry.vcxproj +++ b/samples/mfc/standard/01_Geometry/adm/win/vc12/Geometry.vcxproj @@ -533,24 +533,6 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - - Disabled - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - EnableFastChecks - true - Disabled - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - EnableFastChecks - true - MaxSpeed - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - MaxSpeed - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - @@ -578,7 +560,6 @@ - diff --git a/samples/mfc/standard/01_Geometry/adm/win/vc12/Geometry.vcxproj.filters b/samples/mfc/standard/01_Geometry/adm/win/vc12/Geometry.vcxproj.filters index 185f27ebaa..a56b5b8da7 100644 --- a/samples/mfc/standard/01_Geometry/adm/win/vc12/Geometry.vcxproj.filters +++ b/samples/mfc/standard/01_Geometry/adm/win/vc12/Geometry.vcxproj.filters @@ -66,9 +66,6 @@ Source Files\ISession2d - - Source Files\ISession2d - @@ -115,9 +112,6 @@ Header Files - - Header Files - Header Files diff --git a/samples/mfc/standard/01_Geometry/adm/win/vc14/Geometry.vcxproj b/samples/mfc/standard/01_Geometry/adm/win/vc14/Geometry.vcxproj index 8c2f1d8d44..ca257a9eba 100644 --- a/samples/mfc/standard/01_Geometry/adm/win/vc14/Geometry.vcxproj +++ b/samples/mfc/standard/01_Geometry/adm/win/vc14/Geometry.vcxproj @@ -533,24 +533,6 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - - Disabled - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - EnableFastChecks - true - Disabled - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - EnableFastChecks - true - MaxSpeed - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - MaxSpeed - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - @@ -578,7 +560,6 @@ - diff --git a/samples/mfc/standard/01_Geometry/adm/win/vc14/Geometry.vcxproj.filters b/samples/mfc/standard/01_Geometry/adm/win/vc14/Geometry.vcxproj.filters index 185f27ebaa..a56b5b8da7 100644 --- a/samples/mfc/standard/01_Geometry/adm/win/vc14/Geometry.vcxproj.filters +++ b/samples/mfc/standard/01_Geometry/adm/win/vc14/Geometry.vcxproj.filters @@ -66,9 +66,6 @@ Source Files\ISession2d - - Source Files\ISession2d - @@ -115,9 +112,6 @@ Header Files - - Header Files - Header Files diff --git a/samples/mfc/standard/01_Geometry/src/GeomSources.cpp b/samples/mfc/standard/01_Geometry/src/GeomSources.cpp index 0c433bc1e2..dabb998a17 100755 --- a/samples/mfc/standard/01_Geometry/src/GeomSources.cpp +++ b/samples/mfc/standard/01_Geometry/src/GeomSources.cpp @@ -8,6 +8,7 @@ #include "MainFrm.h" #include #include + 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, diff --git a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession2D_Curve.cpp b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession2D_Curve.cpp index 5f8bd1e5af..30fa4da9c7 100755 --- a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession2D_Curve.cpp +++ b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession2D_Curve.cpp @@ -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*/) -{ -} - - diff --git a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession2D_Curve.h b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession2D_Curve.h index 6fee7daa61..ad5fefceda 100755 --- a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession2D_Curve.h +++ b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession2D_Curve.h @@ -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 // diff --git a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.cpp b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.cpp index a712c3de19..267690e053 100755 --- a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.cpp +++ b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.cpp @@ -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*/) -{ -} - - diff --git a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.h b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.h index 54fc440888..0eba44f27c 100755 --- a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.h +++ b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.h @@ -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 #include #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) diff --git a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.cpp b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.cpp index 8475fbc775..ff9298a035 100755 --- a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.cpp +++ b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.cpp @@ -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*/) -{ -} \ No newline at end of file diff --git a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.h b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.h index f31a7cd573..0ddb6f297d 100755 --- a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.h +++ b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.h @@ -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 #include -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) diff --git a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Text.cpp b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Text.cpp deleted file mode 100755 index 29a5286afe..0000000000 --- a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Text.cpp +++ /dev/null @@ -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*/) -{ -} - diff --git a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Text.h b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Text.h deleted file mode 100755 index aa8fc5956a..0000000000 --- a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Text.h +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -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_) diff --git a/samples/mfc/standard/01_Geometry/src/StdAfx.h b/samples/mfc/standard/01_Geometry/src/StdAfx.h index 195d2b801b..24161de902 100755 --- a/samples/mfc/standard/01_Geometry/src/StdAfx.h +++ b/samples/mfc/standard/01_Geometry/src/StdAfx.h @@ -80,6 +80,7 @@ #include #include #include +#include #include #include #include @@ -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 diff --git a/samples/mfc/standard/03_Viewer2d/src/StdAfx.h b/samples/mfc/standard/03_Viewer2d/src/StdAfx.h index 100ccc9b77..d174ce7b2f 100755 --- a/samples/mfc/standard/03_Viewer2d/src/StdAfx.h +++ b/samples/mfc/standard/03_Viewer2d/src/StdAfx.h @@ -74,6 +74,7 @@ #include #include #include +#include #include #include diff --git a/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp b/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp index 0ecfec8f86..a625a10ec7 100755 --- a/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp +++ b/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp @@ -5,7 +5,6 @@ #include "Viewer2dDoc.h" #include "OCC_App.h" #include "Primitive\Sample2D_Markers.h" -#include "Primitive\Sample2D_Text.h" #include "Primitive\Sample2D_Face.h" #include "Primitive\Sample2D_Image.h" @@ -64,75 +63,69 @@ void CViewer2dDoc::OnBUTTONErase() void CViewer2dDoc::OnBUTTONTestText() { - int aColor= 1; - Standard_Real j; - for (j=15;j<=20;j++) + int aColor = Quantity_NOC_MATRABLUE; + for (Standard_Real j = 15; j <= 20; j++) { - TCollection_AsciiString Text("font 0 scale ");Text+=j/20.0; - Handle (Sample2D_Text) aText = - new Sample2D_Text(Text, - gp_Pnt(0.0,15.0*(j-15.0),0.0), // thePosition - 10.0*M_PI, // theAngle - (Quantity_NameOfColor)(aColor++), // theColor - Font_FA_Regular, // theFontAspect - "Courier", // theFont - j, // theScale - Graphic3d_HTA_LEFT, - Graphic3d_VTA_BOTTOM, - Standard_False); // aIsZoomable - + Handle(AIS_TextLabel) aText = new AIS_TextLabel(); + aText->SetText (TCollection_AsciiString ("font 0 scale ") + (j / 20.0)); + aText->SetPosition (gp_Pnt (0.0, 15.0 * (j - 15.0), 0.0)); + aText->SetAngle (30.0 * M_PI / 180.0); + aText->SetColor (Quantity_NameOfColor(aColor++)); + aText->SetFontAspect (Font_FA_Regular); + aText->SetFont ("Courier"); + aText->SetHeight (j); + aText->SetHJustification (Graphic3d_HTA_LEFT); + aText->SetVJustification (Graphic3d_VTA_BOTTOM); + aText->SetZoomable (Standard_False); myAISContext->Display(aText, Standard_False); } - for (j=10;j<=15;j++) + for (Standard_Real j = 10; j <= 15; j++) { - TCollection_AsciiString Text("font 1 scale ");Text+=j/10.0; - Handle (Sample2D_Text) aText = - new Sample2D_Text(Text, - gp_Pnt(80.,15.0*(j-10.0),0.0), // thePosition - 0.0, // theAngle - (Quantity_NameOfColor)(aColor++), // theColor - Font_FA_BoldItalic, // theFontAspect - "Cambria", // theFont - j*2, // theScale - Graphic3d_HTA_LEFT, - Graphic3d_VTA_BOTTOM, - Standard_False); // aIsZoomable - + Handle(AIS_TextLabel) aText = new AIS_TextLabel(); + aText->SetText (TCollection_AsciiString ("font 1 scale ") + (j / 10.0)); + aText->SetPosition (gp_Pnt (80.0, 15.0 * (j - 10.0), 0.0)); + aText->SetAngle (0.0); + aText->SetColor (Quantity_NameOfColor(aColor++)); + aText->SetFontAspect (Font_FA_BoldItalic); + aText->SetFont ("Cambria"); + aText->SetHeight (j * 2); + aText->SetHJustification (Graphic3d_HTA_LEFT); + aText->SetVJustification (Graphic3d_VTA_BOTTOM); + aText->SetZoomable (Standard_False); myAISContext->Display(aText, Standard_False); } - aColor = 1; - for (j=5;j<=10;j++) + + aColor = Quantity_NOC_MATRABLUE; + for (Standard_Real j = 5; j <= 10; j++) { - TCollection_AsciiString Text("font 2 scale ");Text+=j/10.0; - Handle (Sample2D_Text) aText = - new Sample2D_Text(Text, - gp_Pnt(140.0,15.0*(j-5.0),0.0), // thePosition - 0.0, // theAngle - (Quantity_NameOfColor)(aColor++), // theColor - Font_FA_Bold, // theFontAspect - "Arial", // theFont - j*2, // theScale - Graphic3d_HTA_LEFT, - Graphic3d_VTA_BOTTOM, - Standard_False); // aIsZoomable - myAISContext->Display(aText,Standard_False); + Handle(AIS_TextLabel) aText = new AIS_TextLabel(); + aText->SetText (TCollection_AsciiString ("font 2 scale ") + (j / 10.0)); + aText->SetPosition (gp_Pnt (140.0, 15.0 * (j - 5.0), 0.0)); + aText->SetAngle (0.0); + aText->SetColor (Quantity_NameOfColor(aColor++)); + aText->SetFontAspect (Font_FA_Bold); + aText->SetFont ("Arial"); + aText->SetHeight (j * 2); + aText->SetHJustification (Graphic3d_HTA_LEFT); + aText->SetVJustification (Graphic3d_VTA_BOTTOM); + aText->SetZoomable (Standard_False); + myAISContext->Display(aText, Standard_False); } -for (j=10;j<=15;j++) + for (Standard_Real j = 10; j <= 15; j++) { - TCollection_AsciiString Text("font 3 scale ");Text+=j/10.0; - Handle (Sample2D_Text) aText = - new Sample2D_Text(Text, - gp_Pnt(200.0,15.0*(j-10.0),0.0), // thePosition - 0.0, // theAngle - (Quantity_NameOfColor)(aColor++),// theColor - Font_FA_Italic, // theFontAspect - "Georgia", // theFont - j*2, // theScale - Graphic3d_HTA_LEFT, - Graphic3d_VTA_BOTTOM, - Standard_False); // aIsZoomable - myAISContext->Display(aText,Standard_False); + Handle(AIS_TextLabel) aText = new AIS_TextLabel(); + aText->SetText (TCollection_AsciiString ("font 3 scale ") + (j / 10.0)); + aText->SetPosition (gp_Pnt (200.0, 15.0 * (j - 10.0), 0.0)); + aText->SetAngle (0.0); + aText->SetColor (Quantity_NameOfColor(aColor++)); + aText->SetFontAspect (Font_FA_Italic); + aText->SetFont ("Georgia"); + aText->SetHeight (j * 2); + aText->SetHJustification (Graphic3d_HTA_LEFT); + aText->SetVJustification (Graphic3d_VTA_BOTTOM); + aText->SetZoomable (Standard_False); + myAISContext->Display(aText, Standard_False); } FitAll2DViews(Standard_True); // Update Viewer diff --git a/samples/mfc/standard/Common/Primitive/Sample2D_Text.cpp b/samples/mfc/standard/Common/Primitive/Sample2D_Text.cpp deleted file mode 100755 index db2bebe15f..0000000000 --- a/samples/mfc/standard/Common/Primitive/Sample2D_Text.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "stdafx.h" - -#include "Sample2D_Text.h" - -IMPLEMENT_STANDARD_RTTIEXT(Sample2D_Text,AIS_InteractiveObject) - -Sample2D_Text::Sample2D_Text (const TCollection_AsciiString& theText, - const gp_Pnt& thePosition, - const Quantity_PlaneAngle theAngle, - const Quantity_Color theColor, - const Font_FontAspect theFontAspect, - const Standard_CString theFont, - const Standard_Real theHeight, - const Graphic3d_HorizontalTextAlignment theHAlign, - const Graphic3d_VerticalTextAlignment theVAlign, - const Standard_Boolean theIsZoomable) -:AIS_InteractiveObject() -{ - myText = theText ; - myPosition = thePosition ; - myAngle = theAngle ; - myColor = theColor ; - myFontAspect = theFontAspect; - myFont = theFont ; - myColor = theColor ; - myHeight = theHeight ; - myIsZoomable = theIsZoomable ; - myHAlign = theHAlign ; - myVAlign = theVAlign ; -} - -void Sample2D_Text::Compute (const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/, - const Handle(Prs3d_Presentation)& aPresentation, - const Standard_Integer /*aMode*/) -{ - aPresentation->Clear(); - - Handle(Prs3d_TextAspect) asp = myDrawer->TextAspect(); - - asp->SetFont(myFont); - asp->SetColor(myColor); - asp->SetHeight(myHeight); - - asp->SetHorizontalJustification(myHAlign); - asp->SetVerticalJustification(myVAlign); - asp->Aspect()->SetTextZoomable(myIsZoomable == Standard_True); - asp->Aspect()->SetTextAngle(myAngle); - asp->Aspect()->SetTextFontAspect(myFontAspect); - asp->SetHeight(myHeight); - Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (aPresentation), asp, myText, myPosition); -} diff --git a/samples/mfc/standard/Common/Primitive/Sample2D_Text.h b/samples/mfc/standard/Common/Primitive/Sample2D_Text.h deleted file mode 100755 index 53376aa8e8..0000000000 --- a/samples/mfc/standard/Common/Primitive/Sample2D_Text.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef _Sample2D_Text_HeaderFile -#define _Sample2D_Text_HeaderFile -#include -#include -#include -#include -#include - -class Sample2D_Text; -DEFINE_STANDARD_HANDLE(Sample2D_Text,AIS_InteractiveObject) -class Sample2D_Text : public AIS_InteractiveObject -{ - -public: - -Standard_EXPORT - Sample2D_Text (const TCollection_AsciiString& theText,const gp_Pnt& thePosition, - const Quantity_PlaneAngle theAngle = 0.0 , - const Quantity_Color theColor = Quantity_NOC_YELLOW, - const Font_FontAspect theFontAspect = Font_FA_Regular, - const Standard_CString theFont = "Courier", - const Standard_Real theHeight = 1, - const Graphic3d_HorizontalTextAlignment theHAlign = Graphic3d_HTA_LEFT, - const Graphic3d_VerticalTextAlignment theVAlign = Graphic3d_VTA_BOTTOM, - const Standard_Boolean theIsZoomable = Standard_True); - -inline TCollection_AsciiString GetText() const { return myText ; } -inline void SetText(const TCollection_AsciiString& theText) { myText = theText; } -inline void GetCoord(gp_Pnt& thePosition) const { thePosition=gp_Pnt(myPosition); } -inline void SetCoord(const gp_Pnt& thePosition) { myPosition = thePosition; } -inline Standard_Real GetAngle() const { return myAngle; } -inline void SetAngle(const Standard_Real theAngle) { myAngle = theAngle; } -inline Quantity_Color GetColor() const { return myColor; } -inline void SetColor(const Quantity_Color theColor) { myColor = theColor; } -inline Quantity_Factor GetScale() const { return myScale; } -inline void SetScale (const Quantity_Factor theScale) { myScale = theScale; } -inline Standard_Boolean GetIsZoomable() const { return myIsZoomable; } -inline void SetIsZoomable(const Standard_Boolean theIsZoomable) { myIsZoomable = theIsZoomable;} - - -DEFINE_STANDARD_RTTIEXT(Sample2D_Text,AIS_InteractiveObject) - -private: - - void Compute ( const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, - const Handle(Prs3d_Presentation)& aPresentation, - const Standard_Integer aMode); - - void ComputeSelection (const Handle(SelectMgr_Selection)& /*aSelection*/, - const Standard_Integer /*aMode*/) - { - - } - - -TCollection_AsciiString myText ; -gp_Pnt myPosition ; -Standard_Real myAngle ; -Quantity_Color myColor ; -Standard_CString myFont ; -Quantity_Factor myScale ; -Standard_Real myHeight ; -Font_FontAspect myFontAspect ; -Standard_Boolean myIsZoomable ; -Graphic3d_HorizontalTextAlignment myHAlign ; -Graphic3d_VerticalTextAlignment myVAlign ; - -}; - -#endif diff --git a/samples/mfc/standard/mfcsample/CMakeLists.txt b/samples/mfc/standard/mfcsample/CMakeLists.txt index 05664ef70b..767bf853a7 100644 --- a/samples/mfc/standard/mfcsample/CMakeLists.txt +++ b/samples/mfc/standard/mfcsample/CMakeLists.txt @@ -52,12 +52,10 @@ set (COMMON_ISESSION2D_SOURCE_FILES ${COMMON_ISESSION2D_DIR}/ISession2D_Shape.cp set (COMMON_PRIMITIVE_DIR ${MFC_STANDARD_COMMON_SAMPLES_DIR}/Primitive) set (COMMON_PRIMITIVE_HEADER_FILES ${COMMON_PRIMITIVE_DIR}/Sample2D_Face.h ${COMMON_PRIMITIVE_DIR}/Sample2D_Image.h - ${COMMON_PRIMITIVE_DIR}/Sample2D_Markers.h - ${COMMON_PRIMITIVE_DIR}/Sample2D_Text.h ) + ${COMMON_PRIMITIVE_DIR}/Sample2D_Markers.h ) set (COMMON_PRIMITIVE_SOURCE_FILES ${COMMON_PRIMITIVE_DIR}/Sample2D_Face.cpp ${COMMON_PRIMITIVE_DIR}/Sample2D_Image.cpp - ${COMMON_PRIMITIVE_DIR}/Sample2D_Markers.cpp - ${COMMON_PRIMITIVE_DIR}/Sample2D_Text.cpp ) + ${COMMON_PRIMITIVE_DIR}/Sample2D_Markers.cpp ) # Common Resource2D set (COMMON_RESOURCE2D_DIR ${MFC_STANDARD_COMMON_SAMPLES_DIR}/Resource2D) diff --git a/samples/mfc/standard/mfcsample/adm/win/vc10/mfcsample.vcxproj b/samples/mfc/standard/mfcsample/adm/win/vc10/mfcsample.vcxproj index 6a4b07e54b..ca2b558697 100644 --- a/samples/mfc/standard/mfcsample/adm/win/vc10/mfcsample.vcxproj +++ b/samples/mfc/standard/mfcsample/adm/win/vc10/mfcsample.vcxproj @@ -669,22 +669,6 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - - Disabled - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - EnableFastChecks - Disabled - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - EnableFastChecks - MaxSpeed - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - MaxSpeed - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - Disabled %(AdditionalIncludeDirectories) @@ -748,7 +732,6 @@ - diff --git a/samples/mfc/standard/mfcsample/adm/win/vc10/mfcsample.vcxproj.filters b/samples/mfc/standard/mfcsample/adm/win/vc10/mfcsample.vcxproj.filters index 9e1f073424..9a0cc52520 100644 --- a/samples/mfc/standard/mfcsample/adm/win/vc10/mfcsample.vcxproj.filters +++ b/samples/mfc/standard/mfcsample/adm/win/vc10/mfcsample.vcxproj.filters @@ -111,9 +111,6 @@ Source Files\Primitive-src - - Source Files\Primitive-src - Source Files\ISession2D-src @@ -223,9 +220,6 @@ Header Files\Primitive-headers - - Header Files\Primitive-headers - Header Files\ISession2D-headers diff --git a/samples/mfc/standard/mfcsample/adm/win/vc11/mfcsample.vcxproj b/samples/mfc/standard/mfcsample/adm/win/vc11/mfcsample.vcxproj index f688c8dfa2..7ec5dd2852 100644 --- a/samples/mfc/standard/mfcsample/adm/win/vc11/mfcsample.vcxproj +++ b/samples/mfc/standard/mfcsample/adm/win/vc11/mfcsample.vcxproj @@ -673,22 +673,6 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - - Disabled - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - EnableFastChecks - Disabled - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - EnableFastChecks - MaxSpeed - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - MaxSpeed - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - Disabled %(AdditionalIncludeDirectories) @@ -752,7 +736,6 @@ - diff --git a/samples/mfc/standard/mfcsample/adm/win/vc11/mfcsample.vcxproj.filters b/samples/mfc/standard/mfcsample/adm/win/vc11/mfcsample.vcxproj.filters index dfe07fcfe0..5c272911d2 100644 --- a/samples/mfc/standard/mfcsample/adm/win/vc11/mfcsample.vcxproj.filters +++ b/samples/mfc/standard/mfcsample/adm/win/vc11/mfcsample.vcxproj.filters @@ -114,9 +114,6 @@ Source Files\Primitive-src - - Source Files\Primitive-src - Source Files\ISession2D-src @@ -226,9 +223,6 @@ Header Files\Primitive-headers - - Header Files\Primitive-headers - Header Files\ISession2D-headers diff --git a/samples/mfc/standard/mfcsample/adm/win/vc12/mfcsample.vcxproj b/samples/mfc/standard/mfcsample/adm/win/vc12/mfcsample.vcxproj index e8d07002f5..6511d7675c 100644 --- a/samples/mfc/standard/mfcsample/adm/win/vc12/mfcsample.vcxproj +++ b/samples/mfc/standard/mfcsample/adm/win/vc12/mfcsample.vcxproj @@ -673,22 +673,6 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - - Disabled - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - EnableFastChecks - Disabled - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - EnableFastChecks - MaxSpeed - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - MaxSpeed - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - Disabled %(AdditionalIncludeDirectories) @@ -752,7 +736,6 @@ - diff --git a/samples/mfc/standard/mfcsample/adm/win/vc12/mfcsample.vcxproj.filters b/samples/mfc/standard/mfcsample/adm/win/vc12/mfcsample.vcxproj.filters index dfe07fcfe0..5c272911d2 100644 --- a/samples/mfc/standard/mfcsample/adm/win/vc12/mfcsample.vcxproj.filters +++ b/samples/mfc/standard/mfcsample/adm/win/vc12/mfcsample.vcxproj.filters @@ -114,9 +114,6 @@ Source Files\Primitive-src - - Source Files\Primitive-src - Source Files\ISession2D-src @@ -226,9 +223,6 @@ Header Files\Primitive-headers - - Header Files\Primitive-headers - Header Files\ISession2D-headers diff --git a/samples/mfc/standard/mfcsample/adm/win/vc14/mfcsample.vcxproj b/samples/mfc/standard/mfcsample/adm/win/vc14/mfcsample.vcxproj index 3f75f8c8ed..c18792c2f0 100644 --- a/samples/mfc/standard/mfcsample/adm/win/vc14/mfcsample.vcxproj +++ b/samples/mfc/standard/mfcsample/adm/win/vc14/mfcsample.vcxproj @@ -673,22 +673,6 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) - - Disabled - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - EnableFastChecks - Disabled - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - EnableFastChecks - MaxSpeed - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - MaxSpeed - %(AdditionalIncludeDirectories) - %(PreprocessorDefinitions) - Disabled %(AdditionalIncludeDirectories) @@ -752,7 +736,6 @@ - diff --git a/samples/mfc/standard/mfcsample/adm/win/vc14/mfcsample.vcxproj.filters b/samples/mfc/standard/mfcsample/adm/win/vc14/mfcsample.vcxproj.filters index dfe07fcfe0..5c272911d2 100644 --- a/samples/mfc/standard/mfcsample/adm/win/vc14/mfcsample.vcxproj.filters +++ b/samples/mfc/standard/mfcsample/adm/win/vc14/mfcsample.vcxproj.filters @@ -114,9 +114,6 @@ Source Files\Primitive-src - - Source Files\Primitive-src - Source Files\ISession2D-src @@ -226,9 +223,6 @@ Header Files\Primitive-headers - - Header Files\Primitive-headers - Header Files\ISession2D-headers