public VdBadge(System.IO.BinaryReader r, int owner, int shapeId, int argPtId) : base(owner, shapeId) { _argPtId = argPtId; _endpoint = new ClientClusterable(shapeId, boundsProvider); init(DaoUtils.UserIdToColor(owner)); }
//called only locally private void onClusterUncluster(ClientCluster cluster, ClientClusterable badge, bool plus, bool playImmidiately) { if (plus) { //cluster must exist clusterRebuildPending = true; _rt.clienRt.SendClusterBadgeRequest(badge.GetId(), cluster.GetId(), _palette.GetOwnerId(), TopicId, playImmidiately, -1); } else { //server checks if affected clsuter is empty clusterRebuildPending = true; _rt.clienRt.SendUnclusterBadgeRequest(badge.GetId(), cluster.GetId(), TopicId, _palette.GetOwnerId(), playImmidiately, -1); } }
public VdBadge(System.IO.BinaryReader r, int owner, int shapeId, int argPtId): base(owner, shapeId) { _argPtId = argPtId; _endpoint = new ClientClusterable(shapeId, boundsProvider); init(DaoUtils.UserIdToColor(owner)); }
public VdBadge(double x, double y, int owner, int shapeId, int argPtId) : base(owner, shapeId) { _argPtId = argPtId; _endpoint = new ClientClusterable(shapeId, boundsProvider); init(DaoUtils.UserIdToColor(owner)); setBadgePos(x, y); }
public VdBadge(double x, double y, int owner, int shapeId, int argPtId): base(owner, shapeId) { _argPtId = argPtId; _endpoint = new ClientClusterable(shapeId, boundsProvider); init(DaoUtils.UserIdToColor(owner)); setBadgePos(x, y); }
public void Add(ClientClusterable badge) { if (_badges.Contains(badge)) { throw new NotSupportedException("duplicate cluster entry"); } _badges.Add(badge); badge.Cluster(GetId()); }
//returns true if badge is probably inside cluster. //returns false if badge cannot be inside bool CoarseHitTest(ClientClusterable badge) { if (bezierBorder.Data == null) { return(true); } var borders = bezierBorder.Data.Bounds; borders.Offset(_offset.X, _offset.Y); return(borders.IntersectsWith(badge.GetBounds())); }
//called only locally void onClusterUncluster(ClientCluster cluster, ClientClusterable badge, bool plus, bool playImmidiately) { if (plus) { //cluster must exist clusterRebuildPending = true; _rt.clienRt.SendClusterBadgeRequest(badge.GetId(), cluster.GetId(), _palette.GetOwnerId(), TopicId, playImmidiately, -1); } else { //server checks if affected clsuter is empty clusterRebuildPending = true; _rt.clienRt.SendUnclusterBadgeRequest(badge.GetId(), cluster.GetId(), TopicId, _palette.GetOwnerId(), playImmidiately, -1); } }
public void Remove(ClientClusterable badge) { _badges.Remove(badge); badge.Uncluster(); }
//returns true if badge is probably inside cluster. //returns false if badge cannot be inside private bool CoarseHitTest(ClientClusterable badge) { if (bezierBorder.Data == null) return true; var borders = bezierBorder.Data.Bounds; borders.Offset(_offset.X, _offset.Y); return borders.IntersectsWith(badge.GetBounds()); }
//PRODUCER //if badge is not in any cluster and new bounds are fuzzily inside the cluster, then include //the badge into the cluster and rebuild cluster hull public void ClusterableMoved(ClientClusterable badge) { if (badge.Busy) return; //hull doesn't exist if (convexHull.Points.Count <= 2) return; var contents = GetBadgeList(convexHull.Points.ToList()); var added = contents.Except(_endpoint.GetClusterables()); var removed = _endpoint.GetClusterables().Except(contents); foreach (var a in added) { if (a.Busy) continue; if (a.IsInCluster()) continue; a.SetBusy(); _onClusterUncluster(GetCluster(), a, true, /*a == added.Last()*/true); } foreach (var r in removed) { if (r.Busy) continue; if (!r.IsInCluster()) continue; r.SetBusy(); _onClusterUncluster(GetCluster(), r, false, /*r == removed.Last()*/true); } ////moved shape is in cluster, but not in our one //if (badge.IsInCluster() && badge.ClusterId!= Id()) // return; ////if (!CoarseHitTest(badge)) //// return; //var willBeInTheCluster = ShapeUtils.FuzzyInside(badge.GetBounds(), convexHull.Points.ToList()); //var nowInTheCluster = badge.ClusterId == Id(); ////send cluster edit operation //if (nowInTheCluster && !willBeInTheCluster) //{ // badge.SetBusy(); // _onClusterUncluster(GetCluster(), badge, true, true); //} //else if (!nowInTheCluster && willBeInTheCluster) //{ // badge.SetBusy(); // _onClusterUncluster(GetCluster(), badge, false, true); //} //if (nowInTheCluster != willBeInTheCluster) //{ // badge.SetBusy(); // var contents = GetBadgeList(convexHull.Points.ToList()); // var added = contents.Except(_endpoint.GetClusterables()); // var removed = _endpoint.GetClusterables().Except(contents); // foreach (var a in added) // { // _onClusterUncluster(GetCluster(), a, true, true); // } // foreach (var r in removed) // _onClusterUncluster( GetCluster(), r, false, true); //} }
//PRODUCER //if badge is not in any cluster and new bounds are fuzzily inside the cluster, then include //the badge into the cluster and rebuild cluster hull public void ClusterableMoved(ClientClusterable badge) { if (badge.Busy) { return; } //hull doesn't exist if (convexHull.Points.Count <= 2) { return; } var contents = GetBadgeList(convexHull.Points.ToList()); var added = contents.Except(_endpoint.GetClusterables()); var removed = _endpoint.GetClusterables().Except(contents); foreach (var a in added) { if (a.Busy) { continue; } if (a.IsInCluster()) { continue; } a.SetBusy(); _onClusterUncluster(GetCluster(), a, true, /*a == added.Last()*/ true); } foreach (var r in removed) { if (r.Busy) { continue; } if (!r.IsInCluster()) { continue; } r.SetBusy(); _onClusterUncluster(GetCluster(), r, false, /*r == removed.Last()*/ true); } ////moved shape is in cluster, but not in our one //if (badge.IsInCluster() && badge.ClusterId!= Id()) // return; ////if (!CoarseHitTest(badge)) //// return; //var willBeInTheCluster = ShapeUtils.FuzzyInside(badge.GetBounds(), convexHull.Points.ToList()); //var nowInTheCluster = badge.ClusterId == Id(); ////send cluster edit operation //if (nowInTheCluster && !willBeInTheCluster) //{ // badge.SetBusy(); // _onClusterUncluster(GetCluster(), badge, true, true); //} //else if (!nowInTheCluster && willBeInTheCluster) //{ // badge.SetBusy(); // _onClusterUncluster(GetCluster(), badge, false, true); //} //if (nowInTheCluster != willBeInTheCluster) //{ // badge.SetBusy(); // var contents = GetBadgeList(convexHull.Points.ToList()); // var added = contents.Except(_endpoint.GetClusterables()); // var removed = _endpoint.GetClusterables().Except(contents); // foreach (var a in added) // { // _onClusterUncluster(GetCluster(), a, true, true); // } // foreach (var r in removed) // _onClusterUncluster( GetCluster(), r, false, true); //} }