Skip to content

Commit

Permalink
Change Face centerline command name and icon
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Jun 6, 2019
1 parent 93431ed commit f25826b
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 62 deletions.
16 changes: 8 additions & 8 deletions src/Mod/TechDraw/Gui/CommandAnnotate.cpp
Expand Up @@ -587,21 +587,21 @@ bool CmdTechDrawAnnotation::isActive(void)
// TechDraw_Centerline
//===========================================================================

DEF_STD_CMD_A(CmdTechDrawCenterLine);
DEF_STD_CMD_A(CmdTechDrawFaceCenterLine);

CmdTechDrawCenterLine::CmdTechDrawCenterLine()
: Command("TechDraw_CenterLine")
CmdTechDrawFaceCenterLine::CmdTechDrawFaceCenterLine()
: Command("TechDraw_FaceCenterLine")
{
sAppModule = "TechDraw";
sGroup = QT_TR_NOOP("TechDraw");
sMenuText = QT_TR_NOOP("Add a centerline to a Face(s)");
sToolTipText = QT_TR_NOOP("Add a centerline to a Face(s)");
sWhatsThis = "TechDraw_CenterLine";
sWhatsThis = "TechDraw_FaceCenterLine";
sStatusTip = sToolTipText;
sPixmap = "actions/techdraw-centerline";
sPixmap = "actions/techdraw-facecenterline";
}

void CmdTechDrawCenterLine::activated(int iMsg)
void CmdTechDrawFaceCenterLine::activated(int iMsg)
{
Q_UNUSED(iMsg);

Expand Down Expand Up @@ -652,7 +652,7 @@ void CmdTechDrawCenterLine::activated(int iMsg)
SubNames));
}

bool CmdTechDrawCenterLine::isActive(void)
bool CmdTechDrawFaceCenterLine::isActive(void)
{
bool havePage = DrawGuiUtil::needPage(this);
bool haveView = DrawGuiUtil::needView(this, false);
Expand Down Expand Up @@ -762,7 +762,7 @@ void CreateTechDrawCommandsAnnotate(void)
rcCmdMgr.addCommand(new CmdTechDrawMidpoints());
rcCmdMgr.addCommand(new CmdTechDrawQuadrant());
rcCmdMgr.addCommand(new CmdTechDrawAnnotation());
rcCmdMgr.addCommand(new CmdTechDrawCenterLine());
rcCmdMgr.addCommand(new CmdTechDrawFaceCenterLine());
rcCmdMgr.addCommand(new CmdTechDrawCosmeticEraser());
}

Expand Down
4 changes: 2 additions & 2 deletions src/Mod/TechDraw/Gui/Resources/TechDraw.qrc
Expand Up @@ -66,7 +66,7 @@
<file>icons/actions/techdraw-point.svg</file>
<file>icons/actions/techdraw-midpoint.svg</file>
<file>icons/actions/techdraw-quadrant.svg</file>
<file>icons/actions/techdraw-centerline.svg</file>
<file>icons/actions/techdraw-facecenterline.svg</file>
<file>icons/actions/techdraw-eraser.svg</file>
<file>icons/actions/section-up.svg</file>
<file>icons/actions/section-down.svg</file>
Expand Down Expand Up @@ -145,4 +145,4 @@
<file>translations/TechDraw_ar.qm</file>
<file>translations/TechDraw_vi.qm</file>
</qresource>
</RCC>
</RCC>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 11 additions & 10 deletions src/Mod/TechDraw/Gui/TaskCenterLine.cpp
Expand Up @@ -295,6 +295,8 @@ TechDraw::CosmeticEdge* TaskCenterLine::calcEndPoints(std::vector<std::string> f
Bnd_Box faceBox;
faceBox.SetGap(0.0);

double scale = m_partFeat->getScale();

for (auto& fn: faceNames) {
if (TechDraw::DrawUtil::getGeomTypeFromName(fn) != "Face") {
continue;
Expand All @@ -309,16 +311,15 @@ TechDraw::CosmeticEdge* TaskCenterLine::calcEndPoints(std::vector<std::string> f
}
}

double scale = m_partFeat->getScale();
double Xmin,Ymin,Zmin,Xmax,Ymax,Zmax;
faceBox.Get(Xmin,Ymin,Zmin,Xmax,Ymax,Zmax);

double Xspan = fabs(Xmax - Xmin);
Xspan = (Xspan / 2.0) + (ext * scale);
Xspan = (Xspan / 2.0) + (ext);
double Xmid = Xmin + fabs(Xmax - Xmin) / 2.0;

double Yspan = fabs(Ymax - Ymin);
Yspan = (Yspan / 2.0) + (ext * scale);
Yspan = (Yspan / 2.0) + (ext);
double Ymid = Ymin + fabs(Ymax - Ymin) / 2.0;

Base::Vector3d bbxCenter(Xmid, Ymid, 0.0);
Expand All @@ -327,16 +328,16 @@ TechDraw::CosmeticEdge* TaskCenterLine::calcEndPoints(std::vector<std::string> f
if (vert) {
Base::Vector3d top(Xmid, Ymid - Yspan, 0.0);
Base::Vector3d bottom(Xmid, Ymid + Yspan, 0.0);
p1 = top;
p2 = bottom;
p1 = top / scale;
p2 = bottom / scale;
} else {
Base::Vector3d left(Xmid - Xspan, Ymid, 0.0);
Base::Vector3d right(Xmid + Xspan, Ymid, 0.0);
p1 = left;
p2 = right;
p1 = left / scale;
p2 = right / scale;
}

result = new TechDraw::CosmeticEdge(p1,p2);
result = new TechDraw::CosmeticEdge(p1, p2, scale);
App::Color ac;
ac.setValue<QColor>(ui->cpLineColor->color());
result->color = ac;
Expand Down Expand Up @@ -437,7 +438,7 @@ TaskDlgCenterLine::TaskDlgCenterLine(TechDraw::DrawViewPart* partFeat,
: TaskDialog()
{
widget = new TaskCenterLine(partFeat,page,subNames);
taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/techdraw-centerline"),
taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/techdraw-facecenterline"),
widget->windowTitle(), true, 0);
taskbox->groupLayout()->addWidget(widget);
Content.push_back(taskbox);
Expand All @@ -447,7 +448,7 @@ TaskDlgCenterLine::TaskDlgCenterLine(TechDraw::DrawViewPart* partFeat,
// : TaskDialog()
//{
// widget = new TaskCenterLine(partVP);
// taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/techdraw-centerline"),
// taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/techdraw-facecenterline"),
// widget->windowTitle(), true, 0);
// taskbox->groupLayout()->addWidget(widget);
// Content.push_back(taskbox);
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/TechDraw/Gui/TaskCenterLine.ui
Expand Up @@ -27,7 +27,7 @@
</property>
<property name="windowIcon">
<iconset resource="Resources/TechDraw.qrc">
<normaloff>:/icons/actions/techdraw-centerline.svg</normaloff>:/icons/actions/techdraw-centerline.svg</iconset>
<normaloff>:/icons/actions/techdraw-facecenterline.svg</normaloff>:/icons/actions/techdraw-facecenterline.svg</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
Expand Down

0 comments on commit f25826b

Please sign in to comment.