package caida.otter;
import caida.otter.ValuesGroup;
import java.util.Hashtable;
import java.awt.*;
import caida.tools.PsGenerator;
/*****************************************************************************
* File: DisplayObject.java Name:DisplayObject
* Interface: DisplayObject.java
* Goal: Create a interactive panel. Which will display nodes
* and links. It will also allow a GUI for their
* creation, manipulation, and destruction
*
* Written: Bradley Huffaker (12/17/97)
*
* Modified: Jaeyeon Jung (2/13/98)
* To hold lat/long/city.
*
* For:Cooperative Association for Internet Data Analysis
******************************************************************************
******************************************************************************
By accessing this software, DISPLAYOBJECT, you are duly informed of and
agree to be bound by the conditions described below in this notice:
This software product, DISPLAYOBJECT, is developed by Bradley Huffaker, and
copyrighted(C) 1998 by the University of California, San Diego (UCSD),
with all rights reserved. UCSD administers the NSF grant to CAIDA,
number NCR-9711092, under which this code was developed."
There is no charge for DISPLAYOBJECT software. You can redistribute it and/or
modify it under the terms of the GNU General Public License, v. 2 dated
June 1991 which is incorporated by reference herein. DISPLAYOBJECT is
distributed WITHOUT ANY WARRANTY, IMPLIED OR EXPRESS, OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE or that the use of
it will not infringe on any third party's intellectual property
rights.
You should have received a copy of the GNU GPL along with the DISPLAYOBJECT
program. Copies can also be obtained from
http://www.gnu.org/copyleft/gpl.html or by writing to
University of California, San Diego
SDSC/CAIDA
9500 Gilman Dr., MS-0505
La Jolla, CA 92093 - 0505 USA
Or contact INFO@CAIDA.ORG
*****************************************************************************/
public abstract class DisplayObject
{
/****************************************************
* Commain varialbes
*****************************************************/
// ********** Defualts ****************************
int default_size;
int default_x, default_y;
Color default_color = Color.black;
int x,y;
Color color = default_color;
Color value_color = default_color;
static final Color selected_color = Color.blue;
boolean selected = false;
// switch between draw large or little
boolean little = true;
// The size of the object
int size;
int little_size = 1;
// The rank of the object
int rank;
// Latitude and longitude -jae
boolean set_geo = false;
boolean on_map = false;
boolean set_latlon = true;
double lat = 91.0;
double lon = 181.0;
String city = " ";
//jae
boolean exists = true;
// ************* Links & Path Stuff
int direction;
static int DIR_ONE = 1;
static int DIR_TWO = 2;
// Animation Stuff
// Rembers if the object exists at all
boolean[] exists_in_file;
// Keeps track of the color by file
Color[] color_in_file = new Color[1];
Color[] value_color_in_file = new Color[1];
int current_fileIndex = 0;
int num_files = 1;
// Keeps track of weather the object is currently colored
boolean colored = false;
/***************************** Values Stuff *****************/
// Values Hash;
Hashtable groupHash = new Hashtable(20);
ValuesGroup current_group = null;
Object current_values = null;
String string_value;
double double_value;
String status;
boolean hidden = false;
/** Paint counter stuff for nodes and links */
int prevPaintCounter = -1;
int currentPaintCounter = 0;
/****************************************************
* Purpose: To allow for the DList to sort be sorted
*****************************************************/
public boolean greater(DisplayObject object) { return false; }
public double near(int x, int y){ return -1; }
public void setSelect(boolean input) { selected = input;}
public boolean isSelected(){ return selected; }
public void setHighlight(boolean input) {}
public boolean isHighlighted() { return false;}
public void setColor(Color color_input)
{
color = color_input;
color_in_file[current_fileIndex] = color;
}
public void setToDefaultColor()
{
color = default_color;
color_in_file[current_fileIndex] = color;
colored = false;
}
public void setValueColor(Color input)
{
value_color = input;
value_color_in_file[current_fileIndex] = input;
colored = true;
}
public void setToValueColor()
{
if (current_values != null)
color = value_color;
}
public void setDefaultSize(int size_input)
{
if (size_input < 0)
{
size = 0;
default_size = 0;
}
else
{
size = size_input;
default_size = size_input;
}
}
public void setToDefault()
{
size = default_size;
color = default_color;
}
public int getDirection() { return DIR_ONE;}
public int getSize()
{
return size;
}
public void setSize(int size_input)
{
if (size_input < 0)
size = 0;
else
size = size_input;
}
public void hide() { hidden = true; }
public void show() { hidden = false; }
public boolean hidden() { return hidden; }
public void showAll() { hidden = false; }
public void hideAll() { hidden = true; }
//jae
public int getRank() {return rank;}
public void setRank(int rank_input) { rank = rank_input;}
public void draw(Graphics g, Dimension dim, double[]latlon,
int paintCounter) {
currentPaintCounter = paintCounter;
draw(g,0,0,1,1,dim,latlon,false);
}
public void draw(Graphics g, Dimension dim, double[] latlon)
{
draw(g,0,0,1,1,dim,latlon,false);
}
public void draw(Graphics g, double x_shift, double y_shift,
double x_scale, double y_scale, Dimension dim, double[] latlon,
boolean drawing_postscript)
{
}
public void draw(Graphics g, int x_shift, int y_shift,
int x_scale, int y_scale, Dimension dim, double[] latlon,
boolean drawing_postscript)
{
}
// Helper that both Link and Path use to draw lines.
protected void drawLine(Graphics g,
double x1, double y1, double x2, double y2,
double x_shift, double y_shift, double x_scale, double y_scale,
boolean drawing_postscript) {
double local_x1 =( (x1 * x_scale)+x_shift);
double local_y1 =( (y1 * y_scale)+y_shift);
double local_x2 =( (x2 * x_scale)+x_shift);
double local_y2 =( (y2 * y_scale)+y_shift);
drawLineHelper(g, local_x1, local_y1, local_x2, local_y2);
// Try to draw a arrow on the line at the right side
if (Arrows.getShowArrows()) {
Arrows.drawArrow(g, (int) local_x1, (int) local_x1,
(int) local_x2, (int) local_y2);
}
if (little)
return;
double delta_x = x1 - x2;
double delta_y = y1 - y2;
// Normaling the delta's
if (delta_x == 0 || delta_y == 0)
{
if (delta_x < 0)
delta_x = -1;
else if (delta_x > 0)
delta_x = 1;
if (delta_y < 0)
delta_y = -1;
else if (delta_y > 0)
delta_y = 1;
}
else
{
if (delta_x*delta_x > delta_y*delta_y)
{
delta_y = delta_y / delta_x;
delta_x = 1;
}
else
{
delta_x = delta_x / delta_y;
delta_y = 1;
}
}
// Creates the default of one direction
double[] x_arrayD=null,y_arrayD=null;
int[] x_arrayI=null,y_arrayI=null;
if (drawing_postscript) {
double[]x_array = {x1 - (size*delta_y),
x1 + (size*delta_y), x2};
double[]y_array = {y1 + (size*delta_x),
y1 - (size*delta_x), y2};
x_arrayD=x_array;
y_arrayD=y_array;
}else{
int[]x_array = {(int) (x1 - (size*delta_y)),
(int)(x1 + (size*delta_y)), (int)x2};
int[]y_array = {(int)(y1 + (size*delta_x)),
(int)(y1 - (size*delta_x)),(int) y2};
x_arrayI=x_array;
y_arrayI=y_array;
}
int num = 3;
if (direction == DIR_TWO)
{
if (drawing_postscript) {
double[] x_array = {(x1 - (size*delta_y)),
(x1 + (size*delta_y)),
(x2 + (size*delta_y)),
(x2 - (size*delta_y))};
double[] y_array = {(y1 + (size*delta_x)),
(y1 - (size*delta_x)),
(y2 - (size*delta_x)),
(y2 + (size*delta_x))};
x_arrayD=x_array;
y_arrayD=y_array;
}else{
int[] x_array = {(int)(x1 - (size*delta_y)),
(int)(x1 + (size*delta_y)),
(int)(x2 + (size*delta_y)),
(int)(x2 - (size*delta_y))};
int[] y_array = {(int)(y1 + (size*delta_x)),
(int)(y1 - (size*delta_x)),
(int)(y2 - (size*delta_x)),
(int)(y2 + (size*delta_x))};
x_arrayI=x_array;
y_arrayI=y_array;
}
num = 4;
}
if (g instanceof PsGenerator){
((PsGenerator)g).fillPolygon(x_arrayD,y_arrayD,num);
} else {
g.fillPolygon(x_arrayI,y_arrayI,num);
}
}
public void drawLineHelper(Graphics g, double x1, double y1, double x2,
double y2)
{
if (g instanceof PsGenerator){
((PsGenerator) g).drawLine(x1, y1, x2, y2);
}else{
g.drawLine((int)x1,(int)y1,(int)x2,(int)y2);
}
double x_diff = x1 - x2;
x_diff *= x_diff;
double y_diff = y1 - y2;
y_diff *= y_diff;
double x_shift = 0;
double y_shift = 0;
if (y_diff < x_diff)
{
x_shift = 0;
y_shift = 1;
}
else
{
y_shift = 0;
x_shift = 1;
}
int shift = 1;
for (int index = 1; index < size; index++)
{
if (g instanceof PsGenerator){
((PsGenerator)g).drawLine(x1 - x_shift*shift, y1 -y_shift*shift,
x2 - x_shift*shift, y2 - y_shift*shift);
}else{
g.drawLine((int)(x1 - x_shift*shift),(int) ( y1 -y_shift*shift),
(int)(x2 - x_shift*shift), (int) (y2 - y_shift*shift));
}
shift *= -1;
if (shift >0)
shift += 1;
}
}
public DisplayObject[] remove() {return new DisplayObject[0]; }
public void removeObject(DisplayObject displayObject){}
public void setLittle(boolean value) { little = value; }
public boolean getLittle() { return little; }
public String getInfo(){ return ""; }
public DisplayObject getParent(){ return null; }
public DisplayObject getChild() { return null; }
public void setXY(int x, int y){}
public void changeXY(int delta_x, int delta_y){}
public void setGeo(double lat_input,double lon_input, String city_input)
{
lat = lat_input;
lon = lon_input;
city = city_input;
setGeo(true);
}
public void setGeo(boolean flag)
{
set_geo = flag;
}
public boolean isGeoSet()
{
return set_geo;
}
public void onMap(boolean flag)
{
on_map = flag;
}
public boolean isOnMap()
{
return on_map;
}
public void setLatLon(boolean flag)
{
set_latlon = flag;
}
public boolean isSetLatLon()
{
return set_latlon;
}
//jae
public double getLatitude() { return lat;}
public void setLatitude(double value) { lat = value; }
public double getLongitude() { return lon;}
public void setLongitude(double value) { lon = value; }
//jae
// ---------------------- Animation Stuff --------------------
public void setUpFiles()
{
exists_in_file = new boolean[num_files];
color_in_file = new Color[num_files];
for( int index=0; index < num_files; index++)
{
exists_in_file[index] = false;
color_in_file[index] = default_color;
}
}
public abstract int getMinX();
public abstract int getMaxX();
public abstract int getMinY();
public abstract int getMaxY();
public boolean exists() { return exists; }
public boolean exists(int fileIndex)
{
return exists_in_file[fileIndex];
}
public void setExists(int fileIndex)
{
current_fileIndex = fileIndex;
exists_in_file[fileIndex] = true;
}
public void setFileIndex(int fileIndex)
{
current_fileIndex = fileIndex;
if (exists_in_file != null)
{
exists = exists_in_file[fileIndex];
color = color_in_file[fileIndex];
}
}
/************************ Values Stuff ****************************/
public boolean hasValues()
{
return (current_values != null);
}
public void setNoValue()
{
status = null;
}
public double getDouble() { return double_value; }
public double setDouble(ValuesGroup group, int index)
{
if (group.getType() != ValuesGroup.DOUBLE)
{
System.err.println("ValuesGroup.setDouble():"+
"type is incorrect");
return -1;
}
double_value = ((double[]) groupHash.get(group))[index];
status = group.getTitle() +":" + double_value;
return double_value;
}
public String getString() { return string_value; }
public String setString(ValuesGroup group, int index)
{
if (group.getType() != ValuesGroup.STRING)
{
System.err.println("ValuesGroup.setString():"+
"type is incorrect");
return new String("");
}
string_value = ((String[]) groupHash.get(group))[index];
status = group.getTitle() +":" + string_value;
return string_value;
}
public void setGroup(ValuesGroup group)
{
if (group == null)
return;
int index = group.getSelected();
current_values = groupHash.get(group);
if (current_values == null)
{
current_group = null;
return;
}
if (group.getType() == ValuesGroup.DOUBLE)
double_value = ((double[])current_values)[index];
else
string_value = ((String[])current_values)[index];
current_group = group;
}
public void addValues(ValuesGroup group, Object values)
{
groupHash.put(group,values);
}
}
There was peace and harmony in the home of the Reverend Taylor. An air of neatness and prosperity was about his four-room adobe house. The mocking-bird that hung in a willow cage against the white wall, by the door, whistled sweet mimicry of the cheep of the little chickens in the back yard, and hopped to and fro and up and down on his perches, pecking at the red chili between the bars. From the corner of his eyes he could peek into the window, and it was bright with potted geraniums, white as the wall, or red as the chili, or pink as the little crumpled palm that patted against the glass to him. It was the first scene of the closing act of the tragic comedy of the Geronimo campaign. That wily old devil, weary temporarily of the bloodshed he had continued with more or less regularity for many years, had[Pg 297] sent word to the officers that he would meet them without their commands, in the Ca?on de los Embudos, across the border line, to discuss the terms of surrender. The officers had forthwith come, Crook yet hopeful that something might be accomplished by honesty and plain dealing; the others, for the most part, doubting. The two rival Ministers of England became every day more embittered against each other; and Bolingbroke grew more daring in his advances towards the Pretender, and towards measures only befitting a Stuart's reign. In order to please the High Church, whilst he was taking the surest measures to ruin it by introducing a popish prince, he consulted with Atterbury, and they agreed to bring in a Bill which should prevent Dissenters from educating their own children. This measure was sure to please the Hanoverian Tories, who were as averse from the Dissenters as the Whigs. Thus it would conciliate them and obtain their support at the[19] very moment that the chief authors of it were planning the ruin of their party. This Bill was called the Schism Bill, and enjoined that no person in Great Britain should keep any school, or act as tutor, who had not first subscribed the declaration to conform to the Church of England, and obtained a licence of the diocesan. Upon failure of so doing, the party might be committed to prison without bail; and no such licence was to be granted before the party produced a certificate of his having received the Sacrament according to the communion of the English Church within the last year, and of his having also subscribed the oaths of Allegiance and Supremacy. The earliest martial event of the year 1760 was the landing of Thurot, the French admiral, at Carrickfergus, on the 28th of February. He had been beating about between Scandinavia and Ireland till he had only three ships left, and but six hundred soldiers. But Carrickfergus being negligently garrisoned, Thurot made his way into the town and plundered it, but was soon obliged to abandon it. He was overtaken by Captain Elliot and three frigates before he had got out to sea, his ships were taken, he himself was killed, and his men were carried prisoners to Ramsey, in the Isle of Man. "I see you've got a cow here," said a large man wearing a dingy blue coat with a Captain's faded shoulder-straps. "I'm a Commissary, and it's my duty to take her." Suddenly they heard little Pete's voice calling: "Stop your ranting and tell me how the hogs got you." "Hold, Lord de Boteler," interrupted Father John, calmly; "the threat need not pass thy lips: I go; but before I depart I shall say, in spite of mortal tongue or mortal hand, that honor and true knighthood no longer preside in this hall, where four generations upheld them unsullied." HoME小明看看台湾视频发布
ENTER NUMBET 0017
akway.com.cn
zongjiela.com.cn
gechu9.com.cn
yanjiu8.com.cn
xujun4.com.cn
www.cunge7.com.cn
geize0.com.cn
guilu5.net.cn
www.06vc.com.cn
www.amzdelta.com.cn