0024166: Unable to create file with "Save" menu of voxeldemo Qt sample
[occt.git] / src / StdSelect / StdSelect_Shape.cxx
CommitLineData
b311480e 1// Created on: 1998-03-27
2// Created by: Robert COUBLANC
3// Copyright (c) 1998-1999 Matra Datavision
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
20
7fd59977 21
22
23
24#include <StdSelect_Shape.ixx>
25#include <StdPrs_WFShape.hxx>
26#include <Prs3d_LineAspect.hxx>
27#include <Prs3d_PointAspect.hxx>
28#include <Aspect_TypeOfMarker.hxx>
29#include <Prs3d_PlaneAspect.hxx>
30#include <Prs3d_Drawer.hxx>
31#include <StdPrs_ShadedShape.hxx>
32#include <TopAbs_ShapeEnum.hxx>
33
34StdSelect_Shape::StdSelect_Shape(const TopoDS_Shape& sh):
35 mysh(sh)
36{}
37
35e08fe8 38void StdSelect_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*PM*/,
7fd59977 39 const Handle(Prs3d_Presentation)& P,
40 const Standard_Integer aMode)
41{
42 if(mysh.IsNull()) return;
43
44 static Handle(Prs3d_Drawer) DRWR;
45 if(DRWR.IsNull()){
46 DRWR = new Prs3d_Drawer();
47 DRWR->WireAspect()->SetWidth(2);
48 DRWR->LineAspect()->SetWidth(2.);
49 DRWR->PlaneAspect()->EdgesAspect()->SetWidth(2.);
50 DRWR->FreeBoundaryAspect()->SetWidth(2.);
51 DRWR->UnFreeBoundaryAspect()->SetWidth(2.);
52 Standard_Integer I = 5;//pour tests...
53 DRWR->PointAspect()->SetTypeOfMarker((Aspect_TypeOfMarker)I);
54 DRWR->PointAspect()->SetScale(2.);
55 }
56
57 Standard_Boolean CanShade = (mysh.ShapeType()<5 || mysh.ShapeType()==8);
58 if(aMode==1){
59 if(CanShade)
60 StdPrs_ShadedShape::Add(P,mysh,DRWR);
61 else
62 StdPrs_WFShape::Add(P,mysh,DRWR);
63 }
64 else if (aMode==0)
65 StdPrs_WFShape::Add(P,mysh,DRWR);
66}
67
68void StdSelect_Shape::Compute(const Handle_Prs3d_Projector& aProjector ,
69 const Handle_Geom_Transformation& aGeomTrans,
70 const Handle_Prs3d_Presentation& aPresentation )
71{
72 PrsMgr_PresentableObject::Compute(aProjector,aGeomTrans,aPresentation);
73}
74
7fd59977 75
76void StdSelect_Shape::Compute(const Handle_Prs3d_Projector& aProjector,
77 const Handle_Prs3d_Presentation& aPresentation)
78{
79 PrsMgr_PresentableObject::Compute(aProjector,aPresentation);
80}