/// <summary> /// Creates a new instance of the frmAssignProjection class /// </summary> public frmReproject(MapWinGIS.Interfaces.IMapWin mapWin) { InitializeComponent(); if (mapWin == null) { throw new ArgumentException("No reference to MapWinGIS was passed"); } ProjectionDatabase database = mapWin.ProjectionDatabase as ProjectionDatabase; if (database == null) { throw new InvalidCastException("Invalid instance of projection database was passed"); } m_mapWin = mapWin; LayersControl1.Initialize(mapWin); if (ProjectionTreeView1.Initialize(database, mapWin)) { this.ProjectionTreeView1.RefreshList(); } this.LayersControl1.ControlType = LayersControl.CustomType.Projection; }
/// <summary> /// Creates a new instance of the frmAssignProjection class /// </summary> public frmAssignProjection(MapWinGIS.Interfaces.IMapWin mapWin) { InitializeComponent(); if (mapWin == null) { throw new NullReferenceException("No reference to MapWinGIS was passed"); } ProjectionDatabase database = mapWin.ProjectionDatabase as ProjectionDatabase; if (database == null) { throw new InvalidCastException("Invalid instance of projection database was passed"); } m_mapWin = mapWin; LayersControl1.Initialize(mapWin); LayersControl1.LayerAdded += delegate(string filename, DataGridView dgv, int rowIndex) { this.RefreshControlState(); }; LayersControl1.LayerRemoved += delegate() { this.RefreshControlState(); }; if (ProjectionTreeView1.Initialize(database, mapWin)) { this.ProjectionTreeView1.RefreshList(); } this.LayersControl1.ControlType = LayersControl.CustomType.Projection; this.RefreshControlState(); }
/// <summary> /// Creates a new instance of frmProjectionChooser class. /// It's assumed that database is read already. /// </summary> public frmChooseProjection(ProjectionDatabase database, MapWinGIS.Interfaces.IMapWin mapWin) { InitializeComponent(); if (projectionTreeView1.Initialize(database, mapWin)) { this.projectionTreeView1.RefreshList(); } }
/// <summary> /// Creates a new instance of frmProjectionChooser class /// It's assumed that database isn't read yet /// </summary> public frmChooseProjection(MapWinGIS.Interfaces.IMapWin mapWin) { InitializeComponent(); if (projectionTreeView1.InitializeByExePath(Application.ExecutablePath, mapWin)) { this.projectionTreeView1.RefreshList(); } }
/// <summary> /// Initilizes tree view with the existing in-memory version of database /// </summary> public bool Initialize(ProjectionDatabase database, MapWinGIS.Interfaces.IMapWin mapWin) { m_mapWin = mapWin; // null is acceptable as well if (database.Name == "") { return(false); } this.m_database = database; return(true); }
/// <summary> /// Creates a new instance of the frmImportShapefile dialog /// </summary> public frmImportShapefile(MapWinGIS.Interfaces.IMapWin mapWin) { InitializeComponent(); if (mapWin == null) { throw new ArgumentException("No refernce to MapWinGIS was passed."); } m_mapWin = mapWin; // TODO: fill the list of tables }
/// <summary> /// Initializes tree view /// </summary> /// <param name="databaseName">The name of MS Access database with projections</param> /// <returns></returns> public bool Initialize(string databaseName, MapWinGIS.Interfaces.IMapWin mapWin) { m_mapWin = mapWin; // null is acceptable as well try { m_database = new ProjectionDatabase(databaseName, new MapWinGIS.Data.SQLiteProvider()); } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } return(true); }
/// <summary> /// Creates a new instance of the frmProjectionResults class /// </summary> public frmProjectionResults(MapWinGIS.Interfaces.IMapWin mapWin) { InitializeComponent(); if (mapWin == null) { throw new ArgumentException("Reference to MapWinGIS wasn't passed."); } m_mapWin = mapWin; projectionMap1.LoadStateFromExeName(Application.ExecutablePath); projectionMap1.CoordinatesChanged += new ProjectionMap.CoordinatesChangedDelegate(projectionMap1_CoordinatesChanged); dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect; //dgv.SelectionChanged += new EventHandler(dgv_SelectionChanged); }
/// <summary> /// Initializes by the pass to the executable file. \Projection folder is assumed. /// </summary> public bool InitializeByExePath(string executablePath, MapWinGIS.Interfaces.IMapWin mapWin) { string path = System.IO.Path.GetDirectoryName(executablePath) + @"\Projections\"; if (!Directory.Exists(path)) { MessageBox.Show("Projections folder isn't found: " + path); return(false); } string[] files = Directory.GetFiles(path, "*.mdb"); if (files.Length != 1) { MessageBox.Show("A single database is expected. " + files.Length.ToString() + " databases are found." + Environment.NewLine + "Path : " + path + Environment.NewLine); return(false); } else { this.Initialize(files[0], mapWin); return(true); } }
/// <summary> /// Creates a new instance of frmProjectionManager class /// </summary> public frmProjectionManager(MapWinGIS.Interfaces.IMapWin mapWin) { InitializeComponent(); if (mapWin == null) { throw new NullReferenceException("No reference to MapWinGIS was passed"); } ProjectionDatabase database = mapWin.ProjectionDatabase as ProjectionDatabase; if (database == null) { throw new InvalidCastException("Invalid instance of projection database was passed"); } m_mapWin = mapWin; // initializing tree if (this.projectionTreeView1.Initialize(database, m_mapWin)) { int gcsCount, pcsCount; this.projectionTreeView1.RefreshList(out gcsCount, out pcsCount); lblGcsCount.Text = "Coordinate systems: " + gcsCount.ToString(); lblPcsCount.Text = "Projections: " + pcsCount.ToString(); } projectionTreeView1.CoordinateSystemSelected += new ProjectionTreeView.CoordinateSystemSelectedDelegate(projectionTreeView1_CoordinateSystemSelected); // initializing map projectionMap1.LoadStateFromExeName(Application.ExecutablePath); projectionMap1.CoordinatesChanged += new ProjectionMap.CoordinatesChangedDelegate(projectionMap1_CoordinatesChanged); // showing information on WGS 84 IEnumerable <GeographicCS> list = projectionTreeView1.CoordinateSystems.Where(cs => cs.Code == 4326); projectionTreeView1_CoordinateSystemSelected((Territory)list.First()); }
/// <summary> /// Constructor with bounds /// </summary> public frmIdentifyProjection(MapWinGIS.Interfaces.IMapWin mapWin, MapWinGIS.Extents bounds) { InitializeComponent(); if (mapWin == null) { throw new NullReferenceException("No reference to MapWinGIS was provided"); } m_mapWin = mapWin; m_bounds = bounds; m_noEvents = true; cboLayer.DataSource = m_mapWin.Layers.Where(l => !l.HideFromLegend).ToList(); cboLayer.DisplayMember = "Name"; cboLayer.ValueMember = "Handle"; m_noEvents = false; if (cboLayer.Items.Count > 0) { cboLayer.SelectedIndex = 0; cboLayer_SelectedIndexChanged(null, null); } }
/// <summary> /// Creates a new instance of the ChooseProviderForm /// </summary> public TilesForm(MapWinGIS.Interfaces.IMapWin mapWin, Tiles tiles) { InitializeComponent(); this.btnChangeDiskLocation.Click += new System.EventHandler(this.btnChangeDiskLocation_Click); this.btnRunCaching.Click += new System.EventHandler(this.btnRunCaching_Click); this.chkServer.CheckedChanged += new System.EventHandler(this.chkServer_CheckedChanged); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TilesForm_FormClosing); this.treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick); if (mapWin == null) { throw new ArgumentNullException("Reference to MapWinGIS wasn't passed"); } this.tiles = tiles; this.mapWin = mapWin; TileSettings.FillProviderTree(this.treeView1, tiles.ProviderId); this.state = tiles.Serialize(); this.cacheSizeControl1.Init(tiles, tkCacheType.RAM); this.cacheSizeControl2.Init(tiles, tkCacheType.Disk); string s = tiles.DiskCacheFilename; this.txtDiskCachePath.Text = s; this.chkServer.Checked = tiles.UseServer; this.chkVisible.Checked = tiles.Visible; if (tabIndex >= 0 && tabIndex < tabControl1.TabPages.Count) { this.tabControl1.SelectedIndex = tabIndex; } }
/// <summary> /// Creates a new instance of the frmIdentifyProjection class /// </summary> public frmIdentifyProjection(MapWinGIS.Interfaces.IMapWin mapWin) : this(mapWin, null) { }