Commits

Anonymous committed 190f6e5

adding shapes that have non-intersecting contours

Comments (0)

Files changed (3)

VectorBoolean/MyDocument.h

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

VectorBoolean/MyDocument.m

 - (void) addTriangleInsideRectangle;
 - (void) addDiamondOverlappingRectangle;
 - (void) addDiamondInsideRectangle;
+- (void) addNonOverlappingContours;
+- (void) addMoreNonOverlappingContours;
 
 - (void) addRectangle:(NSRect)rect;
 - (void) addCircleAtPoint:(NSPoint)center withRadius:(CGFloat)radius;
     [self addQuadrangle:NSMakePoint(100, 250) point2:NSMakePoint(250, 400) point3:NSMakePoint(400, 250) point4:NSMakePoint(250, 100)];
 }
 
+- (void) addNonOverlappingContours
+{
+    [self addRectangle:NSMakeRect(100, 200, 200, 200)];
+    
+    NSBezierPath *circles = [NSBezierPath bezierPath];
+    [self addCircleAtPoint:NSMakePoint(200, 300) withRadius:85 toPath:circles];    
+    [self addCircleAtPoint:NSMakePoint(200, 95) withRadius:85 toPath:circles];
+    [_view.canvas addPath:circles withColor:[NSColor redColor]];
+}
+
+- (void) addMoreNonOverlappingContours
+{
+    NSBezierPath *rectangles = [NSBezierPath bezierPath];
+    [self addRectangle:NSMakeRect(100, 200, 200, 200) toPath:rectangles];
+    [self addRectangle:NSMakeRect(175, 70, 50, 50) toPath:rectangles];    
+    [_view.canvas addPath:rectangles withColor:[NSColor blueColor]];
+
+    NSBezierPath *circles = [NSBezierPath bezierPath];
+    [self addCircleAtPoint:NSMakePoint(200, 300) withRadius:85 toPath:circles];    
+    [self addCircleAtPoint:NSMakePoint(200, 95) withRadius:85 toPath:circles];
+    [_view.canvas addPath:circles withColor:[NSColor redColor]];
+}
+
 - (void) addRectangle:(NSRect)rect
 {
     NSBezierPath *rectangle = [NSBezierPath bezierPath];
     [self onReset:sender];        
 }
 
