Skip to content
This repository has been archived by the owner on Mar 29, 2020. It is now read-only.

Commit

Permalink
Allow user control of map inversion. CK2 map does not need inversion.
Browse files Browse the repository at this point in the history
  • Loading branch information
dtremenak committed Feb 22, 2012
1 parent 6988843 commit fa2c566
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 7 deletions.
36 changes: 33 additions & 3 deletions ProvinceMapper/LaunchForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions ProvinceMapper/LaunchForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public LaunchForm()
tbMappingsFile.Text = Properties.Settings.Default.mappingFile;
cbScale.Checked = Properties.Settings.Default.fitMaps;
cbNamesFrom.SelectedItem = Properties.Settings.Default.namesFrom;
ckInvertSource.Checked = Properties.Settings.Default.invertSource;
ckInvertDest.Checked = Properties.Settings.Default.invertDest;
}

private void button1_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -71,11 +73,11 @@ private void button1_Click(object sender, EventArgs e)
// add geo data to province lists
lblStatus.Text = "Load Source Map";
Application.DoEvents();
Program.sourceMap = new MapReader(srcMap, Program.sourceDef.provinces, PushStatusUpdate);
Program.sourceMap = new MapReader(srcMap, Program.sourceDef.provinces, ckInvertSource.Checked, PushStatusUpdate);

lblStatus.Text = "Load Target Map";
Application.DoEvents();
Program.targetMap = new MapReader(targetMap, Program.targetDef.provinces, PushStatusUpdate);
Program.targetMap = new MapReader(targetMap, Program.targetDef.provinces, ckInvertDest.Checked, PushStatusUpdate);

// load localizations, if desired
if (cbNamesFrom.SelectedItem.ToString() == "Localization")
Expand Down Expand Up @@ -111,6 +113,8 @@ private void button1_Click(object sender, EventArgs e)
Properties.Settings.Default.mappingFile = tbMappingsFile.Text;
Properties.Settings.Default.fitMaps = cbScale.Checked;
Properties.Settings.Default.namesFrom = cbNamesFrom.SelectedItem.ToString();
Properties.Settings.Default.invertSource = ckInvertSource.Checked;
Properties.Settings.Default.invertDest = ckInvertDest.Checked;
Properties.Settings.Default.Save();
}

Expand Down
7 changes: 5 additions & 2 deletions ProvinceMapper/MapReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace ProvinceMapper
{
class MapReader
{
public MapReader(Bitmap _map, List<Province> provinces, StatusUpdate su)
public MapReader(Bitmap _map, List<Province> provinces, bool invert, StatusUpdate su)
{
su(0.0);

Expand All @@ -22,7 +22,10 @@ public MapReader(Bitmap _map, List<Province> provinces, StatusUpdate su)
map = _map;

bounds = new Rectangle(Point.Empty, map.Size);
map.RotateFlip(RotateFlipType.RotateNoneFlipY);
if (invert)
{
map.RotateFlip(RotateFlipType.RotateNoneFlipY);
}
UnsafeBitmap bmp = new UnsafeBitmap(map);
bmp.LockBitmap();

Expand Down
24 changes: 24 additions & 0 deletions ProvinceMapper/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions ProvinceMapper/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,11 @@
<Setting Name="namesFrom" Type="System.String" Scope="User">
<Value Profile="(Default)">Localization</Value>
</Setting>
<Setting Name="invertSource" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="invertDest" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>
6 changes: 6 additions & 0 deletions ProvinceMapper/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
<setting name="namesFrom" serializeAs="String">
<value>Localization</value>
</setting>
<setting name="invertSource" serializeAs="String">
<value>True</value>
</setting>
<setting name="invertDest" serializeAs="String">
<value>True</value>
</setting>
</ProvinceMapper.Properties.Settings>
</userSettings>
</configuration>

0 comments on commit fa2c566

Please sign in to comment.