Commits

Anonymous committed 906f914

adding shapes with non-intersecting, concentric contours

Comments (0)

Files changed (3)

VectorBoolean/MyDocument.h

 - (IBAction) onDiamondInsideRectangle:(id)sender;
 - (IBAction) onNonOverlappingContours:(id)sender;
 - (IBAction) onMoreNonOverlappingContours:(id)sender;
+- (IBAction) onConcentricContours:(id)sender;
 
 - (IBAction) onShowPoints:(id)sender;
 - (IBAction) onShowIntersections:(id)sender;

VectorBoolean/MyDocument.m

 - (void) addDiamondInsideRectangle;
 - (void) addNonOverlappingContours;
 - (void) addMoreNonOverlappingContours;
+- (void) addConcentricContours;
 
 - (void) addRectangle:(NSRect)rect;
 - (void) addCircleAtPoint:(NSPoint)center withRadius:(CGFloat)radius;
     [_view.canvas addPath:circles withColor:[NSColor redColor]];
 }
 
+- (void) addConcentricContours
+{
+    NSBezierPath *holeyRectangle = [NSBezierPath bezierPath];
+    [self addRectangle:NSMakeRect(50, 50, 350, 300) toPath:holeyRectangle];
+    [self addCircleAtPoint:NSMakePoint(210, 200) withRadius:125 toPath:holeyRectangle];    
+    [_view.canvas addPath:holeyRectangle withColor:[NSColor blueColor]];
+
+    [self addCircleAtPoint:NSMakePoint(210, 200) withRadius:140];
+}
+
 - (void) addRectangle:(NSRect)rect
 {
     NSBezierPath *rectangle = [NSBezierPath bezierPath];
     [self onReset:sender];            
 }
 
