コード例 #1
0
ファイル: CursorMgr.cs プロジェクト: gdlprj/duscusys
        public CursorMgr(VdDocument doc, IPaletteOwner palette)
        {
            _doc = doc;
            _palette = palette;

            setListeners(true);
        }
コード例 #2
0
        public CursorMgr(VdDocument doc, IPaletteOwner palette)
        {
            _doc     = doc;
            _palette = palette;

            setListeners(true);
        }
コード例 #3
0
        //IVdShape
        public static object DetectSelectedShape(VdDocument doc, Point pos,
                                                 TouchDevice d,
                                                 out Shape resizeNode)
        {
            resizeNode = null;

            HitTestResult htr = VisualTreeHelper.HitTest(doc.Scene, pos);

            if (htr == null)
            {
                return(null);
            }

            var cluster = ShapeHitTester.findVdCluster(htr.VisualHit);

            if (cluster != null)
            {
                return(cluster);
            }

            var text = ShapeHitTester.findVdText(htr.VisualHit);

            if (text != null)
            {
                return(text);
            }

            var badge = ShapeHitTester.findVdBadge(htr.VisualHit);

            if (badge != null)
            {
                return(badge);
            }

            var img = ShapeHitTester.findVdImg(htr.VisualHit);

            if (img != null)
            {
                return(img);
            }

            //is it resize node?
            resizeNode = htr.VisualHit as Shape;
            if (resizeNode != null)
            {
                var vdShape = resizeNode.Tag as IVdShape;
                if (vdShape != null && vdShape.IsVisible())
                {
                    return(vdShape);
                }
            }

            //empty area, find nearest shape
            return(NearestShape(doc, pos));
        }
コード例 #4
0
        public static bool IsPaletteHit(VdDocument doc, Point pos)
        {
            HitTestResult htr = VisualTreeHelper.HitTest(doc.Scene, pos);

            if (htr == null)
            {
                return(false);
            }
            Ellipse paletteEllipse = htr.VisualHit as Ellipse;

            return(paletteEllipse != null);
        }
コード例 #5
0
ファイル: VdCluster.cs プロジェクト: gdlprj/duscusys
        //ctor for drawing
        public VdCluster(int owner, int shapeId,
            VdDocument doc,
            OnClusterUncluster onClusterUncluster,
            OnClusterCleanup OnClusterCleanup)
            : base(owner, shapeId)
        {
            _doc = doc;

            _endpoint = new ClientCluster(shapeId, boundsProvider);

            _onClusterUncluster = onClusterUncluster;

            _OnClusterCleanup = OnClusterCleanup;

            init(DaoUtils.UserIdToColor(owner));
        }
コード例 #6
0
        //ctor for drawing
        public VdCluster(int owner, int shapeId,
                         VdDocument doc,
                         OnClusterUncluster onClusterUncluster,
                         OnClusterCleanup OnClusterCleanup) :
            base(owner, shapeId)
        {
            _doc = doc;

            _endpoint = new ClientCluster(shapeId, boundsProvider);

            _onClusterUncluster = onClusterUncluster;

            _OnClusterCleanup = OnClusterCleanup;

            init(DaoUtils.UserIdToColor(owner));
        }
コード例 #7
0
        public SceneManager(Canvas scene, DistributedInkCanvas ink, Palette palette, InkPalette inkPalette,
                            int topicId, int discussionId, bool shapeVisibility)
        {
            _scene   = scene;
            _palette = palette;

            _ink        = ink;
            _inkPalette = inkPalette;

            //non-NaN palette coords
            Canvas.SetLeft(_palette, 200);
            Canvas.SetTop(_palette, 200);

            _doc = new VdDocument(palette, scene, ShapePostCtor, topicId, discussionId, shapeVisibility);

            inkPalette.Init(FinishFreeDrawing, ink);

            setListeners(true);
        }
コード例 #8
0
ファイル: SceneManager.cs プロジェクト: gdlprj/duscusys
        public SceneManager(Canvas scene, DistributedInkCanvas ink, Palette palette, InkPalette inkPalette,
            int topicId, int discussionId, bool shapeVisibility)
        {
            _scene = scene;
            _palette = palette;

            _ink = ink;
            _inkPalette = inkPalette;

            //non-NaN palette coords
            Canvas.SetLeft(_palette, 200);
            Canvas.SetTop(_palette, 200);

            _doc = new VdDocument(palette, scene, ShapePostCtor, topicId, discussionId, shapeVisibility);

            inkPalette.Init(FinishFreeDrawing, ink);

            setListeners(true);
        }
