Example #1
0
        private void ShowAOIList()
        {
            var aoiw = new AOIWindow();

            aoiw.ShowAOIList();
            aoiw.Owner = this;
            aoiw.Show();
        }
Example #2
0
        private void OnMenuClick(object sender, RoutedEventArgs e)
        {
            switch (((WindowMenuItem)sender).Name)
            {
            case "menuEdit":
                break;

            case "menuAddLayerBoundaryLGU":
                string feedfBack = "";
                MapWindowManager.AddLGUBoundary(out feedfBack);
                if (feedfBack.Length > 0)
                {
                    System.Windows.MessageBox.Show(feedfBack, "GPX Manager", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                break;

            case "menuMapTilesSelectProvider":
                SelectTileProvider();
                break;

            case "menuClose":
                Close();
                break;

            case "menuSaveMapState":
                SaveMapState();
                break;

            case "menuAOICreate":
                var aoiw = new AOIWindow();
                aoiw.Owner = this;
                aoiw.AddNewAOI();
                aoiw.Show();
                AOIManager.AddNew();
                break;

            case "menuAOIList":
                aoiw = new AOIWindow();
                aoiw.ShowAOIList();
                aoiw.Owner = this;
                aoiw.Show();
                break;

            case "menuIslandLabels":
                break;
            }
        }
Example #3
0
        private void OnMenuClick(object sender, RoutedEventArgs e)
        {
            switch (((WindowMenuItem)sender).Name)
            {
            case "menuCleanExtractedtracks":
                if (MapWindowManager.ExtractedTracksShapefile != null && MapWindowManager.BSCBoundaryShapefile != null)
                {
                    var result = Entities.ExtractedFishingTrackViewModel.CleanupUsingBoundary(MapWindowManager.BSCBoundaryShapefile);

                    string message = "No tracks were removed during the cleanup";
                    if (result > 0)
                    {
                        message = $"Cleanup resulted in {result} tracks removed";
                    }

                    System.Windows.Forms.MessageBox.Show(message, "GPX Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    System.Windows.MessageBox.Show("Extracted track and boundary must be loaded", "GPX Manager", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                break;

            case "menuAddExtractedTracks":
                if (!MapWindowManager.AddExtractedTracksLayer())
                {
                    System.Windows.MessageBox.Show("Extracted tracks not found", "GPX Manager", MessageBoxButton.OK, MessageBoxImage.Information);
                }

                break;

            case "menuAddBSCBoundary":
                string feedfBack = "";

                if (!MapWindowManager.SetBoundaryShapefile())
                {
                    if (MapWindowManager.BSCBoundaryShapefile == null)
                    {
                        MapWindowManager.AddBSCBoundaryLineShapefile(FileOpenDialogForShapefile(), out feedfBack);
                    }
                    if (feedfBack.Length > 0)
                    {
                        System.Windows.MessageBox.Show(feedfBack, "GPX Manager", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                }

                break;

            case "menuEdit":
                break;

            case "menuAddLayerBoundaryLGU":
                feedfBack = "";
                MapWindowManager.AddLGUBoundary(out feedfBack);
                if (feedfBack.Length > 0)
                {
                    System.Windows.MessageBox.Show(feedfBack, "GPX Manager", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                break;

            case "menuMapTilesSelectProvider":
                SelectTileProvider();
                break;

            case "menuClose":
                Close();
                break;

            case "menuSaveMapState":
                SaveMapState();
                break;

            case "menuAOICreate":
                var aoiw = new AOIWindow();
                aoiw.Owner = this;
                aoiw.AddNewAOI();
                aoiw.Show();
                AOIManager.AddNew();
                break;

            case "menuAOIList":
                ShowAOIList();
                break;

            case "menuIslandLabels":
                break;
            }
        }
Example #4
0
        protected void CreateWindow(Point startPoint, Point endPoint)
        {
            startPoint = FitPointInImage(startPoint);
            endPoint   = FitPointInImage(endPoint);

            for (int index = m_AOIWindows.Count - 1; index >= 0; index--)
            {
                if (m_AOIWindows[index].IsLoaded == false)
                {
                    m_AOIWindows.RemoveAt(index);
                }
            }

            //TODO: This needs to be configurable
            if (m_AOIWindows.Count >= 3)
            {
                return;
            }


            if (startPoint.X > endPoint.X)
            {
                double temp = endPoint.X;
                endPoint.X   = startPoint.X;
                startPoint.X = temp;
            }

            if (startPoint.Y > endPoint.Y)
            {
                double temp = endPoint.Y;
                endPoint.Y   = startPoint.Y;
                startPoint.Y = temp;
            }

            SourceObject highEnergy = null;
            SourceObject lowEnergy  = null;
            SourceObject trimat     = null;
            ViewType     viewType   = ViewType.Unknown;

            if (m_ViewObject.HighEnergy != null)
            {
                double heightratio = m_ViewObject.HighEnergy.Height / base.ActualHeight;
                double widthratio  = m_ViewObject.HighEnergy.Width / base.ActualWidth;

                int StartX = (int)(startPoint.X * widthratio);
                int StartY = (int)(startPoint.Y * heightratio);
                int EndX   = (int)(endPoint.X * widthratio);
                int EndY   = (int)(endPoint.Y * heightratio);

                int width  = EndX - StartX;
                int height = EndY - StartY;

                float[] data = new float[width * height];

                for (int j = StartY, k = 0; j < EndY; j++, k++)
                {
                    for (int i = StartX, l = 0; i < EndX; i++, l++)
                    {
                        data[(k * width) + l] = m_ViewObject.HighEnergy.Data[(j * m_ViewObject.HighEnergy.Width) + i];
                    }
                }

                highEnergy = new SourceObject(data, width, height, false, false);
                viewType   = ViewType.HighEnergy;
            }

            if (m_ViewObject.LowEnergy != null)
            {
                double heightratio = m_ViewObject.LowEnergy.Height / base.ActualHeight;
                double widthratio  = m_ViewObject.LowEnergy.Width / base.ActualWidth;

                int StartX = (int)(startPoint.X * widthratio);
                int StartY = (int)(startPoint.Y * heightratio);
                int EndX   = (int)(endPoint.X * widthratio);
                int EndY   = (int)(endPoint.Y * heightratio);

                int width  = EndX - StartX;
                int height = EndY - StartY;

                float[] data = new float[width * height];

                for (int j = StartY, k = 0; j < EndY; j++, k++)
                {
                    for (int i = StartX, l = 0; i < EndX; i++, l++)
                    {
                        data[(k * width) + l] = m_ViewObject.LowEnergy.Data[(j * m_ViewObject.LowEnergy.Width) + i];
                    }
                }

                lowEnergy = new SourceObject(data, width, height, false, false);
                viewType  = ViewType.LowEnergy;
            }

            ViewObject viewObj = new ViewObject(m_ViewObject.Name, m_ViewObject.ImageIndex, viewType, highEnergy, lowEnergy, m_ViewObject.MaxDetectorsPerBoard, m_ViewObject.BitsPerPixel, m_ViewObject.SamplingSpeed, m_ViewObject.SamplingSpace, new List <AnnotationInfo>());

            try
            {
                AOIWindow window = new AOIWindow();
                window.AlgServerRequestEvent += new AlgServerRequestEventHandler(AOIWindow_AlgServerRequestEvent);
                window.Setup(viewObj);
                window.AOIXRayView.MainImage.Width  = (int)(endPoint.X - startPoint.X);
                window.AOIXRayView.MainImage.Height = (int)(endPoint.Y - startPoint.Y);
                window.Show();

                foreach (AOIWindow aoiWindow in m_AOIWindows)
                {
                    if (window.Top == aoiWindow.Top && (window.Left == aoiWindow.Left))
                    {
                        window.Top  = aoiWindow.Top + 25;
                        window.Left = aoiWindow.Left + 25;
                    }
                }

                m_AOIWindows.Add(window);
            }
            catch (Exception ex)
            {
            }
        }
Example #5
0
        protected void CreateWindow (Point startPoint, Point endPoint)
        {
            startPoint = FitPointInImage(startPoint);
            endPoint = FitPointInImage(endPoint);
            
            for (int index = m_AOIWindows.Count - 1; index >= 0; index--)
            {
                if (m_AOIWindows[index].IsLoaded == false)
                {
                    m_AOIWindows.RemoveAt(index);
                }
            }

            //TODO: This needs to be configurable
            if (m_AOIWindows.Count >= 3)
            {
                return;
            }


            if (startPoint.X > endPoint.X)
            {
                double temp = endPoint.X;
                endPoint.X = startPoint.X;
                startPoint.X = temp;
            }

            if (startPoint.Y > endPoint.Y)
            {
                double temp = endPoint.Y;
                endPoint.Y = startPoint.Y;
                startPoint.Y = temp;
            }

            SourceObject highEnergy = null;
            SourceObject lowEnergy = null;
            SourceObject trimat = null;
            ViewType viewType = ViewType.Unknown;

            if (m_ViewObject.HighEnergy != null)
            {
                double heightratio = m_ViewObject.HighEnergy.Height / base.ActualHeight;
                double widthratio = m_ViewObject.HighEnergy.Width / base.ActualWidth;

                int StartX = (int)(startPoint.X * widthratio);
                int StartY = (int)(startPoint.Y * heightratio);
                int EndX = (int)(endPoint.X * widthratio);
                int EndY = (int)(endPoint.Y * heightratio);

                int width = EndX - StartX;
                int height = EndY - StartY;

                float[] data = new float[width * height];

                for (int j = StartY, k = 0; j < EndY; j++, k++)
                {
                    for (int i = StartX, l = 0; i < EndX; i++, l++)
                    {
                        data[(k * width) + l] = m_ViewObject.HighEnergy.Data[(j * m_ViewObject.HighEnergy.Width) + i];
                    }
                }

                highEnergy = new SourceObject(data, width, height, false, false);
                viewType = ViewType.HighEnergy;
            }

            if (m_ViewObject.LowEnergy != null)
            {
                double heightratio = m_ViewObject.LowEnergy.Height / base.ActualHeight;
                double widthratio = m_ViewObject.LowEnergy.Width / base.ActualWidth;

                int StartX = (int)(startPoint.X * widthratio);
                int StartY = (int)(startPoint.Y * heightratio);
                int EndX = (int)(endPoint.X * widthratio);
                int EndY = (int)(endPoint.Y * heightratio);

                int width = EndX - StartX;
                int height = EndY - StartY;

                float[] data = new float[width * height];

                for (int j = StartY, k = 0; j < EndY; j++, k++)
                {
                    for (int i = StartX, l = 0; i < EndX; i++, l++)
                    {
                        data[(k * width) + l] = m_ViewObject.LowEnergy.Data[(j * m_ViewObject.LowEnergy.Width) + i];
                    }
                }

                lowEnergy = new SourceObject(data, width, height, false, false);
                viewType = ViewType.LowEnergy;
            }

            ViewObject viewObj = new ViewObject(m_ViewObject.Name, m_ViewObject.ImageIndex, viewType, highEnergy, lowEnergy, m_ViewObject.MaxDetectorsPerBoard, m_ViewObject.BitsPerPixel, m_ViewObject.SamplingSpeed, m_ViewObject.SamplingSpace, new List<AnnotationInfo>());
            try
            {
                AOIWindow window = new AOIWindow();
                window.AlgServerRequestEvent += new AlgServerRequestEventHandler(AOIWindow_AlgServerRequestEvent);
                window.Setup(viewObj);
                window.AOIXRayView.MainImage.Width = (int)(endPoint.X - startPoint.X);
                window.AOIXRayView.MainImage.Height = (int)(endPoint.Y - startPoint.Y);
                window.Show();

                foreach (AOIWindow aoiWindow in m_AOIWindows)
                {
                    if (window.Top == aoiWindow.Top && (window.Left == aoiWindow.Left))
                    {
                        window.Top = aoiWindow.Top + 25;
                        window.Left = aoiWindow.Left + 25;
                    }
                }

                m_AOIWindows.Add(window);
            }
            catch (Exception ex)
            {

            }
        }