• 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
  • misc
coordinate_system.h
Go to the documentation of this file.
1 /*
2  This file is part of Kig, a KDE program for Interactive Geometry...
3  Copyright (C) 2002 Dominique Devriese <devriese@kde.org>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18  USA
19 */
20 
21 #ifndef KIG_MISC_COORDINATE_SYSTEM_H
22 #define KIG_MISC_COORDINATE_SYSTEM_H
23 
24 #include <qnamespace.h>
25 
26 class KigPainter;
27 class KigDocument;
28 class KigWidget;
29 class CoordinateSystem;
30 class QValidator;
31 class Coordinate;
32 class QString;
33 class QStringList;
34 
39 class CoordinateSystemFactory
40 {
41 public:
42  enum { Euclidean = 0, Polar = 1 };
43 
44  static QStringList names();
45  static QString setCoordinateSystemStatement( int id );
46  static CoordinateSystem* build( int which );
47  static CoordinateSystem* build( const char* type );
48 };
49 
60 class CoordinateSystem
61 // : public Qt
62 {
63 public:
64  CoordinateSystem();
65  virtual ~CoordinateSystem();
66 
67  virtual QString fromScreen ( const Coordinate& pt, const KigDocument& w ) const = 0;
74  virtual QString coordinateFormatNotice() const = 0;
79  virtual QString coordinateFormatNoticeMarkup() const = 0;
80  virtual Coordinate toScreen (const QString& pt, bool& ok) const = 0;
81  virtual void drawGrid ( KigPainter& p, bool showgrid = true,
82  bool showaxes = true ) const = 0;
83  virtual QValidator* coordinateValidator() const = 0;
84  virtual Coordinate snapToGrid( const Coordinate& c,
85  const KigWidget& w ) const = 0;
86 
87  virtual const char* type() const = 0;
88  virtual int id() const = 0;
89 };
90 
91 class EuclideanCoords
92  : public CoordinateSystem
93 {
94 public:
95  EuclideanCoords();
96  ~EuclideanCoords();
97  QString fromScreen( const Coordinate& pt, const KigDocument& w ) const;
98  QString coordinateFormatNotice() const;
99  QString coordinateFormatNoticeMarkup() const;
100  Coordinate toScreen (const QString& pt, bool& ok) const;
101  void drawGrid ( KigPainter& p, bool showgrid = true,
102  bool showaxes = true ) const;
103  QValidator* coordinateValidator() const;
104  Coordinate snapToGrid( const Coordinate& c,
105  const KigWidget& w ) const;
106 
107  const char* type() const;
108  int id() const;
109 };
110 
111 class PolarCoords
112  : public CoordinateSystem
113 {
114  void drawGridLine( KigPainter& p, const Coordinate& center,
115  double radius ) const;
116 public:
117  PolarCoords();
118  ~PolarCoords();
119  QString fromScreen( const Coordinate& pt, const KigDocument& w ) const;
120  QString coordinateFormatNotice() const;
121  QString coordinateFormatNoticeMarkup() const;
122  Coordinate toScreen (const QString& pt, bool& ok) const;
123  void drawGrid ( KigPainter& p, bool showgrid = true,
124  bool showaxes = true ) const;
125  QValidator* coordinateValidator() const;
126  Coordinate snapToGrid( const Coordinate& c,
127  const KigWidget& w ) const;
128 
129  const char* type() const;
130  int id() const;
131 };
132 
133 #endif
PolarCoords
Definition: coordinate_system.h:111
CoordinateSystemFactory::Polar
Definition: coordinate_system.h:42
CoordinateSystemFactory::build
static CoordinateSystem * build(int which)
Definition: coordinate_system.cpp:535
CoordinateSystem
a CoordinateSystem is what the user sees: it is kept by KigPart to show the user a grid...
Definition: coordinate_system.h:60
EuclideanCoords::coordinateValidator
QValidator * coordinateValidator() const
Definition: coordinate_system.cpp:517
CoordinateSystem::coordinateValidator
virtual QValidator * coordinateValidator() const =0
CoordinateSystem::coordinateFormatNotice
virtual QString coordinateFormatNotice() const =0
This returns a notice to say in which format coordinates should be entered.
CoordinateSystem::toScreen
virtual Coordinate toScreen(const QString &pt, bool &ok) const =0
CoordinateSystem::snapToGrid
virtual Coordinate snapToGrid(const Coordinate &c, const KigWidget &w) const =0
EuclideanCoords::coordinateFormatNotice
QString coordinateFormatNotice() const
This returns a notice to say in which format coordinates should be entered.
Definition: coordinate_system.cpp:323
PolarCoords::snapToGrid
Coordinate snapToGrid(const Coordinate &c, const KigWidget &w) const
Definition: coordinate_system.cpp:624
EuclideanCoords::coordinateFormatNoticeMarkup
QString coordinateFormatNoticeMarkup() const
Like coordinateFormatNotice(), but with HTML tags useful to have a rich text...
Definition: coordinate_system.cpp:329
EuclideanCoords::~EuclideanCoords
~EuclideanCoords()
Definition: coordinate_system.cpp:335
CoordinateSystemFactory::Euclidean
Definition: coordinate_system.h:42
PolarCoords::fromScreen
QString fromScreen(const Coordinate &pt, const KigDocument &w) const
Definition: coordinate_system.cpp:355
CoordinateSystem::fromScreen
virtual QString fromScreen(const Coordinate &pt, const KigDocument &w) const =0
CoordinateSystemFactory::setCoordinateSystemStatement
static QString setCoordinateSystemStatement(int id)
Definition: coordinate_system.cpp:576
CoordinateSystemFactory::names
static QStringList names()
Definition: coordinate_system.cpp:527
EuclideanCoords::fromScreen
QString fromScreen(const Coordinate &pt, const KigDocument &w) const
Definition: coordinate_system.cpp:150
CoordinateSystem::~CoordinateSystem
virtual ~CoordinateSystem()
Definition: coordinate_system.cpp:339
Coordinate
The Coordinate class is the basic class representing a 2D location by its x and y components...
Definition: coordinate.h:33
EuclideanCoords
Definition: coordinate_system.h:91
KigPainter
KigPainter is an extended QPainter.
Definition: kigpainter.h:51
EuclideanCoords::id
int id() const
Definition: coordinate_system.cpp:566
EuclideanCoords::type
const char * type() const
Definition: coordinate_system.cpp:556
KigWidget
This class is the real widget showing the document.
Definition: kig_view.h:50
PolarCoords::coordinateValidator
QValidator * coordinateValidator() const
Definition: coordinate_system.cpp:522
EuclideanCoords::snapToGrid
Coordinate snapToGrid(const Coordinate &c, const KigWidget &w) const
Definition: coordinate_system.cpp:590
PolarCoords::~PolarCoords
~PolarCoords()
Definition: coordinate_system.cpp:351
CoordinateSystem::drawGrid
virtual void drawGrid(KigPainter &p, bool showgrid=true, bool showaxes=true) const =0
PolarCoords::PolarCoords
PolarCoords()
Definition: coordinate_system.cpp:347
CoordinateSystemFactory
a factory to build a CoordinateSystem and a small handle to the existent CoordinateSystem's...
Definition: coordinate_system.h:39
CoordinateSystem::coordinateFormatNoticeMarkup
virtual QString coordinateFormatNoticeMarkup() const =0
Like coordinateFormatNotice(), but with HTML tags useful to have a rich text...
PolarCoords::coordinateFormatNoticeMarkup
QString coordinateFormatNoticeMarkup() const
Like coordinateFormatNotice(), but with HTML tags useful to have a rich text...
Definition: coordinate_system.cpp:375
EuclideanCoords::EuclideanCoords
EuclideanCoords()
Definition: coordinate_system.cpp:146
PolarCoords::toScreen
Coordinate toScreen(const QString &pt, bool &ok) const
Definition: coordinate_system.cpp:382
PolarCoords::drawGrid
void drawGrid(KigPainter &p, bool showgrid=true, bool showaxes=true) const
Definition: coordinate_system.cpp:403
KigDocument
KigDocument is the class holding the real data in a Kig document.
Definition: kig_document.h:36
EuclideanCoords::drawGrid
void drawGrid(KigPainter &p, bool showgrid=true, bool showaxes=true) const
Definition: coordinate_system.cpp:211
CoordinateSystem::CoordinateSystem
CoordinateSystem()
Definition: coordinate_system.cpp:343
CoordinateSystem::type
virtual const char * type() const =0
CoordinateSystem::id
virtual int id() const =0
EuclideanCoords::toScreen
Coordinate toScreen(const QString &pt, bool &ok) const
Definition: coordinate_system.cpp:162
PolarCoords::type
const char * type() const
Definition: coordinate_system.cpp:561
PolarCoords::coordinateFormatNotice
QString coordinateFormatNotice() const
This returns a notice to say in which format coordinates should be entered.
Definition: coordinate_system.cpp:368
PolarCoords::id
int id() const
Definition: coordinate_system.cpp:571
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