~ubuntu-branches/ubuntu/precise/ipe/precise

« back to all changes in this revision

Viewing changes to src/ipelib/ipemark.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2005-02-24 22:09:16 UTC
  • mfrom: (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050224220916-9vxiiqjz066r5489
Tags: 6.0pre23-2
debian/control: Ipe should depend on exact version of libipe.
Closes: #296771.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
                 IpeString /* data */)
47
47
  : IpeObject(rep, attr)
48
48
{
49
 
  iSize = rep->MakeScalar(IpeAttribute::EMarkSize, attr["size"]);
50
 
  IpeLex shapeLex(attr["shape"]);
51
 
  int shape;
52
 
  shapeLex >> shape;
53
 
  iShape = shape;
 
49
  IpeString str;
 
50
  if (attr.Has("size", str))
 
51
    iSize = rep->MakeScalar(IpeAttribute::EMarkSize, str);
 
52
  iShape = IpeLex(attr["shape"]).GetInt();
54
53
  // parse position
55
54
  IpeLex lex(attr["pos"]);
56
55
  lex >> iPos.iX >> iPos.iY;
100
99
  stream << " pos=\"" << iPos.iX << " " << iPos.iY << "\"";
101
100
  if (painter.MarkShape() == 0)
102
101
    stream << " shape=\"" << int(iShape) << "\"";
103
 
  if (painter.MarkSize().IsNull())
104
 
    stream << " size=\"" << painter.Repository()->String(iSize) << "\"/>\n";
 
102
  if (!painter.MarkSize())
 
103
    stream << " size=\"" << painter.Repository()->String(iSize) << "\"";
 
104
  stream << "/>\n";
105
105
}
106
106
 
107
107
//! Draw marker.
112
112
  painter.Translate(iPos);
113
113
  painter.Untransform(false);
114
114
 
115
 
  painter.SetMarkSize(iSize);
 
115
  if (!painter.MarkSize())
 
116
    painter.SetMarkSize(iSize);
116
117
  painter.SetMarkShape(iShape);
117
118
  painter.SetStroke(Stroke());
118
119
  painter.SetDashStyle(IpeAttribute::Solid());
119
120
 
120
121
  const IpeRepository *rep = painter.Repository();
121
122
  int shape = painter.MarkShape();
122
 
  double absSize = rep->ToScalar(painter.MarkSize());
123
 
 
124
 
  painter.SetLineWidth(IpeAttribute(IpeAttribute::ELineWidth, 0.2 * absSize));
 
123
 
 
124
  IpeFixed markSize = rep->ToScalar(painter.MarkSize());
 
125
  IpeFixed lw = markSize.Mult(1, 5);
 
126
  double absSize = markSize.ToDouble();
 
127
 
 
128
  painter.SetLineWidth(IpeAttribute(IpeAttribute::ELineWidth, lw));
125
129
 
126
130
  if (shape == EDisc || shape == ESquare) {
127
131
    painter.SetFill(painter.Stroke());
129
133
    painter.SetFill(IpeAttribute::Void());
130
134
  }
131
135
 
 
136
  painter.NewPath();
132
137
  IpeVector size(absSize, absSize);
133
138
  IpeVector ll = IpeVector::Zero - 0.5 * size;
134
139
  if (shape == EBox || shape == ESquare) {
136
141
    re.AddPoint(ll + size);
137
142
    painter.Rect(re);
138
143
  } else if (shape == ECross) {
139
 
    painter.BeginPath(ll);
 
144
    painter.MoveTo(ll);
140
145
    painter.LineTo(ll + size);
141
 
    painter.EndPath();
142
 
    painter.BeginPath(ll + IpeVector(absSize, 0));
 
146
    painter.MoveTo(ll + IpeVector(absSize, 0));
143
147
    painter.LineTo(ll + IpeVector(0, absSize));
144
 
    painter.EndPath();
145
148
  } else {
146
149
    IpeMatrix m; // = 1
147
150
    m.iA[0] = m.iA[3] = 0.5 * absSize;