/// <summary>
        /// Constructor for use with serialized lists of OntologyElements.
        /// </summary>
        /// <param name="ParentForm">The parent control of this, currently set to a Form object</param>
        /// <param name="FullFacetSet">The entire catalog of ontological terms, unfiltered.</param>
        /// <param name="SelectedThusFar">The list of ontological terms that have already been selected (selected upstream of this).</param>
        /// <param name="RemainingFacets">The list of ontological terms that are remaining given the selections that have been made up to this.</param>
        /// <param name="MyIndex">Zero-based index of SearchFacetSpecifiers on the parent control. This is my position.</param>
        public SearchFacetSpecifier(FacetedSearchControl ParentForm, IEnumerable <FacetedSearch3.CUAHSIFacetedSearch.OntologyElement> FullFacetSet, IEnumerable <FacetedSearch3.CUAHSIFacetedSearch.OntologyElement> SelectedThusFar, IEnumerable <FacetedSearch3.CUAHSIFacetedSearch.OntologyElement> RemainingFacetsIn, int MyIndex)
        {
            #region Initialize Control
            InitializeComponent();
            FacetedSearchHost = ParentForm;
            RemainingFacets   = RemainingFacetsIn;
            MyFacetIndex      = MyIndex;
            PreviousSelectedOntologyElements = SelectedThusFar;
            MyFullFacetSet = FullFacetSet;
            Orphans        = MyFullFacetSet.Where(r => r.IsRoot == false).ToList();
            // MyRootIsSpecified = false;
            MySelectedFacets   = new List <FacetedSearch3.CUAHSIFacetedSearch.OntologyElement>();
            ac_Timer           = new System.Timers.Timer(AutoDelay_ms);
            ac_Timer.AutoReset = false;
            ac_Timer.Elapsed  += new ElapsedEventHandler(OnAutoCompleteStart);
            #endregion

            #region Render Display of Options
            RenderMyFacetTree();
            #endregion
        }
