v4.29 ZLMV#78395 Whip2DC ook correctie voor niet orthogonale Units

Whip2PNG.flags en Whipfile.flags ingevoerd. Bitje +1 om bovenstaande te activeren

svn path=/Slnkdwf/trunk/; revision=61777
This commit is contained in:
Jos Groot Lipman
2023-09-12 09:25:39 +00:00
parent 9e8df1579d
commit dcf444798e
13 changed files with 76 additions and 16 deletions

View File

@@ -73,6 +73,8 @@ interface IWhipFile : IDispatch{
[propput, id(30), helpstring("property minMergeDistance")] HRESULT minMergeDistance([in] DOUBLE newVal);
[id(31), helpstring("method SetSymbolFont")] HRESULT SetSymbolFont([in] BSTR FontName, [in, defaultvalue(1000)] DOUBLE FontHeight);
[propget, id(32), helpstring("property UnmatchedLabels")] HRESULT UnmatchedLabels([out, retval] BSTR* pUnmatched);
[propget, id(33), helpstring("property flags")] HRESULT flags([out, retval] LONG* pVal);
[propput, id(33), helpstring("property flags")] HRESULT flags([in] LONG newVal);
};
[
object,
@@ -114,6 +116,8 @@ interface IWhip2PNG : IDispatch{
[id(24), helpstring("method SetAntialias")] HRESULT SetAntialias([in] LONG lFactor, [in, defaultvalue(0)] LONG lMethod);
[propget, id(25), helpstring("property markers")] HRESULT markers([out, retval] LONG* pVal);
[propput, id(25), helpstring("property markers")] HRESULT markers([in] LONG newVal);
[propget, id(26), helpstring("property flags")] HRESULT flags([out, retval] LONG* pVal);
[propput, id(26), helpstring("property flags")] HRESULT flags([in] LONG newVal);
};
[
object,

View File

@@ -1,6 +1,6 @@
// Zorg dat versies alfabetisch altijd op elkaar volgen!
#define SLNK_MAJOR_VERSION 4
#define SLNK_MINOR_VERSION 29
#define SLNK_MINOR_VERSION 30
#define SLNK_BUILD_VERSION 0
// Define resource strings

View File

@@ -26,6 +26,7 @@ CWhip2PNG::CWhip2PNG()
m_forcePaper = FALSE;
m_forceBW = FALSE;
m_markers = 0;
m_flags = 0;
m_forceGray = FALSE;
m_Maximize = FALSE;
m_dwgScale = 0.0;
@@ -565,7 +566,7 @@ void CWhip2PNG::InitDC(HDC &myDC)
m_iWhip2DC.Load(myDC, epli,
m_WhipPath, m_RegExp,
myRound(m_sizeX*m_dScale), myRound(m_sizeY*m_dScale),
VARIANT_TRUE /*center*/, m_Maximize, m_dwgScale);
VARIANT_TRUE /*center*/, m_Maximize, m_dwgScale, m_flags);
// Als m_dwgScale was gespecificeerd moeten we wel een goede bitmapgrootte kiezen
if (m_dwgScale > 0.0)
@@ -662,6 +663,20 @@ STDMETHODIMP CWhip2PNG::put_markers(LONG newVal)
return S_OK;
}
STDMETHODIMP CWhip2PNG::get_flags(LONG* pVal)
{
(*pVal) = m_flags;
return S_OK;
}
STDMETHODIMP CWhip2PNG::put_flags(LONG newVal)
{
m_flags = newVal;
return S_OK;
}
STDMETHODIMP CWhip2PNG::get_forceGray(VARIANT_BOOL* pVal)
{
(*pVal) = m_forceGray;

View File

@@ -100,6 +100,7 @@ private:
COLORREF m_paperColor; BOOL m_forcePaper;
BOOL m_forceBW;
LONG m_markers;
LONG m_flags;
BOOL m_forceGray;
BOOL m_Maximize;
double m_dwgScale;
@@ -118,6 +119,8 @@ public:
STDMETHOD(put_forceBW)(VARIANT_BOOL newVal);
STDMETHOD(get_markers)(LONG* pVal);
STDMETHOD(put_markers)(LONG newVal);
STDMETHOD(get_flags)(LONG* pVal);
STDMETHOD(put_flags)(LONG newVal);
STDMETHOD(get_forceGray)(VARIANT_BOOL* pVal);
STDMETHOD(put_forceGray)(VARIANT_BOOL newVal);
STDMETHOD(get_LayerCount)(LONG* pVal);

View File

@@ -90,6 +90,7 @@ CWhipFile::CWhipFile()
m_activeLayerName = "";
m_vdpi = 0;
m_builder_len = 0;
m_flags = 0;
// Predefine fixed symbols
// Merk op dat m_contunits hier nog gewoon de default identity matrix is
@@ -294,7 +295,7 @@ void CWhipFile::read_for_contours()
// Nu zijn ze wel een keer bekend, we hebben ze later weer nodig
// m_contunits=m_W2DFile.rendition().drawing_info().units();werkt niet goed met paperspace
// Deze doet het in de praktijk altijd wel?
m_contunits = myWT_File::fixUnits(m_W2DFile.rendition().viewport().viewport_units());
m_contunits = myWT_File::fixUnits(m_W2DFile.rendition().viewport().viewport_units(), m_flags);
m_view=m_W2DFile.rendition().rendering_options().view();
@@ -531,7 +532,7 @@ WT_Result CWhipFile::my_process_outlineEllipse(WT_Outline_Ellipse & outlineEllip
return WT_Result::Success;
}
WT_Units units = myWT_File::fixUnits(file.rendition().viewport().viewport_units());
WT_Units units = myWT_File::fixUnits(file.rendition().viewport().viewport_units(), deze->m_flags);
WT_Point3D dwgPt = units.transform(outlineEllipse.position());
@@ -609,7 +610,7 @@ WT_Result CWhipFile::my_process_polyline(WT_Polyline & polyline, WT_File & file)
//WT_Units units=file.rendition().drawing_info().units(); werkt niet goed met paperspace
// Waarom zetten we hier m_contunits eigenlijk nog niet gewoon direct?
WT_Units units = myWT_File::fixUnits(file.rendition().viewport().viewport_units());
WT_Units units = myWT_File::fixUnits(file.rendition().viewport().viewport_units(), deze->m_flags);
// if (polyline.count() == 3 && polyline.points()[0].m_x == 2147470970 && polyline.points()[0].m_y == 22603)
// DebugBreak();
@@ -1673,6 +1674,22 @@ STDMETHODIMP CWhipFile::put_minMergeDistance(DOUBLE newVal)
return S_OK;
}
STDMETHODIMP CWhipFile::get_flags(LONG* pVal)
{
(*pVal) = m_flags;
return S_OK;
}
STDMETHODIMP CWhipFile::put_flags(LONG newVal)
{
m_flags = newVal;
return S_OK;
}
STDMETHODIMP CWhipFile::get_AddContour(ISLNKContour** pVal)
{
// Je mag eigenlijk geen echt lege contour doorgeven, daar assert de pointset.cpp op?

View File

@@ -128,6 +128,8 @@ public:
STDMETHOD(put_minContSize)(DOUBLE newVal);
STDMETHOD(get_minMergeDistance)(DOUBLE* pVal);
STDMETHOD(put_minMergeDistance)(DOUBLE newVal);
STDMETHOD(get_flags)(LONG* pVal);
STDMETHOD(put_flags)(LONG newVal);
STDMETHOD(get_vectorDpi)(LONG* pVal);
STDMETHOD(get_DwgLimits)(IBoundingBox** pVal);
@@ -183,6 +185,7 @@ public:
double m_hintScale; // Kunnen we gebruiken om symbolen te 'geeken'
double m_minContSize; // Minimale oppervlakte om als contour te erkend worden
double m_minMergeDistance; // Minimale afstand om lijnsegmenten te mergen
long m_flags;
BOOL m_forFind; // Extra info die we kunnen misbruiken

View File

@@ -20,11 +20,12 @@ int CWhip2DCImpl::Load(HDC hDC, CEPlotSectionImpl *EPlotStream,
const CString &WhipPath,
const CString & RegExp, long sizeX, long sizeY,
VARIANT_BOOL centerImage, VARIANT_BOOL maximize,/*=FALSE*/
double dwgScale/*=0.0*/)
double dwgScale/*=0.0*/, long flags/*=0*/)
{
m_State.Reset();
m_WhipPath = WhipPath;
m_State.m_flags = flags;
m_State.myDC = hDC;
m_State.m_Layernames.RemoveAll();
m_State.m_centerImage = centerImage;
@@ -283,7 +284,7 @@ int CWhip2DCImpl::Paint(VARIANT_BOOL forceBW, LONG markers /* = 0 */)
throw myCString("\nCWhip2DCImpl::Paint: unable to open file '%s'", m_WhipPath.ascii());
}
// For when user wants to use DPtoDWF
m_State.m_Units = myWT_File::fixUnits(my_input_file.rendition().viewport().viewport_units());
m_State.m_Units = myWT_File::fixUnits(my_input_file.rendition().viewport().viewport_units(), m_State.m_flags);
#if 0
{
@@ -414,7 +415,7 @@ int CWhip2DCImpl::FindTexts(const CString &findText)
myTRACE("\nSorry, kan file niet openen: %s", m_WhipPath);
// For when user wants to use DPtoDWF
m_State.m_Units = myWT_File::fixUnits(my_input_file.rendition().viewport().viewport_units());
m_State.m_Units = myWT_File::fixUnits(my_input_file.rendition().viewport().viewport_units(), m_State.m_flags);
my_input_file.close(); // closing Input file.
@@ -507,7 +508,7 @@ int CWhip2DCImpl::Find(LONG findX, LONG findY,
myTRACE("\nSorry, kan file niet openen: %s", m_WhipPath);
// For when user wants to use DPtoDWF
m_State.m_Units = myWT_File::fixUnits(my_input_file.rendition().viewport().viewport_units());
m_State.m_Units = myWT_File::fixUnits(my_input_file.rendition().viewport().viewport_units(), m_State.m_flags);
my_input_file.close(); // closing Input file.
@@ -1105,7 +1106,7 @@ WT_Result CWhip2DCImpl::my_process_polygon_find (WT_Polygon & polygon, WT_File &
{
m_State->foundNode = file.rendition().object_node();
CSLNKContourImpl::EdgeAngle(m_State->DWFfindXY, polygon, m_State->foundEdgeAngle, m_State->foundEdgeDistance);
double scale = myWT_File::fixUnits(file.rendition().viewport().viewport_units()).application_to_dwf_transform()(0,0);
double scale = myWT_File::fixUnits(file.rendition().viewport().viewport_units(), m_State->m_flags).application_to_dwf_transform()(0,0);
m_State->foundEdgeDistance /= scale;
WT_Integer32 layer_num = file.rendition().layer().layer_num();

View File

@@ -125,7 +125,7 @@ public:
int Load(HDC hDC, CEPlotSectionImpl *EPlotSection, const CString &WhipPath,
const CString &RegExp, long sizeX, long sizeY,
VARIANT_BOOL centerImage, VARIANT_BOOL maximize=FALSE,
double dwgScale=0.0);
double dwgScale=0.0, long flags=0);
int Paint(VARIANT_BOOL forceBW, LONG markers = 0);
int Find(LONG findX, LONG findY, BYTE AsMap,
CString &pContourKey, CString &pContourLayer,

View File

@@ -31,6 +31,7 @@ void CWhip2DCState::Reset()
m_font = NULL;
m_forcePaper = false;
m_Maximize = false;
m_flags = 0;
}
CWhip2DCState::~CWhip2DCState()

View File

@@ -84,6 +84,7 @@ public:
BOOL m_Maximize;
BOOL m_centerImage;
double m_mul; // schaal onze DWF-coordinaten naar bitmap coordinaten
long m_flags;
CSize m_Size;
BOOL findIt;

View File

@@ -87,14 +87,25 @@ WT_Result myWT_File::my_WSseek (WT_File & file, int distance, int &amount_seeke
return WT_Result::Success;
};
WT_Units myWT_File::fixUnits(const WT_Units orgunits, long flags)
{
WT_Matrix matrix = orgunits.application_to_dwf_transform();
// LUDE#30224/BLOS#76236
// Vectorworks tekeningen blijken wel eens een (negatieve) z-component in de units te hebben
// Met forse tegenzin corrigeer ik dat door hem hier op 1.0 te zetten
// Merk op: alle AutoCAD dwf's die ik ooit zag hebben hem al op 1.0 staan
WT_Units myWT_File::fixUnits(const WT_Units orgunits)
{
WT_Matrix matrix = orgunits.application_to_dwf_transform();
matrix(2, 2) = 1.0;
// ZLMV#78395
// Ze hadden AutoCAD LT tekeningen waar de (0,1) en (1,0) niet (nagenoeg) op '0' stonden
// Met forse tegenzin corrigeer ik dat door het hier op 0.0 te zetten
if (flags & 0x01)
{
matrix(0, 1) = 0.0;
matrix(1, 0) = 0.0;
}
return WT_Units(matrix, orgunits.units());
}

View File

@@ -23,7 +23,7 @@ public:
};
const unsigned int PaperColor() { return m_color; };
static WT_Units fixUnits(const WT_Units orgunits);
static WT_Units fixUnits(const WT_Units orgunits, long flags);
#ifndef DWFTK_READ_ONLY
bool SaveAsAscii(const CString &destpath, EPlot_Progress_Action action = NULL);
#endif

View File

@@ -1,4 +1,8 @@
V4.29 30-01-2022
V4.30 23-08-2022
ZLMV#78395 Whip2DC ook correctie voor niet orthogonale Units
Whip2PNG.flags en Whipfile.flags ingevoerd. Bitje +1 om bovenstaande te activeren
V4.29 30-01-2023
BLOS#76236 ArchiCad - ook Whip2DC z-co<63>rdinaat correctie van LUDE#30224 laten doen
V4.28 04-01-2022