|
GeoSoft API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object GObject
Class representing a graphical object. The representation is by actual geometry (GSegments) or in terms of sub objects (or both).
Typically GObject is extended and its draw() method is overloaded:
public class ClientGraphicsObject extends GObject { public ClientGraphicsObject() { // Prepare the graphics object here, i.e. add the // GSegments and sub-GObjects it consists of, and // set rendering style (GStyle) on the elements // and add annotations (GText) and images (GImage). } public void draw() { // Set geometry for all containing GSegments. } }A top level GObject is inserted into the scene like this:
GScene scene = new GScene (window); GObject object = new ClientGraphicsObject(); scene.add (object);
Field Summary | |
static int |
ANNOTATION_INVISIBLE
|
static int |
ANNOTATION_VISIBLE
|
static int |
DATA_INVISIBLE
|
static int |
DATA_VISIBLE
|
static int |
INVISIBLE
|
static int |
SYMBOLS_INVISIBLE
|
static int |
SYMBOLS_VISIBLE
|
static int |
VISIBLE
|
static int |
WIDGETS_INVISIBLE
|
static int |
WIDGETS_VISIBLE
|
Constructor Summary | |
GObject()
Create a new unnamed graphic object. |
|
GObject(String name)
Create a graphical object with specified name. |
Method Summary | |
void |
add(GObject child)
Add child object to this object. |
void |
add(GObject child,
int position)
Add a sub object to this graphics object. |
void |
addSegment(GSegment segment)
Add a new segment to this object. |
int |
back()
Return the position code for back. |
int |
backward()
Return position code for "backward". |
int |
behind(GObject child)
Return the position code for the position behind the specified child node. |
void |
draw()
This method should be overloaded for graphics objects with drawable elements (GSegments). |
GObject |
find(int x,
int y)
Return front-most object intersecting the specfied point. |
GObject |
find(int x0,
int y0,
int x1,
int y1)
Return front-most object intersecting the specfied rectangle. |
GObject |
find(Object userData)
Find sub object based on user data tag. |
GObject |
find(String name)
Find a child object with specified name. |
List |
findAll(int x,
int y)
Find all objects intersecting a specified point. |
List |
findAll(int x0,
int y0,
int x1,
int y1)
Find all objects intersecting a specified rectangle. |
List |
findAllInside(int x0,
int y0,
int x1,
int y1)
Find all objects inside a specified rectangle. |
GObject |
findInside(int x0,
int y0,
int x1,
int y1)
Find front-most object that are inside the specified rectangle. |
GSegment |
findSegment(int x,
int y)
Return the first segment found that intersects the specified point. |
GSegment |
findSegment(int x0,
int y0,
int x1,
int y1)
Return the first segment found that intersects the specified rectangle Search this node, and all sub nodes. |
GSegment |
findSegment(Object userData)
Find a segment with specified user data. |
GSegment |
findSegmentInside(int x0,
int y0,
int x1,
int y1)
Return the first segment found that are completely inside the specified rectangle. |
List |
findSegments(int x,
int y)
Return all segments that intersects with the specified point. |
List |
findSegments(int x0,
int y0,
int x1,
int y1)
Return all segments that intersects the specified rectangle. |
List |
findSegmentsInside(int x0,
int y0,
int x1,
int y1)
Return all segments that are completely inside of the specified rectangle. |
int |
forward()
Return position code for "forward". |
int |
front()
Return the position code for front. |
GObject |
getChild(int position)
Return the child object at specified position. |
List |
getChildren()
Return all children objects of this GObject. |
String |
getName()
Return name of this graphic object. |
int |
getNChildren()
Return number of children of this graphic object. |
int |
getNSegments()
Return number of segments in this GObject. |
GObject |
getObjectBehind()
Return the sibling object immediately behind this object. |
GObject |
getObjectInFront()
Return the sibling object in the immediate front of this object. |
GObject |
getParent()
Return parent GObject of this object. |
GScene |
getScene()
Return scene of this graphic object. |
GSegment |
getSegment()
Return first segment of this graphic object. |
GSegment |
getSegment(int segmentNo)
Return the n'th segment of this object. |
List |
getSegments()
Return all segments of this graphic object. |
GStyle |
getStyle()
Return style of this object. |
GTransformer |
getTransformer()
Conveience method for getting the transformation object of the scene of this object. |
Object |
getUserData()
Return user data of this graphics object. |
int |
getVisibility()
Return the current visibility mask for this object. |
GWindow |
getWindow()
Return the window of this graphic object. |
int |
inFrontOf(GObject child)
Return the position code for the position in front of the specified child node. |
boolean |
isInBack()
Return true if this object is behind all its siblings. |
boolean |
isInFront()
Return true if this object is in front of all its siblings. |
void |
redraw()
Force a redraw of this object. |
void |
refresh()
Convenience method for refreshing the window canvas. |
void |
remove()
Unlink self from parent child list. |
void |
remove(GObject child)
Remove child from child list. |
void |
removeAll()
Remove all children objects. |
void |
removeSegment(GSegment segment)
Remove the specified segment from this GObject. |
void |
removeSegment(int segmentNo)
Remove specified segment from this GObject. |
void |
removeSegments()
Remove all segments from this GObject. |
void |
removeSegments(int from)
Remove sequence of segments from this object. |
void |
removeSegments(int from,
int to)
Remove sequence of segments from this object. |
void |
reposition(GObject child,
int position)
Reposition specified child object. |
void |
setName(String name)
Set name of this graphic object. |
void |
setStyle(GStyle style)
Set new style for this object. |
void |
setUserData(Object userData)
Set user data of this graphics object. |
void |
setVisibility(int visibilityMask)
Change the visibility for this object. |
void |
styleChanged(GStyle style)
Called when the style of this object is changed. |
void |
toBack()
Move this object to the behind its siblings in its parent object. |
void |
toFront()
Move this object to the front of its siblings in its parent object. |
String |
toString()
Return a string representation of this object. |
Methods inherited from class Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int DATA_VISIBLE
public static final int ANNOTATION_VISIBLE
public static final int SYMBOLS_VISIBLE
public static final int WIDGETS_VISIBLE
public static final int VISIBLE
public static final int DATA_INVISIBLE
public static final int ANNOTATION_INVISIBLE
public static final int SYMBOLS_INVISIBLE
public static final int WIDGETS_INVISIBLE
public static final int INVISIBLE
Constructor Detail |
public GObject(String name)
name
- Name of object.public GObject()
Method Detail |
public String getName()
public void setName(String name)
name
- New name of this graphic object.public GScene getScene()
public GTransformer getTransformer()
public GWindow getWindow()
public List getSegments()
public GSegment getSegment()
public int getVisibility()
setVisibility(int)
public void setUserData(Object userData)
userData
- User data of this graphics object.public Object getUserData()
public GObject find(Object userData)
userData
- User data of child to find.
public GSegment findSegment(Object userData)
userData
- User data of requested segment.
public void add(GObject child, int position)
child
- Object to addposition
- Position to add topublic void add(GObject child)
child
- Child to add.public void toFront()
public void toBack()
public void reposition(GObject child, int position)
child
- Child object to be repositioned.position
- New position of child.public int behind(GObject child)
child
- Child node.
reposition(GObject,int)
public int inFrontOf(GObject child)
child
- Child node.
reposition(GObject,int)
public int front()
reposition(GObject,int)
public int back()
reposition(GObject,int)
public int forward()
reposition(GObject,int)
public int backward()
reposition(GObject,int)
public List getChildren()
public int getNChildren()
public GObject find(String name)
name
- Name of object to find.
public List findSegments(int x0, int y0, int x1, int y1)
x0
- X coordinate of upper left corner of rectangle.y0
- Y coordinate of upper left corner of rectangle.x1
- X coordinate of lower right corner of rectangle.y1
- Y coordinate of lower right corner of rectangle.
public List findSegmentsInside(int x0, int y0, int x1, int y1)
x0
- X coordinate of upper left corner of rectangle.y0
- Y coordinate of upper left corner of rectangle.x1
- X coordinate of lower right corner of rectangle.y1
- Y coordinate of lower right corner of rectangle.
public GSegment findSegment(int x0, int y0, int x1, int y1)
x0
- X coordinate of upper left corner of rectangle.y0
- Y coordinate of upper left corner of rectangle.x1
- X coordinate of lower right corner of rectangle.y1
- Y coordinate of lower right corner of rectangle.
public GSegment findSegmentInside(int x0, int y0, int x1, int y1)
x0
- X coordinate of upper left corner of rectangle.y0
- Y coordinate of upper left corner of rectangle.x1
- X coordinate of lower right corner of rectangle.y1
- Y coordinate of lower right corner of rectangle.
public GSegment findSegment(int x, int y)
x
- X coordinate of point to check.y
- Y coordinate of point to check.
public List findSegments(int x, int y)
public GObject find(int x0, int y0, int x1, int y1)
x0
- X coordinate of upper left corner of rectangle.y0
- Y coordinate of upper left corner of rectangle.x1
- X coordinate of lower right corner of rectangle.y1
- Y coordinate of lower right corner of rectangle.
public GObject findInside(int x0, int y0, int x1, int y1)
x0
- X coordinate of upper left corner of rectangle.y0
- Y coordinate of upper left corner of rectangle.x1
- X coordinate of lower right corner of rectangle.y1
- Y coordinate of lower right corner of rectangle.
public GObject find(int x, int y)
x
- X coordinate of point to check.y
- Y coordinate of point to check.
public List findAll(int x0, int y0, int x1, int y1)
x0
- X coordinate of upper left corner of rectangle.y0
- Y coordinate of upper left corner of rectangle.x1
- X coordinate of lower right corner of rectangle.y1
- Y coordinate of lower right corner of rectangle.
public List findAllInside(int x0, int y0, int x1, int y1)
public List findAll(int x, int y)
x
- X coordinate of point to check.y
- Y coordinate of point to check.
public void remove()
public void remove(GObject child)
child
- Child object to remove.public void removeAll()
public GObject getChild(int position)
position
- Position to return child of.
public boolean isInFront()
public boolean isInBack()
public GObject getObjectInFront()
public GObject getObjectBehind()
public void addSegment(GSegment segment)
segment
- Segment to add.public GSegment getSegment(int segmentNo)
segmentNo
- Segment number to return.
public int getNSegments()
public void removeSegment(GSegment segment)
segment
- Segment to remove. If the specified segment is not
a child of this GObject, this call has no effect.public void removeSegment(int segmentNo)
segmentNo
- Segment to remove. If the specified segment does not
exist, this casll has no effect.public void removeSegments()
public void removeSegments(int from, int to)
from
- Starting segmentto
- Ending segment (-1 indicates all).public void removeSegments(int from)
from
- Starting segmentpublic void redraw()
Normally this method is called automatically whenever needed (typically on retransformations). A client application may call this method explicitly if some external factor that influence the graphics has been changed. However, beware of the performance overhead of such an approach, and consider reorganizing the code so that model changes explictly affects the graphics elements.
public void setStyle(GStyle style)
style
- Style of this object (or null if the intent is
to unset the current style).public GStyle getStyle()
public void setVisibility(int visibilityMask)
NOTE: The present visibility is maintained, and the new flag is taken as an instruction for change. The instruction is an or'ed combination of:
visibilityMask
- Visibility instruction.public GObject getParent()
public void refresh()
getWindow().refresh();
.
public void draw()
public void styleChanged(GStyle style)
styleChanged
in interface GStyleListener
style
- Style that has changed.public String toString()
|
GeoSoft API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |