Пример #1
0
        private void zoomButton_Click(object sender, System.EventArgs e)
        {
            ArrayList selected = GetSelectedRows(geotiffDataGrid);

            if (selected.Count > 0)
            {
                ClearMessages();
                CustomMapsCache.resetBoundaries();
                int       column = 0;
                DataTable table  = m_geotiffDS.Tables[0];
                foreach (int row in selected)
                {
                    long      cmId = (long)((int)geotiffDataGrid[row, column]);
                    CustomMap cm   = CustomMapsCache.getCustomMapById(cmId);
                    if (cm != null)
                    {
                        CustomMapsCache.pushBoundaries(cm.TopLeft);
                        CustomMapsCache.pushBoundaries(cm.BottomRight);
                    }
                }
                PictureManager.This.CameraManager.zoomToCorners(CustomMapsCache.TopLeft, CustomMapsCache.BottomRight);
            }
            else
            {
                Project.ShowPopup(zoomButton, "\nselect a custom map first" + Project.SELECT_HELP, Point.Empty);
            }
        }
Пример #2
0
        private void setCustomMapsEnabled(DataGrid dataGrid, DataSet dataSet, bool enabled, Control owner)
        {
            ArrayList selected = GetSelectedRows(dataGrid);

            if (selected.Count > 0)
            {
                ClearMessages();
                int       column = 0;
                DataTable table  = dataSet.Tables[0];
                foreach (int row in selected)
                {
                    long      cmId = (long)((int)geotiffDataGrid[row, column]);
                    CustomMap cm   = CustomMapsCache.getCustomMapById(cmId);
                    if (cm != null)
                    {
                        // rows in the table are numbered differently than rows in the grid, so we go by track ID:
                        for (int indx = 0; indx < table.Rows.Count; indx++)
                        {
                            long rowCustomMapId = (long)((int)table.Rows[indx][column]);
                            if (rowCustomMapId == cmId)
                            {
                                cm.Enabled = enabled;
                                table.Rows[indx]["displayed"] = enabled;
                                break;
                            }
                        }
                    }
                }
                PutOnMap();
            }
            else
            {
                Project.ShowPopup(owner, "\nselect a custom map first" + Project.SELECT_HELP, Point.Empty);
            }
        }
Пример #3
0
 private void geotiff_RowDeleting(object sender, System.Data.DataRowChangeEventArgs e)
 {
     if (!rebuildingCustomMaps && !deletingCustomMaps)
     {
         try
         {
             int  column = 0;
             long cmId   = (long)((int)e.Row[column]);
             unlistCustomMap(cmId);
             CustomMapsCache.RemoveCustomMapById(cmId);
             PutOnMap();
         }
         catch {}
     }
 }
Пример #4
0
        private void deleteButton_Click(object sender, System.EventArgs e)
        {
            ArrayList selected = GetSelectedRows(geotiffDataGrid);

            if (selected.Count > 0)
            {
                deletingCustomMaps = true;
                ClearMessages();
#if DEBUG
                string str = "";
#endif
                int       column = 0;
                DataTable table  = m_geotiffDS.Tables[0];
                for (int i = selected.Count - 1; i >= 0; i--)
                {
                    int  row  = (int)selected[i];
                    long cmId = (long)((int)geotiffDataGrid[row, column]);
#if DEBUG
                    str += "" + row + "=" + cmId + " ";
#endif
                    // rows in the table are numbered differently than rows in the grid, so we go by CustomMap ID:
                    for (int indx = 0; indx < table.Rows.Count; indx++)
                    {
                        long rowCustomMapId = (long)((int)table.Rows[indx][column]);
                        if (rowCustomMapId == cmId)
                        {
                            table.Rows[indx].Delete();
                            unlistCustomMap(cmId);
                            CustomMapsCache.RemoveCustomMapById(cmId);
                            break;
                        }
                    }
                }
#if DEBUG
                messageLabel.Text = "selected: " + str;
#else
                messageLabel.Text = "";
#endif
                PutOnMap();
                deletingCustomMaps = false;
            }
            else
            {
                //messageTrkLabel.Text = "Error: select a GeoTIFF map to delete first";
                Project.ShowPopup(deleteButton, "\nselect a custom map to delete first" + Project.SELECT_HELP, Point.Empty);
            }
        }
