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


C# Tuple.Latitude方法代码示例

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


在下文中一共展示了Tuple.Latitude方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: generateSliceDescriptors

        // -----------------------------------------------------------------------------------------------
        // iterates over the line between the coordinates start->end, stepping by degreesBetweenSlices, and
        // generating a slice descriptor at each step that goes from current location to current location + sliceDelta
        private List<SliceDescriptor> generateSliceDescriptors( Tuple<double,double> start, Tuple<double,double> end, 
                                                                double degreesBetweenSlices,
                                                                Tuple<double,double> sliceDelta )
        {
            System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
            stopwatch.Reset();
            stopwatch.Start();

            // determine how many slices will be generated
            var startEndDelta = Vector.Ops.Delta( start, end );

            // length of delta
            double startEndDeltaDegrees = Vector.Ops.Length( startEndDelta );

            // note : add 1 because the division determines the count of spaces -between- slices
            int numSlices = (int)(startEndDeltaDegrees / degreesBetweenSlices) + 1;

            var slices = new List<SliceDescriptor>( numSlices );

            // need normalized length start->end delta
            var normalizedStartEndDelta = Vector.Ops.Normalize( startEndDelta );

            // now need coincident vector, but sized to degrees step
            var deltaStep = Vector.Ops.Scale( normalizedStartEndDelta, degreesBetweenSlices );

            // starting point of current slice
            double currentStartLatitude = start.Item1;
            double currentStartLongitude = start.Item2;

            for ( int currentSliceIndex = 0; currentSliceIndex < numSlices; ++currentSliceIndex )
            {
                var slice = new SliceDescriptor();

                // -- generate coordinates --
                slice.Start = new Tuple<double, double>( currentStartLatitude, currentStartLongitude );
                slice.End = new Tuple<double,double>( currentStartLatitude + sliceDelta.Latitude(), currentStartLongitude + sliceDelta.Longitude());

                // -- generate filename --
                slice.filename = generateSliceFilename( slice, currentSliceIndex, _appendCoordinatesToFilenames );

                slices.Add( slice );

                currentStartLatitude += deltaStep.Latitude();
                currentStartLongitude += deltaStep.Longitude();
            }

            stopwatch.Stop();
            addTiming( "generate slice descriptors", stopwatch.ElapsedMilliseconds );

            return slices;
        }
开发者ID:brucecooner,项目名称:FLTTopo,代码行数:54,代码来源:TopoGenerators.cs

示例2: CoordinateToRowCol

 // ------------------------------------------------------------------------------------------------
 private Tuple<int, int> CoordinateToRowCol( Tuple<double,double> coordinate )
 {
     return new Tuple<int,int>( _data.Descriptor.LatitudeToRowIndex( coordinate.Latitude() ), _data.Descriptor.LongitudeToColumnIndex( coordinate.Longitude() ) );
 }
开发者ID:brucecooner,项目名称:FLTTopo,代码行数:5,代码来源:TopoGenerators.cs


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