Beispiel #1
0
 public void RemoveAtom(AtomEntity atom, bool queryUser)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Beispiel #2
0
 public void ChangeAtomElement(AtomEntity atom, string newChemSymbol)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Beispiel #3
0
        public void OnNewDataSource(IAtom[] atoms, IBond[] bonds, Vector3 origin, Bounds3D bounds)
        {
            sceneGraph = new OcTree <ChemEntity>((int)bounds.radius * 2, -bounds.min);

            /*screenEntities.Add(new BondAngle(device, atoms[0], atoms[1], atoms[2]));
             * screenEntities[0].Init(device);
             *
             * postSceneWorldEntities.Add(new BoundingBoxEntity(new BoundingBox(bounds.min, bounds.max), false, Color.LightGray.ToArgb()));
             * postSceneWorldEntities[0].Init(device);
             * postSceneWorldEntities.Add(new SphereAxis3D());
             * postSceneWorldEntities[1].Init(device);*/

            sceneGraphEntities = sceneGraph.SceneItems;

            // create molecule entities
            foreach (IAtom atom in atoms)
            {
                AtomEntity aentity = AtomEntity.BuildEntity(atom);
                sceneGraph.Insert(aentity);

                /*ScreenLabelVSpaceEntity entity = new ScreenLabelVSpaceEntity(atom.ID + ":" + aentity.UId.ToString(), (Vector3)aentity.Position3D);
                 * entity.Init(device);
                 * screenEntities.Add(entity);*/
                /*AtomSymbolEntity entity = new AtomSymbolEntity(aentity);
                 * entity.Init(device);
                 * postSceneViewEntities.Add(entity);*/
            }

            //foreach (IBond bond in bonds)
            //{
            //sceneGraph.Insert(new BondE);
            //}

            scheme.SetOutputDescription(coDesc);
            scheme.SetupScene(origin, bounds.radius);

            // pass throught scheme & effects
            IGeometryCreator[] schStreams = scheme.GetAtomStreams();
            DataFields[]       efxFields  = null;
            //effect.DesiredData(out efxFields, false);

            DataFields[][] allStreams = new DataFields[1 + (efxFields != null ? 1 : 0)][];
            //if (efxFields != null)
            //    allStreams[1] = efxFields;
            if (scheme.HandlesAtoms && atoms != null)
            {
                GeomDataBufferStream[] geomStream = new GeomDataBufferStream[schStreams.Length];
                for (int i = 0; i < geomStream.Length; i++)
                {
                    allStreams[0] = schStreams[i].Fields;
                    GeomDataTransformer.CreateBufferStream(allStreams, out geomStream[i]);
                }
                // fill buffer stream
                scheme.SetAtomData(atoms, geomStream);
            }

            schStreams = scheme.GetBondStreams();
            if (scheme.HandlesBonds && bonds != null)
            {
                GeomDataBufferStream[] geomStream = new GeomDataBufferStream[schStreams.Length];
                for (int i = 0; i < geomStream.Length; i++)
                {
                    allStreams[0] = schStreams[i].Fields;
                    GeomDataTransformer.CreateBufferStream(allStreams, out geomStream[i]);
                }
                // fill buffer stream
                scheme.SetBondData(bonds, geomStream);
            }
        }