protected override PrimitiveSpatialResult QueryPrimitivesInternal(PrimitiveSpatialQuery specification, bool uniqueEntities, DataSource.QueryProgress progress)
        {
            GeometryQueryRegion region = specification.SpatialFilter.Region as GeometryQueryRegion;

            if (region != null)
            {
                Box2 regionBox = region.Geometry as Box2;
                if (regionBox != null)
                {
                    RasterPatch2 rasterPatch = null;
                    if (isWarped)
                    {
                        colorMapHelper = new ColorMapHelper(wfield, regionBox, minT, maxT);
                        rasterPatch    = colorMapHelper.GetWarpedTilePatch();

                        minT = colorMapHelper.MinT;
                        maxT = colorMapHelper.MaxT;
                    }
                    else
                    {
                        colorMapHelper = new ColorMapHelper(field, regionBox, minT, maxT);
                        rasterPatch    = colorMapHelper.GetTilePatch();

                        minT = colorMapHelper.MinT;
                        maxT = colorMapHelper.MaxT;
                    }
                    if (rasterPatch != null)
                    {
                        PrimitiveSpecification spec = new PrimitiveSpecification(entity,
                                                                                 this.Ontology.PrimitiveTypes["RasterPatch"], rasterPatch);
                        SimplePrimitive primitive = new SimplePrimitive(this, spec);
                        return(new SingleImageResult(primitive));
                    }
                }
            }
            else
            {
            }

            return(new SingleImageResult(null));
        }
        protected override PrimitiveSpatialResult QueryPrimitivesInternal(PrimitiveSpatialQuery specification, bool uniqueEntities, DataSource.QueryProgress progress)
        {
            GeometryQueryRegion region = specification.SpatialFilter.Region as GeometryQueryRegion;

            TileLevelOfDetail tileLevel = (TileLevelOfDetail)host.WorldEngine.ScaleRanges.ScaleToTileLevelOfDetailValue(specification.SpatialFilter.GeometryOptions.Scale);


            if (region != null)
            {
                Box2 regionBox = region.Geometry as Box2;
                if (regionBox != null)
                {
                    int    levelValue = (int)tileLevel.Value > 5 ? (int)tileLevel.Value : 5;
                    double iconSize   = 32.0 / Math.Pow(2, levelValue);
                    step = iconSize / 2.0;

                    RasterPatch2 rasterPatch = null;
                    switch (dataType)
                    {
                    case DSDataType.TwoDim:
                        rasterPatch = probesHelper.GetTilePatch(wfield, regionBox, iconSize);
                        break;

                    case DSDataType.Table:
                        levelValue  = (int)tileLevel.Value > 6 ? (int)tileLevel.Value : 6;
                        iconSize    = 32.0 / Math.Pow(2, levelValue);
                        rasterPatch = probesHelper.GetTilePatch(pointSet, regionBox, iconSize);
                        break;

                    default: break;
                    }

                    if (rasterPatch != null)
                    {
                        PrimitiveSpecification spec = new PrimitiveSpecification(entity,
                                                                                 this.Ontology.PrimitiveTypes["RasterPatch"], rasterPatch);
                        SimplePrimitive primitive = new SimplePrimitive(this, spec);
                        Trace.WriteLine("Tile is ready.");

                        return(new SingleImageResult(primitive));
                    }
                }
            }

            return(new SingleImageResult(null));
        }