本文整理汇总了C++中View::IsNull方法的典型用法代码示例。如果您正苦于以下问题:C++ View::IsNull方法的具体用法?C++ View::IsNull怎么用?C++ View::IsNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::IsNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __Click
void ColorCalibrationInterface::__Click( Button& sender, bool checked )
{
if ( sender == GUI->WhiteReferenceView_ToolButton )
{
ViewSelectionDialog d( instance.whiteReferenceViewId );
if ( d.Execute() == StdDialogCode::Ok )
{
instance.whiteReferenceViewId = d.Id();
GUI->WhiteReferenceView_Edit.SetText( WHITE_REFERENCE_ID );
}
}
else if ( sender == GUI->BackgroundReferenceView_ToolButton )
{
ViewSelectionDialog d( instance.backgroundReferenceViewId );
if ( d.Execute() == StdDialogCode::Ok )
{
instance.backgroundReferenceViewId = d.Id();
GUI->BackgroundReferenceView_Edit.SetText( BACKGROUND_REFERENCE_ID );
}
}
else if ( sender == GUI->OutputWhiteReferenceMask_CheckBox )
instance.outputWhiteReferenceMask = checked;
else if ( sender == GUI->OutputBackgroundReferenceMask_CheckBox )
instance.outputBackgroundReferenceMask = checked;
else if ( sender == GUI->WhiteROISelectPreview_Button )
{
PreviewSelectionDialog d;
if ( d.Execute() )
if ( !d.Id().IsEmpty() )
{
View view = View::ViewById( d.Id() );
if ( !view.IsNull() )
{
instance.whiteROI = view.Window().PreviewRect( view.Id() );
UpdateControls();
}
}
}
else if ( sender == GUI->BackgroundROISelectPreview_Button )
{
PreviewSelectionDialog d;
if ( d.Execute() )
if ( !d.Id().IsEmpty() )
{
View view = View::ViewById( d.Id() );
if ( !view.IsNull() )
{
instance.backgroundROI = view.Window().PreviewRect( view.Id() );
UpdateControls();
}
}
}
}
示例2: ProcessCommandLine
int FITSHeaderProcess::ProcessCommandLine( const StringList& argv ) const
{
ArgumentList arguments =
ExtractArguments( argv, ArgumentItemMode::AsViews,
ArgumentOption::AllowWildcards|ArgumentOption::NoPreviews );
FITSHeaderInstance instance( this );
bool launchInterface = false;
int count = 0;
for ( ArgumentList::const_iterator i = arguments.Begin(); i != arguments.End(); ++i )
{
const Argument& arg = *i;
if ( arg.IsNumeric() )
throw Error( "Unknown numeric argument: " + arg.Token() );
else if ( arg.IsString() )
throw Error( "Unknown string argument: " + arg.Token() );
else if ( arg.IsSwitch() )
throw Error( "Unknown switch argument: " + arg.Token() );
else if ( arg.IsLiteral() )
throw Error( "Unknown argument: " + arg.Token() );
else if ( arg.IsItemList() )
{
++count;
if ( arg.Items().IsEmpty() )
{
Console().WriteLn( "No view(s) found: " + arg.Token() );
continue;
}
for ( StringList::const_iterator j = arg.Items().Begin(); j != arg.Items().End(); ++j )
{
View v = View::ViewById( *j );
if ( v.IsNull() )
throw Error( "No such view: " + *j );
instance.LaunchOn( v );
}
}
}
if ( launchInterface )
instance.LaunchInterface();
else if ( count == 0 )
{
if ( ImageWindow::ActiveWindow().IsNull() )
throw Error( "There is no active image window." );
instance.LaunchOnCurrentWindow();
}
return 0;
}
示例3: __ViewList_ViewSelected
// ----------------------------------------------------------------------------
void MergeCFAInterface::__ViewList_ViewSelected( ViewList& sender, View& view )
{
String id(view.Id());
if ( sender == GUI->CFA0_ViewList )
{
// CFA0 selected -> try to find CFA 1,2,3 view automaticaly
m_instance.p_viewId[0] = id;
if (!id.EndsWith('0')) return;
id.DeleteRight(id.Length()-1); //delete last char
for (int cfaIndex = 3; cfaIndex > 0; --cfaIndex )
{
String cfaViewId( id + String( cfaIndex ) );
View v = ImageWindow::WindowById( cfaViewId ).MainView();
if (v.IsNull())
{
Console().WriteLn("not found id:" + cfaViewId);
}
else
{
Console().WriteLn("found id:" + cfaViewId);
m_instance.p_viewId[cfaIndex] = cfaViewId;
switch (cfaIndex)
{
case 1:
GUI->CFA1_ViewList.SelectView(v);
break;
case 2:
GUI->CFA2_ViewList.SelectView(v);
break;
case 3:
GUI->CFA3_ViewList.SelectView(v);
}
}
}
}
else if( sender == GUI->CFA1_ViewList ) m_instance.p_viewId[1] = id;
else if( sender == GUI->CFA2_ViewList ) m_instance.p_viewId[2] = id;
else if( sender == GUI->CFA3_ViewList ) m_instance.p_viewId[3] = id;
}
示例4: __FittingRegion_Click
void HDRCompositionInterface::__FittingRegion_Click( Button& sender, bool checked )
{
if ( sender == GUI->SelectPreview_Button )
{
PreviewSelectionDialog d;
if ( d.Execute() )
if ( !d.Id().IsEmpty() )
{
View view = View::ViewById( d.Id() );
if ( !view.IsNull() )
{
instance.fittingRect = view.Window().PreviewRect( view.Id() );
UpdateFittingRegionControls();
}
}
}
}
示例5: FindPreviews
static void FindPreviews( StringList& items, const ImageWindow& w, const String& previewId )
{
if ( previewId.HasWildcards() )
{
Array<View> P = w.Previews();
for ( size_type i = 0; i < P.Length(); ++i )
if ( String( P[i].Id() ).WildMatch( previewId ) )
AddView( items, P[i] );
}
else
{
View p = w.PreviewById( IsoString( previewId ) );
if ( p.IsNull() )
throw ParseError( "Preview not found", previewId );
AddView( items, p );
}
}
示例6: __TargetImage_ViewSelected
void ChannelCombinationInterface::__TargetImage_ViewSelected( ViewList& /*sender*/, View& view )
{
for ( int i = 0; i < 3; ++i )
instance.channelId[i].Clear();
if ( !view.IsNull() )
{
IsoString baseId = view.Id();
for ( int i = 0; i < 3; ++i )
{
String suffix = String( '_' ) + ColorSpaceId::ChannelId( instance.colorSpace, i );
if ( !View::ViewById( baseId + suffix ).IsNull() )
instance.channelId[i] = baseId + suffix;
}
}
UpdateControls();
}
示例7: GetViewSTF
void ScreenTransferFunctionInstance::GetViewSTF( const View& view )
{
if ( !view.IsNull() )
{
View::stf_list F;
view.GetScreenTransferFunctions( F );
for ( int c = 0; c < 4; ++c )
{
STF& f = stf[c];
const HistogramTransformation& H = F[c];
f.m = H.MidtonesBalance();
f.c0 = H.ShadowsClipping();
f.c1 = H.HighlightsClipping();
f.r0 = H.LowRange();
f.r1 = H.HighRange();
}
interaction = view.IsColor() ? STFInteraction::SeparateChannels : STFInteraction::Grayscale;
}
}
示例8: ButtonClick
void MultiViewSelectionDialog::ButtonClick( Button& sender, bool checked )
{
if ( sender == SelectAll_PushButton )
{
for ( int i = 0, n = Views_TreeBox.NumberOfChildren(); i < n; ++i )
{
TreeBox::Node* node = Views_TreeBox[i];
if ( node != nullptr )
node->Check();
}
}
else if ( sender == UnselectAll_PushButton )
{
for ( int i = 0, n = Views_TreeBox.NumberOfChildren(); i < n; ++i )
{
TreeBox::Node* node = Views_TreeBox[i];
if ( node != nullptr )
node->Uncheck();
}
}
else if ( sender == OK_PushButton )
{
m_selectedViews.Clear();
for ( int i = 0, n = Views_TreeBox.NumberOfChildren(); i < n; ++i )
{
const TreeBox::Node* node = Views_TreeBox[i];
if ( node != nullptr && node->IsChecked() )
{
View view = View::ViewById( node->Text( 0 ) );
if ( !view.IsNull() )
m_selectedViews.Add( view );
}
}
Ok();
}
else if ( sender == Cancel_PushButton )
{
m_selectedViews.Clear();
Cancel();
}
}
示例9: ProcessCommandLine
int BinarizeProcess::ProcessCommandLine( const StringList& argv ) const
{
ArgumentList arguments =
ExtractArguments( argv, ArgumentItemMode::AsViews, ArgumentOption::AllowWildcards );
BinarizeInstance instance( this );
bool launchInterface = false;
int count = 0;
for ( ArgumentList::const_iterator i = arguments.Begin(); i != arguments.End(); ++i )
{
const Argument& arg = *i;
if ( arg.IsNumeric() )
{
if ( arg.Id() == "t" || arg.Id() == "threshold" )
{
instance.level[0] = instance.level[1] = instance.level[2] = ArgumentThresholdValue( arg );
instance.isGlobal = true;
}
else if ( arg.Id() == "tR" || arg.Id() == "thresholdR" )
{
instance.level[0] = ArgumentThresholdValue( arg );
instance.isGlobal = false;
}
else if ( arg.Id() == "tG" || arg.Id() == "thresholdG" )
{
instance.level[1] = ArgumentThresholdValue( arg );
instance.isGlobal = false;
}
else if ( arg.Id() == "tB" || arg.Id() == "thresholdB" )
{
instance.level[2] = ArgumentThresholdValue( arg );
instance.isGlobal = false;
}
else
throw Error( "Unknown numeric argument: " + arg.Token() );
}
else if ( arg.IsString() )
throw Error( "Unknown string argument: " + arg.Token() );
else if ( arg.IsSwitch() )
throw Error( "Unknown switch argument: " + arg.Token() );
else if ( arg.IsLiteral() )
{
if ( arg.Id() == "-interface" )
launchInterface = true;
else if ( arg.Id() == "-help" )
{
ShowHelp();
return 0;
}
else
throw Error( "Unknown argument: " + arg.Token() );
}
else if ( arg.IsItemList() )
{
++count;
if ( arg.Items().IsEmpty() )
{
Console().WriteLn( "No view(s) found: " + arg.Token() );
continue;
}
for ( StringList::const_iterator j = arg.Items().Begin(); j != arg.Items().End(); ++j )
{
View v = View::ViewById( *j );
if ( v.IsNull() )
throw Error( "No such view: " + *j );
instance.LaunchOn( v );
}
}
}
if ( launchInterface )
instance.LaunchInterface();
else if ( count == 0 )
{
if ( ImageWindow::ActiveWindow().IsNull() )
throw Error( "There is no active image window." );
instance.LaunchOnCurrentView();
}
return 0;
}
示例10: ProcessCommandLine
int MaskedStretchProcess::ProcessCommandLine( const StringList& argv ) const
{
ArgumentList arguments =
ExtractArguments( argv, ArgumentItemMode::AsViews, ArgumentOption::AllowWildcards );
MaskedStretchInstance instance( this );
bool launchInterface = false;
int count = 0;
for ( ArgumentList::const_iterator i = arguments.Begin(); i != arguments.End(); ++i )
{
const Argument& arg = *i;
if ( arg.IsNumeric() )
{
if ( arg.Id() == "b" || arg.Id() == "-background" )
{
double b = arg.NumericValue();
if ( b < TheMSTargetBackgroundParameter->MinimumValue() ||
b > TheMSTargetBackgroundParameter->MaximumValue() )
throw Error( "Target background parameter out of range" );
instance.p_targetBackground = b;
}
else if ( arg.Id() == "n" || arg.Id() == "-iterations" )
{
int n = TruncInt( arg.NumericValue() );
if ( n < int( TheMSNumberOfIterationsParameter->MinimumValue() ) ||
n > int( TheMSNumberOfIterationsParameter->MaximumValue() ) )
throw Error( "Number of iterations parameter out of range" );
instance.p_numberOfIterations = n;
}
else
throw Error( "Unknown numeric argument: " + arg.Token() );
}
else if ( arg.IsString() )
{
if ( arg.Id() == "m" || arg.Id() == "-mask-type" )
{
if ( arg.StringValue() == "I" || arg.StringValue() == "intensity" )
instance.p_maskType = MSMaskType::Intensity;
else if ( arg.StringValue() == "V" || arg.StringValue() == "value" )
instance.p_maskType = MSMaskType::Value;
}
else
throw Error( "Unknown string argument: " + arg.Token() );
}
else if ( arg.IsSwitch() )
{
throw Error( "Unknown switch argument: " + arg.Token() );
}
else if ( arg.IsLiteral() )
{
if ( arg.Id() == "-interface" )
launchInterface = true;
else if ( arg.Id() == "-help" )
{
ShowHelp();
return 0;
}
else
throw Error( "Unknown argument: " + arg.Token() );
}
else if ( arg.IsItemList() )
{
++count;
if ( arg.Items().IsEmpty() )
{
Console().WriteLn( "No view(s) found: " + arg.Token() );
continue;
}
for ( StringList::const_iterator j = arg.Items().Begin(); j != arg.Items().End(); ++j )
{
View v = View::ViewById( *j );
if ( v.IsNull() )
throw Error( "No such view: " + *j );
instance.LaunchOn( v );
}
}
}
if ( launchInterface )
instance.LaunchInterface();
else if ( count == 0 )
{
if ( ImageWindow::ActiveWindow().IsNull() )
throw Error( "There is no active image window." );
instance.LaunchOnCurrentView();
}
return 0;
}
示例11: d
void B3EInterface::__Clicked( Button& sender, bool checked )
{
if ( sender == GUI->InputImage1_ToolButton )
{
ViewSelectionDialog d( instance.p_inputView[0].id );
d.SetWindowTitle( "Select First Input Image" );
if ( d.Execute() )
instance.p_inputView[0].id = d.Id();
GUI->InputImage1_Edit.SetText( instance.p_inputView[0].id );
}
else if ( sender == GUI->InputImage2_ToolButton )
{
ViewSelectionDialog d( instance.p_inputView[1].id );
d.SetWindowTitle( "Select Second Input Image" );
if ( d.Execute() )
instance.p_inputView[1].id = d.Id();
GUI->InputImage2_Edit.SetText( instance.p_inputView[1].id );
}
else if ( sender == GUI->OutOfRangeMask_CheckBox )
{
instance.p_outOfRangeMask = checked;
}
else if ( sender == GUI->BackgroundReferenceView1_ToolButton )
{
ViewSelectionDialog d( instance.p_inputView[0].backgroundReferenceViewId );
d.SetWindowTitle( "Select First Background Reference Image" );
if ( d.Execute() == StdDialogCode::Ok )
{
instance.p_inputView[0].backgroundReferenceViewId = d.Id();
GUI->BackgroundReferenceView1_Edit.SetText( BACKGROUND_REFERENCE_ID1 );
}
}
else if ( sender == GUI->OutputBackgroundReferenceMask1_CheckBox )
instance.p_inputView[0].outputBackgroundReferenceMask = checked;
else if ( sender == GUI->BackgroundROISelectPreview1_Button )
{
PreviewSelectionDialog d;
d.SetWindowTitle( "Select First Background ROI" );
if ( d.Execute() )
if ( !d.Id().IsEmpty() )
{
View view = View::ViewById( d.Id() );
if ( !view.IsNull() )
instance.p_inputView[0].backgroundROI = view.Window().PreviewRect( view.Id() );
}
}
else if ( sender == GUI->BackgroundReferenceView2_ToolButton )
{
ViewSelectionDialog d( instance.p_inputView[1].backgroundReferenceViewId );
d.SetWindowTitle( "Select Second Background Reference Image" );
if ( d.Execute() == StdDialogCode::Ok )
{
instance.p_inputView[1].backgroundReferenceViewId = d.Id();
GUI->BackgroundReferenceView2_Edit.SetText( BACKGROUND_REFERENCE_ID2 );
}
}
else if ( sender == GUI->OutputBackgroundReferenceMask2_CheckBox )
instance.p_inputView[1].outputBackgroundReferenceMask = checked;
else if ( sender == GUI->BackgroundROISelectPreview2_Button )
{
PreviewSelectionDialog d;
d.SetWindowTitle( "Select Second Background ROI" );
if ( d.Execute() )
if ( !d.Id().IsEmpty() )
{
View view = View::ViewById( d.Id() );
if ( !view.IsNull() )
instance.p_inputView[1].backgroundROI = view.Window().PreviewRect( view.Id() );
}
}
UpdateControls();
}
示例12: __Click
void DrizzleIntegrationInterface::__Click( Button& sender, bool checked )
{
if ( sender == GUI->AddFiles_PushButton )
{
FileFilter drzFiles;
drzFiles.SetDescription( "Drizzle Data Files" );
drzFiles.AddExtension( ".drz" );
OpenFileDialog d;
d.EnableMultipleSelections();
d.Filters().Clear();
d.Filters().Add( drzFiles );
d.SetCaption( "DrizzleIntegration: Select Drizzle Data Files" );
if ( d.Execute() )
{
size_type i0 = TreeInsertionIndex( GUI->InputData_TreeBox );
for ( StringList::const_iterator i = d.FileNames().Begin(); i != d.FileNames().End(); ++i )
m_instance.p_inputData.Insert( m_instance.p_inputData.At( i0++ ), DrizzleIntegrationInstance::DataItem( *i ) );
UpdateInputDataList();
UpdateDataSelectionButtons();
}
}
else if ( sender == GUI->SelectAll_PushButton )
{
GUI->InputData_TreeBox.SelectAllNodes();
UpdateDataSelectionButtons();
}
else if ( sender == GUI->InvertSelection_PushButton )
{
for ( int i = 0, n = GUI->InputData_TreeBox.NumberOfChildren(); i < n; ++i )
GUI->InputData_TreeBox[i]->Select( !GUI->InputData_TreeBox[i]->IsSelected() );
UpdateDataSelectionButtons();
}
else if ( sender == GUI->ToggleSelected_PushButton )
{
for ( int i = 0, n = GUI->InputData_TreeBox.NumberOfChildren(); i < n; ++i )
if ( GUI->InputData_TreeBox[i]->IsSelected() )
m_instance.p_inputData[i].enabled = !m_instance.p_inputData[i].enabled;
UpdateInputDataList();
UpdateDataSelectionButtons();
}
else if ( sender == GUI->RemoveSelected_PushButton )
{
DrizzleIntegrationInstance::input_data_list newImages;
for ( int i = 0, n = GUI->InputData_TreeBox.NumberOfChildren(); i < n; ++i )
if ( !GUI->InputData_TreeBox[i]->IsSelected() )
newImages.Add( m_instance.p_inputData[i] );
m_instance.p_inputData = newImages;
UpdateInputDataList();
UpdateDataSelectionButtons();
}
else if ( sender == GUI->Clear_PushButton )
{
m_instance.p_inputData.Clear();
UpdateInputDataList();
UpdateDataSelectionButtons();
}
else if ( sender == GUI->FullPaths_CheckBox )
{
UpdateInputDataList();
UpdateDataSelectionButtons();
}
else if ( sender == GUI->InputDirectory_ToolButton )
{
GetDirectoryDialog d;
d.SetCaption( "DrizzleIntegration: Select Input Directory" );
if ( d.Execute() )
GUI->InputDirectory_Edit.SetText( m_instance.p_inputDirectory = d.Directory() );
}
else if ( sender == GUI->EnableRejection_CheckBox )
{
m_instance.p_enableRejection = checked;
}
else if ( sender == GUI->EnableImageWeighting_CheckBox )
{
m_instance.p_enableImageWeighting = checked;
}
else if ( sender == GUI->EnableSurfaceSplines_CheckBox )
{
m_instance.p_enableSurfaceSplines = checked;
}
else if ( sender == GUI->ClosePreviousImages_CheckBox )
{
m_instance.p_closePreviousImages = checked;
}
else if ( sender == GUI->SelectPreview_Button )
{
PreviewSelectionDialog d;
if ( d.Execute() )
if ( !d.Id().IsEmpty() )
{
View view = View::ViewById( d.Id() );
if ( !view.IsNull() )
{
m_instance.p_roi = view.Window().PreviewRect( view.Id() );
UpdateROIControls();
}
}
}
}
示例13: ProcessCommandLine
int FluxCalibrationProcess::ProcessCommandLine( const StringList& argv ) const
{
ArgumentList arguments =
ExtractArguments( argv, ArgumentItemMode::AsViews, ArgumentOption::AllowWildcards );
FluxCalibrationInstance instance( this );
bool launchInterface = false;
int count = 0;
for ( ArgumentList::const_iterator i = arguments.Begin(); i != arguments.End(); ++i )
{
const Argument& arg = *i;
if ( arg.IsNumeric() )
{
if ( arg.Id() == "l" || arg.Id() == "-wavelength" )
instance.p_wavelength = arg.NumericValue();
else if ( arg.Id() == "tr" || arg.Id() == "-transmissivity" )
instance.p_transmissivity = arg.NumericValue();
else if ( arg.Id() == "w" || arg.Id() == "-filter-width" )
instance.p_filterWidth = arg.NumericValue();
else if ( arg.Id() == "a" || arg.Id() == "-aperture" )
instance.p_aperture = arg.NumericValue();
else if ( arg.Id() == "o" || arg.Id() == "-central-obstruction" )
instance.p_centralObstruction = arg.NumericValue();
else if ( arg.Id() == "t" || arg.Id() == "-exposure-time" )
instance.p_exposureTime = arg.NumericValue();
else if ( arg.Id() == "e" || arg.Id() == "-atmospheric-extinction" )
instance.p_atmosphericExtinction = arg.NumericValue();
else if ( arg.Id() == "G" || arg.Id() == "-sensor-gain" )
instance.p_sensorGain = arg.NumericValue();
else if ( arg.Id() == "qe" || arg.Id() == "-quantum-efficiency" )
instance.p_quantumEfficiency = arg.NumericValue();
else
throw Error( "Unknown numeric argument: " + arg.Token() );
}
else if ( arg.IsString() )
{
throw Error( "Unknown string argument: " + arg.Token() );
}
else if ( arg.IsSwitch() )
{
throw Error( "Unknown switch argument: " + arg.Token() );
}
else if ( arg.IsLiteral() )
{
// These are standard parameters that all processes should provide.
if ( arg.Id() == "-interface" )
launchInterface = true;
else if ( arg.Id() == "-help" )
{
ShowHelp();
return 0;
}
else
throw Error( "Unknown argument: " + arg.Token() );
}
else if ( arg.IsItemList() )
{
++count;
if ( arg.Items().IsEmpty() )
{
Console().WriteLn( "No view(s) found: " + arg.Token() );
throw;
}
for ( StringList::const_iterator j = arg.Items().Begin(); j != arg.Items().End(); ++j )
{
View v = View::ViewById( *j );
if ( v.IsNull() )
throw Error( "No such view: " + *j );
instance.LaunchOn( v );
}
}
}
if ( launchInterface )
instance.LaunchInterface();
else if ( count == 0 )
{
if ( ImageWindow::ActiveWindow().IsNull() )
throw Error( "There is no active image window." );
instance.LaunchOnCurrentView();
}
return 0;
}
示例14: instance
int B3EProcess::ProcessCommandLine( const StringList& argv ) const
{
ArgumentList arguments =
ExtractArguments( argv, ArgumentItemMode::AsViews, ArgumentOption::AllowWildcards );
B3EInstance instance( this );
bool launchInterface = false;
int count = 0;
for ( ArgumentList::const_iterator i = arguments.Begin(); i != arguments.End(); ++i )
{
const Argument& arg = *i;
if ( arg.IsNumeric() )
{
throw Error( "Unknown numeric argument: " + arg.Token() );
}
else if ( arg.IsString() )
{
throw Error( "Unknown string argument: " + arg.Token() );
}
else if ( arg.IsSwitch() )
{
throw Error( "Unknown switch argument: " + arg.Token() );
}
else if ( arg.IsLiteral() )
{
// These are standard parameters that all processes should provide.
if ( arg.Id() == "-interface" )
launchInterface = true;
else if ( arg.Id() == "-help" )
{
ShowHelp();
return 0;
}
else
throw Error( "Unknown argument: " + arg.Token() );
}
else if ( arg.IsItemList() )
{
++count;
if ( arg.Items().IsEmpty() )
{
Console().WriteLn( "No view(s) found: " + arg.Token() );
throw;
}
for ( StringList::const_iterator j = arg.Items().Begin(); j != arg.Items().End(); ++j )
{
View v = View::ViewById( *j );
if ( v.IsNull() )
throw Error( "No such view: " + *j );
instance.LaunchOn( v );
}
}
}
if ( launchInterface )
instance.LaunchInterface();
else if ( count == 0 )
{
if ( ImageWindow::ActiveWindow().IsNull() )
throw Error( "There is no active image window." );
instance.LaunchOnCurrentView();
}
return 0;
}
示例15: ProcessCommandLine
int LocalHistogramEqualizationProcess::ProcessCommandLine( const StringList& argv ) const
{
ArgumentList arguments =
ExtractArguments( argv, ArgumentItemMode::AsViews, ArgumentOption::AllowWildcards );
LocalHistogramEqualizationInstance instance( this );
bool launchInterface = false;
int count = 0;
for ( ArgumentList::const_iterator i = arguments.Begin(); i != arguments.End(); ++i )
{
const Argument& arg = *i;
if ( arg.IsNumeric() )
{
if (arg.Id() == "r" || arg.Id() == "-radius") instance.radius = (int)arg.NumericValue();
else if (arg.Id() == "l" || arg.Id() == "-limit") instance.slopeLimit = arg.NumericValue();
else if (arg.Id() == "a" || arg.Id() == "-amount") instance.amount = arg.NumericValue();
else if (arg.Id() == "h" || arg.Id() == "-hist")
{
int bins = (int)arg.NumericValue();
if (bins == 8) instance.histogramBins = LHEHistogramBins::Bit8;
else if (bins == 10) instance.histogramBins = LHEHistogramBins::Bit10;
else if (bins == 12) instance.histogramBins = LHEHistogramBins::Bit12;
else throw Error( "Invalid value for '-h' argument. Allowed values are 8, 10 or 12" );
}
else throw Error( "Unknown numeric argument: " + arg.Token() );
}
else if ( arg.IsString() )
{
throw Error( "Unknown string argument: " + arg.Token() );
}
else if ( arg.IsSwitch() )
{
if (arg.Id() == "c" || arg.Id() == "-circular") instance.circularKernel = arg.SwitchState();
else throw Error( "Unknown switch argument: " + arg.Token() );
}
else if ( arg.IsLiteral() )
{
if (arg.Id() == "c" || arg.Id() == "-circular") instance.circularKernel = true;
// These are standard parameters that all processes should provide.
else if ( arg.Id() == "-interface" )
launchInterface = true;
else if ( arg.Id() == "-help" )
{
ShowHelp();
return 0;
}
else
throw Error( "Unknown argument: " + arg.Token() );
}
else if ( arg.IsItemList() )
{
++count;
if ( arg.Items().IsEmpty() )
{
Console().WriteLn( "No view(s) found: " + arg.Token() );
throw;
}
for ( StringList::const_iterator j = arg.Items().Begin(); j != arg.Items().End(); ++j )
{
View v = View::ViewById( *j );
if ( v.IsNull() )
throw Error( "No such view: " + *j );
instance.LaunchOn( v );
}
}
}
if ( launchInterface )
instance.LaunchInterface();
else if ( count == 0 )
{
if ( ImageWindow::ActiveWindow().IsNull() )
throw Error( "There is no active image window." );
instance.LaunchOnCurrentView();
}
return 0;
}