Source
xxxxxxxxxx
//# PlotShape.h: Different shape classes that can be drawn on a canvas.
//# Copyright (C) 2008
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: aips2-request@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
//#
//# $Id: $
namespace casa {
// Abstract class for any shape which contains common functionality.
class PlotShape : public virtual PlotItem {
public:
// Constructor.
PlotShape() { }
// Destructor.
virtual ~PlotShape() { }
// Implements PlotItem::drawCount(). Provides default implementation that
// returns 1.
virtual unsigned int drawCount() const { return 1; }
// ABSTRACT METHODS //
// Returns the coordinates for this shape. The number and order depends
// on the specific shape subclass.
virtual std::vector<PlotCoordinate> coordinates() const = 0;
// Sets this shape's coordinates to the given. Must be in the same size
// and order as that returned by coordinates(). Specific to each shape
// subclass.
virtual void setCoordinates(const std::vector<PlotCoordinate>& c) = 0;
// Returns true if a line is shown for this shape, false otherwise.
virtual bool lineShown() const = 0;
// Sets whether a line is shown for this shape or not.
virtual void setLineShown(bool line = true) = 0;
// Returns a copy of the line used for this shape.
virtual PlotLinePtr line() const = 0;
// Sets this shape's line to the given.
virtual void setLine(const PlotLine& line) = 0;
// Returns true if this shape has an area fill, false otherwise.
virtual bool areaFilled() const = 0;
// Sets whether or not this shape has an area fill.
virtual void setAreaFilled(bool area = true) = 0;
// Returns a copy of the area fill for this shape.
virtual PlotAreaFillPtr areaFill() const = 0;
// Sets this shape's area fill to the given.
virtual void setAreaFill(const PlotAreaFill& fill) = 0;
// IMPLEMENTED METHODS //
// Convenience methods for setting the line for this shape.
// <group>
virtual void setLine(const PlotLinePtr l) {