Пример #5
0
        private void unlistCustomMap(long id)
        {
            CustomMap cm = CustomMapsCache.getCustomMapById(id);

            if (cm != null)
            {
                for (int i = 0; i < Project.FileDescrList.Count; i++)
                {
                    FormattedFileDescr ffd = (FormattedFileDescr)Project.FileDescrList[i];
                    if (ffd.filename.Equals(cm.Source))
                    {
                        Project.FileDescrList.RemoveAt(i);
                        break;
                    }
                }
            }
        }
Пример #6
0
        private void selectFileButton_Click(object sender, System.EventArgs e)
        {
            traceTextBox.Text = "selected: " + Project.togeotiffFileName;

            GeoTiff geoTiff = new GeoTiff(Project.togeotiffFileName);

            geoTiff.TopLeftLat     = geoTiff.TopRightLat = CameraManager.This.CoverageTopLeft34.Lat;
            geoTiff.TopLeftLng     = geoTiff.BottomLeftLng = CameraManager.This.CoverageTopLeft34.Lng;
            geoTiff.BottomRightLat = geoTiff.BottomLeftLat = CameraManager.This.CoverageBottomRight34.Lat;
            geoTiff.BottomRightLng = geoTiff.TopRightLng = CameraManager.This.CoverageBottomRight34.Lng;

            geoTiff.initImageOnly();

            if (geoTiff.isValid)
            {
                CustomMapsCache.RemoveCustomMapsBySource(Project.togeotiffFileName);

                CustomMap cm = new CustomMapGeotiff(geoTiff);
                Project.customMapId++;
                cm.Id = Project.customMapId;
                CustomMapsCache.AddCustomMap(cm);

                WaypointsCache.pushBoundaries(cm.Location);
                WaypointsCache.pushBoundaries(new GeoCoord(geoTiff.BottomLeftLng, geoTiff.BottomLeftLat));
                WaypointsCache.pushBoundaries(new GeoCoord(geoTiff.TopRightLng, geoTiff.TopRightLat));
                WaypointsCache.pushBoundaries(new GeoCoord(geoTiff.BottomRightLng, geoTiff.BottomRightLat));

                string msg = "OK: read image file " + Project.togeotiffFileName;
                LibSys.StatusBar.Trace(msg);
                LibSys.StatusBar.Trace("* " + msg);

                toState(2);

                selectGeotiffPointButton.Enabled = true;
                selectMapPointButton.Enabled     = false;

                PictureManager.This.Refresh();
            }
            else
            {
                LibSys.StatusBar.Error("cannot make a GeoTIFF file: " + Project.togeotiffFileName);
            }
        }
Пример #7
0
        private void HandleCustomMapPersistChanges(object sender, BoolValueChangedEventArgs e)
        {
#if DEBUG
            string str = "Persist changed: row " + e.Row + "   value " + e.BoolValue;
#endif
            int       column    = 0;
            DataTable table     = m_geotiffDS.Tables[0];
            int       row       = e.Row;
            long      geotiffId = (long)((int)geotiffDataGrid[row, column]);
            CustomMap cm        = CustomMapsCache.getCustomMapById(geotiffId);
#if DEBUG
            str += "  " + row + "=" + geotiffId + " ";
#endif
            if (cm != null)
            {
                cm.Persist = e.BoolValue;
                //PutOnMap();
            }
#if DEBUG
            LibSys.StatusBar.Trace(str);
            //messageLabel.Text = str;
#endif
        }