private void optCloseVisit()
 {
     if (!empty)
     {
         sendVisitEvent(VisitEvent.visitEnd);
         callbackTray = null;
     }
 }
        public DustProcVisitProcess(DustSession session, DustInfoTray tray)
        {
            this.session        = session;
            this.infoTray       = tray;
            this.visitTray      = tray as DustVisitTray;
            callbackTray        = (null == visitTray) ? new DustVisitTray(tray, null) : new DustVisitTray(visitTray);
            callbackTray.entity = session.resolveEntity(tray.entity);

            empty = true;

            dip = tray.value as DustInfoProcessor;
//			dif = tray.value as DustInfoFilter;
            dvp = tray.value as DustVisitor;
        }
Esempio n. 3
0
        public static void Main(string[] args)
        {
            DustSystem.initKernel(args);

            var module   = "GeoTest02";
            var entityId = "23";

            Console.WriteLine("Connecting to server...");

            Task <DustEntity> t = DustCommConnectorHttp.loadRemote("localhost", module, entityId);

            t.Wait();
            DustEntity e = t.Result;

            DustEntity e1 = DustSystem.getSystem().getEntity(module, "16");

            var draw = new DrawVisitor();
            var vt   = new DustVisitTray(e, draw);

//			vt.cmd = VisitCommand.visitAtts | VisitCommand.recEntityOnce;
            vt.cmd = VisitCommand.visitAllData | VisitCommand.recPathOnce;
//			vt.cmd = VisitCommand.visitRefs | VisitCommand.recEntityOnce;
//			Console.WriteLine("heh? {0}", vt.cmd);
            Dust.Dust.access(DustAccessCommand.visit, vt);

            ShapeSource s = draw.getLastObject <ShapeSource>();

            var a  = Assembly.LoadFrom("bin\\csharp\\DustGui.dll");
            var tt = a.GetType("Dust.Gui.MyClass");
            var mc = Activator.CreateInstance(tt);

            var m = tt.GetMethod("testFunction");

            m.Invoke(mc, null);

            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
Esempio n. 4
0
        public void processVisitEvent(VisitEvent visitEvent, DustVisitTray tray)
        {
            int    kfi = kf.indexOf((DustEntity)tray.key);
            object kfk = kf.keyOf(kfi);

//			Console.WriteLine("DrawVisitor processVisitEvent {0} - {1}", visitEvent, tray.value);
//			return;

            switch (visitEvent)
            {
            case VisitEvent.entityStartOpt:
                DustEntity pt = DustUtils.getValue(tray.entity, (DustEntity)null, DataLinks.EntityPrimaryType);
                if (OB_TYPES.ContainsKey(pt))
                {
                    tray.readerObject = Activator.CreateInstance(OB_TYPES[pt]);
                    var geo = tray.readerObject as GeometricData;
                    if (null != geo)
                    {
                        readingGeoData = geo;
                    }
                }
                break;

            case VisitEvent.keyStartOpt:
                if (-1 == kfi)
                {
                    tray.resp = VisitResponse.skip;
                }
                else
                {
                    if (COORDS.Contains(kfk))
                    {
                        readingCoord = (GeometryValues)kfk;
                    }
                    else if (ROLES.Contains(kfk))
                    {
                        readingRole = (GeometryValues)kfk;
                    }

                    Console.WriteLine("Entering {0} ", kf.keyOf(kfi));
                }
                break;

            case VisitEvent.keyEnd:
                if (CollectionLinks.SequenceMembers == kfk)
                {
                    var sp = tray.readerParent as ShapePath;
                    if (null != sp)
                    {
                        sp.Add((GeometricData)tray.readerObject);
                    }

                    var sc = tray.readerParent as ShapeComposite;
                    if (null != sc)
                    {
                        sc.Add((GeometricInclusion)tray.readerObject);
                    }
                }
                else if (GeometryLinks.GeometricInclusionTarget == kfk)
                {
                    var gi = tray.readerParent as GeometricInclusion;
                    if (null != gi)
                    {
                        gi.target = (ShapeSource)tray.readerObject;
                    }
                }
                else if (GeometryLinks.GeometricInclusionParameters == kfk)
                {
                    var gi = tray.readerParent as GeometricInclusion;

                    if ((null != gi) && (readingRole != null))
                    {
                        gi[readingRole] = (GeometricData)tray.readerObject;
                    }
                }

                Console.WriteLine("Leaving {0} ", kf.keyOf(kfi));
                break;

            case VisitEvent.entityEnd:
                if (null != tray.readerObject)
                {
                    lastReadObject = tray.readerObject;
                }
                break;
            }
        }
 public VisitContext(DustVisitTray tray)
 {
     this.tray = tray;
 }