[gephi-dev] how to implement a selection tool?

Mathieu Bastian mathieu.bastian at gmail.com
Wed Jan 12 17:19:45 CET 2011


I think you have to go the 2nd solution, as the ToolAPI is not
designed for new selection handlers.

Unfortunately, I can already tell that it will be quite a pain to dig and
modify VisualizationModule, as selection has effect on many different
classes. You should mostly copy what Rectangle do, as it is the same
type of selection. The cylinder is a bit different (and its the
default option), as it's only on mouse over.

Modify the org.gephi.visualization.component.SelectionToolbar to add a
new button under rectangle.

Mathieu

On Wed, Jan 12, 2011 at 1:52 AM, Yi Du(§ù¤@) <duyi001 at gmail.com> wrote:
> Hi all,
>   I have some questions on implementing a tool. The tool is a kind of
> selection tool, which can let user to draw a certain shape and select nodes
> in the shape. I call it lasso tool.
>
>   The question is: how can I implement such feature?
>   I think there might be two ways to implement it.
>   *The first is using the Tool API, and implement the lasso as a tool plugin
> just as the other tool plugins. If I do this way, I should focus on the
> process method of ToolEventListener. But now I didn't find any
> ToolEventListener supporting the mouse press and drag on the background of
> the window in the Tool API. If I do this way, should I implement the press
> and drag event listener myself? Besides, I should
> modified DesktopToolController and add a MouseDragHandler, because all the
>  event handlers are here.
>   *Second, In fact the tool is a kind of selection. I found the implemented
> Cylinder and Rectangle are similar as the lasso.  But I don't know how to
> add a new selection tool here. In the CompatibilityEngine->initSelection(),
> there are only three kinds of selections(custom, rectangle, cylinder). Seems
> I shouldn't implement such tool as Cylinder and Rectangle do.
>   Sincerely.
> --
> §ù¤@ Yi Du (Yestin)
> IEL, Chinese Academy of Sciences, Institute of Software.
> TEL: +86-15810134970
> email&gtalk: duyi001 at gmail.com
>
> _______________________________________________
> gephi-dev mailing list
> gephi-dev at lists.gephi.org
> http://gephi.org/mailman/listinfo/gephi-dev
>
>


More information about the gephi-dev mailing list