Пример #1
0
        public Configuration(Map map, GroupBox fieldGroupbox, CheckBox checkAllFields, int featureLayer = 0, int polygonLayer = 0, List<string> ignoreList = null, bool selectMutipleFied = true)
        {
            this._map = map;
            this._fieldsGroupbox = fieldGroupbox;
            this._checkAllFields = checkAllFields;
            this._featureLayerIndex = featureLayer;
            this._polygonLayerIndex = 0;
            this._selectMutipleFied = selectMutipleFied;

            if (ignoreList != null)
                this.reserveFields = ignoreList;
            else
                this.reserveFields = new List<string>();

            SetLayers();

            this._checkAllFields.Visible = selectMutipleFied;

            this._checkAllFields.CheckStateChanged += CheckAllFields_CheckStateChanged;

            loadCheckListboxCollection();

            if (!this._selectMutipleFied)
            {
                bindCheckedEvent();
            }
        }
Пример #2
0
        private void InitializeComponent()
        {
            this.map1 = new DotSpatial.Controls.Map();
            this.SuspendLayout();
            // 
            // map1
            // 
            this.map1.AllowDrop = true;
            this.map1.BackColor = System.Drawing.Color.White;
            this.map1.CollectAfterDraw = false;
            this.map1.CollisionDetection = false;
            this.map1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.map1.ExtendBuffer = false;
            this.map1.FunctionMode = DotSpatial.Controls.FunctionMode.None;
            this.map1.IsBusy = false;
            this.map1.IsZoomedToMaxExtent = false;
            this.map1.Legend = null;
            this.map1.Location = new System.Drawing.Point(0, 0);
            this.map1.Name = "map1";
            this.map1.ProgressHandler = null;
            this.map1.ProjectionModeDefine = DotSpatial.Controls.ActionMode.Prompt;
            this.map1.ProjectionModeReproject = DotSpatial.Controls.ActionMode.Prompt;
            this.map1.RedrawLayersWhileResizing = false;
            this.map1.SelectionEnabled = true;
            this.map1.Size = new System.Drawing.Size(150, 150);
            this.map1.TabIndex = 0;
            // 
            // MapView
            // 
            this.Controls.Add(this.map1);
            this.Name = "MapView";
            this.ResumeLayout(false);

        }
Пример #3
0
 public void DeserializeTest()
 {
     XmlDeserializer target = new XmlDeserializer();
     DotSpatial.Controls.Map map = new DotSpatial.Controls.Map();
     string path = Path.Combine("Data", "DeserializeTest.map.xml");
     target.Deserialize(map, File.ReadAllText(path));
 }
Пример #4
0
 public void DeserializeTest()
 {
     XmlDeserializer target = new XmlDeserializer();
     DotSpatial.Controls.Map map = new DotSpatial.Controls.Map();
     string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestFiles", "DeserializeTest.map.xml");
     target.Deserialize(map, File.ReadAllText(path));
 }
Пример #5
0
        public CalculateProductForm(KrigingInputField field, Map map)
        {
            _field = field;
            _map = map;

            InitializeComponent();
        }
Пример #6
0
 public static AutoForm GetInstance(Map map)
 {
     if (openForm == null)
     {
         openForm = new AutoForm(map);
         openForm.FormClosed += delegate { openForm = null; };
     }
     return openForm;
 }
Пример #7
0
        public override void Activate()
        {
            _Map = App.Map as Map;
            _Map.GeoMouseMove += Map_GeoMouseMove;

            xPanel = new StatusPanel() { Width = 160 };
            yPanel = new StatusPanel() { Width = 160 };
            App.ProgressHandler.Add(xPanel);
            App.ProgressHandler.Add(yPanel);

            base.Activate();
        }
Пример #8
0
        public KrigingForm()
        {
            InitializeComponent();

            _db = new AppContext();
            _preferenceRepository = new AppPreferencesRepository(_db);
            _legendRepository = new FieldLegendRepository(_db);

            this.map = (Map)PluginExtension.MyAppManager.Map;

            btnAddImageTo.Visible = false;
        }
