ProjectionAlgo & DrawingExport renames
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -27,19 +27,18 @@
|
||||
#endif
|
||||
|
||||
#include <Mod/Part/App/TopoShapePy.h>
|
||||
#include "ProjectionAlgos.h"
|
||||
#include <Base/Console.h>
|
||||
#include <Base/VectorPy.h>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
#include <Mod/Part/App/OCCError.h>
|
||||
|
||||
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<TopoShapePy*>(pcObjShape);
|
||||
Base::Vector3d Vector(0,0,1);
|
||||
if (pcObjDir)
|
||||
Vector = *static_cast<Base::VectorPy*>(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<TopoShapePy*>(pcObjShape);
|
||||
Base::Vector3d Vector(0,0,1);
|
||||
if (pcObjDir)
|
||||
Vector = *static_cast<Base::VectorPy*>(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<TopoShapePy*>(pcObjShape);
|
||||
Base::Vector3d Vector(0,0,1);
|
||||
if (pcObjDir)
|
||||
Vector = static_cast<Base::VectorPy*>(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<TopoShapePy*>(pcObjShape);
|
||||
Base::Vector3d Vector(0,0,1);
|
||||
if (pcObjDir)
|
||||
Vector = static_cast<Base::VectorPy*>(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.*?>");
|
||||
svg = boost::regex_replace(svg, e3, empty);
|
||||
// removing sodipodi tags -- DANGEROUS, some sodipodi tags are single, better leave it
|
||||
//boost::regex e4 ("<sodipodi.*?>");
|
||||
//svg = boost::regex_replace(svg, e4, empty);
|
||||
// removing metadata tags
|
||||
boost::regex e5 ("<metadata.*?</metadata>");
|
||||
svg = boost::regex_replace(svg, e5, empty);
|
||||
// removing closing svg tags
|
||||
boost::regex e6 ("</svg>");
|
||||
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 */
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -108,5 +108,5 @@ template<> const char* TechDraw::DrawHatchPython::getViewProviderName(void) cons
|
||||
/// @endcond
|
||||
|
||||
// explicit template instantiation
|
||||
template class DrawingExport FeaturePythonT<TechDraw::DrawHatch>;
|
||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawHatch>;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
namespace TechDraw
|
||||
{
|
||||
|
||||
class DrawingExport DrawHatch : public TechDraw::DrawView
|
||||
class TechDrawExport DrawHatch : public TechDraw::DrawView
|
||||
{
|
||||
PROPERTY_HEADER(TechDraw::DrawHatch);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
namespace TechDraw
|
||||
{
|
||||
|
||||
class DrawingExport DrawPage: public App::DocumentObject
|
||||
class TechDrawExport DrawPage: public App::DocumentObject
|
||||
{
|
||||
PROPERTY_HEADER(TechDraw::DrawPage);
|
||||
|
||||
|
||||
@@ -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">
|
||||
<Documentation>
|
||||
|
||||
@@ -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<DrawingGeometry::BaseGeom *>::iterator it = geom.begin(); it != geom.end(); ++it) {
|
||||
for(std::vector<TechDrawGeometry::BaseGeom *>::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<TechDraw::DrawParametricTemplate>;
|
||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawParametricTemplate>;
|
||||
}
|
||||
|
||||
@@ -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<DrawingGeometry::BaseGeom *> getGeometry() { return geom; }
|
||||
std::vector<TechDrawGeometry::BaseGeom *> getGeometry() { return geom; }
|
||||
int clearGeometry();
|
||||
|
||||
// Template Drawing Methods
|
||||
@@ -80,7 +80,7 @@ protected:
|
||||
void onChanged(const App::Property* prop);
|
||||
|
||||
protected:
|
||||
std::vector<DrawingGeometry::BaseGeom *> geom;
|
||||
std::vector<TechDrawGeometry::BaseGeom *> geom;
|
||||
|
||||
private:
|
||||
static const char* OrientationEnums[];
|
||||
|
||||
@@ -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">
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Luke Parry" EMail="l.parry@warwick.ac.uk" />
|
||||
<UserDocu>Feature for creating and manipulating Drawing Templates</UserDocu>
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2009 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* 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 <sstream>
|
||||
# include <BRep_Builder.hxx>
|
||||
# include <Standard_Failure.hxx>
|
||||
# include <TopoDS_Compound.hxx>
|
||||
#endif
|
||||
|
||||
|
||||
#include <strstream>
|
||||
#include <Base/Writer.h>
|
||||
#include <Base/Reader.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/FileInfo.h>
|
||||
|
||||
#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<Part::Feature*>(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());
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2009 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* 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 <App/DocumentObject.h>
|
||||
#include <App/PropertyStandard.h>
|
||||
#include <App/PropertyGeo.h>
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
|
||||
|
||||
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
|
||||
@@ -357,5 +357,5 @@ template<> const char* TechDraw::DrawSVGTemplatePython::getViewProviderName(void
|
||||
/// @endcond
|
||||
|
||||
// explicit template instantiation
|
||||
template class DrawingExport FeaturePythonT<TechDraw::DrawSVGTemplate>;
|
||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawSVGTemplate>;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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">
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Luke Parry" EMail="l.parry@warwick.ac.uk" />
|
||||
<UserDocu>Feature for creating and manipulating Drawing SVG Templates</UserDocu>
|
||||
|
||||
@@ -142,5 +142,5 @@ template<> const char* TechDraw::DrawTemplatePython::getViewProviderName(void) c
|
||||
/// @endcond
|
||||
|
||||
// explicit template instantiation
|
||||
template class DrawingExport FeaturePythonT<TechDraw::DrawTemplate>;
|
||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawTemplate>;
|
||||
} // namespace App
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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">
|
||||
<Documentation>
|
||||
|
||||
@@ -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<std::string::const_iterator> 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<std::string::const_iterator> 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;
|
||||
|
||||
@@ -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<TechDraw::DrawView>;
|
||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawView>;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<TechDraw::DrawViewAnnotation>;
|
||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawViewAnnotation>;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -165,5 +165,5 @@ template<> const char* TechDraw::DrawViewClipPython::getViewProviderName(void) c
|
||||
/// @endcond
|
||||
|
||||
// explicit template instantiation
|
||||
template class DrawingExport FeaturePythonT<TechDraw::DrawViewClip>;
|
||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawViewClip>;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
namespace TechDraw
|
||||
{
|
||||
|
||||
class DrawingExport DrawViewClip: public TechDraw::DrawView
|
||||
class TechDrawExport DrawViewClip: public TechDraw::DrawView
|
||||
{
|
||||
PROPERTY_HEADER(TechDraw::DrawViewClip);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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<DrawingGeometry::Generic*>(geom);
|
||||
TechDrawGeometry::BaseGeom* geom = getViewPart()->getProjEdgeByIndex(idx);
|
||||
TechDrawGeometry::Generic* gen = static_cast<TechDrawGeometry::Generic*>(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<DrawingGeometry::Generic*>(geom0);
|
||||
DrawingGeometry::Generic* gen1 = static_cast<DrawingGeometry::Generic*>(geom1);
|
||||
TechDrawGeometry::BaseGeom* geom0 = getViewPart()->getProjEdgeByIndex(idx0);
|
||||
TechDrawGeometry::BaseGeom* geom1 = getViewPart()->getProjEdgeByIndex(idx1);
|
||||
TechDrawGeometry::Generic* gen0 = static_cast<TechDrawGeometry::Generic*>(geom0);
|
||||
TechDrawGeometry::Generic* gen1 = static_cast<TechDrawGeometry::Generic*>(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<DrawingGeometry::Generic*>(geom);
|
||||
TechDrawGeometry::BaseGeom* geom = getViewPart()->getProjEdgeByIndex(idx);
|
||||
TechDrawGeometry::Generic* gen = static_cast<TechDrawGeometry::Generic*>(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<DrawingGeometry::Generic*>(geom);
|
||||
TechDrawGeometry::BaseGeom* geom = getViewPart()->getProjEdgeByIndex(idx);
|
||||
TechDrawGeometry::Generic* gen = static_cast<TechDrawGeometry::Generic*>(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<DrawingGeometry::Circle*> (base);
|
||||
TechDrawGeometry::BaseGeom* base = getViewPart()->getProjEdgeByIndex(idx);
|
||||
TechDrawGeometry::Circle* circle = static_cast<TechDrawGeometry::Circle*> (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<DrawingGeometry::Circle*> (base);
|
||||
TechDrawGeometry::BaseGeom* base = getViewPart()->getProjEdgeByIndex(idx);
|
||||
TechDrawGeometry::Circle* circle = static_cast<TechDrawGeometry::Circle*> (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<TechDraw::DrawViewPart *>(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<DrawingGeometry::Generic *>(edge0);
|
||||
DrawingGeometry::Generic *gen2 = static_cast<DrawingGeometry::Generic *>(edge1);
|
||||
if(edge0->geomType == TechDrawGeometry::GENERIC &&
|
||||
edge1->geomType == TechDrawGeometry::GENERIC) {
|
||||
TechDrawGeometry::Generic *gen1 = static_cast<TechDrawGeometry::Generic *>(edge0);
|
||||
TechDrawGeometry::Generic *gen2 = static_cast<TechDrawGeometry::Generic *>(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.);
|
||||
|
||||
@@ -36,7 +36,7 @@ class Measurement;
|
||||
namespace TechDraw
|
||||
{
|
||||
|
||||
class DrawingExport DrawViewDimension : public TechDraw::DrawView
|
||||
class TechDrawExport DrawViewDimension : public TechDraw::DrawView
|
||||
{
|
||||
PROPERTY_HEADER(TechDraw::DrawViewDimension);
|
||||
|
||||
|
||||
@@ -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<TechDraw::DrawHatch*> DrawViewPart::getHatches() const
|
||||
return result;
|
||||
}
|
||||
|
||||
const std::vector<DrawingGeometry::Vertex *> & DrawViewPart::getVertexGeometry() const
|
||||
const std::vector<TechDrawGeometry::Vertex *> & DrawViewPart::getVertexGeometry() const
|
||||
{
|
||||
return geometryObject->getVertexGeometry();
|
||||
}
|
||||
@@ -243,7 +243,7 @@ const std::vector<int> & DrawViewPart::getVertexReferences() const
|
||||
return geometryObject->getVertexRefs();
|
||||
}
|
||||
|
||||
const std::vector<DrawingGeometry::Face *> & DrawViewPart::getFaceGeometry() const
|
||||
const std::vector<TechDrawGeometry::Face *> & DrawViewPart::getFaceGeometry() const
|
||||
{
|
||||
return geometryObject->getFaceGeometry();
|
||||
}
|
||||
@@ -253,7 +253,7 @@ const std::vector<int> & DrawViewPart::getFaceReferences() const
|
||||
return geometryObject->getFaceRefs();
|
||||
}
|
||||
|
||||
const std::vector<DrawingGeometry::BaseGeom *> & DrawViewPart::getEdgeGeometry() const
|
||||
const std::vector<TechDrawGeometry::BaseGeom *> & DrawViewPart::getEdgeGeometry() const
|
||||
{
|
||||
return geometryObject->getEdgeGeometry();
|
||||
}
|
||||
@@ -264,7 +264,7 @@ const std::vector<int> & 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<Part::Feature*>(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<Part::Feature*>(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<DrawingGeometry::Vertex *> &verts = getVertexGeometry();
|
||||
const std::vector<TechDrawGeometry::Vertex *> &verts = getVertexGeometry();
|
||||
if (verts.empty()) {
|
||||
Base::Console().Log("INFO - getVertexGeomByRef(%d) - no Vertex Geometry. Probably restoring?\n",ref);
|
||||
return NULL;
|
||||
}
|
||||
const std::vector<int> &vertRefs = getVertexReferences();
|
||||
std::vector<DrawingGeometry::Vertex *>::const_iterator vert = verts.begin();
|
||||
std::vector<TechDrawGeometry::Vertex *>::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<DrawingGeometry::BaseGeom *> &geoms = getEdgeGeometry();
|
||||
const std::vector<TechDrawGeometry::BaseGeom *> &geoms = getEdgeGeometry();
|
||||
if (geoms.empty()) {
|
||||
Base::Console().Log("INFO - getEdgeGeomByRef(%d) - no Edge Geometry. Probably restoring?\n",ref);
|
||||
return NULL;
|
||||
}
|
||||
const std::vector<int> &refs = getEdgeReferences();
|
||||
std::vector<DrawingGeometry::BaseGeom*>::const_iterator it = geoms.begin();
|
||||
std::vector<TechDrawGeometry::BaseGeom*>::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<DrawingGeometry::BaseGeom *> &geoms = getEdgeGeometry();
|
||||
const std::vector<TechDrawGeometry::BaseGeom *> &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<DrawingGeometry::Vertex *> &geoms = getVertexGeometry();
|
||||
const std::vector<TechDrawGeometry::Vertex *> &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<DrawingGeometry::Vertex*> &verts = getVertexGeometry();
|
||||
const std::vector<DrawingGeometry::BaseGeom*> &edges = getEdgeGeometry();
|
||||
const std::vector<TechDrawGeometry::Vertex*> &verts = getVertexGeometry();
|
||||
const std::vector<TechDrawGeometry::BaseGeom*> &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<TechDraw::DrawViewPart>;
|
||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawViewPart>;
|
||||
}
|
||||
|
||||
@@ -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<TechDraw::DrawHatch*> getHatches(void) const;
|
||||
|
||||
const std::vector<DrawingGeometry::Vertex *> & getVertexGeometry() const;
|
||||
const std::vector<DrawingGeometry::BaseGeom *> & getEdgeGeometry() const;
|
||||
const std::vector<DrawingGeometry::Face *> & getFaceGeometry() const;
|
||||
const std::vector<TechDrawGeometry::Vertex *> & getVertexGeometry() const;
|
||||
const std::vector<TechDrawGeometry::BaseGeom *> & getEdgeGeometry() const;
|
||||
const std::vector<TechDrawGeometry::Face *> & 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<int> & getVertexReferences() const;
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
protected:
|
||||
void onChanged(const App::Property* prop);
|
||||
|
||||
DrawingGeometry::GeometryObject *geometryObject;
|
||||
TechDrawGeometry::GeometryObject *geometryObject;
|
||||
Base::BoundBox3d bbox;
|
||||
|
||||
private:
|
||||
|
||||
@@ -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">
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="WandererFan" EMail="wandererfan@gmail.com" />
|
||||
<UserDocu>Feature for creating and manipulating Drawing Part Views</UserDocu>
|
||||
|
||||
@@ -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">
|
||||
<Documentation>
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
#include <Mod/Part/App/Geometry.h>
|
||||
|
||||
#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<DrawingGeometry::Face *> §ionFace) const {
|
||||
void DrawViewSection::getSectionSurface(std::vector<TechDrawGeometry::Face *> §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<TechDraw::DrawViewSection>;
|
||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawViewSection>;
|
||||
}
|
||||
|
||||
@@ -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<DrawingGeometry::Face *> §ionFace) const;
|
||||
void getSectionSurface(std::vector<TechDrawGeometry::Face *> §ionFace) const;
|
||||
|
||||
protected:
|
||||
TopoDS_Shape result;
|
||||
|
||||
@@ -142,5 +142,5 @@ template<> const char* TechDraw::DrawViewSymbolPython::getViewProviderName(void)
|
||||
/// @endcond
|
||||
|
||||
// explicit template instantiation
|
||||
template class DrawingExport FeaturePythonT<TechDraw::DrawViewSymbol>;
|
||||
template class TechDrawExport FeaturePythonT<TechDraw::DrawViewSymbol>;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace TechDraw
|
||||
{
|
||||
|
||||
|
||||
class DrawingExport DrawViewSymbol : public TechDraw::DrawView
|
||||
class TechDrawExport DrawViewSymbol : public TechDraw::DrawView
|
||||
{
|
||||
PROPERTY_HEADER(TechDraw::DrawViewSymbol);
|
||||
|
||||
|
||||
@@ -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">
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="WandererFan" EMail="wandererfan@gmail.com" />
|
||||
<UserDocu>Feature for creating and manipulating Drawing SVG Symbol Views</UserDocu>
|
||||
|
||||
@@ -118,35 +118,35 @@ std::vector<Base::Vector2D> BaseGeom::findEndPoints()
|
||||
{
|
||||
std::vector<Base::Vector2D> result;
|
||||
switch(this->geomType) {
|
||||
case DrawingGeometry::CIRCLE: {
|
||||
DrawingGeometry::Circle *geom = static_cast<DrawingGeometry::Circle *>(this);
|
||||
case TechDrawGeometry::CIRCLE: {
|
||||
TechDrawGeometry::Circle *geom = static_cast<TechDrawGeometry::Circle *>(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<DrawingGeometry::AOC *>(this);
|
||||
case TechDrawGeometry::ARCOFCIRCLE: {
|
||||
TechDrawGeometry::AOC *geom = static_cast<TechDrawGeometry::AOC *>(this);
|
||||
result.push_back(geom->startPnt);
|
||||
result.push_back(geom->endPnt);
|
||||
} break;
|
||||
case DrawingGeometry::ELLIPSE: {
|
||||
DrawingGeometry::Ellipse *geom = static_cast<DrawingGeometry::Ellipse *>(this);
|
||||
case TechDrawGeometry::ELLIPSE: {
|
||||
TechDrawGeometry::Ellipse *geom = static_cast<TechDrawGeometry::Ellipse *>(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<DrawingGeometry::AOE *>(this);
|
||||
case TechDrawGeometry::ARCOFELLIPSE: {
|
||||
TechDrawGeometry::AOE *geom = static_cast<TechDrawGeometry::AOE *>(this);
|
||||
result.push_back(geom->startPnt);
|
||||
result.push_back(geom->endPnt);
|
||||
} break;
|
||||
case DrawingGeometry::BSPLINE: {
|
||||
DrawingGeometry::BSpline *geom = static_cast<DrawingGeometry::BSpline *>(this);
|
||||
case TechDrawGeometry::BSPLINE: {
|
||||
TechDrawGeometry::BSpline *geom = static_cast<TechDrawGeometry::BSpline *>(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<DrawingGeometry::Generic *>(this);
|
||||
case TechDrawGeometry::GENERIC: {
|
||||
TechDrawGeometry::Generic *geom = static_cast<TechDrawGeometry::Generic *>(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<DrawingGeometry::BaseGeom*> DrawingExport chainGeoms(std::vector<DrawingGeometry::BaseGeom*> geoms)
|
||||
std::vector<TechDrawGeometry::BaseGeom*> TechDrawExport chainGeoms(std::vector<TechDrawGeometry::BaseGeom*> geoms)
|
||||
{
|
||||
std::vector<DrawingGeometry::BaseGeom*> result;
|
||||
std::vector<TechDrawGeometry::BaseGeom*> result;
|
||||
std::vector<bool> used(geoms.size(),false);
|
||||
double tolerance = 0.0;
|
||||
|
||||
@@ -403,7 +403,7 @@ std::vector<DrawingGeometry::BaseGeom*> DrawingExport chainGeoms(std::vector<Dra
|
||||
for (unsigned int i = 1; i < geoms.size(); i++) { //do size-1 more edges
|
||||
getNextReturn next = nextGeom(atPoint,geoms,used,tolerance);
|
||||
if (next.index) { //found an unused edge with vertex == atPoint
|
||||
DrawingGeometry::BaseGeom* nextEdge = geoms.at(next.index);
|
||||
TechDrawGeometry::BaseGeom* nextEdge = geoms.at(next.index);
|
||||
used[next.index] = true;
|
||||
nextEdge->reversed = next.reversed;
|
||||
result.push_back(nextEdge);
|
||||
@@ -422,13 +422,13 @@ std::vector<DrawingGeometry::BaseGeom*> DrawingExport chainGeoms(std::vector<Dra
|
||||
}
|
||||
|
||||
//! find an unused geom starts or ends at atPoint. returns index[1:geoms.size()),reversed [true,false]
|
||||
getNextReturn DrawingExport nextGeom(Base::Vector2D atPoint,
|
||||
std::vector<DrawingGeometry::BaseGeom*> geoms,
|
||||
getNextReturn TechDrawExport nextGeom(Base::Vector2D atPoint,
|
||||
std::vector<TechDrawGeometry::BaseGeom*> geoms,
|
||||
std::vector<bool> used,
|
||||
double tolerance)
|
||||
{
|
||||
getNextReturn result(0,false);
|
||||
std::vector<DrawingGeometry::BaseGeom*>::iterator itGeom = geoms.begin();
|
||||
std::vector<TechDrawGeometry::BaseGeom*>::iterator itGeom = geoms.begin();
|
||||
for (; itGeom != geoms.end(); itGeom++) {
|
||||
unsigned int index = itGeom - geoms.begin();
|
||||
if (used[index]) {
|
||||
|
||||
@@ -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<DrawingGeometry::BaseGeom*> chainGeoms(std::vector<DrawingGeometry::BaseGeom*> geoms);
|
||||
std::vector<TechDrawGeometry::BaseGeom*> chainGeoms(std::vector<TechDrawGeometry::BaseGeom*> geoms);
|
||||
getNextReturn nextGeom(Base::Vector2D atPoint,
|
||||
std::vector<DrawingGeometry::BaseGeom*> geoms,
|
||||
std::vector<TechDrawGeometry::BaseGeom*> geoms,
|
||||
std::vector<bool> used,
|
||||
double tolerance);
|
||||
|
||||
|
||||
@@ -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<DrawingGeometry::Face *> &projFaces) const
|
||||
std::vector<TechDrawGeometry::Face *> &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<DrawingGeometry::Face *> &projFaces,
|
||||
std::vector<TechDrawGeometry::Face *> &projFaces,
|
||||
std::vector<int> &faceRefs) const
|
||||
{
|
||||
#if MOD_TECHDRAW_HANDLE_FACES
|
||||
@@ -783,7 +783,7 @@ void GeometryObject::extractFaces(HLRBRep_Algo *myAlgo,
|
||||
std::vector<TopoDS_Wire> 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<BaseGeom *> &edgeGeom = getEdgeGeometry();
|
||||
std::vector<BaseGeom*>::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<Base::Vector2D> 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);
|
||||
}
|
||||
|
||||
@@ -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<int> & getEdgeRefs() const { return edgeReferences; };
|
||||
const std::vector<int> & 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<DrawingGeometry::Face *> &result) const;
|
||||
std::vector<TechDrawGeometry::Face *> &result) const;
|
||||
|
||||
/// Process 3D shape to get 2D geometry
|
||||
/*!
|
||||
@@ -128,7 +128,7 @@ protected:
|
||||
const TopoDS_Shape &S,
|
||||
bool visible,
|
||||
ExtractionType extractionType,
|
||||
std::vector<DrawingGeometry::Face *> &projFaces,
|
||||
std::vector<TechDrawGeometry::Face *> &projFaces,
|
||||
std::vector<int> &faceRefs) const;
|
||||
|
||||
int calculateGeometry(const TopoDS_Shape &input, ExtractionType extractionType, std::vector<BaseGeom *> &geoms) const;
|
||||
|
||||
@@ -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@ \
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user