• 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
  • filters
kseg-filter.cc
Go to the documentation of this file.
1 // Copyright (C) 2003 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 "kseg-filter.h"
19 
20 #include "filters-common.h"
21 #include "kseg-defs.h"
22 
23 #include "../kig/kig_document.h"
24 #include "../kig/kig_part.h"
25 #include "../misc/coordinate.h"
26 #include "../objects/angle_type.h"
27 #include "../objects/arc_type.h"
28 #include "../objects/bogus_imp.h"
29 #include "../objects/circle_type.h"
30 #include "../objects/conic_imp.h"
31 #include "../objects/conic_types.h"
32 #include "../objects/intersection_types.h"
33 #include "../objects/line_imp.h"
34 #include "../objects/line_type.h"
35 #include "../objects/object_calcer.h"
36 #include "../objects/object_drawer.h"
37 #include "../objects/object_factory.h"
38 #include "../objects/object_holder.h"
39 #include "../objects/other_imp.h"
40 #include "../objects/other_type.h"
41 #include "../objects/point_imp.h"
42 #include "../objects/point_type.h"
43 #include "../objects/polygon_imp.h"
44 #include "../objects/polygon_type.h"
45 #include "../objects/transform_types.h"
46 #include "../objects/vector_type.h"
47 
48 #include <qfont.h>
49 #include <qpen.h>
50 #include <qbrush.h>
51 #include <qfile.h>
52 #include <qdatastream.h>
53 #include <qbuffer.h>
54 
55 #include <klocale.h>
56 
57 KigFilterKSeg::KigFilterKSeg()
58 {
59 }
60 
61 KigFilterKSeg::~KigFilterKSeg()
62 {
63 }
64 
65 bool KigFilterKSeg::supportMime( const QString& mime )
66 {
67  return mime == "application/x-kseg";
68 }
69 
70 struct drawstyle
71 {
72  qint8 pointstyle;
73  QFont font;
74  QPen pen;
75  QBrush brush;
76 };
77 
78 static Coordinate readKSegCoordinate( QDataStream& stream )
79 {
80  // read the coord..
81  float inx, iny;
82  stream >> inx >> iny;
83  // KSeg uses a coordinate system, where the topleft is (0,0), and
84  // the bottom right is the widget coordinate in the window: if the
85  // KSeg window had a width of 600 pixels and a height of 600, then
86  // the bottom right will be at (600,600). We assume a window of
87  // such a height here, and transform it into Kig Coordinates. This
88  // function is quite similar to ScreenInfo::fromScreen, and it's
89  // basically a simple modification of that code to floats..
90 
91  // invert the y-axis: 0 is at the bottom !
92  Coordinate t( inx, 600 - iny );
93  t *= 14;
94  t /= 600;
95  return t + Coordinate( -7, -7 );
96 }
97 
98 static ObjectTypeCalcer* intersectionPoint( const std::vector<ObjectCalcer*>& parents, int which )
99 {
100  if ( parents.size() != 2 ) return 0;
101  int nlines = 0;
102  int nconics = 0;
103  int narcs = 0;
104  for ( int i = 0; i < 2; ++i )
105  {
106  if ( parents[i]->imp()->inherits( AbstractLineImp::stype() ) ) ++nlines;
107  else if ( parents[i]->imp()->inherits( ConicImp::stype() ) ) ++nconics;
108  else if ( parents[i]->imp()->inherits( ArcImp::stype() ) ) ++narcs;
109  else return 0;
110  };
111  if ( nlines == 2 )
112  return which == -1 ? new ObjectTypeCalcer( LineLineIntersectionType::instance(), parents ) : 0;
113  else if ( nlines == 1 && nconics == 1 )
114  {
115  std::vector<ObjectCalcer*> intparents( parents );
116  intparents.push_back( new ObjectConstCalcer( new IntImp( which ) ) );
117  return new ObjectTypeCalcer( ConicLineIntersectionType::instance(), intparents );
118  }
119  else if ( nlines == 0 && nconics == 2 )
120  {
121  std::vector<ObjectCalcer*> rparents( parents );
122  rparents.push_back( new ObjectConstCalcer( new IntImp( 1 ) ) );
123  rparents.push_back( new ObjectConstCalcer( new IntImp( 1 ) ) );
124  rparents.push_back( new ObjectTypeCalcer( ConicRadicalType::instance(), rparents ) );
125  std::vector<ObjectCalcer*> iparents;
126  iparents.push_back( parents[0] );
127  iparents.push_back( rparents.back() );
128  iparents.push_back( new ObjectConstCalcer( new IntImp( which ) ) );
129  return new ObjectTypeCalcer( ConicLineIntersectionType::instance(), iparents );
130  }
131  else if ( nlines == 1 && narcs == 1 )
132  {
133  std::vector<ObjectCalcer*> intparents( parents );
134  intparents.push_back( new ObjectConstCalcer( new IntImp( which ) ) );
135  return new ObjectTypeCalcer( ArcLineIntersectionType::instance(), intparents );
136  }
137  else return 0;
138 }
139 
140 ObjectCalcer* KigFilterKSeg::transformObject( const QString& file, KigDocument& kigdoc,
141  std::vector<ObjectCalcer*>& parents,
142  int subtype, bool& ok )
143 {
144  ok = true;
145  ObjectCalcer* retobj = 0;
146  switch( subtype )
147  {
148  case G_TRANSLATED:
149  {
150  std::vector<ObjectCalcer*> vectorparents( parents.begin() + 1, parents.end() );
151  ObjectTypeCalcer* vector = new ObjectTypeCalcer( VectorType::instance(), vectorparents );
152  vector->calc( kigdoc );
153 
154  std::vector<ObjectCalcer*> transparents;
155  transparents.push_back( parents[0] );
156  transparents.push_back( vector );
157  retobj = new ObjectTypeCalcer( TranslatedType::instance(), transparents );
158  break;
159  }
160  case G_ROTATED:
161  {
162  std::vector<ObjectCalcer*> angleparents( parents.begin() + 2, parents.end() );
163  ObjectTypeCalcer* angle = new ObjectTypeCalcer( AngleType::instance(), angleparents );
164  angle->calc( kigdoc );
165 
166  std::vector<ObjectCalcer*> rotparents;
167  rotparents.push_back( parents[0] );
168  rotparents.push_back( parents[1] );
169  rotparents.push_back( angle );
170  retobj = new ObjectTypeCalcer( RotationType::instance(), rotparents );
171  break;
172  }
173  case G_SCALED:
174  {
175  if ( parents.size() == 4 )
176  {
177  retobj = new ObjectTypeCalcer( ScalingOverCenter2Type::instance(), parents );
178  }
179  else
180  {
181  // TODO
182  notSupported( file, i18n( "This KSeg document uses a scaling "
183  "transformation, which Kig currently "
184  "cannot import." ) );
185  ok = false;
186  return 0;
187  }
188  break;
189  }
190  case G_REFLECTED:
191  {
192  std::vector<ObjectCalcer*> mirparents( parents.begin(), parents.end() );
193  retobj = new ObjectTypeCalcer( LineReflectionType::instance(), mirparents );
194  break;
195  }
196  }
197 
198  return retobj;
199 }
200 
201 KigDocument* KigFilterKSeg::load( const QString& file )
202 {
203  QFile ffile( file );
204  if ( ! ffile.open( QIODevice::ReadOnly ) )
205  {
206  fileNotFound( file );
207  return 0;
208  };
209 
210  KigDocument* retdoc = new KigDocument();
211 
212  QDataStream fstream( &ffile );
213 
214  QString versionstring;
215  fstream >> versionstring;
216  if ( !versionstring.startsWith( "KSeg Document Version " ) )
217  KIG_FILTER_PARSE_ERROR;
218 
219  QByteArray array;
220  fstream >> array;
221  QBuffer buf( &array );
222  buf.open( QIODevice::ReadOnly );
223  QDataStream stream( &buf );
224 
225  stream.setVersion( 3 );
226 
227  // G_drawstyles:
228  short numstyles;
229  stream >> numstyles;
230  std::vector<drawstyle> drawstyles( numstyles );
231  for ( short i = 0; i < numstyles; ++i )
232  {
233  stream >> drawstyles[i].pointstyle;
234  stream >> drawstyles[i].font;
235  stream >> drawstyles[i].pen;
236  stream >> drawstyles[i].brush;
237  };
238 
239  std::vector<ObjectHolder*> ret;
240  std::vector<ObjectHolder*> ret2;
241 
242  // G_refs
243  unsigned int count;
244  stream >> count;
245 
246  ret.resize( count, 0 );
247  const ObjectFactory* fact = ObjectFactory::instance();
248 
249  // KSeg topologically sorts the objects before saving, that means we
250  // can read the entire file in one iteration..
251  for ( uint i = 0; i < count; ++i )
252  {
253  short styleid;
254  stream >> styleid;
255  short nparents;
256  stream >> nparents;
257  std::vector<ObjectCalcer*> parents( nparents, 0 );
258  for ( short j = 0; j < nparents; ++j )
259  {
260  int parent;
261  stream >> parent;
262  parents[j] = ret[parent]->calcer();
263  };
264 
265  // read the object..
266  short info;
267  stream >> info;
268  int type = 1 << (info & 31);
269  info >>= 5;
270  int descendtype = (info & 15);
271  info >>= 4;
272  bool visible = info & 1;
273  bool labelVisible = info & 2;
274  bool given = info & 4;
275  bool final = info & 8;
276 
277  // avoid g++ warnings about unused vars..
278  // this doesn't really do anything..
279  (void) given;
280  (void) final;
281 
282  drawstyle style = drawstyles[styleid];
283 
284  if ( type == G_LOOP ) continue;
285  // read the label..
286  QString labeltext;
287  stream >> labeltext;
288  Coordinate relcoord = readKSegCoordinate( stream );
289  // shut up gcc
290  (void) relcoord;
291  if ( type & G_CURVE )
292  {
293  Coordinate relcurvecoord = readKSegCoordinate( stream );
294  // shut up gcc
295  (void) relcurvecoord;
296  };
297 
298  // now load the object data..
299  ObjectHolder* object = 0;
300  ObjectCalcer* o = 0;
301  bool ok = true;
302 
303  QColor color = style.pen.color();
304  int width = style.pen.width();
305 
306 /*
307  kDebug() << "type: " << type
308  << "descendtype: " << descendtype << endl
309  << "label: " << labeltext << endl;
310 //*/
311 
312  switch ( type )
313  {
314  case G_POINT:
315  {
316  switch( descendtype )
317  {
318  case G_TRANSLATED:
319  case G_ROTATED:
320  case G_SCALED:
321  case G_REFLECTED:
322  {
323  o = transformObject( file, *retdoc, parents, descendtype, ok );
324  break;
325  }
326  case G_FREE_POINT:
327  {
328  // fixed point
329  if ( nparents != 0 ) KIG_FILTER_PARSE_ERROR;
330  Coordinate c = readKSegCoordinate( stream );
331  o = fact->fixedPointCalcer( c );
332  break;
333  }
334  case G_CONSTRAINED_POINT:
335  {
336  // constrained point
337  double p;
338  stream >> p;
339  if ( nparents != 1 ) KIG_FILTER_PARSE_ERROR;
340  ObjectCalcer* parent = parents[0];
341  assert( parent );
342  o = fact->constrainedPointCalcer( parent, p );
343  break;
344  }
345  case G_INTERSECTION_POINT:
346  {
347  // KSeg has somewhat weird intersection objects..
348  // for all objects G_INTERSECTION_POINT gets the
349  // first intersection of its parents, G_INTERSECTION2_POINT
350  // represents the second, if present.
351  o = intersectionPoint( parents, -1 );
352  if ( ! o ) KIG_FILTER_PARSE_ERROR;
353  break;
354  }
355  case G_INTERSECTION2_POINT:
356  {
357  o = intersectionPoint( parents, 1 );
358  if ( ! o ) KIG_FILTER_PARSE_ERROR;
359  break;
360  }
361  case G_MID_POINT:
362  {
363  // midpoint of a segment..
364  if ( parents.size() != 1 ) KIG_FILTER_PARSE_ERROR;
365  if ( !parents[0]->imp()->inherits( SegmentImp::stype() ) )
366  KIG_FILTER_PARSE_ERROR;
367 // int index = parents[0]->imp()->propertiesInternalNames().indexOf( "mid-point" );
368 // assert( index != -1 );
369  o = new ObjectPropertyCalcer( parents[0], "mid-point" );
370  break;
371  }
372  default:
373  KIG_FILTER_PARSE_ERROR;
374  };
375  width = style.pointstyle == SMALL_CIRCLE ? 2 : style.pointstyle == MEDIUM_CIRCLE ? 3 : 5;
376  color = style.brush.color();
377  break;
378  };
379  case G_SEGMENT:
380  {
381  switch( descendtype )
382  {
383  case G_TRANSLATED:
384  case G_ROTATED:
385  case G_SCALED:
386  case G_REFLECTED:
387  {
388  o = transformObject( file, *retdoc, parents, descendtype, ok );
389  break;
390  }
391  case G_ENDPOINTS_SEGMENT:
392  {
393  if ( nparents != 2 ) KIG_FILTER_PARSE_ERROR;
394  o = new ObjectTypeCalcer( SegmentABType::instance(), parents );
395  break;
396  }
397  default:
398  KIG_FILTER_PARSE_ERROR;
399  }
400  break;
401  };
402  case G_RAY:
403  {
404  switch( descendtype )
405  {
406  case G_TRANSLATED:
407  case G_ROTATED:
408  case G_SCALED:
409  case G_REFLECTED:
410  {
411  o = transformObject( file, *retdoc, parents, descendtype, ok );
412  break;
413  }
414  case G_TWOPOINTS_RAY:
415  {
416  if ( nparents != 2 ) KIG_FILTER_PARSE_ERROR;
417  o = new ObjectTypeCalcer( RayABType::instance(), parents );
418  break;
419  }
420  case G_BISECTOR_RAY:
421  {
422  ObjectTypeCalcer* angle = new ObjectTypeCalcer( HalfAngleType::instance(), parents );
423  angle->calc( *retdoc );
424  o = fact->propertyObjectCalcer( angle, "angle-bisector" );
425  break;
426  }
427  default:
428  KIG_FILTER_PARSE_ERROR;
429  };
430  break;
431  };
432  case G_LINE:
433  {
434  switch( descendtype )
435  {
436  case G_TRANSLATED:
437  case G_ROTATED:
438  case G_SCALED:
439  case G_REFLECTED:
440  {
441  o = transformObject( file, *retdoc, parents, descendtype, ok );
442  break;
443  }
444  case G_TWOPOINTS_LINE:
445  {
446  if ( nparents != 2 ) KIG_FILTER_PARSE_ERROR;
447  o = new ObjectTypeCalcer( LineABType::instance(), parents );
448  break;
449  }
450  case G_PARALLEL_LINE:
451  {
452  if ( nparents != 2 ) KIG_FILTER_PARSE_ERROR;
453  o = new ObjectTypeCalcer( LineParallelLPType::instance(), parents );
454  break;
455  }
456  case G_PERPENDICULAR_LINE:
457  {
458  if ( nparents != 2 ) KIG_FILTER_PARSE_ERROR;
459  o = new ObjectTypeCalcer( LinePerpendLPType::instance(), parents );
460  break;
461  }
462  default:
463  KIG_FILTER_PARSE_ERROR;
464  };
465  break;
466  };
467  case G_CIRCLE:
468  {
469  switch( descendtype )
470  {
471  case G_TRANSLATED:
472  case G_ROTATED:
473  case G_SCALED:
474  case G_REFLECTED:
475  {
476  o = transformObject( file, *retdoc, parents, descendtype, ok );
477  break;
478  }
479  case G_CENTERPOINT_CIRCLE:
480  {
481  if ( nparents != 2 ) KIG_FILTER_PARSE_ERROR;
482  o = new ObjectTypeCalcer( CircleBCPType::instance(), parents );
483  break;
484  }
485  case G_CENTERRADIUS_CIRCLE:
486  {
487  ObjectCalcer* point;
488  ObjectCalcer* segment;
489  if ( parents[0]->imp()->inherits( PointImp::stype() ) )
490  {
491  point = parents[0];
492  segment = parents[1];
493  }
494  else
495  {
496  point = parents[1];
497  segment = parents[0];
498  };
499  int index = segment->imp()->propertiesInternalNames().indexOf( "length" );
500  if ( index == -1 ) KIG_FILTER_PARSE_ERROR;
501  ObjectPropertyCalcer* length = new ObjectPropertyCalcer( segment, "length" );
502  length->calc( *retdoc );
503  std::vector<ObjectCalcer*> cparents;
504  cparents.push_back( point );
505  cparents.push_back( length );
506  o = new ObjectTypeCalcer( CircleBPRType::instance(), cparents );
507  break;
508  }
509  default:
510  KIG_FILTER_PARSE_ERROR;
511  };
512  break;
513  };
514  case G_ARC:
515  {
516  switch( descendtype )
517  {
518  case G_TRANSLATED:
519  case G_ROTATED:
520  case G_SCALED:
521  case G_REFLECTED:
522  {
523  o = transformObject( file, *retdoc, parents, descendtype, ok );
524  break;
525  }
526  case G_THREEPOINTS_ARC:
527  {
528  if ( nparents != 3 ) KIG_FILTER_PARSE_ERROR;
529  o = new ObjectTypeCalcer( ArcBTPType::instance(), parents );
530  break;
531  }
532  default:
533  KIG_FILTER_PARSE_ERROR;
534  }
535  break;
536  };
537  case G_POLYGON:
538  {
539  switch( descendtype )
540  {
541  case G_TRANSLATED:
542  case G_ROTATED:
543  case G_SCALED:
544  case G_REFLECTED:
545  {
546  o = transformObject( file, *retdoc, parents, descendtype, ok );
547  break;
548  }
549  default:
550  {
551  if ( nparents < 3 ) KIG_FILTER_PARSE_ERROR;
552  o = new ObjectTypeCalcer( PolygonBNPType::instance(), parents );
553  }
554  }
555 // default:
556 // KIG_FILTER_PARSE_ERROR;
557  break;
558  };
559  case G_CIRCLEINTERIOR:
560  {
561  notSupported( file, i18n( "This KSeg file contains a filled circle, "
562  "which Kig does not currently support." ) );
563  return 0;
564  };
565  case G_ARCSECTOR:
566  {
567  notSupported( file, i18n( "This KSeg file contains an arc sector, "
568  "which Kig does not currently support." ) );
569  return 0;
570  };
571  case G_ARCSEGMENT:
572  {
573  notSupported( file, i18n( "This KSeg file contains an arc segment, "
574  "which Kig does not currently support." ) );
575  return 0;
576  };
577  case G_LOCUS:
578  {
579  switch( descendtype )
580  {
581  case G_TRANSLATED:
582  case G_ROTATED:
583  case G_SCALED:
584  case G_REFLECTED:
585  {
586  o = transformObject( file, *retdoc, parents, descendtype, ok );
587  break;
588  }
589  case G_OBJECT_LOCUS:
590  {
591  if ( nparents != 2 ) KIG_FILTER_PARSE_ERROR;
592  o = fact->locusCalcer( parents[0], parents[1] );
593  break;
594  }
595  default:
596  KIG_FILTER_PARSE_ERROR;
597  }
598  break;
599  };
600  case G_MEASURE:
601  {
602  QByteArray prop;
603  Coordinate txtcoords = readKSegCoordinate( stream );
604  switch( descendtype )
605  {
606  case G_DISTANCE_MEASURE:
607  {
608  if ( nparents != 2 ) KIG_FILTER_PARSE_ERROR;
609  ObjectCalcer* c =
610  new ObjectTypeCalcer( SegmentABType::instance(), parents );
611  c->calc( *retdoc );
612  parents.clear();
613  parents.push_back( c );
614  prop = "length";
615  break;
616  }
617  case G_LENGTH_MEASURE:
618  {
619  if ( nparents != 1 ) KIG_FILTER_PARSE_ERROR;
620  if ( parents[0]->imp()->inherits( SegmentImp::stype() ) )
621  prop = "length";
622  else if ( parents[0]->imp()->inherits( CircleImp::stype() ) )
623  prop = "circumference";
624  else KIG_FILTER_PARSE_ERROR;
625  break;
626  }
627  case G_RADIUS_MEASURE:
628  {
629  if ( nparents != 1 ) KIG_FILTER_PARSE_ERROR;
630  if ( !parents[0]->imp()->inherits( CircleImp::stype() ) )
631  KIG_FILTER_PARSE_ERROR;
632  prop = "radius";
633  break;
634  }
635  case G_ANGLE_MEASURE:
636  {
637  if ( nparents != 3 ) KIG_FILTER_PARSE_ERROR;
638  ObjectTypeCalcer* ao =
639  new ObjectTypeCalcer( AngleType::instance(), parents );
640  ao->calc( *retdoc );
641  parents.clear();
642  parents.push_back( ao );
643  prop = "angle-degrees";
644  break;
645  }
646 // case G_RATIO_MEASURE: // TODO
647  case G_SLOPE_MEASURE:
648  {
649  if ( nparents != 1 ) KIG_FILTER_PARSE_ERROR;
650  if ( !parents[0]->imp()->inherits( AbstractLineImp::stype() ) )
651  KIG_FILTER_PARSE_ERROR;
652  prop = "slope";
653  break;
654  }
655  case G_AREA_MEASURE:
656  {
657  if ( nparents != 1 ) KIG_FILTER_PARSE_ERROR;
658  if ( parents[0]->imp()->inherits( FilledPolygonImp::stype() )
659  || parents[0]->imp()->inherits( FilledPolygonImp::stype3() )
660  || parents[0]->imp()->inherits( FilledPolygonImp::stype4() ) )
661  prop = "polygon-surface";
662  else KIG_FILTER_PARSE_ERROR;
663  break;
664  }
665  default:
666  KIG_FILTER_PARSE_ERROR;
667  }
668  if ( parents.size() != 1 ) KIG_FILTER_PARSE_ERROR;
669  o = filtersConstructTextObject(
670  txtcoords, parents[0], prop, *retdoc, false );
671  break;
672  }
673  case G_CALCULATE:
674  KIG_FILTER_PARSE_ERROR;
675  case G_ANNOTATION:
676  KIG_FILTER_PARSE_ERROR;
677  case G_LOOP:
678  KIG_FILTER_PARSE_ERROR;
679  default:
680  KIG_FILTER_PARSE_ERROR;
681 
682  }
683 
684  // checking if the object was correctly created
685  if ( ! o )
686  {
687  if ( ok )
688  KIG_FILTER_PARSE_ERROR
689  else
690  return 0;
691  }
692 
693  ObjectDrawer* d = new ObjectDrawer( color, width, visible, style.pen.style() );
694  if ( !labeltext.isEmpty() )
695  {
696  ObjectConstCalcer* name = new ObjectConstCalcer( new StringImp( labeltext ) );
697  object = new ObjectHolder( o, d, name );
698  }
699  else
700  {
701  object = new ObjectHolder( o, d );
702  }
703 
704  assert( object );
705  ret[i] = object;
706  object->calc( *retdoc );
707  if ( !labeltext.isEmpty() && labelVisible && object->imp()->inherits( PointImp::stype() ) )
708  {
709  std::vector<ObjectCalcer*> args2;
710  args2.push_back( object->nameCalcer() );
711  ObjectCalcer* oc2 = fact->attachedLabelCalcer(
712  QString::fromLatin1( "%1" ), object->calcer(),
713  static_cast<const PointImp*>( object->imp() )->coordinate(),
714  false, args2, *retdoc );
715  oc2->calc( *retdoc );
716  ObjectDrawer* d2 = new ObjectDrawer( style.pen.color() );
717  ObjectHolder* o2 = new ObjectHolder( oc2, d2 );
718  ret2.push_back( o2 );
719  }
720  };
721 
722  // selection groups ( we ignore them, but we pretend to read them
723  // out anyway, so we can find what comes after them.. )
724  int selgroupcount;
725  stream >> selgroupcount;
726  for ( int i = 0; i < selgroupcount; ++i )
727  {
728  QString name;
729  stream >> name;
730  int size;
731  stream >> size;
732  for ( int i = 0; i < size; ++i )
733  {
734  short object;
735  stream >> object;
736  (void) object;
737  };
738  };
739 
740  // no more data in the file..
741  retdoc->addObjects( ret );
742  retdoc->addObjects( ret2 );
743  retdoc->setAxes( false );
744  retdoc->setGrid( false );
745  return retdoc;
746 }
747 
748 KigFilterKSeg* KigFilterKSeg::instance()
749 {
750  static KigFilterKSeg f;
751  return &f;
752 }
G_CENTERPOINT_CIRCLE
Definition: kseg-defs.h:134
ObjectFactory::instance
static const ObjectFactory * instance()
Definition: object_factory.cc:90
SMALL_CIRCLE
Definition: kseg-defs.h:296
G_ARCSEGMENT
Definition: kseg-defs.h:77
ArcLineIntersectionType::instance
static const ArcLineIntersectionType * instance()
Definition: intersection_types.cc:541
G_BISECTOR_RAY
Definition: kseg-defs.h:122
G_CIRCLE
Definition: kseg-defs.h:72
ArcBTPType::instance
static const ArcBTPType * instance()
Definition: arc_type.cc:70
G_CENTERRADIUS_CIRCLE
Definition: kseg-defs.h:135
G_POINT
Definition: kseg-defs.h:68
StringImp
This ObjectImp is a BogusImp containing only a string value.
Definition: bogus_imp.h:167
RotationType::instance
static const RotationType * instance()
Definition: transform_types.cc:161
TranslatedType::instance
static const TranslatedType * instance()
Definition: transform_types.cc:52
ScalingOverCenter2Type::instance
static const ScalingOverCenter2Type * instance()
Definition: transform_types.cc:248
ObjectConstCalcer
This is an ObjectCalcer that keeps an ObjectImp, and never calculates a new one.
Definition: object_calcer.h:232
LinePerpendLPType::instance
static LinePerpendLPType * instance()
Definition: line_type.cc:130
G_MEASURE
Definition: kseg-defs.h:80
G_AREA_MEASURE
Definition: kseg-defs.h:161
intersectionPoint
static ObjectTypeCalcer * intersectionPoint(const std::vector< ObjectCalcer * > &parents, int which)
Definition: kseg-filter.cc:98
AngleType::instance
static const AngleType * instance()
Definition: angle_type.cc:63
G_ENDPOINTS_SEGMENT
Definition: kseg-defs.h:116
ObjectFactory::fixedPointCalcer
ObjectTypeCalcer * fixedPointCalcer(const Coordinate &c) const
Definition: object_factory.cc:50
G_LOOP
Definition: kseg-defs.h:84
G_OBJECT_LOCUS
Definition: kseg-defs.h:150
CircleBPRType::instance
static const CircleBPRType * instance()
Definition: circle_type.cc:210
G_CURVE
Definition: kseg-defs.h:87
G_MID_POINT
Definition: kseg-defs.h:111
RayABType::instance
static const RayABType * instance()
Definition: line_type.cc:119
HalfAngleType::instance
static const HalfAngleType * instance()
Definition: angle_type.cc:178
KigDocument::addObjects
void addObjects(const std::vector< ObjectHolder * > &os)
Add the objects os to the document.
Definition: kig_document.cc:143
ObjectFactory::locusCalcer
ObjectTypeCalcer * locusCalcer(ObjectCalcer *a, ObjectCalcer *b) const
return a locus, defined by the two points ( one constrained, and one following ) a and b ...
Definition: object_factory.cc:355
ObjectImp::propertiesInternalNames
virtual const QByteArrayList propertiesInternalNames() const
Definition: object_imp.cc:63
ObjectTypeCalcer
This is an ObjectCalcer that uses one of the various ObjectType's to calculate its ObjectImp...
Definition: object_calcer.h:183
ObjectHolder::nameCalcer
const ObjectConstCalcer * nameCalcer() const
Definition: object_holder.cc:63
IntImp
This ObjectImp is a BogusImp containing only an int value.
Definition: bogus_imp.h:128
Coordinate
The Coordinate class is the basic class representing a 2D location by its x and y components...
Definition: coordinate.h:33
KigFilterKSeg
Definition: kseg-filter.h:25
ObjectHolder::calc
void calc(const KigDocument &)
Make our ObjectCalcer recalculate its ObjectImp.
Definition: object_holder.cc:73
G_ANNOTATION
Definition: kseg-defs.h:82
KigDocument::setGrid
void setGrid(bool showgrid)
set to show/hide the grid.
Definition: kig_document.cc:181
ObjectPropertyCalcer::calc
void calc(const KigDocument &doc)
Makes the ObjectCalcer recalculate its ObjectImp from its parents.
Definition: object_calcer.cc:183
G_CALCULATE
Definition: kseg-defs.h:81
kseg-defs.h
G_ROTATED
Definition: kseg-defs.h:98
FilledPolygonImp::stype4
static const ObjectImpType * stype4()
Definition: polygon_imp.cc:732
G_POLYGON
Definition: kseg-defs.h:74
LineLineIntersectionType::instance
static const LineLineIntersectionType * instance()
Definition: intersection_types.cc:374
G_REFLECTED
Definition: kseg-defs.h:100
ObjectHolder
An ObjectHolder represents an object as it is known to the document.
Definition: object_holder.h:40
LineParallelLPType::instance
static LineParallelLPType * instance()
Definition: line_type.cc:163
KigFilterKSeg::load
KigDocument * load(const QString &fromfile)
load file fromfile and build a KigDocument from it.
Definition: kseg-filter.cc:201
VectorType::instance
static const VectorType * instance()
Definition: vector_type.cc:43
PointImp
An ObjectImp representing a point.
Definition: point_imp.h:27
ObjectCalcer
An ObjectCalcer is an object that represents an algorithm for calculating an ObjectImp from other Obj...
Definition: object_calcer.h:66
G_LINE
Definition: kseg-defs.h:71
ObjectFactory::attachedLabelCalcer
ObjectTypeCalcer * attachedLabelCalcer(const QString &s, ObjectCalcer *locationparent, const Coordinate &loc, bool needframe, const std::vector< ObjectCalcer * > &parents, const KigDocument &doc) const
this one does the same as the above, only that the new label is attached to locationparent if it is n...
Definition: object_factory.cc:402
G_SCALED
Definition: kseg-defs.h:99
filtersConstructTextObject
ObjectTypeCalcer * filtersConstructTextObject(const Coordinate &c, ObjectCalcer *o, const QByteArray &arg, const KigDocument &doc, bool needframe)
constructs a text object with text "%1", location c, and variable parts given by the argument arg of ...
Definition: filters-common.cc:28
G_ARC
Definition: kseg-defs.h:73
G_RAY
Definition: kseg-defs.h:70
G_RADIUS_MEASURE
Definition: kseg-defs.h:157
KigFilter::notSupported
void notSupported(const QString &file, const QString &explanation) const
Definition: filter.cc:92
ObjectFactory::constrainedPointCalcer
ObjectTypeCalcer * constrainedPointCalcer(ObjectCalcer *curve, double param) const
Definition: object_factory.cc:313
ObjectCalcer::calc
virtual void calc(const KigDocument &)=0
Makes the ObjectCalcer recalculate its ObjectImp from its parents.
G_CONSTRAINED_POINT
Definition: kseg-defs.h:108
FilledPolygonImp::stype
static const ObjectImpType * stype()
Definition: polygon_imp.cc:660
SegmentImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the SegmentImp type.
Definition: line_imp.cc:545
G_SLOPE_MEASURE
Definition: kseg-defs.h:160
ObjectPropertyCalcer
This is an ObjectCalcer that has a single parent, and gets a certain property from it in its calc() m...
Definition: object_calcer.h:276
ObjectFactory::propertyObjectCalcer
ObjectPropertyCalcer * propertyObjectCalcer(ObjectCalcer *o, const char *p) const
returns a property object for the property p of object o .
Definition: object_factory.cc:483
kseg-filter.h
ArcImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the ArcImp type.
Definition: other_imp.cc:629
KigFilterKSeg::supportMime
bool supportMime(const QString &mime)
can the filter handle the mimetype mime ?
Definition: kseg-filter.cc:65
G_PARALLEL_LINE
Definition: kseg-defs.h:128
KigFilterKSeg::instance
static KigFilterKSeg * instance()
Definition: kseg-filter.cc:748
CircleBCPType::instance
static const CircleBCPType * instance()
Definition: circle_type.cc:55
CircleImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the CircleImp type.
Definition: circle_imp.cc:342
ObjectHolder::calcer
const ObjectCalcer * calcer() const
Definition: object_holder.cc:53
G_PERPENDICULAR_LINE
Definition: kseg-defs.h:129
G_TWOPOINTS_RAY
Definition: kseg-defs.h:121
G_CIRCLEINTERIOR
Definition: kseg-defs.h:75
ObjectDrawer
A class holding some information about how a certain object is drawn on the window.
Definition: object_drawer.h:47
KigDocument::setAxes
void setAxes(bool showaxes)
set to show/hide the grid.
Definition: kig_document.cc:191
G_DISTANCE_MEASURE
Definition: kseg-defs.h:155
G_LENGTH_MEASURE
Definition: kseg-defs.h:156
G_ARCSECTOR
Definition: kseg-defs.h:76
PointImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing PointImp's.
Definition: point_imp.cc:159
G_SEGMENT
Definition: kseg-defs.h:69
filters-common.h
ConicRadicalType::instance
static const ConicRadicalType * instance()
Definition: conic_types.cc:562
G_INTERSECTION2_POINT
Definition: kseg-defs.h:110
ConicImp::stype
static const ObjectImpType * stype()
Returns the ObjectImpType representing the ConicImp type.
Definition: conic_imp.cc:380
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
ConicLineIntersectionType::instance
static const ConicLineIntersectionType * instance()
Definition: intersection_types.cc:54
PolygonBNPType::instance
static const PolygonBNPType * instance()
Definition: polygon_type.cc:151
ObjectCalcer::imp
virtual const ObjectImp * imp() const =0
Returns the ObjectImp of this ObjectCalcer.
G_TWOPOINTS_LINE
Definition: kseg-defs.h:127
G_LOCUS
Definition: kseg-defs.h:79
ObjectTypeCalcer::calc
void calc(const KigDocument &doc)
Makes the ObjectCalcer recalculate its ObjectImp from its parents.
Definition: object_calcer.cc:32
KIG_FILTER_PARSE_ERROR
#define KIG_FILTER_PARSE_ERROR
Definition: filter.h:53
SegmentABType::instance
static const SegmentABType * instance()
Definition: line_type.cc:55
G_ANGLE_MEASURE
Definition: kseg-defs.h:158
LineReflectionType::instance
static const LineReflectionType * instance()
Definition: transform_types.cc:122
FilledPolygonImp::stype3
static const ObjectImpType * stype3()
Definition: polygon_imp.cc:714
KigFilter::fileNotFound
void fileNotFound(const QString &file) const
Definition: filter.cc:70
G_INTERSECTION_POINT
Definition: kseg-defs.h:109
G_TRANSLATED
Definition: kseg-defs.h:97
MEDIUM_CIRCLE
Definition: kseg-defs.h:297
G_THREEPOINTS_ARC
Definition: kseg-defs.h:140
uint
unsigned int uint
Definition: object_imp.h:87
ObjectFactory
Definition: object_factory.h:23
G_FREE_POINT
Definition: kseg-defs.h:107
readKSegCoordinate
static Coordinate readKSegCoordinate(QDataStream &stream)
Definition: kseg-filter.cc:78
LineABType::instance
static const LineABType * instance()
Definition: line_type.cc:87
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