ArcEngine关于单位转换示例
示例界面:

转换代码:
private void Button1_Click(object sender, System.Windows.RoutedEventArgs e)
{
// Get the AreaUnits value string name.
string theSelectionText = ComboBox1.SelectedValue.ToString(); // Get the input Square Meters value.
double theInputValue = System.Convert.ToDouble(TextBox_Input_1.Text); // Create a placeholder output AreaUnits output value from the .ConvertFromSquareMeters Method.
double theOutputValue = ; // For each AreaUnits type perform the .ConvertFromSquareMeters calculation.
if (theSelectionText == Esri.ArcGISRuntime.Geometry.AreaUnits.Acres.Name)
{
theOutputValue = Esri.ArcGISRuntime.Geometry.AreaUnits.Acres.ConvertFromSquareMeters(theInputValue);
}
else if (theSelectionText == Esri.ArcGISRuntime.Geometry.AreaUnits.Ares.Name)
{
theOutputValue = Esri.ArcGISRuntime.Geometry.AreaUnits.Ares.ConvertFromSquareMeters(theInputValue);
}
else if (theSelectionText == Esri.ArcGISRuntime.Geometry.AreaUnits.Hectares.Name)
{
theOutputValue = Esri.ArcGISRuntime.Geometry.AreaUnits.Hectares.ConvertFromSquareMeters(theInputValue);
}
else if (theSelectionText == Esri.ArcGISRuntime.Geometry.AreaUnits.SquareCentimeters.Name)
{
theOutputValue = Esri.ArcGISRuntime.Geometry.AreaUnits.SquareCentimeters.ConvertFromSquareMeters(theInputValue);
}
else if (theSelectionText == Esri.ArcGISRuntime.Geometry.AreaUnits.SquareDecimeters.Name)
{
theOutputValue = Esri.ArcGISRuntime.Geometry.AreaUnits.SquareDecimeters.ConvertFromSquareMeters(theInputValue);
}
else if (theSelectionText == Esri.ArcGISRuntime.Geometry.AreaUnits.SquareFeet.Name)
{
theOutputValue = Esri.ArcGISRuntime.Geometry.AreaUnits.SquareFeet.ConvertFromSquareMeters(theInputValue);
}
else if (theSelectionText == Esri.ArcGISRuntime.Geometry.AreaUnits.SquareInches.Name)
{
theOutputValue = Esri.ArcGISRuntime.Geometry.AreaUnits.SquareInches.ConvertFromSquareMeters(theInputValue);
}
else if (theSelectionText == Esri.ArcGISRuntime.Geometry.AreaUnits.SquareKilometers.Name)
{
theOutputValue = Esri.ArcGISRuntime.Geometry.AreaUnits.SquareKilometers.ConvertFromSquareMeters(theInputValue);
}
else if (theSelectionText == Esri.ArcGISRuntime.Geometry.AreaUnits.SquareMeters.Name)
{
theOutputValue = Esri.ArcGISRuntime.Geometry.AreaUnits.SquareMeters.ConvertFromSquareMeters(theInputValue);
}
else if (theSelectionText == Esri.ArcGISRuntime.Geometry.AreaUnits.SquareMiles.Name)
{
theOutputValue = Esri.ArcGISRuntime.Geometry.AreaUnits.SquareMiles.ConvertFromSquareMeters(theInputValue);
}
else if (theSelectionText == Esri.ArcGISRuntime.Geometry.AreaUnits.SquareMillimeters.Name)
{
theOutputValue = Esri.ArcGISRuntime.Geometry.AreaUnits.SquareMillimeters.ConvertFromSquareMeters(theInputValue);
}
else if (theSelectionText == Esri.ArcGISRuntime.Geometry.AreaUnits.SquareYards.Name)
{
// NOTE: Using this long version you can also obtain information on the AreaUnit Class.
Esri.ArcGISRuntime.Geometry.AreaUnit myUnit_SquareYards = (Esri.ArcGISRuntime.Geometry.AreaUnit)Esri.ArcGISRuntime.Geometry.AreaUnit.Create(Esri.ArcGISRuntime.Geometry.AreaUnits.SquareYards.Id);
theOutputValue = myUnit_SquareYards.ConvertFromSquareMeters(theInputValue); // Additional AreaUnit Properties that you could make use of in another application
int myAreaUnit_SquareYards_ID = myUnit_SquareYards.Id;
string myAreaUnit_SquareYards_Name = myUnit_SquareYards.Name;
Esri.ArcGISRuntime.Geometry.UnitType myAreaUnit_SquareYards_UnitType = myUnit_SquareYards.UnitType;
} // Display the other XXXX AreaUnits values.
TextBox_Output_1.Text = theOutputValue.ToString();
}
参考网址:https://developers.arcgis.com/net/desktop/api-reference/
ArcEngine关于单位转换示例的更多相关文章
- Android 尺寸单位转换和屏幕适配相关
Android 尺寸单位转换和屏幕适配相关 各种尺寸单位的意义 dp: Density-independent Pixels 一个抽象的单元,基于屏幕的物理密度. (dp和dip的意义相同,所以不用区 ...
- System.currentTimeMillis()计算方式与时间的单位转换
目录[-] 一.时间的单位转换 二.System.currentTimeMillis()计算方式 一.时间的单位转换 1秒=1000毫秒(ms) 1毫秒=1/1,000秒(s)1秒=1,000,000 ...
- 武汉科技大学ACM:1005: 单位转换
Problem Description BobLee最近在复习考研,在复习计算 机组成原理的时候,遇到了一个问题.就是在计算机存储里面的单位转换.我们都知道1MB=1024KB,1KB=1024B,1 ...
- dynamic_cast 转换示例
dynamic_cast 转换示例 /* 带虚函数与不带虚函数转换的区别 dynamic_cast:必须要有虚函数才可以转换 dynamic_cast:只能处理转换指针或引用,不能转换对象 dynam ...
- 【转】Android中dip(dp)与px之间单位转换
Android中dip(dp)与px之间单位转换 dp这个单位可能对web开发的人比较陌生,因为一般都是使用px(像素)但是,现在在开始android应用和游戏后,基本上都转换成用dp作用为单位了,因 ...
- Revit API单位转换类
用法:txt.Text=UnitConvertC.CovertFromAPI(param.AsDouble());param.Set(UnitConvertC.CovertToAPI(txt.Text ...
- spring-boot前端参数单位转换
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import ja ...
- Android屏幕尺寸单位转换
最近在看Android群英传这本书,书中有一节涉及到了,屏幕尺寸与单位.觉得以后可能会用到,做个笔记. PPI(pixels per inch) ,又称为DPI,它是由对角线的像素点数除以屏幕的大小得 ...
- while循环/格式化输出/ 逻辑运算/ 编码 /单位转换
一.while 循环 1. 循环 while 条件: 代码块(循环体) else: 当上面的条件为假. 才会执行 执行顺序: 判断条件是否为真. 如果真. 执行循环体. 然后再次判断条件....直到循 ...
随机推荐
- 关于Cassandra与Thrift在int/text/varint上的暧昧
近期简单写了一个基于Cassandra/C++的日志缓存,虽然是Nosql,但是在实际应用中,还是期望能有部分的临时CQL统计 或+-*/可以支持 所以在针对部分字段入库时,选择了作为整形录入,于是麻 ...
- MVC应用程序使用Web Services(asmx)
原文:MVC应用程序使用Web Services(asmx) 这次,我们练习MVC应用程序中,应用web service.先在MVC应用程序中创建一个目录Services,将用来存储Service.a ...
- 安德鲁斯Selector简介
<? xml version="1.0" encoding="utf-8"? > <selector xmlns:android=" ...
- Python 3.3 try catch所有的错误Error,不包括Exception。关键在于 sys.exc_info()
import os; import sys; #---------------------------------------------- def main( ) : try : a = 1 / 0 ...
- 《Visual Studio Magazine》2013年读者选择奖—软件类
<Visual Studio Magazine>会在每年的下半年向读者发出投票邀请,读者将在28个大类,超过500个开发工具的名单中选出他们认为最好的产品,以票数评出各分类的金.银.铜奖. ...
- 我的Android 4 学习系列之创建用户基本界面
目录 使用视图和布局 理解Fragment 优化布局 创建分辨率无关的用户界面 扩展.分组.创建和使用视图 使用适配器将数据绑定到视图 使用视图和布局 1. Android UI 几个基本概念 视图: ...
- codeblock 设置背景颜色
今天觉得codeblock看着刺眼,想了想,能不能跟vs利用dark背景一样可以设置一个舒服的背景.于是就开始各种点击,各种摸索了. 1. 背景和各种颜色设置 不妨先说下vs中的设置是:工具(Tool ...
- linux find命令之exec
find是我们很常用的一个Linux命令,但是我们一般查找出来的并不仅仅是看看而已,还会有进一步的操作,这个时候exec的作用就显现出来了. exec解释: -exec 参数后面跟的是command ...
- 【分享】Python学习资源大合集
地址:http://www.hejizhan.com/html/xueke/520/x520_03.html Python安装软件合集(Windows)(78) Python教程——游戏编程(13) ...
- WCF入门教程(图文)VS2012
WCF入门教程(图文)VS2012 上一遍到现在已经有一段时间了,先向关注本文的各位“挨踢”同仁们道歉了.小生自认为一个ITer如果想要做的更好,就需要将自己的所学.所用积极分享出来,接收大家的指导和 ...