Ejemplo n.º 1
0
 public void Initialize(Configuration config, AppState appState, Configuration.ApplicationRow application)
 {
     foreach (Configuration.ApplicationMapTabRow appMapTabRow in application.GetApplicationMapTabRows())
     {
         Configuration.MapTabRow mapTabRow = appMapTabRow.MapTabRow;
         AddLayers(mapTabRow, appState);
         AddTiles(mapTabRow, appState);
     }
 }
Ejemplo n.º 2
0
    public void Initialize(Configuration config, AppState appState, Configuration.ApplicationRow application)
    {
        int m = 0;

        foreach (Configuration.ApplicationMapTabRow appMapTabRow in application.GetApplicationMapTabRows())
        {
            Configuration.MapTabRow mapTabRow = appMapTabRow.MapTabRow;
            AddTileGroupsForMapTab(mapTabRow, appState, m, true);
            m += 1;
        }

        foreach (Configuration.ApplicationMapTabRow appMapTabRow in application.GetApplicationMapTabRows())
        {
            Configuration.MapTabRow mapTabRow = appMapTabRow.MapTabRow;
            AddTileGroupsForMapTab(mapTabRow, appState, m, false);
            m += 1;
        }
    }
Ejemplo n.º 3
0
    private void CreateMapThemes(Configuration.ApplicationRow application, AppState _appState)
    {
        foreach (Configuration.ApplicationMapTabRow appMapTabRow in application.GetApplicationMapTabRows())
        {
            HtmlGenericControl li = new HtmlGenericControl("li");
            phlMapTheme.Controls.Add(li);
            li.InnerHtml = appMapTabRow.MapTabRow.DisplayName.Replace(" ", " ");
            li.Attributes["data-maptab"] = appMapTabRow.MapTabID;

            if (_appState.MapTab == appMapTabRow.MapTabID)
            {
                selectedTheme.Text = appMapTabRow.MapTabRow.DisplayName;
            }
        }
    }
Ejemplo n.º 4
0
    public void Initialize(Configuration.ApplicationRow application)
    {
        // find all searches for this application

        List <Configuration.SearchRow> searches = new List <Configuration.SearchRow>();

        foreach (Configuration.ApplicationMapTabRow appMapTabRow in application.GetApplicationMapTabRows())
        {
            Configuration.MapTabRow mapTabRow = appMapTabRow.MapTabRow;

            foreach (Configuration.MapTabLayerRow mapTabLayerRow in mapTabRow.GetMapTabLayerRows().Where(o => !o.IsAllowTargetNull() && o.AllowTarget > 0))
            {
                Configuration.LayerRow layerRow = mapTabLayerRow.LayerRow;

                foreach (Configuration.SearchRow searchRow in layerRow.GetSearchRows())
                {
                    if (!searches.Any(o => o.SearchID == searchRow.SearchID))
                    {
                        searches.Add(searchRow);
                    }
                }
            }
        }

        // generate the search interfaces

        foreach (Configuration.SearchRow searchRow in searches)
        {
            // create the panel for this search

            HtmlGenericControl search = new HtmlGenericControl("div");
            search.Attributes["data-search"] = searchRow.SearchID;
            search.Attributes["class"]       = "Search";
            search.Style["display"]          = "none";

            foreach (Configuration.SearchInputFieldRow searchInputFieldRow in searchRow.GetSearchInputFieldRows().OrderBy(o => o.SequenceNo))
            {
                // add UI elements for this criterion
                HtmlGenericControl searchInputField = new HtmlGenericControl("div");
                search.Controls.Add(searchInputField);
                searchInputField.Attributes["data-criteria"] = searchInputFieldRow.FieldID;
                searchInputField.Attributes["class"]         = "SearchInputField";

                HtmlGenericControl searchLabel = new HtmlGenericControl("span");
                searchInputField.Controls.Add(searchLabel);
                searchLabel.InnerText           = searchInputFieldRow.DisplayName;
                searchLabel.Attributes["class"] = "Label";

                HtmlGenericControl betweenText;

                switch (searchInputFieldRow.FieldType)
                {
                case "autocomplete":
                    AddInputFieldValue(searchInputField, new HtmlInputText("text"), searchInputFieldRow, "Autocomplete");
                    break;

                case "date":
                    AddInputFieldValue(searchInputField, new HtmlInputText("text"), searchInputFieldRow, "Date");
                    break;

                case "daterange":
                    AddInputFieldValue(searchInputField, new HtmlInputText("text"), searchInputFieldRow, "DateRange 1");

                    betweenText = new HtmlGenericControl("span");
                    searchInputField.Controls.Add(betweenText);
                    betweenText.InnerText = " - ";

                    AddInputFieldValue(searchInputField, new HtmlInputText("text"), searchInputFieldRow, "DateRange 2");
                    break;

                case "list":
                    HtmlSelect select = CreateSelect(searchInputFieldRow);
                    AddInputFieldValue(searchInputField, select, searchInputFieldRow, "List");
                    break;

                case "number":
                    AddInputFieldValue(searchInputField, AddNumericTip(new HtmlInputText("text")), searchInputFieldRow, "Number");
                    break;

                case "numberrange":
                    AddInputFieldValue(searchInputField, AddNumericTip(new HtmlInputText("text")), searchInputFieldRow, "NumberRange 1");

                    betweenText = new HtmlGenericControl("span");
                    searchInputField.Controls.Add(betweenText);
                    betweenText.InnerText = " - ";

                    AddInputFieldValue(searchInputField, AddNumericTip(new HtmlInputText("text")), searchInputFieldRow, "NumberRange 2");
                    break;

                case "text":
                    AddInputFieldValue(searchInputField, new HtmlInputText("text"), searchInputFieldRow, "Text");
                    break;
                }

                search.Controls.Add(new HtmlGenericControl("br"));
            }

            pnlSearchScroll.Controls.Add(search);
        }
    }
