index xrefs 2006/08/08 17:41:27

ChemoJunMoleculeCatalogueElement

ChemoJun050 (2006/08/08) Copyright 2002-2006 National Institute of Informatics, Research Organization of Information and Systems.

category:

inheritance:

instance variables:

class instance variables:

class variables:

pool variables:

instance methods:

  1. atomResolution [preferences] xrefs
    	^self preferenceTable at: #atomResolution ifAbsent: [nil]
  2. atomResolution: aSymbol [preferences] xrefs
     
    	self preferenceTable at: #atomResolution put: aSymbol
  3. baseNameString [private] xrefs
    	^(Filename 
    		splitExtension: (Filename splitPath: self filename asString) last asString) 
    			first asString
  4. computeMappingPoints: moleculeViewer [private] xrefs
     
    	| 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
  5. decoratedImage: anImage [private] xrefs
     
    	| decoratedImage thumbnailExtent |
    	decoratedImage := anImage.
    	thumbnailExtent := self class defaultThumbnailExtent.
    	decoratedImage extent = thumbnailExtent 
    		ifFalse: 
    			[decoratedImage := JunImageAdjuster 
    						adjustImage: decoratedImage
    						extent: thumbnailExtent
    						keepAspect: true
    						alignmentSymbol: #center].
    	^decoratedImage
  6. defaultDirectoryString [defaults] xrefs
    	| defaultDirectoryString |
    	defaultDirectoryString := (JunUniFileName 
    				fromPlatformFilename: Filename defaultDirectory) uniFileName 
    				asString.
    	defaultDirectoryString last = JunUniFileName uniSeparator 
    		ifFalse: 
    			[defaultDirectoryString := defaultDirectoryString 
    						, JunUniFileName uniSeparatorString].
    	^defaultDirectoryString
  7. exceptHydrogen [preferences] xrefs
    	^self preferenceTable at: #exceptHydrogen ifAbsent: [nil]
  8. exceptHydrogen: aBoolean [preferences] xrefs
     
    	self preferenceTable at: #exceptHydrogen put: aBoolean = true
  9. exceptIndex [preferences] xrefs
    	^self preferenceTable at: #exceptIndex ifAbsent: [nil]
  10. exceptIndex: aBoolean [preferences] xrefs
     
    	self preferenceTable at: #exceptIndex put: aBoolean = true
  11. extent [accessing] xrefs
    	^self thumbnail ifNil: [self class defaultThumbnailExtent]
    		ifNotNil: [:it | it extent]
  12. filename [accessing] xrefs
    	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
  13. filename: aFilename [accessing] xrefs
     
    	| 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
  14. fromPreferences: moleculeViewer [private] xrefs
     
    	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
  15. image [accessing] xrefs
    	| 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
  16. initialize [initialize-release] xrefs
    	super initialize.
    	preferenceTable := nil.
    	moleculeFilename := nil.
    	thumbnailImage := nil.
    	mappingPoints := nil
  17. is2d [testing] xrefs
    	^self filename ifNil: [false]
    		ifNotNil: 
    			[:it | 
    			| tailName |
    			tailName := (Filename splitPath: it asString) last asString asLowercase.
    			(JunStringUtility stringMatch: tailName and: '*2d.mol') yourself]
  18. is3d [testing] xrefs
    	^self is2d not
  19. isVoid [testing] xrefs
    	^false
  20. mappingPoints [accessing] xrefs
    	mappingPoints ifNil: [mappingPoints := Array new].
    	^mappingPoints
  21. moleculeFilename [private] xrefs
    	^moleculeFilename
  22. moleculeFilename: aString [private] xrefs
     
    	moleculeFilename := aString
  23. moleculeFilenameToLispList [lisp support] xrefs
    	| alist |
    	alist := JunLispCons cell.
    	alist head: #moleculeFilename.
    	alist tail: self moleculeFilename asString.
    	^alist
  24. moleculeObject [accessing] xrefs
    	| moleculeObject |
    	self filename ifNil: [^nil].
    	self filename asFilename exists ifFalse: [^nil].
    	moleculeObject := self class defaultMoleculeObjectClass 
    				fileName: self filename asFilename.
    	^moleculeObject
  25. moleculePresentation [preferences] xrefs
    	^self preferenceTable at: #moleculePresentation ifAbsent: [nil]
  26. moleculePresentation: messageSymbol [preferences] xrefs
     
    	self preferenceTable at: #moleculePresentation put: messageSymbol
  27. postCopy [copying] xrefs
    	super postCopy.
    	preferenceTable := preferenceTable copy.
    	moleculeFilename := moleculeFilename copy.
    	thumbnailImage := thumbnailImage copy.
    	mappingPoints := self mappingPoints collect: [:each | each copy]
  28. preferenceTable [preferences] xrefs
    	preferenceTable ifNil: [preferenceTable := JunAttributeTable new].
    	^preferenceTable
  29. preferenceTable: attributeTable [preferences] xrefs
     
    	preferenceTable := attributeTable
  30. preferenceTableToLispList [lisp support] xrefs
    	| alist |
    	alist := JunLispCons cell.
    	alist head: #preferenceTable.
    	alist tail: self preferenceTable toLispList.
    	^alist
  31. preferredBounds [bounds accessing] xrefs
    	displayBox ifNil: 
    			[displayBox := self thumbnail ifNil: [Point zero extent: Point zero]
    						ifNotNil: [:it | Point zero extent: it extent]].
    	^displayBox
  32. projectionTable [preferences] xrefs
    	^self preferenceTable at: #projectionTable ifAbsent: [nil]
  33. projectionTable: aDictionary [preferences] xrefs
     
    	self preferenceTable at: #projectionTable put: aDictionary
  34. serialNumberSetting [preferences] xrefs
    	^self preferenceTable at: #serialNumberSetting ifAbsent: [nil]
  35. serialNumberSetting: settingCollection [preferences] xrefs
     
    	self preferenceTable at: #serialNumberSetting put: settingCollection
  36. thumbnail [accessing] xrefs
    	thumbnailImage ifNil: 
    			[self image 
    				ifNotNil: [:image | self thumbnail: (self decoratedImage: image)]].
    	^thumbnailImage
  37. thumbnail: anImage [accessing] xrefs
     
    	thumbnailImage := anImage ifNil: [nil]
    				ifNotNil: [:it | CachedImage on: (it convertForGraphicsDevice: Screen default)]
  38. toLispList [lisp support] xrefs
    	| 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
  39. toPreferences: moleculeViewer [private] xrefs
     
    	| 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]
  40. viewerExtent [preferences] xrefs
    	^self preferenceTable at: #viewerExtent ifAbsent: [nil]
  41. viewerExtent: aPoint [preferences] xrefs
     
    	self preferenceTable at: #viewerExtent put: aPoint

