Esempio n. 1
0
        public void MergeData(SimpleMapDb.CablesDataTable cables)
        {
            try
            {
                _lockCr.EnterWriteLock();

                _rCableTree.MergeData(cables);
            }
            finally
            {
                _lockCr.ExitWriteLock();
            }
            Update(new Rectangle(0, 0, Width, Height));
        }
Esempio n. 2
0
        public void MergeData(SimpleMapDb.CablesDataTable cables)
        {
            if (CableDbRows == null)
            {
                return;
            }

            CableDbRows.Merge(cables, false, MissingSchemaAction.Error);

            Parallel.ForEach(cables, row =>
            {
                var newRow = CableDbRows.FindByID(row.ID);
                Insert(newRow);
            });

            //apply changes to db here
        }
Esempio n. 3
0
        private void GenerateSampleData()
        {
            _netLayer.ClearData();

            //--sample for show smothness
            var rnd    = new Random();
            var rangeX = Convert.ToInt32((Settings.Default.RightMapBound - Settings.Default.LeftMapBound) * 100000);
            var rangeY = Convert.ToInt32((Settings.Default.TopMapBound - Settings.Default.BottomMapBound) * 100000);

            var longitude1 = Convert.ToDecimal(Settings.Default.LeftMapBound + (double)rnd.Next(0, rangeX) / 100000);
            var latitude1  = Convert.ToDecimal(Settings.Default.BottomMapBound + (double)rnd.Next(0, rangeY) / 100000);

            var cableDbRows  = new SimpleMapDb.CablesDataTable();
            var vertexDbRows = new SimpleMapDb.VertexesDataTable();

            while (cableDbRows.Count < 200)
            {
                var cableRow = cableDbRows.NewCablesRow();

                cableRow.Longitude1 = longitude1;
                cableRow.Latitude1  = latitude1;
                cableRow.Longitude2 = Convert.ToDecimal(Settings.Default.LeftMapBound + (double)rnd.Next(0, rangeX) / 100000);
                cableRow.Latitude2  = Convert.ToDecimal(Settings.Default.BottomMapBound + (double)rnd.Next(0, rangeY) / 100000);
                var rect = new CoordinateRectangle(cableRow.Longitude1, cableRow.Latitude1, cableRow.Longitude2, cableRow.Latitude2);
                cableRow.Length = Convert.ToDecimal(rect.LineLength);
                if (cableRow.Length <= 5000 && cableRow.Length > 200)
                {
                    longitude1       = cableRow.Longitude2;
                    latitude1        = cableRow.Latitude2;
                    cableRow.Caption = rect.ToString();
                    cableDbRows.AddCablesRow(cableRow);

                    var vertexRow = vertexDbRows.NewVertexesRow();

                    vertexRow.Longitude = longitude1;
                    vertexRow.Latitude  = latitude1;

                    var pt = new Coordinate(vertexRow.Longitude, vertexRow.Latitude);
                    vertexRow.Caption = pt.ToString();
                    vertexDbRows.AddVertexesRow(vertexRow);
                }
            }
            _netLayer.MergeData(vertexDbRows);
            _netLayer.MergeData(cableDbRows);
            //--end sample
        }
Esempio n. 4
0
 public CableTree()
     : base(SpatialSheetPowerTypes.Ultra, SpatialSheetPowerTypes.High, SpatialSheetPowerTypes.Low, SpatialSheetPowerTypes.Low)
 {
     CableDbRows = new SimpleMapDb.CablesDataTable();
 }
Esempio n. 5
0
        private void GenerateSampleData()
        {
            _netLayer.ClearData();

            //--sample for show smothness
            var rnd = new Random();
            var rangeX = Convert.ToInt32((Settings.Default.RightMapBound - Settings.Default.LeftMapBound) * 100000);
            var rangeY = Convert.ToInt32((Settings.Default.TopMapBound - Settings.Default.BottomMapBound) * 100000);

            var longitude1 = Convert.ToDecimal(Settings.Default.LeftMapBound + (double) rnd.Next(0, rangeX)/100000);
            var latitude1 = Convert.ToDecimal(Settings.Default.BottomMapBound + (double)rnd.Next(0, rangeY) / 100000);

            var cableDbRows = new SimpleMapDb.CablesDataTable();
            var vertexDbRows = new SimpleMapDb.VertexesDataTable();
            while (cableDbRows.Count < 200)
            {
                var cableRow = cableDbRows.NewCablesRow();

                cableRow.Longitude1 = longitude1;
                cableRow.Latitude1 = latitude1;
                cableRow.Longitude2 = Convert.ToDecimal(Settings.Default.LeftMapBound + (double)rnd.Next(0, rangeX) / 100000);
                cableRow.Latitude2 = Convert.ToDecimal(Settings.Default.BottomMapBound + (double)rnd.Next(0, rangeY) / 100000);
                var rect = new CoordinateRectangle(cableRow.Longitude1, cableRow.Latitude1, cableRow.Longitude2, cableRow.Latitude2);
                cableRow.Length = Convert.ToDecimal(rect.LineLength);
                if (cableRow.Length <= 5000 && cableRow.Length > 200)
                {
                    longitude1 = cableRow.Longitude2;
                    latitude1 = cableRow.Latitude2;
                    cableRow.Caption = rect.ToString();
                    cableDbRows.AddCablesRow(cableRow);

                    var vertexRow = vertexDbRows.NewVertexesRow();

                    vertexRow.Longitude = longitude1;
                    vertexRow.Latitude = latitude1;

                    var pt = new Coordinate(vertexRow.Longitude, vertexRow.Latitude);
                    vertexRow.Caption = pt.ToString();
                    vertexDbRows.AddVertexesRow(vertexRow);
                }
            }
            _netLayer.MergeData(vertexDbRows);
            _netLayer.MergeData(cableDbRows);
            //--end sample
        }