Пример #1
0
 public override short getNSWE()
 {
     return(GeoEngine.getNSWE(_heightAndNSWE));
 }
Пример #2
0
 public GeoCellFlat(GeoBlockFlat block, short height) : base(block)
 {
     _height = GeoEngine.getGeoHeightOfHeight(height);
 }
Пример #3
0
        public bool Save(EditModel model)
        {
            // validate incoming data
            if (model == null)
            {
                throw new Exception("model is empty.");
            }
            if (model.Id <= 0)
            {
                throw new Exception("Id is missing.");
            }


            // get current datasettitle
            string layerName = "";

            using (var datasetManager = new DatasetManager())
            {
                var dataset = datasetManager.GetDataset(model.Id);
                if (dataset == null)
                {
                    throw new Exception("Dataset with id " + model.Id + "not exist.");
                }

                XmlDatasetHelper xmlHelpers = new XmlDatasetHelper();
                layerName = xmlHelpers.GetInformation(dataset, NameAttributeValues.title);

                TimeObject to = new TimeObject(80000, model.Time, new Format()
                {
                    format = "custom", customFormat = model.TimeFormat
                });


                GeoEngine geoEngine = new GeoEngine(
                    model.Longitude,
                    model.Latitude,
                    model.DataType,
                    model.SpatialReference,
                    layerName,
                    GetTypeSortedVariables(dataset.DataStructure.Id),
                    GetVariablesWithType(dataset.DataStructure.Id),
                    to
                    );

                string path = Path.Combine(AppConfiguration.DataPath, "Datasets", model.Id.ToString(), "geoengine.json");

                // check if directory exist, if not create
                if (!Directory.Exists(Path.GetDirectoryName(path)))
                {
                    FileHelper.CreateDicrectoriesIfNotExist(Path.GetDirectoryName(path));
                }

                // if file exist -> delete
                if (FileHelper.FileExist(path))
                {
                    File.Delete(path);
                }

                // save json to file
                File.WriteAllText(path, JsonConvert.SerializeObject(geoEngine));

                return(true);
            }
        }