Пример #9
0
        public void DeserializeFrenchCultureTest()
        {
            // Sets the culture to French (France)
            Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");
            // Sets the UI culture to French (France)
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR");

            XmlDeserializer target = new XmlDeserializer();
            DotSpatial.Controls.Map map = new DotSpatial.Controls.Map();
            string path = Path.Combine("Data", "DeserializeTest.map.xml");
            target.Deserialize(map, File.ReadAllText(path));
        }
Пример #10
0
        public override void Activate()
        {
            base.Activate();

            // Add legend
            var legend = new Legend{Text = "Legend"};
            App.Legend = legend;
            App.DockManager.Add(new DockablePanel("kLegend", "Legend", legend, DockStyle.Left));

            // Add map
            var map = new Map {Text = "Map", Legend = App.Legend};
            App.Map = map;
            App.DockManager.Add(new DockablePanel("kMap", "Map", map, DockStyle.Fill));
        }
Пример #11
0
        public VectorGrid(string typecoor, double xmin, double ymin, int numColums, int numRows, double cellSizeX, double cellSizeY, double azimut, IMap map)
        {
            _orgArea = new AreaInterest();
            _orgArea.TypeCoor = typecoor;
            _orgArea.MinX = xmin;
            _orgArea.MinY = ymin;
            _orgArea.NumColumns = numColums;
            _orgArea.NumRows = numRows;
            _orgArea.CellSizeX = cellSizeX;
            _orgArea.CellSizeY = cellSizeY;
            _orgArea.Azimut = azimut;
            _mainMap = map as Map;
            UpdateAreaInterestByOrigin(_orgArea);

        }
Пример #12
0
        public VectorGrid(double xmin, double ymin, double xmax, double ymax, int numColums, int numRows, double cellSizeX, double cellSizeY, double azimut, IMap map)
        {
            _orgArea.MinX = xmin;
            _orgArea.MinY = ymin;
            _orgArea.MaxX = xmax;
            _orgArea.MaxY = ymax;
            _orgArea.NumColumns = numColums;
            _orgArea.NumRows = numRows;
            _orgArea.CellSizeX = cellSizeX;
            _orgArea.CellSizeY = cellSizeY;
            _orgArea.Azimut = azimut;

            _mainMap = map as Map;
            UpdateAreaInterest(_orgArea);

        }
Пример #13
0
        public KrigingForm(bool importImage, string exportButtonText, bool multipleField)
        {
            InitializeComponent();

            _db = new AppContext();
            _preferenceRepository = new AppPreferencesRepository(_db);
            _legendRepository = new FieldLegendRepository(_db);

            this.map = (Map)PluginExtension.MyAppManager.Map;

            this.canSelectMultipleField = multipleField;
            this.btnAddImageTo.Text = exportButtonText;
            this.btnAddImageTo.Enabled = false;

            if (importImage) btnAddImageTo.Visible = true;
        }
        public void CanOpenProjectFile(string mprojFile, string projectFileVer)
        {
            var map = new Map();
            var target = new LegacyProjectDeserializer(map);
            var curDir = Environment.CurrentDirectory;
            var fileInfo = new FileInfo(mprojFile);

            try
            {
                dynamic parser = DynamicXMLNode.Load(mprojFile);
                Assert.AreEqual(projectFileVer, (string)parser["type"]);
                Assert.AreEqual(0, map.Layers.Count);
                Environment.CurrentDirectory = fileInfo.DirectoryName;
                target.OpenFile(fileInfo.FullName);
                Assert.Greater(map.Layers.Count, 0);
            }
            finally
            {
                // Restore current directory
                Environment.CurrentDirectory = curDir;
            }
        }
Пример #15
0
        public KriggingSimulator(Map map, IFeatureSet selectedDataset, Extent extent,
            Clip clip, string field, string layerName, string pixel)
        {
            this._field = field;
            this._map = map;
            this._selectedDataset = selectedDataset;
            this._layerName = layerName;
            this._extent = extent;
            this._clip = clip;
            this._pixel = pixel;

            this._prefixPath = this._field + "-" + Guid.NewGuid().ToString();
            this._folder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TempFiles");

            zedGraphControl1 = new ZedGraphControl();
            theoreticalModelControl1 = new TheoreticalModelControl();
            uxSearchNeighborhoodControl1 = new SearchNeighborhoodControl();
            uxOutputRaster1 = new OutputRaster();
            zedGraphControl2 = new ZedGraphControl();

            kriggingResult = new KriggingResult();
        }
