Skip to content

Commit

Permalink
Merge pull request #13 from LaurineDargaud/handle-style
Browse files Browse the repository at this point in the history
Improve visualisation
  • Loading branch information
noha authored Aug 5, 2021
2 parents e0d9c75 + e912e69 commit e4465b6
Show file tree
Hide file tree
Showing 38 changed files with 1,894 additions and 1,482 deletions.
16 changes: 8 additions & 8 deletions OGC-Core/ManifestOGCCore.class.st
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"
Implementation of Simple Feature Access Standard from OGC: https://www.ogc.org/standards/sfa
"
Class {
#name : #ManifestOGCCore,
#superclass : #PackageManifest,
#category : #'OGC-Core-Manifest'
}
"
Implementation of Simple Feature Access Standard from OGC: https://www.ogc.org/standards/sfa
"
Class {
#name : #ManifestOGCCore,
#superclass : #PackageManifest,
#category : #'OGC-Core-Manifest'
}
214 changes: 108 additions & 106 deletions OGC-Core/OGCCurve.class.st
Original file line number Diff line number Diff line change
@@ -1,106 +1,108 @@
"
6.1.6 Curve
6.1.6.1 Description
A Curve is a 1-dimensional geometric object usually stored as a sequence of Points, with the subtype of Curve
specifying the form of the interpolation between Points. This standard defines only one subclass of Curve,
LineString, which uses linear interpolation between Points.
"
Class {
#name : #OGCCurve,
#superclass : #OGCGeometry,
#instVars : [
'points'
],
#category : #'OGC-Core'
}

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

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

]

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

{ #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 }
OGCCurve >> dimension [
"The inherent dimension of this geometric object, which must be less than or equal to the coordinate dimension."
^ 1
]

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

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

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

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

{ #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"
| setSize |
setSize := points asSet size.
^ (points size == setSize) ifFalse: [ (setSize == (points size - 1)) and: (self isClosed) ]
]

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

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

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

{ #category : #basic }
OGCCurve >> rectangularEnvelope [
" Returns [ minX, maxX, minY, maxY ] to define minimal rectangle which contains all features "
| minX maxX minY maxY |
minX := (points collect: [ :aPoint | aPoint rectangularEnvelope at: 'minX' ]) min.
maxX := (points collect: [ :aPoint | aPoint rectangularEnvelope at: 'maxX' ]) max.
minY := (points collect: [ :aPoint | aPoint rectangularEnvelope at: 'minY' ]) min.
maxY := (points collect: [ :aPoint | aPoint rectangularEnvelope at: 'maxY' ]) max.
^ Dictionary newFromPairs: {'minX' . minX . 'maxX' . maxX . 'minY' . minY . 'maxY' . maxY }
]

{ #category : #accessing }
OGCCurve >> startPoint [
^ points first
]
"
6.1.6 Curve
6.1.6.1 Description
A Curve is a 1-dimensional geometric object usually stored as a sequence of Points, with the subtype of Curve
specifying the form of the interpolation between Points. This standard defines only one subclass of Curve,
LineString, which uses linear interpolation between Points.
"
Class {
#name : #OGCCurve,
#superclass : #OGCGeometry,
#instVars : [
'points'
],
#category : #'OGC-Core'
}

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

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

]

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

{ #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 : #style }
OGCCurve >> defaultFillColor [
^ 'transparent'
]

{ #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 }
OGCCurve >> endPoint [
^ points last
]

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

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

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

{ #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"
| setSize |
setSize := points asSet size.
^ (points size == setSize) ifFalse: [ (setSize == (points size - 1)) and: (self isClosed) ]
]

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

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

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

{ #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 }
OGCCurve >> startPoint [
^ points first
]
46 changes: 23 additions & 23 deletions OGC-Core/OGCEmptySet.class.st
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
"
I am a geometric object with isEmpty = true.
"
Class {
#name : #OGCEmptySet,
#superclass : #OGCGeometry,
#category : #'OGC-Core'
}

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

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

{ #category : #basic }
OGCEmptySet >> isEmpty [
^ true
]
"
I am a geometric object with isEmpty = true.
"
Class {
#name : #OGCEmptySet,
#superclass : #OGCGeometry,
#category : #'OGC-Core'
}

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

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

{ #category : #basic }
OGCEmptySet >> isEmpty [
^ true
]
112 changes: 67 additions & 45 deletions OGC-Core/OGCFeature.class.st
Original file line number Diff line number Diff line change
@@ -1,45 +1,67 @@
Class {
#name : #OGCFeature,
#superclass : #OGCObject,
#instVars : [
'geometry',
'properties',
'id'
],
#category : #'OGC-Core'
}

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

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

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

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

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

{ #category : #accessing }
OGCFeature >> properties [
^ properties
]

{ #category : #accessing }
OGCFeature >> properties: aDictionary [
properties := aDictionary
]
Class {
#name : #OGCFeature,
#superclass : #OGCObject,
#instVars : [
'geometry',
'properties',
'id'
],
#category : #'OGC-Core'
}

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

{ #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 }
OGCFeature >> asFeaturesCollection [
^ OGCFeatureCollection new features: (Array with: self)
]

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

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

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

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

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

{ #category : #accessing }
OGCFeature >> properties [
^ properties
]

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

{ #category : #basic }
OGCFeature >> rectangularEnvelope [
" Returns the minimal rectangle which contains all features "
^ self geometry rectangularEnvelope
]
Loading

0 comments on commit e4465b6

Please sign in to comment.