Skip to content

Commit 2e338c1

Browse files
committed
Merge branch 'release/v5.2.0'
2 parents eba0782 + 4f19cb8 commit 2e338c1

File tree

163 files changed

+1329
-1025
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+1329
-1025
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,5 @@ src/Plugins/MW5.NtkPlugin/
167167
src/Plugins/MW5.TemplateNtk/ClassDiagram1.cd
168168
src/Plugins/MW5.TemplateNtk/
169169
src/Plugins/MW5.TopoGISPlugin/
170+
test/MW5.Test/packages/
171+
src/.nuget/

MapWindow-v5.1.1.png

340 KB
Loading

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
MW5 is a desktop GIS which is extendable using the plug-in architecture.
33
It is using the MapWinGIS mapping control and is created from scratch in 2015 using new technologies like MEF and Dependency Injection making it small in size, robust and fast.
44

5+
![MapWindow-v5.1.1](MapWindow-v5.1.1.png)
6+
57
We're always looking for C#, C++ and OpenCL/OpenGL developers.
68
If you have design skills we need you as well ;)
79

install/MapWindow5.iss

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define MyAppURL "http://www.mapwindow.org/documentation/mapwindow5/"
1515
#define ReleaseNotes ExeBinPath + "\..\..\..\src\SolutionItems\ReleaseNotes.rtf"
1616

17-
;#define x64BitVersion true
17+
#define x64BitVersion true
1818

