-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add remove text3d #2088
Merged
taketwo
merged 3 commits into
PointCloudLibrary:master
from
SergioRAgostinho:add-remove-text3d
Nov 26, 2017
Merged
Add remove text3d #2088
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#include <pcl/visualization/pcl_visualizer.h> | ||
#include <pcl/io/pcd_io.h> | ||
|
||
using pcl::PointCloud; | ||
using pcl::PointXYZ; | ||
|
||
int | ||
main (int , char **) | ||
{ | ||
srand (unsigned (time (0))); | ||
|
||
PointCloud<PointXYZ>::Ptr cloud (new PointCloud<PointXYZ>); | ||
|
||
cloud->points.resize (5); | ||
for (size_t i = 0; i < cloud->points.size (); ++i) | ||
{ | ||
cloud->points[i].x = float (i); | ||
cloud->points[i].y = float (i / 2); | ||
cloud->points[i].z = 0.0f; | ||
} | ||
|
||
// Start the visualizer | ||
pcl::visualization::PCLVisualizer p ("test_shapes"); | ||
int leftPort(0); | ||
int rightPort(0); | ||
p.createViewPort(0, 0, 0.5, 1, leftPort); | ||
p.createViewPort(0.5, 0, 1, 1, rightPort); | ||
p.setBackgroundColor (1, 1, 1); | ||
p.addCoordinateSystem (1.0, "first"); | ||
|
||
//p.addPolygon (cloud, "polygon"); | ||
p.addPolygon<PointXYZ> (cloud, 1.0, 0.0, 0.0, "polygon", leftPort); | ||
p.setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_LINE_WIDTH, 10, "polygon", leftPort); | ||
|
||
p.addLine<PointXYZ, PointXYZ> (cloud->points[0], cloud->points[1], 0.0, 1.0, 0.0, "line", leftPort); | ||
p.setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_LINE_WIDTH, 50, "line", leftPort); | ||
|
||
p.addSphere<PointXYZ> (cloud->points[0], 1, 0.0, 1.0, 0.0, "sphere", leftPort); | ||
p.setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_LINE_WIDTH, 5, "sphere", leftPort); | ||
// p.removePolygon ("poly"); | ||
|
||
p.addText ("text", 200, 200, 1.0, 0, 0, "text", leftPort); | ||
|
||
p.addText3D ("text3D", cloud->points[0], 1.0, 1.0, 0.0, 0.0, "", rightPort); | ||
p.spin (); | ||
p.removeCoordinateSystem ("first", 0); | ||
p.spin (); | ||
p.addCoordinateSystem (1.0, 5, 3, 1, "second"); | ||
p.spin (); | ||
p.removeCoordinateSystem ("second", 0); | ||
p.spin (); | ||
p.addText3D ("text3D_to_remove", cloud->points[1], 1.0, 0.0, 1.0, 0.0, "", rightPort); | ||
p.spin (); | ||
p.removeText3D ("text3D_to_remove", rightPort); | ||
p.spin (); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand how this loop works. Could you please elaborate why initializing
i
with this value? Also, why breaking on line 690?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If viewport is 0, you're adding it to all viewport, and since they're numbered incrementally their id numbers will be
{1, ..., #existing_viewports}
. If viewport is bigger than 0, then you know the user is specifying the specific viewport id to add the text.So this means that the ids you will be addressing are either from [1, #viewports] or simply the one specified in viewport, as long as its bigger then 0.
Regarding the break, you only cycle all possible ids when viewport = 0. If the user specified a single id, only that id is to be checked, that's why you break after a single iteration.