public VOTABLE ConeSearch(DataSet ds) { try { //Hashtable ucds = FetchUCDS(ds, cjobs); VOTABLE vot = VOTableUtil.DataSet2VOTable(ds); vot.DESCRIPTION = new anyTEXT(); vot.RESOURCE[0].TABLE[0].Items = new object[ds.Tables[0].Columns.Count + 3]; Hashtable votypes = VOTableUtil.getdataTypeTable(); PARAM p = new PARAM(); p.name = "inputRA"; p.datatype = (dataType)votypes[typeof(System.Single)]; p.value = this.ra.ToString(); p.unit = "degrees"; vot.RESOURCE[0].TABLE[0].Items[0] = p; p = new PARAM(); p.name = "inputDEC"; p.datatype = (dataType)votypes[typeof(System.Single)]; p.unit = "degrees"; p.value = this.dec.ToString(); vot.RESOURCE[0].TABLE[0].Items[1] = p; p = new PARAM(); p.name = "inputSR"; p.datatype = (dataType)votypes[typeof(System.Single)]; p.unit = "degrees"; p.value = this.sr.ToString(); vot.RESOURCE[0].TABLE[0].Items[2] = p; vot.DESCRIPTION.Any = new System.Xml.XmlNode[1]; XmlDocument doc = new XmlDocument(); vot.DESCRIPTION.Any[0] = doc.CreateTextNode("DESCRIPTION"); vot.DESCRIPTION.Any[0].InnerText = "ConeSearch results from the Sloan Digital Sky Survey"; //vot.RESOURCE[0].Items[ind] = p; for (int x = 0; x < ds.Tables[0].Columns.Count; x++) { DataColumn col = ds.Tables[0].Columns[x]; FIELD f = new FIELD(); f.datatype = (dataType)votypes[col.DataType]; f.ID = fix(col.ColumnName); //f.ucd = ucds[fix(col.ColumnName)] != null ? ucds[fix(col.ColumnName)].ToString() : "UNKNOWN"; vot.RESOURCE[0].TABLE[0].Items[x + 3] = f; } return(vot); } catch (Exception exp) { throw new Exception(exp.Message); } }
public VOTABLE ConeSearch(System.Double ra, System.Double dec, System.Double sr) { CJobsTARGET = (HttpContext.Current.Request.RequestContext.RouteData.Values["anything1"] as string).ToUpper().Replace("CONE", ""); VOTABLE v; if (!valid_input(ra, dec, sr)) { throw new Exception(" Wrong input parameters "); } sr *= 60.0; // in arcminutes because dbo.fGetNearbyObjEq requires arcminutes ; StringBuilder qry = new StringBuilder(); qry.Append("select " + ConeSelect); qry.Append(" from PhotoPrimary p, dbo.fGetNearbyObjEq(" + ra + "," + dec + "," + sr + ") n"); qry.Append(" where p.objId=n.objId"); sr /= 60.0; // back to degrees as the ervices requieres; JobsSoapClient cjobs = new JobsSoapClient(); //cjobs.Url = CJobsURL; DataSet ds = cjobs.ExecuteQuickJobDS(CJobsWSID, CJobsPasswd, qry.ToString(), CJobsTARGET, "FOR CONESEARCH", false); Hashtable ucds = FetchUCDS(ds, cjobs); VOTABLE vot = VOTableUtil.DataSet2VOTable(ds); vot.DESCRIPTION = new anyTEXT(); // = "ConeSearch results from the Sloan Digital Sky Survey "; vot.RESOURCE[0].TABLE[0].Items = new object[ds.Tables[0].Columns.Count + 3]; Hashtable votypes = VOTableUtil.getdataTypeTable(); PARAM p = new PARAM(); p.name = "inputRA"; p.datatype = (dataType)votypes[typeof(System.Single)]; p.value = ra.ToString(); p.unit = "degrees"; vot.RESOURCE[0].TABLE[0].Items[0] = p; p = new PARAM(); p.name = "inputDEC"; p.datatype = (dataType)votypes[typeof(System.Single)]; p.unit = "degrees"; p.value = dec.ToString(); vot.RESOURCE[0].TABLE[0].Items[1] = p; p = new PARAM(); p.name = "inputSR"; p.datatype = (dataType)votypes[typeof(System.Single)]; p.unit = "degrees"; p.value = sr.ToString(); vot.RESOURCE[0].TABLE[0].Items[2] = p; vot.DESCRIPTION.Any = new System.Xml.XmlNode[1]; XmlDocument doc = new XmlDocument(); vot.DESCRIPTION.Any[0] = doc.CreateTextNode("DESCRIPTION"); vot.DESCRIPTION.Any[0].InnerText = "ConeSearch results from the Sloan Digital Sky Survey " + CJobsTARGET; //vot.RESOURCE[0].Items[ind] = p; for (int x = 0; x < ds.Tables[0].Columns.Count; x++) { DataColumn col = ds.Tables[0].Columns[x]; FIELD f = new FIELD(); f.datatype = (dataType)votypes[col.DataType]; f.ID = fix(col.ColumnName); f.ucd = ucds[fix(col.ColumnName)] != null ? ucds[fix(col.ColumnName)].ToString() : "UNKNOWN"; vot.RESOURCE[0].TABLE[0].Items[x + 3] = f; } return(vot); }