[TD]harmonize Arrow enums
This commit is contained in:
52
src/Mod/TechDraw/App/ArrowPropEnum.cpp
Normal file
52
src/Mod/TechDraw/App/ArrowPropEnum.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2020 WandererFan <wandererfan@gmail.com> *
|
||||
* *
|
||||
* 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 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
#endif
|
||||
|
||||
#include "ArrowPropEnum.h"
|
||||
|
||||
namespace TechDraw {
|
||||
|
||||
const int ArrowPropEnum::ArrowCount = 8;
|
||||
const char* ArrowPropEnum::ArrowTypeEnums[]= { "NONE",
|
||||
"FILLED_ARROW",
|
||||
"OPEN_ARROW",
|
||||
"TICK",
|
||||
"DOT",
|
||||
"OPEN_CIRCLE",
|
||||
"FORK",
|
||||
"FILLED_TRIANGLE",
|
||||
NULL};
|
||||
|
||||
const std::vector<std::string> ArrowPropEnum::ArrowTypeIcons = { ":icons/arrownone.svg",
|
||||
":icons/arrowfilled.svg",
|
||||
":icons/arrowopen.svg",
|
||||
":icons/arrowtick.svg",
|
||||
":icons/arrowdot.svg",
|
||||
":icons/arrowopendot.svg",
|
||||
":icons/arrowfork.svg",
|
||||
":icons/arrowpyramid.svg"};
|
||||
|
||||
}
|
||||
56
src/Mod/TechDraw/App/ArrowPropEnum.h
Normal file
56
src/Mod/TechDraw/App/ArrowPropEnum.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2020 WandererFan <wandererfan@gmail.com> *
|
||||
* *
|
||||
* 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 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _ARROWENUMS_H_
|
||||
#define _ARROWENUMS_H_
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace TechDraw
|
||||
{
|
||||
|
||||
//common definitions for line ends / arrows
|
||||
enum ArrowType { NONE = 0,
|
||||
FILLED_ARROW,
|
||||
OPEN_ARROW,
|
||||
TICK,
|
||||
DOT,
|
||||
OPEN_CIRCLE,
|
||||
FORK,
|
||||
FILLED_TRIANGLE };
|
||||
|
||||
class TechDrawExport ArrowPropEnum {
|
||||
public:
|
||||
|
||||
static const char* ArrowTypeEnums[];
|
||||
static const int ArrowCount;
|
||||
static const std::vector<std::string> ArrowTypeIcons;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
} //end namespace TechDraw
|
||||
#endif
|
||||
@@ -153,6 +153,8 @@ SET(TechDraw_SRCS
|
||||
DrawProjectSplit.h
|
||||
LineGroup.cpp
|
||||
LineGroup.h
|
||||
ArrowPropEnum.cpp
|
||||
ArrowPropEnum.h
|
||||
)
|
||||
|
||||
SET(Geometry_SRCS
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include <Mod/TechDraw/App/DrawLeaderLinePy.h> // generated from DrawLeaderLinePy.xml
|
||||
#include "DrawLeaderLine.h"
|
||||
#include "ArrowPropEnum.h"
|
||||
|
||||
using namespace TechDraw;
|
||||
|
||||
@@ -45,6 +46,26 @@ using namespace TechDraw;
|
||||
|
||||
PROPERTY_SOURCE(TechDraw::DrawLeaderLine, TechDraw::DrawView)
|
||||
|
||||
//TODO: share this between DrawViewBalloon, DrawLeaderLine, QGIArrow, Prefs, etc
|
||||
//const char* DrawLeaderLine::ArrowTypeEnums[]= { "NONE",
|
||||
// "FILLED_ARROW",
|
||||
// "OPEN_ARROW",
|
||||
// "TICK",
|
||||
// "DOT",
|
||||
// "OPEN_CIRCLE",
|
||||
// "FORK",
|
||||
// "FILLED_TRIANGLE",
|
||||
// NULL};
|
||||
//const char* DrawLeaderLine::ArrowTypeEnums2[]= { "NONE",
|
||||
// "FILLED_ARROW",
|
||||
// "OPEN_ARROW",
|
||||
// "TICK",
|
||||
// "DOT",
|
||||
// "OPEN_CIRCLE",
|
||||
// "FORK",
|
||||
// "FILLED_TRIANGLE",
|
||||
// NULL};
|
||||
|
||||
DrawLeaderLine::DrawLeaderLine(void)
|
||||
{
|
||||
static const char *group = "Leader";
|
||||
@@ -54,8 +75,19 @@ DrawLeaderLine::DrawLeaderLine(void)
|
||||
LeaderParent.setScope(App::LinkScope::Global);
|
||||
ADD_PROPERTY_TYPE(WayPoints,(Base::Vector3d()) ,group, App::Prop_None,
|
||||
"Intermediate points for Leader line");
|
||||
ADD_PROPERTY_TYPE(StartSymbol, (-1), group, App::Prop_None, "Symbol (arrowhead) for start of line");
|
||||
ADD_PROPERTY_TYPE(EndSymbol, (-1), group, App::Prop_None, "Symbol (arrowhead) for end of line");
|
||||
|
||||
// EndType.setEnums(ArrowTypeEnums);
|
||||
// ADD_PROPERTY(EndType,(prefEnd()));
|
||||
|
||||
StartSymbol.setEnums(ArrowPropEnum::ArrowTypeEnums);
|
||||
ADD_PROPERTY(StartSymbol,(1l)); //filled arrow
|
||||
|
||||
// ADD_PROPERTY_TYPE(StartSymbol, (0), group, App::Prop_None, "Symbol (arrowhead) for start of line");
|
||||
EndSymbol.setEnums(ArrowPropEnum::ArrowTypeEnums);
|
||||
ADD_PROPERTY(EndSymbol,(0l)); //no symbol
|
||||
// ADD_PROPERTY_TYPE(EndSymbol, (0), group, App::Prop_None, "Symbol (arrowhead) for end of line");
|
||||
|
||||
|
||||
ADD_PROPERTY_TYPE(Scalable ,(false),group,App::Prop_None,"Scale line with LeaderParent");
|
||||
ADD_PROPERTY_TYPE(AutoHorizontal ,(getDefAuto()),group,App::Prop_None,"Forces last line segment to be horizontal");
|
||||
|
||||
|
||||
@@ -44,8 +44,12 @@ public:
|
||||
|
||||
App::PropertyLink LeaderParent;
|
||||
App::PropertyVectorList WayPoints;
|
||||
App::PropertyInteger StartSymbol; //see Gui/QGIArrow for values
|
||||
App::PropertyInteger EndSymbol;
|
||||
App::PropertyEnumeration StartSymbol;
|
||||
App::PropertyEnumeration EndSymbol;
|
||||
|
||||
/* App::PropertyInteger StartSymbol; //see Gui/QGIArrow for values*/
|
||||
/* App::PropertyInteger EndSymbol;*/
|
||||
|
||||
App::PropertyBool Scalable;
|
||||
App::PropertyBool AutoHorizontal;
|
||||
|
||||
@@ -71,11 +75,15 @@ public:
|
||||
Base::Vector3d getKinkPoint(void) const;
|
||||
Base::Vector3d getTailPoint(void) const;
|
||||
|
||||
|
||||
protected:
|
||||
virtual void onChanged(const App::Property* prop) override;
|
||||
|
||||
private:
|
||||
/* static const char* ArrowTypeEnums[];*/
|
||||
/* static const int ArrowCount;*/
|
||||
/* static const std::vector<std::string> ArrowTypeIcons;*/
|
||||
|
||||
|
||||
};
|
||||
|
||||
typedef App::FeaturePythonT<DrawLeaderLine> DrawLeaderLinePython;
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "DrawViewBalloon.h"
|
||||
#include "DrawUtil.h"
|
||||
#include "LineGroup.h"
|
||||
#include "ArrowPropEnum.h"
|
||||
|
||||
|
||||
//#include <Mod/TechDraw/App/DrawViewBalloonPy.h> // generated from DrawViewBalloonPy.xml
|
||||
@@ -74,31 +75,30 @@ using namespace TechDraw;
|
||||
|
||||
PROPERTY_SOURCE(TechDraw::DrawViewBalloon, TechDraw::DrawView)
|
||||
|
||||
//from Gui/QGIArrow.h
|
||||
//enum ArrowType {
|
||||
// FILLED_TRIANGLE = 0,
|
||||
// OPEN_ARROW,
|
||||
// HASH_MARK,
|
||||
// DOT,
|
||||
// OPEN_CIRCLE,
|
||||
// FORK,
|
||||
// PYRAMID
|
||||
// };
|
||||
//const char* DrawViewBalloon::ArrowTypeEnums[]= { "NONE",
|
||||
// "FILLED_ARROW",
|
||||
// "OPEN_ARROW",
|
||||
// "TICK",
|
||||
// "DOT",
|
||||
// "OPEN_CIRCLE",
|
||||
// "FORK",
|
||||
// "FILLED_TRIANGLE",
|
||||
// NULL};
|
||||
|
||||
const char* DrawViewBalloon::endTypeEnums[]= { "FILLED_TRIANGLE",
|
||||
"OPEN_ARROW",
|
||||
"HASH_MARK",
|
||||
"DOT",
|
||||
"OPEN_CIRCLE",
|
||||
"FORK",
|
||||
"PYRAMID",
|
||||
"NONE",
|
||||
NULL};
|
||||
|
||||
//const char* DrawViewBalloon::endTypeEnums[]= {"Arrow",
|
||||
// "Dot",
|
||||
//const char* DrawViewBalloon::endTypeEnums[]= { "FILLED_TRIANGLE",
|
||||
// "OPEN_ARROW",
|
||||
// "HASH_MARK",
|
||||
// "DOT",
|
||||
// "OPEN_CIRCLE",
|
||||
// "FORK",
|
||||
// "PYRAMID",
|
||||
// "NONE",
|
||||
// NULL};
|
||||
|
||||
////const char* DrawViewBalloon::endTypeEnums[]= {"Arrow",
|
||||
//// "Dot",
|
||||
//// NULL};
|
||||
|
||||
const char* DrawViewBalloon::balloonTypeEnums[]= {"Circular",
|
||||
"None",
|
||||
"Triangle",
|
||||
@@ -116,7 +116,8 @@ DrawViewBalloon::DrawViewBalloon(void)
|
||||
ADD_PROPERTY_TYPE(OriginY,(0),"",(App::PropertyType)(App::Prop_None),"Balloon origin y");
|
||||
ADD_PROPERTY_TYPE(OriginIsSet, (false), "",(App::PropertyType)(App::Prop_None),"Balloon origin is set");
|
||||
|
||||
EndType.setEnums(endTypeEnums);
|
||||
// EndType.setEnums(endTypeEnums);
|
||||
EndType.setEnums(ArrowPropEnum::ArrowTypeEnums);
|
||||
ADD_PROPERTY(EndType,(prefEnd()));
|
||||
|
||||
Symbol.setEnums(balloonTypeEnums);
|
||||
|
||||
@@ -76,7 +76,8 @@ public:
|
||||
}
|
||||
|
||||
static const char* balloonTypeEnums[];
|
||||
static const char* endTypeEnums[];
|
||||
/* static const char* endTypeEnums[];*/
|
||||
static const char* ArrowTypeEnums[];
|
||||
|
||||
void handleXYLock(void) override;
|
||||
|
||||
@@ -97,6 +98,11 @@ protected:
|
||||
const char *PropName) override;
|
||||
|
||||
private:
|
||||
/* static const char* ArrowTypeEnums[];*/
|
||||
/* static const int ArrowCount;*/
|
||||
/* static const std::vector<std::string> ArrowTypeIcons;*/
|
||||
|
||||
|
||||
};
|
||||
|
||||
} //namespace TechDraw
|
||||
|
||||
@@ -25,10 +25,18 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include <App/Application.h>
|
||||
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Console.h>
|
||||
|
||||
#include "DrawGuiUtil.h"
|
||||
#include "DlgPrefsTechDraw3Imp.h"
|
||||
#include <Gui/PrefWidgets.h>
|
||||
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
|
||||
DlgPrefsTechDraw3Imp::DlgPrefsTechDraw3Imp( QWidget* parent )
|
||||
: PreferencePage( parent )
|
||||
@@ -95,6 +103,11 @@ void DlgPrefsTechDraw3Imp::loadSettings()
|
||||
plsb_ArrowSize->onRestore();
|
||||
plsb_FontSize->onRestore();
|
||||
sbAltDecimals->onRestore();
|
||||
|
||||
DrawGuiUtil::loadArrowBox(pcbBalloonArrow);
|
||||
pcbBalloonArrow->setCurrentIndex(prefBalloonArrow());
|
||||
DrawGuiUtil::loadArrowBox(pcbArrow);
|
||||
pcbArrow->setCurrentIndex(prefArrowStyle());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,4 +125,24 @@ void DlgPrefsTechDraw3Imp::changeEvent(QEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
int DlgPrefsTechDraw3Imp::prefBalloonArrow(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Decorations");
|
||||
int end = hGrp->GetInt("BalloonArrow", 1);
|
||||
return end;
|
||||
}
|
||||
|
||||
int DlgPrefsTechDraw3Imp::prefArrowStyle(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Dimensions");
|
||||
int style = hGrp->GetInt("ArrowStyle", 1);
|
||||
return style;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include <Mod/TechDraw/Gui/moc_DlgPrefsTechDraw3Imp.cpp>
|
||||
|
||||
@@ -43,6 +43,11 @@ protected:
|
||||
void saveSettings();
|
||||
void loadSettings();
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
int prefBalloonArrow(void) const;
|
||||
int prefArrowStyle(void) const;
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace TechDrawGui
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
#include <Mod/TechDraw/App/DrawViewPart.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/App/Geometry.h>
|
||||
#include <Mod/TechDraw/App/ArrowPropEnum.h>
|
||||
|
||||
#include "QGVPage.h"
|
||||
#include "MDIViewPage.h"
|
||||
@@ -82,6 +83,18 @@
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
void DrawGuiUtil::loadArrowBox(QComboBox* qcb)
|
||||
{
|
||||
qcb->clear();
|
||||
int i = 0;
|
||||
for (; i < ArrowPropEnum::ArrowCount; i++) {
|
||||
qcb->addItem(QString::fromUtf8(ArrowPropEnum::ArrowTypeEnums[i]));
|
||||
QIcon itemIcon(QString::fromUtf8(ArrowPropEnum::ArrowTypeIcons[i].c_str()));
|
||||
qcb->setItemIcon(i, itemIcon);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// validate helper routines
|
||||
//===========================================================================
|
||||
|
||||
@@ -26,8 +26,11 @@
|
||||
#include <string>
|
||||
#include <QRectF>
|
||||
#include <QPointF>
|
||||
#include <QComboBox>
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
/*#include <Gui/PrefWidgets.h>*/
|
||||
|
||||
namespace Part {
|
||||
class Feature;
|
||||
}
|
||||
@@ -51,7 +54,10 @@ class TechDrawGuiExport DrawGuiUtil {
|
||||
static void dumpRectF(const char* text, const QRectF& r);
|
||||
static void dumpPointF(const char* text, const QPointF& p);
|
||||
static std::pair<Base::Vector3d,Base::Vector3d> get3DDirAndRot();
|
||||
static std::pair<Base::Vector3d,Base::Vector3d> getProjDirFromFace(App::DocumentObject* obj, std::string faceName);
|
||||
static std::pair<Base::Vector3d,Base::Vector3d> getProjDirFromFace(App::DocumentObject* obj,
|
||||
std::string faceName);
|
||||
static void loadArrowBox(QComboBox* qcb);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -36,10 +36,13 @@
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Console.h>
|
||||
|
||||
#include <Mod/TechDraw/App/ArrowPropEnum.h>
|
||||
|
||||
#include "Rez.h"
|
||||
#include "QGIArrow.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
using namespace TechDraw;
|
||||
|
||||
QGIArrow::QGIArrow() :
|
||||
m_fill(Qt::SolidPattern),
|
||||
@@ -62,35 +65,35 @@ QGIArrow::QGIArrow() :
|
||||
|
||||
void QGIArrow::draw() {
|
||||
QPainterPath path;
|
||||
if (m_style == FILLED_TRIANGLE) {
|
||||
if (m_style == ArrowType::FILLED_ARROW) {
|
||||
if (m_dirMode) {
|
||||
path = makeFilledTriangle(getDirection(), m_size,m_size/6.0);
|
||||
} else {
|
||||
path = makeFilledTriangle(m_size,m_size/6.0,isFlipped()); //"arrow l/w sb 3/1" ??
|
||||
}
|
||||
} else if (m_style == OPEN_ARROW) {
|
||||
} else if (m_style == ArrowType::OPEN_ARROW) {
|
||||
if (m_dirMode) {
|
||||
path = makeOpenArrow(getDirection(), m_size,m_size/3.0); //broad arrow?
|
||||
} else {
|
||||
path = makeOpenArrow(m_size,m_size/3.0,isFlipped());
|
||||
}
|
||||
} else if (m_style == HASH_MARK) {
|
||||
} else if (m_style == ArrowType::TICK) {
|
||||
if (m_dirMode) {
|
||||
path = makeHashMark(getDirection(), m_size/2.0,m_size/2.0); //big enough?
|
||||
} else {
|
||||
path = makeHashMark(m_size/2.0,m_size/2.0,isFlipped()); //big enough?
|
||||
}
|
||||
} else if (m_style == DOT) {
|
||||
} else if (m_style == ArrowType::DOT) {
|
||||
path = makeDot(m_size/2.0,m_size/2.0,isFlipped());
|
||||
} else if (m_style == OPEN_CIRCLE) {
|
||||
} else if (m_style == ArrowType::OPEN_CIRCLE) {
|
||||
path = makeOpenDot(m_size/2.0,m_size/2.0,isFlipped());
|
||||
} else if (m_style == FORK) {
|
||||
} else if (m_style == ArrowType::FORK) {
|
||||
if (m_dirMode) {
|
||||
path = makeForkArrow(getDirection(), m_size/2.0,m_size/2.0); //big enough?
|
||||
} else {
|
||||
path = makeForkArrow(m_size/2.0,m_size/2.0,isFlipped()); //big enough?
|
||||
}
|
||||
} else if (m_style == PYRAMID){
|
||||
} else if (m_style == ArrowType::FILLED_TRIANGLE){
|
||||
if (m_dirMode) {
|
||||
path = makePyramid(getDirection(), m_size);
|
||||
} else {
|
||||
@@ -331,13 +334,13 @@ double QGIArrow::getOverlapAdjust(int style, double size)
|
||||
// Base::Console().Message("QGIA::getOverlapAdjust(%d, %.3f) \n",style, size);
|
||||
double result = 1.0;
|
||||
switch(style) {
|
||||
case FILLED_TRIANGLE:
|
||||
case FILLED_ARROW:
|
||||
result = 0.50 * size;
|
||||
break;
|
||||
case OPEN_ARROW:
|
||||
result = 0.10 * size;
|
||||
break;
|
||||
case HASH_MARK:
|
||||
case TICK:
|
||||
result = 0.0;
|
||||
break;
|
||||
case DOT:
|
||||
@@ -350,7 +353,7 @@ double QGIArrow::getOverlapAdjust(int style, double size)
|
||||
case FORK:
|
||||
result = 0.0;
|
||||
break;
|
||||
case PYRAMID:
|
||||
case FILLED_TRIANGLE:
|
||||
result = size;
|
||||
break;
|
||||
case NONE:
|
||||
|
||||
@@ -35,16 +35,16 @@ QT_END_NAMESPACE
|
||||
namespace TechDrawGui
|
||||
{
|
||||
|
||||
enum ArrowType {
|
||||
FILLED_TRIANGLE = 0,
|
||||
OPEN_ARROW,
|
||||
HASH_MARK,
|
||||
DOT,
|
||||
OPEN_CIRCLE,
|
||||
FORK,
|
||||
PYRAMID,
|
||||
NONE
|
||||
};
|
||||
/*enum ArrowType {*/
|
||||
/* FILLED_TRIANGLE = 0,*/
|
||||
/* OPEN_ARROW,*/
|
||||
/* HASH_MARK,*/
|
||||
/* DOT,*/
|
||||
/* OPEN_CIRCLE,*/
|
||||
/* FORK,*/
|
||||
/* PYRAMID,*/
|
||||
/* NONE*/
|
||||
/*};*/
|
||||
|
||||
class TechDrawGuiExport QGIArrow : public QGIPrimPath
|
||||
{
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/App/Geometry.h>
|
||||
#include <Mod/TechDraw/App/LineGroup.h>
|
||||
#include <Mod/TechDraw/App/ArrowPropEnum.h>
|
||||
|
||||
#include "Rez.h"
|
||||
#include "ZVALUE.h"
|
||||
@@ -423,11 +424,11 @@ QPainterPath QGILeaderLine::makeLeaderPath(std::vector<QPointF> qPoints)
|
||||
double endAdjLength(0.0);
|
||||
if (qPoints.size() > 1) {
|
||||
//make path adjustment to hide leaderline ends behind arrowheads
|
||||
if (featLeader->StartSymbol.getValue() > -1) {
|
||||
if (featLeader->StartSymbol.getValue() > ArrowType::NONE) {
|
||||
startAdjLength = QGIArrow::getOverlapAdjust(featLeader->StartSymbol.getValue(),
|
||||
QGIArrow::getPrefArrowSize());
|
||||
}
|
||||
if (featLeader->EndSymbol.getValue() > -1) {
|
||||
if (featLeader->EndSymbol.getValue() > ArrowType::NONE) {
|
||||
endAdjLength = QGIArrow::getOverlapAdjust(featLeader->EndSymbol.getValue(),
|
||||
QGIArrow::getPrefArrowSize());
|
||||
}
|
||||
@@ -498,7 +499,7 @@ void QGILeaderLine::setArrows(std::vector<QPointF> pathPoints)
|
||||
|
||||
QPointF lastOffset = (pathPoints.back() - pathPoints.front());
|
||||
|
||||
if (featLeader->StartSymbol.getValue() > -1) {
|
||||
if (featLeader->StartSymbol.getValue() > ArrowType::NONE) {
|
||||
m_arrow1->setStyle(featLeader->StartSymbol.getValue());
|
||||
m_arrow1->setWidth(getLineWidth());
|
||||
// TODO: variable size arrow heads
|
||||
@@ -520,7 +521,7 @@ void QGILeaderLine::setArrows(std::vector<QPointF> pathPoints)
|
||||
m_arrow1->hide();
|
||||
}
|
||||
|
||||
if (featLeader->EndSymbol.getValue() > -1) {
|
||||
if (featLeader->EndSymbol.getValue() > ArrowType::NONE) {
|
||||
m_arrow2->setStyle(featLeader->EndSymbol.getValue());
|
||||
m_arrow2->setWidth(getLineWidth());
|
||||
m_arrow2->setDirMode(true);
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#include <Mod/TechDraw/App/DrawView.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/App/Geometry.h>
|
||||
#include <Mod/TechDraw/App/ArrowPropEnum.h>
|
||||
|
||||
#include "Rez.h"
|
||||
#include "ZVALUE.h"
|
||||
@@ -417,13 +418,11 @@ void QGIViewBalloon::updateBalloon(bool obtuse)
|
||||
if ( vp == nullptr ) {
|
||||
return;
|
||||
}
|
||||
|
||||
const TechDraw::DrawViewPart *refObj = balloon->getViewPart();
|
||||
if (refObj == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
QFont font = balloonLabel->getFont();
|
||||
font.setPixelSize(calculateFontPixelSize(vp->Fontsize.getValue()));
|
||||
font.setFamily(QString::fromUtf8(vp->Font.getValue()));
|
||||
@@ -444,7 +443,6 @@ void QGIViewBalloon::updateBalloon(bool obtuse)
|
||||
}
|
||||
|
||||
balloonLabel->setDimString(labelText, Rez::guiX(balloon->TextWrapLen.getValue()));
|
||||
|
||||
float x = Rez::guiX(balloon->X.getValue() * refObj->getScale());
|
||||
float y = Rez::guiX(balloon->Y.getValue() * refObj->getScale());
|
||||
balloonLabel->setPosFromCenter(x, -y);
|
||||
@@ -520,7 +518,7 @@ void QGIViewBalloon::placeBalloon(QPointF pos)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
QGIView* qgivParent = nullptr;
|
||||
QPointF viewPos;
|
||||
Gui::ViewProvider* objVp = QGIView::getViewProvider(balloonParent);
|
||||
@@ -595,7 +593,7 @@ void QGIViewBalloon::draw()
|
||||
float x = Rez::guiX(balloon->X.getValue() * refObj->getScale());
|
||||
float y = Rez::guiX(balloon->Y.getValue() * refObj->getScale());
|
||||
Base::Vector3d lblCenter(x, -y, 0.0);
|
||||
|
||||
|
||||
float arrowTipX = Rez::guiX(balloon->OriginX.getValue() * refObj->getScale());
|
||||
float arrowTipY = - Rez::guiX(balloon->OriginY.getValue() * refObj->getScale());
|
||||
|
||||
@@ -706,11 +704,10 @@ void QGIViewBalloon::draw()
|
||||
double xAdj = 0.0;
|
||||
double yAdj = 0.0;
|
||||
int endType = balloon->EndType.getValue();
|
||||
std::string endTypeString = balloon->EndType.getValueAsString();
|
||||
double arrowAdj = QGIArrow::getOverlapAdjust(endType,
|
||||
QGIArrow::getPrefArrowSize());
|
||||
|
||||
if (endTypeString == "NONE") {
|
||||
if (endType == ArrowType::NONE) {
|
||||
arrow->hide();
|
||||
} else {
|
||||
arrow->setStyle(endType);
|
||||
@@ -729,7 +726,7 @@ void QGIViewBalloon::draw()
|
||||
float arAngle = atan2(dirballoonLinesLine.y, dirballoonLinesLine.x) * 180 / M_PI;
|
||||
|
||||
arrow->setPos(arrowTipX, arrowTipY);
|
||||
if ( (endTypeString == "PYRAMID") &&
|
||||
if ( (endType == ArrowType::FILLED_TRIANGLE) &&
|
||||
(prefOrthoPyramid()) ) {
|
||||
if (arAngle < 0.0) {
|
||||
arAngle += 360.0;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
<file>icons/TechDraw_VerticalExtentDimension.svg</file>
|
||||
<file>icons/techdraw-landmarkdistance.svg</file>
|
||||
<file>icons/preferences-techdraw.svg</file>
|
||||
<file>icons/arrownone.svg</file>
|
||||
<file>icons/arrowdot.svg</file>
|
||||
<file>icons/arrowopendot.svg</file>
|
||||
<file>icons/arrowfilled.svg</file>
|
||||
|
||||
38
src/Mod/TechDraw/Gui/Resources/icons/arrownone.svg
Normal file
38
src/Mod/TechDraw/Gui/Resources/icons/arrownone.svg
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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"
|
||||
id="svg3942"
|
||||
height="48"
|
||||
width="48"
|
||||
version="1.1">
|
||||
<defs
|
||||
id="defs3944" />
|
||||
<metadata
|
||||
id="metadata3947">
|
||||
<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>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(1.6490345,-1.6458526)"
|
||||
id="g881">
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3.72050047;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 2.2263108,45.766302 42.468226,5.5381284"
|
||||
id="path70" />
|
||||
<path
|
||||
id="path72"
|
||||
d="M 2.2342858,5.5186032 42.475039,45.773102"
|
||||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3.72166395;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -46,9 +46,11 @@
|
||||
#include <Mod/TechDraw/App/DrawViewBalloon.h>
|
||||
#include <Mod/TechDraw/App/DrawPage.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/App/ArrowPropEnum.h>
|
||||
|
||||
#include <Mod/TechDraw/Gui/ui_TaskBalloon.h>
|
||||
|
||||
#include "DrawGuiUtil.h"
|
||||
#include "QGIViewBalloon.h"
|
||||
#include "TaskBalloon.h"
|
||||
|
||||
@@ -74,12 +76,12 @@ TaskBalloon::TaskBalloon(QGIViewBalloon *parent) :
|
||||
ui->inputValue->selectAll();
|
||||
QTimer::singleShot(0, ui->inputValue, SLOT(setFocus()));
|
||||
|
||||
DrawGuiUtil::loadArrowBox(ui->comboEndType);
|
||||
i = parent->dvBalloon->EndType.getValue();
|
||||
ui->comboEndType->setCurrentIndex(i);
|
||||
|
||||
i = parent->dvBalloon->Symbol.getValue();
|
||||
ui->comboSymbol->setCurrentIndex(i);
|
||||
|
||||
}
|
||||
|
||||
TaskBalloon::~TaskBalloon()
|
||||
@@ -87,7 +89,6 @@ TaskBalloon::~TaskBalloon()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
bool TaskBalloon::accept()
|
||||
{
|
||||
m_parent->dvBalloon->Text.setValue(ui->inputValue->text().toUtf8().constData());
|
||||
|
||||
@@ -262,8 +262,12 @@ void TaskLeaderLine::setUiPrimary()
|
||||
ui->pbCancelEdit->setEnabled(false);
|
||||
}
|
||||
|
||||
int aSize = getPrefArrowStyle() + 1;
|
||||
ui->cboxStartSym->setCurrentIndex(aSize);
|
||||
DrawGuiUtil::loadArrowBox(ui->cboxStartSym);
|
||||
int aStyle = getPrefArrowStyle();
|
||||
ui->cboxStartSym->setCurrentIndex(aStyle);
|
||||
|
||||
DrawGuiUtil::loadArrowBox(ui->cboxEndSym);
|
||||
ui->cboxEndSym->setCurrentIndex(0);
|
||||
|
||||
ui->dsbWeight->setUnit(Base::Unit::Length);
|
||||
ui->dsbWeight->setMinimum(0);
|
||||
@@ -290,8 +294,12 @@ void TaskLeaderLine::setUiEdit()
|
||||
if (m_lineFeat != nullptr) {
|
||||
std::string baseName = m_lineFeat->LeaderParent.getValue()->getNameInDocument();
|
||||
ui->tbBaseView->setText(Base::Tools::fromStdString(baseName));
|
||||
ui->cboxStartSym->setCurrentIndex(m_lineFeat->StartSymbol.getValue() + 1);
|
||||
ui->cboxEndSym->setCurrentIndex(m_lineFeat->EndSymbol.getValue() + 1);
|
||||
|
||||
DrawGuiUtil::loadArrowBox(ui->cboxStartSym);
|
||||
ui->cboxStartSym->setCurrentIndex(m_lineFeat->StartSymbol.getValue());
|
||||
DrawGuiUtil::loadArrowBox(ui->cboxEndSym);
|
||||
ui->cboxEndSym->setCurrentIndex(m_lineFeat->EndSymbol.getValue());
|
||||
|
||||
ui->pbTracker->setText(QString::fromUtf8("Edit points"));
|
||||
if (m_haveMdi) {
|
||||
ui->pbTracker->setEnabled(true);
|
||||
@@ -391,8 +399,8 @@ void TaskLeaderLine::updateLeaderFeature(void)
|
||||
|
||||
void TaskLeaderLine::commonFeatureUpdate(void)
|
||||
{
|
||||
int start = ui->cboxStartSym->currentIndex() - 1;
|
||||
int end = ui->cboxEndSym->currentIndex() - 1;
|
||||
int start = ui->cboxStartSym->currentIndex();
|
||||
int end = ui->cboxEndSym->currentIndex();
|
||||
m_lineFeat->StartSymbol.setValue(start);
|
||||
m_lineFeat->EndSymbol.setValue(end);
|
||||
}
|
||||
@@ -719,7 +727,7 @@ int TaskLeaderLine::getPrefArrowStyle()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
int style = hGrp->GetInt("ArrowStyle", 0);
|
||||
int style = hGrp->GetInt("ArrowStyle", 1);
|
||||
return style;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user