From 913cec7b4fa942430abb88ea1bca8e920a0e1f68 Mon Sep 17 00:00:00 2001 From: Jerry Faust Date: Sat, 25 Jul 2020 12:23:22 -0700 Subject: [PATCH 1/2] Update to MWGIS-201; place new optional parameters at the end of existing functions, so as not to break existing code. --- src/COM classes/Labels.cpp | 22 +++++++++++----------- src/COM classes/Labels.h | 10 +++++----- src/COM classes/Shapefile_Edit.cpp | 2 +- src/COM classes/Shapefile_LabelsCharts.cpp | 10 +++++----- src/ComHelpers/ShapeHelper.cpp | 4 ++-- src/ComHelpers/ShapeHelper.h | 2 +- src/Control/Map_DrawingLayer.cpp | 6 +++--- src/Control/Map_Labels.cpp | 4 ++-- src/MapWinGIS.idl | 8 ++++---- src/Ogr/Ogr2Shape.cpp | 2 +- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/COM classes/Labels.cpp b/src/COM classes/Labels.cpp index edb60d4b..56c644f0 100644 --- a/src/COM classes/Labels.cpp +++ b/src/COM classes/Labels.cpp @@ -323,18 +323,18 @@ STDMETHODIMP CLabels::put_Category(long Index, ILabelCategory* newVal) //***********************************************************************/ //* AddLabel() //***********************************************************************/ -STDMETHODIMP CLabels::AddLabel(BSTR Text, double x, double y, double offsetX, double offsetY, double Rotation, long Category) +STDMETHODIMP CLabels::AddLabel(BSTR Text, double x, double y, double Rotation, long Category, double offsetX, double offsetY) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) VARIANT_BOOL vbretval; - this->InsertLabel(_labels.size(), Text, x, y, offsetX, offsetY, Rotation, Category, &vbretval); + this->InsertLabel(_labels.size(), Text, x, y, Rotation, Category, offsetX, offsetY, &vbretval); return S_OK; } //***********************************************************************/ //* InsertLabel() //***********************************************************************/ -STDMETHODIMP CLabels::InsertLabel(long Index, BSTR Text, double x, double y, double offsetX, double offsetY, double Rotation, long Category, VARIANT_BOOL* retVal) +STDMETHODIMP CLabels::InsertLabel(long Index, BSTR Text, double x, double y, double Rotation, long Category, double offsetX, double offsetY, VARIANT_BOOL* retVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) if(Index < 0 || Index > (long)_labels.size()) @@ -343,7 +343,7 @@ STDMETHODIMP CLabels::InsertLabel(long Index, BSTR Text, double x, double y, dou *retVal = VARIANT_FALSE; } - CLabelInfo* lbl = CreateNewLabel(Text, x, y, offsetX, offsetY, Rotation, Category); + CLabelInfo* lbl = CreateNewLabel(Text, x, y, Rotation, Category, offsetX, offsetY); std::vector* parts = new std::vector; parts->push_back(lbl); @@ -363,7 +363,7 @@ STDMETHODIMP CLabels::InsertLabel(long Index, BSTR Text, double x, double y, dou //***********************************************************************/ /* CreateNewLabel() //***********************************************************************/ -CLabelInfo* CLabels::CreateNewLabel(const BSTR &Text, double x, double y, double offsetX, double offsetY, double Rotation, long Category) +CLabelInfo* CLabels::CreateNewLabel(const BSTR &Text, double x, double y, double Rotation, long Category, double offsetX, double offsetY) { // TODO this really is just a constructor for label info => need to move this here ... CLabelInfo *lbl = new CLabelInfo(); @@ -406,7 +406,7 @@ STDMETHODIMP CLabels::RemoveLabel(long Index, VARIANT_BOOL* vbretval) ///***********************************************************************/ ///* AddPart() ///***********************************************************************/ -STDMETHODIMP CLabels::AddPart(long Index, BSTR Text, double x, double y, double offsetX, double offsetY, double Rotation, long Category) +STDMETHODIMP CLabels::AddPart(long Index, BSTR Text, double x, double y, double Rotation, long Category, double offsetX, double offsetY) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) if(Index < 0 || Index > (int)_labels.size()) @@ -417,14 +417,14 @@ STDMETHODIMP CLabels::AddPart(long Index, BSTR Text, double x, double y, double std::vector* parts = _labels[Index]; VARIANT_BOOL vbretval; - InsertPart(Index, parts->size(), Text, x, y, offsetX, offsetY, Rotation, Category, &vbretval); + InsertPart(Index, parts->size(), Text, x, y, Rotation, Category, offsetX, offsetY, &vbretval); return S_OK; }; ///***********************************************************************/ ///* AddPart() ///***********************************************************************/ -STDMETHODIMP CLabels::InsertPart(long Index, long Part, BSTR Text, double x, double y, double offsetX, double offsetY, double Rotation, long Category, VARIANT_BOOL* retVal) +STDMETHODIMP CLabels::InsertPart(long Index, long Part, BSTR Text, double x, double y, double Rotation, long Category, double offsetX, double offsetY, VARIANT_BOOL* retVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) if(Index < 0 || Index >=(int)_labels.size()) @@ -434,7 +434,7 @@ STDMETHODIMP CLabels::InsertPart(long Index, long Part, BSTR Text, double x, dou } std::vector* parts = _labels[Index]; - CLabelInfo* lbl = CreateNewLabel(Text, x, y, offsetX, offsetY, Rotation, Category); + CLabelInfo* lbl = CreateNewLabel(Text, x, y, Rotation, Category, offsetX, offsetY); if (Part == parts->size()) { @@ -2153,7 +2153,7 @@ bool CLabels::DeserializeLabelData(CPLXMLNode* node, bool loadRotation, bool loa angle = 0.0; } - this->AddLabel(bstr, x, y, offsetX, offsetY, angle); + this->AddLabel(bstr, x, y, angle, -1, offsetX, offsetY); node = node->psNext; } @@ -2693,7 +2693,7 @@ bool CLabels::HasRotation() // ************************************************************* void CLabels::AddEmptyLabel() { - AddLabel(m_globalSettings.emptyBstr, 0.0, 0.0, 0.0, 0.0, 0.0); + AddLabel(m_globalSettings.emptyBstr, 0.0, 0.0, 0.0, 0, 0.0, 0.0); if (_labels.size() == 0) return; CLabelInfo* lbl = (*_labels[_labels.size() - 1])[0]; if (lbl) { diff --git a/src/COM classes/Labels.h b/src/COM classes/Labels.h index 79c13e78..168be531 100644 --- a/src/COM classes/Labels.h +++ b/src/COM classes/Labels.h @@ -135,12 +135,12 @@ class ATL_NO_VTABLE CLabels : STDMETHOD(get_ErrorMsg)(/*[in]*/ long ErrorCode, /*[out, retval]*/ BSTR *pVal); STDMETHOD(get_LastErrorCode)(/*[out, retval]*/ long *pVal); - STDMETHOD(AddLabel)(BSTR Text, double x, double y, double offsetX, double offsetY, double Rotation, long Category = -1); - STDMETHOD(InsertLabel)(long Index, BSTR Text, double x, double y, double offsetX, double offsetY, double Rotation, long Category, VARIANT_BOOL* retVal); + STDMETHOD(AddLabel)(BSTR Text, double x, double y, double Rotation, long Category = -1, double offsetX = 0, double offsetY = 0); + STDMETHOD(InsertLabel)(long Index, BSTR Text, double x, double y, double Rotation, long Category, double offsetX, double offsetY, VARIANT_BOOL* retVal); STDMETHOD(RemoveLabel)(long Index, VARIANT_BOOL* vbretval); - STDMETHOD(AddPart)(long Index, BSTR Text, double x, double y, double offsetX, double offsetY, double Rotation, long Category = -1); - STDMETHOD(InsertPart)(long Index, long Part, BSTR Text, double x, double y, double offsetX, double offsetY, double Rotation, long Category, VARIANT_BOOL* retVal); + STDMETHOD(AddPart)(long Index, BSTR Text, double x, double y, double Rotation, long Category = -1, double offsetX = 0, double offsetY = 0); + STDMETHOD(InsertPart)(long Index, long Part, BSTR Text, double x, double y, double Rotation, long Category, double offsetX, double offsetY, VARIANT_BOOL* retVal); STDMETHOD(RemovePart)(long Index, long Part, VARIANT_BOOL* vbretval); STDMETHOD(AddCategory)(BSTR Name, ILabelCategory** retVal); @@ -460,7 +460,7 @@ class ATL_NO_VTABLE CLabels : bool GetMinMaxCategoryValue(double& globalMax, double& globalMin); void SetCategoryForLabel(long labelIndex, long categoryIndex); void UpdateLabelOffsetsFromShapefile(long labelIndex, long categoryIndex); - CLabelInfo* CreateNewLabel(const BSTR &Text, double x, double y, double offsetX, double offsetY, double Rotation, long Category); + CLabelInfo* CreateNewLabel(const BSTR &Text, double x, double y, double Rotation, long Category, double offsetX, double offsetY); public: void ClearLabelFrames(); diff --git a/src/COM classes/Shapefile_Edit.cpp b/src/COM classes/Shapefile_Edit.cpp index 850b36bc..8e633a6d 100644 --- a/src/COM classes/Shapefile_Edit.cpp +++ b/src/COM classes/Shapefile_Edit.cpp @@ -377,7 +377,7 @@ void CShapefile::RegisterNewShape(IShape* Shape, long ShapeIndex) // it doesn't make sense to recalculate expression as DBF cells are empty all the same CComBSTR bstrText(""); - _labels->InsertLabel(ShapeIndex, bstrText, x, y, offsetX, offsetY, rotation, -1, &vbretval); + _labels->InsertLabel(ShapeIndex, bstrText, x, y, rotation, -1, offsetX, offsetY, &vbretval); } if (chartsExist) diff --git a/src/COM classes/Shapefile_LabelsCharts.cpp b/src/COM classes/Shapefile_LabelsCharts.cpp index e138dd87..923a0c6e 100644 --- a/src/COM classes/Shapefile_LabelsCharts.cpp +++ b/src/COM classes/Shapefile_LabelsCharts.cpp @@ -123,14 +123,14 @@ STDMETHODIMP CShapefile::GenerateLabels(long FieldIndex, tkLabelPositioning Meth if( numParts == 1) { - ShapeHelper::AddLabelToShape(shp, _labels, text, offsetX, offsetY, Method, orientation); + ShapeHelper::AddLabelToShape(shp, _labels, text, Method, orientation, offsetX, offsetY); continue; } else if (numParts == 0) { if (shpType == SHP_POINT || shpType == SHP_MULTIPOINT) { - ShapeHelper::AddLabelToShape(shp, _labels, text, offsetX, offsetY, Method, orientation); + ShapeHelper::AddLabelToShape(shp, _labels, text, Method, orientation, offsetX, offsetY); continue; } } @@ -153,14 +153,14 @@ STDMETHODIMP CShapefile::GenerateLabels(long FieldIndex, tkLabelPositioning Meth if (partCount == 0) { - ShapeHelper::AddLabelToShape(shpPart, _labels, text, offsetX, offsetY, Method, orientation); + ShapeHelper::AddLabelToShape(shpPart, _labels, text, Method, orientation, offsetX, offsetY); partCount++; } else { double x = 0.0, y = 0.0; ShapeHelper::Cast(shpPart)->get_LabelPosition(Method, x, y, rotation, orientation); - _labels->AddPart(i, text, x, y, offsetX, offsetY, rotation); + _labels->AddPart(i, text, x, y, rotation, -1, offsetX, offsetY); } } @@ -177,7 +177,7 @@ STDMETHODIMP CShapefile::GenerateLabels(long FieldIndex, tkLabelPositioning Meth shp->get_PartAsShape(maxPart, &shpPart); if (shpPart) { - ShapeHelper::AddLabelToShape(shpPart, _labels, text, offsetX, offsetY, Method, orientation); + ShapeHelper::AddLabelToShape(shpPart, _labels, text, Method, orientation, offsetX, offsetY); continue; } } diff --git a/src/ComHelpers/ShapeHelper.cpp b/src/ComHelpers/ShapeHelper.cpp index 822f97f4..a3896df2 100644 --- a/src/ComHelpers/ShapeHelper.cpp +++ b/src/ComHelpers/ShapeHelper.cpp @@ -382,12 +382,12 @@ int ShapeHelper::GetLargestPart(IShape* shp) // ************************************************************* // AddLabel() // ************************************************************* -void ShapeHelper::AddLabelToShape(IShape* shp, ILabels* labels, BSTR text, double offsetX, double offsetY, tkLabelPositioning method, tkLineLabelOrientation orientation) +void ShapeHelper::AddLabelToShape(IShape* shp, ILabels* labels, BSTR text, tkLabelPositioning method, tkLineLabelOrientation orientation, double offsetX, double offsetY) { if (!shp || !labels) return; double x, y, rotation = 0.0; ((CShape*)shp)->get_LabelPosition(method, x, y, rotation, orientation); - labels->AddLabel(text, x, y, offsetX, offsetY, rotation); + labels->AddLabel(text, x, y, rotation, -1, offsetX, offsetY); } // ************************************************************* diff --git a/src/ComHelpers/ShapeHelper.h b/src/ComHelpers/ShapeHelper.h index dd7ec5c5..a3e3783d 100644 --- a/src/ComHelpers/ShapeHelper.h +++ b/src/ComHelpers/ShapeHelper.h @@ -16,7 +16,7 @@ class ShapeHelper static CShape* Cast(CComPtr& shp); static long GetNumParts(IShape* shp); static int GetLargestPart(IShape* shp); - static void AddLabelToShape(IShape* shp, ILabels* labels, BSTR text, double offsetX, double offsetY, tkLabelPositioning method, tkLineLabelOrientation orientation); + static void AddLabelToShape(IShape* shp, ILabels* labels, BSTR text, tkLabelPositioning method, tkLineLabelOrientation orientation, double offsetX, double offsetY); static IShape* CenterAsShape(IShape* shp); static int GetContentLength(IShape* shp); }; diff --git a/src/Control/Map_DrawingLayer.cpp b/src/Control/Map_DrawingLayer.cpp index 2bb5967e..4f959bfc 100644 --- a/src/Control/Map_DrawingLayer.cpp +++ b/src/Control/Map_DrawingLayer.cpp @@ -526,7 +526,7 @@ LONG CMapView::DrawLabelEx(LONG drawHandle, LPCTSTR text, DOUBLE x, DOUBLE y, DO if (_allDrawLists[drawHandle]->m_labels) { CComBSTR bstr(text); - _allDrawLists[drawHandle]->m_labels->AddLabel(bstr, x, y, 0, 0, rotation); + _allDrawLists[drawHandle]->m_labels->AddLabel(bstr, x, y, rotation); OnDrawingLayersChanged(); return drawHandle; } @@ -545,7 +545,7 @@ void CMapView::AddDrawingLabel(long drawHandle, LPCTSTR Text, OLE_COLOR Color, d { if (_allDrawLists[drawHandle]->m_labels) { CComBSTR bstr(Text); - _allDrawLists[drawHandle]->m_labels->AddLabel(bstr, x, y, 0, 0); + _allDrawLists[drawHandle]->m_labels->AddLabel(bstr, x, y); } OnDrawingLayersChanged(); } @@ -562,7 +562,7 @@ void CMapView::AddDrawingLabelEx(long drawHandle, LPCTSTR Text, OLE_COLOR Color, { if (_allDrawLists[drawHandle]->m_labels) { CComBSTR bstr(Text); - _allDrawLists[drawHandle]->m_labels->AddLabel(bstr, x, y, 0, 0, Rotation); + _allDrawLists[drawHandle]->m_labels->AddLabel(bstr, x, y, Rotation); } OnDrawingLayersChanged(); } diff --git a/src/Control/Map_Labels.cpp b/src/Control/Map_Labels.cpp index 0bdfaca7..741dfe0e 100644 --- a/src/Control/Map_Labels.cpp +++ b/src/Control/Map_Labels.cpp @@ -413,7 +413,7 @@ void CMapView::AddLabel(long LayerHandle, LPCTSTR Text, OLE_COLOR Color, double if (labels) { CComBSTR s(Text); - labels->AddLabel(s, x, y, 0, 0); + labels->AddLabel(s, x, y); } } @@ -426,7 +426,7 @@ void CMapView::AddLabelEx(long LayerHandle, LPCTSTR Text, OLE_COLOR Color, doubl if (labels) { CComBSTR s(Text); - labels->AddLabel(s, x, y, Rotation, 0, 0); + labels->AddLabel(s, x, y, Rotation); } } diff --git a/src/MapWinGIS.idl b/src/MapWinGIS.idl index e61d9118..165faefb 100644 --- a/src/MapWinGIS.idl +++ b/src/MapWinGIS.idl @@ -5041,12 +5041,12 @@ interface ILabels : IDispatch{ [propput, id(6), helpstring("property Category")] HRESULT Category([in]long Index, [in]ILabelCategory* newVal); // methods - [id(7), helpstring("method AddLabel")] HRESULT AddLabel([in]BSTR Text, [in]double x, [in]double y, [in, defaultvalue(0)]double offsetX, [in, defaultvalue(0)]double offsetY, [in, defaultvalue(0)]double Rotation, [in, defaultvalue(-1)]long Category); - [id(8), helpstring("method InsertLabel")] HRESULT InsertLabel([in]long Index, [in]BSTR Text, [in]double x, [in]double y, [in, defaultvalue(0)]double offsetX, [in, defaultvalue(0)]double offsetY, [in, defaultvalue(0)]double Rotation, [in, defaultvalue(-1)]long Category, [out, retval ]VARIANT_BOOL* retval); + [id(7), helpstring("method AddLabel")] HRESULT AddLabel([in]BSTR Text, [in]double x, [in]double y, [in, defaultvalue(0)]double Rotation, [in, defaultvalue(-1)]long Category, [in, defaultvalue(0)]double offsetX, [in, defaultvalue(0)]double offsetY); + [id(8), helpstring("method InsertLabel")] HRESULT InsertLabel([in]long Index, [in]BSTR Text, [in]double x, [in]double y, [in, defaultvalue(0)]double Rotation, [in, defaultvalue(-1)]long Category, [in, defaultvalue(0)]double offsetX, [in, defaultvalue(0)]double offsetY, [out, retval ]VARIANT_BOOL* retval); [id(9), helpstring("method RemoveLabel")] HRESULT RemoveLabel([in]long Index, [out, retval ]VARIANT_BOOL* retval); - [id(10), helpstring("method AddPart")] HRESULT AddPart([in] long Index,[in]BSTR Text, [in]double x, [in]double y, [in, defaultvalue(0)]double offsetX, [in, defaultvalue(0)]double offsetY, [in, defaultvalue(0)]double Rotation, [in, defaultvalue(-1)]long Category); - [id(11), helpstring("method InsertPart")] HRESULT InsertPart([in] long Index, [in] long Part, [in]BSTR Text, [in]double x, [in]double y, [in, defaultvalue(0)]double offsetX, [in, defaultvalue(0)]double offsetY, [in, defaultvalue(0)]double Rotation, [in, defaultvalue(-1)]long Category, [out, retval ]VARIANT_BOOL* retval); + [id(10), helpstring("method AddPart")] HRESULT AddPart([in] long Index,[in]BSTR Text, [in]double x, [in]double y, [in, defaultvalue(0)]double Rotation, [in, defaultvalue(-1)]long Category, [in, defaultvalue(0)]double offsetX, [in, defaultvalue(0)]double offsetY); + [id(11), helpstring("method InsertPart")] HRESULT InsertPart([in] long Index, [in] long Part, [in]BSTR Text, [in]double x, [in]double y, [in, defaultvalue(0)]double Rotation, [in, defaultvalue(-1)]long Category, [in, defaultvalue(0)]double offsetX, [in, defaultvalue(0)]double offsetY, [out, retval ]VARIANT_BOOL* retval); [id(12), helpstring("method RemovePart")] HRESULT RemovePart([in]long Index, [in]long Part, [out, retval ]VARIANT_BOOL* vbretval); [id(13), helpstring("method AddCategory")] HRESULT AddCategory([in]BSTR Name, [out, retval]ILabelCategory** retVal); diff --git a/src/Ogr/Ogr2Shape.cpp b/src/Ogr/Ogr2Shape.cpp index 7706d2fa..bfc87be8 100644 --- a/src/Ogr/Ogr2Shape.cpp +++ b/src/Ogr/Ogr2Shape.cpp @@ -489,7 +489,7 @@ void Ogr2Shape::CopyValues(OGRFeatureDefn* poFields, OGRFeature* poFeature, ISha CComPtr labels = NULL; sf->get_Labels(&labels); - labels->AddLabel(bstr, x, y, offsetX, offsetY, rotation); + labels->AddLabel(bstr, x, y, rotation, -1, offsetX, offsetY); } } From 34b78e980d7b1e0797d6312c2062a489c9d531d5 Mon Sep 17 00:00:00 2001 From: Paul Meems Date: Fri, 31 Jul 2020 10:25:37 +0200 Subject: [PATCH 2/2] Updating version numbers --- src/InnoSetup/MapWinGIS-only.iss | 4 ++-- src/MapWinGIS.rc | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/InnoSetup/MapWinGIS-only.iss b/src/InnoSetup/MapWinGIS-only.iss index b756c0bf..79ddd099 100644 --- a/src/InnoSetup/MapWinGIS-only.iss +++ b/src/InnoSetup/MapWinGIS-only.iss @@ -2,12 +2,12 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "MapWinGIS" -#define MyAppVersion "5.2.3" +#define MyAppVersion "5.2.4" #define MyAppPublisher "MapWindow Open Source GIS Community" #define MyAppURL "http://www.mapwindow.org" #define SetupLocation "D:\dev\MapWindow\MapWinGIS\git\src\InnoSetup" #define BinLocation "D:\dev\MapWindow\MapWinGIS\git\src\bin" -#define x64BitVersion +;; #define x64BitVersion ;; #define VsVersion = "2015" #define VsVersion = "2017" diff --git a/src/MapWinGIS.rc b/src/MapWinGIS.rc index 4f6eb9ce..89b54f4a 100644 --- a/src/MapWinGIS.rc +++ b/src/MapWinGIS.rc @@ -112,8 +112,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 5,2,3,0 - PRODUCTVERSION 5,2,3,0 + FILEVERSION 5,2,4,0 + PRODUCTVERSION 5,2,4,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -131,13 +131,13 @@ BEGIN VALUE "Comments", "This control includes a mapping component and objects for reading and writing shapefiles and various triangulated irregular network and grid files. It also has extensive label and chart options and includes projection routines." VALUE "CompanyName", "MapWindow OSS Team - www.mapwindow.org" VALUE "FileDescription", "MapWinGIS ActiveX Control" - VALUE "FileVersion", "5.2.3.0" + VALUE "FileVersion", "5.2.4.0" VALUE "InternalName", "MapWinGIS ActiveX Control" VALUE "LegalCopyright", "Copyright (C) 2004-2020 MapWindow OSS Team" VALUE "LegalTrademarks", "MapWindow GIS is a trademark of Daniel P. Ames, 2005-2020" VALUE "OriginalFilename", "MapWinGIS.ocx" VALUE "ProductName", "MapWinGIS ActiveX Control" - VALUE "ProductVersion", "5.2.3.0" + VALUE "ProductVersion", "5.2.4.0" END END BLOCK "VarFileInfo"