예제 #1
0
        public WebStack(ScatterView sv, Point origin, WebGroup gr, String group, KnowledgeWeb knowledge, LADSArtworkMode.ArtworkModeWindow art, int g)
        {
            groupNo = g;
            artwork = art;
            kw = knowledge;
            _sv = sv;
            _images = gr.getGroupBitmap(group);
            if (_images == null)
                return;

            foreach (BitmapImage i in _images)
            {
                ScatterViewItem svi = new ScatterViewItem();
                svi.MinHeight = 1;
                svi.MinWidth = 1;
                Image img = new Image();
                img.Source = i;

                sviContent content = new sviContent();
                content.g = new Grid();
                content.g.Height = INITIAL_THUMB_HEIGHT;
                content.g.Width = INITIAL_THUMB_HEIGHT;

                content.im = img;

                content.r = new Rectangle();
                content.r.Height = INITIAL_THUMB_HEIGHT;
                content.r.Width = INITIAL_THUMB_HEIGHT;
                content.r.Visibility = Visibility.Collapsed;

                content.g.Children.Add(content.r);
                content.g.Children.Add(content.im);

                content.used = false;

                svi.Content = content.g;
                svi.Tag = content;

                svi.Height = INITIAL_THUMB_HEIGHT;
                svi.Width = INITIAL_THUMB_HEIGHT;
                svi.Orientation = 0;
                svi.CanRotate = false;
                svi.CanMove = false;
                svi.CanScale = false;
                svi.PreviewTouchUp += new EventHandler<System.Windows.Input.TouchEventArgs>(svi_PreviewTouchUp);
                svi.PreviewTouchDown += new EventHandler<TouchEventArgs>(svi_PreviewTouchDown);
                svi.SizeChanged += new SizeChangedEventHandler(svi_SizeChanged);

                knowledge.sviList.Add(svi);

                _svis.Add(svi);
                _sv.Items.Add(svi);
            }

            PositionScatterViewItems(origin);
        }
        Dictionary<String, List<WebGroup>> _searchKeywords = new Dictionary<string, List<WebGroup>>(); //Keywords to WebGroups

        #endregion Fields

        #region Constructors

        public FloatingSearchBox(List<WebGroup> allGroups, KnowledgeWeb newW)
        {
            InitializeComponent();
            w = newW;
            GroupList.AddRange(allGroups);

            foreach (WebGroup g in allGroups)
            {
                foreach (String k in g.Keywords())
                {
                    List<WebGroup> r = null;
                    if (!_searchKeywords.TryGetValue(k, out r))
                    {
                        r = new List<WebGroup>();
                        _searchKeywords.Add(k, r);
                    }

                    r.Add(g);
                }
            }
        }
예제 #3
0
        public SingleWeb(ScatterView parent, double xStart, double yStart, int index, double sides, List<Image> ims, Image main, int group, Canvas lineCanvas, String fileName, KnowledgeWeb web, string path, WebGroup g, LADSArtworkMode.ArtworkModeWindow art)
        {
            artwork = art;
            webGroup = g;

            filePath = path;

            kw = web;

            file = fileName;

            centerX = xStart;
            centerY = yStart;

            groupNo = group;
            vertIndex = index;

            int counter = 0;

            mainArtwork.Content = mainGrid;

            mainArtwork.Center = new Point(xStart, yStart);
            mainArtwork.MinHeight = 1;
            mainArtwork.MinWidth = 1;
            mainArtwork.SizeChanged += new SizeChangedEventHandler(mainArtwork_SizeChanged);
            mainArtwork.PreviewTouchDown += new EventHandler<TouchEventArgs>(mainArtwork_PreviewTouchDown);
            mainArtwork.PreviewTouchUp += new EventHandler<TouchEventArgs>(mainArtwork_PreviewTouchUp);
            mainArtwork.PreviewTouchMove += new EventHandler<TouchEventArgs>(mainArtwork_PreviewTouchMove);
            double xDist = sides * 0.4;
            double yDist = sides * 0.4;

            mainArtwork.Width = xDist;
            mainArtwork.Height = yDist;

            kw.sviList.Add(mainArtwork);

            main.Width = mainArtwork.Width - 10;
            main.Height = mainArtwork.Height - 10;
            mainIm = main;

            WebStack.sviContent content = new WebStack.sviContent();
            content.g = mainGrid;
            content.im = main;
            content.r = mainRect;

            content.r.Width = main.ActualWidth + 10;
            content.r.Height = main.ActualHeight + 10;
            content.r.Visibility = Visibility.Collapsed;
            content.r.Fill = Brushes.Green;

            content.g.Children.Add(content.r);
            content.g.Children.Add(content.im);

            content.used = false;

            mainArtwork.Tag = content;

            startHeight = mainArtwork.Height;
            startWidth = mainArtwork.Width;

            mainArtwork.CanRotate = false;
            mainArtwork.Orientation = 0;

            DependencyPropertyDescriptor dpd1 = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
            dpd1.AddValueChanged(mainArtwork, ScatterviewMainChanged);

            parent.Items.Add(mainArtwork);

            String[] enumerate = { "A", "B", "C", "D" };

            for(int j = 0; j < group; j++)
            {
                Image i = ims[j];
                groupArtwork current = new groupArtwork();
                current.sv = new ScatterViewItem();
                current.sv.MinHeight = 1;
                current.sv.MinWidth = 1;
                current.groupGrid = new Grid();

                current.sv.Width = sides * 0.05;
                current.sv.Height = sides * 0.05;
                current.angle = 225 + counter * 90;
                current.sv.Center = new Point(xStart + Math.Cos((current.angle/180.0)*Math.PI) * xDist, yStart + Math.Sin((current.angle/180.0)*Math.PI)*yDist);
                current.sv.CanRotate = false;
                current.sv.Orientation = 0;
                //current.sv.SizeChanged += new SizeChangedEventHandler(sv_SizeChanged);
                //current.sv.PreviewTouchDown += new EventHandler<TouchEventArgs>(sv_TouchDown);
                //current.sv.PreviewTouchUp += new EventHandler<TouchEventArgs>(sv_PreviewTouchUp);
                //current.sv.PreviewTouchMove += new EventHandler<TouchEventArgs>(sv_PreviewTouchMove);

                timerAndRect temp2 = new timerAndRect();
                temp2.rect = new Rectangle();
                i.Height = current.sv.Height - 10;
                i.Width = current.sv.Width - 10;
                temp2.ind = counter+1;

                temp2.rect.Height = i.ActualHeight + 10;
                temp2.rect.Width = i.ActualWidth + 10;

                current.sv.Tag = temp2;

                current.sv.Content = current.groupGrid;
                current.groupGrid.Children.Add(temp2.rect);
                current.groupGrid.Children.Add(i);
                current.im = i;

                DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem));
                //dpd.AddValueChanged(current.sv, ScatterViewCenterChanged);

                current.st = new WebStack(parent, current.sv.Center, webGroup, enumerate[j],kw,artwork,j);

                //parent.Items.Add(current.sv);

                groupList.Add(current);
                counter++;
            }

            height = sides;
            width = sides;
            parentScatter = parent;
        }
 internal ItemSelectedArgs(WebGroup grp, KnowledgeWeb w)
 {
     SelectedGroup = grp;
     w.addGroup(grp);
 }