Skip to content

Commit f98a18b

Browse files
Initial version, add analysis
1 parent 31bdafc commit f98a18b

89 files changed

Lines changed: 7544 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
package sysmlinjava.analysis.animatedareadisplay;
2+
3+
import java.io.Serializable;
4+
import sysmlinjava.analysis.common.XYData;
5+
6+
/**
7+
* Representation of an image object in an area display. Contains the parameters
8+
* needed to display the object as an image in the display from a specified
9+
* image file and at a specified position, size, roation, and z-order in the
10+
* area display.
11+
*
12+
* @author ModelerOne
13+
*
14+
*/
15+
public class AAImage extends AAObject implements Serializable
16+
{
17+
/** Serializable ID*/private static final long serialVersionUID = -7826688565768235972L;
18+
/**
19+
* String for default image file URL used only if null URL is provided in
20+
* constructor
21+
*/
22+
public static final String defaultImageFileURL = "file:defaultImage.png";
23+
24+
/**
25+
* URL of the file that contains the image to be displayed in the area display.
26+
* If the URL is for a file on the local file system, be sure to use an absolute
27+
* path to the file. The file will be loaded from the "working" directory of the
28+
* TaskMaster, so use of a relative path to the image file is likely to fail to
29+
* locate it properly.
30+
*/
31+
public String imageFileURL;
32+
/**
33+
* Width (pixels) to resize the image to for the display. Null or zero for no
34+
* resize
35+
*/
36+
public Integer resizeWidth;
37+
/**
38+
* Height (pixels) to resize the image to for the display. Null or zero for no
39+
* resize
40+
*/
41+
public Integer resizeHeight;
42+
/**
43+
* Degrees (clockwise) to rotate the image to for the display. Null or zero for
44+
* no resize
45+
*/
46+
public Integer rotateDegrees;
47+
/**
48+
* X,Y position in the display of the center of the image
49+
*/
50+
public XYData position;
51+
/**
52+
* Order of the image in the layers of objects in the area display. Lower number
53+
* is closer to viewer.
54+
*/
55+
public Integer zOrder;
56+
57+
/**
58+
* Constructor for all attributes
59+
*
60+
* @param uid unique identifier
61+
* @param action the action to be performed in the display of the text
62+
* @param imageFileURL URL for the file that contains the image to be
63+
* displayed.
64+
* @param resizeWidth width (pixels) to resize the image to for the display.
65+
* Null or zero for no resize
66+
* @param resizeHeight height (pixels) to resize the image to for the display.
67+
* Null or zero for no resize
68+
* @param rotateDegrees degrees (clockwise) to rotate the image to for the
69+
* display. Null or zero for no resize
70+
* @param position X,Y position in the display of the center of the image
71+
* @param zOrder order of the image in the layers of objects in the area
72+
* display. Lower number is closer to viewer.
73+
*/
74+
public AAImage(String uid, Action action, String imageFileURL, Integer resizeWidth, Integer resizeHeight, Integer rotateDegrees, XYData position, Integer zOrder)
75+
{
76+
super(uid, action);
77+
switch (action)
78+
{
79+
case create:
80+
this.position = position != null ? position : new XYData(0, 0);
81+
this.imageFileURL = imageFileURL != null ? imageFileURL : defaultImageFileURL;
82+
this.resizeWidth = resizeWidth != null ? resizeWidth : 0;
83+
this.resizeHeight = resizeHeight != null ? resizeHeight : 0;
84+
this.rotateDegrees = rotateDegrees != null ? rotateDegrees : 0;
85+
this.zOrder = zOrder != null ? zOrder : 0;
86+
break;
87+
case update:
88+
this.imageFileURL = imageFileURL;
89+
this.resizeWidth = resizeWidth;
90+
this.resizeHeight = resizeHeight;
91+
this.rotateDegrees = rotateDegrees;
92+
this.position = position;
93+
this.zOrder = zOrder;
94+
break;
95+
case delete:
96+
break;
97+
default:
98+
break;
99+
}
100+
}
101+
102+
/**
103+
* Updates/changes the image display as specified by parameter values, with
104+
* value {@code null} indicating no change
105+
*
106+
* @param action the action to be performed in the display of the text
107+
* @param imageFileURL URL for the file that contains the image to be
108+
* displayed.
109+
* @param resizeWidth width (pixels) to resize the image to for the display.
110+
* Null or zero for no resize
111+
* @param resizeHeight height (pixels) to resize the image to for the display.
112+
* Null or zero for no resize
113+
* @param rotateDegrees degrees (clockwise) to rotate the image to for the
114+
* display. Null or zero for no resize
115+
* @param position X,Y position in the display of the center of the image
116+
* @param zOrder order of the image in the layers of objects in the area
117+
* display. Lower number is closer to viewer.
118+
*/
119+
public void update(Action action, String imageFileURL, Integer resizeWidth, Integer resizeHeight, Integer rotateDegrees, XYData position, Integer zOrder)
120+
{
121+
this.action = action != null ? action : Action.none;
122+
this.imageFileURL = imageFileURL;
123+
this.resizeWidth = imageFileURL != null ? (resizeWidth != null ? resizeWidth : 0) : null;
124+
this.resizeHeight = imageFileURL != null ? (resizeHeight != null ? resizeHeight : 0) : null;
125+
this.rotateDegrees = rotateDegrees;
126+
this.position = position;
127+
this.zOrder = zOrder;
128+
}
129+
130+
@Override
131+
public String toString()
132+
{
133+
return String.format("AAImage [uid=%s, action=%s, imageFileURL=%s, resizeWidth=%s, resizeHeight=%s, rotateDegrees=%s, position=%s, zOrder=%s]", uid, action, imageFileURL, resizeWidth, resizeHeight, rotateDegrees, position, zOrder);
134+
}
135+
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
package sysmlinjava.analysis.animatedareadisplay;
2+
3+
import java.io.Serializable;
4+
import java.util.ArrayList;
5+
import sysmlinjava.analysis.common.ColorEnum;
6+
import sysmlinjava.analysis.common.XYData;
7+
8+
/**
9+
* Representation of a line object in an area display. Contains the parameters
10+
* needed to display the object as a "polyline" in the display that connects a
11+
* specified set of x,y points in the area display.
12+
*
13+
* @author ModelerOne
14+
*
15+
*/
16+
public class AALine extends AAObject implements Serializable
17+
{
18+
/** Serializable ID*/
19+
/** Serializable ID*/private static final long serialVersionUID = 4525775059514772367L;
20+
21+
/**
22+
* List of the x,y points to be connected for the line
23+
*/
24+
public ArrayList<XYData> points;
25+
/**
26+
* Color of the line
27+
*/
28+
public ColorEnum color;
29+
/**
30+
* Width (in points) of the line
31+
*/
32+
public Integer width;
33+
/**
34+
* Order of the line in the layers of objects in the area display. Lower number
35+
* is closer to viewer.
36+
*/
37+
public Integer zOrder;
38+
39+
/**
40+
* Constructor for all attributes
41+
*
42+
* @param uid unique identifier
43+
* @param action action to be performed on the line
44+
* @param points set of x,y points to be connected for the line
45+
* @param color Color of the line
46+
* @param width width, in points, of the line
47+
* @param zOrder order of the line in the layers of objects in the area display.
48+
* Lower number is closer to viewer.
49+
*/
50+
public AALine(String uid, Action action, ArrayList<XYData> points, ColorEnum color, Integer width, Integer zOrder)
51+
{
52+
super(uid, action);
53+
switch (action)
54+
{
55+
case create:
56+
this.points = points != null ? points : new ArrayList<>();
57+
this.color = color != null ? color : ColorEnum.BLACK;
58+
this.width = width != null ? width : 2;
59+
this.zOrder = zOrder != null ? zOrder : 0;
60+
break;
61+
case delete:
62+
break;
63+
case update:
64+
this.points = points;
65+
this.color = color;
66+
this.width = width;
67+
this.zOrder = zOrder;
68+
break;
69+
default:
70+
break;
71+
72+
}
73+
}
74+
75+
/**
76+
* Updates/changes the line display as specified by parameter values, with value
77+
* {@code null} indicating no change
78+
*
79+
* @param action action to be performed on the line
80+
* @param points set of x,y points to be connected for the line
81+
* @param color Color of the line
82+
* @param width width, in points, of the line
83+
* @param zOrder order of the line in the layers of objects in the area display.
84+
* Lower number is closer to viewer.
85+
*/
86+
public void update(Action action, ArrayList<XYData> points, ColorEnum color, Integer width, Integer zOrder)
87+
{
88+
this.action = action != null ? action : Action.none;
89+
this.points = points;
90+
this.color = color;
91+
this.width = width;
92+
this.zOrder = zOrder;
93+
}
94+
95+
@Override
96+
public String toString()
97+
{
98+
return String.format("AALine [uid=%s, action=%s, points=%s, color=%s, width=%s, zOrder=%s, getClass()=%s, hashCode()=%s, toString()=%s]", uid, action, points, color, width, zOrder, getClass(), hashCode(), super.toString());
99+
}
100+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package sysmlinjava.analysis.animatedareadisplay;
2+
3+
import java.io.Serializable;
4+
5+
/**
6+
* Base abstract class for representation of an object in an area display.
7+
* Contains the parameters needed to uniquely identify the object in the display
8+
* and to specify the action to be taken on the object in the area display.
9+
*
10+
* @author ModelerOne
11+
*
12+
*
13+
*/
14+
public abstract class AAObject implements Serializable
15+
{
16+
/** Serializable ID*/private static final long serialVersionUID = 8621836558579485249L;
17+
18+
/**
19+
* Enumeration of actions that can be performed on the object in the display
20+
*
21+
* @author ModelerOne
22+
*
23+
*/
24+
/**
25+
* Enumeration of the action to be performed on the {@code AAObject}, i.e.
26+
* create it, update it, or delete it from the area display. Or do nothing
27+
* (none) if no operation to be performed.
28+
*
29+
* @author ModelerOne
30+
*
31+
*/
32+
public enum Action
33+
{
34+
/**
35+
* Create the object in the display
36+
*/
37+
create,
38+
/**
39+
* Update (move, rotate, change image of, etc.) the object in the display
40+
*/
41+
update,
42+
/**
43+
* Delete (remove) the object from the display
44+
*/
45+
delete,
46+
/**
47+
* Do nothing to the object in the display
48+
*/
49+
none
50+
};
51+
52+
/**
53+
* Unique identifier for the area display object
54+
*/
55+
public String uid;
56+
/**
57+
* Action to be taken on the area display object
58+
*/
59+
public Action action;
60+
61+
/**
62+
* Constructor
63+
*
64+
* @param uid unique identifier for the area display object
65+
* @param action action to be taken on the area display object
66+
*/
67+
public AAObject(String uid, Action action)
68+
{
69+
this.uid = uid != null && !uid.isBlank() ? uid : this.toString();
70+
this.action = action != null ? action : Action.create;
71+
}
72+
}

0 commit comments

Comments
 (0)