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 "DrawViewClip.h"
#include "DrawHatch.h"
#include "DrawCrosshatch.h"
#include "DrawGeomHatch.h"
#include "DrawViewDraft.h"
#include "DrawViewArch.h"
#include "DrawViewSpreadsheet.h"
@ -85,7 +85,7 @@ PyMODINIT_FUNC initTechDraw()
TechDraw::DrawViewClip ::init();
TechDraw::DrawHatch ::init();
TechDraw::DrawCrosshatch ::init();
TechDraw::DrawGeomHatch ::init();
TechDraw::DrawViewDraft ::init();
TechDraw::DrawViewArch ::init();
TechDraw::DrawViewImage ::init();

View File

@ -37,7 +37,7 @@ generate_from_xml(DrawViewSymbolPy)
generate_from_xml(DrawViewClipPy)
generate_from_xml(DrawViewDimensionPy)
generate_from_xml(DrawHatchPy)
generate_from_xml(DrawCrosshatchPy)
generate_from_xml(DrawGeomHatchPy)
generate_from_xml(DrawViewCollectionPy)
generate_from_xml(DrawProjGroupPy)
generate_from_xml(DrawProjGroupItemPy)
@ -75,8 +75,8 @@ SET(Draw_SRCS
DrawViewSection.h
DrawHatch.cpp
DrawHatch.h
DrawCrosshatch.cpp
DrawCrosshatch.h
DrawGeomHatch.cpp
DrawGeomHatch.h
DrawViewDraft.cpp
DrawViewDraft.h
DrawViewArch.cpp
@ -133,8 +133,8 @@ SET(Python_SRCS
DrawViewDimensionPyImp.cpp
DrawHatchPy.xml
DrawHatchPyImp.cpp
DrawCrosshatchPy.xml
DrawCrosshatchPyImp.cpp
DrawGeomHatchPy.xml
DrawGeomHatchPyImp.cpp
DrawViewCollectionPy.xml
DrawViewCollectionPyImp.cpp
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 "DrawViewPart.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 TechDrawGeometry;
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(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(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();
}
DrawCrosshatch::~DrawCrosshatch()
DrawGeomHatch::~DrawGeomHatch()
{
}
void DrawCrosshatch::onChanged(const App::Property* prop)
void DrawGeomHatch::onChanged(const App::Property* prop)
{
if (prop == &Source ) {
if (!isRestoring()) {
DrawCrosshatch::execute();
DrawGeomHatch::execute();
}
}
@ -120,7 +120,7 @@ void DrawCrosshatch::onChanged(const App::Property* prop)
App::DocumentObject::onChanged(prop);
}
short DrawCrosshatch::mustExecute() const
short DrawGeomHatch::mustExecute() const
{
short result = 0;
if (!isRestoring()) {
@ -136,20 +136,20 @@ short DrawCrosshatch::mustExecute() const
}
App::DocumentObjectExecReturn *DrawCrosshatch::execute(void)
App::DocumentObjectExecReturn *DrawGeomHatch::execute(void)
{
return App::DocumentObject::StdReturn;
}
DrawViewPart* DrawCrosshatch::getSourceView(void) const
DrawViewPart* DrawGeomHatch::getSourceView(void) const
{
App::DocumentObject* obj = Source.getValue();
DrawViewPart* result = dynamic_cast<DrawViewPart*>(obj);
return result;
}
std::vector<HatchLine> DrawCrosshatch::getDecodedSpecsFromFile()
std::vector<HatchLine> DrawGeomHatch::getDecodedSpecsFromFile()
{
std::string fileSpec = FilePattern.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
/*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;
Base::FileInfo fi(fileSpec);
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;
}
result = HatchLine::getSpecsForPattern(fileSpec,myPattern);
@ -172,7 +172,7 @@ std::vector<HatchLine> DrawCrosshatch::getDecodedSpecsFromFile(std::string fileS
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;
DrawViewPart* source = getSourceView();
@ -185,7 +185,7 @@ std::vector<LineSet> DrawCrosshatch::getDrawableLines(int i) //get the drawab
}
/* 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;
@ -230,7 +230,7 @@ std::vector<LineSet> DrawCrosshatch::getDrawableLines(DrawViewPart* source, std:
for (auto& ls: lineSets) {
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
BRep_Builder builder;
@ -275,7 +275,7 @@ std::vector<LineSet> DrawCrosshatch::getDrawableLines(DrawViewPart* source, std:
return result;
}
/* 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;
@ -374,7 +374,7 @@ std::vector<TopoDS_Edge> DrawCrosshatch::makeEdgeOverlay(HatchLine hl, Bnd_Box b
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;
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;
}
void DrawCrosshatch::getParameters(void)
void DrawGeomHatch::getParameters(void)
{
//this is probably "/build/data/Mod/TechDraw/PAT"
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())) {
PythonObject = Py::Object(new DrawCrosshatchPy(this),true);
PythonObject = Py::Object(new DrawGeomHatchPy(this),true);
}
return Py::new_reference_to(PythonObject);
}
@ -422,12 +422,12 @@ PyObject *DrawCrosshatch::getPyObject(void)
namespace App {
/// @cond DOXERR
PROPERTY_SOURCE_TEMPLATE(TechDraw::DrawCrosshatchPython, TechDraw::DrawCrosshatch)
template<> const char* TechDraw::DrawCrosshatchPython::getViewProviderName(void) const {
return "TechDrawGui::ViewProviderCrosshatch";
PROPERTY_SOURCE_TEMPLATE(TechDraw::DrawGeomHatchPython, TechDraw::DrawGeomHatch)
template<> const char* TechDraw::DrawGeomHatchPython::getViewProviderName(void) const {
return "TechDrawGui::ViewProviderGeomHatch";
}
/// @endcond
// 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_
#define _TechDraw_DrawCrosshatch_h_
#ifndef _TechDraw_DrawGeomHatch_h_
#define _TechDraw_DrawGeomHatch_h_
# include <App/DocumentObject.h>
# include <App/FeaturePython.h>
@ -43,13 +43,13 @@ class HatchLine;
class LineSet;
class DashSet;
class TechDrawExport DrawCrosshatch : public App::DocumentObject
class TechDrawExport DrawGeomHatch : public App::DocumentObject
{
PROPERTY_HEADER(TechDraw::DrawCrosshatch);
PROPERTY_HEADER(TechDraw::DrawGeomHatch);
public:
DrawCrosshatch();
virtual ~DrawCrosshatch();
DrawGeomHatch();
virtual ~DrawGeomHatch();
App::PropertyLinkSub Source; //the dvX & face(s) this crosshatch belongs to
App::PropertyFile FilePattern;
@ -60,7 +60,7 @@ public:
virtual App::DocumentObjectExecReturn *execute(void);
virtual void onChanged(const App::Property* prop);
virtual const char* getViewProviderName(void) const {
return "TechDrawGui::ViewProviderCrosshatch";
return "TechDrawGui::ViewProviderGeomHatch";
}
virtual PyObject *getPyObject(void);
@ -81,7 +81,7 @@ protected:
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">
<PythonExport
Father="DocumentObjectPy"
Name="DrawCrosshatchPy"
Twin="DrawCrosshatch"
TwinPointer="DrawCrosshatch"
Include="Mod/TechDraw/App/DrawCrosshatch.h"
Name="DrawGeomHatchPy"
Twin="DrawGeomHatch"
TwinPointer="DrawGeomHatch"
Include="Mod/TechDraw/App/DrawGeomHatch.h"
Namespace="TechDraw"
FatherInclude="App/DocumentObjectPy.h"
FatherNamespace="App">
<Documentation>
<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>
<CustomAttributes />
</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 "DrawViewPart.h"
#include "DrawHatch.h"
#include "DrawCrosshatch.h"
#include "DrawGeomHatch.h"
#include "EdgeWalker.h"
@ -409,14 +409,14 @@ std::vector<TechDraw::DrawHatch*> DrawViewPart::getHatches() const
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();
for (std::vector<App::DocumentObject*>::iterator it = children.begin(); it != children.end(); ++it) {
if ((*it)->getTypeId().isDerivedFrom(DrawCrosshatch::getClassTypeId())) {
TechDraw::DrawCrosshatch* cross = dynamic_cast<TechDraw::DrawCrosshatch*>(*it);
result.push_back(cross);
if ((*it)->getTypeId().isDerivedFrom(DrawGeomHatch::getClassTypeId())) {
TechDraw::DrawGeomHatch* geom = dynamic_cast<TechDraw::DrawGeomHatch*>(*it);
result.push_back(geom);
}
}
return result;

View File

@ -56,7 +56,7 @@ class Face;
namespace TechDraw {
class DrawHatch;
class DrawCrosshatch;
class DrawGeomHatch;
class DrawProjectSplit;
class DrawViewSection;
}
@ -99,7 +99,7 @@ public:
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???

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -64,7 +64,7 @@ public:
FromFile,
SvgFill,
BitmapFill,
CrosshatchFill,
GeomHatchFill,
PlainFill
};
@ -100,7 +100,7 @@ public:
void clearSvg(void);
//PAT fill parms & methods
void setCrosshatchWeight(double w) { m_crossWeight = w; }
void setGeomHatchWeight(double w) { m_geomWeight = w; }
void clearLineSets(void);
void addLineSet(QPainterPath pp, std::vector<double> dp);
QGraphicsPathItem* addFillItem();
@ -124,10 +124,10 @@ protected:
bool m_isHatched;
QGIFace::fillMode m_mode;
QPen setCrossPen(int i);
QPen setGeomPen(int i);
QVector<qreal> decodeDashSpec(DashSpec d);
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;
@ -146,10 +146,10 @@ private:
QPainterPath m_outline; //
QPainterPath m_crosshatch; //crosshatch fill lines
QPainterPath m_geomhatch; //crosshatch fill lines
QColor m_crossColor; //color for crosshatch lines
double m_crossWeight; //lineweight for crosshatch lines
QColor m_geomColor; //color 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/DrawViewSection.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 "Rez.h"
@ -68,7 +68,7 @@
#include "QGCustomRect.h"
#include "QGIMatting.h"
#include "QGIViewPart.h"
#include "ViewProviderCrosshatch.h"
#include "ViewProviderGeomHatch.h"
using namespace TechDrawGui;
using namespace TechDrawGeometry;
@ -378,7 +378,7 @@ void QGIViewPart::drawViewPart()
if (viewPart->handleFaces()) {
// Draw Faces
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();
std::vector<TechDrawGeometry::Face *>::const_iterator fit = faceGeoms.begin();
for(int i = 0 ; fit != faceGeoms.end(); fit++, i++) {
@ -386,12 +386,12 @@ void QGIViewPart::drawViewPart()
newFace->isHatched(false);
newFace->setFillMode(QGIFace::PlainFill);
TechDraw::DrawHatch* fHatch = faceIsHatched(i,hatchObjs);
TechDraw::DrawCrosshatch* fCross = faceIsCrosshatched(i,crossObjs);
if (fCross) {
const std::vector<std::string> &sourceNames = fCross->Source.getSubValues();
TechDraw::DrawGeomHatch* fGeom = faceIsGeomHatched(i,geomObjs);
if (fGeom) {
const std::vector<std::string> &sourceNames = fGeom->Source.getSubValues();
if (!sourceNames.empty()) {
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()) {
newFace->clearLineSets();
for (auto& ls: lineSets) {
@ -403,14 +403,14 @@ void QGIViewPart::drawViewPart()
newFace->addLineSet(bigPath,ls.getDashSpec());
}
newFace->isHatched(true);
newFace->setFillMode(QGIFace::CrosshatchFill);
newFace->setHatchScale(fCross->ScalePattern.getValue());
newFace->setHatchFile(fCross->FilePattern.getValue());
Gui::ViewProvider* gvp = QGIView::getViewProvider(fCross);
ViewProviderCrosshatch* crossVp = dynamic_cast<ViewProviderCrosshatch*>(gvp);
if (crossVp != nullptr) {
newFace->setHatchColor(crossVp->ColorPattern.getValue());
newFace->setLineWeight(crossVp->WeightPattern.getValue());
newFace->setFillMode(QGIFace::GeomHatchFill);
newFace->setHatchScale(fGeom->ScalePattern.getValue());
newFace->setHatchFile(fGeom->FilePattern.getValue());
Gui::ViewProvider* gvp = QGIView::getViewProvider(fGeom);
ViewProviderGeomHatch* geomVp = dynamic_cast<ViewProviderGeomHatch*>(gvp);
if (geomVp != nullptr) {
newFace->setHatchColor(geomVp->ColorPattern.getValue());
newFace->setLineWeight(geomVp->WeightPattern.getValue());
}
}
}
@ -887,10 +887,10 @@ TechDraw::DrawHatch* QGIViewPart::faceIsHatched(int i,std::vector<TechDraw::Draw
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;
for (auto& h:crossObjs) {
TechDraw::DrawGeomHatch* result = nullptr;
for (auto& h:geomObjs) {
const std::vector<std::string> &sourceNames = h->Source.getSubValues();
int fdx = TechDraw::DrawUtil::getIndexFromName(sourceNames.at(0));
if (fdx == i) {

View File

@ -34,7 +34,7 @@ namespace TechDraw {
class DrawViewPart;
class DrawViewSection;
class DrawHatch;
class DrawCrosshatch;
class DrawGeomHatch;
}
namespace TechDrawGui
@ -90,7 +90,7 @@ protected:
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
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 removePrimitives(void);
void removeDecorations(void);

View File

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

View File

@ -49,7 +49,7 @@
<file>icons/actions/techdraw-saveSVG.svg</file>
<file>icons/actions/techdraw-viewsection.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-projgroup.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/Control.h>
#include <Mod/TechDraw/App/DrawCrosshatch.h>
#include <Mod/TechDraw/App/DrawGeomHatch.h>
#include <Mod/TechDraw/App/DrawViewPart.h>
#include <Mod/TechDraw/App/DrawView.h>
#include "ViewProviderDrawingView.h"
#include "ViewProviderCrosshatch.h"
#include "ViewProviderGeomHatch.h"
using namespace TechDrawGui;
PROPERTY_SOURCE(TechDrawGui::ViewProviderCrosshatch, Gui::ViewProviderDocumentObject)
PROPERTY_SOURCE(TechDrawGui::ViewProviderGeomHatch, Gui::ViewProviderDocumentObject)
//**************************************************************************
// Construction/Destruction
ViewProviderCrosshatch::ViewProviderCrosshatch()
ViewProviderGeomHatch::ViewProviderGeomHatch()
{
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(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();
}
ViewProviderCrosshatch::~ViewProviderCrosshatch()
ViewProviderGeomHatch::~ViewProviderGeomHatch()
{
}
void ViewProviderCrosshatch::attach(App::DocumentObject *pcFeat)
void ViewProviderGeomHatch::attach(App::DocumentObject *pcFeat)
{
// call parent attach method
ViewProviderDocumentObject::attach(pcFeat);
}
void ViewProviderCrosshatch::setDisplayMode(const char* ModeName)
void ViewProviderGeomHatch::setDisplayMode(const char* 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
std::vector<std::string> StrList = ViewProviderDocumentObject::getDisplayModes();
@ -99,7 +99,7 @@ std::vector<std::string> ViewProviderCrosshatch::getDisplayModes(void) const
}
//for VP properties
void ViewProviderCrosshatch::onChanged(const App::Property* prop)
void ViewProviderGeomHatch::onChanged(const App::Property* prop)
{
if (prop == &WeightPattern ||
prop == &ColorPattern ) {
@ -110,7 +110,7 @@ void ViewProviderCrosshatch::onChanged(const App::Property* prop)
}
//for feature properties
void ViewProviderCrosshatch::updateData(const App::Property* prop)
void ViewProviderGeomHatch::updateData(const App::Property* prop)
{
if (prop == &(getViewObject()->ScalePattern)) {
updateGraphic();
@ -118,9 +118,9 @@ void ViewProviderCrosshatch::updateData(const App::Property* prop)
Gui::ViewProviderDocumentObject::updateData(prop);
}
void ViewProviderCrosshatch::updateGraphic(void)
void ViewProviderGeomHatch::updateGraphic(void)
{
TechDraw::DrawCrosshatch* dc = getViewObject();
TechDraw::DrawGeomHatch* dc = getViewObject();
if (dc) {
TechDraw::DrawViewPart* dvp = dc->getSourceView();
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()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/Colors");
App::Color fcColor;
fcColor.setPackedValue(hGrp->GetUnsigned("Crosshatch", 0x00000000));
fcColor.setPackedValue(hGrp->GetUnsigned("GeomHatch", 0x00000000));
ColorPattern.setValue(fcColor);
hGrp = App::GetApplication().GetUserParameter()
@ -152,7 +152,7 @@ void ViewProviderCrosshatch::getParameters(void)
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{
class DrawCrosshatch;
class DrawGeomHatch;
}
namespace TechDrawGui {
class TechDrawGuiExport ViewProviderCrosshatch : public Gui::ViewProviderDocumentObject
class TechDrawGuiExport ViewProviderGeomHatch : public Gui::ViewProviderDocumentObject
{
PROPERTY_HEADER(TechDrawGui::ViewProviderCrosshatch);
PROPERTY_HEADER(TechDrawGui::ViewProviderGeomHatch);
public:
/// constructor
ViewProviderCrosshatch();
ViewProviderGeomHatch();
/// destructor
virtual ~ViewProviderCrosshatch();
virtual ~ViewProviderGeomHatch();
App::PropertyFloat WeightPattern;
App::PropertyColor ColorPattern;
@ -63,7 +63,7 @@ public:
void updateGraphic(void);
void getParameters(void);
TechDraw::DrawCrosshatch* getViewObject() const;
TechDraw::DrawGeomHatch* getViewObject() const;
};
} // namespace TechDrawGui

View File

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

View File

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