public void WorksWithTimeDependentNetworkCoverage()
        {
            var timeNetworkCoverage = new NetworkCoverage("timedep", true);
            timeNetworkCoverage.Network = network;

            var t1 = new DateTime(2000, 1, 1);
            var t2 = new DateTime(2000, 1, 2);

            timeNetworkCoverage[t1, new NetworkLocation(network.Branches[0], 1)] = 10.0;
            timeNetworkCoverage[t1, new NetworkLocation(network.Branches[1], 2)] = 20.0;
            timeNetworkCoverage[t2, new NetworkLocation(network.Branches[0], 1)] = 30.0;
            timeNetworkCoverage[t2, new NetworkLocation(network.Branches[1], 2)] = 40.0;

            var timeCoverageBindingList = new NetworkCoverageBindingList(timeNetworkCoverage);

            Assert.AreEqual(4, timeCoverageBindingList.ColumnNames.Count());

            //columns shifted
            Assert.AreEqual("Location_Branch", timeCoverageBindingList.GetItemProperties(null)[1].Name);

            var newOffset = 1.5;
            Assert.AreNotEqual(newOffset, timeNetworkCoverage.Locations.Values[0].Chainage);

            timeCoverageBindingList[0][2] = newOffset;

            timeCoverageBindingList[0].EndEdit(); //commit changes

            Assert.AreEqual(newOffset, timeNetworkCoverage.Locations.Values[0].Chainage);

            var gridView = new DataGridView { DataSource = timeCoverageBindingList };
            
            WindowsFormsTestHelper.ShowModal(gridView);
        }
        public void SetUp()
        {
            network = RouteHelperTest.GetSnakeNetwork(false, new Point(0, 0), new Point(100, 0), new Point(100, 100));

            networkCoverage = new NetworkCoverage { Network = network };
            
            networkCoverage.Locations.NextValueGenerator = new NetworkLocationNextValueGenerator(networkCoverage);

            networkCoverageBindingList = new NetworkCoverageBindingList(networkCoverage);
        }
        private bool ColumnIsBranchColumn(int columnIndex)
        {
            int firstIndexOfNetworkLocationArgument = NetworkCoverageBindingList.GetIndexOfNetworkLocationArgument(owner.Function);

            if (columnIndex == firstIndexOfNetworkLocationArgument)
            {
                return(true);
            }

            return(false);
        }
        private int BaseIndexToColumnIndex(int baseColumnIndex)
        {
            int firstIndexOfNetworkLocationArgument = NetworkCoverageBindingList.GetIndexOfNetworkLocationArgument(owner.Function);

            if (baseColumnIndex > firstIndexOfNetworkLocationArgument)
            {
                return(baseColumnIndex + 1);
            }

            return(baseColumnIndex);
        }
        protected override int GetColumnIndex(string columnName)
        {
            int firstIndex = NetworkCoverageBindingList.GetIndexOfNetworkLocationArgument(owner.Function);

            if (columnName.Equals(NetworkCoverageBindingList.ColumnNameBranch))
            {
                return(firstIndex);
            }
            if (columnName.Equals(NetworkCoverageBindingList.ColumnNameChainage))
            {
                return(firstIndex + 1);
            }
            return(BaseIndexToColumnIndex(base.GetColumnIndex(columnName)));
        }
        public void SetUp()
        {
            network = RouteHelperTest.GetSnakeNetwork(false, new Point(0, 0), new Point(100, 0), new Point(100, 100));

            networkCoverage = new NetworkCoverage { Network = network };
            
            //add locations
            networkCoverage[new NetworkLocation(network.Branches[0], 1.0)] = 10.0;
            networkCoverage[new NetworkLocation(network.Branches[0], 2.0)] = 20.0;
            
            networkCoverage.Locations.NextValueGenerator = new NetworkLocationNextValueGenerator(networkCoverage);
            
            networkCoverageBindingList = new NetworkCoverageBindingList(networkCoverage);
        }
        public INetworkLocation GetNetworkLocation()
        {
            int indexOfNetworkLocationInBase = NetworkCoverageBindingList.GetIndexOfNetworkLocationArgument(owner.Function);

            return((INetworkLocation) base[indexOfNetworkLocationInBase]);
        }
 public NetworkCoverageBindingListRow(NetworkCoverageBindingList owner) : base(owner)
 {
 }
 public NetworkCoverageBindingListRow(NetworkCoverageBindingList owner) : base(owner)
 {
 }