Esempio n. 1
0
        private void patchMetrics(string filename, string epsg, int fieldIndex)
        {
            try
            {
                //obtenemos todos los índices de cada shape
                GeometryReader  geometryCollection = new GeometryReader(filename, epsg);
                SchemaDB_Reader namesCollection    = new SchemaDB_Reader(filename, fieldIndex);


                _patchNames = namesCollection.FieldValues;
                _patchAreas = geometryCollection.Areas;


                _pArea_V.Columns.Add("PatchName", typeof(string));
                _pArea_V.Columns.Add("PatchArea", typeof(double));

                for (int i = 0; i < _patchNames.Count; i++)
                {
                    _pArea_V.Rows.Add(_patchNames[i], _patchAreas[i]);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void lLargestPatchIndex(string filename, string epsg)
        {
            try
            {
                GeometryReader geometryCollection = new GeometryReader(filename, epsg);


                for (int i = 0; i < geometryCollection.Areas.Count; i++)
                {
                    _landscapeArea += (double)geometryCollection.Areas[i];
                }

                //Calculo de la mayor area en todo el paisaje
                double maxAreaTmp = 0;

                for (int i = 0; i < geometryCollection.Perimeters.Count; i++)
                {
                    if ((double)geometryCollection.Areas[i] > maxAreaTmp)
                    {
                        maxAreaTmp = (double)geometryCollection.Areas[i];
                    }
                }

                _maxLandscapeArea = maxAreaTmp;

                _landscapeLargestPatchIndex = (_maxLandscapeArea / _landscapeArea) * 100;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        private void pFractalDimension(string filename, string epsg, int fieldIndex)
        {
            try
            {
                //obtenemos todos los índices de cada shape
                GeometryReader  geometryCollection = new GeometryReader(filename, epsg);
                SchemaDB_Reader namesCollection    = new SchemaDB_Reader(filename, fieldIndex);
                _patchNames = namesCollection.FieldValues;



                for (int i = 0; i < geometryCollection.Areas.Count; i++)
                {
                    _patchesFractalDimension.Add(2 * Math.Log((double)geometryCollection.Perimeters[i]) / Math.Log((double)geometryCollection.Areas[i]));
                }


                _pFractalDimension_V.Columns.Add("PatchName", typeof(string));
                _pFractalDimension_V.Columns.Add("PatchFractalDimension", typeof(double));

                for (int i = 0; i < _patchNames.Count; i++)
                {
                    _pFractalDimension_V.Rows.Add(_patchNames[i], _patchesFractalDimension[i]);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 4
0
        private void pPerimeterAreaRatio(string filename, string epsg, int fieldIndex)
        {
            try
            {
                GeometryReader  geometryCollection = new GeometryReader(filename, epsg);
                SchemaDB_Reader namesCollection    = new SchemaDB_Reader(filename, fieldIndex);
                _patchNames = namesCollection.FieldValues;



                for (int i = 0; i < geometryCollection.Areas.Count; i++)
                {
                    _patchesPerimeterAreaRatio.Add((double)geometryCollection.Perimeters[i] / (double)geometryCollection.Areas[i]);
                }


                _pPerimeterAreaRatio_V.Columns.Add("PatchName", typeof(string));
                _pPerimeterAreaRatio_V.Columns.Add("PatchPerimeterAreaRatio", typeof(double));

                for (int i = 0; i < _patchNames.Count; i++)
                {
                    _pPerimeterAreaRatio_V.Rows.Add(_patchNames[i], _patchesPerimeterAreaRatio[i]);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 5
0
        private void landscapeMetrics(string filename, string epsg)
        {
            try
            {
                GeometryReader geometryCollection = new GeometryReader(filename, epsg);

                _numLandscapePatches = (int)geometryCollection.Areas.Count;


                for (int i = 0; i < geometryCollection.Areas.Count; i++)
                {
                    _landscapeArea      += (double)geometryCollection.Areas[i];
                    _landscapePerimeter += (double)geometryCollection.Perimeters[i];
                }

                //Calculo del mayor perimetro y la mayor area en todo el paisaje
                double maxAreaTmp = 0;
                double maxEdgeTmp = 0;
                for (int i = 0; i < geometryCollection.Perimeters.Count; i++)
                {
                    if ((double)geometryCollection.Perimeters[i] > maxEdgeTmp)
                    {
                        maxEdgeTmp = (double)geometryCollection.Perimeters[i];
                    }

                    if ((double)geometryCollection.Areas[i] > maxAreaTmp)
                    {
                        maxAreaTmp = (double)geometryCollection.Areas[i];
                    }
                }
                _maxLandscapeEdge = maxEdgeTmp;
                _maxLandscapeArea = maxAreaTmp;

                _landscapeLargestPatchIndex = (_maxLandscapeArea / _landscapeArea) * 100;


                //Calculo del menor perimetro en todo el paisaje
                double minEdgeTmp = _maxLandscapeEdge;
                for (int i = 0; i < geometryCollection.Perimeters.Count; i++)
                {
                    if ((double)geometryCollection.Perimeters[i] < minEdgeTmp)
                    {
                        minEdgeTmp = (double)geometryCollection.Perimeters[i];
                    }
                }
                _minLandscapeEdge = minEdgeTmp;


                _landscapeArea           = _landscapeArea / 10000;
                _landscapePatchesDensity = ((_numLandscapePatches / _landscapeArea) * 10000) * 100;
                _landscapeEdgeDensity    = (_landscapePerimeter / _landscapeArea) * 10000;
                _landscapeShapeIndex     = _landscapePerimeter / _minLandscapeEdge;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void lNumLandscapePatches(string filename, string epsg)
        {
            try
            {
                GeometryReader geometryCollection = new GeometryReader(filename, epsg);

                _numLandscapePatches = (int)geometryCollection.Areas.Count;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 7
0
        private void lPerimeter(string filename, string epsg)
        {
            try
            {
                GeometryReader geometryCollection = new GeometryReader(filename, epsg);


                for (int i = 0; i < geometryCollection.Areas.Count; i++)
                {
                    _landscapePerimeter += (double)geometryCollection.Perimeters[i];
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void patchMetrics(string filename, string epsg, int fieldIndex)
        {
            try
            {
                //obtenemos todos los índices de cada shape
                GeometryReader  geometryCollection = new GeometryReader(filename, epsg);
                SchemaDB_Reader namesCollection    = new SchemaDB_Reader(filename, fieldIndex);


                _patchNames      = namesCollection.FieldValues;
                _patchAreas      = geometryCollection.Areas;
                _patchPerimeters = geometryCollection.Perimeters;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void lShapeIndex(string filename, string epsg)
        {
            try
            {
                GeometryReader geometryCollection = new GeometryReader(filename, epsg);


                for (int i = 0; i < geometryCollection.Areas.Count; i++)
                {
                    _landscapePerimeter += (double)geometryCollection.Perimeters[i];
                }

                //Calculo del mayor perimetro en todo el paisaje
                double maxEdgeTmp = 0;
                for (int i = 0; i < geometryCollection.Perimeters.Count; i++)
                {
                    if ((double)geometryCollection.Perimeters[i] > maxEdgeTmp)
                    {
                        maxEdgeTmp = (double)geometryCollection.Perimeters[i];
                    }
                }
                _maxLandscapeEdge = maxEdgeTmp;



                //Calculo del menor perimetro en todo el paisaje
                double minEdgeTmp = _maxLandscapeEdge;
                for (int i = 0; i < geometryCollection.Perimeters.Count; i++)
                {
                    if ((double)geometryCollection.Perimeters[i] < minEdgeTmp)
                    {
                        minEdgeTmp = (double)geometryCollection.Perimeters[i];
                    }
                }
                _minLandscapeEdge = minEdgeTmp;


                _landscapeShapeIndex = _landscapePerimeter / _minLandscapeEdge;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 10
0
        private void lArea(string filename, string epsg)
        {
            try
            {
                GeometryReader geometryCollection = new GeometryReader(filename, epsg);


                for (int i = 0; i < geometryCollection.Areas.Count; i++)
                {
                    _landscapeArea += (double)geometryCollection.Areas[i];
                }


                _landscapeArea = _landscapeArea / 10000;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 11
0
        private void lEdgeDensity(string filename, string epsg)
        {
            try
            {
                GeometryReader geometryCollection = new GeometryReader(filename, epsg);


                for (int i = 0; i < geometryCollection.Areas.Count; i++)
                {
                    _landscapeArea      += (double)geometryCollection.Areas[i];
                    _landscapePerimeter += (double)geometryCollection.Perimeters[i];
                }

                _landscapeArea        = _landscapeArea / 10000;
                _landscapeEdgeDensity = (_landscapePerimeter / _landscapeArea) * 10000;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void patchMetrics(string filename, string epsg, int fieldIndex)
        {
            try
            {
                //obtenemos todos los índices de cada shape
                GeometryReader  geometryCollection = new GeometryReader(filename, epsg);
                SchemaDB_Reader namesCollection    = new SchemaDB_Reader(filename, fieldIndex);
                _patchNames = namesCollection.FieldValues;



                for (int i = 0; i < geometryCollection.Areas.Count; i++)
                {
                    _patchesPerimeterAreaRatio.Add((double)geometryCollection.Perimeters[i] / (double)geometryCollection.Areas[i]);
                    _patchesFractalDimension.Add(2 * Math.Log((double)geometryCollection.Perimeters[i]) / Math.Log((double)geometryCollection.Areas[i]));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void cDisjunctCoreAreaDensity(string filename, string epsg, int fieldIndex, double depthOfEdge)
        {
            try
            {
                C_NumDisjunctCoreArea_V ndca = new C_NumDisjunctCoreArea_V(filename, epsg, fieldIndex, depthOfEdge);
                _numDisjunctCoreAreasPerCategory = ndca.NumDisjunctCoreArea;
                _categoryNames = ndca.CategoryNames;

                GeometryReader geometryCollection = new GeometryReader(filename, epsg);


                for (int i = 0; i < geometryCollection.Areas.Count; i++)
                {
                    totalArea += (double)geometryCollection.Areas[i];
                }



                for (int i = 0; i < _numDisjunctCoreAreasPerCategory.Count; i++)
                {
                    _disjunctCoreAreaDensityPerCategory.Add((((int)_numDisjunctCoreAreasPerCategory[i] / totalArea) * 10000) * 100);
                }


                _cDisjunctCoreAreaDensity_V.Columns.Add("CategoryName", typeof(string));
                _cDisjunctCoreAreaDensity_V.Columns.Add("CategoryDisjunctCoreAreaDensity", typeof(double));

                for (int i = 0; i < _categoryNames.Count; i++)
                {
                    _cDisjunctCoreAreaDensity_V.Rows.Add(_categoryNames[i], _disjunctCoreAreaDensityPerCategory[i]);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void categoryMetrics(string filename, string epsg, int fieldIndex)
        {
            try
            {
                //Obtenemos un arraylist con toda la colección de registros del campo
                ArrayList       fieldRows = new ArrayList();
                SchemaDB_Reader colection = new SchemaDB_Reader(filename, fieldIndex);
                fieldRows = colection.FieldValues;

                //obtenemos un arraylist con las categorias encontradas en el campo
                ArrayList       categories = new ArrayList();
                SchemaDB_Reader categ      = new SchemaDB_Reader();
                categories = categ.categories((ArrayList)fieldRows.Clone());


                _categoryNames = categories;

                //obtenemos todas las áreas de cada shape
                ArrayList      areasCollectionArraylist = new ArrayList();
                GeometryReader geometryCollection       = new GeometryReader(filename, epsg);



                for (int i = 0; i < categories.Count; i++)
                {
                    double categoryArea = 0;

                    //cada iteración "i" obtenemos los miembros de una nueva categoria
                    SchemaDB_Reader members         = new SchemaDB_Reader();
                    ArrayList       categoryMembers = new ArrayList();

                    categoryMembers = members.categoryMembers(fieldRows, (string)categories[i]);


                    //en cada iteración j obtenemos el área total de esa categoria
                    for (int j = 0; j < categoryMembers.Count; j++)
                    {
                        categoryArea += (double)geometryCollection.Areas[(int)categoryMembers[j]];
                    }

                    //añadimos el área de la categoría "i" al arraylist _areasCategorias
                    //y volvemos a pones a 0 la variable de area de caregoria, para calcular
                    //una nueva categoria "i"


                    _totalAreasPerCategory.Add(categoryArea);
                }


                for (int i = 0; i < _totalAreasPerCategory.Count; i++)
                {
                    totalArea += (double)_totalAreasPerCategory[i];
                }



                for (int i = 0; i < _totalAreasPerCategory.Count; i++)
                {
                    _landscapePercentPerCategory.Add(((double)_totalAreasPerCategory[i] / totalArea) * 100);
                }

                _cLandscapePercent_V.Columns.Add("CategoryName", typeof(string));
                _cLandscapePercent_V.Columns.Add("LandscapePercent", typeof(double));

                for (int i = 0; i < _categoryNames.Count; i++)
                {
                    _cLandscapePercent_V.Rows.Add(_categoryNames[i], _landscapePercentPerCategory[i]);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void categoryMetrics(string filename, string epsg, int fieldIndex)
        {
            try
            {
                //Obtenemos un arraylist con toda la colección de registros del campo
                ArrayList       fieldRows = new ArrayList();
                SchemaDB_Reader colection = new SchemaDB_Reader(filename, fieldIndex);
                fieldRows = colection.FieldValues;

                //obtenemos un arraylist con las categorias encontradas en el campo
                ArrayList       categories = new ArrayList();
                SchemaDB_Reader categ      = new SchemaDB_Reader();
                categories = categ.categories((ArrayList)fieldRows.Clone());


                _categoryNames = categories;

                //obtenemos todas las áreas de cada shape
                GeometryReader geometryCollection = new GeometryReader(filename, epsg);



                for (int i = 0; i < categories.Count; i++)
                {
                    double categoryArea     = 0;
                    double categoryEdge     = 0;
                    double largestPatchSize = 0;

                    //cada iteración "i" obtenemos los miembros de una nueva categoria
                    SchemaDB_Reader members         = new SchemaDB_Reader();
                    ArrayList       categoryMembers = new ArrayList();

                    categoryMembers = members.categoryMembers(fieldRows, (string)categories[i]);


                    _numPatchesPerCategory.Add(categoryMembers.Count);


                    //en cada iteración j obtenemos el área total de esa categoria
                    for (int j = 0; j < categoryMembers.Count; j++)
                    {
                        categoryArea += (double)geometryCollection.Areas[(int)categoryMembers[j]];
                        categoryEdge += (double)geometryCollection.Perimeters[(int)categoryMembers[j]];


                        if ((double)geometryCollection.Areas[(int)categoryMembers[j]] > largestPatchSize)
                        {
                            largestPatchSize = (double)geometryCollection.Areas[(int)categoryMembers[j]];
                        }
                    }

                    //añadimos el área de la categoría "i" al arraylist _areasCategorias
                    //y volvemos a pones a 0 la variable de area de caregoria, para calcular
                    //una nueva categoria "i"


                    _totalAreasPerCategory.Add(categoryArea);
                    _totalPerimetersPerCategory.Add(categoryEdge);
                    _largestPatchSizePerCategory.Add(largestPatchSize);
                }


                for (int i = 0; i < _totalAreasPerCategory.Count; i++)
                {
                    totalArea += (double)_totalAreasPerCategory[i];
                }

                //Calculo del mayor perimetro y la mayor area en todo el paisaje
                //double maxEdgeTmp = 0;
                //for (int i = 0; i < geometryCollection.Perimeters.Count; i++)
                //{
                //    if ((double)geometryCollection.Perimeters[i] > maxEdgeTmp)
                //    {
                //        maxEdgeTmp = (double)geometryCollection.Perimeters[i];
                //    }
                //   _maxPerimeterPerCategory.Add(maxEdgeTmp);
                //}

                //Calculo del menor perimetro en todo el paisaje

                //for (int i = 0; i < geometryCollection.Perimeters.Count; i++)
                //{
                //    double minEdgeTmp = (double)_maxPerimeterPerCategory[i];
                //    if ((double)geometryCollection.Perimeters[i] < minEdgeTmp)
                //    {
                //        minEdgeTmp = (double)geometryCollection.Perimeters[i];
                //    }
                //    _minPerimeterPerCategory.Add(minEdgeTmp);
                //}



                for (int i = 0; i < _totalAreasPerCategory.Count; i++)
                {
                    _landscapePercentPerCategory.Add(((double)_totalAreasPerCategory[i] / totalArea) * 100);
                    _patchDensPerCategory.Add((((int)_numPatchesPerCategory[i] / totalArea) * 10000) * 100);
                    _edgeDensPerCategory.Add(((double)_totalPerimetersPerCategory[i] / totalArea) * 10000);
                    //_landscapeShapeIndexPerCategory.Add((double)_totalPerimetersPerCategory[i]/(double)_minPerimeterPerCategory[i]);
                    _largestPatchIndexPerCategory.Add(((double)_largestPatchSizePerCategory[i] / totalArea) * 100);
                    _meanPatchSizePerCategory.Add(((double)_totalAreasPerCategory[i] / (int)_numPatchesPerCategory[i]) / 10000);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }