QCAD
Open Source 2D CAD
RLinetypePattern Class Reference

Copyright (c) 2011-2015 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
 
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 ()
 
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 (bool metric, const QString &name, const QString &description, int num...)
 
 RLinetypePattern (bool metric, const QString &name, const QString &description, const QList< double > &dashes)
 
 RLinetypePattern ()
 
 RLinetypePattern (bool metric, const QString &name, const QString &description)
 
 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)
 
bool setPatternString (const QString &patternString)
 Set pattern based on .lin formatted string (e.g. More...
 
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 Member Functions

 Q_DECLARE_TR_FUNCTIONS (RLinetypePattern)
 

Private Attributes

QString description
 
bool metric
 
QString name
 
QList< double > pattern
 
QString patternString
 
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-2015 by Andrew Mustun. More...
 

Friends

class RLinetype
 

Detailed Description

Copyright (c) 2011-2015 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:
This class is available in script environments.
Copyable:
Objects are cleaned up automatically by the garbage collector of the script engine.

Constructor & Destructor Documentation

RLinetypePattern::RLinetypePattern ( bool  metric,
const QString &  name,
const QString &  description,
int  num... 
)
Non-Scriptable:
This function is not available in script environments.
RLinetypePattern::RLinetypePattern ( bool  metric,
const QString &  name,
const QString &  description,
const QList< double > &  dashes 
)
RLinetypePattern::RLinetypePattern ( )
RLinetypePattern::RLinetypePattern ( bool  metric,
const QString &  name,
const QString &  description 
)
RLinetypePattern::RLinetypePattern ( const RLinetypePattern other)
RLinetypePattern::~RLinetypePattern ( )

Member Function Documentation

double RLinetypePattern::getDashLengthAt ( int  i) const
double RLinetypePattern::getDashOffsetAt ( const QList< double > &  dashes,
int  i 
) const
double RLinetypePattern::getDelta ( double  pos) const
Returns
Distance from start of pattern to
QString RLinetypePattern::getDescription ( ) const
QString RLinetypePattern::getLabel ( ) const
double RLinetypePattern::getLargestGap ( ) const
QString RLinetypePattern::getName ( ) const
int RLinetypePattern::getNumDashes ( ) const
QList< double > RLinetypePattern::getPattern ( ) const
double RLinetypePattern::getPatternLength ( ) const
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.
double RLinetypePattern::getPatternOffsetAt ( double  length,
double  symmetryPos,
double *  gap = NULL,
bool  end = false 
)
Non-Scriptable:
This function is not available in script environments.
Returns
Offset to use for an entity with the given length, so that the given dash (index) is in the middle of the entity.
QString RLinetypePattern::getPatternString ( ) const
QVector< qreal > RLinetypePattern::getScreenBasedLinetype ( )
Returns
Line pattern that can be used for a QPen to render screen optimized patterns. Empty vector for continuous.
QList< RPainterPath > RLinetypePattern::getShapeAt ( int  i) const
QList< int > RLinetypePattern::getShapeIndices ( ) const
int RLinetypePattern::getShapeNumberAt ( int  i) const
RVector RLinetypePattern::getShapeOffsetAt ( int  i) const
double RLinetypePattern::getShapeRotationAt ( int  i) const
double RLinetypePattern::getShapeScaleAt ( int  i) const
QString RLinetypePattern::getShapeTextAt ( int  i) const
QString RLinetypePattern::getShapeTextStyleAt ( int  i) const
QList<double> RLinetypePattern::getSymmetries ( ) const
inline
bool RLinetypePattern::hasDashAt ( double  pos) const
bool RLinetypePattern::hasShapeAt ( int  i) const
bool RLinetypePattern::hasShapeNumberAt ( int  i) const
bool RLinetypePattern::hasShapeOffsetAt ( int  i) const
bool RLinetypePattern::hasShapeRotationAt ( int  i) const
bool RLinetypePattern::hasShapes ( ) const
bool RLinetypePattern::hasShapeScaleAt ( int  i) const
bool RLinetypePattern::hasShapeTextAt ( int  i) const
bool RLinetypePattern::hasShapeTextStyleAt ( int  i) const
void RLinetypePattern::initNameMap ( )
static
bool RLinetypePattern::isLoaded ( )
inline
bool RLinetypePattern::isMetric ( ) const
inline
bool RLinetypePattern::isValid ( ) const
void RLinetypePattern::load ( )
inline
QList< QPair< QString, RLinetypePattern * > > RLinetypePattern::loadAllFrom ( bool  metric,
const QString &  fileName 
)
static

Loads all linetype patterns in the given file into memory.

bool RLinetypePattern::operator< ( const RLinetypePattern other) const
RLinetypePattern & RLinetypePattern::operator= ( const RLinetypePattern other)
bool RLinetypePattern::operator== ( const RLinetypePattern other) const
RLinetypePattern::Q_DECLARE_TR_FUNCTIONS ( RLinetypePattern  )
private
void RLinetypePattern::scale ( double  factor)
void RLinetypePattern::set ( const QList< double > &  dashes)
void RLinetypePattern::setDescription ( const QString &  d)
void RLinetypePattern::setMetric ( bool  on)
inline
void RLinetypePattern::setName ( const QString &  n)
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").

void RLinetypePattern::setShapeNumberAt ( int  i,
int  num 
)
void RLinetypePattern::setShapeOffsetAt ( int  i,
const RVector offset 
)
void RLinetypePattern::setShapeRotationAt ( int  i,
double  r 
)
void RLinetypePattern::setShapeScaleAt ( int  i,
double  s 
)
void RLinetypePattern::setShapeTextAt ( int  i,
const QString &  s 
)
void RLinetypePattern::setShapeTextStyleAt ( int  i,
const QString &  s 
)
void RLinetypePattern::updateShapes ( )

Updates the painter paths for the shapes in this pattern.

Friends And Related Function Documentation

friend class RLinetype
friend

Member Data Documentation

QString RLinetypePattern::description
private
bool RLinetypePattern::metric
private
QString RLinetypePattern::name
private
QMap< QString, QString > RLinetypePattern::nameMap
staticprivate

Copyright (c) 2011-2015 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.

QList<double> RLinetypePattern::pattern
private
QString RLinetypePattern::patternString
mutableprivate
QMap<int, int> RLinetypePattern::shapeNumbers
private
QMap<int, RVector> RLinetypePattern::shapeOffsets
private
QMap<int, double> RLinetypePattern::shapeRotations
private
QMap<int, QList<RPainterPath> > RLinetypePattern::shapes
private
QMap<int, double> RLinetypePattern::shapeScales
private
QMap<int, QString> RLinetypePattern::shapeTexts
private
QMap<int, QString> RLinetypePattern::shapeTextStyles
private
QList<double> RLinetypePattern::symmetries
private

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