示例界面:

转换代码:

     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关于单位转换示例的更多相关文章

  1. Android 尺寸单位转换和屏幕适配相关

    Android 尺寸单位转换和屏幕适配相关 各种尺寸单位的意义 dp: Density-independent Pixels 一个抽象的单元,基于屏幕的物理密度. (dp和dip的意义相同,所以不用区 ...

  2. System.currentTimeMillis()计算方式与时间的单位转换

    目录[-] 一.时间的单位转换 二.System.currentTimeMillis()计算方式 一.时间的单位转换 1秒=1000毫秒(ms) 1毫秒=1/1,000秒(s)1秒=1,000,000 ...

  3. 武汉科技大学ACM:1005: 单位转换

    Problem Description BobLee最近在复习考研,在复习计算 机组成原理的时候,遇到了一个问题.就是在计算机存储里面的单位转换.我们都知道1MB=1024KB,1KB=1024B,1 ...

  4. dynamic_cast 转换示例

    dynamic_cast 转换示例 /* 带虚函数与不带虚函数转换的区别 dynamic_cast:必须要有虚函数才可以转换 dynamic_cast:只能处理转换指针或引用,不能转换对象 dynam ...

  5. 【转】Android中dip(dp)与px之间单位转换

    Android中dip(dp)与px之间单位转换 dp这个单位可能对web开发的人比较陌生,因为一般都是使用px(像素)但是,现在在开始android应用和游戏后,基本上都转换成用dp作用为单位了,因 ...

  6. Revit API单位转换类

    用法:txt.Text=UnitConvertC.CovertFromAPI(param.AsDouble());param.Set(UnitConvertC.CovertToAPI(txt.Text ...

  7. spring-boot前端参数单位转换

    import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import ja ...

  8. Android屏幕尺寸单位转换

    最近在看Android群英传这本书,书中有一节涉及到了,屏幕尺寸与单位.觉得以后可能会用到,做个笔记. PPI(pixels per inch) ,又称为DPI,它是由对角线的像素点数除以屏幕的大小得 ...

  9. while循环/格式化输出/ 逻辑运算/ 编码 /单位转换

    一.while 循环 1. 循环 while 条件: 代码块(循环体) else: 当上面的条件为假. 才会执行 执行顺序: 判断条件是否为真. 如果真. 执行循环体. 然后再次判断条件....直到循 ...

随机推荐

  1. HQL语句大全

    第 15 章 HQL: Hibernate查询语言 Hibernate配备了一种很强大的查询语言,这样的语言看上去很像SQL.可是不要被语法结构 上的类似所迷惑,HQL是很有意识的被设计为全然面向对象 ...

  2. 将firebug安装在chrome浏览器上

    一直很喜欢火狐浏览器,原因是火狐的插件很喜欢,几天突然发现firebug这个插件能够安装在chrome浏览器上,震惊,更震惊的是这个好似已经很长时间了,而我猜发现. 具体的具体页面地址是 http:/ ...

  3. linux 在系统启动过程

    从学习<鸟哥linux私人厨房> 用于在计算机系统启动,计算机硬件和软件由(它包含的操作系统软件)包括.对于操作系统在同一台计算机硬件方面的表现,该系统配备有硬件是公用,不同的系统是 的操 ...

  4. 【软测试】(两)计算机组成原理-cpu

    cpu,中文名称中央处理单元,central processing unit.系统的核心,用于数据的处理,算术以及逻辑运算和控制程序的运行. 组成 运算器 从字面上就能够理解到.运算器主要用来对于逻辑 ...

  5. c语言中实现从0-1的随机数输出

    原文:c语言中实现从0-1的随机数输出 今天晚上同学问了一个巨简单的问题,问我怎么用c语言输出0-1的随机数,可别说,一时之间还想不出来.在写的过程中发现,直接调用random函数还不能实现,用以下方 ...

  6. 如何设置Installshield中 feature的选中状态

    原文:如何设置Installshield中 feature的选中状态 上一篇: 使用strtuts2的iterator标签循环输出二维数组之前一直有筒子问如何设置Installshield中 feat ...

  7. 学习的例子gcc+gdb+make

    1 小侃GCC 在正式使用gcc之前,我们先来侃侃gcc是啥玩意儿? 历史 如今的GCC是GNU Compiler Collection的简称.既然是Collection,就是指一些工具链的集合. 最 ...

  8. [Elasticsearch] 集群工作 - 第二部分

    本文翻译自Elasticsearch官方指南的life inside a cluster一章. 添加故障转移(Failover)功能 仅仅执行一个节点意味着可能存在着单点失败(Single point ...

  9. UVA-11134-Fabled Rooks (结构排序+贪婪)

    这个问题更像八皇后问题,但在位置在大选前必须进行排序,让左侧的优选位置,我没想到这死脑筋! 行,这个问题是不是代码贴. 版权声明:本文博客原创文章.博客,未经同意,不得转载.

  10. String 的intern() 方法说明

    1.说明 Java中string.intern()方法调用会先去字符串常量池中查找相应的字符串,如果字符串不存在,就会在字符串常量池中创建该字符串然后再返回. 2.源码说明 public native ...