Exemplo n.º 1
0
        public ProbesDataSource(Guid guid, PointSet pointSet, Host host)
            : base(guid)
        {
            // set up the Ontology, a description of the kind of data we contain.
            // See DataSource sample for more details.
            OntologySpecification o = this.Ontology.Edit();

            o.PrimitiveTypes.Create("RasterPatch", "GeoEntity", typeof(RasterPatch2));
            this.UpdateOntology(o);

            EntitySpecification entitySpec = new EntitySpecification(this.Ontology.EntityTypes["GeoEntity"]); // the default entity type

            entity = this.EntityAuthorityReference.EntityAuthority.CreateEntity(true, entitySpec);

            this.pointSet = pointSet;

            if (pointSet.Metadata.ContainsKey("ProbePicture"))
            {
                probesHelper = new ProbesHelper(pointSet.Metadata["ProbePicture"], true);
            }
            else
            {
                probesHelper = new ProbesHelper("ProbeSample.png", false);
            }

            this.host = host;

            dataType = DSDataType.Table;
        }
        public TrajectoriesDataSource(Host host, PointSet data)
            : base(Guid.NewGuid())
        {
            this.pointSet = data;
            this.host     = host;

            if (pointSet.Metadata.ContainsKey("ProbePicture"))
            {
                probesHelper = new ProbesHelper(pointSet.Metadata["ProbePicture"], true);
            }
            else
            {
                probesHelper = new ProbesHelper("ProbeSample.png", false);
            }

            // set up the Ontology, a description of the kind of data we contain.
            // See DataSource sample for more details.
            OntologySpecification o = this.Ontology.Edit();

            o.PrimitiveTypes.Create("RasterPatch", "GeoEntity", typeof(RasterPatch2));

            this.UpdateOntology(o);

            EntitySpecification entitySpec = new EntitySpecification(this.Ontology.EntityTypes["GeoEntity"]);

            entity = this.EntityAuthorityReference.EntityAuthority.CreateEntity(true, entitySpec);
        }