Пример #16
0
        public ConfigurationMethod(
          Map map
         )
        {
            this._map = map;

        }
Пример #17
0
 public AutoForm()
 {
     this.map = null;
     InitializeComponent();
 }
Пример #18
0
        public ConfigurationMethod2(Map map, GroupBox fieldGroupbox, CheckBox checkAllFields)
        {
            this._map = map;
            this._fieldsGroupbox = fieldGroupbox;
            this._checkAllFields = checkAllFields;

            SetLayers();

            this._checkAllFields.CheckStateChanged += CheckAllFields_CheckStateChanged;
        }
Пример #19
0
        private void InitializeComponent()
        {
            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
            this.map1 = new DotSpatial.Controls.Map();
            this.uxIdentify = new System.Windows.Forms.Button();
            this.uxPan = new System.Windows.Forms.Button();
            this.uxZoomOut = new System.Windows.Forms.Button();
            this.uxZoomIn = new System.Windows.Forms.Button();
            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
            this.splitContainer1.Panel1.SuspendLayout();
            this.splitContainer1.Panel2.SuspendLayout();
            this.splitContainer1.SuspendLayout();
            this.SuspendLayout();
            // 
            // splitContainer1
            // 
            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.splitContainer1.Location = new System.Drawing.Point(0, 0);
            this.splitContainer1.Name = "splitContainer1";
            this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
            // 
            // splitContainer1.Panel1
            // 
            this.splitContainer1.Panel1.Controls.Add(this.map1);
            // 
            // splitContainer1.Panel2
            // 
            this.splitContainer1.Panel2.Controls.Add(this.uxIdentify);
            this.splitContainer1.Panel2.Controls.Add(this.uxPan);
            this.splitContainer1.Panel2.Controls.Add(this.uxZoomOut);
            this.splitContainer1.Panel2.Controls.Add(this.uxZoomIn);
            this.splitContainer1.Size = new System.Drawing.Size(344, 305);
            this.splitContainer1.SplitterDistance = 264;
            this.splitContainer1.TabIndex = 0;
            // 
            // map1
            // 
            this.map1.AllowDrop = true;
            this.map1.BackColor = System.Drawing.Color.White;
            this.map1.CollectAfterDraw = false;
            this.map1.CollisionDetection = false;
            this.map1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.map1.ExtendBuffer = false;
            this.map1.FunctionMode = DotSpatial.Controls.FunctionMode.None;
            this.map1.IsBusy = false;
            this.map1.Legend = null;
            this.map1.Location = new System.Drawing.Point(0, 0);
            this.map1.Name = "map1";
            this.map1.ProgressHandler = null;
            this.map1.ProjectionModeDefine = DotSpatial.Controls.ActionMode.Prompt;
            this.map1.ProjectionModeReproject = DotSpatial.Controls.ActionMode.Prompt;
            this.map1.RedrawLayersWhileResizing = false;
            this.map1.SelectionEnabled = true;
            this.map1.Size = new System.Drawing.Size(344, 264);
            this.map1.TabIndex = 0;
            // 
            // uxIdentify
            // 
            this.uxIdentify.Location = new System.Drawing.Point(171, 2);
            this.uxIdentify.Name = "uxIdentify";
            this.uxIdentify.Size = new System.Drawing.Size(30, 23);
            this.uxIdentify.TabIndex = 3;
            this.uxIdentify.Text = "Id";
            this.uxIdentify.UseVisualStyleBackColor = true;
            this.uxIdentify.Click += new System.EventHandler(this.Identify_Click);
            // 
            // uxPan
            // 
            this.uxPan.Location = new System.Drawing.Point(120, 2);
            this.uxPan.Name = "uxPan";
            this.uxPan.Size = new System.Drawing.Size(35, 23);
            this.uxPan.TabIndex = 2;
            this.uxPan.Text = "Pan";
            this.uxPan.UseVisualStyleBackColor = true;
            this.uxPan.Click += new System.EventHandler(this.Pan_Click);
            // 
            // uxZoomOut
            // 
            this.uxZoomOut.Location = new System.Drawing.Point(68, 2);
            this.uxZoomOut.Name = "uxZoomOut";
            this.uxZoomOut.Size = new System.Drawing.Size(36, 23);
            this.uxZoomOut.TabIndex = 1;
            this.uxZoomOut.Text = "Z-";
            this.uxZoomOut.UseVisualStyleBackColor = true;
            this.uxZoomOut.Click += new System.EventHandler(this.ZoomOut_Click);
            // 
            // uxZoomIn
            // 
            this.uxZoomIn.Location = new System.Drawing.Point(18, 2);
            this.uxZoomIn.Name = "uxZoomIn";
            this.uxZoomIn.Size = new System.Drawing.Size(34, 23);
            this.uxZoomIn.TabIndex = 0;
            this.uxZoomIn.Text = "Z+";
            this.uxZoomIn.UseVisualStyleBackColor = true;
            this.uxZoomIn.Click += new System.EventHandler(this.ZoomIn_Click);
            // 
            // OperationsMap
            // 
            this.Controls.Add(this.splitContainer1);
            this.Name = "OperationsMap";
            this.Size = new System.Drawing.Size(344, 305);
            this.splitContainer1.Panel1.ResumeLayout(false);
            this.splitContainer1.Panel2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
            this.splitContainer1.ResumeLayout(false);
            this.ResumeLayout(false);

        }
