@@ -121,16 +121,16 @@ namespace pdf_lib
121121 std::vector<scalar_type>& x,
122122 std::vector<scalar_type>& y)
123123 {
124- // logging_lib::info("pdf-parser") << __FILE__ << ":" << __LINE__ << "\t" << __FUNCTION__;
124+ logging_lib::info (" pdf-parser" ) << __FILE__ << " :" << __LINE__ << " \t " << __FUNCTION__;
125125
126126 if (j+1 <x.size ())
127127 return false ;
128128
129- scalar_type x0 = x[ j+0 ] ;
130- scalar_type y0 = y[ j+0 ] ;
129+ scalar_type x0 = x. at ( j+0 ) ;
130+ scalar_type y0 = y. at ( j+0 ) ;
131131
132- scalar_type x1 = x[ j+1 ] ;
133- scalar_type y1 = y[ j+1 ] ;
132+ scalar_type x1 = x. at ( j+1 ) ;
133+ scalar_type y1 = y. at ( j+1 ) ;
134134
135135 if (std::abs (x1-x0)>1 .e -3 and
136136 std::abs (y1-y0)<1 .e -3 )
@@ -144,16 +144,16 @@ namespace pdf_lib
144144 std::vector<scalar_type>& x,
145145 std::vector<scalar_type>& y)
146146 {
147- // logging_lib::info("pdf-parser") << __FILE__ << ":" << __LINE__ << "\t" << __FUNCTION__;
147+ logging_lib::info (" pdf-parser" ) << __FILE__ << " :" << __LINE__ << " \t " << __FUNCTION__;
148148
149149 if (j+1 <x.size ())
150150 return false ;
151151
152- scalar_type x0 = x[ j+0 ] ;
153- scalar_type y0 = y[ j+0 ] ;
152+ scalar_type x0 = x. at ( j+0 ) ;
153+ scalar_type y0 = y. at ( j+0 ) ;
154154
155- scalar_type x1 = x[ j+1 ] ;
156- scalar_type y1 = y[ j+1 ] ;
155+ scalar_type x1 = x. at ( j+1 ) ;
156+ scalar_type y1 = y. at ( j+1 ) ;
157157
158158 if (std::abs (x1-x0)<1 .e -3 and
159159 std::abs (y1-y0)>1 .e -3 )
@@ -167,7 +167,7 @@ namespace pdf_lib
167167 scalar_type x1, scalar_type y1,
168168 std::vector<horizontal_line<scalar_type> >& hlines_)
169169 {
170- // logging_lib::info("pdf-parser") << __FILE__ << ":" << __LINE__ << "\t" << __FUNCTION__;
170+ logging_lib::info (" pdf-parser" ) << __FILE__ << " :" << __LINE__ << " \t " << __FUNCTION__;
171171
172172 horizontal_line<scalar_type> hline;
173173 hline.y = y0;
@@ -183,7 +183,7 @@ namespace pdf_lib
183183 scalar_type x1, scalar_type y1,
184184 std::vector<vertical_line<scalar_type> >& vlines_)
185185 {
186- // logging_lib::info("pdf-parser") << __FILE__ << ":" << __LINE__ << "\t" << __FUNCTION__;
186+ logging_lib::info (" pdf-parser" ) << __FILE__ << " :" << __LINE__ << " \t " << __FUNCTION__;
187187
188188 vertical_line<scalar_type> vline;
189189 vline.x = x0;
@@ -199,7 +199,7 @@ namespace pdf_lib
199199 std::vector<vertical_line <scalar_type> >& vlines_,
200200 std::vector<horizontal_line<scalar_type> >& hlines_)
201201 {
202- // logging_lib::info("pdf-parser") << __FILE__ << ":" << __LINE__ << "\t" << __FUNCTION__;
202+ logging_lib::info (" pdf-parser" ) << __FILE__ << " :" << __LINE__ << " \t " << __FUNCTION__;
203203
204204 hlines_.clear ();
205205 vlines_.clear ();
@@ -213,15 +213,31 @@ namespace pdf_lib
213213 x <= paths[k][core::keys<core::PATH>::x_values ()];
214214 y <= paths[k][core::keys<core::PATH>::y_values ()];
215215
216+ /*
217+ logging_lib::info("pdf-parser") << __FILE__ << ":" << __LINE__ << "\t #-subpaths: " << subpaths.size();
218+ for(int i=0; i<subpaths.size(); i++)
219+ {
220+ logging_lib::info("pdf-parser") << i << "\t" << subpaths.at(i);
221+ }
222+ */
223+
216224 for (int i=0 ; i<subpaths.size ()-1 ; i++)
217225 {
218- for (int j=subpaths[i+0 ]; j<subpaths[i+1 ]; j++)
226+ // logging_lib::info("pdf-parser") << __FILE__ << ":" << __LINE__ << "\t subpath (" << i << "): " << subpaths.size();
227+ for (int j=subpaths.at (i+0 ); j<subpaths.at (i+1 ); j++)
219228 {
220- scalar_type x0 = x[j+0 ];
221- scalar_type y0 = y[j+0 ];
229+ // logging_lib::info("pdf-parser") << __FILE__ << ":" << __LINE__ << "\t x/y: " << j << "/" << x.size() << ":" << y.size();
230+
231+ if (j+1 >=x.size () or j+1 >=y.size ()) // skip
232+ {
233+ continue ;
234+ }
235+
236+ scalar_type x0 = x.at (j+0 );
237+ scalar_type y0 = y.at (j+0 );
222238
223- scalar_type x1 = x[ j+1 ] ;
224- scalar_type y1 = y[ j+1 ] ;
239+ scalar_type x1 = x. at ( j+1 ) ;
240+ scalar_type y1 = y. at ( j+1 ) ;
225241
226242 if (std::abs (y1-y0)<1 .e -3 and std::abs (x1-x0)>1 .e -3 )
227243 register_hline (x0, y0, x1, y1, hlines_);
0 commit comments