1 // Created on: 2002-04-09
2 // Created by: QA Admin
3 // Copyright (c) 2002-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
22 #include <QABugs_PresentableObject.ixx>
23 #include <QABugs_PresentableObject.hxx>
25 #include <Graphic3d_Group.hxx>
26 #include <Graphic3d_MaterialAspect.hxx>
27 #include <Prs3d_ShadingAspect.hxx>
28 #include <Graphic3d_AspectFillArea3d.hxx>
29 #include <Graphic3d_ArrayOfTriangles.hxx>
32 #include <AIS_Drawer.hxx>
34 QABugs_PresentableObject::QABugs_PresentableObject(const PrsMgr_TypeOfPresentation3d theTypeOfPresentation3d)
35 :AIS_InteractiveObject(theTypeOfPresentation3d)
39 void QABugs_PresentableObject::Compute(const Handle(PrsMgr_PresentationManager3d)& ,
40 const Handle(Prs3d_Presentation)& thePrs,
41 const Standard_Integer theMode)
43 Handle(Graphic3d_Structure) aStructure = Handle(Graphic3d_Structure)::DownCast (thePrs);
44 Handle(Graphic3d_Group) aGroup = new Graphic3d_Group (aStructure);
45 Handle_Prs3d_ShadingAspect anAspect = myDrawer->ShadingAspect();
46 Graphic3d_MaterialAspect aMat = anAspect->Aspect()->FrontMaterial();
47 aMat.SetReflectionModeOff (Graphic3d_TOR_AMBIENT);
48 aMat.SetReflectionModeOff (Graphic3d_TOR_DIFFUSE);
49 aMat.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
50 aMat.SetReflectionModeOff (Graphic3d_TOR_EMISSION);
51 anAspect->SetMaterial (aMat);
52 aGroup->SetPrimitivesAspect (anAspect->Aspect());
54 Handle(Graphic3d_ArrayOfTriangles) aPrims
55 = new Graphic3d_ArrayOfTriangles (6, 0,
56 theMode == 1, // normals
57 Standard_True); // color per vertex
62 aPrims->AddVertex (gp_Pnt (0.0, 0.0, 0.0), Quantity_Color (Quantity_NOC_RED));
63 aPrims->AddVertex (gp_Pnt (0.0, 5.0, 1.0), Quantity_Color (Quantity_NOC_BLUE1));
64 aPrims->AddVertex (gp_Pnt (5.0, 0.0, 1.0), Quantity_Color (Quantity_NOC_YELLOW));
66 aPrims->AddVertex (gp_Pnt (0.0, 5.0, 1.0), Quantity_Color (Quantity_NOC_BLUE1));
67 aPrims->AddVertex (gp_Pnt (5.0, 5.0, -1.0), Quantity_Color (Quantity_NOC_GREEN));
68 aPrims->AddVertex (gp_Pnt (5.0, 0.0, 1.0), Quantity_Color (Quantity_NOC_YELLOW));
73 aPrims->AddVertex (gp_Pnt ( 5.0, 0.0, 0.0), gp_Dir (0.0, 0.0, 1.0), Quantity_Color (Quantity_NOC_RED));
74 aPrims->AddVertex (gp_Pnt ( 5.0, 5.0, 1.0), gp_Dir (1.0, 1.0, 1.0), Quantity_Color (Quantity_NOC_BLUE1));
75 aPrims->AddVertex (gp_Pnt (10.0, 0.0, 1.0), gp_Dir (0.0, 1.0, 1.0), Quantity_Color (Quantity_NOC_YELLOW));
77 aPrims->AddVertex (gp_Pnt ( 5.0, 5.0, 1.0), gp_Dir (1.0, 1.0, 1.0), Quantity_Color (Quantity_NOC_BLUE1));
78 aPrims->AddVertex (gp_Pnt (10.0, 5.0, -1.0), gp_Dir (0.0, 0.0, -1.0), Quantity_Color (Quantity_NOC_GREEN));
79 aPrims->AddVertex (gp_Pnt (10.0, 0.0, 1.0), gp_Dir (0.0, 1.0, 1.0), Quantity_Color (Quantity_NOC_YELLOW));
84 aGroup->BeginPrimitives();
85 aGroup->AddPrimitiveArray (aPrims);
86 aGroup->EndPrimitives();
89 void QABugs_PresentableObject::ComputeSelection(const Handle(SelectMgr_Selection)& ,
90 const Standard_Integer ) {