casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
DSPolyLine.h
Go to the documentation of this file.
00001 //# DSPolyLine.h: PolyLine implementation for "DisplayShapes"
00002 //# Copyright (C) 1998,1999,2000,2001,2002
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: 
00027 
00028 #ifndef TRIALDISPLAY_DSPOLYLINE_H
00029 #define TRIALDISPLAY_DSPOLYLINE_H
00030 
00031 #include <casa/aips.h> 
00032 #include <casa/Arrays/Matrix.h> 
00033 #include <casa/Arrays/Vector.h>
00034 #include <display/DisplayShapes/DSBasic.h> 
00035 
00036 
00037 namespace casa { //# NAMESPACE CASA - BEGIN
00038 
00039 // <summary>
00040 // Implementation of a polyline.
00041 // </summary>
00042 //
00043 // <prerequisite>
00044 // <li> <linkto class="DisplayShape">DisplayShape</linkto>
00045 // </prerequisite>
00046 //
00047 // <etymology>
00048 // DSPolyLine is a method of managing the drawing of a polyline onto 
00049 // a PixelCanvas.
00050 // </etymology>
00051 //
00052 // <synopsis>
00053 // DSPolyLine manages a collection of points, which when called it draws. 
00054 // It also manages actions like the addition and removal of points from/to 
00055 // the line. 
00056 //
00057 // There are generally two ways to make DisplayShape(s); To create them in 
00058 // "one hit" by providing arguments to the constructor, or by using the 
00059 // default constructor and then the "setOptions" method. A simple interface 
00060 // for all classes inheriting from the 
00061 // <linkto class="DisplayShape">DisplayShape</linkto> class is provided by 
00062 // <linkto class="DisplayShapeInterface">DisplayShapeInterface</linkto>.
00063 // </synopsis>
00064 //
00065 // <motivation>
00066 // The need to draw, move and manipulate a polyline.
00067 // </motivation>
00068 //
00069 // <example>
00070 // <srcblock>
00071 //
00072 // </srcblock>
00073 // </example>
00074 
00075 
00076 class DSPolyLine : public DSBasic {
00077 
00078 public: 
00079   
00080   // Constructors and Destructors
00081   // <group>
00082   DSPolyLine();
00083   DSPolyLine(const DSPolyLine& other);
00084   DSPolyLine(const Matrix<Float>& points, const Bool& handles, 
00085              const Bool& drawHandles);
00086   virtual ~DSPolyLine();
00087   // </group>
00088 
00089   // General DisplayShape functions 
00090   // <group>
00091   virtual void draw(PixelCanvas* pc);
00092   virtual Bool inObject(const Float& xPos, const Float& yPos);
00093   virtual void move(const Float& dX, const Float& dY);  
00094   virtual Vector<Float> getCenter();
00095   virtual void setCenter(const Float& xPos, const Float& yPos);
00096   virtual void scale(const Float& scaleFactor);
00097   virtual void rotate(const Float& angle);
00098   virtual void rotateAbout(const Float& angle, const Float& aboutX, 
00099                            const Float& aboutY);
00100   // </group>
00101 
00102   // Point manipulation functions. The changePoint with only one argument 
00103   // moves the closest point to the location specified.
00104   // <group>
00105   virtual void changePoint(const Vector<Float>& pos); 
00106   virtual void changePoint(const Vector<Float>& pos, const Int n); 
00107   virtual void addPoint(const Vector<Float>& newPos);
00108   virtual void setPoints(const Matrix<Float>& points);
00109   // </group>
00110   
00111   // Return the number of points.
00112   virtual uInt nPoints();
00113   
00114   // Get and set this shapes options. 
00115   // <group>
00116   virtual Bool setOptions(const Record& newSettings);
00117   virtual Record getOptions();
00118   // </group>
00119 
00120 protected:
00121   // Return all my points.
00122   virtual Matrix<Float> getPoints();
00123 
00124 private:
00125   Matrix<Float> itsPoints;
00126   Vector<Float> itsCenter;
00127   Bool itsValidCenter;
00128   // Used when default constructor called.
00129   virtual void setDefaultOptions();
00130 };
00131 
00132 } //# NAMESPACE CASA - END
00133 
00134 #endif
00135 
00136 
00137 
00138