Exemple #1
0
        public static Dictionary<byte, object> WriteBadgeViews(UserCursor cursor,
                                                               SharedView[] badgeViews)
        {
            //serialize badge geometry 
            // number of badges 
            // array of x's  
            // array of y's 
            // array of orientations
            // array of Ids (DB Ids of points)
            double[] Xs = new double[badgeViews.Length];
            double[] Ys = new double[badgeViews.Length];
            double[] Orientations = new double[badgeViews.Length];
            bool[] ViewTypes = new bool[badgeViews.Length];
            int[] Ids = new int[badgeViews.Count()];

            for (int i = 0; i < badgeViews.Count(); ++i)
            {
                Xs[i] = badgeViews[i].badgeGeometry.CenterX;
                Ys[i] = badgeViews[i].badgeGeometry.CenterY;
                Orientations[i] = badgeViews[i].badgeGeometry.Orientation;
                ViewTypes[i] = badgeViews[i].viewType;
                Ids[i] = badgeViews[i].ViewId;
            }
            Dictionary<byte, object> data = new Dictionary<byte, object>();
            data.Add((byte) DiscussionParamKey.NumArrayEntries, badgeViews.Length);
            data.Add((byte) DiscussionParamKey.ArrayOfX, Xs);
            data.Add((byte) DiscussionParamKey.ArrayOfY, Ys);
            data.Add((byte) DiscussionParamKey.ArrayOfOrientations, Orientations);
            data.Add((byte) DiscussionParamKey.ArrayOfIds, Ids);
            data.Add((byte) DiscussionParamKey.ArrayOfViewTypes, ViewTypes);
            data.Add((byte) DiscussionParamKey.UserCursorName, cursor.Name);
            data.Add((byte) DiscussionParamKey.UserCursorState, (int) cursor.State);

            return data;
        }