示例界面:

转换代码:

     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. WebView无法放大缩小解决方式

    先看看我们之前所写的代码 1) 加入权限:AndroidManifest.xml中必须使用了许可"android.permission.INTERNET" 2) 使用了一个WebV ...

  2. UVa 10533 - Digit Primes

    题目:输出给定区间中,本身是素数,而且这个数的各位之和也是素数的数(称为位素数)的个数. 分析:数论.首先利用筛法,求出1000000内的全部的素数:然后在利用生成的素数表, 推断每一个数是不是各位之 ...

  3. utf8 和 UTF-8 在使用中的差别

    在使用中经常遇到utf-8和utf8,如今最终弄明确他们的使用不同之处了,如今来和大家分享一下,以下我们看一下utf8 和 UTF-8 有什么差别  "UTF-8"是标准写法,ph ...

  4. 杭电dp题集,附链接还有解题报告!!!!!

    Robberies 点击打开链接 背包;第一次做的时候把概率当做背包(放大100000倍化为整数):在此范围内最多能抢多少钱  最脑残的是把总的概率以为是抢N家银行的概率之和- 把状态转移方程写成了f ...

  5. easyui datagrid shift 多选

    <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta na ...

  6. asp.net webForm 前后台类关系

    要研究这个,首先要新建网站, protected void Page_Load(object sender, EventArgs e) { string str = System.Reflection ...

  7. VisualStudio2012轻松把JSON数据转换到POCO的代码

    原文:VisualStudio2012轻松把JSON数据转换到POCO的代码       在Visual Studio 2012中轻松把JSON数据转换到POCO的代码,首先你需要安装Web Esse ...

  8. 设计模式组合模式(Composite)精华

    23种子GOF设计模式一般分为三类:创建模式.结构模型.行为模式. 创建模式抽象的实例,他们帮助如何创建一个系统独立.这是一个这些对象和陈述的组合. 创建使用继承类的类架构更改实例.的对象类型模型的建 ...

  9. ASP.NET MVC中加载WebForms用户控件(.ascx)

    原文:ASP.NET MVC中加载WebForms用户控件(.ascx) 问题背景 博客园博客中的日历用的是ASP.NET WebForms的日历控件(System.Web.UI.WebControl ...

  10. ActivityLifeCycle官方demo分解

    1.左右Activity生命周期的若干条款: p=330">http://1.duoinfo.sinaapp.com/? p=330 http://1.duoinfo.sinaapp. ...