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); }
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; }
public KnowledgeWeb(Canvas c, double height, double width, String fileName, LADSArtworkMode.ArtworkModeWindow window) { artwork = window; centerStartX = width * 1.5; centerStartY = height * 1.5; screenW = (int)width; screenH = (int)height; sides = Math.Max(width / 3,15); //first scatterview where the large scatterview item lives canvasH = height; canvasW = width; topCanvas = c; c.ClipToBounds = false; topScatter.Height = canvasH *3; topScatter.Width = canvasW *3; topCanvas.Children.Add(topScatter); Canvas.SetLeft(topScatter, -canvasW); Canvas.SetTop(topScatter, -canvasH); hudScatter.Height = canvasH; hudScatter.Width = canvasW; topCanvas.Children.Add(hudScatter); //create the search button and the search box //createSearchButton(); createSearchBox(); //create the large scatterview item that controls panning and zooming topScatter.Items.Add(moveLayer); moveLayer.Height = canvasH; moveLayer.Width = canvasW; moveLayer.Orientation = 0; moveLayer.CanRotate = false; moveLayer.Center = new Point(canvasW / 2, canvasH / 2); moveLayer.SizeChanged += new SizeChangedEventHandler(moveLayer_SizeChanged); //moveLayer.Background = Brushes.Transparent; moveLayer.ShowsActivationEffects = false; moveLayer.PreviewTouchDown += new EventHandler<TouchEventArgs>(moveLayer_PreviewTouchDown); moveLayer.PreviewTouchUp += new EventHandler<TouchEventArgs>(moveLayer_PreviewTouchUp); moveLayer.PreviewTouchMove += new EventHandler<TouchEventArgs>(moveLayer_PreviewTouchMove); DependencyPropertyDescriptor dpd1 = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem)); dpd1.AddValueChanged(moveLayer, ScatterviewMainChanged); //create the canvas that will contain all the things inside the large scatterview Canvas otherCanvas = new Canvas(); moveLayer.Content = otherCanvas; //save the variables that will calculate ratio currentSize = canvasH * canvasW; oldY = canvasH; oldX = canvasW; r.Width = canvasW; r.Height = canvasH; r.Fill = Brushes.Transparent; otherCanvas.Children.Add(r); otherCanvas.Children.Add(lineCanvas); otherCanvas.Children.Add(innerLayer); DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(ScatterViewItem.CenterProperty, typeof(ScatterViewItem)); dpd.AddValueChanged(moveLayer, ScatterViewCenterChanged); moveLayer.Center = new Point(width * 1.5, height * 1.5); /* List<WebGroup> temp = new List<WebGroup>(); temp = ((FloatingSearchBox)searchBox.Content).GroupList; foreach (WebGroup i in temp) { //TODO: check the filename }*/ }