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


C# GeoCoord.Normalize方法代码示例

本文整理汇总了C#中LibGeo.GeoCoord.Normalize方法的典型用法代码示例。如果您正苦于以下问题:C# GeoCoord.Normalize方法的具体用法?C# GeoCoord.Normalize怎么用?C# GeoCoord.Normalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LibGeo.GeoCoord的用法示例。


在下文中一共展示了GeoCoord.Normalize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: act

        protected override void act()
        {
            double lng;
            double lat;
            double elev;

            bool allcool = validateCoord(out lng, out lat, out elev);

            if(m_wpt.TrackId == -1)
            {
                if(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();
                    if(m_wpt.TrackId == -1)
                    {
                        switch(waypointTypeComboBox.SelectedIndex)
                        {
                            case 0:
                                m_wpt.LiveObjectType = LiveObjectTypes.LiveObjectTypeWaypoint;
                                m_wpt.Found = false;
                                break;
                            case 1:
                                m_wpt.LiveObjectType = LiveObjectTypes.LiveObjectTypeGeocache;
                                m_wpt.Found = false;
                                break;
                            case 2:
                                m_wpt.LiveObjectType = LiveObjectTypes.LiveObjectTypeGeocache;
                                m_wpt.Found = true;
                                break;
                        }
                        m_wpt.WptName = waypointNameTextBox.Text.Trim();
                    }
                    m_wpt.Location = location;
                    if(timePicker.isActive)
                    {
                        m_wpt.DateTime = Project.localToZulu(timePicker.dateTime);
                    }
                    else
                    {
                        m_wpt.DateTime = DateTime.MinValue;
                    }
                    m_wpt.UrlName = urlNameTextBox.Text.Trim();
                    string url = urlTextBox.Text.Trim();
                    if(url.Equals("http://"))		// if something meaningful has been entered
                    {
                        url = "";
                    }
                    m_wpt.Url = url;
                    m_wpt.Comment = commentTextBox.Text.Trim();
                    m_wpt.Sym = symbolTextBox.Text.Trim();
                    m_wpt.Desc = detailTextBox.Text.Trim();
                    WaypointsCache.isDirty = true;
                    Project.drawWaypoints = true;
                    //this.Hide();
                    this.ClientSize = new Size(1,1);
                    Cursor.Current = Cursors.WaitCursor;
                    m_cameraManager.PictureManager.LayersManager.ShowWaypoints = true;
                    m_cameraManager.ProcessCameraMove();	// need to put on map
                    this.Close();
                }
                catch
                {
                    elevLabel.ForeColor = Color.Red;
                    allcool = false;
                }
            }
        }
开发者ID:slgrobotics,项目名称:QuakeMap,代码行数:81,代码来源:DlgEditWaypoint.cs


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