+ move vec_traits into its own module
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5363 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
parent
00030a71c0
commit
dfbea1de96
|
@ -26,6 +26,7 @@
|
||||||
#ifndef _PreComp_
|
#ifndef _PreComp_
|
||||||
# include <sstream>
|
# include <sstream>
|
||||||
# include <BRep_Builder.hxx>
|
# include <BRep_Builder.hxx>
|
||||||
|
# include <Standard_Failure.hxx>
|
||||||
# include <TopoDS_Compound.hxx>
|
# include <TopoDS_Compound.hxx>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include <Base/FileInfo.h>
|
#include <Base/FileInfo.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <Standard_Failure.hxx>
|
||||||
|
|
||||||
using namespace Gui;
|
using namespace Gui;
|
||||||
using namespace DrawingGui;
|
using namespace DrawingGui;
|
||||||
|
|
|
@ -230,6 +230,7 @@ SET(Part_SRCS
|
||||||
edgecluster.h
|
edgecluster.h
|
||||||
modelRefine.cpp
|
modelRefine.cpp
|
||||||
modelRefine.h
|
modelRefine.h
|
||||||
|
Tools.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(Part_Scripts
|
SET(Part_Scripts
|
||||||
|
|
|
@ -189,6 +189,7 @@ include_HEADERS=\
|
||||||
ProgressIndicator.h \
|
ProgressIndicator.h \
|
||||||
PropertyGeometryList.h \
|
PropertyGeometryList.h \
|
||||||
PropertyTopoShape.h \
|
PropertyTopoShape.h \
|
||||||
|
Tools.h \
|
||||||
TopoShape.h
|
TopoShape.h
|
||||||
|
|
||||||
|
|
||||||
|
|
89
src/Mod/Part/App/Tools.h
Normal file
89
src/Mod/Part/App/Tools.h
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (c) 2011 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 PART_TOOLS_H
|
||||||
|
#define PART_TOOLS_H
|
||||||
|
|
||||||
|
#include <gp_Pnt.hxx>
|
||||||
|
#include <gp_Vec.hxx>
|
||||||
|
#include <gp_Dir.hxx>
|
||||||
|
#include <gp_XYZ.hxx>
|
||||||
|
|
||||||
|
namespace Base {
|
||||||
|
// Specialization for gp_Pnt
|
||||||
|
template <>
|
||||||
|
struct vec_traits<gp_Pnt> {
|
||||||
|
typedef gp_Pnt vec_type;
|
||||||
|
typedef double float_type;
|
||||||
|
vec_traits(const vec_type& v) : v(v){}
|
||||||
|
inline float_type x() { return v.X(); }
|
||||||
|
inline float_type y() { return v.Y(); }
|
||||||
|
inline float_type z() { return v.Z(); }
|
||||||
|
private:
|
||||||
|
const vec_type& v;
|
||||||
|
};
|
||||||
|
// Specialization for gp_Vec
|
||||||
|
template <>
|
||||||
|
struct vec_traits<gp_Vec> {
|
||||||
|
typedef gp_Vec vec_type;
|
||||||
|
typedef double float_type;
|
||||||
|
vec_traits(const vec_type& v) : v(v){}
|
||||||
|
inline float_type x() { return v.X(); }
|
||||||
|
inline float_type y() { return v.Y(); }
|
||||||
|
inline float_type z() { return v.Z(); }
|
||||||
|
private:
|
||||||
|
const vec_type& v;
|
||||||
|
};
|
||||||
|
// Specialization for gp_Dir
|
||||||
|
template <>
|
||||||
|
struct vec_traits<gp_Dir> {
|
||||||
|
typedef gp_Dir vec_type;
|
||||||
|
typedef double float_type;
|
||||||
|
vec_traits(const vec_type& v) : v(v){}
|
||||||
|
inline float_type x() { return v.X(); }
|
||||||
|
inline float_type y() { return v.Y(); }
|
||||||
|
inline float_type z() { return v.Z(); }
|
||||||
|
private:
|
||||||
|
const vec_type& v;
|
||||||
|
};
|
||||||
|
// Specialization for gp_XYZ
|
||||||
|
template <>
|
||||||
|
struct vec_traits<gp_XYZ> {
|
||||||
|
typedef gp_XYZ vec_type;
|
||||||
|
typedef double float_type;
|
||||||
|
vec_traits(const vec_type& v) : v(v){}
|
||||||
|
inline float_type x() { return v.X(); }
|
||||||
|
inline float_type y() { return v.Y(); }
|
||||||
|
inline float_type z() { return v.Z(); }
|
||||||
|
private:
|
||||||
|
const vec_type& v;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Part
|
||||||
|
{
|
||||||
|
|
||||||
|
} //namespace Part
|
||||||
|
|
||||||
|
|
||||||
|
#endif // PART_TOOLS_H
|
|
@ -156,6 +156,7 @@
|
||||||
#include "TopoShapeVertexPy.h"
|
#include "TopoShapeVertexPy.h"
|
||||||
#include "ProgressIndicator.h"
|
#include "ProgressIndicator.h"
|
||||||
#include "modelRefine.h"
|
#include "modelRefine.h"
|
||||||
|
#include "Tools.h"
|
||||||
|
|
||||||
using namespace Part;
|
using namespace Part;
|
||||||
|
|
||||||
|
|
|
@ -25,53 +25,14 @@
|
||||||
#define PART_TOPOSHAPE_H
|
#define PART_TOPOSHAPE_H
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <gp_Pnt.hxx>
|
|
||||||
#include <gp_Vec.hxx>
|
|
||||||
#include <TopoDS_Compound.hxx>
|
#include <TopoDS_Compound.hxx>
|
||||||
#include <TopoDS_Wire.hxx>
|
#include <TopoDS_Wire.hxx>
|
||||||
#include <TopTools_ListOfShape.hxx>
|
#include <TopTools_ListOfShape.hxx>
|
||||||
#include <App/ComplexGeoData.h>
|
#include <App/ComplexGeoData.h>
|
||||||
|
|
||||||
|
class gp_Ax1;
|
||||||
class gp_Ax2;
|
class gp_Ax2;
|
||||||
|
class gp_Vec;
|
||||||
namespace Base {
|
|
||||||
// Specialization for gp_Pnt
|
|
||||||
template <>
|
|
||||||
struct vec_traits<gp_Pnt> {
|
|
||||||
typedef gp_Pnt vec_type;
|
|
||||||
typedef double float_type;
|
|
||||||
vec_traits(const vec_type& v) : v(v){}
|
|
||||||
inline float_type x() { return v.X(); }
|
|
||||||
inline float_type y() { return v.Y(); }
|
|
||||||
inline float_type z() { return v.Z(); }
|
|
||||||
private:
|
|
||||||
const vec_type& v;
|
|
||||||
};
|
|
||||||
// Specialization for gp_Vec
|
|
||||||
template <>
|
|
||||||
struct vec_traits<gp_Vec> {
|
|
||||||
typedef gp_Vec vec_type;
|
|
||||||
typedef double float_type;
|
|
||||||
vec_traits(const vec_type& v) : v(v){}
|
|
||||||
inline float_type x() { return v.X(); }
|
|
||||||
inline float_type y() { return v.Y(); }
|
|
||||||
inline float_type z() { return v.Z(); }
|
|
||||||
private:
|
|
||||||
const vec_type& v;
|
|
||||||
};
|
|
||||||
// Specialization for gp_Dir
|
|
||||||
template <>
|
|
||||||
struct vec_traits<gp_Dir> {
|
|
||||||
typedef gp_Dir vec_type;
|
|
||||||
typedef double float_type;
|
|
||||||
vec_traits(const vec_type& v) : v(v){}
|
|
||||||
inline float_type x() { return v.X(); }
|
|
||||||
inline float_type y() { return v.Y(); }
|
|
||||||
inline float_type z() { return v.Z(); }
|
|
||||||
private:
|
|
||||||
const vec_type& v;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Part
|
namespace Part
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,9 +23,10 @@
|
||||||
|
|
||||||
#include "PreCompiled.h"
|
#include "PreCompiled.h"
|
||||||
#include <BRep_Builder.hxx>
|
#include <BRep_Builder.hxx>
|
||||||
|
#include <Standard_Failure.hxx>
|
||||||
#include <TopoDS_CompSolid.hxx>
|
#include <TopoDS_CompSolid.hxx>
|
||||||
|
|
||||||
#include "Mod/Part/App/TopoShape.h"
|
#include "TopoShape.h"
|
||||||
|
|
||||||
// inclusion of the generated files (generated out of TopoShapeCompSolidPy.xml)
|
// inclusion of the generated files (generated out of TopoShapeCompSolidPy.xml)
|
||||||
#include "TopoShapeSolidPy.h"
|
#include "TopoShapeSolidPy.h"
|
||||||
|
|
|
@ -23,8 +23,9 @@
|
||||||
|
|
||||||
#include "PreCompiled.h"
|
#include "PreCompiled.h"
|
||||||
|
|
||||||
#include "Mod/Part/App/TopoShape.h"
|
#include "TopoShape.h"
|
||||||
#include <BRep_Builder.hxx>
|
#include <BRep_Builder.hxx>
|
||||||
|
#include <Standard_Failure.hxx>
|
||||||
#include <TopoDS_Compound.hxx>
|
#include <TopoDS_Compound.hxx>
|
||||||
|
|
||||||
// inclusion of the generated files (generated out of TopoShapeCompoundPy.xml)
|
// inclusion of the generated files (generated out of TopoShapeCompoundPy.xml)
|
||||||
|
|
|
@ -40,7 +40,8 @@
|
||||||
#include <Base/VectorPy.h>
|
#include <Base/VectorPy.h>
|
||||||
#include <Base/GeometryPyCXX.h>
|
#include <Base/GeometryPyCXX.h>
|
||||||
|
|
||||||
#include "Mod/Part/App/TopoShape.h"
|
#include "TopoShape.h"
|
||||||
|
#include "Tools.h"
|
||||||
|
|
||||||
// inclusion of the generated files (generated out of TopoShapeSolidPy.xml)
|
// inclusion of the generated files (generated out of TopoShapeSolidPy.xml)
|
||||||
#include "TopoShapeShellPy.h"
|
#include "TopoShapeShellPy.h"
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include <Gui/Command.h>
|
#include <Gui/Command.h>
|
||||||
#include <Gui/View3DInventor.h>
|
#include <Gui/View3DInventor.h>
|
||||||
#include <Gui/View3DInventorViewer.h>
|
#include <Gui/View3DInventorViewer.h>
|
||||||
|
#include <Mod/Part/App/Tools.h>
|
||||||
|
|
||||||
#include "DlgPrimitives.h"
|
#include "DlgPrimitives.h"
|
||||||
|
|
||||||
|
@ -143,21 +144,6 @@ DlgPrimitives::~DlgPrimitives()
|
||||||
viewer->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), pickCallback,this);
|
viewer->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), pickCallback,this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Base {
|
|
||||||
// Specialization for gp_XYZ
|
|
||||||
template <>
|
|
||||||
struct vec_traits<gp_XYZ> {
|
|
||||||
typedef gp_XYZ vec_type;
|
|
||||||
typedef double float_type;
|
|
||||||
vec_traits(const vec_type& v) : v(v){}
|
|
||||||
inline float_type x() { return v.X(); }
|
|
||||||
inline float_type y() { return v.Y(); }
|
|
||||||
inline float_type z() { return v.Z(); }
|
|
||||||
private:
|
|
||||||
const vec_type& v;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
QString DlgPrimitives::toPlacement() const
|
QString DlgPrimitives::toPlacement() const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user