📄 湘源规划软件.htm
字号:
shape(shapeField.Getvalue().pdispVal);<BR>CLISTrackLayer::AddTrack(map,shape,TRACK_SYMBOL_LINE1);<BR>RectCell
=
shape.GetExtent();<BR>}<BR>if(ShapeType==moShapeTypePoint)<BR>{<BR>CMoPoint
shape(shapeField.Getvalue().pdispVal);<BR>CLISTrackLayer::AddTrack(map,shape,TRACK_SYMBOL_POINT1);<BR>RectCell.SetLeft(shape.GetX()-1);<BR>RectCell.SetRight(shape.GetX()+1);<BR>RectCell.SetTop(shape.GetY()+1);<BR>RectCell.SetBottom(shape.GetY()-1);<BR>}<BR>if(Flag)<BR>{<BR>Rect
= RectCell;<BR>Flag =
FALSE;<BR>}<BR>else<BR>{<BR>if(Rect.GetLeft()>RectCell.GetLeft())
Rect.SetLeft(RectCell.GetLeft())<BR>;<BR>if(Rect.GetRight()<RectCell.GetRight())
Rect.SetRight(RectCell.GetRigh<BR>t());<BR>if(Rect.GetBottom()>RectCell.GetBottom())
Rect.SetBottom(RectCell.GetB<BR>ottom());<BR>if(Rect.GetTop()<RectCell.GetTop())
Rect.SetTop(RectCell.GetTop());<BR>}<BR>selSet.MoveNext();<BR>}
<BR>Rect.ScaleRectangle(1.2);<BR>map.SetExtent(Rect);<BR>map.Refresh();<BR>break;<BR>}<BR>return
TRUE;<BR>}<BR>///////////////////////////////////////////////////////////////<BR>//函数功能
: 坐标点定位<BR>//返 回 值 : void<BR>//参数说明 : CMap1&
m_Map,<BR>// long X, long Y;
坐标点<BR>///////////////////////////////////////////////////////////////<BR>void
SetPos(CMap1& m_Map, long X,long
Y)<BR>{<BR>CMoRectangle
moRect(m_Map.GetExtent());<BR>CMoRectangle
moRectNew;<BR>moRectNew.CreateDispatch(TEXT("MapObjects2.Rectangle"));<BR>moRectNew.SetLeft(X
- moRect.GetWidth()/2.0);<BR>moRectNew.SetRight(X +
moRect.GetWidth()/2.0);<BR>moRectNew.SetTop(Y +
moRect.GetHeight()/2.0);<BR>moRectNew.SetBottom(Y -
moRect.GetHeight()/2.0);<BR>m_Map.SetExtent(moRectNew);<BR>m_Map.Refresh();<BR>}<BR><BR>////**********图形浏览**********<BR>//
<BR>///////////////////////////////////////////////////////////////<BR>//函数功能
: 拉框放大<BR>//返 回 值 : void<BR>//参数说明 : CMap1&
map<BR>///////////////////////////////////////////////////////////////<BR>void
ZoomIn(CMap1& map) <BR>{<BR>CMoRectangle
r(map.TrackRectangle());<BR>if
(LPDISPATCH(r))<BR>map.SetExtent(r);<BR>}<BR>///////////////////////////////////////////////////////////////<BR>//函数功能
: 点击缩小<BR>//返 回 值 : void<BR>//参数说明 : CMap1&
map<BR>///////////////////////////////////////////////////////////////<BR>void
ZoomOut(CMap1& map) <BR>{<BR>CMoRectangle
r(map.GetExtent());<BR>ASSERT(LPDISPATCH(r));<BR>r.ScaleRectangle(1.5);
//1.5为每次缩小比例<BR>map.SetExtent(r);<BR>}<BR>///////////////////////////////////////////////////////////////<BR>//函数功能
: 漫游<BR>//返 回 值 : void<BR>//参数说明 : CMap1&
map<BR>///////////////////////////////////////////////////////////////<BR>void
Pan(CMap1& map)
<BR>{<BR>map.Pan();<BR>}<BR>///////////////////////////////////////////////////////////////<BR>//函数功能
: 刷新<BR>//返 回 值 : void<BR>//参数说明 : CMap1&
map<BR>///////////////////////////////////////////////////////////////<BR>void
Refresh(CMap1& map)
<BR>{<BR>map.Refresh();<BR>}<BR>///////////////////////////////////////////////////////////////<BR>//函数功能
: 全图显示<BR>//返 回 值 : void<BR>//参数说明 : CMap1&
map<BR>///////////////////////////////////////////////////////////////<BR>void
ZoomFull(CMap1& map) <BR>{<BR>CMoRectangle
r(map.GetFullExtent());
//获得地图全图范围<BR>ASSERT(LPDISPATCH(r));<BR>map.SetExtent(r);<BR>}<BR>///////////////////////////////////////////////////////////////<BR>//函
数 名 : Identify<BR>//函数功能 : 属性查询<BR>//处理过程 : <BR>//返 回 值
: void<BR>//参数说明 : long X, long Y
;X,Y为鼠标点击地图屏幕时,鼠标的屏幕位置<BR>///////////////////////////////////////////////////////////////<BR>void
Identify(long X,long Y)<BR>{<BR>long
ShapeType;<BR>CMoRecordset selSet; <BR>CMoMapLayer
selLayer;<BR>if(SelectFeatureOnMap(*m_Map,X,Y,m_SelTolerance/*
咬合范围的大小
*/,selSet<BR>,ShapeType,selLayer))<BR>//SelectFeatureOnMap函数参考如下<BR>{<BR>CMoFields
MoFields = selSet.GetFields();
<BR>FlashMoFields(*m_Map,MoFields,ShapeType);
//使所选择的要素闪烁<BR>//
根据返回的Recordset对象在无模式对话框中显示属性值,代码略<BR>}<BR>}<BR><BR>///////////////////////////////////////////////////////////////<BR>//函数功能
: 返回要素属性<BR>//处理过程 : <BR>//返 回 值 : BOOL<BR>//参数说明 :
CMap1& map, long X, long Y, double ptSize,<BR>//
CMoRecordset& set, 该要素的Recordset (返回参数)<BR>//
long& ShapeType, 要素所在图层的类型(返回参数)<BR>//
CMoMapLayer& layer 要素所在图层
(返回参数)<BR>///////////////////////////////////////////////////////////////<BR>BOOL
SelectFeatureOnMap(CMap1& map,long X,long Y,double
ptSize,CMoRecordset<BR>& set,long&
ShapeType,CMoMapLayer& layer)<BR>{<BR>double
tolerance =
map.ToMapDistance((float)ptSize);<BR>CMoPointmapPt(map.ToMapPoint((float)X,
(float)Y));<BR>CMoLayers
layers(map.GetLayers());<BR>for(long
i=0;i<layers.GetCount();i++)<BR>{<BR>CMoMapLayer
Itemlayer(layers.Item(COleVariant(i)));<BR>if(!Itemlayer.GetVisible())
continue;<BR>ShapeType =
Itemlayer.GetShapeType();<BR>if(Itemlayer.GetShapeType()==moShapeTypePolygon)<BR>{<BR>set
= Itemlayer.SearchShape(mapPt,moPointInPolygon,
TEXT(""));<BR>layer = Itemlayer;<BR>if(!set.GetEof())
return
TRUE;<BR>}<BR>if(Itemlayer.GetShapeType()==moShapeTypePoint||Itemlayer.GetShapeType()==mo<BR>ShapeTypeLine)<BR>{<BR>set
= Itemlayer.SearchByDistance(mapPt,tolerance,
TEXT(""));<BR>layer = Itemlayer;<BR>if(!set.GetEof())
return TRUE;<BR>}<BR>}<BR>return
FALSE;<BR>}<BR>///////////////////////////////////////////////////////////////<BR>//函数功能
: 使Recordset对应的要素闪烁<BR>//返 回 值 : void<BR>//参数说明 :
CMap1& map, CMoFields MoFields,
MoFields为要素的Recordset对应的<BR>Fields<BR>// long
ShapeType<BR>///////////////////////////////////////////////////////////////<BR>void
FlashMoFields(CMap1& map,CMoFields MoFields,long
ShapeType)<BR>{<BR>CMoField
shapeField(MoFields.Item(COleVariant(TEXT("Shape"))));<BR>if(ShapeType==moShapeTypePolygon)<BR>{<BR>CMoPolygon
shape(shapeField.Getvalue().pdispVal);<BR>map.FlashShape(shape,2);
//
2为闪烁次数<BR>}<BR>if(ShapeType==moShapeTypeLine)<BR>{<BR>CMoLine
shape(shapeField.Getvalue().pdispVal);<BR>map.FlashShape(shape,2);<BR>}<BR>if(ShapeType==moShapeTypePoint)<BR>{<BR>CMoPoint
shape(shapeField.Getvalue().pdispVal);<BR>map.FlashShape(shape,2);<BR>}<BR>}<BR>///////////////////////////////////////////////////////////////<BR>//函数功能
: 设置地图显示比例尺<BR>//处理过程 :
先得到屏幕上一米包含多少个象素点,地图的宽度(象素点值)除以该值<BR>得到<BR>//
地图的显示实际宽度(米),地图的显示宽度(米)乘地图显示的比例尺<BR>即得到该比例尺<BR>//
下地图宽度(象素点值)<BR>//返 回 值 : void<BR>//参数说明 : CMap1&
map, double scale
;scale为地图显示比例尺<BR>///////////////////////////////////////////////////////////////<BR>void
SetMapScale(CMap1& map,double scale) <BR>{<BR>CDC*
pDC = map.GetDC();<BR>double MiterPointNum =
(1000.0/25.4)*GetDeviceCaps(pDC->m_hDC,LOGPIXELSX);
<BR>//MiterPointNum为屏幕上一米有多少个象素点<BR>//GetDeviceCaps(pDC->m_hDC,LOGPIXELSX)
返回屏幕横轴方向上每英寸长度包含的象<BR>素个数<BR>CRect r =
GetDeviceRect(pDC);<BR>double widthX =
r.Width()*scale/MiterPointNum;<BR>double widthY =
r.Height()*scale/MiterPointNum; <BR>CMoRectangle
moRect(map.GetExtent());<BR>CMoPoint
pt(moRect.GetCenter());<BR>CMoRectangle
moRectNew;<BR>if(!moRectNew.CreateDispatch(TEXT("MapObjects2.Rectangle")))<BR>return;<BR>moRectNew.SetLeft(pt.GetX()-widthX/2.0);<BR>moRectNew.SetRight(pt.GetX()+widthX/2.0);<BR>moRectNew.SetTop(pt.GetY()+widthY/2.0);<BR>moRectNew.SetBottom(pt.GetY()-widthY/2.0);<BR>map.SetExtent(moRectNew);<BR>map.Refresh();<BR>map.ReleaseDC(pDC);<BR>}<BR></TD>
<TD class=12g> </TD></TR>
<TR>
<TD> </TD>
<TD class=12g> </TD>
<TD class=12g> </TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD> </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><LINK
href="湘源规划软件.files/csxy.css" type=text/css rel=stylesheet>
<TABLE cellSpacing=0 cellPadding=0 width=775 align=center border=0>
<TBODY>
<TR>
<TD bgColor=#ffffff>
<HR width="100%" SIZE=1>
</TD></TR>
<TR>
<TD bgColor=#ffffff height=20>
<DIV align=center>您是第 375143 位来宾,当前 13 人在线</DIV></TD></TR>
<TR>
<TD bgColor=#ffffff height=20>
<DIV align=center><A class=zi
href="http://www.csxysoft.com/bbs/help.htm">网站指南</A> | 欢迎合作 | 刊登广告 | 人才引进 | <A
class=zi href="http://www.csxysoft.com/usb/index.asp">网络U盘 | <A
class=zi
href="http://www.csxysoft.com/admin/index.asp">网站管理</A> | <A
class=zi href="http://www.csxysoft.com/logout.asp">会员退出</A></DIV></TD></TR>
<TR>
<TD class=12lian bgColor=#ffffff height=20>
<DIV align=center>Copyright 2004 版权所有,All Rights
Reserved,Tel:0731-4140701</DIV></TD></TR>
<TR>
<TD class=12lian background=湘源规划软件.files/xz17.jpg bgColor=#ffffff
height=28><DIV
align=center>湖南省长沙市勘测设计研究院湘源规划软件研发部</DIV></TD></TR></TBODY></TABLE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -