• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Segment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Segment的典型用法代码示例。如果您正苦于以下问题:C# Segment类的具体用法?C# Segment怎么用?C# Segment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Segment类属于命名空间,在下文中一共展示了Segment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: createChangeLine

 private CustomerOrderChangeLine createChangeLine(Segment lineSeg)
 {
     SegmentCount++;
     string[] arr = GetEls(lineSeg);
     var line = new CustomerOrderChangeLine
     {
         LineNumber = arr[1].CastToInt(),
         RequestedQuantity = arr[3].CastToInt(),
         QtyLeftToReceive = arr[4].CastToInt(),
         RequestedPrice = arr[6].CastToDecimal(),
         ChangeCode = arr[2]
     };
     for (int i = 8; i < arr.Length - 1; i++)
     {
         if (arr[i] == "IN" || arr[i] == "BP")
         {
             line.CustomerPartNumber = arr[i + 1];
         }
         if (arr[i] == "PD")
             line.ItemDescription = arr[i + 1];
         if (arr[i] == "VN" || arr[i] == "VP")
             line.ItemId = arr[i + 1];
     }
     return line;
 }
开发者ID:agglerithm,项目名称:EDIDocsProcessing,代码行数:25,代码来源:POLineParser.cs


示例2: ToEndTest

        public void ToEndTest()
        {
            Segment container = new Segment(2, 5);

            var aligned = container.AlignToEnd(2);
            Assert.Equal(new Segment(3, 5), aligned);
        }
开发者ID:shahid-pk,项目名称:Perspex,代码行数:7,代码来源:AlignerTests.cs


示例3: ToMiddleTest2

        public void ToMiddleTest2()
        {
            Segment container = new Segment(0, 500);

            var aligned = container.AlignToMiddle(200);
            Assert.Equal(new Segment(150, 350), aligned);
        }
开发者ID:shahid-pk,项目名称:Perspex,代码行数:7,代码来源:AlignerTests.cs


示例4: SegmentIteratorFrom

        public SegmentIteratorFrom(Segment firstSegment)
        {
            Contract.Ensures(firstSegment != null);

            _firstSegment = firstSegment;
            Reset();
        }
开发者ID:jruncik,项目名称:VlakRegion,代码行数:7,代码来源:SegmentIteratorFrom.cs


示例5: isEdge

 bool isEdge(List<Vector3> processedPoints, Segment edge)
 {
     for(int k = 0; k < processedPoints.Count; k++) {
         if(edge.isLeft(processedPoints[k])) return false;
     }
     return true;
 }
开发者ID:Diggery,项目名称:SuperSneak,代码行数:7,代码来源:ConvexHull.cs


示例6: Handle

		public override bool Handle (State previous, Segment prevSegment, Segment newSegment, bool left)
		{
			if (newSegment != null && !newSegment.IsPalette && newSegment.Type != ElementType.None) {

				if (newSegment.Type == ElementType.Coil ||
					newSegment.Type == ElementType.NotCoil || 
					newSegment.Type == ElementType.SetCoil ||
					newSegment.Type == ElementType.ResetCoil) {
					MainClass._main.BindDefaultOutputs ();
				} else {
					MainClass._main.BindDefaultInputs ();
				}

				MainClass._main.BindExistingVariables (newSegment);
				MainClass._main.BindFunction (newSegment);
				AppController.Instance.CheckUserVariables ();

				if (newSegment.Variables.Any ()) {
					int index = 0;
					foreach (var v in newSegment.Variables) {
						MainClass._main.BindElementVariables (v.Type, v.Value, index++);
					}
					for (int i = index; i < 4; i++) {
						MainClass._main.BindElementVariables (VariableType.Default, string.Empty, i);
					}
				}
				MainClass._main.DisableProperties ();
			}

			base.Handle (previous, prevSegment, newSegment, left);
			return true;
		}
开发者ID:jdpillon,项目名称:ArduinoLadder,代码行数:32,代码来源:ElementState.cs


示例7: Insert

        public Segment Insert(TrackObject insertedOject, float distanceFromBegining)
        {
            Segment insertedSegment = new Segment();
            IFirstLastAccessor insertedFLAccessor = FirstLastAccessorFactory.Create(_direction, insertedSegment);
            IFirstLastAccessor segmentFLAccessor = FirstLastAccessorFactory.Create(_direction, _segment);

            insertedFLAccessor.FirstObject = segmentFLAccessor.FirstObject;
            insertedFLAccessor.LastObject = insertedOject;

            segmentFLAccessor.FirstObject = insertedOject;

            Segment prevSegment = segmentFLAccessor.PrevSegment;

            insertedFLAccessor.NextSegment = _segment;
            insertedFLAccessor.PrevSegment = prevSegment;
            segmentFLAccessor.PrevSegment = insertedSegment;

            if (prevSegment != null)
            {
                IFirstLastAccessor prevSegmentFLAccessor = FirstLastAccessorFactory.Create(_direction, prevSegment);
                prevSegmentFLAccessor.NextSegment = insertedSegment;
            }

            float distance = distanceFromBegining - _distanceFull;
            if (distance > 0.0)
            {
                throw new VrException(String.Format("Longer distance '{0}' can't be appended, only appended!", distance));
            }

            float insertedSegmentDistance = _segment.Distance + distance;
            insertedSegment.Distance = insertedSegmentDistance;
            _segment.Distance = _segment.Distance - insertedSegmentDistance;

            return insertedSegment;
        }
开发者ID:jruncik,项目名称:VlakRegion,代码行数:35,代码来源:SegementInfoInside.cs


示例8: GetConnectedSegment

 private Segment GetConnectedSegment(Segment segment)
 {
     HingeJoint2D hingeJoint = GetHingeJoint(segment);
     Segment previousSegment = null;
     if (hingeJoint.connectedBody != null) previousSegment = hingeJoint.connectedBody.gameObject.GetComponent<Segment>();
     return previousSegment;
 }
开发者ID:wtrebella,项目名称:ElephantTrunk,代码行数:7,代码来源:ElephantTrunkEditor.cs


示例9: AddSegmentText

        private void AddSegmentText(SvgDocument document, int index, ComplexLine line,Segment segment, PointF targetPoint, PointF referencePoint)
        {
            //Get midpoint of segment
            PointF location = new PointF(targetPoint.X + ((referencePoint.X - targetPoint.X) / 2), targetPoint.Y + ((referencePoint.Y - targetPoint.Y) / 2));

            if (segment.Label.Text.Trim() == "") return;

            Style style = new Style();

            //Set up text object
            location = OffsetPoint(location, segment.Label.Offset);
            //location = OffsetPoint(location, line.Rectangle.Location);

            Double rotation = Geometry.DegreesFromRadians(Geometry.GetAngle(targetPoint.X, targetPoint.Y, referencePoint.X, referencePoint.Y));

            Text text = new Text();
            text.Label = segment.Label;
            text.LayoutRectangle = new RectangleF(location, new SizeF());

            //Get style
            string classId = null;
            classId = document.AddClass(text.GetStyle());

            //Create fragment and add to document
            XmlDocumentFragment frag = null;
            XmlNode newElementNode = null;

            frag = document.CreateDocumentFragment();
            frag.InnerXml = text.ExtractText(0, 0, line.Key + index.ToString() + "Text", "rotate(" + rotation.ToString() + "," + location.X.ToString() + "," + location.Y.ToString() + ")");
            //frag.InnerXml = text.ExtractText(0, 0, line.Key + index.ToString() + "Text");
            frag.FirstChild.Attributes.GetNamedItem("class").InnerText = classId;
            newElementNode = document.ContainerNode.AppendChild(frag);
        }
开发者ID:savagemat,项目名称:arcgis-diagrammer,代码行数:33,代码来源:ComplexLineFormatter.cs


示例10: Address

 public Address(Segment segment, long value)
     : this()
 {
     this.Type    = AddressType.Logical;
     this.Value   = value;
     this.Segment = segment;
 }
开发者ID:jsren,项目名称:DebugOS,代码行数:7,代码来源:Address.cs


示例11: Create

        public IRun Create(IComparisonGeneratorsFactory factory)
        {
            var run = new Run(factory);

            var json = JSON.FromStream(Stream);

            run.GameName = json.run_name as string;
            run.AttemptCount = json.run_count;

            var timingMethod = (int)(json.timer_type) == 0 
                ? TimingMethod.RealTime 
                : TimingMethod.GameTime;

            var segments = json.splits as IEnumerable<dynamic>;

            foreach (var segment in segments)
            {
                var segmentName = segment.name as string;
                var pbSplitTime = parseTime((int?)segment.pb_split, timingMethod);
                var bestSegment = parseTime((int?)segment.split_best, timingMethod);

                var parsedSegment = new Segment(segmentName, pbSplitTime, bestSegment);
                run.Add(parsedSegment);
            }

            return run;
        }
开发者ID:PrototypeAlpha,项目名称:LiveSplit,代码行数:27,代码来源:SplittyRunFactory.cs


