Merge pull request #19583 from hyarion/refactor/base-type

Refactor Base::Type
This commit is contained in:
Chris Hennes
2025-03-17 00:03:22 -05:00
committed by GitHub
23 changed files with 174 additions and 159 deletions

View File

@@ -302,7 +302,7 @@ PyObject* ExternalGeometryFacadePy::getExtensionOfType(PyObject* args)
Base::Type type = Base::Type::fromName(o);
if (type != Base::Type::badType()) {
if (!type.isBad()) {
try {
std::shared_ptr<const Part::GeometryExtension> ext(
this->getExternalGeometryFacadePtr()->getExtension(type));
@@ -379,7 +379,7 @@ PyObject* ExternalGeometryFacadePy::hasExtensionOfType(PyObject* args)
Base::Type type = Base::Type::fromName(o);
if (type != Base::Type::badType()) {
if (!type.isBad()) {
try {
return Py::new_reference_to(
Py::Boolean(this->getExternalGeometryFacadePtr()->hasExtension(type)));
@@ -427,7 +427,7 @@ PyObject* ExternalGeometryFacadePy::deleteExtensionOfType(PyObject* args)
Base::Type type = Base::Type::fromName(o);
if (type != Base::Type::badType()) {
if (!type.isBad()) {
try {
this->getExternalGeometryFacadePtr()->deleteExtension(type);
Py_Return;

View File

@@ -278,7 +278,7 @@ PyObject* GeometryFacadePy::getExtensionOfType(PyObject* args)
Base::Type type = Base::Type::fromName(o);
if (type != Base::Type::badType()) {
if (!type.isBad()) {
try {
std::shared_ptr<const Part::GeometryExtension> ext(
this->getGeometryFacadePtr()->getExtension(type));
@@ -355,7 +355,7 @@ PyObject* GeometryFacadePy::hasExtensionOfType(PyObject* args)
Base::Type type = Base::Type::fromName(o);
if (type != Base::Type::badType()) {
if (!type.isBad()) {
try {
return Py::new_reference_to(
Py::Boolean(this->getGeometryFacadePtr()->hasExtension(type)));
@@ -403,7 +403,7 @@ PyObject* GeometryFacadePy::deleteExtensionOfType(PyObject* args)
Base::Type type = Base::Type::fromName(o);
if (type != Base::Type::badType()) {
if (!type.isBad()) {
try {
this->getGeometryFacadePtr()->deleteExtension(type);
Py_Return;

View File

@@ -1526,7 +1526,7 @@ public:
selIdPair.GeoId = GeoEnum::GeoUndef;
selIdPair.PosId = Sketcher::PointPos::none;
std::stringstream ss;
Base::Type newselGeoType = Base::Type::badType();
Base::Type newselGeoType = Base::Type::BadType;
int VtId = getPreselectPoint();
int CrvId = getPreselectCurve();
@@ -1662,7 +1662,7 @@ protected:
SelIdPair selIdPair;
getIdsFromName(selElement, Obj, selIdPair.GeoId, selIdPair.PosId);
Base::Type newselGeoType = Base::Type::badType();
Base::Type newselGeoType = Base::Type::BadType;
if (isEdge(selIdPair.GeoId, selIdPair.PosId)) {
const Part::Geometry* geo = Obj->getGeometry(selIdPair.GeoId);
newselGeoType = geo->getTypeId();

View File

@@ -463,7 +463,7 @@ private:
icons.emplace(
std::piecewise_construct,
std::forward_as_tuple(Base::Type::badType()),
std::forward_as_tuple(Base::Type::BadType),
std::forward_as_tuple(
std::initializer_list<
std::pair<const Sketcher::PointPos, std::tuple<QIcon, QIcon, QIcon, QIcon>>> {
@@ -479,14 +479,14 @@ private:
auto typekey = icons.find(type);
if (typekey == icons.end()) {// Not supported Geometry Type - Defaults to invalid icon
typekey = icons.find(Base::Type::badType());
typekey = icons.find(Base::Type::BadType);
pos = Sketcher::PointPos::none;
}
auto poskey = typekey->second.find(pos);
if (poskey == typekey->second.end()) {// invalid PointPos for type - Provide Invalid icon
typekey = icons.find(Base::Type::badType());
typekey = icons.find(Base::Type::BadType);
pos = Sketcher::PointPos::none;
poskey = typekey->second.find(pos);
}