blob: bba07c1ef82945bea4f31e8af103040bfa51e169 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Collections.ObjectModel;
namespace gsview
{
public class TextBlock : INotifyPropertyChanged
{
double height;
double width;
double x;
double y;
double scale;
String color;
int page_number;
public List<TextLine> TextLines;
/* Determine intersection case of block with selection rectangle */
public Intersection_t CheckIntersection(double rect_x, double rect_y, double rect_w, double rect_h)
{
if (rect_h == 0 || rect_y > y + height || rect_y + rect_h < y ||
rect_x + rect_w < x || rect_x > x + width)
return Intersection_t.NONE;
if (rect_y < y && y + height < rect_y + rect_h)
return Intersection_t.FULL;
return Intersection_t.PARTIAL;
}
public double Height
{
get { return height; }
set
{
height = value;
OnPropertyChanged("Height");
}
}
public double Width
{
get { return width; }
set
{
width = value;
OnPropertyChanged("Width");
}
}
public double X
{
get { return x; }
set
{
x = value;
OnPropertyChanged("X");
}
}
public double Y
{
get { return y; }
set
{
y = value;
OnPropertyChanged("Y");
}
}
public double Scale
{
get { return scale; }
set { scale = value;}
}
public int PageNumber
{
get { return page_number; }
set { page_number = value; }
}
public String Color
{
get { return color; }
set
{
color = value;
//OnPropertyChanged("Color");
}
}
public int GetNumberLines()
{
return TextLines.Count;
}
public event PropertyChangedEventHandler PropertyChanged;
// Create the OnPropertyChanged method to raise the event
protected void OnPropertyChanged(string name)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(name));
}
}
}
public class BlocksText : ObservableCollection<TextBlock>
{
public BlocksText()
: base()
{
}
}
}
|