Example #1
0
        public override void OnActivate()
        {
            base.OnActivate();
            GetOptions();

            _view  = null;
            _index = -1;

            InitSession();

            var firstPoint   = new SortedDictionary <int, Point3D>();
            var secondPoint  = new SortedDictionary <int, Point3D>();
            var root         = Document.Root;
            var shapeIndexes = root.Get <DocumentContextInterpreter>().ShapeManager.ShapeIndexes;

            foreach (var shapeIndex in shapeIndexes)
            {
                var builder = new NodeBuilder(root[shapeIndex]);
                if (builder.FunctionName != FunctionNames.LineTwoPoints)
                {
                    continue;
                }
                firstPoint[shapeIndex]  = builder[0].RefTransformedPoint3D;
                secondPoint[shapeIndex] = builder[1].RefTransformedPoint3D;
            }

            InitSession();
            var list = new List <int>();

            list.AddRange(firstPoint.Keys);
            _listCommonPoints = new List <CombinedLinesClassInfo>();
            for (var i = 0; i < list.Count - 1; i++)
            {
                for (var j = i + 1; j < list.Count; j++)
                {
                    var commonPoint = CommonLinePoint(firstPoint, secondPoint, list[i], list[j]);
                    if (commonPoint == null)
                    {
                        continue;
                    }
                    DrawPreviewPoint((Point3D)commonPoint);
                    var commonInfo = new CombinedLinesClassInfo((Point3D)commonPoint,
                                                                new NodeBuilder(root[list[i]]),
                                                                new NodeBuilder(root[list[j]]));
                    _listCommonPoints.Add(commonInfo);
                }
            }
            if (_listCommonPoints.Count != 0)
            {
                return;
            }
            NaroMessage.Show("There are no lines with common points! Exiting");
            BackToNeutralModifier();
        }
Example #2
0
        protected override void OnMouseDownAction(Mouse3DPosition mouseData)
        {
            _index = GetSplineIndex(mouseData);
            if (_index == -1)
            {
                RibbonPanel.Children.Clear();
                return;
            }
            InitSession();
            if (_view != null)
            {
                return;
            }
            var angle = _listCommonPoints[_index].Angle;

            _view = new LineSetAngleView(angle / Math.PI * 180);

            _view.Changed += Changed;
            _view.Closed  += ViewClosed;
            RibbonPanel.Children.Add(_view);
        }