public ActiveReaderDocument LoadDocument(TPadDocument inputDoc) { //Launch the splash animation //splash = new SplashScreen(); //splash.Show(); //Document over which the tPad is located document = LoadDocument(inputDoc.Folder, inputDoc.FileName, inputDoc.ID); //list of hardcoded figures within the paper "LensMouse: Augmenting the Mouse with an Interactive Touch Display" if (document.ID == 1) { listOfFigures.Add(new Figure(1, 1, new Int32Rect(93, 254, 342, 122), new string[] { "Fig 1", "Figure 1", "Fig. 1" })); listOfFigures.Add(new Figure(2, 1, new Int32Rect(483, 570, 362, 388), new string[] { "Fig 2", "Figure 2", "Fig. 2" })); listOfFigures.Add(new Figure(3, 2, new Int32Rect(93, 468, 357, 186), new string[] { "Fig 3", "Figure 3", "Fig. 3" })); listOfFigures.Add(new Figure(4, 2, new Int32Rect(477, 853, 367, 237), new string[] { "Fig 4", "Figure 4", "Fig. 4" })); listOfFigures.Add(new Figure(5, 3, new Int32Rect(92, 146, 360, 206), new string[] { "Fig 5", "Figure 5", "Fig. 5" })); listOfFigures.Add(new Figure(6, 3, new Int32Rect(481, 423, 362, 187), new string[] { "Fig 6", "Figure 6", "Fig. 6" })); listOfFigures.Add(new Figure(7, 4, new Int32Rect(487, 105, 348, 265), new string[] { "Fig 7", "Figure 7", "Fig. 7" })); listOfFigures.Add(new Figure(8, 5, new Int32Rect(99, 120, 348, 250), new string[] { "Fig 8", "Figure 8", "Fig. 8" })); listOfFigures.Add(new Figure(9, 5, new Int32Rect(87, 376, 364, 206), new string[] { "Fig 9", "Figure 9", "Fig. 9" })); listOfFigures.Add(new Figure(10, 5, new Int32Rect(95, 584, 348, 301), new string[] { "Fig 10", "Figure 10", "Fig. 10" })); listOfFigures.Add(new Figure(11, 6, new Int32Rect(93, 121, 356, 181), new string[] { "Fig 11", "Figure 11", "Fig. 11" })); listOfFigures.Add(new Figure(12, 6, new Int32Rect(95, 641, 353, 245), new string[] { "Fig 12", "Figure 12", "Fig. 12" })); listOfFigures.Add(new Figure(13, 7, new Int32Rect(98, 540, 347, 254), new string[] { "Fig 13", "Figure 13", "Fig. 13" })); listOfFigures.Add(new Figure(14, 7, new Int32Rect(478, 671, 362, 340), new string[] { "Fig 14", "Figure 14", "Fig. 14" })); listOfFigures.Add(new Figure(15, 8, new Int32Rect(95, 281, 350, 345), new string[] { "Fig 15", "Figure 15", "Fig. 15" })); listOfFigures.Add(new Figure(16, 8, new Int32Rect(87, 634, 361, 212), new string[] { "Fig 16", "Figure 16", "Fig. 16" })); listOfFigures.Add(new Figure(17, 8, new Int32Rect(481, 812, 355, 224), new string[] { "Fig 17", "Figure 17", "Fig. 17" })); listOfFigures.Add(new Figure(18, 9, new Int32Rect(483, 109, 355, 203), new string[] { "Fig 18", "Figure 18", "Fig. 18" })); listOfFigures.Add(new Figure(19, 9, new Int32Rect(482, 552, 358, 189), new string[] { "Fig 19", "Figure 19", "Fig. 19" })); } CalculateFigurePositions(); return document; }
public new TPadDocument Clone() { ActiveReaderDocument clone = new ActiveReaderDocument(); clone.ID = ID; clone.Folder = Folder; clone.FileName = FileName; clone.Pages = new TPadPage[Pages.Length]; for (int index = 0; index < Pages.Length; index++) clone[index] = this[index].Clone() as ActiveReaderPage; return clone; }
public void LoadLayersFromDisk(ActiveReaderDocument document, int deviceID) { if (deviceID != -1) return; String fileName = String.Format(@"{0}-{1}-ar.cache", document.FileName, deviceID); if (!File.Exists(fileName)) return; XmlSerializer deserializer = new XmlSerializer(typeof(ActiveReaderDocument)); TextReader textReader = new StreamReader(fileName); ActiveReaderDocument newDoc = (ActiveReaderDocument)deserializer.Deserialize(textReader); textReader.Close(); for (int index = 0; index < document.Pages.Length; index++) { document[index].Annotations = newDoc[index].Annotations; document[index].Highlights = newDoc[index].Highlights; //document[index].Scribblings = newDoc[index].Scribblings; document[index].ScribblingCollections = newDoc[index].ScribblingCollections; document[index].SearchResults = newDoc[index].SearchResults; document[index].FigureLinks = newDoc[index].FigureLinks; } }
private void LoadLayersToPage(ActiveReaderDocument document, int pageIndex) { Dispatcher.Invoke(DispatcherPriority.Render, (Action)delegate() { //Unloads existing highlights var highlights = cHighlights.Children.OfType<Line>().ToList(); foreach (Line highlight in highlights) cHighlights.Children.Remove(highlight); //Unload existing notes var notes = cHighlights.Children.OfType<StickyNote>().ToList(); foreach (StickyNote note in notes) cHighlights.Children.Remove(note); //Unload existing icons var icons = cHighlights.Children.OfType<Image>().ToList(); foreach (Image icon in icons) cHighlights.Children.Remove(icon); //Unload existing scribblings inkCScribble.Strokes.Clear(); //Unload existing search results cSearchResults.Children.Clear(); //Loads other highlights for this page foreach (Highlight element in document[pageIndex].Highlights) AddHighlight(element.Line, cHighlights); //Loads search results for this page foreach (Highlight element in document[pageIndex].SearchResults) AddHighlight(element.Line, cSearchResults); //Loads figure links for this page foreach (Highlight element in document[pageIndex].FigureLinks) AddHighlight(element.Line, cHighlights); //Loads notes for this page foreach (Note element in document[pageIndex].Annotations) { Note note = (Note)element; cHighlights.Children.Add(note.Annotation); cHighlights.Children.Add(note.Icon); } //Loads scribbles for this page foreach (ScribbleCollection element in document[pageIndex].ScribblingCollections) { ScribbleCollection note = (ScribbleCollection)element; inkCScribble.Strokes.Add(note.Scribbles); } }); }
private ActiveReaderDocument LoadDocument(string documentFolder, string pdfFile, int docID) { if (documentFolder == null || documentFolder.Length == 0) throw new ArgumentException("Parameter 'documentFolders' cannot be empty"); if (!Directory.Exists(documentFolder)) throw new ArgumentException(String.Format("Folder '{0}' does not exist!", documentFolder)); ActiveReaderDocument result = new ActiveReaderDocument() { ID = docID, Folder = documentFolder, FileName = pdfFile }; result.DocumentSize = new Size(21.59, 27.94); //US Letter - 215.9 mm × 279.4 mm String[] pages = Directory.GetFiles(documentFolder, "*.png"); Array.Sort<String>(pages); result.Pages = new TPadPage[pages.Length]; for (int index = 0; index < pages.Length; index++) result.Pages[index] = new ActiveReaderPage() { PageIndex = index, FileName = pages[index] }; return result; }