Beispiel #1
0
	void showSidePair() {
		std::vector<SidePair>::iterator it;

		for(it = sidepair_.begin(); it != sidepair_.end(); it++) {
			uint16_t shortside   = it->shortside;
			uint16_t longside     = it->longside;
			uint16_t squareside = it->squareside;
			std::cout << "(" << shortside << ", " << longside << ", " << squareside << ") - (" 
					  << calcRectangle(shortside,  squareside) << ", " << calcRectangle (longside, squareside) << ", " 
					  << squareside * squareside << ")" << std::endl;
		}
	}
Beispiel #2
0
void drawMetaDataText (CGContextRef myContext, CGRect contextRect, CFURLRef url)
{
    float w, h;
    w = contextRect.size.width;
    h = contextRect.size.height;
    
    
	
	//Lets pull some metadata!
	
	struct metaData struct_metaData;
    
    bzero(struct_metaData.Title, 1024);
    bzero(struct_metaData.Header, 1024);
//    bzero(struct_metaData.Expdata, 1024);
//    bzero(struct_metaData.Resolution, 1024);
//    bzero(struct_metaData.JrnlTitle, 1024);
//    bzero(struct_metaData.JrnlRef, 1024);
//    bzero(struct_metaData.Keywds, 4000);
//    bzero(struct_metaData.JrnlAuthor, 4000);
    
	
	exportMetaData(url, &struct_metaData);
	
	
	int wraplength = 50;
	int colLength = wraplength+5;
    int rowLength = 10;
	int textposX = 5;
	int textposY = 10;
    
    int calc_textposX = textposX;
	int calc_textposY = textposY;
    
    
    CGContextSetRGBFillColor (myContext, 1, 1, 1, 1);
    
    
    CGContextSelectFont (myContext, "Helvetica", 20, kCGEncodingMacRoman);
	
    CGContextSetCharacterSpacing (myContext, 1);
    CGContextSetTextDrawingMode (myContext, kCGTextFill);
    
    CGContextSetRGBFillColor(myContext, 0, 0, 0, 1);
    
    if(struct_metaData.Title[0] != 0){
        calcRectangle("Title: ", struct_metaData.Title, rowLength, colLength, wraplength, &calc_textposX, &calc_textposY);
        drawRoundedRect(myContext, calc_textposX, calc_textposY);
    }
	
    DrawText("Title: ", struct_metaData.Title, myContext,  rowLength, colLength, wraplength, &textposX, &textposY);
    
}
Beispiel #3
0
	/// 
	/// @brief   compare sum of rectangles with square
	/// @param shortside   the  short side of smaller square
	/// @param longside     the short side of bigger    square
	/// @param squareside the side of square
	///
	/// @return 
	///
	bool compareRectangleToSquare(uint16_t shortside, uint16_t longside, uint16_t squareside) {
		uint16_t large  = calcRectangle(shortside, squareside);
		uint16_t small = calcRectangle(longside, squareside);

		return (large + small == squareside * squareside) ? true : false;
	}