Пример #20
0
 public AutoForm(Map map)
 {
     this.map = map;
     InitializeComponent();
 }
Пример #21
0
 /// <summary>
 /// Constructor
 /// </summary>
 public LayoutMap(Map mapControl)
 {
     Name = "Map";
     _mapControl = mapControl;
     _envelope = _mapControl.ViewExtents.ToEnvelope();
     ResizeStyle = ResizeStyle.NoScaling;
 }
Пример #22
0
        public void TestMapFrameIsNotNull()
        {
            const string filename = @".\TestFiles\test-RandomPts.shp";
            const string projectFileName = @".\testmapframeisnotnull.dspx";
            //string projPath = Path.Combine(Path.GetTempPath(), projectFileName);

            AppManager manager = new AppManager();
            Map map = new Map();
            manager.Map = map;

            IFeatureSet fs = FeatureSet.Open(filename);
            MapPointLayer l = new MapPointLayer(fs);
            map.Layers.Add(l);
            Assert.Greater(map.Layers.Count, 0);

            manager.SerializationManager.SaveProject(projectFileName);
            Assert.True(System.IO.File.Exists(projectFileName));

            //reopen the project
            map.Layers.Clear();
            Assert.AreEqual(map.Layers.Count, 0);

            manager.SerializationManager.OpenProject(projectFileName);
            Assert.Greater(map.Layers.Count, 0);
            Assert.IsNotNull(map.Layers[0].MapFrame);

            //delete file
            System.IO.File.Delete(projectFileName);
        }
Пример #23
0
        public void TestMapFrameIsNotNull_Group()
        {
            string filename = Path.Combine("Data", "test-RandomPts.shp");
            string projectFileName = FileTools.GetTempFileName(".dspx");
            _filesToRemove.Add(projectFileName);
            
            AppManager manager = new AppManager();
            Map map = new Map();
            manager.Map = map;

            //new map group added to map
            MapGroup grp = new MapGroup(map, "group1");

            //new map layer added to group
            IFeatureSet fs = FeatureSet.Open(filename);
            MapPointLayer l = new MapPointLayer(fs);

            //add layer to group
            grp.Layers.Add(l);

            Assert.Greater(map.Layers.Count, 0);
            Assert.IsNotNull(l.MapFrame);

            manager.SerializationManager.SaveProject(projectFileName);
            Assert.True(System.IO.File.Exists(projectFileName));

            //reopen the project
            map.Layers.Clear();
            Assert.AreEqual(map.Layers.Count, 0);

            manager.SerializationManager.OpenProject(projectFileName);

            List<ILayer> layers = map.GetAllLayers();
            Assert.IsNotNull(layers[0].MapFrame);
        }
