Skip to content

Commit

Permalink
fix Coverity issues
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Aug 21, 2016
1 parent 0824c5f commit 9459938
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Drawing/Gui/Command.cpp
Expand Up @@ -343,7 +343,7 @@ void CmdDrawingNewView::activated(int iMsg)
float newRotation = 0.0;
Base::Vector3d newDirection(0.0, 0.0, 1.0);
if (!selectedProjections.empty()) {
const Drawing::FeatureView* const myView = dynamic_cast<Drawing::FeatureView*>(selectedProjections.front());
const Drawing::FeatureView* const myView = static_cast<Drawing::FeatureView*>(selectedProjections.front());

newX = myView->X.getValue();
newY = myView->Y.getValue();
Expand Down
37 changes: 26 additions & 11 deletions src/Mod/Drawing/Gui/TaskOrthoViews.cpp
Expand Up @@ -142,6 +142,8 @@ orthoview::orthoview(App::Document * parent, App::DocumentObject * part, App::Do
parent_doc = parent;
myname = parent_doc->getUniqueObjectName("Ortho");

x = 0;
y = 0;
cx = partbox->GetCenter().x;
cy = partbox->GetCenter().y;
cz = partbox->GetCenter().z;
Expand All @@ -158,6 +160,10 @@ orthoview::orthoview(App::Document * parent, App::DocumentObject * part, App::Do
rel_y = 0;
ortho = true;
auto_scale = true;

away = false;
tri = false;
axo = 0;
}

orthoview::~orthoview()
Expand Down Expand Up @@ -287,6 +293,13 @@ OrthoViews::OrthoViews(App::Document* doc, const char * pagename, const char * p
hidden = false;
autodims = true;

width = height = depth = 0;
layout_width = layout_height = 0;
gap_x = gap_y = 0;
offset_x = offset_y = 0;
scale = 0;
num_gaps_x = num_gaps_y = 0;

this->connectDocumentDeletedObject = doc->signalDeletedObject.connect(boost::bind
(&OrthoViews::slotDeletedObject, this, _1));
this->connectApplicationDeletedDocument = App::GetApplication().signalDeleteDocument.connect(boost::bind
Expand Down Expand Up @@ -700,14 +713,7 @@ void OrthoViews::set_Axo_scale(int rel_x, int rel_y, float axo_scale) // s

void OrthoViews::set_Axo(int rel_x, int rel_y, gp_Dir up, gp_Dir right, bool away, int axo, bool tri) // set custom axonometric view
{
int num = index(rel_x, rel_y);
double rotations[2];
gp_Dir dir;

views[num]->ortho = false;
views[num]->away = away;
views[num]->tri = tri;
views[num]->axo = axo;

if (axo == 0)
{
Expand Down Expand Up @@ -736,13 +742,22 @@ void OrthoViews::set_Axo(int rel_x, int rel_y, gp_Dir up, gp_Dir right, bool awa
gp_Ax2 cs = gp_Ax2(gp_Pnt(0,0,0), right);
cs.SetYDirection(up);
cs.Rotate(gp_Ax1(gp_Pnt(0,0,0), up), rotations[0]);
gp_Dir dir;
dir = cs.XDirection();
cs.Rotate(gp_Ax1(gp_Pnt(0,0,0), dir), rotations[1]);

views[num]->up = up;
views[num]->right = right;
views[num]->set_projection(cs);
views[num]->setPos();
int num = index(rel_x, rel_y);
if (num != -1) {
views[num]->ortho = false;
views[num]->away = away;
views[num]->tri = tri;
views[num]->axo = axo;

views[num]->up = up;
views[num]->right = right;
views[num]->set_projection(cs);
views[num]->setPos();
}

parent_doc->recompute();
}
Expand Down

0 comments on commit 9459938

Please sign in to comment.