[TD]migrate DrawingWB projection functions to TechDrawWB

This commit is contained in:
Wanderer Fan
2022-01-27 15:06:10 -05:00
committed by WandererFan
parent 71913a497f
commit cc770208ea
18 changed files with 2771 additions and 5 deletions

View File

@@ -84,7 +84,7 @@ set(TechDrawGui_UIC_SRCS
TaskWeldingSymbol.ui
SymbolChooser.ui
TaskMoveView.ui
TaskProjection.ui
)
if(BUILD_QT5)
@@ -210,6 +210,9 @@ SET(TechDrawGui_SRCS
TaskCosmeticLine.cpp
TaskCosmeticLine.h
TaskMoveView.ui
TaskProjection.cpp
TaskProjection.h
TaskProjection.ui
)
SET(TechDrawGuiView_SRCS
@@ -381,6 +384,7 @@ SET(TechDrawGuiTaskDlgs_SRCS
TaskCosmeticLine.ui
TaskSelectLineAttributes.ui
TaskMoveView.ui
TaskProjection.ui
)
SOURCE_GROUP("TaskDialogs" FILES ${TechDrawGuiTaskDlgs_SRCS})

View File

@@ -95,6 +95,7 @@
#include "TaskSectionView.h"
#include "TaskActiveView.h"
#include "TaskDetail.h"
#include "TaskProjection.h"
#include "ViewProviderPage.h"
#include "ViewProviderViewPart.h"
@@ -1462,6 +1463,38 @@ bool CmdTechDrawExportPageDXF::isActive(void)
return DrawGuiUtil::needPage(this);
}
//===========================================================================
// TechDraw_ProjectShape
//===========================================================================
DEF_STD_CMD_A(CmdTechDrawProjectShape)
CmdTechDrawProjectShape::CmdTechDrawProjectShape()
: Command("TechDraw_ProjectShape")
{
sAppModule = "TechDraw";
sGroup = QT_TR_NOOP("TechDraw");
sMenuText = QT_TR_NOOP("Project shape...");
sToolTipText = sMenuText;
sWhatsThis = "TechDraw_ProjectShape";
sStatusTip = sToolTipText;
sPixmap = "actions/TechDraw_ProjectShape";
}
void CmdTechDrawProjectShape::activated(int iMsg)
{
Q_UNUSED(iMsg);
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
if (!dlg) {
Gui::Control().showDialog(new TaskDlgProjection());
}
}
bool CmdTechDrawProjectShape::isActive(void)
{
return true;
}
void CreateTechDrawCommands(void)
{
Gui::CommandManager& rcCmdMgr = Gui::Application::Instance->commandManager();
@@ -1484,4 +1517,5 @@ void CreateTechDrawCommands(void)
rcCmdMgr.addCommand(new CmdTechDrawArchView());
rcCmdMgr.addCommand(new CmdTechDrawSpreadsheetView());
rcCmdMgr.addCommand(new CmdTechDrawBalloon());
rcCmdMgr.addCommand(new CmdTechDrawProjectShape());
}

View File

@@ -111,6 +111,7 @@
<file>icons/actions/TechDraw_WeldSymbol.svg</file>
<file>icons/actions/TechDraw_MoveView.svg</file>
<file>icons/actions/TechDraw_CopyView.svg</file>
<file>icons/actions/TechDraw_ProjectShape.svg</file>
<file>icons/actions/section-up.svg</file>
<file>icons/actions/section-down.svg</file>
<file>icons/actions/section-left.svg</file>

View File

