Sketcher: modernize C++11

* use nullptr
This commit is contained in:
wmayer
2022-03-23 19:26:15 +01:00
parent d231a7c7db
commit ead5154b18
44 changed files with 371 additions and 371 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ PyMOD_INIT_FUNC(Sketcher)
}
catch(const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());
PyMOD_Return(0);
PyMOD_Return(nullptr);
}
PyObject* sketcherModule = Sketcher::initModule();
+9 -9
View File
@@ -105,13 +105,13 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/)
this->getConstraintPtr()->Type = Equal;
valid = true;
}
else if (strstr(ConstraintType,"InternalAlignment") != NULL) {
else if (strstr(ConstraintType,"InternalAlignment") != nullptr) {
this->getConstraintPtr()->Type = InternalAlignment;
valid = true;
if(strstr(ConstraintType,"EllipseMajorDiameter") != NULL)
if(strstr(ConstraintType,"EllipseMajorDiameter") != nullptr)
this->getConstraintPtr()->AlignmentType=EllipseMajorDiameter;
else if(strstr(ConstraintType,"EllipseMinorDiameter") != NULL)
else if(strstr(ConstraintType,"EllipseMinorDiameter") != nullptr)
this->getConstraintPtr()->AlignmentType=EllipseMinorDiameter;
else {
this->getConstraintPtr()->AlignmentType=Undef;
@@ -198,14 +198,14 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/)
this->getConstraintPtr()->Type = PointOnObject;
valid = true;
}
else if (strstr(ConstraintType,"InternalAlignment") != NULL) {
else if (strstr(ConstraintType,"InternalAlignment") != nullptr) {
this->getConstraintPtr()->Type = InternalAlignment;
valid = true;
if(strstr(ConstraintType,"EllipseFocus1") != NULL)
if(strstr(ConstraintType,"EllipseFocus1") != nullptr)
this->getConstraintPtr()->AlignmentType=EllipseFocus1;
else if(strstr(ConstraintType,"EllipseFocus2") != NULL)
else if(strstr(ConstraintType,"EllipseFocus2") != nullptr)
this->getConstraintPtr()->AlignmentType=EllipseFocus2;
else {
this->getConstraintPtr()->AlignmentType=Undef;
@@ -313,12 +313,12 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/)
this->getConstraintPtr()->ThirdPos = (Sketcher::PointPos) intArg4;
return 0;
}
else if (strstr(ConstraintType,"InternalAlignment") != NULL) { // InteralAlignment with InternalElementIndex argument
else if (strstr(ConstraintType,"InternalAlignment") != nullptr) { // InteralAlignment with InternalElementIndex argument
this->getConstraintPtr()->Type = InternalAlignment;
valid = true;
if(strstr(ConstraintType,"BSplineControlPoint") != NULL) {
if(strstr(ConstraintType,"BSplineControlPoint") != nullptr) {
this->getConstraintPtr()->AlignmentType=BSplineControlPoint;
}
else {
@@ -673,7 +673,7 @@ Py::Boolean ConstraintPy::getIsActive(void) const
PyObject *ConstraintPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
return nullptr;
}
int ConstraintPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
@@ -110,12 +110,12 @@ PyObject* ExternalGeometryExtensionPy::testFlag(PyObject *args)
return new_reference_to(Py::Boolean(this->getExternalGeometryExtensionPtr()->testFlag(flagtype)));
PyErr_SetString(PyExc_TypeError, "Flag string does not exist.");
return NULL;
return nullptr;
}
PyErr_SetString(PyExc_TypeError, "No flag string provided.");
return NULL;
return nullptr;
}
PyObject* ExternalGeometryExtensionPy::setFlag(PyObject *args)
@@ -133,7 +133,7 @@ PyObject* ExternalGeometryExtensionPy::setFlag(PyObject *args)
}
PyErr_SetString(PyExc_TypeError, "Flag string does not exist.");
return NULL;
return nullptr;
}
PyErr_SetString(PyExc_TypeError, "No flag string provided.");
@@ -153,7 +153,7 @@ void ExternalGeometryExtensionPy::setRef(Py::String value)
PyObject *ExternalGeometryExtensionPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
return nullptr;
}
int ExternalGeometryExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
@@ -98,12 +98,12 @@ PyObject* ExternalGeometryFacadePy::testFlag(PyObject *args)
}
PyErr_SetString(PyExc_TypeError, "Flag string does not exist.");
return NULL;
return nullptr;
}
PyErr_SetString(PyExc_TypeError, "No flag string provided.");
return NULL;
return nullptr;
}
PyObject* ExternalGeometryFacadePy::setFlag(PyObject *args)
@@ -126,7 +126,7 @@ PyObject* ExternalGeometryFacadePy::setFlag(PyObject *args)
}
PyErr_SetString(PyExc_TypeError, "Flag string does not exist.");
return NULL;
return nullptr;
}
PyErr_SetString(PyExc_TypeError, "No flag string provided.");
@@ -208,14 +208,14 @@ PyObject* ExternalGeometryFacadePy::mirror(PyObject *args)
}
PyErr_SetString(Part::PartExceptionOCCError, "either a point (vector) or axis (vector, vector) must be given");
return 0;
return nullptr;
}
PyObject* ExternalGeometryFacadePy::rotate(PyObject *args)
{
PyObject* o;
if (!PyArg_ParseTuple(args, "O!", &(Base::PlacementPy::Type),&o))
return 0;
return nullptr;
Base::Placement* plm = static_cast<Base::PlacementPy*>(o)->getPlacementPtr();
getExternalGeometryFacadePtr()->rotate(*plm);
@@ -241,14 +241,14 @@ PyObject* ExternalGeometryFacadePy::scale(PyObject *args)
}
PyErr_SetString(Part::PartExceptionOCCError, "either vector or tuple and float expected");
return 0;
return nullptr;
}
PyObject* ExternalGeometryFacadePy::transform(PyObject *args)
{
PyObject* o;
if (!PyArg_ParseTuple(args, "O!", &(Base::MatrixPy::Type),&o))
return 0;
return nullptr;
Base::Matrix4D mat = static_cast<Base::MatrixPy*>(o)->value();
getExternalGeometryFacadePtr()->transform(mat);
Py_Return;
@@ -272,7 +272,7 @@ PyObject* ExternalGeometryFacadePy::translate(PyObject *args)
}
PyErr_SetString(Part::PartExceptionOCCError, "either vector or tuple expected");
return 0;
return nullptr;
}
PyObject* ExternalGeometryFacadePy::setExtension(PyObject *args)
@@ -290,7 +290,7 @@ PyObject* ExternalGeometryFacadePy::setExtension(PyObject *args)
}
PyErr_SetString(Part::PartExceptionOCCError, "A geometry extension object was expected");
return 0;
return nullptr;
}
PyObject* ExternalGeometryFacadePy::getExtensionOfType(PyObject *args)
@@ -310,27 +310,27 @@ PyObject* ExternalGeometryFacadePy::getExtensionOfType(PyObject *args)
}
catch(const Base::ValueError& e) {
PyErr_SetString(Part::PartExceptionOCCError, e.what());
return 0;
return nullptr;
}
catch(const std::bad_weak_ptr&) {
PyErr_SetString(Part::PartExceptionOCCError, "Geometry extension does not exist anymore.");
return 0;
return nullptr;
}
catch(Base::NotImplementedError&) {
PyErr_SetString(Part::PartExceptionOCCError, "Geometry extension does not implement a Python counterpart.");
return 0;
return nullptr;
}
}
else
{
PyErr_SetString(Part::PartExceptionOCCError, "Exception type does not exist");
return 0;
return nullptr;
}
}
PyErr_SetString(Part::PartExceptionOCCError, "A string with the name of the geometry extension type was expected");
return 0;
return nullptr;
}
PyObject* ExternalGeometryFacadePy::getExtensionOfName(PyObject *args)
@@ -347,21 +347,21 @@ PyObject* ExternalGeometryFacadePy::getExtensionOfName(PyObject *args)
}
catch(const Base::ValueError& e) {
PyErr_SetString(Part::PartExceptionOCCError, e.what());
return 0;
return nullptr;
}
catch(const std::bad_weak_ptr&) {
PyErr_SetString(Part::PartExceptionOCCError, "Geometry extension does not exist anymore.");
return 0;
return nullptr;
}
catch(Base::NotImplementedError&) {
PyErr_SetString(Part::PartExceptionOCCError, "Geometry extension does not implement a Python counterpart.");
return 0;
return nullptr;
}
}
PyErr_SetString(Part::PartExceptionOCCError, "A string with the name of the geometry extension was expected");
return 0;
return nullptr;
}
PyObject* ExternalGeometryFacadePy::hasExtensionOfType(PyObject *args)
@@ -377,19 +377,19 @@ PyObject* ExternalGeometryFacadePy::hasExtensionOfType(PyObject *args)
}
catch(const Base::ValueError& e) {
PyErr_SetString(Part::PartExceptionOCCError, e.what());
return 0;
return nullptr;
}
}
else
{
PyErr_SetString(Part::PartExceptionOCCError, "Exception type does not exist");
return 0;
return nullptr;
}
}
PyErr_SetString(Part::PartExceptionOCCError, "A string with the type of the geometry extension was expected");
return 0;
return nullptr;
}
PyObject* ExternalGeometryFacadePy::hasExtensionOfName(PyObject *args)
@@ -402,13 +402,13 @@ PyObject* ExternalGeometryFacadePy::hasExtensionOfName(PyObject *args)
}
catch(const Base::ValueError& e) {
PyErr_SetString(Part::PartExceptionOCCError, e.what());
return 0;
return nullptr;
}
}
PyErr_SetString(Part::PartExceptionOCCError, "A string with the type of the geometry extension was expected");
return 0;
return nullptr;
}
PyObject* ExternalGeometryFacadePy::deleteExtensionOfType(PyObject *args)
@@ -425,19 +425,19 @@ PyObject* ExternalGeometryFacadePy::deleteExtensionOfType(PyObject *args)
}
catch(const Base::ValueError& e) {
PyErr_SetString(Part::PartExceptionOCCError, e.what());
return 0;
return nullptr;
}
}
else
{
PyErr_SetString(Part::PartExceptionOCCError, "Type does not exist");
return 0;
return nullptr;
}
}
PyErr_SetString(Part::PartExceptionOCCError, "A string with a type object was expected");
return 0;
return nullptr;
}
PyObject* ExternalGeometryFacadePy::deleteExtensionOfName(PyObject *args)
@@ -451,19 +451,19 @@ PyObject* ExternalGeometryFacadePy::deleteExtensionOfName(PyObject *args)
}
catch(const Base::ValueError& e) {
PyErr_SetString(Part::PartExceptionOCCError, e.what());
return 0;
return nullptr;
}
}
PyErr_SetString(Part::PartExceptionOCCError, "A string with the name of the extension was expected");
return 0;
return nullptr;
}
PyObject* ExternalGeometryFacadePy::getExtensions(PyObject *args)
{
if (!PyArg_ParseTuple(args, "")){
PyErr_SetString(Part::PartExceptionOCCError, "No arguments were expected");
return NULL;
return nullptr;
}
try {
@@ -490,7 +490,7 @@ PyObject* ExternalGeometryFacadePy::getExtensions(PyObject *args)
}
catch(const Base::ValueError& e) {
PyErr_SetString(Part::PartExceptionOCCError, e.what());
return 0;
return nullptr;
}
}
@@ -541,7 +541,7 @@ void ExternalGeometryFacadePy::setGeometry(Py::Object arg)
PyObject *ExternalGeometryFacadePy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
return nullptr;
}
int ExternalGeometryFacadePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
+31 -31
View File
@@ -138,11 +138,11 @@ PyObject* GeometryFacadePy::testGeometryMode(PyObject *args)
return new_reference_to(Py::Boolean(getGeometryFacadePtr()->testGeometryMode(mode)));
PyErr_SetString(PyExc_TypeError, "Flag string does not exist.");
return NULL;
return nullptr;
}
PyErr_SetString(PyExc_TypeError, "No flag string provided.");
return NULL;
return nullptr;
}
PyObject* GeometryFacadePy::setGeometryMode(PyObject *args)
@@ -159,7 +159,7 @@ PyObject* GeometryFacadePy::setGeometryMode(PyObject *args)
}
PyErr_SetString(PyExc_TypeError, "Flag string does not exist.");
return NULL;
return nullptr;
}
PyErr_SetString(PyExc_TypeError, "No flag string provided.");
@@ -187,14 +187,14 @@ PyObject* GeometryFacadePy::mirror(PyObject *args)
}
PyErr_SetString(Part::PartExceptionOCCError, "either a point (vector) or axis (vector, vector) must be given");
return 0;
return nullptr;
}
PyObject* GeometryFacadePy::rotate(PyObject *args)
{
PyObject* o;
if (!PyArg_ParseTuple(args, "O!", &(Base::PlacementPy::Type),&o))
return 0;
return nullptr;
Base::Placement* plm = static_cast<Base::PlacementPy*>(o)->getPlacementPtr();
getGeometryFacadePtr()->rotate(*plm);
@@ -220,14 +220,14 @@ PyObject* GeometryFacadePy::scale(PyObject *args)
}
PyErr_SetString(Part::PartExceptionOCCError, "either vector or tuple and float expected");
return 0;
return nullptr;
}
PyObject* GeometryFacadePy::transform(PyObject *args)
{
PyObject* o;
if (!PyArg_ParseTuple(args, "O!", &(Base::MatrixPy::Type),&o))
return 0;
return nullptr;
Base::Matrix4D mat = static_cast<Base::MatrixPy*>(o)->value();
getGeometryFacadePtr()->transform(mat);
Py_Return;
@@ -251,7 +251,7 @@ PyObject* GeometryFacadePy::translate(PyObject *args)
}
PyErr_SetString(Part::PartExceptionOCCError, "either vector or tuple expected");
return 0;
return nullptr;
}
PyObject* GeometryFacadePy::setExtension(PyObject *args)
@@ -269,7 +269,7 @@ PyObject* GeometryFacadePy::setExtension(PyObject *args)
}
PyErr_SetString(Part::PartExceptionOCCError, "A geometry extension object was expected");
return 0;
return nullptr;
}
PyObject* GeometryFacadePy::getExtensionOfType(PyObject *args)
@@ -289,27 +289,27 @@ PyObject* GeometryFacadePy::getExtensionOfType(PyObject *args)
}
catch(const Base::ValueError& e) {
PyErr_SetString(Part::PartExceptionOCCError, e.what());
return 0;
return nullptr;
}
catch(const std::bad_weak_ptr&) {
PyErr_SetString(Part::PartExceptionOCCError, "Geometry extension does not exist anymore.");
return 0;
return nullptr;
}
catch(Base::NotImplementedError&) {
PyErr_SetString(Part::PartExceptionOCCError, "Geometry extension does not implement a Python counterpart.");
return 0;
return nullptr;
}
}
else
{
PyErr_SetString(Part::PartExceptionOCCError, "Exception type does not exist");
return 0;
return nullptr;
}
}
PyErr_SetString(Part::PartExceptionOCCError, "A string with the name of the geometry extension type was expected");
return 0;
return nullptr;
}
PyObject* GeometryFacadePy::getExtensionOfName(PyObject *args)
@@ -326,20 +326,20 @@ PyObject* GeometryFacadePy::getExtensionOfName(PyObject *args)
}
catch(const Base::ValueError& e) {
PyErr_SetString(Part::PartExceptionOCCError, e.what());
return 0;
return nullptr;
}
catch(const std::bad_weak_ptr&) {
PyErr_SetString(Part::PartExceptionOCCError, "Geometry extension does not exist anymore.");
return 0;
return nullptr;
}
catch(Base::NotImplementedError&) {
PyErr_SetString(Part::PartExceptionOCCError, "Geometry extension does not implement a Python counterpart.");
return 0;
return nullptr;
}
}
PyErr_SetString(Part::PartExceptionOCCError, "A string with the name of the geometry extension was expected");
return 0;
return nullptr;
}
PyObject* GeometryFacadePy::hasExtensionOfType(PyObject *args)
@@ -355,19 +355,19 @@ PyObject* GeometryFacadePy::hasExtensionOfType(PyObject *args)
}
catch(const Base::ValueError& e) {
PyErr_SetString(Part::PartExceptionOCCError, e.what());
return 0;
return nullptr;
}
}
else
{
PyErr_SetString(Part::PartExceptionOCCError, "Exception type does not exist");
return 0;
return nullptr;
}
}
PyErr_SetString(Part::PartExceptionOCCError, "A string with the type of the geometry extension was expected");
return 0;
return nullptr;
}
PyObject* GeometryFacadePy::hasExtensionOfName(PyObject *args)
@@ -380,13 +380,13 @@ PyObject* GeometryFacadePy::hasExtensionOfName(PyObject *args)
}
catch(const Base::ValueError& e) {
PyErr_SetString(Part::PartExceptionOCCError, e.what());
return 0;
return nullptr;
}
}
PyErr_SetString(Part::PartExceptionOCCError, "A string with the type of the geometry extension was expected");
return 0;
return nullptr;
}
PyObject* GeometryFacadePy::deleteExtensionOfType(PyObject *args)
@@ -403,19 +403,19 @@ PyObject* GeometryFacadePy::deleteExtensionOfType(PyObject *args)
}
catch(const Base::ValueError& e) {
PyErr_SetString(Part::PartExceptionOCCError, e.what());
return 0;
return nullptr;
}
}
else
{
PyErr_SetString(Part::PartExceptionOCCError, "Type does not exist");
return 0;
return nullptr;
}
}
PyErr_SetString(Part::PartExceptionOCCError, "A string with a type object was expected");
return 0;
return nullptr;
}
PyObject* GeometryFacadePy::deleteExtensionOfName(PyObject *args)
@@ -429,19 +429,19 @@ PyObject* GeometryFacadePy::deleteExtensionOfName(PyObject *args)
}
catch(const Base::ValueError& e) {
PyErr_SetString(Part::PartExceptionOCCError, e.what());
return 0;
return nullptr;
}
}
PyErr_SetString(Part::PartExceptionOCCError, "A string with the name of the extension was expected");
return 0;
return nullptr;
}
PyObject* GeometryFacadePy::getExtensions(PyObject *args)
{
if (!PyArg_ParseTuple(args, "")){
PyErr_SetString(Part::PartExceptionOCCError, "No arguments were expected");
return NULL;
return nullptr;
}
try {
@@ -468,7 +468,7 @@ PyObject* GeometryFacadePy::getExtensions(PyObject *args)
}
catch(const Base::ValueError& e) {
PyErr_SetString(Part::PartExceptionOCCError, e.what());
return 0;
return nullptr;
}
}
@@ -518,7 +518,7 @@ void GeometryFacadePy::setGeometry(Py::Object arg)
PyObject *GeometryFacadePy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
return nullptr;
}
int GeometryFacadePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
@@ -256,7 +256,7 @@ bool PropertyConstraintList::getPyPathValue(const App::ObjectIdentifier &path, P
const ObjectIdentifier::Component & c1 = path.getPropertyComponent(1);
const Constraint *cstr = 0;
const Constraint *cstr = nullptr;
if (c1.isArray())
cstr = _lValueList[c1.getIndex(_lValueList.size())];
@@ -99,7 +99,7 @@ public:
returns null. This must be checked by the caller.
*/
const Constraint *operator[] (const int idx) const {
return (invalidGeometry || invalidIndices) ? 0 : _lValueList[idx];
return (invalidGeometry || invalidIndices) ? nullptr : _lValueList[idx];
}
const std::vector<Constraint*> &getValues(void) const {
+5 -5
View File
@@ -1526,7 +1526,7 @@ GCS::Curve* Sketch::getGCSCurveByGeoId(int geoId)
return &BSplines[Geoms[geoId].index];
break;
default:
return 0;
return nullptr;
};
}
@@ -2429,7 +2429,7 @@ int Sketch::addAngleAtPointConstraint(
return -1;
}
GCS::Point &p = Points[pointId];
GCS::Point* p2 = 0;
GCS::Point* p2 = nullptr;
if(e2e){//we need second point
int pointId = getPointId(geoId2, pos2);
if (pointId < 0 || pointId >= int(Points.size())){
@@ -2631,7 +2631,7 @@ int Sketch::addAngleConstraint(int geoId1, PointPos pos1, int geoId2, PointPos p
Geoms[geoId2].type != Line)
return -1;
GCS::Point *l1p1=0, *l1p2=0;
GCS::Point *l1p1=nullptr, *l1p2=nullptr;
if (pos1 == PointPos::start) {
l1p1 = &Points[Geoms[geoId1].startPointId];
l1p2 = &Points[Geoms[geoId1].endPointId];
@@ -2640,7 +2640,7 @@ int Sketch::addAngleConstraint(int geoId1, PointPos pos1, int geoId2, PointPos p
l1p2 = &Points[Geoms[geoId1].startPointId];
}
GCS::Point *l2p1=0, *l2p2=0;
GCS::Point *l2p1=nullptr, *l2p2=nullptr;
if (pos2 == PointPos::start) {
l2p1 = &Points[Geoms[geoId2].startPointId];
l2p2 = &Points[Geoms[geoId2].endPointId];
@@ -2649,7 +2649,7 @@ int Sketch::addAngleConstraint(int geoId1, PointPos pos1, int geoId2, PointPos p
l2p2 = &Points[Geoms[geoId2].startPointId];
}
if (l1p1 == 0 || l2p1 == 0)
if (l1p1 == nullptr || l2p1 == nullptr)
return -1;
int tag = ++ConstraintsCounter;
+4 -4
View File
@@ -408,7 +408,7 @@ protected:
protected:
/// container element to store and work with the geometric elements of this sketch
struct GeoDef {
GeoDef() : geo(0),type(None),external(false),index(-1),
GeoDef() : geo(nullptr),type(None),external(false),index(-1),
startPointId(-1),midPointId(-1),endPointId(-1) {}
Part::Geometry * geo; // pointer to the geometry
GeoType type; // type of the geometry
@@ -420,10 +420,10 @@ protected:
};
/// container element to store and work with the constraints of this sketch
struct ConstrDef {
ConstrDef() : constr(0)
ConstrDef() : constr(nullptr)
, driving(true)
, value(0)
, secondvalue(0) {}
, value(nullptr)
, secondvalue(nullptr) {}
Constraint * constr; // pointer to the constraint
bool driving;
double * value;
@@ -145,11 +145,11 @@ PyObject* SketchGeometryExtensionPy::testGeometryMode(PyObject *args)
return new_reference_to(Py::Boolean(getSketchGeometryExtensionPtr()->testGeometryMode(mode)));
PyErr_SetString(PyExc_TypeError, "Flag string does not exist.");
return NULL;
return nullptr;
}
PyErr_SetString(PyExc_TypeError, "No flag string provided.");
return NULL;
return nullptr;
}
PyObject* SketchGeometryExtensionPy::setGeometryMode(PyObject *args)
@@ -166,7 +166,7 @@ PyObject* SketchGeometryExtensionPy::setGeometryMode(PyObject *args)
}
PyErr_SetString(PyExc_TypeError, "Flag string does not exist.");
return NULL;
return nullptr;
}
PyErr_SetString(PyExc_TypeError, "No flag string provided.");
@@ -185,7 +185,7 @@ void SketchGeometryExtensionPy::setGeometryLayerId(Py::Long Id)
PyObject *SketchGeometryExtensionPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
return nullptr;
}
int SketchGeometryExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
+9 -9
View File
@@ -103,9 +103,9 @@ PROPERTY_SOURCE(Sketcher::SketchObject, Part::Part2DObject)
SketchObject::SketchObject()
{
ADD_PROPERTY_TYPE(Geometry, (0) ,"Sketch",(App::PropertyType)(App::Prop_None),"Sketch geometry");
ADD_PROPERTY_TYPE(Constraints, (0) ,"Sketch",(App::PropertyType)(App::Prop_None),"Sketch constraints");
ADD_PROPERTY_TYPE(ExternalGeometry,(0,0),"Sketch",(App::PropertyType)(App::Prop_None),"Sketch external geometry");
ADD_PROPERTY_TYPE(Geometry, (nullptr) ,"Sketch",(App::PropertyType)(App::Prop_None),"Sketch geometry");
ADD_PROPERTY_TYPE(Constraints, (nullptr) ,"Sketch",(App::PropertyType)(App::Prop_None),"Sketch constraints");
ADD_PROPERTY_TYPE(ExternalGeometry,(nullptr,nullptr),"Sketch",(App::PropertyType)(App::Prop_None),"Sketch external geometry");
ADD_PROPERTY_TYPE(FullyConstrained, (false),"Sketch",(App::PropertyType)(App::Prop_Output|App::Prop_ReadOnly |App::Prop_Hidden),"Sketch is fully constrained");
Geometry.setOrderRelevant(true);
@@ -3326,7 +3326,7 @@ bool SketchObject::isExternalAllowed(App::Document *pDoc, App::DocumentObject *p
App::Part* part_this = App::Part::getPartOfObject(this);
App::Part* part_obj = App::Part::getPartOfObject(pObj);
if (part_this == part_obj){ //either in the same part, or in the root of document
if (body_this == NULL) {
if (body_this == nullptr) {
return true;
} else if (body_this == body_obj) {
return true;
@@ -3385,7 +3385,7 @@ bool SketchObject::isCarbonCopyAllowed(App::Document *pDoc, App::DocumentObject
App::Part* part_this = App::Part::getPartOfObject(this);
App::Part* part_obj = App::Part::getPartOfObject(pObj);
if (part_this == part_obj){ //either in the same part, or in the root of document
if (body_this != NULL) {
if (body_this != nullptr) {
if (body_this != body_obj) {
if (!this->allowOtherBody) {
if (rsn)
@@ -7681,7 +7681,7 @@ std::string SketchObject::validateExpression(const App::ObjectIdentifier &path,
{
const App::Property * prop = path.getProperty();
assert(expr != 0);
assert(expr != nullptr);
if (!prop)
return "Property not found";
@@ -7720,7 +7720,7 @@ double SketchObject::calculateAngleViaPoint(int GeoId1, int GeoId2, double px, d
const Part::Geometry *p1=this->getGeometry(GeoId1);
const Part::Geometry *p2=this->getGeometry(GeoId2);
if(p1!=0 && p2!=0) {
if(p1!=nullptr && p2!=nullptr) {
int i1 = sk.addGeometry(this->getGeometry(GeoId1));
int i2 = sk.addGeometry(this->getGeometry(GeoId2));
@@ -8208,7 +8208,7 @@ bool SketchObject::constraintHasExpression(int constrid) const
App::PropertyExpressionEngine::ExpressionInfo expr_info = this->getExpression(spath);
return (expr_info.expression != 0);
return (expr_info.expression != nullptr);
}
@@ -8229,7 +8229,7 @@ int SketchObject::port_reversedExternalArcs(bool justAnalyze)
for(std::size_t ic = 0; ic<newVals.size(); ic++){//ic = index of constraint
bool affected=false;
Constraint *constNew = 0;
Constraint *constNew = nullptr;
for(int ig=1; ig<=3; ig++){//cycle through constraint.first, second, third
int geoId = 0;
Sketcher::PointPos posId = PointPos::none;
+2 -2
View File
@@ -490,9 +490,9 @@ public:
};
/// Return true if this object is allowed as external geometry for the
/// sketch. rsn argument receives the reason for disallowing.
bool isExternalAllowed(App::Document *pDoc, App::DocumentObject *pObj, eReasonList* rsn = 0) const;
bool isExternalAllowed(App::Document *pDoc, App::DocumentObject *pObj, eReasonList* rsn = nullptr) const;
bool isCarbonCopyAllowed(App::Document *pDoc, App::DocumentObject *pObj, bool & xinv, bool & yinv, eReasonList* rsn = 0) const;
bool isCarbonCopyAllowed(App::Document *pDoc, App::DocumentObject *pObj, bool & xinv, bool & yinv, eReasonList* rsn = nullptr) const;
bool isPerformingInternalTransaction() const {return internaltransaction;};
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -39,7 +39,7 @@ PROPERTY_SOURCE(Sketcher::SketchObjectSF, Part::Part2DObject)
SketchObjectSF::SketchObjectSF()
{
ADD_PROPERTY_TYPE(SketchFlatFile,(0),"",(App::PropertyType)(App::Prop_None),
ADD_PROPERTY_TYPE(SketchFlatFile,(nullptr),"",(App::PropertyType)(App::Prop_None),
"SketchFlat file (*.skf) which defines this sketch");
}
+1 -1
View File
@@ -40,7 +40,7 @@ std::string SketchObjectSFPy::representation(void) const
PyObject *SketchObjectSFPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
return nullptr;
}
int SketchObjectSFPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
+6 -6
View File
@@ -63,7 +63,7 @@ int SketchPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
PyObject* SketchPy::solve(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return 0;
return nullptr;
getSketchPtr()->resetSolver();
return Py::new_reference_to(Py::Long(getSketchPtr()->solve()));
}
@@ -72,7 +72,7 @@ PyObject* SketchPy::addGeometry(PyObject *args)
{
PyObject *pcObj;
if (!PyArg_ParseTuple(args, "O", &pcObj))
return 0;
return nullptr;
if (PyObject_TypeCheck(pcObj, &(Part::GeometryPy::Type))) {
Part::Geometry *geo = static_cast<Part::GeometryPy*>(pcObj)->getGeometryPtr();
@@ -108,7 +108,7 @@ PyObject* SketchPy::addConstraint(PyObject *args)
{
PyObject *pcObj;
if (!PyArg_ParseTuple(args, "O", &pcObj))
return 0;
return nullptr;
if (PyObject_TypeCheck(pcObj, &(PyList_Type)) || PyObject_TypeCheck(pcObj, &(PyTuple_Type))) {
std::vector<Constraint*> values;
@@ -144,7 +144,7 @@ PyObject* SketchPy::addConstraint(PyObject *args)
PyObject* SketchPy::clear(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return 0;
return nullptr;
getSketchPtr()->clear();
@@ -157,7 +157,7 @@ PyObject* SketchPy::movePoint(PyObject *args)
PyObject *pcObj;
int relative=0;
if (!PyArg_ParseTuple(args, "iiO!|i", &index1,&index2,&(Base::VectorPy::Type),&pcObj,&relative))
return 0;
return nullptr;
Base::Vector3d* toPoint = static_cast<Base::VectorPy*>(pcObj)->getVectorPtr();
return Py::new_reference_to(Py::Long(getSketchPtr()->movePoint(index1,(Sketcher::PointPos)index2,*toPoint,(relative>0))));
@@ -209,7 +209,7 @@ Py::Object SketchPy::getShape(void) const
PyObject *SketchPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
return nullptr;
}
int SketchPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
+27 -27
View File
@@ -553,7 +553,7 @@ void ConstraintPointOnPerpBisector::errorgrad(double *err, double *grad, double
double ConstraintPointOnPerpBisector::error()
{
double err;
errorgrad(&err,0,0);
errorgrad(&err,nullptr,nullptr);
return scale * err;
}
@@ -563,7 +563,7 @@ double ConstraintPointOnPerpBisector::grad(double *param)
if ( findParamInPvec(param) == -1 ) return 0.0;
double deriv;
errorgrad(0, &deriv, param);
errorgrad(nullptr, &deriv, param);
return deriv*scale;
}
@@ -1095,7 +1095,7 @@ void ConstraintEllipseTangentLine::errorgrad(double *err, double *grad, double *
double ConstraintEllipseTangentLine::error()
{
double err;
errorgrad(&err,0,0);
errorgrad(&err,nullptr,nullptr);
return scale * err;
}
@@ -1105,7 +1105,7 @@ double ConstraintEllipseTangentLine::grad(double *param)
if ( findParamInPvec(param) == -1 ) return 0.0;
double deriv;
errorgrad(0, &deriv, param);
errorgrad(nullptr, &deriv, param);
//use numeric for testing
#if 0
@@ -1220,7 +1220,7 @@ void ConstraintInternalAlignmentPoint2Ellipse::errorgrad(double *err, double *gr
double ConstraintInternalAlignmentPoint2Ellipse::error()
{
double err;
errorgrad(&err,0,0);
errorgrad(&err,nullptr,nullptr);
return scale * err;
}
@@ -1231,7 +1231,7 @@ double ConstraintInternalAlignmentPoint2Ellipse::grad(double *param)
if ( findParamInPvec(param) == -1 ) return 0.0;
double deriv;
errorgrad(0, &deriv, param);
errorgrad(nullptr, &deriv, param);
//use numeric for testing
#if 0
@@ -1353,7 +1353,7 @@ void ConstraintInternalAlignmentPoint2Hyperbola::errorgrad(double *err, double *
double ConstraintInternalAlignmentPoint2Hyperbola::error()
{
double err;
errorgrad(&err,0,0);
errorgrad(&err,nullptr,nullptr);
return scale * err;
}
@@ -1364,7 +1364,7 @@ double ConstraintInternalAlignmentPoint2Hyperbola::grad(double *param)
if ( findParamInPvec(param) == -1 ) return 0.0;
double deriv;
errorgrad(0, &deriv, param);
errorgrad(nullptr, &deriv, param);
return deriv*scale;
@@ -1416,7 +1416,7 @@ void ConstraintEqualMajorAxesConic::errorgrad(double *err, double *grad, double
double ConstraintEqualMajorAxesConic::error()
{
double err;
errorgrad(&err,0,0);
errorgrad(&err,nullptr,nullptr);
return scale * err;
}
@@ -1426,7 +1426,7 @@ double ConstraintEqualMajorAxesConic::grad(double *param)
if ( findParamInPvec(param) == -1 ) return 0.0;
double deriv;
errorgrad(0, &deriv, param);
errorgrad(nullptr, &deriv, param);
return deriv * scale;
}
@@ -1492,7 +1492,7 @@ void ConstraintEqualFocalDistance::errorgrad(double *err, double *grad, double *
double ConstraintEqualFocalDistance::error()
{
double err;
errorgrad(&err,0,0);
errorgrad(&err,nullptr,nullptr);
return scale * err;
}
@@ -1502,7 +1502,7 @@ double ConstraintEqualFocalDistance::grad(double *param)
if ( findParamInPvec(param) == -1 ) return 0.0;
double deriv;
errorgrad(0, &deriv, param);
errorgrad(nullptr, &deriv, param);
return deriv * scale;
}
@@ -1523,7 +1523,7 @@ ConstraintCurveValue::ConstraintCurveValue(Point &p, double* pcoord, Curve& crv,
ConstraintCurveValue::~ConstraintCurveValue()
{
delete this->crv; this->crv = 0;
delete this->crv; this->crv = nullptr;
}
void ConstraintCurveValue::ReconstructGeomPointers()
@@ -1580,7 +1580,7 @@ void ConstraintCurveValue::errorgrad(double *err, double *grad, double *param)
double ConstraintCurveValue::error()
{
double err;
errorgrad(&err,0,0);
errorgrad(&err,nullptr,nullptr);
return scale * err;
}
@@ -1590,7 +1590,7 @@ double ConstraintCurveValue::grad(double *param)
if ( findParamInPvec(param) == -1 ) return 0.0;
double deriv;
errorgrad(0, &deriv, param);
errorgrad(nullptr, &deriv, param);
return deriv*scale;
}
@@ -1748,7 +1748,7 @@ ConstraintPointOnParabola::ConstraintPointOnParabola(Point &p, ArcOfParabola &e)
ConstraintPointOnParabola::~ConstraintPointOnParabola()
{
delete this->parab; this->parab = 0;
delete this->parab; this->parab = nullptr;
}
void ConstraintPointOnParabola::ReconstructGeomPointers()
@@ -1807,7 +1807,7 @@ void ConstraintPointOnParabola::errorgrad(double *err, double *grad, double *par
double ConstraintPointOnParabola::error()
{
double err;
errorgrad(&err,0,0);
errorgrad(&err,nullptr,nullptr);
return scale * err;
}
@@ -1817,7 +1817,7 @@ double ConstraintPointOnParabola::grad(double *param)
if ( findParamInPvec(param) == -1 ) return 0.0;
double deriv;
errorgrad(0, &deriv, param);
errorgrad(nullptr, &deriv, param);
return deriv*scale;
}
@@ -1838,8 +1838,8 @@ ConstraintAngleViaPoint::ConstraintAngleViaPoint(Curve &acrv1, Curve &acrv2, Poi
}
ConstraintAngleViaPoint::~ConstraintAngleViaPoint()
{
delete crv1; crv1 = 0;
delete crv2; crv2 = 0;
delete crv1; crv1 = nullptr;
delete crv2; crv2 = nullptr;
}
void ConstraintAngleViaPoint::ReconstructGeomPointers()
@@ -1941,9 +1941,9 @@ ConstraintSnell::ConstraintSnell(Curve &ray1, Curve &ray2, Curve &boundary, Poin
}
ConstraintSnell::~ConstraintSnell()
{
delete ray1; ray1 = 0;
delete ray2; ray2 = 0;
delete boundary; boundary = 0;
delete ray1; ray1 = nullptr;
delete ray2; ray2 = nullptr;
delete boundary; boundary = nullptr;
}
void ConstraintSnell::ReconstructGeomPointers()
@@ -1992,7 +1992,7 @@ void ConstraintSnell::errorgrad(double *err, double *grad, double* param)
double ConstraintSnell::error()
{
double err;
errorgrad(&err, 0, 0);
errorgrad(&err, nullptr, nullptr);
return scale * err;
}
@@ -2003,7 +2003,7 @@ double ConstraintSnell::grad(double *param)
if ( findParamInPvec(param) == -1 ) return 0.0;
double deriv;
errorgrad(0, &deriv, param);
errorgrad(nullptr, &deriv, param);
//use numeric for testing
@@ -2111,7 +2111,7 @@ void ConstraintEqualLineLength::errorgrad(double *err, double *grad, double *par
double ConstraintEqualLineLength::error()
{
double err;
errorgrad(&err,0,0);
errorgrad(&err,nullptr,nullptr);
return scale * err;
}
@@ -2120,7 +2120,7 @@ double ConstraintEqualLineLength::grad(double *param)
if ( findParamInPvec(param) == -1 ) return 0.0;
double deriv;
errorgrad(0, &deriv, param);
errorgrad(nullptr, &deriv, param);
return deriv*scale;
}
+3 -3
View File
@@ -1521,8 +1521,8 @@ void System::initSolution(Algorithm alg)
clist1.push_back(*constr);
}
subSystems.push_back(NULL);
subSystemsAux.push_back(NULL);
subSystems.push_back(nullptr);
subSystemsAux.push_back(nullptr);
if (clist0.size() > 0)
subSystems[cid] = new SubSystem(clist0, plists[cid], reductionmaps[cid]);
if (clist1.size() > 0)
@@ -4477,7 +4477,7 @@ void System::identifyConflictingRedundantConstraints( Algorithm alg,
break;
int maxPopularity = 0;
Constraint *mostPopular = NULL;
Constraint *mostPopular = nullptr;
for (std::map< Constraint *, SET_I >::const_iterator it=conflictingMap.begin();
it != conflictingMap.end(); ++it) {
if (static_cast<int>(it->second.size()) > maxPopularity ||
+2 -2
View File
@@ -236,7 +236,7 @@ double Ellipse::getRadMaj(double *derivparam, double &ret_dRadMaj) const
double Ellipse::getRadMaj() const
{
double dradmaj;//dummy
return getRadMaj(0,dradmaj);
return getRadMaj(nullptr,dradmaj);
}
DeriVector2 Ellipse::CalculateNormal(const Point &p, const double* derivparam) const
@@ -394,7 +394,7 @@ double Hyperbola::getRadMaj(double *derivparam, double &ret_dRadMaj) const
double Hyperbola::getRadMaj() const
{
double dradmaj;//dummy
return getRadMaj(0,dradmaj);
return getRadMaj(nullptr,dradmaj);
}
DeriVector2 Hyperbola::CalculateNormal(const Point &p, const double* derivparam) const
+23 -23
View File
@@ -31,7 +31,7 @@ namespace GCS
class Point
{
public:
Point(){x = 0; y = 0;}
Point(){x = nullptr; y = nullptr;}
Point(double *px, double *py) {x=px; y=py;}
double *x;
double *y;
@@ -65,7 +65,7 @@ namespace GCS
//unlike other vectors in FreeCAD, this normalization creates a new vector instead of modifying existing one.
DeriVector2 getNormalized() const; //returns zero vector if the original is zero.
double scalarProd(const DeriVector2 &v2, double* dprd=0) const;//calculates scalar product of two vectors and returns the result. The derivative of the result is written into argument dprd.
double scalarProd(const DeriVector2 &v2, double* dprd=nullptr) const;//calculates scalar product of two vectors and returns the result. The derivative of the result is written into argument dprd.
DeriVector2 sum(const DeriVector2 &v2) const {//adds two vectors and returns result
return DeriVector2(x + v2.x, y + v2.y,
dx + v2.dx, dy + v2.dy);}
@@ -100,7 +100,7 @@ namespace GCS
//derivparam is a pointer to a curve parameter (or point coordinate) to
// compute the derivative for. The derivative is returned through dx,dy
// fields of DeriVector2.
virtual DeriVector2 CalculateNormal(const Point &p, const double* derivparam = 0) const = 0;
virtual DeriVector2 CalculateNormal(const Point &p, const double* derivparam = nullptr) const = 0;
/**
* @brief Value: returns point (vector) given the value of parameter
@@ -109,7 +109,7 @@ namespace GCS
* @param derivparam: pointer to sketch parameter to calculate the derivative for
* @return
*/
virtual DeriVector2 Value(double u, double du, const double* derivparam = 0) const;
virtual DeriVector2 Value(double u, double du, const double* derivparam = nullptr) const;
//adds curve's parameters to pvec (used by constraints)
virtual int PushOwnParams(VEC_pD &pvec) = 0;
@@ -126,8 +126,8 @@ namespace GCS
virtual ~Line(){}
Point p1;
Point p2;
DeriVector2 CalculateNormal(const Point &p, const double* derivparam = 0) const override;
DeriVector2 Value(double u, double du, const double* derivparam = 0) const override;
DeriVector2 CalculateNormal(const Point &p, const double* derivparam = nullptr) const override;
DeriVector2 Value(double u, double du, const double* derivparam = nullptr) const override;
virtual int PushOwnParams(VEC_pD &pvec) override;
virtual void ReconstructOnNewPvec (VEC_pD &pvec, int &cnt) override;
virtual Line* Copy() override;
@@ -136,12 +136,12 @@ namespace GCS
class Circle: public Curve
{
public:
Circle(){rad = 0;}
Circle(){rad = nullptr;}
virtual ~Circle(){}
Point center;
double *rad;
DeriVector2 CalculateNormal(const Point &p, const double* derivparam = 0) const override;
DeriVector2 Value(double u, double du, const double* derivparam = 0) const override;
DeriVector2 CalculateNormal(const Point &p, const double* derivparam = nullptr) const override;
DeriVector2 Value(double u, double du, const double* derivparam = nullptr) const override;
virtual int PushOwnParams(VEC_pD &pvec) override;
virtual void ReconstructOnNewPvec (VEC_pD &pvec, int &cnt) override;
virtual Circle* Copy() override;
@@ -150,7 +150,7 @@ namespace GCS
class Arc: public Circle
{
public:
Arc(){startAngle=0;endAngle=0;rad=0;}
Arc(){startAngle=nullptr;endAngle=nullptr;rad=nullptr;}
virtual ~Arc(){}
double *startAngle;
double *endAngle;
@@ -176,7 +176,7 @@ namespace GCS
class Ellipse: public MajorRadiusConic
{
public:
Ellipse(){ radmin = 0;}
Ellipse(){ radmin = nullptr;}
virtual ~Ellipse(){}
Point center;
Point focus1;
@@ -184,8 +184,8 @@ namespace GCS
virtual double getRadMaj(const DeriVector2 &center, const DeriVector2 &f1, double b, double db, double &ret_dRadMaj) const override;
virtual double getRadMaj(double* derivparam, double &ret_dRadMaj) const override;
virtual double getRadMaj() const override;
DeriVector2 CalculateNormal(const Point &p, const double* derivparam = 0) const override;
DeriVector2 Value(double u, double du, const double* derivparam = 0) const override;
DeriVector2 CalculateNormal(const Point &p, const double* derivparam = nullptr) const override;
DeriVector2 Value(double u, double du, const double* derivparam = nullptr) const override;
virtual int PushOwnParams(VEC_pD &pvec) override;
virtual void ReconstructOnNewPvec (VEC_pD &pvec, int &cnt) override;
virtual Ellipse* Copy() override;
@@ -194,7 +194,7 @@ namespace GCS
class ArcOfEllipse: public Ellipse
{
public:
ArcOfEllipse(){startAngle=0;endAngle=0;radmin = 0;}
ArcOfEllipse(){startAngle=nullptr;endAngle=nullptr;radmin = nullptr;}
virtual ~ArcOfEllipse(){}
double *startAngle;
double *endAngle;
@@ -212,7 +212,7 @@ namespace GCS
class Hyperbola: public MajorRadiusConic
{
public:
Hyperbola(){ radmin = 0;}
Hyperbola(){ radmin = nullptr;}
virtual ~Hyperbola(){}
Point center;
Point focus1;
@@ -220,8 +220,8 @@ namespace GCS
virtual double getRadMaj(const DeriVector2 &center, const DeriVector2 &f1, double b, double db, double &ret_dRadMaj) const override;
virtual double getRadMaj(double* derivparam, double &ret_dRadMaj) const override;
virtual double getRadMaj() const override;
DeriVector2 CalculateNormal(const Point &p, const double* derivparam = 0) const override;
virtual DeriVector2 Value(double u, double du, const double* derivparam = 0) const override;
DeriVector2 CalculateNormal(const Point &p, const double* derivparam = nullptr) const override;
virtual DeriVector2 Value(double u, double du, const double* derivparam = nullptr) const override;
virtual int PushOwnParams(VEC_pD &pvec) override;
virtual void ReconstructOnNewPvec (VEC_pD &pvec, int &cnt) override;
virtual Hyperbola* Copy() override;
@@ -230,7 +230,7 @@ namespace GCS
class ArcOfHyperbola: public Hyperbola
{
public:
ArcOfHyperbola(){startAngle=0;endAngle=0;radmin = 0;}
ArcOfHyperbola(){startAngle=nullptr;endAngle=nullptr;radmin = nullptr;}
virtual ~ArcOfHyperbola(){}
// parameters
double *startAngle;
@@ -250,8 +250,8 @@ namespace GCS
virtual ~Parabola(){}
Point vertex;
Point focus1;
DeriVector2 CalculateNormal(const Point &p, const double* derivparam = 0) const override;
virtual DeriVector2 Value(double u, double du, const double* derivparam = 0) const override;
DeriVector2 CalculateNormal(const Point &p, const double* derivparam = nullptr) const override;
virtual DeriVector2 Value(double u, double du, const double* derivparam = nullptr) const override;
virtual int PushOwnParams(VEC_pD &pvec) override;
virtual void ReconstructOnNewPvec (VEC_pD &pvec, int &cnt) override;
virtual Parabola* Copy() override;
@@ -260,7 +260,7 @@ namespace GCS
class ArcOfParabola: public Parabola
{
public:
ArcOfParabola(){startAngle=0;endAngle=0;}
ArcOfParabola(){startAngle=nullptr;endAngle=nullptr;}
virtual ~ArcOfParabola(){}
// parameters
double *startAngle;
@@ -293,8 +293,8 @@ namespace GCS
bool periodic;
VEC_I knotpointGeoids; // geoids of knotpoints as to index Geom array
// interface helpers
DeriVector2 CalculateNormal(const Point &p, const double* derivparam = 0) const override;
virtual DeriVector2 Value(double u, double du, const double* derivparam = 0) const override;
DeriVector2 CalculateNormal(const Point &p, const double* derivparam = nullptr) const override;
virtual DeriVector2 Value(double u, double du, const double* derivparam = nullptr) const override;
virtual int PushOwnParams(VEC_pD &pvec) override;
virtual void ReconstructOnNewPvec (VEC_pD &pvec, int &cnt) override;
virtual BSpline* Copy() override;
+2 -2
View File
@@ -85,7 +85,7 @@ PyMOD_INIT_FUNC(SketcherGui)
{
if (!Gui::Application::Instance) {
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
PyMOD_Return(0);
PyMOD_Return(nullptr);
}
try {
Base::Interpreter().runString("import PartGui");
@@ -93,7 +93,7 @@ PyMOD_INIT_FUNC(SketcherGui)
}
catch(const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());
PyMOD_Return(0);
PyMOD_Return(nullptr);
}
PyObject* mod = SketcherGui::initModule();
+9 -9
View File
@@ -82,16 +82,16 @@ namespace SketcherGui {
};
Attacher::eMapMode SuggestAutoMapMode(Attacher::SuggestResult::eSuggestResult* pMsgId = 0,
QString* message = 0,
std::vector<Attacher::eMapMode>* allmodes = 0){
Attacher::eMapMode SuggestAutoMapMode(Attacher::SuggestResult::eSuggestResult* pMsgId = nullptr,
QString* message = nullptr,
std::vector<Attacher::eMapMode>* allmodes = nullptr){
//convert pointers into valid references, to avoid checking for null pointers everywhere
Attacher::SuggestResult::eSuggestResult buf;
if (pMsgId == 0)
if (pMsgId == nullptr)
pMsgId = &buf;
Attacher::SuggestResult::eSuggestResult &msg = *pMsgId;
QString buf2;
if (message == 0)
if (message == nullptr)
message = &buf2;
QString &msg_str = *message;
@@ -399,7 +399,7 @@ void CmdSketcherReorientSketch::activated(int iMsg)
QMessageBox::Yes|QMessageBox::No);
if (ret == QMessageBox::No)
return;
sketch->Support.setValue(0);
sketch->Support.setValue(nullptr);
}
// ask user for orientation
@@ -733,7 +733,7 @@ CmdSketcherValidateSketch::CmdSketcherValidateSketch()
void CmdSketcherValidateSketch::activated(int iMsg)
{
Q_UNUSED(iMsg);
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
if (selection.size() != 1) {
QMessageBox::warning(Gui::getMainWindow(),
qApp->translate("CmdSketcherValidateSketch", "Wrong selection"),
@@ -772,7 +772,7 @@ CmdSketcherMirrorSketch::CmdSketcherMirrorSketch()
void CmdSketcherMirrorSketch::activated(int iMsg)
{
Q_UNUSED(iMsg);
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
if (selection.size() < 1) {
QMessageBox::warning(Gui::getMainWindow(),
qApp->translate("CmdSketcherMirrorSketch", "Wrong selection"),
@@ -877,7 +877,7 @@ CmdSketcherMergeSketches::CmdSketcherMergeSketches()
void CmdSketcherMergeSketches::activated(int iMsg)
{
Q_UNUSED(iMsg);
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
if (selection.size() < 2) {
QMessageBox::warning(Gui::getMainWindow(),
qApp->translate("CmdSketcherMergeSketches", "Wrong selection"),
@@ -115,7 +115,7 @@ void CmdSketcherToggleConstruction::activated(int iMsg)
{
// get the selection
std::vector<Gui::SelectionObject> selection;
selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
Sketcher::SketchObject* Obj = static_cast<Sketcher::SketchObject*>(selection[0].getObject());
+2 -2
View File
@@ -521,7 +521,7 @@ int SketchSelection::setUp(void)
{
std::vector<Gui::SelectionObject> selection = Gui::Selection().getSelectionEx();
Sketcher::SketchObject *SketchObj=0;
Sketcher::SketchObject *SketchObj=nullptr;
std::vector<std::string> SketchSubNames;
std::vector<std::string> SupportSubNames;
@@ -605,7 +605,7 @@ namespace SketcherGui {
App::DocumentObject* object;
public:
GenericConstraintSelection(App::DocumentObject* obj)
: Gui::SelectionFilterGate((Gui::SelectionFilter*)0)
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr)
, object(obj), allowedSelTypes(0)
{}
+9 -9
View File
@@ -120,7 +120,7 @@ SketcherGui::ViewProviderSketch* getSketchViewprovider(Gui::Document *doc)
(SketcherGui::ViewProviderSketch::getClassTypeId()) )
return dynamic_cast<SketcherGui::ViewProviderSketch*>(doc->getInEdit());
}
return 0;
return nullptr;
}
void removeRedundantHorizontalVertical(Sketcher::SketchObject* psketch,
@@ -5686,7 +5686,7 @@ namespace SketcherGui {
App::DocumentObject* object;
public:
FilletSelection(App::DocumentObject* obj)
: Gui::SelectionFilterGate((Gui::SelectionFilter*)0), object(obj)
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), object(obj)
{}
bool allow(App::Document * /*pDoc*/, App::DocumentObject *pObj, const char *sSubName)
@@ -6099,7 +6099,7 @@ namespace SketcherGui {
App::DocumentObject* object;
public:
TrimmingSelection(App::DocumentObject* obj)
: Gui::SelectionFilterGate((Gui::SelectionFilter*)0), object(obj)
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), object(obj)
{}
bool allow(App::Document * /*pDoc*/, App::DocumentObject *pObj, const char *sSubName)
@@ -6262,7 +6262,7 @@ namespace SketcherGui {
App::DocumentObject* object;
public:
ExtendSelection(App::DocumentObject* obj)
: Gui::SelectionFilterGate((Gui::SelectionFilter*)0)
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr)
, object(obj)
, disabled(false)
{}
@@ -6577,7 +6577,7 @@ namespace SketcherGui {
App::DocumentObject* object;
public:
SplittingSelection(App::DocumentObject* obj)
: Gui::SelectionFilterGate((Gui::SelectionFilter*)0), object(obj)
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), object(obj)
{}
bool allow(App::Document * /*pDoc*/, App::DocumentObject *pObj, const char *sSubName)
@@ -6695,7 +6695,7 @@ namespace SketcherGui {
App::DocumentObject* object;
public:
ExternalSelection(App::DocumentObject* obj)
: Gui::SelectionFilterGate((Gui::SelectionFilter*)0), object(obj)
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), object(obj)
{}
bool allow(App::Document *pDoc, App::DocumentObject *pObj, const char *sSubName)
@@ -6785,7 +6785,7 @@ public:
{
if (msg.Type == Gui::SelectionChanges::AddSelection) {
App::DocumentObject* obj = sketchgui->getObject()->getDocument()->getObject(msg.pObjectName);
if (obj == NULL)
if (obj == nullptr)
throw Base::ValueError("Sketcher: External geometry: Invalid object in selection");
std::string subName(msg.pSubName);
if (obj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId()) ||
@@ -6882,7 +6882,7 @@ namespace SketcherGui {
App::DocumentObject* object;
public:
CarbonCopySelection(App::DocumentObject* obj)
: Gui::SelectionFilterGate((Gui::SelectionFilter*)0), object(obj)
: Gui::SelectionFilterGate((Gui::SelectionFilter*)nullptr), object(obj)
{}
bool allow(App::Document *pDoc, App::DocumentObject *pObj, const char *sSubName)
@@ -6971,7 +6971,7 @@ public:
{
if (msg.Type == Gui::SelectionChanges::AddSelection) {
App::DocumentObject* obj = sketchgui->getObject()->getDocument()->getObject(msg.pObjectName);
if (obj == NULL)
if (obj == nullptr)
throw Base::ValueError("Sketcher: Carbon Copy: Invalid object in selection");
if (obj->getTypeId() == Sketcher::SketchObject::getClassTypeId()) {
@@ -431,7 +431,7 @@ void CmdSketcherConvertToNURBS::activated(int iMsg)
// get the selection
std::vector<Gui::SelectionObject> selection;
selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
@@ -505,7 +505,7 @@ void CmdSketcherIncreaseDegree::activated(int iMsg)
// get the selection
std::vector<Gui::SelectionObject> selection;
selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
@@ -578,7 +578,7 @@ void CmdSketcherDecreaseDegree::activated(int iMsg)
// get the selection
std::vector<Gui::SelectionObject> selection;
selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
@@ -664,7 +664,7 @@ void CmdSketcherIncreaseKnotMultiplicity::activated(int iMsg)
// get the selection
std::vector<Gui::SelectionObject> selection;
selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
@@ -811,7 +811,7 @@ void CmdSketcherDecreaseKnotMultiplicity::activated(int iMsg)
// get the selection
std::vector<Gui::SelectionObject> selection;
selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
@@ -1186,7 +1186,7 @@ void CmdSketcherInsertKnot::activated(int iMsg)
// get the selection
std::vector<Gui::SelectionObject> selection;
selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
// TODO: let user click on a curve after pressing command.
// only one sketch with its subelements are allowed to be selected
@@ -123,7 +123,7 @@ void CmdSketcherCloseShape::activated(int iMsg)
// get the selection
std::vector<Gui::SelectionObject> selection;
selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
@@ -234,7 +234,7 @@ void CmdSketcherConnect::activated(int iMsg)
// get the selection
std::vector<Gui::SelectionObject> selection;
selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
@@ -317,7 +317,7 @@ void CmdSketcherSelectConstraints::activated(int iMsg)
// get the selection
std::vector<Gui::SelectionObject> selection;
selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
// Cancel any in-progress operation
Gui::Document* doc = Gui::Application::Instance->activeDocument();
@@ -967,7 +967,7 @@ void CmdSketcherRestoreInternalAlignmentGeometry::activated(int iMsg)
// get the selection
std::vector<Gui::SelectionObject> selection;
selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
@@ -1080,7 +1080,7 @@ void CmdSketcherSymmetry::activated(int iMsg)
// get the selection
std::vector<Gui::SelectionObject> selection;
selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
@@ -1484,7 +1484,7 @@ void SketcherCopy::activate(SketcherCopy::Op op)
int LastGeoId = 0;
Sketcher::PointPos LastPointPos = Sketcher::PointPos::none;
const Part::Geometry *LastGeo = 0;
const Part::Geometry *LastGeo = nullptr;
// create python command with list of elements
std::stringstream stream;
@@ -2015,7 +2015,7 @@ void CmdSketcherRectangularArray::activated(int iMsg)
Q_UNUSED(iMsg);
// get the selection
std::vector<Gui::SelectionObject> selection;
selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
@@ -2040,7 +2040,7 @@ void CmdSketcherRectangularArray::activated(int iMsg)
int LastGeoId = 0;
Sketcher::PointPos LastPointPos = Sketcher::PointPos::none;
const Part::Geometry *LastGeo = 0;
const Part::Geometry *LastGeo = nullptr;
// create python command with list of elements
std::stringstream stream;
@@ -2282,7 +2282,7 @@ void CmdSketcherRemoveAxesAlignment::activated(int iMsg)
Q_UNUSED(iMsg);
// get the selection
std::vector<Gui::SelectionObject> selection;
selection = getSelection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
selection = getSelection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
+1 -1
View File
@@ -217,7 +217,7 @@ void CurveConverter::OnChange(Base::Subject<const char*> &rCaller, const char *
//**************************************************************************
// Construction/Destruction
DrawSketchHandler::DrawSketchHandler() : sketchgui(0) {}
DrawSketchHandler::DrawSketchHandler() : sketchgui(nullptr) {}
DrawSketchHandler::~DrawSketchHandler() {}
@@ -1289,7 +1289,7 @@ void EditModeConstraintCoinManager::updateConstraintColor(const std::vector<Sket
// Non DatumLabel Nodes will have a material excluding coincident
bool hasMaterial = false;
SoMaterial *m = 0;
SoMaterial *m = nullptr;
if (!hasDatumLabel && type != Sketcher::Coincident && type != Sketcher::InternalAlignment) {
hasMaterial = true;
m = static_cast<SoMaterial *>(s->getChild(static_cast<int>(ConstraintNodePosition::MaterialIndex)));
@@ -1727,7 +1727,7 @@ std::set<int> EditModeConstraintCoinManager::detectPreselectionConstr(const SoPi
if (editModeScenegraphNodes.constrGroup->getChild(i) == tailFather) {
SoSeparator *sep = static_cast<SoSeparator *>(tailFather);
if (sep->getNumChildren() > static_cast<int>(ConstraintNodePosition::FirstConstraintIdIndex)) {
SoInfo *constrIds = NULL;
SoInfo *constrIds = nullptr;
if (tail == sep->getChild(static_cast<int>(ConstraintNodePosition::FirstIconIndex))) {
// First icon was hit
constrIds = static_cast<SoInfo *>(sep->getChild(static_cast<int>(ConstraintNodePosition::FirstConstraintIdIndex)));
@@ -225,10 +225,10 @@ private:
//! Gets populated with bounding boxes (in icon
//! image coordinates) for the icon at left, then
//! labels for different constraints.
std::vector<QRect> *boundingBoxes = NULL,
std::vector<QRect> *boundingBoxes = nullptr,
//! If not NULL, gets set to the number of pixels
//! that the text extends below the icon base.
int *vPad = NULL);
int *vPad = nullptr);
/// Copies a QImage constraint icon into a SoImage*
/*! Used by drawTypicalConstraintIcon() and drawMergedConstraintIcons() */
+3 -3
View File
@@ -41,7 +41,7 @@ class SketcherSettings : public Gui::Dialog::PreferencePage
Q_OBJECT
public:
SketcherSettings(QWidget* parent = 0);
SketcherSettings(QWidget* parent = nullptr);
~SketcherSettings();
void saveSettings();
@@ -64,7 +64,7 @@ class SketcherSettingsDisplay : public Gui::Dialog::PreferencePage
Q_OBJECT
public:
SketcherSettingsDisplay(QWidget* parent = 0);
SketcherSettingsDisplay(QWidget* parent = nullptr);
~SketcherSettingsDisplay();
void saveSettings();
@@ -89,7 +89,7 @@ class SketcherSettingsColors : public Gui::Dialog::PreferencePage
Q_OBJECT
public:
SketcherSettingsColors(QWidget* parent = 0);
SketcherSettingsColors(QWidget* parent = nullptr);
~SketcherSettingsColors();
void saveSettings();
+1 -1
View File
@@ -458,7 +458,7 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
}
const unsigned char * dataptr = this->image.getValue(imgsize, nc);
if (dataptr == NULL) return; // no image
if (dataptr == nullptr) return; // no image
srcw = imgsize[0];
srch = imgsize[1];
@@ -515,10 +515,10 @@ void ConstraintView::contextMenuEvent (QContextMenuEvent* event)
,QKeySequence(Qt::Key_F2)
#endif
);
rename->setEnabled(item != 0);
rename->setEnabled(item != nullptr);
QAction* center = menu.addAction(tr("Center sketch"), this, SLOT(centerSelectedItems()));
center->setEnabled(item != 0);
center->setEnabled(item != nullptr);
QAction* remove = menu.addAction(tr("Delete"), this, SLOT(deleteSelectedItems()),
QKeySequence(QKeySequence::Delete));
@@ -636,7 +636,7 @@ void ConstraintView::swapNamedOfSelectedItems()
// ----------------------------------------------------------------------------
TaskSketcherConstraints::TaskSketcherConstraints(ViewProviderSketch *sketchView) :
TaskBox(Gui::BitmapFactory().pixmap("document-new"), tr("Constraints"), true, 0),
TaskBox(Gui::BitmapFactory().pixmap("document-new"), tr("Constraints"), true, nullptr),
sketchView(sketchView), inEditMode(false),
ui(new Ui_TaskSketcherConstraints)
{
@@ -763,7 +763,7 @@ void TaskSketcherConstraints::updateAssociatedConstraintsFilter()
assert(sketchView);
std::vector<Gui::SelectionObject> selection;
selection = Gui::Selection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
selection = Gui::Selection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {
@@ -1422,7 +1422,7 @@ void TaskSketcherConstraints::slotConstraintsChanged(void)
for (int i = 0; i < ui->listWidgetConstraints->count(); ++i) {
ConstraintItem * it = dynamic_cast<ConstraintItem*>(ui->listWidgetConstraints->item(i));
assert(it != 0);
assert(it != nullptr);
it->ConstraintNbr = i;
it->value = QVariant();
@@ -47,7 +47,7 @@ class ConstraintView : public QListWidget
Q_OBJECT
public:
explicit ConstraintView(QWidget *parent = 0);
explicit ConstraintView(QWidget *parent = nullptr);
~ConstraintView();
protected:
@@ -45,7 +45,7 @@ class TaskSketcherCreateCommands : public TaskBox, public Gui::SelectionSingleto
Q_OBJECT
public:
TaskSketcherCreateCommands(QWidget *parent = 0);
TaskSketcherCreateCommands(QWidget *parent = nullptr);
~TaskSketcherCreateCommands();
/// Observer message from the Selection
void OnChange(Gui::SelectionSingleton::SubjectType &rCaller,
@@ -257,7 +257,7 @@ void ElementView::keyPressEvent(QKeyEvent * event)
/* TRANSLATOR SketcherGui::TaskSketcherElements */
TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView)
: TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("Elements"),true, 0)
: TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("Elements"),true, nullptr)
, sketchView(sketchView)
, ui(new Ui_TaskSketcherElements())
, focusItemIndex(-1)
@@ -468,13 +468,13 @@ void TaskSketcherElements::on_listWidgetElements_itemSelectionChanged(void)
if(focusItemIndex>-1 && focusItemIndex<ui->listWidgetElements->count())
itf=static_cast<ElementItem*>(ui->listWidgetElements->item(focusItemIndex));
else
itf=NULL;
itf=nullptr;
bool multipleselection=true; // ctrl type of selection in listWidget
bool multipleconsecutiveselection=false; // shift type of selection in listWidget
if (!inhibitSelectionUpdate) {
if(itf!=NULL) {
if(itf!=nullptr) {
switch(element){
case 0:
itf->isLineSelected=!itf->isLineSelected;
+1 -1
View File
@@ -44,7 +44,7 @@ class ElementView : public QListWidget
Q_OBJECT
public:
explicit ElementView(QWidget *parent = 0);
explicit ElementView(QWidget *parent = nullptr);
~ElementView();
+1 -1
View File
@@ -190,7 +190,7 @@ void SketcherGeneralWidget::changeEvent(QEvent *e)
// ----------------------------------------------------------------------------
TaskSketcherGeneral::TaskSketcherGeneral(ViewProviderSketch *sketchView)
: TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("Edit controls"),true, 0)
: TaskBox(Gui::BitmapFactory().pixmap("document-new"),tr("Edit controls"),true, nullptr)
, sketchView(sketchView)
{
// we need a separate container widget to add all controls to
+1 -1
View File
@@ -46,7 +46,7 @@ class SketcherGeneralWidget : public QWidget
Q_OBJECT
public:
SketcherGeneralWidget(QWidget *parent=0);
SketcherGeneralWidget(QWidget *parent=nullptr);
~SketcherGeneralWidget();
bool eventFilter(QObject *object, QEvent *event);
@@ -48,7 +48,7 @@ using namespace Gui::TaskView;
namespace bp = boost::placeholders;
TaskSketcherMessages::TaskSketcherMessages(ViewProviderSketch *sketchView) :
TaskBox(Gui::BitmapFactory().pixmap("document-new"), tr("Solver messages"), true, 0),
TaskBox(Gui::BitmapFactory().pixmap("document-new"), tr("Solver messages"), true, nullptr),
sketchView(sketchView),
ui(new Ui_TaskSketcherMessages)
{
@@ -61,7 +61,7 @@ using namespace SketcherGui;
using namespace Gui::TaskView;
TaskSketcherSolverAdvanced::TaskSketcherSolverAdvanced(ViewProviderSketch *sketchView) :
TaskBox(Gui::BitmapFactory().pixmap("document-new"), tr("Advanced solver control"), true, 0),
TaskBox(Gui::BitmapFactory().pixmap("document-new"), tr("Advanced solver control"), true, nullptr),
sketchView(sketchView),
ui(new Ui_TaskSketcherSolverAdvanced)
{
@@ -64,7 +64,7 @@ using namespace Gui::TaskView;
/* TRANSLATOR SketcherGui::SketcherValidation */
SketcherValidation::SketcherValidation(Sketcher::SketchObject* Obj, QWidget* parent)
: QWidget(parent), ui(new Ui_TaskSketcherValidation()), sketch(Obj), sketchAnalyser(Obj), coincidenceRoot(0)
: QWidget(parent), ui(new Ui_TaskSketcherValidation()), sketch(Obj), sketchAnalyser(Obj), coincidenceRoot(nullptr)
{
ui->setupUi(this);
ui->fixButton->setEnabled(false);
@@ -431,7 +431,7 @@ TaskSketcherValidation::TaskSketcherValidation(Sketcher::SketchObject* Obj)
{
QWidget* widget = new SketcherValidation(Obj);
Gui::TaskView::TaskBox* taskbox = new Gui::TaskView::TaskBox(
QPixmap(), widget->windowTitle(), true, 0);
QPixmap(), widget->windowTitle(), true, nullptr);
taskbox->groupLayout()->addWidget(widget);
Content.push_back(taskbox);
}
@@ -42,7 +42,7 @@ class SketcherValidation : public QWidget
Q_OBJECT
public:
SketcherValidation(Sketcher::SketchObject* Obj, QWidget* parent = 0);
SketcherValidation(Sketcher::SketchObject* Obj, QWidget* parent = nullptr);
~SketcherValidation();
protected:
+5 -5
View File
@@ -282,7 +282,7 @@ PROPERTY_SOURCE_WITH_EXTENSIONS(SketcherGui::ViewProviderSketch, PartGui::ViewPr
ViewProviderSketch::ViewProviderSketch()
: SelectionObserver(false),
Mode(STATUS_NONE),
listener(0),
listener(nullptr),
editCoinManager(nullptr),
pObserver(std::make_unique<ViewProviderSketch::ParameterObserver>(*this)),
sketchHandler(nullptr)
@@ -2656,7 +2656,7 @@ bool ViewProviderSketch::setEdit(int ModNum)
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
TaskDlgEditSketch *sketchDlg = qobject_cast<TaskDlgEditSketch *>(dlg);
if (sketchDlg && sketchDlg->getSketchView() != this)
sketchDlg = 0; // another sketch left open its task panel
sketchDlg = nullptr; // another sketch left open its task panel
if (dlg && !sketchDlg) {
QMessageBox msgBox;
msgBox.setText(tr("A dialog is already open in the task panel"));
@@ -2705,7 +2705,7 @@ bool ViewProviderSketch::setEdit(int ModNum)
auto editDoc = Gui::Application::Instance->editDocument();
App::DocumentObject *editObj = getSketchObject();
std::string editSubName;
ViewProviderDocumentObject *editVp = 0;
ViewProviderDocumentObject *editVp = nullptr;
if(editDoc) {
editDoc->getInEdit(&editVp,&editSubName);
if(editVp)
@@ -3003,7 +3003,7 @@ void ViewProviderSketch::setEditViewer(Gui::View3DInventorViewer* viewer, int Mo
auto editDoc = Gui::Application::Instance->editDocument();
editDocName.clear();
if(editDoc) {
ViewProviderDocumentObject *parent=0;
ViewProviderDocumentObject *parent=nullptr;
editDoc->getInEdit(&parent,&editSubName);
if(parent) {
editDocName = editDoc->getDocument()->getName();
@@ -3101,7 +3101,7 @@ const Sketcher::Sketch &ViewProviderSketch::getSolvedSketch(void) const
void ViewProviderSketch::deleteSelected()
{
std::vector<Gui::SelectionObject> selection;
selection = Gui::Selection().getSelectionEx(0, Sketcher::SketchObject::getClassTypeId());
selection = Gui::Selection().getSelectionEx(nullptr, Sketcher::SketchObject::getClassTypeId());
// only one sketch with its subelements are allowed to be selected
if (selection.size() != 1) {