|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.objex.panywhere.SmartDrawService
public abstract class SmartDrawService
This abstract class defines the smart draw service. ProgenyAnywhere defines a default smartdraw service that is used internally to determine the most appropriate XY positions for the
person icons. Programmers also have an opportunity to provide their own smartdraw algorithm by creating subclasses of this class and implementing the smartdraw() method.
When you do create your own smartdraw service, you must remember to replace the default service used internally by ProgenyAnywhere by adding this new service using t he method
ProgenyAnywhere.addSmartDrawService(SmartDrawService service).
One of the reasons this may be useful is if you like the way ProgenyAnywhere handles the rendering of the pedigree but know of a web service somewhere on the wider Internet that performs a better (we think not)
smartdraw algorithm. You would then create your external smartdraw service as shown in example below and use the output from that web service to feed ProgenyAnywhere with the XY positions.
See example below for a rather rudiementary smartdraw algorithm that feeds ProgenyAnywhere with ready made XY positions for rendering the icons.
class ExternalSmartDrawService extends SmartDrawService {
private ProgenyAnywhere m_anywhere;
public ExternalSmartDrawService(ProgenyAnywhere a_anywhere) {
super(a_anywhere);
m_anywhere= a_anywhere;
}
public Map smartDraw() {
if (m_anywhere.getCount() == 0) {//no persons in the pedigree
Map map = new Hashtable();
map.put(1, new String[]{});
map.put(2, new double[]{});
map.put(3, new double[]{});
return map;
}
//Run some algorithm that returns XY positions for the persons in the pedigree
Map map = new Hashtable();
int PERSON_COUNT = 10;
double lm_xd[] = new double[PERSON_COUNT]; //array of x coordinates
double lm_yd[] = new double[PERSON_COUNT]; //array of y coordinates
String lm_local_upns[] = new String[PERSON_COUNT]; //array of person UPNs
for (int xx = 0; xx < lm_local_upns.length; xx++) {
lm_local_upns[xx] = (xx + 1) + ""; //UPN
lm_xd[xx] = xx; //x coordinate determined by my algorithm
lm_yd[xx] = xx + 10; //y coordinate determined by my algorithm
}
map.put(1, lm_local_upns);
map.put(2, lm_xd);
map.put(3, lm_yd);
return map;
}
}
ProgenyAnywhere anywhere; //must have been instantiated somehwere
anywhere.addSmartDrawService(new ExternalSmartDrawService(anywhere));
| Constructor Summary | |
|---|---|
protected |
SmartDrawService(ProgenyAnywhere a_anywhere)
Create a new smart draw service |
| Method Summary | |
|---|---|
void |
destroy()
Destroy the service and any worker threads that may be running |
abstract java.util.Map<java.lang.Integer,java.lang.Object> |
smartDraw()
Must implement this method if you create your own smartdraw service. |
void |
start()
Called internally to invoke the supplied smartDraw() algorithm |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected SmartDrawService(ProgenyAnywhere a_anywhere)
a_anywhere - An instance of ProgenyAnywhere for which the smart draw service is being created.| Method Detail |
|---|
public abstract java.util.Map<java.lang.Integer,java.lang.Object> smartDraw()
public final void destroy()
public final void start()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||