当前位置:文档之家› 四种空间数据模型

四种空间数据模型


©桂林理工大学 测绘地理信息学院 GIS 教研室制表
中 间 生 成 数 据
文件名 1、 2、 3、
©桂林理工大学 测绘地理信息学院 GIS 教研室制表
一:分别用四种数据库模型(层状、网状、关系、面向对象)
画出下面给定空间数据的计算机组织结构图; 层次结构
MAP
I
II
a
b
c
d
c e 6 2
e
f
g
h
主程序文件:
#include "homework-H.h" #include <iostream> #include <cstring> #include <fstream> using std::cout; using std::endl; using std::cin; using std::string; using std::getline; using std::ofstream; void menu_point(); void menu(); void menu_line(); void menu_polyon(); int main() { bool y=true; char ch; ofstream fileout;
实现文件:
#include "homework-H.h" #include <cmath> point::point() { x=0;
©桂林理工大学 测绘地理信息学院 GIS 教研室制表
y=0; } point::point(double p_x,double p_y) { x=p_x; y=p_y; } point::point(double p_x,double p_y,std::string p_attri) { x=p_x; y=p_y; attri=p_attri; } void point::move(double p_x,double p_y) { x=p_x; y=p_y; } void point::reset_attri(std::string p_string) { attri=p_string; } double point::dis_point(const point& p_point)const { double t_dis; t_dis=(x-p_point.x)*(x-p_point.x)+(y-p_point.y)*(y-p_point.y); return std::sqrt(t_dis); } const std::string& point::back_attri()const { return attri; } std::ostream& operator<<(std::ostream& os,const point& p_point) { os<<"("<<p_point.x<<","<<p_point.y<<")"; return os; } line::line(point p_point[2]) { m_point[0]=p_point[0]; m_point[1]=p_point[1];
i
1
7
1
2
2
6
6
7
6
5
5
4
4
3
3
2
9
10
8
网状结构
Map
I
II
a
b
c
d
e
f
g
h
i
1
2
3
4
5
6
7
9
10
8
关系模型
©桂林理工大学 测绘地理信息学院 GIS 教研室制表
地图: Map 多边形: I II 线: I I I I II II II II 点: 1 2 3 4 5 6 7 8 9 10 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 Y1 Y2 Y3 Y4 Y5 Y6 Y7 Y8 Y9 Y10
©桂林理工大学 测绘地理信息学院 GIS 教研室制表
void polyon::reset_attri(std::string p_attri) { attri=p_attri; } polyon::~polyon() { delete []point_polyon; } std::string polyon::back_attri() { return attri; } std::ostream& operator<<(std::ostream& os,const polyon& p_polyon) { for(int i=0;i<p_polyon.n;i++) os<<*(p_polyon.point_polyon+i)<<","; return os; }
©桂林理工大学 测绘地理信息学院 GIS 教研室制表
menu(); cout<<"请输入想做的:"<<endl; while(y&&cin>>ch) { cin.clear(); while(cin.get()!='\n') continue; //点的操作 if(ch=='a') { //点的变量 point* point_ptr[10]={NULL}; int i=0; int j; double m_x; double m_y; string m_attri; int select; bool point_=true; //点的变量 system("cls"); menu_point(); while(point_) { cout<<"请输入想做的:";cin>>select; while(cin.get()!='\n') continue; switch(select) { case 1:{ cout<<"请输入 x:";cin>>m_x; cin.get(); cout<<"请输入 y:";cin>>m_y; cin.get(); cout<<"请输入属性:";cin>>m_attri; cin.get(); point_ptr[i]=new point(m_x,m_y,m_attri); i++; break; } case 2:{
f
g 4 2 h 3
8 9
i
10
©桂林理工大学 测绘地理信息学院 GIS 教研室制表
二、 采用计算机编程或软件工具实现下列空间数据的四种模 型之一的存储与操作。
( 2) :编程代码 头文件:
#ifndef LIBAISHOU_H_ #define LIBAISHOU_H_ #include <string> #include <ostream> class point{ friend std::ostream& operator<<(std::ostream& os,const point& p_point); private: double x; double y; std::string attri; public: point(); point(double p_x,double p_y); point(double p_x,double p_y,std::string p_attri); void move(double p_x,double p_y); void reset_attri(std::string p_string);
©桂林理工大学 测绘地理信息学院 GIS 教研室制表
I
II
i
8
a c a b c d e f g h i
b e
c f 1 1 2 1 5 5 4 3 9
d g 7 2 6 4 6 4 3 2 10
h
1
面向对象模型:
a b I c d
7 1 2 2 6 6 7
II MAP
e
5 6 2 c 6 5 6 3
《四种数据库结构模型存储空间数据》实验报告
题目:四种数据库结构模型存储空间数据 报告人 时 软 硬 间 件 件 姓名: 陈辉 2015 年 5 月 17 日 操作系统:windows XP CPU 主频:3.00 MHz 学号:3121809201 地点:02223 使用软件: :MAPGIS67 Visual C++6 内存:2048 MB 显存:512 MB
实 验 目 的
1、 分别用四种数据库模型(层状、网状、关系、面向对象)画出下面给定空间数据 的计算机组织结构图 2、采用计算机编程或软件工具实现下列空间数据的四种模型之一的存储与操作。 3、
验 初 数 始 据 实
文件名 1、 实验二数据
简单ห้องสมุดไป่ตู้述 空间数据库实验课-实验内容与成果要求
一、实验原理 层状模型(层次模型) :是数据库系统中最早出现的数据 模型,层状数据库系统采用层次模型 作为数据的组织方式,用 树形结构来表示各类实体以及实体间的联系。它的特点是将数据 组织成一对多关系的结构。层次结构采用关键字来访问其中每一层次 的每一部分。 网状模型:在现实世界中客体的联系更多的是非层次关系的,用层次模型表示非树形结构是很 不直接的,网络模型可以克服这一弊病。在数据库中,把满足以下两个条件的基本层次联系集 合称为网状模型:允许一个以上的结点无双亲:一个结点可以有多于一个的双亲。 网状模型可 以更直接地去描述现实世界,而层次模型实际上是网状模型的一个特例。 关系模型:是一种数学化的模型,它是将数据的逻辑结构归结为满足一定条件的二维表。实体 本身的信息以及实体之间的联系均表现为二维表,在数学上把这种二维表叫做“关系” 。这些关 系表的集合就构成了关系模型。 向对象的数据:为了有效地描述复杂的事物或现象,需要在更高层次上综合利用和管理多种数 据结构和数据模型,并用面向对象的方法进行统一的抽象。这就是面向对象数据模型的含义, 其具体实 现就是面向对象的数据结构。 面向对象的地理数据模型的核心是对复杂对象的模拟和 操纵。
相关主题