├── LICENCE ├── MCDA.Test ├── FeatureTest.cs ├── IdentityNormalizationTest.cs ├── MCDA.Test.csproj ├── MCDA.Test.csproj.vspscc ├── MaximumScoreNormalizationTest.cs ├── ObserveableCollectionTest.cs ├── ProgressHandlerTest.cs ├── Properties │ └── AssemblyInfo.cs ├── ScoreRangeNormalizationTest.cs ├── TestUtil.cs ├── WLCToolTest.cs ├── app.config └── packages.config ├── MCDA.sln ├── MCDA.vssscc ├── MCDA ├── Config.Designer.cs ├── Config.esriaddinx ├── CustomControls │ ├── FlipControl.xaml │ ├── FlipControl.xaml.cs │ └── LabeledSlider.cs ├── Images │ ├── AHPTool.png │ ├── AddData.png │ ├── AddDataWindow.png │ ├── ArcGISAddin1.png │ ├── Config.png │ ├── ConfigView.png │ ├── LWLCTool.png │ ├── MCDA Add-in.png │ ├── OWATool.png │ ├── OWAToolView.png │ ├── StandardizationSelection.png │ ├── Visualization.png │ ├── VisualizationGraphics │ │ └── Breaks.png │ ├── VisualizationView.png │ ├── WLCTool.png │ ├── WLCToolView.png │ └── toolbargraphics │ │ ├── Alpha.png │ │ ├── Distribution.png │ │ ├── Export.png │ │ ├── LockLocked.png │ │ ├── LockOpen.png │ │ ├── MapAdd.png │ │ ├── MapDelete.png │ │ ├── Neighborhood.png │ │ └── Normalization.png ├── MCDA.csproj ├── MCDA.csproj.vspscc ├── Misc │ ├── AddDataButton.cs │ ├── Classification.cs │ ├── ConfigButton.cs │ ├── Export.cs │ ├── ExtensionMethods.cs │ ├── LWLCToolButton.cs │ ├── MCDAExtension.cs │ ├── OWAToolButton.cs │ ├── ProgressDialog.cs │ ├── ProgressHandler.cs │ ├── Range.cs │ ├── Util.cs │ ├── VisualizationButton.cs │ └── WLCToolButton.cs ├── Model │ ├── AbstractToolParameter.cs │ ├── AbstractToolTemplate.cs │ ├── BiPolarRendererContainer.cs │ ├── ClassBreaksRendererContainer.cs │ ├── Cluster.cs │ ├── ConfigSingleton.cs │ ├── Feature.cs │ ├── Field.cs │ ├── FieldTypeOID.cs │ ├── IDeepCloneable.cs │ ├── IStandardizationStrategy.cs │ ├── ITool.cs │ ├── IToolParameter.cs │ ├── IWeightDistributeStrategy.cs │ ├── IdentityStandardizationStrategy.cs │ ├── LWLCTool.cs │ ├── MaximumScoreNormalizationStrategy.cs │ ├── NormalizationStrategyFactory.cs │ ├── NullToFalseConverter.cs │ ├── OWATool.cs │ ├── ProportionalDistributionStrategy.cs │ ├── RelayCommand.cs │ ├── RendererContainer.cs │ ├── RendererFactory.cs │ ├── ScoreRangeNormalizationStrategy.cs │ ├── ToolFactory.cs │ ├── ToolParameter.cs │ ├── ToolParameterContainer.cs │ ├── WLCTool.cs │ ├── WeightDistributionStrategyFactory.cs │ └── WeightValidationRule.cs ├── Properties │ └── AssemblyInfo.cs ├── View │ ├── AddDataView.xaml │ ├── AddDataView.xaml.cs │ ├── AlphaSelectionView.xaml │ ├── AlphaSelectionView.xaml.cs │ ├── ConfigView.xaml │ ├── ConfigView.xaml.cs │ ├── LWLCToolView.xaml │ ├── LWLCToolView.xaml.cs │ ├── NeighborhoodSelectionView.xaml │ ├── NeighborhoodSelectionView.xaml.cs │ ├── NormalizationSelectionView.xaml │ ├── NormalizationSelectionView.xaml.cs │ ├── OWAToolView.xaml │ ├── OWAToolView.xaml.cs │ ├── VisualizationView.xaml │ ├── VisualizationView.xaml.cs │ ├── WLCToolView.xaml │ └── WLCToolView.xaml.cs ├── ViewModel │ ├── AbstractToolViewModel.cs │ ├── AddDataViewModel.cs │ ├── AlphaSelectionViewModel.cs │ ├── ConfigViewModel.cs │ ├── EnumToBooleanConverter.cs │ ├── LWLCToolViewModel.cs │ ├── NeighborhoodSelectionViewModel.cs │ ├── NormalizationSelectionViewModel.cs │ ├── OWAToolViewModel.cs │ ├── VisualizationViewModel.cs │ ├── WLCToolViewModel.cs │ └── WpfProgressDialogViewModel.cs ├── app.config ├── packages.config └── view │ ├── WpfProgressDialog.xaml │ └── WpfProgressDialog.xaml.cs ├── README.md ├── _config.yml ├── doc ├── MCDA4ArcMap User Guide.docx ├── MCDA4ArcMap_Architecture_and_Implementation_Details.docx ├── Using_MCDA4ArcMap.pdf └── overview.jpg └── packages └── repositories.config /MCDA.Test/FeatureTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using MCDA.Model; 4 | using ESRI.ArcGIS.Carto; 5 | using ESRI.ArcGIS.Geodatabase; 6 | 7 | namespace MCDA.Test 8 | { 9 | [TestClass] 10 | public class FeatureTest 11 | { 12 | [TestMethod] 13 | public void TestMethod1() 14 | { 15 | /*object o = new object(); 16 | 17 | IFeatureLayer2 featureLayer = o as IFeatureLayer2; 18 | IFeatureClass featureClass = o as IFeatureClass; 19 | 20 | MCDA.Model.Feature feature = new MCDA.Model.Feature(featureClass, featureLayer); 21 | */ 22 | 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /MCDA.Test/IdentityNormalizationTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using System.Data; 4 | using System.Linq; 5 | 6 | namespace MCDA.Test 7 | { 8 | [TestClass] 9 | public class IdentityNormalizationTest 10 | { 11 | private MCDA.Model.INormalizationStrategy IdentityNormalizationStrategy { get; set; } 12 | 13 | [TestInitialize] 14 | public void Init() 15 | { 16 | IdentityNormalizationStrategy = MCDA.Model.NormalizationStrategyFactory.GetStrategy(Model.NormalizationStrategy.IdentityNormalizationStrategy); 17 | } 18 | 19 | [TestMethod] 20 | public void TestMethod1() 21 | { 22 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { -3d, -2d, 0d }); 23 | 24 | IdentityNormalizationStrategy.Transform(dataColumn); 25 | 26 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), -3); 27 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), -2); 28 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 0); 29 | } 30 | 31 | [TestMethod] 32 | public void TestMethod2() 33 | { 34 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 0d, 0d, 0d }); 35 | 36 | IdentityNormalizationStrategy.Transform(dataColumn); 37 | 38 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 0); 39 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 0); 40 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 0); 41 | } 42 | 43 | [TestMethod] 44 | public void TestMethod3() 45 | { 46 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 1d, 1d, 1d }); 47 | 48 | IdentityNormalizationStrategy.Transform(dataColumn); 49 | 50 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 1); 51 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 1); 52 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 1); 53 | } 54 | 55 | [TestMethod] 56 | public void TestMethod4() 57 | { 58 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 1d, 2d, 3d }); 59 | 60 | IdentityNormalizationStrategy.Transform(dataColumn); 61 | 62 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 1); 63 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 2); 64 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 3); 65 | } 66 | 67 | [TestMethod] 68 | public void TestMethod5() 69 | { 70 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { -3d, -2d, 0d }); 71 | 72 | IdentityNormalizationStrategy.Transform(dataColumn, false); 73 | 74 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), -3); 75 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), -2); 76 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 0); 77 | } 78 | 79 | [TestMethod] 80 | public void TestMethod6() 81 | { 82 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 0d, 0d, 0d }); 83 | 84 | IdentityNormalizationStrategy.Transform(dataColumn, false); 85 | 86 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 0); 87 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 0); 88 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 0); 89 | } 90 | 91 | [TestMethod] 92 | public void TestMethod7() 93 | { 94 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 1d, 1d, 1d }); 95 | 96 | IdentityNormalizationStrategy.Transform(dataColumn, false); 97 | 98 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 1); 99 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 1); 100 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 1); 101 | } 102 | 103 | [TestMethod] 104 | public void TestMethod8() 105 | { 106 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 1d, 2d, 3d }); 107 | 108 | IdentityNormalizationStrategy.Transform(dataColumn, false); 109 | 110 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 1); 111 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 2); 112 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 3); 113 | } 114 | 115 | [TestMethod] 116 | public void TestMethod9() 117 | { 118 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 1, 2, 3 }); 119 | 120 | IdentityNormalizationStrategy.Transform(dataColumn); 121 | 122 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 1); 123 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 2); 124 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 3); 125 | } 126 | 127 | [TestMethod] 128 | public void TestMethod10() 129 | { 130 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { "string" }); 131 | 132 | IdentityNormalizationStrategy.Transform(dataColumn); 133 | 134 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), "string"); 135 | } 136 | 137 | [TestMethod] 138 | public void TestMethod11() 139 | { 140 | DataColumn dataColumn = TestUtil.CreateDataColumn(Enumerable.Empty()); 141 | 142 | IdentityNormalizationStrategy.Transform(dataColumn); 143 | 144 | Assert.AreEqual(dataColumn.Table.Rows.Count, 0); 145 | } 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /MCDA.Test/MCDA.Test.csproj.vspscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" 10 | } 11 | -------------------------------------------------------------------------------- /MCDA.Test/MaximumScoreNormalizationTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | using System.Data; 5 | using System.IO; 6 | using System.Collections.Generic; 7 | 8 | namespace MCDA.Test 9 | { 10 | [TestClass] 11 | public class MaximumScoreNormalizationTest 12 | { 13 | private MCDA.Model.INormalizationStrategy MaximumScoreNormalizationStrategy { get; set; } 14 | 15 | [TestInitialize] 16 | public void Init() 17 | { 18 | MaximumScoreNormalizationStrategy = MCDA.Model.NormalizationStrategyFactory.GetStrategy(Model.NormalizationStrategy.MaximumScoreNormalizationStrategy); 19 | } 20 | 21 | [TestMethod] 22 | public void TestMethod1() 23 | { 24 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { -3d, -2d, 0d }); 25 | 26 | MaximumScoreNormalizationStrategy.Transform(dataColumn); 27 | 28 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), -3); 29 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), -2); 30 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 0); 31 | } 32 | 33 | [TestMethod] 34 | public void TestMethod2() 35 | { 36 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 0d, 0d, 0d }); 37 | 38 | MaximumScoreNormalizationStrategy.Transform(dataColumn); 39 | 40 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 0); 41 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 0); 42 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 0); 43 | } 44 | 45 | [TestMethod] 46 | public void TestMethod3() 47 | { 48 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 1d, 1d, 1d }); 49 | 50 | MaximumScoreNormalizationStrategy.Transform(dataColumn); 51 | 52 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 1); 53 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 1); 54 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 1); 55 | } 56 | 57 | [TestMethod] 58 | public void TestMethod4() 59 | { 60 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 1d, 2d, 3d }); 61 | 62 | MaximumScoreNormalizationStrategy.Transform(dataColumn); 63 | 64 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 0.33, 0.01); 65 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 0.66, 0.01); 66 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 1); 67 | } 68 | 69 | [TestMethod] 70 | public void TestMethod5() 71 | { 72 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { -3d, -2d, 0d }); 73 | 74 | MaximumScoreNormalizationStrategy.Transform(dataColumn, false); 75 | 76 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), -3); 77 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), -2); 78 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 0); 79 | } 80 | 81 | [TestMethod] 82 | public void TestMethod6() 83 | { 84 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 0d, 0d, 0d }); 85 | 86 | MaximumScoreNormalizationStrategy.Transform(dataColumn, false); 87 | 88 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 0); 89 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 0); 90 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 0); 91 | } 92 | 93 | [TestMethod] 94 | public void TestMethod7() 95 | { 96 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 1d, 1d, 1d }); 97 | 98 | MaximumScoreNormalizationStrategy.Transform(dataColumn, false); 99 | 100 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 0); 101 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 0); 102 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 0); 103 | } 104 | 105 | [TestMethod] 106 | public void TestMethod8() 107 | { 108 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 1d, 2d, 3d }); 109 | 110 | MaximumScoreNormalizationStrategy.Transform(dataColumn, false); 111 | 112 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 0.66, 0.01); 113 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 0.33, 0.01); 114 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 0); 115 | } 116 | 117 | [TestMethod] 118 | public void TestMethod9() 119 | { 120 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 1, 2, 3 }); 121 | 122 | MaximumScoreNormalizationStrategy.Transform(dataColumn); 123 | 124 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 0); 125 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 0); 126 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 1); 127 | } 128 | 129 | [TestMethod] 130 | public void TestMethod10() 131 | { 132 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { "string" }); 133 | 134 | MaximumScoreNormalizationStrategy.Transform(dataColumn); 135 | 136 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), "string"); 137 | } 138 | 139 | [TestMethod] 140 | public void TestMethod11() 141 | { 142 | DataColumn dataColumn = TestUtil.CreateDataColumn(Enumerable.Empty()); 143 | 144 | MaximumScoreNormalizationStrategy.Transform(dataColumn); 145 | 146 | Assert.AreEqual(dataColumn.Table.Rows.Count, 0); 147 | } 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /MCDA.Test/ObserveableCollectionTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using MCDA.Extensions; 8 | using Microsoft.VisualStudio.TestTools.UnitTesting; 9 | 10 | namespace MCDA.Test 11 | { 12 | [TestClass] 13 | public class ObserveableCollectionTest 14 | { 15 | [TestMethod] 16 | public void TestMethod1() 17 | { 18 | var observableCollection = new ObservableCollection {"bCa", "abc", "caB"}; 19 | 20 | observableCollection.SortBy(i => i); 21 | 22 | Assert.AreEqual(observableCollection[0], "abc"); 23 | Assert.AreEqual(observableCollection[1], "bCa"); 24 | Assert.AreEqual(observableCollection[2], "caB"); 25 | } 26 | 27 | [TestMethod] 28 | public void TestMethod2() 29 | { 30 | var observableCollection = new ObservableCollection { "bCa", "abc", "caB" }; 31 | 32 | observableCollection.SortByDescending(i => i); 33 | 34 | Assert.AreEqual(observableCollection[2], "abc"); 35 | Assert.AreEqual(observableCollection[1], "bCa"); 36 | Assert.AreEqual(observableCollection[0], "caB"); 37 | } 38 | 39 | [TestMethod] 40 | public void TestMethod3() 41 | { 42 | var observableCollection = new ObservableCollection { 34, -2, 0 }; 43 | 44 | observableCollection.SortBy(i => i); 45 | 46 | Assert.AreEqual(observableCollection[0], -2); 47 | Assert.AreEqual(observableCollection[1], 0); 48 | Assert.AreEqual(observableCollection[2], 34); 49 | } 50 | 51 | [TestMethod] 52 | public void TestMethod4() 53 | { 54 | var observableCollection = new ObservableCollection { 34, -2, 0 }; 55 | 56 | observableCollection.SortByDescending(i => i); 57 | 58 | Assert.AreEqual(observableCollection[2], -2); 59 | Assert.AreEqual(observableCollection[1], 0); 60 | Assert.AreEqual(observableCollection[0], 34); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /MCDA.Test/ProgressHandlerTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using MCDA.Misc; 4 | using Microsoft.VisualStudio.TestTools.UnitTesting; 5 | 6 | namespace MCDA.Test 7 | { 8 | [TestClass] 9 | public class ProgressHandlerTest 10 | { 11 | private void Task(ProgressHandler progressHandler) 12 | { 13 | //progressHandler.Callback(1, "blub"); 14 | } 15 | 16 | public void ProgressDialogMockUp(Action action) 17 | { 18 | BackgroundWorker worker = new BackgroundWorker { WorkerReportsProgress = true }; 19 | 20 | Delegate LWCLAction = action; 21 | 22 | worker.DoWork += (s, ea) => 23 | { 24 | Action callback = new Action((p, t) => 25 | { 26 | (s as BackgroundWorker).ReportProgress(p); 27 | string str = t; 28 | 29 | } 30 | ); 31 | 32 | ProgressHandler progressHandler = new ProgressHandler(); 33 | 34 | LWCLAction.DynamicInvoke(progressHandler); 35 | 36 | }; 37 | worker.ProgressChanged += (s, ex) => 38 | { 39 | //dlg.ProgressBar.Value = ex.ProgressPercentage; 40 | int i = ex.ProgressPercentage; 41 | }; 42 | 43 | worker.RunWorkerCompleted += (o, ea) => 44 | { 45 | //dlg.Close(); 46 | }; 47 | 48 | //dlg.Show(); 49 | worker.RunWorkerAsync(); 50 | } 51 | [TestMethod] 52 | public void TestMethod1() 53 | { 54 | ProgressDialogMockUp(Task); 55 | //Assert.AreEqual(1, 2); 56 | } 57 | 58 | [TestMethod] 59 | public void TestMethod2() 60 | { 61 | ProgressHandler progressHandler = new ProgressHandler(); 62 | 63 | for (int i = 0; i < 100; i++) 64 | { 65 | progressHandler.OnProgress(i, i.ToString()); 66 | 67 | Assert.AreEqual(i, progressHandler.Progress); 68 | Assert.AreEqual(i.ToString(), progressHandler.Text); 69 | } 70 | } 71 | 72 | [TestMethod] 73 | public void TestMethod3() 74 | { 75 | ProgressHandler progressHandler = new ProgressHandler(); 76 | string progressText = "50 percent"; 77 | int progress = 0; 78 | string text = String.Empty; 79 | 80 | progressHandler.ProgressEvent += (p, t) => 81 | { 82 | progress = p; 83 | text = t; 84 | }; 85 | 86 | progressHandler.OnProgress(50, progressText); 87 | 88 | Assert.AreEqual(50, progress); 89 | Assert.AreEqual(text, progressText); 90 | } 91 | 92 | [TestMethod] 93 | public void TestMethod4() 94 | { 95 | ProgressHandler progressHandler = new ProgressHandler(); 96 | 97 | progressHandler.OnProgress(50, String.Empty); 98 | 99 | ProgressHandler childHandler = progressHandler.ProvideChildProgressHandler(10); 100 | childHandler.OnProgress(50, String.Empty); 101 | 102 | Assert.AreEqual(55, progressHandler.Progress); 103 | 104 | ProgressHandler childCallback2 = progressHandler.ProvideChildProgressHandler(40); 105 | 106 | // Getting a new one finishes the old one 107 | Assert.AreEqual(60, progressHandler.Progress); 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /MCDA.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MCDA.Test")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MCDA.Test")] 13 | [assembly: AssemblyCopyright("Copyright © 2014 Steffan Voß")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("473d3a46-48fe-496b-8ee9-74ef462d72cf")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /MCDA.Test/ScoreRangeNormalizationTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | using System.Data; 5 | 6 | 7 | namespace MCDA.Test 8 | { 9 | [TestClass] 10 | public class ScoreRangeNormalizationTest 11 | { 12 | private MCDA.Model.INormalizationStrategy ScoreRangeNormalizationStrategy { get; set; } 13 | 14 | [TestInitialize] 15 | public void Init() 16 | { 17 | ScoreRangeNormalizationStrategy = MCDA.Model.NormalizationStrategyFactory.GetStrategy(Model.NormalizationStrategy.ScoreRangeNormalizationStrategy); 18 | } 19 | 20 | [TestMethod] 21 | public void TestMethod1() 22 | { 23 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { -3d, -2d, 0d }); 24 | 25 | ScoreRangeNormalizationStrategy.Transform(dataColumn); 26 | 27 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 0); 28 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 0.33, 0.01); 29 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 1); 30 | } 31 | 32 | [TestMethod] 33 | public void TestMethod2() 34 | { 35 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 0d, 0d, 0d }); 36 | 37 | ScoreRangeNormalizationStrategy.Transform(dataColumn); 38 | 39 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 0); 40 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 0); 41 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 0); 42 | } 43 | 44 | [TestMethod] 45 | public void TestMethod3() 46 | { 47 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 1d, 1d, 1d }); 48 | 49 | ScoreRangeNormalizationStrategy.Transform(dataColumn); 50 | 51 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 1); 52 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 1); 53 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 1); 54 | } 55 | 56 | [TestMethod] 57 | public void TestMethod4() 58 | { 59 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 1d, 2d, 3d }); 60 | 61 | ScoreRangeNormalizationStrategy.Transform(dataColumn); 62 | 63 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 0); 64 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 0.5); 65 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 1); 66 | } 67 | 68 | [TestMethod] 69 | public void TestMethod5() 70 | { 71 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { -3d, -2d, 0d }); 72 | 73 | ScoreRangeNormalizationStrategy.Transform(dataColumn, false); 74 | 75 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 1); 76 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 0.66, 0.01); 77 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 0); 78 | } 79 | 80 | [TestMethod] 81 | public void TestMethod6() 82 | { 83 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 0d, 0d, 0d }); 84 | 85 | ScoreRangeNormalizationStrategy.Transform(dataColumn, false); 86 | 87 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 0); 88 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 0); 89 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 0); 90 | } 91 | 92 | [TestMethod] 93 | public void TestMethod7() 94 | { 95 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 1d, 1d, 1d }); 96 | 97 | ScoreRangeNormalizationStrategy.Transform(dataColumn, false); 98 | 99 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 1); 100 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 1); 101 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 1); 102 | } 103 | 104 | [TestMethod] 105 | public void TestMethod8() 106 | { 107 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 1d, 2d, 3d }); 108 | 109 | ScoreRangeNormalizationStrategy.Transform(dataColumn, false); 110 | 111 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 1); 112 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 0.5); 113 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 0); 114 | } 115 | 116 | [TestMethod] 117 | public void TestMethod9() 118 | { 119 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { 1, 2, 3}); 120 | 121 | ScoreRangeNormalizationStrategy.Transform(dataColumn); 122 | 123 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), 0); 124 | Assert.AreEqual(dataColumn.Table.Rows[1].Field(0), 0); 125 | Assert.AreEqual(dataColumn.Table.Rows[2].Field(0), 1); 126 | } 127 | 128 | [TestMethod] 129 | public void TestMethod10() 130 | { 131 | DataColumn dataColumn = TestUtil.CreateDataColumn(new[] { "string" }); 132 | 133 | ScoreRangeNormalizationStrategy.Transform(dataColumn); 134 | 135 | Assert.AreEqual(dataColumn.Table.Rows[0].Field(0), "string"); 136 | } 137 | 138 | [TestMethod] 139 | public void TestMethod11() 140 | { 141 | DataColumn dataColumn = TestUtil.CreateDataColumn(Enumerable.Empty()); 142 | 143 | ScoreRangeNormalizationStrategy.Transform(dataColumn); 144 | 145 | Assert.AreEqual(dataColumn.Table.Rows.Count, 0); 146 | } 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /MCDA.Test/TestUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace MCDA.Test 9 | { 10 | internal static class TestUtil 11 | { 12 | public static DataColumn CreateDataColumn(IEnumerable data) 13 | { 14 | 15 | DataTable dt = new DataTable(); 16 | DataColumn dc = new DataColumn("Column", typeof(T)); 17 | dt.Columns.Add(dc); 18 | 19 | foreach (var currentValue in data) 20 | { 21 | DataRow dr = dt.NewRow(); 22 | dr[0] = currentValue; 23 | dt.Rows.Add(dr); 24 | } 25 | 26 | return dt.Columns[0]; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /MCDA.Test/WLCToolTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.ObjectModel; 3 | using ESRI.ArcGIS.Carto; 4 | using MCDA.Model; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting; 6 | using System.Data; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using Moq; 10 | 11 | namespace MCDA.Test 12 | { 13 | [TestClass] 14 | public class WLCToolTest 15 | { 16 | DataTable DataTable { get; set; } 17 | Model.ToolParameterContainer ToolParameterContainer { get; set; } 18 | 19 | [TestInitialize] 20 | public void Init() 21 | { 22 | //var mcdaExtension = MCDAExtension.GetExtension(); 23 | //var mock = new Mock(); 24 | //mock.Setup(extension => extension.AvailableFeatures).Returns(new ObservableCollection()); 25 | //MCDAExtension Extensions = MCDAExtension.GetExtension(); 26 | 27 | //DataTable = new DataTable(); 28 | 29 | var toolParameter = new ToolParameter("test") {IsOID = true}; 30 | var toolParameter2 = new ToolParameter("test2") {Weight = 33.33d}; 31 | var toolParameter3 = new ToolParameter("test3") { Weight = 33.33d }; 32 | var toolParameter4 = new ToolParameter("test4") { Weight = 33.33d }; 33 | 34 | //object o = mock.Object.AvailableFeatures; 35 | 36 | ToolParameterContainer = new Model.ToolParameterContainer(new List() { toolParameter, toolParameter2, toolParameter3, toolParameter4}); 37 | 38 | DataTable = new DataTable(); 39 | DataTable.Columns.Add("test", typeof(int)); 40 | DataTable.Columns.Add("test2", typeof(int)); 41 | DataTable.Columns.Add("test3", typeof(int)); 42 | DataTable.Columns.Add("test4", typeof(int)); 43 | 44 | DataTable.Rows.Add(2, 22, 4444, 1); 45 | DataTable.Rows.Add(3, 22, 4444, 1); 46 | DataTable.Rows.Add(4, 22, 4444, 1); 47 | DataTable.Rows.Add(5, 22, 4444, 1); 48 | DataTable.Rows.Add(6, 22, 4444, 1); 49 | 50 | //ToolFactory.NewLWLCTool(); 51 | } 52 | 53 | [TestMethod] 54 | public void TestMethod1() 55 | { 56 | Assert.AreEqual(4, 4); 57 | } 58 | 59 | [TestMethod] 60 | public void TestMethod2() 61 | { 62 | var wlcTool = new MCDA.Model.WLCTool(DataTable, ToolParameterContainer); 63 | 64 | wlcTool.Run(); 65 | 66 | Assert.IsNotNull(wlcTool.Data); 67 | Assert.IsTrue(wlcTool.Data.Rows.Count == 5); 68 | Assert.AreEqual(wlcTool.DefaultResultColumnName, "WLCResult"); 69 | var item = wlcTool.Data.Rows[0].ItemArray[4]; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /MCDA.Test/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /MCDA.Test/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /MCDA.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MCDA", "MCDA\MCDA.csproj", "{6B4C0EC2-4865-4C29-8BBC-8A73FF9DCBA9}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MCDA.Test", "MCDA.Test\MCDA.Test.csproj", "{18F1EB09-2E54-4B41-B54A-ADA5407F2F88}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Debug|Mixed Platforms = Debug|Mixed Platforms 14 | Debug|x86 = Debug|x86 15 | Release|Any CPU = Release|Any CPU 16 | Release|Mixed Platforms = Release|Mixed Platforms 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {6B4C0EC2-4865-4C29-8BBC-8A73FF9DCBA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {6B4C0EC2-4865-4C29-8BBC-8A73FF9DCBA9}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {6B4C0EC2-4865-4C29-8BBC-8A73FF9DCBA9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 23 | {6B4C0EC2-4865-4C29-8BBC-8A73FF9DCBA9}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 24 | {6B4C0EC2-4865-4C29-8BBC-8A73FF9DCBA9}.Debug|x86.ActiveCfg = Debug|Any CPU 25 | {6B4C0EC2-4865-4C29-8BBC-8A73FF9DCBA9}.Release|Any CPU.ActiveCfg = Release|Any CPU 26 | {6B4C0EC2-4865-4C29-8BBC-8A73FF9DCBA9}.Release|Any CPU.Build.0 = Release|Any CPU 27 | {6B4C0EC2-4865-4C29-8BBC-8A73FF9DCBA9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 28 | {6B4C0EC2-4865-4C29-8BBC-8A73FF9DCBA9}.Release|Mixed Platforms.Build.0 = Release|Any CPU 29 | {6B4C0EC2-4865-4C29-8BBC-8A73FF9DCBA9}.Release|x86.ActiveCfg = Release|Any CPU 30 | {18F1EB09-2E54-4B41-B54A-ADA5407F2F88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {18F1EB09-2E54-4B41-B54A-ADA5407F2F88}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {18F1EB09-2E54-4B41-B54A-ADA5407F2F88}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 33 | {18F1EB09-2E54-4B41-B54A-ADA5407F2F88}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 34 | {18F1EB09-2E54-4B41-B54A-ADA5407F2F88}.Debug|x86.ActiveCfg = Debug|Any CPU 35 | {18F1EB09-2E54-4B41-B54A-ADA5407F2F88}.Release|Any CPU.ActiveCfg = Release|Any CPU 36 | {18F1EB09-2E54-4B41-B54A-ADA5407F2F88}.Release|Any CPU.Build.0 = Release|Any CPU 37 | {18F1EB09-2E54-4B41-B54A-ADA5407F2F88}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 38 | {18F1EB09-2E54-4B41-B54A-ADA5407F2F88}.Release|Mixed Platforms.Build.0 = Release|Any CPU 39 | {18F1EB09-2E54-4B41-B54A-ADA5407F2F88}.Release|x86.ActiveCfg = Release|Any CPU 40 | EndGlobalSection 41 | GlobalSection(SolutionProperties) = preSolution 42 | HideSolutionNode = FALSE 43 | EndGlobalSection 44 | GlobalSection(TeamFoundationVersionControl) = preSolution 45 | SccNumberOfProjects = 2 46 | SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} 47 | SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs36 48 | SccProjectUniqueName0 = MCDA\\MCDA.csproj 49 | SccProjectName0 = MCDA 50 | SccAuxPath0 = https://tfs.codeplex.com/tfs/tfs36 51 | SccLocalPath0 = MCDA 52 | SccProvider0 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} 53 | SccProjectUniqueName1 = MCDA.Test\\MCDA.Test.csproj 54 | SccProjectName1 = MCDA.Test 55 | SccAuxPath1 = https://tfs.codeplex.com/tfs/tfs36 56 | SccLocalPath1 = MCDA.Test 57 | SccProvider1 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} 58 | EndGlobalSection 59 | GlobalSection(SubversionScc) = preSolution 60 | Svn-Managed = True 61 | Manager = AnkhSVN - Subversion Support for Visual Studio 62 | EndGlobalSection 63 | EndGlobal 64 | -------------------------------------------------------------------------------- /MCDA.vssscc: -------------------------------------------------------------------------------- 1 | "" 2 | { 3 | "FILE_VERSION" = "9237" 4 | "ENLISTMENT_CHOICE" = "NEVER" 5 | "PROJECT_FILE_RELATIVE_PATH" = "" 6 | "NUMBER_OF_EXCLUDED_FILES" = "0" 7 | "ORIGINAL_PROJECT_FILE_PATH" = "" 8 | "NUMBER_OF_NESTED_PROJECTS" = "0" 9 | "SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT" 10 | } 11 | -------------------------------------------------------------------------------- /MCDA/Config.Designer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steffanv/mcda4arcmap/4c49dbd11ff6753ffb9421d62fcd9bb0b3ede376/MCDA/Config.Designer.cs -------------------------------------------------------------------------------- /MCDA/Config.esriaddinx: -------------------------------------------------------------------------------- 1 |  2 | MCDA Add-in 3 | {f098ac0f-6cae-4e1b-81d0-d67452d3cf57} 4 | 5 | Add-in for MCDA analysis. 6 | 7 | I would like to thank Mark James for his awesome icon set: 8 | http://www.famfamfam.com/lab/icons/silk/ 9 | 10 | Open Source components: 11 | http://wpftoolkit.codeplex.com/ 12 | http://oxyplot.codeplex.com/ 13 | 14 | Finally, I thank Brad Carter for his implementation of LWLC, which was inspiring and helpful for the early LWLC implementation of this tool. 15 | 16 | 1.1A 17 | Images\MCDA Add-in.png 18 | Steffan Voss 19 | Steffan Voss 20 | 30 Nov 2016 21 | 22 | 23 | 24 | 25 | 26 | 27 |