Пример #1
0
TRasterMapPlugin::TRasterMapPlugin()
   : TMapPlugin<TRasterMapAdapter>(TImageManager::Consts::RasterMap, false)
{
setPluginName(tr("Raster Map"));
setSourceType(TMapAdapter::Consts::RasterMap);
setMapType(Consts::TypeRasterMap);
}
void QgsProcessingModelerParameterWidget::setWidgetValue( const QgsProcessingModelChildParameterSource &value )
{
  // we make a copy of all attributes and store locally, so that users can flick between
  // sources without losing their current value
  mStaticValue = value.staticValue();
  mModelInputParameterName = value.parameterName();
  mOutputChildId = value.outputChildId();
  mOutputName = value.outputName();
  mExpression = value.expression();

  updateUi();
  setSourceType( value.source() );
}
Пример #3
0
/* Class:     sage_DShowCaptureDevice
 * Method:    getDevicesInCategory0
 * Signature: (Ljava/lang/String;)[Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_sage_DShowCaptureDevice_scanBDAChannel0
	(JNIEnv *env, jobject jo, jlong capInfo, jstring jnum, jstring jcountry, jint streamType )
{
	static jclass stringClass;

	DShowCaptureInfo* pCapInfo = (DShowCaptureInfo*) capInfo;
	if (!pCapInfo )
	{
		slog((env, "ScanDBAChannel0 failed device is not open or not exist.\r\n"  ));
		return env->NewStringUTF("");
	}

	if ( !capMask(pCapInfo->captureConfig, sage_DShowCaptureDevice_BDA_VIDEO_CAPTURE_MASK ) )
	{
		slog((env, "is not BDA capture device\r\n" ));
		return env->NewStringUTF("");
	}

	TV_TYPE TVType = GetTVType( pCapInfo );
	const char* cnum = env->GetStringUTFChars(jnum, NULL);
	const jchar* country = env->GetStringChars( jcountry, NULL);

	char  countryRegion[256]={0};
	char  tuningString[64]={0};

	if ( country != NULL && country[0] )
		wcstombs( countryRegion, (wchar_t*)country, sizeof(countryRegion)-2 );

	//trime space
	int len = strlen(countryRegion);
	while( len-- > 0 )
	{
		if ( countryRegion[len] == ' ' ) countryRegion[len] = 0x0;
		else break;
	}
	strncpy( pCapInfo->Country, countryRegion, sizeof(pCapInfo->Country) );

	//$NEW
	strncpy( tuningString, cnum, sizeof(tuningString) );
	env->ReleaseStringUTFChars( jnum, cnum);
	env->ReleaseStringChars( jcountry, country);
	
	//if ( pCapInfo->filterState <= 1 )  //in case, CaptureFilters is not ready
	{
		AddBDAVideoCaptureFilters( env, pCapInfo, pCapInfo->pGraph, 0 );             
		BDAGraphSetDebugFileSource( env, pCapInfo, pCapInfo->pGraph  );
		BDAGraphConnectFilter( env, pCapInfo,  pCapInfo->pGraph );
		SetupCAM( env, pCapInfo );
		SetupTunerPlugin( env, pCapInfo, GetTVType( pCapInfo ) );
		BDAGraphConnectDebugRawDumpSink( env, pCapInfo, pCapInfo->pGraph  );
       	BDAGraphConnectDumpSink( env, pCapInfo,  pCapInfo->pGraph );
		ClearUpDebugFileSource(  env, pCapInfo, pCapInfo->pGraph  );
	}

	TV_TYPE BDATVType = GetTVType( pCapInfo ); 
	if ( BDATVType == ATSC )
	{
		if ( !stricmp( pCapInfo->TuningMode, "Cable" ) )
		{
			if ( QAMTunerType( env, pCapInfo ) == 1  )
			{
				BDATVType = QAM;
			}
			else 
			if ( strstr(  pCapInfo->videoCaptureFilterName, "Silicondust HDHomeRun" ) ) //ZQ. hardcode HDHR QAM
			{
				BDATVType = QAM;
				slog( (env, "It's a HDHomeRun QAM tuner\r\n") );
			}
		}

		if ( strcmp( getSourceType( (CHANNEL_DATA*)pCapInfo->channel ), TVTypeString( BDATVType ) ) )
			setSourceType( (CHANNEL_DATA*)pCapInfo->channel, TVTypeString( BDATVType ) );
	}

	if ( BDATVType == DVBS ) 
	{
		if ( atoi( tuningString) == 0 )
			SetupSatelliteLNB( pCapInfo, 1 );
	}

	char* deviceName =  SageGetTunerDeviceName(pCapInfo);	
	slog(( env, "Scan Channel:%s,  country:%s, type:%s...\r\n", 
	                   tuningString, countryRegion, getSourceType( (CHANNEL_DATA*)pCapInfo->channel ) ));	
			   
	char* scanResult = scanChannel( (CHANNEL_DATA*)pCapInfo->channel, deviceName, tuningString,  
		                               countryRegion,  (int)streamType );
	len = strlen( scanResult );
	//trim \r\n
	while ( len > 1 && scanResult[len-1] == '\r' || scanResult[len-1] == '\n' ) 
	{
		scanResult[len-1] = 0; 
		len--;
	};
	if ( scanResult != NULL && len >= 1024 )
		slog(( env, "Scan Channel: scan result too long to log here, check native log\r\n" ));
	else
		slog(( env, "Scan Channel:%s,  ret='%s'.\r\n", tuningString, scanResult==NULL ? "": scanResult  ));	

	jstring jretstr;
	if ( scanResult != NULL )
	{
		jretstr = env->NewStringUTF(scanResult );
		free( scanResult );
	} else
		jretstr = env->NewStringUTF( "" );

	return jretstr;
	//$NEW

}
QgsProcessingModelerParameterWidget::QgsProcessingModelerParameterWidget( QgsProcessingModelAlgorithm *model,
    const QString &childId,
    const QgsProcessingParameterDefinition *parameter, QgsProcessingContext &context,
    QWidget *parent )
  : QWidget( parent )
  , mModel( model )
  , mChildId( childId )
  , mParameterDefinition( parameter )
  , mContext( context )
{
  setFocusPolicy( Qt::StrongFocus );

  // icon size is a bit bigger than text, but minimum size of 24 so that we get pixel-aligned rendering on low-dpi screens
  int iconSize = static_cast< int >( std::floor( std::max( Qgis::UI_SCALE_FACTOR * fontMetrics().height() * 1.1, 24.0 ) ) );

  QHBoxLayout *hLayout = new QHBoxLayout();

  mSourceButton = new QToolButton();
  mSourceButton->setFocusPolicy( Qt::StrongFocus );

  // button width is 1.25 * icon size, height 1.1 * icon size. But we round to ensure even pixel sizes for equal margins
  mSourceButton->setFixedSize( 2 * static_cast< int >( 1.25 * iconSize / 2.0 ), 2 * static_cast< int >( iconSize * 1.1 / 2.0 ) );
  mSourceButton->setIconSize( QSize( iconSize, iconSize ) );
  mSourceButton->setPopupMode( QToolButton::InstantPopup );

  mSourceMenu = new QMenu( this );
  connect( mSourceMenu, &QMenu::aboutToShow, this, &QgsProcessingModelerParameterWidget::sourceMenuAboutToShow );
  connect( mSourceMenu, &QMenu::triggered, this, &QgsProcessingModelerParameterWidget::sourceMenuActionTriggered );
  mSourceButton->setMenu( mSourceMenu );

  hLayout->addWidget( mSourceButton );

  mStackedWidget = new QStackedWidget();

  mStaticWidgetWrapper.reset( QgsGui::processingGuiRegistry()->createParameterWidgetWrapper( mParameterDefinition, QgsProcessingGui::Modeler ) );
  if ( mStaticWidgetWrapper )
  {
    QWidget *widget = mStaticWidgetWrapper->createWrappedWidget( context );
    if ( widget )
    {
      mHasStaticWrapper = true;
      mStackedWidget->addWidget( widget );
    }
    else
      mStackedWidget->addWidget( new QWidget() );
  }
  else
  {
    mStackedWidget->addWidget( new QWidget() );
  }

  mExpressionWidget = new QgsExpressionLineEdit();
  mStackedWidget->addWidget( mExpressionWidget );

  mModelInputCombo = new QComboBox();
  QHBoxLayout *hLayout2 = new QHBoxLayout();
  hLayout2->setMargin( 0 );
  hLayout2->setContentsMargins( 0, 0, 0, 0 );
  hLayout2->addWidget( new QLabel( tr( "Using model input" ) ) );
  hLayout2->addWidget( mModelInputCombo, 1 );
  QWidget *hWidget2 = new QWidget();
  hWidget2->setLayout( hLayout2 );
  mStackedWidget->addWidget( hWidget2 );

  mChildOutputCombo = new QComboBox();
  QHBoxLayout *hLayout3 = new QHBoxLayout();
  hLayout3->setMargin( 0 );
  hLayout3->setContentsMargins( 0, 0, 0, 0 );
  hLayout3->addWidget( new QLabel( tr( "Using algorithm output" ) ) );
  hLayout3->addWidget( mChildOutputCombo, 1 );
  QWidget *hWidget3 = new QWidget();
  hWidget3->setLayout( hLayout3 );
  mStackedWidget->addWidget( hWidget3 );

  hLayout->setMargin( 0 );
  hLayout->setContentsMargins( 0, 0, 0, 0 );
  hLayout->addWidget( mStackedWidget, 1 );

  setLayout( hLayout );
  setSourceType( QgsProcessingModelChildParameterSource::StaticValue );
}
void QgsProcessingModelerParameterWidget::sourceMenuActionTriggered( QAction *action )
{
  QgsProcessingModelChildParameterSource::Source sourceType = static_cast< QgsProcessingModelChildParameterSource::Source  >( action->data().toInt() );
  setSourceType( sourceType );
}