DSLine.h

Classes

DSLine -- Implementation of a line. (full description)

class DSLine : public DSPolyLine

Interface

Public Members
DSLine()
DSLine(const DSLine &other)
DSLine(const Vector<Float>& startPos, const Vector<Float>& endPos, const Bool& handles = True, const Bool& drawHandles = True)
virtual ~DSLine()
virtual void setCenter(const Float& xPos, const Float& yPos)
virtual Bool isValid()
virtual void setStartPoint(const Vector<Float>& start)
virtual void setEndPoint(const Vector<Float>& end)
virtual Record getOptions()
virtual Bool setOptions(const Record& newSettings)
Protected Members
virtual Bool validStart()
virtual Bool validEnd()
virtual void make()
virtual Matrix<Float> getEnds()
virtual Matrix<Float> asPolyLine(const Vector<Float>& startPos, const Vector<Float>& endPos)

Description

Prerequisite

Etymology

DSLine is a method of managing the drawing of a line onto a PixelCanvas.

Synopsis

DSLine simply extends from DSPolyLine, and adds specific functions to a line with only two points (e.g. setStartPoint)

There are generally two ways to make DisplayShape(s); To create them in "one hit" by providing arguments to the constructor, or by using the default constructor and then the "setOptions" method. A simple interface for all classes inheriting from the DisplayShape class is provided by DisplayShapeInterface.

Motivation

The need for a basic line drawing tool.

Example

    Vector<Float> startPoint(2); startPoint[0] = 100; startPoint[1] = 100;
    Vector<Float> endPoint(2);   endPoint[0] = 200;   endPoint[1] = 200;
    
    DSLine* myLine = new DSLine(startPoint, endPoint, True, True);
    
    myLine->move(10,10);
    
    Vector<Float> newStart(2); newStart[0] = 50; newStart[1] = 50;
    myLine->setStartPoint(newStart);
    
    Record newLineOpt;
    newLineOpt.define("linewidth", 3);
    
    myLine->setOptions(newLineOpt);
    myLine->draw(myPixelCanvas);
    etc..
    

Member Description

DSLine()
DSLine(const DSLine &other)
DSLine(const Vector<Float>& startPos, const Vector<Float>& endPos, const Bool& handles = True, const Bool& drawHandles = True)
virtual ~DSLine()

Constructors and Destructors

virtual void setCenter(const Float& xPos, const Float& yPos)

This does nothing, it's so arrow and other inheriting classes can take note of new centers

virtual Bool isValid()

Does this line have a valid start and a valid end?

virtual void setStartPoint(const Vector<Float>& start)
virtual void setEndPoint(const Vector<Float>& end)

Line specific functions for ease of use

virtual Record getOptions()
virtual Bool setOptions(const Record& newSettings)

Set and get options

virtual Bool validStart()

virtual Bool validEnd()

virtual void make()

virtual Matrix<Float> getEnds()
virtual Matrix<Float> asPolyLine(const Vector<Float>& startPos, const Vector<Float>& endPos)

General utility functions.