コード例 #1
0
            public virtual int CompareTo(LocationTextExtractionStrategy.ITextChunkLocation other)
            {
                if (this == other)
                {
                    return(0);
                }
                // not really needed, but just in case
                LineSegment mySegment    = new LineSegment(startLocation, endLocation);
                LineSegment otherSegment = new LineSegment(other.GetStartLocation(), other.GetEndLocation());

                if (other.GetStartLocation().Equals(other.GetEndLocation()) && mySegment.ContainsSegment(otherSegment) ||
                    startLocation.Equals(endLocation) && otherSegment.ContainsSegment(mySegment))
                {
                    // Return 0 to save order due to stable sort. This handles situation of mark glyphs that have zero width
                    return(0);
                }
                int result;

                result = iText.IO.Util.JavaUtil.IntegerCompare(OrientationMagnitude(), other.OrientationMagnitude());
                if (result != 0)
                {
                    return(result);
                }
                result = iText.IO.Util.JavaUtil.IntegerCompare(DistPerpendicular(), other.DistPerpendicular());
                if (result != 0)
                {
                    return(result);
                }
                return(iText.IO.Util.JavaUtil.FloatCompare(DistParallelStart(), other.DistParallelStart()));
            }
コード例 #2
0
 /// <summary>
 /// Constructor del PdfColorFontTextChunk.
 /// </summary>
 /// <param name="str">Texto contenido.</param>
 /// <param name="location">Extractor.</param>
 /// <param name="ll">Coordenada izquierda abajo.</param>
 /// <param name="ur">Coordenada derecha arriba.</param>
 /// <param name="fillColor">Color del texto.</param>
 /// <param name="strokeColor">Color del texto.</param>
 /// <param name="fontName">Nombre de la fuente.</param>
 /// <param name="fontSize">Tamaño de la fuente.</param>
 public PdfColorFontTextChunk(
     string str,
     LocationTextExtractionStrategy.ITextChunkLocation location,
     Vector ll, Vector ur,
     string fillColor, string strokeColor,
     string fontName, double?fontSize
     ) : base(str, location, ll, ur)
 {
     FillColor   = fillColor;
     StrokeColor = strokeColor;
     FontName    = fontName;
     FontSize    = fontSize;
 }
コード例 #3
0
            public virtual bool IsAtWordBoundary(LocationTextExtractionStrategy.ITextChunkLocation previous)
            {
                if (GetCharSpaceWidth() < 0.1f)
                {
                    return(false);
                }
                // In case a text chunk is of zero length, this probably means this is a mark character,
                // and we do not actually want to insert a space in such case
                if (startLocation.Equals(endLocation) || previous.GetEndLocation().Equals(previous.GetStartLocation()))
                {
                    return(false);
                }
                float dist = DistanceFromEndOf(previous);

                return(dist < -GetCharSpaceWidth() || dist > GetCharSpaceWidth() / 2.0f);
            }
コード例 #4
0
 /// <summary>
 /// Computes the distance between the end of 'other' and the beginning of this chunk
 /// in the direction of this chunk's orientation vector.
 /// </summary>
 /// <remarks>
 /// Computes the distance between the end of 'other' and the beginning of this chunk
 /// in the direction of this chunk's orientation vector.  Note that it's a bad idea
 /// to call this for chunks that aren't on the same line and orientation, but we don't
 /// explicitly check for that condition for performance reasons.
 /// </remarks>
 /// <param name="other"/>
 /// <returns>the number of spaces between the end of 'other' and the beginning of this chunk</returns>
 public virtual float DistanceFromEndOf(LocationTextExtractionStrategy.ITextChunkLocation other)
 {
     return(DistParallelStart() - other.DistParallelEnd());
 }
コード例 #5
0
 /// <param name="as">the location to compare to</param>
 /// <returns>true is this location is on the the same line as the other</returns>
 public virtual bool SameLine(LocationTextExtractionStrategy.ITextChunkLocation @as)
 {
     return(OrientationMagnitude() == @as.OrientationMagnitude() && DistPerpendicular() == @as.DistPerpendicular
                ());
 }
コード例 #6
0
 public TextChunk(String @string, LocationTextExtractionStrategy.ITextChunkLocation loc)
 {
     this.text     = @string;
     this.location = loc;
 }
コード例 #7
0
ファイル: PdfTextChunk.cs プロジェクト: bautista225/PdfTagger
 /// <summary>
 /// Construye una nueva instancia de la clase PdfTextChunk.
 /// </summary>
 /// <param name="str">Texto contenido.</param>
 /// <param name="location">Localización</param>
 /// <param name="ll"></param>
 /// <param name="ur"></param>
 public PdfTextChunk(String str, LocationTextExtractionStrategy.ITextChunkLocation location,
                     Vector ll, Vector ur) : base(str, location)
 {
     Ll = ll;
     Ur = ur;
 }