예제 #1
0
        public static Stream SearchResults(SearchResults input)
        {
            MemoryStream buffer = new MemoryStream();
            XmlWriter output = XmlWriter.Create(buffer);

            output.WriteStartElement("geosoft_xml");
            output.WriteStartElement("search_result");
            output.WriteAttributeString("version", input.Version);
            output.WriteAttributeString("handle", input.Handle);
            output.WriteAttributeString("offset", input.Offset.ToString());
            output.WriteAttributeString("totalcount", input.TotalResults.ToString());

            if (input.Count > 0)
            {
                output.WriteAttributeString("count", input.Count.ToString());

                output.WriteStartElement("layers");
                for (int count = 0; count < input.Count; count++)
                    Encoder.Layer(input[count], output);
                output.WriteEndElement();
            }

            output.WriteEndElement();

            output.Close();

            buffer.Seek(0, SeekOrigin.Begin);
            return buffer;
        }
예제 #2
0
        internal static Stream OverDAP(string dapUrl, string requestXML)
        {
            SearchRequest request = Decoder.SearchRequest(requestXML);

            Geosoft.Dap.Command c = new Geosoft.Dap.Command(dapUrl, false, Geosoft.Dap.Command.Version.GEOSOFT_XML_1_1, false, DapSecureToken.Instance, 30000);
            ArrayList datasets; c.GetCatalog(null, 0, request.Offset, request.MaxCount, request.TextFilter, request.AoIFilter, out datasets);
            int totalResults; c.GetDataSetCount(null, 0, request.Offset, request.MaxCount, request.TextFilter, request.AoIFilter, out totalResults);

            SearchResults result = new SearchResults(request.Version, request.Handle, request.Offset, totalResults);
            cachedData.Clear();
            foreach (DataSet d in datasets)
            {
                result.AddResult(new DAPLayer(d));
                cachedData.Add(int.Parse(d.Name), d);
            }

            return Encoder.SearchResults(result);
        }