Пример #24
0
 /// <summary>
 /// Creates a new instance of a GLyphFunction with the specified Map
 /// </summary>
 /// <param name="map"></param>
 public MapFunctionGlyph(Map map)
     : base(map)
 {
     YieldStyle = YieldStyles.AlwaysOn;
     Cursor = Cursors.Hand;
 }
Пример #25
0
        public void TestMapFrameIsNotNull_Group()
        {
            const string filename = @".\TestFiles\test-RandomPts.shp";
            const string projectFileName = @".\testmapframeisnotnull.dspx";
            
            AppManager manager = new AppManager();
            Map map = new Map();
            manager.Map = map;

            //new map group added to map
            MapGroup grp = new MapGroup(map, "group1");

            //new map layer added to group
            IFeatureSet fs = FeatureSet.Open(filename);
            MapPointLayer l = new MapPointLayer(fs);

            //add layer to group
            grp.Layers.Add(l);

            Assert.Greater(map.Layers.Count, 0);
            Assert.IsNotNull(l.MapFrame);

            manager.SerializationManager.SaveProject(projectFileName);
            Assert.True(System.IO.File.Exists(projectFileName));

            //reopen the project
            map.Layers.Clear();
            Assert.AreEqual(map.Layers.Count, 0);

            manager.SerializationManager.OpenProject(projectFileName);

            List<ILayer> layers = map.GetAllLayers();
            Assert.IsNotNull(layers[0].MapFrame);

            //delete file
            System.IO.File.Delete(projectFileName);
        }
Пример #26
0
 public void SetParameters(
      Map map,
      ListBox method,
      ListBox output,
      ComboBox layer,
      ComboBox field,
      ComboBox transformation,
      ComboBox trend, bool filter)
 {
     this._map = map;
     this.method = method;
     this.output = output;
     this.layer = layer;
     this.field = field;
     this.transformation = transformation;
     this.trend = trend;
     this.filter = filter;
     this.method.SelectedValueChanged += new EventHandler(method_Click);
     this.trend.SelectedValueChanged += new EventHandler(trend_Click);
 }
Пример #27
0
        public ConfigurationMethod(
            Map map,
                               ListBox method,
                               ListBox output,
                               ComboBox layer,
                               ComboBox field,
                               ComboBox transformation,
                               ComboBox trend, bool filter)
        {
            this._map = map;
            this.method = method;
            this.output = output;
            this.layer = layer;
            this.field = field;
            this.transformation = transformation;
            this.trend = trend;
            this.filter = filter;

            if (filter)
                UpdataLayerFilter();
            else
                UpdataLayer();

            this.method.SelectedValueChanged += new EventHandler(method_Click);
            this.trend.SelectedValueChanged += new EventHandler(trend_Click);
        }
Пример #28
0
        public ConfigurationMethod(
            Map map,
                               ListBox method,
                               ComboBox layer,
                               ComboBox field
            )
        {
            this._map = map;
            this.method = method;
            this.layer = layer;
            this.field = field;
            UpdataLayer();

        }
Пример #29
0
        public static void UncheckAllLayers(Map map)
        {
            int count = 0;

            foreach (var item in map.GetLayers())
            {
                if (!(item is MapImageLayer))
                {
                    item.Checked = false;
                }

                if (item is MapPolygonLayer && count == 0)
                {
                    count++;
                    var layer = item as IMapPolygonLayer;

                    Extent ext = layer.Extent;
                    //map.ViewExtents = ext;
                }
            }



            PluginExtension.MyAppManager.Legend.RefreshNodes();
            PluginExtension.MyAppManager.Map.Refresh();
        }
