#include<iostream>
#include<fstream>//文本读写头文件
#include<vector>//在C++标准模板库中的部分内容,它是一个多功能的,能够操作多种数据结构和算法的模板类和函数库。
#include<GL/glut.h>
using namespace std;
class MapPoint//声明一个名为MapPoint的类
{
public:
double longitude;//数据成员 经度
double latitude;//纬度
};
class Polygon
{
public:
vector<MapPoint>points; //多边形的顶点序列
};
vector<Polygon*> polys; //多边形集合
vector<Polygon*> ReadMapData(char* filename)//文件名
{
int PointCount;//计算点的个数
vector<Polygon*>polygons;
ifstream fs(filename);//寻找filename文件是否为空
while (fs.eof() != true)
#include<fstream>//文本读写头文件
#include<vector>//在C++标准模板库中的部分内容,它是一个多功能的,能够操作多种数据结构和算法的模板类和函数库。
#include<GL/glut.h>
using namespace std;
class MapPoint//声明一个名为MapPoint的类
{
public:
double longitude;//数据成员 经度
double latitude;//纬度
};
class Polygon
{
public:
vector<MapPoint>points; //多边形的顶点序列
};
vector<Polygon*> polys; //多边形集合
vector<Polygon*> ReadMapData(char* filename)//文件名
{
int PointCount;//计算点的个数
vector<Polygon*>polygons;
ifstream fs(filename);//寻找filename文件是否为空
while (fs.eof() != true)

这篇博客主要介绍了如何使用OpenGL和C++来绘制地图。通过读取包含经度和纬度信息的文件,创建并渲染地图上的多边形。首先定义了MapPoint类存储地理位置信息,然后在Polygon类中存储多边形的顶点。ReadMapData函数从文件中读取数据,display函数用于绘制地图。最后,使用GLUT库初始化窗口和显示函数,并进入主循环。

5919

被折叠的 条评论
为什么被折叠?



