Example #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]);
            }
        }
Example #2
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];
            }
        }