2 // Created: Wed Aug 9 14:38:46 1995
3 // Author: Arnaud BOUZY/Odile Olivier
6 #define GER61351 //GG_171199 Enable to set an object RGB color
7 // instead a restricted object NameOfColor.
9 #include <AIS_Point.ixx>
10 #include <Aspect_TypeOfLine.hxx>
11 #include <Prs3d_Drawer.hxx>
12 #include <Prs3d_PointAspect.hxx>
13 #include <Graphic3d_Structure.hxx>
14 #include <Graphic3d_Group.hxx>
15 #include <Quantity_Color.hxx>
16 #include <Graphic3d_Vertex.hxx>
17 #include <Graphic3d_AspectMarker3d.hxx>
18 #include <SelectMgr_EntityOwner.hxx>
19 #include <SelectBasics_EntityOwner.hxx>
20 #include <Select3D_SensitivePoint.hxx>
21 #include <StdPrs_Point.hxx>
22 #include <Geom_Point.hxx>
23 #include <BRepBuilderAPI_MakeVertex.hxx>
24 #include <AIS_Drawer.hxx>
26 #include <AIS_InteractiveContext.hxx>
27 //=======================================================================
28 //function : AIS_Point
30 //=======================================================================
31 AIS_Point::AIS_Point(const Handle(Geom_Point)& aComponent):
32 myComponent(aComponent),
33 myHasTOM(Standard_False),
34 myTOM(Aspect_TOM_PLUS)
39 //=======================================================================
40 //function : Component
42 //=======================================================================
44 Handle(Geom_Point) AIS_Point::Component()
49 //=======================================================================
50 //function : SetComponent
52 //=======================================================================
54 void AIS_Point::SetComponent(const Handle(Geom_Point)& aComponent)
56 myComponent = aComponent;
59 //=======================================================================
62 //=======================================================================
63 void AIS_Point::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
64 const Handle(Prs3d_Presentation)& aPresentation,
65 const Standard_Integer aMode)
67 aPresentation->Clear();
69 aPresentation->SetInfiniteState(myInfiniteState);
72 StdPrs_Point::Add(aPresentation,myComponent,myDrawer);
75 // Beeurk.. a revoir - rob-25/04/97
76 static Handle(Graphic3d_AspectMarker3d) PtA =
77 new Graphic3d_AspectMarker3d ();
78 PtA->SetType(Aspect_TOM_PLUS);
80 Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
81 TheGroup->SetPrimitivesAspect(PtA);
82 Graphic3d_Vertex Vtx(myComponent->X(),myComponent->Y(),myComponent->Z());
83 TheGroup->Marker(Vtx);
88 //=======================================================================
91 //=======================================================================
93 void AIS_Point::Compute(const Handle_Prs3d_Projector& aProjector,
94 const Handle_Geom_Transformation& aTransformation,
95 const Handle_Prs3d_Presentation& aPresentation)
97 // Standard_NotImplemented::Raise("AIS_Point::Compute(const Handle_Prs3d_Projector&, const Handle_Geom_Transformation&, const Handle_Prs3d_Presentation&)");
98 PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation) ;
101 //=======================================================================
102 //function : ComputeSelection
104 //=======================================================================
105 void AIS_Point::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
106 const Standard_Integer /*aMode*/)
108 Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this,10);
109 // eown -> SelectBasics_EntityOwner::Set(5);
110 Handle(Select3D_SensitivePoint) sp = new Select3D_SensitivePoint(eown,
115 //=======================================================================
116 //function : SetColor
118 //=======================================================================
120 void AIS_Point::SetColor(const Quantity_NameOfColor aCol)
123 SetColor(Quantity_Color(aCol));
126 void AIS_Point::SetColor(const Quantity_Color &aCol)
129 hasOwnColor=Standard_True;
134 //=======================================================================
135 //function : UnsetColor
137 //=======================================================================
138 void AIS_Point::UnsetColor()
140 hasOwnColor=Standard_False;
145 //=======================================================================
148 //=======================================================================
149 TopoDS_Vertex AIS_Point::Vertex() const
151 gp_Pnt P = myComponent->Pnt();
152 return BRepBuilderAPI_MakeVertex(P);
155 //=======================================================================
157 //purpose : to avoid warning
158 //=======================================================================
159 void AIS_Point::Compute(const Handle(PrsMgr_PresentationManager2d)&,
160 const Handle(Graphic2d_GraphicObject)&,
161 const Standard_Integer)
164 //=======================================================================
166 //purpose : to avoid warning
167 //=======================================================================
168 void AIS_Point::Compute(const Handle(Prs3d_Projector)&,
169 const Handle(Prs3d_Presentation)&)
173 //=======================================================================
174 //function : SetMarker
176 //=======================================================================
178 void AIS_Point::SetMarker(const Aspect_TypeOfMarker aTOM)
181 myHasTOM = Standard_True;
185 //=======================================================================
186 //function : UnsetMarker
188 //=======================================================================
189 void AIS_Point::UnsetMarker()
191 myHasTOM = Standard_False;
195 //=======================================================================
196 //function : AcceptDisplayMode
198 //=======================================================================
200 Standard_Boolean AIS_Point::
201 AcceptDisplayMode(const Standard_Integer aMode) const
205 //=======================================================================
206 //function : UpdatePointValues
208 //=======================================================================
210 void AIS_Point::UpdatePointValues()
213 if(!hasOwnColor && myOwnWidth==0.0 && !myHasTOM){
214 myDrawer->PointAspect().Nullify();
220 Quantity_NameOfColor aCol;
223 Aspect_TypeOfMarker aTOM;
224 Standard_Real aScale;
226 if(myDrawer->HasLink()){
227 myDrawer->Link()->PointAspect()->Aspect()->Values(QCO,aTOM,aScale);
231 aCol = Quantity_NOC_YELLOW;
232 aTOM = Aspect_TOM_PLUS;
235 if(hasOwnColor) aCol = myOwnColor;
236 if(myOwnWidth!=0.0) aScale = myOwnWidth;
237 if(myHasTOM) aTOM = myTOM;
240 if(myDrawer->HasPointAspect()){
242 // const Handle(Prs3d_PointAspect) PA = myDrawer->PointAspect();
243 Handle(Prs3d_PointAspect) PA = myDrawer->PointAspect();
246 PA->SetTypeOfMarker(aTOM);
247 PA->SetScale(aScale);
250 myDrawer->SetPointAspect(new Prs3d_PointAspect(aTOM,aCol,aScale));