fix naming conflicts

This commit is contained in:
WandererFan 2017-01-25 18:36:33 -05:00
parent 42bb64736d
commit 84b858a142
26 changed files with 184 additions and 185 deletions

View File

@ -31,7 +31,7 @@
#include "DrawViewSymbol.h" #include "DrawViewSymbol.h"
#include "DrawViewClip.h" #include "DrawViewClip.h"
#include "DrawHatch.h" #include "DrawHatch.h"
#include "DrawCrosshatch.h" #include "DrawGeomHatch.h"
#include "DrawViewDraft.h" #include "DrawViewDraft.h"
#include "DrawViewArch.h" #include "DrawViewArch.h"
#include "DrawViewSpreadsheet.h" #include "DrawViewSpreadsheet.h"
@ -85,7 +85,7 @@ PyMODINIT_FUNC initTechDraw()
TechDraw::DrawViewClip ::init(); TechDraw::DrawViewClip ::init();
TechDraw::DrawHatch ::init(); TechDraw::DrawHatch ::init();
TechDraw::DrawCrosshatch ::init(); TechDraw::DrawGeomHatch ::init();
TechDraw::DrawViewDraft ::init(); TechDraw::DrawViewDraft ::init();
TechDraw::DrawViewArch ::init(); TechDraw::DrawViewArch ::init();
TechDraw::DrawViewImage ::init(); TechDraw::DrawViewImage ::init();

View File

@ -37,7 +37,7 @@ generate_from_xml(DrawViewSymbolPy)
generate_from_xml(DrawViewClipPy) generate_from_xml(DrawViewClipPy)
generate_from_xml(DrawViewDimensionPy) generate_from_xml(DrawViewDimensionPy)
generate_from_xml(DrawHatchPy) generate_from_xml(DrawHatchPy)
generate_from_xml(DrawCrosshatchPy) generate_from_xml(DrawGeomHatchPy)
generate_from_xml(DrawViewCollectionPy) generate_from_xml(DrawViewCollectionPy)
generate_from_xml(DrawProjGroupPy) generate_from_xml(DrawProjGroupPy)
generate_from_xml(DrawProjGroupItemPy) generate_from_xml(DrawProjGroupItemPy)
@ -75,8 +75,8 @@ SET(Draw_SRCS
DrawViewSection.h DrawViewSection.h
DrawHatch.cpp DrawHatch.cpp
DrawHatch.h DrawHatch.h
DrawCrosshatch.cpp DrawGeomHatch.cpp
DrawCrosshatch.h DrawGeomHatch.h
DrawViewDraft.cpp DrawViewDraft.cpp
DrawViewDraft.h DrawViewDraft.h
DrawViewArch.cpp DrawViewArch.cpp
@ -133,8 +133,8 @@ SET(Python_SRCS
DrawViewDimensionPyImp.cpp DrawViewDimensionPyImp.cpp
DrawHatchPy.xml DrawHatchPy.xml
DrawHatchPyImp.cpp DrawHatchPyImp.cpp
DrawCrosshatchPy.xml DrawGeomHatchPy.xml
DrawCrosshatchPyImp.cpp DrawGeomHatchPyImp.cpp
DrawViewCollectionPy.xml DrawViewCollectionPy.xml
DrawViewCollectionPyImp.cpp DrawViewCollectionPyImp.cpp
DrawProjGroupPy.xml DrawProjGroupPy.xml

View File

@ -1,32 +0,0 @@
#include "PreCompiled.h"
#include "DrawCrosshatch.h"
// inclusion of the generated files (generated out of DrawCrosshatchPy.xml)
#include <Mod/TechDraw/App/DrawCrosshatchPy.h>
#include <Mod/TechDraw/App/DrawCrosshatchPy.cpp>
using namespace TechDraw;
// returns a string which represents the object e.g. when printed in python
std::string DrawCrosshatchPy::representation(void) const
{
return std::string("<DrawCrosshatch object>");
}
PyObject *DrawCrosshatchPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
}
int DrawCrosshatchPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
}

View File

