Skip to content

Commit

Permalink
Merge 0754f76
Browse files Browse the repository at this point in the history
  • Loading branch information
cdelaunay committed Nov 19, 2021
2 parents 28b138d + 0754f76 commit 29c2a26
Show file tree
Hide file tree
Showing 40 changed files with 2,005 additions and 1,730 deletions.
90 changes: 45 additions & 45 deletions BaselineOfOGC/BaselineOfOGC.class.st
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
Class {
#name : #BaselineOfOGC,
#superclass : #BaselineOf,
#category : #BaselineOfOGC
}

{ #category : #baselines }
BaselineOfOGC >> baseline: spec [
<baseline>

spec for: #'common' do: [
self geometry: spec.
spec
package: #'OGC-Core';
package: #'OGC-Core-Tests' with: [
spec requires: #('OGC-Core' ) ];
package: #'OGC-Viewer';
package: #'OGC-Viewer-Tests';
package: #'OGC-Geometry' with: [
spec requires: #('OGC-Core' 'Geometry') ];
package: #'OGC-Geometry-Tests' with: [
spec requires: #('OGC-Core-Tests' 'OGC-Geometry') ];
package: #'OGC-Spheric' with: [
spec requires: #('OGC-Core' ) ];
package: #'OGC-Spheric-Tests' with: [
spec requires: #('OGC-Core-Tests' 'OGC-Spheric') ].
spec
group: 'Core' with: #('OGC-Core' );
group: 'Tests' with: #('OGC-Core-Tests');
group: 'Geometric' with: #('OGC-Geometry' 'OGC-Geometry-Tests');
group: 'Spheric' with: #('OGC-Spheric' 'OGC-Spheric-Tests');
group: 'Visualisation' with: #('OGC-Viewer' 'OGC-Viewer-Tests');
group: 'default' with: #('Core' 'Tests' 'Spheric' 'Visualisation').
]

]

{ #category : #accessing }
BaselineOfOGC >> geometry: spec [
"For Geometric projection computation"
spec
baseline: 'Geometry'
with: [
spec repository: 'github://pharo-contributions/Geometry:master/src' ]
]
Class {
#name : #BaselineOfOGC,
#superclass : #BaselineOf,
#category : #BaselineOfOGC
}

{ #category : #baselines }
BaselineOfOGC >> baseline: spec [
<baseline>

spec for: #'common' do: [
self geometry: spec.
spec
package: #'OGC-Core';
package: #'OGC-Core-Tests' with: [
spec requires: #('OGC-Core' ) ];
package: #'OGC-Viewer';
package: #'OGC-Viewer-Tests';
package: #'OGC-Geometry' with: [
spec requires: #('OGC-Core' 'Geometry') ];
package: #'OGC-Geometry-Tests' with: [
spec requires: #('OGC-Core-Tests' 'OGC-Geometry') ];
package: #'OGC-Spheric' with: [
spec requires: #('OGC-Core' ) ];
package: #'OGC-Spheric-Tests' with: [
spec requires: #('OGC-Core-Tests' 'OGC-Spheric') ].
spec
group: 'Core' with: #('OGC-Core' );
group: 'Tests' with: #('OGC-Core-Tests');
group: 'Geometric' with: #('OGC-Geometry' 'OGC-Geometry-Tests');
group: 'Spheric' with: #('OGC-Spheric' 'OGC-Spheric-Tests');
group: 'Visualisation' with: #('OGC-Viewer' 'OGC-Viewer-Tests');
group: 'default' with: #('Core' 'Tests' 'Geometric' 'Visualisation').
]

]

{ #category : #accessing }
BaselineOfOGC >> geometry: spec [
"For Geometric projection computation"
spec
baseline: 'Geometry'
with: [
spec repository: 'github://pharo-contributions/Geometry:master/src' ]
]
2 changes: 1 addition & 1 deletion BaselineOfOGC/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : #BaselineOfOGC }
Package { #name : #BaselineOfOGC }
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'
}
241 changes: 123 additions & 118 deletions OGC-Core/OGCCurve.class.st
Original file line number Diff line number Diff line change
@@ -1,118 +1,123 @@
"
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 >> coordinates [
^ self points
]

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

{ #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
]
"
###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.
Points are stored in `points` instance variable as a sequence of `OGCPoint`
I am an **abstract** class.
Instanciation:
`OGCCurve class>>#withPoints:`
"
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 >> coordinates [
^ self points
]

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

{ #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 the empty OGCGeometry object, so `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
]
Loading

0 comments on commit 29c2a26

Please sign in to comment.