Ejemplo n.º 5
0
    public void Initialize(Configuration config, AppState appState, Configuration.ApplicationRow application)
    {
        foreach (Configuration.ApplicationMapTabRow appMapTabRow in application.GetApplicationMapTabRows())
        {
            Configuration.MapTabRow mapTabRow = appMapTabRow.MapTabRow;
            CommonDataFrame         dataFrame = AppContext.GetDataFrame(mapTabRow);

            bool      isInteractive = !mapTabRow.IsInteractiveLegendNull() && mapTabRow.InteractiveLegend == 1;
            CheckMode checkMode     = CheckMode.None;

            List <CommonLayer>     configuredLayers = new List <CommonLayer>();
            List <LayerProperties> layerProperties  = new List <LayerProperties>();
            List <String>          mapTabLayerIds   = new List <String>();

            string name        = null;
            string metaDataUrl = null;

            StringCollection visibleLayers = isInteractive ? appState.VisibleLayers[mapTabRow.MapTabID] : null;

            // find layers attached via MapTabLayer

            foreach (Configuration.MapTabLayerRow mapTabLayerRow in mapTabRow.GetMapTabLayerRows())
            {
                if (!mapTabLayerRow.IsShowInLegendNull() && mapTabLayerRow.ShowInLegend == 1)
                {
                    CommonLayer layer = dataFrame.Layers.FirstOrDefault(lyr => String.Compare(lyr.Name, mapTabLayerRow.LayerRow.LayerName, true) == 0);

                    name        = mapTabLayerRow.LayerRow.IsDisplayNameNull() ? mapTabLayerRow.LayerRow.LayerName : mapTabLayerRow.LayerRow.DisplayName;
                    metaDataUrl = mapTabLayerRow.LayerRow.IsMetaDataURLNull() ? null : mapTabLayerRow.LayerRow.MetaDataURL;
                    bool isExclusive = mapTabLayerRow.IsIsExclusiveNull() ? false : mapTabLayerRow.IsExclusive == 1;

                    string tag = mapTabLayerRow.LayerID;
                    mapTabLayerIds.Add(tag);

                    if (isInteractive)
                    {
                        bool layerVisible = visibleLayers != null && visibleLayers.Contains(mapTabLayerRow.LayerID);
                        checkMode = mapTabLayerRow.IsCheckInLegendNull() || mapTabLayerRow.CheckInLegend < 0 ? CheckMode.Empty :
                                    layerVisible ? CheckMode.Checked : CheckMode.Unchecked;
                    }

                    configuredLayers.Add(layer);
                    layerProperties.Add(new LayerProperties(name, tag, checkMode, isExclusive, metaDataUrl));
                }
            }

            // find layers attached via BaseMapID

            if (!mapTabRow.IsBaseMapIDNull() && !mapTabRow.IsShowBaseMapInLegendNull() && mapTabRow.ShowBaseMapInLegend == 1)
            {
                if (checkMode != CheckMode.None)
                {
                    checkMode = CheckMode.Empty;
                }

                foreach (DataRow row in config.Layer.Select("BaseMapID = '" + mapTabRow.BaseMapID + "'"))
                {
                    Configuration.LayerRow layerRow = (Configuration.LayerRow)row;

                    if (!mapTabLayerIds.Contains(layerRow.LayerID))
                    {
                        CommonLayer layer = dataFrame.Layers.FirstOrDefault(lyr => String.Compare(lyr.Name, layerRow.LayerName, true) == 0);
                        metaDataUrl = layerRow.IsMetaDataURLNull() ? null : layerRow.MetaDataURL;

                        configuredLayers.Add(layer);
                        layerProperties.Add(new LayerProperties(layerRow.Name, null, checkMode, false, metaDataUrl));
                    }
                }
            }

            // add group layers as necessary

            for (int i = 0; i < configuredLayers.Count; ++i)
            {
                checkMode = !isInteractive ? CheckMode.None : layerProperties[i].CheckMode == CheckMode.Checked ? CheckMode.Checked : CheckMode.Unchecked;
                CommonLayer parent = configuredLayers[i].Parent;

                while (parent != null)
                {
                    int index = configuredLayers.IndexOf(parent);

                    if (index < 0)
                    {
                        configuredLayers.Add(parent);
                        layerProperties.Add(new LayerProperties(parent.Name, null, checkMode, false, null));
                    }
                    else
                    {
                        if (checkMode == CheckMode.Checked && layerProperties[index].CheckMode == CheckMode.Unchecked)
                        {
                            layerProperties[index].CheckMode = CheckMode.Checked;
                        }
                    }

                    parent = parent.Parent;
                }
            }

            // create the top level legend control for this map tab

            HtmlGenericControl parentLegend = new HtmlGenericControl("div");
            pnlLegendScroll.Controls.Add(parentLegend);
            parentLegend.Attributes["data-maptab"] = appMapTabRow.MapTabID;
            parentLegend.Attributes["class"]       = "LegendTop";
            parentLegend.Style["display"]          = appMapTabRow.MapTabID == appState.MapTab ? "block" : "none";

            // add the Legend controls for the configured layers

            foreach (CommonLayer layer in dataFrame.TopLevelLayers)
            {
                AddLayerToLegend(mapTabRow.MapTabID, configuredLayers, layerProperties, parentLegend, layer);
            }
        }
    }