QCAD
Open Source 2D CAD
RLinetypePattern Class Reference

Copyright (c) 2011-2018 by Andrew Mustun. More...

#include <RLinetypePattern.h>

Public Member Functions

double getDashLengthAt (int i) const
 
double getDashOffsetAt (const QList< double > &dashes, int i) const
 
double getDelta (double pos) const
 
QString getDescription () const
 
QString getLabel () const
 
double getLargestGap () const
 
QString getName () const
 
bool getNoOffset () const
 
int getNumDashes () const
 
QList< double > getPattern () const
 
double getPatternLength () const
 
double getPatternOffset (double length)
 
double getPatternOffsetAt (double length, double symmetryPos, double *gap=NULL, bool end=false)
 
QString getPatternString () const
 
QVector< qreal > getScreenBasedLinetype ()
 
double getScreenScale () const
 
QList< RPainterPathgetShapeAt (int i) const
 
QList< int > getShapeIndices () const
 
int getShapeNumberAt (int i) const
 
RVector getShapeOffsetAt (int i) const
 
double getShapeRotationAt (int i) const
 
double getShapeScaleAt (int i) const
 
QString getShapeTextAt (int i) const
 
QString getShapeTextStyleAt (int i) const
 
QList< double > getSymmetries () const
 
bool hasDashAt (double pos) const
 
bool hasShapeAt (int i) const
 
bool hasShapeNumberAt (int i) const
 
bool hasShapeOffsetAt (int i) const
 
bool hasShapeRotationAt (int i) const
 
bool hasShapes () const
 
bool hasShapeScaleAt (int i) const
 
bool hasShapeTextAt (int i) const
 
bool hasShapeTextStyleAt (int i) const
 
bool isLoaded ()
 
bool isMetric () const
 
bool isValid () const
 
void load ()
 
bool operator< (const RLinetypePattern &other) const
 
RLinetypePatternoperator= (const RLinetypePattern &other)
 
bool operator== (const RLinetypePattern &other) const
 
 RLinetypePattern ()
 
 RLinetypePattern (bool metric, const QString &name, const QString &description)
 
 RLinetypePattern (bool metric, const QString &name, const QString &description, const QList< double > &dashes)
 
 RLinetypePattern (bool metric, const QString &name, const QString &description, int num...)
 
 RLinetypePattern (const RLinetypePattern &other)
 
void scale (double factor)
 
void set (const QList< double > &dashes)
 
void setDescription (const QString &d)
 
void setMetric (bool on)
 
void setName (const QString &n)
 
void setNoOffset (bool n)
 
bool setPatternString (const QString &patternString)
 Set pattern based on .lin formatted string. More...
 
void setScreenScale (double s)
 
void setShapeNumberAt (int i, int num)
 
void setShapeOffsetAt (int i, const RVector &offset)
 
void setShapeRotationAt (int i, double r)
 
void setShapeScaleAt (int i, double s)
 
void setShapeTextAt (int i, const QString &s)
 
void setShapeTextStyleAt (int i, const QString &s)
 
void updateShapes ()
 Updates the painter paths for the shapes in this pattern. More...
 
 ~RLinetypePattern ()
 

Static Public Member Functions

static void initNameMap ()
 
static QList< QPair< QString, RLinetypePattern * > > loadAllFrom (bool metric, const QString &fileName)
 Loads all linetype patterns in the given file into memory. More...
 

Private Attributes

QString description
 
bool metric
 
QString name
 
bool noOffset
 
QList< double > pattern
 
QString patternString
 
double screenScale
 
QMap< int, int > shapeNumbers
 
QMap< int, RVectorshapeOffsets
 
QMap< int, double > shapeRotations
 
QMap< int, QList< RPainterPath > > shapes
 
QMap< int, double > shapeScales
 
QMap< int, QString > shapeTexts
 
QMap< int, QString > shapeTextStyles
 
QList< double > symmetries
 

Static Private Attributes

static QMap< QString, QString > nameMap
 Copyright (c) 2011-2018 by Andrew Mustun. More...
 

Friends

class RLinetype
 

Detailed Description

Copyright (c) 2011-2018 by Andrew Mustun.

All rights reserved.

This file is part of the QCAD project.

QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

QCAD 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with QCAD. Represents a linetype pattern which can be used to draw dashed graphical elements.

Scriptable:\nThis class is available in script environments.\n
Copyable:\nObjects are cleaned up automatically by the garbage collector of the script engine.\n