示例12: addSegment

    // Add a segment, where the first point shows up in the
    // visualization but the second one does not. (Every endpoint is
    // part of two segments, but we want to only show them once.)
    public void addSegment(float x1, float y1, float x2, float y2)
    {
        Segment segment = new Segment();//null;
            //EndPoint p1 = {begin, x, y, angle,segment, visualize};

            //EndPoint p1 = new EndPoint.Init(begin = false, x = 0F, y= 0F, angle = 0F,segment = segment, visualize = true);
            //EndPoint p2 = new EndPoint.Init(begin = false, x = 0F, y= 0F, angle = 0F,segment = segment, visualize = false);

            EndPoint p1 = new EndPoint{begin = false, x = 0F, y = 0F, angle = 0F,segment = segment, visualize = true};
            EndPoint p2 = new EndPoint{begin = false, x = 0F, y = 0F, angle = 0F,segment = segment, visualize = false};
            //EndPoint p2 = {begin: false, x: 0.0, y: 0.0, angle: 0.0,segment: segment, visualize: false};
            //segment = {p1: p1, p2: p2, d: 0.0};
            p1.x = x1; p1.y = y1;
            p2.x = x2; p2.y = y2;
            p1.segment = segment;
            p2.segment = segment;
            segment.p1 = p1;
            segment.p2 = p2;

            segments.Add(segment);	//segments.append(segment);
            endpoints.Add(p1);	//endpoints.append(p1);
            endpoints.Add(p2);	//endpoints.append(p2);

            //Drawline lags one frame behind because off is updated after, no problem
            //Debug.DrawLine(new Vector3(p1.x,0F,p1.y)+off,new Vector3(p2.x,0F,p2.y)+off,new Color(1F,1F,1F,0.5F),0F,false);
    }
开发者ID:neonwednesdays,项目名称:StealthShot-Test,代码行数:29,代码来源:VisibilityOLD.cs


示例13: update

        public void update(Point p, bool shiftPressed, bool ctrlPressed)
        {
            Point s = (Point)start;
            segments.Clear();

            if (ctrlPressed)
            {
                // calculate the angle
                double A = p.Y < s.Y ? s.Y - p.Y : -(p.Y - s.Y);
                double B = p.X < s.X ? -(s.X - p.X) : p.X - s.X;
                angle = Math.Tanh(A / B) * 180 / Math.PI;
            }
            else
            {
                end = p;
            }

            Point e = (Point)end;

            Point a = s;
            Point b = new Point(e.X, a.Y);
            Point c = new Point(b.X, e.Y);
            Point d = new Point(a.X, c.Y);

            Segment AB = new Segment(a, b).Rotate(-angle);
            Segment BC = new Segment(b, c).Rotate(-angle).Translate(AB.End);
            Segment CD = new Segment(c, d).Rotate(-angle).Translate(BC.End);
            Segment DA = new Segment(d, a).Rotate(-angle).Translate(CD.End);

            segments.Add(AB);
            segments.Add(BC);
            segments.Add(CD);
            segments.Add(DA);
        }
开发者ID:vipuldivyanshu92,项目名称:Projects,代码行数:34,代码来源:RectangleTool.cs


示例14: GetAllowableSegmentPart

        private static string GetAllowableSegmentPart(Segment segment, int pos, 
            int extractStart, int extractLength, bool extractToEnd)
        {
            var segmentMin = pos;
            var segmentMax = pos + segment.Text.Length;
            var extractMax = extractStart + (extractToEnd ? segmentMax : extractLength);
            var startIsInsideSegment = extractStart >= segmentMin && extractStart <= segmentMax;
            var endIsInsideSegment = extractMax >= segmentMin && extractMax <= segmentMax;
            var segmentIsInsideRange = extractStart <= segmentMin && extractMax >= segmentMax;

            if (segmentIsInsideRange)
                return segment.Text;

            if (startIsInsideSegment && endIsInsideSegment)
            {
                var fragmentStart = extractStart - segmentMin;
                var fragmentLength = extractMax - extractStart;
                return segment.Text.Substring(fragmentStart, fragmentLength);
            }

            if (startIsInsideSegment)
                return segment.Text.Substring(extractStart - segmentMin);
            if (endIsInsideSegment)
                return segment.Text.Substring(0, extractMax - segmentMin);

            return null;
        }
开发者ID:jamie-davis,项目名称:ConsoleTools,代码行数:27,代码来源:ColourString.cs