class methods:

  1. copyright [copyright] xrefs
    	^'ChemoJun050 (2006/08/08) Copyright 2002-2006 National Institute of Informatics, Research Organization of Information and Systems.'
  2. defaultEmptyColor [defaults] xrefs
    	| colorValue |
    	colorValue := ColorValue blue.
    	2 timesRepeat: [colorValue := colorValue blendWith: ColorValue white].
    	^colorValue
  3. example1 [examples] xrefs
    	"ChemoJunMoleculeCatalogueElement example1."
    
    	| moleculeObject catalogueElement |
    	(moleculeObject := ChemoJunMoleculeObject request) ifNil: [^nil].
    	catalogueElement := ChemoJunMoleculeCatalogueElement 
    				filename: moleculeObject fileName.
    	JunImageDisplayModel show: catalogueElement thumbnail.
    	^catalogueElement
  4. example2 [examples] xrefs
    	"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
  5. example3 [examples] xrefs
    	"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
  6. filename: aFilename [instance creation] xrefs
     
    	^(self new)
    		filename: aFilename;
    		yourself
  7. fromLispList: aList [lisp support] xrefs
     
    	| 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
  8. moleculeFilenameFromTable: aTable for: aCatalogue [lisp support] xrefs
     
    	| moleculeFilename |
    	moleculeFilename := aTable at: #moleculeFilename ifAbsent: [^aCatalogue].
    	aCatalogue moleculeFilename: moleculeFilename.
    	^aCatalogue
  9. preferenceTableFromTable: aTable for: aCatalogue [lisp support] xrefs
     
    	| aList preferenceTable |
    	aList := aTable at: #preferenceTable ifAbsent: [^aCatalogue].
    	preferenceTable := JunAttributeTable fromLispList: aList.
    	aCatalogue preferenceTable: preferenceTable.
    	^aCatalogue
  10. system [copyright] xrefs
    	^'ChemoJun'
  11. tableFromLispList: aList [lisp support] xrefs
     
    	| aTable |
    	aTable := JunAttributeTable new.
    	aList do: [:pair | aTable at: pair head put: pair tail].
    	^aTable
  12. version [copyright] xrefs
    	^'050'

index xrefs