Streamline scaling for DXF import
Eliminate m_measurement_inch to clean up logic for priority of MEASUREMENT and INSUNITS. Save the actual scaling factor rather than the scaling enum so a switch statement is not executed for each call to mm() Add to CDxfRead the work to handle dxfScaling option, ImpExpDxfRead just has to set it up now. Get the scaling factor from a lookup table rather than a switch statement Display a message explaining what the scaling factor is and where it comes from Remove large amount of Lint.
This commit is contained in:
committed by
Yorik van Havre
parent
8cadc2294d
commit
2c0bc89f62
@@ -7,25 +7,31 @@
|
||||
|
||||
AreaDxfRead::AreaDxfRead(CArea* area, const char* filepath):CDxfRead(filepath), m_area(area){}
|
||||
|
||||
void AreaDxfRead::StartCurveIfNecessary(const double* s)
|
||||
void AreaDxfRead::StartCurveIfNecessary(const Base::Vector3d& startPoint) const
|
||||
{
|
||||
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))
|
||||
Point ps(startPoint.x, startPoint.y);
|
||||
if(m_area->m_curves.empty() || m_area->m_curves.back().m_vertices.empty() || m_area->m_curves.back().m_vertices.back().m_p != ps)
|
||||
{
|
||||
// start a new curve
|
||||
m_area->m_curves.emplace_back();
|
||||
m_area->m_curves.back().m_vertices.push_back(ps);
|
||||
m_area->m_curves.back().m_vertices.emplace_back(ps);
|
||||
}
|
||||
}
|
||||
|
||||
void AreaDxfRead::OnReadLine(const double* s, const double* e, bool /*hidden*/)
|
||||
void AreaDxfRead::OnReadLine(const Base::Vector3d& start, const Base::Vector3d& end, bool /*hidden*/)
|
||||
{
|
||||
StartCurveIfNecessary(s);
|
||||
m_area->m_curves.back().m_vertices.push_back(Point(e));
|
||||
StartCurveIfNecessary(start);
|
||||
m_area->m_curves.back().m_vertices.emplace_back(Point(end.x, end.y));
|
||||
}
|
||||
|
||||
void AreaDxfRead::OnReadArc(const double* s, const double* e, const double* c, bool dir, bool /*hidden*/)
|
||||
void AreaDxfRead::OnReadArc(const Base::Vector3d& start,
|
||||
const Base::Vector3d& end,
|
||||
const Base::Vector3d& center,
|
||||
bool dir,
|
||||
bool /*hidden*/)
|
||||
{
|
||||
StartCurveIfNecessary(s);
|
||||
m_area->m_curves.back().m_vertices.emplace_back(dir?1:0, Point(e), Point(c));
|
||||
StartCurveIfNecessary(start);
|
||||
m_area->m_curves.back().m_vertices.emplace_back(dir ? 1 : 0,
|
||||
Point(end.x, end.y),
|
||||
Point(center.x, center.y));
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@ class CArea;
|
||||
class CCurve;
|
||||
|
||||
class AreaDxfRead : public CDxfRead{
|
||||
void StartCurveIfNecessary(const double* s);
|
||||
void StartCurveIfNecessary(const Base::Vector3d& startPoint) const;
|
||||
|
||||
public:
|
||||
CArea* m_area;
|
||||
AreaDxfRead(CArea* area, const char* filepath);
|
||||
|
||||
// AreaDxfRead's virtual functions
|
||||
void OnReadLine(const double* s, const double* e, bool /*hidden*/) override;
|
||||
void OnReadArc(const double* s, const double* e, const double* c, bool dir, bool /*hidden*/) override;
|
||||
void OnReadLine(const Base::Vector3d& start, const Base::Vector3d& end, bool /*hidden*/) override;
|
||||
void OnReadArc(const Base::Vector3d& start, const Base::Vector3d& end, const Base::Vector3d& center, bool dir, bool /*hidden*/) override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user