Exemplo n.º 1
0
        /// <summary>
        /// Called from the IMultiImageControl control when the group of images changes.
        /// </summary>
        /// <param name="file">Unused as IMultiImageControl uses batches of files.</param>
        private void IMultiImageControlGroupChanged(SourceFile file)
        {
            if (this.ApplicationContext.SelectedDataSource != null && !String.IsNullOrEmpty(this.ApplicationContext.SelectedDataSource.CurrentContainer))
            {
                String classification = (this.ApplicationContext.SelectedDataSource as IMultiImageDataSource).CurrentContainerAsClassification;
                int    groupSize      = (this.ApplicationContext.SelectedDataSource as IMultiImageDataSource).BatchSize;
                int    currentIndex   = this.ApplicationContext.SelectedDataSource.CurrentContainerIndex + 1;
                int    containerCount = this.ApplicationContext.SelectedDataSource.CurrentContainerCollectionCount;

                double dblgroups = (double)containerCount / (double)groupSize;
                int    intgroups = containerCount / groupSize;

                if ((dblgroups - intgroups) > 0)
                {
                    intgroups += 1;
                }

                int currentGroup = (currentIndex > 0) ? (int)Math.Round((double)currentIndex / (double)groupSize) : 1;


                ClassificationCheckboxPanelHelper.MakeSelection(
                    this.ClassificationTabSelectionPanel,
                    classification);

                this.StatusBarLocationStatus.Text =
                    String.Format("Viewing Group :  {0} of {1}",
                                  (currentGroup > 0)?currentGroup : 1,
                                  intgroups);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Helper function used whenever we need to save the current selections
 /// </summary>
 private void ForceClassificationUpdate()
 {
     if (this.ApplicationContext.SelectedDataSource != null && this.ApplicationContext.SelectedDataSource.ImageControl != null)
     {
         this.ApplicationContext.SelectedDataSource.ImageControl.UpdateClassifications(
             ClassificationCheckboxPanelHelper.CollectSelections(this.ClassificationTabSelectionPanel)
             );
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Called when ANY ToggleButton is changed for classification purposes.
        /// </summary>
        private void OnSelectionsChanged()
        {
            this.Item.CurrentSource.Classifications = ClassificationCheckboxPanelHelper.CollectSelections(this.ClassificationPanel);


            if (this.Item.CurrentSource.Classifications.Count == 0)
            {
                // Back to the original
                this.Item.CurrentSource.Classifications.Add(this.Source.CurrentContainerAsClassification);
            }

            this.Source.UpdateSourceFile(this.Item.CurrentSource);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Populate the StackPanel with the classificaitons options then select
        /// whatever the image has been tagged with already.
        /// </summary>
        private void AddPanelItems()
        {
            this.ClassificationPanel.Children.Clear();
            ClassificationCheckboxPanelHelper.PopulateSelectionPanel(
                this.Source,
                this.ClassificationPanel,
                this.Classifications,
                this.OnSelectionsChanged);

            ClassificationCheckboxPanelHelper.MakeSelection(
                this.ClassificationPanel,
                this.Item.CurrentSource);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Populate the panel with the selections for classifications and then hook all of the key bindings
        /// so it can be made with shortcuts.
        /// </summary>
        private void PopulateAnnotationsTabAnnotationsPanel()
        {
            // Clear current bindings
            this.InputBindings.Clear();

            // Set up all the boxes
            List <System.Windows.Controls.Primitives.ToggleButton> boxes = ClassificationCheckboxPanelHelper.PopulateSelectionPanel(
                this.ApplicationContext.SelectedDataSource,
                this.ClassificationTabSelectionPanel,
                this.ApplicationContext.SelectedDataSource.Classifications,
                this.ForceClassificationUpdate);

            // Now set up all of the key bindings
            this.PrepareAllInputBindings(boxes);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Called from the ISingleImageControl control when the displayed image changes
        /// </summary>
        /// <param name="file">File on display</param>
        private void ISingleImageControlFileChanged(SourceFile file)
        {
            if (this.ApplicationContext.SelectedDataSource != null)
            {
                if (file != null)
                {
                    ClassificationCheckboxPanelHelper.MakeSelection(
                        this.ClassificationTabSelectionPanel,
                        file);
                }

                this.StatusBarLocationStatus.Text =
                    String.Format("Viewing {0} of {1} ",
                                  this.ApplicationContext.SelectedDataSource.CurrentContainerIndex + 1,
                                  this.ApplicationContext.SelectedDataSource.CurrentContainerCollectionCount);
            }
        }