コード例 #1
0
        public void test()
        {
            List<CoordinatePoint> pointURIs = new List<CoordinatePoint>();

            List<DBpedia.DbpediaInfo> dbpediaResults = DBpedia.getDbpediaInfo(44.346, 33.356, 44.464, 33.284);
            DBpedia.DbpediaInfo answer = new DBpedia.DbpediaInfo();

            int x = 0;

            //foreach (CoordinatePoint item in coordinatePoints)
            //{
            //    answer = findMinDistance(item, dbpediaResults);
            //    CoordinatePoint pnt = new CoordinatePoint();
            //    pnt.lat = item.lat;
            //    pnt.lng = item.lng;
            //    item.URI = pnt.URI = answer.uri;
            //    item.type = pnt.type = answer.type;
            //    dbpediaResults.Remove(answer);
            //    pointURIs.Add(pnt);
            //}
        }
コード例 #2
0
 private DBpedia.DbpediaInfo findMinDistance(CoordinatePoint item, List<DBpedia.DbpediaInfo> dbpediaResults)
 {
     double dis = int.MaxValue;
     double xS, yS, xD, yD;
     DBpedia.DbpediaInfo min = new DBpedia.DbpediaInfo();
     foreach (DBpedia.DbpediaInfo node in dbpediaResults)
     {
         GetXY(item.lng, item.lat, out xS, out yS);
         GetXY(node.lng, node.lat, out xD, out yD);
         double d = shortestDistance(xS, yS, xD, yD);
         if (d < dis)
         {
             dis = d;
             min = node;
         }
     }
     return min;
 }
コード例 #3
0
        private void bindURI()
        {
            List<CoordinatePoint> pointURIs = new List<CoordinatePoint>();

            List<DBpedia.DbpediaInfo> dbpediaResults = DBpedia.getDbpediaInfo(_rasterInfo.rasterTopLeftX, _rasterInfo.rasterTopLeftY, _rasterInfo.rasterDownRightX, _rasterInfo.rasterDownRightY);
            DBpedia.DbpediaInfo answer = new DBpedia.DbpediaInfo();

            foreach (CoordinatePoint item in coordinatePoints)
            {
                answer = findMinDistance(item, dbpediaResults);
                CoordinatePoint pnt = new CoordinatePoint();
                pnt.lat = item.lat;
                pnt.lng = item.lng;
                item.URI = pnt.URI = answer.uri;
                item.type = pnt.type = answer.type;
                dbpediaResults.Remove(answer);
                pointURIs.Add(pnt);
            }
            string type = votting();
            for (int i = 0; i < coordinatePoints.Length; i++)

                if (pointURIs[i].type != type)
                    pointURIs[i].type = "";
        }