From 3b2d07e8af35fe35dfdf25841257191d1c97ea49 Mon Sep 17 00:00:00 2001 From: WandererFan Date: Fri, 15 Jan 2016 13:36:28 -0500 Subject: [PATCH] ProjectionAlgo & DrawingExport renames --- src/Mod/TechDraw/App/AppTechDraw.cpp | 6 +- src/Mod/TechDraw/App/AppTechDrawPy.cpp | 164 +----------------- src/Mod/TechDraw/App/CMakeLists.txt | 2 - src/Mod/TechDraw/App/DrawHatch.cpp | 2 +- src/Mod/TechDraw/App/DrawHatch.h | 2 +- src/Mod/TechDraw/App/DrawPage.h | 2 +- src/Mod/TechDraw/App/DrawPagePy.xml | 4 +- .../TechDraw/App/DrawParametricTemplate.cpp | 6 +- src/Mod/TechDraw/App/DrawParametricTemplate.h | 6 +- .../TechDraw/App/DrawParametricTemplatePy.xml | 6 +- src/Mod/TechDraw/App/DrawProjGroup.h | 2 +- src/Mod/TechDraw/App/DrawProjGroupItem.h | 2 +- src/Mod/TechDraw/App/DrawProjection.cpp | 116 ------------- src/Mod/TechDraw/App/DrawProjection.h | 73 -------- src/Mod/TechDraw/App/DrawSVGTemplate.cpp | 2 +- src/Mod/TechDraw/App/DrawSVGTemplate.h | 2 +- src/Mod/TechDraw/App/DrawSVGTemplatePy.xml | 6 +- src/Mod/TechDraw/App/DrawTemplate.cpp | 2 +- src/Mod/TechDraw/App/DrawTemplate.h | 2 +- src/Mod/TechDraw/App/DrawTemplatePy.xml | 4 +- src/Mod/TechDraw/App/DrawUtil.cpp | 6 +- src/Mod/TechDraw/App/DrawView.cpp | 10 +- src/Mod/TechDraw/App/DrawView.h | 4 +- src/Mod/TechDraw/App/DrawViewAnnotation.cpp | 12 +- src/Mod/TechDraw/App/DrawViewAnnotation.h | 2 +- src/Mod/TechDraw/App/DrawViewClip.cpp | 2 +- src/Mod/TechDraw/App/DrawViewClip.h | 2 +- src/Mod/TechDraw/App/DrawViewCollection.h | 2 +- src/Mod/TechDraw/App/DrawViewDimension.cpp | 52 +++--- src/Mod/TechDraw/App/DrawViewDimension.h | 2 +- src/Mod/TechDraw/App/DrawViewPart.cpp | 44 ++--- src/Mod/TechDraw/App/DrawViewPart.h | 22 +-- src/Mod/TechDraw/App/DrawViewPartPy.xml | 8 +- src/Mod/TechDraw/App/DrawViewPy.xml | 4 +- src/Mod/TechDraw/App/DrawViewSection.cpp | 8 +- src/Mod/TechDraw/App/DrawViewSection.h | 4 +- src/Mod/TechDraw/App/DrawViewSymbol.cpp | 2 +- src/Mod/TechDraw/App/DrawViewSymbol.h | 2 +- src/Mod/TechDraw/App/DrawViewSymbolPy.xml | 8 +- src/Mod/TechDraw/App/Geometry.cpp | 40 ++--- src/Mod/TechDraw/App/Geometry.h | 24 +-- src/Mod/TechDraw/App/GeometryObject.cpp | 30 ++-- src/Mod/TechDraw/App/GeometryObject.h | 10 +- src/Mod/TechDraw/App/Makefile.am | 6 +- src/Mod/TechDraw/App/PreCompiled.h | 4 +- src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp | 18 +- src/Mod/TechDraw/Gui/Command.cpp | 10 +- src/Mod/TechDraw/Gui/CommandCreateDims.cpp | 28 +-- src/Mod/TechDraw/Gui/PreCompiled.h | 4 +- src/Mod/TechDraw/Gui/QGIDrawingTemplate.cpp | 8 +- src/Mod/TechDraw/Gui/QGIViewDimension.cpp | 52 +++--- src/Mod/TechDraw/Gui/QGIViewDimension.h | 2 +- src/Mod/TechDraw/Gui/QGIViewPart.cpp | 70 ++++---- src/Mod/TechDraw/Gui/QGIViewPart.h | 2 +- src/Mod/TechDraw/Gui/QGIViewSection.cpp | 12 +- 55 files changed, 294 insertions(+), 633 deletions(-) delete mode 100644 src/Mod/TechDraw/App/DrawProjection.cpp delete mode 100644 src/Mod/TechDraw/App/DrawProjection.h diff --git a/src/Mod/TechDraw/App/AppTechDraw.cpp b/src/Mod/TechDraw/App/AppTechDraw.cpp index 27dc59e9d..e4c4c5624 100644 --- a/src/Mod/TechDraw/App/AppTechDraw.cpp +++ b/src/Mod/TechDraw/App/AppTechDraw.cpp @@ -29,7 +29,7 @@ #include "DrawProjGroupItem.h" #include "DrawProjGroup.h" #include "DrawViewSymbol.h" -#include "DrawProjection.h" +//#include "DrawProjection.h" #include "DrawViewClip.h" #include "DrawHatch.h" @@ -41,7 +41,7 @@ PyDoc_STRVAR(module_drawing_doc, /* Python entry */ extern "C" { -void DrawingExport initDrawing() +void TechDrawExport initDrawing() { // load dependent module try { @@ -65,7 +65,7 @@ void DrawingExport initDrawing() TechDraw::DrawView ::init(); TechDraw::DrawViewCollection ::init(); TechDraw::DrawViewPart ::init(); - TechDraw::DrawProjection ::init(); + //TechDraw::DrawProjection ::init(); TechDraw::DrawViewAnnotation ::init(); TechDraw::DrawViewSymbol ::init(); diff --git a/src/Mod/TechDraw/App/AppTechDrawPy.cpp b/src/Mod/TechDraw/App/AppTechDrawPy.cpp index b5b2ad12a..cbc496858 100644 --- a/src/Mod/TechDraw/App/AppTechDrawPy.cpp +++ b/src/Mod/TechDraw/App/AppTechDrawPy.cpp @@ -27,19 +27,18 @@ #endif #include -#include "ProjectionAlgos.h" #include #include #include #include -using namespace TechDraw; +//using namespace TechDraw; using namespace Part; using namespace std; -static PyObject * -project(PyObject *self, PyObject *args) +static PyObject * +tdPlaceholder(PyObject *self, PyObject *args) { PyObject *pcObjShape; PyObject *pcObjDir=0; @@ -49,168 +48,17 @@ project(PyObject *self, PyObject *args) PY_TRY { TopoShapePy* pShape = static_cast(pcObjShape); - Base::Vector3d Vector(0,0,1); - if (pcObjDir) - Vector = *static_cast(pcObjDir)->getVectorPtr(); - - ProjectionAlgos Alg(pShape->getTopoShapePtr()->_Shape,Vector); - Py::List list; - list.append(Py::Object(new TopoShapePy(new TopoShape(Alg.V)) , true)); - list.append(Py::Object(new TopoShapePy(new TopoShape(Alg.V1)), true)); - list.append(Py::Object(new TopoShapePy(new TopoShape(Alg.H)) , true)); - list.append(Py::Object(new TopoShapePy(new TopoShape(Alg.H1)), true)); - + list.append(Py::Object(pShape , true)); return Py::new_reference_to(list); } PY_CATCH_OCC; } -static PyObject * -projectEx(PyObject *self, PyObject *args) -{ - PyObject *pcObjShape; - PyObject *pcObjDir=0; - - if (!PyArg_ParseTuple(args, "O!|O!", &(TopoShapePy::Type), &pcObjShape,&(Base::VectorPy::Type), &pcObjDir)) // convert args: Python->C - return NULL; // NULL triggers exception - - PY_TRY { - TopoShapePy* pShape = static_cast(pcObjShape); - Base::Vector3d Vector(0,0,1); - if (pcObjDir) - Vector = *static_cast(pcObjDir)->getVectorPtr(); - - ProjectionAlgos Alg(pShape->getTopoShapePtr()->_Shape,Vector); - - Py::List list; - list.append(Py::Object(new TopoShapePy(new TopoShape(Alg.V)) , true)); - list.append(Py::Object(new TopoShapePy(new TopoShape(Alg.V1)), true)); - list.append(Py::Object(new TopoShapePy(new TopoShape(Alg.VN)), true)); - list.append(Py::Object(new TopoShapePy(new TopoShape(Alg.VO)), true)); - list.append(Py::Object(new TopoShapePy(new TopoShape(Alg.VI)), true)); - list.append(Py::Object(new TopoShapePy(new TopoShape(Alg.H)) , true)); - list.append(Py::Object(new TopoShapePy(new TopoShape(Alg.H1)), true)); - list.append(Py::Object(new TopoShapePy(new TopoShape(Alg.HN)), true)); - list.append(Py::Object(new TopoShapePy(new TopoShape(Alg.HO)), true)); - list.append(Py::Object(new TopoShapePy(new TopoShape(Alg.HI)), true)); - - return Py::new_reference_to(list); - - } PY_CATCH_OCC; -} - -static PyObject * -projectToSVG(PyObject *self, PyObject *args) -{ - PyObject *pcObjShape; - PyObject *pcObjDir=0; - const char *type=0; - float scale=1.0f; - float tol=0.1f; - - if (!PyArg_ParseTuple(args, "O!|O!sff", &(TopoShapePy::Type), &pcObjShape, - &(Base::VectorPy::Type), &pcObjDir, &type, &scale, &tol)) - return NULL; - - PY_TRY { - TopoShapePy* pShape = static_cast(pcObjShape); - Base::Vector3d Vector(0,0,1); - if (pcObjDir) - Vector = static_cast(pcObjDir)->value(); - ProjectionAlgos Alg(pShape->getTopoShapePtr()->_Shape,Vector); - - bool hidden = false; - if (type && std::string(type) == "ShowHiddenLines") - hidden = true; - - Py::String result(Alg.getSVG(hidden?ProjectionAlgos::WithHidden:ProjectionAlgos::Plain, scale, tol)); - return Py::new_reference_to(result); - - } PY_CATCH_OCC; -} - -static PyObject * -projectToDXF(PyObject *self, PyObject *args) -{ - PyObject *pcObjShape; - PyObject *pcObjDir=0; - const char *type=0; - float scale=1.0f; - float tol=0.1f; - - if (!PyArg_ParseTuple(args, "O!|O!sff", &(TopoShapePy::Type), &pcObjShape, - &(Base::VectorPy::Type), &pcObjDir, &type, &scale, &tol)) - return NULL; - - PY_TRY { - TopoShapePy* pShape = static_cast(pcObjShape); - Base::Vector3d Vector(0,0,1); - if (pcObjDir) - Vector = static_cast(pcObjDir)->value(); - ProjectionAlgos Alg(pShape->getTopoShapePtr()->_Shape,Vector); - - bool hidden = false; - if (type && std::string(type) == "ShowHiddenLines") - hidden = true; - - Py::String result(Alg.getDXF(hidden?ProjectionAlgos::WithHidden:ProjectionAlgos::Plain, scale, tol)); - return Py::new_reference_to(result); - - } PY_CATCH_OCC; -} - -static PyObject * -removeSvgTags(PyObject *self, PyObject *args) -{ - const char* svgcode; - if (!PyArg_ParseTuple(args, "s",&svgcode)) - return NULL; - - PY_TRY { - string svg(svgcode); - string empty = ""; - string endline = "--endOfLine--"; - string linebreak = "\\n"; - // removing linebreaks for regex to work - boost::regex e1 ("\\n"); - svg = boost::regex_replace(svg, e1, endline); - // removing starting xml definition - boost::regex e2 ("<\\?xml.*?\\?>"); - svg = boost::regex_replace(svg, e2, empty); - // removing starting svg tag - boost::regex e3 (""); - svg = boost::regex_replace(svg, e3, empty); - // removing sodipodi tags -- DANGEROUS, some sodipodi tags are single, better leave it - //boost::regex e4 (""); - //svg = boost::regex_replace(svg, e4, empty); - // removing metadata tags - boost::regex e5 (""); - svg = boost::regex_replace(svg, e5, empty); - // removing closing svg tags - boost::regex e6 (""); - svg = boost::regex_replace(svg, e6, empty); - // restoring linebreaks - boost::regex e7 ("--endOfLine--"); - svg = boost::regex_replace(svg, e7, linebreak); - Py::String result(svg); - - return Py::new_reference_to(result); - } PY_CATCH_OCC; -} - /* registration table */ struct PyMethodDef Drawing_methods[] = { - {"project" ,project ,METH_VARARGS, - "[visiblyG0,visiblyG1,hiddenG0,hiddenG1] = project(TopoShape[,App.Vector Direction, string type]) -- Project a shape and return the visible/invisible parts of it."}, - {"projectEx" ,projectEx ,METH_VARARGS, - "[V,V1,VN,VO,VI,H,H1,HN,HO,HI] = projectEx(TopoShape[,App.Vector Direction, string type]) -- Project a shape and return the all parts of it."}, - {"projectToSVG" ,projectToSVG ,METH_VARARGS, - "string = projectToSVG(TopoShape[,App.Vector Direction, string type]) -- Project a shape and return the SVG representation as string."}, - {"projectToDXF" ,projectToDXF ,METH_VARARGS, - "string = projectToDXF(TopoShape[,App.Vector Direction, string type]) -- Project a shape and return the DXF representation as string."}, - {"removeSvgTags" ,removeSvgTags ,METH_VARARGS, - "string = removeSvgTags(string) -- Removes the opening and closing svg tags and other metatags from a svg code, making it embeddable"}, + {"tdPlaceholder" ,tdPlaceholder ,METH_VARARGS, + "[n/a] = tdPlaceholder(n/a) -- Temporary hack."}, {NULL, NULL} /* end of table marker */ }; diff --git a/src/Mod/TechDraw/App/CMakeLists.txt b/src/Mod/TechDraw/App/CMakeLists.txt index 04e8d50cd..375c63112 100644 --- a/src/Mod/TechDraw/App/CMakeLists.txt +++ b/src/Mod/TechDraw/App/CMakeLists.txt @@ -36,8 +36,6 @@ generate_from_xml(DrawViewSymbolPy) SET(Draw_SRCS DrawPage.cpp DrawPage.h - DrawProjection.cpp - DrawProjection.h DrawView.cpp DrawView.h DrawViewPart.cpp diff --git a/src/Mod/TechDraw/App/DrawHatch.cpp b/src/Mod/TechDraw/App/DrawHatch.cpp index 6527a764c..7f3cb59e2 100644 --- a/src/Mod/TechDraw/App/DrawHatch.cpp +++ b/src/Mod/TechDraw/App/DrawHatch.cpp @@ -108,5 +108,5 @@ template<> const char* TechDraw::DrawHatchPython::getViewProviderName(void) cons /// @endcond // explicit template instantiation -template class DrawingExport FeaturePythonT; +template class TechDrawExport FeaturePythonT; } diff --git a/src/Mod/TechDraw/App/DrawHatch.h b/src/Mod/TechDraw/App/DrawHatch.h index 64874b4d8..7f9da09e6 100644 --- a/src/Mod/TechDraw/App/DrawHatch.h +++ b/src/Mod/TechDraw/App/DrawHatch.h @@ -34,7 +34,7 @@ namespace TechDraw { -class DrawingExport DrawHatch : public TechDraw::DrawView +class TechDrawExport DrawHatch : public TechDraw::DrawView { PROPERTY_HEADER(TechDraw::DrawHatch); diff --git a/src/Mod/TechDraw/App/DrawPage.h b/src/Mod/TechDraw/App/DrawPage.h index fdc3d3620..2fe499a0d 100644 --- a/src/Mod/TechDraw/App/DrawPage.h +++ b/src/Mod/TechDraw/App/DrawPage.h @@ -33,7 +33,7 @@ namespace TechDraw { -class DrawingExport DrawPage: public App::DocumentObject +class TechDrawExport DrawPage: public App::DocumentObject { PROPERTY_HEADER(TechDraw::DrawPage); diff --git a/src/Mod/TechDraw/App/DrawPagePy.xml b/src/Mod/TechDraw/App/DrawPagePy.xml index 0f0e2cfed..518f30c3d 100644 --- a/src/Mod/TechDraw/App/DrawPagePy.xml +++ b/src/Mod/TechDraw/App/DrawPagePy.xml @@ -5,8 +5,8 @@ Name="DrawPagePy" Twin="DrawPage" TwinPointer="DrawPage" - Include="Mod/Drawing/App/DrawPage.h" - Namespace="Drawing" + Include="Mod/TechDraw/App/DrawPage.h" + Namespace="TechDraw" FatherInclude="App/DocumentObjectPy.h" FatherNamespace="App"> diff --git a/src/Mod/TechDraw/App/DrawParametricTemplate.cpp b/src/Mod/TechDraw/App/DrawParametricTemplate.cpp index 4dff0f1ec..bd03fb3f2 100644 --- a/src/Mod/TechDraw/App/DrawParametricTemplate.cpp +++ b/src/Mod/TechDraw/App/DrawParametricTemplate.cpp @@ -117,7 +117,7 @@ App::DocumentObjectExecReturn *DrawParametricTemplate::execute(void) int DrawParametricTemplate::drawLine(double x1, double y1, double x2, double y2) { - DrawingGeometry::Generic *line = new DrawingGeometry::Generic(); + TechDrawGeometry::Generic *line = new TechDrawGeometry::Generic(); line->points.push_back(Base::Vector2D(x1, y1)); line->points.push_back(Base::Vector2D(x2, y2)); @@ -128,7 +128,7 @@ int DrawParametricTemplate::drawLine(double x1, double y1, double x2, double y2) int DrawParametricTemplate::clearGeometry() { - for(std::vector::iterator it = geom.begin(); it != geom.end(); ++it) { + for(std::vector::iterator it = geom.begin(); it != geom.end(); ++it) { delete *it; *it = 0; } @@ -147,5 +147,5 @@ template<> const char* TechDraw::DrawParametricTemplatePython::getViewProviderNa /// @endcond // explicit template instantiation -template class DrawingExport FeaturePythonT; +template class TechDrawExport FeaturePythonT; } diff --git a/src/Mod/TechDraw/App/DrawParametricTemplate.h b/src/Mod/TechDraw/App/DrawParametricTemplate.h index d88987307..e6c5a6843 100644 --- a/src/Mod/TechDraw/App/DrawParametricTemplate.h +++ b/src/Mod/TechDraw/App/DrawParametricTemplate.h @@ -38,7 +38,7 @@ namespace TechDraw /** Base class of all View Features in the drawing module */ -class DrawingExport DrawParametricTemplate: public TechDraw::DrawTemplate +class TechDrawExport DrawParametricTemplate: public TechDraw::DrawTemplate { PROPERTY_HEADER(TechDraw::DrawParametricTemplate); @@ -67,7 +67,7 @@ public: virtual unsigned int getMemSize(void) const; public: - std::vector getGeometry() { return geom; } + std::vector getGeometry() { return geom; } int clearGeometry(); // Template Drawing Methods @@ -80,7 +80,7 @@ protected: void onChanged(const App::Property* prop); protected: - std::vector geom; + std::vector geom; private: static const char* OrientationEnums[]; diff --git a/src/Mod/TechDraw/App/DrawParametricTemplatePy.xml b/src/Mod/TechDraw/App/DrawParametricTemplatePy.xml index 19ada4aca..4e30b9cb1 100644 --- a/src/Mod/TechDraw/App/DrawParametricTemplatePy.xml +++ b/src/Mod/TechDraw/App/DrawParametricTemplatePy.xml @@ -5,10 +5,10 @@ Name="DrawParametricTemplatePy" Twin="DrawParametricTemplate" TwinPointer="DrawParametricTemplate" - Include="Mod/Drawing/App/DrawParametricTemplate.h" - Namespace="Drawing" + Include="Mod/TechDraw/App/DrawParametricTemplate.h" + Namespace="TechDraw" FatherInclude="DrawTemplatePy.h" - FatherNamespace="Drawing"> + FatherNamespace="TechDraw"> Feature for creating and manipulating Drawing Templates diff --git a/src/Mod/TechDraw/App/DrawProjGroup.h b/src/Mod/TechDraw/App/DrawProjGroup.h index 6785c1005..44f58cc73 100644 --- a/src/Mod/TechDraw/App/DrawProjGroup.h +++ b/src/Mod/TechDraw/App/DrawProjGroup.h @@ -39,7 +39,7 @@ namespace TechDraw * Class super-container for managing a collection of DrawProjGroupItem * Page Features */ -class DrawingExport DrawProjGroup : public TechDraw::DrawViewCollection +class TechDrawExport DrawProjGroup : public TechDraw::DrawViewCollection { PROPERTY_HEADER(TechDraw::DrawProjGroup); diff --git a/src/Mod/TechDraw/App/DrawProjGroupItem.h b/src/Mod/TechDraw/App/DrawProjGroupItem.h index f82472cab..7bdaf00ef 100644 --- a/src/Mod/TechDraw/App/DrawProjGroupItem.h +++ b/src/Mod/TechDraw/App/DrawProjGroupItem.h @@ -33,7 +33,7 @@ namespace TechDraw /** Base class of all View Features in the drawing module */ -class DrawingExport DrawProjGroupItem : public TechDraw::DrawViewPart +class TechDrawExport DrawProjGroupItem : public TechDraw::DrawViewPart { PROPERTY_HEADER(TechDraw::DrawProjGroupItem); diff --git a/src/Mod/TechDraw/App/DrawProjection.cpp b/src/Mod/TechDraw/App/DrawProjection.cpp deleted file mode 100644 index 8a0834df6..000000000 --- a/src/Mod/TechDraw/App/DrawProjection.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2009 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#include "PreCompiled.h" - -#ifndef _PreComp_ -# include -# include -# include -# include -#endif - - -#include -#include -#include -#include -#include - -#include "DrawProjection.h" -#include "ProjectionAlgos.h" - -using namespace TechDraw; - - -PROPERTY_SOURCE(TechDraw::DrawProjection, Part::Feature) - - -DrawProjection::DrawProjection() -{ - static const char *group = "Projection"; - ADD_PROPERTY_TYPE(Source ,(0),group,App::Prop_None,"Shape to project"); - ADD_PROPERTY_TYPE(Direction ,(Base::Vector3d(0.0,0.0,1.0)),group,App::Prop_None,"Projection direction"); - ADD_PROPERTY_TYPE(VCompound ,(true),group,App::Prop_None,"Projection parameter"); - ADD_PROPERTY_TYPE(Rg1LineVCompound ,(true),group,App::Prop_None,"Projection parameter"); - ADD_PROPERTY_TYPE(RgNLineVCompound ,(true),group,App::Prop_None,"Projection parameter"); - ADD_PROPERTY_TYPE(OutLineVCompound ,(true),group,App::Prop_None,"Projection parameter"); - ADD_PROPERTY_TYPE(IsoLineVCompound ,(true),group,App::Prop_None,"Projection parameter"); - ADD_PROPERTY_TYPE(HCompound ,(true),group,App::Prop_None,"Projection parameter"); - ADD_PROPERTY_TYPE(Rg1LineHCompound ,(true),group,App::Prop_None,"Projection parameter"); - ADD_PROPERTY_TYPE(RgNLineHCompound ,(true),group,App::Prop_None,"Projection parameter"); - ADD_PROPERTY_TYPE(OutLineHCompound ,(true),group,App::Prop_None,"Projection parameter"); - ADD_PROPERTY_TYPE(IsoLineHCompound ,(true),group,App::Prop_None,"Projection parameter"); -} - -DrawProjection::~DrawProjection() -{ -} - -App::DocumentObjectExecReturn *DrawProjection::execute(void) -{ - App::DocumentObject* link = Source.getValue(); - if (!link) - return new App::DocumentObjectExecReturn("No object linked"); - if (!link->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) - return new App::DocumentObjectExecReturn("Linked object is not a Part object"); - const TopoDS_Shape& shape = static_cast(link)->Shape.getShape()._Shape; - if (shape.IsNull()) - return new App::DocumentObjectExecReturn("Linked shape object is empty"); - - try { - const Base::Vector3d& dir = Direction.getValue(); - TechDraw::ProjectionAlgos alg(shape, dir); - - TopoDS_Compound comp; - BRep_Builder builder; - builder.MakeCompound(comp); - if (!alg.V.IsNull() && VCompound.getValue()) - builder.Add(comp, alg.V); - if (!alg.V1.IsNull() && Rg1LineVCompound.getValue()) - builder.Add(comp, alg.V1); - if (!alg.VN.IsNull() && RgNLineVCompound.getValue()) - builder.Add(comp, alg.VN); - if (!alg.VO.IsNull() && OutLineVCompound.getValue()) - builder.Add(comp, alg.VO); - if (!alg.VI.IsNull() && IsoLineVCompound.getValue()) - builder.Add(comp, alg.VI); - if (!alg.H.IsNull() && HCompound.getValue()) - builder.Add(comp, alg.H); - if (!alg.H1.IsNull() && Rg1LineHCompound.getValue()) - builder.Add(comp, alg.H1); - if (!alg.HN.IsNull() && RgNLineHCompound.getValue()) - builder.Add(comp, alg.HN); - if (!alg.HO.IsNull() && OutLineHCompound.getValue()) - builder.Add(comp, alg.HO); - if (!alg.HI.IsNull() && IsoLineHCompound.getValue()) - builder.Add(comp, alg.HI); - - Shape.setValue(comp); - return App::DocumentObject::StdReturn; - } - catch (Standard_Failure) { - Handle_Standard_Failure e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); - } -} diff --git a/src/Mod/TechDraw/App/DrawProjection.h b/src/Mod/TechDraw/App/DrawProjection.h deleted file mode 100644 index 7f0b8343b..000000000 --- a/src/Mod/TechDraw/App/DrawProjection.h +++ /dev/null @@ -1,73 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2009 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public * - * License along with this library; see the file COPYING.LIB. If not, * - * write to the Free Software Foundation, Inc., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#ifndef TECHDRAW_FEATUREPROJECTION -#define TECHDRAW_FEATUREPROJECTION - - -#include -#include -#include -#include - - -namespace TechDraw -{ - - -/** Base class of all View Features in the drawing module - */ -class DrawingExport DrawProjection : public Part::Feature -{ - PROPERTY_HEADER(TechDraw::DrawProjection); - -public: - /// Constructor - DrawProjection(); - virtual ~DrawProjection(); - - App::PropertyLink Source; - App::PropertyVector Direction; - App::PropertyBool VCompound; - App::PropertyBool Rg1LineVCompound; - App::PropertyBool RgNLineVCompound; - App::PropertyBool OutLineVCompound; - App::PropertyBool IsoLineVCompound; - App::PropertyBool HCompound; - App::PropertyBool Rg1LineHCompound; - App::PropertyBool RgNLineHCompound; - App::PropertyBool OutLineHCompound; - App::PropertyBool IsoLineHCompound; - - /** @name methods overide feature */ - //@{ - /// recalculate the Feature - virtual App::DocumentObjectExecReturn *execute(void); - //@} -}; - -} //namespace TechDraw - - - -#endif // TECHDRAW_FEATUREPROJECTION diff --git a/src/Mod/TechDraw/App/DrawSVGTemplate.cpp b/src/Mod/TechDraw/App/DrawSVGTemplate.cpp index 073cd77f1..858e7e848 100644 --- a/src/Mod/TechDraw/App/DrawSVGTemplate.cpp +++ b/src/Mod/TechDraw/App/DrawSVGTemplate.cpp @@ -357,5 +357,5 @@ template<> const char* TechDraw::DrawSVGTemplatePython::getViewProviderName(void /// @endcond // explicit template instantiation -template class DrawingExport FeaturePythonT; +template class TechDrawExport FeaturePythonT; } diff --git a/src/Mod/TechDraw/App/DrawSVGTemplate.h b/src/Mod/TechDraw/App/DrawSVGTemplate.h index a6f5723ec..f05590a5c 100644 --- a/src/Mod/TechDraw/App/DrawSVGTemplate.h +++ b/src/Mod/TechDraw/App/DrawSVGTemplate.h @@ -35,7 +35,7 @@ namespace TechDraw /** Base class of all View Features in the drawing module */ -class DrawingExport DrawSVGTemplate: public TechDraw::DrawTemplate +class TechDrawExport DrawSVGTemplate: public TechDraw::DrawTemplate { PROPERTY_HEADER(TechDraw::DrawSVGTemplate); diff --git a/src/Mod/TechDraw/App/DrawSVGTemplatePy.xml b/src/Mod/TechDraw/App/DrawSVGTemplatePy.xml index 833aad92c..fbe8b819f 100644 --- a/src/Mod/TechDraw/App/DrawSVGTemplatePy.xml +++ b/src/Mod/TechDraw/App/DrawSVGTemplatePy.xml @@ -5,10 +5,10 @@ Name="DrawSVGTemplatePy" Twin="DrawSVGTemplate" TwinPointer="DrawSVGTemplate" - Include="Mod/Drawing/App/DrawSVGTemplate.h" - Namespace="Drawing" + Include="Mod/TechDraw/App/DrawSVGTemplate.h" + Namespace="TechDraw" FatherInclude="DrawTemplatePy.h" - FatherNamespace="Drawing"> + FatherNamespace="TechDraw"> Feature for creating and manipulating Drawing SVG Templates diff --git a/src/Mod/TechDraw/App/DrawTemplate.cpp b/src/Mod/TechDraw/App/DrawTemplate.cpp index 6b61b26ba..13f19353c 100644 --- a/src/Mod/TechDraw/App/DrawTemplate.cpp +++ b/src/Mod/TechDraw/App/DrawTemplate.cpp @@ -142,5 +142,5 @@ template<> const char* TechDraw::DrawTemplatePython::getViewProviderName(void) c /// @endcond // explicit template instantiation -template class DrawingExport FeaturePythonT; +template class TechDrawExport FeaturePythonT; } // namespace App diff --git a/src/Mod/TechDraw/App/DrawTemplate.h b/src/Mod/TechDraw/App/DrawTemplate.h index dbd8e8088..bcf4605c2 100644 --- a/src/Mod/TechDraw/App/DrawTemplate.h +++ b/src/Mod/TechDraw/App/DrawTemplate.h @@ -40,7 +40,7 @@ namespace TechDraw /** Base class of all View Features in the drawing module */ -class DrawingExport DrawTemplate: public App::DocumentObject +class TechDrawExport DrawTemplate: public App::DocumentObject { PROPERTY_HEADER(TechDraw::DrawTemplate); diff --git a/src/Mod/TechDraw/App/DrawTemplatePy.xml b/src/Mod/TechDraw/App/DrawTemplatePy.xml index 1a73d9a04..bf87839eb 100644 --- a/src/Mod/TechDraw/App/DrawTemplatePy.xml +++ b/src/Mod/TechDraw/App/DrawTemplatePy.xml @@ -5,8 +5,8 @@ Name="DrawTemplatePy" Twin="DrawTemplate" TwinPointer="DrawTemplate" - Include="Mod/Drawing/App/DrawTemplate.h" - Namespace="Drawing" + Include="Mod/TechDraw/App/DrawTemplate.h" + Namespace="TechDraw" FatherInclude="App/DocumentObjectPy.h" FatherNamespace="App"> diff --git a/src/Mod/TechDraw/App/DrawUtil.cpp b/src/Mod/TechDraw/App/DrawUtil.cpp index 19aae4d2a..150e65118 100644 --- a/src/Mod/TechDraw/App/DrawUtil.cpp +++ b/src/Mod/TechDraw/App/DrawUtil.cpp @@ -47,7 +47,7 @@ namespace DrawUtil { // convenient utility functions for Drawing Module //============================================================================== extern "C" { -int DrawingExport getIndexFromName(std::string geomName) +int TechDrawExport getIndexFromName(std::string geomName) { boost::regex re("\\d+$"); //one of more digits at end of string boost::match_results what; @@ -69,7 +69,7 @@ int DrawingExport getIndexFromName(std::string geomName) } } -std::string DrawingExport getGeomTypeFromName(std::string geomName) +std::string TechDrawExport getGeomTypeFromName(std::string geomName) { boost::regex re("^[a-zA-Z]*"); //one or more letters at start of string boost::match_results what; @@ -90,7 +90,7 @@ std::string DrawingExport getGeomTypeFromName(std::string geomName) } } -std::string DrawingExport makeGeomName(std::string geomType, int index) +std::string TechDrawExport makeGeomName(std::string geomType, int index) { std::stringstream newName; newName << geomType << index; diff --git a/src/Mod/TechDraw/App/DrawView.cpp b/src/Mod/TechDraw/App/DrawView.cpp index 0a36737eb..68491b68b 100644 --- a/src/Mod/TechDraw/App/DrawView.cpp +++ b/src/Mod/TechDraw/App/DrawView.cpp @@ -57,7 +57,7 @@ PROPERTY_SOURCE(TechDraw::DrawView, App::DocumentObject) -DrawView::DrawView(void) +DrawView::DrawView(void) { static const char *group = "Drawing view"; ADD_PROPERTY_TYPE(X ,(0),group,App::Prop_None,"X position of the view on the page in modelling units (mm)"); @@ -94,7 +94,8 @@ App::DocumentObjectExecReturn *DrawView::recompute(void) App::DocumentObjectExecReturn *DrawView::execute(void) { if (ScaleType.isValue("Document")) { - Scale.StatusBits.set(2, true); + Scale.setStatus(App::Property::ReadOnly,true); + //Scale.StatusBits.set(2, true); TechDraw::DrawPage *page = findParentPage(); if(page) { @@ -104,7 +105,8 @@ App::DocumentObjectExecReturn *DrawView::execute(void) } } } else if (ScaleType.isValue("Custom")) { - Scale.StatusBits.set(2, false); + Scale.setStatus(App::Property::ReadOnly,false); + //Scale.StatusBits.set(2, false); //TODO: need to ?recompute? ?redraw? to get this to stick. Mantis #1941 //TODO: try Gui::Selection to force update //currently need to lose focus and re-get focus to make Scale editable. @@ -179,5 +181,5 @@ template<> const char* TechDraw::DrawViewPython::getViewProviderName(void) const /// @endcond // explicit template instantiation -template class DrawingExport FeaturePythonT; +template class TechDrawExport FeaturePythonT; } diff --git a/src/Mod/TechDraw/App/DrawView.h b/src/Mod/TechDraw/App/DrawView.h index bbe901082..ed9e68188 100644 --- a/src/Mod/TechDraw/App/DrawView.h +++ b/src/Mod/TechDraw/App/DrawView.h @@ -34,7 +34,7 @@ class DrawPage; /** Base class of all View Features in the drawing module */ -class DrawingExport DrawView : public App::DocumentObject +class TechDrawExport DrawView : public App::DocumentObject { PROPERTY_HEADER(TechDraw::DrawView); @@ -58,7 +58,7 @@ public: virtual App::DocumentObjectExecReturn *execute(void); virtual void onDocumentRestored(); //@} - + bool isInClip(); /// returns the type name of the ViewProvider diff --git a/src/Mod/TechDraw/App/DrawViewAnnotation.cpp b/src/Mod/TechDraw/App/DrawViewAnnotation.cpp index 493b48949..b05030385 100644 --- a/src/Mod/TechDraw/App/DrawViewAnnotation.cpp +++ b/src/Mod/TechDraw/App/DrawViewAnnotation.cpp @@ -49,7 +49,7 @@ using namespace std; PROPERTY_SOURCE(TechDraw::DrawViewAnnotation, TechDraw::DrawView) -DrawViewAnnotation::DrawViewAnnotation(void) +DrawViewAnnotation::DrawViewAnnotation(void) { static const char *vgroup = "Annotation"; @@ -62,9 +62,11 @@ DrawViewAnnotation::DrawViewAnnotation(void) ADD_PROPERTY_TYPE(TextColor,(0.0f,0.0f,0.0f),vgroup,App::Prop_None,"The color of the text"); ADD_PROPERTY_TYPE(TextSize,(8),vgroup,App::Prop_None,"The size of the text in mm"); - - Scale.StatusBits.set(3); //hide scale. n/a for Annotation - ScaleType.StatusBits.set(3); + + //Scale.StatusBits.set(3); //hide scale. n/a for Annotation + //ScaleType.StatusBits.set(3); + Scale.setStatus(App::Property::Hidden,true); + ScaleType.setStatus(App::Property::Hidden,true); } DrawViewAnnotation::~DrawViewAnnotation() @@ -87,5 +89,5 @@ template<> const char* TechDraw::DrawViewAnnotationPython::getViewProviderName(v /// @endcond // explicit template instantiation -template class DrawingExport FeaturePythonT; +template class TechDrawExport FeaturePythonT; } diff --git a/src/Mod/TechDraw/App/DrawViewAnnotation.h b/src/Mod/TechDraw/App/DrawViewAnnotation.h index e24fde117..540cf5ef2 100644 --- a/src/Mod/TechDraw/App/DrawViewAnnotation.h +++ b/src/Mod/TechDraw/App/DrawViewAnnotation.h @@ -40,7 +40,7 @@ namespace TechDraw /** Base class of all View Features in the drawing module */ -class DrawingExport DrawViewAnnotation : public TechDraw::DrawView +class TechDrawExport DrawViewAnnotation : public TechDraw::DrawView { PROPERTY_HEADER(TechDraw::DrawViewAnnotation); diff --git a/src/Mod/TechDraw/App/DrawViewClip.cpp b/src/Mod/TechDraw/App/DrawViewClip.cpp index 53e05c72c..d152e6e0e 100644 --- a/src/Mod/TechDraw/App/DrawViewClip.cpp +++ b/src/Mod/TechDraw/App/DrawViewClip.cpp @@ -165,5 +165,5 @@ template<> const char* TechDraw::DrawViewClipPython::getViewProviderName(void) c /// @endcond // explicit template instantiation -template class DrawingExport FeaturePythonT; +template class TechDrawExport FeaturePythonT; } diff --git a/src/Mod/TechDraw/App/DrawViewClip.h b/src/Mod/TechDraw/App/DrawViewClip.h index 3c4b7f9d2..78511b40c 100644 --- a/src/Mod/TechDraw/App/DrawViewClip.h +++ b/src/Mod/TechDraw/App/DrawViewClip.h @@ -36,7 +36,7 @@ namespace TechDraw { -class DrawingExport DrawViewClip: public TechDraw::DrawView +class TechDrawExport DrawViewClip: public TechDraw::DrawView { PROPERTY_HEADER(TechDraw::DrawViewClip); diff --git a/src/Mod/TechDraw/App/DrawViewCollection.h b/src/Mod/TechDraw/App/DrawViewCollection.h index 2a6f79cdf..fec37cd4f 100644 --- a/src/Mod/TechDraw/App/DrawViewCollection.h +++ b/src/Mod/TechDraw/App/DrawViewCollection.h @@ -34,7 +34,7 @@ namespace TechDraw /** Base class for collection of view objects */ -class DrawingExport DrawViewCollection : public DrawView +class TechDrawExport DrawViewCollection : public DrawView { PROPERTY_HEADER(TechDraw::DrawViewCollection); diff --git a/src/Mod/TechDraw/App/DrawViewDimension.cpp b/src/Mod/TechDraw/App/DrawViewDimension.cpp index 9d66e7b87..14262f3d3 100644 --- a/src/Mod/TechDraw/App/DrawViewDimension.cpp +++ b/src/Mod/TechDraw/App/DrawViewDimension.cpp @@ -275,8 +275,8 @@ double DrawViewDimension::getDimValue() const if (Type.isValue("Distance") && getRefType() == oneEdge) { //TODO: Check for straight line Edge? int idx = DrawUtil::getIndexFromName(subElements[0]); - DrawingGeometry::BaseGeom* geom = getViewPart()->getProjEdgeByIndex(idx); - DrawingGeometry::Generic* gen = static_cast(geom); + TechDrawGeometry::BaseGeom* geom = getViewPart()->getProjEdgeByIndex(idx); + TechDrawGeometry::Generic* gen = static_cast(geom); Base::Vector2D start = gen->points[0]; Base::Vector2D end = gen->points[1]; Base::Vector2D line = end - start; @@ -285,10 +285,10 @@ double DrawViewDimension::getDimValue() const //only works for straight line edges int idx0 = DrawUtil::getIndexFromName(subElements[0]); int idx1 = DrawUtil::getIndexFromName(subElements[1]); - DrawingGeometry::BaseGeom* geom0 = getViewPart()->getProjEdgeByIndex(idx0); - DrawingGeometry::BaseGeom* geom1 = getViewPart()->getProjEdgeByIndex(idx1); - DrawingGeometry::Generic* gen0 = static_cast(geom0); - DrawingGeometry::Generic* gen1 = static_cast(geom1); + TechDrawGeometry::BaseGeom* geom0 = getViewPart()->getProjEdgeByIndex(idx0); + TechDrawGeometry::BaseGeom* geom1 = getViewPart()->getProjEdgeByIndex(idx1); + TechDrawGeometry::Generic* gen0 = static_cast(geom0); + TechDrawGeometry::Generic* gen1 = static_cast(geom1); Base::Vector2D s0 = gen0->points[0]; Base::Vector2D e0 = gen0->points[1]; Base::Vector2D s1 = gen1->points[0]; @@ -297,24 +297,24 @@ double DrawViewDimension::getDimValue() const } else if (Type.isValue("Distance") && getRefType() == twoVertex) { int idx0 = DrawUtil::getIndexFromName(subElements[0]); int idx1 = DrawUtil::getIndexFromName(subElements[1]); - DrawingGeometry::Vertex* v0 = getViewPart()->getProjVertexByIndex(idx0); - DrawingGeometry::Vertex* v1 = getViewPart()->getProjVertexByIndex(idx1); + TechDrawGeometry::Vertex* v0 = getViewPart()->getProjVertexByIndex(idx0); + TechDrawGeometry::Vertex* v1 = getViewPart()->getProjVertexByIndex(idx1); Base::Vector2D start = v0->pnt; Base::Vector2D end = v1->pnt; Base::Vector2D line = end - start; result = line.Length() / getViewPart()->Scale.getValue(); } else if (Type.isValue("DistanceX") && getRefType() == oneEdge) { int idx = DrawUtil::getIndexFromName(subElements[0]); - DrawingGeometry::BaseGeom* geom = getViewPart()->getProjEdgeByIndex(idx); - DrawingGeometry::Generic* gen = static_cast(geom); + TechDrawGeometry::BaseGeom* geom = getViewPart()->getProjEdgeByIndex(idx); + TechDrawGeometry::Generic* gen = static_cast(geom); Base::Vector2D start = gen->points[0]; Base::Vector2D end = gen->points[1]; Base::Vector2D line = end - start; return fabs(line.fX) / getViewPart()->Scale.getValue(); } else if (Type.isValue("DistanceY") && getRefType() == oneEdge) { int idx = DrawUtil::getIndexFromName(subElements[0]); - DrawingGeometry::BaseGeom* geom = getViewPart()->getProjEdgeByIndex(idx); - DrawingGeometry::Generic* gen = static_cast(geom); + TechDrawGeometry::BaseGeom* geom = getViewPart()->getProjEdgeByIndex(idx); + TechDrawGeometry::Generic* gen = static_cast(geom); Base::Vector2D start = gen->points[0]; Base::Vector2D end = gen->points[1]; Base::Vector2D line = end - start; @@ -322,8 +322,8 @@ double DrawViewDimension::getDimValue() const } else if (Type.isValue("DistanceX") && getRefType() == twoVertex) { int idx0 = DrawUtil::getIndexFromName(subElements[0]); int idx1 = DrawUtil::getIndexFromName(subElements[1]); - DrawingGeometry::Vertex* v0 = getViewPart()->getProjVertexByIndex(idx0); - DrawingGeometry::Vertex* v1 = getViewPart()->getProjVertexByIndex(idx1); + TechDrawGeometry::Vertex* v0 = getViewPart()->getProjVertexByIndex(idx0); + TechDrawGeometry::Vertex* v1 = getViewPart()->getProjVertexByIndex(idx1); Base::Vector2D start = v0->pnt; Base::Vector2D end = v1->pnt; Base::Vector2D line = end - start; @@ -331,8 +331,8 @@ double DrawViewDimension::getDimValue() const } else if (Type.isValue("DistanceY") && getRefType() == twoVertex) { int idx0 = DrawUtil::getIndexFromName(subElements[0]); int idx1 = DrawUtil::getIndexFromName(subElements[1]); - DrawingGeometry::Vertex* v0 = getViewPart()->getProjVertexByIndex(idx0); - DrawingGeometry::Vertex* v1 = getViewPart()->getProjVertexByIndex(idx1); + TechDrawGeometry::Vertex* v0 = getViewPart()->getProjVertexByIndex(idx0); + TechDrawGeometry::Vertex* v1 = getViewPart()->getProjVertexByIndex(idx1); Base::Vector2D start = v0->pnt; Base::Vector2D end = v1->pnt; Base::Vector2D line = end - start; @@ -340,14 +340,14 @@ double DrawViewDimension::getDimValue() const } else if(Type.isValue("Radius")){ //only 1 reference for a Radius int idx = DrawUtil::getIndexFromName(subElements[0]); - DrawingGeometry::BaseGeom* base = getViewPart()->getProjEdgeByIndex(idx); - DrawingGeometry::Circle* circle = static_cast (base); + TechDrawGeometry::BaseGeom* base = getViewPart()->getProjEdgeByIndex(idx); + TechDrawGeometry::Circle* circle = static_cast (base); result = circle->radius / getViewPart()->Scale.getValue(); //Projected BaseGeom is scaled for drawing } else if(Type.isValue("Diameter")){ //only 1 reference for a Diameter int idx = DrawUtil::getIndexFromName(subElements[0]); - DrawingGeometry::BaseGeom* base = getViewPart()->getProjEdgeByIndex(idx); - DrawingGeometry::Circle* circle = static_cast (base); + TechDrawGeometry::BaseGeom* base = getViewPart()->getProjEdgeByIndex(idx); + TechDrawGeometry::Circle* circle = static_cast (base); result = (circle->radius * 2.0) / getViewPart()->Scale.getValue(); //Projected BaseGeom is scaled for drawing } else if(Type.isValue("Angle")){ // Must project lines to 2D so cannot use measurement framework this time @@ -363,14 +363,14 @@ double DrawViewDimension::getDimValue() const int idx0 = DrawUtil::getIndexFromName(subElements[0]); int idx1 = DrawUtil::getIndexFromName(subElements[1]); TechDraw::DrawViewPart *viewPart = dynamic_cast(objects[0]); - DrawingGeometry::BaseGeom* edge0 = viewPart->getProjEdgeByIndex(idx0); - DrawingGeometry::BaseGeom* edge1 = viewPart->getProjEdgeByIndex(idx1); + TechDrawGeometry::BaseGeom* edge0 = viewPart->getProjEdgeByIndex(idx0); + TechDrawGeometry::BaseGeom* edge1 = viewPart->getProjEdgeByIndex(idx1); // Only can find angles with straight line edges - if(edge0->geomType == DrawingGeometry::GENERIC && - edge1->geomType == DrawingGeometry::GENERIC) { - DrawingGeometry::Generic *gen1 = static_cast(edge0); - DrawingGeometry::Generic *gen2 = static_cast(edge1); + if(edge0->geomType == TechDrawGeometry::GENERIC && + edge1->geomType == TechDrawGeometry::GENERIC) { + TechDrawGeometry::Generic *gen1 = static_cast(edge0); + TechDrawGeometry::Generic *gen2 = static_cast(edge1); Base::Vector3d p1S(gen1->points.at(0).fX, gen1->points.at(0).fY, 0.); Base::Vector3d p1E(gen1->points.at(1).fX, gen1->points.at(1).fY, 0.); diff --git a/src/Mod/TechDraw/App/DrawViewDimension.h b/src/Mod/TechDraw/App/DrawViewDimension.h index 3ba604805..0eb36c8c0 100644 --- a/src/Mod/TechDraw/App/DrawViewDimension.h +++ b/src/Mod/TechDraw/App/DrawViewDimension.h @@ -36,7 +36,7 @@ class Measurement; namespace TechDraw { -class DrawingExport DrawViewDimension : public TechDraw::DrawView +class TechDrawExport DrawViewDimension : public TechDraw::DrawView { PROPERTY_HEADER(TechDraw::DrawViewDimension); diff --git a/src/Mod/TechDraw/App/DrawViewPart.cpp b/src/Mod/TechDraw/App/DrawViewPart.cpp index 81c7385ef..7993d27df 100644 --- a/src/Mod/TechDraw/App/DrawViewPart.cpp +++ b/src/Mod/TechDraw/App/DrawViewPart.cpp @@ -62,7 +62,7 @@ #include "Geometry.h" #include "DrawViewPart.h" -#include "ProjectionAlgos.h" +//#include "ProjectionAlgos.h" #include "DrawHatch.h" //#include "DrawViewDimension.h" @@ -96,7 +96,7 @@ DrawViewPart::DrawViewPart(void) : geometryObject(0) ADD_PROPERTY_TYPE(XAxisDirection ,(1,0,0) ,group,App::Prop_None,"X-Axis direction"); //ADD_PROPERTY_TYPE(HatchAreas ,(0),vgroup,App::Prop_None,"Hatched areas of this view"); - geometryObject = new DrawingGeometry::GeometryObject(); + geometryObject = new TechDrawGeometry::GeometryObject(); } DrawViewPart::~DrawViewPart() @@ -233,7 +233,7 @@ std::vector DrawViewPart::getHatches() const return result; } -const std::vector & DrawViewPart::getVertexGeometry() const +const std::vector & DrawViewPart::getVertexGeometry() const { return geometryObject->getVertexGeometry(); } @@ -243,7 +243,7 @@ const std::vector & DrawViewPart::getVertexReferences() const return geometryObject->getVertexRefs(); } -const std::vector & DrawViewPart::getFaceGeometry() const +const std::vector & DrawViewPart::getFaceGeometry() const { return geometryObject->getFaceGeometry(); } @@ -253,7 +253,7 @@ const std::vector & DrawViewPart::getFaceReferences() const return geometryObject->getFaceRefs(); } -const std::vector & DrawViewPart::getEdgeGeometry() const +const std::vector & DrawViewPart::getEdgeGeometry() const { return geometryObject->getEdgeGeometry(); } @@ -264,7 +264,7 @@ const std::vector & DrawViewPart::getEdgeReferences() const } //! project Source Edge(idx) to 2D BaseGeom -DrawingGeometry::BaseGeom *DrawViewPart::getCompleteEdge(int idx) const +TechDrawGeometry::BaseGeom *DrawViewPart::getCompleteEdge(int idx) const { //NOTE: idx is in fact a Reference to an Edge in Source //returns projection of ref'd Edge as BaseGeom. Why not just use existing BaseGeom(idx)? @@ -282,7 +282,7 @@ DrawingGeometry::BaseGeom *DrawViewPart::getCompleteEdge(int idx) const const TopoDS_Shape &support = static_cast(link)->Shape.getValue(); //TODO: make sure prjShape gets deleted - DrawingGeometry::BaseGeom* prjShape = 0; + TechDrawGeometry::BaseGeom* prjShape = 0; try { prjShape = geometryObject->projectEdge(shape, support, Direction.getValue(), _getValidXDir(this)); } @@ -303,7 +303,7 @@ DrawingGeometry::BaseGeom *DrawViewPart::getCompleteEdge(int idx) const } //! project Source Vertex(idx) to 2D geometry -DrawingGeometry::Vertex * DrawViewPart::getVertex(int idx) const +TechDrawGeometry::Vertex * DrawViewPart::getVertex(int idx) const { //## Get the Part Link ##/ App::DocumentObject* link = Source.getValue(); @@ -318,20 +318,20 @@ DrawingGeometry::Vertex * DrawViewPart::getVertex(int idx) const const TopoDS_Shape &support = static_cast(link)->Shape.getValue(); //TODO: Make sure prjShape gets deleted - DrawingGeometry::Vertex *prjShape = geometryObject->projectVertex(shape, support, Direction.getValue(), _getValidXDir(this)); + TechDrawGeometry::Vertex *prjShape = geometryObject->projectVertex(shape, support, Direction.getValue(), _getValidXDir(this)); //Base::Console().Log("vert %f, %f \n", prjShape->pnt.fX, prjShape->pnt.fY); return prjShape; } -DrawingGeometry::Vertex* DrawViewPart::getVertexGeomByRef(int ref) const +TechDrawGeometry::Vertex* DrawViewPart::getVertexGeomByRef(int ref) const { - const std::vector &verts = getVertexGeometry(); + const std::vector &verts = getVertexGeometry(); if (verts.empty()) { Base::Console().Log("INFO - getVertexGeomByRef(%d) - no Vertex Geometry. Probably restoring?\n",ref); return NULL; } const std::vector &vertRefs = getVertexReferences(); - std::vector::const_iterator vert = verts.begin(); + std::vector::const_iterator vert = verts.begin(); bool found = false; for(int i = 0 ; vert != verts.end(); ++vert, i++) { if (vertRefs[i] == ref) { @@ -349,15 +349,15 @@ DrawingGeometry::Vertex* DrawViewPart::getVertexGeomByRef(int ref) const } //! returns existing BaseGeom of Edge with 3D Reference = ref -DrawingGeometry::BaseGeom* DrawViewPart::getEdgeGeomByRef(int ref) const +TechDrawGeometry::BaseGeom* DrawViewPart::getEdgeGeomByRef(int ref) const { - const std::vector &geoms = getEdgeGeometry(); + const std::vector &geoms = getEdgeGeometry(); if (geoms.empty()) { Base::Console().Log("INFO - getEdgeGeomByRef(%d) - no Edge Geometry. Probably restoring?\n",ref); return NULL; } const std::vector &refs = getEdgeReferences(); - std::vector::const_iterator it = geoms.begin(); + std::vector::const_iterator it = geoms.begin(); bool found = false; for(int i = 0 ; it != geoms.end(); ++it, i++) { if (refs[i] == ref) { @@ -375,9 +375,9 @@ DrawingGeometry::BaseGeom* DrawViewPart::getEdgeGeomByRef(int ref) const } //! returns existing BaseGeom of 2D Edge(idx) -DrawingGeometry::BaseGeom* DrawViewPart::getProjEdgeByIndex(int idx) const +TechDrawGeometry::BaseGeom* DrawViewPart::getProjEdgeByIndex(int idx) const { - const std::vector &geoms = getEdgeGeometry(); + const std::vector &geoms = getEdgeGeometry(); if (geoms.empty()) { Base::Console().Log("INFO - getProjEdgeByIndex(%d) - no Edge Geometry. Probably restoring?\n",idx); return NULL; @@ -386,9 +386,9 @@ DrawingGeometry::BaseGeom* DrawViewPart::getProjEdgeByIndex(int idx) const } //! returns existing geometry of 2D Vertex(idx) -DrawingGeometry::Vertex* DrawViewPart::getProjVertexByIndex(int idx) const +TechDrawGeometry::Vertex* DrawViewPart::getProjVertexByIndex(int idx) const { - const std::vector &geoms = getVertexGeometry(); + const std::vector &geoms = getVertexGeometry(); if (geoms.empty()) { Base::Console().Log("INFO - getProjVertexByIndex(%d) - no Vertex Geometry. Probably restoring?\n",idx); return NULL; @@ -424,8 +424,8 @@ Base::BoundBox3d DrawViewPart::getBoundingBox() const bool DrawViewPart::hasGeometry(void) const { bool result = false; - const std::vector &verts = getVertexGeometry(); - const std::vector &edges = getEdgeGeometry(); + const std::vector &verts = getVertexGeometry(); + const std::vector &edges = getEdgeGeometry(); if (verts.empty() && edges.empty() ) { result = false; @@ -467,5 +467,5 @@ template<> const char* TechDraw::DrawViewPartPython::getViewProviderName(void) c /// @endcond // explicit template instantiation -template class DrawingExport FeaturePythonT; +template class TechDrawExport FeaturePythonT; } diff --git a/src/Mod/TechDraw/App/DrawViewPart.h b/src/Mod/TechDraw/App/DrawViewPart.h index 6c5ed2218..f33ee7496 100644 --- a/src/Mod/TechDraw/App/DrawViewPart.h +++ b/src/Mod/TechDraw/App/DrawViewPart.h @@ -41,7 +41,7 @@ namespace TechDraw /** Base class of all View Features in the drawing module */ -class DrawingExport DrawViewPart : public DrawView +class TechDrawExport DrawViewPart : public DrawView { PROPERTY_HEADER(TechDraw::DrawViewPart); @@ -64,21 +64,21 @@ public: //int removeHatch(App::DocumentObject *docObj); std::vector getHatches(void) const; - const std::vector & getVertexGeometry() const; - const std::vector & getEdgeGeometry() const; - const std::vector & getFaceGeometry() const; + const std::vector & getVertexGeometry() const; + const std::vector & getEdgeGeometry() const; + const std::vector & getFaceGeometry() const; bool hasGeometry(void) const; - DrawingGeometry::BaseGeom* getProjEdgeByIndex(int idx) const; //get existing geom for edge idx in projection - DrawingGeometry::Vertex* getProjVertexByIndex(int idx) const; //get existing geom for vertex idx in projection + TechDrawGeometry::BaseGeom* getProjEdgeByIndex(int idx) const; //get existing geom for edge idx in projection + TechDrawGeometry::Vertex* getProjVertexByIndex(int idx) const; //get existing geom for vertex idx in projection int getEdgeRefByIndex(int idx) const; //get reference to Source edge for Projected edge idx int getVertexRefByIndex(int idx) const; //get reference to Source Vertex for Projected Vertex idx - DrawingGeometry::BaseGeom * getCompleteEdge(int idx) const; //project source edge idx - DrawingGeometry::Vertex * getVertex(int idx) const; //project source vertex - DrawingGeometry::Vertex* getVertexGeomByRef(int ref) const; - DrawingGeometry::BaseGeom* getEdgeGeomByRef(int ref) const; + TechDrawGeometry::BaseGeom * getCompleteEdge(int idx) const; //project source edge idx + TechDrawGeometry::Vertex * getVertex(int idx) const; //project source vertex + TechDrawGeometry::Vertex* getVertexGeomByRef(int ref) const; + TechDrawGeometry::BaseGeom* getEdgeGeomByRef(int ref) const; /// Get References for geometric features const std::vector & getVertexReferences() const; @@ -105,7 +105,7 @@ public: protected: void onChanged(const App::Property* prop); - DrawingGeometry::GeometryObject *geometryObject; + TechDrawGeometry::GeometryObject *geometryObject; Base::BoundBox3d bbox; private: diff --git a/src/Mod/TechDraw/App/DrawViewPartPy.xml b/src/Mod/TechDraw/App/DrawViewPartPy.xml index 44f135e67..f1717ba28 100644 --- a/src/Mod/TechDraw/App/DrawViewPartPy.xml +++ b/src/Mod/TechDraw/App/DrawViewPartPy.xml @@ -5,10 +5,10 @@ Name="DrawViewPartPy" Twin="DrawViewPart" TwinPointer="DrawViewPart" - Include="Mod/Drawing/App/DrawViewPart.h" - Namespace="Drawing" - FatherInclude="Mod/Drawing/App/DrawViewPy.h" - FatherNamespace="Drawing"> + Include="Mod/TechDraw/App/DrawViewPart.h" + Namespace="TechDraw" + FatherInclude="Mod/TechDraw/App/DrawViewPy.h" + FatherNamespace="TechDraw"> Feature for creating and manipulating Drawing Part Views diff --git a/src/Mod/TechDraw/App/DrawViewPy.xml b/src/Mod/TechDraw/App/DrawViewPy.xml index b201fcaeb..224650122 100644 --- a/src/Mod/TechDraw/App/DrawViewPy.xml +++ b/src/Mod/TechDraw/App/DrawViewPy.xml @@ -5,8 +5,8 @@ Name="DrawViewPy" Twin="DrawView" TwinPointer="DrawView" - Include="Mod/Drawing/App/DrawView.h" - Namespace="Drawing" + Include="Mod/TechDraw/App/DrawView.h" + Namespace="TechDraw" FatherInclude="App/DocumentObjectPy.h" FatherNamespace="App"> diff --git a/src/Mod/TechDraw/App/DrawViewSection.cpp b/src/Mod/TechDraw/App/DrawViewSection.cpp index ad74fadd3..3a4f9fe10 100644 --- a/src/Mod/TechDraw/App/DrawViewSection.cpp +++ b/src/Mod/TechDraw/App/DrawViewSection.cpp @@ -74,7 +74,7 @@ #include #include "DrawViewSection.h" -#include "ProjectionAlgos.h" +//#include "ProjectionAlgos.h" using namespace TechDraw; using namespace std; @@ -93,7 +93,7 @@ DrawViewSection::DrawViewSection() ADD_PROPERTY_TYPE(SectionOrigin ,(0,0,0) ,group,App::Prop_None,"Section Plane Origin"); ADD_PROPERTY_TYPE(ShowCutSurface ,(true),group,App::Prop_None,"Show the cut surface"); - geometryObject = new DrawingGeometry::GeometryObject(); + geometryObject = new TechDrawGeometry::GeometryObject(); } DrawViewSection::~DrawViewSection() @@ -236,7 +236,7 @@ gp_Pln DrawViewSection::getSectionPlane() const //! tries to find the intersection of the section plane with the part??? //face logic is turned off in GeometryObject, so this won't work now. -void DrawViewSection::getSectionSurface(std::vector §ionFace) const { +void DrawViewSection::getSectionSurface(std::vector §ionFace) const { #if MOD_TECHDRAW_HANDLE_FACES if(result.IsNull()){ @@ -278,5 +278,5 @@ template<> const char* TechDraw::DrawViewSectionPython::getViewProviderName(void /// @endcond // explicit template instantiation -template class DrawingExport FeaturePythonT; +template class TechDrawExport FeaturePythonT; } diff --git a/src/Mod/TechDraw/App/DrawViewSection.h b/src/Mod/TechDraw/App/DrawViewSection.h index 9ba979c8b..099d0936c 100644 --- a/src/Mod/TechDraw/App/DrawViewSection.h +++ b/src/Mod/TechDraw/App/DrawViewSection.h @@ -37,7 +37,7 @@ namespace TechDraw /** Base class of all View Features in the drawing module */ -class DrawingExport DrawViewSection : public DrawViewPart +class TechDrawExport DrawViewSection : public DrawViewPart { PROPERTY_HEADER(Part::DrawViewSection); @@ -65,7 +65,7 @@ public: } public: - void getSectionSurface(std::vector §ionFace) const; + void getSectionSurface(std::vector §ionFace) const; protected: TopoDS_Shape result; diff --git a/src/Mod/TechDraw/App/DrawViewSymbol.cpp b/src/Mod/TechDraw/App/DrawViewSymbol.cpp index 4aac10e41..12177784a 100644 --- a/src/Mod/TechDraw/App/DrawViewSymbol.cpp +++ b/src/Mod/TechDraw/App/DrawViewSymbol.cpp @@ -142,5 +142,5 @@ template<> const char* TechDraw::DrawViewSymbolPython::getViewProviderName(void) /// @endcond // explicit template instantiation -template class DrawingExport FeaturePythonT; +template class TechDrawExport FeaturePythonT; } diff --git a/src/Mod/TechDraw/App/DrawViewSymbol.h b/src/Mod/TechDraw/App/DrawViewSymbol.h index a7ce490f6..de9f164ce 100644 --- a/src/Mod/TechDraw/App/DrawViewSymbol.h +++ b/src/Mod/TechDraw/App/DrawViewSymbol.h @@ -34,7 +34,7 @@ namespace TechDraw { -class DrawingExport DrawViewSymbol : public TechDraw::DrawView +class TechDrawExport DrawViewSymbol : public TechDraw::DrawView { PROPERTY_HEADER(TechDraw::DrawViewSymbol); diff --git a/src/Mod/TechDraw/App/DrawViewSymbolPy.xml b/src/Mod/TechDraw/App/DrawViewSymbolPy.xml index 1f26bb4ab..794e7271e 100644 --- a/src/Mod/TechDraw/App/DrawViewSymbolPy.xml +++ b/src/Mod/TechDraw/App/DrawViewSymbolPy.xml @@ -5,10 +5,10 @@ Name="DrawViewSymbolPy" Twin="DrawViewSymbol" TwinPointer="DrawViewSymbol" - Include="Mod/Drawing/App/DrawViewSymbol.h" - Namespace="Drawing" - FatherInclude="Mod/Drawing/App/DrawViewPy.h" - FatherNamespace="Drawing"> + Include="Mod/TechDraw/App/DrawViewSymbol.h" + Namespace="TechDraw" + FatherInclude="Mod/TechDraw/App/DrawViewPy.h" + FatherNamespace="TechDraw"> Feature for creating and manipulating Drawing SVG Symbol Views diff --git a/src/Mod/TechDraw/App/Geometry.cpp b/src/Mod/TechDraw/App/Geometry.cpp index c9f977315..fb5f6907c 100644 --- a/src/Mod/TechDraw/App/Geometry.cpp +++ b/src/Mod/TechDraw/App/Geometry.cpp @@ -118,35 +118,35 @@ std::vector BaseGeom::findEndPoints() { std::vector result; switch(this->geomType) { - case DrawingGeometry::CIRCLE: { - DrawingGeometry::Circle *geom = static_cast(this); + case TechDrawGeometry::CIRCLE: { + TechDrawGeometry::Circle *geom = static_cast(this); double x = geom->center.fX + geom->radius; result.push_back(Base::Vector2D(x,geom->center.fY)); result.push_back(Base::Vector2D(x,geom->center.fY)); } break; - case DrawingGeometry::ARCOFCIRCLE: { - DrawingGeometry::AOC *geom = static_cast(this); + case TechDrawGeometry::ARCOFCIRCLE: { + TechDrawGeometry::AOC *geom = static_cast(this); result.push_back(geom->startPnt); result.push_back(geom->endPnt); } break; - case DrawingGeometry::ELLIPSE: { - DrawingGeometry::Ellipse *geom = static_cast(this); + case TechDrawGeometry::ELLIPSE: { + TechDrawGeometry::Ellipse *geom = static_cast(this); result.push_back(geom->center + Base::Vector2D(geom->major * cos(geom->angle), geom->major * sin(geom->angle))); result.push_back(geom->center + Base::Vector2D(geom->major * cos(geom->angle), geom->major * sin(geom->angle))); } break; - case DrawingGeometry::ARCOFELLIPSE: { - DrawingGeometry::AOE *geom = static_cast(this); + case TechDrawGeometry::ARCOFELLIPSE: { + TechDrawGeometry::AOE *geom = static_cast(this); result.push_back(geom->startPnt); result.push_back(geom->endPnt); } break; - case DrawingGeometry::BSPLINE: { - DrawingGeometry::BSpline *geom = static_cast(this); + case TechDrawGeometry::BSPLINE: { + TechDrawGeometry::BSpline *geom = static_cast(this); result.push_back(geom->segments.front().pnts[0]); - DrawingGeometry::BezierSegment tempSeg = geom->segments.back(); + TechDrawGeometry::BezierSegment tempSeg = geom->segments.back(); result.push_back(tempSeg.pnts[tempSeg.poles - 1]); } break; - case DrawingGeometry::GENERIC: { - DrawingGeometry::Generic *geom = static_cast(this); + case TechDrawGeometry::GENERIC: { + TechDrawGeometry::Generic *geom = static_cast(this); result.push_back(geom->points.front()); result.push_back(geom->points.back()); } break; @@ -380,13 +380,13 @@ bool BSpline::isLine() return result; } -//**** DrawingGeometry utility funtions +//**** TechDrawGeometry utility funtions extern "C" { //! return a vector of BaseGeom*'s in tail to nose order -std::vector DrawingExport chainGeoms(std::vector geoms) +std::vector TechDrawExport chainGeoms(std::vector geoms) { - std::vector result; + std::vector result; std::vector used(geoms.size(),false); double tolerance = 0.0; @@ -403,7 +403,7 @@ std::vector DrawingExport chainGeoms(std::vectorreversed = next.reversed; result.push_back(nextEdge); @@ -422,13 +422,13 @@ std::vector DrawingExport chainGeoms(std::vector geoms, +getNextReturn TechDrawExport nextGeom(Base::Vector2D atPoint, + std::vector geoms, std::vector used, double tolerance) { getNextReturn result(0,false); - std::vector::iterator itGeom = geoms.begin(); + std::vector::iterator itGeom = geoms.begin(); for (; itGeom != geoms.end(); itGeom++) { unsigned int index = itGeom - geoms.begin(); if (used[index]) { diff --git a/src/Mod/TechDraw/App/Geometry.h b/src/Mod/TechDraw/App/Geometry.h index 0329a38a0..db1424125 100644 --- a/src/Mod/TechDraw/App/Geometry.h +++ b/src/Mod/TechDraw/App/Geometry.h @@ -44,7 +44,7 @@ enum GeomType { GENERIC }; -class DrawingExport BaseGeom +class TechDrawExport BaseGeom { public: BaseGeom(); @@ -58,7 +58,7 @@ public: Base::Vector2D getEndPoint(); }; -class DrawingExport Circle: public BaseGeom +class TechDrawExport Circle: public BaseGeom { public: Circle(const BRepAdaptor_Curve &c); @@ -69,7 +69,7 @@ public: double radius; }; -class DrawingExport Ellipse: public BaseGeom +class TechDrawExport Ellipse: public BaseGeom { public: Ellipse(const BRepAdaptor_Curve &c); @@ -83,7 +83,7 @@ public: double angle; }; -class DrawingExport AOE: public Ellipse +class TechDrawExport AOE: public Ellipse { public: AOE(const BRepAdaptor_Curve &c); @@ -102,7 +102,7 @@ public: bool largeArc; }; -class DrawingExport AOC: public Circle +class TechDrawExport AOC: public Circle { public: AOC(const BRepAdaptor_Curve &c); @@ -139,7 +139,7 @@ struct BezierSegment Base::Vector2D pnts[4]; }; -class DrawingExport BSpline: public BaseGeom +class TechDrawExport BSpline: public BaseGeom { public: BSpline(const BRepAdaptor_Curve &c); @@ -162,7 +162,7 @@ public: }; /// Simple Collection of geometric features based on BaseGeom inherited classes in order -struct DrawingExport Wire +struct TechDrawExport Wire { Wire(); ~Wire(); @@ -170,7 +170,7 @@ struct DrawingExport Wire }; /// Simple Collection of geometric features based on BaseGeom inherited classes in order -struct DrawingExport Face +struct TechDrawExport Face { Face(); ~Face(); @@ -178,7 +178,7 @@ struct DrawingExport Face }; /// Simple vertex -struct DrawingExport Vertex +struct TechDrawExport Vertex { Vertex(double x, double y) { pnt = Base::Vector2D(x, y); } Vertex(Base::Vector2D v) { pnt = v; } @@ -190,7 +190,7 @@ struct DrawingExport Vertex //*** utility functions extern "C" { -struct DrawingExport getNextReturn { +struct TechDrawExport getNextReturn { unsigned int index; bool reversed; explicit getNextReturn(int i = 0, bool r = false) : @@ -199,9 +199,9 @@ struct DrawingExport getNextReturn { {} }; -std::vector chainGeoms(std::vector geoms); +std::vector chainGeoms(std::vector geoms); getNextReturn nextGeom(Base::Vector2D atPoint, - std::vector geoms, + std::vector geoms, std::vector used, double tolerance); diff --git a/src/Mod/TechDraw/App/GeometryObject.cpp b/src/Mod/TechDraw/App/GeometryObject.cpp index e210af3e9..52ad005d8 100644 --- a/src/Mod/TechDraw/App/GeometryObject.cpp +++ b/src/Mod/TechDraw/App/GeometryObject.cpp @@ -211,7 +211,7 @@ void GeometryObject::drawEdge(HLRBRep_EdgeData& ed, TopoDS_Shape& Result, const } //! only ever called from FVP::getVertex -DrawingGeometry::Vertex * GeometryObject::projectVertex(const TopoDS_Shape &vert, +TechDrawGeometry::Vertex * GeometryObject::projectVertex(const TopoDS_Shape &vert, const TopoDS_Shape &support, const Base::Vector3d &direction, const Base::Vector3d &projXAxis) const @@ -242,7 +242,7 @@ DrawingGeometry::Vertex * GeometryObject::projectVertex(const TopoDS_Shape &vert // If the index was found and is unique, the point is projected using the HLR Projector Algorithm gp_Pnt2d prjPnt; projector.Project(BRep_Tool::Pnt(refVert), prjPnt); - DrawingGeometry::Vertex *myVert = new Vertex(prjPnt.X(), prjPnt.Y()); + TechDrawGeometry::Vertex *myVert = new Vertex(prjPnt.X(), prjPnt.Y()); return myVert; } @@ -251,7 +251,7 @@ void GeometryObject::projectSurfaces(const TopoDS_Shape &face, const TopoDS_Shape &support, const Base::Vector3d &direction, const Base::Vector3d &xaxis, - std::vector &projFaces) const + std::vector &projFaces) const { if(face.IsNull()) throw Base::Exception("Projected shape is null"); @@ -580,7 +580,7 @@ Base::BoundBox3d GeometryObject::calcBoundingBox() const } //! only ever called from fvp::getCompleteEdge -DrawingGeometry::BaseGeom * GeometryObject::projectEdge(const TopoDS_Shape &edge, +TechDrawGeometry::BaseGeom * GeometryObject::projectEdge(const TopoDS_Shape &edge, const TopoDS_Shape &support, const Base::Vector3d &direction, const Base::Vector3d &projXAxis) const @@ -619,7 +619,7 @@ DrawingGeometry::BaseGeom * GeometryObject::projectEdge(const TopoDS_Shape &edge projector.Project(p1, pnt1); projector.Project(p2, pnt2); - DrawingGeometry::Generic *line = new DrawingGeometry::Generic(); + TechDrawGeometry::Generic *line = new TechDrawGeometry::Generic(); line->points.push_back(Base::Vector2D(pnt1.X(), pnt1.Y())); line->points.push_back(Base::Vector2D(pnt2.X(), pnt2.Y())); @@ -633,11 +633,11 @@ DrawingGeometry::BaseGeom * GeometryObject::projectEdge(const TopoDS_Shape &edge curve.Projector(&projector); - DrawingGeometry::BaseGeom *result = 0; + TechDrawGeometry::BaseGeom *result = 0; switch(HLRBRep_BCurveTool::GetType(curve.Curve())) { case GeomAbs_Line: { - DrawingGeometry::Generic *line = new DrawingGeometry::Generic(); + TechDrawGeometry::Generic *line = new TechDrawGeometry::Generic(); gp_Pnt2d pnt1 = curve.Value(curve.FirstParameter()); gp_Pnt2d pnt2 = curve.Value(curve.LastParameter()); @@ -648,7 +648,7 @@ DrawingGeometry::BaseGeom * GeometryObject::projectEdge(const TopoDS_Shape &edge result = line; }break; case GeomAbs_Circle: { - DrawingGeometry::Circle *circle = new DrawingGeometry::Circle(); + TechDrawGeometry::Circle *circle = new TechDrawGeometry::Circle(); gp_Circ2d prjCirc = curve.Circle(); double f = curve.FirstParameter(); @@ -726,7 +726,7 @@ void GeometryObject::extractFaces(HLRBRep_Algo *myAlgo, const TopoDS_Shape &S, bool visible, ExtractionType extractionType, - std::vector &projFaces, + std::vector &projFaces, std::vector &faceRefs) const { #if MOD_TECHDRAW_HANDLE_FACES @@ -783,7 +783,7 @@ void GeometryObject::extractFaces(HLRBRep_Algo *myAlgo, std::vector possibleFaceWires; createWire(face, possibleFaceWires); - DrawingGeometry::Face *myFace = NULL; + TechDrawGeometry::Face *myFace = NULL; // Process each wire - if we can make at least one face with it, then // send it down the road toward rendering @@ -794,9 +794,9 @@ void GeometryObject::extractFaces(HLRBRep_Algo *myAlgo, BRepBuilderAPI_MakeFace testFace(*wireIt); if (testFace.IsDone()) { if (myFace == NULL) { - myFace = new DrawingGeometry::Face(); + myFace = new TechDrawGeometry::Face(); } - DrawingGeometry::Wire *genWire = new DrawingGeometry::Wire(); + TechDrawGeometry::Wire *genWire = new TechDrawGeometry::Wire(); // See createWire regarding BRepTools_WireExplorer vs TopExp_Explorer BRepTools_WireExplorer explr(*wireIt); @@ -1317,20 +1317,20 @@ void GeometryObject::extractGeometry(const TopoDS_Shape &input, const std::vector &edgeGeom = getEdgeGeometry(); std::vector::const_iterator iEdge = edgeGeom.begin(); for (; iEdge != edgeGeom.end(); iEdge++) { - if ((*iEdge)->extractType == DrawingGeometry::WithHidden) { //only use visible edges + if ((*iEdge)->extractType == TechDrawGeometry::WithHidden) { //only use visible edges continue; } std::vector ends = (*iEdge)->findEndPoints(); if (!ends.empty()) { if (!findVertex(ends[0])) { Vertex* v0 = new Vertex(ends[0]); - v0->extractType = DrawingGeometry::Plain; + v0->extractType = TechDrawGeometry::Plain; vertexGeom.push_back(v0); vertexReferences.push_back(-1); } if (!findVertex(ends[1])) { Vertex* v1 = new Vertex(ends[1]); - v1->extractType = DrawingGeometry::Plain; + v1->extractType = TechDrawGeometry::Plain; vertexGeom.push_back(v1); vertexReferences.push_back(-1); } diff --git a/src/Mod/TechDraw/App/GeometryObject.h b/src/Mod/TechDraw/App/GeometryObject.h index 26b974dc9..c56b5a0f3 100644 --- a/src/Mod/TechDraw/App/GeometryObject.h +++ b/src/Mod/TechDraw/App/GeometryObject.h @@ -43,7 +43,7 @@ namespace TechDrawGeometry class BaseGeom; /** Algo class for projecting shapes and creating SVG output of it */ -class DrawingExport GeometryObject +class TechDrawExport GeometryObject { public: /// Constructor @@ -66,11 +66,11 @@ public: const std::vector & getEdgeRefs() const { return edgeReferences; }; const std::vector & getFaceRefs() const { return faceReferences; }; - DrawingGeometry::BaseGeom * projectEdge(const TopoDS_Shape &edge, + TechDrawGeometry::BaseGeom * projectEdge(const TopoDS_Shape &edge, const TopoDS_Shape &support, const Base::Vector3d &direction, const Base::Vector3d &projXAxis) const; - DrawingGeometry::Vertex * projectVertex(const TopoDS_Shape &vert, + TechDrawGeometry::Vertex * projectVertex(const TopoDS_Shape &vert, const TopoDS_Shape &support, const Base::Vector3d &direction, const Base::Vector3d &projXAxis) const; @@ -79,7 +79,7 @@ public: const TopoDS_Shape &support, const Base::Vector3d &direction, const Base::Vector3d &xaxis, - std::vector &result) const; + std::vector &result) const; /// Process 3D shape to get 2D geometry /*! @@ -128,7 +128,7 @@ protected: const TopoDS_Shape &S, bool visible, ExtractionType extractionType, - std::vector &projFaces, + std::vector &projFaces, std::vector &faceRefs) const; int calculateGeometry(const TopoDS_Shape &input, ExtractionType extractionType, std::vector &geoms) const; diff --git a/src/Mod/TechDraw/App/Makefile.am b/src/Mod/TechDraw/App/Makefile.am index 2180befed..2d56bef31 100644 --- a/src/Mod/TechDraw/App/Makefile.am +++ b/src/Mod/TechDraw/App/Makefile.am @@ -3,8 +3,8 @@ lib_LTLIBRARIES=libDrawing.la Drawing.la libDrawing_la_SOURCES=\ AppDrawingPy.cpp \ - DrawingExport.cpp \ - DrawingExport.h \ + TechDrawExport.cpp \ + TechDrawExport.h \ DrawPage.cpp \ DrawPage.h \ DrawProjection.cpp \ @@ -29,7 +29,7 @@ libDrawing_la_SOURCES=\ libDrawing_la_LDFLAGS = -L../../../Base -L../../../App -L../../../Mod/Part/App \ -L$(OCC_LIB) $(all_libraries) \ -version-info @LIB_CURRENT@:@LIB_REVISION@:@LIB_AGE@ -libDrawing_la_CPPFLAGS = -DDrawingExport= +libDrawing_la_CPPFLAGS = -DTechDrawExport= libDrawing_la_LIBADD = \ @BOOST_REGEX_LIB@ @BOOST_SYSTEM_LIB@ \ diff --git a/src/Mod/TechDraw/App/PreCompiled.h b/src/Mod/TechDraw/App/PreCompiled.h index af70d9c33..409a3ab44 100644 --- a/src/Mod/TechDraw/App/PreCompiled.h +++ b/src/Mod/TechDraw/App/PreCompiled.h @@ -28,12 +28,12 @@ // Exporting of App classes #ifdef FC_OS_WIN32 -# define DrawingExport __declspec(dllexport) +# define TechDrawExport __declspec(dllexport) # define PartExport __declspec(dllimport) # define MeasureExport __declspec(dllimport) # define MeshExport __declspec(dllimport) #else // for Linux -# define DrawingExport +# define TechDrawExport # define MeasureExport # define PartExport # define MeshExport diff --git a/src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp b/src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp index 46799aa1f..48877637f 100644 --- a/src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp +++ b/src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp @@ -47,8 +47,8 @@ using namespace TechDrawGui; /* module functions */ -static PyObject * -open(PyObject *self, PyObject *args) +static PyObject * +open(PyObject *self, PyObject *args) { char* Name; if (!PyArg_ParseTuple(args, "et","utf-8",&Name)) @@ -77,7 +77,7 @@ open(PyObject *self, PyObject *args) } } PY_CATCH; - Py_Return; + Py_Return; } /* module functions */ @@ -112,10 +112,10 @@ importer(PyObject *self, PyObject *args) } } PY_CATCH; - Py_Return; + Py_Return; } -static PyObject * +static PyObject * exporter(PyObject *self, PyObject *args) { PyObject* object; @@ -177,13 +177,13 @@ exporter(PyObject *self, PyObject *args) Base::Vector3d dir = view->Direction.getValue(); bool hidden = view->ShowHiddenLines.getValue(); bool smooth = view->ShowSmoothLines.getValue(); - TechDraw::ProjectionAlgos::ExtractionType type = TechDraw::ProjectionAlgos::Plain; - if (hidden) type = (TechDraw::ProjectionAlgos::ExtractionType)(type|TechDraw::ProjectionAlgos::WithHidden); - if (smooth) type = (TechDraw::ProjectionAlgos::ExtractionType)(type|TechDraw::ProjectionAlgos::WithSmooth); + Drawing::ProjectionAlgos::ExtractionType type = Drawing::ProjectionAlgos::Plain; + if (hidden) type = (Drawing::ProjectionAlgos::ExtractionType)(type|Drawing::ProjectionAlgos::WithHidden); + if (smooth) type = (Drawing::ProjectionAlgos::ExtractionType)(type|Drawing::ProjectionAlgos::WithSmooth); float scale = view->Scale.getValue(); float tol = view->Tolerance.getValue(); - TechDraw::ProjectionAlgos project(shape, dir); + Drawing::ProjectionAlgos project(shape, dir); str_out << project.getDXF(type, scale, tol); break; // TODO: How to add several shapes? } diff --git a/src/Mod/TechDraw/Gui/Command.cpp b/src/Mod/TechDraw/Gui/Command.cpp index aeb9208a2..934ee18d3 100644 --- a/src/Mod/TechDraw/Gui/Command.cpp +++ b/src/Mod/TechDraw/Gui/Command.cpp @@ -841,9 +841,9 @@ bool CmdDrawingSymbol::isActive(void) // Drawing_ExportPage //=========================================================================== -DEF_STD_CMD_A(CmdDrawingExportPage); +DEF_STD_CMD_A(CmdTechDrawExportPage); -CmdDrawingExportPage::CmdDrawingExportPage() +CmdTechDrawExportPage::CmdTechDrawExportPage() : Command("Drawing_ExportPage") { // seting the @@ -855,7 +855,7 @@ CmdDrawingExportPage::CmdDrawingExportPage() sPixmap = "actions/saveSVG"; } -void CmdDrawingExportPage::activated(int iMsg) +void CmdTechDrawExportPage::activated(int iMsg) { std::vector pages = getSelection().getObjectsOfType(TechDraw::DrawPage::getClassTypeId()); if (pages.empty()) { // no Pages in Selection @@ -890,7 +890,7 @@ void CmdDrawingExportPage::activated(int iMsg) } -bool CmdDrawingExportPage::isActive(void) +bool CmdTechDrawExportPage::isActive(void) { return (getActiveGuiDocument() ? true : false); } @@ -976,7 +976,7 @@ void CreateDrawingCommands(void) rcCmdMgr.addCommand(new CmdDrawingClipPlus()); rcCmdMgr.addCommand(new CmdDrawingClipMinus()); rcCmdMgr.addCommand(new CmdDrawingSymbol()); - rcCmdMgr.addCommand(new CmdDrawingExportPage()); + rcCmdMgr.addCommand(new CmdTechDrawExportPage()); rcCmdMgr.addCommand(new CmdDrawingProjectShape()); rcCmdMgr.addCommand(new CmdDrawingDraftView()); } diff --git a/src/Mod/TechDraw/Gui/CommandCreateDims.cpp b/src/Mod/TechDraw/Gui/CommandCreateDims.cpp index a2b2420fa..cb60af427 100644 --- a/src/Mod/TechDraw/Gui/CommandCreateDims.cpp +++ b/src/Mod/TechDraw/Gui/CommandCreateDims.cpp @@ -796,7 +796,7 @@ int _isValidSingleEdge(Gui::Command* cmd, bool trueDim) { if (SubNames.size() == 1) { //only 1 subshape selected if (DrawUtil::getGeomTypeFromName(SubNames[0]) == "Edge") { //the Name starts with "Edge" int GeoId = DrawUtil::getIndexFromName(SubNames[0]); - DrawingGeometry::BaseGeom* geom = NULL; + TechDrawGeometry::BaseGeom* geom = NULL; if (trueDim) { int ref = objFeat->getEdgeRefByIndex(GeoId); geom = objFeat->getCompleteEdge(ref); //project edge onto its shape to get 2D geom @@ -808,8 +808,8 @@ int _isValidSingleEdge(Gui::Command* cmd, bool trueDim) { return isInvalid; } - if(geom->geomType == DrawingGeometry::GENERIC) { - DrawingGeometry::Generic* gen1 = static_cast(geom); + if(geom->geomType == TechDrawGeometry::GENERIC) { + TechDrawGeometry::Generic* gen1 = static_cast(geom); if(gen1->points.size() > 2) { //the edge is a polyline return isInvalid; } @@ -821,12 +821,12 @@ int _isValidSingleEdge(Gui::Command* cmd, bool trueDim) { } else { edgeType = isDiagonal; } - } else if (geom->geomType == DrawingGeometry::CIRCLE || - geom->geomType == DrawingGeometry::ELLIPSE || - geom->geomType == DrawingGeometry::ARCOFCIRCLE || - geom->geomType == DrawingGeometry::ARCOFELLIPSE ) { + } else if (geom->geomType == TechDrawGeometry::CIRCLE || + geom->geomType == TechDrawGeometry::ELLIPSE || + geom->geomType == TechDrawGeometry::ARCOFCIRCLE || + geom->geomType == TechDrawGeometry::ARCOFELLIPSE ) { edgeType = isCircle; - } else if (geom->geomType == DrawingGeometry::BSPLINE) { + } else if (geom->geomType == TechDrawGeometry::BSPLINE) { edgeType = isCurve; } else { edgeType = isInvalid; @@ -862,8 +862,8 @@ int _isValidEdgeToEdge(Gui::Command* cmd, bool trueDim) { DrawUtil::getGeomTypeFromName(SubNames[1]) == "Edge") { int GeoId0 = DrawUtil::getIndexFromName(SubNames[0]); int GeoId1 = DrawUtil::getIndexFromName(SubNames[1]); - DrawingGeometry::BaseGeom* geom0 = NULL; - DrawingGeometry::BaseGeom* geom1 = NULL; + TechDrawGeometry::BaseGeom* geom0 = NULL; + TechDrawGeometry::BaseGeom* geom1 = NULL; if (trueDim) { int ref0 = objFeat0->getEdgeRefByIndex(GeoId0); int ref1 = objFeat0->getEdgeRefByIndex(GeoId1); @@ -878,10 +878,10 @@ int _isValidEdgeToEdge(Gui::Command* cmd, bool trueDim) { return isInvalid; } - if(geom0->geomType == DrawingGeometry::GENERIC && - geom1->geomType == DrawingGeometry::GENERIC) { - DrawingGeometry::Generic *gen0 = static_cast(geom0); - DrawingGeometry::Generic *gen1 = static_cast(geom1); + if(geom0->geomType == TechDrawGeometry::GENERIC && + geom1->geomType == TechDrawGeometry::GENERIC) { + TechDrawGeometry::Generic *gen0 = static_cast(geom0); + TechDrawGeometry::Generic *gen1 = static_cast(geom1); if(gen0->points.size() > 2 || gen1->points.size() > 2) { //the edge is a polyline return isInvalid; diff --git a/src/Mod/TechDraw/Gui/PreCompiled.h b/src/Mod/TechDraw/Gui/PreCompiled.h index 7e32f7b43..215cbcb2e 100644 --- a/src/Mod/TechDraw/Gui/PreCompiled.h +++ b/src/Mod/TechDraw/Gui/PreCompiled.h @@ -29,11 +29,11 @@ // Importing of App classes #ifdef FC_OS_WIN32 //# define DrawingAppExport __declspec(dllimport) -# define DrawingExport __declspec(dllimport) +# define TechDrawExport __declspec(dllimport) # define PartExport __declspec(dllimport) # define TechDrawGuiExport __declspec(dllexport) #else // for Linux -# define DrawingExport +# define TechDrawExport # define PartExport # define TechDrawGuiExport #endif diff --git a/src/Mod/TechDraw/Gui/QGIDrawingTemplate.cpp b/src/Mod/TechDraw/Gui/QGIDrawingTemplate.cpp index 676ec1f80..25e22e6e5 100644 --- a/src/Mod/TechDraw/Gui/QGIDrawingTemplate.cpp +++ b/src/Mod/TechDraw/Gui/QGIDrawingTemplate.cpp @@ -97,9 +97,9 @@ void QGIDrawingTemplate::draw() // Clear the previous geometry stored // Get a list of geometry and iterate - const std::vector &geoms = tmplte->getGeometry(); + const std::vector &geoms = tmplte->getGeometry(); - std::vector::const_iterator it = geoms.begin(); + std::vector::const_iterator it = geoms.begin(); QPainterPath path; @@ -107,9 +107,9 @@ void QGIDrawingTemplate::draw() // iterate through all the geometries for(; it != geoms.end(); ++it) { switch((*it)->geomType) { - case DrawingGeometry::GENERIC: { + case TechDrawGeometry::GENERIC: { - DrawingGeometry::Generic *geom = static_cast(*it); + TechDrawGeometry::Generic *geom = static_cast(*it); path.moveTo(geom->points[0].fX, geom->points[0].fY); std::vector::const_iterator it = geom->points.begin(); diff --git a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp index 407df32eb..aee5f91b7 100644 --- a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp @@ -360,14 +360,14 @@ void QGIViewDimension::draw() if((dim->References.getValues().size() == 1) && (DrawUtil::getGeomTypeFromName(SubNames[0]) == "Edge")) { int idx = DrawUtil::getIndexFromName(SubNames[0]); - DrawingGeometry::BaseGeom* geom = refObj->getProjEdgeByIndex(idx); + TechDrawGeometry::BaseGeom* geom = refObj->getProjEdgeByIndex(idx); if (!geom) { Base::Console().Log("INFO - qgivd::draw - no geom for projected edge: %d of %d\n", idx,refObj->getEdgeGeometry().size()); return; } - if (geom->geomType == DrawingGeometry::GENERIC) { - DrawingGeometry::Generic *gen = static_cast(geom); + if (geom->geomType == TechDrawGeometry::GENERIC) { + TechDrawGeometry::Generic *gen = static_cast(geom); Base::Vector2D pnt1 = gen->points.at(0); Base::Vector2D pnt2 = gen->points.at(1); distStart = Base::Vector3d(pnt1.fX, pnt1.fY, 0.); @@ -380,8 +380,8 @@ void QGIViewDimension::draw() DrawUtil::getGeomTypeFromName(SubNames[1]) == "Vertex") { int idx0 = DrawUtil::getIndexFromName(SubNames[0]); int idx1 = DrawUtil::getIndexFromName(SubNames[1]); - DrawingGeometry::Vertex *v0 = refObj->getProjVertexByIndex(idx0); - DrawingGeometry::Vertex *v1 = refObj->getProjVertexByIndex(idx1); + TechDrawGeometry::Vertex *v0 = refObj->getProjVertexByIndex(idx0); + TechDrawGeometry::Vertex *v1 = refObj->getProjVertexByIndex(idx1); if (!v0 || !v1) { //Ugh. this is probably because the document is restoring. check log. Base::Console().Log("INFO - qgivd::draw - no geom for projected edge: %d or %d of %d\n", @@ -395,17 +395,17 @@ void QGIViewDimension::draw() DrawUtil::getGeomTypeFromName(SubNames[1]) == "Edge") { int idx0 = DrawUtil::getIndexFromName(SubNames[0]); int idx1 = DrawUtil::getIndexFromName(SubNames[1]); - DrawingGeometry::BaseGeom* geom0 = refObj->getProjEdgeByIndex(idx0); - DrawingGeometry::BaseGeom* geom1 = refObj->getProjEdgeByIndex(idx1); + TechDrawGeometry::BaseGeom* geom0 = refObj->getProjEdgeByIndex(idx0); + TechDrawGeometry::BaseGeom* geom1 = refObj->getProjEdgeByIndex(idx1); if (!geom0 || !geom1) { Base::Console().Log("INFO - qgivd::draw - no geom for projected edge: %d or %d of %d\n", idx0,idx1,refObj->getEdgeGeometry().size()); return; } - if ( (geom0->geomType == DrawingGeometry::GENERIC) && - (geom1->geomType == DrawingGeometry::GENERIC) ){ - DrawingGeometry::Generic *gen0 = static_cast(geom0); - DrawingGeometry::Generic *gen1 = static_cast(geom1); + if ( (geom0->geomType == TechDrawGeometry::GENERIC) && + (geom1->geomType == TechDrawGeometry::GENERIC) ){ + TechDrawGeometry::Generic *gen0 = static_cast(geom0); + TechDrawGeometry::Generic *gen1 = static_cast(geom1); Base::Vector2D pnt1, pnt2; Base::Vector3d edge1Start, edge1End, edge2Start, edge2End; pnt1 = gen0->points.at(0); @@ -599,16 +599,16 @@ void QGIViewDimension::draw() if(dim->References.getValues().size() == 1 && DrawUtil::getGeomTypeFromName(SubNames[0]) == "Edge") { int idx = DrawUtil::getIndexFromName(SubNames[0]); - DrawingGeometry::BaseGeom *geom = refObj->getProjEdgeByIndex(idx); + TechDrawGeometry::BaseGeom *geom = refObj->getProjEdgeByIndex(idx); if(!geom) { Base::Console().Log("INFO - qgivd::draw - no geom for projected edge: %d of %d\n", idx,refObj->getEdgeGeometry().size()); return; //throw Base::Exception("Edge couldn't be found for diameter dimension"); } - if( (geom->geomType == DrawingGeometry::CIRCLE) || - (geom->geomType == DrawingGeometry::ARCOFCIRCLE) ) { - DrawingGeometry::Circle *circ = static_cast(geom); + if( (geom->geomType == TechDrawGeometry::CIRCLE) || + (geom->geomType == TechDrawGeometry::ARCOFCIRCLE) ) { + TechDrawGeometry::Circle *circ = static_cast(geom); radius = circ->radius; centre = Base::Vector3d (circ->center.fX, circ->center.fY, 0); } else { @@ -864,19 +864,19 @@ void QGIViewDimension::draw() if(dim->References.getValues().size() == 1 && DrawUtil::getGeomTypeFromName(SubNames[0]) == "Edge") { int idx = DrawUtil::getIndexFromName(SubNames[0]); - DrawingGeometry::BaseGeom* geom = refObj->getProjEdgeByIndex(idx); + TechDrawGeometry::BaseGeom* geom = refObj->getProjEdgeByIndex(idx); if(!geom) { Base::Console().Log("INFO - qgivd::draw - no geom for projected edge: %d of %d\n", idx,refObj->getEdgeGeometry().size()); return; } - if (geom->geomType == DrawingGeometry::CIRCLE) { - DrawingGeometry::Circle *circ = static_cast(geom); + if (geom->geomType == TechDrawGeometry::CIRCLE) { + TechDrawGeometry::Circle *circ = static_cast(geom); radius = circ->radius; curveCenter = Base::Vector3d(circ->center.fX,circ->center.fY,0.0); pointOnCurve = Base::Vector3d(curveCenter.x + radius, curveCenter.y,0.0); - } else if (geom->geomType == DrawingGeometry::ARCOFCIRCLE) { - DrawingGeometry::AOC *circ = static_cast(geom); + } else if (geom->geomType == TechDrawGeometry::ARCOFCIRCLE) { + TechDrawGeometry::AOC *circ = static_cast(geom); radius = circ->radius; curveCenter = Base::Vector3d(circ->center.fX,circ->center.fY,0.0); pointOnCurve = Base::Vector3d(circ->midPnt.fX, circ->midPnt.fY,0.0); @@ -976,17 +976,17 @@ void QGIViewDimension::draw() DrawUtil::getGeomTypeFromName(SubNames[1]) == "Edge") { int idx0 = DrawUtil::getIndexFromName(SubNames[0]); int idx1 = DrawUtil::getIndexFromName(SubNames[1]); - DrawingGeometry::BaseGeom* geom0 = refObj->getProjEdgeByIndex(idx0); - DrawingGeometry::BaseGeom* geom1 = refObj->getProjEdgeByIndex(idx1); + TechDrawGeometry::BaseGeom* geom0 = refObj->getProjEdgeByIndex(idx0); + TechDrawGeometry::BaseGeom* geom1 = refObj->getProjEdgeByIndex(idx1); if (!geom0 || !geom1) { Base::Console().Log("INFO - qgivd::draw - no geom for projected edge: %d or %d of %d\n", idx0,idx1,refObj->getEdgeGeometry().size()); return; } - if ( (geom0->geomType == DrawingGeometry::GENERIC) && - (geom1->geomType == DrawingGeometry::GENERIC) ) { - DrawingGeometry::Generic *gen0 = static_cast(geom0); - DrawingGeometry::Generic *gen1 = static_cast(geom1); + if ( (geom0->geomType == TechDrawGeometry::GENERIC) && + (geom1->geomType == TechDrawGeometry::GENERIC) ) { + TechDrawGeometry::Generic *gen0 = static_cast(geom0); + TechDrawGeometry::Generic *gen1 = static_cast(geom1); // Get Points for line Base::Vector2D pnt1, pnt2; diff --git a/src/Mod/TechDraw/Gui/QGIViewDimension.h b/src/Mod/TechDraw/Gui/QGIViewDimension.h index 70f5eb5db..14f4016ba 100644 --- a/src/Mod/TechDraw/Gui/QGIViewDimension.h +++ b/src/Mod/TechDraw/Gui/QGIViewDimension.h @@ -121,7 +121,7 @@ protected: QGI *centreLines; std::vector arw; //arrowheads - std::vector projGeom; + std::vector projGeom; QPen pen; QColor m_colNormal; QColor m_colPre; diff --git a/src/Mod/TechDraw/Gui/QGIViewPart.cpp b/src/Mod/TechDraw/Gui/QGIViewPart.cpp index 4194b679c..386dec4b4 100644 --- a/src/Mod/TechDraw/Gui/QGIViewPart.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewPart.cpp @@ -110,13 +110,13 @@ void QGIViewPart::setViewPartFeature(TechDraw::DrawViewPart *obj) setViewFeature(static_cast(obj)); } -QPainterPath QGIViewPart::drawPainterPath(DrawingGeometry::BaseGeom *baseGeom) const +QPainterPath QGIViewPart::drawPainterPath(TechDrawGeometry::BaseGeom *baseGeom) const { QPainterPath path; switch(baseGeom->geomType) { - case DrawingGeometry::CIRCLE: { - DrawingGeometry::Circle *geom = static_cast(baseGeom); + case TechDrawGeometry::CIRCLE: { + TechDrawGeometry::Circle *geom = static_cast(baseGeom); double x = geom->center.fX - geom->radius; double y = geom->center.fY - geom->radius; @@ -125,8 +125,8 @@ QPainterPath QGIViewPart::drawPainterPath(DrawingGeometry::BaseGeom *baseGeom) c //Base::Console().Message("TRACE -drawPainterPath - making an CIRCLE @(%.3f,%.3f) R:%.3f\n",x, y, geom->radius); } break; - case DrawingGeometry::ARCOFCIRCLE: { - DrawingGeometry::AOC *geom = static_cast(baseGeom); + case TechDrawGeometry::ARCOFCIRCLE: { + TechDrawGeometry::AOC *geom = static_cast(baseGeom); //double x = geom->center.fX - geom->radius; //double y = geom->center.fY - geom->radius; @@ -135,8 +135,8 @@ QPainterPath QGIViewPart::drawPainterPath(DrawingGeometry::BaseGeom *baseGeom) c geom->startPnt.fX, geom->startPnt.fY); //Base::Console().Message("TRACE -drawPainterPath - making an ARCOFCIRCLE @(%.3f,%.3f) R:%.3f\n",x, y, geom->radius); } break; - case DrawingGeometry::ELLIPSE: { - DrawingGeometry::Ellipse *geom = static_cast(baseGeom); + case TechDrawGeometry::ELLIPSE: { + TechDrawGeometry::Ellipse *geom = static_cast(baseGeom); // Calculate start and end points as ellipse with theta = 0 and pi double startX = geom->center.fX + geom->major * cos(geom->angle), @@ -152,8 +152,8 @@ QPainterPath QGIViewPart::drawPainterPath(DrawingGeometry::BaseGeom *baseGeom) c //Base::Console().Message("TRACE -drawPainterPath - making an ELLIPSE @(%.3f,%.3f) R1:%.3f R2:%.3f\n",x, y, geom->major, geom->minor); } break; - case DrawingGeometry::ARCOFELLIPSE: { - DrawingGeometry::AOE *geom = static_cast(baseGeom); + case TechDrawGeometry::ARCOFELLIPSE: { + TechDrawGeometry::AOE *geom = static_cast(baseGeom); pathArc(path, geom->major, geom->minor, geom->angle, geom->largeArc, geom->cw, geom->endPnt.fX, geom->endPnt.fY, @@ -161,10 +161,10 @@ QPainterPath QGIViewPart::drawPainterPath(DrawingGeometry::BaseGeom *baseGeom) c //Base::Console().Message("TRACE -drawPainterPath - making an ARCOFELLIPSE R1:%.3f R2:%.3f From: (%.3f,%.3f) To: (%.3f,%.3f)\n",geom->major, geom->minor,geom->startPnt.fX, geom->startPnt.fY,geom->endPnt.fX, geom->endPnt.fY); } break; - case DrawingGeometry::BSPLINE: { - DrawingGeometry::BSpline *geom = static_cast(baseGeom); + case TechDrawGeometry::BSPLINE: { + TechDrawGeometry::BSpline *geom = static_cast(baseGeom); - std::vector::const_iterator it = geom->segments.begin(); + std::vector::const_iterator it = geom->segments.begin(); // Move painter to the beginning of our first segment path.moveTo(it->pnts[0].fX, it->pnts[0].fY); @@ -191,8 +191,8 @@ QPainterPath QGIViewPart::drawPainterPath(DrawingGeometry::BaseGeom *baseGeom) c } } } break; - case DrawingGeometry::GENERIC: { - DrawingGeometry::Generic *geom = static_cast(baseGeom); + case TechDrawGeometry::GENERIC: { + TechDrawGeometry::Generic *geom = static_cast(baseGeom); path.moveTo(geom->points[0].fX, geom->points[0].fY); std::vector::const_iterator it = geom->points.begin(); @@ -286,18 +286,18 @@ void QGIViewPart::drawViewPart() #if MOD_TECHDRAW_HANDLE_FACES // Draw Faces - const std::vector &faceGeoms = part->getFaceGeometry(); + const std::vector &faceGeoms = part->getFaceGeometry(); const std::vector &faceRefs = part->getFaceReferences(); - std::vector::const_iterator fit = faceGeoms.begin(); + std::vector::const_iterator fit = faceGeoms.begin(); QGIFace* face; QPen facePen; for(int i = 0 ; fit != faceGeoms.end(); fit++, i++) { - std::vector faceWires = (*fit)->wires; + std::vector faceWires = (*fit)->wires; QPainterPath facePath; - for(std::vector::iterator wire = faceWires.begin(); wire != faceWires.end(); wire++) { + for(std::vector::iterator wire = faceWires.begin(); wire != faceWires.end(); wire++) { QPainterPath wirePath; QPointF shapePos; - for(std::vector::iterator baseGeom = (*wire)->geoms.begin(); + for(std::vector::iterator baseGeom = (*wire)->geoms.begin(); baseGeom != (*wire)->geoms.end(); baseGeom++) { QPainterPath edgePath = drawPainterPath(*baseGeom); @@ -318,9 +318,9 @@ void QGIViewPart::drawViewPart() //_dumpPath(faceId.str().c_str(),facePath); QGIFace *fitem = new QGIFace(-1); - // TODO: DrawingGeometry::Face has no easy method of determining hidden/visible??? + // TODO: TechDrawGeometry::Face has no easy method of determining hidden/visible??? // Hide any edges that are hidden if option is set. -// if((*fit)->extractType == DrawingGeometry::WithHidden && !part->ShowHiddenLines.getValue()) +// if((*fit)->extractType == TechDrawGeometry::WithHidden && !part->ShowHiddenLines.getValue()) // graphicsItem->hide(); addToGroup(fitem); fitem->setPos(0.0,0.0); @@ -341,12 +341,12 @@ void QGIViewPart::drawViewPart() TechDraw::DrawHatch* feat = (*itHatch); const std::vector &edgeNames = feat->Edges.getSubValues(); std::vector::const_iterator itEdge = edgeNames.begin(); - std::vector unChained; + std::vector unChained; //get all edge geometries for this hatch for (; itEdge != edgeNames.end(); itEdge++) { int idxEdge = DrawUtil::getIndexFromName((*itEdge)); - DrawingGeometry::BaseGeom* edgeGeom = viewPart->getProjEdgeByIndex(idxEdge); + TechDrawGeometry::BaseGeom* edgeGeom = viewPart->getProjEdgeByIndex(idxEdge); if (!edgeGeom) { Base::Console().Log("Error - qgivp::drawViewPart - edgeGeom: %d is NULL\n",idxEdge); } @@ -354,10 +354,10 @@ void QGIViewPart::drawViewPart() } //chain edges tail to nose into a closed region - std::vector chained = DrawingGeometry::chainGeoms(unChained); + std::vector chained = TechDrawGeometry::chainGeoms(unChained); //iterate through the chain to make QPainterPath - std::vector::iterator itChain = chained.begin(); + std::vector::iterator itChain = chained.begin(); QPainterPath hatchPath; for (; itChain != chained.end(); itChain++) { QPainterPath subPath; @@ -382,27 +382,27 @@ void QGIViewPart::drawViewPart() } // Draw Edges - const std::vector &geoms = viewPart->getEdgeGeometry(); + const std::vector &geoms = viewPart->getEdgeGeometry(); const std::vector &refs = viewPart->getEdgeReferences(); - std::vector::const_iterator it = geoms.begin(); + std::vector::const_iterator it = geoms.begin(); QGIEdge* item; for(int i = 0 ; it != geoms.end(); ++it, i++) { //TODO: investigate if an Edge can be both Hidden and Smooth??? - if(((*it)->extractType == DrawingGeometry::Plain) || - (((*it)->extractType == DrawingGeometry::WithHidden) && viewPart->ShowHiddenLines.getValue()) || - ((*it)->extractType == DrawingGeometry::WithSmooth)) { -// (((*it)->extractType == DrawingGeometry::WithSmooth) && part->ShowSmoothLines.getValue())) { + if(((*it)->extractType == TechDrawGeometry::Plain) || + (((*it)->extractType == TechDrawGeometry::WithHidden) && viewPart->ShowHiddenLines.getValue()) || + ((*it)->extractType == TechDrawGeometry::WithSmooth)) { +// (((*it)->extractType == TechDrawGeometry::WithSmooth) && part->ShowSmoothLines.getValue())) { //item = new QGIEdge(refs.at(i)); item = new QGIEdge(i); item->setReference(refs.at(i)); addToGroup(item); //item is at scene(0,0), not group(0,0) item->setPos(0.0,0.0); item->setStrokeWidth(lineWidth); - if((*it)->extractType == DrawingGeometry::WithHidden) { + if((*it)->extractType == TechDrawGeometry::WithHidden) { item->setStrokeWidth(lineWidthHid); item->setHiddenEdge(true); - } else if((*it)->extractType == DrawingGeometry::WithSmooth) { + } else if((*it)->extractType == TechDrawGeometry::WithSmooth) { item->setSmoothEdge(true); } item->setPath(drawPainterPath(*it)); @@ -419,9 +419,9 @@ void QGIViewPart::drawViewPart() } // Draw Vertexs: - const std::vector &verts = viewPart->getVertexGeometry(); + const std::vector &verts = viewPart->getVertexGeometry(); const std::vector &vertRefs = viewPart->getVertexReferences(); - std::vector::const_iterator vert = verts.begin(); + std::vector::const_iterator vert = verts.begin(); for(int i = 0 ; vert != verts.end(); ++vert, i++) { QGIVertex *item = new QGIVertex(i); diff --git a/src/Mod/TechDraw/Gui/QGIViewPart.h b/src/Mod/TechDraw/Gui/QGIViewPart.h index fa7829b37..dc0e108e6 100644 --- a/src/Mod/TechDraw/Gui/QGIViewPart.h +++ b/src/Mod/TechDraw/Gui/QGIViewPart.h @@ -91,7 +91,7 @@ protected: double x, double y, double curx, double cury) const; - QPainterPath drawPainterPath(DrawingGeometry::BaseGeom *baseGeom) const; + QPainterPath drawPainterPath(TechDrawGeometry::BaseGeom *baseGeom) const; std::vector getHatchesForView(TechDraw::DrawViewPart* viewPart); void drawViewPart(); diff --git a/src/Mod/TechDraw/Gui/QGIViewSection.cpp b/src/Mod/TechDraw/Gui/QGIViewSection.cpp index ced2203aa..2f694820a 100644 --- a/src/Mod/TechDraw/Gui/QGIViewSection.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewSection.cpp @@ -73,7 +73,7 @@ void QGIViewSection::drawSectionFace() //Base::Console().Log("drawing section face\n"); // Get the section face from the feature - std::vector faceGeoms; + std::vector faceGeoms; part->getSectionSurface(faceGeoms); if (faceGeoms.empty()) { Base::Console().Log("INFO - QGIViewSection::drawSectionFace - No Face available. Check Section plane.\n"); @@ -82,19 +82,19 @@ void QGIViewSection::drawSectionFace() #if MOD_TECHDRAW_HANDLE_FACES // Draw Faces - std::vector::const_iterator fit = faceGeoms.begin(); + std::vector::const_iterator fit = faceGeoms.begin(); QGI *graphicsItem = 0; QPen facePen; //TODO: check if this is the same logic as QGIVPart for(int i = 0 ; fit != faceGeoms.end(); ++fit, i++) { - std::vector faceWires = (*fit)->wires; + std::vector faceWires = (*fit)->wires; QPainterPath facePath; - for(std::vector::iterator wire = faceWires.begin(); wire != faceWires.end(); ++wire) { + for(std::vector::iterator wire = faceWires.begin(); wire != faceWires.end(); ++wire) { QPainterPath wirePath; QPointF shapePos; - for(std::vector::iterator baseGeom = (*wire)->geoms.begin(); baseGeom != (*wire)->geoms.end(); ++baseGeom) { + for(std::vector::iterator baseGeom = (*wire)->geoms.begin(); baseGeom != (*wire)->geoms.end(); ++baseGeom) { //Save the start Position QPainterPath edgePath = drawPainterPath(*baseGeom); @@ -124,7 +124,7 @@ void QGIViewSection::drawSectionFace() if(graphicsItem) { // Hide any edges that are hidden if option is set. - // if((*fit)->extractType == DrawingGeometry::WithHidden && !part->ShowHiddenLines.getValue()) + // if((*fit)->extractType == TechDrawGeometry::WithHidden && !part->ShowHiddenLines.getValue()) // graphicsItem->hide(); addToGroup(graphicsItem);