kendzi / kendzi3d

3D plugin for JOSM
56 stars 19 forks source link

Selection for buildings #46

Closed andreimaneasa closed 10 years ago

andreimaneasa commented 10 years ago

Hi, I try to make an selection in 3d for buildings. So for a selected building I want add some attribute. In class Kendzi3dGLEventListener is this method :

  public void initObjectSelectionListener() {
        this.objectSelectionListener = new ObjectSelectionManager() {

            @Override
            public Ray3d viewportPicking(int x, int y) {
                return Kendzi3dGLEventListener.this.viewport.picking(x, y);
            }

            @Override
            public Selection select(Ray3d selectRay) {
            return Kendzi3dGLEventListener.this.renderJosm.select(selectRay);
            }
        };

        // this.selectEditorListeners.add(this.objectSelectionListener);
        // this.objectSelectionListener.addEditorChangeListener(this);

        JosmEditorListener jel = new JosmEditorListener();
        this.objectSelectionListener.addEditorChangeListener(jel);
    }

I want know where is save data from return :

            @Override
            public Selection select(Ray3d selectRay) {

                return Kendzi3dGLEventListener.this.renderJosm.select(selectRay);
            }

this return parameters from a building like Way . And way is thing I want to save in a variable or in other mode (like getter/ setter ) because I need this in class Kendzi3dGLFrame and I can't receive in Kendzi3dGLFrame this parameters.

Thanks.

kendzi commented 10 years ago

You should not use result of selection inside Kendzi3dGLEventListener class. Result of that call is used by ObjectSelectionManager to call some editor which is responsible for editing selected object. Currently selection mechanism is very simple and have few glitches. The only one implemented editor is type of ArrowEditor, which allows to modify height of building. So depends on what are you plan to do, you need to either implement your own ArrowEditor or create completely new kind of editor, but that involve more work. The current implementation of ArrowEditor is not the best and should be reactor little.

andreimaneasa commented 10 years ago

To be more selective, I found attribute way (contains uniq id and some nodes) for a building from method "select" which is in class RederJosm and still want this attribute (which is variable for each building separately) to use in class Kendzi3dGLFrame. I want to make a selection of buildings in 3D. I want to select the building of the editor and get the attribute way in class Kendzi3dGLFrame to know for sure that the selected building is the one that I clicked. Then for this building one add other attributes. So my problem is that I can not send a variable (specific way in this case) from class RederJosm to class Kendzi3dGLFrame. I know that Kendzi3dGLFrame doesn't extends RederJosm so it's a chalange to me . If you know how I can pass over this please write me. Thank you.