コード例 #1
0
        private IEnumerable <ObservationPoint> GetObservationPoints(string observerPointsFeatureClassName)
        {
            var observerPointsFeatureClass = GdbAccess.Instance.GetFeatureClass(_gdb, observerPointsFeatureClassName);
            var pointsFromLayer            = VisibilityManager
                                             .GetObservationPointsFromAppropriateLayer(string.Empty, null,
                                                                                       null, observerPointsFeatureClass);

            if (!pointsFromLayer.Any())
            {
                Debugger.Launch();
            }

            return(pointsFromLayer.Select(point => { return point as ObservationPoint; }).ToArray());
        }
コード例 #2
0
        private void CalculateVATotalValues(int pointsCount, string visibilityAreasFCName)
        {
            _logger.InfoEx("> CalculateVATotalValues START");

            var visibilityPolygonsForPointFeatureClass = GdbAccess.Instance.GetFeatureClass(_gdb, visibilityAreasFCName);
            var totalObjArea = GetProjectedPolygonArea(_objPolygons[-1]);

            try
            {
                foreach (var polygon in _objPolygons)
                {
                    if (polygon.Key == -1)
                    {
                        continue;
                    }

                    var obj = VisibilityManager.GetObservationObjectsFromFeatureClass(_observationStationFeatureClass)
                              .FirstOrDefault(observationObject => observationObject.ObjectId == polygon.Key);

                    if (obj == null)
                    {
                        _logger.ErrorEx($"CalculateVATotalValues. Observation object with id {polygon.Key} is not found");
                        return;
                    }

                    if (totalObjArea == 0)
                    {
                        AddEmptyAreaRow(_allTitle, -1, polygon.Key, obj.Title, -1);
                        continue;
                    }

                    var visibilityArea = EsriTools.GetObjVisibilityArea(visibilityPolygonsForPointFeatureClass, VisibilityManager.CurrentMap, polygon.Value);
                    var polygonArea    = GetProjectedPolygonArea(polygon.Value);

                    AddVARowModel(_allTitle, -1, obj.Title, polygon.Key, -1, visibilityArea, polygonArea);
                }
            }
            catch (Exception ex)
            {
                _logger.ErrorEx($"CalculateVATotalValues Exception(1): {ex.Message}");
            }

            try
            {
                for (int i = 1; i <= pointsCount; i++)
                {
                    var areaByPointsSee = EsriTools.GetObjVisibilityArea(visibilityPolygonsForPointFeatureClass, VisibilityManager.CurrentMap, _objPolygons[-1], i);
                    var polygon         = _objPolygons[-1];

                    var polygonArea = GetProjectedPolygonArea(polygon);

                    AddVARowModel(_allTitle, -1, _allTitle, -1, i, areaByPointsSee, polygonArea);
                }
            }
            catch (Exception ex)
            {
                _logger.ErrorEx($"CalculateVATotalValues Exception(2): {ex.Message}");
            }

            _logger.InfoEx("> CalculateVATotalValues END");
        }
コード例 #3
0
        private void CalculateCoverageTableVADataForPoint(bool isTotal, string currentPointFeatureClassName,
                                                          string visibilityAreasFCName, int pointCount, int curPointId)
        {
            _logger.InfoEx("> CalculateCoverageTableVADataForPoint START. isTotal:{0} currPointId:{1}", isTotal.ToString(), curPointId);

            if (isTotal)
            {
                CalculateVATotalValues(pointCount, visibilityAreasFCName);
            }

            if (!isTotal || pointCount == 1)
            {
                var observPoint = GetObservationPoints(currentPointFeatureClassName).First();
                if (observPoint == null)
                {
                    _logger.ErrorEx($"> CalculateCoverageTableVADataForPoint END. Observation point with id {curPointId} is not found");
                    return;
                }
                else
                {
                    _logger.DebugEx("CalculateCoverageTableVADataForPoint. observPoint.Title: {0}", observPoint.Title);
                }

                try
                {
                    var totalObjArea = (IArea)_objPolygons[-1];
                    var visibilityPolygonsForPointFeatureClass = GdbAccess.Instance.GetFeatureClass(_gdb, visibilityAreasFCName);

                    foreach (var polygon in _objPolygons)
                    {
                        if (polygon.Key == -1)
                        {
                            continue;
                        }

                        var obj = VisibilityManager.GetObservationObjectsFromFeatureClass(_observationStationFeatureClass)
                                  .FirstOrDefault(observationObject => observationObject.ObjectId == polygon.Key);

                        if (obj == null)
                        {
                            continue;
                        }

                        if (totalObjArea.Area == 0)
                        {
                            AddEmptyAreaRow(observPoint.Title, curPointId, polygon.Key, obj.Title);
                            continue;
                        }

                        var visibilityArea = EsriTools.GetObjVisibilityArea(visibilityPolygonsForPointFeatureClass, VisibilityManager.CurrentMap, polygon.Value);
                        var objArea        = GetProjectedPolygonArea(polygon.Value);

                        AddVARowModel(observPoint.Title, curPointId, obj.Title, polygon.Key, 1, visibilityArea, objArea);
                    }
                }
                catch (Exception ex)
                {
                    _logger.ErrorEx($"> CalculateCoverageTableVADataForPoint Exception: {ex.Message}");
                    return;
                }
            }
            _logger.InfoEx("> CalculateCoverageTableVADataForPoint END");
        }