@@ -0,0 +1,631 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
id="svg249"
height="64"
width="64"
version="1.1">
<defs
id="defs3">
<radialGradient
gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient5060"
id="radialGradient5031"
fy="486.64789"
fx="605.71429"
r="117.14286"
cy="486.64789"
cx="605.71429" />
<linearGradient
id="linearGradient5060">
<stop
offset="0"
style="stop-color:#000000;stop-opacity:1"
id="stop5062" />
<stop
offset="1"
style="stop-color:#000000;stop-opacity:0"
id="stop5064" />
</linearGradient>
<radialGradient
gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient5060"
id="radialGradient5029"
fy="486.64789"
fx="605.71429"
r="117.14286"
cy="486.64789"
cx="605.71429" />
<linearGradient
id="linearGradient5048">
<stop
offset="0"
style="stop-color:#000000;stop-opacity:0"
id="stop5050" />
<stop
offset="0.5"
style="stop-color:#000000;stop-opacity:1"
id="stop5056" />
<stop
offset="1"
style="stop-color:#000000;stop-opacity:0"
id="stop5052" />
</linearGradient>
<linearGradient
gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient5048"
id="linearGradient5027"
y2="609.50507"
x2="302.85715"
y1="366.64789"
x1="302.85715" />
<linearGradient
id="linearGradient4542">
<stop
offset="0"
style="stop-color:#000000;stop-opacity:1"
id="stop4544" />
<stop
offset="1"
style="stop-color:#000000;stop-opacity:0"
id="stop4546" />
</linearGradient>
<radialGradient
gradientTransform="matrix(1,0,0,0.284916,0,30.08928)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient4542"
id="radialGradient4548"
fy="42.07798"
fx="24.306795"
r="15.821514"
cy="42.07798"
cx="24.306795" />
<linearGradient
id="linearGradient15662">
<stop
offset="0"
style="stop-color:#ffffff;stop-opacity:1"
id="stop15664" />
<stop
offset="1"
style="stop-color:#f8f8f8;stop-opacity:1"
id="stop15666" />
</linearGradient>
<radialGradient
gradientUnits="userSpaceOnUse"
id="aigrd3"
fy="64.567902"
fx="20.892099"
r="5.257"
cy="64.567902"
cx="20.892099">
<stop
offset="0"
style="stop-color:#f0f0f0;stop-opacity:1"
id="stop15573" />
<stop
offset="1"
style="stop-color:#9a9a9a;stop-opacity:1"
id="stop15575" />
</radialGradient>
<radialGradient
gradientUnits="userSpaceOnUse"
id="aigrd2"
fy="114.5684"
fx="20.892099"
r="5.256"
cy="114.5684"
cx="20.892099">
<stop
offset="0"
style="stop-color:#f0f0f0;stop-opacity:1"
id="stop15566" />
<stop
offset="1"
style="stop-color:#9a9a9a;stop-opacity:1"
id="stop15568" />
</radialGradient>
<linearGradient
id="linearGradient269">
<stop
offset="0"
style="stop-color:#a3a3a3;stop-opacity:1"
id="stop270" />
<stop
offset="1"
style="stop-color:#4c4c4c;stop-opacity:1"
id="stop271" />
</linearGradient>
<linearGradient
id="linearGradient259">
<stop
offset="0"
style="stop-color:#fafafa;stop-opacity:1"
id="stop260" />
<stop
offset="1"
style="stop-color:#bbbbbb;stop-opacity:1"
id="stop261" />
</linearGradient>
<linearGradient
id="linearGradient12512">
<stop
offset="0"
style="stop-color:#ffffff;stop-opacity:1"
id="stop12513" />
<stop
offset="0.5"
style="stop-color:#fff520;stop-opacity:0.89108908"
id="stop12517" />
<stop
offset="1"
style="stop-color:#fff300;stop-opacity:0"
id="stop12514" />
</linearGradient>
<radialGradient
gradientTransform="matrix(0.968273,0,0,1.032767,3.4281936,-47.492271)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient269"
id="radialGradient15656"
fy="3.7561285"
fx="8.824419"
r="37.751713"
cy="3.7561285"
cx="8.824419" />
<radialGradient
gradientTransform="matrix(0.960493,0,0,1.041132,0.07464063,-48.138718)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient259"
id="radialGradient15658"
fy="35.736916"
fx="33.966679"
r="86.70845"
cy="35.736916"
cx="33.966679" />
<radialGradient
gradientTransform="matrix(0.968273,0,0,1.032767,3.4281936,-47.492271)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient15662"
id="radialGradient15668"
fy="7.2678967"
fx="8.1435566"
r="38.158695"
cy="7.2678967"
cx="8.1435566" />
<radialGradient
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)"
gradientUnits="userSpaceOnUse"
xlink:href="#aigrd2"
id="radialGradient2283"
fy="114.5684"
fx="20.892099"
r="5.256"
cy="114.5684"
cx="20.892099" />
<radialGradient
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)"
gradientUnits="userSpaceOnUse"
xlink:href="#aigrd3"
id="radialGradient2285"
fy="64.567902"
fx="20.892099"
r="5.257"
cy="64.567902"
cx="20.892099" />
<linearGradient
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3377-76"
id="linearGradient4343"
y2="41.792759"
x2="44.524982"
y1="14.452502"
x1="18.971846" />
<linearGradient
id="linearGradient3377-76">
<stop
offset="0"
style="stop-color:#faff2b;stop-opacity:1"
id="stop3379-5" />
<stop
offset="0.5"
style="stop-color:#fcb915;stop-opacity:1"
id="stop4345" />
<stop
offset="1"
style="stop-color:#c68708;stop-opacity:1"
id="stop3381-7" />
</linearGradient>
<linearGradient
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3377-76"
id="linearGradient4349"
y2="108.75008"
x2="175.6825"
y1="79.160103"
x1="145.64697" />
<linearGradient
id="linearGradient4482">
<stop
offset="0"
style="stop-color:#faff2b;stop-opacity:1"
id="stop4484" />
<stop
offset="0.5"
style="stop-color:#fcb915;stop-opacity:1"
id="stop4486" />
<stop
offset="1"
style="stop-color:#c68708;stop-opacity:1"
id="stop4488" />
</linearGradient>
<radialGradient
gradientTransform="matrix(0.97435,0.2250379,-0.4623105,2.0016728,48.487554,-127.99883)"
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3377"
id="radialGradient4351"
fy="97.369568"
fx="135.38333"
r="19.467436"
cy="97.369568"
cx="135.38333" />
<linearGradient
id="linearGradient3377">
<stop
offset="0"
style="stop-color:#faff2b;stop-opacity:1"
id="stop3379" />
<stop
offset="1"
style="stop-color:#ffaa00;stop-opacity:1"
id="stop3381" />
</linearGradient>
<radialGradient
gradientUnits="userSpaceOnUse"
xlink:href="#linearGradient3377"
id="radialGradient4353"
fy="28.869568"
fx="45.883327"
r="19.467436"
cy="28.869568"
cx="45.883327" />
<linearGradient
id="linearGradient4495">
<stop
offset="0"
style="stop-color:#faff2b;stop-opacity:1"
id="stop4497" />
<stop
offset="1"
style="stop-color:#ffaa00;stop-opacity:1"
id="stop4499" />
</linearGradient>
<linearGradient
gradientTransform="matrix(1.0625,0,0,1.1065089,-87.687497,0.78106561)"
gradientUnits="userSpaceOnUse"
y2="30"
x2="115"
y1="43"
x1="121"
id="linearGradient4027"
xlink:href="#linearGradient4029" />
<linearGradient
id="linearGradient4029">
<stop
style="stop-color:#06989a;stop-opacity:1"
offset="0"
id="stop4031" />
<stop
style="stop-color:#16d0d2;stop-opacity:1"
offset="1"
id="stop4033" />
</linearGradient>
<linearGradient
gradientTransform="matrix(1.0625,0,0,1.1065089,-87.687497,0.78106561)"
gradientUnits="userSpaceOnUse"
y2="30"
x2="99"
y1="45.629101"
x1="102.22456"
id="linearGradient4001"
xlink:href="#linearGradient3995" />
<linearGradient
id="linearGradient3995">
<stop
id="stop3997"
offset="0"
style="stop-color:#16d0d2;stop-opacity:1" />
<stop
id="stop3999"
offset="1"
style="stop-color:#34e0e2;stop-opacity:1" />
</linearGradient>
<radialGradient
r="5.256"
fy="114.5684"
fx="20.892099"
cy="114.5684"
cx="20.892099"
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)"
gradientUnits="userSpaceOnUse"
id="radialGradient2283-4"
xlink:href="#aigrd2-2" />
<radialGradient
id="aigrd2-2"
cx="20.892099"
cy="114.5684"
r="5.256"
fx="20.892099"
fy="114.5684"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
style="stop-color:#F0F0F0"
id="stop15566-3" />
<stop
offset="1.0000000"
style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
id="stop15568-2" />
</radialGradient>
<radialGradient
r="5.257"
fy="64.567902"
fx="20.892099"
cy="64.567902"
cx="20.892099"
gradientTransform="matrix(0.229703,0,0,0.229703,4.613529,3.979808)"
gradientUnits="userSpaceOnUse"
id="radialGradient2285-2"
xlink:href="#aigrd3-1" />
<radialGradient
id="aigrd3-1"
cx="20.892099"
cy="64.567902"
r="5.257"
fx="20.892099"
fy="64.567902"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
style="stop-color:#F0F0F0"
id="stop15573-6" />
<stop
offset="1.0000000"
style="stop-color:#9a9a9a;stop-opacity:1.0000000;"
id="stop15575-8" />
</radialGradient>
<radialGradient
xlink:href="#linearGradient15662-7"
id="radialGradient15668-2"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2992848,0,0,1.4315068,3.2140525,-64.437909)"
cx="8.1435566"
cy="7.2678967"
fx="8.1435566"
fy="7.2678967"
r="38.158695" />
<linearGradient
id="linearGradient15662-7">
<stop
id="stop15664-6"
offset="0.0000000"
style="stop-color:#ffffff;stop-opacity:1.0000000;" />
<stop
id="stop15666-1"
offset="1.0000000"
style="stop-color:#f8f8f8;stop-opacity:1.0000000;" />
</linearGradient>
<radialGradient
xlink:href="#linearGradient259-5"
id="radialGradient15658-4"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.3214205,0,0,1.4752426,-2.0839021,-66.146883)"
cx="33.966679"
cy="35.736916"
fx="33.966679"
fy="35.736916"
r="86.70845" />
<linearGradient
id="linearGradient259-5">
<stop
id="stop260-5"
offset="0.0000000"
style="stop-color:#fafafa;stop-opacity:1.0000000;" />
<stop
id="stop261-1"
offset="1.0000000"
style="stop-color:#bbbbbb;stop-opacity:1.0000000;" />
</linearGradient>
<radialGradient
xlink:href="#linearGradient269-1"
id="radialGradient15656-7"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.3321242,0,0,1.4633899,2.5298271,-65.230893)"
cx="3.3431637"
cy="37.388847"
fx="3.3431637"
fy="37.388847"
r="37.751713" />
<linearGradient
id="linearGradient269-1">
<stop
id="stop270-1"
offset="0.0000000"
style="stop-color:#a3a3a3;stop-opacity:1.0000000;" />
<stop
id="stop271-5"
offset="1.0000000"
style="stop-color:#4c4c4c;stop-opacity:1.0000000;" />
</linearGradient>
<linearGradient
y2="609.50507"
x2="302.85715"
y1="366.64789"
x1="302.85715"
gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
gradientUnits="userSpaceOnUse"
id="linearGradient5027-1"
xlink:href="#linearGradient5048-7" />
<linearGradient
id="linearGradient5048-7">
<stop
id="stop5050-4"
offset="0"
style="stop-color:black;stop-opacity:0;" />
<stop
style="stop-color:black;stop-opacity:1;"
offset="0.5"
id="stop5056-0" />
<stop
id="stop5052-9"
offset="1"
style="stop-color:black;stop-opacity:0;" />
</linearGradient>
<radialGradient
r="117.14286"
fy="486.64789"
fx="605.71429"
cy="486.64789"
cx="605.71429"
gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
gradientUnits="userSpaceOnUse"
id="radialGradient5029-4"
xlink:href="#linearGradient5060-8" />
<linearGradient
id="linearGradient5060-8">
<stop
id="stop5062-8"
offset="0"
style="stop-color:black;stop-opacity:1;" />
<stop
id="stop5064-2"
offset="1"
style="stop-color:black;stop-opacity:0;" />
</linearGradient>
<radialGradient
xlink:href="#linearGradient5060-8"
id="radialGradient3663"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
cx="605.71429"
cy="486.64789"
fx="605.71429"
fy="486.64789"
r="117.14286" />
<radialGradient
xlink:href="#linearGradient5060-8"
id="radialGradient4227"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
cx="605.71429"
cy="486.64789"
fx="605.71429"
fy="486.64789"
r="117.14286" />
</defs>
<metadata
id="metadata4">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:creator>
<cc:Agent>
<dc:title>[agryson] Alexander Gryson</dc:title>
</cc:Agent>
</dc:creator>
<dc:source>http://agryson.net</dc:source>
<cc:license
rdf:resource="https://www.gnu.org/copyleft/lesser.html" />
<dc:title>techdraw-view</dc:title>
<dc:date>2016-01-14</dc:date>
<dc:relation>http://www.freecadweb.org/wiki/index.php?title=Artwork</dc:relation>
<dc:publisher>
<cc:Agent>
<dc:title>FreeCAD</dc:title>
</cc:Agent>
</dc:publisher>
<dc:identifier>FreeCAD/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-view.svg</dc:identifier>
<dc:rights>
<cc:Agent>
<dc:title>FreeCAD LGPL2+</dc:title>
</cc:Agent>
</dc:rights>
<dc:contributor>
<cc:Agent>
<dc:title>[agryson] Alexander Gryson</dc:title>
</cc:Agent>
</dc:contributor>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Notice" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Attribution" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<cc:requires
rdf:resource="http://web.resource.org/cc/ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
transform="translate(-34.033307,6.8535314)"
id="g414">
<path
style="fill:none;fill-opacity:1;stroke:#042a2a;stroke-width:1.99999988;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
d="M 59.384832,27.369471 V 6.4463929 L 77.692524,11.677164 V 32.60024 Z"
id="path3185-6" />
<path
style="fill:none;stroke:#042a2a;stroke-width:1.99999988;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1"
d="M 59.384832,6.4463929 75.07714,-1.3997601 93.384833,3.8310089 77.692524,11.677164 Z"
id="path3973-2" />
<path
style="fill:none;fill-opacity:1;stroke:#042a2a;stroke-width:1.99999988;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1"
d="M 77.692524,11.677164 V 32.60024 L 93.384833,24.754087 V 3.8310089 Z"
id="path3975-9" />
</g>
<g
transform="translate(0,16)"
style="display:inline"
id="layer4" />
<g
transform="translate(-4,4)"
id="g421">
<path
style="fill:url(#linearGradient4001);fill-opacity:1;stroke:#042a2a;stroke-width:1.99999988;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
d="M 9,49.769231 V 28.846153 l 18.307692,5.230771 V 55 Z"
id="path3185" />
<path
style="fill:#34e0e2;stroke:#042a2a;stroke-width:1.99999988;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1"
d="M 9,28.846153 24.692308,21 43.000001,26.230769 27.307692,34.076924 Z"
id="path3973" />
<path
style="fill:url(#linearGradient4027);fill-opacity:1;stroke:#042a2a;stroke-width:1.99999988;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1"
d="M 27.307692,34.076924 V 55 L 43.000001,47.153847 V 26.230769 Z"
id="path3975" />
<path
style="fill:none;stroke:#34e0e2;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
d="M 10.999999,48.247271 V 31.536724 l 14.224332,4.001147 0.0875,16.81772 z"
id="path3185-7" />
<path
style="fill:none;stroke:#16d0d2;stroke-width:1.99999988;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 29.290031,35.305198 29.27232,51.999998 41,46.247429 40.960479,29.607759 Z"
id="path3975-4" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,171 @@
/***************************************************************************
* Copyright (c) 2009 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
//this file originally part of TechDraw workbench
//migrated to TechDraw workbench 2022-01-26 by Wandererfan
#include "PreCompiled.h"
#ifndef _PreComp_
# include <QCheckBox>
# include <QMessageBox>
#endif
#include <Standard_math.hxx>
#include <Gui/Application.h>
#include <Gui/BitmapFactory.h>
#include <Gui/Command.h>
#include <Gui/Selection.h>
#include <Gui/Document.h>
#include <Gui/MainWindow.h>
#include <Gui/View3DInventor.h>
#include <Gui/View3DInventorViewer.h>
#include <Mod/Part/App/PartFeature.h>
#include "TaskProjection.h"
#include "ui_TaskProjection.h"
using namespace TechDrawGui;
/* TRANSLATOR TechDrawGui::TaskProjection */
TaskProjection::TaskProjection() :
ui(new Ui_TaskProjection)
{
ui->setupUi(this);
}
TaskProjection::~TaskProjection()
{
// automatically deleted in the sub-class
}
bool TaskProjection::accept()
{
Gui::Document* document = Gui::Application::Instance->activeDocument();
if (!document) {
QMessageBox::warning(Gui::getMainWindow(), tr("No active document"),
tr("There is currently no active document to complete the operation"));
return true;
}
std::list<Gui::MDIView*> mdis = document->getMDIViewsOfType(Gui::View3DInventor::getClassTypeId());
if (mdis.empty()) {
QMessageBox::warning(Gui::getMainWindow(), tr("No active view"),
tr("There is currently no active view to complete the operation"));
return false;
}
Gui::View3DInventorViewer* viewer = static_cast<Gui::View3DInventor*>(mdis.front())->getViewer();
SbVec3f pnt, dir;
viewer->getNearPlane(pnt, dir);
float x=0, y=1,z=1;
dir.getValue(x,y,z);
std::vector<Part::Feature*> shapes = Gui::Selection().getObjectsOfType<Part::Feature>();
Gui::Command::openCommand("Project shape");
Gui::Command::addModule(Gui::Command::Doc,"TechDraw");
for (std::vector<Part::Feature*>::iterator it = shapes.begin(); it != shapes.end(); ++it) {
const char* object = (*it)->getNameInDocument();
Gui::Command::doCommand(Gui::Command::Doc,
"FreeCAD.ActiveDocument.addObject('TechDraw::FeatureProjection','%s_proj')", object);
Gui::Command::doCommand(Gui::Command::Doc,
"FreeCAD.ActiveDocument.ActiveObject.Direction=FreeCAD.Vector(%f,%f,%f)", x,y,z);
Gui::Command::doCommand(Gui::Command::Doc,
"FreeCAD.ActiveDocument.ActiveObject.Source=FreeCAD.ActiveDocument.%s", object);
Gui::Command::doCommand(Gui::Command::Doc,
"FreeCAD.ActiveDocument.ActiveObject.VCompound=%s", (ui->cbVisSharp->isChecked() ? "True" : "False"));
Gui::Command::doCommand(Gui::Command::Doc,
"FreeCAD.ActiveDocument.ActiveObject.Rg1LineVCompound=%s", (ui->cbVisSmooth->isChecked() ? "True" : "False"));
Gui::Command::doCommand(Gui::Command::Doc,
"FreeCAD.ActiveDocument.ActiveObject.RgNLineVCompound=%s", (ui->cbVisSewn->isChecked() ? "True" : "False"));
Gui::Command::doCommand(Gui::Command::Doc,
"FreeCAD.ActiveDocument.ActiveObject.OutLineVCompound=%s", (ui->cbVisOutline->isChecked() ? "True" : "False"));
Gui::Command::doCommand(Gui::Command::Doc,
"FreeCAD.ActiveDocument.ActiveObject.IsoLineVCompound=%s", (ui->cbVisIso->isChecked() ? "True" : "False"));
Gui::Command::doCommand(Gui::Command::Doc,
"FreeCAD.ActiveDocument.ActiveObject.HCompound=%s", (ui->cbHidSharp->isChecked() ? "True" : "False"));
Gui::Command::doCommand(Gui::Command::Doc,
"FreeCAD.ActiveDocument.ActiveObject.Rg1LineHCompound=%s", (ui->cbHidSmooth->isChecked() ? "True" : "False"));
Gui::Command::doCommand(Gui::Command::Doc,
"FreeCAD.ActiveDocument.ActiveObject.RgNLineHCompound=%s", (ui->cbHidSewn->isChecked() ? "True" : "False"));
Gui::Command::doCommand(Gui::Command::Doc,
"FreeCAD.ActiveDocument.ActiveObject.OutLineHCompound=%s", (ui->cbHidOutline->isChecked() ? "True" : "False"));
Gui::Command::doCommand(Gui::Command::Doc,
"FreeCAD.ActiveDocument.ActiveObject.IsoLineHCompound=%s", (ui->cbHidIso->isChecked() ? "True" : "False"));
}
Gui::Command::updateActive();
Gui::Command::commitCommand();
return true;
}
bool TaskProjection::reject()
{
return true;
}
///////////////////////////////////////////////////////////////////////////
TaskDlgProjection::TaskDlgProjection() :
TaskDialog()
{
widget = new TaskProjection();
taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/TechDraw_ProjectShape"), widget->windowTitle(), true, 0);
taskbox->groupLayout()->addWidget(widget);
Content.push_back(taskbox);
setAutoCloseOnTransactionChange(true);
}
TaskDlgProjection::~TaskDlgProjection()
{
}
void TaskDlgProjection::update()
{
}
//==== calls from the TaskView ===============================================================
void TaskDlgProjection::open()
{
}
void TaskDlgProjection::clicked(int i)
{
Q_UNUSED(i);
}
bool TaskDlgProjection::accept()
{
widget->accept();
return true;
}
bool TaskDlgProjection::reject()
{
widget->reject();
return true;
}
#include "moc_TaskProjection.cpp"