Exemplo n.º 3
0
        public ProbesDataSource(Guid guid, IDataSource2D <double> field, Host host)
            : base(guid)
        {
            // set up the Ontology, a description of the kind of data we contain.
            // See DataSource sample for more details.
            OntologySpecification o = this.Ontology.Edit();

            o.PrimitiveTypes.Create("RasterPatch", "GeoEntity", typeof(RasterPatch2));
            this.UpdateOntology(o);

            EntitySpecification entitySpec = new EntitySpecification(this.Ontology.EntityTypes["GeoEntity"]); // the default entity type

            entity = this.EntityAuthorityReference.EntityAuthority.CreateEntity(true, entitySpec);

            this.wfield = field;

            System.Windows.Point[,] grid = wfield.Grid;
            Coordinate2D minCoordinate = new Coordinate2D(grid[0, 0].X, grid[0, 0].Y);
            Coordinate2D maxCoordinate = new Coordinate2D(grid[field.Width - 1, field.Height - 1].X, grid[field.Width - 1, field.Height - 1].Y);


            for (int j = 0; j < field.Height; j++)
            {
                for (int i = 0; i < field.Width; i++)
                {
                    if (grid[i, j].X < minCoordinate.X)
                    {
                        minCoordinate.X = grid[i, j].X;
                    }

                    if (grid[i, j].X > maxCoordinate.X)
                    {
                        maxCoordinate.X = grid[i, j].X;
                    }

                    if (grid[i, j].Y < minCoordinate.Y)
                    {
                        minCoordinate.Y = grid[i, j].Y;
                    }

                    if (grid[i, j].Y > maxCoordinate.Y)
                    {
                        maxCoordinate.Y = grid[i, j].Y;
                    }
                }
            }

            gridBox = new GeoRect(
                minCoordinate.X,
                minCoordinate.Y,
                maxCoordinate.X - minCoordinate.X,
                maxCoordinate.Y - minCoordinate.Y);

            dataType  = DSDataType.TwoDim;
            this.host = host;

            probesHelper = new ProbesHelper("ProbeSample.png", false);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets the by specification.
        /// </summary>
        /// <param name="spec">The spec.</param>
        /// <returns>The entities.</returns>
        public IEnumerable <ContactModel> GetBySpecification(EntitySpecification <ContactModel> spec)
        {
            //return dbSet.Where(p => spec.IsSatisfiedBy(p));
            var contacts = new List <ContactModel>();

            foreach (var contact in dbSet.ToList())
            {
                if (spec.IsSatisfiedBy(contact))
                {
                    contacts.Add(contact);
                }
            }
            return(contacts);
        }
Exemplo n.º 5
0
        public async Task IndexClothesAsync()
        {
            var clothes = _data.Categories.WomensClothing;
            var actual  = await _controller.IndexAsync(clothes.Id, null);

            var spec           = new EntitySpecification <Category>(clothes.Id);
            var flatCategories = await _service.EnumerateHierarchyAsync(spec);

            var expected = new IndexViewModel <CategoryViewModel>(1,
                                                                  GetPageCount(flatCategories.Count(), DefaultSettings.DefaultTake),
                                                                  flatCategories.Count(),
                                                                  (from c in flatCategories select new CategoryViewModel(c)));

            Equal(expected, actual);
        }
        public ColorMapDataSource(WarpedDataSource2D<double> field, Host host, double minT, double maxT)
            : base(Guid.NewGuid())
        {
            OntologySpecification o = this.Ontology.Edit();
            o.PrimitiveTypes.Create("RasterPatch", "GeoEntity", typeof(RasterPatch2));
            this.UpdateOntology(o);

            EntitySpecification entitySpec = new EntitySpecification(this.Ontology.EntityTypes["GeoEntity"]); // the default entity type
            entity = this.EntityAuthorityReference.EntityAuthority.CreateEntity(true, entitySpec);

            this.host = host;
            this.wfield = field;

            this.minT = minT;
            this.maxT = maxT;

            //colorMapHelper = new ColorMapHelper(field, null);
            isWarped = true;
        }
Exemplo n.º 7
0
        public ColorMapDataSource(WarpedDataSource2D <double> field, Host host, double minT, double maxT)
            : base(Guid.NewGuid())
        {
            OntologySpecification o = this.Ontology.Edit();

            o.PrimitiveTypes.Create("RasterPatch", "GeoEntity", typeof(RasterPatch2));
            this.UpdateOntology(o);

            EntitySpecification entitySpec = new EntitySpecification(this.Ontology.EntityTypes["GeoEntity"]); // the default entity type

            entity = this.EntityAuthorityReference.EntityAuthority.CreateEntity(true, entitySpec);

            this.host   = host;
            this.wfield = field;

            this.minT = minT;
            this.maxT = maxT;

            //colorMapHelper = new ColorMapHelper(field, null);
            isWarped = true;
        }
        public TrajectoriesDataSource(Host host, PointSet data)
            : base(Guid.NewGuid())
        {
            this.pointSet = data;
            this.host = host;

            if (pointSet.Metadata.ContainsKey("ProbePicture"))
                probesHelper = new ProbesHelper(pointSet.Metadata["ProbePicture"], true);
            else
                probesHelper = new ProbesHelper("ProbeSample.png", false);

            // set up the Ontology, a description of the kind of data we contain.
            // See DataSource sample for more details.
            OntologySpecification o = this.Ontology.Edit();
            o.PrimitiveTypes.Create("RasterPatch", "GeoEntity", typeof(RasterPatch2));

            this.UpdateOntology(o);

            EntitySpecification entitySpec = new EntitySpecification(this.Ontology.EntityTypes["GeoEntity"]);
            entity = this.EntityAuthorityReference.EntityAuthority.CreateEntity(true, entitySpec);

        }
Exemplo n.º 9
0
 public static IRuleBuilderOptions <T, TProperty> IsValid <T, TProperty>(this IRuleBuilder <T, TProperty> ruleBuilder, EntitySpecification <T> predicate) where T : Entity <T>
 {
     return(ruleBuilder.Must(p => predicate.IsValid()));
 }
Exemplo n.º 10
0
        /// <summary>
        /// Gets the contacts.
        /// </summary>
        /// <param name="spec">The spec.</param>
        /// <returns>The contacts.</returns>
        public IEnumerable <ContactModel> GetContacts(ContactSpecification spec)
        {
            var entitySpec = new EntitySpecification <ContactModel>(spec.Predicate);

            return(repository.GetBySpecification(entitySpec));
        }
Exemplo n.º 11
0
        public ProbesDataSource(Guid guid, IDataSource2D<double> field, Host host)
            : base(guid)
        {
            // set up the Ontology, a description of the kind of data we contain.
            // See DataSource sample for more details.
            OntologySpecification o = this.Ontology.Edit();
            o.PrimitiveTypes.Create("RasterPatch", "GeoEntity", typeof(RasterPatch2));
            this.UpdateOntology(o);

            EntitySpecification entitySpec = new EntitySpecification(this.Ontology.EntityTypes["GeoEntity"]); // the default entity type
            entity = this.EntityAuthorityReference.EntityAuthority.CreateEntity(true, entitySpec);

            this.wfield = field;

            System.Windows.Point[,] grid = wfield.Grid;
            Coordinate2D minCoordinate = new Coordinate2D(grid[0, 0].X, grid[0, 0].Y);
            Coordinate2D maxCoordinate = new Coordinate2D(grid[field.Width - 1, field.Height - 1].X, grid[field.Width - 1, field.Height - 1].Y);


            for (int j = 0; j < field.Height; j++)
            {
                for (int i = 0; i < field.Width; i++)
                {
                    if (grid[i, j].X < minCoordinate.X)
                        minCoordinate.X = grid[i, j].X;

                    if (grid[i, j].X > maxCoordinate.X)
                        maxCoordinate.X = grid[i, j].X;

                    if (grid[i, j].Y < minCoordinate.Y)
                        minCoordinate.Y = grid[i, j].Y;

                    if (grid[i, j].Y > maxCoordinate.Y)
                        maxCoordinate.Y = grid[i, j].Y;
                }
            }

            gridBox = new GeoRect(
                minCoordinate.X,
                minCoordinate.Y,
                maxCoordinate.X - minCoordinate.X,
                maxCoordinate.Y - minCoordinate.Y);

            dataType = DSDataType.TwoDim;
            this.host = host;

            probesHelper = new ProbesHelper("ProbeSample.png", false);
        }
Exemplo n.º 12
0
 protected EntityMap()
 {
     _specification = new EntitySpecification <TEntity, TSchema>();
 }
 public void GivenASpecification()
 {
     specification = new EntitySpecification();
 }