private void AttributeTransformationViewModelMoved(object sender, AttributeTransformationViewModelEventArgs e)
        {
            IGeometry mainPageBounds = e.Bounds.GetPolygon();
            var       hits           = new List <AttributeTransformationViewModelEventHandler>();
            var       tt             = InkableScene.GetDescendants().OfType <AttributeTransformationViewModelEventHandler>().ToList();

            foreach (var element in tt)
            {
                var geom = element.BoundsGeometry;
                if ((geom != null) && mainPageBounds.Intersects(geom))
                {
                    hits.Add(element);
                }
            }

            var ops = InkableScene.GetDescendants().OfType <OperationContainerView>().ToList();

            foreach (var element in ops)
            {
                var geom = element.Geometry;
                if ((geom != null) && (mainPageBounds.Distance(geom) < 100))
                {
                    foreach (var a in (element.DataContext as OperationViewModel).AttachementViewModels)
                    {
                        if (a.ShowOnAttributeMove)
                        {
                            a.ActiveStopwatch.Restart();
                        }
                    }
                }
            }

            var orderderHits = hits.OrderBy(fe => (fe.BoundsGeometry.Centroid.GetVec() - e.Bounds.Center.GetVec()).LengthSquared).ToList();

            foreach (var element in InkableScene.GetDescendants().OfType <AttributeTransformationViewModelEventHandler>())
            {
                element.AttributeTransformationViewModelMoved(
                    sender as AttributeTransformationViewModel, e,
                    (hits.Count() > 0) && (orderderHits[0] == element));
            }
        }
        private void AttributeTransformationViewModelDropped(object sender, AttributeTransformationViewModelEventArgs e)
        {
            IGeometry mainPageBounds = e.Bounds.GetPolygon();
            var       hits           = new List <AttributeTransformationViewModelEventHandler>();

            foreach (var element in InkableScene.GetDescendants().OfType <AttributeTransformationViewModelEventHandler>())
            {
                var geom = element.BoundsGeometry;
                if ((geom != null) && mainPageBounds.Intersects(geom))
                {
                    hits.Add(element);
                }
            }

            var width    = OperationViewModel.WIDTH;
            var height   = OperationViewModel.HEIGHT;
            var size     = new Vec(width, height);
            var position = (Pt) new Vec(e.Bounds.Center.X, e.Bounds.Center.Y) - size / 2.0;

            var orderderHits = hits.OrderBy(fe => (fe.BoundsGeometry.Centroid.GetVec() - e.Bounds.Center.GetVec()).LengthSquared).ToList();

            foreach (var element in InkableScene.GetDescendants().OfType <AttributeTransformationViewModelEventHandler>())
            {
                element.AttributeTransformationViewModelDropped(
                    sender as AttributeTransformationViewModel, e,
                    (hits.Count() > 0) && (orderderHits[0] == element));
            }

            if (!hits.Any())
            {
                var operationContainerView      = new OperationContainerView();
                var histogramOperationViewModel = CreateDefaultHistogramOperationViewModel(e.AttributeTransformationModel.AttributeModel, position);
                histogramOperationViewModel.Size   = size;
                operationContainerView.DataContext = histogramOperationViewModel;
                InkableScene.Add(operationContainerView);
            }
        }