Пример #1
0
        private async Task <bool> insertPointsDataset(PointsDataSet pointsDataset)
        {
            IEnumerable <PointType> pointTypes = PointType.GetPoints(pointsDataset);

            CassandraQueryBuilder queryBuilder = new CassandraQueryBuilder();

            queryBuilder.TableName = "points_by_dataset";
            queryBuilder.Type      = typeof(PointType);
            queryBuilder.QueryType = CassandraQueryBuilder.QueryTypes.InsertFromType;
            // if (pointsDataset.ZoomLevel != 0) queryBuilder.IgnoredColumnNames = new List<string>() { "displacements" };



            this.executionInstance.PrepareQuery(queryBuilder);

            try
            {
                await pointTypes.ParallelForEachAsync(async pointType =>
                {
                    await executionInstance.ExecuteNonQuery(new
                    {
                        pointType.dataset_id,
                        number = pointType.point_number,
                        pointType.longitude,
                        pointType.latitude,
                        pointType.height,
                        pointType.deformation_rate,
                        pointType.standard_deviation,
                        pointType.estimated_height,
                        pointType.estimated_deformation_rate,
                        pointType.observations,
                        pointType.displacements
                    });
                });
            }
            catch (Exception exception)
            {
                CoreContainers.LogsRepository.LogError(exception, Core.Database.Logs.LogTrigger.DataAccess);
            }


            return(true);
        }
Пример #2
0
        public void CheckDataSetCreation()
        {
            IDataPointsSource        pointsSource = new TxtDataPointsSource();
            IDataPointsRegionsSource regionSource = new PowerOfTwoRegionsSource();

            (pointsSource as TxtDataPointsSource).HeaderFile        = @"E:\temp\header.txt";
            (pointsSource as TxtDataPointsSource).DisplacementsFile = @"E:\temp\displacements.txt";
            (pointsSource as TxtDataPointsSource).LatitudeZone      = 'T';
            (pointsSource as TxtDataPointsSource).Zone = 35;
            PointsDataSet dataset = pointsSource.CreateDataSet("Test", CoordinateSystem.UTM).First();

            bool regionsGenerationResult = regionSource.GenerateRegions(dataset);

            IEnumerable <PointType> points = PointType.GetPoints(dataset);

            IDataPointsZoomLevelsSource zoomGenerator = new SquareMeanPZGenerator();

            PointsDataSet[] set = zoomGenerator.CreateDataSetsZoomSets(dataset, 3, 19);

            Assert.IsNotNull(dataset);
            Assert.IsNotNull(points);
            Assert.IsTrue(regionsGenerationResult);
        }