Пример #1
0
        public void AddObjectToSelection(ObjectInstance obj)
        {
            foreach (SelectedObjectRecord instRecord in _selectedObjects)
            {
                if (instRecord.Instance == obj)
                {
                    return;
                }
            }

            SelectedObjectRecord record = new SelectedObjectRecord()
            {
                Instance = obj,
                Annot    = new SelectionAnnot(obj.ImageBounds.Location)
                {
                    End         = new Point(obj.ImageBounds.Right, obj.ImageBounds.Bottom),
                    Fill        = SelectedAnnotFill,
                    Outline     = SelectedAnnotOutline,
                    OutlineGlow = SelectedAnnotOutlineGlow,
                },
                OriginAnnot = new GripAnnot(obj.Position, 3)
                {
                    Fill     = SelectedAnnotOriginFill,
                    FillGlow = SelectedAnnotOriginFillGlow,
                },
                InitialLocation = new Point(obj.X, obj.Y),
            };

            obj.PositionChanged += InstancePositionChanged;
            obj.RotationChanged += InstanceRotationChanged;

            _selectedObjects.Add(record);

            AddAnnotation(record.Annot);
            AddAnnotation(record.OriginAnnot);

            OnSelectionChanged(EventArgs.Empty);
        }
Пример #2
0
        public void AddObjectToSelection(ObjectInstance obj)
        {
            foreach (SelectedObjectRecord instRecord in _selectedObjects)
                if (instRecord.Instance == obj)
                    return;

            SelectedObjectRecord record = new SelectedObjectRecord() {
                Instance = obj,
                Annot = new SelectionAnnot(obj.ImageBounds.Location) {
                    End = new Point(obj.ImageBounds.Right, obj.ImageBounds.Bottom),
                    Fill = SelectedAnnotFill,
                    Outline = SelectedAnnotOutline,
                    OutlineGlow = SelectedAnnotOutlineGlow,
                },
                OriginAnnot = new GripAnnot(obj.Position, 3) {
                    Fill = SelectedAnnotOriginFill,
                    FillGlow = SelectedAnnotOriginFillGlow,
                },
                InitialLocation = new Point(obj.X, obj.Y),
            };

            obj.PositionChanged += InstancePositionChanged;
            obj.RotationChanged += InstanceRotationChanged;

            _selectedObjects.Add(record);

            AddAnnotation(record.Annot);
            AddAnnotation(record.OriginAnnot);

            OnSelectionChanged(EventArgs.Empty);
        }