TechDraw: Add taskbox to Part View. Removes Projection Group from toolbar.
This commit is contained in:
@@ -583,74 +583,7 @@ std::pair<Base::Vector3d, Base::Vector3d> DrawProjGroup::getDirsFromFront(std::s
|
||||
throw Base::RuntimeError("Project Group missing Anchor projection item");
|
||||
}
|
||||
|
||||
Base::Vector3d org(0.0, 0.0, 0.0);
|
||||
gp_Ax2 anchorCS = anch->getProjectionCS(org);
|
||||
gp_Pnt gOrg(0.0, 0.0, 0.0);
|
||||
gp_Dir gDir = anchorCS.Direction();
|
||||
gp_Dir gXDir = anchorCS.XDirection();
|
||||
gp_Dir gYDir = anchorCS.YDirection();
|
||||
gp_Ax1 gUpAxis(gOrg, gYDir);
|
||||
gp_Ax2 newCS;
|
||||
gp_Dir gNewDir;
|
||||
gp_Dir gNewXDir;
|
||||
|
||||
double angle = M_PI / 2.0;//90*
|
||||
|
||||
if (viewType == "Right") {
|
||||
newCS = anchorCS.Rotated(gUpAxis, angle);
|
||||
projDir = dir2vec(newCS.Direction());
|
||||
rotVec = dir2vec(newCS.XDirection());
|
||||
}
|
||||
else if (viewType == "Left") {
|
||||
newCS = anchorCS.Rotated(gUpAxis, -angle);
|
||||
projDir = dir2vec(newCS.Direction());
|
||||
rotVec = dir2vec(newCS.XDirection());
|
||||
}
|
||||
else if (viewType == "Top") {
|
||||
projDir = dir2vec(gYDir);
|
||||
rotVec = dir2vec(gXDir);
|
||||
}
|
||||
else if (viewType == "Bottom") {
|
||||
projDir = dir2vec(gYDir.Reversed());
|
||||
rotVec = dir2vec(gXDir);
|
||||
}
|
||||
else if (viewType == "Rear") {
|
||||
projDir = dir2vec(gDir.Reversed());
|
||||
rotVec = dir2vec(gXDir.Reversed());
|
||||
}
|
||||
else if (viewType == "FrontTopLeft") {
|
||||
gp_Dir newDir = gp_Dir(gp_Vec(gDir) - gp_Vec(gXDir) + gp_Vec(gYDir));
|
||||
projDir = dir2vec(newDir);
|
||||
gp_Dir newXDir = gp_Dir(gp_Vec(gXDir) + gp_Vec(gDir));
|
||||
rotVec = dir2vec(newXDir);
|
||||
}
|
||||
else if (viewType == "FrontTopRight") {
|
||||
gp_Dir newDir = gp_Dir(gp_Vec(gDir) + gp_Vec(gXDir) + gp_Vec(gYDir));
|
||||
projDir = dir2vec(newDir);
|
||||
gp_Dir newXDir = gp_Dir(gp_Vec(gXDir) - gp_Vec(gDir));
|
||||
rotVec = dir2vec(newXDir);
|
||||
}
|
||||
else if (viewType == "FrontBottomLeft") {
|
||||
gp_Dir newDir = gp_Dir(gp_Vec(gDir) - gp_Vec(gXDir) - gp_Vec(gYDir));
|
||||
projDir = dir2vec(newDir);
|
||||
gp_Dir newXDir = gp_Dir(gp_Vec(gXDir) + gp_Vec(gDir));
|
||||
rotVec = dir2vec(newXDir);
|
||||
}
|
||||
else if (viewType == "FrontBottomRight") {
|
||||
gp_Dir newDir = gp_Dir(gp_Vec(gDir) + gp_Vec(gXDir) - gp_Vec(gYDir));
|
||||
projDir = dir2vec(newDir);
|
||||
gp_Dir newXDir = gp_Dir(gp_Vec(gXDir) - gp_Vec(gDir));
|
||||
rotVec = dir2vec(newXDir);
|
||||
} else {
|
||||
// not one of the standard view directions, so complain and use the values for "Front"
|
||||
Base::Console().Error("DrawProjGroup - %s unknown projection: %s\n", getNameInDocument(),
|
||||
viewType.c_str());
|
||||
Base::Vector3d dirAnch = anch->Direction.getValue();
|
||||
Base::Vector3d rotAnch = anch->getXDirection();
|
||||
return std::make_pair(dirAnch, rotAnch);
|
||||
}
|
||||
|
||||
return std::make_pair(projDir, rotVec);
|
||||
return anch->getDirsFromFront(viewType);
|
||||
}
|
||||
|
||||
Base::Vector3d DrawProjGroup::dir2vec(gp_Dir d)
|
||||
|
||||
@@ -1263,6 +1263,124 @@ Base::Vector3d DrawViewPart::getXDirection() const
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void DrawViewPart::rotate(const std::string& rotationdirection)
|
||||
{
|
||||
std::pair<Base::Vector3d, Base::Vector3d> newDirs;
|
||||
if (rotationdirection == "Right")
|
||||
newDirs = getDirsFromFront("Left");// Front -> Right -> Rear -> Left -> Front
|
||||
else if (rotationdirection == "Left")
|
||||
newDirs = getDirsFromFront("Right");// Front -> Left -> Rear -> Right -> Front
|
||||
else if (rotationdirection == "Up")
|
||||
newDirs = getDirsFromFront("Bottom");// Front -> Top -> Rear -> Bottom -> Front
|
||||
else if (rotationdirection == "Down")
|
||||
newDirs = getDirsFromFront("Top");// Front -> Bottom -> Rear -> Top -> Front
|
||||
|
||||
Direction.setValue(newDirs.first);
|
||||
XDirection.setValue(newDirs.second);
|
||||
recompute();
|
||||
}
|
||||
|
||||
void DrawViewPart::spin(const std::string& spindirection)
|
||||
{
|
||||
double angle;
|
||||
if (spindirection == "CW")
|
||||
angle = M_PI / 2.0;// Top -> Right -> Bottom -> Left -> Top
|
||||
if (spindirection == "CCW")
|
||||
angle = -M_PI / 2.0;// Top -> Left -> Bottom -> Right -> Top
|
||||
|
||||
Base::Vector3d org(0.0, 0.0, 0.0);
|
||||
Base::Vector3d curRot = getXDirection();
|
||||
Base::Vector3d curDir = Direction.getValue();
|
||||
Base::Vector3d newRot = DrawUtil::vecRotate(curRot, angle, curDir, org);
|
||||
|
||||
XDirection.setValue(newRot);
|
||||
recompute();
|
||||
}
|
||||
|
||||
std::pair<Base::Vector3d, Base::Vector3d> DrawViewPart::getDirsFromFront(std::string viewType)
|
||||
{
|
||||
// Base::Console().Message("DVP::getDirsFromFront(%s)\n", viewType.c_str());
|
||||
std::pair<Base::Vector3d, Base::Vector3d> result;
|
||||
|
||||
Base::Vector3d projDir, rotVec;
|
||||
|
||||
Base::Vector3d org(0.0, 0.0, 0.0);
|
||||
gp_Ax2 anchorCS = getProjectionCS(org);
|
||||
gp_Pnt gOrg(0.0, 0.0, 0.0);
|
||||
gp_Dir gDir = anchorCS.Direction();
|
||||
gp_Dir gXDir = anchorCS.XDirection();
|
||||
gp_Dir gYDir = anchorCS.YDirection();
|
||||
gp_Ax1 gUpAxis(gOrg, gYDir);
|
||||
gp_Ax2 newCS;
|
||||
gp_Dir gNewDir;
|
||||
gp_Dir gNewXDir;
|
||||
|
||||
double angle = M_PI / 2.0;//90*
|
||||
|
||||
if (viewType == "Right") {
|
||||
newCS = anchorCS.Rotated(gUpAxis, angle);
|
||||
projDir = dir2vec(newCS.Direction());
|
||||
rotVec = dir2vec(newCS.XDirection());
|
||||
}
|
||||
else if (viewType == "Left") {
|
||||
newCS = anchorCS.Rotated(gUpAxis, -angle);
|
||||
projDir = dir2vec(newCS.Direction());
|
||||
rotVec = dir2vec(newCS.XDirection());
|
||||
}
|
||||
else if (viewType == "Top") {
|
||||
projDir = dir2vec(gYDir);
|
||||
rotVec = dir2vec(gXDir);
|
||||
}
|
||||
else if (viewType == "Bottom") {
|
||||
projDir = dir2vec(gYDir.Reversed());
|
||||
rotVec = dir2vec(gXDir);
|
||||
}
|
||||
else if (viewType == "Rear") {
|
||||
projDir = dir2vec(gDir.Reversed());
|
||||
rotVec = dir2vec(gXDir.Reversed());
|
||||
}
|
||||
else if (viewType == "FrontTopLeft") {
|
||||
gp_Dir newDir = gp_Dir(gp_Vec(gDir) - gp_Vec(gXDir) + gp_Vec(gYDir));
|
||||
projDir = dir2vec(newDir);
|
||||
gp_Dir newXDir = gp_Dir(gp_Vec(gXDir) + gp_Vec(gDir));
|
||||
rotVec = dir2vec(newXDir);
|
||||
}
|
||||
else if (viewType == "FrontTopRight") {
|
||||
gp_Dir newDir = gp_Dir(gp_Vec(gDir) + gp_Vec(gXDir) + gp_Vec(gYDir));
|
||||
projDir = dir2vec(newDir);
|
||||
gp_Dir newXDir = gp_Dir(gp_Vec(gXDir) - gp_Vec(gDir));
|
||||
rotVec = dir2vec(newXDir);
|
||||
}
|
||||
else if (viewType == "FrontBottomLeft") {
|
||||
gp_Dir newDir = gp_Dir(gp_Vec(gDir) - gp_Vec(gXDir) - gp_Vec(gYDir));
|
||||
projDir = dir2vec(newDir);
|
||||
gp_Dir newXDir = gp_Dir(gp_Vec(gXDir) + gp_Vec(gDir));
|
||||
rotVec = dir2vec(newXDir);
|
||||
}
|
||||
else if (viewType == "FrontBottomRight") {
|
||||
gp_Dir newDir = gp_Dir(gp_Vec(gDir) + gp_Vec(gXDir) - gp_Vec(gYDir));
|
||||
projDir = dir2vec(newDir);
|
||||
gp_Dir newXDir = gp_Dir(gp_Vec(gXDir) - gp_Vec(gDir));
|
||||
rotVec = dir2vec(newXDir);
|
||||
}
|
||||
else {
|
||||
// not one of the standard view directions, so complain and use the values for "Front"
|
||||
Base::Console().Error("DrawViewPart - %s unknown projection: %s\n", getNameInDocument(),
|
||||
viewType.c_str());
|
||||
Base::Vector3d dirAnch = Direction.getValue();
|
||||
Base::Vector3d rotAnch = getXDirection();
|
||||
return std::make_pair(dirAnch, rotAnch);
|
||||
}
|
||||
|
||||
return std::make_pair(projDir, rotVec);
|
||||
}
|
||||
|
||||
Base::Vector3d DrawViewPart::dir2vec(gp_Dir d)
|
||||
{
|
||||
return Base::Vector3d(d.X(), d.Y(), d.Z());
|
||||
}
|
||||
|
||||
Base::Vector3d DrawViewPart::getLegacyX(const Base::Vector3d& pt, const Base::Vector3d& axis,
|
||||
const bool flip) const
|
||||
{
|
||||
|
||||
@@ -172,6 +172,11 @@ public:
|
||||
virtual Base::Vector3d getLegacyX(const Base::Vector3d& pt, const Base::Vector3d& axis,
|
||||
const bool flip = true) const;
|
||||
|
||||
void rotate(const std::string& rotationdirection);
|
||||
void spin(const std::string& spindirection);
|
||||
std::pair<Base::Vector3d, Base::Vector3d> getDirsFromFront(std::string viewType);
|
||||
Base::Vector3d dir2vec(gp_Dir d);
|
||||
|
||||
gp_Ax2 localVectorToCS(const Base::Vector3d localUnit) const;
|
||||
Base::Vector3d localVectorToDirection(const Base::Vector3d localUnit) const;
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@ CmdTechDrawView::CmdTechDrawView() : Command("TechDraw_View")
|
||||
sGroup = QT_TR_NOOP("TechDraw");
|
||||
sMenuText = QT_TR_NOOP("Insert View");
|
||||
sToolTipText = QT_TR_NOOP("Insert a View in current page.\n"
|
||||
"Selected objects, spreadsheets or Arch WB section planes will be added with the current camera orientation.\n"
|
||||
"Selected objects, spreadsheets or Arch WB section planes will be added.\n"
|
||||
"Without a selection, a file browser lets you select a SVG or image file.");
|
||||
sWhatsThis = "TechDraw_View";
|
||||
sStatusTip = sToolTipText;
|
||||
@@ -469,51 +469,72 @@ void CmdTechDrawView::activated(int iMsg)
|
||||
return;
|
||||
}
|
||||
|
||||
Base::Vector3d projDir;
|
||||
Gui::WaitCursor wc;
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Create view"));
|
||||
std::string FeatName = getUniqueObjectName("View");
|
||||
doCommand(Doc, "App.activeDocument().addObject('TechDraw::DrawViewPart', '%s')",
|
||||
FeatName.c_str());
|
||||
doCommand(Doc, "App.activeDocument().%s.translateLabel('DrawViewPart', 'View', '%s')",
|
||||
FeatName.c_str(), FeatName.c_str());
|
||||
doCommand(Doc, "App.activeDocument().%s.addView(App.activeDocument().%s)", PageName.c_str(),
|
||||
FeatName.c_str());
|
||||
bool createProjGroup = hGrp->GetBool("InsertAsProjGroup", true);
|
||||
if (createProjGroup) {
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Create Projection Group"));
|
||||
|
||||
std::string multiViewName = getUniqueObjectName("ProjGroup");
|
||||
doCommand(Doc, "App.activeDocument().addObject('TechDraw::DrawProjGroup', '%s')",
|
||||
multiViewName.c_str());
|
||||
doCommand(Doc, "App.activeDocument().%s.addView(App.activeDocument().%s)", PageName.c_str(),
|
||||
multiViewName.c_str());
|
||||
|
||||
App::DocumentObject* docObj = getDocument()->getObject(multiViewName.c_str());
|
||||
auto multiView(static_cast<TechDraw::DrawProjGroup*>(docObj));
|
||||
multiView->Source.setValues(shapes);
|
||||
multiView->XSource.setValues(xShapes);
|
||||
doCommand(Doc, "App.activeDocument().%s.addProjection('Front')", multiViewName.c_str());
|
||||
|
||||
App::DocumentObject* docObj = getDocument()->getObject(FeatName.c_str());
|
||||
TechDraw::DrawViewPart* dvp = dynamic_cast<TechDraw::DrawViewPart*>(docObj);
|
||||
if (!dvp) {
|
||||
throw Base::TypeError("CmdTechDrawView DVP not found\n");
|
||||
}
|
||||
dvp->Source.setValues(shapes);
|
||||
dvp->XSource.setValues(xShapes);
|
||||
if (!faceName.empty()) {
|
||||
std::pair<Base::Vector3d, Base::Vector3d> dirs =
|
||||
DrawGuiUtil::getProjDirFromFace(partObj, faceName);
|
||||
projDir = dirs.first;
|
||||
getDocument()->setStatus(App::Document::Status::SkipRecompute, true);
|
||||
doCommand(Doc, "App.activeDocument().%s.Direction = FreeCAD.Vector(%.12f, %.12f, %.12f)",
|
||||
FeatName.c_str(), projDir.x, projDir.y, projDir.z);
|
||||
//do something clever with dirs.second;
|
||||
// dvp->setXDir(dirs.second);
|
||||
doCommand(Doc, "App.activeDocument().%s.XDirection = FreeCAD.Vector(%.12f, %.12f, %.12f)",
|
||||
FeatName.c_str(), dirs.second.x, dirs.second.y, dirs.second.z);
|
||||
doCommand(Doc, "App.activeDocument().%s.recompute()", FeatName.c_str());
|
||||
doCommand(Doc,
|
||||
"App.activeDocument().%s.Anchor.Direction = FreeCAD.Vector(0.0, -1.0, 0.0)",
|
||||
multiViewName.c_str());
|
||||
doCommand(Doc,
|
||||
"App.activeDocument().%s.Anchor.RotationVector = FreeCAD.Vector(1.0, 0.0, 0.0)",
|
||||
multiViewName.c_str());
|
||||
doCommand(Doc,
|
||||
"App.activeDocument().%s.Anchor.XDirection = FreeCAD.Vector(1.0, 0.0, 0.0)",
|
||||
multiViewName.c_str());
|
||||
getDocument()->setStatus(App::Document::Status::SkipRecompute, false);
|
||||
|
||||
doCommand(Doc, "App.activeDocument().%s.Anchor.recompute()", multiViewName.c_str());
|
||||
commitCommand();
|
||||
updateActive();
|
||||
|
||||
// create the rest of the desired views
|
||||
Gui::Control().showDialog(new TaskDlgProjGroup(multiView, true));
|
||||
}
|
||||
else {
|
||||
std::pair<Base::Vector3d, Base::Vector3d> dirs = DrawGuiUtil::get3DDirAndRot();
|
||||
projDir = dirs.first;
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Create view"));
|
||||
std::string FeatName = getUniqueObjectName("View");
|
||||
doCommand(Doc, "App.activeDocument().addObject('TechDraw::DrawViewPart', '%s')",
|
||||
FeatName.c_str());
|
||||
doCommand(Doc, "App.activeDocument().%s.translateLabel('DrawViewPart', 'View', '%s')",
|
||||
FeatName.c_str(), FeatName.c_str());
|
||||
doCommand(Doc, "App.activeDocument().%s.addView(App.activeDocument().%s)", PageName.c_str(),
|
||||
FeatName.c_str());
|
||||
|
||||
App::DocumentObject* docObj = getDocument()->getObject(FeatName.c_str());
|
||||
auto* dvp = dynamic_cast<TechDraw::DrawViewPart*>(docObj);
|
||||
if (!dvp) {
|
||||
throw Base::TypeError("CmdTechDrawView DVP not found\n");
|
||||
}
|
||||
dvp->Source.setValues(shapes);
|
||||
dvp->XSource.setValues(xShapes);
|
||||
|
||||
getDocument()->setStatus(App::Document::Status::SkipRecompute, true);
|
||||
doCommand(Doc, "App.activeDocument().%s.Direction = FreeCAD.Vector(%.12f, %.12f, %.12f)",
|
||||
FeatName.c_str(), projDir.x, projDir.y, projDir.z);
|
||||
doCommand(Doc, "App.activeDocument().%s.XDirection = FreeCAD.Vector(%.12f, %.12f, %.12f)",
|
||||
FeatName.c_str(), dirs.second.x, dirs.second.y, dirs.second.z);
|
||||
// dvp->setXDir(dirs.second);
|
||||
doCommand(Doc, "App.activeDocument().%s.Direction = FreeCAD.Vector(0.0, -1.0, 0.0)",
|
||||
FeatName.c_str());
|
||||
doCommand(Doc, "App.activeDocument().%s.XDirection = FreeCAD.Vector(1.0, 0.0, 0.0)",
|
||||
FeatName.c_str());
|
||||
getDocument()->setStatus(App::Document::Status::SkipRecompute, false);
|
||||
doCommand(Doc, "App.activeDocument().%s.recompute()", FeatName.c_str());
|
||||
commitCommand();
|
||||
|
||||
// create the rest of the desired views
|
||||
Gui::Control().showDialog(new TaskDlgProjGroup(dvp, true));
|
||||
}
|
||||
commitCommand();
|
||||
}
|
||||
|
||||
bool CmdTechDrawView::isActive() { return DrawGuiUtil::needPage(this); }
|
||||
@@ -1106,37 +1127,21 @@ void CmdTechDrawProjectionGroup::activated(int iMsg)
|
||||
multiView->XSource.setValues(xShapes);
|
||||
doCommand(Doc, "App.activeDocument().%s.addProjection('Front')", multiViewName.c_str());
|
||||
|
||||
if (!faceName.empty()) {
|
||||
std::pair<Base::Vector3d, Base::Vector3d> dirs =
|
||||
DrawGuiUtil::getProjDirFromFace(partObj, faceName);
|
||||
getDocument()->setStatus(App::Document::Status::SkipRecompute, true);
|
||||
doCommand(Doc,
|
||||
"App.activeDocument().%s.Anchor.Direction = FreeCAD.Vector(%.12f, %.12f, %.12f)",
|
||||
multiViewName.c_str(), dirs.first.x, dirs.first.y, dirs.first.z);
|
||||
doCommand(
|
||||
Doc,
|
||||
"App.activeDocument().%s.Anchor.RotationVector = FreeCAD.Vector(%.12f, %.12f, %.12f)",
|
||||
multiViewName.c_str(), dirs.second.x, dirs.second.y, dirs.second.z);
|
||||
doCommand(Doc,
|
||||
"App.activeDocument().%s.Anchor.XDirection = FreeCAD.Vector(%.12f, %.12f, %.12f)",
|
||||
multiViewName.c_str(), dirs.second.x, dirs.second.y, dirs.second.z);
|
||||
getDocument()->setStatus(App::Document::Status::SkipRecompute, false);
|
||||
}
|
||||
else {
|
||||
std::pair<Base::Vector3d, Base::Vector3d> dirs = DrawGuiUtil::get3DDirAndRot();
|
||||
getDocument()->setStatus(App::Document::Status::SkipRecompute, true);
|
||||
doCommand(Doc,
|
||||
"App.activeDocument().%s.Anchor.Direction = FreeCAD.Vector(%.12f, %.12f, %.12f)",
|
||||
multiViewName.c_str(), dirs.first.x, dirs.first.y, dirs.first.z);
|
||||
doCommand(
|
||||
Doc,
|
||||
"App.activeDocument().%s.Anchor.RotationVector = FreeCAD.Vector(%.12f, %.12f, %.12f)",
|
||||
multiViewName.c_str(), dirs.second.x, dirs.second.y, dirs.second.z);
|
||||
doCommand(Doc,
|
||||
"App.activeDocument().%s.Anchor.XDirection = FreeCAD.Vector(%.12f, %.12f, %.12f)",
|
||||
multiViewName.c_str(), dirs.second.x, dirs.second.y, dirs.second.z);
|
||||
getDocument()->setStatus(App::Document::Status::SkipRecompute, false);
|
||||
}
|
||||
std::pair<Base::Vector3d, Base::Vector3d> dirs = !faceName.empty() ?
|
||||
DrawGuiUtil::getProjDirFromFace(partObj, faceName)
|
||||
: DrawGuiUtil::get3DDirAndRot();
|
||||
|
||||
getDocument()->setStatus(App::Document::Status::SkipRecompute, true);
|
||||
doCommand(Doc,
|
||||
"App.activeDocument().%s.Anchor.Direction = FreeCAD.Vector(%.12f, %.12f, %.12f)",
|
||||
multiViewName.c_str(), dirs.first.x, dirs.first.y, dirs.first.z);
|
||||
doCommand(Doc,
|
||||
"App.activeDocument().%s.Anchor.RotationVector = FreeCAD.Vector(%.12f, %.12f, %.12f)",
|
||||
multiViewName.c_str(), dirs.second.x, dirs.second.y, dirs.second.z);
|
||||
doCommand(Doc,
|
||||
"App.activeDocument().%s.Anchor.XDirection = FreeCAD.Vector(%.12f, %.12f, %.12f)",
|
||||
multiViewName.c_str(), dirs.second.x, dirs.second.y, dirs.second.z);
|
||||
getDocument()->setStatus(App::Document::Status::SkipRecompute, false);
|
||||
|
||||
doCommand(Doc, "App.activeDocument().%s.Anchor.recompute()", multiViewName.c_str());
|
||||
commitCommand();
|
||||
|
||||
@@ -87,6 +87,7 @@
|
||||
<file>icons/TechDraw_3PtAngleDimension.svg</file>
|
||||
<file>icons/TechDraw_AngleDimension.svg</file>
|
||||
<file>icons/TechDraw_Balloon.svg</file>
|
||||
<file>icons/TechDraw_CameraOrientation.svg</file>
|
||||
<file>icons/TechDraw_DiameterDimension.svg</file>
|
||||
<file>icons/TechDraw_Dimension.svg</file>
|
||||
<file>icons/TechDraw_DimensionRepair.svg</file>
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="64"
|
||||
height="64"
|
||||
viewBox="0 0 64 64"
|
||||
version="1.1"
|
||||
id="svg142"
|
||||
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
|
||||
sodipodi:docname="TechDraw_CameraOrientation.svg"
|
||||
inkscape:version="1.1-beta1 (77e7b44db3, 2021-03-28)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<sodipodi:namedview
|
||||
id="namedview19"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#eeeeee"
|
||||
borderopacity="1"
|
||||
objecttolerance="10.0"
|
||||
gridtolerance="10.0"
|
||||
guidetolerance="10.0"
|
||||
inkscape:pageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
showgrid="false"
|
||||
inkscape:zoom="11.765625"
|
||||
inkscape:cx="32"
|
||||
inkscape:cy="32"
|
||||
inkscape:window-width="3840"
|
||||
inkscape:window-height="1571"
|
||||
inkscape:window-x="-9"
|
||||
inkscape:window-y="-9"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg142" />
|
||||
<metadata
|
||||
id="metadata148">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs146">
|
||||
<linearGradient
|
||||
id="linearGradient1328">
|
||||
<stop
|
||||
id="stop1324"
|
||||
offset="0"
|
||||
style="stop-color:#ffffff;stop-opacity:1" />
|
||||
<stop
|
||||
id="stop1326"
|
||||
offset="1"
|
||||
style="stop-color:#16d0d2;stop-opacity:0;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient1310">
|
||||
<stop
|
||||
style="stop-color:#06989a;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop1306" />
|
||||
<stop
|
||||
style="stop-color:#34e0e2;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop1308" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
xlink:href="#linearGradient1310"
|
||||
id="linearGradient1312"
|
||||
x1="57.636765"
|
||||
y1="50.225197"
|
||||
x2="5.834971"
|
||||
y2="19.189537"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<radialGradient
|
||||
xlink:href="#linearGradient1328"
|
||||
id="radialGradient1322"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.71743104,0.00748738,-0.00738849,0.70797021,9.3050603,6.5739852)"
|
||||
cx="32"
|
||||
cy="35.575535"
|
||||
fx="32"
|
||||
fy="35.575535"
|
||||
r="16" />
|
||||
<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>
|
||||
<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>
|
||||
</defs>
|
||||
<circle
|
||||
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#06989a;stroke-width:2.61091852;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||
id="path907"
|
||||
cx="-14.782197"
|
||||
cy="31.832508"
|
||||
rx="11.694541"
|
||||
ry="12.694541" />
|
||||
<g
|
||||
id="g1166"
|
||||
transform="matrix(0.59922184,0,0,0.59922184,26.083865,-4.6624405)">
|
||||
<path
|
||||
id="path138"
|
||||
d="m 60.689917,49.407377 a 5.2163485,4.9735365 0 0 1 -5.216349,4.973537 H 8.5264316 A 5.2163485,4.9735365 0 0 1 3.310083,49.407377 V 22.052926 A 5.2163485,4.9735365 0 0 1 8.5264316,17.079389 H 18.959129 l 5.216348,-7.4603035 h 15.649046 l 5.216348,7.4603035 h 10.432697 a 5.2163485,4.9735365 0 0 1 5.216349,4.973537 z"
|
||||
style="fill:url(#linearGradient1312);fill-opacity:1;stroke:#000000;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none" />
|
||||
<g
|
||||
transform="translate(0,4)"
|
||||
id="g1160">
|
||||
<circle
|
||||
cx="32"
|
||||
cy="32"
|
||||
id="circle140"
|
||||
style="fill:url(#radialGradient1322);fill-opacity:1;stroke:#000000;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
r="14" />
|
||||
<ellipse
|
||||
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#06989a;stroke-width:1.78571;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||
id="path351"
|
||||
cx="32"
|
||||
cy="32"
|
||||
rx="11.607143"
|
||||
ry="11.607142" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-6.7915007,7.2164799)"
|
||||
id="g421">
|
||||
<path
|
||||
style="fill:url(#linearGradient4001);fill-opacity:1;stroke:#042a2a;stroke-width:2;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:2;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:2;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:2;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>
|
||||
<path
|
||||
style="fill:none;stroke:#e12929;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:4, 4;stroke-dashoffset:0;stroke-opacity:1"
|
||||
d="M 44.961487,16.828685 24.903055,36.802124"
|
||||
id="path908"
|
||||
sodipodi:nodetypes="cc" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.9 KiB |
@@ -27,6 +27,7 @@
|
||||
# include <QMessageBox>
|
||||
#endif // #ifndef _PreComp_
|
||||
|
||||
#include <App/Document.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Gui/Application.h>
|
||||
@@ -36,37 +37,41 @@
|
||||
#include <Gui/WaitCursor.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawPage.h>
|
||||
#include <Mod/TechDraw/App/DrawProjGroupItem.h>
|
||||
#include <Mod/TechDraw/App/DrawView.h>
|
||||
#include <Mod/TechDraw/App/DrawViewPart.h>
|
||||
#include <Mod/TechDraw/App/DrawProjGroup.h>
|
||||
#include <Mod/TechDraw/App/DrawProjGroupItem.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
|
||||
#include "DrawGuiUtil.h"
|
||||
#include "TaskProjGroup.h"
|
||||
#include "ui_TaskProjGroup.h"
|
||||
#include "MDIViewPage.h"
|
||||
#include "ViewProviderPage.h"
|
||||
#include "ViewProviderProjGroup.h"
|
||||
#include "ViewProviderDrawingView.h"
|
||||
|
||||
|
||||
using namespace Gui;
|
||||
using namespace TechDraw;
|
||||
using namespace TechDrawGui;
|
||||
|
||||
TaskProjGroup::TaskProjGroup(TechDraw::DrawProjGroup* featView, bool mode) :
|
||||
TaskProjGroup::TaskProjGroup(TechDraw::DrawView* featView, bool mode) :
|
||||
ui(new Ui_TaskProjGroup),
|
||||
multiView(featView),
|
||||
view(featView),
|
||||
multiView(nullptr),
|
||||
m_createMode(mode)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
blockUpdate = true;
|
||||
multiView = dynamic_cast<TechDraw::DrawProjGroup*>(view);
|
||||
updateUi();
|
||||
|
||||
ui->projection->setCurrentIndex(multiView->ProjectionType.getValue());
|
||||
|
||||
setFractionalScale(multiView->getScale());
|
||||
ui->cmbScaleType->setCurrentIndex(multiView->ScaleType.getValue());
|
||||
setFractionalScale(view->getScale());
|
||||
ui->cmbScaleType->setCurrentIndex(view->ScaleType.getValue());
|
||||
|
||||
//Allow or prevent scale changing initially
|
||||
if (multiView->ScaleType.isValue("Custom")) {
|
||||
if (view->ScaleType.isValue("Custom")) {
|
||||
ui->sbScaleNum->setEnabled(true);
|
||||
ui->sbScaleDen->setEnabled(true);
|
||||
}
|
||||
@@ -75,12 +80,6 @@ TaskProjGroup::TaskProjGroup(TechDraw::DrawProjGroup* featView, bool mode) :
|
||||
ui->sbScaleDen->setEnabled(false);
|
||||
}
|
||||
|
||||
ui->cbAutoDistribute->setChecked(multiView->AutoDistribute.getValue());
|
||||
// disable if no AutoDistribute
|
||||
ui->sbXSpacing->setEnabled(multiView->AutoDistribute.getValue());
|
||||
ui->sbYSpacing->setEnabled(multiView->AutoDistribute.getValue());
|
||||
ui->sbXSpacing->setValue(multiView->spacingX.getValue());
|
||||
ui->sbYSpacing->setValue(multiView->spacingY.getValue());
|
||||
|
||||
// Initially toggle view checkboxes if needed
|
||||
setupViewCheckboxes(true);
|
||||
@@ -95,6 +94,8 @@ TaskProjGroup::TaskProjGroup(TechDraw::DrawProjGroup* featView, bool mode) :
|
||||
connect(ui->butDownRotate, &QPushButton::clicked, this, &TaskProjGroup::rotateButtonClicked);
|
||||
connect(ui->butLeftRotate, &QPushButton::clicked, this, &TaskProjGroup::rotateButtonClicked);
|
||||
connect(ui->butCCWRotate, &QPushButton::clicked, this, &TaskProjGroup::rotateButtonClicked);
|
||||
connect(ui->butFront, &QPushButton::clicked, this, &TaskProjGroup::rotateButtonClicked);
|
||||
connect(ui->butCam, &QPushButton::clicked, this, &TaskProjGroup::rotateButtonClicked);
|
||||
|
||||
// //Reset button
|
||||
// connect(ui->butReset, SIGNAL(clicked()), this, SLOT(onResetClicked()));
|
||||
@@ -120,36 +121,71 @@ TaskProjGroup::TaskProjGroup(TechDraw::DrawProjGroup* featView, bool mode) :
|
||||
ui->sbXSpacing->setUnit(Base::Unit::Length);
|
||||
ui->sbYSpacing->setUnit(Base::Unit::Length);
|
||||
|
||||
m_page = multiView->findParentPage();
|
||||
m_page = view->findParentPage();
|
||||
Gui::Document* activeGui = Gui::Application::Instance->getDocument(m_page->getDocument());
|
||||
Gui::ViewProvider* vp = activeGui->getViewProvider(m_page);
|
||||
ViewProviderPage* dvp = static_cast<ViewProviderPage*>(vp);
|
||||
auto* dvp = static_cast<ViewProviderPage*>(vp);
|
||||
m_mdi = dvp->getMDIViewPage();
|
||||
|
||||
setUiPrimary();
|
||||
saveGroupState();
|
||||
}
|
||||
|
||||
void TaskProjGroup::updateUi()
|
||||
{
|
||||
if (multiView) {
|
||||
setWindowTitle(QObject::tr("Projection Group"));
|
||||
ui->projection->show();
|
||||
ui->cbAutoDistribute->show();
|
||||
ui->sbXSpacing->show();
|
||||
ui->sbYSpacing->show();
|
||||
ui->label_7->show();
|
||||
ui->label_10->show();
|
||||
ui->label_11->show();
|
||||
|
||||
ui->projection->setCurrentIndex(multiView->ProjectionType.getValue());
|
||||
ui->cbAutoDistribute->setChecked(multiView->AutoDistribute.getValue());
|
||||
// disable if no AutoDistribute
|
||||
ui->sbXSpacing->setEnabled(multiView->AutoDistribute.getValue());
|
||||
ui->sbYSpacing->setEnabled(multiView->AutoDistribute.getValue());
|
||||
ui->sbXSpacing->setValue(multiView->spacingX.getValue());
|
||||
ui->sbYSpacing->setValue(multiView->spacingY.getValue());
|
||||
}
|
||||
else {
|
||||
setWindowTitle(QObject::tr("Part View"));
|
||||
ui->projection->hide();
|
||||
ui->cbAutoDistribute->hide();
|
||||
ui->sbXSpacing->hide();
|
||||
ui->sbYSpacing->hide();
|
||||
ui->label_7->hide();
|
||||
ui->label_10->hide();
|
||||
ui->label_11->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void TaskProjGroup::saveGroupState()
|
||||
{
|
||||
// Base::Console().Message("TPG::saveGroupState()\n");
|
||||
if (!multiView)
|
||||
if (!view)
|
||||
return;
|
||||
|
||||
m_saveSource = multiView->Source.getValues();
|
||||
m_saveProjType = multiView->ProjectionType.getValueAsString();
|
||||
m_saveScaleType = multiView->ScaleType.getValueAsString();
|
||||
m_saveScale = multiView->Scale.getValue();
|
||||
m_saveAutoDistribute = multiView->AutoDistribute.getValue();
|
||||
m_saveSpacingX = multiView->spacingX.getValue();
|
||||
m_saveSpacingY = multiView->spacingY.getValue();
|
||||
DrawProjGroupItem* anchor = multiView->getAnchor();
|
||||
m_saveDirection = anchor->Direction.getValue();
|
||||
m_saveScaleType = view->ScaleType.getValueAsString();
|
||||
m_saveScale = view->Scale.getValue();
|
||||
|
||||
for( const auto it : multiView->Views.getValues() ) {
|
||||
auto view( dynamic_cast<DrawProjGroupItem *>(it) );
|
||||
if (view) {
|
||||
m_saveViewNames.emplace_back(view->Type.getValueAsString());
|
||||
if (multiView) {
|
||||
m_saveSource = multiView->Source.getValues();
|
||||
m_saveProjType = multiView->ProjectionType.getValueAsString();
|
||||
m_saveAutoDistribute = multiView->AutoDistribute.getValue();
|
||||
m_saveSpacingX = multiView->spacingX.getValue();
|
||||
m_saveSpacingY = multiView->spacingY.getValue();
|
||||
DrawProjGroupItem* anchor = multiView->getAnchor();
|
||||
m_saveDirection = anchor->Direction.getValue();
|
||||
|
||||
for( const auto it : multiView->Views.getValues() ) {
|
||||
auto view( dynamic_cast<DrawProjGroupItem *>(it) );
|
||||
if (view) {
|
||||
m_saveViewNames.emplace_back(view->Type.getValueAsString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,19 +194,22 @@ void TaskProjGroup::saveGroupState()
|
||||
void TaskProjGroup::restoreGroupState()
|
||||
{
|
||||
Base::Console().Message("TPG::restoreGroupState()\n");
|
||||
if (!multiView)
|
||||
if (!view)
|
||||
return;
|
||||
|
||||
multiView->ProjectionType.setValue(m_saveProjType.c_str());
|
||||
multiView->ScaleType.setValue(m_saveScaleType.c_str());
|
||||
multiView->Scale.setValue(m_saveScale);
|
||||
multiView->AutoDistribute.setValue(m_saveAutoDistribute);
|
||||
multiView->spacingX.setValue(m_saveSpacingX);
|
||||
multiView->spacingY.setValue(m_saveSpacingY);
|
||||
multiView->purgeProjections();
|
||||
for(auto & sv : m_saveViewNames) {
|
||||
if (sv != "Front") {
|
||||
multiView->addProjection(sv.c_str());
|
||||
view->ScaleType.setValue(m_saveScaleType.c_str());
|
||||
view->Scale.setValue(m_saveScale);
|
||||
|
||||
if (multiView) {
|
||||
multiView->ProjectionType.setValue(m_saveProjType.c_str());
|
||||
multiView->AutoDistribute.setValue(m_saveAutoDistribute);
|
||||
multiView->spacingX.setValue(m_saveSpacingX);
|
||||
multiView->spacingY.setValue(m_saveSpacingY);
|
||||
multiView->purgeProjections();
|
||||
for(auto & sv : m_saveViewNames) {
|
||||
if (sv != "Front") {
|
||||
multiView->addProjection(sv.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -180,42 +219,147 @@ void TaskProjGroup::viewToggled(bool toggle)
|
||||
Gui::WaitCursor wc;
|
||||
bool changed = false;
|
||||
// Obtain name of checkbox
|
||||
QString viewName = sender()->objectName();
|
||||
int index = viewName.mid(7).toInt();
|
||||
int index = sender()->objectName().mid(7).toInt();
|
||||
const char *viewNameCStr = viewChkIndexToCStr(index);
|
||||
if ( toggle && !multiView->hasProjection( viewNameCStr ) ) {
|
||||
|
||||
if (multiView) {
|
||||
// Check if only front is now available. If so switch to normal view.
|
||||
}
|
||||
else {
|
||||
// If toggle then we remove the view object and create a proj group instead.
|
||||
|
||||
App::Document* doc = view->getDocument();
|
||||
|
||||
std::string multiViewName = doc->getUniqueObjectName("ProjGroup");
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "App.activeDocument().addObject('TechDraw::DrawProjGroup', '%s')", multiViewName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "App.activeDocument().%s.addView(App.activeDocument().%s)", view->findParentPage()->getNameInDocument(), multiViewName.c_str());
|
||||
|
||||
auto* viewPart = static_cast<TechDraw::DrawViewPart*>(view);
|
||||
multiView = static_cast<TechDraw::DrawProjGroup*>(doc->getObject(multiViewName.c_str()));
|
||||
multiView->Source.setValues(viewPart->Source.getValues());
|
||||
multiView->XSource.setValues(viewPart->XSource.getValues());
|
||||
multiView->X.setValue(viewPart->X.getValue());
|
||||
multiView->Y.setValue(viewPart->Y.getValue());
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "App.activeDocument().%s.addProjection('Front')", multiViewName.c_str());
|
||||
|
||||
Base::Vector3d dir1 = viewPart->Direction.getValue();
|
||||
Base::Vector3d dir2 = viewPart->XDirection.getValue();
|
||||
|
||||
doc->setStatus(App::Document::Status::SkipRecompute, true);
|
||||
Gui::Command::doCommand(Gui::Command::Gui,
|
||||
"App.activeDocument().%s.Anchor.Direction = FreeCAD.Vector(%.12f, %.12f, %.12f)",
|
||||
multiViewName.c_str(), dir1.x, dir1.y, dir1.z);
|
||||
Gui::Command::doCommand(Gui::Command::Gui,
|
||||
"App.activeDocument().%s.Anchor.RotationVector = FreeCAD.Vector(%.12f, %.12f, %.12f)",
|
||||
multiViewName.c_str(), dir2.x, dir2.y, dir2.z);
|
||||
Gui::Command::doCommand(Gui::Command::Gui,
|
||||
"App.activeDocument().%s.Anchor.XDirection = FreeCAD.Vector(%.12f, %.12f, %.12f)",
|
||||
multiViewName.c_str(), dir2.x, dir2.y, dir2.z);
|
||||
doc->setStatus(App::Document::Status::SkipRecompute, false);
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "App.activeDocument().%s.Anchor.recompute()", multiViewName.c_str());
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "App.activeDocument().removeObject('%s')", view->getNameInDocument());
|
||||
view = multiView;
|
||||
|
||||
updateUi();
|
||||
}
|
||||
|
||||
|
||||
if (toggle && !multiView->hasProjection(viewNameCStr)) {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.activeDocument().%s.addProjection('%s')",
|
||||
multiView->getNameInDocument(), viewNameCStr);
|
||||
changed = true;
|
||||
} else if ( !toggle && multiView->hasProjection( viewNameCStr ) ) {
|
||||
}
|
||||
else if (!toggle && multiView->hasProjection(viewNameCStr)) {
|
||||
if (multiView->canDelete(viewNameCStr)) {
|
||||
multiView->removeProjection( viewNameCStr );
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
if (multiView->ScaleType.isValue("Automatic")) {
|
||||
double scale = multiView->getScale();
|
||||
if (view->ScaleType.isValue("Automatic")) {
|
||||
double scale = view->getScale();
|
||||
setFractionalScale(scale);
|
||||
}
|
||||
multiView->recomputeFeature();
|
||||
view->recomputeFeature();
|
||||
}
|
||||
wc.restoreCursor();
|
||||
}
|
||||
|
||||
void TaskProjGroup::rotateButtonClicked()
|
||||
{
|
||||
if ( multiView && ui ) {
|
||||
if ( view && ui ) {
|
||||
const QObject *clicked = sender();
|
||||
|
||||
//change Front View Dir by 90
|
||||
if ( clicked == ui->butTopRotate ) multiView->rotate("Up");
|
||||
else if (clicked == ui->butDownRotate) multiView->rotate("Down");
|
||||
else if (clicked == ui->butRightRotate) multiView->rotate("Right");
|
||||
else if (clicked == ui->butLeftRotate) multiView->rotate("Left");
|
||||
else if (clicked == ui->butCWRotate ) multiView->spin("CW");
|
||||
else if (clicked == ui->butCCWRotate) multiView->spin("CCW");
|
||||
auto handleCameraButton = [&]() {
|
||||
std::string faceName;
|
||||
App::DocumentObject* obj = nullptr;
|
||||
auto selection = Gui::Command::getSelection().getSelectionEx();
|
||||
for (auto& sel : selection) {
|
||||
for (auto& sub : sel.getSubNames()) {
|
||||
if (TechDraw::DrawUtil::getGeomTypeFromName(sub) == "Face") {
|
||||
obj = sel.getObject();
|
||||
faceName = sub;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!faceName.empty()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::pair<Base::Vector3d, Base::Vector3d> dirs = !faceName.empty() ?
|
||||
DrawGuiUtil::getProjDirFromFace(obj, faceName)
|
||||
: DrawGuiUtil::get3DDirAndRot();
|
||||
return dirs;
|
||||
};
|
||||
|
||||
if (multiView) {
|
||||
//change Front View Dir by 90
|
||||
if (clicked == ui->butTopRotate) multiView->rotate("Up");
|
||||
else if (clicked == ui->butDownRotate) multiView->rotate("Down");
|
||||
else if (clicked == ui->butRightRotate) multiView->rotate("Right");
|
||||
else if (clicked == ui->butLeftRotate) multiView->rotate("Left");
|
||||
else if (clicked == ui->butCWRotate) multiView->spin("CW");
|
||||
else if (clicked == ui->butCCWRotate) multiView->spin("CCW");
|
||||
else if (clicked == ui->butFront) {
|
||||
multiView->getAnchor()->Direction.setValue(Base::Vector3d(0.0, -1.0, 0.0));
|
||||
multiView->getAnchor()->RotationVector.setValue(Base::Vector3d(1.0, 0.0, 0.0));
|
||||
multiView->getAnchor()->XDirection.setValue(Base::Vector3d(1.0, 0.0, 0.0));
|
||||
multiView->updateSecondaryDirs();
|
||||
}
|
||||
else if (clicked == ui->butCam) {
|
||||
std::pair<Base::Vector3d, Base::Vector3d> dirs = handleCameraButton();
|
||||
multiView->getAnchor()->Direction.setValue(dirs.first);
|
||||
multiView->getAnchor()->RotationVector.setValue(dirs.second);
|
||||
multiView->getAnchor()->XDirection.setValue(dirs.second);
|
||||
multiView->updateSecondaryDirs();
|
||||
}
|
||||
}
|
||||
else {
|
||||
auto* viewPart = static_cast<TechDraw::DrawViewPart*>(view);
|
||||
if (clicked == ui->butTopRotate) viewPart->rotate("Up");
|
||||
else if (clicked == ui->butDownRotate) viewPart->rotate("Down");
|
||||
else if (clicked == ui->butRightRotate) viewPart->rotate("Right");
|
||||
else if (clicked == ui->butLeftRotate) viewPart->rotate("Left");
|
||||
else if (clicked == ui->butCWRotate) viewPart->spin("CW");
|
||||
else if (clicked == ui->butCCWRotate) viewPart->spin("CCW");
|
||||
else if (clicked == ui->butFront) {
|
||||
viewPart->Direction.setValue(Base::Vector3d(0.0,-1.0,0.0));
|
||||
viewPart->XDirection.setValue(Base::Vector3d(1.0, 0.0, 0.0));
|
||||
viewPart->recomputeFeature();
|
||||
}
|
||||
else if (clicked == ui->butCam) {
|
||||
std::pair<Base::Vector3d, Base::Vector3d> dirs = handleCameraButton();
|
||||
|
||||
viewPart->Direction.setValue(dirs.first);
|
||||
viewPart->XDirection.setValue(dirs.second);
|
||||
viewPart->recomputeFeature();
|
||||
}
|
||||
}
|
||||
|
||||
setUiPrimary();
|
||||
}
|
||||
@@ -224,7 +368,7 @@ void TaskProjGroup::rotateButtonClicked()
|
||||
//void TaskProjGroup::projectionTypeChanged(int index)
|
||||
void TaskProjGroup::projectionTypeChanged(QString qText)
|
||||
{
|
||||
if(blockUpdate) {
|
||||
if(blockUpdate || !multiView) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -250,7 +394,7 @@ void TaskProjGroup::projectionTypeChanged(QString qText)
|
||||
ui->chkView8->setToolTip(getToolTipForBox(8));
|
||||
ui->chkView9->setToolTip(getToolTipForBox(9));
|
||||
|
||||
multiView->recomputeFeature();
|
||||
view->recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskProjGroup::scaleTypeChanged(int index)
|
||||
@@ -264,33 +408,35 @@ void TaskProjGroup::scaleTypeChanged(int index)
|
||||
|
||||
if (index == 0) {
|
||||
// Document Scale Type
|
||||
multiView->ScaleType.setValue("Page");
|
||||
} else if (index == 1) {
|
||||
view->ScaleType.setValue("Page");
|
||||
}
|
||||
else if (index == 1) {
|
||||
// Automatic Scale Type
|
||||
//block recompute
|
||||
multiView->ScaleType.setValue("Automatic");
|
||||
double autoScale = multiView->autoScale();
|
||||
multiView->Scale.setValue(autoScale);
|
||||
view->ScaleType.setValue("Automatic");
|
||||
double autoScale = view->autoScale();
|
||||
view->Scale.setValue(autoScale);
|
||||
//unblock recompute
|
||||
|
||||
} else if (index == 2) {
|
||||
}
|
||||
else if (index == 2) {
|
||||
// Custom Scale Type
|
||||
//block recompute
|
||||
multiView->ScaleType.setValue("Custom");
|
||||
view->ScaleType.setValue("Custom");
|
||||
ui->sbScaleNum->setEnabled(true);
|
||||
ui->sbScaleDen->setEnabled(true);
|
||||
|
||||
int a = ui->sbScaleNum->value();
|
||||
int b = ui->sbScaleDen->value();
|
||||
double scale = (double) a / (double) b;
|
||||
multiView->Scale.setValue(scale);
|
||||
view->Scale.setValue(scale);
|
||||
//unblock recompute
|
||||
}
|
||||
}
|
||||
|
||||
void TaskProjGroup::AutoDistributeClicked(bool clicked)
|
||||
{
|
||||
if (blockUpdate) {
|
||||
if (blockUpdate || !multiView) {
|
||||
return;
|
||||
}
|
||||
multiView->AutoDistribute.setValue(clicked);
|
||||
@@ -299,7 +445,7 @@ void TaskProjGroup::AutoDistributeClicked(bool clicked)
|
||||
|
||||
void TaskProjGroup::spacingChanged()
|
||||
{
|
||||
if (blockUpdate) {
|
||||
if (blockUpdate || !multiView) {
|
||||
return;
|
||||
}
|
||||
multiView->spacingX.setValue(ui->sbXSpacing->value().getValue());
|
||||
@@ -311,10 +457,10 @@ void TaskProjGroup::updateTask()
|
||||
{
|
||||
// Update the scale type
|
||||
blockUpdate = true;
|
||||
ui->cmbScaleType->setCurrentIndex(multiView->ScaleType.getValue());
|
||||
ui->cmbScaleType->setCurrentIndex(view->ScaleType.getValue());
|
||||
|
||||
// Update the scale value
|
||||
setFractionalScale(multiView->getScale());
|
||||
setFractionalScale(view->getScale());
|
||||
|
||||
blockUpdate = false;
|
||||
}
|
||||
@@ -336,7 +482,7 @@ void TaskProjGroup::scaleManuallyChanged(int unused)
|
||||
Q_UNUSED(unused);
|
||||
if(blockUpdate)
|
||||
return;
|
||||
if (!multiView->ScaleType.isValue("Custom")) { //ignore if not custom!
|
||||
if (!view->ScaleType.isValue("Custom")) { //ignore if not custom!
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -345,9 +491,9 @@ void TaskProjGroup::scaleManuallyChanged(int unused)
|
||||
|
||||
double scale = (double) a / (double) b;
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.activeDocument().%s.Scale = %f", multiView->getNameInDocument()
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.activeDocument().%s.Scale = %f", view->getNameInDocument()
|
||||
, scale);
|
||||
multiView->recomputeFeature();
|
||||
view->recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskProjGroup::changeEvent(QEvent *event)
|
||||
@@ -366,9 +512,8 @@ const char * TaskProjGroup::viewChkIndexToCStr(int index)
|
||||
// First Angle: FBRight B FBL
|
||||
// Right F L Rear
|
||||
// FTRight T FTL
|
||||
assert (multiView);
|
||||
|
||||
bool thirdAngle = multiView->usedProjectionType().isValue("Third Angle");
|
||||
bool thirdAngle = multiView ? multiView->usedProjectionType().isValue("Third Angle") : false;
|
||||
switch(index) {
|
||||
case 0: return (thirdAngle ? "FrontTopLeft" : "FrontBottomRight");
|
||||
case 1: return (thirdAngle ? "Top" : "Bottom");
|
||||
@@ -386,7 +531,7 @@ const char * TaskProjGroup::viewChkIndexToCStr(int index)
|
||||
|
||||
QString TaskProjGroup::getToolTipForBox(int boxNumber)
|
||||
{
|
||||
bool thirdAngle = multiView->usedProjectionType().isValue("Third Angle");
|
||||
bool thirdAngle = multiView ? multiView->usedProjectionType().isValue("Third Angle") : false;
|
||||
switch(boxNumber) {
|
||||
case 0: {return (thirdAngle ? tr("FrontTopLeft") : tr("FrontBottomRight")); break;}
|
||||
case 1: {return (thirdAngle ? tr("Top") : tr("Bottom")); break;}
|
||||
@@ -404,7 +549,7 @@ QString TaskProjGroup::getToolTipForBox(int boxNumber)
|
||||
|
||||
void TaskProjGroup::setupViewCheckboxes(bool addConnections)
|
||||
{
|
||||
if (!multiView)
|
||||
if (!view)
|
||||
return;
|
||||
|
||||
// There must be a better way to construct this list...
|
||||
@@ -419,29 +564,44 @@ void TaskProjGroup::setupViewCheckboxes(bool addConnections)
|
||||
ui->chkView8,
|
||||
ui->chkView9 };
|
||||
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
QCheckBox *box = viewCheckboxes[i];
|
||||
box->setToolTip(getToolTipForBox(i));
|
||||
const char *viewStr = viewChkIndexToCStr(i);
|
||||
|
||||
if (!multiView) {
|
||||
box->setCheckState(viewStr == "Front" ? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
|
||||
if (addConnections) {
|
||||
connect(box, &QCheckBox::toggled, this, &TaskProjGroup::viewToggled);
|
||||
}
|
||||
|
||||
const char *viewStr = viewChkIndexToCStr(i);
|
||||
if (viewStr && multiView->hasProjection(viewStr)) {
|
||||
box->setCheckState(Qt::Checked);
|
||||
if (!multiView->canDelete(viewStr)) {
|
||||
box->setEnabled(false);
|
||||
if (multiView) {
|
||||
if (viewStr && multiView->hasProjection(viewStr)) {
|
||||
box->setCheckState(Qt::Checked);
|
||||
if (!multiView->canDelete(viewStr)) {
|
||||
box->setEnabled(false);
|
||||
}
|
||||
} else {
|
||||
box->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
} else {
|
||||
box->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
box->setToolTip(getToolTipForBox(i));
|
||||
}
|
||||
}
|
||||
|
||||
void TaskProjGroup::setUiPrimary()
|
||||
{
|
||||
Base::Vector3d frontDir = multiView->getAnchorDirection();
|
||||
Base::Vector3d frontDir;
|
||||
if (multiView) {
|
||||
frontDir = multiView->getAnchorDirection();
|
||||
}
|
||||
else {
|
||||
auto* viewPart = static_cast<TechDraw::DrawViewPart*>(view);
|
||||
if (viewPart) {
|
||||
frontDir = viewPart->Direction.getValue();
|
||||
}
|
||||
}
|
||||
ui->lePrimary->setText(formatVector(frontDir));
|
||||
}
|
||||
|
||||
@@ -467,8 +627,10 @@ void TaskProjGroup::saveButtons(QPushButton* btnOK,
|
||||
bool TaskProjGroup::apply()
|
||||
{
|
||||
// Base::Console().Message("TPG::apply()\n");
|
||||
multiView->recomputeChildren();
|
||||
multiView->recomputeFeature();
|
||||
if (multiView) {
|
||||
multiView->recomputeChildren();
|
||||
}
|
||||
view->recomputeFeature();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -476,12 +638,14 @@ bool TaskProjGroup::apply()
|
||||
bool TaskProjGroup::accept()
|
||||
{
|
||||
// Base::Console().Message("TPG::accept()\n");
|
||||
Gui::Document* doc = Gui::Application::Instance->getDocument(multiView->getDocument());
|
||||
Gui::Document* doc = Gui::Application::Instance->getDocument(view->getDocument());
|
||||
if (!doc)
|
||||
return false;
|
||||
|
||||
multiView->recomputeChildren();
|
||||
multiView->recomputeFeature();
|
||||
if (multiView) {
|
||||
multiView->recomputeChildren();
|
||||
}
|
||||
view->recomputeFeature();
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.ActiveDocument.resetEdit()");
|
||||
|
||||
@@ -490,28 +654,31 @@ bool TaskProjGroup::accept()
|
||||
|
||||
bool TaskProjGroup::reject()
|
||||
{
|
||||
Gui::Document* doc = Gui::Application::Instance->getDocument(multiView->getDocument());
|
||||
Gui::Document* doc = Gui::Application::Instance->getDocument(view->getDocument());
|
||||
if (!doc)
|
||||
return false;
|
||||
|
||||
if (getCreateMode()) {
|
||||
//remove the object completely from the document
|
||||
std::string multiViewName = multiView->getNameInDocument();
|
||||
std::string PageName = multiView->findParentPage()->getNameInDocument();
|
||||
const char* viewName = view->getNameInDocument();
|
||||
const char* PageName = view->findParentPage()->getNameInDocument();
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "App.activeDocument().%s.purgeProjections()",
|
||||
multiViewName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "App.activeDocument().%s.removeView(App.activeDocument().%s)",
|
||||
PageName.c_str(), multiViewName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "App.activeDocument().removeObject('%s')", multiViewName.c_str());
|
||||
if (multiView) {
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "App.activeDocument().%s.purgeProjections()",
|
||||
viewName);
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "App.activeDocument().%s.removeView(App.activeDocument().%s)",
|
||||
PageName, viewName);
|
||||
}
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "App.activeDocument().removeObject('%s')", viewName);
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.ActiveDocument.resetEdit()");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
//set the DPG and its views back to entry state.
|
||||
if (Gui::Command::hasPendingCommand()) {
|
||||
Gui::Command::abortCommand();
|
||||
// std::vector<std::string> undos = Gui::Application::Instance->activeDocument()->getUndoVector();
|
||||
// Gui::Application::Instance->activeDocument()->undo(1);
|
||||
// multiView->rebuildViewList();
|
||||
// view->rebuildViewList();
|
||||
// apply();
|
||||
}
|
||||
}
|
||||
@@ -521,12 +688,12 @@ bool TaskProjGroup::reject()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//TODO: Do we really need to hang on to the TaskDlgProjGroup in this class? IR
|
||||
TaskDlgProjGroup::TaskDlgProjGroup(TechDraw::DrawProjGroup* featView, bool mode)
|
||||
TaskDlgProjGroup::TaskDlgProjGroup(TechDraw::DrawView* featView, bool mode)
|
||||
: TaskDialog()
|
||||
, viewProvider(nullptr)
|
||||
, multiView(featView)
|
||||
, view(featView)
|
||||
{
|
||||
//viewProvider = dynamic_cast<const ViewProviderProjGroup *>(featView);
|
||||
//viewProvider = dynamic_cast<const ViewProviderDrawingView *>(featView);
|
||||
widget = new TaskProjGroup(featView, mode);
|
||||
taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/TechDraw_ProjectionGroup"),
|
||||
widget->windowTitle(), true, nullptr);
|
||||
@@ -559,8 +726,13 @@ void TaskDlgProjGroup::modifyStandardButtons(QDialogButtonBox* box)
|
||||
//==== calls from the TaskView ===============================================================
|
||||
void TaskDlgProjGroup::open()
|
||||
{
|
||||
if (!widget->getCreateMode()) { //this is an edit session, start a transaction
|
||||
App::GetApplication().setActiveTransaction("Edit Projection Group", true);
|
||||
if (!widget->getCreateMode()) { //this is an edit session, start a transaction
|
||||
if (dynamic_cast<TechDraw::DrawProjGroup*>(view)) {
|
||||
App::GetApplication().setActiveTransaction("Edit Projection Group", true);
|
||||
}
|
||||
else {
|
||||
App::GetApplication().setActiveTransaction("Edit Part View", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
|
||||
namespace TechDraw {
|
||||
class DrawView;
|
||||
class DrawProjGroup;
|
||||
class DrawPage;
|
||||
}
|
||||
@@ -41,14 +42,14 @@ namespace TechDrawGui
|
||||
{
|
||||
class MDIViewPage;
|
||||
class Ui_TaskProjGroup;
|
||||
class ViewProviderProjGroup;
|
||||
class ViewProviderDrawingView;
|
||||
|
||||
class TaskProjGroup : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskProjGroup(TechDraw::DrawProjGroup* featView, bool mode);
|
||||
TaskProjGroup(TechDraw::DrawView* featView, bool mode);
|
||||
~TaskProjGroup() override = default;
|
||||
|
||||
virtual bool accept();
|
||||
@@ -77,6 +78,7 @@ protected:
|
||||
void setUiPrimary();
|
||||
void saveGroupState();
|
||||
void restoreGroupState();
|
||||
void updateUi();
|
||||
|
||||
QString formatVector(Base::Vector3d vec);
|
||||
|
||||
@@ -98,6 +100,7 @@ private:
|
||||
MDIViewPage* m_mdi;
|
||||
|
||||
std::unique_ptr<Ui_TaskProjGroup> ui;
|
||||
TechDraw::DrawView* view;
|
||||
TechDraw::DrawProjGroup* multiView;
|
||||
bool m_createMode;
|
||||
|
||||
@@ -126,11 +129,11 @@ class TaskDlgProjGroup : public Gui::TaskView::TaskDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskDlgProjGroup(TechDraw::DrawProjGroup* featView, bool mode);
|
||||
TaskDlgProjGroup(TechDraw::DrawView* featView, bool mode);
|
||||
~TaskDlgProjGroup() override;
|
||||
|
||||
const ViewProviderProjGroup * getViewProvider() const { return viewProvider; }
|
||||
TechDraw::DrawProjGroup * getMultiView() const { return multiView; }
|
||||
const ViewProviderDrawingView* getViewProvider() const { return viewProvider; }
|
||||
TechDraw::DrawView* getView() const { return view; }
|
||||
|
||||
QDialogButtonBox::StandardButtons getStandardButtons() const override
|
||||
{ return QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel; }
|
||||
@@ -152,8 +155,8 @@ public:
|
||||
void update();
|
||||
|
||||
protected:
|
||||
const ViewProviderProjGroup *viewProvider;
|
||||
TechDraw::DrawProjGroup *multiView;
|
||||
const ViewProviderDrawingView *viewProvider;
|
||||
TechDraw::DrawView* view;
|
||||
|
||||
private:
|
||||
TaskProjGroup * widget;
|
||||
|
||||
@@ -26,39 +26,6 @@
|
||||
<string>Projection Group</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Projection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="projection">
|
||||
<property name="toolTip">
|
||||
<string>First or Third Angle</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>First Angle</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Third Angle</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Page</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
@@ -90,17 +57,6 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="0,0,1,0,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Custom Scale</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
@@ -176,7 +132,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Adjust Primary Direction</string>
|
||||
<string>Adjust Direction</string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
@@ -193,6 +149,27 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="butCWRotate">
|
||||
<property name="toolTip">
|
||||
<string>Spin clock wise</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/arrow-cw.svg</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="butTopRotate">
|
||||
<property name="sizePolicy">
|
||||
@@ -220,6 +197,27 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="butCCWRotate">
|
||||
<property name="toolTip">
|
||||
<string>Spin counter clock wise</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/arrow-ccw.svg</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="butLeftRotate">
|
||||
<property name="toolTip">
|
||||
@@ -290,17 +288,25 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<widget class="QPushButton" name="butFront">
|
||||
<property name="toolTip">
|
||||
<string>Set document front view as primary direction.</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/view-front.svg</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="butDownRotate">
|
||||
@@ -324,17 +330,25 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<widget class="QPushButton" name="butCam">
|
||||
<property name="toolTip">
|
||||
<string>Set direction of the camera, or selected face if any, as primary direction.</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/TechDraw_CameraOrientation.svg</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@@ -575,76 +589,36 @@ height: 24px;
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="butCWRotate">
|
||||
<property name="toolTip">
|
||||
<string>Spin CW</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/arrow-cw.svg</normalon>
|
||||
</iconset>
|
||||
<string>Projection</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="butCCWRotate">
|
||||
<widget class="QComboBox" name="projection">
|
||||
<property name="toolTip">
|
||||
<string>Spin CCW</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/arrow-ccw.svg</normalon>
|
||||
</iconset>
|
||||
<string>First or Third Angle</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>First Angle</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Third Angle</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Page</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#include "PreferencesGui.h"
|
||||
#include "QGIView.h"
|
||||
#include "TaskDetail.h"
|
||||
#include "TaskProjGroup.h"
|
||||
#include "ViewProviderViewPart.h"
|
||||
#include "ViewProviderPage.h"
|
||||
#include "QGIViewDimension.h"
|
||||
@@ -264,6 +265,10 @@ bool ViewProviderViewPart::setEdit(int ModNum)
|
||||
if (Gui::Control().activeDialog()) { //TaskPanel already open!
|
||||
return false;
|
||||
}
|
||||
|
||||
// clear the selection (convenience)
|
||||
Gui::Selection().clearSelection();
|
||||
|
||||
TechDraw::DrawViewPart* dvp = getViewObject();
|
||||
TechDraw::DrawViewDetail* dvd = dynamic_cast<TechDraw::DrawViewDetail*>(dvp);
|
||||
if (dvd) {
|
||||
@@ -271,13 +276,15 @@ bool ViewProviderViewPart::setEdit(int ModNum)
|
||||
Base::Console().Error("DrawViewDetail - %s - has no BaseView!\n", dvd->getNameInDocument());
|
||||
return false;
|
||||
}
|
||||
// clear the selection (convenience)
|
||||
Gui::Selection().clearSelection();
|
||||
Gui::Control().showDialog(new TaskDlgDetail(dvd));
|
||||
Gui::Selection().clearSelection();
|
||||
Gui::Selection().addSelection(dvd->getDocument()->getName(),
|
||||
dvd->getNameInDocument());
|
||||
}
|
||||
else {
|
||||
auto* view = dynamic_cast<TechDraw::DrawView*>(getObject());
|
||||
Gui::Control().showDialog(new TaskDlgProjGroup(view, false));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -294,7 +294,6 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
*views << "TechDraw_View";
|
||||
*views << "TechDraw_BrokenView";
|
||||
*views << "TechDraw_ActiveView";
|
||||
*views << "TechDraw_ProjectionGroup";
|
||||
*views << "TechDraw_SectionGroup";
|
||||
*views << "TechDraw_DetailView";
|
||||
*views << "TechDraw_DraftView";
|
||||
@@ -397,7 +396,6 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const
|
||||
views->setCommand("Views");
|
||||
*views << "TechDraw_View";
|
||||
*views << "TechDraw_ActiveView";
|
||||
*views << "TechDraw_ProjectionGroup";
|
||||
*views << "TechDraw_SectionGroup";
|
||||
*views << "TechDraw_DetailView";
|
||||
*views << "TechDraw_DraftView";
|
||||
|
||||
Reference in New Issue
Block a user