示例#1
0
        public static int[] GetAOI(Feature[] fets, Envelope dstEnvelope, Size size)
        {
            if (fets == null || fets.Length == 0)
            {
                return(null);
            }
            List <ShapePolygon> geometryslist = new List <ShapePolygon>();
            ShapePolygon        temp          = null;

            foreach (Feature item in fets)
            {
                temp = item.Geometry as ShapePolygon;
                if (temp != null)
                {
                    geometryslist.Add(temp);
                }
            }
            if (geometryslist.Count == 0)
            {
                return(null);
            }
            using (IVectorAOIGenerator gen = new VectorAOIGenerator())
            {
                int[] aoi = gen.GetAOI(geometryslist.ToArray(), dstEnvelope, size);
                return(aoi);
            }
        }
示例#2
0
        public int[] GetAOI(CoordEnvelope fileCorEnv, AOIContainerLayer aoiContainer, Size fileSize)
        {
            int[] retAOI               = null, aoi = null;
            VectorAOIGenerator vg      = new VectorAOIGenerator();
            Envelope           fileEnv = new Envelope(fileCorEnv.MinX, fileCorEnv.MinY, fileCorEnv.MaxX, fileCorEnv.MaxY);

            foreach (object obj in aoiContainer.AOIs)
            {
                try
                {
                    aoi = vg.GetAOI(new ShapePolygon[] { (obj as Feature).Geometry as ShapePolygon }, fileEnv, fileSize);
                    if (aoi == null)
                    {
                        continue;
                    }
                    if (retAOI == null)
                    {
                        retAOI = aoi;
                    }
                    else
                    {
                        retAOI = GeoDo.RSS.RasterTools.AOIHelper.Merge(new int[][] { retAOI, aoi });
                    }
                }
                catch (System.Exception ex)
                {
                    continue;
                }
            }
            return(retAOI);
        }
示例#3
0
        public Dictionary <string, int[]> GetFeatureAOIIndex()
        {
            int filedIndex = -1;

            GetFiledIndex(out filedIndex, cbFields.Text);
            if (_selectFeature == null || _selectFeature.Count == 0 || filedIndex == -1)
            {
                return(null);
            }
            Dictionary <string, int[]> result = new Dictionary <string, int[]>();
            int        featuresLength         = _selectFeature.Count;
            List <int> tempInt = new List <int>();

            VectorAOIGenerator vg = new VectorAOIGenerator();

            int[]  aoi = null;
            string currentFiledValue = string.Empty;

            for (int i = 0; i < featuresLength; i++)
            {
                Feature feature = _selectFeature[i];
                if (_spatialReference != null && _spatialReference.ProjectionCoordSystem != null && !feature.Projected)
                {
                    using (GeoDo.Project.IProjectionTransform transform = GeoDo.Project.ProjectionTransformFactory.GetProjectionTransform(GeoDo.Project.SpatialReference.GetDefault(), _spatialReference))
                    {
                        using (ShapePolygon spolygon = ShapePolygonPrjToGeo(transform, feature.Geometry as ShapePolygon))
                        {
                            aoi = vg.GetAOI(new ShapePolygon[] { spolygon }, _envelope, _size);
                        }
                    }
                }
                else
                {
                    ShapePolygon spolygon = _selectFeature[i].Geometry as ShapePolygon;
                    aoi = vg.GetAOI(new ShapePolygon[] { spolygon }, _envelope, _size);
                }
                if (aoi == null || aoi.Length == 0)
                {
                    continue;
                }
                currentFiledValue = _selectFeature[i].FieldValues[filedIndex];
                if (result.ContainsKey(currentFiledValue))
                {
                    tempInt.AddRange(result[currentFiledValue]);
                    tempInt.AddRange(aoi);
                    result[currentFiledValue] = tempInt.ToArray();
                }
                else
                {
                    result.Add(currentFiledValue, aoi);
                }
                tempInt.Clear();
            }
            return(result.Count == 0 ? null : result);
        }
示例#4
0
        public byte[] GetRaster(Envelope dstEnvelope, Size size, string nameField, out string[] names)
        {
            names = null;
            List <string> retNames = new List <string>();

            ShapePolygon[] geometrys = GetGeometry(retNames, nameField);
            if (geometrys == null || geometrys.Length == 0)
            {
                return(null);
            }
            names = retNames.ToArray();
            using (IVectorAOIGenerator gen = new VectorAOIGenerator())
            {
                return(gen.GetRaster(geometrys, dstEnvelope, size));
            }
        }
示例#5
0
 public int[] GetAOI(Envelope dstEnvelope, Size size)
 {
     ShapePolygon[] geometrys = GetGeometry(null, null);
     if (geometrys == null || geometrys.Length == 0)
     {
         return(null);
     }
     using (IVectorAOIGenerator gen = new VectorAOIGenerator())
     {
         int[] aoi = gen.GetAOI(geometrys, dstEnvelope, size);
         if (_isReverse)
         {
             return(AOIHelper.Reverse(aoi, size));
         }
         return(aoi);
     }
 }
        public Dictionary <string, int[]> GetFeatureAOIIndex()
        {
            int filedIndex = -1;

            GetFiledIndex(out filedIndex, cbFields.Text);
            if (_selectFeature == null || _selectFeature.Count == 0 || filedIndex == -1)
            {
                return(null);
            }
            Dictionary <string, int[]> result = new Dictionary <string, int[]>();
            int                featuresLength = _selectFeature.Count;
            List <int>         tempInt        = new List <int>();
            VectorAOIGenerator vg             = new VectorAOIGenerator();

            int[]  aoi = null;
            string currentFiledValue = string.Empty;

            for (int i = 0; i < featuresLength; i++)
            {
                aoi = vg.GetAOI(new ShapePolygon[] { _selectFeature[i].Geometry as ShapePolygon }, _envelope, _size);
                if (aoi == null || aoi.Length == 0)
                {
                    continue;
                }
                currentFiledValue = _selectFeature[i].FieldValues[filedIndex];
                if (result.ContainsKey(currentFiledValue))
                {
                    tempInt.AddRange(result[currentFiledValue]);
                    tempInt.AddRange(aoi);
                    result[currentFiledValue] = tempInt.ToArray();
                }
                else
                {
                    result.Add(currentFiledValue, aoi);
                }
                tempInt.Clear();
            }
            return(result.Count == 0 ? null : result);
        }