diff --git a/src/GeoView-Examples/GeoViewExamples.class.st b/src/GeoView-Examples/GeoViewExamples.class.st index 512e8cc..8288f2b 100644 --- a/src/GeoView-Examples/GeoViewExamples.class.st +++ b/src/GeoView-Examples/GeoViewExamples.class.st @@ -1455,6 +1455,42 @@ GeoViewExamples class >> exampleWithDShapesLayer [ ^ self openViewInWindow: element ] +{ #category : #'examples - dshapeslayer' } +GeoViewExamples class >> exampleWithDShapesLayerWithDeviceAndUserArcBand [ + + | element layer arcBand arcBand2 | + element := GeoViewElement new. + layer := GeoViewDShapesLayer new name: #shapes. + element addLayer: layer. + + arcBand := (SmockDArcBand key: #arcBand) + coordinates: 200 @ 200; + strokeWidth: 2; + strokeColor: Color yellow; + radiusMin: 100; + radiusMax: 150; + orientation: 0; + aperture: 90; + setDrawModeDevice. + layer addDShape: arcBand. + + arcBand2 := (SmockDArcBand key: #arcBand2) + coordinates: + (element mapProjection projLatLonToCart: + AbsoluteCoordinates zero); + strokeWidth: 2; + strokeColor: Color green; + radiusMin: 1000000; + radiusMax: 1100000; + orientation: 90; + aperture: 150; + setDrawModeUser. + layer addDShape: arcBand2. + + + ^ self openViewInWindow: element +] + { #category : #'examples - dshapeslayer' } GeoViewExamples class >> exampleWithDShapesLayerWithDeviceRectanglesResizedOnSizeChanged [ "In this test, use of a DShapes layer to display rectangles in device coordinates. These rectangle are resize when the window size change." diff --git a/src/GeoView-Tests/DArcBandGeoViewProcessDataTest.class.st b/src/GeoView-Tests/DArcBandGeoViewProcessDataTest.class.st new file mode 100644 index 0000000..0adc3d7 --- /dev/null +++ b/src/GeoView-Tests/DArcBandGeoViewProcessDataTest.class.st @@ -0,0 +1,27 @@ +Class { + #name : #DArcBandGeoViewProcessDataTest, + #superclass : #DLeafShapeGeoViewProcessDataTest, + #category : #'GeoView-Tests-ProcessDatas' +} + +{ #category : #running } +DArcBandGeoViewProcessDataTest >> createDShapes [ + "Create a list of DShape to execute several tests" + + ^ { + "Empty shape" + SmockDArcBand new . + + "Complete shape" + (SmockDArcBand new aperture: 10; radiusMin: 20; radiusMax: 25; orientation: 45; coordinates: 0@0; fillColor: Color red). + + "Draw mode device (default is user)" + (SmockDArcBand new aperture: 10; radiusMin: 20; radiusMax: 25; orientation: 45; coordinates: 0@0; fillColor: Color red; setDrawModeDevice). + } +] + +{ #category : #running } +DArcBandGeoViewProcessDataTest >> processDataClass [ + + ^ DArcBandGeoViewProcessData +] diff --git a/src/GeoView/AbstractGeoViewGraphicModelLayer.class.st b/src/GeoView/AbstractGeoViewGraphicModelLayer.class.st index 6486cd2..792f0b9 100644 --- a/src/GeoView/AbstractGeoViewGraphicModelLayer.class.st +++ b/src/GeoView/AbstractGeoViewGraphicModelLayer.class.st @@ -252,6 +252,7 @@ AbstractGeoViewGraphicModelLayer >> initializeGraphicModel [ self graphicModel setProcessData: DSectorGeoViewProcessData new forClass: SmockDSector. self graphicModel setProcessData: DSegmentGeoViewProcessData new forClass: SmockDSegment. self graphicModel setProcessData: DMultiPolylinesGeoViewProcessData new forClass: SmockDMultiPolylines. + self graphicModel setProcessData: DArcBandGeoViewProcessData new forClass: SmockDArcBand. ] diff --git a/src/GeoView/DArcBandGeoViewProcessData.class.st b/src/GeoView/DArcBandGeoViewProcessData.class.st new file mode 100644 index 0000000..93ac8d4 --- /dev/null +++ b/src/GeoView/DArcBandGeoViewProcessData.class.st @@ -0,0 +1,51 @@ +Class { + #name : #DArcBandGeoViewProcessData, + #superclass : #DLeafShapeGeoViewProcessData, + #category : #'GeoView-ProcessDatas' +} + +{ #category : #private } +DArcBandGeoViewProcessData >> createGShape2D [ + + ^ SmockGArcBand2D new +] + +{ #category : #processing } +DArcBandGeoViewProcessData >> processUpdatedData: aKey incoming: aDArcBand with: aGArcBand2D context: aContext [ + + | radiusMin radiusMax from to orientation aperture | + super + processUpdatedData: aKey + incoming: aDArcBand + with: aGArcBand2D + context: aContext. + aDArcBand radiusMin ifNil: [ ^ aGArcBand2D ]. + aDArcBand radiusMax ifNil: [ ^ aGArcBand2D ]. + aDArcBand orientation ifNil: [ ^ aGArcBand2D ]. + aDArcBand aperture ifNil: [ ^ aGArcBand2D ]. + + aDArcBand isDrawModeDevice + ifTrue: [ "draw as geometric angle" + radiusMin := aDArcBand radiusMin. + radiusMax := aDArcBand radiusMax. + orientation := aDArcBand orientation. + aperture := aDArcBand aperture ] + ifFalse: [ + aDArcBand isDrawModeUser ifTrue: [ "draw as azimuth angle" + radiusMin := aDArcBand radiusMin + * self processor projection metersByPixel. + radiusMax := aDArcBand radiusMax + * self processor projection metersByPixel. + orientation := aDArcBand orientation asTrigonometricAngle. + aperture := aDArcBand aperture ] ]. + + from := orientation - (aperture / 2). + to := orientation + (aperture / 2). + + aGArcBand2D radiusMin: radiusMin. + aGArcBand2D radiusMax: radiusMax. + aGArcBand2D fromInDegrees: from. + aGArcBand2D toInDegrees: to. + + ^ aGArcBand2D +]