summaryrefslogtreecommitdiffstats
path: root/tksao/frame
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2017-03-19 18:13:45 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2017-03-19 18:13:45 (GMT)
commite04b80382f90d1b31a27c92693fdf1110ce91822 (patch)
treead75a002fae6f81115dba24bb4aa53434780dec9 /tksao/frame
parentd496f63d7b4ca3d4df7176e89d07549c27456774 (diff)
downloadblt-e04b80382f90d1b31a27c92693fdf1110ce91822.zip
blt-e04b80382f90d1b31a27c92693fdf1110ce91822.tar.gz
blt-e04b80382f90d1b31a27c92693fdf1110ce91822.tar.bz2
add support for region fill
Diffstat (limited to 'tksao/frame')
-rw-r--r--tksao/frame/basebox.C25
-rw-r--r--tksao/frame/basebox.h10
-rw-r--r--tksao/frame/baseellipse.C93
-rw-r--r--tksao/frame/baseellipse.h11
-rw-r--r--tksao/frame/basepolygon.h5
-rw-r--r--tksao/frame/box.C44
-rw-r--r--tksao/frame/box.h20
-rw-r--r--tksao/frame/circle.C86
-rw-r--r--tksao/frame/circle.h22
-rw-r--r--tksao/frame/ellipse.C86
-rw-r--r--tksao/frame/ellipse.h22
-rw-r--r--tksao/frame/polygon.C62
-rw-r--r--tksao/frame/polygon.h9
13 files changed, 370 insertions, 125 deletions
diff --git a/tksao/frame/basebox.C b/tksao/frame/basebox.C
index b7edb22..7d55dc8 100644
--- a/tksao/frame/basebox.C
+++ b/tksao/frame/basebox.C
@@ -86,6 +86,21 @@ void BaseBox::renderPSDraw(int ii)
Tcl_AppendResult(parent->interp, str.str().c_str(), NULL);
}
+void BaseBox::renderPSFillDraw(int ii)
+{
+ ostringstream str;
+ for (int jj=0; jj<numPoints_; jj++) {
+ Vector v = parent->mapFromRef(vertices_[ii][jj],Coord::CANVAS);
+ if (jj==0)
+ str << "newpath "
+ << v.TkCanvasPs(parent->canvas) << " moveto" << endl;
+ else
+ str << v.TkCanvasPs(parent->canvas) << " lineto" << endl;
+ }
+ str << "fill" << endl << ends;
+ Tcl_AppendResult(parent->interp, str.str().c_str(), NULL);
+}
+
#ifdef MAC_OSX_TK
void BaseBox::renderMACOSX()
{
@@ -101,6 +116,11 @@ void BaseBox::renderMACOSX()
}
deleteVertices();
}
+
+void BaseBox::renderMACOSXDraw(Vector* vv)
+{
+ macosxDrawLines(vv, numPoints_);
+}
#endif
#ifdef __WIN32
@@ -118,6 +138,11 @@ void BaseBox::renderWIN32()
}
deleteVertices();
}
+
+void BaseBox::renderWIN32Draw(Vector* vv)
+{
+ win32DrawLines(vv, numPoints_);
+}
#endif
// Support
diff --git a/tksao/frame/basebox.h b/tksao/frame/basebox.h
index b3919f9..37f9ae2 100644
--- a/tksao/frame/basebox.h
+++ b/tksao/frame/basebox.h
@@ -26,21 +26,25 @@ class BaseBox : public BaseMarker {
int isInRef(const Vector& vv, int);
protected:
- virtual void updateHandles();
- Vector intersect(Vector, double);
-
void renderX(Drawable, Coord::InternalSystem, RenderMode);
virtual void renderXDraw(Drawable drawable, GC lgc, XPoint* pp);
+
void renderPS(int);
virtual void renderPSDraw(int);
+ void renderPSFillDraw(int);
#ifdef MAC_OSX_TK
void renderMACOSX();
+ virtual void renderMACOSXDraw(Vector*);
#endif
#ifdef __WIN32
void renderWIN32();
+ virtual void renderWIN32Draw(Vector*);
#endif
+ virtual void updateHandles();
+ Vector intersect(Vector, double);
+
public:
BaseBox(Base* p, const Vector& ctr, double a);
BaseBox(Base* p, const Vector& ctr,
diff --git a/tksao/frame/baseellipse.C b/tksao/frame/baseellipse.C
index cb0c63f..8e6166f 100644
--- a/tksao/frame/baseellipse.C
+++ b/tksao/frame/baseellipse.C
@@ -164,7 +164,7 @@ void BaseEllipse::renderXEllipse(Drawable drawable, Coord::InternalSystem sys,
}
}
- renderXEllipseDraw(drawable, lgc, xpoint_, xpointNum_);
+ renderXEllipseDraw(drawable, lgc);
if (xpoint_)
free(xpoint_);
@@ -174,21 +174,24 @@ void BaseEllipse::renderXEllipse(Drawable drawable, Coord::InternalSystem sys,
}
}
-void BaseEllipse::renderXEllipseDraw(Drawable drawable, GC lgc,
- XPoint* pts, int cnt)
+void BaseEllipse::renderXEllipseDraw(Drawable drawable, GC lgc)
{
if ((properties & SOURCE) && !(properties & DASH))
- XDrawLines(display, drawable, lgc, pts, cnt, CoordModeOrigin);
- else {
- // crude attempt to clip unwanted drawlines
- // only works for SRC
- for (int ii=0; ii<xpointNum_; ii+=2) {
- XPoint* ptr1 = xpoint_+ii;
- XPoint* ptr2 = xpoint_+ii+1;
- XDrawLine(display, drawable, lgc,
- (*ptr1).x, (*ptr1).y, (*ptr2).x, (*ptr2).y);
- }
- }
+ XDrawLines(display, drawable, lgc, xpoint_, xpointNum_, CoordModeOrigin);
+ else
+ renderXEllipseDashDraw(drawable, lgc);
+}
+
+void BaseEllipse::renderXEllipseDashDraw(Drawable drawable, GC lgc)
+{
+ // crude attempt to clip unwanted drawlines
+ // only works for SRC
+ for (int ii=0; ii<xpointNum_; ii+=2) {
+ XPoint* ptr1 = xpoint_+ii;
+ XPoint* ptr2 = xpoint_+ii+1;
+ XDrawLine(display, drawable, lgc,
+ (*ptr1).x, (*ptr1).y, (*ptr2).x, (*ptr2).y);
+ }
}
void BaseEllipse::renderXEllipsePrep(Drawable drawable,
@@ -391,7 +394,18 @@ void BaseEllipse::renderPSCircleDraw(Vector& cc, double l, float a1, float a2)
<< l << ' '
<< a1 << ' ' << a2 << ' '
<< "arc stroke" << endl << ends;
+ Tcl_AppendResult(parent->interp, str.str().c_str(), NULL);
+}
+void BaseEllipse::renderPSCircleFillDraw(Vector& cc, double l,
+ float a1, float a2)
+{
+ ostringstream str;
+ str << "newpath "
+ << cc.TkCanvasPs(parent->getCanvas()) << ' '
+ << l << ' '
+ << a1 << ' ' << a2 << ' '
+ << "arc fill" << endl << ends;
Tcl_AppendResult(parent->interp, str.str().c_str(), NULL);
}
@@ -481,11 +495,35 @@ void BaseEllipse::renderPSEllipseArcDraw(Vector& tt0, Vector& xx1,
<< "moveto "
<< xx1.TkCanvasPs(parent->canvas) << ' '
<< xx2.TkCanvasPs(parent->canvas) << ' '
- << tt1.TkCanvasPs(parent->canvas) << ' '
+ << tt1.TkCanvasPs(parent->canvas) << ' '
<< "curveto stroke" << endl << ends;
Tcl_AppendResult(parent->interp, str.str().c_str(), NULL);
}
+void BaseEllipse::renderPSEllipseArcFillDraw(Vector& tt0, Vector& xx1,
+ Vector& xx2, Vector& tt1)
+{
+ Vector cc = parent->mapFromRef(center,Coord::CANVAS);
+ ostringstream str;
+ str << "newpath "
+ << tt0.TkCanvasPs(parent->getCanvas()) << ' '
+ << "moveto "
+ << xx1.TkCanvasPs(parent->getCanvas()) << ' '
+ << xx2.TkCanvasPs(parent->getCanvas()) << ' '
+ << tt1.TkCanvasPs(parent->getCanvas()) << ' '
+ << "curveto fill" << endl
+ << "newpath "
+ << cc.TkCanvasPs(parent->getCanvas()) << ' '
+ << "moveto "
+ << tt0.TkCanvasPs(parent->getCanvas()) << ' '
+ << "lineto "
+ << tt1.TkCanvasPs(parent->getCanvas()) << ' '
+ << "lineto closepath gsave" << endl
+ << "1 setlinejoin 1 setlinewidth stroke" << endl
+ << "grestore fill" << endl << ends;
+ Tcl_AppendResult(parent->interp, str.str().c_str(), NULL);
+}
+
void BaseEllipse::renderPSInclude(int mode)
{
if (!(properties & INCLUDE)) {
@@ -522,7 +560,7 @@ void BaseEllipse::renderMACOSX() {
if (isRound && isScale && isOrient & parent->isAzElZero())
renderMACOSXCircle();
else
- renderMACOSXEllipseCurve();
+ renderMACOSXEllipse();
}
void BaseEllipse::renderMACOSXCircle()
@@ -547,11 +585,17 @@ void BaseEllipse::renderMACOSXCircle()
if (a2<=a1)
a2 += M_TWOPI;
- macosxDrawArc(cc, l, a1, a2);
+ renderMACOSXCircleDraw(cc, l, a1, a2);
}
}
-void BaseEllipse::renderMACOSXEllipseCurve()
+void BaseEllipse::renderMACOSXCircleDraw(Vector& cc, double l,
+ float a1, float a2)
+{
+ macosxDrawArc(cc, l, a1, a2);
+}
+
+void BaseEllipse::renderMACOSXEllipse()
{
renderMACOSXGC();
@@ -626,6 +670,11 @@ void BaseEllipse::renderMACOSXEllipseArc(double a1, double a2, Vector& rr)
Vector xx2 = fwdMap(x2*FlipY(),Coord::CANVAS);
Vector tt1 = fwdMap(t1*FlipY(),Coord::CANVAS);
+ renderMACOSXEllipseArcDraw(tt0, xx1, xx2, tt1);
+}
+
+void BaseEllipse::renderMACOSXEllipseArcDraw(Vector& tt0, Vector& xx1, Vector& xx2, Vector& tt1)
+{
macosxDrawCurve(tt0, xx1, xx2, tt1);
}
@@ -684,10 +733,16 @@ void BaseEllipse::renderWIN32Circle()
if (a2<=a1)
a2 += M_TWOPI;
- win32DrawArc(cc, l, a1, a2);
+ renderWIN32CircleDraw(cc, l, a1, a2);
}
}
+void BaseEllipse::renderWIN32CircleDraw(Vector& cc, double l,
+ float a1, float a2)
+{
+ win32DrawArc(cc, l, a1, a2);
+}
+
void BaseEllipse::renderWIN32EllipseCurve()
{
renderWIN32GC();
diff --git a/tksao/frame/baseellipse.h b/tksao/frame/baseellipse.h
index 117ad8a..f4794b4 100644
--- a/tksao/frame/baseellipse.h
+++ b/tksao/frame/baseellipse.h
@@ -35,7 +35,7 @@ class BaseEllipse : public BaseMarker {
#ifdef MAC_OSX_TK
void renderMACOSXCircle();
- void renderMACOSXEllipseCurve();
+ void renderMACOSXEllipse();
void renderMACOSXEllipsePrep(double, double, double, double, Vector&);
void renderMACOSXEllipseArc(double, double, Vector&);
void renderMACOSXInclude();
@@ -52,16 +52,23 @@ class BaseEllipse : public BaseMarker {
protected:
void renderX(Drawable, Coord::InternalSystem, RenderMode);
virtual void renderXCircleDraw(Drawable, GC, Vector&, Vector&, int, int);
- virtual void renderXEllipseDraw(Drawable, GC, XPoint*, int);
+ virtual void renderXEllipseDraw(Drawable, GC);
+ void renderXEllipseDashDraw(Drawable, GC);
+
void renderPS(int);
virtual void renderPSCircleDraw(Vector& cc, double l, float a1, float a2);
+ void renderPSCircleFillDraw(Vector& cc, double l, float a1, float a2);
virtual void renderPSEllipseArcDraw(Vector&, Vector&, Vector&, Vector&);
+ void renderPSEllipseArcFillDraw(Vector&, Vector&, Vector&, Vector&);
#ifdef MAC_OSX_TK
void renderMACOSX();
+ virtual void renderMACOSXCircleDraw(Vector&, double, float, float);
+ virtual void renderMACOSXEllipseArcDraw(Vector&, Vector&, Vector&, Vector&);
#endif
#ifdef __WIN32
void renderWIN32();
+ virtual void renderWIN32CircleDraw(Vector&, double, float, float);
#endif
virtual void updateHandles();
diff --git a/tksao/frame/basepolygon.h b/tksao/frame/basepolygon.h
index 9712138..e9c2170 100644
--- a/tksao/frame/basepolygon.h
+++ b/tksao/frame/basepolygon.h
@@ -13,8 +13,6 @@ class BasePolygon : public Marker {
List<Vertex> vertex;
protected:
- void moveVertex(const Vector&, int);
- void recalcCenter();
virtual void renderX(Drawable, Coord::InternalSystem, RenderMode) =0;
virtual void renderPS(int) =0;
#ifdef MAC_OSX_TK
@@ -23,6 +21,9 @@ class BasePolygon : public Marker {
#ifdef __WIN32
virtual void renderWIN32() =0;
#endif
+
+ void moveVertex(const Vector&, int);
+ void recalcCenter();
void updateHandles();
void listBase(FitsImage*, ostream&, Coord::CoordSystem,
diff --git a/tksao/frame/box.C b/tksao/frame/box.C
index a6ca971..5c4908b 100644
--- a/tksao/frame/box.C
+++ b/tksao/frame/box.C
@@ -7,15 +7,19 @@
#include "box.h"
#include "fitsimage.h"
-Box::Box(const Box& a) : BaseBox(a), BaseFill(a) {}
+Box::Box(const Box& a) : BaseBox(a)
+{
+ fill_ =0;
+}
Box::Box(Base* p, const Vector& ctr, const Vector& seg, double ang, int fill)
- : BaseBox(p, ctr, ang), BaseFill(fill)
+ : BaseBox(p, ctr, ang)
{
numAnnuli_ = 1;
annuli_ = new Vector[1];
annuli_[0] = seg;
+ fill_ = fill;
strcpy(type_,"box");
numHandle = 4;
@@ -29,13 +33,13 @@ Box::Box(Base* p, const Vector& ctr,
int wth, const char* fnt, const char* txt,
unsigned short prop, const char* cmt,
const List<Tag>& tg, const List<CallBack>& cb)
- : BaseBox(p, ctr, ang, clr, dsh, wth, fnt, txt, prop, cmt, tg, cb),
- BaseFill(fill)
+ : BaseBox(p, ctr, ang, clr, dsh, wth, fnt, txt, prop, cmt, tg, cb)
{
numAnnuli_ = 1;
annuli_ = new Vector[1];
annuli_[0] = seg;
+ fill_ = fill;
strcpy(type_,"box");
numHandle = 4;
@@ -52,22 +56,30 @@ void Box::renderXDraw(Drawable drawable, GC lgc, XPoint* pp)
void Box::renderPSDraw(int ii)
{
- ostringstream str;
- for (int jj=0; jj<numPoints_; jj++) {
- Vector v = parent->mapFromRef(vertices_[ii][jj],Coord::CANVAS);
- if (jj==0)
- str << "newpath "
- << v.TkCanvasPs(parent->canvas) << " moveto" << endl;
- else
- str << v.TkCanvasPs(parent->canvas) << " lineto" << endl;
- }
if (fill_)
- str << "fill" << endl << ends;
+ BaseBox::renderPSFillDraw(ii);
else
- str << "stroke" << endl << ends;
+ BaseBox::renderPSDraw(ii);
+}
- Tcl_AppendResult(parent->interp, str.str().c_str(), NULL);
+#ifdef MAC_OSX_TK
+void Box::renderMACOSXDraw(Vector* vv)
+{
+ if (fill_)
+ macosxFillPolygon(vv, numPoints_);
+ else
+ macosxDrawLines(vv, numPoints_);
+}
+#endif
+
+#ifdef __WIN32
+void Box::renderWIN32Draw(Vector* vv)
+ if (fill_)
+ win32FillPolygon(vv, numPoints_);
+ else
+ win32DrawLines(vv, numPoints_);
}
+#endif
void Box::editBegin(int h)
{
diff --git a/tksao/frame/box.h b/tksao/frame/box.h
index ba7460e..e558688 100644
--- a/tksao/frame/box.h
+++ b/tksao/frame/box.h
@@ -6,14 +6,25 @@
#define __box_h__
#include "basebox.h"
-#include "basefill.h"
-class Box : public BaseBox, public BaseFill {
+class Box : public BaseBox {
+ protected:
+ int fill_;
+
protected:
- void listNonCel(FitsImage*, ostream&, Coord::CoordSystem);
void renderXDraw(Drawable drawable, GC lgc, XPoint* pp);
void renderPSDraw(int);
+#ifdef MAC_OSX_TK
+ void renderMACOSXDraw(Vector*);
+#endif
+
+#ifdef __WIN32
+ void renderWIN32Draw(Vector*);
+#endif
+
+ void listNonCel(FitsImage*, ostream&, Coord::CoordSystem);
+
public:
Box(Base* p, const Vector& ctr, const Vector& seg, double ang, int fill);
Box(Base* p, const Vector& ctr,
@@ -30,6 +41,9 @@ public:
void edit(const Vector&, int);
void editEnd();
+ void fill(int ff) {fill_ = ff;}
+ int getFill() {return fill_;}
+
void analysis(AnalysisTask, int);
void analysisHistogram(char*, char*, int);
void analysisPlot3d(char*, char*, Coord::CoordSystem, Marker::AnalysisMethod);
diff --git a/tksao/frame/circle.C b/tksao/frame/circle.C
index 87d29cb..f3f08c9 100644
--- a/tksao/frame/circle.C
+++ b/tksao/frame/circle.C
@@ -7,15 +7,19 @@
#include "circle.h"
#include "fitsimage.h"
-Circle::Circle(const Circle& a) : BaseEllipse(a), BaseFillEllipse(a) {}
+Circle::Circle(const Circle& a) : BaseEllipse(a)
+{
+ fill_ =0;
+}
Circle::Circle(Base* p, const Vector& ctr, double r, int fill)
- : BaseEllipse(p, ctr, 0), BaseFillEllipse(fill)
+ : BaseEllipse(p, ctr, 0)
{
numAnnuli_ = 1;
annuli_ = new Vector[1];
annuli_[0] = Vector(r,r);
+ fill_ = fill;
strcpy(type_, "circle");
numHandle = 4;
@@ -28,13 +32,13 @@ Circle::Circle(Base* p, const Vector& ctr,
int wth, const char* fnt, const char* txt,
unsigned short prop, const char* cmt,
const List<Tag>& tg, const List<CallBack>& cb)
- : BaseEllipse(p, ctr, 0, clr, dsh, wth, fnt, txt, prop, cmt, tg, cb),
- BaseFillEllipse(fill)
+ : BaseEllipse(p, ctr, 0, clr, dsh, wth, fnt, txt, prop, cmt, tg, cb)
{
numAnnuli_ = 1;
annuli_ = new Vector[numAnnuli_];
annuli_[0] = Vector(r,r);
+ fill_ = fill;
strcpy(type_, "circle");
numHandle = 4;
@@ -58,36 +62,76 @@ void Circle::renderXCircleDraw(Drawable drawable, GC lgc,
Vector& st, Vector& size,
int a1, int aa)
{
- BaseFillEllipse::renderXCircleDraw(display, drawable, lgc, st, size, a1, aa);
+ if (fill_)
+ XFillArc(display, drawable, lgc, st[0], st[1], size[0], size[1], a1, aa);
+ else
+ XDrawArc(display, drawable, lgc, st[0], st[1], size[0], size[1], a1, aa);
}
-void Circle::renderXEllipseDraw(Drawable drawable, GC lgc,
- XPoint* pts, int cnt)
+void Circle::renderXEllipseDraw(Drawable drawable, GC lgc)
{
- if (fill_ || ((properties & SOURCE) && !(properties & DASH)))
- BaseFillEllipse::renderXEllipseDraw(display, drawable, lgc, pts, cnt);
- else {
- // crude attempt to clip unwanted drawlines
- // only works for SRC
- for (int ii=0; ii<xpointNum_; ii+=2) {
- XPoint* ptr1 = xpoint_+ii;
- XPoint* ptr2 = xpoint_+ii+1;
- XDrawLine(display, drawable, lgc,
- (*ptr1).x, (*ptr1).y, (*ptr2).x, (*ptr2).y);
- }
- }
+ if (fill_)
+ XFillPolygon(display, drawable, lgc, xpoint_, xpointNum_, Convex, CoordModeOrigin);
+ else if ((properties & SOURCE) && !(properties & DASH))
+ XDrawLines(display, drawable, lgc, xpoint_, xpointNum_, CoordModeOrigin);
+ else
+ renderXEllipseDashDraw(drawable, lgc);
}
void Circle::renderPSCircleDraw(Vector& cc, double l, float a1, float a2)
{
- BaseFillEllipse::renderPSCircleDraw(parent, cc, l, a1, a2);
+ if (fill_)
+ BaseEllipse::renderPSCircleFillDraw(cc, l, a1, a2);
+ else
+ BaseEllipse::renderPSCircleDraw(cc, l, a1, a2);
}
void Circle::renderPSEllipseArcDraw(Vector& tt0, Vector& xx1,
Vector& xx2, Vector& tt1)
{
- BaseFillEllipse::renderPSEllipseArcDraw(parent, center, tt0, xx1, xx2, tt1);
+ if (fill_)
+ BaseEllipse::renderPSEllipseArcFillDraw(tt0, xx1, xx2, tt1);
+ else
+ BaseEllipse::renderPSEllipseArcDraw(tt0, xx1, xx2, tt1);
+}
+
+#ifdef MAC_OSX_TK
+void Circle::renderMACOSXCircleDraw(Vector& cc, double l, float a1, float a2)
+{
+ if (fill_)
+ macosxFillArc(cc, l, a1, a2);
+ else
+ macosxDrawArc(cc, l, a1, a2);
+}
+
+void Circle::renderMACOSXEllipseArcDraw(Vector& tt0, Vector& xx1,
+ Vector& xx2, Vector& tt1)
+{
+ if (fill_)
+ macosxFillCurve(tt0, xx1, xx2, tt1);
+ else
+ macosxDrawCurve(tt0, xx1, xx2, tt1);
+}
+#endif
+
+#ifdef __WIN32
+void Circle::renderWIN32CircleDraw(Vector& cc, double l, float a1, float a2)
+{
+ if (fill_)
+ win32FillArc(cc, l, a1, a2);
+ else
+ win32DrawArc(cc, l, a1, a2);
+}
+
+void Circle::renderWIN32EllipseArcDraw(Vector& tt0, Vector& xx1,
+ Vector& xx2, Vector& tt1)
+{
+ if (fill_)
+ win32FillCurve(tt0, xx1, xx2, tt1);
+ else
+ win32DrawCurve(tt0, xx1, xx2, tt1);
}
+#endif
void Circle::analysis(AnalysisTask mm, int which)
{
diff --git a/tksao/frame/circle.h b/tksao/frame/circle.h
index ed26b7b..ac856b7 100644
--- a/tksao/frame/circle.h
+++ b/tksao/frame/circle.h
@@ -6,15 +6,28 @@
#define __circle_h__
#include "baseellipse.h"
-#include "basefill.h"
-class Circle : public BaseEllipse, public BaseFillEllipse {
+class Circle : public BaseEllipse {
+ protected:
+ int fill_;
+
protected:
void renderXCircleDraw(Drawable, GC, Vector&, Vector&, int, int);
- void renderXEllipseDraw(Drawable, GC, XPoint*, int);
+ void renderXEllipseDraw(Drawable, GC);
+
void renderPSCircleDraw(Vector& cc, double l, float a1, float a2);
void renderPSEllipseArcDraw(Vector&, Vector&, Vector&, Vector&);
+#ifdef MAC_OSX_TK
+ void renderMACOSXCircleDraw(Vector&, double, float, float);
+ void renderMACOSXEllipseArcDraw(Vector&, Vector&, Vector&, Vector&);
+#endif
+
+#ifdef __WIN32
+ void renderWIN32CircleDraw(Vector&, double, float, float);
+ void renderWIN32EllipseArcDraw(Vector&, Vector&, Vector&, Vector&);
+#endif
+
void listNonCel(FitsImage*, ostream&, Coord::CoordSystem);
public:
@@ -34,6 +47,9 @@ public:
void rotate(const Vector& v, int h) {}
void rotateEnd() {}
+ void fill(int ff) {fill_ = ff;}
+ int getFill() {return fill_;}
+
void analysis(AnalysisTask, int);
void analysisHistogram(char*, char*, int);
void analysisPlot3d(char*, char*, Coord::CoordSystem, Marker::AnalysisMethod);
diff --git a/tksao/frame/ellipse.C b/tksao/frame/ellipse.C
index 0a53023..6dbedb7 100644
--- a/tksao/frame/ellipse.C
+++ b/tksao/frame/ellipse.C
@@ -7,16 +7,20 @@
#include "ellipse.h"
#include "fitsimage.h"
-Ellipse::Ellipse(const Ellipse& a) : BaseEllipse(a), BaseFillEllipse(a) {}
+Ellipse::Ellipse(const Ellipse& a) : BaseEllipse(a)
+{
+ fill_ =0;
+}
Ellipse::Ellipse(Base* p, const Vector& ctr, const Vector& r,
double ang, int fill)
- : BaseEllipse(p, ctr, ang), BaseFillEllipse(fill)
+ : BaseEllipse(p, ctr, ang)
{
numAnnuli_ = 1;
annuli_ = new Vector[1];
annuli_[0] = r;
+ fill_ = fill;
strcpy(type_,"ellipse");
numHandle = 4;
@@ -29,13 +33,13 @@ Ellipse::Ellipse(Base* p, const Vector& ctr,
int wth, const char* fnt, const char* txt,
unsigned short prop, const char* cmt,
const List<Tag>& tg, const List<CallBack>& cb)
- : BaseEllipse(p, ctr, ang, clr, dsh, wth, fnt, txt, prop, cmt, tg, cb),
- BaseFillEllipse(fill)
+ : BaseEllipse(p, ctr, ang, clr, dsh, wth, fnt, txt, prop, cmt, tg, cb)
{
numAnnuli_ = 1;
annuli_ = new Vector[1];
annuli_[0] = r;
+ fill_ = fill;
strcpy(type_,"ellipse");
numHandle = 4;
@@ -46,36 +50,76 @@ void Ellipse::renderXCircleDraw(Drawable drawable, GC lgc,
Vector& st, Vector& size,
int a1, int aa)
{
- BaseFillEllipse::renderXCircleDraw(display, drawable, lgc, st, size, a1, aa);
+ if (fill_)
+ XFillArc(display, drawable, lgc, st[0], st[1], size[0], size[1], a1, aa);
+ else
+ XDrawArc(display, drawable, lgc, st[0], st[1], size[0], size[1], a1, aa);
}
-void Ellipse::renderXEllipseDraw(Drawable drawable, GC lgc,
- XPoint* pts, int cnt)
+void Ellipse::renderXEllipseDraw(Drawable drawable, GC lgc)
{
- if (fill_ || ((properties & SOURCE) && !(properties & DASH)))
- BaseFillEllipse::renderXEllipseDraw(display, drawable, lgc, pts, cnt);
- else {
- // crude attempt to clip unwanted drawlines
- // only works for SRC
- for (int ii=0; ii<xpointNum_; ii+=2) {
- XPoint* ptr1 = xpoint_+ii;
- XPoint* ptr2 = xpoint_+ii+1;
- XDrawLine(display, drawable, lgc,
- (*ptr1).x, (*ptr1).y, (*ptr2).x, (*ptr2).y);
- }
- }
+ if (fill_)
+ XFillPolygon(display, drawable, lgc, xpoint_, xpointNum_, Convex, CoordModeOrigin);
+ else if ((properties & SOURCE) && !(properties & DASH))
+ XDrawLines(display, drawable, lgc, xpoint_, xpointNum_, CoordModeOrigin);
+ else
+ renderXEllipseDashDraw(drawable, lgc);
}
void Ellipse::renderPSCircleDraw(Vector& cc, double l, float a1, float a2)
{
- BaseFillEllipse::renderPSCircleDraw(parent, cc, l, a1, a2);
+ if (fill_)
+ BaseEllipse::renderPSCircleFillDraw(cc, l, a1, a2);
+ else
+ BaseEllipse::renderPSCircleDraw(cc, l, a1, a2);
}
void Ellipse::renderPSEllipseArcDraw(Vector& tt0, Vector& xx1,
Vector& xx2, Vector& tt1)
{
- BaseFillEllipse::renderPSEllipseArcDraw(parent, center, tt0, xx1, xx2, tt1);
+ if (fill_)
+ BaseEllipse::renderPSEllipseArcFillDraw(tt0, xx1, xx2, tt1);
+ else
+ BaseEllipse::renderPSEllipseArcDraw(tt0, xx1, xx2, tt1);
+}
+
+#ifdef MAC_OSX_TK
+void Ellipse::renderMACOSXCircleDraw(Vector& cc, double l, float a1, float a2)
+{
+ if (fill_)
+ macosxFillArc(cc, l, a1, a2);
+ else
+ macosxDrawArc(cc, l, a1, a2);
+}
+
+void Ellipse::renderMACOSXEllipseArcDraw(Vector& tt0, Vector& xx1,
+ Vector& xx2, Vector& tt1)
+{
+ if (fill_)
+ macosxFillCurve(tt0, xx1, xx2, tt1);
+ else
+ macosxDrawCurve(tt0, xx1, xx2, tt1);
+}
+#endif
+
+#ifdef __WIN32
+void Ellipse::renderWIN32CircleDraw(Vector& cc, double l, float a1, float a2)
+{
+ if (fill_)
+ win32FillArc(cc, l, a1, a2);
+ else
+ win32DrawArc(cc, l, a1, a2);
+}
+
+void Ellipse::renderWIN32EllipseArcDraw(Vector& tt0, Vector& xx1,
+ Vector& xx2, Vector& tt1)
+{
+ if (fill_)
+ win32FillCurve(tt0, xx1, xx2, tt1);
+ else
+ win32drawCurve(tt0, xx1, xx2, tt1);
}
+#endif
void Ellipse::edit(const Vector& v, int h)
{
diff --git a/tksao/frame/ellipse.h b/tksao/frame/ellipse.h
index 5b95a7a..8fe00d6 100644
--- a/tksao/frame/ellipse.h
+++ b/tksao/frame/ellipse.h
@@ -6,15 +6,28 @@
#define __ellipse_h__
#include "baseellipse.h"
-#include "basefill.h"
-class Ellipse : public BaseEllipse, public BaseFillEllipse {
+class Ellipse : public BaseEllipse {
+ protected:
+ int fill_;
+
protected:
void renderXCircleDraw(Drawable, GC, Vector&, Vector&, int, int);
- void renderXEllipseDraw(Drawable, GC, XPoint*, int);
+ void renderXEllipseDraw(Drawable, GC);
+
void renderPSCircleDraw(Vector& cc, double l, float a1, float a2);
void renderPSEllipseArcDraw(Vector&, Vector&, Vector&, Vector&);
+#ifdef MAC_OSX_TK
+ void renderMACOSXCircleDraw(Vector&, double, float, float);
+ void renderMACOSXEllipseArcDraw(Vector&, Vector&, Vector&, Vector&);
+#endif
+
+#ifdef __WIN32
+ void renderWIN32CircleDraw(Vector&, double, float, float);
+ void renderWIN32EllipseArcDraw(Vector&, Vector&, Vector&, Vector&);
+#endif
+
void listNonCel(FitsImage*, ostream&, Coord::CoordSystem);
public:
@@ -30,6 +43,9 @@ public:
virtual Marker* dup() {return new Ellipse(*this);}
void edit(const Vector&, int);
+ void fill(int ff) {fill_ = ff;}
+ int getFill() {return fill_;}
+
void analysis(AnalysisTask, int);
void analysisHistogram(char*, char*, int);
void analysisPlot3d(char*, char*, Coord::CoordSystem, Marker::AnalysisMethod);
diff --git a/tksao/frame/polygon.C b/tksao/frame/polygon.C
index f6370c9..29fbe67 100644
--- a/tksao/frame/polygon.C
+++ b/tksao/frame/polygon.C
@@ -7,11 +7,15 @@
#include "polygon.h"
#include "fitsimage.h"
-Polygon::Polygon(const Polygon& a) : BasePolygon(a), BaseFill(a) {}
+Polygon::Polygon(const Polygon& a) : BasePolygon(a)
+{
+ fill_ =0;
+}
Polygon::Polygon(Base* p, const Vector& ctr, const Vector& b, int fill)
- : BasePolygon(p,ctr,b), BaseFill(fill)
+ : BasePolygon(p,ctr,b)
{
+ fill_ = fill;
strcpy(type_, "polygon");
reset(b);
}
@@ -22,9 +26,9 @@ Polygon::Polygon(Base* p, const Vector& ctr,
int wth, const char* fnt, const char* txt,
unsigned short prop, const char* cmt,
const List<Tag>& tg, const List<CallBack>& cb)
- : BasePolygon(p, ctr, b, clr, dsh, wth, fnt, txt, prop, cmt, tg, cb),
- BaseFill(fill)
+ : BasePolygon(p, ctr, b, clr, dsh, wth, fnt, txt, prop, cmt, tg, cb)
{
+ fill_ = fill;
strcpy(type_, "polygon");
reset(b);
}
@@ -34,9 +38,9 @@ Polygon::Polygon(Base* p, const List<Vertex>& v, int fill,
int wth, const char* fnt, const char* txt,
unsigned short prop, const char* cmt,
const List<Tag>& tg, const List<CallBack>& cb)
- : BasePolygon(p, v, clr, dsh, wth, fnt, txt, prop, cmt, tg, cb),
- BaseFill(fill)
+ : BasePolygon(p, v, clr, dsh, wth, fnt, txt, prop, cmt, tg, cb)
{
+ fill_ = fill;
strcpy(type_, "polygon");
// check to see if the first and last node are the same
@@ -96,20 +100,20 @@ void Polygon::renderMACOSX()
{
renderMACOSXGC();
+ int cnt = vertex.count();
+ Vector* vv = new Vector[cnt];
vertex.head();
- Vector v1;
- Vector v2 = fwdMap(vertex.current()->vector,Coord::CANVAS);
- int done = 0;
+ for (int ii=0; ii<cnt; ii++) {
+ vv[ii] = fwdMap(vertex.current()->vector,Coord::CANVAS);
+ vertex.next();
+ }
- do {
- if (!vertex.next()) {
- done = 1;
- vertex.head();
- }
- v1 = v2;
- v2 = fwdMap(vertex.current()->vector,Coord::CANVAS);
- macosxDrawLine(v1,v2);
- } while (!done);
+ if (fill_)
+ macosxFillPolygon(vv,cnt);
+ else
+ macosxDrawLines(vv,cnt);
+
+ delete [] vv;
}
#endif
@@ -118,20 +122,18 @@ void Polygon::renderWIN32()
{
renderWIN32GC();
+ int cnt = vertex.count();
+ Vector* vv = new Vector[cnt];
vertex.head();
- Vector v1;
- Vector v2 = fwdMap(vertex.current()->vector,Coord::CANVAS);
- int done = 0;
+ for (int ii=0; ii<cnt; ii++) {
+ vv[ii] = fwdMap(vertex.current()->vector,Coord::CANVAS);
+ vertex.next();
+ }
- do {
- if (!vertex.next()) {
- done = 1;
- vertex.head();
- }
- v1 = v2;
- v2 = fwdMap(vertex.current()->vector,Coord::CANVAS);
- win32DrawLine(v1,v2);
- } while (!done);
+ if (fill_)
+ win32FillPolygon(vv,cnt);
+ else
+ win32DrawLines(vv,cnt);
}
#endif
diff --git a/tksao/frame/polygon.h b/tksao/frame/polygon.h
index 27b661d..1c31132 100644
--- a/tksao/frame/polygon.h
+++ b/tksao/frame/polygon.h
@@ -6,11 +6,13 @@
#define __polygon_h__
#include "basepolygon.h"
-#include "basefill.h"
#include "marker.h"
#include "list.h"
-class Polygon : public BasePolygon, public BaseFill {
+class Polygon : public BasePolygon {
+ protected:
+ int fill_;
+
protected:
int isInRef(const Vector& v);
void renderX(Drawable, Coord::InternalSystem, RenderMode);
@@ -40,6 +42,9 @@ public:
Marker* dup() {return new Polygon(*this);}
+ void fill(int ff) {fill_ = ff;}
+ int getFill() {return fill_;}
+
void analysis(AnalysisTask, int);
void analysisHistogram(char*, char*, int);
void analysisPlot3d(char*, char*, Coord::CoordSystem, Marker::AnalysisMethod);