It is possible to create GUI-Classes that take any two CCG-objects
and displays the first component at a given location and pops-up the
second component, if mouse moves (or upon mouse click) on the first
component.
For example:
LandMarkTemplete
LM_Obj1 = new LandMarkTemplete
(CCG1, CCG2,
loc_x, loc-y);
// Where,
loc_x
and
loc_y
gives the coordinates for the CCG1's
component.
// The
CCG2
is presented upon mouse action. (Please move mouse
over RED-Rectangle)
// loc_x
and loc_y
are usually set to ZERO, so that parent can determine the location
(see below)
|
//The map is drawn on a "canvas"
(please click here for a
Canvas example):
// The following statement instantiates the Canvas's
GUI-Object.
CanvasTemplate CanvasObj1 = new CanvasTemplate (x_size, y_size,
width, height);
// Create the
back-ground Vector map for any country (or City/State).
MapComponentFactory MAP_Obj
= new MapComponentFactory("USA",
COUNTRY);
//Now, to add each
component to the Canvas's Object, use its methods. For example:
CanvasObj1.addComponent ( MAP_Obj,
0, 0); // Add
map as the background
CanvasObj1.addComponent
( LM_Obj1, loc_x1, loc_y1);
// Add first landmark
CanvasObj1.addComponent
( LM_Obj2, loc_x2, loc_y2); //
Add second landmark
CanvasObj1.addComponent
( LM_Obj3, loc_x3, loc_y3); //
Repeat it to add landmarks
Note: The order is important.
First component is shown at the bottom of the SVG-image stack. If we add
the MAP_Obj last, all the landmark components added before will be hidden
behind the Map.
|
The above SVG example showed three types of Landmark GUI-Classes:
-
A pop-up information component (Auto Hide, upon
mouse out).
-
A pop-up window to show the information subcomponent.
-
A info-component to be displayed at a
specific location away from the map.
Note: In the above example, we have used simple
Circle or Squire for the Land Marks, but they could be complex components,
having 10 subcomponents and thousands of lines of code.
Usually the GUI-classes do not restrict the
complexity of the subcomponents. There is no technical limitation that
require us to restrict the complexity of the subcomponents. However, some
cases the extra testing effort may not give any advantage, if user always
use certain types of components.
|