Constructor & Destructor Documentation

◆ RLinetypePattern() [1/5]

RLinetypePattern::RLinetypePattern ( bool  metric,
const QString &  name,
const QString &  description,
int  num... 
)
Non-Scriptable:\nThis function is not available in script environments.\n

◆ RLinetypePattern() [2/5]

RLinetypePattern::RLinetypePattern ( bool  metric,
const QString &  name,
const QString &  description,
const QList< double > &  dashes 
)

◆ RLinetypePattern() [3/5]

RLinetypePattern::RLinetypePattern ( )

◆ RLinetypePattern() [4/5]

RLinetypePattern::RLinetypePattern ( bool  metric,
const QString &  name,
const QString &  description 
)

◆ RLinetypePattern() [5/5]

RLinetypePattern::RLinetypePattern ( const RLinetypePattern other)

◆ ~RLinetypePattern()

RLinetypePattern::~RLinetypePattern ( )

Member Function Documentation

◆ getDashLengthAt()

double RLinetypePattern::getDashLengthAt ( int  i) const

◆ getDashOffsetAt()

double RLinetypePattern::getDashOffsetAt ( const QList< double > &  dashes,
int  i 
) const

◆ getDelta()

double RLinetypePattern::getDelta ( double  pos) const
Returns
Distance from start of pattern to

◆ getDescription()

QString RLinetypePattern::getDescription ( ) const

◆ getLabel()

QString RLinetypePattern::getLabel ( ) const

◆ getLargestGap()

double RLinetypePattern::getLargestGap ( ) const

◆ getName()

QString RLinetypePattern::getName ( ) const

◆ getNoOffset()

bool RLinetypePattern::getNoOffset ( ) const

◆ getNumDashes()

int RLinetypePattern::getNumDashes ( ) const

◆ getPattern()

QList< double > RLinetypePattern::getPattern ( ) const

◆ getPatternLength()

double RLinetypePattern::getPatternLength ( ) const

◆ getPatternOffset()

double RLinetypePattern::getPatternOffset ( double  length)
Returns
Offset to use to apply the given pattern to an entity of the given length that the pattern is symmetrical.

◆ getPatternOffsetAt()

double RLinetypePattern::getPatternOffsetAt ( double  length,
double  symmetryPos,
double *  gap = NULL,
bool  end = false 
)
Non-Scriptable:\nThis function is not available in script environments.\n
Returns
Offset to use for an entity with the given length, so that the given dash (index) is in the middle of the entity.

◆ getPatternString()

QString RLinetypePattern::getPatternString ( ) const

◆ getScreenBasedLinetype()

QVector< qreal > RLinetypePattern::getScreenBasedLinetype ( )
Returns
Line pattern that can be used for a QPen to render screen optimized patterns. Empty vector for continuous.

◆ getScreenScale()

double RLinetypePattern::getScreenScale ( ) const

◆ getShapeAt()

QList< RPainterPath > RLinetypePattern::getShapeAt ( int  i) const

◆ getShapeIndices()

QList< int > RLinetypePattern::getShapeIndices ( ) const

◆ getShapeNumberAt()

int RLinetypePattern::getShapeNumberAt ( int  i) const

◆ getShapeOffsetAt()

RVector RLinetypePattern::getShapeOffsetAt ( int  i) const

◆ getShapeRotationAt()

double RLinetypePattern::getShapeRotationAt ( int  i) const

◆ getShapeScaleAt()

double RLinetypePattern::getShapeScaleAt ( int  i) const

◆ getShapeTextAt()

QString RLinetypePattern::getShapeTextAt ( int  i) const

◆ getShapeTextStyleAt()

QString RLinetypePattern::getShapeTextStyleAt ( int  i) const

◆ getSymmetries()

QList<double> RLinetypePattern::getSymmetries ( ) const
inline

◆ hasDashAt()

bool RLinetypePattern::hasDashAt ( double  pos) const

◆ hasShapeAt()

bool RLinetypePattern::hasShapeAt ( int  i) const

◆ hasShapeNumberAt()

bool RLinetypePattern::hasShapeNumberAt ( int  i) const

◆ hasShapeOffsetAt()

bool RLinetypePattern::hasShapeOffsetAt ( int  i) const

◆ hasShapeRotationAt()

bool RLinetypePattern::hasShapeRotationAt ( int  i) const

◆ hasShapes()

bool RLinetypePattern::hasShapes ( ) const

◆ hasShapeScaleAt()

