wxSize(1200,800),
min_dim,
max_dim,
- output_dim,
threads);
w.ShowModal();
void SetMaxDimension(int maxdim){ mSelectionMaxDimension=maxdim; }
///Sets the minimum dimension allowed for selections
void SetMinDimension(int mindim){ mSelectionMinDimension=mindim; }
- ///Sets the output dimension desired for selections
- void SetOutputDimension(int outdim){ mOutputDimension=outdim; }
-
+
protected:
TreeHandler* GetTreeHandler() { return mTreeHandler; }
///Gets the maximum dimension allowed for selections
int GetMaxDimension(){ return mSelectionMaxDimension; }
///Gets the minimum dimension allowed for selections
int GetMinDimension(){ return mSelectionMinDimension; }
- ///Gets the output dimension desired for selections
- int GetOutputDimension(){ return mOutputDimension; }
-
+
private:
/// The TreeHandler with which it corresponds
TreeHandler* mTreeHandler;
int mSelectionMaxDimension;
//The selection's minimum dimension
int mSelectionMinDimension;
- //The user desired output dimension
- int mOutputDimension;
- };
+ };
// EO class TreeView
//=====================================================================
const wxSize& size,
int min_dim,
int max_dim,
- int out_dim,
int threads)
: wxDialog( parent,
id,
size,
min_dim,
max_dim,
- out_dim,
threads);
mView->Initialize();
}
const wxSize& size,
int image_min_dim = GIMMICK_2D_IMAGE_SELECTION,
int image_max_dim = GIMMICK_3D_IMAGE_SELECTION,
- int output_dim = NATIVE,
int threads = 0);
Gimmick* GetGimmick() { return mGimmick; }
const wxPoint& pos, const wxSize& size,
int min_dim,
int max_dim,
- int out_dim,
int number_of_threads)
: wxPanel(parent,id,pos,size),
GimmickView(gimmick),
mSelectionMaxDimension=max_dim;
mSelectionMinDimension=min_dim;
- mOutputDimension=out_dim;
// Create the views
CreateTreeViews();
view->SetMaxDimension(mSelectionMaxDimension);
view->SetMinDimension(mSelectionMinDimension);
- view->SetOutputDimension(mOutputDimension);
// TO DO : TEST THAT A VIEW WITH SAME NAME IS NOT
// ALREADY IN THE MAP
const wxPoint& pos, const wxSize& size,
int min_dim = GIMMICK_2D_IMAGE_SELECTION,
int max_dim = GIMMICK_3D_IMAGE_SELECTION,
- int out_dim = NATIVE,
int number_of_threads = 0);
/// Virtual destructor
virtual ~WxGimmickView();
int mSelectionMaxDimension;
//The selection's minimum dimension
int mSelectionMinDimension;
- //The user desired output dimension
- int mOutputDimension;
wxString mCurrentDirectory;
{
int level=mLevelList.size();
std::vector<tree::Node*> sel=GetSelected(level+1);
+ bool valid=true;
if(sel.size()>0)
{
std::vector<tree::Node*>::iterator i;
- bool valid=true;
std::string row;
std::string col;
std::string plane;
<< std::endl);
//Dimention validation
//Compatibility with maximum
- 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)
- {
- GimmickMessage(1,
- "Unknown image dimension : cannot select !"
- <<dim<<" "
- <<plane<<" "
- <<col<<" "
- <<row<<" "
- << std::endl);
- valid= false;
- }
- else if (dim>GetMaxDimension())
- {
- GimmickMessage(1,"Selecting "<<dim<<"D images is not allowed !"
- << std::endl);
- valid= false;
- }
- if ( dim == GetMaxDimension() )
- {
- GimmickMessage(1,"Cannot add this image to selection : would result in a "<<dim+1<<"D image !" << std::endl);
- valid= false;
+ 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)
+ {
+ GimmickMessage(1,
+ "Unknown image dimension : cannot select !"
+ <<dim<<" "
+ <<plane<<" "
+ <<col<<" "
+ <<row<<" "
+ << std::endl);
+ valid= false;
+ }
+ else if (dim>GetMaxDimension())
+ {
+ GimmickMessage(1,"Selecting "<<dim<<"D images is not allowed !"
+ << std::endl);
+ valid= false;
+ }
+ if ( dim == GetMaxDimension() )
+ {
+ GimmickMessage(1,"Cannot add this image to selection : would result in a "
+ <<dim+1<<"D image !" << std::endl);
+ valid= false;
+ }
+ if ( dim < GetMinDimension() && sel.size()<2 )
+ {
+ GimmickMessage(1,"Cannot build the selection as it would result in a "
+ <<dim<<"D image, and the minimum is"<<GetMinDimension()<<"D!" << std::endl);
+ valid= false;
+ }
}
- }
-
+ }
+ else
+ {
+ GimmickMessage(1,"Cannot have 0 images selected"<< std::endl);
+ valid=false;
+ }
+
//Send an event telling wether the selection is valid or not
wxCommandEvent event( 0, GetId() );
event.SetEventObject( this );
else
{event.SetInt(1);}
GetEventHandler()->ProcessEvent( event );
- }
+
}