Skip to content

Commit

Permalink
Remove the usage of braceWith:with: for pharo 12 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
noha committed Dec 10, 2024
1 parent 5a1025f commit 83503cb
Show file tree
Hide file tree
Showing 28 changed files with 333 additions and 303 deletions.
8 changes: 5 additions & 3 deletions OGC-Core/ManifestOGCCore.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
Implementation of Simple Feature Access Standard from OGC: https://www.ogc.org/standards/sfa
"
Class {
#name : #ManifestOGCCore,
#superclass : #PackageManifest,
#category : #'OGC-Core-Manifest'
#name : 'ManifestOGCCore',
#superclass : 'PackageManifest',
#category : 'OGC-Core-Manifest',
#package : 'OGC-Core',
#tag : 'Manifest'
}
43 changes: 22 additions & 21 deletions OGC-Core/OGCCurve.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,78 +13,79 @@ Instanciation:
`OGCCurve class>>#withPoints:`
"
Class {
#name : #OGCCurve,
#superclass : #OGCGeometry,
#name : 'OGCCurve',
#superclass : 'OGCGeometry',
#instVars : [
'points'
],
#category : #'OGC-Core'
#category : 'OGC-Core',
#package : 'OGC-Core'
}

{ #category : #accessing }
{ #category : 'accessing' }
OGCCurve class >> geometryType [
^ 'Curve'
]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
OGCCurve class >> withPoints: aCollectionOfPoints [
^ self new points: aCollectionOfPoints

]

{ #category : #testing }
{ #category : 'testing' }
OGCCurve >> = anotherCurve [
^ (self points) = (anotherCurve points)
]

{ #category : #basic }
{ #category : 'basic' }
OGCCurve >> boundary [
"The boundary of a non-closed Curve consists of its two end Points. The boundary of a closed Curve is empty."
self isClosed ifFalse: [ ^ self class withPoints: (OrderedCollection with: (self points allButLast last) with: self endPoint) ] ifTrue: [ ^ OGCEmptySet new ]
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCCurve >> coordinates [
^ self points
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCCurve >> coordinates: aCollection [
self points: (aCollection collect: [ :each | OGCPoint xy: each ])
]

{ #category : #style }
{ #category : 'style' }
OGCCurve >> defaultFillColor [
^ 'transparent'
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCCurve >> dimension [
"The inherent dimension of this geometric object, which must be less than or equal to the coordinate dimension."
^ 1
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCCurve >> endPoint [
^ points last
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCCurve >> isClosed [
^ self startPoint = self endPoint
]

{ #category : #testing }
{ #category : 'testing' }
OGCCurve >> isLine [
^ points size = 2
]

{ #category : #testing }
{ #category : 'testing' }
OGCCurve >> isRing [
^ self isClosed & self isSimple
]

{ #category : #basic }
{ #category : 'basic' }
OGCCurve >> isSimple [
"A Curve is simple if it does not pass through the same Point twice with the possible exception of the two end
points"
Expand All @@ -93,31 +94,31 @@ points"
^ (points size == setSize) ifFalse: [ (setSize == (points size - 1)) and: (self isClosed) ]
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCCurve >> length [
"The length of this Curve in its associated spatial reference"
self subclassResponsibility
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCCurve >> points [
^ points
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCCurve >> points: anObject [
points := anObject
]

{ #category : #basic }
{ #category : 'basic' }
OGCCurve >> rectangularEnvelope [
" Returns the minimal rectangle which contains all features "
| allRectangularEnvelopes |
allRectangularEnvelopes := points collect: [ :aPoint | aPoint rectangularEnvelope ].
^ allRectangularEnvelopes reduce: [ :rect1 :rect2 | rect1 merge: rect2 ]
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCCurve >> startPoint [
^ points first
]
13 changes: 7 additions & 6 deletions OGC-Core/OGCEmptySet.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
I am the empty OGCGeometry object, so `isEmpty = true`
"
Class {
#name : #OGCEmptySet,
#superclass : #OGCGeometry,
#category : #'OGC-Core'
#name : 'OGCEmptySet',
#superclass : 'OGCGeometry',
#category : 'OGC-Core',
#package : 'OGC-Core'
}

{ #category : #accessing }
{ #category : 'accessing' }
OGCEmptySet class >> geometryType [
^ 'Empty set'
]

{ #category : #testing }
{ #category : 'testing' }
OGCEmptySet >> = anotherObject [
^ self isEmpty = anotherObject isEmpty
]

{ #category : #basic }
{ #category : 'basic' }
OGCEmptySet >> isEmpty [
^ true
]
31 changes: 16 additions & 15 deletions OGC-Core/OGCFeature.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,73 +7,74 @@ I contain:
- (if needed) an id
"
Class {
#name : #OGCFeature,
#superclass : #OGCObject,
#name : 'OGCFeature',
#superclass : 'OGCObject',
#instVars : [
'geometry',
'properties',
'id'
],
#category : #'OGC-Core'
#category : 'OGC-Core',
#package : 'OGC-Core'
}

{ #category : #accessing }
{ #category : 'accessing' }
OGCFeature class >> geometry: aOGCGeometry [
^ self new geometry: aOGCGeometry
]

{ #category : #style }
{ #category : 'style' }
OGCFeature >> applyStyle: aStyleDictionary [
self geometry applyStyle: aStyleDictionary
]

{ #category : #style }
{ #category : 'style' }
OGCFeature >> applyStyle: aStyleDictionary ifFeature: aBlock [
" apply the given style to features which respect given block closure"
(aBlock value: self) ifTrue: [ self applyStyle: aStyleDictionary ]
]

{ #category : #converting }
{ #category : 'converting' }
OGCFeature >> asFeaturesCollection [
^ OGCFeatureCollection new features: (Array with: self)
]

{ #category : #'methods analysis' }
{ #category : 'methods analysis' }
OGCFeature >> distance: anotherFeature [
^ self geometry distance: anotherFeature geometry
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCFeature >> geometry [
^ geometry
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCFeature >> geometry: anObject [
geometry := anObject
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCFeature >> id [
^ id
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCFeature >> id: aStringIdOrInteger [
id := aStringIdOrInteger
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCFeature >> properties [
^ properties ifNil: [ ^ properties := Dictionary new ]
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCFeature >> properties: aDictionary [
properties := aDictionary
]

{ #category : #basic }
{ #category : 'basic' }
OGCFeature >> rectangularEnvelope [
" Returns the minimal rectangle which contains all features "
^ self geometry rectangularEnvelope
Expand Down
35 changes: 18 additions & 17 deletions OGC-Core/OGCFeatureCollection.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@ I represent the GeoJSON element called FeatureCollection which gathers:
Instanciation: `OGCFeatureCollection class>>#features:`
"
Class {
#name : #OGCFeatureCollection,
#superclass : #OGCObject,
#name : 'OGCFeatureCollection',
#superclass : 'OGCObject',
#instVars : [
'features',
'properties'
],
#category : #'OGC-Core'
#category : 'OGC-Core',
#package : 'OGC-Core'
}

{ #category : #accessing }
{ #category : 'accessing' }
OGCFeatureCollection class >> features: aCollectionOfFeatures [
^ self new features: aCollectionOfFeatures
]

{ #category : #adding }
{ #category : 'adding' }
OGCFeatureCollection >> addFeaturePropertyKey: aKey withData: aDictionary withIdentityKey: anIdentityKey [
" add a property to the properties of features,
based on a dictionary which uses a join key to identify concerned feature = identity key"
Expand All @@ -30,7 +31,7 @@ OGCFeatureCollection >> addFeaturePropertyKey: aKey withData: aDictionary withId
(self features at: index) properties add: (Association key: aKey value: value) ]
]

{ #category : #style }
{ #category : 'style' }
OGCFeatureCollection >> applyContinuousColorationOn: aDataKey withColor: aColorName [
| maxValue minValue |
maxValue := (self features collect: [ :aFeature | (aFeature properties at: aDataKey) asNumber ]) max.
Expand All @@ -49,12 +50,12 @@ OGCFeatureCollection >> applyContinuousColorationOn: aDataKey withColor: aColorN
].
]

{ #category : #style }
{ #category : 'style' }
OGCFeatureCollection >> applyContinuousColorationOn: aDataKey withFeatureData: aCSVArray withAssociateKey: aDataAssociateKey withColor: aColorName [
^ self applyContinuousColorationOn: aDataKey withFeatureData: aCSVArray withAssociateKey: aDataAssociateKey withEqualityCondition: [ :a :b | a = b ] withColor: aColorName
]

{ #category : #style }
{ #category : 'style' }
OGCFeatureCollection >> applyContinuousColorationOn: aDataKey withFeatureData: aCSVArray withAssociateKey: aDataAssociateKey withEqualityCondition: aBlock withColor: aColorName [
| indexKey indexAssociateKey dataDictionary |
" 1. organize data "
Expand All @@ -72,49 +73,49 @@ OGCFeatureCollection >> applyContinuousColorationOn: aDataKey withFeatureData: a
self applyContinuousColorationOn: aDataKey withColor: aColorName
]

{ #category : #style }
{ #category : 'style' }
OGCFeatureCollection >> applyStyle: aStyleDictionary [
self features do: [ :aFeature | aFeature applyStyle: aStyleDictionary ]
]

{ #category : #style }
{ #category : 'style' }
OGCFeatureCollection >> applyStyle: aStyleDictionary ifFeature: aBlock [
self features do: [ :eachFeature | eachFeature applyStyle: aStyleDictionary ifFeature: aBlock ]
]

{ #category : #converting }
{ #category : 'converting' }
OGCFeatureCollection >> asFeaturesCollection [
^ self
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCFeatureCollection >> detectFeatureIndexWithPropertyKey: aKey andValue: aValue [
^ self features detectIndex: [ :aFeature | aFeature properties includesAssociation: (Association key: aKey value: aValue) ]
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCFeatureCollection >> features [
^ features
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCFeatureCollection >> features: aCollection [
features := aCollection
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCFeatureCollection >> initialize [
super initialize.
features := OrderedCollection new.
properties := Dictionary new.
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCFeatureCollection >> properties [
^ properties
]

{ #category : #accessing }
{ #category : 'accessing' }
OGCFeatureCollection >> rectangularEnvelope [
" Returns the minimal rectangle which contains all features "
| allRectangularEnvelopes |
Expand Down
Loading

0 comments on commit 83503cb

Please sign in to comment.