<< LPD-Extraktions-Spezifikation [50/117] >>

LPD-Extraktions-Spezifikation


Startseite / Projekte / Lucene eLecture / Konzepte & Spezifikationen / LPD-Extraktions-Spezifikation

LPD-Extraktions-Spezifikation



LPD-Dateien sind Vorlesungsaufzeichnungen die mittels dem Lecturnity-Player (http://132.230.139.59/csc/) abgespielt werden können. Da noch keine Schnittstelle für Java existiert um die Text-Elemente der Datei zurückzugeben musste eine Spezifikation für die Extraktion erstellt werden.
Basis für diese Spezifikation (2 Tags)

TEXT-Tag
<TEXT x=245 y=123 width=300 height=20>...</TEXT>
Dieses TEXT-Tag kann mehrere TEXTITEM-Tags beinhalten:

TEXTITEM-Tag
<TEXTITEM x=200 y=314 offx=0 offy=0 font="Arial" size=20 ccolor=0 weight=normal slant=roman style=0 ttf="ARIAL.TTF" rgb=0x000000>Computer Algorithms – Introduction to Design & Analysis, </TEXTITEM>

Klassen
Am Besten wären Klassen für die Text-&TextItem-Tags. Die Klasse LPDTextTag repräsentiert ein TEXT-Tag und enthält ein Array auf die enthaltenen TEXTITEM-Tags (LPDTextItemTag[]). Über eine Klasse LPDFile (siehe ganz unten) soll es schließlich möglich sein die MetaDaten und TEXT-Tags (indirekt somit auch die TEXTITEM-Tags) zurückzugeben. Die Inhalte (LPDTextTag's + LPDTextItemTag's) können statisch beim Öffnen der LPD-Datei komplett gefüllt werden. Eine stream-basierte Variante sollte nicht notwendig sein.

LPDTextTag
package imc.epresenter.filesdk;
/** * Class for storing a TEXT-Tag * @author Markus Krebs */
public class LPDTextTag { private int x; private int y; private int width; private int height; /** * The page-nr (started from 1 to maxpages) the TEXT-Tag lies into * VERY IMPORTANT */
    private int pageNr; /** The TEXTITEM-Tags that are inside this TEXT-Tag. */
    private LPDTextItemTag[] textItemTags;
    public LPDTextTag() {}
    public int getHeight() { return height; }
    public int getPageNr() { return pageNr; }
    public LPDTextItemTag[] getTextItemTags() { return textItemTags; }
    public int getWidth() { return width; }
    public int getX() { return x; }
    public int getY() { return y; }
}
Eine Seitennummer in der das Tag vorkommt (siehe oben: pageNr) muss unbedingt vorhanden sein! (Seitennummerierung von x = 1 bis n laut MetaData.ThumbnailData[x-1])

LPDTextItemTag
package imc.epresenter.filesdk; import java.awt.Color;
/** * Class for storing a TEXTITEM-Tag * @author Markus Krebs */
public class LPDTextItemTag {
    // Weights
    // Add here more for other weights by assigning integer-values. If it is
    // possible that a font can have mixed weights, than use 1, 2, 4, 8, 16, ...
    // so that the values can be mixed by addition.
    public static final int WEIGHT_NORMAL = 0;
    // Styles
    // Add here more for other styles. Because e.g. font-styles normally can be mixed,
    // use e.g. STYLE_BOLD=1, STYLE_ITALIC=2, STYLE_UNDERLINE=4.
    // for a bold and underline style results: 5 (1+4)
    public static final int STYLE_NONE = 0;
    // Fields private int x; private int y; private int offx; private int offy; private String font; private int size; private Color ccolor; private int weight;
    // a constant from above starting with WEIGHT_ (addition possible)
    private String slant; private int style;
    // a constant from above starting with STYLE_ (addition possible) private String ttf; private Color rgb;
    // the raw text the textitem describes private String text;
    /* optional fields (i think not really needed) * width and heigth of the textitembox in pixel (same scaling as x y size, etc) * if this values are present in the LPD-File, than include it. * needed, to determine text-overlapping. */
    private int width; private int height;
    public LPDTextItemTag() { weight = WEIGHT_NORMAL; style = STYLE_NONE; }
    public Color getCColor() { return ccolor; }
    public String getFont() { return font; }
    public int getHeight() { return height; }
    public int getOffX() { return offx; }
    public int getOffY() { return offy; }
    public Color getRGB() { return rgb; }
    public int getSize() { return size; }
    public String getSlant() { return slant; }
    public int getStyle() { return style; }
    public String getText() { return text; }
    public String getTTF() { return ttf; }
    public int getWeight() { return weight; }
    public int getWidth() { return width; }
    public int getX() { return x; }
    public int getY() { return y; }
}

LPDFile
package imc.epresenter.filesdk; import java.io.File;
public class LPDFile { public static LPDFile open(File file) {
    // Code for opening the file and filling the MetaData and LPDTextTags
    // this method can close the file afterwards immediatly return null; }
    /** * Returns the MetaData of the lpd-file * (imc.epresenter.filesdk.MetaData) * @return */
    public Metadata getMetaData() { return null; }
    /** * Returns the TEXT-Tags of the lpd-file as an array * @return */
    public LPDTextTag[] getTextTags() { return null; }
}

Spätere Anwendung (Beispiel)
File file = new File("einleitung.lpd");
LPDFile lpdFile = LPDFile.open(file);
LPDTextTag[] textTags = lpdFile.getTextTags();
// process the text and textitem-tags .....

Bemerkung Der HTML-Code dieser Seite wurde so gestaltet, dass sich die Java-Codes einfach markieren und mit Copy-Paste herauskopieren lassen


Visitors PageClicks Valid XHTML 1.0! Valid CSS!

CanciÜber michSite-MapRechtlichesKontaktJSWins (JavaScript-Desktop-System)© 2004-2013 by Markus Krebs