public MultitaskKernelTreeNormalizer(SWIGTYPE_p_std__vectorT_std__string_t task_lhs, SWIGTYPE_p_std__vectorT_std__string_t task_rhs, CTaxonomy tax) : this(modshogunPINVOKE.new_MultitaskKernelTreeNormalizer__SWIG_1(SWIGTYPE_p_std__vectorT_std__string_t.getCPtr(task_lhs), SWIGTYPE_p_std__vectorT_std__string_t.getCPtr(task_rhs), CTaxonomy.getCPtr(tax)), true) {
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #2
0
        public IActionResult NameCode(string nCode)
        {
            WebClient obj = new WebClient();

            obj.Encoding = Encoding.UTF8;  //設定編碼解決亂碼問題
            string  urlDetail   = string.Format("http://ngismap.forest.gov.tw/REST/species/name_code/{0}", nCode);
            string  detailStr   = obj.DownloadString(urlDetail);
            JObject objJsonTxt2 = JObject.Parse(detailStr);


            //中文科學分類
            JToken    objWantDate = objJsonTxt2.SelectToken("kingdom_c");
            CTaxonomy taxonomyC   = new CTaxonomy()
            {
                Kingdom        = objWantDate.Value <string>(),
                Phylum         = objJsonTxt2.SelectToken("phylum_c").Value <string>(),
                Cclass         = objJsonTxt2.SelectToken("class_c").Value <string>(),
                Order          = objJsonTxt2.SelectToken("order_c").Value <string>(),
                Family         = objJsonTxt2.SelectToken("family_c").Value <string>(),
                Genus          = objJsonTxt2.SelectToken("genus_c").Value <string>(),
                ScientificName = objJsonTxt2.SelectToken("ScientificName_c").Value <string>(),
                //Description = objJsonTxt2.SelectToken("species_eol_info[0].description").Value<string>(),
                //Habitat = objJsonTxt2.SelectToken("species_eol_info[0].habitat").Value<string>()
            };

            ViewBag.taxonomyC = taxonomyC;

            //英文科學分類
            JToken    objWantDateE = objJsonTxt2.SelectToken("kingdom");
            CTaxonomy taxonomy     = new CTaxonomy()
            {
                Kingdom        = objWantDateE.Value <string>(),
                Phylum         = objJsonTxt2.SelectToken("phylum").Value <string>(),
                Cclass         = objJsonTxt2.SelectToken("class").Value <string>(),
                Order          = objJsonTxt2.SelectToken("order").Value <string>(),
                Family         = objJsonTxt2.SelectToken("family").Value <string>(),
                Genus          = objJsonTxt2.SelectToken("genus").Value <string>(),
                ScientificName = objJsonTxt2.SelectToken("ScientificName").Value <string>(),
            };

            ViewBag.taxonomy = taxonomy;

            //簡介
            if (objJsonTxt2.SelectToken("species_eol_info[0].description") != null && objJsonTxt2.SelectToken("species_eol_info[0].habitat") != null)
            {
                CTaxonomy info = new CTaxonomy()
                {
                    Description  = objJsonTxt2.SelectToken("species_eol_info[0].description").Value <string>(),
                    Habitat      = objJsonTxt2.SelectToken("species_eol_info[0].habitat").Value <string>(),
                    Author       = objJsonTxt2.SelectToken("species_eol_info[0].author").Value <string>(),
                    Distribution = objJsonTxt2.SelectToken("species_eol_info[0].distribution").Value <string>(),
                    Provider     = objJsonTxt2.SelectToken("species_eol_info[0].provider").Value <string>()
                };
                ViewBag.info = info;
            }
            else
            {
                CTaxonomy info = new CTaxonomy()
                {
                    Description  = "無相關資料",
                    Habitat      = "無相關資料",
                    Author       = "暫無提供者",
                    Distribution = "無相關資料",
                    Provider     = "暫無來源"
                };
                ViewBag.info = info;
            }


            List <CImage> picUrls = new List <CImage>();
            //物種圖片
            JToken objWantPic = objJsonTxt2.SelectToken("img_info");

            foreach (JToken pictures in objWantPic)
            {
                var imgData = new CImage()
                {
                    ImgUrl   = pictures.SelectToken("image_big").Value <string>(),
                    Author   = pictures.SelectToken("author").Value <string>(),
                    License  = pictures.SelectToken("license").Value <string>(),
                    Provider = pictures.SelectToken("provider").Value <string>()
                };

                picUrls.Add(imgData);
            }
            ViewBag.picUrls = picUrls;
            //return Content(nCode);
            return(View());
        }
 public MultitaskKernelTreeNormalizer(SWIGTYPE_p_std__vectorT_std__string_t task_lhs, SWIGTYPE_p_std__vectorT_std__string_t task_rhs, CTaxonomy tax) : this(modshogunPINVOKE.new_MultitaskKernelTreeNormalizer__SWIG_1(SWIGTYPE_p_std__vectorT_std__string_t.getCPtr(task_lhs), SWIGTYPE_p_std__vectorT_std__string_t.getCPtr(task_rhs), CTaxonomy.getCPtr(tax)), true)
 {
     if (modshogunPINVOKE.SWIGPendingException.Pending)
     {
         throw modshogunPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #4
0
 internal static HandleRef getCPtr(CTaxonomy obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
예제 #5
0
 internal static HandleRef getCPtr(CTaxonomy obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }