示例#1
0
        protected override void OnShowObject(object Object)
        {
            this.section = Object as SectionViewModel;
            Debug.Assert(this.section != null);

            this.channelSetupControl.SetChannelData(section.ChannelInfoArray, section.VolumeViewModel.ChannelNames);
        }
示例#2
0
        /// <summary>
        /// Create a new form or use the existing form and show the specified section
        /// </summary>
        /// <param name="section"></param>
        /// <returns></returns>
        public static SectionViewerForm Show(SectionViewModel section)
        {
            //  SectionViewerForm form = new SectionViewerForm(section);
              //  form.Show();
            SectionViewerForm form = State.ViewerForm;
            if (form == null)
            {
                form = new SectionViewerForm(section);
                State.ViewerForm = form;
            }
            else if (form.IsDisposed)
            {
                form = new SectionViewerForm(section);
                State.ViewerForm = form;
            }
            else
            {
                form.Section = section;
            }

            form.WindowState = FormWindowState.Maximized;
            form.Show();

            return form;
        }
示例#3
0
        public SectionViewerForm(SectionViewModel section)
        {
            InitializeComponent();

            this.SectionControl.Section = section;
            this.SectionControl.OnSectionChanged += new SectionChangedEventHandler(OnSectionChanged);

            if(section != null)
                this.Text = this.BuildTitleString(section.ToString());
        }
        public SectionAnnotationViewModel(SectionViewModel section,  Viking.UI.Controls.SectionViewerControl Parent)
        {
            this.parent = Parent;
            this.Section = section;

            Store.Locations.OnAddUpdateRemoveKey += new AddUpdateRemoveKeyEventHandler(OnStoreAddRemoveKey);
            Store.Locations.OnAllUpdatesCompleted += new OnAllUpdatesCompletedEventHandler(OnAllUpdatesCompleted);

            LocationLinkDeletedEventHandler = new EventHandler(OnLocationLinkDeleted);
            StructureLinkDeletedEventHandler = new EventHandler(OnStructureLinkDeleted);
        }
示例#5
0
        public VolumeViewModel(string path, string localCachePath, System.ComponentModel.BackgroundWorker workerThread)
        {
            _Volume = new Volume(path, localCachePath, workerThread);

            SectionViewModels = new SortedList<int, SectionViewModel>(_Volume.Sections.Length);

            foreach (Section s in _Volume.Sections)
            {
                SectionViewModel sectionViewModel = new SectionViewModel(this, s);
                SectionViewModels.Add(s.Number, sectionViewModel);
            }
        }
示例#6
0
        protected override void OnShowObject(object Object)
        {
            this.Obj = Object as SectionViewModel;
            Debug.Assert(this.Obj != null);

            this.textSectionNameNumber.Text = Obj.Number.ToString() + " : " + Obj.Name;

            try
            {

                SetRTFText(Obj.Notes);
            }
            catch
            {

            }

            List<int> SectionNumbers = new List<int>(UI.State.volume.SectionViewModels.Keys);
            SectionNumbers.Sort();

            int ReferenceAbove = int.MaxValue;
            int ReferenceBelow = int.MinValue;

            if(Obj.ReferenceSectionAbove != null)
                ReferenceAbove = Obj.ReferenceSectionAbove.Number;

            if (Obj.ReferenceSectionBelow != null)
                ReferenceBelow = Obj.ReferenceSectionBelow.Number;

            for (int iSection = 0; iSection < SectionNumbers.Count; iSection++)
            {
                int SectionNumber = SectionNumbers[iSection];
                if (SectionNumber < Obj.Number)
                {
                    listBelow.Items.Add(SectionNumber);
                    if (SectionNumber == ReferenceBelow)
                        listBelow.SelectedItem = SectionNumber;

                }
                else if (SectionNumber > Obj.Number)
                {
                    listAbove.Items.Add(SectionNumber);
                    if (SectionNumber == ReferenceAbove)
                        listAbove.SelectedItem = SectionNumber;
                }
            }
        }
        public SectionLocationsViewModel(SectionViewModel section,  Viking.UI.Controls.SectionViewerControl Parent)
        {
            this.parent = Parent;
            Trace.WriteLine("Create SectionLocationsViewModel for " + section.Number.ToString());
            this.Section = section;

            GridRectangle bounds = AnnotationOverlay.SectionBounds(parent, parent.Section.Number);

            if (Locations == null)
                Locations = new QuadTree<Location_CanvasViewModel>(bounds);

            LocationsForStructure = new ConcurrentDictionary<long, ConcurrentDictionary<long, Location_CanvasViewModel>>();
            
            StructureLinksSearch = new LineSearchGrid<StructureLink>(bounds, 10000);
            
            CollectionChangedEventManager.AddListener(Store.Structures, this);
            CollectionChangedEventManager.AddListener(Store.StructureLinks, this);
        }
