当前位置: 首页>>代码示例>>C#>>正文


C# Distance.byUnits方法代码示例

本文整理汇总了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)
                        {
//.........这里部分代码省略.........
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:101,代码来源:GotoForm.cs

示例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;
        }
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:67,代码来源:DlgMakeWaypoint.cs

示例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();
            }
        }
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:59,代码来源:DlgNewRouteParameters.cs


注:本文中的Distance.byUnits方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。