示例15: LoadWildcard

        private void LoadWildcard(string fileName)
        {
            lock (_LockObj)
            {
                _WildcardList = new List<WildcardInfo>();

                if (!System.IO.File.Exists(fileName))
                {
                    return;
                }

                Segment segment = new Segment();

                using (StreamReader sr = new StreamReader(fileName, Encoding.UTF8))
                {

                    while (!sr.EndOfStream)
                    {
                        string line = sr.ReadLine().Trim();

                        if (string.IsNullOrEmpty(line))
                        {
                            continue;
                        }

                        _WildcardList.Add(new WildcardInfo(line, segment, _Options, _Parameter));
                    }
                }

                _Init = true;
            }
        }
开发者ID:alinote,项目名称:Lucene.Net.Analysis.PanGu,代码行数:32,代码来源:Wildcard.cs


示例16: SubPath

 /// <summary> Creates a new subpath with the given start point and segments.
 /// 
 /// </summary>
 /// <param name="startX">x coordinate of the start point.
 /// </param>
 /// <param name="startY">y coordinate of the start point.
 /// </param>
 /// <param name="segments">the segments.
 /// </param>
 /// <param name="closed">defines is the subpath closed.
 /// </param>
 public SubPath(float startX, float startY, Segment[] segments, bool closed)
 {
     this.startX = startX;
     this.startY = startY;
     this.segments = segments;
     this.closed = closed;
 }
开发者ID:agustinsantos,项目名称:mogregis3d,代码行数:18,代码来源:SubPath.cs


示例17: Detail

        /// <summary>
        /// Subdivides long segments in ones of smaller length. 
        /// </summary>
        /// <param name="subSegmentLength">An approximate value indicating the length of the individual subsegment.
        /// The segment will be divided into an integer number of parts. 
        ///</param>
        public void Detail(double subSegmentLength)
        {
            List<Segment> detailedSegments = new List<Segment>();

            Vector2D currentPoint = SegmentList[0].StartPoint;
            for (int i = 0; i < SegmentList.Count; i++)
            {
                Segment segment = new Segment(currentPoint, SegmentList[i].EndPoint);
                double length = segment.Length;
                if (length < subSegmentLength / 2) {
                    currentPoint = segment.EndPoint;
                    continue;
                    }
                if (length < 2*subSegmentLength)
                {
                    detailedSegments.Add(segment);
                    currentPoint = segment.EndPoint;
                    continue;
                }

                detailedSegments.AddRange(Segment.Subdivide(segment, (int) Math.Round(length/subSegmentLength)));
                currentPoint = detailedSegments[detailedSegments.Count - 1].EndPoint;
            }

            SegmentList = detailedSegments;
        }
开发者ID:yong-ja,项目名称:starodyssey,代码行数:32,代码来源:PathFigure.cs


示例18: SweptTest

		public override void SweptTest(CollisionFunctor cf, Part partA, Part partB, Vector3 delta)
		{
			var a = (SpherePart)partA;
			var b = (CapsulePart)partB;

			Segment path;
			path.P1 = a.World.Center;
			Vector3.Add(ref path.P1, ref delta, out path.P2);

			Capsule cap = b.World;
			cap.Radius += a.World.Radius;
			Segment capSegment = new Segment(b.World.P1, b.World.P2);

			float k;
			Vector3 pa, pb, normal;
			cap.Intersect(ref path, out k, out pa);
			if (k <= 1f)
			{
				capSegment.ClosestPointTo(ref pa, out k, out pb);
				Vector3.Subtract(ref pa, ref pb, out normal);
				normal.Normalize();
				Vector3.Multiply(ref normal, b.World.Radius, out pa);
				Vector3.Add(ref pb, ref pa, out pb);
				Vector3.Multiply(ref normal, -a.World.Radius, out pa);
				Vector3.Add(ref a.World.Center, ref pa, out pa);

				cf.WritePoint(ref pa, ref pb, ref normal);
			}
		}
开发者ID:jdddog,项目名称:jengasimulatorp4p,代码行数:29,代码来源:SphereCapsule.cs


示例19: Start

 void Start()
 {
     sceneManager = FindObjectOfType<SceneManager>();
     serialData = FindObjectOfType<SerialData>();
     segment = GetComponentInParent<Segment>();
     thisCollider = GetComponent<Collider>();
 }
开发者ID:JoeJalbert,项目名称:e4-thesis-prototype,代码行数:7,代码来源:SegmentZone.cs


示例20: Trapezoid

 public Trapezoid(Vertex leftp, Vertex rightp, Segment top, Segment bottom)
 {
     Leftp = leftp;
     Rightp = rightp;
     Top = top;
     Bottom = bottom;
 }
开发者ID:PlastecProfiles,项目名称:ComputationalGeometry,代码行数:7,代码来源:Trapezoid.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Select类代码示例发布时间:2022-05-24
下一篇:
C# Seeker类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap