Ejemplo n.º 1
0
/**
 * Sets previous image to image label.
 */
void Photo_Viewer::previousImage()
{
	//using dynamic memory
	char* filename;
	//check if a previous image exists
	if (getImgLoc()>0) {
		//current image location - 1
		string str = files.at(getImgLoc() - 1);
		filename = new char[str.length() + 1];
		//copy string to char
		strcpy(filename, str.c_str());
		//change image
		setNewImage(filename);
		//free up memory
		delete[] filename;
		//set new image location to be one number lower
		setImgLoc(getImgLoc() - 1);
	} else { //get the last image
		string str = files.at(files.size() - 1);
		filename = new char[str.length() + 1];
		//copy string to char
		strcpy(filename, str.c_str());
		//change image
		setNewImage(filename);
		//free up memory
		delete[] filename;
		//set image location to last image
		setImgLoc(files.size() - 1);
	}
}
Ejemplo n.º 2
0
/**
 * Sets next image to image label.
 */
void Photo_Viewer::nextImage()
{
	//using dynamic memory
	char* filename;
	//check if a next image exists
	if (getImgLoc()<files.size()-1) {
		//current image location + 1
		string str = files.at(getImgLoc() + 1);
		filename = new char[str.length() + 1];
		//copy string to char
		strcpy(filename, str.c_str());
		//change image
		setNewImage(filename);
		//free up memory
		delete[] filename;
		//set new image location to be one number higher
		setImgLoc(getImgLoc() + 1);
	}else { //get the first image
		string str = files.at(0);
		filename = new char[str.length() + 1];
		//copy string to char
		strcpy(filename, str.c_str());
		//change image
		setNewImage(filename);
		//free up memory
		delete[] filename;
		//set image location to first image
		setImgLoc(0);
	}
}
Ejemplo n.º 3
0
/**
 * Creates an image label that fills QMainWindow and reloads the first
 * image and scales it to the size of the label.
 */
void Photo_Viewer::createImageLabel()
{
	imgLbl = new QLabel(this);
	imgLbl->setBackgroundRole(QPalette::Base);
	imgLbl->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
	//using dynamic memory
	char* filename;
	//get the current image location
	string str = files.at(getImgLoc());
	filename = new char[str.length() + 1];
	//copy string to char
	strcpy(filename, str.c_str());
	//change image
	setNewImage(filename);
	//free up memory
	delete[] filename;
    imgLbl->resize(maxWidth, maxHeight);
    imgLbl->setScaledContents(TRUE);
    imgLbl->show();
}
Ejemplo n.º 4
0
void Lattice2DRep::update(int x, int y, cv::Scalar color){
    x = getImgLoc(x); y = getImgLoc(y);
    cv::Point cen = cv::Point(x,y);
    helperCV.DrawRectangle(imgLattice,cen,squareSize,squareSize,color);
}