[TD] remove some more superfluous nullptr checks
This commit is contained in:
@@ -219,18 +219,15 @@ TechDraw::CosmeticEdge* CosmeticExtension::getCosmeticEdgeBySelection(std::strin
|
||||
CosmeticEdge* result = nullptr;
|
||||
App::DocumentObject* extObj = const_cast<App::DocumentObject*> (getExtendedObject());
|
||||
TechDraw::DrawViewPart* dvp = dynamic_cast<TechDraw::DrawViewPart*>(extObj);
|
||||
if (dvp == nullptr) {
|
||||
if (!dvp)
|
||||
return result;
|
||||
}
|
||||
int idx = DrawUtil::getIndexFromName(name);
|
||||
TechDraw::BaseGeomPtr base = dvp->getGeomByIndex(idx);
|
||||
if (base == nullptr) {
|
||||
if (!base)
|
||||
return result;
|
||||
}
|
||||
|
||||
if (!base->getCosmeticTag().empty()) {
|
||||
if (!base->getCosmeticTag().empty())
|
||||
result = getCosmeticEdge(base->getCosmeticTag());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -338,17 +335,14 @@ TechDraw::CenterLine* CosmeticExtension::getCenterLineBySelection(std::string na
|
||||
CenterLine* result = nullptr;
|
||||
App::DocumentObject* extObj = const_cast<App::DocumentObject*> (getExtendedObject());
|
||||
TechDraw::DrawViewPart* dvp = dynamic_cast<TechDraw::DrawViewPart*>(extObj);
|
||||
if (dvp == nullptr) {
|
||||
if (!dvp)
|
||||
return result;
|
||||
}
|
||||
int idx = DrawUtil::getIndexFromName(name);
|
||||
TechDraw::BaseGeomPtr base = dvp->getGeomByIndex(idx);
|
||||
if (base == nullptr) {
|
||||
if (!base)
|
||||
return result;
|
||||
}
|
||||
if (!base->getCosmeticTag().empty()) {
|
||||
if (!base->getCosmeticTag().empty())
|
||||
result = getCenterLine(base->getCosmeticTag());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -167,26 +167,22 @@ void DrawProjGroup::onChanged(const App::Property* prop)
|
||||
App::DocumentObjectExecReturn *DrawProjGroup::execute(void)
|
||||
{
|
||||
// Base::Console().Message("DPG::execute() - %s\n", getNameInDocument());
|
||||
if (!keepUpdated()) {
|
||||
if (!keepUpdated())
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
|
||||
//if group hasn't been added to page yet, can't scale or distribute projItems
|
||||
TechDraw::DrawPage *page = getPage();
|
||||
if (!page) {
|
||||
if (!page)
|
||||
return DrawViewCollection::execute();
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> docObjs = getAllSources();
|
||||
if (docObjs.empty()) {
|
||||
if (docObjs.empty())
|
||||
return DrawViewCollection::execute();
|
||||
}
|
||||
|
||||
App::DocumentObject* docObj = Anchor.getValue();
|
||||
if (docObj == nullptr) {
|
||||
if (!docObj)
|
||||
//no anchor yet. nothing to do.
|
||||
return DrawViewCollection::execute();
|
||||
}
|
||||
|
||||
if (ScaleType.isValue("Automatic")) {
|
||||
if (!checkFit()) {
|
||||
@@ -230,7 +226,7 @@ Base::BoundBox3d DrawProjGroup::getBoundingBox() const
|
||||
|
||||
std::vector<App::DocumentObject*> views = Views.getValues();
|
||||
TechDraw::DrawProjGroupItem *anchorView = dynamic_cast<TechDraw::DrawProjGroupItem *>(Anchor.getValue());
|
||||
if (anchorView == nullptr) {
|
||||
if (!anchorView) {
|
||||
//if an element in Views is not a DPGI, something really bad has happened somewhere
|
||||
Base::Console().Log("PROBLEM - DPG::getBoundingBox - non DPGI entry in Views! %s\n",
|
||||
getNameInDocument());
|
||||
@@ -429,9 +425,8 @@ App::DocumentObject * DrawProjGroup::addProjection(const char *viewProjType)
|
||||
std::pair<Base::Vector3d,Base::Vector3d> vecs;
|
||||
|
||||
DrawPage* dp = findParentPage();
|
||||
if (dp == nullptr) {
|
||||
if (!dp)
|
||||
Base::Console().Error("DPG:addProjection - %s - DPG is not on a page!\n",getNameInDocument());
|
||||
}
|
||||
|
||||
if ( checkViewProjType(viewProjType) && !hasProjection(viewProjType) ) {
|
||||
std::string FeatName = getDocument()->getUniqueObjectName("ProjItem");
|
||||
@@ -881,7 +876,7 @@ void DrawProjGroup::arrangeViewPointers(DrawProjGroupItem *viewPtrs[10]) const
|
||||
bool thirdAngle = (strcmp(projType, "Third Angle") == 0);
|
||||
for (auto it : Views.getValues()) {
|
||||
auto oView( dynamic_cast<DrawProjGroupItem *>(it) );
|
||||
if (oView == nullptr) {
|
||||
if (!oView) {
|
||||
//if an element in Views is not a DPGI, something really bad has happened somewhere
|
||||
Base::Console().Log("PROBLEM - DPG::arrangeViewPointers - non DPGI in Views! %s\n",
|
||||
getNameInDocument());
|
||||
|
||||
@@ -358,9 +358,8 @@ void DrawViewPart::partExec(TopoDS_Shape shape)
|
||||
geometryObject = nullptr;
|
||||
}
|
||||
geometryObject = makeGeometryForShape(shape);
|
||||
if (geometryObject == nullptr) {
|
||||
if (!geometryObject)
|
||||
return;
|
||||
}
|
||||
|
||||
#if MOD_TECHDRAW_HANDLE_FACES
|
||||
if (handleFaces() && !geometryObject->usePolygonHLR()) {
|
||||
@@ -1205,7 +1204,7 @@ int DrawViewPart::add1CVToGV(std::string tag)
|
||||
{
|
||||
// Base::Console().Message("DVP::add1CVToGV(%s) 2\n", tag.c_str());
|
||||
TechDraw::CosmeticVertex* cv = getCosmeticVertex(tag);
|
||||
if (cv == nullptr) {
|
||||
if (!cv) {
|
||||
Base::Console().Message("DVP::add1CVToGV 2 - cv %s not found\n", tag.c_str());
|
||||
return 0;
|
||||
}
|
||||
@@ -1283,9 +1282,8 @@ void DrawViewPart::addCosmeticEdgesToGeom(void)
|
||||
const std::vector<TechDraw::CosmeticEdge*> cEdges = CosmeticEdges.getValues();
|
||||
for (auto& ce: cEdges) {
|
||||
TechDraw::BaseGeomPtr scaledGeom = ce->scaledGeometry(getScale());
|
||||
if (scaledGeom == nullptr) {
|
||||
if (!scaledGeom)
|
||||
continue;
|
||||
}
|
||||
// int iGE =
|
||||
geometryObject->addCosmeticEdge(scaledGeom,
|
||||
ce->getTagAsString());
|
||||
@@ -1296,7 +1294,7 @@ int DrawViewPart::add1CEToGE(std::string tag)
|
||||
{
|
||||
// Base::Console().Message("CEx::add1CEToGE(%s) 2\n", tag.c_str());
|
||||
TechDraw::CosmeticEdge* ce = getCosmeticEdge(tag);
|
||||
if (ce == nullptr) {
|
||||
if (!ce) {
|
||||
Base::Console().Message("CEx::add1CEToGE 2 - ce %s not found\n", tag.c_str());
|
||||
return -1;
|
||||
}
|
||||
@@ -1334,7 +1332,7 @@ int DrawViewPart::add1CLToGE(std::string tag)
|
||||
{
|
||||
// Base::Console().Message("CEx::add1CLToGE(%s) 2\n", tag.c_str());
|
||||
TechDraw::CenterLine* cl = getCenterLine(tag);
|
||||
if (cl == nullptr) {
|
||||
if (!cl) {
|
||||
Base::Console().Message("CEx::add1CLToGE 2 - cl %s not found\n", tag.c_str());
|
||||
return -1;
|
||||
}
|
||||
@@ -1367,7 +1365,7 @@ void DrawViewPart::addCenterLinesToGeom(void)
|
||||
const std::vector<TechDraw::CenterLine*> lines = CenterLines.getValues();
|
||||
for (auto& cl: lines) {
|
||||
TechDraw::BaseGeomPtr scaledGeom = cl->scaledGeometry(this);
|
||||
if (scaledGeom == nullptr) {
|
||||
if (!scaledGeom) {
|
||||
Base::Console().Error("DVP::addCenterLinesToGeom - scaledGeometry is null\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -230,9 +230,8 @@ PyObject* DrawViewPartPy::getCosmeticVertexBySelection(PyObject *args)
|
||||
PyObject* DrawViewPartPy::removeCosmeticVertex(PyObject *args)
|
||||
{
|
||||
DrawViewPart* dvp = getDrawViewPartPtr();
|
||||
if (dvp == nullptr) {
|
||||
if (!dvp)
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
char* tag;
|
||||
if (PyArg_ParseTuple(args, "s", &tag)) {
|
||||
@@ -714,17 +713,15 @@ PyObject* DrawViewPartPy::getEdgeByIndex(PyObject *args)
|
||||
PyObject* DrawViewPartPy::getVertexByIndex(PyObject *args)
|
||||
{
|
||||
int vertexIndex = 0;
|
||||
if (!PyArg_ParseTuple(args, "i", &vertexIndex)) {
|
||||
if (!PyArg_ParseTuple(args, "i", &vertexIndex))
|
||||
throw Py::TypeError("expected (vertIndex)");
|
||||
}
|
||||
DrawViewPart* dvp = getDrawViewPartPtr();
|
||||
|
||||
//this is scaled and +Yup
|
||||
//need unscaled and +Ydown
|
||||
TechDraw::VertexPtr vert = dvp->getProjVertexByIndex(vertexIndex);
|
||||
if (vert == nullptr) {
|
||||
if (!vert)
|
||||
throw Py::ValueError("wrong vertIndex");
|
||||
}
|
||||
Base::Vector3d point = DrawUtil::invertY(vert->point()) / dvp->getScale();
|
||||
|
||||
gp_Pnt gPoint(point.x, point.y, point.z);
|
||||
@@ -737,9 +734,8 @@ PyObject* DrawViewPartPy::getEdgeBySelection(PyObject *args)
|
||||
{
|
||||
int edgeIndex = 0;
|
||||
char* selName; //Selection routine name - "Edge0"
|
||||
if (!PyArg_ParseTuple(args, "s", &selName)) {
|
||||
if (!PyArg_ParseTuple(args, "s", &selName))
|
||||
throw Py::TypeError("expected (string)");
|
||||
}
|
||||
|
||||
edgeIndex = DrawUtil::getIndexFromName(std::string(selName));
|
||||
DrawViewPart* dvp = getDrawViewPartPtr();
|
||||
@@ -747,9 +743,8 @@ PyObject* DrawViewPartPy::getEdgeBySelection(PyObject *args)
|
||||
//this is scaled and +Yup
|
||||
//need unscaled and +Ydown
|
||||
TechDraw::BaseGeomPtr geom = dvp->getGeomByIndex(edgeIndex);
|
||||
if (geom == nullptr) {
|
||||
if (!geom)
|
||||
throw Py::ValueError("wrong edgeIndex");
|
||||
}
|
||||
|
||||
TopoDS_Shape temp = TechDraw::mirrorShapeVec(geom->occEdge,
|
||||
Base::Vector3d(0.0, 0.0, 0.0),
|
||||
@@ -773,9 +768,8 @@ PyObject* DrawViewPartPy::getVertexBySelection(PyObject *args)
|
||||
//this is scaled and +Yup
|
||||
//need unscaled and +Ydown
|
||||
TechDraw::VertexPtr vert = dvp->getProjVertexByIndex(vertexIndex);
|
||||
if (vert == nullptr) {
|
||||
if (!vert)
|
||||
throw Py::ValueError("wrong vertIndex");
|
||||
}
|
||||
Base::Vector3d point = DrawUtil::invertY(vert->point()) / dvp->getScale();
|
||||
|
||||
gp_Pnt gPoint(point.x, point.y, point.z);
|
||||
|
||||
@@ -249,13 +249,11 @@ void QGIDatumLabel::setPosFromCenter(const double &xCenter, const double &yCente
|
||||
{
|
||||
prepareGeometryChange();
|
||||
QGIViewDimension* qgivd = dynamic_cast<QGIViewDimension*>(parentItem());
|
||||
if( qgivd == nullptr ) {
|
||||
if (!qgivd)
|
||||
return;
|
||||
}
|
||||
const auto dim( dynamic_cast<TechDraw::DrawViewDimension *>(qgivd->getViewObject()) );
|
||||
if( dim == nullptr ) {
|
||||
if (!dim)
|
||||
return;
|
||||
}
|
||||
|
||||
//set label's Qt position(top,left) given boundingRect center point
|
||||
setPos(xCenter - m_dimText->boundingRect().width() / 2., yCenter - m_dimText->boundingRect().height() / 2.);
|
||||
@@ -337,9 +335,8 @@ void QGIDatumLabel::setToleranceString()
|
||||
{
|
||||
prepareGeometryChange();
|
||||
QGIViewDimension* qgivd = dynamic_cast<QGIViewDimension*>(parentItem());
|
||||
if( qgivd == nullptr ) {
|
||||
if (!qgivd)
|
||||
return;
|
||||
}
|
||||
const auto dim( dynamic_cast<TechDraw::DrawViewDimension *>(qgivd->getViewObject()) );
|
||||
if( dim == nullptr ) {
|
||||
return;
|
||||
|
||||
@@ -805,14 +805,12 @@ void QGIViewPart::removeDecorations()
|
||||
void QGIViewPart::drawAllSectionLines(void)
|
||||
{
|
||||
TechDraw::DrawViewPart *viewPart = static_cast<TechDraw::DrawViewPart *>(getViewObject());
|
||||
if (!viewPart) {
|
||||
if (!viewPart)
|
||||
return;
|
||||
}
|
||||
|
||||
auto vp = static_cast<ViewProviderViewPart*>(getViewProvider(getViewObject()));
|
||||
if ( vp == nullptr ) {
|
||||
if (!vp)
|
||||
return;
|
||||
}
|
||||
if (vp->ShowSectionLine.getValue()) {
|
||||
auto refs = viewPart->getSectionRefs();
|
||||
for (auto& r:refs) {
|
||||
@@ -824,20 +822,17 @@ void QGIViewPart::drawAllSectionLines(void)
|
||||
void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b)
|
||||
{
|
||||
TechDraw::DrawViewPart *viewPart = static_cast<TechDraw::DrawViewPart *>(getViewObject());
|
||||
if (!viewPart) {
|
||||
if (!viewPart)
|
||||
return;
|
||||
}
|
||||
if (!viewSection)
|
||||
return;
|
||||
|
||||
if (!viewSection->hasGeometry()) {
|
||||
if (!viewSection->hasGeometry())
|
||||
return;
|
||||
}
|
||||
|
||||
auto vp = static_cast<ViewProviderViewPart*>(getViewProvider(getViewObject()));
|
||||
if ( vp == nullptr ) {
|
||||
if (!vp)
|
||||
return;
|
||||
}
|
||||
|
||||
if (b) {
|
||||
QGISectionLine* sectionLine = new QGISectionLine();
|
||||
@@ -882,14 +877,12 @@ void QGIViewPart::drawSectionLine(TechDraw::DrawViewSection* viewSection, bool b
|
||||
void QGIViewPart::drawCenterLines(bool b)
|
||||
{
|
||||
TechDraw::DrawViewPart *viewPart = dynamic_cast<TechDraw::DrawViewPart *>(getViewObject());
|
||||
if (!viewPart) {
|
||||
if (!viewPart)
|
||||
return;
|
||||
}
|
||||
|
||||
auto vp = static_cast<ViewProviderViewPart*>(getViewProvider(getViewObject()));
|
||||
if ( vp == nullptr ) {
|
||||
if (!vp)
|
||||
return;
|
||||
}
|
||||
|
||||
if (b) {
|
||||
bool horiz = vp->HorizCenterLine.getValue();
|
||||
@@ -946,9 +939,8 @@ void QGIViewPart::drawHighlight(TechDraw::DrawViewDetail* viewDetail, bool b)
|
||||
}
|
||||
|
||||
auto vp = static_cast<ViewProviderViewPart*>(getViewProvider(getViewObject()));
|
||||
if ( vp == nullptr ) {
|
||||
if (!vp)
|
||||
return;
|
||||
}
|
||||
|
||||
if (b) {
|
||||
// double fontSize = getPrefFontSize();
|
||||
|
||||
@@ -194,13 +194,11 @@ void QGIWeldSymbol::drawTile(TechDraw::DrawTileWeld* tileFeat)
|
||||
}
|
||||
|
||||
const auto sym( dynamic_cast<TechDraw::DrawWeldSymbol *>(getViewObject()) );
|
||||
if( sym == nullptr ) {
|
||||
if (!sym)
|
||||
return;
|
||||
}
|
||||
auto vp = static_cast<ViewProviderWeld*>(getViewProvider(getViewObject()));
|
||||
if ( vp == nullptr ) {
|
||||
if (!vp)
|
||||
return;
|
||||
}
|
||||
std::string fontName = vp->Font.getValue();
|
||||
double sizeMM = vp->TileFontSize.getValue();
|
||||
double fontSize = QGIView::calculateFontPixelSize(sizeMM);
|
||||
@@ -270,13 +268,11 @@ void QGIWeldSymbol::drawTailText(void)
|
||||
m_tailText->show();
|
||||
}
|
||||
const auto sym( dynamic_cast<TechDraw::DrawWeldSymbol *>(getViewObject()) );
|
||||
if( sym == nullptr ) {
|
||||
if (!sym)
|
||||
return;
|
||||
}
|
||||
auto vp = static_cast<ViewProviderWeld*>(getViewProvider(getViewObject()));
|
||||
if ( vp == nullptr ) {
|
||||
if (!vp)
|
||||
return;
|
||||
}
|
||||
std::string fontName = vp->Font.getValue();
|
||||
QString qFontName = Base::Tools::fromStdString(fontName);
|
||||
double sizeMM = vp->FontSize.getValue();
|
||||
|
||||
@@ -102,7 +102,7 @@ TaskDetail::TaskDetail(TechDraw::DrawViewPart* baseFeat):
|
||||
|
||||
m_basePage = m_baseFeat->findParentPage();
|
||||
//it is possible that the basePage could be unparented and have no corresponding Page
|
||||
if (m_basePage == nullptr) {
|
||||
if (!m_basePage) {
|
||||
Base::Console().Error("TaskDetail - bad parameters - base page. Can not proceed.\n");
|
||||
return;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ TaskDetail::TaskDetail(TechDraw::DrawViewDetail* detailFeat):
|
||||
m_mode(EDITMODE),
|
||||
m_created(false)
|
||||
{
|
||||
if (m_detailFeat == nullptr) {
|
||||
if (!m_detailFeat) {
|
||||
//should be caught in CMD caller
|
||||
Base::Console().Error("TaskDetail - bad parameters. Can not proceed.\n");
|
||||
return;
|
||||
@@ -402,7 +402,7 @@ void TaskDetail::onDraggerClicked(bool b)
|
||||
void TaskDetail::editByHighlight()
|
||||
{
|
||||
// Base::Console().Message("TD::editByHighlight()\n");
|
||||
if (m_ghost == nullptr) {
|
||||
if (!m_ghost) {
|
||||
Base::Console().Error("TaskDetail::editByHighlight - no ghost object\n");
|
||||
return;
|
||||
}
|
||||
@@ -431,7 +431,7 @@ void TaskDetail::onHighlightMoved(QPointF dragEnd)
|
||||
DrawProjGroupItem* dpgi = dynamic_cast<DrawProjGroupItem*>(dvp);
|
||||
if (dpgi) {
|
||||
DrawProjGroup* dpg = dpgi->getPGroup();
|
||||
if (dpg == nullptr) {
|
||||
if (!dpg) {
|
||||
Base::Console().Message("TD::getAnchorScene - projection group is confused\n");
|
||||
//TODO::throw something.
|
||||
return;
|
||||
@@ -543,7 +543,7 @@ QPointF TaskDetail::getAnchorScene()
|
||||
Base::Vector3d basePos;
|
||||
double scale = 1;
|
||||
|
||||
if (dpgi == nullptr) { //base is normal view
|
||||
if (!dpgi) { //base is normal view
|
||||
double x = dvp->X.getValue();
|
||||
double y = dvp->Y.getValue();
|
||||
basePos = Base::Vector3d (x, -y, 0.0);
|
||||
@@ -551,7 +551,7 @@ QPointF TaskDetail::getAnchorScene()
|
||||
} else { //part of projection group
|
||||
|
||||
DrawProjGroup* dpg = dpgi->getPGroup();
|
||||
if (dpg == nullptr) {
|
||||
if (!dpg) {
|
||||
Base::Console().Message("TD::getAnchorScene - projection group is confused\n");
|
||||
//TODO::throw something.
|
||||
return QPointF(0.0, 0.0);
|
||||
|
||||
@@ -103,7 +103,7 @@ TaskLeaderLine::TaskLeaderLine(TechDrawGui::ViewProviderLeader* leadVP) :
|
||||
m_lineFeat = m_lineVP->getFeature();
|
||||
|
||||
m_basePage = m_lineFeat->findParentPage();
|
||||
if ( m_basePage == nullptr ) {
|
||||
if (!m_basePage) {
|
||||
Base::Console().Error("TaskRichAnno - bad parameters (2). Can not proceed.\n");
|
||||
return;
|
||||
}
|
||||
@@ -132,8 +132,7 @@ TaskLeaderLine::TaskLeaderLine(TechDrawGui::ViewProviderLeader* leadVP) :
|
||||
}
|
||||
|
||||
//TODO: when/if leaders are allowed to be parented to Page, check for m_baseFeat will be removed
|
||||
if ( (m_baseFeat == nullptr) ||
|
||||
(m_basePage == nullptr) ) {
|
||||
if (!m_baseFeat || !m_basePage) {
|
||||
Base::Console().Error("TaskLeaderLine - bad parameters (2). Can not proceed.\n");
|
||||
return;
|
||||
}
|
||||
@@ -401,9 +400,8 @@ void TaskLeaderLine::createLeaderFeature(std::vector<Base::Vector3d> converted)
|
||||
}
|
||||
|
||||
App::DocumentObject* obj = m_basePage->getDocument()->getObject(m_leaderName.c_str());
|
||||
if (obj == nullptr) {
|
||||
if (!obj)
|
||||
throw Base::RuntimeError("TaskLeaderLine - new markup object not found");
|
||||
}
|
||||
if (obj->isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId())) {
|
||||
m_lineFeat = static_cast<TechDraw::DrawLeaderLine*>(obj);
|
||||
m_lineFeat->setPosition(Rez::appX(m_attachPoint.x),Rez::appX(- m_attachPoint.y), true);
|
||||
@@ -475,7 +473,7 @@ void TaskLeaderLine::commonFeatureUpdate(void)
|
||||
void TaskLeaderLine::removeFeature(void)
|
||||
{
|
||||
// Base::Console().Message("TTL::removeFeature()\n");
|
||||
if (m_lineFeat == nullptr)
|
||||
if (!m_lineFeat)
|
||||
return;
|
||||
|
||||
if (m_createMode) {
|
||||
@@ -564,7 +562,7 @@ void TaskLeaderLine::onTrackerClicked(bool b)
|
||||
QGIView* qgiv = qgsp->findQViewForDocObj(m_lineFeat);
|
||||
QGILeaderLine* qgLead = dynamic_cast<QGILeaderLine*>(qgiv);
|
||||
|
||||
if (qgLead == nullptr) {
|
||||
if (!qgLead) {
|
||||
//tarfu
|
||||
Base::Console().Error("TaskLeaderLine - can't find leader graphic\n");
|
||||
//now what? throw will generate "unknown unhandled exception"
|
||||
@@ -612,7 +610,7 @@ void TaskLeaderLine::startTracker(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_tracker == nullptr) {
|
||||
if (!m_tracker) {
|
||||
m_tracker = new QGTracker(m_scene, m_trackerMode);
|
||||
QObject::connect(
|
||||
m_tracker, SIGNAL(drawingFinished(std::vector<QPointF>, QGIView*)),
|
||||
@@ -696,12 +694,12 @@ void TaskLeaderLine::onCancelEditClicked(bool b)
|
||||
|
||||
QGIView* TaskLeaderLine::findParentQGIV()
|
||||
{
|
||||
if (m_baseFeat == nullptr)
|
||||
if (!m_baseFeat)
|
||||
return nullptr;
|
||||
|
||||
Gui::ViewProvider* gvp = QGIView::getViewProvider(m_baseFeat);
|
||||
ViewProviderDrawingView* vpdv = dynamic_cast<ViewProviderDrawingView*>(gvp);
|
||||
if (vpdv == nullptr)
|
||||
if (!vpdv)
|
||||
return nullptr;
|
||||
|
||||
return vpdv->getQView();;
|
||||
@@ -709,9 +707,8 @@ QGIView* TaskLeaderLine::findParentQGIV()
|
||||
|
||||
void TaskLeaderLine::setEditCursor(QCursor c)
|
||||
{
|
||||
if (!m_haveMdi || m_baseFeat == nullptr) {
|
||||
if (!m_haveMdi || !m_baseFeat)
|
||||
return;
|
||||
}
|
||||
QGIView* qgivBase = m_scene->findQViewForDocObj(m_baseFeat);
|
||||
qgivBase->setCursor(c);
|
||||
}
|
||||
|
||||
@@ -118,10 +118,8 @@ TaskSectionView::TaskSectionView(TechDraw::DrawViewSection* section) :
|
||||
m_sectionName = m_section->getNameInDocument();
|
||||
App::DocumentObject* newObj = m_section->BaseView.getValue();
|
||||
m_base = dynamic_cast<TechDraw::DrawViewPart*>(newObj);
|
||||
if ( (newObj == nullptr) ||
|
||||
(m_base == nullptr) ) {
|
||||
if (!newObj || !m_base)
|
||||
throw Base::RuntimeError("TaskSectionView - BaseView not found");
|
||||
}
|
||||
|
||||
m_saveBaseName = m_base->getNameInDocument();
|
||||
m_savePageName = m_base->findParentPage()->getNameInDocument();
|
||||
@@ -364,11 +362,10 @@ bool TaskSectionView::apply(void)
|
||||
Base::Console().Error((msg + "\n").c_str());
|
||||
return false;
|
||||
}
|
||||
if (m_section == nullptr) { //didn't create the feature yet
|
||||
if (!m_section) //didn't create the feature yet
|
||||
//this can't happen as applyQuick has to be called by the direction
|
||||
//setting process
|
||||
return false;
|
||||
}
|
||||
|
||||
checkAll(false);
|
||||
applyQuick(m_dirName);
|
||||
@@ -447,10 +444,8 @@ void TaskSectionView::createSectionView(void)
|
||||
|
||||
App::DocumentObject* newObj = m_base->getDocument()->getObject(m_sectionName.c_str());
|
||||
m_section = dynamic_cast<TechDraw::DrawViewSection*>(newObj);
|
||||
if ( (newObj == nullptr) ||
|
||||
(m_section == nullptr) ) {
|
||||
if (!newObj || !m_section)
|
||||
throw Base::RuntimeError("TaskSectionView - new section object not found");
|
||||
}
|
||||
}
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
@@ -509,28 +504,24 @@ void TaskSectionView::failNoObject(std::string objectName)
|
||||
|
||||
bool TaskSectionView::isBaseValid(void)
|
||||
{
|
||||
if (m_base == nullptr) {
|
||||
if (!m_base)
|
||||
return false;
|
||||
}
|
||||
|
||||
App::DocumentObject* baseObj = m_doc->getObject(m_saveBaseName.c_str());
|
||||
if (baseObj == nullptr) {
|
||||
if (!baseObj)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TaskSectionView::isSectionValid(void)
|
||||
{
|
||||
if (m_section == nullptr) {
|
||||
if (!m_section)
|
||||
return false;
|
||||
}
|
||||
|
||||
App::DocumentObject* sectionObj = m_doc->getObject(m_sectionName.c_str());
|
||||
if (sectionObj == nullptr) {
|
||||
if (!sectionObj)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -552,7 +543,7 @@ bool TaskSectionView::accept()
|
||||
bool TaskSectionView::reject()
|
||||
{
|
||||
// Base::Console().Message("TSV::reject()\n");
|
||||
if (m_section == nullptr) { //no section created, nothing to undo
|
||||
if (!m_section) { //no section created, nothing to undo
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawWeldSymbol* weld) :
|
||||
// or ViewProviderWeld.setEdit
|
||||
|
||||
App::DocumentObject* obj = m_weldFeat->Leader.getValue();
|
||||
if (obj == nullptr ||
|
||||
if (!obj ||
|
||||
!obj->isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId()) ) {
|
||||
Base::Console().Error("TaskWeldingSymbol - no leader for welding symbol. Can not proceed.\n");
|
||||
return;
|
||||
@@ -524,10 +524,8 @@ TechDraw::DrawWeldSymbol* TaskWeldingSymbol::createWeldingSymbol(void)
|
||||
|
||||
App::DocumentObject* newObj = m_leadFeat->getDocument()->getObject(symbolName.c_str());
|
||||
TechDraw::DrawWeldSymbol* newSym = dynamic_cast<TechDraw::DrawWeldSymbol*>(newObj);
|
||||
if ( (newObj == nullptr) ||
|
||||
(newSym == nullptr) ) {
|
||||
if (!newObj || !newSym)
|
||||
throw Base::RuntimeError("TaskWeldingSymbol - new symbol object not found");
|
||||
}
|
||||
|
||||
return newSym;
|
||||
}
|
||||
@@ -563,7 +561,7 @@ void TaskWeldingSymbol::updateTiles(void)
|
||||
// Base::Console().Message("TWS::updateTiles()\n");
|
||||
getTileFeats();
|
||||
|
||||
if (m_arrowFeat == nullptr) {
|
||||
if (!m_arrowFeat) {
|
||||
Base::Console().Message("TWS::updateTiles - no arrow tile!\n");
|
||||
} else {
|
||||
collectArrowData();
|
||||
@@ -587,7 +585,7 @@ void TaskWeldingSymbol::updateTiles(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (m_otherFeat == nullptr) {
|
||||
if (!m_otherFeat) {
|
||||
// Base::Console().Message("TWS::updateTiles - no other tile!\n");
|
||||
} else {
|
||||
if (m_otherDirty) {
|
||||
|
||||
Reference in New Issue
Block a user