コード例 #9
0
ファイル: SceneManager.cs プロジェクト: gdlprj/duscusys
        public SceneManager(Canvas scene, DistributedInkCanvas ink, Palette palette, InkPalette inkPalette,
                            int topicId, int discussionId)
        {
            _scene = scene;
            _palette = palette;

            _ink = ink;
            _inkPalette = inkPalette;

            //non-NaN palette coords
            Canvas.SetLeft(_palette, 200);
            Canvas.SetTop(_palette, 200);

            _doc = new VdDocument(palette, scene, ShapePostCtor, topicId, discussionId);
            _doc.VolatileCtx.localCursorChanged += localCursorChanged;

            _ink.OnInkChanged += OnLocalInkChanged;
            inkPalette.Init(finishFreeDrawing);

            setListeners(true);
        }
コード例 #10
0
        public SceneManager(Canvas scene, DistributedInkCanvas ink, Palette palette, InkPalette inkPalette,
                            int topicId, int discussionId)
        {
            _scene   = scene;
            _palette = palette;

            _ink        = ink;
            _inkPalette = inkPalette;

            //non-NaN palette coords
            Canvas.SetLeft(_palette, 200);
            Canvas.SetTop(_palette, 200);

            _doc = new VdDocument(palette, scene, ShapePostCtor, topicId, discussionId);
            _doc.VolatileCtx.localCursorChanged += localCursorChanged;

            _ink.OnInkChanged += OnLocalInkChanged;
            inkPalette.Init(finishFreeDrawing);

            setListeners(true);
        }
コード例 #11
0
        private static IVdShape NearestShape(VdDocument doc, Point point)
        {
            IVdShape res     = null;
            double   minDist = double.MaxValue;

            foreach (var sh in doc.GetShapes())
            {
                if (!sh.IsVisible())
                {
                    continue;
                }

                if (sh.ShapeCode() == VdShapeType.Badge)
                {
                    continue;
                }

                double d_i = sh.distToFigure(point);

                if (sh.ShapeCode() == VdShapeType.Arrow)
                {
                    d_i /= 2.0;
                }

                if (d_i < minDist)
                {
                    minDist = d_i;
                    res     = sh;
                }
            }

            const double MAX_NEIGHBOURHOOD = 70;

            if (minDist > MAX_NEIGHBOURHOOD)
            {
                res = null;
            }

            return(res);
        }
コード例 #12
0
        public VdClusterLink(ClientLinkable end1, ClientLinkable end2,
                             int shapeId, int owner,
                             VdDocument doc,
                             LinkHeadType headType) :
            base(owner, shapeId)
        {
            _doc = doc;

            _end1 = end1;
            _end2 = end2;

            _headType = headType;

            initLine(DaoUtils.UserIdToColor(owner), headType);

            //wait until actual size is set
            line.Dispatcher.BeginInvoke(new Action(() => { NotifyLinkableMoved(); }),
                                        System.Windows.Threading.DispatcherPriority.Background);

            RemoveFocus();
            updateUserCursor();
        }
コード例 #13
0
ファイル: VdClusterLink.cs プロジェクト: gdlprj/duscusys
        public VdClusterLink(ClientLinkable end1, ClientLinkable end2,
            int shapeId, int owner,
            VdDocument doc,
            LinkHeadType headType)
            : base(owner, shapeId)
        {
            _doc = doc;

            _end1 = end1;
            _end2 = end2;

            _headType = headType;

            initLine(DaoUtils.UserIdToColor(owner), headType);

            //wait until actual size is set
            line.Dispatcher.BeginInvoke(new Action(() => { NotifyLinkableMoved(); }),
                                        System.Windows.Threading.DispatcherPriority.Background);

            RemoveFocus();
            updateUserCursor();
        }
コード例 #14
0
ファイル: DocTools.cs プロジェクト: z-saffarpour/duscusys
        static IVdShape NearestShape(VdDocument doc, Point point)
        {
            IVdShape res     = null;
            double   minDist = double.MaxValue;

            foreach (var sh in doc.GetShapes())
            {
                double d_i = sh.distToFigure(point);
                if (d_i < minDist)
                {
                    minDist = d_i;
                    res     = sh;
                }
            }

            const double MAX_NEIGHBOURHOOD = 150;

            if (minDist > MAX_NEIGHBOURHOOD)
            {
                res = null;
            }

            return(res);
        }
コード例 #15
0
ファイル: ShapeHitTester.cs プロジェクト: gdlprj/duscusys
 public static bool IsPaletteHit(VdDocument doc, Point pos)
 {
     HitTestResult htr = VisualTreeHelper.HitTest(doc.Scene, pos);
     if (htr == null)
         return false;
     Ellipse paletteEllipse = htr.VisualHit as Ellipse;
     return paletteEllipse != null;
 }