(1) 根據shp檔案刪選出來一座標點為中心傳入長度為半徑的polygon所有拐點和道路資訊
(2) 通過刪選出來的道路資訊構建graph;
(3) 通過刪選出來的拐點和中心點來求graph最短路徑
(4) 根據最短路徑來求和半徑的關係刪選出在半徑內的所有點
(5) 根據點求出最小凸包(凸包就是服務區範圍)
一下是**宣告:
class tdservicearea :public tdconversionbase
;
實現:
#include "tdservicearea.h"
#include "tdapicommon.h"
#include #include "tdapicommon.h"
bool tdservicearea::process(layerpathinfov1 layerpathinfo, layerpathinfov1 armlayerpathinfo, std::vectorvecinpout, std::vectorservicescope)
); m_params = servicescope;
return process_allwrite(layerpathinfo,armlayerpathinfo);
}void tdservicearea::calsinglefeature(ogrfeature * ogrfeature, int flags_cal)
//道路拐點在距離範圍內
} if (flags)
num++;
});}void tdservicearea::allcalsinglefeature()
});ogrfeature * feature = new ogrfeature(m_ogrfeaturedefn);
feature->setgeometry(ogrmultipoint.convexhull());
//feature->setgeometry(&ogrmultipoint);
m_cachevector.push_back(feature);
});}double tdservicearea::calpathlength(gnmpath indexinfo, std::vectortempogrline)
} });
return length;
}int tdservicearea::getindexdata(ogrpoint * ppoint,int num)
}; auto fun1 = [&](ogrpoint & it, int num, ogrpoint & beginpoint) ;
auto fun = [&](ogrpoint indexpoint)
fun1(it.second, it.first, indexpoint);
indexnum++;
});}; fun(*ppoint);
return beginfid;
}void tdservicearea::makegraph()
}for (int j = 0; j < numpoint - 1; j++)
}});
linefdid = 0;
std::for_each(m_tempogrline[num].begin(), m_tempogrline[num].end(), [&](ogrlinestring & ogrlinestring) );
num++;
});}
座標點橢球距離計算公式:
double tdapicommon::computedistancebearing(const ogrpoint &p1, const ogrpoint &p2, ogrspatialreference * psrs,double *course1, double *course2)
if (iterlimit == 0)
return -1; // formula failed to converge
double usq = cossqalpha * (msemimajor * msemimajor - msemiminor * msemiminor) / (msemiminor * msemiminor);
double a = 1 + usq / 16384 * (4096 + usq * (-768 + usq * (320 - 175 * usq)));
double b = usq / 1024 * (256 + usq * (-128 + usq * (74 - 47 * usq)));
double deltasigma = b * sinsigma * (cos2sigmam + b / 4 * (cossigma * (-1 + 2 * cos2sigmam * cos2sigmam) -
b / 6 * cos2sigmam * (-3 + 4 * sinsigma * sinsigma) * (-3 + 4 * cos2sigmam * cos2sigmam)));
double s = msemiminor * a * (sigma - deltasigma);
if (course1)
if (course2)
return s;
}
愛情不在服務區
這是乙個真實的故事 愛情不在服務區 寫給我永遠的愛人 兩年前,我的愛情斷了線,到現在整整兩年零25天了。那是第一次真正愛上乙個人,和他生活在一起,一起吃飯,吵架,逛街,夜裡睡在他身邊。每天出門前,我們總是相擁而別。他比我早半個小時出門,每次總是把我從被窩裡抱起,偶爾也例外,他會壞壞地掀起被子,大叫 ...
python中,根據座標點位置求方位角
話不多說,直接上 from pyqt5.qtgui import from pyqt5.qtwidgets import from pyqt5.qtcore import qt import sys import math class example qwidget def init self su...
理解Iass Pass SasS三種雲服務區別
其實搞懂這個問題也不難,我們可以把雲計算理解成一棟大樓,而這棟樓又可以分為頂樓 中間 低層三大塊。那麼我們就可以把iass 基礎設施 pass 平台 sass 軟體 理解成這棟樓的三部分。基礎設施在最下端,平台在中間,軟體在頂端。別的一些 軟 的層可以在這些層上面新增。接下來我們再分別用例項給大家介...