selectionSize=0;
valid=true;
}
+
+
+ class ImageExtent
+ {
+ public:
+ ImageExtent(const std::string& x, const std::string& y, const std::string& z, const std::string& t);
+
+ void Clear() { mExtent[0] = mExtent[1] = mExtent[2] = mExtent[3] = 1; }
+
+ bool IsCompatible( const ImageExtent& );
+
+ void Add ( const ImageExtent& );
+
+ int Get(int i) { return mExtent[i]; }
+
+ int GetDimension() { return mDim; }
+
+ private:
+ int mExtent[4];
+ int mDim;
+ };
+
+
//======================================================================
///Validates the dimension compliance of the images with the maximum and
///minimum given, and between their sizes
bool GimmickView::ValidateSelected (tree::Node* sel, int min_dim, int max_dim)
{
GimmickMessage(2,"Validating selected"<<std::endl);
+ std::string mMessage;
+ if(sel==0)
+ {
+ mMessage="Cannot have 0 images selected!";
+ valid=false;
+ }
+ if(valid)
+ {
selectionSize++;
/*// EED validate all
mValidationSignal(valid);
return valid;*/
int level;
- std::string mMessage;
+
if(row.compare("")==0 || col.compare("")==0)
{
}
}
+
+ int dim = 0;
+ int rows;
+ int cols;
+ int planes;
+
+ //Dimention validation
+ //Compatibility with maximum and minimum
+ if(valid)
+ {
+ sscanf(row.c_str(),"%d",&rows);
+ sscanf(col.c_str(),"%d",&cols);
+ sscanf(plane.c_str(),"%d",&planes);
+ if(row==""){rows=1;}
+ if(col==""){cols=1;}
+ if(plane==""){planes=1;}
+
+ std::cout << cols << "x"<<rows<<"x"<<planes << std::endl;
- //Dimention validation
- //Compatibility with maximum and minimum
- if(valid)
- {
-
- int rows;
- int cols;
- int planes;
- std::string s;
- std::istringstream t(s);
- s=row;
- t >> rows;
- if(row==""){rows=1;}
- s=col;
- t >> cols;
- if(col==""){cols=1;}
- s=plane;
- t >> planes;
- if(plane==""){planes=1;}
-
- int dim = 0;
- if (planes>1) dim=3;
- else if (cols>1) dim=2;
- else if (rows>1) dim=1;
-
- if (dim == 0)
- {
- mMessage="Unknown image dimension : cannot select !";
- valid= false;
- }
- else if (dim>max_dim)
- {
- mMessage="Selecting ";
- mMessage+=dim;
- mMessage+="D images is not allowed !";
- valid= false;
- }
- if ( dim == max_dim )
- {
- mMessage="Cannot add this image to selection : would result in a ";
- mMessage+=(dim+1);
- mMessage+="D image!";
-
- valid= false;
- }
- if ( dim < min_dim )
- {
- GimmickMessage(1, "State Check: Dim: "
- <<dim
- <<" Dim min:"
- <<min_dim
- <<std::endl);
- mMessage="Cannot build the selection as it would result in a ";
- std::string a;
- std::stringstream out;
- out<<dim;
- a=out.str();
- mMessage+=a;
- mMessage+="D image, and the minimum is ";
- out<<min_dim;
- a=out.str();
- mMessage+=a;
- mMessage+="D!";
- valid= false;
- }
- }
+ if (planes>1) dim=3;
+ else if (cols>1) dim=2;
+ else if (rows>1) dim=1;
+
+ if (dim == 0)
+ {
+ mMessage="Unknown image dimension : cannot select !";
+ valid= false;
+ }
+ else if (dim>max_dim)
+ {
+ mMessage="Selecting ";
+ mMessage+=dim;
+ mMessage+="D images is not allowed !";
+ valid= false;
+ }
+ if ( dim == max_dim )
+ {
+ mMessage="Cannot add this image to selection : would result in a ";
+ mMessage+=(dim+1);
+ mMessage+="D image!";
+
+ valid= false;
+ }
+ if ( dim < min_dim )
+ {
+ GimmickMessage(1, "State Check: Dim: "
+ <<dim
+ <<" Dim min:"
+ <<min_dim
+ <<std::endl);
+ std::stringstream out;
+ out << "Cannot build the selection as it would result in a ";
+ out << dim;
+ out << "D image, and the minimum is ";
+ out << min_dim;
+ out << "D!";
+ mMessage+=out.str();
+ valid= false;
+ }
+ }
if(valid)
- {
- mMessage="Selection OK !";
+ {
+ std::stringstream out;
+ out << dim << "D image " << cols << "x"<< rows << "x"<< planes <<" selected";
+ mMessage = out.str();
+ }
}
mValidationSignal(valid);
SetMessage(mMessage);