public ShaGenerator(IGraphRuntime runtime, HashAlgorithmType type) : base(runtime) { this.type = type; this.inputPin = AddInputPin("Input", PinDataTypeFactory.Create <object>(), PropertyMode.Never); this.hashPin = AddOutputPin("Hash", PinDataTypeFactory.Create <byte[]>()); }
public IFrameModuleBase(IGraphRuntime runtime) : base(runtime, ModuleKind.Iframe, DisplayMode.Expanded) { this.AddInputPin("Caption", PinDataTypeFactory.Create <string>(), PropertyMode.Always); this.AddInputPin("SourceUri", PinDataTypeFactory.Create <string>(), PropertyMode.Always); this.AddInputPin("Size", PinDataTypeFactory.Create <Int2>(new Int2(320, 240)), PropertyMode.Always); }
public ZipFunc(IGraphRuntime runtime) : base(runtime) { this.funcPin = AddInputPin("Function", PinDataTypeFactory.Create <Delegate>(), PropertyMode.Allow); this.dynamicInputPin = new DynamicInputPin(runtime, inputs, "Input", PinDataTypeFactory.Create <ISequence>()); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <object> >()); }
public UnaryOperation(IGraphRuntime runtime, string moduleType, Func <double, double> operation, string resultPinName = "Result", string operandPinName = "Operand") : base(runtime, ModuleKind.Module, DisplayMode.Expanded, moduleType) { this.operation = operation; this.operandPin = this.AddInputPin(operandPinName, PinDataTypeFactory.CreateFloat64(), PropertyMode.Never); this.resultPin = this.AddOutputPin(resultPinName, PinDataTypeFactory.CreateFloat64()); }
public Aggregate(IGraphRuntime runtime) : base(runtime, false, SUBGRAPH_SOURCE_PIN_ID, SUBGRAPH_ACCUMULATE_PIN_ID) { this.sourceInput = AddInputPin("Source", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never); this.seedInput = AddInputPin("Seed", PinDataTypeFactory.CreateAny(), PropertyMode.Allow); this.output = AddOutputPin("Output", PinDataTypeFactory.CreateAny()); this.subGraphInput = ((GenericOutputPin)this.subGraphInputModule.Outputs[SUBGRAPH_SOURCE_PIN_ID]); this.subGraphAccumulate = (GenericOutputPin)this.subGraphInputModule.Outputs[SUBGRAPH_ACCUMULATE_PIN_ID]; this.subGraphOutput = subGraph.OutputModule.DefaultInputPin; this.sourceInput.WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.FromType(typeof(ISequence <>)), true, pinDataType => { var genericType = pinDataType.UnderlyingType.GenericTypeArguments.FirstOrDefault() ?? typeof(object); subGraphInput.ChangeType(PinDataTypeFactory.FromType(genericType)); BuildGenericDelegate(); }); }); this.seedInput.WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.CreateAny(), false, pinDataType => { subGraphAccumulate.ChangeType(pinDataType); output.ChangeType(pinDataType); subGraphOutput.ChangeType(pinDataType); BuildGenericDelegate(); }); }); }
public SequenceToArray(IGraphRuntime runtime) : base(runtime, ModuleKind.Module, DisplayMode.Collapsed) { this.inputPin = AddInputPin("Sequence", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Allow); this.outputPin = AddOutputPin("Array", PinDataTypeFactory.FromType(typeof(object[]))); this.inputPin.WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.FromType(typeof(ISequence <>)), true, pinDataType => { var method = EvaluateInternalAttribute.GetMethod(GetType()).MakeGenericMethod(pinDataType.UnderlyingType); var genericType = pinDataType.UnderlyingType.GenericTypeArguments.FirstOrDefault() ?? pinDataType.UnderlyingType; if (genericType != null) { genericDelegate = new GenericDelegate <Func <object, object> >(this, EvaluateInternalAttribute.GetMethod(GetType()).MakeGenericMethod(genericType)); } else { genericDelegate = null; } outputPin.ChangeType(PinDataTypeFactory.FromType(genericType.MakeArrayType())); }); }); }
public ViewCurrent(IGraphRuntime runtime) : base(runtime, ModuleKind.ViewModule) { this.inputPin = AddInputPin("Input", PinDataTypeFactory.FromType(typeof(ISequence <string>), string.Empty, WellKnownEditors.Hidden, null, null), PropertyMode.Never); this.data = AddInputPin("data", PinDataTypeFactory.CreateString(), PropertyMode.Always); EnableVirtualOutputPin(); }
public PythonScriptModuleBase(IGraphRuntime runtime, ILoggerFactory loggerFactory, IPythonMainThread mainThread) : base(runtime, ModuleKind.ScriptModule) { logger = loggerFactory.CreateLogger <PythonScriptModuleBase>(); this.mainThread = mainThread; this.captionPin = this.AddInputPin("caption", PinDataTypeFactory.Create <string>(), PropertyMode.Always); this.functionNamePin = this.AddInputPin("functionName", PinDataTypeFactory.Create <string>(DEFAULT_FUNCTION_NAME), PropertyMode.Default); this.useMainThreadPin = this.AddInputPin("useMainThread", PinDataTypeFactory.Create <bool>(true), PropertyMode.Always); this.parserErrorPin = this.AddInputPin("parserError", PinDataTypeFactory.Create <Models.ExceptionModel>(null, WellKnownEditors.ExceptionViewer), PropertyMode.Always); var scriptSourcePinId = this.AddScriptSourcePin(); this.argumentPins = new List <GenericInputPin>(); this.resultPins = new List <GenericOutputPin>(); this.properties[scriptSourcePinId].WhenNodeEvent.OfType <PropertyChangedEvent>().Subscribe(evt => { logger.LogInformation("Script source changed"); UpdateSignatureSafe(); }); this.properties[functionNamePin.Id].WhenNodeEvent.OfType <PropertyChangedEvent>().Subscribe(evt => { logger.LogInformation("Function name changed"); UpdateSignatureSafe(); }); this.DynamicDisplayName = new DynamicDisplayNameFunc(FormatDisplayName); }
public Range(IGraphRuntime runtime) : base(runtime) { this.startPin = AddInputPin("Start", PinDataTypeFactory.CreateInt32(0), PropertyMode.Default); this.countPin = AddInputPin("Count", PinDataTypeFactory.CreateInt32(10), PropertyMode.Default); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <int> >()); }
public SelectMany(IGraphRuntime runtime) : base(runtime, false, PinDataTypeFactory.FromType(typeof(ISequence <>)), SUBGRAPH_SOURCE_PIN_ID) { this.inputPin = AddInputPin("Input", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never); this.sequentialPin = AddInputPin("Sequential", PinDataTypeFactory.Create <bool>(true), PropertyMode.Default); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <object> >()); this.maxConcurrencyPin = AddInputPin("MaxConcurrency", PinDataTypeFactory.Create <int>(8), PropertyMode.Default); this.subGraphSource = ((GenericOutputPin)this.subGraphInputModule.Outputs[SUBGRAPH_SOURCE_PIN_ID]); this.subGraphResult = this.SubGraph.OutputModule.DefaultInputPin; this.inputPin.WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.FromType(typeof(ISequence <>)), true, pinDataType => { var genericType = pinDataType.UnderlyingType.GenericTypeArguments.FirstOrDefault() ?? typeof(object); subGraphSource.ChangeType(PinDataTypeFactory.FromType(genericType)); BuildGenericDelegate(); }); }); this.subGraphResult.WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.FromType(typeof(ISequence <>)), true, pinDataType => { outputPin.ChangeType(pinDataType); BuildGenericDelegate(); }); }); }
public void Initialize(IGraphRuntime runtime) { runtime.ModuleFactory.RegisterAllModules(Assembly.GetExecutingAssembly()); StaticModules.Init( runtime.ServiceLocator.GetService <ILoggerFactory>(), runtime.ServiceLocator.GetService <IManagedConnection>(), runtime.ServiceLocator.GetService <RpcAdapter>(), runtime.ServiceLocator.GetService <IWorldViewClient>(), runtime.ServiceLocator.GetService <IRosClientLibrary>() ); var converter = new RoboticsMotionConverter(); foreach (var convert in converter.GetConverters()) { runtime.TypeConverters.AddConverter(convert); } //foreach (var c in converter.GetDynamicConverters()) // runtime.TypeConverters.AddDynamicConverter(c); foreach (var serializer in converter.GetSerializers()) { runtime.TypeSerializers.Add(serializer.Key, new SerializationFunctions { Serialize = serializer.Value.Item1, Deserialize = serializer.Value.Item2 }); } }
public void Initialize(IGraphRuntime runtime) { RunProcessModule.Init( runtime.ServiceLocator.GetService <ILoggerFactory>() ); VariableModules.Init(runtime); }
public Broadcast(IGraphRuntime runtime) : base(runtime) { this.inputPin = AddInputPin("Input", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never); this.dynamicOutputPin = new DynamicOutputPin(runtime, outputs, "Output", PinDataTypeFactory.FromType(typeof(ISequence <>))); this.inputPin.WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.FromType(typeof(ISequence <>)), true, pinDataType => { var genericType = pinDataType.UnderlyingType.GenericTypeArguments.FirstOrDefault(); if (genericType != null) { genericDelegate = new GenericDelegate <Func <object, object[]> >(this, EvaluateInternalAttribute.GetMethod(GetType()).MakeGenericMethod(genericType)); } else { genericDelegate = null; } foreach (var pin in dynamicOutputPin.Pins.OfType <IDataTypeChangeable>()) { pin.ChangeType(pinDataType); } }); }); }
public Take(IGraphRuntime runtime) : base(runtime) { this.inputPin = AddInputPin("Input", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never); this.countPin = AddInputPin("Count", PinDataTypeFactory.CreateInt32(5), PropertyMode.Default); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.FromType(typeof(ISequence <>))); this.inputPin.WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.FromType(typeof(ISequence <>)), true, pinDataType => { var genericType = pinDataType.UnderlyingType.GenericTypeArguments.FirstOrDefault(); if (genericType != null) { genericDelegate = new GenericDelegate <Func <object, object, object> >(this, EvaluateInternalAttribute.GetMethod(GetType()).MakeGenericMethod(genericType)); } else { genericDelegate = null; } outputPin.ChangeType(pinDataType); }); }); }
public SelectFunc(IGraphRuntime runtime) : base(runtime) { this.inputPin = AddInputPin("Input", PinDataTypeFactory.Create <ISequence>(), PropertyMode.Never); this.funcPin = AddInputPin("Function", PinDataTypeFactory.Create <Delegate>(), PropertyMode.Allow); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <object> >()); }
public Convert(IGraphRuntime runtime) : base(runtime) { this.inputPin = AddInputPin("Input", PinDataTypeFactory.CreateFloat64(), PropertyMode.Never); this.targetTypePin = AddInputPin("TargetType", PinDataTypeFactory.CreateEnum <ConvertTypeCode>(ConvertTypeCode.Float64), PropertyMode.Always); this.outputPin = AddOutputPin("Output", CreateTargetPinDataType(ConvertTypeCode.Float64)); this.inputPin.WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, CreateTargetPinDataType(ConvertTypeCode.Float64), false, pinDataType => { var genericInputType = pinDataType.UnderlyingType; BuildGenericDelegate(genericInputType, outputPin.DataType.UnderlyingType); }); }); this.properties[targetTypePin.Id].WhenNodeEvent.OfType <PropertyChangedEvent>().Subscribe(x => { var targetTypeCode = (ConvertTypeCode)x.Value.Value; IPinDataType targetPinDataType = CreateTargetPinDataType(targetTypeCode); var errors = outputPin.ChangeType(targetPinDataType); if (errors.Any()) { throw new AggregateException("One or more connections could not be reestablished after a data type change.", errors); } BuildGenericDelegate(inputPin.DataType.UnderlyingType, outputPin.DataType.UnderlyingType); }); }
public void Initialize(IGraphRuntime runtime) { //OpenCvExceptionContext.Reset(); runtime.ModuleFactory.RegisterAllModules(Assembly.GetExecutingAssembly()); var converter = new OpenCvConverter(); foreach (var convert in converter.GetConverters()) { runtime.TypeConverters.AddConverter(convert); } foreach (var c in converter.GetDynamicConverters()) { runtime.TypeConverters.AddDynamicConverter(c); } foreach (var serializer in converter.GetSerializers()) { runtime.TypeSerializers.Add(serializer.Key, new SerializationFunctions { Serialize = serializer.Value.Item1, Deserialize = serializer.Value.Item2 }); } }
public Fork(IGraphRuntime runtime) : base(runtime) { this.flowMode = FlowMode.WaitAny; this.AddInputPin("flowIn", PinDataTypeFactory.CreateFlow(), PropertyMode.Never); this.flowOutputs = new DynamicOutputPin(runtime, outputs, "Flow", PinDataTypeFactory.CreateFlow()); }
public Where(IGraphRuntime runtime) : base(runtime, false, PinDataTypeFactory.Create <bool>(), SUBGRAPH_SOURCE_PIN_ID) { this.inputPin = AddInputPin("Input", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <object> >()); this.subGraphSource = ((GenericOutputPin)this.subGraphInputModule.Outputs[SUBGRAPH_SOURCE_PIN_ID]); this.subGraphResult = this.SubGraph.OutputModule.DefaultInputPin; this.inputPin.WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.FromType(typeof(ISequence <>)), true, pinDataType => { var genericType = pinDataType.UnderlyingType.GenericTypeArguments.FirstOrDefault() ?? typeof(object); subGraphSource.ChangeType(PinDataTypeFactory.FromType(genericType)); var outputType = PinDataTypeFactory.FromType(typeof(ISequence <>).MakeGenericType(genericType)); if (outputPin.DataType.UnderlyingType != outputType.UnderlyingType) { outputPin.ChangeType(outputType); } genericDelegate = new GenericDelegate <Func <object, object, object> >(this, EvaluateInternalAttribute.GetMethod(GetType()).MakeGenericMethod(genericType)); }); }); }
public ViewMat(IGraphRuntime runtime) : base(runtime) { this.PreviewGenerator = new OpenCvPreviewGenerator(runtime) { IgnoreEmptyOutputs = true }; }
public ViewImage(IGraphRuntime runtime) : base(runtime) { this.PreviewGenerator = new ImageBufferPreviewGenerator(runtime) { IgnoreEmptyOutputs = true }; }
public GaussianRandomSequence(IGraphRuntime runtime) : base(runtime) { this.seedPin = AddInputPin("Seed", PinDataTypeFactory.Create <int?>(null, WellKnownEditors.IntNumber), PropertyMode.Default); this.muPin = AddInputPin("µ", PinDataTypeFactory.Create <double>(0, WellKnownEditors.FloatNumber), PropertyMode.Default); this.sigmaPin = AddInputPin("σ", PinDataTypeFactory.Create <double>(1, WellKnownEditors.FloatNumber), PropertyMode.Default); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <double> >()); }
public SelectManyFunc(IGraphRuntime runtime) : base(runtime) { inputPin = AddInputPin("Input", PinDataTypeFactory.Create <ISequence>(), PropertyMode.Never); funcPin = AddInputPin("Function", PinDataTypeFactory.Create <Delegate>(), PropertyMode.Allow); sequentialPin = AddInputPin("Sequential", PinDataTypeFactory.Create <bool>(true), PropertyMode.Default); outputPin = AddOutputPin("Output", PinDataTypeFactory.Create <ISequence <object> >()); }
public CreateArray(IGraphRuntime runtime) : base(runtime) { this.dynamicInputPin = new DynamicInputPin(runtime, inputs, "Input", PinDataTypeFactory.CreateAny(), OnDynamicInputAdd) { ForceAutoId = true }; this.output = AddOutputPin("Output", PinDataTypeFactory.FromType(typeof(Array))); }
public Merge(IGraphRuntime runtime) : base(runtime) { this.dynamicInputPin = new DynamicInputPin(runtime, inputs, "Input", PinDataTypeFactory.FromType(typeof(ISequence <>)), OnDynamicInputAdd) { Renameable = true }; this.outputPin = AddOutputPin("Output", PinDataTypeFactory.FromType(typeof(ISequence <>))); }
public SaveImage(IGraphRuntime runtime) : base(runtime) { this.PreviewGenerator = new OpenCvPreviewGenerator(runtime) { IgnoreEmptyOutputs = true }; EnableVirtualOutputPin(); }
public SequenceEqual(IGraphRuntime runtime) : base(runtime) { this.firstInputPin = AddInputPin("First", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never); this.secondInputPin = AddInputPin("Second", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never); this.outputPin = AddOutputPin("Result", PinDataTypeFactory.CreateBoolean()); this.firstInputPin.WhenNodeEvent.Subscribe(HandleInputPinEvent); this.secondInputPin.WhenNodeEvent.Subscribe(HandleInputPinEvent); }
public WriteFile(IGraphRuntime runtime) : base(runtime) { pathPin = this.AddInputPin("fileName", PinDataTypeFactory.Create <string>(string.Empty, WellKnownEditors.FileSelector), PropertyMode.Default, flags: PinFlags.ResolvePath); modePin = this.AddInputPin("mode", PinDataTypeFactory.CreateEnum(WriteFileMode.OverwriteOrCreate, WellKnownEditors.DropDown), PropertyMode.Default); writablePin = this.AddInputPin("writable", PinDataTypeFactory.Create <IWritable>(), PropertyMode.Never); appendGuidPin = this.AddInputPin("appendGuid", PinDataTypeFactory.CreateBoolean(false), PropertyMode.Default); createDirectoryPin = this.AddInputPin("createDirectory", PinDataTypeFactory.CreateBoolean(false), PropertyMode.Default); EnableVirtualOutputPin(); }
public void Initialize(IGraphRuntime runtime) { ROS.RegisterMessageAssembly(Assembly.GetExecutingAssembly()); runtime.ModuleFactory.RegisterAllModules(Assembly.GetExecutingAssembly()); StaticModules.Init( runtime.ServiceLocator.GetService <ILoggerFactory>(), runtime.ServiceLocator.GetService <IRosClientLibrary>() ); }
public Count(IGraphRuntime runtime) : base(runtime) { this.inputPin = AddInputPin("Input", PinDataTypeFactory.FromType(typeof(ISequence <>)), PropertyMode.Never); this.outputPin = AddOutputPin("Output", PinDataTypeFactory.CreateInt32()); this.inputPin.WhenNodeEvent.Subscribe(evt => { PinConnectionChangeEventHandler.ConnectionSensitivePinDataType(evt, PinDataTypeFactory.FromType(typeof(ISequence <>)), true); }); }