removed dxf related files and code that used them
This commit is contained in:
parent
797a6f1ddb
commit
0d5aee2f62
|
@ -1,31 +0,0 @@
|
|||
// AreaDxf.cpp
|
||||
// Copyright (c) 2011, Dan Heeks
|
||||
// This program is released under the BSD license. See the file COPYING for details.
|
||||
|
||||
#include "AreaDxf.h"
|
||||
#include "Area.h"
|
||||
|
||||
AreaDxfRead::AreaDxfRead(CArea* area, const char* filepath):CDxfRead(filepath), m_area(area){}
|
||||
|
||||
void AreaDxfRead::StartCurveIfNecessary(const double* s)
|
||||
{
|
||||
Point ps(s);
|
||||
if((m_area->m_curves.size() == 0) || (m_area->m_curves.back().m_vertices.size() == 0) || (m_area->m_curves.back().m_vertices.back().m_p != ps))
|
||||
{
|
||||
// start a new curve
|
||||
m_area->m_curves.push_back(CCurve());
|
||||
m_area->m_curves.back().m_vertices.push_back(ps);
|
||||
}
|
||||
}
|
||||
|
||||
void AreaDxfRead::OnReadLine(const double* s, const double* e)
|
||||
{
|
||||
StartCurveIfNecessary(s);
|
||||
m_area->m_curves.back().m_vertices.push_back(Point(e));
|
||||
}
|
||||
|
||||
void AreaDxfRead::OnReadArc(const double* s, const double* e, const double* c, bool dir)
|
||||
{
|
||||
StartCurveIfNecessary(s);
|
||||
m_area->m_curves.back().m_vertices.push_back(CVertex(dir?1:0, Point(e), Point(c)));
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
// AreaDxf.h
|
||||
// Copyright (c) 2011, Dan Heeks
|
||||
// This program is released under the BSD license. See the file COPYING for details.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "dxf.h"
|
||||
|
||||
class CSketch;
|
||||
class CArea;
|
||||
class CCurve;
|
||||
|
||||
class AreaDxfRead : public CDxfRead{
|
||||
void StartCurveIfNecessary(const double* s);
|
||||
|
||||
public:
|
||||
CArea* m_area;
|
||||
AreaDxfRead(CArea* area, const char* filepath);
|
||||
|
||||
// AreaDxfRead's virtual functions
|
||||
void OnReadLine(const double* s, const double* e);
|
||||
void OnReadArc(const double* s, const double* e, const double* c, bool dir);
|
||||
};
|
150
src/Mod/Path/libarea/CMakeLists.txt
Normal file
150
src/Mod/Path/libarea/CMakeLists.txt
Normal file
|
@ -0,0 +1,150 @@
|
|||
project(area)
|
||||
|
||||
cmake_minimum_required(VERSION 2.4)
|
||||
|
||||
# Turn compiler warnings up to 11, at least with gcc.
|
||||
if (CMAKE_BUILD_TOOL MATCHES "make")
|
||||
MESSAGE(STATUS "setting gcc options: -Wall -Werror -Wno-deprecated -pedantic-errors")
|
||||
# NON-optimized build:
|
||||
# add_definitions( -Wall -Wno-deprecated -Werror -pedantic-errors)
|
||||
add_definitions(-fPIC)
|
||||
endif (CMAKE_BUILD_TOOL MATCHES "make")
|
||||
|
||||
option(BUILD_TYPE
|
||||
"Build type: Release=ON/Debug=OFF " ON)
|
||||
|
||||
if (BUILD_TYPE)
|
||||
MESSAGE(STATUS " CMAKE_BUILD_TYPE = Release")
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif(BUILD_TYPE)
|
||||
|
||||
if (NOT BUILD_TYPE)
|
||||
MESSAGE(STATUS " CMAKE_BUILD_TYPE = Debug")
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
endif(NOT BUILD_TYPE)
|
||||
|
||||
# this figures out the Python include directories and adds them to the
|
||||
# header file search path
|
||||
execute_process(
|
||||
COMMAND python-config --includes
|
||||
COMMAND sed -r "s/-I//g; s/ +/;/g"
|
||||
COMMAND tr -d '\n'
|
||||
OUTPUT_VARIABLE Python_Includes
|
||||
)
|
||||
message(STATUS "Python include dir:" ${Python_Includes})
|
||||
|
||||
include_directories(${Python_Includes})
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
find_package( Boost COMPONENTS python REQUIRED) # find BOOST and boost-python
|
||||
if(Boost_FOUND)
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
MESSAGE(STATUS "found Boost: " ${Boost_LIB_VERSION})
|
||||
MESSAGE(STATUS "boost-incude dirs are: " ${Boost_INCLUDE_DIRS})
|
||||
MESSAGE(STATUS "boost-python lib is: " ${Boost_PYTHON_LIBRARY})
|
||||
MESSAGE(STATUS "boost_LIBRARY_DIRS is: " ${Boost_LIBRARY_DIRS})
|
||||
MESSAGE(STATUS "Boost_LIBRARIES is: " ${Boost_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# this defines the source-files for library
|
||||
set(AREA_SRC_COMMON
|
||||
Arc.cpp
|
||||
Area.cpp
|
||||
AreaOrderer.cpp
|
||||
AreaPocket.cpp
|
||||
Circle.cpp
|
||||
Curve.cpp
|
||||
|
||||
kurve/Construction.cpp
|
||||
kurve/Finite.cpp
|
||||
kurve/kurve.cpp
|
||||
kurve/Matrix.cpp
|
||||
kurve/offset.cpp
|
||||
)
|
||||
|
||||
|
||||
set(AREA_SRC_CLIPPER
|
||||
AreaClipper.cpp
|
||||
|
||||
clipper.cpp
|
||||
)
|
||||
|
||||
# this defines the additional source-files for python module (wrapper to libarea)
|
||||
set(PYAREA_SRC
|
||||
PythonStuff.cpp
|
||||
)
|
||||
|
||||
# this defines the headers
|
||||
if(DEFINED INCLUDE_INSTALL_DIR)
|
||||
set(includedir ${INCLUDE_INSTALL_DIR})
|
||||
else(DEFINED INCLUDE_INSTALL_DIR)
|
||||
set(INCLUDE_INSTALL_DIR include)
|
||||
set(includedir ${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR})
|
||||
endif(DEFINED INCLUDE_INSTALL_DIR)
|
||||
|
||||
file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/kurve/*.h")
|
||||
install(FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}/area/kurve COMPONENT headers)
|
||||
file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
|
||||
install(FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}/area COMPONENT headers)
|
||||
|
||||
# include directories
|
||||
|
||||
# this makes the shared library
|
||||
|
||||
add_library(
|
||||
libarea
|
||||
SHARED
|
||||
${AREA_SRC_COMMON}
|
||||
${AREA_SRC_CLIPPER}
|
||||
)
|
||||
|
||||
set_target_properties(libarea PROPERTIES PREFIX "")
|
||||
set_target_properties(libarea PROPERTIES SOVERSION 0)
|
||||
|
||||
# this part allow to support multi-arch
|
||||
# ie. Debian builder sets correctly the target path according to architecture
|
||||
# e.g. /usr/lib/i386-linux-gnu, /usr/lib/x86_64-linux-gnu
|
||||
# TODO: Support this feature
|
||||
#if(DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
# set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
|
||||
#else(DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
# set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
#endif(DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
|
||||
install(TARGETS libarea LIBRARY DESTINATION lib/ COMPONENT libraries)
|
||||
message(STATUS "Library will be installed to: " ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
|
||||
|
||||
# this makes the Python module
|
||||
|
||||
add_library(
|
||||
area
|
||||
MODULE
|
||||
${AREA_SRC_COMMON}
|
||||
${AREA_SRC_CLIPPER}
|
||||
${PYAREA_SRC}
|
||||
)
|
||||
|
||||
|
||||
target_link_libraries(area ${Boost_LIBRARIES})
|
||||
set_target_properties(area PROPERTIES PREFIX "")
|
||||
|
||||
# this figures out where to install the Python modules
|
||||
execute_process(
|
||||
COMMAND python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
|
||||
OUTPUT_VARIABLE Python_site_packages
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# strip away /usr/local/ because that is what CMAKE_INSTALL_PREFIX is set to
|
||||
# also, since there is no leading "/", it makes ${Python_site_packages} a relative path.
|
||||
STRING(REGEX REPLACE "/usr/local/(.*)$" "\\1" Python_site_packages "${Python_site_packages}" )
|
||||
STRING(REGEX REPLACE "/usr/(.*)$" "\\1" Python_site_packages "${Python_site_packages}" )
|
||||
|
||||
message(STATUS "Python module will be installed to: " ${CMAKE_INSTALL_PREFIX}/${Python_site_packages})
|
||||
|
||||
# this installs the python library
|
||||
install(
|
||||
TARGETS area
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/${Python_site_packages}
|
||||
)
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "Area.h"
|
||||
#include "Point.h"
|
||||
#include "AreaDxf.h"
|
||||
#include "kurve/geometry.h"
|
||||
|
||||
#if _DEBUG
|
||||
|
@ -113,13 +112,6 @@ static bool holes_linked()
|
|||
return CArea::HolesLinked();
|
||||
}
|
||||
|
||||
static CArea AreaFromDxf(const char* filepath)
|
||||
{
|
||||
CArea area;
|
||||
AreaDxfRead dxf(&area, filepath);
|
||||
dxf.DoRead();
|
||||
return area;
|
||||
}
|
||||
|
||||
static void append_point(CCurve& c, const Point& p)
|
||||
{
|
||||
|
@ -160,10 +152,6 @@ boost::python::list SplitArea(const CArea& a)
|
|||
return alist;
|
||||
}
|
||||
|
||||
void dxfArea(CArea& area, const char* str)
|
||||
{
|
||||
area = CArea();
|
||||
}
|
||||
|
||||
boost::python::list getCurveSpans(const CCurve& c)
|
||||
{
|
||||
|
@ -404,6 +392,5 @@ BOOST_PYTHON_MODULE(area) {
|
|||
bp::def("set_units", set_units);
|
||||
bp::def("get_units", get_units);
|
||||
bp::def("holes_linked", holes_linked);
|
||||
bp::def("AreaFromDxf", AreaFromDxf);
|
||||
bp::def("TangentialArc", TangentialArc);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,156 +0,0 @@
|
|||
// dxf.h
|
||||
// Copyright (c) 2009, Dan Heeks
|
||||
// This program is released under the BSD license. See the file COPYING for details.
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
//Following is required to be defined on Ubuntu with OCC 6.3.1
|
||||
#ifndef HAVE_IOSTREAM
|
||||
#define HAVE_IOSTREAM
|
||||
#endif
|
||||
|
||||
typedef int Aci_t; // AutoCAD color index
|
||||
|
||||
typedef enum
|
||||
{
|
||||
eUnspecified = 0, // Unspecified (No units)
|
||||
eInches,
|
||||
eFeet,
|
||||
eMiles,
|
||||
eMillimeters,
|
||||
eCentimeters,
|
||||
eMeters,
|
||||
eKilometers,
|
||||
eMicroinches,
|
||||
eMils,
|
||||
eYards,
|
||||
eAngstroms,
|
||||
eNanometers,
|
||||
eMicrons,
|
||||
eDecimeters,
|
||||
eDekameters,
|
||||
eHectometers,
|
||||
eGigameters,
|
||||
eAstronomicalUnits,
|
||||
eLightYears,
|
||||
eParsecs
|
||||
} eDxfUnits_t;
|
||||
|
||||
|
||||
struct SplineData
|
||||
{
|
||||
double norm[3];
|
||||
int degree;
|
||||
int knots;
|
||||
int control_points;
|
||||
int fit_points;
|
||||
int flag;
|
||||
std::list<double> starttanx;
|
||||
std::list<double> starttany;
|
||||
std::list<double> starttanz;
|
||||
std::list<double> endtanx;
|
||||
std::list<double> endtany;
|
||||
std::list<double> endtanz;
|
||||
std::list<double> knot;
|
||||
std::list<double> weight;
|
||||
std::list<double> controlx;
|
||||
std::list<double> controly;
|
||||
std::list<double> controlz;
|
||||
std::list<double> fitx;
|
||||
std::list<double> fity;
|
||||
std::list<double> fitz;
|
||||
};
|
||||
|
||||
class CDxfWrite{
|
||||
private:
|
||||
std::ofstream* m_ofs;
|
||||
bool m_fail;
|
||||
|
||||
public:
|
||||
CDxfWrite(const char* filepath);
|
||||
~CDxfWrite();
|
||||
|
||||
bool Failed(){return m_fail;}
|
||||
|
||||
void WriteLine(const double* s, const double* e, const char* layer_name );
|
||||
void WritePoint(const double*, const char*);
|
||||
void WriteArc(const double* s, const double* e, const double* c, bool dir, const char* layer_name );
|
||||
void WriteEllipse(const double* c, double major_radius, double minor_radius, double rotation, double start_angle, double end_angle, bool dir, const char* layer_name );
|
||||
void WriteCircle(const double* c, double radius, const char* layer_name );
|
||||
};
|
||||
|
||||
// derive a class from this and implement it's virtual functions
|
||||
class CDxfRead{
|
||||
private:
|
||||
std::ifstream* m_ifs;
|
||||
|
||||
bool m_fail;
|
||||
char m_str[1024];
|
||||
char m_unused_line[1024];
|
||||
eDxfUnits_t m_eUnits;
|
||||
char m_layer_name[1024];
|
||||
char m_section_name[1024];
|
||||
char m_block_name[1024];
|
||||
bool m_ignore_errors;
|
||||
|
||||
|
||||
typedef std::map< std::string,Aci_t > LayerAciMap_t;
|
||||
LayerAciMap_t m_layer_aci; // layer names -> layer color aci map
|
||||
|
||||
bool ReadUnits();
|
||||
bool ReadLayer();
|
||||
bool ReadLine();
|
||||
bool ReadText();
|
||||
bool ReadArc();
|
||||
bool ReadCircle();
|
||||
bool ReadEllipse();
|
||||
bool ReadPoint();
|
||||
bool ReadSpline();
|
||||
bool ReadLwPolyLine();
|
||||
bool ReadPolyLine();
|
||||
bool ReadVertex(double *pVertex, bool *bulge_found, double *bulge);
|
||||
void OnReadArc(double start_angle, double end_angle, double radius, const double* c);
|
||||
void OnReadCircle(const double* c, double radius);
|
||||
void OnReadEllipse(const double* c, const double* m, double ratio, double start_angle, double end_angle);
|
||||
|
||||
void get_line();
|
||||
void put_line(const char *value);
|
||||
void DerefACI();
|
||||
|
||||
protected:
|
||||
Aci_t m_aci; // manifest color name or 256 for layer color
|
||||
|
||||
public:
|
||||
CDxfRead(const char* filepath); // this opens the file
|
||||
~CDxfRead(); // this closes the file
|
||||
|
||||
bool Failed(){return m_fail;}
|
||||
void DoRead(const bool ignore_errors = false); // this reads the file and calls the following functions
|
||||
|
||||
double mm( const double & value ) const;
|
||||
|
||||
bool IgnoreErrors() const { return(m_ignore_errors); }
|
||||
|
||||
virtual void OnReadLine(const double* s, const double* e){}
|
||||
virtual void OnReadPoint(const double* s){}
|
||||
virtual void OnReadText(const double* point, const double height, const char* text){}
|
||||
virtual void OnReadArc(const double* s, const double* e, const double* c, bool dir){}
|
||||
virtual void OnReadCircle(const double* s, const double* c, bool dir){}
|
||||
virtual void OnReadEllipse(const double* c, double major_radius, double minor_radius, double rotation, double start_angle, double end_angle, bool dir){}
|
||||
virtual void OnReadSpline(struct SplineData& sd){}
|
||||
virtual void AddGraphics() const { }
|
||||
|
||||
std::string LayerName() const;
|
||||
|
||||
};
|
Loading…
Reference in New Issue
Block a user