DrawKit
Vector and illustration framework for Mac OS X
Instance Methods | List of all members
DKObjectDrawingLayer(Duplication) Category Reference

Some handy methods for implementing various kinds of object duplications. More...

Instance Methods

(NSArray *) - autoPolarDuplicate:centre:
 Automatically polar duplicates object to fit a circle exactly. More...
 
(NSArray *) - concentricDuplicate:centre:numberOfCopies:insetBy:
 Duplicates one or more objects concentrically around a common centre. More...
 
(NSArray *) - linearDuplicate:offset:numberOfCopies:
 Duplicates one or more objects linearly. More...
 
(NSArray *) - polarDuplicate:centre:numberOfCopies:incrementAngle:rotateCopies:
 Duplicates one or more objects radially around a common centre. More...
 

Detailed Description

Some handy methods for implementing various kinds of object duplications.

Author
Contributions from the community; see CONTRIBUTORS.md
Date
2005-2015

Some handy methods for implementing various kinds of object duplications.

Method Documentation

- (NSArray*) autoPolarDuplicate: (DKDrawableObject *)  object
centre: (NSPoint)  centre 

Automatically polar duplicates object to fit a circle exactly.

This computes the increment angle and number of copies needed to fit the object exactly into a circle. The angle is that subtended by the object's logical bounds at the centre. The radius will be adjusted outwards as necessary so that an integral number of copies fit a complete circle.

Parameters
objecta single opject to be copied
centrethe centre around which the object is located
Returns
A list of DKDrawableObjects representing the copies. The originals are not copied to this array.

Extends class DKObjectDrawingLayer.

- (NSArray*) concentricDuplicate: (NSArray *)  objectsToDuplicate
centre: (NSPoint)  centre
numberOfCopies: (NSInteger nCopies
insetBy: (CGFloat inset 

Duplicates one or more objects concentrically around a common centre.

Objects in the result are obtained by copying the objects in the original list, and so will have the same types, styles, etc. While this works with paths, it works best with shapes or groups, because paths don't implement setSize: and their location is at their top, left.

Parameters
objectsToDuplicatea list of DKDrawableObjects which will be copied
centrethe location of the centre around which the copies are arranged
numberOfCopieshow many copies to make
insetBythe amount each copy is inset or outset (-ve) by
Returns
A list of DKDrawableObjects representing the copies. The originals are not copied to this array.

Extends class DKObjectDrawingLayer.

- (NSArray*) linearDuplicate: (NSArray *)  objectsToDuplicate
offset: (NSSize)  offset
numberOfCopies: (NSInteger nCopies 

Duplicates one or more objects linearly.

Objects in the result are obtained by copying the objects in the original list, and so will have the same types, styles, etc.

Parameters
objectsToDuplicatea list of DKDrawableObjects which will be copied
offseteach copy is offset this much from the last
numberOfCopieshow many copies to make
Returns
A list of DKDrawableObjects representing the copies. The originals are not copied to this array.

Extends class DKObjectDrawingLayer.

- (NSArray*) polarDuplicate: (NSArray *)  objectsToDuplicate
centre: (NSPoint)  centre
numberOfCopies: (NSInteger nCopies
incrementAngle: (CGFloat incRadians
rotateCopies: (BOOL rotCopies 

Duplicates one or more objects radially around a common centre.

Objects in the result are obtained by copying the objects in the original list, and so will have the same types, styles, etc.

Parameters
objectsToDuplicatea list of DKDrawableObjects which will be copied
centrethe location of the centre around which the copies are arranged
numberOfCopieshow many copies to make
incrementAnglethe angle in radians between each copy
rotateCopiesYES to rotate the copies so that they lie on the radial, NO to keep them at their original rotation
Returns
A list of DKDrawableObjects representing the copies. The originals are not copied to this array.

Extends class DKObjectDrawingLayer.