Skip to content

Commit

Permalink
Merge pull request #130 from godardma/master
Browse files Browse the repository at this point in the history
[viewer] added LineStyle and LineWidth support
  • Loading branch information
SimonRohou authored Oct 9, 2024
2 parents d2593c9 + f1038c4 commit bfc0301
Show file tree
Hide file tree
Showing 6 changed files with 388 additions and 188 deletions.
3 changes: 3 additions & 0 deletions client-api/C++/examples/all_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ int main()
VIBES_TEST(vibes::drawPoint(17,17,"red[darkyellow]"));
VIBES_TEST(vibes::drawPoint(27,27,2,vibesParams("FaceColor","magenta","EdgeColor","none","Draggable",true,"FixedScale",false)));

VIBES_TEST(vibes::drawBox(10,20,10,16,vibesParams("FaceColor","red","EdgeColor","black","LineStyle","-..","LineWidth","0.3","name","custom_line")))
VIBES_TEST(vibes::drawTank(12,6,30,4,"black[red]",vibesParams("LineWidth","0.5")))

VIBES_TEST( vibes::axisAuto() );
// VIBES_TEST( vibes::axisLimits(-1,1, -3,2) );

Expand Down
7 changes: 5 additions & 2 deletions client-api/python/vibes/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
vibes.drawBox(0,1,4,6,color='[#FF12FFA0]', figure='test')
vibes.drawText(12, 12, 'My Text', 0.1, 'b[r]')
vibes.axisAuto()
vibes.drawBox(0.5,2,4,7,color='[#00FFFF66]', figure='test')
vibes.drawBox(0.5,2,4,7,color='[#00FFFF66]', figure='test', name='box1')
vibes.drawBox(-1,0,-4,-6,color='r', figure='test')
vibes.drawLine([[0,0], [4,4]])
vibes.drawEllipse(3, 5, 1, 3, 45)
Expand All @@ -25,7 +25,7 @@
vibes.drawPie([0,0], [5,9], [-120, -40], group="Pie")
# vibes.drawPie([0,0], [5,9], [-120, -40], "[b]")

vibes.drawPie([5,2], [1,2], [160, 220]) #, 'g[y]')
vibes.drawPie([5,2], [1,2], [160, 220],name="pie alone") #, 'g[y]')

# vibes.clearGroup("Pie", figure="test")

Expand Down Expand Up @@ -57,6 +57,9 @@

vibes.drawPolygon([[1,1], [1,4], [5,2], [5, 1]])
vibes.setFigureProperties({'viewbox':'equal'})
vibes.drawAUV(5,3, 1, 2, color='blue[yellow]',name='auv1',LineStyle="..",LineWidth="0.3")
vibes.drawBox(2,4,4,7,color='red[yellow]', figure='test', name='box1',LineStyle="-..",LineWidth="0.1")
vibes.drawArrow((0,0), (1,1), 0.1, color='[b]', name='arrow1')

vibes.newFigure("raster")
vibes.drawArrow((0,0), (1,1), 0.1)
Expand Down
4 changes: 3 additions & 1 deletion viewer/propertyeditdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ QJsonObject PropertyEditDialog::showEditorForJson(QJsonObject init)
dlg->ui->comboBox_LineStyle->setCurrentText(init["LineStyle"].toString());
dlg->ui->comboBox_FaceColor->setCurrentText(init["FaceColor"].toString());
dlg->ui->comboBox_EdgeColor->setCurrentText(init["EdgeColor"].toString());
dlg->ui->lineEdit_LineWidth->setText(init["LineWidth"].toString());

QJsonObject json;

Expand All @@ -29,9 +30,10 @@ QJsonObject PropertyEditDialog::showEditorForJson(QJsonObject init)
json["LineStyle"] = QJsonValue(dlg->ui->comboBox_LineStyle->currentText());
json["FaceColor"] = QJsonValue(dlg->ui->comboBox_FaceColor->currentText());
json["EdgeColor"] = QJsonValue(dlg->ui->comboBox_EdgeColor->currentText());
json["LineWidth"] = QJsonValue(dlg->ui->lineEdit_LineWidth->text());
}

qDebug() << "dlg json result" << json;
// qDebug() << "dlg json result" << json;

return json;
}
48 changes: 47 additions & 1 deletion viewer/propertyeditdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@
<string/>
</property>
</item>
<item>
<property name="text">
<string>-</string>
</property>
</item>
<item>
<property name="text">
<string>--</string>
Expand All @@ -275,14 +280,55 @@
<string>-.</string>
</property>
</item>
<item>
<property name="text">
<string>-..</string>
</property>
</item>
<item>
<property name="text">
<string>..</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Line width</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_LineWidth">
<item>
<property name="text">
<string/>
</property>
</item>
<item>
<property name="text">
<string>-</string>
</property>
</item>
<item>
<property name="text">
<string>:</string>
<string>--</string>
</property>
</item>
<item>
<property name="text">
<string>-.</string>
</property>
</item>
<item>
<property name="text">
<string>-..</string>
</property>
</item>
<item>
<property name="text">
<string>..</string>
</property>
</item>
</widget>
Expand Down
Loading

0 comments on commit bfc0301

Please sign in to comment.