本文整理汇总了C#中Distance.byUnits方法的典型用法代码示例。如果您正苦于以下问题:C# Distance.byUnits方法的具体用法?C# Distance.byUnits怎么用?C# Distance.byUnits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Distance
的用法示例。
在下文中一共展示了Distance.byUnits方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: act
private void act()
{
double lng = 0.0d;
double lat = 0.0d;
double elev = 0.0d;
bool allcool = true;
if(Project.coordStyle == 3) // UTM?
{
// something like "11S 0432345E 3712345N" in the latitudeTextBox
allcool = Project.mainCommand.fromUtmString(latitudeTextBox.Text, out lng, out lat);
if(allcool)
{
latLabel.ForeColor = Color.Black;
}
else
{
latLabel.ForeColor = Color.Red;
}
}
else
{
try
{
lng = GeoCoord.stringLngToDouble(longitudeTextBox.Text);
lngLabel.ForeColor = Color.Black;
}
catch
{
lngLabel.ForeColor = Color.Red;
allcool = false;
}
try
{
lat = GeoCoord.stringLatToDouble(latitudeTextBox.Text);
latLabel.ForeColor = Color.Black;
}
catch
{
latLabel.ForeColor = Color.Red;
allcool = false;
}
}
try
{
Distance elevDist = new Distance(0.0d);
int unitsCompl = elevDist.UnitsCompl;
double nuElev = Convert.ToDouble(elevationTextBox.Text.Replace(",",""));
elevDist.byUnits(nuElev, unitsCompl);
elev = elevDist.Meters;
if(elev < Project.cameraHeightMin*1000.0d)
{
elevDist.byUnits(Project.cameraHeightMin*1000.0d, Distance.UNITS_DISTANCE_M);
elev = elevDist.Meters;
}
else if(elev > Project.CAMERA_HEIGHT_MAX*1000.0d)
{
elevDist.byUnits(Project.CAMERA_HEIGHT_MAX*1000.0d, Distance.UNITS_DISTANCE_M);
elev = elevDist.Meters;
}
elevationUnitsLabel.Text = elevDist.toStringU(unitsCompl);
elevLabel.ForeColor = Color.Black;
}
catch
{
elevLabel.ForeColor = Color.Red;
allcool = false;
}
if(makeWaypointCheckBox.Checked && waypointNameTextBox.Text.Length == 0)
{
waypointNameLabel.ForeColor = Color.Red;
allcool = false;
}
else
{
waypointNameLabel.ForeColor = Color.Black;
}
if(allcool)
{
try
{
GeoCoord location = new GeoCoord(lng, lat, elev);
location.Normalize();
m_cameraManager.MarkLocation(location, 0);
if(makeWaypointCheckBox.Checked)
{
LiveObjectTypes type = LiveObjectTypes.LiveObjectTypeWaypoint;
bool isFound = false;
switch(waypointTypeComboBox.SelectedIndex)
{
//.........这里部分代码省略.........
示例2: validateCoord
protected bool validateCoord(out double lng, out double lat, out double elev)
{
bool allcool = true;
lng = 0.0d;
lat = 0.0d;
elev = 0.0d;
if(Project.coordStyle == 3) // UTM?
{
// something like "11S 0432345E 3712345N" in the latitudeTextBox
allcool = Project.mainCommand.fromUtmString(latitudeTextBox.Text, out lng, out lat);
if(allcool)
{
latLabel.ForeColor = Color.Black;
}
else
{
latLabel.ForeColor = Color.Red;
}
}
else
{
try
{
lng = GeoCoord.stringLngToDouble(longitudeTextBox.Text);
lngLabel.ForeColor = Color.Black;
}
catch
{
lngLabel.ForeColor = Color.Red;
allcool = false;
}
try
{
lat = GeoCoord.stringLatToDouble(latitudeTextBox.Text);
latLabel.ForeColor = Color.Black;
}
catch
{
latLabel.ForeColor = Color.Red;
allcool = false;
}
}
try
{
Distance elevDist = new Distance(0.0d);
int unitsCompl = elevDist.UnitsCompl;
double nuElev = Convert.ToDouble(elevationTextBox.Text.Replace(",",""));
elevDist.byUnits(nuElev, unitsCompl);
elev = elevDist.Meters;
elevationUnitsLabel.Text = elevDist.toStringU(unitsCompl);
elevLabel.ForeColor = Color.Black;
}
catch
{
elevLabel.ForeColor = Color.Red;
allcool = false;
}
return allcool;
}
示例3: goButton_Click
private void goButton_Click(object sender, System.EventArgs e)
{
bool allcool = true;
try
{
Distance elevDist = new Distance(0.0d);
int unitsCompl = elevDist.UnitsCompl;
double nuElev = Convert.ToDouble(elevationTextBox.Text.Replace(",",""));
elevDist.byUnits(nuElev, unitsCompl);
altitude = elevDist.Meters;
elevationUnitsLabel.Text = elevDist.toStringU(unitsCompl);
elevLabel.ForeColor = Color.Black;
}
catch
{
elevLabel.ForeColor = Color.Red;
allcool = false;
}
try
{
Speed speedDist = new Speed(0.0d);
int units = speedDist.Units;
double nuSpeed = Convert.ToDouble(speedTextBox.Text.Replace(",",""));
speedDist.byUnits(nuSpeed, units);
speed = speedDist.Meters;
speedUnitsLabel.Text = speedDist.toStringU(units);
elevLabel.ForeColor = Color.Black;
}
catch
{
elevLabel.ForeColor = Color.Red;
allcool = false;
}
try
{
startTime = timePicker.isDateTimeValid ? timePicker.dateTime : DateTime.MinValue; //new DateTime(7000, 1, 1);
}
catch
{
allcool = false;
}
if(allcool)
{
result = true;
this.Close();
}
}