1919
#ifdef x64BitVersion
2020
#define CPU "x64"
@@ -70,10 +70,10 @@ VersionInfoProductName={#MyAppName}
7070
VersionInfoProductVersion={#MyAppVersion}
7171
AlwaysShowComponentsList=false
7272
#ifdef x64BitVersion
73-
ArchitecturesAllowed=x64
74-
ArchitecturesInstallIn64BitMode=x64
73+
ArchitecturesAllowed=x64
74+
ArchitecturesInstallIn64BitMode=x64
7575
#endif
76-
ChangesAssociations=True
76+
ChangesAssociations=Yes
7777
UsePreviousAppDir=False
7878

7979
[Components]
@@ -82,7 +82,7 @@ Name: "USASampleData"; Description: "USA Sample data"; Types: full
8282

8383
[Files]
8484
;; MapWinGIS
85-
Source: "{#ExeBinPath}\MapWinGIS\*.*"; DestDir: "{app}\MapWinGIS"; Flags: ignoreversion recursesubdirs createallsubdirs {#SystemFlag}; Components: MapWindow
85+
Source: "{#ExeBinPath}\MapWinGIS\*.*"; DestDir: "{app}\MapWinGIS"; Flags: ignoreversion recursesubdirs createallsubdirs {#SystemFlag}; Components: MapWindow; Excludes: "libecwj2.dll, *.exe, *.pdb"
8686
;; MapWindow5 dlls
8787
Source: "{#ExeBinPath}\*.dll"; DestDir: "{app}"; Flags: ignoreversion {#SystemFlag}; Components: MapWindow
8888
Source: "{#ExeBinPath}\MapWindow.exe"; DestDir: "{app}"; Flags: ignoreversion {#SystemFlag}; Components: MapWindow
@@ -93,7 +93,7 @@ Source: "{#ExeBinPath}\Projections\*"; DestDir: "{app}\Projections"; Flags: igno
9393
;; Manuals sub folder
9494
Source: "{#ExeBinPath}\Manuals\*"; DestDir: "{app}\Manuals"; Flags: ignoreversion recursesubdirs createallsubdirs {#SystemFlag}; Components: MapWindow
9595
;; Plugins subfolder
96-
Source: "{#ExeBinPath}\Plugins\*.dll"; DestDir: "{app}\Plugins"; Flags: ignoreversion {#SystemFlag}; Components: MapWindow; Excludes: "Interop.MapWinGIS.dll,MW5.TemplatePlugin.dll"
96+
Source: "{#ExeBinPath}\Plugins\*.dll"; DestDir: "{app}\Plugins"; Flags: ignoreversion {#SystemFlag}; Components: MapWindow; Excludes: "Interop.MapWinGIS.dll,MW5.TemplatePlugin.dll,Syncfusion.*"
9797
;; Styles subfolder
9898
Source: "{#ExeBinPath}\Styles\*"; DestDir: "{app}\Styles"; Flags: ignoreversion recursesubdirs createallsubdirs {#SystemFlag}; Components: MapWindow
9999
;; SQLite interop:
@@ -125,9 +125,9 @@ BeveledLabel={#MyAppName}
125125
[Run]
126126
; Install VC++ 2013 if needed:
127127
#ifdef x64BitVersion
128-
Filename: "{tmp}\{#vcredist}"; Parameters: "/qb"; Flags: waituntilterminated; Check: VCRedistNeedsInstall_x64()
128+
Filename: "{tmp}\{#vcredist}"; Parameters: "/quiet"; Flags: waituntilterminated; Check: VCRedistNeedsInstall_x64()
129129
#else
130-
Filename: "{tmp}\{#vcredist}"; Parameters: "/qb"; Flags: waituntilterminated; Check: VCRedistNeedsInstall_x86()
130+
Filename: "{tmp}\{#vcredist}"; Parameters: "/quiet"; Flags: waituntilterminated; Check: VCRedistNeedsInstall_x86()
131131
#endif
132132
Filename: "{app}\MapWindow.exe"; Flags: shellexec runasoriginaluser postinstall nowait skipifsilent; Description: "Start MapWindow5 GIS?"
133133
Filename: "{code:GetDataDir}"; Flags: shellexec runasoriginaluser nowait skipifsilent; Description: "Open sample data folder"; Components: USASampleData
@@ -150,14 +150,16 @@ Type: filesandordirs; Name: "{app}\Logs"; Components: MapWindow
150150

151151
[Registry]
152152
;; http://www.jrsoftware.org/isfaq.php#assoc
153-
Root: HKCR; Subkey: ".mwproj"; ValueType: string; ValueName: ""; ValueData: "MW5Project"; Flags: uninsdeletevalue
154-
Root: HKCR; Subkey: "MW5Project"; ValueType: string; ValueName: ""; ValueData: "MW5 Project"; Flags: uninsdeletekey
155-
Root: HKCR; Subkey: "MW5Project\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\MAPWINDOW.EXE,0"
156-
Root: HKCR; Subkey: "MW5Project\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\MAPWINDOW.EXE"" ""%1"""
153+
Root: "HKCR"; Subkey: ".mwproj"; ValueType: string; ValueData: "MW5Project"; Flags: uninsdeletevalue;
154+
Root: "HKCR"; Subkey: "MW5Project"; ValueType: string; ValueData: "MW5 Project"; Flags: uninsdeletekey
155+
Root: "HKCR"; Subkey: "MW5Project\DefaultIcon"; ValueType: string; ValueData: "{app}\MAPWINDOW.EXE,0"
156+
Root: "HKCR"; Subkey: "MW5Project\shell\open\command"; ValueType: string; ValueData: """{app}\MAPWINDOW.EXE"" ""%1"""
157157

158158
[InstallDelete]
159159
Type: files; Name: "{app}\Plugins\MW5.TemplatePlugin.dll"; Components: MapWindow
160160
Type: files; Name: "{app}\Plugins\Interop.MapWinGIS.dll"; Components: MapWindow
161+
;; Old ECW driver, conflicts with new driver:
162+
Type: files; Name: "{app}\MapWinGIS\libecwj2.dll"; Components: MapWindow
161163

162164
[Code]
163165
#IFDEF UNICODE

src/.nuget/NuGet.Config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<solution>
4+
<add key="disableSourceControlIntegration" value="true" />
5+
</solution>
6+
</configuration>

src/.nuget/NuGet.targets

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
5+
6+
<!-- Enable the restore command to run before builds -->
7+
<RestorePackages Condition=" '$(RestorePackages)' == '' ">true</RestorePackages>
8+
9+
<!-- Property that enables building a package from a project -->
10+
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
11+
12+
<!-- Determines if package restore consent is required to restore packages -->
13+
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
14+
15+
<!-- Download NuGet.exe if it does not already exist -->
16+
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">true</DownloadNuGetExe>
17+
</PropertyGroup>
18+
19+
<ItemGroup Condition=" '$(PackageSources)' == '' ">
20+
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
21+
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
22+
<!--
23+
<PackageSource Include="https://www.nuget.org/api/v2/" />
24+
<PackageSource Include="https://my-nuget-source/nuget/" />
25+
-->
26+
</ItemGroup>
27+
28+
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
29+
<!-- Windows specific commands -->
30+
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
31+
</PropertyGroup>
32+
33+
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
34+
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
35+
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
36+
</PropertyGroup>
37+
38+
<PropertyGroup>
39+
<PackagesProjectConfig Condition=" '$(OS)' == 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>
40+
<PackagesProjectConfig Condition=" '$(OS)' != 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config</PackagesProjectConfig>
41+
</PropertyGroup>
42+
43+
<PropertyGroup>
44+
<PackagesConfig Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfig>
45+
<PackagesConfig Condition="Exists('$(PackagesProjectConfig)')">$(PackagesProjectConfig)</PackagesConfig>
46+
</PropertyGroup>
47+
48+
<PropertyGroup>
49+
<!-- NuGet command -->
50+
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
51+
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
52+
53+
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
54+
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 "$(NuGetExePath)"</NuGetCommand>
55+
56+
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
57+
58+
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
59+
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
60+
61+
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
62+
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
63+
64+
<!-- Commands -->
65+
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
66+
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
67+
68+
<!-- We need to ensure packages are restored prior to assembly resolve -->
69+
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
70+
RestorePackages;
71+
$(BuildDependsOn);
72+
</BuildDependsOn>
73+
74+
<!-- Make the build depend on restore packages -->
75+
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
76+
$(BuildDependsOn);
77+
BuildPackage;
78+
</BuildDependsOn>
79+
</PropertyGroup>
80+
81+
<Target Name="CheckPrerequisites">
82+
<!-- Raise an error if we're unable to locate nuget.exe -->
83+
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
84+
<!--
85+
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
86+
This effectively acts as a lock that makes sure that the download operation will only happen once and all
87+
parallel builds will have to wait for it to complete.
88+
-->
89+
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
90+
</Target>
91+
92+
<Target Name="_DownloadNuGet">
93+
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
94+
</Target>
95+
96+
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
97+
<Exec Command="$(RestoreCommand)"
98+
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
99+
100+
<Exec Command="$(RestoreCommand)"
101+
LogStandardErrorAsError="true"
102+
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
103+
</Target>
104+
105+
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
106+
<Exec Command="$(BuildCommand)"
107+
Condition=" '$(OS)' != 'Windows_NT' " />
108+
109+
<Exec Command="$(BuildCommand)"
110+
LogStandardErrorAsError="true"
111+
Condition=" '$(OS)' == 'Windows_NT' " />
112+
</Target>
113+
114+
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
115+
<ParameterGroup>
116+
<OutputFilename ParameterType="System.String" Required="true" />
117+
</ParameterGroup>
118+
<Task>
119+
<Reference Include="System.Core" />
120+
<Using Namespace="System" />
121+
<Using Namespace="System.IO" />
122+
<Using Namespace="System.Net" />
123+
<Using Namespace="Microsoft.Build.Framework" />
124+
<Using Namespace="Microsoft.Build.Utilities" />
125+
<Code Type="Fragment" Language="cs">
126+
<![CDATA[
127+
try {
128+
OutputFilename = Path.GetFullPath(OutputFilename);
129+
130+
Log.LogMessage("Downloading latest version of NuGet.exe...");
131+
WebClient webClient = new WebClient();
132+
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
133+
134+
return true;
135+
}
136+
catch (Exception ex) {
137+
Log.LogErrorFromException(ex);
138+
return false;
139+
}
140+
]]>
141+
</Code>
142+
</Task>
143+
</UsingTask>
144+
</Project>

src/MW5.Api/Concrete/AttributeFieldList.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ IEnumerator IEnumerable.GetEnumerator()
6262
return GetEnumerator();
6363
}
6464

65-
public void Add(IAttributeField item)
65+
public bool Add(IAttributeField item)
6666
{
67-
_table.EditInsertField(item.GetInternal(), _table.NumFields);
67+
return _table.EditInsertField(item.GetInternal(), _table.NumFields);
6868
}
6969

7070
public int Add(string name, AttributeType type, int precision, int width)
@@ -104,9 +104,9 @@ public bool Exists(string fieldName)
104104
return IndexByName(fieldName) != -1;
105105
}
106106

107-
public void Insert(int index, IAttributeField item)
107+
public bool Insert(int index, IAttributeField item)
108108
{
109-
_table.EditInsertField(item.GetInternal(), index);
109+
return _table.EditInsertField(item.GetInternal(), index);
110110
}
111111

112112
public int IndexByName(string fieldName)

src/MW5.Api/Concrete/BitmapSource.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal BitmapSource(Image image)
2525
_image = image;
2626
}
2727

28-
public stdole.IPictureDisp Picture
28+
public IPictureDisp Picture
2929
{
3030
get { return _image.Picture; }
3131
set { _image.Picture = value; }
@@ -179,6 +179,7 @@ public InRamState InRamState
179179
{
180180
get
181181
{
182+
// ReSharper disable RedundantCaseLabel
182183
switch (_image.SourceType)
183184
{
184185
case tkImageSourceType.istDiskBased:
@@ -221,15 +222,15 @@ public bool Save(string filename, bool writeWorldFile = false,
221222
return _image.Save(filename, writeWorldFile, (ImageType) fileType);
222223
}
223224

224-
public void ImageToProjection(int imageX, int imageY, out double projX, out double projY)
225+
public void ImageToProjection(int column, int row, out double projX, out double projY)
225226
{
226-
_image.ImageToProjection(imageX, imageY, out projX, out projY);
227+
_image.ImageToProjection(column, row, out projX, out projY);
227228
}
228229

229-
public bool ProjectionToImage(double projX, double projY, out int imageX, out int imageY)
230+
public bool ProjectionToImage(double projX, double projY, out int column, out int row)
230231
{
231-
_image.ProjectionToImage(projX, projY, out imageX, out imageY);
232-
return imageX >= 0 && imageX < Width && imageY >= 0 && imageY < Height;
232+
_image.ProjectionToImage(projX, projY, out column, out row);
233+
return column >= 0 && column < Width && row >= 0 && row < Height;
233234
}
234235

235236
public Color GetPixel(int row, int column)
@@ -369,7 +370,7 @@ public void Dispose()
369370
public System.Drawing.Image ToGdiPlusBitmap()
370371
{
371372
var utils = new OleImageHelper();
372-
return utils.GetPictureFromIPicture(this.Picture);
373+
return utils.GetPictureFromIPicture(Picture);
373374
}
374375

375376
public bool FromGdiPlusBitmap(System.Drawing.Image image)

src/MW5.Api/Concrete/ColorInterval.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
using System;
22
using System.Drawing;
33
using MapWinGIS;
4-
using MW5.Api.Helpers;
54
using MW5.Shared;
65

76
namespace MW5.Api.Concrete
87
{
98
public class ColorInterval : IEquatable<ColorInterval>
109
{
1110
// these 2 are used to loop through breaks
12-
private int _breakIndex = -1;
13-
private ColorScheme _scheme = null;
11+
private readonly int _breakIndex = -1;
12+
private readonly ColorScheme _scheme;
1413

1514
// these ones for adding a new break
16-
private double _value;
15+
private readonly double _value;
1716
private Color _color;
1817

1918
public double Value
@@ -62,7 +61,7 @@ internal ColorInterval(ColorScheme scheme, int breakIndex)
6261
}
6362
if (breakIndex < 0 || breakIndex >= scheme.NumBreaks)
6463
{
65-
throw new ArgumentOutOfRangeException("Color break index is out of range.");
64+
throw new ArgumentOutOfRangeException("breakIndex", "Color break index is out of range.");
6665
}
6766
_scheme = scheme;
6867
_breakIndex = breakIndex;
@@ -71,7 +70,7 @@ internal ColorInterval(ColorScheme scheme, int breakIndex)
7170
public bool Equals(ColorInterval other)
7271
{
7372
// TODO: use tolerance for comparison
74-
return other.Value == this.Value;
73+
return other != null && other.Value.Equals(Value);
7574
}
7675

7776
public override bool Equals(object obj)

src/MW5.Api/Concrete/ColorRamp.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Drawing.Drawing2D;
66
using MapWinGIS;
77
using MW5.Api.Enums;
8-
using MW5.Api.Helpers;
98
using MW5.Api.Interfaces;
109
using MW5.Shared;
1110

@@ -49,7 +48,7 @@ public ColorInterval this[int index]
4948
{
5049
if (index >= 0 && index < Count)
5150
{
52-
var color = ColorHelper.UintToColor(_scheme.BreakColor[index]);
51+
// var color = ColorHelper.UintToColor(_scheme.BreakColor[index]);
5352
return new ColorInterval(_scheme, index);
5453
}
5554
return null;

0 commit comments

Comments
 (0)