GeoSoft API

no.geosoft.cc.graphics
Interface GInteraction

All Known Implementing Classes:
ZoomInteraction

public interface GInteraction

Common interface for all graphics interactions.

Typical usage:

    public class DrawInteraction implements GInteraction
    {
       private GObject   interaction_;
       private GSegment  line_;

       public void event (GScene scene, int event, int x, int y)
       {
          switch (event) {
             case GWindow.BUTTON1_DOWN :
               // Create interaction object and segment and add to scene
               break;
 
             case GWindow.BUTTON1.DRAG :
                // extend segment with new x,y
                // and refresh graphics
 
             case ...
          }
       }
    }
 
The interaction is started by installing it in the GWindow:
    GInteraction drawInteraction = new DrawInteraction();
    window.startInteraction (drawInteraction);
 
The interaction is stopped if another interaction is started or if it is explicitly stopped by GWindow.stopInteraction(). Before the interaction is stopped a GWindow.ABORT event is passed to the interaction.

Author:
GeoSoft
See Also:
GWindow.startInteraction(GInteraction), GWindow.stopInteraction(), ZoomInteraction

Method Summary
 void event(GScene scene, int event, int x, int y)
          Trigged by mouse events within the canvas.
 

Method Detail

event

public void event(GScene scene,
                  int event,
                  int x,
                  int y)
Trigged by mouse events within the canvas.

Parameters:
scene - The scene of this event.
event - Event type
x - X position of cursor.
y - Y position of cursor.
See Also:
GWindow

GeoSoft API

Copyright © 2004 - Geotechnical Software Services     geosoft.no