Skip to content

Commit

Permalink
fix naming conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Jan 30, 2017
1 parent 42bb647 commit 84b858a
Show file tree
Hide file tree
Showing 26 changed files with 184 additions and 185 deletions.
4 changes: 2 additions & 2 deletions src/Mod/TechDraw/App/AppTechDraw.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
Expand Down
10 changes: 5 additions & 5 deletions src/Mod/TechDraw/App/CMakeLists.txt
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
32 changes: 0 additions & 32 deletions src/Mod/TechDraw/App/DrawCrosshatchPyImp.cpp

This file was deleted.

Expand Up @@ -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();
}
}

Expand All @@ -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()) {
Expand All @@ -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();
Expand All @@ -159,20 +159,20 @@ 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);

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();
Expand All @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand All @@ -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()
Expand All @@ -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);
}
Expand All @@ -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>;
}
Expand Up @@ -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>
Expand All @@ -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;
Expand All @@ -60,7 +60,7 @@ class TechDrawExport DrawCrosshatch : public App::DocumentObject
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);

Expand All @@ -81,7 +81,7 @@ class TechDrawExport DrawCrosshatch : public App::DocumentObject
private:
};

typedef App::FeaturePythonT<DrawCrosshatch> DrawCrosshatchPython;
typedef App::FeaturePythonT<DrawGeomHatch> DrawGeomHatchPython;



Expand Down
Expand Up @@ -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>
Expand Down
32 changes: 32 additions & 0 deletions src/Mod/TechDraw/App/DrawGeomHatchPyImp.cpp
@@ -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;
}
12 changes: 6 additions & 6 deletions src/Mod/TechDraw/App/DrawViewPart.cpp
Expand Up @@ -89,7 +89,7 @@
#include "GeometryObject.h"
#include "DrawViewPart.h"
#include "DrawHatch.h"
#include "DrawCrosshatch.h"
#include "DrawGeomHatch.h"
#include "EdgeWalker.h"


Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 84b858a

Please sign in to comment.