DisplayTransform.st
author Claus Gittinger <cg@exept.de>
Wed, 22 Aug 2018 12:58:11 +0200
changeset 8451 6eafe0433763
parent 8384 c473ce4aa06a
permissions -rw-r--r--
#QUALITY by cg class: WindowSensor comment/format in: #basicAddDamage:view:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8384
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
     1
"{ Encoding: utf8 }"
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
     2
7951
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
     3
"
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
     4
 COPYRIGHT (c) 1992 by Claus Gittinger
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
     5
              All Rights Reserved
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
     6
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
     7
 This software is furnished under a license and may be used
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
     8
 only in accordance with the terms of that license and with the
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    10
 be provided or otherwise made available to, or used by, any
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    11
 other person.  No title to or ownership of the software is
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    12
 hereby transferred.
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    13
"
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
"{ Package: 'stx:libview' }"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
    16
"{ NameSpace: Smalltalk }"
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
    17
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
Object subclass:#DisplayTransform
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	instanceVariableNames:''
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	classVariableNames:''
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	poolDictionaries:''
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	category:'Graphics-Transformations'
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
DisplayTransform comment:'This class represents a base for generic transformations of 2D points between different coordinate systems (including scaling and rotation). The transformations map objects between one coordinate system and another where it is assumed that a nested hierarchy of transformations can be defined.
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
It is assumed that transformations deal with Integer points. All transformations should return Integer coordinates (even though float points may be passed in as argument).
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
Compositions of transformations MUST work in the following order. A ''global'' transformation (the argument in #composedWithGlobal:) is defined as a transformation that takes place between the receiver (the ''local'') transformation and any ''global'' point computations, whereas a ''local'' transformation (e.g., the argument in #composedWithLocal:) takes place between the receiver (''global'') and any ''local'' points. For the transformation methods this means that combining a global and a local transformation will result in the following order:
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
		globalPointToLocal: globalPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
			"globalPoint -> globalTransform -> localTransform -> locaPoint"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
			^localTransform globalPointToLocal:
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
				(globalTransform globalPointToLocal: globalPoint)
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
		localPointToGlobal: localPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
			"localPoint -> localTransform -> globalTransform -> globalPoint"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
			^globalTransform localPointToGlobal:
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
				(localTransform localPointToGlobal: localPoint)
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
'
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
7951
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    44
!DisplayTransform class methodsFor:'documentation'!
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    45
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    46
copyright
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    47
"
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    48
 COPYRIGHT (c) 1992 by Claus Gittinger
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    49
              All Rights Reserved
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    50
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    51
 This software is furnished under a license and may be used
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    52
 only in accordance with the terms of that license and with the
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    53
 inclusion of the above copyright notice.   This software may not
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    54
 be provided or otherwise made available to, or used by, any
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    55
 other person.  No title to or ownership of the software is
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    56
 hereby transferred.
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    57
"
b1387707d27d #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 7858
diff changeset
    58
! !
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
!DisplayTransform class methodsFor:'instance creation'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
identity
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
	^self new setIdentity
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
7858
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    66
!DisplayTransform class methodsFor:'queries'!
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    67
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    68
isAbstract
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    69
    "Return if this class is an abstract class.
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    70
     True is returned here for myself only; false for subclasses.
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    71
     Abstract subclasses must redefine this again."
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    72
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    73
    ^ self == DisplayTransform.
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    74
! !
a32d811bda6f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7414
diff changeset
    75
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
!DisplayTransform methodsFor:'accessing'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
inverseTransformation
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
	"Return the inverse transformation of the receiver"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
	^self subclassResponsibility
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
!DisplayTransform methodsFor:'composing'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
composedWithGlobal: aTransformation
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
	"Return the composition of the receiver and the global transformation passed in.
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
	A 'global' transformation is defined as a transformation that takes place
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
	between the receiver (the 'local') transformation and any 'global' point
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
	computations, e.g., for the methods
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
		globalPointToLocal: globalPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
			globalPoint -> globalTransform -> localTransform -> locaPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
		localPointToGlobal: localPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
			localPoint -> localTransform -> globalTransform -> globalPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
		"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
	^aTransformation composedWithLocal: self
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
composedWithLocal: aTransformation
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   102
        "Return the composition of the receiver and the local transformation passed in.
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   103
        A 'local' transformation is defined as a transformation that takes place
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   104
        between the receiver (the 'global') transformation and any 'local' point
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   105
        computations, e.g., for the methods
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   107
                globalPointToLocal: globalPoint
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   108
                        globalPoint -> globalTransform -> localTransform -> locaPoint
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   110
                localPointToGlobal: localPoint
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   111
                        localPoint -> localTransform -> globalTransform -> globalPoint
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   113
                "
8384
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   114
        self isIdentityTransformation ifTrue:[^ aTransformation].
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   115
        aTransformation isIdentityTransformation ifTrue:[^ self].
8384
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   116
        ^ CompositeTransform new 
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   117
                globalTransform: self
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   118
                localTransform: aTransformation
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   119
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   120
    "Modified: / 14-06-2018 / 10:31:37 / Claus Gittinger"
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
!DisplayTransform methodsFor:'converting'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
asCompositeTransform
8384
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   126
    "Represent the receiver as a composite transformation"
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   127
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   128
    ^CompositeTransform new
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   129
            globalTransform: self
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   130
            localTransform: self species identity
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   131
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   132
    "Modified: / 14-06-2018 / 10:31:50 / Claus Gittinger"
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
asMatrixTransform2x3
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
	"Represent the receiver as a 2x3 matrix transformation"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
	^self subclassResponsibility
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
!DisplayTransform methodsFor:'initialize'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
setIdentity
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
    "Initialize the receiver to the identity transformation (e.g., not affecting points)"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
    ^self subclassResponsibility
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
!DisplayTransform methodsFor:'testing'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
isCompositeTransform
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
	"Return true if the receiver is a composite transformation.
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
	Composite transformations may have impact on the accuracy."
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
	^false
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   156
isIdentityTransformation
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   157
    "Return true if the receiver is the identity transform; that is, if applying to a point returns the point itself."
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   158
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   159
    ^ self subclassResponsibility
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
isMatrixTransform2x3
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
	"Return true if the receiver is 2x3 matrix transformation"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
	^false
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
isMorphicTransform
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
	"Return true if the receiver is a MorphicTransform, that is specifies the transformation values explicitly."
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
	^false
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
isNoScale
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
    "return true if the identity scale is in effect (i.e. saleFactor is 1);
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
     return false, otherwise."
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   176
    ^ self subclassResponsibility
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
noScale
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
    "return true if the identity scale is in effect (i.e. saleFactor is 1);
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
     return false, otherwise.
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
     Obsolete: use isNoScale"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
    <resource: #obsolete>
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
    ^ self isNoScale
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
!DisplayTransform methodsFor:'transforming points'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
applyInverseTo:aPoint
8384
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   192
    self subclassResponsibility
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   193
    "/ ^ self invertPoint: aPoint
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   194
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   195
    "Modified: / 14-06-2018 / 10:29:56 / Claus Gittinger"
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
applyScaleX:aNumber
8384
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   199
    self subclassResponsibility
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   200
    "/ ^ (self transformPoint: aNumber @ 0) x
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   201
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   202
    "Modified: / 14-06-2018 / 10:30:11 / Claus Gittinger"
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
applyScaleY:aNumber
8384
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   206
    self subclassResponsibility
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   207
    "/ ^ (self transformPoint: 0 @ aNumber) y
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   208
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   209
    "Modified: / 14-06-2018 / 10:30:17 / Claus Gittinger"
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
applyTo:aPoint
8384
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   213
    self subclassResponsibility
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   214
    "/ ^ self transformPoint: aPoint
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   215
c473ce4aa06a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7951
diff changeset
   216
    "Modified: / 14-06-2018 / 10:30:24 / Claus Gittinger"
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
globalPointToLocal: aPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
	"Transform aPoint from global coordinates into local coordinates"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
	^self subclassResponsibility
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
globalPointsToLocal: inArray
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
	"Transform all the points of inArray from global into local coordinates"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
	^inArray collect:[:pt| self globalPointToLocal: pt]
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
localPointToGlobal: aPoint
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
	"Transform aPoint from local coordinates into global coordinates"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
	^self subclassResponsibility
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
localPointsToGlobal: inArray
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
	"Transform all the points of inArray from local into global coordinates"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
	^inArray collect:[:pt| self localPointToGlobal: pt]
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
!DisplayTransform methodsFor:'transforming rects'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
globalBoundsToLocal: aRectangle
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
	"Transform aRectangle from global coordinates into local coordinates"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
	^Rectangle encompassing: (self globalPointsToLocal: aRectangle corners)
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
localBoundsToGlobal: aRectangle
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
	"Transform aRectangle from local coordinates into global coordinates"
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
	^Rectangle encompassing: (self localPointsToGlobal: aRectangle corners)
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
!DisplayTransform class methodsFor:'documentation'!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
version
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   254
    ^ '$Header$'
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
!
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
version_CVS
7414
0dd19064cf94 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6698
diff changeset
   258
    ^ '$Header$'
6698
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
! !
80a994c909c6 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260