Salome HOME
Suppression of warnings, application launching problems in different cases (on Window...
[modules/shaper.git] / src / ModuleBase / ModuleBase_ResultPrs.cpp
1 // Copyright (C) 2014-2021  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "ModuleBase_ResultPrs.h"
21 #include "ModuleBase_IViewer.h"
22
23 #include <GeomAPI_PlanarEdges.h>
24 #include <GeomAPI_Edge.h>
25
26 #include <ModelAPI_Events.h>
27 #include <ModelAPI_Tools.h>
28 #include <ModelAPI_ResultConstruction.h>
29 #include <ModelAPI_ResultBody.h>
30 #include <ModelAPI_AttributeIntArray.h>
31
32 #include "ModuleBase_Tools.h"
33 #include "ModuleBase_BRepOwner.h"
34
35 #include <Events_InfoMessage.h>
36 #include <Events_Loop.h>
37 #include <Config_PropManager.h>
38
39 #include <AIS_ColoredDrawer.hxx>
40 #include <AIS_InteractiveContext.hxx>
41 #include <AIS_Selection.hxx>
42 #include <BOPTools_AlgoTools3D.hxx>
43 #include <BRep_Builder.hxx>
44 #include <Graphic3d_AspectMarker3d.hxx>
45 #include <Prs3d_Drawer.hxx>
46 #include <Prs3d.hxx>
47 #include <Prs3d_PointAspect.hxx>
48 #include <Prs3d_IsoAspect.hxx>
49 #include <Prs3d_ShadingAspect.hxx>
50 #include <Prs3d_PlaneAspect.hxx>
51 #include <SelectMgr_SequenceOfOwner.hxx>
52 #include <SelectMgr_EntityOwner.hxx>
53 #include <SelectMgr_SelectionManager.hxx>
54 #include <StdPrs_WFShape.hxx>
55 #include <StdPrs_ShadedShape.hxx>
56 #include <StdSelect_BRepSelectionTool.hxx>
57 #include <TColStd_ListIteratorOfListOfInteger.hxx>
58 #include <TopExp_Explorer.hxx>
59 #include <TopoDS.hxx>
60 #include <TopoDS_Builder.hxx>
61 #include <TopoDS_Edge.hxx>
62 #include <BRepMesh_IncrementalMesh.hxx>
63 #include <Standard_Version.hxx>
64
65 #if OCC_VERSION_HEX > 0x070400
66 #include <StdPrs_ToolTriangulatedShape.hxx>
67 #endif
68
69 //*******************************************************************************************
70
71 IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ResultPrs, ViewerData_AISShape);
72
73
74
75 //********************************************************************
76 ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult)
77   : ViewerData_AISShape(TopoDS_Shape()),
78     myResult(theResult),
79     myIsSubstituted(false),
80     myTransparency(1),
81     myAdditionalSelectionPriority(0)
82 {
83
84   GeomShapePtr aShapePtr = ModelAPI_Tools::shape(theResult);
85   TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
86   // Workaround for Sketch subshapes which has no discrete representation
87   // until sketch faces are built and displayed.
88   // Thus, perform discretization of such edges.
89   if (theResult->groupName() == ModelAPI_ResultConstruction::group() &&
90     aShape.ShapeType() == TopAbs_EDGE) {
91     GeomEdgePtr anEdgePtr = GeomEdgePtr(new GeomAPI_Edge(aShapePtr));
92     if (anEdgePtr->isCircle() || anEdgePtr->isArc()) {
93       TopoDS_Edge anEdge = TopoDS::Edge(aShape);
94       TopLoc_Location aLoc;
95       Handle(Poly_Polygon3D) aPoly3D = BRep_Tool::Polygon3D(anEdge, aLoc);
96       if (aPoly3D.IsNull()) {
97         double aDeflection = Config_PropManager::real("Visualization", "construction_deflection");
98         BRepMesh_IncrementalMesh(aShape, aDeflection);
99       }
100     }
101   }
102   Set(aShape);
103
104   // VSV: bos22744: The AutoHilight mode is swithced off because it produces different
105   // behaviour of selection for simple shape and compound. For example when selection mode
106   // is Vertex the shape is selected by vertex, but compound is selected by whole shape
107   //ResultBodyPtr aResOwner = ModelAPI_Tools::bodyOwner(myResult);
108   //SetAutoHilight(aResOwner.get() == NULL);
109
110   // Set own free boundaries aspect in order to have free
111   // and unfree boundaries with different colors
112   Handle(Prs3d_Drawer) aDrawer = Attributes();
113   aDrawer->SetUnFreeBoundaryAspect(
114     new Prs3d_LineAspect(Quantity_NOC_YELLOW, Aspect_TOL_SOLID, 1));
115   aDrawer->SetFreeBoundaryAspect(new Prs3d_LineAspect(Quantity_NOC_GREEN, Aspect_TOL_SOLID, 1));
116   aDrawer->SetFaceBoundaryAspect(new Prs3d_LineAspect(Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1));
117
118   Quantity_Color aColor;
119   Color(aColor);
120
121   std::vector<int> aIsoValues;
122   bool isIsoVisible;
123   ModelAPI_Tools::getIsoLines(myResult, isIsoVisible, aIsoValues);
124   if (isIsoVisible) {
125     if (aIsoValues.size() == 0) {
126       aIsoValues.push_back(1);
127       aIsoValues.push_back(1);
128     }
129   }
130   else {
131     aIsoValues.push_back(0);
132     aIsoValues.push_back(0);
133   }
134   myUIsoAspect = new Prs3d_IsoAspect(aColor, Aspect_TOL_SOLID, 1, aIsoValues[0]);
135   myVIsoAspect = new Prs3d_IsoAspect(aColor, Aspect_TOL_SOLID, 1, aIsoValues[1]);
136   aDrawer->SetUIsoAspect(myUIsoAspect);
137   aDrawer->SetVIsoAspect(myVIsoAspect);
138
139   if (aDrawer->HasOwnPointAspect())
140     aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS);
141   else
142     aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.));
143
144   aDrawer = DynamicHilightAttributes();
145   if (aDrawer.IsNull()) {
146     if (!ModuleBase_IViewer::DefaultHighlightDrawer.IsNull()) {
147       aDrawer = new Prs3d_Drawer(*ModuleBase_IViewer::DefaultHighlightDrawer);
148       aDrawer->SetUIsoAspect(myUIsoAspect);
149       aDrawer->SetVIsoAspect(myVIsoAspect);
150       SetDynamicHilightAttributes(aDrawer);
151     }
152   }
153
154   myHiddenSubShapesDrawer = new AIS_ColoredDrawer(myDrawer);
155   Handle(Prs3d_ShadingAspect) aShadingAspect = new Prs3d_ShadingAspect();
156   aShadingAspect->SetMaterial(Graphic3d_NOM_BRASS); //default value of context material
157   aShadingAspect->Aspect()->SetEdgeColor(Quantity_NOC_BLACK);
158   myHiddenSubShapesDrawer->SetShadingAspect(aShadingAspect);
159
160   ModuleBase_Tools::setPointBallHighlighting(this);
161
162   // Define colors for wireframe mode
163   setEdgesDefaultColor();
164
165   ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), DynamicHilightAttributes());
166   ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), Attributes());
167   Attributes()->UpdatePreviousDeviationCoefficient();
168 }
169
170 //********************************************************************
171 void ModuleBase_ResultPrs::setAdditionalSelectionPriority(const int thePriority)
172 {
173   myAdditionalSelectionPriority = thePriority;
174 }
175
176 //********************************************************************
177 void ModuleBase_ResultPrs::SetColor (const Quantity_Color& theColor)
178 {
179   ViewerData_AISShape::SetColor(theColor);
180   myHiddenSubShapesDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
181   setEdgesDefaultColor();
182   myUIsoAspect->SetColor(theColor);
183   myVIsoAspect->SetColor(theColor);
184 }
185
186 void ModuleBase_ResultPrs::setEdgesDefaultColor()
187 {
188   if (myResult.get()) {
189     AttributeIntArrayPtr aColorAttr = myResult->data()->intArray(ModelAPI_Result::COLOR_ID());
190     bool aHasColor = aColorAttr.get() && aColorAttr->isInitialized();
191
192     Handle(Prs3d_Drawer) aDrawer = Attributes();
193     aDrawer->SetFaceBoundaryDraw(Standard_True);
194     aDrawer->FaceBoundaryAspect()->SetColor(Quantity_NOC_BLACK);
195
196     if (!aHasColor) {
197       aDrawer->UnFreeBoundaryAspect()->SetColor(Quantity_NOC_YELLOW);
198       aDrawer->FreeBoundaryAspect()->SetColor(Quantity_NOC_GREEN);
199       aDrawer->WireAspect()->SetColor(Quantity_NOC_RED);
200
201       aDrawer->SetUnFreeBoundaryDraw(Standard_True);
202       aDrawer->SetFreeBoundaryDraw(Standard_True);
203       aDrawer->SetWireDraw(Standard_True);
204     }
205   }
206 }
207
208
209 //********************************************************************
210 void ModuleBase_ResultPrs::setSubShapeHidden(const TopoDS_ListOfShape& theShapes)
211 {
212   TopoDS_Compound aCompound;
213   BRep_Builder aBBuilder;
214   aBBuilder.MakeCompound (aCompound);
215
216   myHiddenSubShapes = theShapes;
217   collectSubShapes(aBBuilder, aCompound, myOriginalShape, myHiddenSubShapes);
218   myVisibleCompound = aCompound;
219
220   aBBuilder.MakeCompound (aCompound);
221   TopoDS_ListOfShape::Iterator aIt(myHiddenSubShapes);
222   for (; aIt.More(); aIt.Next()) {
223     aBBuilder.Add(aCompound, aIt.Value());
224   }
225   myHiddenCompound = aCompound;
226 }
227
228 //********************************************************************
229 bool ModuleBase_ResultPrs::isSubShapeHidden(const TopoDS_Shape& theShape)
230 {
231   if (theShape.IsNull() || theShape.ShapeType() != TopAbs_FACE) // only face shape can be hidden
232     return false;
233
234   // orientation of parameter shape(come from selection) may be wrong, check isEqual() to be sure
235   TopoDS_ListOfShape::Iterator aShapeIt(myHiddenSubShapes);
236   for (; aShapeIt.More(); aShapeIt.Next()) {
237     if (theShape.IsSame(aShapeIt.Value()))
238       return true;
239   }
240
241   return true;
242 }
243
244 //********************************************************************
245 bool ModuleBase_ResultPrs::hasSubShapeVisible(
246   const TopoDS_ListOfShape& theShapesToSkip)
247 {
248   TopoDS_Compound aCompound;
249   BRep_Builder aBuilder;
250   aBuilder.MakeCompound (aCompound);
251   TopoDS_ListOfShape aShapesToSkip;
252   TopoDS_ListOfShape aHiddenCopy(myHiddenSubShapes);
253   aShapesToSkip.Append(aHiddenCopy);
254   for (TopoDS_ListOfShape::Iterator anIt(theShapesToSkip); anIt.More(); anIt.Next())
255     aShapesToSkip.Append(anIt.Value());
256
257   collectSubShapes(aBuilder, aCompound, myOriginalShape, aShapesToSkip);
258   return !BOPTools_AlgoTools3D::IsEmptyShape(aCompound);
259 }
260
261 //********************************************************************
262 bool ModuleBase_ResultPrs::setHiddenSubShapeTransparency(double theTransparency)
263 {
264   if (myTransparency == theTransparency || theTransparency > 1 || theTransparency < 0)
265     return false;
266
267   myTransparency = theTransparency;
268   myHiddenSubShapesDrawer->ShadingAspect()->SetTransparency (theTransparency, myCurrentFacingModel);
269   return true;
270 }
271
272 //********************************************************************
273 void ModuleBase_ResultPrs::Compute(
274           const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
275           const Handle(Prs3d_Presentation)& thePresentation,
276           const Standard_Integer theMode)
277 {
278   std::shared_ptr<GeomAPI_Shape> aShapePtr = myResult->shape();
279   bool aReadyToDisplay = aShapePtr.get();
280   if (aReadyToDisplay) {
281     myOriginalShape = aShapePtr->impl<TopoDS_Shape>();
282     if (myHiddenSubShapes.IsEmpty() || myOriginalShape.ShapeType() > TopAbs_FACE ) {
283       if (!myOriginalShape.IsNull()) {
284         Set(myOriginalShape);
285         myIsSubstituted = false;
286       }
287     }
288     else { // convert shape into SHELL
289       bool isEmptyShape = BOPTools_AlgoTools3D::IsEmptyShape(myVisibleCompound);
290       Set(myVisibleCompound);
291       myIsSubstituted = true;
292       if (isEmptyShape)
293         aReadyToDisplay = false;
294     }
295   }
296   // change deviation coefficient to provide more precise circle
297   try {
298     AIS_Shape::Compute(thePresentationManager, thePresentation, theMode);
299   }
300   catch (...) {
301     return;
302   }
303
304   // visualize hidden sub-shapes transparent
305   if (myResult.get()) {
306     if (myTransparency < 1 && !myHiddenSubShapes.IsEmpty())
307     {
308       StdPrs_ShadedShape::Add(thePresentation, myHiddenCompound, myHiddenSubShapesDrawer);
309       aReadyToDisplay = true;
310     }
311
312     if (!aReadyToDisplay) {
313       Events_InfoMessage("ModuleBase_ResultPrs",
314         "An empty AIS presentation: ModuleBase_ResultPrs").send();
315       static const Events_ID anEvent = Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION);
316       ModelAPI_EventCreator::get()->sendUpdated(myResult, anEvent);
317     }
318   }
319 }
320
321 //********************************************************************
322 void ModuleBase_ResultPrs::collectSubShapes(BRep_Builder& theBuilder,
323   TopoDS_Shape& theCompound, const TopoDS_Shape& theShape,
324   const TopoDS_ListOfShape& theHiddenSubShapes)
325 {
326   switch (theShape.ShapeType()) {
327     case TopAbs_COMPSOLID:
328     case TopAbs_COMPOUND: {
329       for (TopoDS_Iterator aChildIter (theShape); aChildIter.More(); aChildIter.Next())
330         collectSubShapes(theBuilder, theCompound, aChildIter.Value(), theHiddenSubShapes);
331     }
332     break;
333     case TopAbs_SOLID:
334     case TopAbs_SHELL: {
335       for (TopExp_Explorer anExp (theShape, TopAbs_FACE); anExp.More(); anExp.Next()) {
336         collectSubShapes(theBuilder, theCompound, anExp.Current(), theHiddenSubShapes);
337       }
338     }
339     break;
340     case TopAbs_WIRE: {
341       for (TopExp_Explorer anExp (theShape, TopAbs_EDGE); anExp.More(); anExp.Next()) {
342         collectSubShapes(theBuilder, theCompound, anExp.Current(), theHiddenSubShapes);
343       }
344     }
345     break;
346     case TopAbs_FACE: {
347       if (theHiddenSubShapes.Contains(theShape))
348         return; // remove hidden shape
349       theBuilder.Add(theCompound, theShape);
350     }
351     break;
352     case TopAbs_EDGE:
353     case TopAbs_VERTEX: {
354       theBuilder.Add(theCompound, theShape);
355     }
356     default:
357       break;
358   }
359 }
360
361 //********************************************************************
362 void ModuleBase_ResultPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
363                                             const Standard_Integer theMode)
364 {
365   if (appendVertexSelection(aSelection, theMode))
366     return;
367
368   if (theMode > TopAbs_SHAPE) {
369     // In order to avoid using custom selection modes
370     if (theMode == ModuleBase_ResultPrs::Sel_Result) {
371       AIS_Shape::ComputeSelection(aSelection, TopAbs_COMPOUND);
372     }
373     return;
374   }
375
376   // TODO: OCCT issue should be created for the COMPOUND processing
377   // before it is fixed, the next workaround in necessary
378   if (theMode == AIS_Shape::SelectionMode(TopAbs_COMPOUND)) {
379     const TopoDS_Shape& aShape = Shape();
380     TopExp_Explorer aCompExp(aShape, TopAbs_COMPOUND);
381     // do not activate in compound mode shapes which do not contain compounds
382     if (!aCompExp.More())
383       return;
384   }
385
386   // bug 2110: if (theMode == AIS_Shape::SelectionMode(TopAbs_COMPSOLID)) {
387   //  // Limit selection area only by actual object (Shape)
388   //  ResultCompSolidPtr aCompSolid = ModelAPI_Tools::compSolidOwner(myResult);
389   //  if (aCompSolid.get()) {
390   //    std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aCompSolid);
391   //    if (aShapePtr.get()) {
392   //      TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
393   //   int aPriority = StdSelect_BRepSelectionTool::GetStandardPriority(aShape, TopAbs_COMPSOLID);
394   //     /// It is important to have priority for the shape of comp solid result less than priority
395   //      /// for the presentation shape which is a sub-result.
396   //      /// Reason is to select the sub-objects before: #1592
397   //      aPriority = aPriority - 1;
398   //      double aDeflection = Prs3d::GetDeflection(aShape, myDrawer);
399
400   //      Handle(ModuleBase_BRepOwner) aOwner = new ModuleBase_BRepOwner(aShape, aPriority);
401   //      StdSelect_BRepSelectionTool::ComputeSensitive(aShape, aOwner, aSelection,
402   //        aDeflection, myDrawer->HLRAngle(), 9, 500);
403
404   //      for (aSelection->Init(); aSelection->More(); aSelection->Next()) {
405   //        Handle(SelectMgr_EntityOwner) anOwner =
406   //          Handle(SelectMgr_EntityOwner)
407   //          ::DownCast(aSelection->Sensitive()->BaseSensitive()->OwnerId());
408   //        anOwner->Set(this);
409   //      }
410   //      return;
411   //    }
412   //  }
413   //}
414   AIS_Shape::ComputeSelection(aSelection, theMode);
415
416   if (myAdditionalSelectionPriority > 0) {
417     NCollection_Vector<Handle(SelectMgr_SensitiveEntity)> anEntities = aSelection->Entities();
418     for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator anIt(anEntities);
419          anIt.More();
420          anIt.Next()) {
421       Handle(SelectMgr_SensitiveEntity) anEntity = anIt.Value();
422       Handle(SelectBasics_EntityOwner) aBasicsOwner = anEntity->BaseSensitive()->OwnerId();
423       if (!aBasicsOwner.IsNull())
424         aBasicsOwner->SetPriority(aBasicsOwner->Priority() + myAdditionalSelectionPriority);
425     }
426   }
427 }
428
429 //********************************************************************
430 bool ModuleBase_ResultPrs::appendVertexSelection(const Handle(SelectMgr_Selection)& aSelection,
431                                                  const Standard_Integer /*theMode*/)
432 {
433   if (Shape().ShapeType() == TopAbs_VERTEX) {
434     const TopoDS_Shape& aShape = Shape();
435
436     int aPriority = StdSelect_BRepSelectionTool::GetStandardPriority(aShape, TopAbs_VERTEX);
437 #if OCC_VERSION_HEX > 0x070400
438     double aDeflection = StdPrs_ToolTriangulatedShape::GetDeflection(aShape, myDrawer);
439 #else
440     double aDeflection = Prs3d::GetDeflection(aShape, myDrawer);
441 #endif
442     /// The cause of this method is the last parameter of BRep owner setting into True.
443     /// That means that owner should behave like it comes from decomposition. (In this case, OCCT
444     /// visualizes it in Ring style) OCCT version is 7.0.0 with path for SHAPER module.
445     Handle(StdSelect_BRepOwner) aOwner = new StdSelect_BRepOwner(aShape, aPriority, Standard_True);
446     StdSelect_BRepSelectionTool::ComputeSensitive(aShape, aOwner, aSelection,
447                                                   aDeflection, myDrawer->DeviationAngle(), 9, 500);
448
449
450     NCollection_Vector<Handle(SelectMgr_SensitiveEntity)> anEntities = aSelection->Entities();
451     for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator anIt(anEntities);
452          anIt.More();
453          anIt.Next()) {
454       Handle(SelectMgr_SensitiveEntity) anEntity = anIt.Value();
455       Handle(SelectMgr_EntityOwner) anOwner = anEntity->BaseSensitive()->OwnerId();
456       anOwner->SetSelectable(this);
457     }
458
459     return true;
460   }
461   return false;
462 }
463
464 //********************************************************************
465 void ModuleBase_ResultPrs::HilightSelected(const Handle(PrsMgr_PresentationManager3d)& thePM,
466                                            const SelectMgr_SequenceOfOwner& theOwners)
467 {
468   Handle(SelectMgr_EntityOwner) anOwner;
469   Handle(ModuleBase_BRepOwner) aCompOwner;
470   for (int i = 1; i <= theOwners.Length(); i++) {
471     anOwner = theOwners.Value(i);
472     aCompOwner = Handle(ModuleBase_BRepOwner)::DownCast(anOwner);
473     if (aCompOwner.IsNull()) {
474       thePM->Color(anOwner->Selectable(), GetContext()->SelectionStyle());
475     }
476     else {
477       TopoDS_Shape aShape = aCompOwner->Shape();
478       Handle( Prs3d_Presentation ) aSelectionPrs = GetSelectPresentation( thePM );
479       aSelectionPrs->Clear();
480
481       StdPrs_WFShape::Add(aSelectionPrs, aShape, myDrawer);
482
483       aSelectionPrs->SetDisplayPriority(9);
484       aSelectionPrs->Highlight(GetContext()->SelectionStyle());
485       aSelectionPrs->Display();
486       thePM->Color(this, GetContext()->SelectionStyle());
487     }
488   }
489 }
490
491 //********************************************************************
492 void ModuleBase_ResultPrs::HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager3d)& thePM,
493                                                  const Handle(Prs3d_Drawer)& theStyle,
494                                                  const Handle(SelectMgr_EntityOwner)& theOwner)
495 {
496   Handle(StdSelect_BRepOwner) aOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
497   if (aOwner.IsNull())
498     return;
499
500   TopoDS_Shape aShape = aOwner->Shape();
501   if (!aShape.IsNull()) {
502     thePM->Color(this, theStyle);
503
504     Handle( Prs3d_Presentation ) aHilightPrs = GetHilightPresentation( thePM );
505     aHilightPrs->Clear();
506
507     StdPrs_WFShape::Add(aHilightPrs, aShape, myDrawer);
508     aHilightPrs->Highlight(theStyle);
509
510     if (thePM->IsImmediateModeOn())
511       thePM->AddToImmediateList(aHilightPrs);
512   }
513 }
514
515
516 //********************************************************************
517 void ModuleBase_ResultPrs::updateIsoLines()
518 {
519   std::vector<int> aIsoValues;
520   bool isIsoVisible;
521   ModelAPI_Tools::getIsoLines(myResult, isIsoVisible, aIsoValues);
522   if (isIsoVisible) {
523     if (aIsoValues.size() == 0) {
524       aIsoValues.push_back(1);
525       aIsoValues.push_back(1);
526     }
527   }
528   else {
529     if (aIsoValues.size() == 0) {
530       aIsoValues.push_back(0);
531       aIsoValues.push_back(0);
532     }
533     else {
534       aIsoValues[0] = 0;
535       aIsoValues[1] = 0;
536     }
537   }
538   myUIsoAspect->SetNumber(aIsoValues[0]);
539   myVIsoAspect->SetNumber(aIsoValues[1]);
540 }