This is BBRegionShape.m in view mode; [Download] [Up]
/* BBRegionShape.h * * This object is the backbone of each region shape. It maintains a list of * shapes that have to be drawn to represent the region according the the * regions graphics settings. * * For more interface-info see the header file. More in depth information * can be found in the source-code. * * Written by: Thomas Engel * Created: 10.03.1994 (Copyleft) * Last modified: 07.05.1994 */ #import "BBRegionShape.h" #import "BBAtomShape.h" #import "BBBondShape.h" #import "BBRegion.h" #import "BBRenderingStyle.h" @implementation BBRegionShape - initFrom:aRegion asPartOf:aMolecule; { self = [super init]; if( !self ) return self; // OK. We really are an object...here we go with our init. ourRegion = aRegion; ourMolecule = aMolecule; subshapeList = [List new]; [self setRenderingStyle:[ourRegion drawingStyle]]; [self update]; return self; } - regionClass { // Here we will return the region class we want to use for handling the // data. // Any manager from the outisde should take care of this info an switch the // regions if needed. return [BBRegion class]; } - renderSelf:(N3DCamera *)theCamera { // We will ask our renderingStyle to perform all needed settings. // It will execute the RenderMan code. [style executeRiCommands]; return self; } - renderSelfAsBox:(N3DCamera *)theCamera { // Just set the right color for the box ! RtColor color; NXConvertColorToRGB( [ourRegion color], &color[0], &color[1], &color[2] ); RiColor( color ); return [super renderSelfAsBox:theCamera]; } - setRenderingStyle:aStyle { style = aStyle; [style applySettingsTo:self]; return self; } - update { // With this method that will create a the new subshapes. These subshapes // are created according to the regions settings. // The last step will group all those shapes to this regionShape. // Every position is in molecule coordinates! int i; descendant = nil; [subshapeList freeObjects]; selectionColor = NX_COLORWHITE; // Lets fill our subshapeList with everything we own. [self addSubshapesTo:subshapeList]; // Now that the subshapeList is filled with all the needed objects // will group them all to us. for( i=0; i<[subshapeList count]; i++ ) [[subshapeList objectAt:i] group:self]; // Now that our hierarchie is set we will apply all the settings our style // asks us to. // [style applySettingsTo:self]; << should check this !!! return self; } - addSubshapesTo:aList { return self; } - region { return ourRegion; } - (NXColor)selectionColor { return selectionColor; } - (float)atomRadius:sender { return 0.4; } - (float)bondRadius:sender { return 0.1; } @end /* * History: 23.05.94 Made it a kind of abstract class. * * 07.05.94 Changed the init method and changed everything to allow * the use of BB..classes. * * 27.03.94 Does use the regions drawingstyle by default. * * 10.03.94 Extracted from the nomral Region. * * * Bugs: - Could add region class check to our init method! */
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.