View File

@@ -0,0 +1,96 @@
/***************************************************************************
* Copyright (c) 2009 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
//this file originally part of TechDraw workbench
//migrated to TechDraw workbench 2022-01-26 by Wandererfan
#ifndef TECHDRAWGUI_TASKDIALOG
#define TECHDRAWGUI_TASKDIALOG
#include <QWidget>
#include <Gui/TaskView/TaskDialog.h>
#include <Gui/TaskView/TaskView.h>
class QCheckBox;
namespace TechDrawGui
{
/**
* Embed the panel into a task dialog.
*/
class Ui_TaskProjection;
class TaskProjection : public QWidget
{
Q_OBJECT
public:
TaskProjection();
~TaskProjection();
public:
bool accept();
bool reject();
virtual bool isAllowedAlterDocument(void) const
{ return true; }
private:
std::unique_ptr<Ui_TaskProjection> ui;
};
class TaskDlgProjection : public Gui::TaskView::TaskDialog
{
Q_OBJECT
public:
TaskDlgProjection();
~TaskDlgProjection();
public:
/// is called the TaskView when the dialog is opened
virtual void open();
/// is called by the framework if an button is clicked which has no accept or reject role
virtual void clicked(int);
/// is called by the framework if the dialog is accepted (Ok)
virtual bool accept();
/// is called by the framework if the dialog is rejected (Cancel)
virtual bool reject();
/// is called by the framework if the user presses the help button
virtual void helpRequested() { return;}
void update();
protected:
private:
TaskProjection* widget;
Gui::TaskView::TaskBox* taskbox;
};
} //namespace TechDrawGui
#endif // TECHDRAWGUI_TASKDIALOG