bool RLinetypePattern::hasShapeScaleAt ( int  i) const

◆ hasShapeTextAt()

bool RLinetypePattern::hasShapeTextAt ( int  i) const

◆ hasShapeTextStyleAt()

bool RLinetypePattern::hasShapeTextStyleAt ( int  i) const

◆ initNameMap()

void RLinetypePattern::initNameMap ( )
static

◆ isLoaded()

bool RLinetypePattern::isLoaded ( )
inline

◆ isMetric()

bool RLinetypePattern::isMetric ( ) const
inline

◆ isValid()

bool RLinetypePattern::isValid ( ) const

◆ load()

void RLinetypePattern::load ( )
inline

◆ loadAllFrom()

QList< QPair< QString, RLinetypePattern * > > RLinetypePattern::loadAllFrom ( bool  metric,
const QString &  fileName 
)
static

Loads all linetype patterns in the given file into memory.

◆ operator<()

bool RLinetypePattern::operator< ( const RLinetypePattern other) const

◆ operator=()

RLinetypePattern & RLinetypePattern::operator= ( const RLinetypePattern other)

◆ operator==()

bool RLinetypePattern::operator== ( const RLinetypePattern other) const

◆ scale()

void RLinetypePattern::scale ( double  factor)

◆ set()

void RLinetypePattern::set ( const QList< double > &  dashes)

◆ setDescription()

void RLinetypePattern::setDescription ( const QString &  d)

◆ setMetric()

void RLinetypePattern::setMetric ( bool  on)
inline

◆ setName()

void RLinetypePattern::setName ( const QString &  n)

◆ setNoOffset()

void RLinetypePattern::setNoOffset ( bool  n)

◆ setPatternString()

bool RLinetypePattern::setPatternString ( const QString &  patternString)

Set pattern based on .lin formatted string.

e.g. "A,3.81,[TRACK1,ltypeshp.shx,S=6.35],3.81"

◆ setScreenScale()

void RLinetypePattern::setScreenScale ( double  s)

◆ setShapeNumberAt()

void RLinetypePattern::setShapeNumberAt ( int  i,
int  num 
)

◆ setShapeOffsetAt()

void RLinetypePattern::setShapeOffsetAt ( int  i,
const RVector offset 
)

◆ setShapeRotationAt()

void RLinetypePattern::setShapeRotationAt ( int  i,
double  r 
)

◆ setShapeScaleAt()

void RLinetypePattern::setShapeScaleAt ( int  i,
double  s 
)

◆ setShapeTextAt()

void RLinetypePattern::setShapeTextAt ( int  i,
const QString &  s 
)

◆ setShapeTextStyleAt()

void RLinetypePattern::setShapeTextStyleAt ( int  i,
const QString &  s 
)

◆ updateShapes()

void RLinetypePattern::updateShapes ( )

Updates the painter paths for the shapes in this pattern.

Friends And Related Function Documentation

◆ RLinetype

friend class RLinetype
friend

Member Data Documentation

◆ description

QString RLinetypePattern::description
private

◆ metric

bool RLinetypePattern::metric
private

◆ name

QString RLinetypePattern::name
private

◆ nameMap

QMap< QString, QString > RLinetypePattern::nameMap
staticprivate

Copyright (c) 2011-2018 by Andrew Mustun.

All rights reserved.

This file is part of the QCAD project.

QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

QCAD 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 General Public License for more details.

You should have received a copy of the GNU General Public License along with QCAD.

◆ noOffset

bool RLinetypePattern::noOffset
private

◆ pattern

QList<double> RLinetypePattern::pattern
private

◆ patternString

QString RLinetypePattern::patternString
mutableprivate

◆ screenScale

double RLinetypePattern::screenScale
private

◆ shapeNumbers

QMap<int, int> RLinetypePattern::shapeNumbers
private

◆ shapeOffsets

QMap<int, RVector> RLinetypePattern::shapeOffsets
private

◆ shapeRotations

QMap<int, double> RLinetypePattern::shapeRotations
private

◆ shapes

QMap<int, QList<RPainterPath> > RLinetypePattern::shapes
private

◆ shapeScales

QMap<int, double> RLinetypePattern::shapeScales
private

◆ shapeTexts

QMap<int, QString> RLinetypePattern::shapeTexts
private

◆ shapeTextStyles

QMap<int, QString> RLinetypePattern::shapeTextStyles
private

◆ symmetries

QList<double> RLinetypePattern::symmetries
private

The documentation for this class was generated from the following files: