| 1 | // Created on: 1998-03-27 |
| 2 | // Created by: Robert COUBLANC |
| 3 | // Copyright (c) 1998-1999 Matra Datavision |
| 4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
| 5 | // |
| 6 | // This file is part of Open CASCADE Technology software library. |
| 7 | // |
| 8 | // This library is free software; you can redistribute it and/or modify it under |
| 9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
| 10 | // by the Free Software Foundation, with special exception defined in the file |
| 11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
| 12 | // distribution for complete text of the license and disclaimer of any warranty. |
| 13 | // |
| 14 | // Alternatively, this file may be used under the terms of Open CASCADE |
| 15 | // commercial license or contractual agreement. |
| 16 | |
| 17 | #include <StdSelect_Shape.ixx> |
| 18 | #include <StdPrs_WFShape.hxx> |
| 19 | #include <Prs3d_LineAspect.hxx> |
| 20 | #include <Prs3d_PointAspect.hxx> |
| 21 | #include <Aspect_TypeOfMarker.hxx> |
| 22 | #include <Prs3d_PlaneAspect.hxx> |
| 23 | #include <Prs3d_Drawer.hxx> |
| 24 | #include <StdPrs_ShadedShape.hxx> |
| 25 | #include <TopAbs_ShapeEnum.hxx> |
| 26 | |
| 27 | StdSelect_Shape::StdSelect_Shape(const TopoDS_Shape& sh): |
| 28 | mysh(sh) |
| 29 | {} |
| 30 | |
| 31 | void StdSelect_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*PM*/, |
| 32 | const Handle(Prs3d_Presentation)& P, |
| 33 | const Standard_Integer aMode) |
| 34 | { |
| 35 | if(mysh.IsNull()) return; |
| 36 | |
| 37 | static Handle(Prs3d_Drawer) DRWR; |
| 38 | if(DRWR.IsNull()){ |
| 39 | DRWR = new Prs3d_Drawer(); |
| 40 | DRWR->WireAspect()->SetWidth(2); |
| 41 | DRWR->LineAspect()->SetWidth(2.); |
| 42 | DRWR->PlaneAspect()->EdgesAspect()->SetWidth(2.); |
| 43 | DRWR->FreeBoundaryAspect()->SetWidth(2.); |
| 44 | DRWR->UnFreeBoundaryAspect()->SetWidth(2.); |
| 45 | Standard_Integer I = 5;//pour tests... |
| 46 | DRWR->PointAspect()->SetTypeOfMarker((Aspect_TypeOfMarker)I); |
| 47 | DRWR->PointAspect()->SetScale(2.); |
| 48 | } |
| 49 | |
| 50 | Standard_Boolean CanShade = (mysh.ShapeType()<5 || mysh.ShapeType()==8); |
| 51 | if(aMode==1){ |
| 52 | if(CanShade) |
| 53 | StdPrs_ShadedShape::Add(P,mysh,DRWR); |
| 54 | else |
| 55 | StdPrs_WFShape::Add(P,mysh,DRWR); |
| 56 | } |
| 57 | else if (aMode==0) |
| 58 | StdPrs_WFShape::Add(P,mysh,DRWR); |
| 59 | } |
| 60 | |
| 61 | void StdSelect_Shape::Compute(const Handle(Prs3d_Projector)& aProjector , |
| 62 | const Handle(Geom_Transformation)& aGeomTrans, |
| 63 | const Handle(Prs3d_Presentation)& aPresentation ) |
| 64 | { |
| 65 | PrsMgr_PresentableObject::Compute(aProjector,aGeomTrans,aPresentation); |
| 66 | } |
| 67 | |
| 68 | |
| 69 | void StdSelect_Shape::Compute(const Handle(Prs3d_Projector)& aProjector, |
| 70 | const Handle(Prs3d_Presentation)& aPresentation) |
| 71 | { |
| 72 | PrsMgr_PresentableObject::Compute(aProjector,aPresentation); |
| 73 | } |