casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DSLine.h
Go to the documentation of this file.
1 //# DSLine.h: Line implementation for "DisplayShapes"
2 //# Copyright (C) 1998,1999,2000,2001,2002
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id:
27 
28 #ifndef TRIALDISPLAY_DSLINE_H
29 #define TRIALDISPLAY_DSLINE_H
30 
31 #include <casa/aips.h>
32 
34 #include <casa/Arrays/Matrix.h>
35 
36 namespace casacore{
37 
38  template <class T> class Vector;
39 }
40 
41 namespace casa { //# NAMESPACE CASA - BEGIN
42 
43 
44 // <summary>
45 // Implementation of a line.
46 // </summary>
47 //
48 // <prerequisite>
49 // <li> <linkto class="DSPolyLine">DSPoly</linkto>
50 // <li> <linkto class="DisplayShape">DisplayShape</linkto>
51 // </prerequisite>
52 //
53 // <etymology>
54 // DSLine is a method of managing the drawing of a line onto a PixelCanvas.
55 // </etymology>
56 //
57 // <synopsis>
58 // DSLine simply extends from DSPolyLine, and adds specific functions to a
59 // line with only two points (e.g. setStartPoint)
60 //
61 // There are generally two ways to make DisplayShape(s); To create them in
62 // "one hit" by providing arguments to the constructor, or by using the
63 // default constructor and then the "setOptions" method. A simple interface
64 // for all classes inheriting from the
65 // <linkto class="DisplayShape">DisplayShape</linkto> class is provided by
66 // <linkto class="DisplayShapeInterface">DisplayShapeInterface</linkto>.
67 // </synopsis>
68 //
69 // <motivation>
70 // The need for a basic line drawing tool.
71 // </motivation>
72 //
73 // <example>
74 // <srcblock>
75 // casacore::Vector<casacore::Float> startPoint(2); startPoint[0] = 100; startPoint[1] = 100;
76 // casacore::Vector<casacore::Float> endPoint(2); endPoint[0] = 200; endPoint[1] = 200;
77 //
78 // DSLine* myLine = new DSLine(startPoint, endPoint, true, true);
79 //
80 // myLine->move(10,10);
81 //
82 // casacore::Vector<casacore::Float> newStart(2); newStart[0] = 50; newStart[1] = 50;
83 // myLine->setStartPoint(newStart);
84 //
85 // casacore::Record newLineOpt;
86 // newLineOpt.define("linewidth", 3);
87 //
88 // myLine->setOptions(newLineOpt);
89 // myLine->draw(myPixelCanvas);
90 // etc..
91 // </srcblock>
92 // </example>
93 
94  class DSLine : public DSPolyLine {
95 
96  public:
97 
98  // Constructors and Destructors
99  // <group>
100  DSLine();
101  DSLine(const DSLine &other);
103  const casacore::Bool& handles = true, const casacore::Bool& drawHandles = true);
104  virtual ~DSLine();
105  // </group>
106 
107  // This does nothing, it's so arrow and other inheriting classes can
108  // take note of new centers
109  virtual void setCenter(const casacore::Float& xPos, const casacore::Float& yPos);
110 
111  // Does this line have a valid start and a valid end?
112  virtual casacore::Bool isValid();
113 
114  // Line specific functions for ease of use
115  // <group>
116  virtual void setStartPoint(const casacore::Vector<casacore::Float>& start);
118  // </group>
119 
120  // Set and get options
121  // <group>
122  virtual casacore::Record getOptions();
123  virtual casacore::Bool setOptions(const casacore::Record& newSettings);
124  // </group>
125 
126  private:
127 
128 
130 
131  // These are to hold the points while line is being made (line is invalid).
134 
135  protected:
136 
138  return itsValidStart;
139  }
140 
142  return itsValidEnd;
143  }
144 
145  virtual void make();
146  // General utility functions.
147  // <group>
150  // </group>
151  };
152 
153 
154 } //# NAMESPACE CASA - END
155 
156 #endif
157 
158 
159 
virtual casacore::Bool validStart()
Definition: DSLine.h:137
virtual casacore::Bool setOptions(const casacore::Record &newSettings)
Get and set this shapes options.
casacore::Vector< casacore::Float > itsStart
These are to hold the points while line is being made (line is invalid).
Definition: DSLine.h:132
virtual casacore::Record getOptions()
Set and get options.
std::vector< double > Vector
Definition: ds9context.h:24
virtual void setStartPoint(const casacore::Vector< casacore::Float > &start)
Line specific functions for ease of use.
virtual void make()
DSLine()
Constructors and Destructors.
casacore::Bool itsValidStart
Definition: DSLine.h:129
const_iterator end() const
Implementation of a polyline.
Definition: DSPolyLine.h:76
Implementation of a line.
Definition: DSLine.h:94
virtual void setEndPoint(const casacore::Vector< casacore::Float > &end)
casacore::Vector< casacore::Float > itsEnd
Definition: DSLine.h:133
virtual ~DSLine()
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual casacore::Matrix< casacore::Float > asPolyLine(const casacore::Vector< casacore::Float > &startPos, const casacore::Vector< casacore::Float > &endPos)
virtual casacore::Bool validEnd()
Definition: DSLine.h:141
float Float
Definition: aipstype.h:54
virtual void setCenter(const casacore::Float &xPos, const casacore::Float &yPos)
This does nothing, it&#39;s so arrow and other inheriting classes can take note of new centers...
virtual casacore::Bool isValid()
Does this line have a valid start and a valid end?
virtual casacore::Matrix< casacore::Float > getEnds()
General utility functions.
casacore::Bool itsValidEnd
Definition: DSLine.h:129
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42