summaryrefslogtreecommitdiffstats
path: root/tksao/frame/baseellipse.h
blob: e2ed9ce225bf69caab5571762ce75d691c72c602 (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
// Copyright (C) 1999-2017
// Smithsonian Astrophysical Observatory, Cambridge, MA, USA
// For conditions of distribution and use, see copyright notice in "copyright"

#ifndef __baseellipse_h__
#define __baseellipse_h__

#include <tk.h>

#include "basemarker.h"

class BaseEllipse : public BaseMarker {
 protected:
  XPoint* xpoint_;
  int xpointSize_;
  int xpointNum_;

 private:
  double xyz(Vector rr, double ang);
  void XDrawCurve(Drawable, RenderMode, Vector&, Vector&, Vector&, Vector&);

  void renderXCircle(Drawable, Coord::InternalSystem, double, RenderMode);
  void renderXEllipse(Drawable, Coord::InternalSystem, double, RenderMode);
  void renderXBezier(Drawable, Coord::InternalSystem, RenderMode);
  void renderXBezierPrep(Drawable, Coord::InternalSystem, RenderMode,
			  double, double, double, double, Vector&);
  void renderXBezierArc(Drawable, Coord::InternalSystem, RenderMode, 
			 double, double, Vector&);
  void renderXInclude(Drawable, Coord::InternalSystem, RenderMode);

  void renderPSCircle(int);
  void renderPSEllipse(int);
  void renderPSEllipsePrep(double, double, double, double, Vector&);
  void renderPSEllipseArc(double, double, Vector&);
  void renderPSInclude(int);

#ifdef MAC_OSX_TK
  void renderMACOSXCircle();
  void renderMACOSXEllipse();
  void renderMACOSXEllipsePrep(double, double, double, double, Vector&);
  void renderMACOSXEllipseArc(double, double, Vector&);
  void renderMACOSXInclude();
#endif

#ifdef __WIN32
  void renderWIN32Circle();
  void renderWIN32Ellipse();
  void renderWIN32EllipsePrep(double, double, double, double, Vector&);
  void renderWIN32EllipseArc(double, double, Vector&);
  void renderWIN32Include();
#endif

 protected:
  void renderX(Drawable, Coord::InternalSystem, RenderMode);
  virtual void renderXArcDraw(Drawable, GC, Vector&, Vector&, 
				 int, int, RenderMode);
  virtual void renderXBezierDraw(Drawable, GC, RenderMode);
  void renderXBezierDashDraw(Drawable, GC);

  void renderPS(int);
  virtual void renderPSDraw();
  void renderPSFill();

#ifdef MAC_OSX_TK
  void renderMACOSX();
  virtual void renderMACOSXDraw();
#endif
#ifdef __WIN32
  void renderWIN32();
  virtual void renderWIN32Draw();
#endif

  virtual void updateHandles();
  Vector intersect(Vector, double);

  int isInRef(const Vector& vv, int);

 public:
  BaseEllipse(Base* p, const Vector& ctr, double a);
  BaseEllipse(Base* p, const Vector& ctr, 
	      double a,
	      const char* clr, int* dsh, 
	      int w, const char* f, const char* t, 
	      unsigned short prop, const char* c, 
	      const List<Tag>& tag, const List<CallBack>& cb);
  BaseEllipse(const BaseEllipse&);

  virtual ~BaseEllipse();

  virtual Marker* dup() =0;

  int isIn(const Vector& vv) 
  {return isIn(vv, Coord::CANVAS);}
  int isIn(const Vector& vv, Coord::InternalSystem sys)
  {return isIn(vv,sys,numAnnuli_-1);}
  int isIn(const Vector& vv, Coord::InternalSystem sys, int nn)
  {return isInRef(bckMap(vv,sys),nn);}
  virtual int isIn(const Vector& vv, Coord::InternalSystem sys, int nn, int aa)
  {return isInRef(bckMap(vv,sys),nn);}

  // valid for non-fixed only
  int isIn(const Vector& vv, const Matrix& bck)
  {return isIn(vv,bck,numAnnuli_-1);}
  int isIn(const Vector& vv, const Matrix& bck, int nn)
  {return isInRef(vv*bck,nn);}
};

#endif