From 1422da91d0094d1762fe138fc9ebc712bd42ac65 Mon Sep 17 00:00:00 2001 From: Jos Groot Lipman Date: Wed, 3 Jul 2013 21:55:55 +0000 Subject: [PATCH] v3.00 want divers deprecated spul verwijderd whipfile.AddContour en contour.AddPoint toegevoegd svn path=/Slnkdwf/trunk/; revision=18350 --- SlnkDWFCom/Options.cpp | 9 +------ SlnkDWFCom/Options.h | 1 - SlnkDWFCom/SLNKContour.cpp | 9 +++++++ SlnkDWFCom/SLNKContour.h | 1 + SlnkDWFCom/SLNKDWF.idl | 5 ++-- SlnkDWFCom/SLNKDWFVersion.h | 4 +-- SlnkDWFCom/SLNKEvent.cpp | 14 ----------- SlnkDWFCom/SLNKEvent.h | 2 -- SlnkDWFCom/WhipFile.cpp | 27 +++++++++++--------- SlnkDWFCom/WhipFile.h | 3 ++- SlnkDWFImpl/SLNKContourImpl.cpp | 44 ++++++++++++++------------------- SlnkDWFImpl/SLNKContourImpl.h | 7 +----- SlnkDWFImpl/Whip2DCImpl.cpp | 20 +++++++++------ 13 files changed, 64 insertions(+), 82 deletions(-) diff --git a/SlnkDWFCom/Options.cpp b/SlnkDWFCom/Options.cpp index 5a34908..be439f2 100644 --- a/SlnkDWFCom/Options.cpp +++ b/SlnkDWFCom/Options.cpp @@ -8,7 +8,6 @@ CSLNKOptions g_SLNKOptions; // The one and only // Set all default values CSLNKOptions::CSLNKOptions() { - m_MinContSize = 0.20e6; // Minimale grootte voor een contour om herkend te worden m_SkipContLeader = FALSE; // ARKEY tekeningen hebben een leading lijntje voor de contour } // COptions @@ -34,13 +33,7 @@ STDMETHODIMP COptions::SetOption(BSTR optionName, VARIANT OptionValue) CString nm(optionName); nm.MakeUpper(); - if (nm=="MINCONTSIZE") // deprecated sinds 2.80 - { - HRESULT hr = val.ChangeType(VT_R8); - if (FAILED(hr)) return hr; - g_SLNKOptions.m_MinContSize = val.dblVal; - } - else if (nm=="SKIPCONTLEADER") + if (nm=="SKIPCONTLEADER") { HRESULT hr = val.ChangeType(VT_BOOL); if (FAILED(hr)) return hr; diff --git a/SlnkDWFCom/Options.h b/SlnkDWFCom/Options.h index 209d36b..95c3b05 100644 --- a/SlnkDWFCom/Options.h +++ b/SlnkDWFCom/Options.h @@ -16,7 +16,6 @@ class CSLNKOptions public: CSLNKOptions(); - double m_MinContSize; // In DWG Units BOOL m_SkipContLeader; // voor ARKEY }; extern CSLNKOptions g_SLNKOptions; // The one and only diff --git a/SlnkDWFCom/SLNKContour.cpp b/SlnkDWFCom/SLNKContour.cpp index 6fac82f..54409ec 100644 --- a/SlnkDWFCom/SLNKContour.cpp +++ b/SlnkDWFCom/SLNKContour.cpp @@ -202,3 +202,12 @@ STDMETHODIMP CSLNKContour::put_Labelposition(BYTE newVal) return S_OK; } +STDMETHODIMP CSLNKContour::AddPoint(DOUBLE pValX, DOUBLE pValY) +{ + // Het lijkt nogal onzinnig m_SLNKContour zijn eigen m_contunits door te geven + // SLNKContourImpl.h heeft echter alleen een forward declaration naar CWhipFile + // en compile technisch werd het me anders te ingewikkeld. + m_SLNKContour->AddPoint(pValX, pValY, m_SLNKContour->m_parentWhipFile->m_contunits); + + return S_OK; +}; diff --git a/SlnkDWFCom/SLNKContour.h b/SlnkDWFCom/SLNKContour.h index 90642ea..ff6eff3 100644 --- a/SlnkDWFCom/SLNKContour.h +++ b/SlnkDWFCom/SLNKContour.h @@ -107,6 +107,7 @@ public: STDMETHOD(put_Fontheight)(DOUBLE newVal); STDMETHOD(get_Labelposition)(BYTE* pVal); STDMETHOD(put_Labelposition)(BYTE newVal); + STDMETHOD(AddPoint)(DOUBLE pValX, DOUBLE pValY); }; //REMOVED OBJECT_ENTRY_AUTO(__uuidof(SLNKContour), CSLNKContour) diff --git a/SlnkDWFCom/SLNKDWF.idl b/SlnkDWFCom/SLNKDWF.idl index 8e9a6d2..5720a7a 100644 --- a/SlnkDWFCom/SLNKDWF.idl +++ b/SlnkDWFCom/SLNKDWF.idl @@ -64,7 +64,7 @@ interface IWhipFile : IDispatch{ [propget, id(23), helpstring("property ContourItem")] HRESULT ContourItem([in] ULONG i, [out, retval] ISLNKContour** pVal); [propget, id(24), helpstring("property minContSize")] HRESULT minContSize([out, retval] DOUBLE* pVal); [propput, id(24), helpstring("property minContSize")] HRESULT minContSize([in] DOUBLE newVal); - [propget, id(25), helpstring("property AddContour")] HRESULT AddContour([in, defaultvalue (L"")] BSTR Label,[in, defaultvalue (L"")] BSTR Key, [out, retval] ISLNKContour** pVal); + [propget, id(25), helpstring("property AddContour")] HRESULT AddContour([out, retval] ISLNKContour** pVal); }; [ object, @@ -179,8 +179,6 @@ interface ISLNKEvent : IDispatch{ [propput, id(1), helpstring("property DwgX")] HRESULT DwgX([in] DOUBLE newVal); [propget, id(2), helpstring("property DwgY")] HRESULT DwgY([out, retval] DOUBLE* pVal); [propput, id(2), helpstring("property DwgY")] HRESULT DwgY([in] DOUBLE newVal); - [propget, id(7), helpstring("property ContourLabel")] HRESULT ContourLabel([out, retval] BSTR* pVal); // DEPRECATED - [propput, id(7), helpstring("property ContourLabel")] HRESULT ContourLabel([in] BSTR newVal); // DEPRECATED [propget, id(8), helpstring("property ContourLayer")] HRESULT ContourLayer([out, retval] BSTR* pVal); [propput, id(8), helpstring("property ContourLayer")] HRESULT ContourLayer([in] BSTR newVal); [propget, id(9), helpstring("property TextLabel")] HRESULT TextLabel([out, retval] BSTR* pVal); @@ -251,6 +249,7 @@ interface ISLNKContour : IDispatch{ [propput, id(12), helpstring("property LabelPosition")] HRESULT Labelposition([in] BYTE pVal); [propget, id(13), helpstring("property Fontheight")] HRESULT Fontheight([out, retval] DOUBLE* pVal); [propput, id(13), helpstring("property Fontheight")] HRESULT Fontheight([in] DOUBLE pVal); + [id(14), helpstring("property AddPoint")] HRESULT AddPoint([in] DOUBLE pValX, [in] DOUBLE pValY); }; [ object, diff --git a/SlnkDWFCom/SLNKDWFVersion.h b/SlnkDWFCom/SLNKDWFVersion.h index f98219d..70cf286 100644 --- a/SlnkDWFCom/SLNKDWFVersion.h +++ b/SlnkDWFCom/SLNKDWFVersion.h @@ -1,6 +1,6 @@ // Zorg dat versies alfabetisch altijd op elkaar volgen! -#define SLNK_MAJOR_VERSION 2 -#define SLNK_MINOR_VERSION 91 +#define SLNK_MAJOR_VERSION 3 +#define SLNK_MINOR_VERSION 00 #define SLNK_BUILD_VERSION 0 // Define resource strings diff --git a/SlnkDWFCom/SLNKEvent.cpp b/SlnkDWFCom/SLNKEvent.cpp index 8085dd4..7a6752c 100644 --- a/SlnkDWFCom/SLNKEvent.cpp +++ b/SlnkDWFCom/SLNKEvent.cpp @@ -31,20 +31,6 @@ STDMETHODIMP CSLNKEvent::put_DwgY(DOUBLE newVal) return S_OK; } -// 2.80 DEPRECATED -STDMETHODIMP CSLNKEvent::get_ContourLabel(BSTR* pVal) -{ - CComBSTR bstrString(m_ContourKey); - return bstrString.CopyTo(pVal); -} - -// 2.80 DEPRECATED -STDMETHODIMP CSLNKEvent::put_ContourLabel(BSTR newVal) -{ - m_ContourKey = newVal; - return S_OK; -} - STDMETHODIMP CSLNKEvent::get_ContourKey(BSTR* pVal) { CComBSTR bstrString(m_ContourKey); diff --git a/SlnkDWFCom/SLNKEvent.h b/SlnkDWFCom/SLNKEvent.h index 2e8326f..a759d4b 100644 --- a/SlnkDWFCom/SLNKEvent.h +++ b/SlnkDWFCom/SLNKEvent.h @@ -79,8 +79,6 @@ public: STDMETHOD(put_DwgX)(DOUBLE newVal); STDMETHOD(get_DwgY)(DOUBLE* pVal); STDMETHOD(put_DwgY)(DOUBLE newVal); - STDMETHOD(get_ContourLabel)(BSTR* pVal); // DEPRECATED 2.80 - STDMETHOD(put_ContourLabel)(BSTR newVal); // DEPRECATED 2.80 STDMETHOD(get_ContourKey)(BSTR* pVal); STDMETHOD(put_ContourKey)(BSTR newVal); STDMETHOD(get_ContourLayer)(BSTR* pVal); diff --git a/SlnkDWFCom/WhipFile.cpp b/SlnkDWFCom/WhipFile.cpp index 4704300..9ced095 100644 --- a/SlnkDWFCom/WhipFile.cpp +++ b/SlnkDWFCom/WhipFile.cpp @@ -35,7 +35,7 @@ // CWhipFile -const WT_Logical_Point CWhipFile::star[] = +const WT_Logical_Point CWhipFile::star[] = { WT_Logical_Point(-1000, 0), WT_Logical_Point( -200, 200), WT_Logical_Point( 0, 1000), @@ -47,7 +47,7 @@ const WT_Logical_Point CWhipFile::star[] = WT_Logical_Point(-1000, 0) }; -const WT_Logical_Point CWhipFile::octa[] = +const WT_Logical_Point CWhipFile::octa[] = { WT_Logical_Point( 1000, 414), WT_Logical_Point( 414, 1000), WT_Logical_Point( -414, 1000), @@ -59,7 +59,7 @@ const WT_Logical_Point CWhipFile::octa[] = WT_Logical_Point( 1000, 414) }; -const WT_Logical_Point CWhipFile::square[] = +const WT_Logical_Point CWhipFile::square[] = { WT_Logical_Point( 0, 0), WT_Logical_Point( 0, 1000), WT_Logical_Point( 1000, 1000), @@ -67,6 +67,10 @@ const WT_Logical_Point CWhipFile::square[] = WT_Logical_Point( 0, 0) }; +const WT_Logical_Point CWhipFile::empty[] = // Lege contour + { WT_Logical_Point( INT_MAX, INT_MAX) + }; + CWhipFile::CWhipFile() { m_FontName.set("Arial"); @@ -77,7 +81,7 @@ CWhipFile::CWhipFile() m_reLabels.Parse(".*", FALSE); m_reLayers.Parse(".*", FALSE); m_hintScale = -1.0; - m_minContSize = g_SLNKOptions.m_MinContSize; // deprecated via globale setting. Later 0.20e6 + m_minContSize = 0.20e6; // Minimale opp om herkend te worden. m_forFind = TRUE; // backward compatible m_activeLayerName = ""; @@ -90,6 +94,9 @@ CWhipFile::CWhipFile() symb = new CSLNKSymbolDefinition(sizeof(square)/sizeof(square[0]), square); m_SLNKSymbolDefinitions.SetAt("*SQUARE", symb); + + symb = new CSLNKSymbolDefinition(sizeof(empty)/sizeof(empty[0]), empty); + m_SLNKSymbolDefinitions.SetAt("*EMPTY", symb); } int xxxx; @@ -1257,15 +1264,11 @@ STDMETHODIMP CWhipFile::put_minContSize(DOUBLE newVal) return S_OK; } -STDMETHODIMP CWhipFile::get_AddContour(BSTR Label, BSTR Key, ISLNKContour** pVal) +STDMETHODIMP CWhipFile::get_AddContour(ISLNKContour** pVal) { - return E_NOTIMPL; // Nog niet klaar - // TODO: - // dwgX en dwgY coordinaten toevoegen (vertalen naar DWF coordinaten?) - // Na elk punt voor de zekerheid boundingcontour/ centroid opnieuw? - - WT_Logical_Point *pts; - CSLNKContourImpl *myContour = new CSLNKContourImpl(0, pts, WD_True, this); + // Je mag eigenlijk geen echt lege contour doorgeven, daar assert de pointset.cpp op? + CSLNKContourImpl *myContour = new CSLNKContourImpl(sizeof(empty)/sizeof(empty[0]), empty, WD_True, this); + myContour->m_contLabel = "Dynamic"; // Anders wordt hij niet getekend uiteindelijk this->m_SLNKContouren.Add(myContour); diff --git a/SlnkDWFCom/WhipFile.h b/SlnkDWFCom/WhipFile.h index 2732666..0243d5d 100644 --- a/SlnkDWFCom/WhipFile.h +++ b/SlnkDWFCom/WhipFile.h @@ -62,7 +62,7 @@ public: STDMETHOD(get_Contour)(BSTR IdentLabel, ISLNKContour** pVal); STDMETHOD(SetFilterLayers)(BSTR reLayers); STDMETHOD(get_FindInContour)(DOUBLE dwgX, DOUBLE dwgY, BSTR* pVal); - STDMETHOD(get_AddContour)(BSTR Label, BSTR Key, ISLNKContour** pVal); + STDMETHOD(get_AddContour)(ISLNKContour** pVal); private: @@ -159,6 +159,7 @@ private: const static WT_Logical_Point star[]; const static WT_Logical_Point octa[]; const static WT_Logical_Point square[]; + const static WT_Logical_Point empty[]; }; OBJECT_ENTRY_AUTO(__uuidof(WhipFile), CWhipFile) diff --git a/SlnkDWFImpl/SLNKContourImpl.cpp b/SlnkDWFImpl/SLNKContourImpl.cpp index 25d0967..896e47b 100644 --- a/SlnkDWFImpl/SLNKContourImpl.cpp +++ b/SlnkDWFImpl/SLNKContourImpl.cpp @@ -689,34 +689,26 @@ WT_Result CSLNKContourImpl::serialize(WT_File & file, BOOL solidOnly, BOOL forFi return WT_Result::Success; }; - -#ifndef DWFTK_READ_ONLY -void CSLNKContourImpl::serializeXML( DWFToolkit::DWFXMLSerializer& rSerializer, - WT_Units units ) - throw( DWFException ) +void CSLNKContourImpl::AddPoint(double pValX, double pValY, WT_Units units) { - rSerializer.startElement( L"Contour ", L"SLNKDWF" ); - - rSerializer.addAttribute( L"Label", DWFString(m_contLabel) ); - wchar_t zTempBuffer[32]; - _DWFCORE_SWPRINTF( zTempBuffer, 32, L"%.2f", m_DWGArea ); - rSerializer.addAttribute( "Area", zTempBuffer ); - - CString builder; - for (int i=0; i < count(); i++) + bool wasEmpty = (points()[0].m_x == INT_MAX && + points()[0].m_y == INT_MAX); + WT_Logical_Point *pts = new WT_Logical_Point[count()+1]; + int i; + for (i = 0; i < count(); i++) { - WT_Point3D dwgPt = units.transform(points()[i]); - CString pts; - pts.Format("%.1f,%.1f", dwgPt.m_x,dwgPt.m_y); - if (builder.GetLength()>0) builder += " "; - builder = builder + pts; + pts[i] = points()[i]; } - rSerializer.addAttribute( "Points", (LPCSTR)builder ); - //rSerializer.addAttribute( DWFXML::kzAttribute_Category, _zCategory ); - //rSerializer.addAttribute( DWFXML::kzAttribute_Type, _zType ); - //rSerializer.addAttribute( DWFXML::kzAttribute_Units, _zUnits ); + // Het nieuwe punt + pts[i] = units.transform(WT_Point3D(pValX, pValY)); + + // Bij wasEmpty het eerste dummy punt overslaan + set(wasEmpty?1:(count() + 1), &pts[wasEmpty?1:0], true); - rSerializer.endElement(); + // Na elk punt voor de zekerheid area opnieuw? + if (wasEmpty) + m_ptLabel = points()[0]; -} -#endif \ No newline at end of file + delete[] pts; + +} \ No newline at end of file diff --git a/SlnkDWFImpl/SLNKContourImpl.h b/SlnkDWFImpl/SLNKContourImpl.h index d51dfb4..20c2337 100644 --- a/SlnkDWFImpl/SLNKContourImpl.h +++ b/SlnkDWFImpl/SLNKContourImpl.h @@ -66,11 +66,6 @@ public: int l_fontheight, double scale, HDC myDC, int width=-2); - + void AddPoint(double pValX, double pValY, WT_Units units); static WT_Integer32 m_next_node_num; -#ifndef DWFTK_READ_ONLY - void serializeXML( DWFToolkit::DWFXMLSerializer& rSerializer, - WT_Units units ) - throw( DWFException ); -#endif }; diff --git a/SlnkDWFImpl/Whip2DCImpl.cpp b/SlnkDWFImpl/Whip2DCImpl.cpp index 71f1e70..fc68e59 100644 --- a/SlnkDWFImpl/Whip2DCImpl.cpp +++ b/SlnkDWFImpl/Whip2DCImpl.cpp @@ -1024,25 +1024,31 @@ CString CWhip2DCImpl::PolyToMap(WT_Polygon & polygon, if (firstURL->address().length() == 0) Href = ""; else - Href.Format("href=\"%s\"", CString(firstURL->address().ascii())); + Href.Format(" href=\"%s\"", CString(firstURL->address().ascii())); if (firstURL->friendly_name().is_ascii()) ttl = firstURL->friendly_name().ascii(); else ttl = CStringW(firstURL->friendly_name().unicode()); } - else - ttl = objKey; // Is dit wel zo logisch/wenselijk? + //else + // ttl = objKey; // Is dit wel zo logisch/wenselijk? ttl.Replace("\\n", "\n"); Title.Format("title=\"%s\"", ttl); CString smbl = ""; - if (m_State->bIsSymbolLayer && objKey != "") - smbl.Format("\nSLNKSymbolKey=\"%s\"", objKey); + if (objKey != "") + { + // SLNKSymbolKey voor FACILITOR 5.3.1 backward compatible + if (m_State->bIsSymbolLayer) + smbl.Format(" SLNKSymbolKey=\"%s\" SLNKKey=\"%s\"", objKey, objKey); + else + smbl.Format(" SLNKKey=\"%s\"", objKey); + } CString Builder; - Builder.Format("\n", - shape, Coords, Title, Href, smbl); + Builder.Format("\n", + smbl, Title, shape, Coords, Href); return Builder; };