Salome HOME
Cleare Macros for easy atribute initialization in C++HighAPI interfaces
[modules/shaper.git] / src / ConstructionAPI / ConstructionAPI_Point.cpp
index 7464536c43ec5abccf12bf4407d358883d6bab72..e28a96bb4445c97db7c28a8b59b12d8aa57a03f2 100644 (file)
@@ -27,10 +27,8 @@ ConstructionAPI_Point::ConstructionAPI_Point(
     const ModelHighAPI_Double & theZ)
 : ModelHighAPI_Interface(theFeature)
 {
-  if (initialize()) {
+  if (initialize())
     setPoint(theX, theY, theZ);
-    execute();
-  }
 }
 
 ConstructionAPI_Point::~ConstructionAPI_Point()
@@ -38,52 +36,16 @@ ConstructionAPI_Point::~ConstructionAPI_Point()
 
 }
 
-//--------------------------------------------------------------------------------------
-bool ConstructionAPI_Point::initialize()
-{
-  if (!myFeature) {
-    throwException("ConstructionAPI_Point exception: The feature is NULL.");
-    return false;
-  }
-
-  if (feature()->getKind() != "Point") {
-    throwException("ConstructionAPI_Point exception: Wrong feature kind.");
-    return false;
-  }
-
-  // data() throws exceptions if the attribute is invalid
-  myX = feature()->real("x");
-  myY = feature()->real("y");
-  myZ = feature()->real("z");
-
-  if (!myX || !myY || !myZ)
-    return false;
-
-  return true;
-}
-
 //--------------------------------------------------------------------------------------
 void ConstructionAPI_Point::setPoint(const ModelHighAPI_Double & theX,
                                      const ModelHighAPI_Double & theY,
                                      const ModelHighAPI_Double & theZ)
 {
-  theX.fillAttribute(myX);
-  theY.fillAttribute(myY);
-  theZ.fillAttribute(myZ);
-}
+  theX.fillAttribute(myx);
+  theY.fillAttribute(myy);
+  theZ.fillAttribute(myz);
 
-//--------------------------------------------------------------------------------------
-std::shared_ptr<ModelAPI_AttributeDouble> ConstructionAPI_Point::x() const
-{
-  return myX;
-}
-std::shared_ptr<ModelAPI_AttributeDouble> ConstructionAPI_Point::y() const
-{
-  return myY;
-}
-std::shared_ptr<ModelAPI_AttributeDouble> ConstructionAPI_Point::z() const
-{
-  return myZ;
+  execute();
 }
 
 //--------------------------------------------------------------------------------------