Ejemplo n.º 1
0
    private void AddTiles(Configuration.MapTabRow mapTabRow, AppState appState)
    {
        StringCollection visibleTiles = appState.VisibleTiles[mapTabRow.MapTabID];

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

        HtmlGenericControl parentLegend = new HtmlGenericControl("div");

        pnlTileScroll.Controls.Add(parentLegend);
        parentLegend.Attributes["data-maptab"] = mapTabRow.MapTabID;
        parentLegend.Attributes["class"]       = "LegendTop";
        parentLegend.Style["display"]          = mapTabRow.MapTabID == appState.MapTab ? "block" : "none";

        foreach (Configuration.MapTabTileGroupRow mapTabTileGroupRow in mapTabRow.GetMapTabTileGroupRows())
        {
            Configuration.TileGroupRow tileGroupRow = mapTabTileGroupRow.TileGroupRow;

            HtmlGenericControl legendEntry = new HtmlGenericControl("div");
            parentLegend.Controls.Add(legendEntry);
            legendEntry.Attributes["class"] = "LegendEntry";

            HtmlGenericControl legendHeader = new HtmlGenericControl("div");
            legendEntry.Controls.Add(legendHeader);
            legendHeader.Attributes["class"] = "LegendHeader";

            HtmlGenericControl visibility = new HtmlGenericControl("span");
            legendHeader.Controls.Add(visibility);
            visibility.Attributes["class"] = "LegendVisibility";

            HtmlInputCheckBox checkBox = new HtmlInputCheckBox();
            visibility.Controls.Add(checkBox);
            checkBox.Checked                      = visibleTiles.Contains(tileGroupRow.TileGroupID);
            checkBox.Attributes["class"]          = "LegendCheck";
            checkBox.Attributes["data-tilegroup"] = tileGroupRow.TileGroupID;

            HtmlGenericControl name = new HtmlGenericControl("span");
            legendHeader.Controls.Add(name);
            name.Attributes["class"] = "LegendName";
            name.InnerText           = tileGroupRow.DisplayName;
        }
    }
Ejemplo n.º 2
0
    private void AddTileGroupsForMapTab(Configuration.MapTabRow mapTabRow, AppState appState, int m, bool asBaseMap)
    {
        StringCollection visibleTiles = appState.VisibleTiles[mapTabRow.MapTabID];

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

        HtmlGenericControl parentLegend = new HtmlGenericControl("div");

        pnlBaseMapScroll.Controls.Add(parentLegend);
        parentLegend.Attributes["data-maptab"] = mapTabRow.MapTabID;
        parentLegend.Attributes["class"]       = "LegendTop";
        parentLegend.Style["display"]          = mapTabRow.MapTabID == appState.MapTab ? "block" : "none";

        HtmlGenericControl typeEntry = new HtmlGenericControl("div");

        parentLegend.Controls.Add(typeEntry);
        typeEntry.Attributes["class"] = "LegendEntry";

        HtmlGenericControl typeHeader = new HtmlGenericControl("div");

        typeEntry.Controls.Add(typeHeader);
        typeHeader.Attributes["class"] = "LegendHeader";

        HtmlGenericControl typeName = new HtmlGenericControl("span");

        typeHeader.Controls.Add(typeName);
        typeName.Attributes["class"] = "LegendName";
        typeName.InnerText           = asBaseMap ? "BaseMaps" : "Overlays";

        int g = 0;

        foreach (Configuration.MapTabTileGroupRow mapTabTileGroupRow in mapTabRow.GetMapTabTileGroupRows())
        {
            Configuration.TileGroupRow tileGroupRow = mapTabTileGroupRow.TileGroupRow;
            bool isBaseMap = tileGroupRow.GetTileLayerRows().Any(t => t.IsOverlayNull() || t.Overlay == 0);

            if (isBaseMap == asBaseMap)
            {
                HtmlGenericControl legendEntry = new HtmlGenericControl("div");
                parentLegend.Controls.Add(legendEntry);
                legendEntry.Attributes["class"] = "LegendEntry";

                HtmlGenericControl legendHeader = new HtmlGenericControl("div");
                legendEntry.Controls.Add(legendHeader);
                legendHeader.Attributes["class"] = "LegendHeader";

                HtmlGenericControl visibility = new HtmlGenericControl("span");
                legendHeader.Controls.Add(visibility);
                visibility.Attributes["class"] = "LegendVisibility";

                HtmlControl onOffControl;

                if (isBaseMap)
                {
                    HtmlInputRadioButton radio = new HtmlInputRadioButton();
                    radio.Attributes["id"]    = string.Format("baseTile{0}-{1}", m, g);
                    radio.Checked             = visibleTiles.Contains(tileGroupRow.TileGroupID);
                    radio.Attributes["class"] = "LegendCheck RadioCheck";
                    onOffControl = radio;
                }
                else
                {
                    HtmlInputCheckBox checkBox = new HtmlInputCheckBox();
                    checkBox.Attributes["id"]    = string.Format("overlayTile{0}-{1}", m, g);
                    checkBox.Checked             = visibleTiles.Contains(tileGroupRow.TileGroupID);
                    checkBox.Attributes["class"] = "LegendCheck OverlaysCheck";
                    onOffControl = checkBox;
                }

                visibility.Controls.Add(onOffControl);
                onOffControl.Attributes["group"]          = mapTabRow.MapTabID;
                onOffControl.Attributes["name"]           = mapTabRow.MapTabID;
                onOffControl.Attributes["data-tilegroup"] = tileGroupRow.TileGroupID;

                HtmlGenericControl label = new HtmlGenericControl("label");
                legendHeader.Controls.Add(label);
                label.Attributes["for"] = onOffControl.Attributes["id"];

                HtmlGenericControl name = new HtmlGenericControl("span");
                label.Controls.Add(name);
                name.Attributes["class"] = "LegendName";
                name.InnerText           = tileGroupRow.DisplayName;

                g += 1;
            }
        }

        if (g == 0)
        {
            parentLegend.Controls.Remove(typeEntry);
        }
        else if (asBaseMap)
        {
            AddNoneOption(mapTabRow, parentLegend);
        }
    }