Esempio n. 1
0
        protected override Collection <Layer> GetLayersCore(GetLayersParameters getLayersParameters)
        {
            Collection <Layer> layers = base.GetLayersCore(getLayersParameters);

            foreach (var uri in getLayersParameters.LayerUris)
            {
                WorldFileInfo wInfo = GetWorldFileInfo(uri);
                RasterLayer   layer = GetRasterLayer(uri, wInfo);

                if (layer != null)
                {
                    layer.UpperThreshold = double.MaxValue;
                    layer.LowerThreshold = 0d;
                    layer.Name           = Path.GetFileNameWithoutExtension(uri.LocalPath);

                    layer.Open();
                    if (!layer.HasProjectionText)
                    {
                        string proj4PathFileName = Path.ChangeExtension(uri.LocalPath, "prj");
                        string proj4Parameter    = LayerPluginHelper.GetProj4ProjectionParameter(proj4PathFileName);
                        if (!string.IsNullOrEmpty(proj4Parameter))
                        {
                            layer.InitializeProj4Projection(proj4Parameter);
                        }
                    }
                    else
                    {
                        string proj = layer.GetProjectionText().Trim();
                        if (!string.IsNullOrEmpty(proj))
                        {
                            layer.InitializeProj4Projection(proj);
                        }
                    }

                    layer.Close();

                    layers.Add(layer);
                }
            }

            return(layers);
        }