Example #1
0
        public static object BindTo(this IComponentIntrospect component, string name)
        {
            var type   = typeof(solar);
            var method = type.GetMethod("bindTo_" + name, BindingFlags.Public | BindingFlags.Static);

            Assert.IsNotNull(method);
            return(method.Invoke(null, new[] { component }));
        }
Example #2
0
        public static IOpticalFlowEstimator bindTo_IOpticalFlowEstimator(IComponentIntrospect component)
        {
            global::System.IntPtr cPtr = solarPINVOKE.bindTo_IOpticalFlowEstimator(IComponentIntrospect.getCPtr(component));
            IOpticalFlowEstimator ret  = (cPtr == global::System.IntPtr.Zero) ? null : new IOpticalFlowEstimator(cPtr, true);

            if (solarPINVOKE.SWIGPendingException.Pending)
            {
                throw solarPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Example #3
0
        public static IMatchesOverlay bindTo_IMatchesOverlay(IComponentIntrospect component)
        {
            global::System.IntPtr cPtr = solarPINVOKE.bindTo_IMatchesOverlay(IComponentIntrospect.getCPtr(component));
            IMatchesOverlay       ret  = (cPtr == global::System.IntPtr.Zero) ? null : new IMatchesOverlay(cPtr, true);

            if (solarPINVOKE.SWIGPendingException.Pending)
            {
                throw solarPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Example #4
0
        public static I3DTransformFinderFrom2D3D bindTo_I3DTransformFinderFrom2D3D(IComponentIntrospect component)
        {
            global::System.IntPtr      cPtr = solarPINVOKE.bindTo_I3DTransformFinderFrom2D3D(IComponentIntrospect.getCPtr(component));
            I3DTransformFinderFrom2D3D ret  = (cPtr == global::System.IntPtr.Zero) ? null : new I3DTransformFinderFrom2D3D(cPtr, true);

            if (solarPINVOKE.SWIGPendingException.Pending)
            {
                throw solarPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Example #5
0
        public static IHomographyValidation bindTo_IHomographyValidation(IComponentIntrospect component)
        {
            global::System.IntPtr cPtr = solarPINVOKE.bindTo_IHomographyValidation(IComponentIntrospect.getCPtr(component));
            IHomographyValidation ret  = (cPtr == global::System.IntPtr.Zero) ? null : new IHomographyValidation(cPtr, true);

            if (solarPINVOKE.SWIGPendingException.Pending)
            {
                throw solarPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Example #6
0
        public static I2D3DCorrespondencesFinder bindTo_I2D3DCorrespondencesFinder(IComponentIntrospect component)
        {
            global::System.IntPtr      cPtr = solarPINVOKE.bindTo_I2D3DCorrespondencesFinder(IComponentIntrospect.getCPtr(component));
            I2D3DCorrespondencesFinder ret  = (cPtr == global::System.IntPtr.Zero) ? null : new I2D3DCorrespondencesFinder(cPtr, true);

            if (solarPINVOKE.SWIGPendingException.Pending)
            {
                throw solarPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Example #7
0
        public static ISinkPoseImage bindTo_ISinkPoseImage(IComponentIntrospect component)
        {
            global::System.IntPtr cPtr = solarPINVOKE.bindTo_ISinkPoseImage(IComponentIntrospect.getCPtr(component));
            ISinkPoseImage        ret  = (cPtr == global::System.IntPtr.Zero) ? null : new ISinkPoseImage(cPtr, true);

            if (solarPINVOKE.SWIGPendingException.Pending)
            {
                throw solarPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Example #8
0
        public static IUndistortPoints bindTo_IUndistortPoints(IComponentIntrospect component)
        {
            global::System.IntPtr cPtr = solarPINVOKE.bindTo_IUndistortPoints(IComponentIntrospect.getCPtr(component));
            IUndistortPoints      ret  = (cPtr == global::System.IntPtr.Zero) ? null : new IUndistortPoints(cPtr, true);

            if (solarPINVOKE.SWIGPendingException.Pending)
            {
                throw solarPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Example #9
0
        public static T CastTo <T>(this IComponentIntrospect from, bool cMemoryOwn = false)
        {
            var        type    = typeof(IComponentIntrospect);
            MethodInfo getCPtr = type.GetMethod("getCPtr", BindingFlags.NonPublic | BindingFlags.Static);

            Assert.IsNotNull(getCPtr);
            FieldInfo swigCMemOwnBase = type.GetField("swigCMemOwnBase", BindingFlags.NonPublic | BindingFlags.Instance);

            Assert.IsNotNull(swigCMemOwnBase);
            //cMemoryOwn = (bool) swigCMemOwnBase.GetValue(from);
            swigCMemOwnBase.SetValue(from, false);
            var cptr = (HandleRef)getCPtr.Invoke(null, new object[] { from });

            return((T)Activator.CreateInstance
                   (
                       typeof(T),
                       BindingFlags.NonPublic | BindingFlags.Instance,
                       null,
                       new object[] { cptr.Handle, cMemoryOwn },
                       null
                   ));
        }
Example #10
0
    protected void OnGUI()
    {
        if (isOpenUUID = GUILayout.Toggle(isOpenUUID, "UUID"))
        {
            DictGui("Modules", ComponentExtensions.modulesDict);
            DictGui("Interfaces", ComponentExtensions.interfacesDict);
            DictGui("Components", ComponentExtensions.componentsDict);
        }

        using (new GUILayout.HorizontalScope())
        {
            if (GUILayout.Button("getManager"))
            {
                xpcfComponentManager = xpcf_api.getComponentManagerInstance().AddTo(subscriptions);
            }
            GUILayout.Toggle(xpcfComponentManager != null, "OK");
            if (GUILayout.Button("load"))
            {
                var path = conf.path;
                Debug.Log(path);
                Debug.Log(xpcfComponentManager.load(path));
            }
            if (GUILayout.Button("clear"))
            {
                xpcfComponentManager.clear();
            }
        }
        using (new GUILayout.HorizontalScope("Metadata", GUI.skin.window))
        {
            if (GUILayout.Button("getModulesMD"))
            {
                using (var modules = xpcfComponentManager.getModulesMetadata())
                {
                    Debug.Log(modules);
                    Debug.Log(modules.size());
                    using (var e = modules.getEnumerator())
                    {
                        while (e.MoveNext())
                        {
                            using (var m = e.current())
                            {
                                Debug.LogFormat("{0}: {1} : {2}", m.name(), m.getPath(), m.description());
                            }
                        }
                    }
                }
            }
            if (GUILayout.Button("getInterfacesMD"))
            {
                using (var interfaces = xpcfComponentManager.getInterfacesMetadata())
                {
                    Debug.Log(interfaces);
                    Debug.Log(interfaces.size());
                    using (var e = interfaces.getEnumerator())
                    {
                        while (e.MoveNext())
                        {
                            using (var i = e.current())
                            {
                                //Debug.Log(i.getUUID());
                                Debug.LogFormat("{0}: {1}", i.name(), i.description());
                            }
                        }
                    }
                }
            }
            if (GUILayout.Button("findComponentMD(UUID)"))
            {
                using (var x = xpcfComponentManager.findComponentMetadata(UUID)) Debug.Log(x);
            }
            if (GUILayout.Button("findInterfaceMD(UUID)"))
            {
                using (var x = xpcfComponentManager.findInterfaceMetadata(UUID)) Debug.Log(x);
            }
            if (GUILayout.Button("findModuleMD(UUID)"))
            {
                using (var x = xpcfComponentManager.findModuleMetadata(UUID)) Debug.Log(x);
            }
            if (GUILayout.Button("getModuleUUID(UUID)"))
            {
                using (var x = xpcfComponentManager.getModuleUUID(UUID)) Debug.Log(x);
            }
        }
        uuid = GUILayout.TextField(uuid);
        if (GUILayout.Button("createComponent(UUID)"))
        {
            xpcfComponent = xpcfComponentManager.createComponent(UUID).AddTo(subscriptions);
        }
        GUILayout.Toggle(xpcfComponent != null, "OK");
        using (new GUILayout.HorizontalScope("IComponentIntrospect", GUI.skin.window))
        {
            if (GUILayout.Button("getNbInterfaces"))
            {
                Debug.Log(xpcfComponent.getNbInterfaces());
            }
            if (GUILayout.Button("getInterfaces"))
            {
                using (var interfaces = xpcfComponent.getInterfaces())
                {
                    Debug.Log(interfaces.size());
                    using (var e = interfaces.getEnumerator())
                    {
                        while (e.MoveNext())
                        {
                            using (var i = e.current())
                            {
                                Debug.Log(xpcfComponent.getDescription(i));
                            }
                        }
                    }
                }
            }
            if (GUILayout.Button("implements(UUID)"))
            {
                Debug.Log(xpcfComponent.implements(UUID));
            }
            if (GUILayout.Button("getDescription(UUID)"))
            {
                Debug.Log(xpcfComponent.getDescription(UUID));
            }
        }
        using (new GUILayout.HorizontalScope("bindTo", GUI.skin.window))
        {
            if (GUILayout.Button("bindTo<ICamera>"))
            {
                iCamera = xpcfComponent.BindTo <ICamera>().AddTo(subscriptions);
            }
            //if (GUILayout.Button("queryInterface TODO"))
            //{
            //    xpcfComponent = xpcfComponent.queryInterface(UUID);
            //}
        }
        GUILayout.Toggle(iCamera != null, "OK");
        using (new GUILayout.HorizontalScope("ICamera", GUI.skin.window))
        {
            if (GUILayout.Button("start"))
            {
                Debug.Log(iCamera.start());
            }
            if (GUILayout.Button("getDistorsionParameters"))
            {
                using (var x = iCamera.getDistorsionParameters()) { Debug.Log(x); }
            }
            if (GUILayout.Button("getIntrinsicsParameters"))
            {
                using (var x = iCamera.getIntrinsicsParameters()) { Debug.Log(x); }
            }
            if (GUILayout.Button("getResolution"))
            {
                using (var size = iCamera.getResolution())
                {
                    Debug.LogFormat("{0} x {1}", size.width, size.height);
                }
            }
            if (GUILayout.Button("getNextImage"))
            {
                Debug.Log(iCamera.getNextImage(image));
            }
        }
        GUILayout.Toggle(image != null, "OK");
        using (new GUILayout.HorizontalScope("Image", GUI.skin.window))
        {
            if (GUILayout.Button("getWidth"))
            {
                Debug.Log(image.getWidth());
            }
            if (GUILayout.Button("getHeight"))
            {
                Debug.Log(image.getHeight());
            }
            if (GUILayout.Button("getNbChannels"))
            {
                Debug.Log(image.getNbChannels());
            }
            if (GUILayout.Button("getSize"))
            {
                using (var size = image.getSize()) Debug.LogFormat("{0} x {1}", size.width, size.height);
            }
            if (GUILayout.Button("getNbBitsPerComponent"))
            {
                Debug.Log(image.getNbBitsPerComponent());
            }
            if (GUILayout.Button("getBufferSize"))
            {
                Debug.Log(image.getBufferSize());
            }
            if (GUILayout.Button("getDataType"))
            {
                Debug.Log(image.getDataType());
            }
            if (GUILayout.Button("getImageLayout"))
            {
                Debug.Log(image.getImageLayout());
            }
            if (GUILayout.Button("getPixelOrder"))
            {
                Debug.Log(image.getPixelOrder());
            }
        }
        using (new GUILayout.HorizontalScope("Texture", GUI.skin.window))
        {
            if (GUILayout.Button("new"))
            {
                if (tex != null)
                {
                    Destroy(tex);
                }
                var w = (int)image.getWidth();
                var h = (int)image.getHeight();
                Assert.AreEqual(3, image.getNbChannels());
                Assert.AreEqual(8, image.getNbBitsPerComponent());
                Assert.AreEqual(Image.DataType.TYPE_8U, image.getDataType());
                Assert.AreEqual(Image.ImageLayout.LAYOUT_BGR, image.getImageLayout());
                Assert.AreEqual(Image.PixelOrder.INTERLEAVED, image.getPixelOrder());
                tex = new Texture2D(w, h, TextureFormat.RGB24, false);
            }
            if (GUILayout.Button("LoadRawTextureData"))
            {
                tex.LoadRawTextureData(image.data(), (int)image.getBufferSize());
            }
            if (GUILayout.Button("Apply"))
            {
                tex.Apply();
            }
        }
        if (tex != null)
        {
            GUILayout.Label(tex);
        }
    }
Example #11
0
 public static T BindTo <T>(this IComponentIntrospect component) where T : class
 {
     return((T)component.BindTo(typeof(T).Name));
 }
Example #12
0
        public static IDescriptorsExtractorSBPattern bindTo_IDescriptorsExtractorSBPattern(IComponentIntrospect component)
        {
            global::System.IntPtr          cPtr = solarPINVOKE.bindTo_IDescriptorsExtractorSBPattern(IComponentIntrospect.getCPtr(component));
            IDescriptorsExtractorSBPattern ret  = (cPtr == global::System.IntPtr.Zero) ? null : new IDescriptorsExtractorSBPattern(cPtr, true);

            if (solarPINVOKE.SWIGPendingException.Pending)
            {
                throw solarPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Example #13
0
    protected void OnGUI()
    {
        using (new GUILayout.HorizontalScope(GUI.skin.box, GUILayout.ExpandWidth(true)))
        {
            if (guiComponents != null)
            {
                using (GUIScope.ChangeCheck)
                {
                    idComponent = GUILayout.SelectionGrid(idComponent, guiComponents, 1, GUILayout.Width(200));
                    if (GUI.changed)
                    {
                        xpcfComponent = xpcfComponents[idComponent];

                        /*
                         * foreach (var uuid in xpcfComponent.getInterfaces())
                         * {
                         *  Debug.Log(xpcfComponent.getDescription(uuid));
                         *  //var metadata = xpcfManager.findInterfaceMetadata(uuid);
                         *  //Debug.Log(metadata.name());
                         *  //Debug.Log(metadata.description());
                         * }
                         */
                        /*
                         * xpcfInterfaces = xpcfComponent.getInterfaces().ToArray();
                         * guiInterfaces = xpcfInterfaces
                         *  .Select(xpcfComponent.getDescription)
                         *  .Select(s => new GUIContent("", s))
                         *  .ToArray();
                         */

                        xpcfConfigurable = xpcfComponent.implements(configurableUUID) ? xpcfComponent.BindTo <IConfigurable>() : null;
                    }
                }
            }

            /*
             * if (guiInterfaces != null)
             * {
             *  using (GUITools.ChangeCheckScope)
             *  {
             *      idInterface = GUILayout.SelectionGrid(idInterface, guiInterfaces, 1);
             *      if (GUI.changed)
             *      {
             *          var uuid = xpcfInterfaces[idInterface];
             *
             *          //var xpcfInstance = xpcfComponent.bindTo("");
             *          guiInterfaces = xpcfComponent.getInterfaces()
             *              .Select(xpcfComponent.getDescription)
             *              .Select(s => new GUIContent("", s))
             *              .ToArray();
             *      }
             *  }
             * }
             */
            if (xpcfConfigurable == null)
            {
                GUILayout.Label("This component is not IConfigurable");
            }
            else
            {
                using (new GUILayout.VerticalScope(GUI.skin.box))
                {
                    foreach (var p in xpcfConfigurable.getProperties())
                    {
                        var    access = p.getAccessSpecifier();
                        var    type   = p.getType();
                        object value  = access.CanRead() ? p.Get() : type.Default();

                        using (new GUILayout.HorizontalScope())
                        {
                            GUILayout.Label(p.getName(), GUILayout.Width(200));
                            using (GUIScope.ChangeCheck)
                            {
                                value = type.OnGUI(value);
                                if (access.CanWrite() && GUI.changed)
                                {
                                    p.Set(value);
                                }
                            }
                        }
                    }
                }
            }
        }
    }