Пример #30
0
        public static bool SaveLayers(Map map, string directory, Chart pieChart, Panel panel, ref CustomerInterpolation interpolation, ref List<InterpolatedFields> saveFields)
        {

            var projectFile = new Project();
            var layers = new List<ProjectLayer>();
            var baseMap = new BaseMapLayer();

            UncheckAllLayers(map);

            foreach (var item in map.GetLayers())
            {
                // Map Layer
                if (item is MapImageLayer && item.DataSet is InRamImageData)
                {

                }
                else
                {
                    //Point Features Layer
                    if (item is MapPointLayer && item.DataSet is PointShapefile)
                    {
                        var layer = item as IMapFeatureLayer;
                        var fileName = Path.GetFileName(layer.DataSet.Filename);
                        var path = Path.Combine(directory, fileName);
                        layer.DataSet.SaveAs(Path.Combine(directory, fileName), true);
                        layers.Add(new ProjectLayer() { Path = path });

                        item.Checked = true;
                        PluginExtension.MyAppManager.Map.Refresh();
                    }
                    else if (item is MapPolygonLayer && item.DataSet is IFeatureSet)
                    {
                        var layer = item as IMapPolygonLayer;
                        var fileName = Path.GetFileName(layer.DataSet.Filename);
                        var path = Path.Combine(directory, fileName);

                        var imagePath = Path.Combine(directory, Path.GetFileNameWithoutExtension(layer.DataSet.Filename) + ".png");
                        var colorPlatImg = Path.Combine(directory, Path.GetFileNameWithoutExtension(layer.DataSet.Filename) + "_ColorPlate.png");
                        var pieChartImage = Path.Combine(directory, Path.GetFileNameWithoutExtension(layer.DataSet.Filename) + "_PIEChart.png");

                        item.Checked = true;
                        PluginExtension.MyAppManager.Map.Refresh();

                        if (KrigingTemp.Fields.Where(c => c.OutputShapeFile == fileName).Count() > 0)
                        {
                            var tempField = KrigingTemp.Fields.Where(c => c.OutputShapeFile == fileName).First();

                            SaveGridFile(tempField.OutputShapeFile, directory);

                            var intField = new InterpolatedFields();

                            intField.ZData = tempField.OutputZ;
                            intField.Field = tempField.Field;
                            intField.ShapeFile = path;
                            intField.Image = imagePath;
                            intField.PieChartData = Newtonsoft.Json.JsonConvert.SerializeObject(tempField.PieChartData);
                            intField.ProductValue = tempField.ProductResult;

                            if (new ConfigSaveKriging().LoadPieChart(pieChart, panel, tempField.PieChartData, pieChartImage))
                            {
                                intField.PieChartImage = pieChartImage;
                            }

                            var ls = new List<ColorCategory>();

                            foreach (var s in layer.Symbology.Categories.ToList())
                            {
                                ls.Add(new ColorCategory()
                                {
                                    Color = s.GetColor(),
                                    Expression = s.FilterExpression,
                                    LegendText = s.LegendText,
                                    Max = s.Maximum,
                                    Min = s.Minimum,
                                });
                            }

                            var colorPlate = CreateColorPlate(ls);

                            if (colorPlate != null)
                            {
                                colorPlate.Save(colorPlatImg, System.Drawing.Imaging.ImageFormat.Png);
                                intField.ColorPlateImage = colorPlatImg;
                            }

                            intField.ColorsCategories = Newtonsoft.Json.JsonConvert.SerializeObject(ls);

                            var array = Array.ConvertAll(tempField.OutputZ.Split(','), Double.Parse);


                            intField.Max = Convert.ToDouble(array.Max(), System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
                            intField.Min = Convert.ToDouble(array.Min(), System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
                            intField.Mean = Convert.ToDouble(Math.Round(array.Average(), 2), System.Globalization.CultureInfo.InvariantCulture.NumberFormat);

                            saveFields.Add(intField);

                            getSnapshot(imagePath);
                        }
                        else
                        {
                            layers.Add(new ProjectLayer() { Path = path });
                        }

                        layer.DataSet.SaveAs(path, true);
                    }
                }
            }

            projectFile.BaseMap = baseMap;
            projectFile.Layers = layers;

            interpolation.ProjectFiles = Newtonsoft.Json.JsonConvert.SerializeObject(projectFile);

            return true;
        }