@ -65,39 +65,39 @@
#include "Geometry.h" #include "Geometry.h"
#include "DrawViewPart.h" #include "DrawViewPart.h"
#include "DrawViewSection.h" #include "DrawViewSection.h"
#include "DrawCrosshatch.h" #include "DrawGeomHatch.h"
#include <Mod/TechDraw/App/DrawCrosshatchPy.h> // generated from DrawCrosshatchPy.xml #include <Mod/TechDraw/App/DrawGeomHatchPy.h> // generated from DrawGeomHatchPy.xml
using namespace TechDraw; using namespace TechDraw;
using namespace TechDrawGeometry; using namespace TechDrawGeometry;
using namespace std; using namespace std;
PROPERTY_SOURCE(TechDraw::DrawCrosshatch, App::DocumentObject) PROPERTY_SOURCE(TechDraw::DrawGeomHatch, App::DocumentObject)
DrawCrosshatch::DrawCrosshatch(void) DrawGeomHatch::DrawGeomHatch(void)
{ {
static const char *vgroup = "Crosshatch"; static const char *vgroup = "GeomHatch";
ADD_PROPERTY_TYPE(Source,(0),vgroup,(App::PropertyType)(App::Prop_None),"The View + Face to be crosshatched"); ADD_PROPERTY_TYPE(Source,(0),vgroup,(App::PropertyType)(App::Prop_None),"The View + Face to be crosshatched");
ADD_PROPERTY_TYPE(FilePattern ,(""),vgroup,App::Prop_None,"The crosshatch pattern file for this area"); ADD_PROPERTY_TYPE(FilePattern ,(""),vgroup,App::Prop_None,"The crosshatch pattern file for this area");
ADD_PROPERTY_TYPE(NamePattern,(""),vgroup,App::Prop_None,"The name of the pattern"); ADD_PROPERTY_TYPE(NamePattern,(""),vgroup,App::Prop_None,"The name of the pattern");
ADD_PROPERTY_TYPE(ScalePattern,(1.0),vgroup,App::Prop_None,"Crosshatch pattern size adjustment"); ADD_PROPERTY_TYPE(ScalePattern,(1.0),vgroup,App::Prop_None,"GeomHatch pattern size adjustment");
getParameters(); getParameters();
} }
DrawCrosshatch::~DrawCrosshatch() DrawGeomHatch::~DrawGeomHatch()
{ {
} }
void DrawCrosshatch::onChanged(const App::Property* prop) void DrawGeomHatch::onChanged(const App::Property* prop)
{ {
if (prop == &Source ) { if (prop == &Source ) {
if (!isRestoring()) { if (!isRestoring()) {
DrawCrosshatch::execute(); DrawGeomHatch::execute();
} }
} }
@ -120,7 +120,7 @@ void DrawCrosshatch::onChanged(const App::Property* prop)
App::DocumentObject::onChanged(prop); App::DocumentObject::onChanged(prop);
} }
short DrawCrosshatch::mustExecute() const short DrawGeomHatch::mustExecute() const
{ {
short result = 0; short result = 0;
if (!isRestoring()) { if (!isRestoring()) {
@ -136,20 +136,20 @@ short DrawCrosshatch::mustExecute() const
} }
App::DocumentObjectExecReturn *DrawCrosshatch::execute(void) App::DocumentObjectExecReturn *DrawGeomHatch::execute(void)
{ {
return App::DocumentObject::StdReturn; return App::DocumentObject::StdReturn;
} }
DrawViewPart* DrawCrosshatch::getSourceView(void) const DrawViewPart* DrawGeomHatch::getSourceView(void) const
{ {
App::DocumentObject* obj = Source.getValue(); App::DocumentObject* obj = Source.getValue();
DrawViewPart* result = dynamic_cast<DrawViewPart*>(obj); DrawViewPart* result = dynamic_cast<DrawViewPart*>(obj);
return result; return result;
} }
std::vector<HatchLine> DrawCrosshatch::getDecodedSpecsFromFile() std::vector<HatchLine> DrawGeomHatch::getDecodedSpecsFromFile()
{ {
std::string fileSpec = FilePattern.getValue(); std::string fileSpec = FilePattern.getValue();
std::string myPattern = NamePattern.getValue(); std::string myPattern = NamePattern.getValue();
@ -159,12 +159,12 @@ std::vector<HatchLine> DrawCrosshatch::getDecodedSpecsFromFile()
//!get all the specification lines and decode them into HatchLine structures //!get all the specification lines and decode them into HatchLine structures
/*static*/ /*static*/
std::vector<HatchLine> DrawCrosshatch::getDecodedSpecsFromFile(std::string fileSpec, std::string myPattern) std::vector<HatchLine> DrawGeomHatch::getDecodedSpecsFromFile(std::string fileSpec, std::string myPattern)
{ {
std::vector<HatchLine> result; std::vector<HatchLine> result;
Base::FileInfo fi(fileSpec); Base::FileInfo fi(fileSpec);
if (!fi.isReadable()) { if (!fi.isReadable()) {
Base::Console().Error("DrawCrosshatch::getDecodedSpecsFromFile not able to open %s!\n",fileSpec.c_str()); Base::Console().Error("DrawGeomHatch::getDecodedSpecsFromFile not able to open %s!\n",fileSpec.c_str());
return result; return result;
} }
result = HatchLine::getSpecsForPattern(fileSpec,myPattern); result = HatchLine::getSpecsForPattern(fileSpec,myPattern);
@ -172,7 +172,7 @@ std::vector<HatchLine> DrawCrosshatch::getDecodedSpecsFromFile(std::string fileS
return result; return result;
} }
std::vector<LineSet> DrawCrosshatch::getDrawableLines(int i) //get the drawable lines for face i std::vector<LineSet> DrawGeomHatch::getDrawableLines(int i) //get the drawable lines for face i
{ {
std::vector<LineSet> result; std::vector<LineSet> result;
DrawViewPart* source = getSourceView(); DrawViewPart* source = getSourceView();
@ -185,7 +185,7 @@ std::vector<LineSet> DrawCrosshatch::getDrawableLines(int i) //get the drawab
} }
/* static */ /* static */
std::vector<LineSet> DrawCrosshatch::getDrawableLines(DrawViewPart* source, std::vector<LineSet> lineSets, int iface, double scale ) std::vector<LineSet> DrawGeomHatch::getDrawableLines(DrawViewPart* source, std::vector<LineSet> lineSets, int iface, double scale )
{ {
std::vector<LineSet> result; std::vector<LineSet> result;
@ -230,7 +230,7 @@ std::vector<LineSet> DrawCrosshatch::getDrawableLines(DrawViewPart* source, std:
for (auto& ls: lineSets) { for (auto& ls: lineSets) {
HatchLine hl = ls.getHatchLine(); HatchLine hl = ls.getHatchLine();
std::vector<TopoDS_Edge> candidates = DrawCrosshatch::makeEdgeOverlay(hl, bBox, scale); std::vector<TopoDS_Edge> candidates = DrawGeomHatch::makeEdgeOverlay(hl, bBox, scale);
//make Compound for this linespec //make Compound for this linespec
BRep_Builder builder; BRep_Builder builder;
@ -275,7 +275,7 @@ std::vector<LineSet> DrawCrosshatch::getDrawableLines(DrawViewPart* source, std:
return result; return result;
} }
/* static */ /* static */
std::vector<TopoDS_Edge> DrawCrosshatch::makeEdgeOverlay(HatchLine hl, Bnd_Box b, double scale) std::vector<TopoDS_Edge> DrawGeomHatch::makeEdgeOverlay(HatchLine hl, Bnd_Box b, double scale)
{ {
std::vector<TopoDS_Edge> result; std::vector<TopoDS_Edge> result;
@ -374,7 +374,7 @@ std::vector<TopoDS_Edge> DrawCrosshatch::makeEdgeOverlay(HatchLine hl, Bnd_Box b
return result; return result;
} }
TopoDS_Edge DrawCrosshatch::makeLine(Base::Vector3d s, Base::Vector3d e) TopoDS_Edge DrawGeomHatch::makeLine(Base::Vector3d s, Base::Vector3d e)
{ {
TopoDS_Edge result; TopoDS_Edge result;
gp_Pnt start(s.x,s.y,0.0); gp_Pnt start(s.x,s.y,0.0);
@ -386,7 +386,7 @@ TopoDS_Edge DrawCrosshatch::makeLine(Base::Vector3d s, Base::Vector3d e)
return result; return result;
} }
void DrawCrosshatch::getParameters(void) void DrawGeomHatch::getParameters(void)
{ {
//this is probably "/build/data/Mod/TechDraw/PAT" //this is probably "/build/data/Mod/TechDraw/PAT"
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter() Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
@ -410,10 +410,10 @@ void DrawCrosshatch::getParameters(void)
} }
PyObject *DrawCrosshatch::getPyObject(void) PyObject *DrawGeomHatch::getPyObject(void)
{ {
if (PythonObject.is(Py::_None())) { if (PythonObject.is(Py::_None())) {
PythonObject = Py::Object(new DrawCrosshatchPy(this),true); PythonObject = Py::Object(new DrawGeomHatchPy(this),true);
} }
return Py::new_reference_to(PythonObject); return Py::new_reference_to(PythonObject);
} }
@ -422,12 +422,12 @@ PyObject *DrawCrosshatch::getPyObject(void)
namespace App { namespace App {
/// @cond DOXERR /// @cond DOXERR
PROPERTY_SOURCE_TEMPLATE(TechDraw::DrawCrosshatchPython, TechDraw::DrawCrosshatch) PROPERTY_SOURCE_TEMPLATE(TechDraw::DrawGeomHatchPython, TechDraw::DrawGeomHatch)
template<> const char* TechDraw::DrawCrosshatchPython::getViewProviderName(void) const { template<> const char* TechDraw::DrawGeomHatchPython::getViewProviderName(void) const {
return "TechDrawGui::ViewProviderCrosshatch"; return "TechDrawGui::ViewProviderGeomHatch";
} }
/// @endcond /// @endcond
// explicit template instantiation // explicit template instantiation
template class TechDrawExport FeaturePythonT<TechDraw::DrawCrosshatch>; template class TechDrawExport FeaturePythonT<TechDraw::DrawGeomHatch>;
} }

View File

@ -20,8 +20,8 @@
* * * *
***************************************************************************/ ***************************************************************************/
#ifndef _TechDraw_DrawCrosshatch_h_ #ifndef _TechDraw_DrawGeomHatch_h_
#define _TechDraw_DrawCrosshatch_h_ #define _TechDraw_DrawGeomHatch_h_
# include <App/DocumentObject.h> # include <App/DocumentObject.h>
# include <App/FeaturePython.h> # include <App/FeaturePython.h>
@ -43,13 +43,13 @@ class HatchLine;
class LineSet; class LineSet;
class DashSet; class DashSet;
class TechDrawExport DrawCrosshatch : public App::DocumentObject class TechDrawExport DrawGeomHatch : public App::DocumentObject
{ {
PROPERTY_HEADER(TechDraw::DrawCrosshatch); PROPERTY_HEADER(TechDraw::DrawGeomHatch);
public: public:
DrawCrosshatch(); DrawGeomHatch();
virtual ~DrawCrosshatch(); virtual ~DrawGeomHatch();
App::PropertyLinkSub Source; //the dvX & face(s) this crosshatch belongs to App::PropertyLinkSub Source; //the dvX & face(s) this crosshatch belongs to
App::PropertyFile FilePattern; App::PropertyFile FilePattern;
@ -60,7 +60,7 @@ public:
virtual App::DocumentObjectExecReturn *execute(void); virtual App::DocumentObjectExecReturn *execute(void);
virtual void onChanged(const App::Property* prop); virtual void onChanged(const App::Property* prop);
virtual const char* getViewProviderName(void) const { virtual const char* getViewProviderName(void) const {
return "TechDrawGui::ViewProviderCrosshatch"; return "TechDrawGui::ViewProviderGeomHatch";
} }
virtual PyObject *getPyObject(void); virtual PyObject *getPyObject(void);
@ -81,7 +81,7 @@ protected:
private: private:
}; };
typedef App::FeaturePythonT<DrawCrosshatch> DrawCrosshatchPython; typedef App::FeaturePythonT<DrawGeomHatch> DrawGeomHatchPython;

View File

@ -2,16 +2,16 @@
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd"> <GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport <PythonExport
Father="DocumentObjectPy" Father="DocumentObjectPy"
Name="DrawCrosshatchPy" Name="DrawGeomHatchPy"
Twin="DrawCrosshatch" Twin="DrawGeomHatch"
TwinPointer="DrawCrosshatch" TwinPointer="DrawGeomHatch"
Include="Mod/TechDraw/App/DrawCrosshatch.h" Include="Mod/TechDraw/App/DrawGeomHatch.h"
Namespace="TechDraw" Namespace="TechDraw"
FatherInclude="App/DocumentObjectPy.h" FatherInclude="App/DocumentObjectPy.h"
FatherNamespace="App"> FatherNamespace="App">
<Documentation> <Documentation>
<Author Licence="LGPL" Name="WandererFan" EMail="wandererfan@gmail.com" /> <Author Licence="LGPL" Name="WandererFan" EMail="wandererfan@gmail.com" />
<UserDocu>Feature for creating and manipulating Technical Drawing Crosshatch areas</UserDocu> <UserDocu>Feature for creating and manipulating Technical Drawing GeomHatch areas</UserDocu>
</Documentation> </Documentation>
<CustomAttributes /> <CustomAttributes />
</PythonExport> </PythonExport>

View File

@ -0,0 +1,32 @@
#include "PreCompiled.h"
#include "DrawGeomHatch.h"
// inclusion of the generated files (generated out of DrawGeomHatchPy.xml)
#include <Mod/TechDraw/App/DrawGeomHatchPy.h>
#include <Mod/TechDraw/App/DrawGeomHatchPy.cpp>
using namespace TechDraw;
// returns a string which represents the object e.g. when printed in python
std::string DrawGeomHatchPy::representation(void) const
{
return std::string("<DrawGeomHatch object>");
}
PyObject *DrawGeomHatchPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
}
int DrawGeomHatchPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
}

View File

@ -89,7 +89,7 @@
#include "GeometryObject.h" #include "GeometryObject.h"
#include "DrawViewPart.h" #include "DrawViewPart.h"
#include "DrawHatch.h" #include "DrawHatch.h"
#include "DrawCrosshatch.h" #include "DrawGeomHatch.h"
#include "EdgeWalker.h" #include "EdgeWalker.h"
@ -409,14 +409,14 @@ std::vector<TechDraw::DrawHatch*> DrawViewPart::getHatches() const
return result; return result;
} }
std::vector<TechDraw::DrawCrosshatch*> DrawViewPart::getCrosshatches() const std::vector<TechDraw::DrawGeomHatch*> DrawViewPart::getGeomHatches() const
{ {
std::vector<TechDraw::DrawCrosshatch*> result; std::vector<TechDraw::DrawGeomHatch*> result;
std::vector<App::DocumentObject*> children = getInList(); std::vector<App::DocumentObject*> children = getInList();
for (std::vector<App::DocumentObject*>::iterator it = children.begin(); it != children.end(); ++it) { for (std::vector<App::DocumentObject*>::iterator it = children.begin(); it != children.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(DrawCrosshatch::getClassTypeId())) { if ((*it)->getTypeId().isDerivedFrom(DrawGeomHatch::getClassTypeId())) {
TechDraw::DrawCrosshatch* cross = dynamic_cast<TechDraw::DrawCrosshatch*>(*it); TechDraw::DrawGeomHatch* geom = dynamic_cast<TechDraw::DrawGeomHatch*>(*it);
result.push_back(cross); result.push_back(geom);
} }
} }
return result; return result;

View File

@ -56,7 +56,7 @@ class Face;
namespace TechDraw { namespace TechDraw {
class DrawHatch; class DrawHatch;
class DrawCrosshatch; class DrawGeomHatch;
class DrawProjectSplit; class DrawProjectSplit;
class DrawViewSection; class DrawViewSection;
} }
@ -99,7 +99,7 @@ public:
std::vector<TechDraw::DrawHatch*> getHatches(void) const; std::vector<TechDraw::DrawHatch*> getHatches(void) const;
std::vector<TechDraw::DrawCrosshatch*> getCrosshatches(void) const; std::vector<TechDraw::DrawGeomHatch*> getGeomHatches(void) const;
//TODO: are there use-cases for Python access to TechDrawGeometry??? //TODO: are there use-cases for Python access to TechDrawGeometry???

View File

@ -81,7 +81,7 @@
#include "DrawUtil.h" #include "DrawUtil.h"
#include "DrawProjGroupItem.h" #include "DrawProjGroupItem.h"
#include "DrawProjectSplit.h" #include "DrawProjectSplit.h"
#include "DrawCrosshatch.h" #include "DrawGeomHatch.h"
#include "DrawViewSection.h" #include "DrawViewSection.h"
using namespace TechDraw; using namespace TechDraw;
@ -174,7 +174,7 @@ void DrawViewSection::onChanged(const App::Property* prop)
if ((!FileHatchPattern.isEmpty()) && if ((!FileHatchPattern.isEmpty()) &&
(!NameGeomPattern.isEmpty())) { (!NameGeomPattern.isEmpty())) {
std::vector<HatchLine> specs = std::vector<HatchLine> specs =
DrawCrosshatch::getDecodedSpecsFromFile(FileHatchPattern.getValue(),NameGeomPattern.getValue()); DrawGeomHatch::getDecodedSpecsFromFile(FileHatchPattern.getValue(),NameGeomPattern.getValue());
m_lineSets.clear(); m_lineSets.clear();
for (auto& hl: specs) { for (auto& hl: specs) {
//hl.dump("hl from section"); //hl.dump("hl from section");
@ -539,7 +539,7 @@ Base::Vector3d DrawViewSection::getSectionVector (const std::string sectionName)
std::vector<LineSet> DrawViewSection::getDrawableLines(int i) std::vector<LineSet> DrawViewSection::getDrawableLines(int i)
{ {
std::vector<LineSet> result; std::vector<LineSet> result;
result = DrawCrosshatch::getDrawableLines(this,m_lineSets,i,HatchScale.getValue()); result = DrawGeomHatch::getDrawableLines(this,m_lineSets,i,HatchScale.getValue());
return result; return result;
} }

View File

@ -45,7 +45,7 @@ class Face;
namespace TechDraw namespace TechDraw
{ {
class DrawProjGroupItem; class DrawProjGroupItem;
class DrawCrosshatch; class DrawGeomHatch;
class HatchLine; class HatchLine;
class LineSet; class LineSet;
class DashSet; class DashSet;

View File

@ -48,7 +48,7 @@
#include "ViewProviderSymbol.h" #include "ViewProviderSymbol.h"
#include "ViewProviderViewClip.h" #include "ViewProviderViewClip.h"
#include "ViewProviderHatch.h" #include "ViewProviderHatch.h"
#include "ViewProviderCrosshatch.h" #include "ViewProviderGeomHatch.h"
#include "ViewProviderSpreadsheet.h" #include "ViewProviderSpreadsheet.h"
#include "ViewProviderImage.h" #include "ViewProviderImage.h"
@ -103,7 +103,7 @@ void TechDrawGuiExport initTechDrawGui()
TechDrawGui::ViewProviderDraft::init(); TechDrawGui::ViewProviderDraft::init();
TechDrawGui::ViewProviderArch::init(); TechDrawGui::ViewProviderArch::init();
TechDrawGui::ViewProviderHatch::init(); TechDrawGui::ViewProviderHatch::init();
TechDrawGui::ViewProviderCrosshatch::init(); TechDrawGui::ViewProviderGeomHatch::init();
TechDrawGui::ViewProviderSpreadsheet::init(); TechDrawGui::ViewProviderSpreadsheet::init();
TechDrawGui::ViewProviderImage::init(); TechDrawGui::ViewProviderImage::init();

View File

@ -199,8 +199,8 @@ SET(TechDrawGuiViewProvider_SRCS
ViewProviderViewClip.h ViewProviderViewClip.h
ViewProviderHatch.cpp ViewProviderHatch.cpp
ViewProviderHatch.h ViewProviderHatch.h
ViewProviderCrosshatch.cpp ViewProviderGeomHatch.cpp
ViewProviderCrosshatch.h ViewProviderGeomHatch.h
ViewProviderImage.cpp ViewProviderImage.cpp
ViewProviderImage.h ViewProviderImage.h
) )

View File

@ -49,7 +49,7 @@
#include <Mod/TechDraw/App/DrawView.h> #include <Mod/TechDraw/App/DrawView.h>
#include <Mod/TechDraw/App/DrawViewPart.h> #include <Mod/TechDraw/App/DrawViewPart.h>
#include <Mod/TechDraw/App/DrawHatch.h> #include <Mod/TechDraw/App/DrawHatch.h>
#include <Mod/TechDraw/App/DrawCrosshatch.h> #include <Mod/TechDraw/App/DrawGeomHatch.h>
#include <Mod/TechDraw/App/DrawPage.h> #include <Mod/TechDraw/App/DrawPage.h>
#include <Mod/TechDraw/App/DrawUtil.h> #include <Mod/TechDraw/App/DrawUtil.h>
#include <Mod/TechDraw/Gui/QGVPage.h> #include <Mod/TechDraw/Gui/QGVPage.h>
@ -128,24 +128,24 @@ bool CmdTechDrawNewHatch::isActive(void)
} }
//=========================================================================== //===========================================================================
// TechDraw_NewCrosshatch // TechDraw_NewGeomHatch
//=========================================================================== //===========================================================================
DEF_STD_CMD_A(CmdTechDrawNewCrosshatch); DEF_STD_CMD_A(CmdTechDrawNewGeomHatch);
CmdTechDrawNewCrosshatch::CmdTechDrawNewCrosshatch() CmdTechDrawNewGeomHatch::CmdTechDrawNewGeomHatch()
: Command("TechDraw_NewCrosshatch") : Command("TechDraw_NewGeomHatch")
{ {
sAppModule = "TechDraw"; sAppModule = "TechDraw";
sGroup = QT_TR_NOOP("TechDraw"); sGroup = QT_TR_NOOP("TechDraw");
sMenuText = QT_TR_NOOP("Apply geometric hatch to a Face"); sMenuText = QT_TR_NOOP("Apply geometric hatch to a Face");
sToolTipText = QT_TR_NOOP("Apply geometric hatch to a Face"); sToolTipText = QT_TR_NOOP("Apply geometric hatch to a Face");
sWhatsThis = "TechDraw_NewCrosshatch"; sWhatsThis = "TechDraw_NewGeomHatch";
sStatusTip = sToolTipText; sStatusTip = sToolTipText;
sPixmap = "actions/techdraw-crosshatch"; sPixmap = "actions/techdraw-geomhatch";
} }
void CmdTechDrawNewCrosshatch::activated(int iMsg) void CmdTechDrawNewGeomHatch::activated(int iMsg)
{ {
Q_UNUSED(iMsg); Q_UNUSED(iMsg);
if (!_checkSelectionHatch(this)) { //same requirements as hatch - page, DrawViewXXX, face if (!_checkSelectionHatch(this)) { //same requirements as hatch - page, DrawViewXXX, face
@ -161,16 +161,16 @@ void CmdTechDrawNewCrosshatch::activated(int iMsg)
TechDraw::DrawPage* page = objFeat->findParentPage(); TechDraw::DrawPage* page = objFeat->findParentPage();
std::string PageName = page->getNameInDocument(); std::string PageName = page->getNameInDocument();
std::string FeatName = getUniqueObjectName("Crosshatch"); std::string FeatName = getUniqueObjectName("GeomHatch");
std::stringstream featLabel; std::stringstream featLabel;
featLabel << FeatName << "FX" << TechDraw::DrawUtil::getIndexFromName(subNames.at(0)); featLabel << FeatName << "FX" << TechDraw::DrawUtil::getIndexFromName(subNames.at(0));
openCommand("Create Crosshatch"); openCommand("Create GeomHatch");
doCommand(Doc,"App.activeDocument().addObject('TechDraw::DrawCrosshatch','%s')",FeatName.c_str()); doCommand(Doc,"App.activeDocument().addObject('TechDraw::DrawGeomHatch','%s')",FeatName.c_str());
doCommand(Doc,"App.activeDocument().%s.Label = '%s'",FeatName.c_str(),featLabel.str().c_str()); doCommand(Doc,"App.activeDocument().%s.Label = '%s'",FeatName.c_str(),featLabel.str().c_str());
auto crosshatch( static_cast<TechDraw::DrawCrosshatch *>(getDocument()->getObject(FeatName.c_str())) ); auto geomhatch( static_cast<TechDraw::DrawGeomHatch *>(getDocument()->getObject(FeatName.c_str())) );
crosshatch->Source.setValue(objFeat, subNames); geomhatch->Source.setValue(objFeat, subNames);
commitCommand(); commitCommand();
@ -180,7 +180,7 @@ void CmdTechDrawNewCrosshatch::activated(int iMsg)
getDocument()->recompute(); getDocument()->recompute();
} }
bool CmdTechDrawNewCrosshatch::isActive(void) bool CmdTechDrawNewGeomHatch::isActive(void)
{ {
bool havePage = DrawGuiUtil::needPage(this); bool havePage = DrawGuiUtil::needPage(this);
bool haveView = DrawGuiUtil::needView(this); bool haveView = DrawGuiUtil::needView(this);
@ -291,7 +291,7 @@ void CreateTechDrawCommandsDecorate(void)
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager(); Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
rcCmdMgr.addCommand(new CmdTechDrawNewHatch()); rcCmdMgr.addCommand(new CmdTechDrawNewHatch());
rcCmdMgr.addCommand(new CmdTechDrawNewCrosshatch()); rcCmdMgr.addCommand(new CmdTechDrawNewGeomHatch());
rcCmdMgr.addCommand(new CmdTechDrawImage()); rcCmdMgr.addCommand(new CmdTechDrawImage());
rcCmdMgr.addCommand(new CmdTechDrawToggleFrame()); rcCmdMgr.addCommand(new CmdTechDrawToggleFrame());
} }

View File

@ -74,7 +74,7 @@ QGIFace::QGIFace(int index) :
m_styleNormal = m_styleDef; m_styleNormal = m_styleDef;
m_fillStyle = m_styleDef; m_fillStyle = m_styleDef;
m_colNormalFill = m_colDefFill; m_colNormalFill = m_colDefFill;
m_crossColor = QColor(Qt::black); m_geomColor = QColor(Qt::black);
setLineWeight(0.5); //0 = cosmetic setLineWeight(0.5); //0 = cosmetic
setPrettyNormal(); setPrettyNormal();
@ -99,17 +99,17 @@ void QGIFace::draw()
setPath(m_outline); //Face boundary setPath(m_outline); //Face boundary
if (isHatched()) { if (isHatched()) {
if (m_mode == CrosshatchFill) { //crosshatch if (m_mode == GeomHatchFill) { //crosshatch
if (!m_crossHatchPaths.empty()) { //surrogate for LineSets.empty if (!m_geomHatchPaths.empty()) { //surrogate for LineSets.empty
m_brush.setTexture(nullptr); m_brush.setTexture(nullptr);
m_fillStyle = m_styleDef; m_fillStyle = m_styleDef;
m_styleNormal = m_fillStyle; m_styleNormal = m_fillStyle;
int pathNo = 0; int pathNo = 0;
for (auto& pp: m_crossHatchPaths) { for (auto& pp: m_geomHatchPaths) {
QGraphicsPathItem* fillItem = m_fillItems.at(pathNo); QGraphicsPathItem* fillItem = m_fillItems.at(pathNo);
fillItem->setPath(pp); fillItem->setPath(pp);
QPen crossPen = setCrossPen(pathNo); QPen geomPen = setGeomPen(pathNo);
fillItem->setPen(crossPen); fillItem->setPen(geomPen);
pathNo++; pathNo++;
} }
} }
@ -217,7 +217,7 @@ void QGIFace::setOutline(const QPainterPath & path)
void QGIFace::clearLineSets(void) void QGIFace::clearLineSets(void)
{ {
m_crossHatchPaths.clear(); m_geomHatchPaths.clear();
m_dashSpecs.clear(); m_dashSpecs.clear();
clearFillItems(); clearFillItems();
} }
@ -225,7 +225,7 @@ void QGIFace::clearLineSets(void)
//each line set needs a painterpath, a dashspec and a QGPItem to show them //each line set needs a painterpath, a dashspec and a QGPItem to show them
void QGIFace::addLineSet(QPainterPath pp, std::vector<double> dp) void QGIFace::addLineSet(QPainterPath pp, std::vector<double> dp)
{ {
m_crossHatchPaths.push_back(pp); m_geomHatchPaths.push_back(pp);
m_dashSpecs.push_back(DashSpec(dp)); m_dashSpecs.push_back(DashSpec(dp));
addFillItem(); addFillItem();
} }
@ -253,7 +253,7 @@ QVector<qreal> QGIFace::decodeDashSpec(DashSpec patDash)
//Rez::guiX(something)? //Rez::guiX(something)?
double dotLength = 3.0; double dotLength = 3.0;
double unitLength = 6.0; double unitLength = 6.0;
// double penWidth = m_crossWeight; //mark, space and dot lengths are to be in terms of penWidth(Qt) or mm(PAT)?? // double penWidth = m_geomWeight; //mark, space and dot lengths are to be in terms of penWidth(Qt) or mm(PAT)??
// //if we want it in terms of mm, we need to divide by penWidth? // //if we want it in terms of mm, we need to divide by penWidth?
// double minPen = 0.01; //avoid trouble with cosmetic pen (zero width) // double minPen = 0.01; //avoid trouble with cosmetic pen (zero width)
std::vector<double> result; std::vector<double> result;
@ -273,16 +273,15 @@ QVector<qreal> QGIFace::decodeDashSpec(DashSpec patDash)
} }
QPen QGIFace::setCrossPen(int i) QPen QGIFace::setGeomPen(int i)
{ {
//m_dashSpecs[i].dump("spec test"); //m_dashSpecs[i].dump("spec test");
DashSpec ourSpec = m_dashSpecs.at(i); DashSpec ourSpec = m_dashSpecs.at(i);
//ourSpec.dump("our spec"); //ourSpec.dump("our spec");
QPen result; QPen result;
result.setWidthF(Rez::guiX(m_crossWeight)); //Rez::guiX() ?? line weights are in mm? result.setWidthF(Rez::guiX(m_geomWeight)); //Rez::guiX() ?? line weights are in mm?
// result.setWidthF(Rez::guiX(0.09)); result.setColor(m_geomColor);
result.setColor(m_crossColor);
if (ourSpec.empty()) { if (ourSpec.empty()) {
result.setStyle(Qt::SolidLine); result.setStyle(Qt::SolidLine);
} else { } else {
@ -348,7 +347,7 @@ QPixmap QGIFace::textureFromSvg(std::string fileSpec)
void QGIFace::setHatchColor(App::Color c) void QGIFace::setHatchColor(App::Color c)
{ {
m_svgCol = c.asCSSString(); m_svgCol = c.asCSSString();
m_crossColor = c.asValue<QColor>(); m_geomColor = c.asValue<QColor>();
} }
void QGIFace::setHatchScale(double s) void QGIFace::setHatchScale(double s)
@ -396,7 +395,7 @@ void QGIFace::resetFill() {
} }
void QGIFace::setLineWeight(double w) { void QGIFace::setLineWeight(double w) {
m_crossWeight = w; m_geomWeight = w;
} }

View File

@ -64,7 +64,7 @@ public:
FromFile, FromFile,
SvgFill, SvgFill,
BitmapFill, BitmapFill,
CrosshatchFill, GeomHatchFill,
PlainFill PlainFill
}; };
@ -100,7 +100,7 @@ public:
void clearSvg(void); void clearSvg(void);
//PAT fill parms & methods //PAT fill parms & methods
void setCrosshatchWeight(double w) { m_crossWeight = w; } void setGeomHatchWeight(double w) { m_geomWeight = w; }
void clearLineSets(void); void clearLineSets(void);
void addLineSet(QPainterPath pp, std::vector<double> dp); void addLineSet(QPainterPath pp, std::vector<double> dp);
QGraphicsPathItem* addFillItem(); QGraphicsPathItem* addFillItem();
@ -124,10 +124,10 @@ protected:
bool m_isHatched; bool m_isHatched;
QGIFace::fillMode m_mode; QGIFace::fillMode m_mode;
QPen setCrossPen(int i); QPen setGeomPen(int i);
QVector<qreal> decodeDashSpec(DashSpec d); QVector<qreal> decodeDashSpec(DashSpec d);
std::vector<QGraphicsPathItem*> m_fillItems; std::vector<QGraphicsPathItem*> m_fillItems;
std::vector<QPainterPath> m_crossHatchPaths; // 0/1 dashspec per crosshatchpath std::vector<QPainterPath> m_geomHatchPaths; // 0/1 dashspec per hatchpath
std::vector<DashSpec> m_dashSpecs; std::vector<DashSpec> m_dashSpecs;
@ -146,10 +146,10 @@ private:
QPainterPath m_outline; // QPainterPath m_outline; //
QPainterPath m_crosshatch; //crosshatch fill lines QPainterPath m_geomhatch; //crosshatch fill lines
QColor m_crossColor; //color for crosshatch lines QColor m_geomColor; //color for crosshatch lines
double m_crossWeight; //lineweight for crosshatch lines double m_geomWeight; //lineweight for crosshatch lines
}; };
} }

View File

@ -52,7 +52,7 @@
#include <Mod/TechDraw/App/DrawViewPart.h> #include <Mod/TechDraw/App/DrawViewPart.h>
#include <Mod/TechDraw/App/DrawViewSection.h> #include <Mod/TechDraw/App/DrawViewSection.h>
#include <Mod/TechDraw/App/DrawHatch.h> #include <Mod/TechDraw/App/DrawHatch.h>
#include <Mod/TechDraw/App/DrawCrosshatch.h> #include <Mod/TechDraw/App/DrawGeomHatch.h>
#include <Mod/TechDraw/App/DrawViewDetail.h> #include <Mod/TechDraw/App/DrawViewDetail.h>
#include "Rez.h" #include "Rez.h"
@ -68,7 +68,7 @@
#include "QGCustomRect.h" #include "QGCustomRect.h"
#include "QGIMatting.h" #include "QGIMatting.h"
#include "QGIViewPart.h" #include "QGIViewPart.h"
#include "ViewProviderCrosshatch.h" #include "ViewProviderGeomHatch.h"
using namespace TechDrawGui; using namespace TechDrawGui;
using namespace TechDrawGeometry; using namespace TechDrawGeometry;
@ -378,7 +378,7 @@ void QGIViewPart::drawViewPart()
if (viewPart->handleFaces()) { if (viewPart->handleFaces()) {
// Draw Faces // Draw Faces
std::vector<TechDraw::DrawHatch*> hatchObjs = viewPart->getHatches(); std::vector<TechDraw::DrawHatch*> hatchObjs = viewPart->getHatches();
std::vector<TechDraw::DrawCrosshatch*> crossObjs = viewPart->getCrosshatches(); std::vector<TechDraw::DrawGeomHatch*> geomObjs = viewPart->getGeomHatches();
const std::vector<TechDrawGeometry::Face *> &faceGeoms = viewPart->getFaceGeometry(); const std::vector<TechDrawGeometry::Face *> &faceGeoms = viewPart->getFaceGeometry();
std::vector<TechDrawGeometry::Face *>::const_iterator fit = faceGeoms.begin(); std::vector<TechDrawGeometry::Face *>::const_iterator fit = faceGeoms.begin();
for(int i = 0 ; fit != faceGeoms.end(); fit++, i++) { for(int i = 0 ; fit != faceGeoms.end(); fit++, i++) {
@ -386,12 +386,12 @@ void QGIViewPart::drawViewPart()
newFace->isHatched(false); newFace->isHatched(false);
newFace->setFillMode(QGIFace::PlainFill); newFace->setFillMode(QGIFace::PlainFill);
TechDraw::DrawHatch* fHatch = faceIsHatched(i,hatchObjs); TechDraw::DrawHatch* fHatch = faceIsHatched(i,hatchObjs);
TechDraw::DrawCrosshatch* fCross = faceIsCrosshatched(i,crossObjs); TechDraw::DrawGeomHatch* fGeom = faceIsGeomHatched(i,geomObjs);
if (fCross) { if (fGeom) {
const std::vector<std::string> &sourceNames = fCross->Source.getSubValues(); const std::vector<std::string> &sourceNames = fGeom->Source.getSubValues();
if (!sourceNames.empty()) { if (!sourceNames.empty()) {
int fdx = TechDraw::DrawUtil::getIndexFromName(sourceNames.at(0)); int fdx = TechDraw::DrawUtil::getIndexFromName(sourceNames.at(0));
std::vector<LineSet> lineSets = fCross->getDrawableLines(fdx); std::vector<LineSet> lineSets = fGeom->getDrawableLines(fdx);
if (!lineSets.empty()) { if (!lineSets.empty()) {
newFace->clearLineSets(); newFace->clearLineSets();
for (auto& ls: lineSets) { for (auto& ls: lineSets) {
@ -403,14 +403,14 @@ void QGIViewPart::drawViewPart()
newFace->addLineSet(bigPath,ls.getDashSpec()); newFace->addLineSet(bigPath,ls.getDashSpec());
} }
newFace->isHatched(true); newFace->isHatched(true);
newFace->setFillMode(QGIFace::CrosshatchFill); newFace->setFillMode(QGIFace::GeomHatchFill);
newFace->setHatchScale(fCross->ScalePattern.getValue()); newFace->setHatchScale(fGeom->ScalePattern.getValue());
newFace->setHatchFile(fCross->FilePattern.getValue()); newFace->setHatchFile(fGeom->FilePattern.getValue());
Gui::ViewProvider* gvp = QGIView::getViewProvider(fCross); Gui::ViewProvider* gvp = QGIView::getViewProvider(fGeom);
ViewProviderCrosshatch* crossVp = dynamic_cast<ViewProviderCrosshatch*>(gvp); ViewProviderGeomHatch* geomVp = dynamic_cast<ViewProviderGeomHatch*>(gvp);
if (crossVp != nullptr) { if (geomVp != nullptr) {
newFace->setHatchColor(crossVp->ColorPattern.getValue()); newFace->setHatchColor(geomVp->ColorPattern.getValue());
newFace->setLineWeight(crossVp->WeightPattern.getValue()); newFace->setLineWeight(geomVp->WeightPattern.getValue());
} }
} }
} }
@ -887,10 +887,10 @@ TechDraw::DrawHatch* QGIViewPart::faceIsHatched(int i,std::vector<TechDraw::Draw
return result; return result;
} }
TechDraw::DrawCrosshatch* QGIViewPart::faceIsCrosshatched(int i,std::vector<TechDraw::DrawCrosshatch*> crossObjs) const TechDraw::DrawGeomHatch* QGIViewPart::faceIsGeomHatched(int i,std::vector<TechDraw::DrawGeomHatch*> geomObjs) const
{ {
TechDraw::DrawCrosshatch* result = nullptr; TechDraw::DrawGeomHatch* result = nullptr;
for (auto& h:crossObjs) { for (auto& h:geomObjs) {
const std::vector<std::string> &sourceNames = h->Source.getSubValues(); const std::vector<std::string> &sourceNames = h->Source.getSubValues();
int fdx = TechDraw::DrawUtil::getIndexFromName(sourceNames.at(0)); int fdx = TechDraw::DrawUtil::getIndexFromName(sourceNames.at(0));
if (fdx == i) { if (fdx == i) {

View File

@ -34,7 +34,7 @@ namespace TechDraw {
class DrawViewPart; class DrawViewPart;
class DrawViewSection; class DrawViewSection;
class DrawHatch; class DrawHatch;
class DrawCrosshatch; class DrawGeomHatch;
} }
namespace TechDrawGui namespace TechDrawGui
@ -90,7 +90,7 @@ protected:
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) override; virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
TechDraw::DrawHatch* faceIsHatched(int i,std::vector<TechDraw::DrawHatch*> hatchObjs) const; TechDraw::DrawHatch* faceIsHatched(int i,std::vector<TechDraw::DrawHatch*> hatchObjs) const;
TechDraw::DrawCrosshatch* faceIsCrosshatched(int i,std::vector<TechDraw::DrawCrosshatch*> crossObjs) const; TechDraw::DrawGeomHatch* faceIsGeomHatched(int i,std::vector<TechDraw::DrawGeomHatch*> geomObjs) const;
void dumpPath(const char* text,QPainterPath path); void dumpPath(const char* text,QPainterPath path);
void removePrimitives(void); void removePrimitives(void);
void removeDecorations(void); void removeDecorations(void);

View File

@ -42,7 +42,7 @@
#include <Base/Console.h> #include <Base/Console.h>
#include <App/Material.h> #include <App/Material.h>
#include <Mod/TechDraw/App/DrawCrosshatch.h> #include <Mod/TechDraw/App/DrawGeomHatch.h>
#include <Mod/TechDraw/App/DrawViewSection.h> #include <Mod/TechDraw/App/DrawViewSection.h>
@ -113,7 +113,7 @@ void QGIViewSection::drawSectionFace()
QString ext = hfi.suffix(); QString ext = hfi.suffix();
if ((ext.toUpper() == QString::fromUtf8("PAT")) && if ((ext.toUpper() == QString::fromUtf8("PAT")) &&
!patternName.empty() ) { !patternName.empty() ) {
newFace->setFillMode(QGIFace::CrosshatchFill); newFace->setFillMode(QGIFace::GeomHatchFill);
newFace->setLineWeight(sectionVp->WeightPattern.getValue()); newFace->setLineWeight(sectionVp->WeightPattern.getValue());
std::vector<LineSet> lineSets = section->getDrawableLines(i); std::vector<LineSet> lineSets = section->getDrawableLines(i);
if (!lineSets.empty()) { if (!lineSets.empty()) {

View File

@ -49,7 +49,7 @@
<file>icons/actions/techdraw-saveSVG.svg</file> <file>icons/actions/techdraw-saveSVG.svg</file>
<file>icons/actions/techdraw-viewsection.svg</file> <file>icons/actions/techdraw-viewsection.svg</file>
<file>icons/actions/techdraw-hatch.svg</file> <file>icons/actions/techdraw-hatch.svg</file>
<file>icons/actions/techdraw-crosshatch.svg</file> <file>icons/actions/techdraw-geomhatch.svg</file>
<file>icons/actions/techdraw-toggleframe.svg</file> <file>icons/actions/techdraw-toggleframe.svg</file>
<file>icons/actions/techdraw-projgroup.svg</file> <file>icons/actions/techdraw-projgroup.svg</file>
<file>icons/actions/techdraw-spreadsheet.svg</file> <file>icons/actions/techdraw-spreadsheet.svg</file>

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -49,48 +49,48 @@
#include <Gui/Utilities.h> #include <Gui/Utilities.h>
#include <Gui/Control.h> #include <Gui/Control.h>
#include <Mod/TechDraw/App/DrawCrosshatch.h> #include <Mod/TechDraw/App/DrawGeomHatch.h>
#include <Mod/TechDraw/App/DrawViewPart.h> #include <Mod/TechDraw/App/DrawViewPart.h>
#include <Mod/TechDraw/App/DrawView.h> #include <Mod/TechDraw/App/DrawView.h>
#include "ViewProviderDrawingView.h" #include "ViewProviderDrawingView.h"
#include "ViewProviderCrosshatch.h" #include "ViewProviderGeomHatch.h"
using namespace TechDrawGui; using namespace TechDrawGui;
PROPERTY_SOURCE(TechDrawGui::ViewProviderCrosshatch, Gui::ViewProviderDocumentObject) PROPERTY_SOURCE(TechDrawGui::ViewProviderGeomHatch, Gui::ViewProviderDocumentObject)
//************************************************************************** //**************************************************************************
// Construction/Destruction // Construction/Destruction
ViewProviderCrosshatch::ViewProviderCrosshatch() ViewProviderGeomHatch::ViewProviderGeomHatch()
{ {
static const char *vgroup = "Format"; static const char *vgroup = "Format";
sPixmap = "actions/techdraw-crosshatch"; sPixmap = "actions/techdraw-geomhatch";
ADD_PROPERTY_TYPE(ColorPattern,(0),vgroup,App::Prop_None,"The color of the pattern"); ADD_PROPERTY_TYPE(ColorPattern,(0),vgroup,App::Prop_None,"The color of the pattern");
ADD_PROPERTY_TYPE(WeightPattern,(0.1),vgroup,App::Prop_None,"Crosshatch pattern line thickness"); ADD_PROPERTY_TYPE(WeightPattern,(0.1),vgroup,App::Prop_None,"GeomHatch pattern line thickness");
getParameters(); getParameters();
} }
ViewProviderCrosshatch::~ViewProviderCrosshatch() ViewProviderGeomHatch::~ViewProviderGeomHatch()
{ {
} }
void ViewProviderCrosshatch::attach(App::DocumentObject *pcFeat) void ViewProviderGeomHatch::attach(App::DocumentObject *pcFeat)
{ {
// call parent attach method // call parent attach method
ViewProviderDocumentObject::attach(pcFeat); ViewProviderDocumentObject::attach(pcFeat);
} }
void ViewProviderCrosshatch::setDisplayMode(const char* ModeName) void ViewProviderGeomHatch::setDisplayMode(const char* ModeName)
{ {
ViewProviderDocumentObject::setDisplayMode(ModeName); ViewProviderDocumentObject::setDisplayMode(ModeName);
} }
std::vector<std::string> ViewProviderCrosshatch::getDisplayModes(void) const std::vector<std::string> ViewProviderGeomHatch::getDisplayModes(void) const
{ {
// get the modes of the father // get the modes of the father
std::vector<std::string> StrList = ViewProviderDocumentObject::getDisplayModes(); std::vector<std::string> StrList = ViewProviderDocumentObject::getDisplayModes();
@ -99,7 +99,7 @@ std::vector<std::string> ViewProviderCrosshatch::getDisplayModes(void) const
} }
//for VP properties //for VP properties
void ViewProviderCrosshatch::onChanged(const App::Property* prop) void ViewProviderGeomHatch::onChanged(const App::Property* prop)
{ {
if (prop == &WeightPattern || if (prop == &WeightPattern ||
prop == &ColorPattern ) { prop == &ColorPattern ) {
@ -110,7 +110,7 @@ void ViewProviderCrosshatch::onChanged(const App::Property* prop)
} }
//for feature properties //for feature properties
void ViewProviderCrosshatch::updateData(const App::Property* prop) void ViewProviderGeomHatch::updateData(const App::Property* prop)
{ {
if (prop == &(getViewObject()->ScalePattern)) { if (prop == &(getViewObject()->ScalePattern)) {
updateGraphic(); updateGraphic();
@ -118,9 +118,9 @@ void ViewProviderCrosshatch::updateData(const App::Property* prop)
Gui::ViewProviderDocumentObject::updateData(prop); Gui::ViewProviderDocumentObject::updateData(prop);
} }
void ViewProviderCrosshatch::updateGraphic(void) void ViewProviderGeomHatch::updateGraphic(void)
{ {
TechDraw::DrawCrosshatch* dc = getViewObject(); TechDraw::DrawGeomHatch* dc = getViewObject();
if (dc) { if (dc) {
TechDraw::DrawViewPart* dvp = dc->getSourceView(); TechDraw::DrawViewPart* dvp = dc->getSourceView();
if (dvp) { if (dvp) {
@ -138,12 +138,12 @@ void ViewProviderCrosshatch::updateGraphic(void)
} }
void ViewProviderCrosshatch::getParameters(void) void ViewProviderGeomHatch::getParameters(void)
{ {
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter() Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors"); .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
App::Color fcColor; App::Color fcColor;
fcColor.setPackedValue(hGrp->GetUnsigned("Crosshatch", 0x00000000)); fcColor.setPackedValue(hGrp->GetUnsigned("GeomHatch", 0x00000000));
ColorPattern.setValue(fcColor); ColorPattern.setValue(fcColor);
hGrp = App::GetApplication().GetUserParameter() hGrp = App::GetApplication().GetUserParameter()
@ -152,7 +152,7 @@ void ViewProviderCrosshatch::getParameters(void)
WeightPattern.setValue(lineWeight); WeightPattern.setValue(lineWeight);
} }
TechDraw::DrawCrosshatch* ViewProviderCrosshatch::getViewObject() const TechDraw::DrawGeomHatch* ViewProviderGeomHatch::getViewObject() const
{ {
return dynamic_cast<TechDraw::DrawCrosshatch*>(pcObject); return dynamic_cast<TechDraw::DrawGeomHatch*>(pcObject);
} }

View File

@ -33,21 +33,21 @@
namespace TechDraw{ namespace TechDraw{
class DrawCrosshatch; class DrawGeomHatch;
} }
namespace TechDrawGui { namespace TechDrawGui {
class TechDrawGuiExport ViewProviderCrosshatch : public Gui::ViewProviderDocumentObject class TechDrawGuiExport ViewProviderGeomHatch : public Gui::ViewProviderDocumentObject
{ {
PROPERTY_HEADER(TechDrawGui::ViewProviderCrosshatch); PROPERTY_HEADER(TechDrawGui::ViewProviderGeomHatch);
public: public:
/// constructor /// constructor
ViewProviderCrosshatch(); ViewProviderGeomHatch();
/// destructor /// destructor
virtual ~ViewProviderCrosshatch(); virtual ~ViewProviderGeomHatch();
App::PropertyFloat WeightPattern; App::PropertyFloat WeightPattern;
App::PropertyColor ColorPattern; App::PropertyColor ColorPattern;
@ -63,7 +63,7 @@ public:
void updateGraphic(void); void updateGraphic(void);
void getParameters(void); void getParameters(void);
TechDraw::DrawCrosshatch* getViewObject() const; TechDraw::DrawGeomHatch* getViewObject() const;
}; };
} // namespace TechDrawGui } // namespace TechDrawGui

View File

@ -39,7 +39,7 @@
#include <Mod/TechDraw/App/DrawViewDimension.h> #include <Mod/TechDraw/App/DrawViewDimension.h>
#include <Mod/TechDraw/App/DrawViewMulti.h> #include <Mod/TechDraw/App/DrawViewMulti.h>
#include <Mod/TechDraw/App/DrawHatch.h> #include <Mod/TechDraw/App/DrawHatch.h>
#include <Mod/TechDraw/App/DrawCrosshatch.h> #include <Mod/TechDraw/App/DrawGeomHatch.h>
#include<Mod/TechDraw/App/DrawPage.h> #include<Mod/TechDraw/App/DrawPage.h>
#include "ViewProviderViewPart.h" #include "ViewProviderViewPart.h"
@ -118,7 +118,7 @@ std::vector<App::DocumentObject*> ViewProviderViewPart::claimChildren(void) cons
// valid children of a ViewPart are: // valid children of a ViewPart are:
// - Dimensions // - Dimensions
// - Hatches // - Hatches
// - Crosshatches // - GeomHatches
std::vector<App::DocumentObject*> temp; std::vector<App::DocumentObject*> temp;
const std::vector<App::DocumentObject *> &views = getViewPart()->getInList(); const std::vector<App::DocumentObject *> &views = getViewPart()->getInList();
try { try {
@ -134,7 +134,7 @@ std::vector<App::DocumentObject*> ViewProviderViewPart::claimChildren(void) cons
} }
} else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawHatch::getClassTypeId())) { } else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawHatch::getClassTypeId())) {
temp.push_back((*it)); temp.push_back((*it));
} else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawCrosshatch::getClassTypeId())) { } else if ((*it)->getTypeId().isDerivedFrom(TechDraw::DrawGeomHatch::getClassTypeId())) {
temp.push_back((*it)); temp.push_back((*it));
} }
} }

View File

@ -55,7 +55,7 @@ ViewProviderViewSection::ViewProviderViewSection()
ADD_PROPERTY_TYPE(CutSurfaceColor,(0.0,0.0,0.0),sgroup,App::Prop_None,"The color to shade the cut surface"); ADD_PROPERTY_TYPE(CutSurfaceColor,(0.0,0.0,0.0),sgroup,App::Prop_None,"The color to shade the cut surface");
ADD_PROPERTY_TYPE(HatchCutSurface ,(false),hgroup,App::Prop_None,"Hatch the cut surface"); ADD_PROPERTY_TYPE(HatchCutSurface ,(false),hgroup,App::Prop_None,"Hatch the cut surface");
ADD_PROPERTY_TYPE(HatchColor,(0.0,0.0,0.0),hgroup,App::Prop_None,"The color of the hatch pattern"); ADD_PROPERTY_TYPE(HatchColor,(0.0,0.0,0.0),hgroup,App::Prop_None,"The color of the hatch pattern");
ADD_PROPERTY_TYPE(WeightPattern,(0.1),hgroup,App::Prop_None,"Crosshatch pattern line thickness"); ADD_PROPERTY_TYPE(WeightPattern,(0.1),hgroup,App::Prop_None,"GeomHatch pattern line thickness");
getParameters(); getParameters();

View File

@ -126,7 +126,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
Gui::ToolBarItem *decor = new Gui::ToolBarItem(root); Gui::ToolBarItem *decor = new Gui::ToolBarItem(root);
decor->setCommand("TechDraw Decoration"); decor->setCommand("TechDraw Decoration");
*decor << "TechDraw_NewHatch"; *decor << "TechDraw_NewHatch";
*decor << "TechDraw_NewCrosshatch"; *decor << "TechDraw_NewGeomHatch";
*decor << "TechDraw_Symbol"; *decor << "TechDraw_Symbol";
*decor << "TechDraw_Image"; *decor << "TechDraw_Image";
*decor << "TechDraw_ToggleFrame"; *decor << "TechDraw_ToggleFrame";
@ -176,7 +176,7 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const
Gui::ToolBarItem *decor = new Gui::ToolBarItem(root); Gui::ToolBarItem *decor = new Gui::ToolBarItem(root);
decor->setCommand("TechDraw Decoration"); decor->setCommand("TechDraw Decoration");
*decor << "TechDraw_NewHatch"; *decor << "TechDraw_NewHatch";
*decor << "TechDraw_NewCrosshatch"; *decor << "TechDraw_NewGeomHatch";
*decor << "TechDraw_Symbol"; *decor << "TechDraw_Symbol";
*decor << "TechDraw_Image"; *decor << "TechDraw_Image";
*decor << "TechDraw_ToggleFrame"; *decor << "TechDraw_ToggleFrame";