Example #1
0
        /// <summary>
        /// Get the catalog at the specific edition and bounding box of this catalog
        /// </summary>
        /// <param name="hBoundingBox"></param>
        /// <param name="strCatalogEdition"></param>
        /// <returns></returns>
        internal Catalog GetCatalog(BoundingBox hBoundingBox, string strKeywords)
        {
            CatalogHash hHash            = new CatalogHash(hBoundingBox, strKeywords);
            Catalog     hRetCatalog      = null;
            string      strEdition       = String.Empty;
            string      strConfigEdition = String.Empty;

            hRetCatalog = (Catalog)m_hCatalogList[hHash];

            if (hRetCatalog != null)
            {
                try
                {
                    m_oServer.Command.GetCatalogEdition(out strConfigEdition, out strEdition, null);
                }
                catch
                {
                    strEdition = "Default";
                }

                if (strEdition != hRetCatalog.Edition || strConfigEdition != hRetCatalog.ConfigurationEdition)
                {
                    lock (m_hCatalogList) {
                        if (m_hCatalogList.ContainsKey(hHash))
                        {
                            m_hCatalogList.Remove(hHash);
                        }
                    }
                    hRetCatalog = null;
                }
            }

            if (hRetCatalog == null)
            {
                XmlDocument hDocument;

                try
                {
                    m_oServer.Command.GetCatalogEdition(out strConfigEdition, out strEdition, null);
                }
                catch
                {
                    strEdition = "Default";
                }

                try
                {
                    hDocument = m_oServer.Command.GetCatalog(String.Empty, -1, 0, 0, strKeywords, hBoundingBox, null);
                    m_oServer.Command.Parser.PruneCatalog(hDocument);

                    hRetCatalog = new Catalog(hDocument, strEdition);

                    lock (m_hCatalogList) {
                        if (!m_hCatalogList.ContainsKey(hHash))
                        {
                            m_hCatalogList.Add(hHash, hRetCatalog);
                        }
                        else
                        {
                            m_hCatalogList[hHash] = hRetCatalog;
                        }
                    }
                }
                catch (Exception e)
                {
                    GetDapError.Instance.Write("GetCatalog - " + e.Message);
                }
            }
            return(hRetCatalog);
        }
Example #2
0
        /// <summary>
        /// Get the catalog at the specific edition and bounding box of this catalog
        /// </summary>
        /// <param name="hBoundingBox"></param>
        /// <param name="strCatalogEdition"></param>
        /// <returns></returns>
        internal Catalog GetCatalog(BoundingBox hBoundingBox, string strKeywords)
        {
            CatalogHash hHash = new CatalogHash(hBoundingBox, strKeywords);
             Catalog     hRetCatalog = null;
             string      strEdition = String.Empty;
             string      strConfigEdition = String.Empty;

             hRetCatalog = (Catalog)m_hCatalogList[hHash];

             if (hRetCatalog != null)
             {
            try
            {
               m_oServer.Command.GetCatalogEdition(out strConfigEdition, out strEdition, null);
            }
            catch
            {
               strEdition = "Default";
            }

            if (strEdition != hRetCatalog.Edition || strConfigEdition != hRetCatalog.ConfigurationEdition)
            {
               lock (m_hCatalogList) {
                  if (m_hCatalogList.ContainsKey(hHash))
                     m_hCatalogList.Remove(hHash);
               }
               hRetCatalog = null;
            }
             }

             if (hRetCatalog == null)
             {
            XmlDocument hDocument;

            try
            {
               m_oServer.Command.GetCatalogEdition(out strConfigEdition, out strEdition, null);
            }
            catch
            {
               strEdition = "Default";
            }

            try
            {
               hDocument = m_oServer.Command.GetCatalog(String.Empty, -1, 0, 0, strKeywords, hBoundingBox, null);
               m_oServer.Command.Parser.PruneCatalog(hDocument);

               hRetCatalog = new Catalog(hDocument, strEdition);

               lock (m_hCatalogList) {
                  if (!m_hCatalogList.ContainsKey(hHash))
                     m_hCatalogList.Add(hHash, hRetCatalog);
                  else
                     m_hCatalogList[hHash] = hRetCatalog;
               }
            }
            catch (Exception e)
            {
               GetDapError.Instance.Write("GetCatalog - " + e.Message);
            }
             }
             return hRetCatalog;
        }