Selecting point, or multipe points

Any question about the main GUI application (frontend)
eimixas
Posts: 36
Joined: Thu Jan 17, 2013 8:14 am

Selecting point, or multipe points

Post by eimixas »

Trying to write plugin for plane creation on three selected points.

Is it possible to check if selected entity is a "Point" (created by "Point list picking")
something like ent->isKindOf(CC_POINT)?

and what class is representing point? (ccGenericPoint* Point1 = NULL; is not working)
Is documentation of existing structure somethere?

What about posibility selecting "Points" in 3d view? Now it works in tree only.

Thank you
Eimantas
daniel
Site Admin
Posts: 7707
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Selecting point, or multipe points

Post by daniel »

For the code documentation, you should run "doxygen" on the sources.
There's up-to-date versions here:
CCLib: http://www.cloudcompare.org/doc/CCLib/h ... tated.html
qCC_db: http://www.cloudcompare.org/doc/qCC_db/ ... tated.html
qCC: http://www.cloudcompare.org/doc/qCC/html/annotated.html

Points are (generally) stored as CCVector3 structures. In fact it's just 3 float values (x, y and z). They are not handled as 'entities' as there are too many points in 'standard' point clouds (i.e. millions). The DB tree (nor the user) could handle so many items. If you need, you can create point clouds with a unique point however.

Then, you should look at the "Point picking" tool (ccPointPropertiesDlg) class to understand/copy its behavior (you should play with the real tool first). There's also the "Point list picking" tool and the "3-points align" tool that relies on this mechanism.

Here are the basic of the 'point picking' mode:
  • you must first enable point picking mechanism in the current 3D view (ccGLWindow::setPickingMode). In a plugin you can query the active 3D view via the ccMainAppInterface attribute (m_app) :

    Code: Select all

    ccGLWindow* win = m_app->getActiveGLWindow();
    if (win)
        win->setPickingMode(POINT_PICKING);
    
  • Once activated, the window will emit the 'pointPicked' event each time the user picks a point on screen. You must connect this signal to a dedicated slot in your plugin. The slot will be called each time a point is picked. You can then put anything you want in this slot (store the point, show/hide its label, etc.).
  • Don't forget to restore standard picking mode once you're done (DEFAULT_PICKING)
I hope you're familiar with Qt signal/slot mechanism. If not, you should probably start by some tutorial:
http://doc.qt.digia.com/4.7-snapshot/si ... slots.html
Daniel, CloudCompare admin
eimixas
Posts: 36
Joined: Thu Jan 17, 2013 8:14 am

Re: Selecting point, or multipe points

Post by eimixas »

Thanks for links - helpfull.

I do not try to select "points" in point cloud.
I want to select points what are already picked with "Point picking" tool, and has it's own "square" and label in view.
daniel
Site Admin
Posts: 7707
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Selecting point, or multipe points

Post by daniel »

In this case, you could select the labels ? If you pick points the standard way, a "label" entity is added under the cloud (in the tree).

If you select this label, you can get the corresponding point index and/or coordinate.
Daniel, CloudCompare admin
eimixas
Posts: 36
Joined: Thu Jan 17, 2013 8:14 am

Re: Selecting point, or multipe points

Post by eimixas »

Yes, but how to enable this?
Trying to click mouse on that label "Point 1", or red square that is drawn for picked point - but nothing is selected.
daniel
Site Admin
Posts: 7707
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Selecting point, or multipe points

Post by daniel »

Well, in theory when you select a label it should become highlighted (red border around the label). It works either direclty on screen (on the label itself) or on the corresponding DB tree entry.

Are you doing this while your plugin is running? Maybe you have a modal dialog opened preventing you from interacting with the main interface?
Attachments
cc_selected_label.jpg
cc_selected_label.jpg (412.36 KiB) Viewed 20685 times
Daniel, CloudCompare admin
eimixas
Posts: 36
Joined: Thu Jan 17, 2013 8:14 am

Re: Selecting point, or multipe points

Post by eimixas »

something here is wrong (i enabled "Show 2D label" as in your image)
i have view like below:
Image

if i select anything on tree (shown on left screen side) it works - and border (red) is shown
but if i try click anyware on "3d view" (right side) - i could NOT select any point or label assigned to it.
eimixas
Posts: 36
Joined: Thu Jan 17, 2013 8:14 am

Re: Selecting point, or multipe points

Post by eimixas »

additional question:

your code:

Code: Select all

ccGLWindow* win = m_app->getActiveGLWindow();
if (win)
    win->setPickingMode(POINT_PICKING);
is it possible to make it something like "FACE_PICKING"?

(point picking list - but using not point cloud, but mesh faces too)
eimixas
Posts: 36
Joined: Thu Jan 17, 2013 8:14 am

Re: Selecting point, or multipe points

Post by eimixas »

Selecting 2d label works - if no mesh or points is behind it. (point 1 in upper image)
(2d label are so large - why should they be used?)

I want to "select" red square that is painted on "picked point" (not label)
Perfect solution would be selecting multipe points - with drawing rectangle with mouse (area)

if i move labels outside mesh/cloud point like in image below:
Image
sellection works.

but again "2d labels" are too big for use. 3d labels or those little squares would be great.

is some kind of "mouse grabbing" implemented on CC?
daniel
Site Admin
Posts: 7707
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Selecting point, or multipe points

Post by daniel »

I've modified the default point marker. It's now a sphere that the user can select in the 3D view. It goes from magenta to red if selected. So in your case you should hide the 2D part of the label and only work with the 3D version.

The rectangular selection of entities is not supported in CC (it's quite heavy but we are currently thinking of a good way to do it).

The triangle picking mechanism is almost ready (most of the internal mechanism is here). But we will have to add new kind of labels, so it will take some more time.
Daniel, CloudCompare admin
Post Reply