+- (IBAction) onConcentricContours:(id)sender
+{
+    _resetAction = @selector(addConcentricContours);
+    [self onReset:sender];            
+}
+
 - (IBAction) onShowPoints:(id)sender
 {
     _view.canvas.showPoints = !_view.canvas.showPoints;
         [menuItem setState:_resetAction == @selector(addNonOverlappingContours) ? NSOnState : NSOffState];
     } else if ( [anItem action] == @selector(onMoreNonOverlappingContours:) ) {
         [menuItem setState:_resetAction == @selector(addMoreNonOverlappingContours) ? NSOnState : NSOffState];
+    } else if ( [anItem action] == @selector(onConcentricContours:) ) {
+        [menuItem setState:_resetAction == @selector(addConcentricContours) ? NSOnState : NSOffState];
    } else if ( [anItem action] == @selector(onShowPoints:) ) {
         [menuItem setState:_view.canvas.showPoints ? NSOnState : NSOffState];
     } else if ( [anItem action] == @selector(onShowIntersections:) ) {

VectorBoolean/en.lproj/MainMenu.xib

 									<reference key="NSOnImage" ref="1033313550"/>
 									<reference key="NSMixedImage" ref="310636482"/>
 								</object>
-								<object class="NSMenuItem" id="125004856">
+								<object class="NSMenuItem" id="796805952">
 									<reference key="NSMenu" ref="930598111"/>
 									<string key="NSTitle">Non-overlapping Contours</string>
 									<string key="NSKeyEquiv"/>
 									<reference key="NSOnImage" ref="1033313550"/>
 									<reference key="NSMixedImage" ref="310636482"/>
 								</object>
-								<object class="NSMenuItem" id="25565448">
+								<object class="NSMenuItem" id="895961210">
 									<reference key="NSMenu" ref="930598111"/>
 									<string key="NSTitle">More Non-overlapping Contours</string>
 									<string key="NSKeyEquiv"/>
 									<reference key="NSOnImage" ref="1033313550"/>
 									<reference key="NSMixedImage" ref="310636482"/>
 								</object>
+								<object class="NSMenuItem" id="402158463">
+									<reference key="NSMenu" ref="930598111"/>
+									<string key="NSTitle">Concentric Contours</string>
+									<string key="NSKeyEquiv"/>
+									<int key="NSMnemonicLoc">2147483647</int>
+									<reference key="NSOnImage" ref="1033313550"/>
+									<reference key="NSMixedImage" ref="310636482"/>
+								</object>
 							</object>
 						</object>
 					</object>
 					<object class="IBActionConnection" key="connection">
 						<string key="label">onNonOverlappingContours:</string>
 						<reference key="source" ref="1014"/>
-						<reference key="destination" ref="125004856"/>
+						<reference key="destination" ref="796805952"/>
 					</object>
 					<int key="connectionID">575</int>
 				</object>
 					<object class="IBActionConnection" key="connection">
 						<string key="label">onMoreNonOverlappingContours:</string>
 						<reference key="source" ref="1014"/>
-						<reference key="destination" ref="25565448"/>
+						<reference key="destination" ref="895961210"/>
 					</object>
 					<int key="connectionID">577</int>
 				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBActionConnection" key="connection">
+						<string key="label">onConcentricContours:</string>
+						<reference key="source" ref="1014"/>
+						<reference key="destination" ref="402158463"/>
+					</object>
+					<int key="connectionID">579</int>
+				</object>
 			</object>
 			<object class="IBMutableOrderedSet" key="objectRecords">
 				<object class="NSArray" key="orderedObjects">
 							<reference ref="239388374"/>
 							<reference ref="206127035"/>
 							<reference ref="300298976"/>
-							<reference ref="125004856"/>
-							<reference ref="25565448"/>
+							<reference ref="796805952"/>
+							<reference ref="895961210"/>
+							<reference ref="402158463"/>
 						</object>
 						<reference key="parent" ref="40719474"/>
 					</object>
 					</object>
 					<object class="IBObjectRecord">
 						<int key="objectID">574</int>
-						<reference key="object" ref="125004856"/>
+						<reference key="object" ref="796805952"/>
 						<reference key="parent" ref="930598111"/>
 					</object>
 					<object class="IBObjectRecord">
 						<int key="objectID">576</int>
-						<reference key="object" ref="25565448"/>
+						<reference key="object" ref="895961210"/>
+						<reference key="parent" ref="930598111"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">578</int>
+						<reference key="object" ref="402158463"/>
 						<reference key="parent" ref="930598111"/>
 					</object>
 				</object>
 					<string>570.IBPluginDependency</string>
 					<string>574.IBPluginDependency</string>
 					<string>576.IBPluginDependency</string>
+					<string>578.IBPluginDependency</string>
 					<string>58.IBPluginDependency</string>
 					<string>58.ImportedFromIB2</string>
 					<string>72.IBPluginDependency</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<integer value="1"/>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<integer value="1"/>
 				<reference key="dict.values" ref="0"/>
 			</object>
 			<nil key="sourceID"/>
-			<int key="maxID">577</int>
+			<int key="maxID">579</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
 							<string>onCircleOverlappingRectangle:</string>
 							<string>onComplexShapes2:</string>
 							<string>onComplexShapes:</string>
+							<string>onConcentricContours:</string>
 							<string>onDiamondInsideRectangle:</string>
 							<string>onDiamondOverlappingRectangle:</string>
 							<string>onDifference:</string>
 							<string>id</string>
 							<string>id</string>
 							<string>id</string>
+							<string>id</string>
 						</object>
 					</object>
 					<object class="NSMutableDictionary" key="actionInfosByName">
 							<string>onCircleOverlappingRectangle:</string>
 							<string>onComplexShapes2:</string>
 							<string>onComplexShapes:</string>
+							<string>onConcentricContours:</string>
 							<string>onDiamondInsideRectangle:</string>
 							<string>onDiamondOverlappingRectangle:</string>
 							<string>onDifference:</string>
 								<string key="candidateClassName">id</string>
 							</object>
 							<object class="IBActionInfo">
+								<string key="name">onConcentricContours:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+							<object class="IBActionInfo">
 								<string key="name">onDiamondInsideRectangle:</string>
 								<string key="candidateClassName">id</string>
 							</object>
 							<string>onCircleOverlappingRectangle:</string>
 							<string>onComplexShapes2:</string>
 							<string>onComplexShapes:</string>
+							<string>onConcentricContours:</string>
 							<string>onDiamondInsideRectangle:</string>
 							<string>onDiamondOverlappingRectangle:</string>
 							<string>onDifference:</string>
 							<string>id</string>
 							<string>id</string>
 							<string>id</string>
+							<string>id</string>
 						</object>
 					</object>
 					<object class="NSMutableDictionary" key="actionInfosByName">
 							<string>onCircleOverlappingRectangle:</string>
 							<string>onComplexShapes2:</string>
 							<string>onComplexShapes:</string>
+							<string>onConcentricContours:</string>
 							<string>onDiamondInsideRectangle:</string>
 							<string>onDiamondOverlappingRectangle:</string>
 							<string>onDifference:</string>
 								<string key="candidateClassName">id</string>
 							</object>
 							<object class="IBActionInfo">
+								<string key="name">onConcentricContours:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+							<object class="IBActionInfo">
 								<string key="name">onDiamondInsideRectangle:</string>
 								<string key="candidateClassName">id</string>
 							</object>