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 <QARoutelous_PresentableObject.ixx>
23 #include <QARoutelous_PresentableObject.hxx>
25 #include <Graphic3d_Group.hxx>
26 #include <Graphic3d_MaterialAspect.hxx>
27 #include <Prs3d_ShadingAspect.hxx>
28 #include <Graphic3d_AspectFillArea3d.hxx>
29 #include <Aspect_Array1OfEdge.hxx>
30 #include <Graphic3d_VertexC.hxx>
31 #include <Graphic3d_VertexNC.hxx>
32 #include <Graphic3d_Array1OfVertexC.hxx>
33 #include <Graphic3d_Array1OfVertexNC.hxx>
34 #include <AIS_Drawer.hxx>
36 QARoutelous_PresentableObject::QARoutelous_PresentableObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d)
37 :AIS_InteractiveObject(aTypeOfPresentation3d)
41 void QARoutelous_PresentableObject::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
42 const Handle(Prs3d_Presentation)& aPresentation,
43 const Standard_Integer aMode )
45 Handle(Graphic3d_Structure) theStructure = Handle(Graphic3d_Structure)::DownCast(aPresentation);
46 Handle(Graphic3d_Group) theGroup= new Graphic3d_Group(theStructure);
47 Handle_Prs3d_ShadingAspect theAspect = myDrawer->ShadingAspect();
48 Graphic3d_MaterialAspect mat = theAspect->Aspect()->FrontMaterial();
49 mat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
50 mat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
51 mat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
52 mat.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
53 theAspect->SetMaterial(mat);
54 theGroup->SetPrimitivesAspect(theAspect->Aspect());
56 Aspect_Array1OfEdge aListEdge(1, 3);
57 aListEdge.SetValue(1, Aspect_Edge(1, 2, Aspect_TOE_VISIBLE));
58 aListEdge.SetValue(2, Aspect_Edge(2, 3, Aspect_TOE_VISIBLE));
59 aListEdge.SetValue(3, Aspect_Edge(3, 1, Aspect_TOE_VISIBLE));
60 theGroup->BeginPrimitives();
64 case 0://using VertexC
66 Graphic3d_Array1OfVertexC theArray1(1, 3);
68 theArray1.SetValue(1, Graphic3d_VertexC(0,0,0,Quantity_NOC_RED));
69 theArray1.SetValue(2, Graphic3d_VertexC(0,5,1,Quantity_NOC_BLUE1));
70 theArray1.SetValue(3, Graphic3d_VertexC(5,0,1,Quantity_NOC_YELLOW));
71 theGroup->TriangleSet(theArray1, aListEdge);
73 theArray1.SetValue(1, Graphic3d_VertexC(0,5,1,Quantity_NOC_BLUE1));
74 theArray1.SetValue(2, Graphic3d_VertexC(5,5,-1,Quantity_NOC_GREEN));
75 theArray1.SetValue(3, Graphic3d_VertexC(5,0,1,Quantity_NOC_YELLOW));
76 theGroup->TriangleSet(theArray1, aListEdge);
79 case 1://using VertexNC
81 Graphic3d_Array1OfVertexNC theArray1(1, 3);
83 theArray1.SetValue(1, Graphic3d_VertexNC(5,0,0, //coord
86 theArray1.SetValue(2, Graphic3d_VertexNC(5,5,1, //coord
89 theArray1.SetValue(3, Graphic3d_VertexNC(10,0,1, //coord
91 Quantity_NOC_YELLOW));
92 theGroup->TriangleSet(theArray1, aListEdge);
94 theArray1.SetValue(1, Graphic3d_VertexNC(5,5,1, //coord
97 theArray1.SetValue(2, Graphic3d_VertexNC(10,5,-1, //coord
100 theArray1.SetValue(3, Graphic3d_VertexNC(10,0,1, //coord
102 Quantity_NOC_YELLOW));
103 theGroup->TriangleSet(theArray1, aListEdge);
107 theGroup->EndPrimitives();
111 void QARoutelous_PresentableObject::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
112 const Standard_Integer aMode) {