-
atomResolution [preferences]
^self preferenceTable at: #atomResolution ifAbsent: [nil]
-
atomResolution: aSymbol [preferences]
self preferenceTable at: #atomResolution put: aSymbol
-
baseNameString [private]
^(Filename
splitExtension: (Filename splitPath: self filename asString) last asString)
first asString
-
computeMappingPoints: moleculeViewer [private]
| atomObjects atomicPoints |
atomObjects := moleculeViewer moleculeObject atomObjects asArray.
atomicPoints := atomObjects
collect: [:atomObject | atomObject atomicPoint].
mappingPoints := moleculeViewer
convertModelPointsToViewPoints: atomicPoints
in: (Point zero extent: self class defaultThumbnailExtent).
^mappingPoints
-
decoratedImage: anImage [private]
| decoratedImage thumbnailExtent |
decoratedImage := anImage.
thumbnailExtent := self class defaultThumbnailExtent.
decoratedImage extent = thumbnailExtent
ifFalse:
[decoratedImage := JunImageAdjuster
adjustImage: decoratedImage
extent: thumbnailExtent
keepAspect: true
alignmentSymbol: #center].
^decoratedImage
-
defaultDirectoryString [defaults]
| defaultDirectoryString |
defaultDirectoryString := (JunUniFileName
fromPlatformFilename: Filename defaultDirectory) uniFileName
asString.
defaultDirectoryString last = JunUniFileName uniSeparator
ifFalse:
[defaultDirectoryString := defaultDirectoryString
, JunUniFileName uniSeparatorString].
^defaultDirectoryString
-
exceptHydrogen [preferences]
^self preferenceTable at: #exceptHydrogen ifAbsent: [nil]
-
exceptHydrogen: aBoolean [preferences]
self preferenceTable at: #exceptHydrogen put: aBoolean = true
-
exceptIndex [preferences]
^self preferenceTable at: #exceptIndex ifAbsent: [nil]
-
exceptIndex: aBoolean [preferences]
self preferenceTable at: #exceptIndex put: aBoolean = true
-
extent [accessing]
^self thumbnail ifNil: [self class defaultThumbnailExtent]
ifNotNil: [:it | it extent]
-
filename [accessing]
self moleculeFilename ifNil: [^nil].
self moleculeFilename isEmpty ifTrue: [^self moleculeFilename].
self moleculeFilename first = JunUniFileName uniSeparator
ifTrue: [^(JunUniFileName named: self moleculeFilename) asFilename].
^(JunUniFileName
named: self defaultDirectoryString , self moleculeFilename) asFilename
-
filename: aFilename [accessing]
| defaultDirectoryString fileNameString |
defaultDirectoryString := self defaultDirectoryString.
fileNameString := (JunUniFileName fromPlatformFilename: aFilename)
uniFileName asString.
(fileNameString findString: defaultDirectoryString startingAt: 1) = 1
ifTrue:
[fileNameString := fileNameString copyFrom: defaultDirectoryString size + 1
to: fileNameString size.
[fileNameString isEmpty not
and: [fileNameString first = JunUniFileName uniSeparator]]
whileTrue:
[fileNameString := fileNameString copyFrom: 2 to: fileNameString size]].
self moleculeFilename: fileNameString
-
fromPreferences: moleculeViewer [private]
self moleculePresentation: moleculeViewer messageSymbol.
self viewerExtent: (moleculeViewer getView
ifNil: [self class defaultThumbnailExtent]
ifNotNil: [:aView | aView bounds extent]).
self projectionTable: moleculeViewer projectionTable.
self exceptHydrogen: moleculeViewer exceptHydrogen.
self exceptIndex: moleculeViewer exceptIndex.
self atomResolution: moleculeViewer moleculeObject atomResolution.
self serialNumberSetting: moleculeViewer serialNumberSetting setting
-
image [accessing]
| moleculeObject anImage moleculeViewer |
self filename asFilename exists ifFalse: [^nil].
self errorSignal handle:
[:exception |
anImage := nil.
exception reject]
do:
[moleculeObject := self moleculeObject.
moleculeObject ifNil: [^nil].
moleculeObject atomObjects isEmpty ifTrue: [^nil].
moleculeViewer := self class defaultMoleculeViewerClass
moleculeObject: moleculeObject.
self toPreferences: moleculeViewer.
anImage := moleculeViewer asImageExtent: (self viewerExtent
ifNil: [self class defaultThumbnailExtent * 2]
ifNotNil: [:it | it]).
self computeMappingPoints: moleculeViewer].
^anImage
-
initialize [initialize-release]
super initialize.
preferenceTable := nil.
moleculeFilename := nil.
thumbnailImage := nil.
mappingPoints := nil
-
is2d [testing]
^self filename ifNil: [false]
ifNotNil:
[:it |
| tailName |
tailName := (Filename splitPath: it asString) last asString asLowercase.
(JunStringUtility stringMatch: tailName and: '*2d.mol') yourself]
-
is3d [testing]
^self is2d not
-
isVoid [testing]
^false
-
mappingPoints [accessing]
mappingPoints ifNil: [mappingPoints := Array new].
^mappingPoints
-
moleculeFilename [private]
^moleculeFilename
-
moleculeFilename: aString [private]
moleculeFilename := aString
-
moleculeFilenameToLispList [lisp support]
| alist |
alist := JunLispCons cell.
alist head: #moleculeFilename.
alist tail: self moleculeFilename asString.
^alist
-
moleculeObject [accessing]
| moleculeObject |
self filename ifNil: [^nil].
self filename asFilename exists ifFalse: [^nil].
moleculeObject := self class defaultMoleculeObjectClass
fileName: self filename asFilename.
^moleculeObject
-
moleculePresentation [preferences]
^self preferenceTable at: #moleculePresentation ifAbsent: [nil]
-
moleculePresentation: messageSymbol [preferences]
self preferenceTable at: #moleculePresentation put: messageSymbol
-
postCopy [copying]
super postCopy.
preferenceTable := preferenceTable copy.
moleculeFilename := moleculeFilename copy.
thumbnailImage := thumbnailImage copy.
mappingPoints := self mappingPoints collect: [:each | each copy]
-
preferenceTable [preferences]
preferenceTable ifNil: [preferenceTable := JunAttributeTable new].
^preferenceTable
-
preferenceTable: attributeTable [preferences]
preferenceTable := attributeTable
-
preferenceTableToLispList [lisp support]
| alist |
alist := JunLispCons cell.
alist head: #preferenceTable.
alist tail: self preferenceTable toLispList.
^alist
-
preferredBounds [bounds accessing]
displayBox ifNil:
[displayBox := self thumbnail ifNil: [Point zero extent: Point zero]
ifNotNil: [:it | Point zero extent: it extent]].
^displayBox
-
projectionTable [preferences]
^self preferenceTable at: #projectionTable ifAbsent: [nil]
-
projectionTable: aDictionary [preferences]
self preferenceTable at: #projectionTable put: aDictionary
-
serialNumberSetting [preferences]
^self preferenceTable at: #serialNumberSetting ifAbsent: [nil]
-
serialNumberSetting: settingCollection [preferences]
self preferenceTable at: #serialNumberSetting put: settingCollection
-
thumbnail [accessing]
thumbnailImage ifNil:
[self image
ifNotNil: [:image | self thumbnail: (self decoratedImage: image)]].
^thumbnailImage
-
thumbnail: anImage [accessing]
thumbnailImage := anImage ifNil: [nil]
ifNotNil: [:it | CachedImage on: (it convertForGraphicsDevice: Screen default)]
-
toLispList [lisp support]
| aList |
aList := JunLispCons cell.
aList head: self class name.
self preferenceTable isEmpty
ifFalse: [aList add: self preferenceTableToLispList].
self moleculeFilename ifNotNil: [aList add: self moleculeFilenameToLispList].
^aList
-
toPreferences: moleculeViewer [private]
| tailName |
tailName := (Filename
splitPath: moleculeViewer moleculeObject fileName asString) last
asString.
self class defaultCatalogueClass catalogueProgress message: tailName.
(JunStringUtility stringMatch: tailName asLowercase and: '*2d.mol')
ifTrue: [moleculeViewer messageSymbol: #moleculeAsPlane]
ifFalse:
[moleculeViewer messageSymbol: (self moleculePresentation
ifNil: [self class defaultMoleculePresentation]
ifNotNil: [:it | it yourself])].
self exceptHydrogen ifNil: [moleculeViewer exceptHydrogen: false]
ifNotNil: [:it | moleculeViewer exceptHydrogen: it].
self exceptIndex ifNil: [moleculeViewer exceptIndex: true]
ifNotNil: [:it | moleculeViewer exceptIndex: it].
self atomResolution
ifNil: [moleculeViewer moleculeObject atomResolution: #medium]
ifNotNil: [:it | moleculeViewer moleculeObject atomResolution: it].
self serialNumberSetting
ifNil: [moleculeViewer serialNumberSetting setting]
ifNotNil: [:it | moleculeViewer serialNumberSetting setting: it].
self projectionTable ifNil:
[moleculeViewer
resetView;
zoomHeight: moleculeViewer zoomHeight + (moleculeViewer zoomHeight * 0.2)]
ifNotNil:
[:it |
moleculeViewer
defaultProjectionTable: it;
projectionTable: it]
-
viewerExtent [preferences]
^self preferenceTable at: #viewerExtent ifAbsent: [nil]
-
viewerExtent: aPoint [preferences]
self preferenceTable at: #viewerExtent put: aPoint
-
copyright [copyright]
^'ChemoJun050 (2006/08/08) Copyright 2002-2006 National Institute of Informatics, Research Organization of Information and Systems.'
-
defaultEmptyColor [defaults]
| colorValue |
colorValue := ColorValue blue.
2 timesRepeat: [colorValue := colorValue blendWith: ColorValue white].
^colorValue
-
example1 [examples]
"ChemoJunMoleculeCatalogueElement example1."
| moleculeObject catalogueElement |
(moleculeObject := ChemoJunMoleculeObject request) ifNil: [^nil].
catalogueElement := ChemoJunMoleculeCatalogueElement
filename: moleculeObject fileName.
JunImageDisplayModel show: catalogueElement thumbnail.
^catalogueElement
-
example2 [examples]
"ChemoJunMoleculeCatalogueElement example2."
| moleculeObject catalogueElement |
(moleculeObject := ChemoJunMoleculeObject request) ifNil: [^nil].
catalogueElement := ChemoJunMoleculeCatalogueElement
filename: moleculeObject fileName.
catalogueElement moleculePresentation: #moleculeAsSpaceFill.
catalogueElement viewerExtent: 256 @ 256.
catalogueElement projectionTable: ((Core.Dictionary new)
add: #sightPoint -> (-0.6d , 2.9d , 1.5d);
add: #presentation -> #solidPresentation;
add: #eyePoint -> (0 , 0 , 10);
add: #zoomHeight -> 4;
add: #shading -> #smoothShading;
add: #viewFactor -> 10;
add: #projection -> #perspectiveProjection;
add: #upVector -> (0 , 1 , 0);
yourself).
JunImageDisplayModel show: catalogueElement thumbnail.
^catalogueElement
-
example3 [examples]
"ChemoJunMoleculeCatalogueElement example3."
| moleculeObject catalogueElement lispList |
(moleculeObject := ChemoJunMoleculeObject request) ifNil: [^nil].
catalogueElement := ChemoJunMoleculeCatalogueElement
filename: moleculeObject fileName.
catalogueElement moleculePresentation: #moleculeAsSpaceFill.
catalogueElement viewerExtent: 256 @ 256.
catalogueElement projectionTable: ((Core.Dictionary new)
add: #sightPoint -> (-0.6d , 2.9d , 1.5d);
add: #presentation -> #solidPresentation;
add: #eyePoint -> (0 , 0 , 10);
add: #zoomHeight -> 4;
add: #shading -> #smoothShading;
add: #viewFactor -> 10;
add: #projection -> #perspectiveProjection;
add: #upVector -> (0 , 1 , 0);
yourself).
lispList := catalogueElement toLispList.
Transcript
clear;
show: lispList saveString.
catalogueElement := catalogueElement class fromLispList: lispList.
lispList := catalogueElement toLispList.
Transcript
cr;
show: lispList saveString.
^catalogueElement
-
filename: aFilename [instance creation]
^(self new)
filename: aFilename;
yourself
-
fromLispList: aList [lisp support]
| aClass aTable catalogueElement |
aClass := Smalltalk at: aList head.
aTable := self tableFromLispList: aList tail.
catalogueElement := aClass new.
self preferenceTableFromTable: aTable for: catalogueElement.
self moleculeFilenameFromTable: aTable for: catalogueElement.
^catalogueElement
-
moleculeFilenameFromTable: aTable for: aCatalogue [lisp support]
| moleculeFilename |
moleculeFilename := aTable at: #moleculeFilename ifAbsent: [^aCatalogue].
aCatalogue moleculeFilename: moleculeFilename.
^aCatalogue
-
preferenceTableFromTable: aTable for: aCatalogue [lisp support]
| aList preferenceTable |
aList := aTable at: #preferenceTable ifAbsent: [^aCatalogue].
preferenceTable := JunAttributeTable fromLispList: aList.
aCatalogue preferenceTable: preferenceTable.
^aCatalogue
-
system [copyright]
^'ChemoJun'
-
tableFromLispList: aList [lisp support]
| aTable |
aTable := JunAttributeTable new.
aList do: [:pair | aTable at: pair head put: pair tail].
^aTable
-
version [copyright]
^'050'