GetBValue (MSColor)/255.0,
Quantity_TOC_RGB);
- TopoDS_Shape S = myAISContext->SelectedShape();
- Handle(Geom_Surface) Surface = BRep_Tool::Surface (TopoDS::Face(S));
- if (Surface->IsKind (STANDARD_TYPE (Geom_Plane)))
- {
- Handle(User_Cylinder)::DownCast (myAISContext->SelectedInteractive())
- ->SetPlanarFaceColor (CSFColor.Name());
- }
- else
- {
- Handle(User_Cylinder)::DownCast (myAISContext->SelectedInteractive())
- ->SetCylindricalFaceColor (CSFColor.Name());
- }
-
- myAISContext->Redisplay (myAISContext->SelectedInteractive());
+ Handle(AIS_InteractiveObject) aSelectedObject = myAISContext->SelectedInteractive();
+ Handle(User_Cylinder)::DownCast (aSelectedObject)->SetColor (CSFColor.Name());
+
+ myAISContext->Redisplay (aSelectedObject);
myState = -1;
myAISContext->CloseLocalContext();
}
myShape = S.Shape();
SetHilightMode(0);
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
- myPlanarFaceColor = Quantity_NOC_FIREBRICK3;
- myCylindricalFaceColor = Quantity_NOC_GRAY;
+ myColor = Quantity_NOC_GRAY;
}
User_Cylinder::User_Cylinder(const gp_Ax2 CylAx2, const Standard_Real R, const Standard_Real H) :
myShape = aNurbsConvert.Shape();
SetHilightMode(0);
myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
- myPlanarFaceColor = Quantity_NOC_FIREBRICK3;
- myCylindricalFaceColor = Quantity_NOC_KHAKI4;
+ myColor = Quantity_NOC_KHAKI4;
}
void User_Cylinder::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
const Standard_Integer aMode )
{
switch (aMode) {
-case 0:
- StdPrs_WFShape::Add(aPresentation,myShape, myDrawer );
- break;
-case 1:
+case AIS_WireFrame:
+ {
+ StdPrs_WFShape::Add(aPresentation,myShape, myDrawer );
+ break;
+ }
+case AIS_Shaded:
{
-
Standard_Real aTransparency = Transparency();
Graphic3d_NameOfMaterial aMaterial = Material();
- TopExp_Explorer Ex;
- Handle(Geom_Surface) Surface;
-
- for (Ex.Init(myShape,TopAbs_FACE); Ex.More(); Ex.Next())
- {
-
- Surface = BRep_Tool::Surface(TopoDS::Face(Ex.Current()));
- myDrawer->ShadingAspect()->SetMaterial(aMaterial);
- if (Surface->IsKind(STANDARD_TYPE(Geom_Plane)))
- myDrawer->ShadingAspect()->SetColor(myPlanarFaceColor);
- else
- myDrawer->ShadingAspect()->SetColor(myCylindricalFaceColor);
-
-
- myDrawer->ShadingAspect()->SetTransparency (aTransparency);
- StdPrs_ShadedShape::Add(aPresentation,Ex.Current(), myDrawer);
- }
+ myDrawer->ShadingAspect()->SetMaterial(aMaterial);
+ myDrawer->ShadingAspect()->SetColor(myColor);
+ myDrawer->ShadingAspect()->SetTransparency (aTransparency);
+ StdPrs_ShadedShape::Add(aPresentation,myShape, myDrawer);
break;
-
}
case 6: //color
{
void User_Cylinder::Compute(const Handle(Prs3d_Projector)& aProjector,
const Handle(Prs3d_Presentation)& aPresentation)
{
- myDrawer->EnableDrawHiddenLine();
+ Handle (Prs3d_Drawer) aDefDrawer = GetContext()->DefaultDrawer();
+ if (aDefDrawer->DrawHiddenLine())
+ myDrawer->EnableDrawHiddenLine();
+ else
+ myDrawer->DisableDrawHiddenLine();
StdPrs_HLRPolyShape::Add(aPresentation,myShape,myDrawer,aProjector);
}
return Standard_True;
}
-void User_Cylinder::SetPlanarFaceColor(const Quantity_Color acolor)
-{
- myPlanarFaceColor = acolor;
-}
-
-void User_Cylinder::SetCylindricalFaceColor(const Quantity_Color acolor)
-{
- myCylindricalFaceColor = acolor;
-}
-
Standard_Boolean User_Cylinder::TriangleIsValid(const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3) const
{
gp_Vec V1(P1,P2);// V1=(P1,P2)
void User_Cylinder::SetColor(const Quantity_Color &aColor)
{
AIS_InteractiveObject::SetColor(aColor);
- SetPlanarFaceColor(aColor);
- SetCylindricalFaceColor(aColor);
+ myColor = aColor;
}
~User_Cylinder(){};
Standard_Boolean AcceptShapeDecomposition() const;
- void Standard_EXPORT SetCylindricalFaceColor(const Quantity_Color acolor);
- void Standard_EXPORT SetPlanarFaceColor(const Quantity_Color);
Standard_Integer NbPossibleSelection() const;
void SetColor(const Quantity_Color &aColor);
//
DEFINE_STANDARD_RTTIEXT(User_Cylinder,AIS_InteractiveObject)
private:
-// Quantity_NameOfColor myCylindricalFaceColor;
-// Quantity_NameOfColor myPlanarFaceColor;
- Quantity_Color myCylindricalFaceColor;
- Quantity_Color myPlanarFaceColor;
+ Quantity_Color myColor;
TopoDS_Shape myShape;
Handle(Graphic3d_AspectFillArea3d) myAspect;