Salome HOME
Issue #1860: fix end lines with spaces
[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_InfoMessage.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,
144                                            aDataType, Stride, anOffset);
145         break;
146       }
147
148       anOffset += Graphic3d_Attribute::Stride (anAttrib.DataType);
149     }
150   }
151
152   /// Bind all attributes
153   /// \param theGlCtx OpenGl context
154   virtual void BindAllAttributes (const Handle(OpenGl_Context)& theGlCtx) const
155   {
156     if (!OpenGl_VertexBuffer::IsValid())
157       return;
158
159     OpenGl_VertexBuffer::Bind (theGlCtx);
160     GLint aNbComp;
161     const GLubyte* anOffset = OpenGl_VertexBuffer::myOffset;
162     for (Standard_Integer anAttribIter = 0; anAttribIter < NbAttributes; ++anAttribIter)
163     {
164       const Graphic3d_Attribute& anAttrib = Attribs[anAttribIter];
165       const GLenum   aDataType = toGlDataType (anAttrib.DataType, aNbComp);
166       if (aDataType == GL_NONE)
167         continue;
168
169       OpenGl_VertexBuffer::bindAttribute(theGlCtx, anAttrib.Id, aNbComp,
170                                          aDataType, Stride, anOffset);
171       anOffset += Graphic3d_Attribute::Stride (anAttrib.DataType);
172     }
173   }
174
175   /// Unbind all attributes
176   /// \param theGlCtx OpenGl context
177   virtual void UnbindAllAttributes (const Handle(OpenGl_Context)& theGlCtx) const
178   {
179     if (!OpenGl_VertexBuffer::IsValid())
180       return;
181     OpenGl_VertexBuffer::Unbind (theGlCtx);
182
183     for (Standard_Integer anAttribIter = 0; anAttribIter < NbAttributes; ++anAttribIter) {
184       const Graphic3d_Attribute& anAttrib = Attribs[anAttribIter];
185       OpenGl_VertexBuffer::unbindAttribute (theGlCtx, anAttrib.Id);
186     }
187   }
188
189 public:
190
191   /// Array of attributes
192   Graphic3d_Attribute Attribs[1];
193
194   /// A flag
195   Standard_Integer    Stride;
196
197   /// Number of attributes
198   Standard_Integer NbAttributes;
199 };
200
201 //**************************************************************
202 //! Redefinition of OpenGl_Element
203 class SketcherPrs_Element: public OpenGl_Element
204 {
205 public:
206   /// Constructor
207   /// \param theObj a presentation
208   SketcherPrs_Element(const Handle(SketcherPrs_SymbolPrs)& theObj) :
209   OpenGl_Element(), myObj(theObj) {}
210
211   /// Render the current presentation
212   /// \param theWorkspace OpenGL workspace
213   virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const
214   {
215     if (!myObj.IsNull())
216       myObj->Render(theWorkspace);
217   }
218
219   /// Releases OpenGL resources
220   /// \param theContext OpenGL context
221   virtual void Release (OpenGl_Context* theContext)
222   {
223     if (!myObj.IsNull())
224       myObj->Release(theContext);
225   }
226
227 private:
228   Handle(SketcherPrs_SymbolPrs) myObj;
229 };
230
231
232 //**************************************************************
233 //! Definition of call back
234 OpenGl_Element* SymbolPrsCallBack(const CALL_DEF_USERDRAW * theUserDraw)
235 {
236   Handle(SketcherPrs_SymbolPrs) anIObj = (SketcherPrs_SymbolPrs*)theUserDraw->Data;
237   if (anIObj.IsNull()) {
238     std::cout <<
239       "VUserDrawCallback error: null object passed, the custom scene element will not be rendered"
240       << std::endl;
241   }
242   return new SketcherPrs_Element(anIObj);
243 }
244
245
246 //*****************************************************************************
247 IMPLEMENT_STANDARD_HANDLE(SketcherPrs_SymbolPrs, AIS_InteractiveObject);
248 IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_SymbolPrs, AIS_InteractiveObject);
249
250
251 std::map<const char*, Handle(Image_AlienPixMap)> SketcherPrs_SymbolPrs::myIconsMap;
252
253
254 SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint,
255                                              const std::shared_ptr<GeomAPI_Ax3>& thePlane)
256  : AIS_InteractiveObject(), myConstraint(theConstraint), myPlane(thePlane), myIsConflicting(false)
257 {
258   SetAutoHilight(Standard_False);
259   myPntArray = new Graphic3d_ArrayOfPoints(1);
260   myPntArray->AddVertex(0., 0., 0.);
261 }
262
263 SketcherPrs_SymbolPrs::~SketcherPrs_SymbolPrs()
264 {
265   SketcherPrs_PositionMgr* aMgr = SketcherPrs_PositionMgr::get();
266   // Empty memory in position manager
267   aMgr->deleteConstraint(this);
268 }
269
270 #ifdef _WINDOWS
271 #pragma warning( disable : 4996 )
272 #endif
273
274 Handle(Image_AlienPixMap) SketcherPrs_SymbolPrs::icon()
275 {
276   if (myIconsMap.count(iconName()) == 1) {
277     return myIconsMap[iconName()];
278   }
279   // Load icon for the presentation
280   std::string aFile;
281   char* anEnv = getenv("SHAPER_ROOT_DIR");
282   if (anEnv) {
283     aFile = std::string(anEnv) +
284       FSEP + "share" + FSEP + "salome" + FSEP + "resources" + FSEP + "shaper";
285   } else {
286     anEnv = getenv("OPENPARTS_ROOT_DIR");
287     if (anEnv)
288       aFile = std::string(anEnv) + FSEP + "resources";
289   }
290
291   aFile += FSEP;
292   aFile += iconName();
293   Handle(Image_AlienPixMap) aPixMap = new Image_AlienPixMap();
294   if (aPixMap->Load(aFile.c_str())) {
295     myIconsMap[iconName()] = aPixMap;
296     return aPixMap;
297   }
298   // The icon for constraint is not found
299   static const char aMsg[] = "Error! constraint images are not found";
300   cout<<aMsg<<endl;
301   Events_InfoMessage("SketcherPrs_SymbolPrs", aMsg).send();
302   myIconsMap[iconName()] = Handle(Image_AlienPixMap)();
303   return Handle(Image_AlienPixMap)();
304 }
305
306 void SketcherPrs_SymbolPrs::prepareAspect()
307 {
308   // Create an aspect with the icon
309   if (myAspect.IsNull()) {
310     Handle(Image_AlienPixMap) aIcon = icon();
311     if (aIcon.IsNull())
312       myAspect = new Graphic3d_AspectMarker3d();
313     else
314       myAspect = new Graphic3d_AspectMarker3d(aIcon);
315   }
316 }
317
318 void SketcherPrs_SymbolPrs::addLine(const Handle(Graphic3d_Group)& theGroup,
319                                     std::string theAttrName) const
320 {
321   ObjectPtr aObj = SketcherPrs_Tools::getResult(myConstraint, theAttrName);
322   std::shared_ptr<GeomAPI_Shape> aLine = SketcherPrs_Tools::getShape(aObj);
323   if (aLine.get() == NULL)
324     return;
325   std::shared_ptr<GeomAPI_Edge> aEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aLine));
326
327   std::shared_ptr<GeomAPI_Pnt> aPnt1 = aEdge->firstPoint();
328   std::shared_ptr<GeomAPI_Pnt> aPnt2 = aEdge->lastPoint();
329
330   // Draw line by two points
331   Handle(Graphic3d_ArrayOfSegments) aLines = new Graphic3d_ArrayOfSegments(2, 1);
332   aLines->AddVertex(aPnt1->impl<gp_Pnt>());
333   aLines->AddVertex(aPnt2->impl<gp_Pnt>());
334   theGroup->AddPrimitiveArray(aLines);
335 }
336
337 void SketcherPrs_SymbolPrs::HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM,
338                                            const SelectMgr_SequenceOfOwner& theOwners)
339 {
340
341   Handle( Prs3d_Presentation ) aSelectionPrs = GetSelectPresentation( thePM );
342   aSelectionPrs->Clear();
343   drawLines(aSelectionPrs, Quantity_NOC_WHITE);
344
345   aSelectionPrs->SetDisplayPriority(9);
346   aSelectionPrs->Display();
347   thePM->Highlight(this);
348 }
349
350 void SketcherPrs_SymbolPrs::HilightOwnerWithColor(
351   const Handle(PrsMgr_PresentationManager3d)& thePM,
352   const Quantity_NameOfColor theColor,
353   const Handle(SelectMgr_EntityOwner)& theOwner)
354 {
355   thePM->Color(this, theColor);
356
357   Handle( Prs3d_Presentation ) aHilightPrs = GetHilightPresentation( thePM );
358   aHilightPrs->Clear();
359   drawLines(aHilightPrs, theColor);
360
361   if (thePM->IsImmediateModeOn())
362     thePM->AddToImmediateList(aHilightPrs);
363 }
364
365 void SketcherPrs_SymbolPrs::Compute(
366   const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
367   const Handle(Prs3d_Presentation)& thePresentation,
368   const Standard_Integer theMode)
369 {
370   // Create an icon
371   prepareAspect();
372
373   Handle(AIS_InteractiveContext) aCtx = GetContext();
374   Handle(OpenGl_GraphicDriver) aDriver =
375     Handle(OpenGl_GraphicDriver)::DownCast(aCtx->CurrentViewer()->Driver());
376   if (!aDriver.IsNull()) {
377     // register the custom element factory function
378     aDriver->UserDrawCallback() = SymbolPrsCallBack;
379   }
380
381   // Update points with default shift value
382   // it updates array of points if the presentation is ready to display, or the array of points
383   // contains the previous values
384
385   bool aReadyToDisplay = updateIfReadyToDisplay(20);
386
387   int aNbVertex = myPntArray->VertexNumber();
388   if (myOwner.IsNull()) {
389     myOwner = new SelectMgr_EntityOwner(this);
390   }
391
392   // Create sensitive point for each symbol
393   mySPoints.Clear();
394   for (int i = 1; i <= aNbVertex; i++) {
395     Handle(SketcherPrs_SensitivePoint) aSP = new SketcherPrs_SensitivePoint(myOwner, i);
396     mySPoints.Append(aSP);
397   }
398
399   Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(thePresentation);
400   aGroup->SetPrimitivesAspect(myAspect);
401
402   // Recompute boundary box of the group
403   Graphic3d_BndBox4f& aBnd = aGroup->ChangeBoundingBox();
404   gp_Pnt aVert;
405   aBnd.Clear();
406   for (int i = 1; i <= myPntArray->ItemNumber(); i++) {
407     aVert = myPntArray->Vertice(i);
408     aBnd.Add (Graphic3d_Vec4((float)aVert.X(), (float)aVert.Y(), (float)aVert.Z(), 1.0f));
409   }
410
411   // Pint the group with custom procedure (see Render)
412   aGroup->UserDraw(this, true);
413
414   // Disable frustum culling for this object by marking it as mutable
415   aGroup->Structure()->SetMutable(true);
416   //aGroup->AddPrimitiveArray(myPntArray);
417
418   if (!aReadyToDisplay)
419     SketcherPrs_Tools::sendEmptyPresentationError(myConstraint,
420                           "An empty AIS presentation: SketcherPrs_LengthDimension");
421 }
422
423
424
425 void SketcherPrs_SymbolPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
426                                              const Standard_Integer aMode)
427 {
428   ClearSelected();
429   if ((aMode == 0) || (aMode == SketcherPrs_Tools::Sel_Constraint)) {
430     for (int i = 1; i <= mySPoints.Length(); i++)
431       aSelection->Add(mySPoints.Value(i));
432   }
433 }
434
435 void SketcherPrs_SymbolPrs::SetConflictingConstraint(const bool& theConflicting,
436                                                      const std::vector<int>& theColor)
437 {
438   if (theConflicting)
439   {
440     if (!myAspect.IsNull())
441       myAspect->SetColor (Quantity_Color (theColor[0] / 255., theColor[1] / 255.,
442                           theColor[2] / 255., Quantity_TOC_RGB));
443     myIsConflicting = true;
444   }
445   else
446   {
447     if (!myAspect.IsNull())
448       myAspect->SetColor (Quantity_Color (1.0, 1.0, 0.0, Quantity_TOC_RGB));
449     myIsConflicting = false;
450   }
451 }
452
453 void SketcherPrs_SymbolPrs::Render(const Handle(OpenGl_Workspace)& theWorkspace) const
454 {
455   // this method is a combination of OCCT OpenGL functions. The main purpose is to have
456   // equal distance from the source object to symbol indpendently of zoom.
457   // It is base on OCCT 6.9.1 and might need changes when using later OCCT versions.
458   // The specific SHAPER modifications are marked by ShaperModification:start/end,
459   // other is OCCT code
460
461   // do not update presentation for invalid or already removed objects: the presentation
462   // should be removed soon
463   if (!myConstraint->data().get() || !myConstraint->data()->isValid())
464     return;
465
466   const OpenGl_AspectMarker* anAspectMarker = theWorkspace->AspectMarker(Standard_True);
467   const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
468   Handle(OpenGl_View) aView = theWorkspace->ActiveView();
469
470   // ShaperModification:start
471   double aScale = aView->Camera()->Scale();
472   // Update points coordinate taking the viewer scale into account
473   updateIfReadyToDisplay(MyDist * aScale);
474
475   // ShaperModification:end
476
477   Handle(Graphic3d_Buffer) aAttribs = myPntArray->Attributes();
478
479   if (myVboAttribs.IsNull()) {
480     myVboAttribs = new SketcherPrs_VertexBuffer(*aAttribs);
481   }
482
483   // Update drawing attributes
484   if (!myVboAttribs->init(aCtx, 0, aAttribs->NbElements,
485                           aAttribs->Data(), GL_NONE, aAttribs->Stride)) {
486     myVboAttribs->Release (aCtx.operator->());
487     myVboAttribs.Nullify();
488     return;
489   }
490
491   Handle(OpenGl_Texture) aTextureBack = theWorkspace->DisableTexture();
492
493   const Handle(OpenGl_PointSprite)& aSpriteNorm = anAspectMarker->SpriteRes(aCtx);
494
495   if (!aSpriteNorm.IsNull() && !aSpriteNorm->IsDisplayList()) {
496     // ShaperModification:start : filling the presentation with color if there is a conflict
497     const bool toHilight =
498       (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) != 0 || myIsConflicting;
499     // ShaperModification:end
500
501     const Handle(OpenGl_PointSprite)& aSprite =
502       (toHilight && anAspectMarker->SpriteHighlightRes(aCtx)->IsValid())?
503                                               anAspectMarker->SpriteHighlightRes(aCtx)
504                                               : aSpriteNorm;
505     theWorkspace->EnableTexture (aSprite);
506     aCtx->ShaderManager()->BindProgram(anAspectMarker, aSprite, Standard_False,
507                                        Standard_False, anAspectMarker->ShaderProgramRes(aCtx));
508     const TEL_COLOUR* aLineColor  =  &anAspectMarker->Color();
509     if (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)
510       aLineColor = theWorkspace->HighlightColor;
511
512     // Set lighting of the symbol
513     if (toHilight)
514       aCtx->core11fwd->glDisable (GL_LIGHTING);
515     else
516       aCtx->core11fwd->glEnable (GL_LIGHTING);
517
518     aCtx->SetColor4fv(*(const OpenGl_Vec4* )(aLineColor->rgb));
519
520
521     myVboAttribs->BindAllAttributes(aCtx);
522     // Textured markers will be drawn with the point sprites
523     aCtx->SetPointSize (anAspectMarker->MarkerSize());
524     aCtx->core11fwd->glEnable (GL_ALPHA_TEST);
525     aCtx->core11fwd->glAlphaFunc (GL_GEQUAL, 0.1f);
526
527     aCtx->core11fwd->glEnable (GL_BLEND);
528     aCtx->core11fwd->glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
529
530     aCtx->core11fwd->glDrawArrays (0, 0, myVboAttribs->GetElemsNb());
531
532     aCtx->core11fwd->glDisable (GL_BLEND);
533     aCtx->core11fwd->glDisable (GL_ALPHA_TEST);
534     aCtx->SetPointSize (1.0f);
535   }
536   theWorkspace->EnableTexture (aTextureBack);
537   aCtx->BindProgram (NULL);
538
539   // Update selection position only if there is no selected object
540   // because it can corrupt selection of other objects
541   if ((GetContext()->NbCurrents() == 0) && (GetContext()->NbSelected() == 0))
542   {
543     GetContext()->MainSelector()->RebuildSensitivesTree (this);
544     GetContext()->MainSelector()->RebuildObjectsTree (false);
545   }
546 }
547
548
549 void SketcherPrs_SymbolPrs::Release (OpenGl_Context* theContext)
550 {
551   // Release OpenGl resources
552   if (!myVboAttribs.IsNull()) {
553     if (theContext) {
554       theContext->DelayedRelease (myVboAttribs);
555     }
556     myVboAttribs.Nullify();
557   }
558 }
559
560 void SketcherPrs_SymbolPrs::drawShape(const std::shared_ptr<GeomAPI_Shape>& theShape,
561                                       const Handle(Prs3d_Presentation)& thePrs) const
562 {
563   if (theShape->isEdge()) {
564     // The shape is edge
565     std::shared_ptr<GeomAPI_Curve> aCurve =
566       std::shared_ptr<GeomAPI_Curve>(new GeomAPI_Curve(theShape));
567     if (aCurve->isLine()) {
568       // The shape is line
569       GeomAdaptor_Curve
570         aCurv(aCurve->impl<Handle(Geom_Curve)>(), aCurve->startParam(), aCurve->endParam());
571       StdPrs_Curve::Add(thePrs, aCurv, myDrawer);
572     } else {
573       // The shape is circle or arc
574       GeomAdaptor_Curve
575         aAdaptor(aCurve->impl<Handle(Geom_Curve)>(), aCurve->startParam(), aCurve->endParam());
576       StdPrs_DeflectionCurve::Add(thePrs,aAdaptor,myDrawer);
577     }
578   } else if (theShape->isVertex()) {
579     // draw vertex
580     std::shared_ptr<GeomAPI_Vertex> aVertex =
581       std::shared_ptr<GeomAPI_Vertex>(new GeomAPI_Vertex(theShape));
582     std::shared_ptr<GeomAPI_Pnt> aPnt = aVertex->point();
583     Handle(Geom_CartesianPoint) aPoint = new Geom_CartesianPoint(aPnt->impl<gp_Pnt>());
584     StdPrs_Point::Add(thePrs, aPoint, myDrawer);
585   }
586 }
587
588 void SketcherPrs_SymbolPrs::drawListOfShapes(
589   const std::shared_ptr<ModelAPI_AttributeRefList>& theListAttr,
590   const Handle(Prs3d_Presentation)& thePrs) const
591 {
592   int aNb = theListAttr->size();
593   if (aNb == 0)
594     return;
595   int i;
596   ObjectPtr aObj;
597   for (i = 0; i < aNb; i++) {
598     aObj = theListAttr->object(i);
599     std::shared_ptr<GeomAPI_Shape> aShape = SketcherPrs_Tools::getShape(aObj);
600     if (aShape.get() != NULL)
601       drawShape(aShape, thePrs);
602   }
603 }
604
605 void SketcherPrs_SymbolPrs::BoundingBox (Bnd_Box& theBndBox)
606 {
607   Select3D_BndBox3d aTmpBox;
608   for (Select3D_EntitySequenceIter aPntIter (mySPoints); aPntIter.More(); aPntIter.Next()) {
609     const Handle(Select3D_SensitiveEntity)& anEnt = aPntIter.Value();
610     aTmpBox.Combine (anEnt->BoundingBox());
611   }
612
613   theBndBox.Update (aTmpBox.CornerMin().x(), aTmpBox.CornerMin().y(), aTmpBox.CornerMin().z(),
614                     aTmpBox.CornerMax().x(), aTmpBox.CornerMax().y(), aTmpBox.CornerMax().z());
615 }
616