+- (IBAction) onNonOverlappingContours:(id)sender
+{
+    _resetAction = @selector(addNonOverlappingContours);
+    [self onReset:sender];            
+}
+
+- (IBAction) onMoreNonOverlappingContours:(id)sender
+{
+    _resetAction = @selector(addMoreNonOverlappingContours);
+    [self onReset:sender];            
+}
+
 - (IBAction) onShowPoints:(id)sender
 {
     _view.canvas.showPoints = !_view.canvas.showPoints;
         [menuItem setState:_resetAction == @selector(addDiamondOverlappingRectangle) ? NSOnState : NSOffState];
     } else if ( [anItem action] == @selector(onDiamondInsideRectangle:) ) {
         [menuItem setState:_resetAction == @selector(addDiamondInsideRectangle) ? NSOnState : NSOffState];
-    } else if ( [anItem action] == @selector(onShowPoints:) ) {
+    } else if ( [anItem action] == @selector(onNonOverlappingContours:) ) {
+        [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(onShowPoints:) ) {
         [menuItem setState:_view.canvas.showPoints ? NSOnState : NSOffState];
     } else if ( [anItem action] == @selector(onShowIntersections:) ) {
         [menuItem setState:_view.canvas.showIntersections ? NSOnState : NSOffState];

VectorBoolean/en.lproj/MainMenu.xib

 									<reference key="NSOnImage" ref="1033313550"/>
 									<reference key="NSMixedImage" ref="310636482"/>
 								</object>
+								<object class="NSMenuItem" id="125004856">
+									<reference key="NSMenu" ref="930598111"/>
+									<string key="NSTitle">Non-overlapping Contours</string>
+									<string key="NSKeyEquiv"/>
+									<int key="NSMnemonicLoc">2147483647</int>
+									<reference key="NSOnImage" ref="1033313550"/>
+									<reference key="NSMixedImage" ref="310636482"/>
+								</object>
+								<object class="NSMenuItem" id="25565448">
+									<reference key="NSMenu" ref="930598111"/>
+									<string key="NSTitle">More Non-overlapping 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>
 					<int key="connectionID">573</int>
 				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBActionConnection" key="connection">
+						<string key="label">onNonOverlappingContours:</string>
+						<reference key="source" ref="1014"/>
+						<reference key="destination" ref="125004856"/>
+					</object>
+					<int key="connectionID">575</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBActionConnection" key="connection">
+						<string key="label">onMoreNonOverlappingContours:</string>
+						<reference key="source" ref="1014"/>
+						<reference key="destination" ref="25565448"/>
+					</object>
+					<int key="connectionID">577</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"/>
 						</object>
 						<reference key="parent" ref="40719474"/>
 					</object>
 						<reference key="object" ref="300298976"/>
 						<reference key="parent" ref="930598111"/>
 					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">574</int>
+						<reference key="object" ref="125004856"/>
+						<reference key="parent" ref="930598111"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">576</int>
+						<reference key="object" ref="25565448"/>
+						<reference key="parent" ref="930598111"/>
+					</object>
 				</object>
 			</object>
 			<object class="NSMutableDictionary" key="flattenedProperties">
 					<string>57.ImportedFromIB2</string>
 					<string>57.editorWindowContentRectSynchronizationRect</string>
 					<string>570.IBPluginDependency</string>
+					<string>574.IBPluginDependency</string>
+					<string>576.IBPluginDependency</string>
 					<string>58.IBPluginDependency</string>
 					<string>58.ImportedFromIB2</string>
 					<string>72.IBPluginDependency</string>
 					<string>{{23, 794}, {245, 183}}</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">573</int>
+			<int key="maxID">577</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
 							<string>onDifference:</string>
 							<string>onIntersect:</string>
 							<string>onJoin:</string>
+							<string>onMoreNonOverlappingContours:</string>
+							<string>onNonOverlappingContours:</string>
 							<string>onRectangleInCircle:</string>
 							<string>onRectangleWithHoleOverlappingRectangle:</string>
 							<string>onReset:</string>
 							<string>id</string>
 							<string>id</string>
 							<string>id</string>
+							<string>id</string>
+							<string>id</string>
 						</object>
 					</object>
 					<object class="NSMutableDictionary" key="actionInfosByName">
 							<string>onDifference:</string>
 							<string>onIntersect:</string>
 							<string>onJoin:</string>
+							<string>onMoreNonOverlappingContours:</string>
+							<string>onNonOverlappingContours:</string>
 							<string>onRectangleInCircle:</string>
 							<string>onRectangleWithHoleOverlappingRectangle:</string>
 							<string>onReset:</string>
 								<string key="candidateClassName">id</string>
 							</object>
 							<object class="IBActionInfo">
+								<string key="name">onMoreNonOverlappingContours:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+							<object class="IBActionInfo">
+								<string key="name">onNonOverlappingContours:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+							<object class="IBActionInfo">
 								<string key="name">onRectangleInCircle:</string>
 								<string key="candidateClassName">id</string>
 							</object>
 							<string>onDifference:</string>
 							<string>onIntersect:</string>
 							<string>onJoin:</string>
+							<string>onMoreNonOverlappingContours:</string>
+							<string>onNonOverlappingContours:</string>
 							<string>onRectangleInCircle:</string>
 							<string>onRectangleWithHoleOverlappingRectangle:</string>
 							<string>onReset:</string>
 							<string>id</string>
 							<string>id</string>
 							<string>id</string>
+							<string>id</string>
+							<string>id</string>
 						</object>
 					</object>
 					<object class="NSMutableDictionary" key="actionInfosByName">
 							<string>onDifference:</string>
 							<string>onIntersect:</string>
 							<string>onJoin:</string>
+							<string>onMoreNonOverlappingContours:</string>
+							<string>onNonOverlappingContours:</string>
 							<string>onRectangleInCircle:</string>
 							<string>onRectangleWithHoleOverlappingRectangle:</string>
 							<string>onReset:</string>
 								<string key="candidateClassName">id</string>
 							</object>
 							<object class="IBActionInfo">
+								<string key="name">onMoreNonOverlappingContours:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+							<object class="IBActionInfo">
+								<string key="name">onNonOverlappingContours:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+							<object class="IBActionInfo">
 								<string key="name">onRectangleInCircle:</string>
 								<string key="candidateClassName">id</string>
 							</object>