Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Raska

macrumors 6502
Original poster
Aug 5, 2007
335
0
NJ
Hi all,

I am writing an application using Distributed Objects in which one or more objects sends data to a central object, which then uses that data to display objects on a screen at certain locations. I have done a fair amount of testing and am positive that the connections are being made and the data is being sent over correctly. However, whenever I call setNeedsDisplay to redraw the view, nothing happens. I have debugged and have determined that the application never enters drawRect. Here are the snippets of code that relate to the current issue:

This is the function called by the DO, the last line of the code sends the data to the view
Code:
-(void)receivePlaneStatistics:(NSData *)planeData {
	Statistics *tempPlane = [NSKeyedUnarchiver unarchiveObjectWithData: planeData];
	NSLog(@"Receiving Data From Plane With ID %d", [tempPlane planeID]);
	NSPoint tempCoordinate = [tempPlane coordinate];
	CGFloat tempX = tempCoordinate.x;
	CGFloat tempY = tempCoordinate.y;
	
	//If in bounds add to view array, if out of bounds remove from array
	if (((tempX >= 0) && (tempX <= 640)) && ((tempY >= 0) && (tempY <= 640))) {
		if (![planes containsObject: tempPlane]) [planes addObject: tempPlane];
	}
	else [planes removeObject: tempPlane];
	
	NSLog(@"Number of planes in array is %d", [planes count]);
	
	//setPlanes does not get called or does not work correctly =[
	 [theView setPlanes: planes];
}

This code is in the view and receives the data and then calls setNeedsDisplay
Code:
-(void)setPlanes: (NSArray *)planeArray {
	NSLog(@"Setting planes...");
	if (planeArray != nil) {
		planes = planeArray;
		[self setNeedsDisplay: YES];
	}
}

Any help would be greatly appreciated! Thanks in advance!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.