Skip to content

Commit

Permalink
Fixed #739. Added a possibility to have multiple shapes for agent pov
Browse files Browse the repository at this point in the history
  • Loading branch information
olekscode committed Sep 21, 2023
1 parent ce43df5 commit fb2ef10
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
8 changes: 8 additions & 0 deletions repository/Cormas-Core/TCMLocated.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,14 @@ TCMLocated >> randomWalkConstrainedBy: aBlock [
self moveTo: destination
]

{ #category : #accessing }
TCMLocated >> shapeOfPOV [
" Answer a <Symbol> to specify the shape the will be displayed in a space.
This must be a selector understood by the RSShapeFactory class"

^ #circle
]

{ #category : #'environment - sensing - agents' }
TCMLocated >> similarAgentsVerifying: aBlock withinRadius: range [
"Purpose: returns the receiver-like instances located withing a given radius of the receiver location and fulfilling a specified constraint
Expand Down
17 changes: 16 additions & 1 deletion repository/Cormas-UI-Roassal3/CMR3SpaceAgentsBuilder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CMR3SpaceAgentsBuilder >> cellAt: aPoint ifAbsent: absentBlock [
{ #category : #'as yet unclassified' }
CMR3SpaceAgentsBuilder >> defaultMasterShape [

^ RSShapeFactory star
^ (RSShapeFactory perform: #circle)
size: 25;
yourself.
]
Expand Down Expand Up @@ -110,6 +110,21 @@ CMR3SpaceAgentsBuilder >> objects [
^ diagramBuilder cormasModel theAgents
]

{ #category : #hooks }
CMR3SpaceAgentsBuilder >> shapeFor: anObject index: aNumber [

| shape |

shape := (RSShapeFactory perform: anObject shapeOfPOV)
color: Color red;
size: 25;
model: anObject;
yourself.

self makeAgentShapeDraggable: shape.
^ shape
]

{ #category : #updating }
CMR3SpaceAgentsBuilder >> update [

Expand Down

0 comments on commit fb2ef10

Please sign in to comment.