Exemplo n.º 1
0
        public void AddPoint(TPoint lcp, LinePointAdditionMethod method)
        {
            if (lcp != null)
            {
                AddPointComponent comp = new AddPointComponent();
                comp.lcp        = lcp;
                comp.collection = new LinePointCollection <TPoint>(linePoint);
                switch (method)
                {
                case LinePointAdditionMethod.last:
                {
                    comp.strategy = new AddPointStrategyLast();
                    break;
                }

                case LinePointAdditionMethod.first:
                {
                    comp.strategy = new AddPointStrategyFirst();
                    break;
                }
                }
                comp.Build();

                linePoint.Add(lcp);

                Sphere sphere = new Sphere();
                sphere.r      = r;
                sphere.color  = colorManager.spline;
                sphere.center = lcp.vert.q;
                AddPrimitive(sphere);
            }
        }
Exemplo n.º 2
0
        public override void AddVertex(SplineLinePoint lcp, LinePointAdditionMethod method)
        {
            if (lcp == null)
            {
                return;
            }

            if (!ConfirmCollection())
            {
                return;
            }

            if (lcp is SplineSegmentLinePoint)
            {
                SplineSegmentLinePoint lcpNew = lcp as SplineSegmentLinePoint;

                AddPointComponent component = new AddPointComponent();
                component.lcp        = lcpNew;
                component.collection = new LinePointCollection <SplineSegmentLinePoint>(_point);
                switch (method)
                {
                case LinePointAdditionMethod.last:
                {
                    component.strategy = new AddPointStrategyLast();
                    break;
                }

                case LinePointAdditionMethod.first:
                {
                    component.strategy = new AddPointStrategyFirst();
                    break;
                }

                case LinePointAdditionMethod.intoSpline:
                {
                    component.strategy = new AddPointStrategyIntoSpline();
                    break;
                }

                default:
                {
                    break;
                }
                }
                component.Build();

                if ((!component.Complite()) & (_point.Count > 1))
                {
                    return;
                }

                _point.Add(lcpNew);

                AddSegment(lcpNew);
            }
        }
Exemplo n.º 3
0
 protected override void AddVertexIntoCollection(LinePointSegmentSpline lcp, LinePointAdditionMethod method)
 {
     if (lcp != null)
     {
         if (method == LinePointAdditionMethod.intoSpline)
         {
             AddPointComponent comp = new AddPointComponent();
             comp.lcp        = lcp;
             comp.collection = new LinePointCollection <LinePointSegmentSpline>(pointList);
             comp.strategy   = new AddPointStrategyIntoSpline();
             comp.Build();
         }
         else
         {
             base.AddVertexIntoCollection(lcp, method);
         }
     }
 }
Exemplo n.º 4
0
        protected virtual void AddVertexIntoCollection(TPoint lcp, LinePointAdditionMethod method)
        {
            AddPointComponent comp = new AddPointComponent();

            comp.collection = new LinePointCollection <TPoint>(pointList);
            comp.lcp        = lcp;
            switch (method)
            {
            case LinePointAdditionMethod.last:
            {
                comp.strategy = new AddPointStrategyLast();
                break;
            }

            case LinePointAdditionMethod.first:
            {
                comp.strategy = new AddPointStrategyFirst();
                break;
            }
            }
            comp.Build();
        }