com.xj.anylogic.engine
Class AgentContinuousGIS
java.lang.Object
com.xj.anylogic.engine.Presentable
com.xj.anylogic.engine.Utilities
com.xj.anylogic.engine.ActiveObject
com.xj.anylogic.engine.Agent
com.xj.anylogic.engine.AgentContinuous
com.xj.anylogic.engine.AgentContinuousGIS
- All Implemented Interfaces:
- com.xj.anylogic.engine.internal.Child, java.io.Serializable
public class AgentContinuousGIS
- extends AgentContinuous
A subclass of ActiveObject designed to support agent based modeling in
continuous GIS space, in particular:
- time (continuous or discrete)
- continuous 2D space based on GIS map
- connections between agents, networks (e.g. social) and their visualization
- communication - message passing and broadcasting
A user-defined agent class should be a subclass of this class
in order to use those features.
If your model is agent based, but none of the above features are required,
it is recommended to use regular ActiveObject as a base class for your agents,
and not this class: Agent classes require 36+ bytes more memory than ActiveObject.
- Author:
- XJ Technologies Company Ltd. www.anylogic.com
- See Also:
- Serialized Form
| Fields inherited from class com.xj.anylogic.engine.Agent |
ALL, ALL_CONNECTED, ALL_NEIGHBORS, EAST, NORTH, NORTHEAST, NORTHWEST, RANDOM, RANDOM_CONNECTED, RANDOM_NEIGHBOR, SOUTH, SOUTHEAST, SOUTHWEST, WEST |
| Fields inherited from class com.xj.anylogic.engine.ActiveObject |
DRAW_PARAMETER_DYNAMIC, DRAW_SD_ARRAY, DRAW_SD_CONSTANT, DRAW_SD_EXTERNAL, DRAW_SD_LINK_DELAY, DRAW_SD_LINK_INITIAL, DRAW_SD_NEGATIVE, DRAW_SD_NO_SOURCE, DRAW_SD_NO_TARGET, DRAW_SD_PUBLIC_ONLY, DRAW_SD_SHADOW, DRAW_SD_ZERO, EVENT_TIMEOUT_MODE_CYCLIC, EVENT_TIMEOUT_MODE_ONCE, EVENT_TIMEOUT_MODE_USER |
| Fields inherited from class com.xj.anylogic.engine.Utilities |
AM, APRIL, AUGUST, DAY, DECEMBER, FEBRUARY, FRIDAY, HOUR, infinity, JANUARY, JULY, JUNE, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, TIME_UNIT_DAY, TIME_UNIT_HOUR, TIME_UNIT_MILLISECOND, TIME_UNIT_MINUTE, TIME_UNIT_SECOND, TIME_UNIT_WEEK, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK, YEAR |
| Fields inherited from class com.xj.anylogic.engine.Presentable |
ALIGNMENT_CENTER, ALIGNMENT_LEFT, ALIGNMENT_RIGHT, CAD_ANTIALIASING, CAD_INVERTED, LINE_STYLE_DASHED, LINE_STYLE_DOTTED, LINE_STYLE_SOLID, NAVIGATION_FULL, NAVIGATION_LIMITED_TO_Z_ABOVE_ZERO, NAVIGATION_NONE, NAVIGATION_ROTATION_ONLY, SHAPE_ARC, SHAPE_BUTTON, SHAPE_CAD, SHAPE_CHART_BAR, SHAPE_CHART_HISTOGRAM, SHAPE_CHART_HISTOGRAM2D, SHAPE_CHART_PIE, SHAPE_CHART_PLOT, SHAPE_CHART_STACK, SHAPE_CHART_TIME_COLOR, SHAPE_CHART_TIME_PLOT, SHAPE_CHART_TIME_STACK, SHAPE_CHECKBOX, SHAPE_COMBOBOX, SHAPE_CURVE, SHAPE_EMBEDDED_OBJECT, SHAPE_FILECHOOSER, SHAPE_GROUP, SHAPE_IMAGE, SHAPE_LINE, SHAPE_LISTBOX, SHAPE_OVAL, SHAPE_PIXEL, SHAPE_POLYLINE, SHAPE_PROGRESSBAR, SHAPE_RADIOBUTTONS, SHAPE_RECTANGLE, SHAPE_ROUNDED_RECTANGLE, SHAPE_SLIDER, SHAPE_TEXT, SHAPE_TEXTFIELD |
|
Method Summary |
void |
connectTo(AgentContinuousGIS a)
Creates a bi-directional connection between this agent and a given
other agent. |
void |
deliver(java.lang.Object msg,
AgentContinuousGIS dest)
Delivers a message to a given agent immediately during this method call. |
double |
distanceTo(Agent other)
Calculates the distance from this agent to another one in GIS space. |
double |
distanceTo(double x,
double y)
Calculates the distance from this GIS agent to a given point (latitude, longitude)
in continuous GIS space. |
AgentContinuousGIS |
getConnectedAgent(int index)
Returns the connected agent with a given index. |
java.util.LinkedList<AgentContinuousGIS> |
getConnections()
Returns a collection of agents connected to this agent (bi-directionally),
or null if there have not been any connections yet. |
EnvironmentContinuousGIS |
getEnvironment()
Returns the environment where this agent belongs to. |
double |
getGISHeading()
Returns current heading angle (measured in radians CW,
starting from North direction) of agent moving in continuous GIS space. |
double |
getTargetX()
Returns the x of the target location if moving, otherwise current x in
continuous 2D space or GIS space. |
double |
getX()
Returns the current (up-to-date) longitude of the agent in continuous GIS space. |
double |
getY()
Returns the current (up-to-date) latitude of the agent in continuous GIS space. |
boolean |
isShapeVisible(int id)
Should be overridden to return true if a non-persistent shape is visible,
false otherwise. |
void |
jumpTo(double x,
double y)
Instantly moves the agent to a given location in GIS space. |
void |
moveTo(double x,
double y)
Starts movement in the direction of the given target location in continuous GIS space. |
void |
onReceive(java.lang.Object msg,
AgentContinuousGIS sender)
A callback that is called when the agent receives a message
from another agent. |
void |
send(java.lang.Object msg,
AgentContinuousGIS dest)
Sends a message to a given agent. |
void |
setRotation(double rotation)
Sets the rotation (angle in radians) of the agent animation in continuous 2D
space. |
void |
setRotation(double rotation,
boolean freezeRotation)
Sets the rotation (angle in radians) of the agent animation in continuous 2D
space. |
void |
setXY(double x,
double y)
Sets the coordinates of the agent location. |
| Methods inherited from class com.xj.anylogic.engine.AgentContinuous |
getNearestAgent, getRotation, getShapeRotation, getTargetY, getVelocity, isMoving, isRotationFrozen, moveToNearestAgent, onArrival, onDestroy, setVelocity, stop, timeToArrival |
| Methods inherited from class com.xj.anylogic.engine.Agent |
agentInfo, deliver, disconnectFrom, disconnectFromAll, getConnectionsNumber, getShapeX, getShapeY, isConnectedTo, onBeforeStep, onStep, receive, restoreConnections_xjal, send, setEnvironment |
| Methods inherited from class com.xj.anylogic.engine.ActiveObject |
assignInitialConditions_xjal, create, drawActionChart, drawActionChartLink, drawAuxiliaryVariable, drawAuxiliaryVariable, drawBranchExit, drawBranchState, drawBreakBlock, drawCausalLoop, drawCodeBlock, drawConnector, drawDecisionBlock, drawDynamicEvent, drawEmbeddedObjectModel, drawEmbeddedObjectModel, drawEmbeddedObjectModelDefault, drawEmbeddedObjectModelDefault, drawEnvironment, drawEvent, drawFinalState, drawFlow, drawFlow, drawFlowStockDependencyLine, drawHistoryState, drawInitialStatePointer, drawLink, drawLink, drawLocalVariable, drawLoopArea, drawLoopBlock, drawParameter, drawParameter, drawPlainDependencyArc, drawPlainDependencyLine, drawPort, drawReturnBlock, drawSchedule, drawState, drawStatechartEntryPoint, drawStock, drawStock, drawTransition, enterState, error, evaluateRateOf, evaluateRateOf, evaluateTimeoutOf, evaluateTimeoutOf, executeActionOf, executeActionOf, executeActionOf, executeActionOf, executeActionOf, executeActionOf, executeActionOf, executeActionOf, executeActionOf, executeOnReceiveActionOf, executeOnSendActionOf, exitInnerStates, exitState, finishSimulation, formulasExecute_xjal, getCameras3D, getContainerStateOf, getDynamicEvents, getEmbeddedObjects, getEngine, getFirstOccurrenceTime, getFullName, getIndex, getIntegrationManager_xjal, getModeOf, getName, getNameOf, getNameOf, getNameOf, getNameOf, getNameOf, getNameOf, getNameOf, getNameOf, getNameOf, getNameOf, getNameOf, getNameOfState, getOwner, getOwnerShape, getPresentation, getReplicatedCollection, getReplicatedList, getScalarPhaseVector_xjal, getScalarPhaseVectorForInitialConditions_xjal, getScalarRightPart_xjal, getScalarRightPartForInitialConditions_xjal, getStatechartOf, getStatechartOf, getStatechartOf, getStatechartOf, isReplicated, nothingChanged, onChange, onCreate, onStartup, pauseSimulation, putScalarPhaseVector_xjal, putScalarPhaseVectorForInitialConditions_xjal, restoreOwner, runSimulation, setDestroyed, setEngine, setOwnerShape_xjal, setParametersToDefaultValues, setupPlainDependencyArc, start, stateContainsState, stopSimulation, testConditionOf, testConditionOf, testGuardOf, testGuardOf, testGuardOf, testGuardOf, testMessageOf, toString |
| Methods inherited from class com.xj.anylogic.engine.Utilities |
bernoulli, bernoulli, beta, beta, beta, beta, beta, binomial, binomial, binomial, binomial, binomial, briefInfoOn, cauchy, cauchy, cauchy, chi2, chi2, chi2, copyToClipboard, createURL_xjal, date, dateToTime, day, difference, difference, differenceInDateUnits, differenceInDateUnits, dropTime, erlang, erlang, erlang, error, exponential, exponential, exponential, exponential, exponential, exponential, format, format, format, format, format, format, formatDayOfWeek, formatGeoHeading, formatLatitude, formatLongitude, formatMonth, formatTimeInterval, gamma_frac, gamma, gamma, gamma, gamma, gamma, gammaLog, geometric, geometric, getAmPm, getAmPm, getDayOfMonth, getDayOfMonth, getDayOfWeek, getDayOfWeek, getDayOfYear, getDefaultRandomGenerator, getDistance, getDistance, getDistanceFromPointToLine, getDistanceFromPointToLineSq, getDistanceFromPointToSegment, getDistanceFromPointToSegmentSq, getDistanceSq, getDistanceSq, getHour, getHour, getHourOfDay, getHourOfDay, getLength, getLength, getMillisecond, getMillisecond, getMinute, getMinute, getMonth, getMonth, getRandom, getRandom, getSecond, getSecond, getTime, getYear, getYear, gumbel1, gumbel1, gumbel2, gumbel2, hour, hypergeometric, hypergeometric, inspectOf, isLineIntersectingLine, isLineIntersectingRectangle, isPointInsideRectangle, isPointOnTheSameLine, laplace, laplace, limit, limitMax, limitMin, logarithmic, logarithmic, logistic, logistic, lognormal, lognormal, millisecond, minute, negativeBinomial, negativeBinomial, negativeBinomial, negativeBinomial, normal, normal, normal, normal, normal, normal, pareto, pareto, pareto, pert, pert, poisson, poisson, poisson, poisson, prepareBeforeExperimentStart_xjal, pulse, pulseTrain, quantum, ramp, randomFalse, randomFalse, randomTrue, randomTrue, rayleigh, rayleigh, rayleigh, second, setDefaultRandomGenerator, sqr, step, time, timeToDate, toDate, toDateInMillis, toLatitude, toLongitude, toTimeout, trace, traceln, traceln, traceln, triangular, triangular, triangular, triangular, triangular, uniform_discr, uniform_discr, uniform_discr, uniform_pos, uniform_pos, uniform, uniform, uniform, uniform, uniform, week, weibull, weibull, weibull, weibull, weibull, xidz, zidz |
| Methods inherited from class com.xj.anylogic.engine.Presentable |
contains, drawCollection, drawDatabase, drawDataset, drawExcelFile, drawFunction, drawHistogram2DData, drawHistogramData, drawInsert, drawKeyValueTable, drawModel, drawModelElements, drawPlainVariable, drawPresentation, drawQuery, drawShape, drawStatistics, drawTableFunction, drawTextFile, drawUpdate, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, finishReadObject_xjal, getExperiment, getNameOfShape, getPersistentShape, getShapeArcAngle, getShapeArcAngle, getShapeArcStartAngle, getShapeArcStartAngle, getShapeCADCustomLayerColors, getShapeCADDrawingAttributes, getShapeCADDrawingAttributes, getShapeCADFileName, getShapeCADFileName, getShapeCADVisibleLayerNames, getShapeChartColorFromDouble, getShapeChartDataColors, getShapeChartDataItems, getShapeChartDataPlotOptions, getShapeChartDataSets, getShapeChartDataTitles, getShapeChartHistogram2DOptions, getShapeChartHistogramOptions, getShapeChartHistograms, getShapeChartHistograms2D, getShapeChartProperties, getShapeControl, getShapeControl, getShapeControlDefaultValueBoolean, getShapeControlDefaultValueBoolean, getShapeControlDefaultValueDouble, getShapeControlDefaultValueDouble, getShapeControlDefaultValueInt, getShapeControlDefaultValueInt, getShapeControlDefaultValueString, getShapeControlDefaultValueString, getShapeControlManager, getShapeControlMaximum, getShapeControlMaximum, getShapeControlMinimum, getShapeControlMinimum, getShapeControlMultipleSelectionMode, getShapeControlMultipleSelectionMode, getShapeControlProgressString, getShapeControlProgressString, getShapeControlTexts, getShapeControlTexts, getShapeControlTexts2D, getShapeControlTexts2D, getShapeControlType, getShapeControlType, getShapeControlValueType, getShapeControlValueType, getShapeEmbeddedObject, getShapeEmbeddedObject, getShapeFillColor, getShapeFillColor, getShapeFont, getShapeFont, getShapeGroupContent, getShapeHeight, getShapeHeight, getShapeImageFileNames, getShapeImageFileNames, getShapeImageNumber, getShapeImageNumber, getShapeLineColor, getShapeLineColor, getShapeLineDx, getShapeLineDx, getShapeLineDy, getShapeLineDy, getShapeLineStyle, getShapeLineStyle, getShapeLineWidth, getShapeLineWidth, getShapeNPoints, getShapeNPoints, getShapePackagePrefix, getShapePointsDx, getShapePointsDx, getShapePointsDy, getShapePointsDy, getShapeRadiusX, getShapeRadiusX, getShapeRadiusY, getShapeRadiusY, getShapeReplication, getShapeRotation, getShapeScaleX, getShapeScaleX, getShapeScaleY, getShapeScaleY, getShapeText, getShapeText, getShapeTextAlignment, getShapeTextAlignment, getShapeType, getShapeWidth, getShapeWidth, getShapeX, getShapeY, getViewAreas, iconContains, isShapeCADNegative, isShapeCADNegative, isShapeClosed, isShapeClosed, isShapeControlEnabled, isShapeControlEnabled, isShapeControlVertical, isShapeControlVertical, isShapePublic, isShapeWithManualControlPoints, isShapeWithManualControlPoints, modelElementContains, modelElementContains, onClickIconAt, onClickModelAt, onClickPresentationAt, onItemRemoved, onSelectionChanged, onShapeClick, onShapeClickAt, onShapeGroupDraw, presentationContains, readCustomData, setControlValueToDefault, setControlValueToDefault, writeCustomData |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
AgentContinuousGIS
public AgentContinuousGIS(Engine engine,
ActiveObject owner,
ActiveObjectCollection<?> collection)
getEnvironment
public EnvironmentContinuousGIS getEnvironment()
- Description copied from class:
Agent
- Returns the environment where this agent belongs to.
- Overrides:
getEnvironment in class AgentContinuous
- Returns:
- the environment where this agent belongs to
connectTo
public void connectTo(AgentContinuousGIS a)
- Creates a bi-directional connection between this agent and a given
other agent. Raises error if you try to connect to itself. Does
nothing if agents are already connected.
- Parameters:
a - another agent
getConnectedAgent
public AgentContinuousGIS getConnectedAgent(int index)
- Description copied from class:
Agent
- Returns the connected agent with a given index.
- Overrides:
getConnectedAgent in class AgentContinuous
- Parameters:
index - the index of connection
- Returns:
- the connected agent with a given index
getConnections
public java.util.LinkedList<AgentContinuousGIS> getConnections()
- Returns a collection of agents connected to this agent (bi-directionally),
or null if there have not been any connections yet. You should not
modify this collection.
- Overrides:
getConnections in class AgentContinuous
- Returns:
- collection of connected agents, or null
deliver
public void deliver(java.lang.Object msg,
AgentContinuousGIS dest)
- Delivers a message to a given agent immediately during this method call.
If you wish this to happen in a separate event, use send() method.
- Parameters:
msg - a messagedest - the destination agent
send
public void send(java.lang.Object msg,
AgentContinuousGIS dest)
- Sends a message to a given agent. The message will be delivered during
a separate event scheduled to occur in zero time after the current one.
If you are OK with the message delivered immediately during this event,
use deliver() method, which has better performance.
- Parameters:
msg - a messagedest - the destination agent
onReceive
public void onReceive(java.lang.Object msg,
AgentContinuousGIS sender)
- A callback that is called when the agent receives a message
from another agent. Should be defined in a subclass if reaction is needed.
getGISHeading
public double getGISHeading()
- Returns current heading angle (measured in radians CW,
starting from North direction) of agent moving in continuous GIS space.
- Returns:
- the current GIS heading angle (measured in radians CW,
starting from North direction)
getX
public double getX()
- Returns the current (up-to-date) longitude of the agent in continuous GIS space.
- Overrides:
getX in class AgentContinuous
- Returns:
- the longitude of the current location,
measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
getY
public double getY()
- Returns the current (up-to-date) latitude of the agent in continuous GIS space.
- Overrides:
getY in class AgentContinuous
- Returns:
- the latitude of the current location,
measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
getTargetX
public double getTargetX()
- Description copied from class:
AgentContinuous
- Returns the x of the target location if moving, otherwise current x in
continuous 2D space or GIS space.
In case of GIS environment this is the longitude,
measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
- Overrides:
getTargetX in class AgentContinuous
- Returns:
- the x of the target location if moving, otherwise current x
distanceTo
public double distanceTo(Agent other)
- Calculates the distance from this agent to another one in GIS space.
In case of GIS environment returns distance measured in meters
- Specified by:
distanceTo in class AgentContinuous
- Parameters:
other - another agent
- Returns:
- the distance to the other agent
distanceTo
public double distanceTo(double x,
double y)
- Calculates the distance from this GIS agent to a given point (latitude, longitude)
in continuous GIS space.
- Parameters:
x - the longitude of the point,
measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)y - the latitude of the point,
measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
- Returns:
- the distance to the point (x,y)
setXY
public void setXY(double x,
double y)
- Sets the coordinates of the agent location. Should only be
used to initialize the agent location. Assumes the agent is not moving.
- Parameters:
x - the longitude of the location,
measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)y - the latitude of the location,
measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
jumpTo
public void jumpTo(double x,
double y)
- Instantly moves the agent to a given location in GIS space.
Terminates any movement.
Doesn't call "on arrival" code
- Parameters:
x - the longitude of the new location,
measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)y - the latitude of the new location,
measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
moveTo
public void moveTo(double x,
double y)
- Starts movement in the direction of the given target location in continuous GIS space.
"On arrival" code is executed when movement is finished.
- Parameters:
x - the longitude of the target location,
measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)y - the latitude of the target location,
measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
setRotation
public void setRotation(double rotation)
- Sets the rotation (angle in radians) of the agent animation in continuous 2D
space. This rotation will be overridden during the next call of moveTo() or
during current movement (if any exists) in GIS space. If rotation is not
intended to be changed, use
setRotation(double, boolean) method
with second parameter set to true.
- Parameters:
rotation - the rotation angle of the agent in radians- See Also:
setRotation(double, boolean)
setRotation
public void setRotation(double rotation,
boolean freezeRotation)
- Sets the rotation (angle in radians) of the agent animation in continuous 2D
space.
- Parameters:
rotation - the rotation angle of the agent in radiansfreezeRotation - if true, rotation will not be changed by
moveTo(double, double) calls- See Also:
AgentContinuous.isRotationFrozen()
isShapeVisible
public boolean isShapeVisible(int id)
- Description copied from class:
Presentable
- Should be overridden to return true if a non-persistent shape is visible,
false otherwise.
Note that in case of replicated shape this property applies to
the whole array and cannot be specified on per-instance basis.
If the shape is not visible none of its other properties are evaluated.
- Overrides:
isShapeVisible in class Presentable
- Parameters:
id - the shape id
- Returns:
- the visibility status of the shape, true by default
Copyright © 1991-2008 XJ Technlogies. All Rights Reserved.