Skip to content

Commit f2b3e12

Browse files
Merge pull request #155 from ThalesGroup/dev-154
Fix issue #154 : compute user coordinates GBitmap size correctly + te…
2 parents b2a63e0 + 430ad95 commit f2b3e12

15 files changed

+102
-19
lines changed

src/GeoView-Examples/GeoViewBench.class.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ I am a bench class to test performances
44
Class {
55
#name : #GeoViewBench,
66
#superclass : #Object,
7-
#category : #'GeoView-Examples'
7+
#category : #'GeoView-Examples-Bench'
88
}
99

1010
{ #category : #projections }

src/GeoView-Examples/GeoViewExamples.class.st

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,11 +1140,11 @@ GeoViewExamples class >> exampleWithDShapesLayer [
11401140
layer := GeoViewDShapesLayer new name: #shapes.
11411141
element addLayer: layer.
11421142

1143-
"User circle (not projected)"
1143+
"User circle (considering measures are in cartesian coordinates)"
11441144
circle1 := (SmockDCircle key: #circle1) coordinates: (element mapProjection projLatLonToCart: AbsoluteCoordinates zero); radius: 1000000; strokeColor: Color green; strokeWidth: 2.
11451145
layer addDShape: circle1.
11461146

1147-
"Device circle"
1147+
"Device circle (considering measures are in screen coordinates)"
11481148
circle2 := (SmockDCircle key: #circle2) coordinates: 100@100; radius: 100; strokeColor: Color yellow; strokeWidth: 2; setDrawModeDevice.
11491149
layer addDShape: circle2.
11501150

@@ -1363,6 +1363,32 @@ GeoViewExamples class >> exampleWithGeoObjectsUpdated [
13631363
^ space
13641364
]
13651365

1366+
{ #category : #'examples - dshapeslayer' }
1367+
GeoViewExamples class >> exampleWithUserDrawModeImage [
1368+
"Display the pharo logo image of 32m x 32m on the Brest city"
1369+
1370+
| element layer image |
1371+
element := GeoViewElement new.
1372+
element addLayer: GeoViewMapTilesLayer newWithOpenStreetMap.
1373+
1374+
layer := GeoViewDShapesLayer new name: #shapes.
1375+
element addLayer: layer.
1376+
1377+
"User image (considering measures are in cartesian coordinates)"
1378+
image := (SmockDImage key: #image1)
1379+
coordinates:
1380+
(element mapProjection projLatLonToCart:
1381+
AbsoluteCoordinates frBrest);
1382+
image: (self iconNamed: #pharo); "this image is 32x32 pixels => 1 meter by pixel in user draw mode"
1383+
setDrawModeUser.
1384+
layer addDShape: image.
1385+
1386+
element geoCenter: AbsoluteCoordinates frBrest.
1387+
element scale: 200.
1388+
1389+
^ self openViewInWindow: element
1390+
]
1391+
13661392
{ #category : #'private - datas' }
13671393
GeoViewExamples class >> largest50Cities [
13681394
"example: not realistic"

src/GeoView-Tests/DCircleGeoViewProcessDataTest.class.st

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ DCircleGeoViewProcessDataTest >> createDShapes [
1515
"Complete shape"
1616
(SmockDCircle new radius: 10; coordinates: 0@0; fillColor: Color red).
1717

18+
"Draw mode device (default is user)"
19+
(SmockDCircle new radius: 10; coordinates: 0@0; fillColor: Color red; setDrawModeDevice).
20+
1821
"With effect"
1922
(SmockDCircle new radius: 10; coordinates: 0@0; fillColor: Color red; effect: (SmockDuplicateEffect new)).
2023
}

src/GeoView-Tests/DCompositeShapeGeoViewProcessDataTest.class.st

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ DCompositeShapeGeoViewProcessDataTest >> createDShapes [
4949
(SmockDCompositeShape new addChildren: {
5050
(SmockDText new key: #text1).
5151
(SmockDText new key: #text2).
52-
(SmockDText new key: #text3) })
52+
(SmockDText new key: #text3) }).
53+
54+
"Draw mode device (default is user)"
55+
(SmockDCompositeShape new addChildren: {
56+
(SmockDText new key: #text1).
57+
(SmockDText new key: #text2).
58+
(SmockDText new key: #text3) }) setDrawModeDevice.
5359
}
5460
]
5561

src/GeoView-Tests/DEllipseGeoViewProcessDataTest.class.st

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ DEllipseGeoViewProcessDataTest >> createDShapes [
1313
SmockDEllipse new .
1414

1515
"Complete shape"
16-
(SmockDEllipse new radius1: 10; radius2: 20; orientation: 45; coordinates: 0@0; fillColor: Color red)
16+
(SmockDEllipse new radius1: 10; radius2: 20; orientation: 45; coordinates: 0@0; fillColor: Color red).
17+
18+
"Draw mode device (default is user)"
19+
(SmockDEllipse new radius1: 10; radius2: 20; orientation: 45; coordinates: 0@0; fillColor: Color red; setDrawModeDevice).
1720
}
1821
]
1922

src/GeoView-Tests/DImageGeoViewProcessDataTest.class.st

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,18 @@ Class {
88
DImageGeoViewProcessDataTest >> createDShapes [
99
"Create a list of DShape to execute several tests"
1010

11+
| form |
12+
form := (self iconNamed: #pharo).
13+
1114
^ {
1215
"Empty shape"
1316
SmockDImage new .
1417

1518
"Complete shape"
16-
(SmockDImage new image: Form new; orientation: 45; scale: 2@2; coordinates: 0@0; fillColor: Color red)
19+
(SmockDImage new image: form; orientation: 45; scale: 2@2; coordinates: 0@0; fillColor: Color red).
20+
21+
"Draw mode user (default is device)"
22+
(SmockDImage new image: form; orientation: 45; coordinates: 0@0; fillColor: Color red; setDrawModeUser)
1723
}
1824
]
1925

src/GeoView-Tests/DMultiPolylinesGeoViewProcessDataTest.class.st

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ DMultiPolylinesGeoViewProcessDataTest >> createDShapes [
1616
(SmockDMultiPolylines new addPolylines: { SmockDPolyline new . SmockDPolyline new . SmockDPolyline new }; fillColor: Color red) .
1717

1818
"With polylines"
19-
(SmockDMultiPolylines new addPolylines: { SmockDPolyline new points: { 0 asPoint . 1 asPoint . 2 asPoint } . SmockDPolyline new points: { 3 asPoint . 4 asPoint . 5 asPoint } . SmockDPolyline new points: { 6 asPoint . 7 asPoint . 8 asPoint } }; fillColor: Color red)
19+
(SmockDMultiPolylines new addPolylines: { SmockDPolyline new points: { 0 asPoint . 1 asPoint . 2 asPoint } . SmockDPolyline new points: { 3 asPoint . 4 asPoint . 5 asPoint } . SmockDPolyline new points: { 6 asPoint . 7 asPoint . 8 asPoint } }; fillColor: Color red).
20+
21+
"Draw mode device (default is user)"
22+
(SmockDMultiPolylines new addPolylines: { SmockDPolyline new points: { 0 asPoint . 1 asPoint . 2 asPoint } . SmockDPolyline new points: { 3 asPoint . 4 asPoint . 5 asPoint } . SmockDPolyline new points: { 6 asPoint . 7 asPoint . 8 asPoint } }; fillColor: Color red; setDrawModeDevice).
2023
}
2124
]
2225

src/GeoView-Tests/DPolygonGeoViewProcessDataTest.class.st

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ DPolygonGeoViewProcessDataTest >> createDShapes [
1313
SmockDPolygon new .
1414

1515
"Complete shape"
16-
(SmockDPolygon new points: { 0 asPoint . 1 asPoint . 2 asPoint }; fillColor: Color red)
16+
(SmockDPolygon new points: { 0 asPoint . 1 asPoint . 2 asPoint }; fillColor: Color red).
17+
18+
"Draw mode device (default is user)"
19+
(SmockDPolygon new points: { 0 asPoint . 1 asPoint . 2 asPoint }; fillColor: Color red) setDrawModeDevice.
1720
}
1821
]
1922

src/GeoView-Tests/DPolylineGeoViewProcessDataTest.class.st

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ DPolylineGeoViewProcessDataTest >> createDShapes [
1313
SmockDPolyline new .
1414

1515
"Complete shape"
16-
(SmockDPolyline new points: { 0 asPoint . 1 asPoint . 2 asPoint }; fillColor: Color red)
16+
(SmockDPolyline new points: { 0 asPoint . 1 asPoint . 2 asPoint }; fillColor: Color red).
17+
18+
"Draw mode device (default is user)"
19+
(SmockDPolyline new points: { 0 asPoint . 1 asPoint . 2 asPoint }; fillColor: Color red) setDrawModeDevice.
1720
}
1821
]
1922

src/GeoView-Tests/DRectangleGeoViewProcessDataTest.class.st

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ DRectangleGeoViewProcessDataTest >> createDShapes [
1313
SmockDRectangle new .
1414

1515
"Complete shape"
16-
(SmockDRectangle new length1: 10; length2: 20; orientation: 45; coordinates: 0@0; fillColor: Color red)
16+
(SmockDRectangle new length1: 10; length2: 20; orientation: 45; coordinates: 0@0; fillColor: Color red).
17+
18+
"Draw mode device (default is user)"
19+
(SmockDRectangle new length1: 10; length2: 20; orientation: 45; coordinates: 0@0; fillColor: Color red; setDrawModeDevice).
1720
}
1821
]
1922

0 commit comments

Comments
 (0)