示例#1
0
  private void CreateMapThemes(Configuration.ApplicationRow application)
  {
    // add map tabs

    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.InnerHtml = appMapTabRow.MapTabRow.DisplayName.Replace(" ", " ");
      }
    }
  }
示例#2
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);
      }
    }
  }
示例#3
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":
            AddInputControl(searchInputField, new HtmlInputText("text"), searchInputFieldRow, "Autocomplete", "Enter some text");
            break;

          case "date":
            AddInputControl(searchInputField, new HtmlInputText("text"), searchInputFieldRow, "Date", "Enter a date");
            break;

          case "daterange":
            AddInputControl(searchInputField, new HtmlInputText("text"), searchInputFieldRow, "DateRange 1", "Enter a date");

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

            AddInputControl(searchInputField, new HtmlInputText("text"), searchInputFieldRow, "DateRange 2", "Enter a date");
            break;

          case "list":
            HtmlSelect select = CreateSelect(searchInputFieldRow);
            AddInputControl(searchInputField, select, searchInputFieldRow, "List", "Select from a list");
            break;

          case "number":
            AddInputControl(searchInputField, new HtmlInputText("text"), searchInputFieldRow, "Number", "Enter a number");
            break;

          case "numberrange":
            AddInputControl(searchInputField, new HtmlInputText("text"), searchInputFieldRow, "NumberRange 1", "Enter a number");

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

            AddInputControl(searchInputField, new HtmlInputText("text"), searchInputFieldRow, "NumberRange 2", "Enter a number");
            break;

          case "text":
            AddInputControl(searchInputField, new HtmlInputText("text"), searchInputFieldRow, "Text", "Enter some text");
            break;

          case "textcontains":
            AddInputControl(searchInputField, new HtmlInputText("text"), searchInputFieldRow, "Text", "Enter some text (contains)");
            break;

          case "textstarts":
            AddInputControl(searchInputField, new HtmlInputText("text"), searchInputFieldRow, "Text", "Enter some text (starts with)");
            break;
        }

        search.Controls.Add(new LiteralControl("<br/>"));
      }
     
      pnlSearchScroll.Controls.Add(search);
    }
  }