[TD]Welding Symbol creation
@@ -42,6 +42,9 @@
|
||||
#include "DrawViewBalloon.h"
|
||||
#include "DrawLeaderLine.h"
|
||||
#include "DrawRichAnno.h"
|
||||
#include "DrawTile.h"
|
||||
#include "DrawTileWeld.h"
|
||||
#include "DrawWeldSymbol.h"
|
||||
#include "Cosmetic.h"
|
||||
#include "PropertyGeomFormatList.h"
|
||||
#include "PropertyCenterLineList.h"
|
||||
@@ -100,6 +103,9 @@ PyMOD_INIT_FUNC(TechDraw)
|
||||
TechDraw::DrawViewDraft ::init();
|
||||
TechDraw::DrawViewArch ::init();
|
||||
TechDraw::DrawViewImage ::init();
|
||||
TechDraw::DrawTile ::init();
|
||||
TechDraw::DrawTileWeld ::init();
|
||||
TechDraw::DrawWeldSymbol ::init();
|
||||
|
||||
TechDraw::PropertyGeomFormatList::init();
|
||||
TechDraw::GeomFormat ::init();
|
||||
@@ -119,5 +125,8 @@ PyMOD_INIT_FUNC(TechDraw)
|
||||
TechDraw::DrawViewSymbolPython::init();
|
||||
TechDraw::DrawLeaderLinePython::init();
|
||||
TechDraw::DrawRichAnnoPython ::init();
|
||||
TechDraw::DrawTilePython ::init();
|
||||
TechDraw::DrawTileWeldPython ::init();
|
||||
TechDraw::DrawWeldSymbolPython::init();
|
||||
PyMOD_Return(mod);
|
||||
}
|
||||
|
||||
@@ -63,6 +63,9 @@ generate_from_xml(GeomFormatPy)
|
||||
generate_from_xml(CenterLinePy)
|
||||
generate_from_xml(CosmeticEdgePy)
|
||||
generate_from_xml(CosmeticVertexPy)
|
||||
generate_from_xml(DrawTilePy)
|
||||
generate_from_xml(DrawTileWeldPy)
|
||||
generate_from_xml(DrawWeldSymbolPy)
|
||||
|
||||
SET(Draw_SRCS
|
||||
DrawPage.cpp
|
||||
@@ -117,6 +120,12 @@ SET(Draw_SRCS
|
||||
DrawRichAnno.h
|
||||
QDomNodeModel.cpp
|
||||
QDomNodeModel.h
|
||||
DrawTile.cpp
|
||||
DrawTile.h
|
||||
DrawTileWeld.cpp
|
||||
DrawTileWeld.h
|
||||
DrawWeldSymbol.cpp
|
||||
DrawWeldSymbol.h
|
||||
)
|
||||
|
||||
SET(TechDraw_SRCS
|
||||
@@ -196,6 +205,12 @@ SET(Python_SRCS
|
||||
CosmeticEdgePyImp.cpp
|
||||
CosmeticVertexPy.xml
|
||||
CosmeticVertexPyImp.cpp
|
||||
DrawTilePy.xml
|
||||
DrawTilePyImp.cpp
|
||||
DrawTileWeldPy.xml
|
||||
DrawTileWeldPyImp.cpp
|
||||
DrawWeldSymbolPy.xml
|
||||
DrawWeldSymbolPyImp.cpp
|
||||
)
|
||||
|
||||
SOURCE_GROUP("Mod" FILES ${TechDraw_SRCS})
|
||||
@@ -225,6 +240,13 @@ ADD_CUSTOM_COMMAND(TARGET TechDraw
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CMAKE_SOURCE_DIR}/src/Mod/TechDraw/Templates
|
||||
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/TechDraw/Templates
|
||||
)
|
||||
|
||||
ADD_CUSTOM_COMMAND(TARGET TechDraw
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CMAKE_SOURCE_DIR}/src/Mod/TechDraw/Symbols
|
||||
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_DATADIR}/Mod/TechDraw/Symbols
|
||||
)
|
||||
|
||||
SET_BIN_DIR(TechDraw TechDraw /Mod/TechDraw)
|
||||
|
||||
@@ -187,6 +187,52 @@ void DrawLeaderLine::adjustLastSegment(void)
|
||||
WayPoints.setValues(wp);
|
||||
}
|
||||
|
||||
//middle of last line segment
|
||||
Base::Vector3d DrawLeaderLine::getTileOrigin(void) const
|
||||
{
|
||||
Base::Vector3d result;
|
||||
std::vector<Base::Vector3d> wp = WayPoints.getValues();
|
||||
if (wp.size() > 1) {
|
||||
Base::Vector3d last = wp.rbegin()[0];
|
||||
Base::Vector3d second = wp.rbegin()[1];
|
||||
result = (last + second) / 2.0;
|
||||
} else {
|
||||
Base::Console().Warning("DLL::getTileOrigin - no waypoints\n");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//start of last line segment
|
||||
Base::Vector3d DrawLeaderLine::getKinkPoint(void) const
|
||||
{
|
||||
Base::Vector3d result;
|
||||
std::vector<Base::Vector3d> wp = WayPoints.getValues();
|
||||
if (wp.size() > 1) {
|
||||
Base::Vector3d second = wp.rbegin()[1];
|
||||
result = second;
|
||||
} else {
|
||||
Base::Console().Warning("DLL::getKinkPoint - no waypoints\n");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//end of last line segment
|
||||
Base::Vector3d DrawLeaderLine::getTailPoint(void) const
|
||||
{
|
||||
Base::Vector3d result;
|
||||
std::vector<Base::Vector3d> wp = WayPoints.getValues();
|
||||
if (!wp.empty()) {
|
||||
Base::Vector3d last = wp.rbegin()[0];
|
||||
result = last;
|
||||
} else {
|
||||
Base::Console().Warning("DLL::getTailPoint - no waypoints\n");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
bool DrawLeaderLine::getDefAuto(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
|
||||
@@ -66,6 +66,10 @@ public:
|
||||
void adjustLastSegment(void);
|
||||
bool getDefAuto(void) const;
|
||||
|
||||
Base::Vector3d getTileOrigin(void) const;
|
||||
Base::Vector3d getKinkPoint(void) const;
|
||||
Base::Vector3d getTailPoint(void) const;
|
||||
|
||||
|
||||
protected:
|
||||
virtual void onChanged(const App::Property* prop) override;
|
||||
|
||||
118
src/Mod/TechDraw/App/DrawTile.cpp
Normal file
@@ -0,0 +1,118 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 Wanderer Fan <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 <App/Application.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include "DrawUtil.h"
|
||||
|
||||
#include <Mod/TechDraw/App/DrawTilePy.h> // generated from DrawTilePy.xml
|
||||
#include "DrawTile.h"
|
||||
|
||||
using namespace TechDraw;
|
||||
|
||||
//===========================================================================
|
||||
// DrawTile - attachable tile
|
||||
//===========================================================================
|
||||
|
||||
PROPERTY_SOURCE(TechDraw::DrawTile, App::DocumentObject)
|
||||
|
||||
DrawTile::DrawTile(void)
|
||||
{
|
||||
static const char *group = "Tile";
|
||||
|
||||
Base::Vector3d defOrg(0.0, 0.0, 0.0);
|
||||
ADD_PROPERTY_TYPE(TileParent,(0),group,(App::PropertyType)(App::Prop_None),
|
||||
"Object to which this tile is attached");
|
||||
ADD_PROPERTY_TYPE(TileRow, (0), group, App::Prop_None, "Row in parent");
|
||||
ADD_PROPERTY_TYPE(TileColumn, (0), group, App::Prop_None, "Column in parent");
|
||||
ADD_PROPERTY_TYPE(TileOrigin, (defOrg), group, App::Prop_None, "Width limit before auto wrap");
|
||||
}
|
||||
|
||||
DrawTile::~DrawTile()
|
||||
{
|
||||
}
|
||||
|
||||
void DrawTile::onChanged(const App::Property* prop)
|
||||
{
|
||||
if (!isRestoring()) {
|
||||
//nothing in particular
|
||||
}
|
||||
DocumentObject::onChanged(prop);
|
||||
|
||||
}
|
||||
|
||||
short DrawTile::mustExecute() const
|
||||
{
|
||||
return DocumentObject::mustExecute();
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn *DrawTile::execute(void)
|
||||
{
|
||||
// Base::Console().Message("DT::execute()\n");
|
||||
return DocumentObject::execute();
|
||||
}
|
||||
|
||||
DrawView* DrawTile::getParent(void) const
|
||||
{
|
||||
Base::Console().Message("DT::getParent() - %s\n", getNameInDocument());
|
||||
DrawView* result = nullptr;
|
||||
App::DocumentObject* baseObj = TileParent.getValue();
|
||||
if (baseObj != nullptr) {
|
||||
DrawView* cast = dynamic_cast<DrawView*>(baseObj);
|
||||
if (cast != nullptr) {
|
||||
result = cast;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
PyObject *DrawTile::getPyObject(void)
|
||||
{
|
||||
if (PythonObject.is(Py::_None())) {
|
||||
// ref counter is set to 1
|
||||
PythonObject = Py::Object(new DrawTilePy(this),true);
|
||||
}
|
||||
return Py::new_reference_to(PythonObject);
|
||||
}
|
||||
|
||||
// Python Drawing feature ---------------------------------------------------------
|
||||
|
||||
namespace App {
|
||||
/// @cond DOXERR
|
||||
PROPERTY_SOURCE_TEMPLATE(TechDraw::DrawTilePython, TechDraw::DrawTile)
|
||||
template<> const char* TechDraw::DrawTilePython::getViewProviderName(void) const {
|
||||
return "TechDrawGui::ViewProviderTile";
|
||||
}
|
||||
/// @endcond
|
||||
|
||||
// explicit template instantiation
|
||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawTile>;
|
||||
}
|
||||
|
||||
65
src/Mod/TechDraw/App/DrawTile.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 Wanderer Fan <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 _TechDraw_DrawTile_h_
|
||||
#define _TechDraw_DrawTile_h_
|
||||
|
||||
# include <App/DocumentObject.h>
|
||||
# include <App/FeaturePython.h>
|
||||
|
||||
#include "DrawView.h"
|
||||
|
||||
namespace TechDraw
|
||||
{
|
||||
|
||||
class TechDrawExport DrawTile : public App::DocumentObject
|
||||
{
|
||||
PROPERTY_HEADER(TechDraw::DrawTile);
|
||||
|
||||
public:
|
||||
DrawTile();
|
||||
virtual ~DrawTile();
|
||||
|
||||
App::PropertyLink TileParent; //eg DrawWeldSymbol
|
||||
App::PropertyInteger TileRow;
|
||||
App::PropertyInteger TileColumn;
|
||||
App::PropertyVector TileOrigin; //sb call to TileParent - WeldingSymbol
|
||||
|
||||
virtual short mustExecute() const;
|
||||
virtual App::DocumentObjectExecReturn *execute(void);
|
||||
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "TechDrawGui::ViewProviderTile";
|
||||
}
|
||||
virtual PyObject *getPyObject(void);
|
||||
virtual DrawView* getParent(void) const;
|
||||
|
||||
protected:
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
typedef App::FeaturePythonT<DrawTile> DrawTilePython;
|
||||
|
||||
} //namespace TechDraw
|
||||
#endif
|
||||
18
src/Mod/TechDraw/App/DrawTilePy.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
|
||||
<PythonExport
|
||||
Father="DocumentObjectPy"
|
||||
Name="DrawTilePy"
|
||||
Twin="DrawTile"
|
||||
TwinPointer="DrawTile"
|
||||
Include="Mod/TechDraw/App/DrawTile.h"
|
||||
Namespace="TechDraw"
|
||||
FatherInclude="App/DocumentObjectPy.h"
|
||||
FatherNamespace="App">
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="WandererFan" EMail="wandererfan@gmail.com" />
|
||||
<UserDocu>Feature for adding tiles to leader lines</UserDocu>
|
||||
</Documentation>
|
||||
<CustomAttributes />
|
||||
</PythonExport>
|
||||
</GenerateModel>
|
||||
54
src/Mod/TechDraw/App/DrawTilePyImp.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 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 <Base/Console.h>
|
||||
#include <Base/PyObjectBase.h>
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
#include "DrawTile.h"
|
||||
|
||||
// inclusion of the generated files (generated out of DrawTilePy.xml)
|
||||
#include <Base/VectorPy.h>
|
||||
#include <Mod/TechDraw/App/DrawTilePy.h>
|
||||
#include <Mod/TechDraw/App/DrawTilePy.cpp>
|
||||
|
||||
using namespace TechDraw;
|
||||
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
std::string DrawTilePy::representation(void) const
|
||||
{
|
||||
return std::string("<DrawTile object>");
|
||||
}
|
||||
|
||||
PyObject *DrawTilePy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DrawTilePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
103
src/Mod/TechDraw/App/DrawTileWeld.cpp
Normal file
@@ -0,0 +1,103 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 Wanderer Fan <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 <App/Application.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include "DrawUtil.h"
|
||||
|
||||
#include <Mod/TechDraw/App/DrawTileWeldPy.h> // generated from DrawTileWeldPy.xml
|
||||
#include "DrawTileWeld.h"
|
||||
|
||||
using namespace TechDraw;
|
||||
|
||||
//===========================================================================
|
||||
// DrawTileWeld - attachable tile
|
||||
//===========================================================================
|
||||
|
||||
PROPERTY_SOURCE(TechDraw::DrawTileWeld, TechDraw::DrawTile)
|
||||
|
||||
DrawTileWeld::DrawTileWeld(void)
|
||||
{
|
||||
static const char *group = "TileWeld";
|
||||
|
||||
ADD_PROPERTY_TYPE(LeftText,(""),group,(App::PropertyType)(App::Prop_None),
|
||||
"Text LHS");
|
||||
ADD_PROPERTY_TYPE(RightText, (0), group, App::Prop_None, "Text RHS");
|
||||
ADD_PROPERTY_TYPE(CenterText, (0), group, App::Prop_None, "Text above Symbol");
|
||||
ADD_PROPERTY_TYPE(SymbolFile, (""), group, App::Prop_None, "Svg Symbol File");
|
||||
}
|
||||
|
||||
DrawTileWeld::~DrawTileWeld()
|
||||
{
|
||||
}
|
||||
|
||||
void DrawTileWeld::onChanged(const App::Property* prop)
|
||||
{
|
||||
if (!isRestoring()) {
|
||||
//nothing in particular
|
||||
}
|
||||
DrawTile::onChanged(prop);
|
||||
|
||||
}
|
||||
|
||||
short DrawTileWeld::mustExecute() const
|
||||
{
|
||||
return DrawTile::mustExecute();
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn *DrawTileWeld::execute(void)
|
||||
{
|
||||
// Base::Console().Message("DT::execute()\n");
|
||||
return DrawTile::execute();
|
||||
}
|
||||
|
||||
PyObject *DrawTileWeld::getPyObject(void)
|
||||
{
|
||||
if (PythonObject.is(Py::_None())) {
|
||||
// ref counter is set to 1
|
||||
PythonObject = Py::Object(new DrawTileWeldPy(this),true);
|
||||
}
|
||||
return Py::new_reference_to(PythonObject);
|
||||
}
|
||||
|
||||
// Python Drawing feature ---------------------------------------------------------
|
||||
|
||||
namespace App {
|
||||
/// @cond DOXERR
|
||||
PROPERTY_SOURCE_TEMPLATE(TechDraw::DrawTileWeldPython, TechDraw::DrawTileWeld)
|
||||
template<> const char* TechDraw::DrawTileWeldPython::getViewProviderName(void) const {
|
||||
return "TechDrawGui::ViewProviderTile";
|
||||
}
|
||||
/// @endcond
|
||||
|
||||
// explicit template instantiation
|
||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawTileWeld>;
|
||||
}
|
||||
|
||||
68
src/Mod/TechDraw/App/DrawTileWeld.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 Wanderer Fan <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 _TechDraw_DrawTileWeld_h_
|
||||
#define _TechDraw_DrawTileWeld_h_
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
#include <App/FeaturePython.h>
|
||||
#include <App/PropertyFile.h>
|
||||
#include <App/PropertyStandard.h>
|
||||
|
||||
#include "DrawTile.h"
|
||||
|
||||
|
||||
namespace TechDraw
|
||||
{
|
||||
|
||||
class TechDrawExport DrawTileWeld : public TechDraw::DrawTile
|
||||
{
|
||||
PROPERTY_HEADER(TechDraw::DrawTileWeld);
|
||||
|
||||
public:
|
||||
DrawTileWeld();
|
||||
virtual ~DrawTileWeld();
|
||||
|
||||
App::PropertyString LeftText;
|
||||
App::PropertyString RightText;
|
||||
App::PropertyString CenterText;
|
||||
App::PropertyFileIncluded SymbolFile;
|
||||
|
||||
virtual short mustExecute() const;
|
||||
virtual App::DocumentObjectExecReturn *execute(void);
|
||||
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "TechDrawGui::ViewProviderTile";
|
||||
}
|
||||
virtual PyObject *getPyObject(void);
|
||||
virtual QRectF getRect() const { return QRectF(0,0,1,1);}
|
||||
|
||||
protected:
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
typedef App::FeaturePythonT<DrawTileWeld> DrawTileWeldPython;
|
||||
|
||||
} //namespace TechDraw
|
||||
#endif
|
||||
18
src/Mod/TechDraw/App/DrawTileWeldPy.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
|
||||
<PythonExport
|
||||
Father="DrawTilePy"
|
||||
Name="DrawTileWeldPy"
|
||||
Twin="DrawTileWeld"
|
||||
TwinPointer="DrawTileWeld"
|
||||
Include="Mod/TechDraw/App/DrawTileWeld.h"
|
||||
Namespace="TechDraw"
|
||||
FatherInclude="Mod/TechDraw/App/DrawTilePy.h"
|
||||
FatherNamespace="TechDraw">
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="WandererFan" EMail="wandererfan@gmail.com" />
|
||||
<UserDocu>Feature for adding welding tiles to leader lines</UserDocu>
|
||||
</Documentation>
|
||||
<CustomAttributes />
|
||||
</PythonExport>
|
||||
</GenerateModel>
|
||||
54
src/Mod/TechDraw/App/DrawTileWeldPyImp.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 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 <Base/Console.h>
|
||||
#include <Base/PyObjectBase.h>
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
#include "DrawTileWeld.h"
|
||||
|
||||
// inclusion of the generated files (generated out of DrawTileWeldPy.xml)
|
||||
#include <Base/VectorPy.h>
|
||||
#include <Mod/TechDraw/App/DrawTileWeldPy.h>
|
||||
#include <Mod/TechDraw/App/DrawTileWeldPy.cpp>
|
||||
|
||||
using namespace TechDraw;
|
||||
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
std::string DrawTileWeldPy::representation(void) const
|
||||
{
|
||||
return std::string("<DrawTileWeld object>");
|
||||
}
|
||||
|
||||
PyObject *DrawTileWeldPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DrawTileWeldPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
136
src/Mod/TechDraw/App/DrawWeldSymbol.cpp
Normal file
@@ -0,0 +1,136 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 Wanderer Fan <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 <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include "DrawUtil.h"
|
||||
|
||||
#include <Mod/TechDraw/App/DrawWeldSymbolPy.h> // generated from DrawWeldSymbolPy.xml
|
||||
|
||||
#include "DrawTile.h"
|
||||
#include "DrawTileWeld.h"
|
||||
#include "DrawWeldSymbol.h"
|
||||
|
||||
using namespace TechDraw;
|
||||
|
||||
//===========================================================================
|
||||
// DrawWeldSymbol - welding symbol
|
||||
//===========================================================================
|
||||
|
||||
PROPERTY_SOURCE(TechDraw::DrawWeldSymbol, TechDraw::DrawView)
|
||||
|
||||
DrawWeldSymbol::DrawWeldSymbol(void)
|
||||
{
|
||||
static const char *group = "Weld Symbol";
|
||||
|
||||
ADD_PROPERTY_TYPE(Leader,(0),group,(App::PropertyType)(App::Prop_None), "Parent Leader");
|
||||
ADD_PROPERTY_TYPE(AllAround, (false), group, App::Prop_None, "All Around Symbol on/off");
|
||||
ADD_PROPERTY_TYPE(FieldWeld, (false), group, App::Prop_None, "Field Weld Symbol on/off");
|
||||
ADD_PROPERTY_TYPE(TailText, (""), group, App::Prop_None, "Text at tail of symbol");
|
||||
|
||||
Caption.setStatus(App::Property::Hidden,true);
|
||||
Scale.setStatus(App::Property::Hidden,true);
|
||||
ScaleType.setStatus(App::Property::Hidden,true);
|
||||
|
||||
}
|
||||
|
||||
DrawWeldSymbol::~DrawWeldSymbol()
|
||||
{
|
||||
}
|
||||
|
||||
void DrawWeldSymbol::onChanged(const App::Property* prop)
|
||||
{
|
||||
if (!isRestoring()) {
|
||||
//nothing in particular
|
||||
}
|
||||
DrawView::onChanged(prop);
|
||||
}
|
||||
|
||||
short DrawWeldSymbol::mustExecute() const
|
||||
{
|
||||
return DrawView::mustExecute();
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn *DrawWeldSymbol::execute(void)
|
||||
{
|
||||
// Base::Console().Message("DWS::execute()\n");
|
||||
if (!keepUpdated()) {
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
|
||||
|
||||
return DrawView::execute();
|
||||
}
|
||||
|
||||
std::vector<DrawTileWeld*> DrawWeldSymbol::getTiles(void) const
|
||||
{
|
||||
// Base::Console().Message("DWS::getTiles()\n");
|
||||
std::vector<App::DocumentObject*> temp;
|
||||
std::vector<DrawTileWeld*> result;
|
||||
|
||||
std::vector<App::DocumentObject*> tiles = getInList();
|
||||
if (!tiles.empty()) {
|
||||
for(std::vector<App::DocumentObject *>::iterator it = tiles.begin(); it != tiles.end(); it++) {
|
||||
if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawTileWeld::getClassTypeId())) {
|
||||
App::DocumentObject* doTemp = (*it);
|
||||
DrawTileWeld* temp = static_cast<DrawTileWeld*>(doTemp);
|
||||
result.push_back(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Base::Console().Message("DWS::getTiles - returns: %d tiles\n",result.size());
|
||||
return result;
|
||||
}
|
||||
|
||||
PyObject *DrawWeldSymbol::getPyObject(void)
|
||||
{
|
||||
if (PythonObject.is(Py::_None())) {
|
||||
// ref counter is set to 1
|
||||
PythonObject = Py::Object(new DrawWeldSymbolPy(this),true);
|
||||
}
|
||||
return Py::new_reference_to(PythonObject);
|
||||
}
|
||||
|
||||
// Python Drawing feature ---------------------------------------------------------
|
||||
|
||||
namespace App {
|
||||
/// @cond DOXERR
|
||||
PROPERTY_SOURCE_TEMPLATE(TechDraw::DrawWeldSymbolPython, TechDraw::DrawWeldSymbol)
|
||||
template<> const char* TechDraw::DrawWeldSymbolPython::getViewProviderName(void) const {
|
||||
return "TechDrawGui::ViewProviderWeld";
|
||||
}
|
||||
/// @endcond
|
||||
|
||||
// explicit template instantiation
|
||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawWeldSymbol>;
|
||||
}
|
||||
|
||||
72
src/Mod/TechDraw/App/DrawWeldSymbol.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 Wanderer Fan <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 _TechDraw_DrawWeldSymbol_h_
|
||||
#define _TechDraw_DrawWeldSymbol_h_
|
||||
|
||||
# include <App/DocumentObject.h>
|
||||
# include <App/FeaturePython.h>
|
||||
|
||||
#include "DrawView.h"
|
||||
|
||||
|
||||
namespace TechDraw
|
||||
{
|
||||
class DrawTile;
|
||||
class DrawTileWeld;
|
||||
|
||||
class TechDrawExport DrawWeldSymbol : public TechDraw::DrawView
|
||||
{
|
||||
PROPERTY_HEADER(TechDraw::DrawWeldSymbol);
|
||||
|
||||
public:
|
||||
DrawWeldSymbol();
|
||||
virtual ~DrawWeldSymbol();
|
||||
|
||||
App::PropertyLink Leader;
|
||||
// App::PropertyLinkList Tiles;
|
||||
App::PropertyBool AllAround;
|
||||
App::PropertyBool FieldWeld;
|
||||
App::PropertyString TailText;
|
||||
|
||||
virtual short mustExecute() const;
|
||||
virtual App::DocumentObjectExecReturn *execute(void);
|
||||
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "TechDrawGui::ViewProviderWeld";
|
||||
}
|
||||
virtual PyObject *getPyObject(void);
|
||||
virtual QRectF getRect() const { return QRectF(0,0,1,1);}
|
||||
|
||||
std::vector<DrawTileWeld*> getTiles(void) const;
|
||||
// void addTile(App::DocumentObject* d);
|
||||
|
||||
protected:
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
typedef App::FeaturePythonT<DrawWeldSymbol> DrawWeldSymbolPython;
|
||||
|
||||
} //namespace TechDraw
|
||||
#endif
|
||||
18
src/Mod/TechDraw/App/DrawWeldSymbolPy.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
|
||||
<PythonExport
|
||||
Father="DrawViewPy"
|
||||
Name="DrawWeldSymbolPy"
|
||||
Twin="DrawWeldSymbol"
|
||||
TwinPointer="DrawWeldSymbol"
|
||||
Include="Mod/TechDraw/App/DrawWeldSymbol.h"
|
||||
Namespace="TechDraw"
|
||||
FatherInclude="Mod/TechDraw/App/DrawViewPy.h"
|
||||
FatherNamespace="TechDraw">
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="WandererFan" EMail="wandererfan@gmail.com" />
|
||||
<UserDocu>Feature for adding welding tiles to leader lines</UserDocu>
|
||||
</Documentation>
|
||||
<CustomAttributes />
|
||||
</PythonExport>
|
||||
</GenerateModel>
|
||||
67
src/Mod/TechDraw/App/DrawWeldSymbolPyImp.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 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 <Base/Console.h>
|
||||
#include <Base/PyObjectBase.h>
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
#include "DrawWeldSymbol.h"
|
||||
|
||||
// inclusion of the generated files (generated out of DrawWeldSymbolPy.xml)
|
||||
#include <Base/VectorPy.h>
|
||||
#include <Mod/TechDraw/App/DrawWeldSymbolPy.h>
|
||||
#include <Mod/TechDraw/App/DrawWeldSymbolPy.cpp>
|
||||
|
||||
using namespace TechDraw;
|
||||
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
std::string DrawWeldSymbolPy::representation(void) const
|
||||
{
|
||||
return std::string("<DrawWeldSymbol object>");
|
||||
}
|
||||
|
||||
//PyObject* DrawWeldSymbolPy::getTiles(PyObject *args)
|
||||
//{
|
||||
// const char* fileSpec;
|
||||
// PyObject* pTile
|
||||
// if (!PyArg_ParseTuple(args, "O", &pTile)) {
|
||||
// throw Py::TypeError("getTiles expected DrawTile");
|
||||
// }
|
||||
// auto dws = getDrawWeldSymbolPtr();
|
||||
//// auto dt = pTile->getDrawTilePtr();
|
||||
////TODO: finish this!
|
||||
// Py_Return;
|
||||
//}
|
||||
|
||||
PyObject *DrawWeldSymbolPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DrawWeldSymbolPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -24,7 +24,7 @@ SET(TechDraw_LineGroupFile
|
||||
)
|
||||
|
||||
add_custom_target(TechDraw_Data ALL
|
||||
SOURCES ${TechDraw_Scripts} ${TechDraw_PATFile} ${TechDraw_LineGroupFile}
|
||||
SOURCES ${TechDraw_Scripts} ${TechDraw_PATFile} ${TechDraw_LineGroupFile}
|
||||
)
|
||||
|
||||
fc_target_copy_resource(TechDraw_Data
|
||||
@@ -86,6 +86,15 @@ INSTALL(
|
||||
PATTERN "*.svg*"
|
||||
)
|
||||
|
||||
INSTALL(
|
||||
DIRECTORY
|
||||
Symbols
|
||||
DESTINATION
|
||||
${CMAKE_INSTALL_DATADIR}/Mod/TechDraw
|
||||
FILES_MATCHING
|
||||
PATTERN "*.svg*"
|
||||
)
|
||||
|
||||
|
||||
#unit test files
|
||||
SET(TDTest_SRCS
|
||||
|
||||
@@ -58,6 +58,8 @@
|
||||
#include "ViewProviderImage.h"
|
||||
#include "ViewProviderRichAnno.h"
|
||||
#include "ViewProviderLeader.h"
|
||||
#include "ViewProviderTile.h"
|
||||
#include "ViewProviderWeld.h"
|
||||
|
||||
|
||||
// use a different name to CreateCommand()
|
||||
@@ -134,6 +136,8 @@ PyMOD_INIT_FUNC(TechDrawGui)
|
||||
TechDrawGui::ViewProviderImage::init();
|
||||
TechDrawGui::ViewProviderLeader::init();
|
||||
TechDrawGui::ViewProviderRichAnno::init();
|
||||
TechDrawGui::ViewProviderTile::init();
|
||||
TechDrawGui::ViewProviderWeld::init();
|
||||
|
||||
// register preferences pages
|
||||
new Gui::PrefPageProducer<TechDrawGui::DlgPrefsTechDrawImp> ("TechDraw");
|
||||
|
||||
@@ -55,6 +55,7 @@ set(TechDrawGui_MOC_HDRS
|
||||
TaskCosVertex.h
|
||||
TaskCenterLine.h
|
||||
TaskLineDecor.h
|
||||
TaskWeldingSymbol.h
|
||||
QGEPath.h
|
||||
QGTracker.h
|
||||
QGILeaderLine.h
|
||||
@@ -63,6 +64,7 @@ set(TechDrawGui_MOC_HDRS
|
||||
mrichtextedit.h
|
||||
mtextedit.h
|
||||
TaskBalloon.h
|
||||
QGIWeldSymbol.h
|
||||
)
|
||||
|
||||
fc_wrap_cpp(TechDrawGui_MOC_SRCS ${TechDrawGui_MOC_HDRS})
|
||||
@@ -91,6 +93,7 @@ set(TechDrawGui_UIC_SRCS
|
||||
TaskCL2Lines.ui
|
||||
TaskLineDecor.ui
|
||||
TaskRestoreLines.ui
|
||||
TaskWeldingSymbol.ui
|
||||
)
|
||||
|
||||
if(BUILD_QT5)
|
||||
@@ -168,6 +171,9 @@ SET(TechDrawGui_SRCS
|
||||
TaskLineDecor.h
|
||||
TaskRestoreLines.ui
|
||||
TaskCL2Lines.ui
|
||||
TaskWeldingSymbol.ui
|
||||
TaskWeldingSymbol.cpp
|
||||
TaskWeldingSymbol.h
|
||||
DrawGuiUtil.cpp
|
||||
DrawGuiUtil.h
|
||||
Rez.cpp
|
||||
@@ -261,6 +267,10 @@ SET(TechDrawGuiView_SRCS
|
||||
QGIRichAnno.h
|
||||
QGMText.h
|
||||
QGMText.cpp
|
||||
QGIWeldSymbol.h
|
||||
QGIWeldSymbol.cpp
|
||||
QGITile.h
|
||||
QGITile.cpp
|
||||
TemplateTextField.cpp
|
||||
TemplateTextField.h
|
||||
ZVALUE.h
|
||||
@@ -302,6 +312,10 @@ SET(TechDrawGuiViewProvider_SRCS
|
||||
ViewProviderLeader.h
|
||||
ViewProviderRichAnno.cpp
|
||||
ViewProviderRichAnno.h
|
||||
ViewProviderTile.cpp
|
||||
ViewProviderTile.h
|
||||
ViewProviderWeld.cpp
|
||||
ViewProviderWeld.h
|
||||
)
|
||||
|
||||
SOURCE_GROUP("MRTE" FILES ${MRTE_SRCS})
|
||||
@@ -323,6 +337,7 @@ SET(TechDrawGuiTaskDlgs_SRCS
|
||||
TaskLineDecor.ui
|
||||
TaskRestoreLines.ui
|
||||
TaskCL2Lines.ui
|
||||
TaskWeldingSymbol.ui
|
||||
)
|
||||
SOURCE_GROUP("TaskDialogs" FILES ${TechDrawGuiTaskDlgs_SRCS})
|
||||
|
||||
|
||||
@@ -48,6 +48,8 @@
|
||||
#include <Mod/TechDraw/App/DrawView.h>
|
||||
#include <Mod/TechDraw/App/DrawViewPart.h>
|
||||
#include <Mod/TechDraw/App/DrawViewAnnotation.h>
|
||||
#include <Mod/TechDraw/App/DrawLeaderLine.h>
|
||||
#include <Mod/TechDraw/App/DrawWeldSymbol.h>
|
||||
#include <Mod/TechDraw/App/DrawPage.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/App/Geometry.h>
|
||||
@@ -60,6 +62,7 @@
|
||||
#include "TaskCosVertex.h"
|
||||
#include "TaskCenterLine.h"
|
||||
#include "TaskLineDecor.h"
|
||||
#include "TaskWeldingSymbol.h"
|
||||
#include "ViewProviderPage.h"
|
||||
#include "ViewProviderViewPart.h"
|
||||
#include "QGVPage.h"
|
||||
@@ -1279,6 +1282,61 @@ bool CmdTechDrawShowAll::isActive(void)
|
||||
return (havePage && haveView);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_WeldSymbol
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdTechDrawWeldSymbol);
|
||||
|
||||
CmdTechDrawWeldSymbol::CmdTechDrawWeldSymbol()
|
||||
: Command("TechDraw_WeldSymbol")
|
||||
{
|
||||
sAppModule = "TechDraw";
|
||||
sGroup = QT_TR_NOOP("TechDraw");
|
||||
sMenuText = QT_TR_NOOP("Add welding information to a leader");
|
||||
sToolTipText = sMenuText;
|
||||
sWhatsThis = "TechDraw_WeldSymbol";
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "actions/techdraw-weldsymbol";
|
||||
}
|
||||
|
||||
void CmdTechDrawWeldSymbol::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
if (dlg != nullptr) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Task In Progress"),
|
||||
QObject::tr("Close active task dialog and try again."));
|
||||
return;
|
||||
}
|
||||
|
||||
TechDraw::DrawPage* page = DrawGuiUtil::findPage(this);
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> leaders = getSelection().
|
||||
getObjectsOfType(TechDraw::DrawLeaderLine::getClassTypeId());
|
||||
if (leaders.size() != 1) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
|
||||
QObject::tr("Select exactly one Leader line."));
|
||||
return;
|
||||
}
|
||||
TechDraw::DrawLeaderLine* baseFeat = nullptr;
|
||||
baseFeat = static_cast<TechDraw::DrawLeaderLine*> (leaders.front());
|
||||
|
||||
Gui::Control().showDialog(new TaskDlgWeldingSymbol(baseFeat));
|
||||
}
|
||||
|
||||
bool CmdTechDrawWeldSymbol::isActive(void)
|
||||
{
|
||||
bool havePage = DrawGuiUtil::needPage(this);
|
||||
bool haveView = DrawGuiUtil::needView(this, false);
|
||||
return (havePage && haveView);
|
||||
}
|
||||
|
||||
|
||||
void CreateTechDrawCommandsAnnotate(void)
|
||||
{
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
@@ -1297,6 +1355,7 @@ void CreateTechDrawCommandsAnnotate(void)
|
||||
rcCmdMgr.addCommand(new CmdTechDrawCosmeticEraser());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawDecorateLine());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawShowAll());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawWeldSymbol());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
#include <Mod/TechDraw/App/DrawViewImage.h>
|
||||
#include <Mod/TechDraw/App/DrawLeaderLine.h>
|
||||
#include <Mod/TechDraw/App/DrawRichAnno.h>
|
||||
#include <Mod/TechDraw/App/DrawWeldSymbol.h>
|
||||
|
||||
#include "Rez.h"
|
||||
#include "QGIDrawingTemplate.h"
|
||||
@@ -365,6 +366,9 @@ bool MDIViewPage::attachView(App::DocumentObject *obj)
|
||||
} else if (typeId.isDerivedFrom(TechDraw::DrawRichAnno::getClassTypeId()) ) {
|
||||
qview = m_view->addRichAnno( static_cast<TechDraw::DrawRichAnno*>(obj) );
|
||||
|
||||
} else if (typeId.isDerivedFrom(TechDraw::DrawWeldSymbol::getClassTypeId()) ) {
|
||||
qview = m_view->addWeldSymbol( static_cast<TechDraw::DrawWeldSymbol*>(obj) );
|
||||
|
||||
} else if (typeId.isDerivedFrom(TechDraw::DrawHatch::getClassTypeId()) ) {
|
||||
//Hatch is not attached like other Views (since it isn't really a View)
|
||||
return true;
|
||||
|
||||
@@ -49,7 +49,8 @@
|
||||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
QGCustomText::QGCustomText()
|
||||
QGCustomText::QGCustomText(QGraphicsItem* parent) :
|
||||
QGraphicsTextItem(parent)
|
||||
{
|
||||
setCacheMode(QGraphicsItem::NoCache);
|
||||
setAcceptHoverEvents(false);
|
||||
@@ -64,12 +65,6 @@ QGCustomText::QGCustomText()
|
||||
void QGCustomText::centerAt(QPointF centerPos)
|
||||
{
|
||||
centerAt(centerPos.x(),centerPos.y());
|
||||
// QRectF box = boundingRect();
|
||||
// double width = box.width();
|
||||
// double height = box.height();
|
||||
// double newX = centerPos.x() - width/2.;
|
||||
// double newY = centerPos.y() - height/2.;
|
||||
// setPos(newX,newY);
|
||||
}
|
||||
|
||||
void QGCustomText::centerAt(double cX, double cY)
|
||||
@@ -82,8 +77,52 @@ void QGCustomText::centerAt(double cX, double cY)
|
||||
setPos(newX,newY);
|
||||
}
|
||||
|
||||
void QGCustomText::justifyLeftAt(QPointF centerPos, bool vCenter)
|
||||
{
|
||||
justifyLeftAt(centerPos.x(),centerPos.y(), vCenter);
|
||||
}
|
||||
|
||||
void QGCustomText::justifyLeftAt(double cX, double cY, bool vCenter)
|
||||
{
|
||||
QRectF box = boundingRect();
|
||||
double height = box.height();
|
||||
double newY = cY - height;
|
||||
if (vCenter) {
|
||||
newY = cY - height/2.;
|
||||
}
|
||||
setPos(cX,newY);
|
||||
}
|
||||
|
||||
void QGCustomText::justifyRightAt(QPointF centerPos, bool vCenter)
|
||||
{
|
||||
justifyRightAt(centerPos.x(),centerPos.y(), vCenter);
|
||||
}
|
||||
|
||||
void QGCustomText::justifyRightAt(double cX, double cY, bool vCenter)
|
||||
{
|
||||
QRectF box = boundingRect();
|
||||
double width = box.width();
|
||||
double height = box.height();
|
||||
double newX = cX - width;
|
||||
double newY = cY - height;
|
||||
if (vCenter) {
|
||||
newY = cY - height/2.;
|
||||
}
|
||||
setPos(newX,newY);
|
||||
}
|
||||
|
||||
double QGCustomText::getHeight(void)
|
||||
{
|
||||
return boundingRect().height();
|
||||
}
|
||||
|
||||
double QGCustomText::getWidth(void)
|
||||
{
|
||||
return boundingRect().width();
|
||||
}
|
||||
QVariant QGCustomText::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
// Base::Console().Message("QGCT::itemChange - this: %X change: %d\n", this, change);
|
||||
if (change == ItemSelectedHasChanged && scene()) {
|
||||
if(isSelected()) {
|
||||
setPrettySel();
|
||||
@@ -112,18 +151,20 @@ void QGCustomText::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
}
|
||||
|
||||
void QGCustomText::setPrettyNormal() {
|
||||
// m_colCurrent = getNormalColor();
|
||||
m_colCurrent = m_colNormal;
|
||||
setDefaultTextColor(m_colNormal);
|
||||
update();
|
||||
}
|
||||
|
||||
void QGCustomText::setPrettyPre() {
|
||||
m_colCurrent = getPreColor();
|
||||
setDefaultTextColor(m_colCurrent);
|
||||
update();
|
||||
}
|
||||
|
||||
void QGCustomText::setPrettySel() {
|
||||
m_colCurrent = getSelectColor();
|
||||
setDefaultTextColor(m_colCurrent);
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -131,31 +172,19 @@ void QGCustomText::paint ( QPainter * painter, const QStyleOptionGraphicsItem *
|
||||
QStyleOptionGraphicsItem myOption(*option);
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
|
||||
// painter->setPen(Qt::green);
|
||||
// painter->drawRect(boundingRect()); //good for debugging
|
||||
|
||||
setDefaultTextColor(m_colCurrent);
|
||||
QGraphicsTextItem::paint (painter, &myOption, widget);
|
||||
}
|
||||
|
||||
QColor QGCustomText::getNormalColor()
|
||||
QColor QGCustomText::getNormalColor() //preference!
|
||||
{
|
||||
QColor result;
|
||||
QGIView *parent;
|
||||
QGraphicsItem* qparent = parentItem();
|
||||
if (qparent == nullptr) {
|
||||
parent = nullptr;
|
||||
} else {
|
||||
parent = dynamic_cast<QGIView *> (qparent);
|
||||
}
|
||||
|
||||
if (parent != nullptr) {
|
||||
result = parent->getNormalColor();
|
||||
} else {
|
||||
Base::Reference<ParameterGrp> hGrp = getParmGroup();
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("NormalColor", 0x00000000));
|
||||
result = fcColor.asValue<QColor>();
|
||||
}
|
||||
Base::Reference<ParameterGrp> hGrp = getParmGroup();
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("NormalColor", 0x00000000));
|
||||
result = fcColor.asValue<QColor>();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,24 +41,34 @@ namespace TechDrawGui
|
||||
class TechDrawGuiExport QGCustomText : public QGraphicsTextItem
|
||||
{
|
||||
public:
|
||||
explicit QGCustomText(void);
|
||||
explicit QGCustomText(QGraphicsItem* parent = nullptr);
|
||||
~QGCustomText() {}
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 130};
|
||||
int type() const { return Type;}
|
||||
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
|
||||
|
||||
void setHighlighted(bool state);
|
||||
virtual void setPrettyNormal();
|
||||
virtual void setPrettyPre();
|
||||
virtual void setPrettySel();
|
||||
|
||||
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
|
||||
virtual void centerAt(QPointF centerPos);
|
||||
virtual void centerAt(double cX, double cY);
|
||||
virtual void justifyLeftAt(QPointF centerPos, bool vCenter = true);
|
||||
virtual void justifyLeftAt(double cX, double cY, bool vCenter = true);
|
||||
virtual void justifyRightAt(QPointF centerPos, bool vCenter = true);
|
||||
virtual void justifyRightAt(double cX, double cY, bool vCenter = true);
|
||||
|
||||
virtual double getHeight(void);
|
||||
virtual double getWidth(void);
|
||||
|
||||
virtual QColor getNormalColor(void);
|
||||
virtual QColor getPreColor(void);
|
||||
virtual QColor getSelectColor(void);
|
||||
virtual void setColor(QColor c) { m_colNormal = c; }
|
||||
virtual void setColor(QColor c) { m_colNormal = c;
|
||||
setDefaultTextColor(c); }
|
||||
|
||||
void makeMark(double x, double y);
|
||||
void makeMark(Base::Vector3d v);
|
||||
|
||||
|
||||
@@ -49,8 +49,10 @@ QGIArrow::QGIArrow() :
|
||||
m_dirMode(false),
|
||||
m_dir(Base::Vector3d(1.0,0.0,0.0))
|
||||
{
|
||||
isFlipped = false;
|
||||
setFill(Qt::SolidPattern);
|
||||
m_brush.setStyle(m_fill);
|
||||
|
||||
|
||||
setCacheMode(QGraphicsItem::NoCache);
|
||||
setAcceptHoverEvents(false);
|
||||
setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
@@ -60,6 +62,7 @@ QGIArrow::QGIArrow() :
|
||||
void QGIArrow::draw() {
|
||||
QPainterPath path;
|
||||
if (m_style == 0) {
|
||||
setFill(Qt::SolidPattern);
|
||||
if (m_dirMode) {
|
||||
path = makeFilledTriangle(getDirection(), m_size,m_size/6.0);
|
||||
} else {
|
||||
|
||||
@@ -83,8 +83,43 @@ void QGIDecoration::setStyle(Qt::PenStyle s)
|
||||
|
||||
void QGIDecoration::setColor(QColor c)
|
||||
{
|
||||
m_colNormal = c;
|
||||
m_colCurrent = c;
|
||||
m_pen.setColor(m_colCurrent);
|
||||
m_brush.setColor(m_colCurrent);
|
||||
}
|
||||
|
||||
QColor QGIDecoration::prefNormalColor()
|
||||
{
|
||||
QColor result;
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("NormalColor", 0x00000000));
|
||||
result = fcColor.asValue<QColor>();
|
||||
return result;
|
||||
}
|
||||
|
||||
QColor QGIDecoration::prefPreColor()
|
||||
{
|
||||
QColor result;
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("PreSelectColor", 0x00000000));
|
||||
result = fcColor.asValue<QColor>();
|
||||
return result;
|
||||
}
|
||||
|
||||
QColor QGIDecoration::prefSelectColor()
|
||||
{
|
||||
QColor result;
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("SelectColor", 0x00000000));
|
||||
result = fcColor.asValue<QColor>();
|
||||
return result;
|
||||
}
|
||||
|
||||
void QGIDecoration::makeMark(double x, double y)
|
||||
|
||||
@@ -52,13 +52,22 @@ public:
|
||||
void setWidth(double w);
|
||||
void setStyle(Qt::PenStyle s);
|
||||
void setColor(QColor c);
|
||||
QColor getColor(void) { return m_colNormal; }
|
||||
void setFill(Qt::BrushStyle bs) { m_brushCurrent = bs; }
|
||||
void makeMark(double x, double y);
|
||||
void makeMark(Base::Vector3d v);
|
||||
|
||||
protected:
|
||||
void setPrettyNormal();
|
||||
void setPrettyPre();
|
||||
void setPrettySel();
|
||||
virtual QColor prefNormalColor(void);
|
||||
virtual QColor prefPreColor(void);
|
||||
virtual QColor prefSelectColor(void);
|
||||
QPen m_pen;
|
||||
QBrush m_brush;
|
||||
QColor m_colCurrent;
|
||||
QColor m_colNormal;
|
||||
double m_width;
|
||||
Qt::PenStyle m_styleCurrent;
|
||||
Qt::BrushStyle m_brushCurrent;
|
||||
|
||||
@@ -48,6 +48,7 @@ QGIEdge::QGIEdge(int index) :
|
||||
{
|
||||
m_width = 1.0;
|
||||
setCosmetic(isCosmetic);
|
||||
setFill(Qt::NoBrush);
|
||||
}
|
||||
|
||||
//NOTE this refers to Qt cosmetic lines
|
||||
|
||||
@@ -361,6 +361,7 @@ void QGILeaderLine::draw()
|
||||
return;
|
||||
}
|
||||
|
||||
m_line->setFill(Qt::NoBrush);
|
||||
m_line->setStyle(m_lineStyle);
|
||||
double scaler = 1.0;
|
||||
m_line->setWidth(scaler * m_lineWidth);
|
||||
@@ -498,6 +499,11 @@ void QGILeaderLine::abandonEdit(void)
|
||||
restoreState();
|
||||
}
|
||||
|
||||
double QGILeaderLine::getLineWidth(void)
|
||||
{
|
||||
return m_lineWidth;
|
||||
}
|
||||
|
||||
TechDraw::DrawLeaderLine* QGILeaderLine::getFeature(void)
|
||||
{
|
||||
TechDraw::DrawLeaderLine* result =
|
||||
@@ -548,6 +554,7 @@ void QGILeaderLine::paint ( QPainter * painter, const QStyleOptionGraphicsItem *
|
||||
QStyleOptionGraphicsItem myOption(*option);
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
|
||||
// painter->setPen(Qt::blue);
|
||||
// painter->drawRect(boundingRect()); //good for debugging
|
||||
|
||||
QGIView::paint (painter, &myOption, widget);
|
||||
|
||||
@@ -82,6 +82,8 @@ public:
|
||||
|
||||
void abandonEdit(void);
|
||||
void closeEdit(void);
|
||||
|
||||
double getLineWidth(void);
|
||||
|
||||
public Q_SLOTS:
|
||||
void onLineEditFinished(QPointF attach, std::vector<QPointF> deltas); //QGEPath is finished editing points
|
||||
|
||||
@@ -42,7 +42,9 @@ using namespace TechDrawGui;
|
||||
|
||||
QGIPrimPath::QGIPrimPath():
|
||||
m_width(0),
|
||||
m_capStyle(Qt::RoundCap)
|
||||
m_capStyle(Qt::RoundCap),
|
||||
m_fill(Qt::NoBrush)
|
||||
// m_fill(Qt::SolidPattern)
|
||||
{
|
||||
setCacheMode(QGraphicsItem::NoCache);
|
||||
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
@@ -129,6 +131,11 @@ void QGIPrimPath::paint ( QPainter * painter, const QStyleOptionGraphicsItem * o
|
||||
m_pen.setColor(m_colCurrent);
|
||||
m_pen.setStyle(m_styleCurrent);
|
||||
setPen(m_pen);
|
||||
|
||||
m_brush.setColor(m_colCurrent);
|
||||
m_brush.setStyle(m_fill);
|
||||
setBrush(m_brush);
|
||||
|
||||
QGraphicsPathItem::paint (painter, &myOption, widget);
|
||||
}
|
||||
|
||||
@@ -256,15 +263,21 @@ Qt::PenCapStyle QGIPrimPath::prefCapStyle()
|
||||
|
||||
void QGIPrimPath::mousePressEvent(QGraphicsSceneMouseEvent * event)
|
||||
{
|
||||
//wf: this seems a bit of a hack. does it mess up selection of QGIPP??
|
||||
QGIView *parent;
|
||||
QGraphicsItem* qparent = parentItem();
|
||||
if (qparent != nullptr) {
|
||||
parent = dynamic_cast<QGIView *> (qparent);
|
||||
if (parent != nullptr) {
|
||||
// Base::Console().Message("QGIPP::mousePressEvent - passing event to QGIV parent\n");
|
||||
parent->mousePressEvent(event);
|
||||
} else {
|
||||
// qparent->mousePressEvent(event); //protected!
|
||||
QGraphicsPathItem::mousePressEvent(event);
|
||||
Base::Console().Log("QGIPP::mousePressEvent - no QGIView parent\n");
|
||||
}
|
||||
} else {
|
||||
// Base::Console().Message("QGIPP::mousePressEvent - passing event to ancestor\n");
|
||||
QGraphicsPathItem::mousePressEvent(event);
|
||||
}
|
||||
QGraphicsPathItem::mousePressEvent(event);
|
||||
}
|
||||
|
||||
@@ -58,6 +58,8 @@ public:
|
||||
void setStyle(int s);
|
||||
virtual void setNormalColor(QColor c);
|
||||
virtual void setCapStyle(Qt::PenCapStyle c);
|
||||
Qt::BrushStyle getFill() { return m_fill; }
|
||||
void setFill(Qt::BrushStyle f) { m_fill = f; }
|
||||
|
||||
protected:
|
||||
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
|
||||
@@ -79,6 +81,9 @@ protected:
|
||||
Qt::PenStyle m_styleCurrent;
|
||||
double m_width;
|
||||
Qt::PenCapStyle m_capStyle;
|
||||
QBrush m_brush;
|
||||
Qt::BrushStyle m_fill;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
351
src/Mod/TechDraw/Gui/QGITile.cpp
Normal file
@@ -0,0 +1,351 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 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_
|
||||
#include <QPainter>
|
||||
#include <QPainterPathStroker>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
#include <QFile>
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/Material.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/App/DrawTile.h>
|
||||
#include <Mod/TechDraw/App/DrawTileWeld.h>
|
||||
|
||||
#include <qmath.h>
|
||||
#include "Rez.h"
|
||||
#include "DrawGuiUtil.h"
|
||||
#include "QGIView.h"
|
||||
#include "QGITile.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
QGITile::QGITile(TechDraw::DrawTile* feat) :
|
||||
m_tileFeat(feat),
|
||||
m_textL(QString()),
|
||||
m_textR(QString()),
|
||||
m_textC(QString()),
|
||||
m_textSize(0.0),
|
||||
m_row(0),
|
||||
m_col(0),
|
||||
m_scale(1.0)
|
||||
{
|
||||
m_qgSvg = new QGCustomSvg();
|
||||
m_qgSvg->setParentItem(this);
|
||||
m_effect = new QGraphicsColorizeEffect();
|
||||
m_qgTextL = new QGCustomText();
|
||||
m_qgTextL->setParentItem(this);
|
||||
m_qgTextR = new QGCustomText();
|
||||
m_qgTextR->setParentItem(this);
|
||||
m_qgTextC = new QGCustomText();
|
||||
m_qgTextC->setParentItem(this);
|
||||
|
||||
m_wide = getSymbolWidth();
|
||||
m_high = getFontSize();
|
||||
m_textSize = getFontSize();
|
||||
m_textL = QString();
|
||||
m_textR = QString();
|
||||
m_textC = QString();
|
||||
m_fontName = getTextFont();
|
||||
m_font = QFont(m_fontName);
|
||||
|
||||
// setHandlesChildEvents(true); //qt4
|
||||
setFiltersChildEvents(true); //qt5
|
||||
setAcceptHoverEvents(true);
|
||||
setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||
setFlag(QGraphicsItem::ItemSendsScenePositionChanges, false);
|
||||
setFlag(QGraphicsItem::ItemSendsGeometryChanges,true);
|
||||
setFlag(QGraphicsItem::ItemStacksBehindParent, true);
|
||||
|
||||
m_colNormal = prefNormalColor();
|
||||
m_colCurrent = m_colNormal;
|
||||
}
|
||||
|
||||
QVariant QGITile::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
// Base::Console().Message("QGIT::itemChange(%d)\n", change);
|
||||
return QGIDecoration::itemChange(change, value);
|
||||
}
|
||||
|
||||
void QGITile::draw(void)
|
||||
{
|
||||
// Base::Console().Message("QGIT::draw()\n");
|
||||
prepareGeometryChange();
|
||||
m_wide = getSymbolWidth();
|
||||
m_high = getSymbolHeight() * scaleToFont();
|
||||
|
||||
makeText();
|
||||
makeSymbol();
|
||||
|
||||
double textWidthL = m_qgTextL->boundingRect().width();
|
||||
double textWidthR = m_qgTextR->boundingRect().width();
|
||||
double totalWidth = m_wide + textWidthL + textWidthR;
|
||||
|
||||
double x = m_origin.x() + m_col * totalWidth; //bit of a hack. sb 0.5 of prev tile + 0.5 of this tile
|
||||
double y = m_origin.y() - (m_row * m_high) - (m_high * 0.5); //inverted y!!
|
||||
setPos(x,y);
|
||||
}
|
||||
|
||||
void QGITile::makeSymbol(void)
|
||||
{
|
||||
// Base::Console().Message("QGIT::makeSymbol()\n");
|
||||
m_effect->setColor(m_colCurrent);
|
||||
|
||||
m_qgSvg->setGraphicsEffect(m_effect);
|
||||
QFile svgFile(m_svgPath);
|
||||
if(svgFile.open(QIODevice::ReadOnly)) {
|
||||
QByteArray qba = svgFile.readAll();
|
||||
if (!m_qgSvg->load(&qba)) {
|
||||
Base::Console().Error("Error - Could not load SVG renderer with %s\n", qPrintable(m_svgPath));
|
||||
}
|
||||
svgFile.close();
|
||||
} else {
|
||||
Base::Console().Error("Error - Could not open file %s\n", qPrintable(m_svgPath));
|
||||
}
|
||||
|
||||
m_qgSvg->setScale(scaleToFont());
|
||||
m_qgSvg->centerAt(0.0, 0.0); //(0,0) is based on symbol size
|
||||
}
|
||||
|
||||
void QGITile::makeText(void)
|
||||
{
|
||||
// Base::Console().Message("QGIT::makeText()\n");
|
||||
prepareGeometryChange();
|
||||
m_font.setPixelSize(getFontSize());
|
||||
double verticalFudge = 0.10; //% of textHeight
|
||||
|
||||
m_qgTextL->setFont(m_font);
|
||||
m_qgTextL->setPlainText(m_textL);
|
||||
m_qgTextL->setColor(m_colCurrent);
|
||||
double textWidth = m_qgTextL->boundingRect().width();
|
||||
double charWidth = textWidth / m_textL.size(); //not good for non-ASCII chars
|
||||
double hMargin = (m_wide / 2.0) + (charWidth / 2.0);
|
||||
|
||||
double textHeightL = m_qgTextL->boundingRect().height();
|
||||
double offsetAdjustL = 0.0;
|
||||
if (m_row < 0) {
|
||||
offsetAdjustL = -textHeightL * verticalFudge;
|
||||
} else {
|
||||
offsetAdjustL = textHeightL * verticalFudge;
|
||||
}
|
||||
double offset = (textHeightL * verticalFudge * m_row) + offsetAdjustL;
|
||||
m_qgTextL->justifyRightAt(-hMargin, -offset, true);
|
||||
|
||||
m_qgTextR->setFont(m_font);
|
||||
m_qgTextR->setPlainText(m_textR);
|
||||
m_qgTextR->setColor(m_colCurrent);
|
||||
textWidth = m_qgTextR->boundingRect().width();
|
||||
charWidth = textWidth / m_textR.size();
|
||||
double textHeightR = m_qgTextR->boundingRect().height();
|
||||
double offsetAdjustR = 0.0;
|
||||
if (m_row < 0) {
|
||||
offsetAdjustR = -textHeightR * verticalFudge;
|
||||
} else {
|
||||
offsetAdjustR = textHeightR * verticalFudge;
|
||||
}
|
||||
offset = (textHeightR * verticalFudge * m_row) + offsetAdjustR;
|
||||
m_qgTextR->justifyLeftAt(hMargin, -offset, true);
|
||||
|
||||
m_qgTextC->setFont(m_font);
|
||||
m_qgTextC->setPlainText(m_textC);
|
||||
m_qgTextC->setColor(m_colCurrent);
|
||||
double textHeightC = m_qgTextC->boundingRect().height();
|
||||
textHeightC = textHeightC;
|
||||
int rowAdjustC = m_row;
|
||||
if (m_row >= 0) {
|
||||
rowAdjustC++;
|
||||
}
|
||||
double offsetAdjustC = textHeightC * verticalFudge;
|
||||
if (m_row < 0) {
|
||||
offsetAdjustC = - offsetAdjustC;
|
||||
}
|
||||
offset = (textHeightC * rowAdjustC) - offsetAdjustC;
|
||||
m_qgTextC->centerAt(0.0, -offset);
|
||||
}
|
||||
|
||||
void QGITile::setTilePosition(QPointF org, int r, int c)
|
||||
{
|
||||
m_origin = org;
|
||||
m_row = r;
|
||||
m_col = c;
|
||||
}
|
||||
|
||||
void QGITile::setTileScale(double s)
|
||||
{
|
||||
m_scale = s;
|
||||
}
|
||||
|
||||
void QGITile::setTileTextLeft(std::string s)
|
||||
{
|
||||
m_textL = QString::fromUtf8(s.c_str());
|
||||
}
|
||||
|
||||
void QGITile::setTileTextRight(std::string s)
|
||||
{
|
||||
m_textR = QString::fromUtf8(s.c_str());
|
||||
}
|
||||
|
||||
void QGITile::setTileTextCenter(std::string s)
|
||||
{
|
||||
m_textC = QString::fromUtf8(s.c_str());
|
||||
}
|
||||
|
||||
//using label font and dimension font size. could change later
|
||||
//void QGITile::setFont(QFont f, double fsize)
|
||||
//{
|
||||
// m_font = f;
|
||||
// m_textSize = fsize;
|
||||
//}
|
||||
|
||||
void QGITile::setSymbolFile(std::string s)
|
||||
{
|
||||
// Base::Console().Message("QGIT::setSymbolFile(%s)\n",s.c_str());
|
||||
if (!s.empty()) {
|
||||
m_svgPath = QString::fromUtf8(s.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void QGITile::setPrettyNormal() {
|
||||
m_colCurrent = m_colNormal;
|
||||
|
||||
m_effect->setColor(m_colNormal);
|
||||
m_qgTextL->setColor(m_colNormal);
|
||||
m_qgTextR->setColor(m_colNormal);
|
||||
m_qgTextC->setColor(m_colNormal);
|
||||
|
||||
draw();
|
||||
}
|
||||
|
||||
void QGITile::setPrettyPre() {
|
||||
m_colCurrent = prefPreColor();
|
||||
|
||||
m_effect->setColor(m_colCurrent);
|
||||
m_qgTextL->setColor(m_colCurrent);
|
||||
m_qgTextR->setColor(m_colCurrent);
|
||||
m_qgTextC->setColor(m_colCurrent);
|
||||
|
||||
draw();
|
||||
}
|
||||
|
||||
void QGITile::setPrettySel() {
|
||||
m_colCurrent = prefSelectColor();
|
||||
|
||||
m_effect->setColor(m_colCurrent);
|
||||
m_qgTextL->setColor(m_colCurrent);
|
||||
m_qgTextR->setColor(m_colCurrent);
|
||||
m_qgTextC->setColor(m_colCurrent);
|
||||
|
||||
draw();
|
||||
}
|
||||
|
||||
|
||||
//TODO: this is Pen, not Brush. sb Brush to colour background
|
||||
QColor QGITile::getTileColor(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
|
||||
App::Color fcColor = App::Color((uint32_t) hGrp->GetUnsigned("TileColor", 0x00000000));
|
||||
return fcColor.asValue<QColor>();
|
||||
}
|
||||
|
||||
double QGITile::getSymbolWidth(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
double w = hGrp->GetFloat("SymbolSize",64);
|
||||
// symbols are only nominally 64x64. they actually have a "border" of 4 - 0.5*stroke(0.5)
|
||||
// so we'll say effectively 62x62? 60 x 60
|
||||
// double w = 64.0;
|
||||
double fudge = 4.0; //allowance for tile border
|
||||
w = w - fudge;
|
||||
return w;
|
||||
}
|
||||
|
||||
double QGITile::getSymbolHeight(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
double h = hGrp->GetFloat("SymbolSize",64);
|
||||
double fudge = 4.0;
|
||||
h = h - fudge;
|
||||
// double h = 60.0;
|
||||
return h;
|
||||
}
|
||||
|
||||
double QGITile::getSymbolFactor(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Decorations");
|
||||
double s = hGrp->GetFloat("SymbolFactor",1.25);
|
||||
// double s = 1.25;
|
||||
return s;
|
||||
}
|
||||
|
||||
double QGITile::getFontSize(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
double sizeMM = hGrp->GetFloat("FontSize", QGIView::DefaultFontSizeInMM);
|
||||
double fontSize = QGIView::calculateFontPixelSize(sizeMM);
|
||||
return fontSize;
|
||||
}
|
||||
|
||||
//factor to scale symbol to match font size
|
||||
double QGITile::scaleToFont(void) const
|
||||
{
|
||||
double fpx = getFontSize();
|
||||
double spx = getSymbolHeight();
|
||||
double factor = getSymbolFactor();
|
||||
double sf = (fpx / spx) * factor;
|
||||
return sf;
|
||||
}
|
||||
|
||||
QString QGITile::getTextFont(void) const
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Labels");
|
||||
std::string fontName = hGrp->GetASCII("LabelFont", "osifont");
|
||||
return QString::fromStdString(fontName);
|
||||
}
|
||||
|
||||
void QGITile::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
|
||||
QStyleOptionGraphicsItem myOption(*option);
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
|
||||
// painter->setPen(Qt::magenta);
|
||||
// painter->drawRect(boundingRect()); //good for debugging
|
||||
|
||||
QGIDecoration::paint (painter, &myOption, widget);
|
||||
}
|
||||
|
||||
QRectF QGITile::boundingRect() const
|
||||
{
|
||||
return childrenBoundingRect();
|
||||
}
|
||||
|
||||
114
src/Mod/TechDraw/Gui/QGITile.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 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 TECHDRAWGUI_QGITILE_H
|
||||
#define TECHDRAWGUI_QGITILE_H
|
||||
|
||||
#include <QFont>
|
||||
#include <QPointF>
|
||||
#include <QGraphicsTextItem>
|
||||
#include <QGraphicsRectItem>
|
||||
#include <QGraphicsEllipseItem>
|
||||
#include <QPainterPath>
|
||||
#include <QColor>
|
||||
#include <QGraphicsColorizeEffect>
|
||||
|
||||
#include <Base/Vector3D.h>
|
||||
|
||||
#include "QGIArrow.h"
|
||||
#include "QGCustomText.h"
|
||||
#include "QGCustomRect.h"
|
||||
#include "QGCustomSvg.h"
|
||||
#include "QGIDecoration.h"
|
||||
|
||||
namespace TechDraw {
|
||||
class DrawTile;
|
||||
class DrawTileWeld;
|
||||
}
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
|
||||
class TechDrawGuiExport QGITile : public QGIDecoration
|
||||
{
|
||||
public:
|
||||
explicit QGITile(TechDraw::DrawTile* tileFeat);
|
||||
~QGITile(void) {}
|
||||
|
||||
enum {Type = QGraphicsItem::UserType + 325};
|
||||
int type(void) const { return Type;}
|
||||
|
||||
virtual void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
|
||||
virtual QRectF boundingRect() const;
|
||||
|
||||
void setTileTextLeft(std::string s);
|
||||
void setTileTextRight(std::string s);
|
||||
void setTileTextCenter(std::string s);
|
||||
void setFont(QFont f, double fsize);
|
||||
void setSymbolFile(std::string s);
|
||||
void setTilePosition(QPointF org, int row, int col);
|
||||
void setTileScale(double s);
|
||||
// double getSymbolScale(void) const;
|
||||
virtual void draw(void);
|
||||
|
||||
protected:
|
||||
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
|
||||
QColor getTileColor(void) const;
|
||||
void setPrettyNormal();
|
||||
void setPrettyPre();
|
||||
void setPrettySel();
|
||||
|
||||
double getSymbolWidth(void) const;
|
||||
double getSymbolHeight(void) const;
|
||||
double getSymbolFactor(void) const;
|
||||
QString getTextFont(void) const;
|
||||
double getFontSize(void) const;
|
||||
double scaleToFont(void) const;
|
||||
void makeSymbol(void);
|
||||
void makeText(void);
|
||||
|
||||
private:
|
||||
TechDraw::DrawTile* m_tileFeat;
|
||||
QGCustomText* m_qgTextL;
|
||||
QGCustomText* m_qgTextR;
|
||||
QGCustomText* m_qgTextC;
|
||||
QGCustomSvg* m_qgSvg;
|
||||
QGraphicsColorizeEffect* m_effect;
|
||||
QString m_svgPath;
|
||||
QString m_textL;
|
||||
QString m_textR;
|
||||
QString m_textC;
|
||||
QString m_fontName;
|
||||
QFont m_font;
|
||||
double m_textSize;
|
||||
int m_row;
|
||||
int m_col;
|
||||
QPointF m_origin;
|
||||
double m_wide;
|
||||
double m_high;
|
||||
double m_scale;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TECHDRAWGUI_QGITILE_H
|
||||
@@ -47,6 +47,8 @@ QGIRichAnno: 233
|
||||
QGMText: 300
|
||||
QGEPath: 301
|
||||
QGMarker: 302
|
||||
QGITile: 325
|
||||
QGIWeldSymbol: 340
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -35,15 +35,16 @@
|
||||
#include <Base/Console.h>
|
||||
//#include <Base/Parameter.h>
|
||||
|
||||
#include "QGIPrimPath.h"
|
||||
#include "QGIVertex.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
QGIVertex::QGIVertex(int index) :
|
||||
projIndex(index),
|
||||
m_radius(2),
|
||||
m_fill(Qt::SolidPattern)
|
||||
m_radius(2)
|
||||
{
|
||||
m_fill = Qt::SolidPattern;
|
||||
m_brush.setStyle(m_fill);
|
||||
|
||||
setRadius(m_radius);
|
||||
@@ -62,8 +63,11 @@ void QGIVertex::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QStyleOptionGraphicsItem myOption(*option);
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
|
||||
m_brush.setColor(m_colCurrent);
|
||||
m_brush.setStyle(m_fill);
|
||||
setBrush(m_brush);
|
||||
// painter->setPen(Qt::blue);
|
||||
// painter->drawRect(boundingRect()); //good for debugging
|
||||
|
||||
// m_brush.setColor(m_colCurrent);
|
||||
// m_brush.setStyle(m_fill);
|
||||
// setBrush(m_brush);
|
||||
QGIPrimPath::paint (painter, &myOption, widget);
|
||||
}
|
||||
|
||||
@@ -42,14 +42,14 @@ public:
|
||||
|
||||
float getRadius() { return m_radius; }
|
||||
virtual void setRadius(float r);
|
||||
Qt::BrushStyle getFill() { return m_fill; }
|
||||
void setFill(Qt::BrushStyle f) { m_fill = f; }
|
||||
/* Qt::BrushStyle getFill() { return m_fill; }*/
|
||||
/* void setFill(Qt::BrushStyle f) { m_fill = f; }*/
|
||||
|
||||
protected:
|
||||
int projIndex;
|
||||
float m_radius;
|
||||
QBrush m_brush;
|
||||
Qt::BrushStyle m_fill;
|
||||
/* QBrush m_brush;*/
|
||||
/* Qt::BrushStyle m_fill;*/
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
@@ -82,7 +82,8 @@ QGIView::QGIView()
|
||||
:QGraphicsItemGroup(),
|
||||
viewObj(nullptr),
|
||||
m_locked(false),
|
||||
m_innerView(false)
|
||||
m_innerView(false),
|
||||
m_selectState(0)
|
||||
{
|
||||
setCacheMode(QGraphicsItem::NoCache);
|
||||
setHandlesChildEvents(false);
|
||||
@@ -215,8 +216,10 @@ QVariant QGIView::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
if (change == ItemSelectedHasChanged && scene()) {
|
||||
if(isSelected()) {
|
||||
m_colCurrent = getSelectColor();
|
||||
m_selectState = 2;
|
||||
} else {
|
||||
m_colCurrent = getNormalColor();
|
||||
m_selectState = 0;
|
||||
}
|
||||
drawBorder();
|
||||
}
|
||||
@@ -257,8 +260,10 @@ void QGIView::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
// TODO don't like this but only solution at the minute (MLP)
|
||||
if (isSelected()) {
|
||||
m_colCurrent = getSelectColor();
|
||||
m_selectState = 2;
|
||||
} else {
|
||||
m_colCurrent = getPreColor();
|
||||
m_selectState = 1;
|
||||
}
|
||||
drawBorder();
|
||||
}
|
||||
@@ -268,8 +273,10 @@ void QGIView::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
Q_UNUSED(event);
|
||||
if(isSelected()) {
|
||||
m_colCurrent = getSelectColor();
|
||||
m_selectState = 1;
|
||||
} else {
|
||||
m_colCurrent = getNormalColor();
|
||||
m_selectState = 0;
|
||||
}
|
||||
drawBorder();
|
||||
}
|
||||
@@ -622,6 +629,7 @@ bool QGIView::getFrameState(void)
|
||||
return result;
|
||||
}
|
||||
|
||||
//TODO: change name to prefNormalColor()
|
||||
QColor QGIView::getNormalColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = getParmGroupCol();
|
||||
|
||||
@@ -105,9 +105,12 @@ public:
|
||||
void alignTo(QGraphicsItem*, const QString &alignment);
|
||||
void setLocked(bool b) { m_locked = b; }
|
||||
|
||||
virtual QColor getNormalColor(void);
|
||||
virtual QColor getPreColor(void);
|
||||
virtual QColor getSelectColor(void);
|
||||
virtual QColor getNormalColor(void); //preference
|
||||
virtual QColor getPreColor(void); //preference
|
||||
virtual QColor getSelectColor(void); //preference
|
||||
virtual QColor getCurrentColor(void) { return m_colCurrent; }
|
||||
virtual QColor getSettingColor(void) { return m_colSetting; }
|
||||
virtual void setSettingColor(QColor c) { m_colSetting = c; }
|
||||
|
||||
static Gui::ViewProvider* getViewProvider(App::DocumentObject* obj);
|
||||
static QGVPage* getGraphicsView(TechDraw::DrawView* dv);
|
||||
@@ -156,6 +159,7 @@ protected:
|
||||
QColor m_colNormal;
|
||||
QColor m_colPre;
|
||||
QColor m_colSel;
|
||||
QColor m_colSetting;
|
||||
QFont m_font;
|
||||
QGCustomLabel* m_label;
|
||||
QGCustomBorder* m_border;
|
||||
@@ -165,6 +169,7 @@ protected:
|
||||
double m_lockWidth;
|
||||
double m_lockHeight;
|
||||
|
||||
int m_selectState;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
441
src/Mod/TechDraw/Gui/QGIWeldSymbol.cpp
Normal file
@@ -0,0 +1,441 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 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_
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
# include <TopoDS_Shape.hxx>
|
||||
# include <TopoDS_Edge.hxx>
|
||||
# include <TopoDS.hxx>
|
||||
# include <BRepAdaptor_Curve.hxx>
|
||||
# include <Precision.hxx>
|
||||
|
||||
# include <QGraphicsScene>
|
||||
# include <QPainter>
|
||||
# include <QPaintDevice>
|
||||
# include <QSvgGenerator>
|
||||
|
||||
# include <math.h>
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/Material.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
#include <Gui/Command.h>
|
||||
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawWeldSymbol.h>
|
||||
#include <Mod/TechDraw/App/DrawLeaderLine.h>
|
||||
#include <Mod/TechDraw/App/DrawTile.h>
|
||||
#include <Mod/TechDraw/App/DrawTileWeld.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/App/Geometry.h>
|
||||
|
||||
#include "Rez.h"
|
||||
#include "ZVALUE.h"
|
||||
#include "ViewProviderWeld.h"
|
||||
#include "MDIViewPage.h"
|
||||
#include "DrawGuiUtil.h"
|
||||
#include "QGVPage.h"
|
||||
#include "QGIPrimPath.h"
|
||||
#include "QGITile.h"
|
||||
#include "QGILeaderLine.h"
|
||||
#include "QGIVertex.h"
|
||||
#include "QGCustomText.h"
|
||||
|
||||
#include "QGIWeldSymbol.h"
|
||||
|
||||
using namespace TechDraw;
|
||||
using namespace TechDrawGui;
|
||||
|
||||
|
||||
//**************************************************************
|
||||
QGIWeldSymbol::QGIWeldSymbol(QGILeaderLine* myParent,
|
||||
TechDraw::DrawWeldSymbol* weld) :
|
||||
m_weldFeat(weld),
|
||||
m_qgLead(myParent),
|
||||
m_blockDraw(false)
|
||||
{
|
||||
// setHandlesChildEvents(true); //qt4 deprecated in qt5
|
||||
setFiltersChildEvents(true); //qt5
|
||||
setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||
|
||||
setCacheMode(QGraphicsItem::NoCache);
|
||||
|
||||
setParentItem(m_qgLead);
|
||||
setViewFeature(weld);
|
||||
m_leadFeat = m_qgLead->getFeature();
|
||||
setZValue(ZVALUE::DIMENSION);
|
||||
|
||||
m_tailText = new QGCustomText();
|
||||
addToGroup(m_tailText);
|
||||
m_colCurrent = getNormalColor(); //preference
|
||||
m_colSetting = m_colCurrent;
|
||||
}
|
||||
|
||||
QVariant QGIWeldSymbol::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
// Base::Console().Message("QGIWS::itemChange(%d)\n", change);
|
||||
if (change == ItemSelectedHasChanged && scene()) {
|
||||
if(isSelected()) {
|
||||
setPrettySel();
|
||||
} else {
|
||||
setPrettyNormal();
|
||||
}
|
||||
draw();
|
||||
} else if(change == ItemSceneChange && scene()) {
|
||||
// nothing special!
|
||||
}
|
||||
return QGIView::itemChange(change, value);
|
||||
}
|
||||
|
||||
void QGIWeldSymbol::updateView(bool update)
|
||||
{
|
||||
// Base::Console().Message("QGIWS::updateView() %s\n",m_weldFeat->getNameInDocument());
|
||||
Q_UNUSED(update);
|
||||
if ( m_weldFeat == nullptr ) {
|
||||
Base::Console().Warning("QGIWS::updateView - no feature!\n");
|
||||
return;
|
||||
}
|
||||
draw();
|
||||
}
|
||||
|
||||
void QGIWeldSymbol::draw()
|
||||
{
|
||||
// Base::Console().Message("QGIWS::draw()- %s\n", m_weldFeat->getNameInDocument());
|
||||
if (!isVisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
removeDecorations();
|
||||
|
||||
std::vector<TechDraw::DrawTileWeld*> tiles = m_weldFeat->getTiles();
|
||||
for (auto& t: tiles) {
|
||||
if (t != nullptr) {
|
||||
QGITile* qt = new QGITile(t);
|
||||
qt->setParentItem(this);
|
||||
m_tiles.push_back(qt);
|
||||
drawTile(t, qt);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_weldFeat->AllAround.getValue()) {
|
||||
drawAllAround();
|
||||
}
|
||||
|
||||
if (m_weldFeat->FieldWeld.getValue()) {
|
||||
drawFieldFlag();
|
||||
}
|
||||
|
||||
if (strlen(m_weldFeat->TailText.getValue()) != 0) {
|
||||
drawProcessText();
|
||||
}
|
||||
}
|
||||
|
||||
void QGIWeldSymbol::drawTile(TechDraw::DrawTileWeld* dtw,
|
||||
QGITile* tile)
|
||||
{
|
||||
// Base::Console().Message("QGIWS::drawTile()\n");
|
||||
double featScale = m_leadFeat->getScale();
|
||||
|
||||
std::string tileTextL = dtw->LeftText.getValue();
|
||||
std::string tileTextR = dtw->RightText.getValue();
|
||||
std::string tileTextC = dtw->CenterText.getValue();
|
||||
tile->setSymbolFile(dtw->SymbolFile.getValue());
|
||||
int tileRow = dtw->TileRow.getValue();
|
||||
int tileCol = dtw->TileColumn.getValue();
|
||||
tile->setTileScale(featScale);
|
||||
|
||||
QPointF org = getTileOrigin();
|
||||
tile->setTilePosition(org, tileRow, tileCol);
|
||||
tile->setColor(getCurrentColor());
|
||||
tile->setTileTextLeft(tileTextL);
|
||||
tile->setTileTextRight(tileTextR);
|
||||
tile->setTileTextCenter(tileTextC);
|
||||
tile->setZValue(ZVALUE::DIMENSION);
|
||||
tile->draw();
|
||||
}
|
||||
|
||||
void QGIWeldSymbol::drawAllAround(void)
|
||||
{
|
||||
// Base::Console().Message("QGIWS::drawAllAround()\n");
|
||||
m_allAround = new QGIVertex(-1);
|
||||
m_allAround->setParentItem(this);
|
||||
|
||||
m_allAround->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
m_allAround->setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||
m_allAround->setAcceptHoverEvents(false);
|
||||
|
||||
m_allAround->setNormalColor(getCurrentColor());
|
||||
|
||||
m_allAround->setFill(Qt::NoBrush);
|
||||
m_allAround->setRadius(calculateFontPixelSize(getDimFontSize()));
|
||||
double width = m_qgLead->getLineWidth();
|
||||
m_allAround->setWidth(width);
|
||||
m_allAround->setZValue(ZVALUE::DIMENSION);
|
||||
|
||||
QPointF allAroundPos = getKinkPoint();
|
||||
m_allAround->setPos(allAroundPos);
|
||||
}
|
||||
|
||||
void QGIWeldSymbol::drawProcessText(void)
|
||||
{
|
||||
// Base::Console().Message("QGIWS::drawProcessText()\n");
|
||||
m_tailText = new QGCustomText();
|
||||
m_tailText->setParentItem(this);
|
||||
|
||||
m_font.setFamily(getPrefFont());
|
||||
m_font.setPixelSize(calculateFontPixelSize(getDimFontSize()));
|
||||
|
||||
m_tailText->setFont(m_font);
|
||||
std::string tText = m_weldFeat->TailText.getValue();
|
||||
m_tailText->setPlainText(
|
||||
QString::fromUtf8(tText.c_str()));
|
||||
m_tailText->setColor(getCurrentColor());
|
||||
m_tailText->setZValue(ZVALUE::DIMENSION);
|
||||
|
||||
QPointF textPos = getTailPoint();
|
||||
|
||||
double textWidth = m_tailText->boundingRect().width();
|
||||
double charWidth = textWidth / tText.size();
|
||||
double hMargin = charWidth + getPrefArrowSize();
|
||||
|
||||
if (isTextRightSide()) {
|
||||
m_tailText->justifyLeftAt(textPos.x() + hMargin, textPos.y(), true);
|
||||
} else {
|
||||
m_tailText->justifyRightAt(textPos.x() - hMargin, textPos.y(), true);
|
||||
}
|
||||
}
|
||||
|
||||
void QGIWeldSymbol::drawFieldFlag()
|
||||
{
|
||||
// Base::Console().Message("QGIWS::drawFieldFlag()\n");
|
||||
std::vector<QPointF> flagPoints = { QPointF(0.0, 0.0),
|
||||
QPointF(0.0, -3.0),
|
||||
QPointF(-2.0, -2.5),
|
||||
QPointF(0.0, -2.0) };
|
||||
//flag sb about 2x text?
|
||||
double scale = calculateFontPixelSize(getDimFontSize()) / 2.0;
|
||||
QPainterPath path;
|
||||
path.moveTo(flagPoints.at(0) * scale);
|
||||
int i = 1;
|
||||
int stop = flagPoints.size();
|
||||
for ( ; i < stop; i++) {
|
||||
path.lineTo(flagPoints.at(i) * scale);
|
||||
}
|
||||
|
||||
m_fieldFlag = new QGIPrimPath();
|
||||
m_fieldFlag->setParentItem(this);
|
||||
|
||||
m_fieldFlag->setFlag(QGraphicsItem::ItemIsSelectable, false);
|
||||
m_fieldFlag->setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||
m_fieldFlag->setAcceptHoverEvents(false);
|
||||
m_fieldFlag->setPath(path);
|
||||
|
||||
m_fieldFlag->setNormalColor(getCurrentColor());
|
||||
m_fieldFlag->setFill(Qt::SolidPattern);
|
||||
double width = m_qgLead->getLineWidth();
|
||||
m_fieldFlag->setWidth(width);
|
||||
m_fieldFlag->setZValue(ZVALUE::DIMENSION);
|
||||
|
||||
QPointF fieldFlagPos = getKinkPoint();
|
||||
m_fieldFlag->setPos(fieldFlagPos);
|
||||
}
|
||||
|
||||
void QGIWeldSymbol::removeDecorations()
|
||||
{
|
||||
// Base::Console().Message("QGIWS::removeDecorations()\n");
|
||||
QList<QGraphicsItem*> children = childItems();
|
||||
for (auto& c:children) {
|
||||
QGITile* tile = dynamic_cast<QGITile*>(c);
|
||||
QGIPrimPath* prim = dynamic_cast<QGIPrimPath*>(c); //allAround, fieldFlag
|
||||
if (tile) {
|
||||
tile->setParentItem(nullptr);
|
||||
scene()->removeItem(tile);
|
||||
delete tile;
|
||||
} else if (prim) {
|
||||
prim->setParentItem(nullptr);
|
||||
scene()->removeItem(prim);
|
||||
delete prim;
|
||||
}
|
||||
}
|
||||
if (m_tailText != nullptr) {
|
||||
m_tailText->setParentItem(nullptr);
|
||||
scene()->removeItem(m_tailText);
|
||||
delete m_tailText;
|
||||
}
|
||||
std::vector<QGITile*> noTiles;
|
||||
m_tiles = noTiles;
|
||||
}
|
||||
|
||||
void QGIWeldSymbol::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
if (isSelected()) {
|
||||
setPrettySel();
|
||||
m_colCurrent = getSelectColor();
|
||||
} else {
|
||||
m_colCurrent = getPreColor();
|
||||
setPrettyPre();
|
||||
}
|
||||
QGIView::hoverEnterEvent(event);
|
||||
}
|
||||
|
||||
void QGIWeldSymbol::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
if(isSelected()) {
|
||||
m_colCurrent = getSelectColor();
|
||||
setPrettySel();
|
||||
} else {
|
||||
m_colCurrent = m_colNormal;
|
||||
setPrettyNormal();
|
||||
}
|
||||
QGIView::hoverLeaveEvent(event);
|
||||
}
|
||||
|
||||
void QGIWeldSymbol::drawBorder()
|
||||
{
|
||||
////Weld Symbols have no border!
|
||||
// QGIView::drawBorder(); //good for debugging
|
||||
}
|
||||
|
||||
void QGIWeldSymbol::setPrettyNormal()
|
||||
{
|
||||
for (auto t: m_tiles) {
|
||||
t->setColor(m_colNormal);
|
||||
t->draw();
|
||||
}
|
||||
m_fieldFlag->setPrettyNormal();
|
||||
m_allAround->setPrettyNormal();
|
||||
m_tailText->setPrettyNormal();
|
||||
}
|
||||
|
||||
void QGIWeldSymbol::setPrettyPre()
|
||||
{
|
||||
// Base::Console().Message("QGIWS::setPrettyPre()\n");
|
||||
for (auto t: m_tiles) {
|
||||
t->setColor(getPreColor());
|
||||
t->draw();
|
||||
}
|
||||
m_fieldFlag->setPrettyPre();
|
||||
m_allAround->setPrettyPre();
|
||||
m_tailText->setPrettyPre();
|
||||
}
|
||||
|
||||
void QGIWeldSymbol::setPrettySel()
|
||||
{
|
||||
// Base::Console().Message("QGIWS::setPrettySel()\n");
|
||||
for (auto t: m_tiles) {
|
||||
t->setColor(getSelectColor());
|
||||
t->draw();
|
||||
}
|
||||
m_fieldFlag->setPrettySel();
|
||||
m_allAround->setPrettySel();
|
||||
m_tailText->setPrettySel();
|
||||
}
|
||||
|
||||
QPointF QGIWeldSymbol::getTileOrigin(void)
|
||||
{
|
||||
Base::Vector3d org = m_leadFeat->getTileOrigin();
|
||||
QPointF result(org.x, org.y);
|
||||
return result;
|
||||
}
|
||||
|
||||
QPointF QGIWeldSymbol::getKinkPoint(void)
|
||||
{
|
||||
Base::Vector3d org = m_leadFeat->getKinkPoint();
|
||||
QPointF result(org.x, org.y);
|
||||
return result;
|
||||
}
|
||||
|
||||
QPointF QGIWeldSymbol::getTailPoint(void)
|
||||
{
|
||||
Base::Vector3d org = m_leadFeat->getTailPoint();
|
||||
QPointF result(org.x, org.y);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool QGIWeldSymbol::isTextRightSide()
|
||||
{
|
||||
bool result = true;
|
||||
Base::Vector3d tail = m_leadFeat->getTailPoint();
|
||||
Base::Vector3d kink = m_leadFeat->getKinkPoint();
|
||||
if (tail.x < kink.x) { //tail is to left
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
TechDraw::DrawWeldSymbol* QGIWeldSymbol::getFeature(void)
|
||||
{
|
||||
TechDraw::DrawWeldSymbol* result =
|
||||
static_cast<TechDraw::DrawWeldSymbol*>(getViewObject());
|
||||
return result;
|
||||
}
|
||||
|
||||
//preference
|
||||
QColor QGIWeldSymbol::getNormalColor()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
|
||||
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/LeaderLines");
|
||||
App::Color fcColor;
|
||||
fcColor.setPackedValue(hGrp->GetUnsigned("Color", 0x00000000));
|
||||
m_colNormal = fcColor.asValue<QColor>();
|
||||
return m_colNormal;
|
||||
}
|
||||
|
||||
double QGIWeldSymbol::getPrefArrowSize()
|
||||
{
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Dimensions");
|
||||
double size = Rez::guiX(hGrp->GetFloat("ArrowSize", 3.5));
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
QRectF QGIWeldSymbol::boundingRect() const
|
||||
{
|
||||
return customChildrenBoundingRect();
|
||||
}
|
||||
|
||||
QPainterPath QGIWeldSymbol::shape() const
|
||||
{
|
||||
return QGraphicsItemGroup::shape();
|
||||
}
|
||||
|
||||
void QGIWeldSymbol::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
|
||||
QStyleOptionGraphicsItem myOption(*option);
|
||||
myOption.state &= ~QStyle::State_Selected;
|
||||
|
||||
// painter->setPen(Qt::red);
|
||||
// painter->drawRect(boundingRect()); //good for debugging
|
||||
|
||||
QGIView::paint (painter, &myOption, widget);
|
||||
}
|
||||
|
||||
#include <Mod/TechDraw/Gui/moc_QGIWeldSymbol.cpp>
|
||||
120
src/Mod/TechDraw/Gui/QGIWeldSymbol.h
Normal file
@@ -0,0 +1,120 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 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 DRAWINGGUI_QGRAPHICSITEMWELDSYMBOL_H
|
||||
#define DRAWINGGUI_QGRAPHICSITEMWELDSYMBOL_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QGraphicsView>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
#include <QGraphicsItem>
|
||||
#include <QGraphicsObject>
|
||||
#include <QPainterPath>
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QPointF>
|
||||
|
||||
#include <Base/Vector3D.h>
|
||||
#include "QGIView.h"
|
||||
|
||||
namespace TechDraw {
|
||||
class DrawWeldSymbol;
|
||||
class DrawWeldSymbol;
|
||||
class DrawView;
|
||||
}
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
class QGIPrimPath;
|
||||
class QGITile;
|
||||
class QGIVertex;
|
||||
class QGCustomText;
|
||||
|
||||
//*******************************************************************
|
||||
|
||||
class TechDrawGuiExport QGIWeldSymbol : public QGIView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum {Type = QGraphicsItem::UserType + 340};
|
||||
|
||||
explicit QGIWeldSymbol(QGILeaderLine* myParent = nullptr,
|
||||
TechDraw::DrawWeldSymbol* lead = nullptr);
|
||||
~QGIWeldSymbol() = default;
|
||||
|
||||
int type() const override { return Type;}
|
||||
virtual void paint( QPainter * painter,
|
||||
const QStyleOptionGraphicsItem * option,
|
||||
QWidget * widget = 0 ) override;
|
||||
virtual QRectF boundingRect() const override;
|
||||
virtual QPainterPath shape(void) const override;
|
||||
double getEdgeFuzz(void) const;
|
||||
|
||||
virtual void drawBorder() override;
|
||||
virtual void updateView(bool update = false) override;
|
||||
|
||||
virtual TechDraw::DrawWeldSymbol* getFeature(void);
|
||||
QPointF getTileOrigin(void);
|
||||
QPointF getKinkPoint(void);
|
||||
QPointF getTailPoint(void);
|
||||
bool isTextRightSide(void);
|
||||
|
||||
virtual void setPrettyNormal();
|
||||
virtual void setPrettySel();
|
||||
virtual void setPrettyPre();
|
||||
|
||||
protected:
|
||||
virtual QVariant itemChange( GraphicsItemChange change,
|
||||
const QVariant &value ) override;
|
||||
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
|
||||
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
|
||||
|
||||
virtual void draw() override;
|
||||
void drawTile(TechDraw::DrawTileWeld* dtw,
|
||||
QGITile* tile);
|
||||
void drawAllAround(void);
|
||||
void drawProcessText(void);
|
||||
void drawFieldFlag();
|
||||
void removeDecorations();
|
||||
|
||||
protected:
|
||||
virtual QColor getNormalColor() override;
|
||||
double getPrefArrowSize();
|
||||
|
||||
TechDraw::DrawWeldSymbol* m_weldFeat;
|
||||
TechDraw::DrawLeaderLine* m_leadFeat;
|
||||
|
||||
QGILeaderLine* m_qgLead;
|
||||
std::vector<QGITile*> m_tiles;
|
||||
QGCustomText* m_tailText;
|
||||
QGIPrimPath* m_fieldFlag;
|
||||
QGIVertex* m_allAround;
|
||||
|
||||
QFont m_font;
|
||||
|
||||
bool m_blockDraw; //prevent redraws while updating.
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // DRAWINGGUI_QGRAPHICSITEMWELDSYMBOL_H
|
||||
@@ -75,6 +75,7 @@
|
||||
#include <Mod/TechDraw/App/DrawViewImage.h>
|
||||
#include <Mod/TechDraw/App/DrawLeaderLine.h>
|
||||
#include <Mod/TechDraw/App/DrawRichAnno.h>
|
||||
#include <Mod/TechDraw/App/DrawWeldSymbol.h>
|
||||
#include <Mod/TechDraw/App/QDomNodeModel.h>
|
||||
|
||||
#include "Rez.h"
|
||||
@@ -96,6 +97,7 @@
|
||||
#include "QGIFace.h"
|
||||
#include "QGILeaderLine.h"
|
||||
#include "QGIRichAnno.h"
|
||||
#include "QGIWeldSymbol.h"
|
||||
|
||||
#include "ZVALUE.h"
|
||||
#include "ViewProviderPage.h"
|
||||
@@ -545,6 +547,34 @@ QGIView * QGVPage::addRichAnno(TechDraw::DrawRichAnno* anno)
|
||||
return annoGroup;
|
||||
}
|
||||
|
||||
QGIView * QGVPage::addWeldSymbol(TechDraw::DrawWeldSymbol* weld)
|
||||
{
|
||||
// Base::Console().Message("QGVP::addWeldSymbol()\n");
|
||||
QGIWeldSymbol* weldGroup = nullptr;
|
||||
TechDraw::DrawView* parentDV = nullptr;
|
||||
|
||||
App::DocumentObject* parentObj = weld->Leader.getValue();
|
||||
if (parentObj != nullptr) {
|
||||
parentDV = dynamic_cast<TechDraw::DrawView*>(parentObj);
|
||||
} else {
|
||||
Base::Console().Message("QGVP::addWeldSymbol - no parent doc obj\n");
|
||||
}
|
||||
if (parentDV != nullptr) {
|
||||
QGIView* parentQV = findQViewForDocObj(parentObj);
|
||||
QGILeaderLine* leadParent = dynamic_cast<QGILeaderLine*>(parentQV);
|
||||
if (leadParent != nullptr) {
|
||||
weldGroup = new QGIWeldSymbol(leadParent, weld);
|
||||
weldGroup->updateView(true);
|
||||
} else {
|
||||
Base::Console().Message("QGVP::addWeldSymbol - no parent QGILL\n");
|
||||
}
|
||||
} else {
|
||||
Base::Console().Message("QGVP::addWeldSymbol - parent is not DV!\n");
|
||||
}
|
||||
return weldGroup;
|
||||
}
|
||||
|
||||
|
||||
//! find the graphic for a DocumentObject
|
||||
QGIView * QGVPage::findQViewForDocObj(App::DocumentObject *obj) const
|
||||
{
|
||||
|
||||
@@ -45,6 +45,7 @@ class DrawViewImage;
|
||||
class DrawLeaderLine;
|
||||
class DrawViewBalloon;
|
||||
class DrawRichAnno;
|
||||
class DrawWeldSymbol;
|
||||
}
|
||||
|
||||
namespace TechDrawGui
|
||||
@@ -84,6 +85,7 @@ public:
|
||||
QGIView * addDrawViewImage(TechDraw::DrawViewImage *view);
|
||||
QGIView * addViewLeader(TechDraw::DrawLeaderLine* view);
|
||||
QGIView * addRichAnno(TechDraw::DrawRichAnno* anno);
|
||||
QGIView * addWeldSymbol(TechDraw::DrawWeldSymbol* weld);
|
||||
|
||||
QGIView* findQViewForDocObj(App::DocumentObject *obj) const;
|
||||
QGIView* getQGIVByName(std::string name);
|
||||
|
||||
@@ -73,6 +73,8 @@
|
||||
<file>icons/actions/techdraw-linedecor.svg</file>
|
||||
<file>icons/actions/techdraw-facedecor.svg</file>
|
||||
<file>icons/actions/techdraw-showall.svg</file>
|
||||
<file>icons/actions/techdraw-weldsymbol.svg</file>
|
||||
<file>icons/actions/techdraw-tile.svg</file>
|
||||
<file>icons/actions/section-up.svg</file>
|
||||
<file>icons/actions/section-down.svg</file>
|
||||
<file>icons/actions/section-left.svg</file>
|
||||
|
||||
158
src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-tile.svg
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
533
src/Mod/TechDraw/Gui/TaskWeldingSymbol.cpp
Normal file
@@ -0,0 +1,533 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 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_
|
||||
#include <cmath>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
|
||||
#endif // #ifndef _PreComp_
|
||||
|
||||
#include <QApplication>
|
||||
#include <QStatusBar>
|
||||
#include <QGraphicsScene>
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/UnitsApi.h>
|
||||
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Control.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/ViewProvider.h>
|
||||
#include <Gui/WaitCursor.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawPage.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/App/DrawView.h>
|
||||
#include <Mod/TechDraw/App/DrawViewPart.h>
|
||||
#include <Mod/TechDraw/App/DrawLeaderLine.h>
|
||||
#include <Mod/TechDraw/App/DrawWeldSymbol.h>
|
||||
#include <Mod/TechDraw/App/DrawTile.h>
|
||||
#include <Mod/TechDraw/App/DrawTileWeld.h>
|
||||
#include <Mod/TechDraw/App/Geometry.h>
|
||||
#include <Mod/TechDraw/App/Cosmetic.h>
|
||||
|
||||
#include <Mod/TechDraw/Gui/ui_TaskWeldingSymbol.h>
|
||||
|
||||
#include "DrawGuiStd.h"
|
||||
#include "QGVPage.h"
|
||||
#include "QGIView.h"
|
||||
#include "QGIPrimPath.h"
|
||||
#include "QGILeaderLine.h"
|
||||
#include "MDIViewPage.h"
|
||||
#include "ViewProviderPage.h"
|
||||
#include "ViewProviderViewPart.h"
|
||||
#include "Rez.h"
|
||||
|
||||
#include "TaskWeldingSymbol.h"
|
||||
|
||||
using namespace Gui;
|
||||
using namespace TechDraw;
|
||||
using namespace TechDrawGui;
|
||||
|
||||
//ctor for creation
|
||||
TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawLeaderLine* leader) :
|
||||
ui(new Ui_TaskWeldingSymbol),
|
||||
m_leadFeat(leader),
|
||||
m_arrowCount(0),
|
||||
m_otherCount(0)
|
||||
{
|
||||
// Base::Console().Message("TWS::TWS() - create mode\n");
|
||||
if (m_leadFeat == nullptr) {
|
||||
//should be caught in CMD caller
|
||||
Base::Console().Error("TaskWeldingSymbol - bad parameters. Can not proceed.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ui->setupUi(this);
|
||||
connect(ui->pbArrow0, SIGNAL(clicked(bool)),
|
||||
this, SLOT(onArrow0Clicked(bool)));
|
||||
connect(ui->pbArrow1, SIGNAL(clicked(bool)),
|
||||
this, SLOT(onArrow1Clicked(bool)));
|
||||
connect(ui->pbOther0, SIGNAL(clicked(bool)),
|
||||
this, SLOT(onOther0Clicked(bool)));
|
||||
connect(ui->pbOther1, SIGNAL(clicked(bool)),
|
||||
this, SLOT(onOther1Clicked(bool)));
|
||||
connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(const QString&)),
|
||||
this, SLOT(onDirectorySelected(const QString&)));
|
||||
|
||||
setUiPrimary();
|
||||
}
|
||||
|
||||
TaskWeldingSymbol::~TaskWeldingSymbol()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void TaskWeldingSymbol::updateTask()
|
||||
{
|
||||
// blockUpdate = true;
|
||||
|
||||
// blockUpdate = false;
|
||||
}
|
||||
|
||||
void TaskWeldingSymbol::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void TaskWeldingSymbol::setUiPrimary()
|
||||
{
|
||||
// Base::Console().Message("TWS::setUiPrimary()\n");
|
||||
setWindowTitle(QObject::tr("Create Welding Symbol"));
|
||||
m_currDir = QString::fromUtf8(prefSymbolDir().c_str());
|
||||
ui->fcSymbolDir->setFileName(m_currDir);
|
||||
loadSymbolNames(m_currDir);
|
||||
|
||||
ui->lwSymbols->setViewMode(QListView::IconMode);
|
||||
ui->lwSymbols->setFlow(QListView::LeftToRight);
|
||||
ui->lwSymbols->setWrapping(true);
|
||||
ui->lwSymbols->setDragEnabled(true);
|
||||
ui->lwSymbols->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
ui->lwSymbols->setAcceptDrops(false);
|
||||
}
|
||||
|
||||
void TaskWeldingSymbol::setUiEdit()
|
||||
{
|
||||
// Base::Console().Message("TWS::setUiEdit()\n");
|
||||
setWindowTitle(QObject::tr("Edit Welding Symbol"));
|
||||
}
|
||||
|
||||
void TaskWeldingSymbol::onArrow0Clicked(bool b)
|
||||
{
|
||||
// Base::Console().Message("TWS::OnArrow0Clicked()\n");
|
||||
Q_UNUSED(b);
|
||||
Qt::KeyboardModifiers km = QApplication::keyboardModifiers();
|
||||
if (km & Qt::ControlModifier) {
|
||||
ui->pbArrow0->setText(QString::fromUtf8("Add"));
|
||||
ui->pbArrow0->setIcon(QIcon());
|
||||
removePendingTile(0,0);
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* sourceItem = ui->lwSymbols->currentItem();
|
||||
QString targetText = sourceItem->text();
|
||||
TechDrawGui::Tile2Add newTile;
|
||||
|
||||
QString iconPath = m_currDir +
|
||||
targetText +
|
||||
QString::fromUtf8(".svg") ;
|
||||
|
||||
QIcon targetIcon(iconPath);
|
||||
QSize iconSize(32,32);
|
||||
ui->pbArrow0->setIcon(targetIcon);
|
||||
ui->pbArrow0->setIconSize(iconSize);
|
||||
ui->pbArrow0->setText(QString());
|
||||
|
||||
newTile.arrowSide = true;
|
||||
newTile.symbolPath = Base::Tools::toStdString(iconPath);
|
||||
newTile.leftText = Base::Tools::toStdString(ui->leLeftText->text());
|
||||
newTile.centerText = Base::Tools::toStdString(ui->leCenterText->text());
|
||||
newTile.rightText = Base::Tools::toStdString(ui->leRightText->text());
|
||||
newTile.row = 0;
|
||||
newTile.col = 0;
|
||||
m_tiles2Add.push_back(newTile);
|
||||
m_arrowCount++;
|
||||
}
|
||||
|
||||
void TaskWeldingSymbol::onArrow1Clicked(bool b)
|
||||
{
|
||||
// Base::Console().Message("TWS::OnArrow1Clicked()\n");
|
||||
Q_UNUSED(b);
|
||||
Qt::KeyboardModifiers km = QApplication::keyboardModifiers();
|
||||
if (km & Qt::ControlModifier) {
|
||||
ui->pbArrow1->setText(QString::fromUtf8("Add"));
|
||||
ui->pbArrow1->setIcon(QIcon());
|
||||
removePendingTile(0,1);
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* sourceItem = ui->lwSymbols->currentItem();
|
||||
QString targetText = sourceItem->text();
|
||||
TechDrawGui::Tile2Add newTile;
|
||||
|
||||
QString iconPath = m_currDir +
|
||||
targetText +
|
||||
QString::fromUtf8(".svg") ;
|
||||
|
||||
QIcon targetIcon(iconPath);
|
||||
QSize iconSize(32,32);
|
||||
ui->pbArrow1->setIcon(targetIcon);
|
||||
ui->pbArrow1->setIconSize(iconSize);
|
||||
ui->pbArrow1->setText(QString());
|
||||
|
||||
newTile.arrowSide = true;
|
||||
newTile.symbolPath = Base::Tools::toStdString(iconPath);
|
||||
newTile.leftText = Base::Tools::toStdString(ui->leLeftText->text());
|
||||
newTile.centerText = Base::Tools::toStdString(ui->leCenterText->text());
|
||||
newTile.rightText = Base::Tools::toStdString(ui->leRightText->text());
|
||||
newTile.row = 0;
|
||||
newTile.col = 1;
|
||||
m_tiles2Add.push_back(newTile);
|
||||
m_arrowCount++;
|
||||
}
|
||||
|
||||
void TaskWeldingSymbol::onOther0Clicked(bool b)
|
||||
{
|
||||
// Base::Console().Message("TWS::onOther0Clicked()\n");
|
||||
Q_UNUSED(b);
|
||||
Qt::KeyboardModifiers km = QApplication::keyboardModifiers();
|
||||
if (km & Qt::ControlModifier) {
|
||||
ui->pbOther0->setText(QString::fromUtf8("Add"));
|
||||
ui->pbOther0->setIcon(QIcon());
|
||||
removePendingTile(-1,0);
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* sourceItem = ui->lwSymbols->currentItem();
|
||||
QString targetText = sourceItem->text();
|
||||
TechDrawGui::Tile2Add newTile;
|
||||
|
||||
QString iconPath = m_currDir +
|
||||
targetText +
|
||||
QString::fromUtf8(".svg") ;
|
||||
|
||||
QIcon targetIcon(iconPath);
|
||||
QSize iconSize(32,32);
|
||||
ui->pbOther0->setIcon(targetIcon);
|
||||
ui->pbOther0->setIconSize(iconSize);
|
||||
ui->pbOther0->setText(QString());
|
||||
|
||||
newTile.arrowSide = false;
|
||||
newTile.symbolPath = Base::Tools::toStdString(iconPath);
|
||||
newTile.leftText = Base::Tools::toStdString(ui->leLeftText->text());
|
||||
newTile.centerText = Base::Tools::toStdString(ui->leCenterText->text());
|
||||
newTile.rightText = Base::Tools::toStdString(ui->leRightText->text());
|
||||
newTile.row = -1;
|
||||
newTile.col = 0;
|
||||
m_tiles2Add.push_back(newTile);
|
||||
m_otherCount++;
|
||||
}
|
||||
|
||||
void TaskWeldingSymbol::onOther1Clicked(bool b)
|
||||
{
|
||||
// Base::Console().Message("TWS::onOther1Clicked()\n");
|
||||
Q_UNUSED(b);
|
||||
Qt::KeyboardModifiers km = QApplication::keyboardModifiers();
|
||||
if (km & Qt::ControlModifier) {
|
||||
ui->pbOther1->setText(QString::fromUtf8("Add"));
|
||||
ui->pbOther1->setIcon(QIcon());
|
||||
removePendingTile(-1,1);
|
||||
return;
|
||||
}
|
||||
|
||||
QListWidgetItem* sourceItem = ui->lwSymbols->currentItem();
|
||||
QString targetText = sourceItem->text();
|
||||
TechDrawGui::Tile2Add newTile;
|
||||
|
||||
QString iconPath = m_currDir +
|
||||
targetText +
|
||||
QString::fromUtf8(".svg") ;
|
||||
|
||||
QIcon targetIcon(iconPath);
|
||||
QSize iconSize(32,32);
|
||||
ui->pbOther1->setIcon(targetIcon);
|
||||
ui->pbOther1->setIconSize(iconSize);
|
||||
ui->pbOther1->setText(QString());
|
||||
|
||||
newTile.arrowSide = false;
|
||||
newTile.symbolPath = Base::Tools::toStdString(iconPath);
|
||||
newTile.leftText = Base::Tools::toStdString(ui->leLeftText->text());
|
||||
newTile.centerText = Base::Tools::toStdString(ui->leCenterText->text());
|
||||
newTile.rightText = Base::Tools::toStdString(ui->leRightText->text());
|
||||
newTile.row = -1;
|
||||
newTile.col = 1;
|
||||
m_tiles2Add.push_back(newTile);
|
||||
m_otherCount++;
|
||||
}
|
||||
|
||||
void TaskWeldingSymbol::onDirectorySelected(const QString& newDir)
|
||||
{
|
||||
// Base::Console().Message("TWS::onDirectorySelected(%s)\n", qPrintable(newDir));
|
||||
m_currDir = newDir + QString::fromUtf8("/");
|
||||
loadSymbolNames(m_currDir);
|
||||
}
|
||||
|
||||
void TaskWeldingSymbol::removePendingTile(int row, int col)
|
||||
{
|
||||
// Base::Console().Message("TWS::removePendingIcon(%d, %d) - tiles in: %d\n",
|
||||
// row, col, m_tiles2Add.size());
|
||||
std::vector<Tile2Add> newList;
|
||||
for (auto& t: m_tiles2Add) {
|
||||
if ((t.row == row) &&
|
||||
(t.col == col) ) {
|
||||
continue;
|
||||
} else {
|
||||
newList.push_back(t);
|
||||
}
|
||||
}
|
||||
m_tiles2Add = newList;
|
||||
}
|
||||
|
||||
|
||||
void TaskWeldingSymbol::blockButtons(bool b)
|
||||
{
|
||||
Q_UNUSED(b);
|
||||
}
|
||||
|
||||
void TaskWeldingSymbol::loadSymbolNames(QString pathToSymbols)
|
||||
{
|
||||
//fill selection list with names and icons
|
||||
QDir symbolDir(pathToSymbols);
|
||||
symbolDir.setFilter(QDir::Files);
|
||||
QStringList fileNames = symbolDir.entryList();
|
||||
|
||||
for (auto& fn: fileNames) {
|
||||
QListWidgetItem* item = new QListWidgetItem(fn, ui->lwSymbols);
|
||||
QFileInfo fi(fn);
|
||||
item->setText(fi.baseName());
|
||||
QIcon symbolIcon(pathToSymbols + fn);
|
||||
item->setIcon(symbolIcon);
|
||||
ui->lwSymbols->addItem(item);
|
||||
}
|
||||
ui->lwSymbols->setCurrentRow(0);
|
||||
ui->lwSymbols->setAcceptDrops(false); //have to do this every time you update the items
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
App::DocumentObject* TaskWeldingSymbol::createWeldingSymbol(void)
|
||||
{
|
||||
// Base::Console().Message("TWS::createWeldingSymbol()\n");
|
||||
Gui::Command::openCommand("Create WeldSymbol");
|
||||
|
||||
std::string symbolName = m_leadFeat->getDocument()->getUniqueObjectName("DrawWeldSymbol");
|
||||
std::string symbolType = "TechDraw::DrawWeldSymbol";
|
||||
|
||||
TechDraw::DrawPage* page = m_leadFeat->findParentPage();
|
||||
std::string pageName = page->getNameInDocument();
|
||||
|
||||
Command::doCommand(Command::Doc,"App.activeDocument().addObject('%s','%s')",
|
||||
symbolType.c_str(),symbolName.c_str());
|
||||
Command::doCommand(Command::Doc,"App.activeDocument().%s.addView(App.activeDocument().%s)",
|
||||
pageName.c_str(), symbolName.c_str());
|
||||
Command::doCommand(Command::Doc,"App.activeDocument().%s.Leader = App.activeDocument().%s",
|
||||
symbolName.c_str(),m_leadFeat->getNameInDocument());
|
||||
|
||||
bool allAround = ui->rbAllAround->isChecked();
|
||||
std::string allAroundText = allAround ? "True" : "False";
|
||||
Command::doCommand(Command::Doc,"App.activeDocument().%s.AllAround = %s",
|
||||
symbolName.c_str(), allAroundText.c_str());
|
||||
|
||||
bool fieldWeld = ui->rbFieldWeld->isChecked();
|
||||
std::string fieldWeldText = fieldWeld ? "True" : "False";
|
||||
Command::doCommand(Command::Doc,"App.activeDocument().%s.FieldWeld = %s",
|
||||
symbolName.c_str(), fieldWeldText.c_str());
|
||||
|
||||
std::string tailText = Base::Tools::toStdString(ui->leProcessText->text());
|
||||
Command::doCommand(Command::Doc,"App.activeDocument().%s.TailText = '%s'",
|
||||
symbolName.c_str(), tailText.c_str());
|
||||
|
||||
App::DocumentObject* newObj = m_leadFeat->getDocument()->getObject(symbolName.c_str());
|
||||
if (newObj == nullptr) {
|
||||
throw Base::RuntimeError("TaskWeldingSymbol - new symbol object not found");
|
||||
}
|
||||
newObj->recomputeFeature();
|
||||
Gui::Command::updateActive();
|
||||
Gui::Command::commitCommand();
|
||||
return newObj;
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> TaskWeldingSymbol::createTiles(void)
|
||||
{
|
||||
// Base::Console().Message("TWS::createTiles()\n");
|
||||
Gui::Command::openCommand("Create Welding Tiles");
|
||||
std::vector<App::DocumentObject*> tileFeats;
|
||||
std::string tileType("TechDraw::DrawTileWeld");
|
||||
for (auto& t: m_tiles2Add) {
|
||||
std::string tileName = m_leadFeat->getDocument()->getUniqueObjectName("DrawTileWeld");
|
||||
Command::doCommand(Command::Doc,"App.activeDocument().addObject('%s','%s')",
|
||||
tileType.c_str(),tileName.c_str());
|
||||
Command::doCommand(Command::Doc,"App.activeDocument().%s.TileRow = %d",
|
||||
tileName.c_str(), t.row);
|
||||
Command::doCommand(Command::Doc,"App.activeDocument().%s.TileColumn = %d",
|
||||
tileName.c_str(), t.col);
|
||||
Command::doCommand(Command::Doc,"App.activeDocument().%s.SymbolFile = '%s'",
|
||||
tileName.c_str(), t.symbolPath.c_str());
|
||||
Command::doCommand(Command::Doc,"App.activeDocument().%s.LeftText = '%s'",
|
||||
tileName.c_str(), t.leftText.c_str());
|
||||
Command::doCommand(Command::Doc,"App.activeDocument().%s.RightText = '%s'",
|
||||
tileName.c_str(), t.rightText.c_str());
|
||||
Command::doCommand(Command::Doc,"App.activeDocument().%s.CenterText = '%s'",
|
||||
tileName.c_str(), t.centerText.c_str());
|
||||
|
||||
App::DocumentObject* newTile = m_leadFeat->getDocument()->getObject(tileName.c_str());
|
||||
if (newTile == nullptr) {
|
||||
throw Base::RuntimeError("TaskWeldingSymbol - new tile object not found");
|
||||
}
|
||||
tileFeats.push_back(newTile);
|
||||
}
|
||||
|
||||
Gui::Command::updateActive();
|
||||
Gui::Command::commitCommand();
|
||||
return tileFeats;
|
||||
}
|
||||
|
||||
void TaskWeldingSymbol::updateWeldingSymbol(void)
|
||||
{
|
||||
// Base::Console().Message("TWS::updateWeldingSymbol()\n");
|
||||
Gui::Command::openCommand("Edit WeldingSymbol");
|
||||
m_weldFeat->requestPaint();
|
||||
|
||||
Gui::Command::updateActive();
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
|
||||
void TaskWeldingSymbol::saveButtons(QPushButton* btnOK,
|
||||
QPushButton* btnCancel)
|
||||
{
|
||||
m_btnOK = btnOK;
|
||||
m_btnCancel = btnCancel;
|
||||
}
|
||||
|
||||
void TaskWeldingSymbol::enableTaskButtons(bool b)
|
||||
{
|
||||
m_btnOK->setEnabled(b);
|
||||
m_btnCancel->setEnabled(b);
|
||||
}
|
||||
|
||||
std::string TaskWeldingSymbol::prefSymbolDir()
|
||||
{
|
||||
std::string defaultDir = App::Application::getResourceDir() + "Mod/TechDraw/Symbols/Welding/AWS/";
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
|
||||
GetGroup("Preferences")->GetGroup("Mod/TechDraw/Files");
|
||||
|
||||
std::string symbolDir = hGrp->GetASCII("WeldingDir", defaultDir.c_str());
|
||||
return symbolDir;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
|
||||
bool TaskWeldingSymbol::accept()
|
||||
{
|
||||
// Base::Console().Message("TWS::accept()\n");
|
||||
std::vector<App::DocumentObject*> tileFeats = createTiles();
|
||||
App::DocumentObject* weldFeat = createWeldingSymbol();
|
||||
for (auto& obj: tileFeats) {
|
||||
TechDraw::DrawTileWeld* tile = dynamic_cast<TechDraw::DrawTileWeld*>(obj);
|
||||
tile->TileParent.setValue(weldFeat);
|
||||
}
|
||||
weldFeat->recomputeFeature();
|
||||
// weldFeat->requestPaint(); //not a dv!
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TaskWeldingSymbol::reject()
|
||||
{
|
||||
// Base::Console().Message("TWS::reject()\n");
|
||||
//nothing to remove.
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"App.activeDocument().recompute()");
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()");
|
||||
|
||||
return false;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
TaskDlgWeldingSymbol::TaskDlgWeldingSymbol(TechDraw::DrawLeaderLine* leader)
|
||||
: TaskDialog()
|
||||
{
|
||||
widget = new TaskWeldingSymbol(leader);
|
||||
taskbox = new Gui::TaskView::TaskBox(Gui::BitmapFactory().pixmap("actions/techdraw-weldsymbol"),
|
||||
widget->windowTitle(), true, 0);
|
||||
taskbox->groupLayout()->addWidget(widget);
|
||||
Content.push_back(taskbox);
|
||||
}
|
||||
|
||||
TaskDlgWeldingSymbol::~TaskDlgWeldingSymbol()
|
||||
{
|
||||
}
|
||||
|
||||
void TaskDlgWeldingSymbol::update()
|
||||
{
|
||||
// widget->updateTask();
|
||||
}
|
||||
|
||||
void TaskDlgWeldingSymbol::modifyStandardButtons(QDialogButtonBox* box)
|
||||
{
|
||||
QPushButton* btnOK = box->button(QDialogButtonBox::Ok);
|
||||
QPushButton* btnCancel = box->button(QDialogButtonBox::Cancel);
|
||||
widget->saveButtons(btnOK, btnCancel);
|
||||
}
|
||||
|
||||
//==== calls from the TaskView ===============================================================
|
||||
void TaskDlgWeldingSymbol::open()
|
||||
{
|
||||
}
|
||||
|
||||
void TaskDlgWeldingSymbol::clicked(int)
|
||||
{
|
||||
}
|
||||
|
||||
bool TaskDlgWeldingSymbol::accept()
|
||||
{
|
||||
widget->accept();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TaskDlgWeldingSymbol::reject()
|
||||
{
|
||||
widget->reject();
|
||||
return true;
|
||||
}
|
||||
|
||||
#include <Mod/TechDraw/Gui/moc_TaskWeldingSymbol.cpp>
|
||||
178
src/Mod/TechDraw/Gui/TaskWeldingSymbol.h
Normal file
@@ -0,0 +1,178 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 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 TECHDRAWGUI_TASKWELDINGSYMBOL_H
|
||||
#define TECHDRAWGUI_TASKWELDINGSYMBOL_H
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Base/Vector3D.h>
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
|
||||
#include <Mod/TechDraw/Gui/ui_TaskWeldingSymbol.h>
|
||||
|
||||
|
||||
class Ui_TaskWeldingSymbol;
|
||||
class Ui_TaskCL2Lines;
|
||||
|
||||
namespace App {
|
||||
class DocumentObject;
|
||||
}
|
||||
|
||||
namespace TechDraw
|
||||
{
|
||||
class DrawPage;
|
||||
class DrawView;
|
||||
class DrawLeaderLine;
|
||||
class DrawWeldSymbol;
|
||||
}
|
||||
|
||||
namespace TechDraw
|
||||
{
|
||||
class Face;
|
||||
}
|
||||
|
||||
namespace TechDrawGui
|
||||
{
|
||||
class QGVPage;
|
||||
class QGIView;
|
||||
class QGILeaderLine;
|
||||
class QGIWeldSymbol;
|
||||
class MDIViewPage;
|
||||
//class ViewProviderWeld;
|
||||
|
||||
class Tile2Add
|
||||
{
|
||||
public:
|
||||
Tile2Add() {};
|
||||
~Tile2Add() = default;
|
||||
bool arrowSide; // or is row enough?
|
||||
int row;
|
||||
int col;
|
||||
std::string leftText;
|
||||
std::string centerText;
|
||||
std::string rightText;
|
||||
std::string symbolPath;
|
||||
};
|
||||
|
||||
class TaskWeldingSymbol : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskWeldingSymbol(TechDraw::DrawLeaderLine* baseFeat);
|
||||
~TaskWeldingSymbol();
|
||||
|
||||
public Q_SLOTS:
|
||||
void onArrow0Clicked(bool b);
|
||||
void onArrow1Clicked(bool b);
|
||||
void onOther0Clicked(bool b);
|
||||
void onOther1Clicked(bool b);
|
||||
void onDirectorySelected(const QString& newDir);
|
||||
|
||||
public:
|
||||
virtual bool accept();
|
||||
virtual bool reject();
|
||||
void updateTask();
|
||||
void saveButtons(QPushButton* btnOK,
|
||||
QPushButton* btnCancel);
|
||||
void enableTaskButtons(bool b);
|
||||
void setFlipped(bool b);
|
||||
|
||||
protected Q_SLOTS:
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
void blockButtons(bool b);
|
||||
void setUiPrimary(void);
|
||||
void setUiEdit();
|
||||
|
||||
void turnOnArrow();
|
||||
void turnOnOther();
|
||||
void removePendingTile(int row, int col);
|
||||
|
||||
|
||||
App::DocumentObject* createWeldingSymbol(void);
|
||||
void updateWeldingSymbol(void);
|
||||
std::vector<App::DocumentObject*> createTiles(void);
|
||||
|
||||
void loadSymbolNames(QString pathToSymbols);
|
||||
|
||||
std::string prefSymbolDir();
|
||||
QString m_currDir;
|
||||
|
||||
|
||||
private:
|
||||
Ui_TaskWeldingSymbol * ui;
|
||||
|
||||
TechDraw::DrawLeaderLine* m_leadFeat;
|
||||
TechDraw::DrawWeldSymbol* m_weldFeat;
|
||||
|
||||
std::vector<Tile2Add> m_tiles2Add;
|
||||
|
||||
QPushButton* m_btnOK;
|
||||
QPushButton* m_btnCancel;
|
||||
|
||||
int m_arrowCount;
|
||||
int m_otherCount;
|
||||
};
|
||||
|
||||
|
||||
class TaskDlgWeldingSymbol : public Gui::TaskView::TaskDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskDlgWeldingSymbol(TechDraw::DrawLeaderLine* leader);
|
||||
~TaskDlgWeldingSymbol();
|
||||
|
||||
public:
|
||||
/// is called the TaskView when the dialog is opened
|
||||
virtual void open();
|
||||
/// is called by the framework if an button is clicked which has no accept or reject role
|
||||
virtual void clicked(int);
|
||||
/// is called by the framework if the dialog is accepted (Ok)
|
||||
virtual bool accept();
|
||||
/// is called by the framework if the dialog is rejected (Cancel)
|
||||
virtual bool reject();
|
||||
/// is called by the framework if the user presses the help button
|
||||
virtual void helpRequested() { return;}
|
||||
virtual bool isAllowedAlterDocument(void) const
|
||||
{ return false; }
|
||||
void update();
|
||||
|
||||
void modifyStandardButtons(QDialogButtonBox* box);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
TaskWeldingSymbol* widget;
|
||||
Gui::TaskView::TaskBox* taskbox;
|
||||
|
||||
};
|
||||
|
||||
} //namespace TechDrawGui
|
||||
|
||||
#endif // #ifndef TECHDRAWGUI_TASKWELDINGSYMBOL_H
|
||||
398
src/Mod/TechDraw/Gui/TaskWeldingSymbol.ui
Normal file
@@ -0,0 +1,398 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TaskWeldingSymbol</class>
|
||||
<widget class="QWidget" name="TaskWeldingSymbol">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>409</width>
|
||||
<height>578</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>250</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Welding Symbol</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="Resources/TechDraw.qrc">
|
||||
<normaloff>:/icons/actions/techdraw-weldsymbol.svg</normaloff>:/icons/actions/techdraw-weldsymbol.svg</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="hlArrowSideLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbArrow0">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add an Arrow Side Symbol</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbArrow1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add an Arrow Side Symbol</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="hlOtherSideLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbOther0">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add an Other Side Symbol</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbOther1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add an Other Side Symbol</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QListWidget" name="lwSymbols">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>256</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select a symbol</string>
|
||||
</property>
|
||||
<property name="movement">
|
||||
<enum>QListView::Static</enum>
|
||||
</property>
|
||||
<property name="flow">
|
||||
<enum>QListView::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="isWrapping" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="resizeMode">
|
||||
<enum>QListView::Adjust</enum>
|
||||
</property>
|
||||
<property name="gridSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="viewMode">
|
||||
<enum>QListView::IconMode</enum>
|
||||
</property>
|
||||
<property name="uniformItemSizes">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="currentRow">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Left Text</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="leLeftText">
|
||||
<property name="toolTip">
|
||||
<string>Text before symbol</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Center Text</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="leCenterText">
|
||||
<property name="toolTip">
|
||||
<string>Text above/below symbol</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Right Text</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="leRightText">
|
||||
<property name="toolTip">
|
||||
<string>Text after symbol</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Symbol Directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::FileChooser" name="fcSymbolDir">
|
||||
<property name="toolTip">
|
||||
<string>Pick a directory of welding symbols</string>
|
||||
</property>
|
||||
<property name="mode">
|
||||
<enum>Gui::FileChooser::Directory</enum>
|
||||
</property>
|
||||
<property name="filter">
|
||||
<string>*.svg</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Process Text</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="leProcessText">
|
||||
<property name="toolTip">
|
||||
<string>Text at end of symbol</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="rbFieldWeld">
|
||||
<property name="toolTip">
|
||||
<string>Show on site flag</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Field Weld</string>
|
||||
</property>
|
||||
<property name="autoExclusive">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QRadioButton" name="rbAllAround">
|
||||
<property name="toolTip">
|
||||
<string>show perimeter circle</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>All Around</string>
|
||||
</property>
|
||||
<property name="autoExclusive">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::FileChooser</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Gui/FileDialog.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="Resources/TechDraw.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -88,9 +88,17 @@ void ViewProviderDrawingView::attach(App::DocumentObject *pcFeat)
|
||||
connectGuiRepaint = feature->signalGuiPaint.connect(bnd);
|
||||
//TODO: would be good to start the QGIV creation process here, but no guarantee we actually have
|
||||
// MDIVP or QGVP yet.
|
||||
// but parent page might. we may not be part of the document yet though!
|
||||
// :( we're not part of the page yet either!
|
||||
} else {
|
||||
Base::Console().Warning("VPDV::attach has no Feature!\n");
|
||||
}
|
||||
// TechDraw::DrawView* view = static_cast<TechDraw::DrawView*>(pcFeat);
|
||||
// TechDraw::DrawPage* page = view->findParentPage();
|
||||
// TechDraw::DrawPage* page = feature->findParentPage();
|
||||
// Base::Console().Message("VPDV::attach(%X) - parent: %X\n",
|
||||
// pcFeat, page);
|
||||
// pcFeat->getNameInDocument(), page->getNameInDocument());
|
||||
}
|
||||
|
||||
void ViewProviderDrawingView::setDisplayMode(const char* ModeName)
|
||||
@@ -232,7 +240,7 @@ MDIViewPage* ViewProviderDrawingView::getMDIViewPage() const
|
||||
{
|
||||
MDIViewPage* result = nullptr;
|
||||
Gui::Document* guiDoc = Gui::Application::Instance->getDocument(getViewObject()->getDocument());
|
||||
Gui::ViewProvider* vp = guiDoc->getViewProvider(getViewObject()->findParentPage());
|
||||
Gui::ViewProvider* vp = guiDoc->getViewProvider(getViewObject()->findParentPage()); //if not in page.views, !@#$%
|
||||
ViewProviderPage* dvp = dynamic_cast<ViewProviderPage*>(vp);
|
||||
if (dvp) {
|
||||
result = dvp->getMDIViewPage();
|
||||
@@ -256,6 +264,9 @@ void ViewProviderDrawingView::onGuiRepaint(const TechDraw::DrawView* dv)
|
||||
} else { //we are not part of the Gui page yet. ask page to add us.
|
||||
//TODO: this bit causes trouble. Should move QGIV creation to attach?
|
||||
// is MDIVP/QGVP available at attach time?
|
||||
// wf: mdivp/qgvp is not necessarily directly available at attach time. It should be available
|
||||
// via the parent DrawPage since the DP is created before any views.
|
||||
// Base::Console().Message("VPDV::onGuiRepaint - no QGIV for: %s\n",dv->getNameInDocument());
|
||||
MDIViewPage* page = getMDIViewPage();
|
||||
if (page != nullptr) {
|
||||
page->addView(dv);
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include <Mod/TechDraw/App/LineGroup.h>
|
||||
#include <Mod/TechDraw/App/DrawLeaderLine.h>
|
||||
#include <Mod/TechDraw/App/DrawRichAnno.h>
|
||||
#include <Mod/TechDraw/App/DrawWeldSymbol.h>
|
||||
|
||||
#include "MDIViewPage.h"
|
||||
#include "QGVPage.h"
|
||||
@@ -153,12 +154,15 @@ std::vector<App::DocumentObject*> ViewProviderLeader::claimChildren(void) const
|
||||
// Collect any child Document Objects and put them in the right place in the Feature tree
|
||||
// valid children of a ViewLeader are:
|
||||
// - Rich Annotations
|
||||
// - Weld Symbols
|
||||
std::vector<App::DocumentObject*> temp;
|
||||
const std::vector<App::DocumentObject *> &views = getFeature()->getInList();
|
||||
try {
|
||||
for(std::vector<App::DocumentObject *>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawRichAnno::getClassTypeId())) {
|
||||
temp.push_back((*it));
|
||||
} else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawWeldSymbol::getClassTypeId())) {
|
||||
temp.push_back((*it));
|
||||
}
|
||||
}
|
||||
return temp;
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#include <Mod/TechDraw/App/DrawLeaderLine.h>
|
||||
#include <Mod/TechDraw/App/DrawRichAnno.h>
|
||||
#include <Mod/TechDraw/App/DrawHatch.h>
|
||||
#include <Mod/TechDraw/App/DrawWeldSymbol.h>
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
|
||||
#include "MDIViewPage.h"
|
||||
@@ -283,10 +284,11 @@ std::vector<App::DocumentObject*> ViewProviderPage::claimChildren(void) const
|
||||
// for Page, valid children are any View except: DrawProjGroupItem
|
||||
// DrawViewDimension
|
||||
// DrawViewBalloon
|
||||
// DrawLeader
|
||||
// DrawRichAnno (if not a child of View)
|
||||
// DrawLeaderLine
|
||||
// DrawRichAnno
|
||||
// any FeatuerView in a DrawViewClip
|
||||
// DrawHatch
|
||||
// DrawWeldSymbol
|
||||
|
||||
const std::vector<App::DocumentObject *> &views = getDrawPage()->Views.getValues();
|
||||
|
||||
@@ -312,6 +314,7 @@ std::vector<App::DocumentObject*> ViewProviderPage::claimChildren(void) const
|
||||
docObj->isDerivedFrom(TechDraw::DrawViewBalloon::getClassTypeId()) ||
|
||||
docObj->isDerivedFrom(TechDraw::DrawRichAnno::getClassTypeId()) ||
|
||||
docObj->isDerivedFrom(TechDraw::DrawLeaderLine::getClassTypeId()) ||
|
||||
docObj->isDerivedFrom(TechDraw::DrawWeldSymbol::getClassTypeId()) ||
|
||||
(featView && featView->isInClip()) )
|
||||
continue;
|
||||
else
|
||||
|
||||
90
src/Mod/TechDraw/Gui/ViewProviderTile.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 Wanderer Fan <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
|
||||
|
||||
/// Here the FreeCAD includes sorted by Base,App,Gui......
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Sequencer.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Gui/SoFCSelection.h>
|
||||
#include <Gui/Selection.h>
|
||||
|
||||
#include "ViewProviderTile.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
PROPERTY_SOURCE(TechDrawGui::ViewProviderTile, Gui::ViewProviderDocumentObject)
|
||||
|
||||
//**************************************************************************
|
||||
// Construction/Destruction
|
||||
|
||||
ViewProviderTile::ViewProviderTile()
|
||||
{
|
||||
sPixmap = "actions/techdraw-tile";
|
||||
}
|
||||
|
||||
ViewProviderTile::~ViewProviderTile()
|
||||
{
|
||||
}
|
||||
|
||||
void ViewProviderTile::attach(App::DocumentObject *pcFeat)
|
||||
{
|
||||
// call parent attach method
|
||||
ViewProviderDocumentObject::attach(pcFeat);
|
||||
}
|
||||
|
||||
void ViewProviderTile::setDisplayMode(const char* ModeName)
|
||||
{
|
||||
ViewProviderDocumentObject::setDisplayMode(ModeName);
|
||||
}
|
||||
|
||||
std::vector<std::string> ViewProviderTile::getDisplayModes(void) const
|
||||
{
|
||||
// get the modes of the father
|
||||
std::vector<std::string> StrList = ViewProviderDocumentObject::getDisplayModes();
|
||||
|
||||
return StrList;
|
||||
}
|
||||
|
||||
void ViewProviderTile::updateData(const App::Property* prop)
|
||||
{
|
||||
ViewProviderDocumentObject::updateData(prop);
|
||||
}
|
||||
|
||||
//TechDraw::DrawTile* ViewProviderTile::getViewObject() const
|
||||
//{
|
||||
// return dynamic_cast<TechDraw::DrawTile*>(pcObject);
|
||||
//}
|
||||
|
||||
TechDraw::DrawTile* ViewProviderTile::getFeature() const
|
||||
{
|
||||
return dynamic_cast<TechDraw::DrawTile*>(pcObject);
|
||||
}
|
||||
59
src/Mod/TechDraw/Gui/ViewProviderTile.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 Wanderer Fan <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 DRAWINGGUI_VIEWPROVIDERTILE_H
|
||||
#define DRAWINGGUI_VIEWPROVIDERTILE_H
|
||||
|
||||
#include <Gui/ViewProviderDocumentObject.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawTile.h>
|
||||
|
||||
namespace TechDrawGui {
|
||||
|
||||
|
||||
class TechDrawGuiExport ViewProviderTile : public Gui::ViewProviderDocumentObject
|
||||
{
|
||||
PROPERTY_HEADER(TechDrawGui::ViewProviderTile);
|
||||
|
||||
public:
|
||||
/// constructor
|
||||
ViewProviderTile();
|
||||
/// destructor
|
||||
virtual ~ViewProviderTile();
|
||||
|
||||
|
||||
virtual void attach(App::DocumentObject *);
|
||||
virtual void setDisplayMode(const char* ModeName);
|
||||
virtual bool useNewSelectionModel(void) const {return false;}
|
||||
/// returns a list of all possible modes
|
||||
virtual std::vector<std::string> getDisplayModes(void) const;
|
||||
virtual void updateData(const App::Property*);
|
||||
|
||||
/* virtual TechDraw::DrawTile* getViewObject() const;*/
|
||||
virtual TechDraw::DrawTile* getFeature() const;
|
||||
};
|
||||
|
||||
} // namespace TechDrawGui
|
||||
|
||||
|
||||
#endif // DRAWINGGUI_VIEWPROVIDERTILE_H
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <Mod/TechDraw/App/DrawViewMulti.h>
|
||||
#include <Mod/TechDraw/App/DrawHatch.h>
|
||||
#include <Mod/TechDraw/App/DrawGeomHatch.h>
|
||||
#include <Mod/TechDraw/App/DrawWeldSymbol.h>
|
||||
#include <Mod/TechDraw/App/LineGroup.h>
|
||||
|
||||
#include<Mod/TechDraw/App/DrawPage.h>
|
||||
|
||||
110
src/Mod/TechDraw/Gui/ViewProviderWeld.cpp
Normal file
@@ -0,0 +1,110 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 Wanderer Fan <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
|
||||
|
||||
/// Here the FreeCAD includes sorted by Base,App,Gui......
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Sequencer.h>
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObject.h>
|
||||
#include <Gui/SoFCSelection.h>
|
||||
#include <Gui/Selection.h>
|
||||
|
||||
#include "ViewProviderWeld.h"
|
||||
|
||||
using namespace TechDrawGui;
|
||||
|
||||
PROPERTY_SOURCE(TechDrawGui::ViewProviderWeld, TechDrawGui::ViewProviderDrawingView)
|
||||
|
||||
//**************************************************************************
|
||||
// Construction/Destruction
|
||||
|
||||
ViewProviderWeld::ViewProviderWeld()
|
||||
{
|
||||
sPixmap = "actions/techdraw-weldsymbol";
|
||||
}
|
||||
|
||||
ViewProviderWeld::~ViewProviderWeld()
|
||||
{
|
||||
}
|
||||
|
||||
void ViewProviderWeld::attach(App::DocumentObject *pcFeat)
|
||||
{
|
||||
// call parent attach method
|
||||
ViewProviderDrawingView::attach(pcFeat);
|
||||
}
|
||||
|
||||
void ViewProviderWeld::setDisplayMode(const char* ModeName)
|
||||
{
|
||||
ViewProviderDrawingView::setDisplayMode(ModeName);
|
||||
}
|
||||
|
||||
std::vector<std::string> ViewProviderWeld::getDisplayModes(void) const
|
||||
{
|
||||
// get the modes of the father
|
||||
std::vector<std::string> StrList = ViewProviderDrawingView::getDisplayModes();
|
||||
|
||||
return StrList;
|
||||
}
|
||||
|
||||
void ViewProviderWeld::updateData(const App::Property* prop)
|
||||
{
|
||||
ViewProviderDrawingView::updateData(prop);
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> ViewProviderWeld::claimChildren(void) const
|
||||
{
|
||||
// Collect any child Document Objects and put them in the right place in the Feature tree
|
||||
// valid children of a DrawWeldSymbol are:
|
||||
// - DrawTiles
|
||||
std::vector<App::DocumentObject*> temp;
|
||||
const std::vector<App::DocumentObject *> &tiles = getFeature()->getInList();
|
||||
try {
|
||||
for(std::vector<App::DocumentObject *>::const_iterator it = tiles.begin(); it != tiles.end(); ++it) {
|
||||
if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawTile::getClassTypeId())) {
|
||||
temp.push_back((*it));
|
||||
}
|
||||
}
|
||||
return temp;
|
||||
} catch (...) {
|
||||
std::vector<App::DocumentObject*> tmp;
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
TechDraw::DrawWeldSymbol* ViewProviderWeld::getViewObject() const
|
||||
{
|
||||
return dynamic_cast<TechDraw::DrawWeldSymbol*>(pcObject);
|
||||
}
|
||||
|
||||
TechDraw::DrawWeldSymbol* ViewProviderWeld::getFeature() const
|
||||
{
|
||||
return getViewObject();
|
||||
}
|
||||
63
src/Mod/TechDraw/Gui/ViewProviderWeld.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2019 Wanderer Fan <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 DRAWINGGUI_VIEWPROVIDERWELD_H
|
||||
#define DRAWINGGUI_VIEWPROVIDERWELD_H
|
||||
|
||||
#include <Gui/ViewProviderFeature.h>
|
||||
|
||||
#include "ViewProviderDrawingView.h"
|
||||
#include <Mod/TechDraw/App/DrawView.h>
|
||||
#include <Mod/TechDraw/App/DrawWeldSymbol.h>
|
||||
#include <Mod/TechDraw/App/DrawTile.h>
|
||||
|
||||
|
||||
namespace TechDrawGui {
|
||||
|
||||
|
||||
class TechDrawGuiExport ViewProviderWeld : public ViewProviderDrawingView
|
||||
{
|
||||
PROPERTY_HEADER(TechDrawGui::ViewProviderWeld);
|
||||
|
||||
public:
|
||||
/// constructor
|
||||
ViewProviderWeld();
|
||||
/// destructor
|
||||
virtual ~ViewProviderWeld();
|
||||
|
||||
virtual void attach(App::DocumentObject *);
|
||||
virtual void setDisplayMode(const char* ModeName);
|
||||
virtual bool useNewSelectionModel(void) const {return false;}
|
||||
/// returns a list of all possible modes
|
||||
virtual std::vector<std::string> getDisplayModes(void) const;
|
||||
virtual void updateData(const App::Property*);
|
||||
virtual std::vector<App::DocumentObject*> claimChildren(void) const;
|
||||
|
||||
virtual TechDraw::DrawWeldSymbol* getViewObject() const;
|
||||
virtual TechDraw::DrawWeldSymbol* getFeature() const;
|
||||
};
|
||||
|
||||
} // namespace TechDrawGui
|
||||
|
||||
|
||||
#endif // DRAWINGGUI_VIEWPROVIDERWELD_H
|
||||
@@ -87,6 +87,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
||||
*draw << "TechDraw_Image";
|
||||
*draw << "TechDraw_ToggleFrame";
|
||||
// *decor << "TechDraw_RedrawPage";
|
||||
*draw << "Separator";
|
||||
*draw << "TechDraw_Annotation";
|
||||
*draw << "TechDraw_LeaderLine";
|
||||
*draw << "TechDraw_RichAnno";
|
||||
@@ -99,7 +100,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
||||
*draw << "TechDraw_CosmeticEraser";
|
||||
*draw << "TechDraw_DecorateLine";
|
||||
*draw << "TechDraw_ShowAll";
|
||||
|
||||
*draw << "TechDraw_WeldSymbol";
|
||||
return root;
|
||||
}
|
||||
|
||||
@@ -168,6 +169,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
*anno << "TechDraw_CosmeticEraser";
|
||||
*anno << "TechDraw_DecorateLine";
|
||||
*anno << "TechDraw_ShowAll";
|
||||
*anno << "TechDraw_WeldSymbol";
|
||||
return root;
|
||||
}
|
||||
|
||||
@@ -234,6 +236,7 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const
|
||||
*anno << "TechDraw_CosmeticEraser";
|
||||
*anno << "TechDraw_DecorateLine";
|
||||
*anno << "TechDraw_ShowAll";
|
||||
*anno << "TechDraw_WeldSymbol";
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
175
src/Mod/TechDraw/Symbols/Welding/AWS/SquareDown.svg
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
171
src/Mod/TechDraw/Symbols/Welding/AWS/SquareUp.svg
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
166
src/Mod/TechDraw/Symbols/Welding/AWS/VDown.svg
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
170
src/Mod/TechDraw/Symbols/Welding/AWS/VUp.svg
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
152
src/Mod/TechDraw/Symbols/Welding/AWS/beadDown.svg
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
152
src/Mod/TechDraw/Symbols/Welding/AWS/beadUp.svg
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
151
src/Mod/TechDraw/Symbols/Welding/AWS/filletDown.svg
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
151
src/Mod/TechDraw/Symbols/Welding/AWS/filletUp.svg
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
30
src/Mod/TechDraw/Symbols/Welding/AWS/filletUpPlain.svg
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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="svg3085"
|
||||
height="64"
|
||||
width="64"
|
||||
version="1.1">
|
||||
<defs
|
||||
id="defs3087" />
|
||||
<metadata
|
||||
id="metadata3090">
|
||||
<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>
|
||||
<path
|
||||
id="path1016"
|
||||
d="M 58.663735,60 H 2.6637352 V 4 Z"
|
||||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1.88976383;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 938 B |
151
src/Mod/TechDraw/Symbols/Welding/AWS/plug.svg
Normal file
|
After Width: | Height: | Size: 4.7 KiB |