Rhino C++ API  8.6
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
ON_HatchLine Class Reference

#include <opennurbs_hatch.h>

Public Member Functions

 ON_HatchLine ()=default
 Default constructor creates ON_HatchLine::SolidHorizontal. More...
 ON_HatchLine (const ON_HatchLine &)=default
 ON_HatchLine (double angle_in_radians)
 constructs solid line More...
 ON_HatchLine (double angle_in_radians, ON_2dPoint base, ON_2dVector offset, const ON_SimpleArray< double > &dashes)
 ~ON_HatchLine ()=default
double AngleDegrees () const
double AngleRadians () const
void AppendDash (double dash)
ON_2dPoint Base () const
double Dash (int) const
int DashCount () const
const ON_SimpleArray< double > & Dashes () const
void Dump (ON_TextLog &) const
 for debugging More...
void GetLineData (double &angle_radians, ON_2dPoint &base, ON_2dVector &offset, ON_SimpleArray< double > &dashes) const
double GetPatternLength () const
bool IsValid (ON_TextLog *text_log=nullptr) const
ON_2dVector Offset () const
bool operator!= (const ON_HatchLine &) const
ON_HatchLineoperator= (const ON_HatchLine &)=default
bool operator== (const ON_HatchLine &) const
bool Read (ON_BinaryArchive &)
 restore definition from binary archive More...
void SetAngleDegrees (double angle_in_degrees)
void SetAngleRadians (double angle_in_radians)
void SetBase (const ON_2dPoint &base)
void SetDashes (const ON_SimpleArray< double > &dashes)
void SetOffset (const ON_2dVector &offset)
bool Write (ON_BinaryArchive &) const
 serialize definition to binary archive More...

Static Public Member Functions

static int Compare (const ON_HatchLine &a, const ON_HatchLine &b)

Static Public Attributes

static const ON_HatchLine SolidHorizontal
 angle = 0 More...
static const ON_HatchLine SolidVertical
 angle = pi/2 More...
static const ON_HatchLine Unset
 angle = unset More...

Detailed Description

class ON_HatchLine /////////////////////////////////////////////////////////////// Represents one line of a hatch pattern Similar to AutoCAD's .pat file definition ON_HatchLine's are used by ON_HatchPattern to specify the dashes and offset patterns of the lines.

Each line has the following information: Angle is the direction of the line CCW from the x axis The first line origin is at base Each line repetition is offset by offset from the previous line offset.x is parallel to the line and offset.y is perpendicular to the line The base and offset values are rotated by the line's angle to produce a location in the hatch pattern's coordinate system There can be gaps and dashes specified for drawing the line

If there are no dashes, the line is solid Negative length dashes are gaps Positive length dashes are drawn as line segments

Constructor & Destructor Documentation

◆ ON_HatchLine() [1/4]

ON_HatchLine::ON_HatchLine ( )

Default constructor creates ON_HatchLine::SolidHorizontal.

◆ ~ON_HatchLine()

ON_HatchLine::~ON_HatchLine ( )

◆ ON_HatchLine() [2/4]

ON_HatchLine::ON_HatchLine ( const ON_HatchLine )

◆ ON_HatchLine() [3/4]

ON_HatchLine::ON_HatchLine ( double  angle_in_radians,
ON_2dPoint  base,
ON_2dVector  offset,
const ON_SimpleArray< double > &  dashes 

◆ ON_HatchLine() [4/4]

ON_HatchLine::ON_HatchLine ( double  angle_in_radians)

constructs solid line

Member Function Documentation

◆ AngleDegrees()

double ON_HatchLine::AngleDegrees ( ) const

◆ AngleRadians()

double ON_HatchLine::AngleRadians ( ) const

Interface Description: Get angle of the hatch line. CCW from x-axis Parameters: Return: The angle in radians

◆ AppendDash()

void ON_HatchLine::AppendDash ( double  dash)

Description: Add a dash to the pattern Parameters: dash - [in] length to append - < 0 for a gap

◆ Base()

ON_2dPoint ON_HatchLine::Base ( ) const

Description: Get this line's 2d basepoint Parameters: Return: the base point

◆ Compare()

static int ON_HatchLine::Compare ( const ON_HatchLine a,
const ON_HatchLine b 

◆ Dash()

double ON_HatchLine::Dash ( int  ) const

Description: Get the dash length at index Parameters: index - [in] the dash to get Return: the length of the dash ( gap if negative)

◆ DashCount()

int ON_HatchLine::DashCount ( ) const

Description: Get the number of gaps + dashes in the line Parameters: Return: number of dashes in the line

◆ Dashes()

const ON_SimpleArray<double>& ON_HatchLine::Dashes ( ) const

◆ Dump()

void ON_HatchLine::Dump ( ON_TextLog ) const

for debugging

◆ GetLineData()

void ON_HatchLine::GetLineData ( double &  angle_radians,
ON_2dPoint base,
ON_2dVector offset,
ON_SimpleArray< double > &  dashes 
) const

Description: Get the line's angle, base, offset and dashes in one function call Parameters: angle_radians - [out] angle in radians CCW from x-axis base - [out] origin of the master line offset - [out] offset for line replications dashes - [out] the dash array for the line Return:

◆ GetPatternLength()

double ON_HatchLine::GetPatternLength ( ) const

Description: Get the total length of a pattern repeat Parameters: Return: Pattern length

◆ IsValid()

bool ON_HatchLine::IsValid ( ON_TextLog text_log = nullptr) const

◆ Offset()

ON_2dVector ON_HatchLine::Offset ( ) const

Description: Get this line's 2d offset for line repetitions Offset().x is shift parallel to line Offset().y is spacing perpendicular to line Parameters: Return: the offset

◆ operator!=()

bool ON_HatchLine::operator!= ( const ON_HatchLine ) const

◆ operator=()

ON_HatchLine& ON_HatchLine::operator= ( const ON_HatchLine )

◆ operator==()

bool ON_HatchLine::operator== ( const ON_HatchLine ) const

◆ Read()

bool ON_HatchLine::Read ( ON_BinaryArchive )

restore definition from binary archive

◆ SetAngleDegrees()

void ON_HatchLine::SetAngleDegrees ( double  angle_in_degrees)

◆ SetAngleRadians()

void ON_HatchLine::SetAngleRadians ( double  angle_in_radians)

Description: Set angle of the hatch line. CCW from x-axis Parameters: angle - [in] angle in radians Return:

◆ SetBase()

void ON_HatchLine::SetBase ( const ON_2dPoint base)

Description: Set this line's 2d basepoint Parameters: base - [in] the basepoint Return:

◆ SetDashes()

void ON_HatchLine::SetDashes ( const ON_SimpleArray< double > &  dashes)

Description: Specify a new dash array Parameters: dashes - [in] array of dash lengths

◆ SetOffset()

void ON_HatchLine::SetOffset ( const ON_2dVector offset)

Description: Get this line's 2d offset for line repetitions Offset().x is shift parallel to line Offset().y is spacing perpendicular to line Parameters: offset - [in] the shift,spacing for repeated lines Return:

◆ Write()

bool ON_HatchLine::Write ( ON_BinaryArchive ) const

serialize definition to binary archive

Member Data Documentation

◆ SolidHorizontal

const ON_HatchLine ON_HatchLine::SolidHorizontal

angle = 0

◆ SolidVertical

const ON_HatchLine ON_HatchLine::SolidVertical

angle = pi/2

◆ Unset

const ON_HatchLine ON_HatchLine::Unset

angle = unset