Salome HOME
Fix bug "too long line" and "space".
authorClarisse Genrault <clarisse.genrault@cea.fr>
Thu, 6 Jul 2017 09:50:40 +0000 (11:50 +0200)
committerClarisse Genrault <clarisse.genrault@cea.fr>
Thu, 6 Jul 2017 09:50:40 +0000 (11:50 +0200)
src/GDMLPlugin/GDMLPlugin_Ellipsoid.cpp
src/GDMLPlugin/GDMLPlugin_Plugin.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Ellipsoid.cpp

index db962dcfefec093245830186f0bb82c44936df49..1ab4ce05d6dad80a124556f739ba0a7194e0c538 100644 (file)
@@ -46,14 +46,14 @@ void GDMLPlugin_Ellipsoid::initAttributes()
 void GDMLPlugin_Ellipsoid::execute()
 {
   std::shared_ptr<GeomAlgoAPI_Ellipsoid> anEllipsoidAlgo;
-  
+
   double aAx = real(AX_ID())->value();
   double aBy = real(BY_ID())->value();
   double aCz = real(CZ_ID())->value();
-  
+
   std::string useZCut1 = string(USE_ZCUT1_ID())->value();
   std::string useZCut2 = string(USE_ZCUT2_ID())->value();
-  
+
   double aZCut1 = 0.;
   if (useZCut1.empty()) {
     aZCut1 = aCz /2.;
@@ -66,13 +66,13 @@ void GDMLPlugin_Ellipsoid::execute()
   } else {
     aZCut2 = real(ZCUT2_ID())->value();
   }
-  
+
   anEllipsoidAlgo = std::shared_ptr<GeomAlgoAPI_Ellipsoid>(
     new GeomAlgoAPI_Ellipsoid(aAx, aBy, aCz, aZCut1, aZCut2));
-  
+
   // Check with that the arguments for anEllipsoidAlgo are correct
-  if (!anEllipsoidAlgo->check()){
-    setError(anEllipsoidAlgo->getError(), false);   
+  if (!anEllipsoidAlgo->check()) {
+    setError(anEllipsoidAlgo->getError(), false);
     return;
   }
 
@@ -83,15 +83,15 @@ void GDMLPlugin_Ellipsoid::execute()
     setError(anEllipsoidAlgo->getError(), false);
     return;
   }
-  
+
   // Check if the created ellipsoid is valid
   if (!anEllipsoidAlgo->checkValid("Ellipsoid builder")) {
     setError(anEllipsoidAlgo->getError(), false);
     return;
   }
 
-  int aResultIndex = 0; 
-  ResultBodyPtr aResultEllipsoid = document()->createBody(data(), aResultIndex); 
+  int aResultIndex = 0;
+  ResultBodyPtr aResultEllipsoid = document()->createBody(data(), aResultIndex);
   loadNamingDS(anEllipsoidAlgo, aResultEllipsoid);
   setResult(aResultEllipsoid, aResultIndex);
 
@@ -103,10 +103,10 @@ void GDMLPlugin_Ellipsoid::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Ellipsoid> t
 {
   // Load the result
   theResultEllipsoid->store(theEllipsoidAlgo->shape());
-  
+
   // Prepare the naming
   theEllipsoidAlgo->prepareNamingFaces();
-  
+
   // Insert to faces
   int num = 1;
   std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
index 9dba4a099f3e1ff5ba268fb85092458225afb3fb..168ae380e05c44db301fc8b368feb11831593518 100644 (file)
@@ -41,7 +41,7 @@ FeaturePtr GDMLPlugin_Plugin::createFeature(std::string theFeatureID)
   } else if (theFeatureID == GDMLPlugin_Ellipsoid::ID()) {
     return FeaturePtr(new GDMLPlugin_Ellipsoid);
   }
-  
+
   // feature of such kind is not found
   return FeaturePtr();
 }
index f23471221bc1e95c3c69b787602c8a3daf650a2e..afa430db18b3fef3fbb827304a72ce4cddd8c5cd 100644 (file)
@@ -76,7 +76,7 @@ bool GeomAlgoAPI_Ellipsoid::check()
     myError = "Ellipsoid builder :: zcut1 and zcut2 are null.";
     return false;
   }
-  
+
   return true;
 }
 