示例#8
0
 public SectionChangedEventArgs(SectionViewModel newSection, SectionViewModel oldSection)
 {
     this.NewSection = newSection;
     this.OldSection = oldSection;
 }
示例#9
0
        /// <summary>
        /// Load the annotations for the passed section and its reference sections
        /// </summary>
        /// <param name="section"></param>
        internal static void LoadSectionAnnotations(SectionViewModel section)
        {
            Trace.WriteLine("LoadSectionAnnotations: " + section.Number.ToString(), "WebAnnotation");
            lock (LockObject)
            {
                if (LocationsForStructure != null)
                {
                    LocationsForStructure.Clear();
                }

                if (TransformedLocationPositionDict != null)
                {
                    TransformedLocationPositionDict.Clear();
                }

                if (TransformedRefLocationQuadTree != null)
                {
                    TransformedRefLocationQuadTree = null;
                }

                if (TransformedLocationQuadTree != null)
                {
                    TransformedLocationQuadTree = null;
                }

                if (LocationLinksSearch != null)
                {
                    ClearLocationLinks();
                    LocationLinksSearch = null;
                }

                if (StructureLinksSearch != null)
                {
                    ClearStructureLinks();
                    StructureLinksSearch = null;
                }

                AnnotationCache.Section = section;

                if (Section == null)
                    return;

                //Create the datastructures
                GridRectangle bounds = QuadTreeBounds();

                /*PORT Concurrent Collections
                if (Locations == null)
                {
                    Locations = new SortedList<long, LocationObj>();
                }

                if (ReferenceLocations == null)
                {
                    ReferenceLocations = new SortedList<long, LocationObj>();
                }
                */

                if (LocationsForStructure == null)
                {
                    LocationsForStructure = new ConcurrentDictionary<long, ConcurrentDictionary<long, LocationObj>>();
                }

                TransformedRefLocationQuadTree = new QuadTree<long>(bounds);
                TransformedLocationQuadTree = new QuadTree<long>(bounds);

                bounds.Scale(.2);
                LocationLinksSearch = new LineSearchGrid<LocationLinkObj>(bounds, 10000);
                StructureLinksSearch = new LineSearchGrid<StructureLinkObj>(bounds, 10000);
            } //Have to let the Lock go before we call the location store or we can get a deadlock.  Don't modify
              //data structures after this point.

            //Load reference locations

            /* PORT Concurrent Collections
            List<LocationObj> RefLocationArray = new List<LocationObj>();

            if (section.ReferenceSectionBelow != null)
                RefLocationArray.AddRange(Store.Locations.GetLocationsForSection(section.ReferenceSectionBelow.Number));

            if (section.ReferenceSectionAbove != null)
                RefLocationArray.AddRange(Store.Locations.GetLocationsForSection(section.ReferenceSectionAbove.Number));

            //            ReferenceLocations = new SortedList<long, LocationObj>();
            */

            LocationObj[] RefLocations = GetReferenceLocations();
            foreach (LocationObj loc in RefLocations)
            {
                AddLocation(loc);
            }

            foreach (LocationObj loc in Locations.Values)
            {
                AddLocation(loc);
            }

            //            PopulateLocationLinks();
        }