View File

@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TechDrawGui::TaskProjection</class>
<widget class="QWidget" name="TechDrawGui::TaskProjection">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>353</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Project shapes</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="cbVisSharp">
<property name="text">
<string>Visible sharp edges</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbVisSmooth">
<property name="text">
<string>Visible smooth edges</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbVisSewn">
<property name="text">
<string>Visible sewn edges</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbVisOutline">
<property name="text">
<string>Visible outline edges</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbVisIso">
<property name="text">
<string>Visible isoparameters</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbHidSharp">
<property name="text">
<string>Hidden sharp edges</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbHidSmooth">
<property name="text">
<string>Hidden smooth edges</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbHidSewn">
<property name="text">
<string>Hidden sewn edges</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbHidOutline">
<property name="text">
<string>Hidden outline edges</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbHidIso">
<property name="text">
<string>Hidden isoparameters</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -207,6 +207,8 @@ Gui::MenuItem* Workbench::setupMenuBar() const
*draw << "TechDraw_DecorateLine";
*draw << "TechDraw_ShowAll";
*draw << "TechDraw_WeldSymbol";
*draw << "Separator";
*draw << "TechDraw_ProjectShape";
return root;
}
@@ -231,6 +233,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
*views << "TechDraw_SpreadsheetView";
*views << "TechDraw_MoveView";
*views << "TechDraw_CopyView";
*views << "TechDraw_ProjectShape";
Gui::ToolBarItem *clips = new Gui::ToolBarItem(root);
clips->setCommand("TechDraw Clips");
@@ -364,6 +367,8 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const
*views << "TechDraw_SpreadsheetView";
*views << "TechDraw_MoveView";
*views << "TechDraw_CopyView";
*views << "TechDraw_ProjectShape";
Gui::ToolBarItem *clips = new Gui::ToolBarItem(root);
clips->setCommand("TechDraw Clips");