Exemple #2
0
        private void AddSearchRibbon()
        {
            var head = App.HeaderControl;

            //Search ribbon tab
            var root = new RootItem(kHydroFacetedSearch3, "Faceted Search");

            //setting the sort order to small positive number to display it to the right of home tab
            root.SortOrder = -1;
            head.Add(root);

            #region Area group

            const string grpArea = "Area";

            //to get area select mode
            App.Map.FunctionModeChanged += new EventHandler(Map_FunctionModeChanged);
            App.Map.SelectionChanged    += Map_SelectionChanged;

            //Draw Box
            rbDrawBox                = new SimpleActionItem(kHydroFacetedSearch3, "Draw Rectangle", rbDrawBox_Click);
            rbDrawBox.LargeImage     = Resources.Draw_Box_32;
            rbDrawBox.SmallImage     = Resources.Draw_Box_16;
            rbDrawBox.GroupCaption   = grpArea;
            rbDrawBox.ToggleGroupKey = grpArea;
            head.Add(rbDrawBox);
            SearchSettings.Instance.AreaSettings.AreaRectangleChanged += Instance_AreaRectangleChanged;

            //Select
            rbSelect                = new SimpleActionItem(kHydroFacetedSearch3, "Select Polygons", rbSelect_Click);
            rbSelect.ToolTipText    = "Select Region";
            rbSelect.LargeImage     = Resources.select_poly_32;
            rbSelect.SmallImage     = Resources.select_poly_16;
            rbSelect.GroupCaption   = grpArea;
            rbSelect.ToggleGroupKey = grpArea;
            head.Add(rbSelect);
            SearchSettings.Instance.AreaSettings.PolygonsChanged += AreaSettings_PolygonsChanged;

            //AttributeTable
            rbAttribute                = new SimpleActionItem(kHydroFacetedSearch3, "Select by Attribute", rbAttribute_Click);
            rbAttribute.ToolTipText    = "Select by Attribute";
            rbAttribute.GroupCaption   = grpArea;
            rbAttribute.ToggleGroupKey = grpArea;
            rbAttribute.LargeImage     = Resources.select_table_32;
            rbAttribute.SmallImage     = Resources.select_table_16;
            head.Add(rbAttribute);

            #endregion

            #region do not implement these for now - use attribute table selection instead

            ////Select Layer
            //var rbSelectLayer = new DropDownActionItem("kSearch3LayerDropDown", "Layer");
            //rbSelectLayer.GroupCaption = grpArea;
            //rbSelectLayer.AllowEditingText = true;
            //rbSelectLayer.Items.Add("Countries");
            //rbSelectLayer.Items.Add("U.S. States");
            //rbSelectLayer.Items.Add("u.S. HUC");
            //rbSelectLayer.Width = 120;
            //rbSelectLayer.RootKey = kHydroSearch3;
            //head.Add(rbSelectLayer);

            ////Select Field
            //var rbSelectField = new DropDownActionItem("kSearch3FieldDropDown", "Field_");
            //rbSelectField.GroupCaption = grpArea;
            //rbSelectField.AllowEditingText = true;
            //rbSelectField.Items.Add("Name");
            //rbSelectField.Items.Add("Population");
            //rbSelectField.Items.Add("FIPS");
            //rbSelectField.Width = 120;
            ////rbSelectLayer.SelectedItem = "Countries";
            //rbSelectField.RootKey = kHydroSearch3;
            //head.Add(rbSelectField);

            ////Select Value
            //var rbSelectVal = new DropDownActionItem("kSearch3ValueDropDown", "Value ");
            //rbSelectVal.GroupCaption = grpArea;
            //rbSelectVal.AllowEditingText = true;
            //rbSelectVal.Items.Add("Afghanistan");
            //rbSelectVal.Items.Add("Australia");
            //rbSelectVal.Items.Add("Austria");
            //rbSelectVal.Width = 120;
            ////rbSelectLayer.SelectedItem = "Countries";
            //rbSelectVal.RootKey = kHydroSearch3;
            //head.Add(rbSelectVal);

            //rbSelectLayer.SelectedItem = "Countries";
            //rbSelectField.SelectedItem = "Name";

            #endregion

            #region Keyword Group

            // Keyword text entry

            /*
             * const string grpKeyword = "Keyword";
             * rbKeyword = new TextEntryActionItem();
             * rbKeyword.PropertyChanged += rbKeyword_PropertyChanged;
             * rbKeyword.GroupCaption = grpKeyword;
             * rbKeyword.RootKey = kHydroFacetedSearch3;
             * rbKeyword.Width = 150;
             * head.Add(rbKeyword);
             * UpdateKeywordsCaption();
             *
             * //Keyword more options
             * var rbKeyword2 = new SimpleActionItem("Keyword Selection", rbKeyword_Click);
             * rbKeyword2.LargeImage = Resources.keyword_32;
             * rbKeyword2.SmallImage = Resources.keyword_16;
             * rbKeyword2.GroupCaption = grpKeyword;
             * rbKeyword2.ToolTipText = "Show Keyword Ontology Tree";
             * rbKeyword2.RootKey = kHydroFacetedSearch3;
             * head.Add(rbKeyword2);
             */
            #endregion

            #region Dates group

            const string grpDates = "Time Range";
            rbStartDate                  = new TextEntryActionItem();
            rbStartDate.Caption          = "Start";
            rbStartDate.GroupCaption     = grpDates;
            rbStartDate.RootKey          = kHydroFacetedSearch3;
            rbStartDate.Width            = 60;
            rbStartDate.PropertyChanged += rbStartDate_PropertyChanged;
            head.Add(rbStartDate);

            rbEndDate              = new TextEntryActionItem();
            rbEndDate.Caption      = " End";
            rbEndDate.GroupCaption = grpDates;
            rbEndDate.RootKey      = kHydroFacetedSearch3;
            rbEndDate.Width        = 60;
            head.Add(rbEndDate);
            rbEndDate.PropertyChanged += rbEndDate_PropertyChanged;
            UpdateDatesCaption();

            var rbDate = new SimpleActionItem("Select Dates", rbDate_Click);
            rbDate.GroupCaption = grpDates;
            rbDate.RootKey      = kHydroFacetedSearch3;
            rbDate.LargeImage   = Resources.select_date_v1_32;
            rbDate.SmallImage   = Resources.select_date_v1_16;
            head.Add(rbDate);

            #endregion

            #region Web Services group

            /*
             * const string grpServices = "Web Services";
             * rbServices = new SimpleActionItem("All Services", rbServices_Click);
             * ChangeWebServicesIcon();
             * rbServices.ToolTipText = "Select web services (All Services selected)";
             * rbServices.GroupCaption = grpServices;
             * rbServices.RootKey = kHydroFacetedSearch3;
             * head.Add(rbServices);
             */
            #endregion

            #region Catalog group

            /*
             * const string grpCatalog = "Catalog";
             * rbCatalog = new SimpleActionItem("HIS Central", rbCatalog_Click);
             * rbCatalog.LargeImage = Resources.catalog_v2_32;
             * rbCatalog.SmallImage = Resources.catalog_v2_32;
             * rbCatalog.GroupCaption = grpCatalog;
             * rbCatalog.RootKey = kHydroFacetedSearch3;
             * head.Add(rbCatalog);
             * UpdateCatalogCaption();
             */
            #endregion

            #region Search and download buttons

            string grpSearch = "Search";
            var    rbSearch  = new SimpleActionItem("Initialize Faceted Search", rbSearch_Click);
            rbSearch.LargeImage   = Resources.search_32;
            rbSearch.SmallImage   = Resources.search_16;
            rbSearch.ToolTipText  = "Choose facets based on selected spatial and temporal criteria";
            rbSearch.GroupCaption = grpSearch;
            rbSearch.RootKey      = kHydroFacetedSearch3;
            head.Add(rbSearch);

            // var cBShowSpatial = new SimpleActionItem("

            /*
             * var btnDownload = new SimpleActionItem("Download", rbDownload_Click);
             * btnDownload.RootKey = kHydroFacetedSearch3;
             * btnDownload.GroupCaption = grpSearch;
             * btnDownload.LargeImage = Resources.download_32;
             * btnDownload.SmallImage = Resources.download_16;
             * App.HeaderControl.Add(btnDownload);
             */
            #endregion

            //map buttons
            AddMapButtons();

            #region Faceted Search Control

            fsc = new FacetedSearchControl(App);
            App.DockManager.Add(new DotSpatial.Controls.Docking.DockablePanel(kHydroFacetedSearch3, "Faceted Search", fsc, DockStyle.Left));

            #endregion
        }