示例#1
0
  private static CommonMapService GetService(Configuration.MapTabRow mapTab, string type)
  {
    Dictionary<String, CommonMapService> services = GetCachedServices();

    string serviceKey = mapTab.GetServiceKey(type);
    CommonMapService service = null;

    if (services.ContainsKey(serviceKey))
    {
      service = services[serviceKey];
    }
    else
    {
      CommonHost host = GetHost(mapTab, type);

      if (host != null)
      {
        try
        {
          service = host.GetMapService(mapTab.MapService);

          ArcImsService arcImsService = service as ArcImsService;

          if (arcImsService != null && !arcImsService.IsArcMap)
          {
            arcImsService.LoadToc(true);
          }

          services.Add(serviceKey, service);
        }
        catch { }
      }
    }

    return service;
  }
示例#2
0
  public static CommonDataFrame GetDataFrame(Configuration.MapTabRow mapTab)
	{
    Dictionary<String, CommonDataFrame> dataFrames = GetCachedDataFrames();

    string dataFrameKey = mapTab.GetDataFrameKey();
    CommonDataFrame dataFrame = null;

    if (dataFrames.ContainsKey(dataFrameKey))
    {
      dataFrame = dataFrames[dataFrameKey];
    }
    else
    {
      Dictionary<String, CommonMapService> services = GetCachedServices();
      CommonMapService service = null;

      string serviceKey = mapTab.GetServiceKey("AGS");

      if (services.ContainsKey(serviceKey))
      {
        service = services[serviceKey];
      }
      else
      {
        serviceKey = mapTab.GetServiceKey("ArcIMS");

        if (services.ContainsKey(serviceKey))
        {
          service = services[serviceKey];
        }
      }

      if (service == null)
      {
        service = GetService(mapTab, "AGS");

        if (service == null)
        {
          service = GetService(mapTab, "ArcIMS");
        }
      }

      if (service != null)
      {
        dataFrame = mapTab.IsDataFrameNull() ? service.DefaultDataFrame : service.DataFrames.FirstOrDefault(df => String.Compare(df.Name, mapTab.DataFrame, true) == 0);

        if (dataFrame != null)
        {
          dataFrames.Add(dataFrameKey, dataFrame);
        }
      }
    }

    return dataFrame;
	}