-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: PlaneGCSSolver_AttributeBuilder.cpp
-// Created: 10 Feb 2017
-// Author: Artem ZHIDKOV
+// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
#include <PlaneGCSSolver_AngleWrapper.h>
#include <PlaneGCSSolver_AttributeBuilder.h>
#include <PlaneGCSSolver_PointWrapper.h>
#include <PlaneGCSSolver_ScalarWrapper.h>
+#include <PlaneGCSSolver_BooleanWrapper.h>
#include <GeomDataAPI_Point2D.h>
#include <ModelAPI_AttributeDouble.h>
return theStorage ? theStorage->createParameter() : (new double(0));
}
+static EntityWrapperPtr createBoolean(const AttributePtr& theAttribute)
+{
+ BooleanWrapperPtr aWrapper;
+ AttributeBooleanPtr aBoolean =
+ std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(theAttribute);
+ if (aBoolean)
+ aWrapper = BooleanWrapperPtr(new PlaneGCSSolver_BooleanWrapper(aBoolean->value()));
+ return aWrapper;
+}
+
static EntityWrapperPtr createScalar(const AttributePtr& theAttribute,
PlaneGCSSolver_Storage* theStorage)
{
else
aWrapper = ScalarWrapperPtr(new PlaneGCSSolver_ScalarWrapper(createParameter(theStorage)));
- aWrapper->setValue(aScalar->value());
+ if (aScalar->isInitialized())
+ aWrapper->setValue(aScalar->value());
return aWrapper;
}
GCSPointPtr aNewPoint(new GCS::Point);
aNewPoint->x = createParameter(theStorage);
- *(aNewPoint->x) = aPoint2D->x();
aNewPoint->y = createParameter(theStorage);
- *(aNewPoint->y) = aPoint2D->y();
+ if (aPoint2D->isInitialized()) {
+ *(aNewPoint->x) = aPoint2D->x();
+ *(aNewPoint->y) = aPoint2D->y();
+ }
return EntityWrapperPtr(new PlaneGCSSolver_PointWrapper(aNewPoint));
}
aResult = createPoint(theAttribute, myStorage);
if (!aResult)
aResult = createScalar(theAttribute, myStorage);
+ if (!aResult)
+ aResult = createBoolean(theAttribute);
if (aResult && !myStorage)
aResult->setExternal(true);
return aResult;
}
-
-const std::list<GCSConstraintPtr>& PlaneGCSSolver_AttributeBuilder::constraints() const
-{
- static std::list<GCSConstraintPtr> aList;
- return aList;
-}