Exemple #1
0
        //if it's real-time creation, shape is locked by its owner.
        //if it's initial loading, we don't lock the shape,
        //lock requests will follow in this case
        public IVdShape PlayCreateShape(VdShapeType shapeType,
                                        int shapeId,
                                        int owner,
                                        double startX,
                                        double startY,
                                        bool takeCursor,
                                        // for badge creation events, it's false, as badges are created in private board
                                        int tag)
        {
            if (!_shapes.ContainsKey(shapeId))
            {
                //update id generator
                if (shapeType != VdShapeType.Badge)
                {
                    ShapeIdGenerator.Instance.CorrectLowBound(owner, shapeId);
                }

                IVdShape res = null;
                switch (shapeType)
                {
                case VdShapeType.Cluster:
                    res = new VdCluster(owner, shapeId, this, onClusterUncluster, OnClusterCleanup);
                    break;

                case VdShapeType.Text:
                    res = new VdText(startX, startY, owner, shapeId);
                    break;

                default:
                    res = DocTools.MakeShape(shapeType, owner, shapeId, startX, startY, tag);
                    break;
                }

                _shapePostHandler(res, shapeType);

                if (!_shapeVisibility)
                {
                    res.Hide();
                }

                this.Add(res);
                DocTools.SortScene(_scene);
                if (takeCursor)
                {
                    VolatileCtx.PlayTakeCursor(owner, shapeId);
                }
                return(res);
            }
            else
            {
                return(_shapes[shapeId]);
            }
        }
Exemple #2
0
        VdClusterLink PlayLinkCreate(ClientLinkable end1, ClientLinkable end2,
                                     int shapeId, int initOwnerId, bool takeCursor)
        {
            ShapeIdGenerator.Instance.CorrectLowBound(initOwnerId, shapeId);
            var res = new VdClusterLink(end1, end2, shapeId, initOwnerId);

            end1.AddEdge(res);
            end2.AddEdge(res);
            //no post handler for cluster link
            this.Add(res);
            DocTools.SortScene(_scene);
            //no initial lock, as link is created in free state (no pressed buttons)
            return(res);
        }
Exemple #3
0
        private VdClusterLink PlayLinkCreate(ClientLinkable end1, ClientLinkable end2,
                                             int shapeId, int initOwnerId, bool takeCursor,
                                             LinkHeadType linkHead)
        {
            ShapeIdGenerator.Instance.CorrectLowBound(initOwnerId, shapeId);
            var res = new VdClusterLink(end1, end2, shapeId, initOwnerId, this, linkHead);

            _shapePostHandler(res, VdShapeType.ClusterLink);
            end1.AddEdge(res);
            end2.AddEdge(res);

            if (!_shapeVisibility)
            {
                res.Hide();
            }

            //no post handler for cluster link

            this.Add(res);

            DocTools.SortScene(_scene);
            //no initial lock, as link is created in free state (no pressed buttons)
            return(res);
        }