QVector<QPointF> ReadSonicPoint::sortSonicPoint(QVector<QPointF> befPointVector) //把x轴的值从小到大排序
{
QVector<QPointF> modPointVector;
QMap<double, double>sonicMap; //利用QMap自动排序
for (int i = 0; i < befPointVector.size(); i++)
{
sonicMap.insert(befPointVector[i].x(), befPointVector[i].y());
}
QMap<double, double>::Iterator it = sonicMap.begin();
while (it!=sonicMap.end())
{
QPointF sonicPoint;
sonicPoint.setX(it.key());
sonicPoint.setY(it.value());
modPointVector.append(sonicPoint);
i++;
}
return modPointVector;
}