MapXtreme 2005 学习心得 在地图上创建点/线并显示标注(五)
创建 显示 地图 标注 学习心得 2005
2023-09-11 14:20:07 时间
新建一个网站,选择MapXtreme 6.7.1 Web Application
在App_Code中,我们新建一个类,起名叫:LayerManager.cs
![ExpandedBlockStart.gif](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
string tableName = "tableName", layerName = "layerName";//随便定义两个名字
LayerManager.CreateLayer(tableName, layerName);//创建图层
LayerManager.AddPoint(layerName, GetDPoint(60,60), 35, Color.Red);//创建一个红色五角星的点
LayerManager.AddLine(layerName, GetDPoint(160, 160), GetDPoint(300, 160), 59, Color.Red);//创建一条红色单箭头的线
LayerManager.ShowValue(tableName, "value");//显示标注
![ExpandedBlockStart.gif](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
private DPoint GetDPoint(int x,int y)
{
DPoint dp = new DPoint();
System.Drawing.Point point = new System.Drawing.Point(x, y);//客户端坐标(相对地图)
Map map = MapInfo.Engine.Session.Current.MapFactory[0];
map.DisplayTransform.FromDisplay(point, out dp);//转成相应的经纬度坐标
return dp;
}
![ExpandedBlockStart.gif](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
public partial class _Default : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
// If the StateManager doesnt exist in the session put it else get it.
if (StateManager.GetStateManagerFromSession() == null)
StateManager.PutStateManagerInSession(new AppStateManager());
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
// Now Restore State
StateManager.GetStateManagerFromSession().ParamsDictionary[StateManager.ActiveMapAliasKey] = MapControl1.MapAlias;
StateManager.GetStateManagerFromSession().RestoreState();
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
string tableName = "tableName", layerName = "layerName";//随便定义两个名字
LayerManager.CreateLayer(tableName, layerName);//创建图层
LayerManager.AddPoint(layerName, GetDPoint(60,60), 35, Color.Red);//创建一个红色五角星的点
LayerManager.AddLine(layerName, GetDPoint(160, 160), GetDPoint(300, 160), 59, Color.Red);//创建一条红色单箭头的线
LayerManager.ShowValue(tableName, "value");//显示标注
}
private DPoint GetDPoint(int x,int y)
{
DPoint dp = new DPoint();
System.Drawing.Point point = new System.Drawing.Point(x, y);//客户端坐标(相对地图)
Map map = MapInfo.Engine.Session.Current.MapFactory[0];
map.DisplayTransform.FromDisplay(point, out dp);//转成相应的经纬度坐标
return dp;
}
// At the time of unloading the page, save the state
private void Page_UnLoad(object sender, System.EventArgs e)
{
StateManager.GetStateManagerFromSession().SaveState();
}
}
获取天气信息以及地方位置(Unity3D) 前段时间有小伙伴问到如何用Unity制作天气预报,博主也是在网上找了很多资料,发现天气API接口稳定的确实没有,除非是天气官方提供的, 但是我观察了下,要是合作伙伴才有开放的可能。 其他的,例如:百度 APIStore、一些同学在其他网站上抓包下来的接口,以及什么各种收费的 API,都没有稳定的。 找了很多接口API,发现了一个比较好用的免费天气API,就分享一下
【Unity3D 灵巧小知识点】 ☀️ | 层级面板中的 ‘小手指‘ 作用: 在Scen中将该物体设置为不可选中状态 Unity 小科普 老规矩,先介绍一下 Unity 的科普小知识: Unity是 实时3D互动内容创作和运营平台 。 包括游戏开发、美术、建筑、汽车设计、影视在内的所有创作者,借助 Unity 将创意变成现实。 Unity 平台提供一整套完善的软件解决方案,可用于创作、运营和变现任何实时互动的2D和3D内容,支持平台包括手机、平板电脑、PC、游戏主机、增强现实和虚拟现实设备。
在App_Code中,我们新建一个类,起名叫:LayerManager.cs
2:把上节函数放到类LayerManager中
把上一节的函数代码全copy过来,还有using的名称空间
3:打开MapForm.cs,在Page_Load代码里,添加如下代码
![ExpandedBlockStart.gif](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/None.gif)
说明:
里面有一个GetDPoint(int x,int y)函数,主要是传入客户端的坐标,返回地图的经纬度
GetDPoint 函数如下
![ExpandedBlockStart.gif](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![ExpandedBlockStart.gif](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
4:完整的页面代码如下
![ExpandedBlockStart.gif](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![ExpandedBlockStart.gif](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![ExpandedSubBlockStart.gif](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
5:运行结果
OK,保存,浏览,即可在页面上看到在相应的地方上,创建了一个五角星和一个红色单向箭头线
版权声明:本文原创发表于博客园,作者为路过秋天,原文链接:
http://www.cnblogs.com/cyq1162/archive/2009/11/02/1594564.html
获取天气信息以及地方位置(Unity3D) 前段时间有小伙伴问到如何用Unity制作天气预报,博主也是在网上找了很多资料,发现天气API接口稳定的确实没有,除非是天气官方提供的, 但是我观察了下,要是合作伙伴才有开放的可能。 其他的,例如:百度 APIStore、一些同学在其他网站上抓包下来的接口,以及什么各种收费的 API,都没有稳定的。 找了很多接口API,发现了一个比较好用的免费天气API,就分享一下
【Unity3D 灵巧小知识点】 ☀️ | 层级面板中的 ‘小手指‘ 作用: 在Scen中将该物体设置为不可选中状态 Unity 小科普 老规矩,先介绍一下 Unity 的科普小知识: Unity是 实时3D互动内容创作和运营平台 。 包括游戏开发、美术、建筑、汽车设计、影视在内的所有创作者,借助 Unity 将创意变成现实。 Unity 平台提供一整套完善的软件解决方案,可用于创作、运营和变现任何实时互动的2D和3D内容,支持平台包括手机、平板电脑、PC、游戏主机、增强现实和虚拟现实设备。
相关文章
- windows创建映射网络硬盘
- 使用UIDynamicAnimator创建重力感应的View
- 实例:Cocos2d-js中使用纹理对象创建Sprite对象
- KVM详解(三)——KVM创建虚拟机
- 使用Visual Studio的动态连接库创建通用数据库连接对话框
- 使用 SAP Business Application Studio 创建 Fiori Elements 应用显示 OData 服务的数据
- 如何在Kubernetes里创建一个Nginx应用
- 医美小程序实战教程创建应用
- android8.0 Launcher源码(8)---Launcher的源码启动过程创建Launcher辅助对象
- 动态库的创建和使用(Win10+VS2022)(亲测可用)
- 1 游戏逻辑架构,Cocos2d-x游戏项目创建,HelloWorld项目创建,HelloWorld程序分析,(CCApplicationProtocol,CCApplication,AppDeleg
- LabVIEW创建自定义输入控件、显示控件和自定义类型2
- 【Qt】通过创建ui界面类成员变量的方式显示窗体