• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kig

  • sources
  • kde-4.12
  • kdeedu
  • kig
  • objects
line_imp.cc
Go to the documentation of this file.
1 // Copyright (C) 2002 Dominique Devriese <devriese@kde.org>
2 
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
7 
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 // 02110-1301, USA.
17 
18 #include "line_imp.h"
19 
20 #include "bogus_imp.h"
21 #include "point_imp.h"
22 
23 #include "../misc/rect.h"
24 #include "../misc/common.h"
25 #include "../misc/kigtransform.h"
26 #include "../misc/kigpainter.h"
27 #include "../misc/equation.h"
28 #include "../kig/kig_view.h"
29 
30 #include <klocale.h>
31 
32 #include <cmath>
33 using namespace std;
34 
35 AbstractLineImp::AbstractLineImp( const Coordinate& a, const Coordinate& b )
36  : mdata( a, b )
37 {
38 }
39 
40 AbstractLineImp::~AbstractLineImp()
41 {
42 }
43 
44 bool AbstractLineImp::inRect( const Rect& r, int width, const KigWidget& w ) const
45 {
46  return lineInRect( r, mdata.a, mdata.b, width, this, w );
47 }
48 
49 int AbstractLineImp::numberOfProperties() const
50 {
51  return Parent::numberOfProperties() + 2;
52 }
53 
54 const ObjectImpType* AbstractLineImp::impRequirementForProperty( int which ) const
55 {
56  if ( which < Parent::numberOfProperties() )
57  return Parent::impRequirementForProperty( which );
58  else return AbstractLineImp::stype();
59 }
60 
61 const char* AbstractLineImp::iconForProperty( int which ) const
62 {
63  if ( which < Parent::numberOfProperties() )
64  return Parent::iconForProperty( which );
65  if ( which == Parent::numberOfProperties() )
66  return "slope"; // slope
67  if ( which == Parent::numberOfProperties() + 1 )
68  return "kig_text"; // equation
69  else assert( false );
70  return "";
71 }
72 
73 ObjectImp* AbstractLineImp::property( int which, const KigDocument& w ) const
74 {
75  if ( which < Parent::numberOfProperties() )
76  return Parent::property( which, w );
77  if ( which == Parent::numberOfProperties() )
78  return new DoubleImp( slope() );
79  if ( which == Parent::numberOfProperties() + 1 )
80  return new StringImp( equationString() );
81  else assert( false );
82  return new InvalidImp;
83 }
84 
85 const QByteArrayList AbstractLineImp::propertiesInternalNames() const
86 {
87  QByteArrayList l = Parent::propertiesInternalNames();
88  l << "slope";
89  l << "equation";
90  assert( l.size() == AbstractLineImp::numberOfProperties() );
91  return l;
92 }
93 
94 const QByteArrayList AbstractLineImp::properties() const
95 {
96  QByteArrayList l = Parent::properties();
97  l << I18N_NOOP( "Slope" );
98  l << I18N_NOOP( "Equation" );
99  assert( l.size() == AbstractLineImp::numberOfProperties() );
100  return l;
101 }
102 
103 int SegmentImp::numberOfProperties() const
104 {
105  return Parent::numberOfProperties() + 5;
106 }
107 
108 const QByteArrayList SegmentImp::propertiesInternalNames() const
109 {
110  QByteArrayList s = Parent::propertiesInternalNames();
111  s << "length";
112  s << "mid-point";
113  s << "support";
114  s << "end-point-A";
115  s << "end-point-B";
116  assert( s.size() == SegmentImp::numberOfProperties() );
117  return s;
118 }
119 
120 const QByteArrayList SegmentImp::properties() const
121 {
122  QByteArrayList s = Parent::properties();
123  s << I18N_NOOP( "Length" );
124  s << I18N_NOOP( "Mid Point" );
125  s << I18N_NOOP( "Support Line" );
126  s << I18N_NOOP( "First End Point" );
127  s << I18N_NOOP( "Second End Point" );
128  assert( s.size() == SegmentImp::numberOfProperties() );
129  return s;
130 }
131 
132 const ObjectImpType* SegmentImp::impRequirementForProperty( int which ) const
133 {
134  if ( which < Parent::numberOfProperties() )
135  return Parent::impRequirementForProperty( which );
136  else return SegmentImp::stype();
137 }
138 
139 const char* SegmentImp::iconForProperty( int which ) const
140 {
141  int pnum = 0;
142  if ( which < Parent::numberOfProperties() )
143  return Parent::iconForProperty( which );
144  else if ( which == Parent::numberOfProperties() + pnum++ )
145  return "distance"; // length
146  else if ( which == Parent::numberOfProperties() + pnum++ )
147  return "segment_midpoint"; // mid point
148  else if ( which == Parent::numberOfProperties() + pnum++ )
149  return ""; // support line
150  else if ( which == Parent::numberOfProperties() + pnum++ )
151  return "endpoint1"; // mid point
152  else if ( which == Parent::numberOfProperties() + pnum++ )
153  return "endpoint2"; // mid point
154  else assert( false );
155  return "";
156 }
157 
158 ObjectImp* SegmentImp::property( int which, const KigDocument& w ) const
159 {
160  int pnum = 0;
161 
162  if ( which < Parent::numberOfProperties() )
163  return Parent::property( which, w );
164  else if ( which == Parent::numberOfProperties() + pnum++ )
165  return new DoubleImp( mdata.dir().length() );
166  else if ( which == Parent::numberOfProperties() + pnum++ )
167  return new PointImp( ( mdata.a + mdata.b ) / 2 );
168  else if ( which == Parent::numberOfProperties() + pnum++ )
169  return new LineImp( mdata.a, mdata.b );
170  else if ( which == Parent::numberOfProperties() + pnum++ )
171  return new PointImp( mdata.a );
172  else if ( which == Parent::numberOfProperties() + pnum++ )
173  return new PointImp( mdata.b );
174  else assert( false );
175  return new InvalidImp;
176 }
177 
178 int RayImp::numberOfProperties() const
179 {
180  return Parent::numberOfProperties() + 2;
181 }
182 
183 const QByteArrayList RayImp::propertiesInternalNames() const
184 {
185  QByteArrayList s = Parent::propertiesInternalNames();
186  s << "support";
187  s << "end-point-A";
188  assert( s.size() == RayImp::numberOfProperties() );
189  return s;
190 }
191 
192 const QByteArrayList RayImp::properties() const
193 {
194  QByteArrayList s = Parent::properties();
195  s << I18N_NOOP( "Support Line" );
196  s << I18N_NOOP( "End Point" );
197  assert( s.size() == RayImp::numberOfProperties() );
198  return s;
199 }
200 
201 const ObjectImpType* RayImp::impRequirementForProperty( int which ) const
202 {
203  if ( which < Parent::numberOfProperties() )
204  return Parent::impRequirementForProperty( which );
205  else return RayImp::stype();
206 }
207 
208 const char* RayImp::iconForProperty( int which ) const
209 {
210  int pnum = 0;
211  if ( which < Parent::numberOfProperties() )
212  return Parent::iconForProperty( which );
213  else if ( which == Parent::numberOfProperties() + pnum++ )
214  return ""; // support line
215  else if ( which == Parent::numberOfProperties() + pnum++ )
216  return "endpoint1"; // end point
217  else assert( false );
218  return "";
219 }
220 
221 ObjectImp* RayImp::property( int which, const KigDocument& w ) const
222 {
223  int pnum = 0;
224 
225  if ( which < Parent::numberOfProperties() )
226  return Parent::property( which, w );
227  else if ( which == Parent::numberOfProperties() + pnum++ )
228  return new LineImp( mdata.a, mdata.b );
229  else if ( which == Parent::numberOfProperties() + pnum++ )
230  return new PointImp( mdata.a );
231  else assert( false );
232  return new InvalidImp;
233 }
234 
235 double AbstractLineImp::slope() const
236 {
237  Coordinate diff = mdata.dir();
238  return diff.y / diff.x;
239 }
240 
241 const QString AbstractLineImp::equationString() const
242 {
243  Coordinate p = mdata.a;
244  Coordinate q = mdata.b;
245 
246  EquationString ret = EquationString( "" );
247 
248  double a = q.y - p.y;
249  double b = p.x - q.x;
250  double c = q.x*p.y - q.y*p.x;
251 
252  bool needsign = false;
253  if ( fabs( b ) < 1e-6*fabs( a ) )
254  {
255  ret.addTerm( 1.0, ret.x(), needsign );
256  ret.addTerm( b/a, ret.y(), needsign );
257  ret.addTerm( c/a, "", needsign );
258  ret.append( " = 0" );
259  return ret;
260  }
261 
262  ret.append( "y = " );
263  ret.addTerm( -a/b, ret.x(), needsign );
264  ret.addTerm( -c/b, "", needsign );
265  if ( ! needsign ) ret.append( "0" );
266 // double m = ( q.y - p.y ) / ( q.x - p.x );
267 // double r = - ( q.y - p.y ) * p.x / ( q.x - p.x ) + p.y;
268 //
269 // QString ret = QString::fromUtf8( "y = %1x " ) +
270 // QString::fromUtf8( r > 0 ? "+" : "-" ) +
271 // QString::fromUtf8( " %2" );
272 //
273 // ret = ret.arg( m, 0, 'g', 3 );
274 // ret = ret.arg( abs( r ), 0, 'g', 3 );
275 
276  return ret;
277 }
278 
279 void SegmentImp::draw( KigPainter& p ) const
280 {
281  p.drawSegment( mdata );
282 }
283 
284 bool SegmentImp::contains( const Coordinate& p, int width, const KigWidget& w ) const
285 {
286  return internalContainsPoint( p, w.screenInfo().normalMiss( width ) );
287 }
288 
289 void RayImp::draw( KigPainter& p ) const
290 {
291  p.drawRay( mdata );
292 }
293 
294 bool RayImp::contains( const Coordinate& p, int width, const KigWidget& w ) const
295 {
296  return internalContainsPoint( p, w.screenInfo().normalMiss( width ) );
297 }
298 
299 void LineImp::draw( KigPainter& p ) const
300 {
301  p.drawLine( mdata );
302 }
303 
304 bool LineImp::contains( const Coordinate& p, int width, const KigWidget& w ) const
305 {
306  return internalContainsPoint( p, w.screenInfo().normalMiss( width ) );
307 }
308 
309 SegmentImp::SegmentImp( const Coordinate& a, const Coordinate& b )
310  : AbstractLineImp( a, b )
311 {
312 }
313 
314 RayImp::RayImp( const Coordinate& a, const Coordinate& b )
315  : AbstractLineImp( a, b )
316 {
317 }
318 
319 LineImp::LineImp( const Coordinate& a, const Coordinate& b )
320  : AbstractLineImp( a, b )
321 {
322 }
323 
324 SegmentImp* SegmentImp::copy() const
325 {
326  return new SegmentImp( mdata );
327 }
328 
329 RayImp* RayImp::copy() const
330 {
331  return new RayImp( mdata );
332 }
333 
334 LineImp* LineImp::copy() const
335 {
336  return new LineImp( mdata );
337 }
338 
339 const Coordinate SegmentImp::getPoint( double param, const KigDocument& ) const
340 {
341  return mdata.a + mdata.dir()*param;
342 }
343 
344 double SegmentImp::getParam( const Coordinate& p, const KigDocument& ) const
345 {
346  Coordinate pt = calcPointOnPerpend( data(), p );
347  pt = calcIntersectionPoint( data(), LineData( p, pt ) );
348  // if pt is over the end of the segment ( i.e. it's on the line
349  // which the segment is a part of, but not of the segment itself..;
350  // ) we set it to one of the end points of the segment...
351  if ((pt - mdata.a).length() > mdata.dir().length() )
352  pt = mdata.b;
353  else if ( (pt- mdata.b).length() > mdata.dir().length() )
354  pt = mdata.a;
355  if (mdata.b == mdata.a) return 0;
356  return ((pt - mdata.a).length())/(mdata.dir().length());
357 }
358 
359 LineData AbstractLineImp::data() const
360 {
361  return mdata;
362 }
363 
364 const Coordinate RayImp::getPoint( double param, const KigDocument& ) const
365 {
366  param = 1.0/param - 1.0;
367  return mdata.a + mdata.dir()*param;
368 }
369 
370 double RayImp::getParam( const Coordinate& p, const KigDocument& ) const
371 {
372  const LineData ld = data();
373  Coordinate pt = calcPointOnPerpend( ld, p );
374  pt = calcIntersectionPoint( ld, LineData( p, pt ));
375  // if pt is over the end of the ray ( i.e. it's on the line
376  // which the ray is a part of, but not of the ray itself..;
377  // ) we set it to the start point of the ray...
378  Coordinate dir = ld.dir();
379  pt -= ld.a;
380  double param;
381  if ( dir.x != 0 ) param = pt.x / dir.x;
382  else if ( dir.y != 0 ) param = pt.y / dir.y;
383  else param = 0.;
384  if ( param < 0. ) param = 0.;
385 
386  // mp: let's try with 1/(x+1), this reverses the mapping, but
387  // should allow to take advantage of the tightness of floating point
388  // numbers near zero, in order to get more possible positions near
389  // infinity
390 
391  param = 1./( param + 1. );
392 
393  assert( param >= 0. && param <= 1. );
394  return param;
395 }
396 
397 const Coordinate LineImp::getPoint( double p, const KigDocument& ) const
398 {
399  // inspired upon KSeg
400 
401  // we need to spread the points over the line, it should also come near
402  // the (infinite) end of the line, but most points should be near
403  // the two points we contain...
404  if ( p <= 0. ) p = 1e-6;
405  if ( p >= 1. ) p = 1 - 1e-6;
406  p = 2*p - 1;
407  if (p > 0) p = p/(1 - p);
408  else p = p/(1 + p);
409 // p *= 1024; // such multiplying factor could be useful in order to
410  // have more points near infinity, at the expense of
411  // points near ma and mb
412  return mdata.a + p*mdata.dir();
413 }
414 
415 double LineImp::getParam( const Coordinate& point, const KigDocument& ) const
416 {
417  // somewhat the reverse of getPoint, although it also supports
418  // points not on the line...
419 
420  Coordinate pa = point - mdata.a;
421  Coordinate ba = mdata.dir();
422  double balsq = ba.x*ba.x + ba.y*ba.y;
423  assert (balsq > 0);
424 
425  double p = (pa.x*ba.x + pa.y*ba.y)/balsq;
426 // p /= 1024;
427  if (p > 0) p = p/(1+p);
428  else p = p/(1-p);
429 
430  return 0.5*(p + 1);
431 }
432 
433 ObjectImp* SegmentImp::transform( const Transformation& t ) const
434 {
435  if ( ! t.isAffine() ) /* we need to check the position of the two points */
436  {
437  if ( t.getProjectiveIndicator( mdata.a ) *
438  t.getProjectiveIndicator( mdata.b ) < 0 )
439  return new InvalidImp();
440  }
441  Coordinate na = t.apply( mdata.a );
442  Coordinate nb = t.apply( mdata.b );
443  if( na.valid() && nb.valid() ) return new SegmentImp( na, nb );
444  else return new InvalidImp();
445 }
446 
447 ObjectImp* LineImp::transform( const Transformation& t ) const
448 {
449  Coordinate na = t.apply( mdata.a );
450  Coordinate nb = t.apply( mdata.b );
451  if ( na.valid() && nb.valid() ) return new LineImp( na, nb );
452  else return new InvalidImp();
453 }
454 
455 ObjectImp* RayImp::transform( const Transformation& t ) const
456 {
457  if ( ! t.isAffine() ) /* we need to check the position of the two points */
458  {
459  double pa = t.getProjectiveIndicator( mdata.a );
460  double pb = t.getProjectiveIndicator( mdata.b );
461  if ( pa < 0 ) pb = -pb;
462  if ( pb < fabs (pa) ) return new InvalidImp();
463  Coordinate na = t.apply( mdata.a );
464  Coordinate nb = t.apply0( mdata.b - mdata.a );
465  if ( na.valid() && nb.valid() ) return new SegmentImp( na, nb );
466  else return new InvalidImp();
467  }
468  Coordinate na = t.apply( mdata.a );
469  Coordinate nb = t.apply( mdata.b );
470  if ( na.valid() && nb.valid() ) return new RayImp( na, nb );
471  else return new InvalidImp();
472 }
473 
474 AbstractLineImp::AbstractLineImp( const LineData& d )
475  : mdata( d )
476 {
477 }
478 
479 SegmentImp::SegmentImp( const LineData& d )
480  : AbstractLineImp( d )
481 {
482 }
483 
484 RayImp::RayImp( const LineData& d )
485  : AbstractLineImp( d )
486 {
487 }
488 
489 LineImp::LineImp( const LineData& d )
490  : AbstractLineImp( d )
491 {
492 }
493 
494 double SegmentImp::length() const
495 {
496  return mdata.length();
497 }
498 
499 void SegmentImp::visit( ObjectImpVisitor* vtor ) const
500 {
501  vtor->visit( this );
502 }
503 
504 void RayImp::visit( ObjectImpVisitor* vtor ) const
505 {
506  vtor->visit( this );
507 }
508 
509 void LineImp::visit( ObjectImpVisitor* vtor ) const
510 {
511  vtor->visit( this );
512 }
513 
514 bool AbstractLineImp::equals( const ObjectImp& rhs ) const
515 {
516  return rhs.type() == type() &&
517  static_cast<const AbstractLineImp&>( rhs ).data() == data();
518 }
519 
520 const ObjectImpType* AbstractLineImp::stype()
521 {
522  static const ObjectImpType t(
523  Parent::stype(), "line", I18N_NOOP( "line" ),
524  I18N_NOOP( "Select a Line" ), 0, 0, 0, 0, 0, 0, 0 );
525  return &t;
526 }
527 
528 const ObjectImpType* LineImp::stype()
529 {
530  static const ObjectImpType t(
531  Parent::stype(), "line",
532  I18N_NOOP( "line" ),
533  I18N_NOOP( "Select this line" ),
534  I18N_NOOP( "Select line %1" ),
535  I18N_NOOP( "Remove a Line" ),
536  I18N_NOOP( "Add a Line" ),
537  I18N_NOOP( "Move a Line" ),
538  I18N_NOOP( "Attach to this line" ),
539  I18N_NOOP( "Show a Line" ),
540  I18N_NOOP( "Hide a Line" )
541  );
542  return &t;
543 }
544 
545 const ObjectImpType* SegmentImp::stype()
546 {
547  static const ObjectImpType t(
548  Parent::stype(), "segment",
549  I18N_NOOP( "segment" ),
550  I18N_NOOP( "Select this segment" ),
551  I18N_NOOP( "Select segment %1" ),
552  I18N_NOOP( "Remove a Segment" ),
553  I18N_NOOP( "Add a Segment" ),
554  I18N_NOOP( "Move a Segment" ),
555  I18N_NOOP( "Attach to this segment" ),
556  I18N_NOOP( "Show a Segment" ),
557  I18N_NOOP( "Hide a Segment" )
558  );
559  return &t;
560 }
561 
562 const ObjectImpType* RayImp::stype()
563 {
564  static const ObjectImpType t(
565  Parent::stype(), "ray",
566  I18N_NOOP( "half-line" ),
567  I18N_NOOP( "Select this half-line" ),
568  I18N_NOOP( "Select half-line %1" ),
569  I18N_NOOP( "Remove a Half-Line" ),
570  I18N_NOOP( "Add a Half-Line" ),
571  I18N_NOOP( "Move a Half-Line" ),
572  I18N_NOOP( "Attach to this half-line" ),
573  I18N_NOOP( "Show a Half-Line" ),
574  I18N_NOOP( "Hide a Half-Line" )
575  );
576  return &t;
577 }
578 
579 const ObjectImpType* SegmentImp::type() const
580 {
581  return SegmentImp::stype();
582 }
583 
584 const ObjectImpType* RayImp::type() const
585 {
586  return RayImp::stype();
587 }
588 
589 const ObjectImpType* LineImp::type() const
590 {
591  return LineImp::stype();
592 }
593 
594 bool SegmentImp::containsPoint( const Coordinate& p, const KigDocument& ) const
595 {
596  return internalContainsPoint( p, test_threshold );
597 }
598 
599 bool SegmentImp::internalContainsPoint( const Coordinate& p, double threshold ) const
600 {
601  return isOnSegment( p, mdata.a, mdata.b, threshold );
602 }
603 
604 bool RayImp::containsPoint( const Coordinate& p, const KigDocument& ) const
605 {
606  return internalContainsPoint( p, test_threshold );
607 }
608 
609 bool RayImp::internalContainsPoint( const Coordinate& p, double threshold ) const
610 {
611  return isOnRay( p, mdata.a, mdata.b, threshold );
612 }
613 
614 bool LineImp::containsPoint( const Coordinate& p, const KigDocument& ) const
615 {
616  return internalContainsPoint( p, test_threshold );
617 }
618 
619 bool LineImp::internalContainsPoint( const Coordinate& p, double threshold ) const
620 {
621  return isOnLine( p, mdata.a, mdata.b, threshold );
622 }
623 
624 bool AbstractLineImp::isPropertyDefinedOnOrThroughThisImp( int which ) const
625 {
626  int pnum = 0;
627 
628  if ( which < Parent::numberOfProperties() )
629  return Parent::isPropertyDefinedOnOrThroughThisImp( which );
630  else if ( which == Parent::numberOfProperties() + pnum++ )
631  return false;
632  else if ( which == Parent::numberOfProperties() + pnum++ )
633  return true;
634  else if ( which == Parent::numberOfProperties() + pnum++ )
635  return true;
636  else if ( which == Parent::numberOfProperties() + pnum++ )
637  return true;
638  else assert( false );
639  return false;
640 }
641 
642 Rect SegmentImp::surroundingRect() const
643 {
644  return Rect( mdata.a, mdata.b );
645 }
646 
647 Rect RayImp::surroundingRect() const
648 {
649  return Rect::invalidRect();
650 }
651 
652 Rect LineImp::surroundingRect() const
653 {
654  return Rect::invalidRect();
655 }
SegmentImp::contains
bool contains(const Coordinate &p, int width, const KigWidget &si) const
Definition: line_imp.cc:284
SegmentImp::draw
void draw(KigPainter &p) const
Definition: line_imp.cc:279
EquationString::y
const QString y() const
Definition: equation.cc:110
AbstractLineImp::data
LineData data() const
Get the LineData for this AbstractLineImp.
Definition: line_imp.cc:359
ObjectImpType
Instances of this class represent a certain ObjectImp type.
Definition: object_imp.h:95
RayImp::property
ObjectImp * property(int which, const KigDocument &d) const
Definition: line_imp.cc:221
isOnLine
bool isOnLine(const Coordinate &o, const Coordinate &a, const Coordinate &b, const double fault)
is o on the line defined by point a and point b ? fault is the allowed difference...
Definition: common.cpp:188
SegmentImp::internalContainsPoint
bool internalContainsPoint(const Coordinate &p, double threshold) const
Definition: line_imp.cc:599
AbstractLineImp::numberOfProperties
int numberOfProperties() const
Definition: line_imp.cc:49
RayImp::visit
void visit(ObjectImpVisitor *vtor) const
Definition: line_imp.cc:504
SegmentImp::length
double length() const
Get the length of this segment.
Definition: line_imp.cc:494
LineImp::contains
bool contains(const Coordinate &p, int width, const KigWidget &si) const
Definition: line_imp.cc:304
point_imp.h
SegmentImp::property
ObjectImp * property(int which, const KigDocument &d) const
Definition: line_imp.cc:158
SegmentImp::getParam
double getParam(const Coordinate &, const KigDocument &) const
Definition: line_imp.cc:344
SegmentImp::numberOfProperties
int numberOfProperties() const
Definition: line_imp.cc:103
AbstractLineImp::~AbstractLineImp
~AbstractLineImp()
Definition: line_imp.cc:40
RayImp::contains
bool contains(const Coordinate &p, int width, const KigWidget &si) const
Definition: line_imp.cc:294
StringImp
This ObjectImp is a BogusImp containing only a string value.
Definition: bogus_imp.h:167
ScreenInfo::normalMiss
double normalMiss(int width) const
Definition: screeninfo.cc:88
AbstractLineImp::property
ObjectImp * property(int which, const KigDocument &d) const
Definition: line_imp.cc:73
AbstractLineImp
An ObjectImp class that is the base of the line-like ObjectImp's: SegmentImp, LineImp and RayImp...
Definition: line_imp.h:31
LineData
Simple class representing a line.
Definition: misc/common.h:49
RayImp::iconForProperty
const char * iconForProperty(int which) const
Definition: line_imp.cc:208
RayImp::surroundingRect
Rect surroundingRect() const
Definition: line_imp.cc:647
LineData::dir
const Coordinate dir() const
The direction of the line.
Definition: misc/common.h:72
AbstractLineImp::slope
double slope() const
Get the slope of this AbstractLineImp.
Definition: line_imp.cc:235
RayImp::copy
RayImp * copy() const
Returns a copy of this ObjectImp.
Definition: line_imp.cc:329
LineData::b
Coordinate b
Another point on the line.
Definition: misc/common.h:68
RayImp::draw
void draw(KigPainter &p) const
Definition: line_imp.cc:289
LineImp::draw
void draw(KigPainter &p) const
Definition: line_imp.cc:299
ObjectImpVisitor::visit
void visit(const ObjectImp *imp)
Definition: object_imp.cc:81
LineImp::containsPoint
bool containsPoint(const Coordinate &p, const KigDocument &doc) const
Return whether this Curve contains the given point.
Definition: line_imp.cc:614
ObjectImp::impRequirementForProperty
virtual const ObjectImpType * impRequirementForProperty(int which) const
Definition: object_imp.cc:76
ObjectImp::property
virtual ObjectImp * property(int which, const KigDocument &d) const
Definition: object_imp.cc:70
AbstractLineImp::impRequirementForProperty
const ObjectImpType * impRequirementForProperty(int which) const
Definition: line_imp.cc:54
RayImp
An ObjectImp representing a ray.
Definition: line_imp.h:136
Rect
This file is part of Kig, a KDE program for Interactive Geometry...
Definition: rect.h:34
EquationString
Simple class that represents an equation.
Definition: equation.h:49
RayImp::numberOfProperties
int numberOfProperties() const
Definition: line_imp.cc:178
RayImp::impRequirementForProperty
const ObjectImpType * impRequirementForProperty(int which) const
Definition: line_imp.cc:201
RayImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the RayImp type.
Definition: line_imp.cc:562
Transformation::getProjectiveIndicator
double getProjectiveIndicator(const Coordinate &c) const
Definition: kigtransform.cpp:703
SegmentImp::surroundingRect
Rect surroundingRect() const
Definition: line_imp.cc:642
LineImp::LineImp
LineImp(const Coordinate &a, const Coordinate &b)
Construct a LineImp going through points a and b.
Definition: line_imp.cc:319
LineImp::getParam
double getParam(const Coordinate &, const KigDocument &) const
Definition: line_imp.cc:415
ObjectImp::propertiesInternalNames
virtual const QByteArrayList propertiesInternalNames() const
Definition: object_imp.cc:63
Transformation::isAffine
bool isAffine() const
Definition: kigtransform.cpp:686
LineImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the LineImp type.
Definition: line_imp.cc:528
calcPointOnPerpend
Coordinate calcPointOnPerpend(const LineData &l, const Coordinate &t)
This file is part of Kig, a KDE program for Interactive Geometry...
Definition: common.cpp:37
KigPainter::drawRay
void drawRay(const Coordinate &a, const Coordinate &b)
draw a ray...
Definition: kigpainter.cpp:594
EquationString::x
const QString x() const
Definition: equation.cc:105
Rect::invalidRect
static Rect invalidRect()
Definition: rect.cc:305
RayImp::internalContainsPoint
bool internalContainsPoint(const Coordinate &p, double threshold) const
Definition: line_imp.cc:609
Coordinate
The Coordinate class is the basic class representing a 2D location by its x and y components...
Definition: coordinate.h:33
LineImp::visit
void visit(ObjectImpVisitor *vtor) const
Definition: line_imp.cc:509
Coordinate::length
double length() const
Length.
Definition: coordinate.cpp:144
KigPainter::drawLine
void drawLine(const Coordinate &p1, const Coordinate &p2)
draw a line...
Definition: kigpainter.cpp:187
SegmentImp::transform
ObjectImp * transform(const Transformation &) const
Return this ObjectImp, transformed by the transformation t.
Definition: line_imp.cc:433
LineImp::copy
LineImp * copy() const
Returns a copy of this ObjectImp.
Definition: line_imp.cc:334
EquationString::addTerm
void addTerm(double coeff, const QString &unknowns, bool &needsign)
Definition: equation.cc:41
KigWidget::screenInfo
const ScreenInfo & screenInfo() const
the part of the document we're currently showing i.e.
Definition: kig_view.cpp:272
SegmentImp::impRequirementForProperty
const ObjectImpType * impRequirementForProperty(int which) const
Definition: line_imp.cc:132
Transformation::apply0
const Coordinate apply0(const Coordinate &c) const
Definition: kigtransform.cpp:653
ObjectImp::type
virtual const ObjectImpType * type() const =0
Returns the lowermost ObjectImpType that this object is an instantiation of.
RayImp::type
const ObjectImpType * type() const
Returns the lowermost ObjectImpType that this object is an instantiation of.
Definition: line_imp.cc:584
isOnSegment
bool isOnSegment(const Coordinate &o, const Coordinate &a, const Coordinate &b, const double fault)
is o on the segment defined by point a and point b ? this calls isOnLine(), but also checks if o is "...
Definition: common.cpp:212
LineImp::surroundingRect
Rect surroundingRect() const
Definition: line_imp.cc:652
AbstractLineImp::properties
const QByteArrayList properties() const
Definition: line_imp.cc:94
test_threshold
const double test_threshold
Definition: common.cpp:510
ObjectImp::iconForProperty
virtual const char * iconForProperty(int which) const
Definition: object_imp.cc:187
KigPainter
KigPainter is an extended QPainter.
Definition: kigpainter.h:51
SegmentImp::properties
const QByteArrayList properties() const
Definition: line_imp.cc:120
LineImp::transform
ObjectImp * transform(const Transformation &) const
Return this ObjectImp, transformed by the transformation t.
Definition: line_imp.cc:447
bogus_imp.h
PointImp
An ObjectImp representing a point.
Definition: point_imp.h:27
SegmentImp::getPoint
const Coordinate getPoint(double param, const KigDocument &) const
Definition: line_imp.cc:339
Transformation
Class representing a transformation.
Definition: kigtransform.h:37
LineData::a
Coordinate a
One point on the line.
Definition: misc/common.h:64
AbstractLineImp::equals
bool equals(const ObjectImp &rhs) const
Returns true if this ObjectImp is equal to rhs.
Definition: line_imp.cc:514
KigWidget
This class is the real widget showing the document.
Definition: kig_view.h:50
RayImp::transform
ObjectImp * transform(const Transformation &) const
Return this ObjectImp, transformed by the transformation t.
Definition: line_imp.cc:455
AbstractLineImp::inRect
bool inRect(const Rect &r, int width, const KigWidget &) const
Definition: line_imp.cc:44
SegmentImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the SegmentImp type.
Definition: line_imp.cc:545
ObjectImp::isPropertyDefinedOnOrThroughThisImp
virtual bool isPropertyDefinedOnOrThroughThisImp(int which) const
Definition: object_imp.cc:326
calcIntersectionPoint
Coordinate calcIntersectionPoint(const LineData &l1, const LineData &l2)
this calcs the point where the lines l and m intersect...
Definition: common.cpp:57
SegmentImp::iconForProperty
const char * iconForProperty(int which) const
Definition: line_imp.cc:139
RayImp::containsPoint
bool containsPoint(const Coordinate &p, const KigDocument &doc) const
Return whether this Curve contains the given point.
Definition: line_imp.cc:604
isOnRay
bool isOnRay(const Coordinate &o, const Coordinate &a, const Coordinate &b, const double fault)
Definition: common.cpp:226
LineImp::getPoint
const Coordinate getPoint(double param, const KigDocument &) const
Definition: line_imp.cc:397
AbstractLineImp::AbstractLineImp
AbstractLineImp(const LineData &d)
Definition: line_imp.cc:474
lineInRect
bool lineInRect(const Rect &r, const Coordinate &a, const Coordinate &b, const int width, const ObjectImp *imp, const KigWidget &w)
Is the line, segment, ray or vector inside r ? We need the imp to distinguish between rays...
Definition: common.cpp:401
Transformation::apply
const Coordinate apply(const double x0, const double x1, const double x2) const
Apply this Tranformation.
Definition: kigtransform.cpp:611
AbstractLineImp::isPropertyDefinedOnOrThroughThisImp
bool isPropertyDefinedOnOrThroughThisImp(int which) const
Definition: line_imp.cc:624
SegmentImp::visit
void visit(ObjectImpVisitor *vtor) const
Definition: line_imp.cc:499
AbstractLineImp::mdata
LineData mdata
Definition: line_imp.h:35
SegmentImp::copy
SegmentImp * copy() const
Returns a copy of this ObjectImp.
Definition: line_imp.cc:324
line_imp.h
AbstractLineImp::equationString
const QString equationString() const
Get a string containing the equation of this line in the form "y = a * x + b ".
Definition: line_imp.cc:241
SegmentImp::type
const ObjectImpType * type() const
Returns the lowermost ObjectImpType that this object is an instantiation of.
Definition: line_imp.cc:579
AbstractLineImp::propertiesInternalNames
const QByteArrayList propertiesInternalNames() const
Definition: line_imp.cc:85
CurveImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the CurveImp type.
Definition: curve_imp.cc:27
DoubleImp
This ObjectImp is a BogusImp containing only a double value.
Definition: bogus_imp.h:89
RayImp::getPoint
const Coordinate getPoint(double param, const KigDocument &) const
Definition: line_imp.cc:364
KigDocument
KigDocument is the class holding the real data in a Kig document.
Definition: kig_document.h:36
AbstractLineImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the AbstractLineImp type.
Definition: line_imp.cc:520
AbstractLineImp::iconForProperty
const char * iconForProperty(int which) const
Definition: line_imp.cc:61
LineImp
An ObjectImp representing a line.
Definition: line_imp.h:184
Coordinate::x
double x
X Component.
Definition: coordinate.h:126
RayImp::properties
const QByteArrayList properties() const
Definition: line_imp.cc:192
QByteArrayList
QList< QByteArray > QByteArrayList
Definition: objects/common.h:50
RayImp::propertiesInternalNames
const QByteArrayList propertiesInternalNames() const
Definition: line_imp.cc:183
Coordinate::y
double y
Y Component.
Definition: coordinate.h:129
ObjectImp
The ObjectImp class represents the behaviour of an object after it is calculated. ...
Definition: object_imp.h:226
LineImp::type
const ObjectImpType * type() const
Returns the lowermost ObjectImpType that this object is an instantiation of.
Definition: line_imp.cc:589
SegmentImp::propertiesInternalNames
const QByteArrayList propertiesInternalNames() const
Definition: line_imp.cc:108
RayImp::getParam
double getParam(const Coordinate &, const KigDocument &) const
Definition: line_imp.cc:370
KigPainter::drawSegment
void drawSegment(const Coordinate &from, const Coordinate &to)
draw a segment...
Definition: kigpainter.cpp:94
SegmentImp::SegmentImp
SegmentImp(const Coordinate &a, const Coordinate &b)
Construct a new segment from point a to point b.
Definition: line_imp.cc:309
LineImp::internalContainsPoint
bool internalContainsPoint(const Coordinate &p, double threshold) const
Definition: line_imp.cc:619
SegmentImp::containsPoint
bool containsPoint(const Coordinate &p, const KigDocument &doc) const
Return whether this Curve contains the given point.
Definition: line_imp.cc:594
ObjectImp::numberOfProperties
virtual int numberOfProperties() const
Definition: object_imp.cc:58
Coordinate::valid
bool valid() const
Return whether this is a valid Coordinate.
Definition: coordinate.cpp:176
RayImp::RayImp
RayImp(const Coordinate &a, const Coordinate &b)
Construct a ray, starting at a, and going through b.
Definition: line_imp.cc:314
ObjectImpVisitor
Definition: object_imp.h:56
ObjectImp::properties
virtual const QByteArrayList properties() const
Definition: object_imp.cc:51
InvalidImp
This ObjectImp represents an invalid object.
Definition: bogus_imp.h:61
LineData::length
double length() const
The length from a to b.
Definition: misc/common.h:76
SegmentImp
An ObjectImp representing a segment.
Definition: line_imp.h:81
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:35:39 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kig

Skip menu "kig"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal