]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketcherPrs/SketcherPrs_SymbolPrs.cpp
Salome HOME
d4d0df3cee43eb7916c819d32fa5fde35c08032e
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_SymbolPrs.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        SketcherPrs_SymbolPrs.cpp
4 // Created:     12 March 2015
5 // Author:      Vitaly SMETANNIKOV
6
7 #include "SketcherPrs_SymbolPrs.h"
8 #include "SketcherPrs_Tools.h"
9 #include "SketcherPrs_PositionMgr.h"
10
11 #include <GeomAPI_Edge.h>
12 #include <GeomAPI_Vertex.h>
13 #include <GeomAPI_Curve.h>
14
15 #include <Events_Error.h>
16
17 #include <Graphic3d_ArrayOfSegments.hxx>
18 #include <Graphic3d_BndBox4f.hxx>
19
20 #include <SelectMgr_Selection.hxx>
21 #include <Select3D_SensitivePoint.hxx>
22 #include <TopLoc_Location.hxx>
23 #include <AIS_InteractiveContext.hxx>
24 #include <V3d_Viewer.hxx>
25 #include <Prs3d_Root.hxx>
26 #include <Geom_CartesianPoint.hxx>
27 #include <GeomAdaptor_Curve.hxx>
28 #include <StdPrs_DeflectionCurve.hxx>
29 #include <StdPrs_Point.hxx>
30 #include <StdPrs_Curve.hxx>
31
32 #include <OpenGl_Element.hxx>
33 #include <OpenGl_GraphicDriver.hxx>
34 #include <OpenGl_Context.hxx>
35 #include <OpenGl_View.hxx>
36 #include <OpenGl_PointSprite.hxx>
37 #include <OpenGl_VertexBuffer.hxx>
38 #include <OpenGl_ShaderManager.hxx>
39
40 #ifdef WIN32
41 # define FSEP "\\"
42 #else
43 # define FSEP "/"
44 #endif
45
46 /// Step between icons
47 static const double MyDist = 0.02;
48
49 /// Function to convert opengl data type
50 GLenum toGlDataType (const Graphic3d_TypeOfData theType, GLint& theNbComp)
51 {
52   switch (theType) {
53     case Graphic3d_TOD_USHORT:
54       theNbComp = 1;
55       return GL_UNSIGNED_SHORT;
56     case Graphic3d_TOD_UINT:
57       theNbComp = 1;
58       return GL_UNSIGNED_INT;
59     case Graphic3d_TOD_VEC2:
60       theNbComp = 2;
61       return GL_FLOAT;
62     case Graphic3d_TOD_VEC3:
63       theNbComp = 3;
64       return GL_FLOAT;
65     case Graphic3d_TOD_VEC4:
66       theNbComp = 4;
67       return GL_FLOAT;
68     case Graphic3d_TOD_VEC4UB:
69       theNbComp = 4;
70       return GL_UNSIGNED_BYTE;
71   }
72   theNbComp = 0;
73   return GL_NONE;
74 }
75
76
77 //*******************************************************************
78 //! Auxiliary class for Vertex buffer with interleaved attributes.
79 class SketcherPrs_VertexBuffer : public OpenGl_VertexBuffer
80 {
81
82 public:
83
84   //! Create uninitialized VBO..
85   //! \param theAttribs attributes
86   //! \param theStride a flag
87   SketcherPrs_VertexBuffer (const Graphic3d_Attribute* theAttribs,
88                         const Standard_Integer     theStride)
89   : Stride (theStride), NbAttributes(1)
90   {
91
92     memcpy (Attribs, theAttribs, sizeof(Graphic3d_Attribute) * NbAttributes);
93   }
94
95   //! Create uninitialized VBO.
96   SketcherPrs_VertexBuffer (const Graphic3d_Buffer& theAttribs)
97   : Stride (theAttribs.Stride), NbAttributes(1)
98   {
99     memcpy (Attribs, theAttribs.AttributesArray(), sizeof(Graphic3d_Attribute) * NbAttributes);
100   }
101
102   /// Returns True if color attribute is defined
103   virtual bool HasColorAttribute() const
104   {
105     for (Standard_Integer anAttribIter = 0; anAttribIter < NbAttributes; ++anAttribIter) {
106       const Graphic3d_Attribute& anAttrib = Attribs[anAttribIter];
107       if (anAttrib.Id == Graphic3d_TOA_COLOR) {
108         return true;
109       }
110     }
111     return false;
112   }
113
114   /// Returns True if normal attribute is defined
115   virtual bool HasNormalAttribute() const
116   {
117     for (Standard_Integer anAttribIter = 0; anAttribIter < NbAttributes; ++anAttribIter) {
118       const Graphic3d_Attribute& anAttrib = Attribs[anAttribIter];
119       if (anAttrib.Id == Graphic3d_TOA_NORM) {
120         return true;
121       }
122     }
123     return false;
124   }
125
126   /// Bind position of the attribute
127   /// \param theGlCtx OpenGl context
128   virtual void BindPositionAttribute (const Handle(OpenGl_Context)& theGlCtx) const
129   {
130     if (!OpenGl_VertexBuffer::IsValid()) {
131       return;
132     }
133
134     OpenGl_VertexBuffer::Bind (theGlCtx);
135     GLint aNbComp;
136     const GLubyte* anOffset = OpenGl_VertexBuffer::myOffset;
137     for (Standard_Integer anAttribIter = 0; anAttribIter < NbAttributes; ++anAttribIter) {
138       const Graphic3d_Attribute& anAttrib = Attribs[anAttribIter];
139       const GLenum   aDataType = toGlDataType (anAttrib.DataType, aNbComp);
140       if (aDataType == GL_NONE) {
141         continue;
142       } else if (anAttrib.Id == Graphic3d_TOA_POS) {
143         OpenGl_VertexBuffer::bindAttribute (theGlCtx, Graphic3d_TOA_POS, aNbComp, aDataType, Stride, anOffset);
144         break;
145       }
146
147       anOffset += Graphic3d_Attribute::Stride (anAttrib.DataType);
148     }
149   }
150
151   /// Bind all attributes
152   /// \param theGlCtx OpenGl context
153   virtual void BindAllAttributes (const Handle(OpenGl_Context)& theGlCtx) const
154   {
155     if (!OpenGl_VertexBuffer::IsValid())
156       return;
157
158     OpenGl_VertexBuffer::Bind (theGlCtx);
159     GLint aNbComp;
160     const GLubyte* anOffset = OpenGl_VertexBuffer::myOffset;
161     for (Standard_Integer anAttribIter = 0; anAttribIter < NbAttributes; ++anAttribIter)
162     {
163       const Graphic3d_Attribute& anAttrib = Attribs[anAttribIter];
164       const GLenum   aDataType = toGlDataType (anAttrib.DataType, aNbComp);
165       if (aDataType == GL_NONE)
166         continue;
167
168       OpenGl_VertexBuffer::bindAttribute (theGlCtx, anAttrib.Id, aNbComp, aDataType, Stride, anOffset);
169       anOffset += Graphic3d_Attribute::Stride (anAttrib.DataType);
170     }
171   }
172
173   /// Unbind all attributes
174   /// \param theGlCtx OpenGl context
175   virtual void UnbindAllAttributes (const Handle(OpenGl_Context)& theGlCtx) const
176   {
177     if (!OpenGl_VertexBuffer::IsValid())
178       return;
179     OpenGl_VertexBuffer::Unbind (theGlCtx);
180
181     for (Standard_Integer anAttribIter = 0; anAttribIter < NbAttributes; ++anAttribIter) {
182       const Graphic3d_Attribute& anAttrib = Attribs[anAttribIter];
183       OpenGl_VertexBuffer::unbindAttribute (theGlCtx, anAttrib.Id);
184     }
185   }
186
187 public:
188
189   /// Array of attributes
190   Graphic3d_Attribute Attribs[1];
191
192   /// A flag
193   Standard_Integer    Stride;
194
195   /// Number of attributes
196   Standard_Integer NbAttributes;
197 };
198
199 //**************************************************************
200 //! Redefinition of OpenGl_Element
201 class SketcherPrs_Element: public OpenGl_Element
202 {
203 public:
204   /// Constructor
205   /// \param theObj a presentation
206   SketcherPrs_Element(const Handle(SketcherPrs_SymbolPrs)& theObj) : 
207   OpenGl_Element(), myObj(theObj) {}
208
209   /// Render the current presentation
210   /// \param theWorkspace OpenGL workspace
211   virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const
212   {
213     if (!myObj.IsNull())
214       myObj->Render(theWorkspace);
215   }
216
217   /// Releases OpenGL resources
218   /// \param theContext OpenGL context
219   virtual void Release (OpenGl_Context* theContext) 
220   {
221     if (!myObj.IsNull())
222       myObj->Release(theContext);
223   }
224
225 private:
226   Handle(SketcherPrs_SymbolPrs) myObj;
227 };
228
229
230 //**************************************************************
231 //! Definition of call back
232 OpenGl_Element* SymbolPrsCallBack(const CALL_DEF_USERDRAW * theUserDraw)
233 {
234   Handle(SketcherPrs_SymbolPrs) anIObj = (SketcherPrs_SymbolPrs*)theUserDraw->Data;
235   if (anIObj.IsNull()) {
236     std::cout << "VUserDrawCallback error: null object passed, the custom scene element will not be rendered" << std::endl;
237   }
238   return new SketcherPrs_Element(anIObj);
239 }
240
241
242 //*****************************************************************************
243 IMPLEMENT_STANDARD_HANDLE(SketcherPrs_SymbolPrs, AIS_InteractiveObject);
244 IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_SymbolPrs, AIS_InteractiveObject);
245
246
247 std::map<const char*, Handle(Image_AlienPixMap)> SketcherPrs_SymbolPrs::myIconsMap;
248
249
250 SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint, 
251                                              const std::shared_ptr<GeomAPI_Ax3>& thePlane)
252  : AIS_InteractiveObject(), myConstraint(theConstraint), myPlane(thePlane), myIsConflicting(false)
253 {
254   SetAutoHilight(Standard_False);
255 }
256
257 SketcherPrs_SymbolPrs::~SketcherPrs_SymbolPrs()
258 {
259   SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
260   // Empty memory in position manager
261   aMgr->deleteConstraint(this);
262 }
263
264 #ifdef _WINDOWS
265 #pragma warning( disable : 4996 )
266 #endif
267
268 Handle(Image_AlienPixMap) SketcherPrs_SymbolPrs::icon()
269 {
270   if (myIsConflicting) {
271     if (myErrorIcon.IsNull()) {
272       char* aEnv = getenv("NEWGEOM_ROOT_DIR");
273       if (aEnv != NULL) {
274         TCollection_AsciiString aFile(aEnv);
275         aFile+=FSEP;
276         aFile+="resources";
277         aFile += FSEP;
278         aFile += "conflicting_icon.png";
279         Handle(Image_AlienPixMap) aPixMap = new Image_AlienPixMap();
280         if (aPixMap->Load(aFile)) {
281           myErrorIcon = aPixMap;
282         }
283       }
284     }
285     return myErrorIcon;
286   }
287
288   if (myIconsMap.count(iconName()) == 1) {
289     return myIconsMap[iconName()];
290   }
291   // Load icon for the presentation
292   char* aEnv = getenv("NEWGEOM_ROOT_DIR");
293   if (aEnv != NULL) {
294     TCollection_AsciiString aFile(aEnv);
295     aFile+=FSEP;
296     aFile+="resources";
297     aFile += FSEP;
298     aFile += iconName();
299     Handle(Image_AlienPixMap) aPixMap = new Image_AlienPixMap();
300     if (aPixMap->Load(aFile)) {
301       myIconsMap[iconName()] = aPixMap;
302       return aPixMap;
303     }
304   }
305   // The icon for constraint is not found
306   static const char aMsg[] = "Error! constraint images are not found";
307   cout<<aMsg<<endl;
308   Events_Error::send(aMsg);
309   myIconsMap[iconName()] = Handle(Image_AlienPixMap)();
310   return Handle(Image_AlienPixMap)();
311 }
312
313 void SketcherPrs_SymbolPrs::prepareAspect()
314 {
315   // Create an aspect with the icon
316   if (myAspect.IsNull()) {
317     Handle(Image_AlienPixMap) aIcon = icon();
318     if (aIcon.IsNull()) 
319       myAspect = new Graphic3d_AspectMarker3d();
320     else
321       myAspect = new Graphic3d_AspectMarker3d(aIcon);
322   }
323 }
324
325 void SketcherPrs_SymbolPrs::addLine(const Handle(Graphic3d_Group)& theGroup, std::string theAttrName) const
326 {
327   ObjectPtr aObj = SketcherPrs_Tools::getResult(myConstraint, theAttrName);
328   std::shared_ptr<GeomAPI_Shape> aLine = SketcherPrs_Tools::getShape(aObj);
329   if (aLine.get() == NULL)
330     return;
331   std::shared_ptr<GeomAPI_Edge> aEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aLine));
332
333   std::shared_ptr<GeomAPI_Pnt> aPnt1 = aEdge->firstPoint();
334   std::shared_ptr<GeomAPI_Pnt> aPnt2 = aEdge->lastPoint();
335
336   // Draw line by two points
337   Handle(Graphic3d_ArrayOfSegments) aLines = new Graphic3d_ArrayOfSegments(2, 1);
338   aLines->AddVertex(aPnt1->impl<gp_Pnt>());
339   aLines->AddVertex(aPnt2->impl<gp_Pnt>());
340   theGroup->AddPrimitiveArray(aLines);
341 }
342
343 void SketcherPrs_SymbolPrs::HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM, 
344                                            const SelectMgr_SequenceOfOwner& theOwners)
345 {
346
347   Handle( Prs3d_Presentation ) aSelectionPrs = GetSelectPresentation( thePM );
348   aSelectionPrs->Clear();
349   drawLines(aSelectionPrs, Quantity_NOC_WHITE);
350
351   aSelectionPrs->SetDisplayPriority(9);
352   aSelectionPrs->Display();
353   thePM->Highlight(this);
354 }
355
356 void SketcherPrs_SymbolPrs::HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d)& thePM, 
357                                                  const Quantity_NameOfColor theColor, 
358                                                  const Handle(SelectMgr_EntityOwner)& theOwner)
359 {
360   thePM->Color(this, theColor);
361
362   Handle( Prs3d_Presentation ) aHilightPrs = GetHilightPresentation( thePM );
363   aHilightPrs->Clear();
364   drawLines(aHilightPrs, theColor);
365
366   if (thePM->IsImmediateModeOn())
367     thePM->AddToImmediateList(aHilightPrs);
368 }
369
370 void SketcherPrs_SymbolPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
371                                    const Handle(Prs3d_Presentation)& thePresentation, 
372                                    const Standard_Integer theMode)
373 {
374   // Create an icon
375   prepareAspect();
376
377   Handle(AIS_InteractiveContext) aCtx = GetContext();
378   Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(aCtx->CurrentViewer()->Driver());
379   if (!aDriver.IsNull()) {
380     // register the custom element factory function
381     aDriver->UserDrawCallback() = SymbolPrsCallBack;
382   }
383
384   // Update points with default shift value
385   if (!updatePoints(20)) {
386     return;
387   }
388
389   int aNbVertex = myPntArray->VertexNumber();
390   if (myOwner.IsNull()) {
391     myOwner = new SelectMgr_EntityOwner(this);
392   }
393
394   // Create sensitive point for each symbol
395   mySPoints.Clear();
396   for (int i = 1; i <= aNbVertex; i++) {
397     Handle(SketcherPrs_SensitivePoint) aSP = new SketcherPrs_SensitivePoint(myOwner, i);
398     mySPoints.Append(aSP);
399   }
400
401   Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePresentation);
402   aGroup->SetPrimitivesAspect(myAspect);
403
404   // Recompute boundary box of the group
405   Graphic3d_BndBox4f& aBnd = aGroup->ChangeBoundingBox();
406   gp_Pnt aVert;
407   aBnd.Clear();
408   for (int i = 1; i <= myPntArray->ItemNumber(); i++) {
409     aVert = myPntArray->Vertice(i);
410     aBnd.Add (Graphic3d_Vec4((float)aVert.X(), (float)aVert.Y(), (float)aVert.Z(), 1.0f));
411   }
412
413   // Pint the group with custom procedure (see Render)
414   aGroup->UserDraw(this, true);
415
416   // Disable frustum culling for this object by marking it as mutable
417   aGroup->Structure()->SetMutable(true);
418   //aGroup->AddPrimitiveArray(myPntArray);
419 }
420
421
422
423 void SketcherPrs_SymbolPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
424                                             const Standard_Integer aMode)
425 {
426   ClearSelected();
427   if ((aMode == 0) || (aMode == SketcherPrs_Tools::Sel_Constraint)) {
428     for (int i = 1; i <= mySPoints.Length(); i++)
429       aSelection->Add(mySPoints.Value(i));
430   }
431 }
432
433 void SketcherPrs_SymbolPrs::SetConflictingConstraint(const bool& theConflicting)
434 {
435   if (myIsConflicting != theConflicting) {
436     myIsConflicting = theConflicting;
437     Handle(Image_AlienPixMap) anIcon = icon();
438     if (!anIcon.IsNull())
439       myAspect->SetMarkerImage(new Graphic3d_MarkerImage(anIcon));
440   }
441 }
442
443 void SketcherPrs_SymbolPrs::Render(const Handle(OpenGl_Workspace)& theWorkspace) const
444 {
445   // do not update presentation for invalid or already removed objects: the presentation
446   // should be removed soon
447   if (!myConstraint->data().get() || !myConstraint->data()->isValid())
448     return;
449
450   const OpenGl_AspectMarker* anAspectMarker = theWorkspace->AspectMarker(Standard_True);
451   const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
452   Handle(OpenGl_View) aView = theWorkspace->ActiveView();
453   
454   double aScale = aView->Camera()->Scale();
455   // Update points coordinate taking the viewer scale into account
456   if (!updatePoints(MyDist * aScale))
457     return;
458
459   Handle(Graphic3d_Buffer) aAttribs = myPntArray->Attributes();
460
461   if (myVboAttribs.IsNull()) {
462     myVboAttribs = new SketcherPrs_VertexBuffer(*aAttribs);
463   }
464
465   // Update drawing attributes
466   if (!myVboAttribs->init(aCtx, 0, aAttribs->NbElements, aAttribs->Data(), GL_NONE, aAttribs->Stride)) {
467     myVboAttribs->Release (aCtx.operator->());
468     myVboAttribs.Nullify();
469     return;
470   }
471     
472   Handle(OpenGl_Texture) aTextureBack = theWorkspace->DisableTexture();
473
474   const Handle(OpenGl_PointSprite)& aSpriteNorm = anAspectMarker->SpriteRes(aCtx);
475       
476   if (!aSpriteNorm.IsNull() && !aSpriteNorm->IsDisplayList()) {
477     const bool toHilight = (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) != 0;
478     const Handle(OpenGl_PointSprite)& aSprite = (toHilight && anAspectMarker->SpriteHighlightRes(aCtx)->IsValid())
479                                               ? anAspectMarker->SpriteHighlightRes(aCtx)
480                                               : aSpriteNorm;
481     theWorkspace->EnableTexture (aSprite);
482     aCtx->ShaderManager()->BindProgram(anAspectMarker, aSprite, Standard_False, Standard_False, anAspectMarker->ShaderProgramRes(aCtx));
483     const TEL_COLOUR* aLineColor  =  &anAspectMarker->Color();
484     if (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)
485       aLineColor = theWorkspace->HighlightColor;
486
487     // Set lighting of the symbol
488     if (toHilight)
489       aCtx->core11fwd->glDisable (GL_LIGHTING);
490     else
491       aCtx->core11fwd->glEnable (GL_LIGHTING);
492
493     aCtx->SetColor4fv(*(const OpenGl_Vec4* )(aLineColor->rgb));
494
495
496     myVboAttribs->BindAllAttributes(aCtx);
497     // Textured markers will be drawn with the point sprites
498     aCtx->SetPointSize (anAspectMarker->MarkerSize());
499     aCtx->core11fwd->glEnable (GL_ALPHA_TEST);
500     aCtx->core11fwd->glAlphaFunc (GL_GEQUAL, 0.1f);
501
502     aCtx->core11fwd->glEnable (GL_BLEND);
503     aCtx->core11fwd->glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
504
505     aCtx->core11fwd->glDrawArrays (0, 0, myVboAttribs->GetElemsNb());
506
507     aCtx->core11fwd->glDisable (GL_BLEND);
508     aCtx->core11fwd->glDisable (GL_ALPHA_TEST);
509     aCtx->SetPointSize (1.0f);
510   }
511   theWorkspace->EnableTexture (aTextureBack);
512   aCtx->BindProgram (NULL);
513
514   // Update selection position only if there is no selected object
515   // because it can corrupt selection of other objects
516   if ((GetContext()->NbCurrents() == 0) && (GetContext()->NbSelected() == 0))
517   {
518     GetContext()->MainSelector()->RebuildSensitivesTree (this);
519     GetContext()->MainSelector()->RebuildObjectsTree (false);
520   }
521 }
522
523
524 void SketcherPrs_SymbolPrs::Release (OpenGl_Context* theContext)
525 {
526   // Release OpenGl resources
527   if (!myVboAttribs.IsNull()) {
528     if (theContext) {
529       theContext->DelayedRelease (myVboAttribs);
530     }
531     myVboAttribs.Nullify();
532   }
533 }
534
535 void SketcherPrs_SymbolPrs::drawShape(const std::shared_ptr<GeomAPI_Shape>& theShape, 
536                                       const Handle(Prs3d_Presentation)& thePrs) const
537 {
538   if (theShape->isEdge()) {
539     // The shape is edge
540     std::shared_ptr<GeomAPI_Curve> aCurve = 
541       std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(theShape));
542     if (aCurve->isLine()) {
543       // The shape is line
544       GeomAdaptor_Curve aCurv(aCurve->impl<Handle(Geom_Curve)>(), aCurve->startParam(), aCurve->endParam());
545       StdPrs_Curve::Add(thePrs, aCurv, myDrawer);
546     } else {
547       // The shape is circle or arc
548       GeomAdaptor_Curve aAdaptor(aCurve->impl<Handle(Geom_Curve)>(), aCurve->startParam(), aCurve->endParam());
549       StdPrs_DeflectionCurve::Add(thePrs,aAdaptor,myDrawer);
550     }
551   } else if (theShape->isVertex()) {
552     // draw vertex
553     std::shared_ptr<GeomAPI_Vertex> aVertex = 
554       std::shared_ptr<GeomAPI_Vertex>(new GeomAPI_Vertex(theShape));
555     std::shared_ptr<GeomAPI_Pnt> aPnt = aVertex->point();
556     Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl<gp_Pnt>());
557     StdPrs_Point::Add(thePrs, aPoint, myDrawer);
558   }
559 }
560
561 void SketcherPrs_SymbolPrs::drawListOfShapes(const std::shared_ptr<ModelAPI_AttributeRefList>& theListAttr, 
562                                              const Handle(Prs3d_Presentation)& thePrs) const
563 {
564   int aNb = theListAttr->size();
565   if (aNb == 0)
566     return;
567   int i;
568   ObjectPtr aObj;
569   for (i = 0; i < aNb; i++) {
570     aObj = theListAttr->object(i);
571     std::shared_ptr<GeomAPI_Shape> aShape = SketcherPrs_Tools::getShape(aObj);
572     if (aShape.get() != NULL)
573       drawShape(aShape, thePrs);
574   }
575 }
576
577 void SketcherPrs_SymbolPrs::BoundingBox (Bnd_Box& theBndBox)
578 {
579   Select3D_BndBox3d aTmpBox;
580   for (Select3D_EntitySequenceIter aPntIter (mySPoints); aPntIter.More(); aPntIter.Next()) {
581     const Handle(Select3D_SensitiveEntity)& anEnt = aPntIter.Value();
582     aTmpBox.Combine (anEnt->BoundingBox());
583   }
584
585   theBndBox.Update (aTmpBox.CornerMin().x(), aTmpBox.CornerMin().y(), aTmpBox.CornerMin().z(),
586                     aTmpBox.CornerMax().x(), aTmpBox.CornerMax().y(), aTmpBox.CornerMax().z());
587 }
588