资源简介
GIS专业 数字地图制图课程实习成果 有完整界面:菜单栏、工具栏、图形显示窗口。
包括点状符号、现状符号、面状符号的绘制
其中,点状符号:空心圆、三角形、实心三角形、五角星、点圆等;线状符号:土堤、长城、境界、铁路、公路、短线;面状符号:晕线、圆填充、点填充。
代码片段和文件信息
#include “StdAfx.h“
#include “AbstractSymbol.h“
AbstractSymbol::AbstractSymbol(void)
{
this->Active=false;
this->PenColor=RGB(0125125);
this->PenWidth=1;
this->pDrawPen=new CPen(PS_SOLIDthis->PenWidth this->PenColor);
this->BrushColor=RGB(255255255);
this->pBrush=new CBrush(this->BrushColor);
this->IsDrawed=false;
this->pDC=NULL;
}
AbstractSymbol::~AbstractSymbol(void)
{
delete this->pDrawPen;
}
void AbstractSymbol::SetSymbolProperty(map propertyMap)
{
if(propertyMap.find(“pencolor“)!=propertyMap.end())
{
this->PenColor=propertyMap[“pencolor“];
}
if(propertyMap.find(“brushcolor“)!=propertyMap.end())
{
this->BrushColor=propertyMap[“brushcolor“];
}
if(propertyMap.find(“penwidth“)!=propertyMap.end())
{
this->PenWidth=propertyMap[“penwidth“];
}
}
void AbstractSymbol::OnLButtonDown(UINT nFlags CPoint point)
{
}
void AbstractSymbol::OnRButtonDown(UINT nFlags CPoint point)
{
}
void AbstractSymbol::OnLButtonUp(UINT nFlags CPoint point)
{
}
void AbstractSymbol::OnRButtonUp(UINT nFlags CPoint point)
{
}
void AbstractSymbol::onmousemove(UINT nFlags CPoint point)
{
}
void AbstractSymbol::SetDC(CDC *pDC)
{
this->pDC=pDC;
}//判断线段相交
bool AbstractSymbol::LineIsIntersect(double x0 double y0 double x1 double y1 double x2 double y2 double x3 double y3)
{ //两条线段是否相交X0X1 AND X1X2
double x y;
double Minx01 = min(x0 x1);
double Miny01 = min(y0 y1);
double Minx23 = min(x2 x3);
double Miny23 = min(y2 y3);
double Maxx01 = max(x0 x1);
double Maxy01 = max(y0 y1);
double Maxx23 = max(x2 x3);
double Maxy23 = max(y2 y3);
if(x1!=x0 && x2!=x3)
{
double k1 = (y1-y0)/(x1-x0);
double k2 = (y3-y2)/(x3-x2);
double Den = (y1-y0)*(x3-x2) - (y3-y2)*(x1-x0);
if(k1==k2)
{ //平行不相交
double d1 = abs(int(y0*(x1-x0)-x0*(y1-y0)-y2*(x3-x2)+x2*(y3-y2))); //距离公式d = abs(c1-c2) / sqrt(a*a+b*b)
if(d1==0)
{//直线重合
if((x2>Minx01 && x2Miny01 && y2Minx01 && x3Miny01 && y3 || (x0>Minx23 && x0Miny23 && y0Minx23 && x1Miny23 && y1 { //实际碰撞问题线段重合认为相交了
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
x = ((y2-y0)*(x1-x0)*(x3-x2)+(y1-y0)*(x3-x2)*x0-(y3-y2)*(x1-x0)*x2)/Den;
y = ((y1-y0)*(x-x0))/(x1-x0) + y0;
if(Minx01<=x && x<=Maxx01 && Miny01<=y && y<=Maxy01 && Minx23<=x && x<=Maxx23 && Miny23<=y && y<=Maxy23)
{
/* InterX = x;
InterY = y;*/
return true;
}
}
else if(x1==x0 && x2!=x3)
{
x = x0;
y = ((y3-y2)*(x0-x2))/(x3-x2) + y2;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 371200 2011-12-14 21:02 符号绘制\MyMapSymbol\Debug\MyMapSymbol.exe
文件 3948588 2011-12-14 21:02 符号绘制\MyMapSymbol\Debug\MyMapSymbol.ilk
文件 6409216 2011-12-14 21:02 符号绘制\MyMapSymbol\Debug\MyMapSymbol.pdb
文件 61952 2011-12-12 23:06 符号绘制\MyMapSymbol\Debug\MyTest.exe
文件 421032 2011-12-12 23:06 符号绘制\MyMapSymbol\Debug\MyTest.ilk
文件 732160 2011-12-12 23:06 符号绘制\MyMapSymbol\Debug\MyTest.pdb
文件 2359296 2011-12-14 19:10 符号绘制\MyMapSymbol\ipch\mytest-526a42c6\mytest-ca15672.ipch
文件 3582 2011-12-13 14:01 符号绘制\MyMapSymbol\MyMapSymbol\AbstractSymbol.cpp
文件 1328 2011-12-14 19:11 符号绘制\MyMapSymbol\MyMapSymbol\AbstractSymbol.h
文件 2856 2011-12-13 15:38 符号绘制\MyMapSymbol\MyMapSymbol\AreaSymbol.cpp
文件 977 2011-12-13 15:38 符号绘制\MyMapSymbol\MyMapSymbol\AreaSymbol.h
文件 1892 2011-12-11 23:26 符号绘制\MyMapSymbol\MyMapSymbol\BankSymbol.cpp
文件 249 2011-12-13 15:27 符号绘制\MyMapSymbol\MyMapSymbol\BankSymbol.h
文件 1769 2011-12-12 17:19 符号绘制\MyMapSymbol\MyMapSymbol\BoundaryLineSymbol.cpp
文件 238 2011-12-13 14:21 符号绘制\MyMapSymbol\MyMapSymbol\BoundaryLineSymbol.h
文件 2329 2011-12-13 15:49 符号绘制\MyMapSymbol\MyMapSymbol\CircleAreaSymbol.cpp
文件 349 2011-12-13 15:35 符号绘制\MyMapSymbol\MyMapSymbol\CircleAreaSymbol.h
文件 904 2011-12-13 15:43 符号绘制\MyMapSymbol\MyMapSymbol\CircleSymbol.cpp
文件 256 2011-12-13 14:37 符号绘制\MyMapSymbol\MyMapSymbol\CircleSymbol.h
文件 247634 2011-12-14 19:11 符号绘制\MyMapSymbol\MyMapSymbol\Debug\AbstractSymbol.obj
文件 384494 2011-12-14 19:12 符号绘制\MyMapSymbol\MyMapSymbol\Debug\AreaSymbol.obj
文件 30472 2011-12-14 19:12 符号绘制\MyMapSymbol\MyMapSymbol\Debug\BankSymbol.obj
文件 32070 2011-12-14 19:12 符号绘制\MyMapSymbol\MyMapSymbol\Debug\BoundaryLineSymbol.obj
文件 191378 2011-12-14 21:02 符号绘制\MyMapSymbol\MyMapSymbol\Debug\CircleAreaSymbol.obj
文件 277821 2011-12-14 21:02 符号绘制\MyMapSymbol\MyMapSymbol\Debug\CircleSymbol.obj
文件 19658 2011-12-14 21:02 符号绘制\MyMapSymbol\MyMapSymbol\Debug\cl.command.1.tlog
文件 153446 2011-12-14 21:02 符号绘制\MyMapSymbol\MyMapSymbol\Debug\CL.read.1.tlog
文件 48064 2011-12-14 21:02 符号绘制\MyMapSymbol\MyMapSymbol\Debug\CL.write.1.tlog
文件 34353 2011-12-14 19:12 符号绘制\MyMapSymbol\MyMapSymbol\Debug\GreatwallSymbol.obj
文件 189814 2011-12-14 19:12 符号绘制\MyMapSymbol\MyMapSymbol\Debug\HachureSymbol.obj
............此处省略150个文件信息
- 上一篇:金融大数据技术与实战-王健宗
- 下一篇:springmvc注解实现用户注册验证
评论
共有 条评论