Add SHORT_DASH stipple pattern.

pull/10/head
whitequark 2016-05-26 19:20:39 +00:00
parent 73d82a6347
commit faa84c61cf
4 changed files with 19 additions and 7 deletions

View File

@ -200,6 +200,11 @@ public:
case StipplePattern::CONTINUOUS:
break;
case StipplePattern::SHORT_DASH:
type.path.push_back(sw);
type.path.push_back(-sw * 2.0);
break;
case StipplePattern::DASH:
type.path.push_back(sw);
type.path.push_back(-sw);
@ -715,6 +720,7 @@ bool DxfFileWriter::NeedToOutput(Constraint *c) {
const char *DxfFileWriter::lineTypeName(StipplePattern stippleType) {
switch(stippleType) {
case StipplePattern::CONTINUOUS: return "CONTINUOUS";
case StipplePattern::SHORT_DASH: return "DASHED";
case StipplePattern::DASH: return "DASHED";
case StipplePattern::LONG_DASH: return "DASHEDX2";
case StipplePattern::DASH_DOT: return "DASHDOT";
@ -744,6 +750,9 @@ static std::string MakeStipplePattern(StipplePattern pattern, double scale, char
case StipplePattern::CONTINUOUS:
return "";
case StipplePattern::SHORT_DASH:
result = ssprintf("%.3f_%.3f", scale, scale * 2.0);
break;
case StipplePattern::DASH:
result = ssprintf("%.3f_%.3f", scale, scale);
break;

View File

@ -120,6 +120,7 @@ void ssglStippledLine(Vector a, Vector b, double width,
const char *stipplePattern;
switch(stippleType) {
case StipplePattern::CONTINUOUS: ssglLine(a, b, width, maybeFat); return;
case StipplePattern::SHORT_DASH: stipplePattern = "- "; break;
case StipplePattern::DASH: stipplePattern = "- "; break;
case StipplePattern::LONG_DASH: stipplePattern = "_ "; break;
case StipplePattern::DASH_DOT: stipplePattern = "-."; break;

View File

@ -36,13 +36,14 @@ enum class PolyError : uint32_t {
enum class StipplePattern : uint32_t {
CONTINUOUS = 0,
DASH = 1,
LONG_DASH = 2,
DASH_DOT = 3,
DASH_DOT_DOT = 4,
DOT = 5,
FREEHAND = 6,
ZIGZAG = 7,
SHORT_DASH = 1,
DASH = 2,
LONG_DASH = 3,
DASH_DOT = 4,
DASH_DOT_DOT = 5,
DOT = 6,
FREEHAND = 7,
ZIGZAG = 8,
LAST = ZIGZAG
};

View File

@ -777,6 +777,7 @@ void TextWindow::ShowStyleInfo() {
const size_t patternCount = (size_t)StipplePattern::LAST + 1;
const char *patternsSource[patternCount] = {
"___________",
"- - - - ",
"- - - - - -",
"__ __ __ __",
"-.-.-.-.-.-",