@@ -84,17 +84,17 @@ bool GeomAlgoAPI_Ellipsoid::check()
 void GeomAlgoAPI_Ellipsoid::build()
 {
   myCreatedFaces.clear();
-  
+
   BRepOffsetAPI_Sewing aSewer;
   gp_Ax2 aRefAx2;
   gp_Elips anElips;
-  
+
   gp_Pnt anOrigin(0., 0., 0.);
   gp_Dir aDirX(1., 0., 0.);
   gp_Dir aDirY(0., 1., 0.);
   gp_Dir aDirZ(0., 0., 1.);
   gp_Ax1 aZAxis(anOrigin, aDirZ);
-  
+
   // Calculate the parameters needed to make the edges and the faces
   // gp_Elips needs the second parameter to be greater than the third (major axis)
   if (myCz < myAx) {
@@ -104,20 +104,20 @@ void GeomAlgoAPI_Ellipsoid::build()
     aRefAx2 = gp_Ax2(anOrigin, aDirY, aDirZ);
     anElips = gp_Elips(aRefAx2, myCz / 2., myAx / 2.);
   }
-  
+
   double aLowPositionFactor = sqrt(1. - (myZCut1 * myZCut1 * 4. / (myCz * myCz))) / 2.;
   double aHighPositionFactor = sqrt(1. - (myZCut2 * myZCut2 * 4. / (myCz * myCz))) / 2.;
-  
+
   double aXEndTop = myAx * aHighPositionFactor;
   double aXEndBottom = myAx *  aLowPositionFactor;
-  
+
   // Build the XZ ellipse
   gp_Pnt anEndPoint1(aXEndTop, 0., myZCut2);
   gp_Pnt anEndPoint2(aXEndBottom, 0., -myZCut1);
   BRepBuilderAPI_MakeEdge anElipsBuilder(anElips, anEndPoint1, anEndPoint2);
   anElipsBuilder.Build();
   TopoDS_Edge anOuterEdge = anElipsBuilder.Edge();
-  
+
   // Perform a revolution based on the section to build a simple version of the outer face
   // (isotropic in XY)
   BRepPrimAPI_MakeRevol aRevolBuilder(anOuterEdge, aZAxis, 2. * M_PI, Standard_True);
@@ -125,7 +125,7 @@ void GeomAlgoAPI_Ellipsoid::build()
     myError = "Ellipsoid builder :: section revolution did not succeed";
     return;
   }
-  
+
   gp_GTrsf aGTrsf;
   gp_Mat rot (1.,          0., 0.,
               0., myBy / myAx, 0.,
@@ -141,11 +141,11 @@ void GeomAlgoAPI_Ellipsoid::build()
 
   TopoDS_Face anOuterFace = TopoDS::Face(aScaleBuilder.Shape());
   aSewer.Add(TopoDS::Face(anOuterFace.Reversed()));
-  
+
   // Build the high and low ellipse if needed
   gp_Ax2 aLowAx2;
   gp_Ax2 aHighAx2;
-  gp_Elips aLowElips; 
+  gp_Elips aLowElips;
   gp_Elips aHighElips;
   if (myBy < myAx) {
     if ((myCz / 2. - myZCut1) > Precision::Confusion()) {
@@ -179,7 +179,7 @@ void GeomAlgoAPI_Ellipsoid::build()
     aSewer.Add(TopoDS::Face(aBottomFace.Reversed()));
   }
   if ((myCz / 2. - myZCut2) > Precision::Confusion()) {
-    TopoDS_Face aTopFace; 
+    TopoDS_Face aTopFace;
     BRepBuilderAPI_MakeEdge aTopEdgeMk(aHighElips);
     aTopEdgeMk.Build();
     BRepBuilderAPI_MakeWire aTopWireMk;
@@ -188,33 +188,35 @@ void GeomAlgoAPI_Ellipsoid::build()
     aTopFace = aTopFaceMk.Face();
     aSewer.Add(TopoDS::Face(aTopFace.Reversed()));
   }
-  
+
   TopoDS_Shell aShell;
   aSewer.Perform();
-  if ((myCz / 2. - myZCut2) > Precision::Confusion() || (myCz / 2. - myZCut1) > Precision::Confusion()) {
+  if ((myCz / 2. - myZCut2) > Precision::Confusion() ||
+      (myCz / 2. - myZCut1) > Precision::Confusion()) {
     aShell = TopoDS::Shell(aSewer.SewedShape());
   } else {
     TopoDS_Builder aBuilder;
     aBuilder.MakeShell(aShell);
     aBuilder.Add(aShell, aSewer.SewedShape());
   }
-  
+
   BRepBuilderAPI_MakeSolid *anEllipsoidMk = new BRepBuilderAPI_MakeSolid(aShell);
   anEllipsoidMk->Build();
-  
+
   // Store and publish the results
-  std::shared_ptr<GeomAPI_Shape> aResultShape =  std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape()) ;
+  std::shared_ptr<GeomAPI_Shape> aResultShape =
+    std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
   aResultShape->setImpl(new TopoDS_Shape(anEllipsoidMk->Solid()));
   setShape(aResultShape);
-  
+
   // Test on the shapes
   if (!(aResultShape).get() || aResultShape->isNull()) {
     myError = "Ellipsoid builder  :: resulting shape is null.";
     return;
   }
-  
+
   setImpl(anEllipsoidMk);
   setBuilderType(OCCT_BRepBuilderAPI_MakeShape);
-  
+
   setDone(true);
 }