Skip to content

Commit d06fea6

Browse files
committed
Added AxisEqual() method to C++ API
+ Referenced PR #142
1 parent 30fd52d commit d06fea6

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

client-api/C++/src/vibes.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,14 @@ namespace vibes
218218
setFigureProperty(figureName.empty()?current_fig:figureName, "viewbox", "auto");
219219
}
220220

221+
//>[#144]
222+
void axisEqual(const std::string &figureName)
223+
{
224+
beginDrawingIfNeeded();
225+
setFigureProperty(figureName.empty()?current_fig:figureName, "viewbox", "equal");
226+
}
227+
//<[#144]
228+
221229
void axisLimits(const double &x_lb, const double &x_ub, const double &y_lb, const double &y_ub, const std::string &figureName)
222230
{
223231
beginDrawingIfNeeded();

client-api/C++/src/vibes.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ namespace vibes {
265265
/// Set axes limits to the bounding box of the drawing
266266
void axisAuto(const std::string &figureName = std::string());
267267

268+
/// Set axis equal aspect ratio to the bounding box of the drawing [#144]
269+
void axisEqual(const std::string &figureName = std::string());
270+
268271
/// Specify the rectangle to be displayed: Lower-left corner (\a x_lb, \a y_lb) and a upper-right corner (\a x_ub, \a y_ub).
269272
void axisLimits(const double &x_lb, const double &x_ub, const double &y_lb, const double &y_ub, const std::string &figureName = std::string());
270273

viewer/vibesgraphicsitem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ bool VibesGraphicsItem::parseJson(QJsonObject &json)
280280
json.remove("format");
281281
}
282282

283-
//>[VBS_VR_000002]
283+
//>[#142]
284284
// Hexadecimal/Short color name -> Qt Predefined color name
285285
// for group color names
286286
if (this->_qGraphicsItem->type() == VibesGraphicsGroupType){
@@ -297,7 +297,7 @@ bool VibesGraphicsItem::parseJson(QJsonObject &json)
297297
}
298298
}
299299
}
300-
//<[VBS_VR_000002]
300+
//<[#142]
301301

302302
// Process object name
303303
if (json.contains("name") && json["name"].isString())

viewer/vibesgraphicsitem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class VibesDefaults {
4646
return std::max(0.,width.toDouble());
4747
}
4848

49-
//>[VBS_VR_000002]
49+
//>[#142]
5050
// Hexadecimal/Short color name -> Qt Predefined color name
5151
bool toPredefinedColorName(QString &color){
5252

@@ -83,7 +83,7 @@ class VibesDefaults {
8383

8484
return true;
8585
}
86-
//<[VBS_VR_000002]
86+
//<[#142]
8787

8888
const QBrush brush(const QString & name = QString()) {
8989
if( !_brushes.contains(name)){

0 commit comments

Comments
 (0)