// Copyright 2005, 2006 - Morten Nielsen (www.iter.dk)
//
// This file is part of SharpMap.
// SharpMap is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// SharpMap is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public License
// along with SharpMap; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
using System;
using System.Collections.Generic;
using System.Drawing;
using GeoAPI.CoordinateSystems;
using GeoAPI.CoordinateSystems.Transformations;
using GeoAPI.Extensions.Feature;
using GeoAPI.Geometries;
using SharpMap.Api.Editors;
namespace SharpMap.Api.Layers
{
///
/// Interface for map layers
///
public interface ILayer : ICloneable, IDisposable
{
///
/// Image of the layer for current map, layer uses it to render it's content to.
/// Layer image contains only graphics rendered by one layer.
///
Image Image { get; }
///
/// True if you don't want the extent of this layer to be included in the total map extent.
///
bool ExcludeFromMapExtent { get; set; }
///
/// Is not visible by default.
///
ILabelLayer LabelLayer { get; set; }
///
/// True if the name is not allowed to be modified in the UI. set_Name will throw exception if you attempt to change the name while this flag is true.
///
bool NameIsReadOnly { get; }
///
/// Custom renderers which can be added to the layer and used to render something in addition to / instead of default rendering.
///
IList CustomRenderers { get; set; }
///
/// True if layers needs to be rendered. Map will check this flag while it will render itself.
/// If flag is set to true - Render() will be called before Image is drawn on Map.
///
/// Setting this flag to true in some layers and calling Map.Refresh() will make sure that only required layers will be rendered.
///
/// Calling Render() resets this flag automatically.
///
bool RenderRequired { get; set; }
///
/// Duration of last rendering in ms.
///
double LastRenderDuration { get; }
///
/// Minimum visible zoom level
///
double MinVisible { get; set; }
///
/// Minimum visible zoom level
///
double MaxVisible { get; set; }
///
/// Specifies whether this layer should be rendered or not
///
bool Visible { get; set; }
///
/// Name of layer
///
string Name { get; set; }
///
/// Gets the boundingbox of the entire layer
///
IEnvelope Envelope { get; }
//System.Collections.Generic.List Features { get; }
///
/// Gets or sets map where this layer belongs to, or null.
///
IMap Map { get; set; }
///
/// Defines if layer should be shown in a legend of map layers. Useful to hide supplementary layers such as drawing Trackers or geometries.
///
bool ShowInLegend { get; set; }
///
/// Determines if the labels of the layer are shown in the map. Uses the underlying LabelLayer to customize the display style.
///
bool ShowLabels { get; set; }
///
/// Defines if layer should be shown in a treeview of map layers. Useful to hide supplementary layers such as drawing Trackers or geometries.
///
bool ShowInTreeView { get; set; }
///
/// Determines whether the layer is mutable.
///
bool ReadOnly { get; set; }
///
/// Gets coordinate system of the layer.
///
ICoordinateSystem CoordinateSystem { get; }
///
/// Gets or sets the applied to this layer prior to rendering
///
ICoordinateTransformation CoordinateTransformation { get; set; }
///
/// Provides access to the features used by the current layer.
///
IFeatureProvider DataSource { get; set; }
///
/// Allows editing of features.
///
IFeatureEditor FeatureEditor { get; set; }
///
/// Symbology used to render features of the current layer.
///
ITheme Theme { get; set; }
///
/// Can features of the layer be selected.
/// This defaults to Selectable and Visible.
///
bool IsSelectable { get; }
///
/// Defines whether the features in the layer should be selectable
///
bool Selectable { get; set; }
///
/// Determines if the theme should be updated when values of the coverage change.
///
bool AutoUpdateThemeOnDataSourceChanged { get; set; }
///
/// Determines if an attribute table can be shown for this layer
///
bool ShowAttributeTable { get; set; }
///
/// Determines the order of rendering
///
int RenderOrder { get; set; }
string ThemeGroup { get; set; }
bool ThemeIsDirty { get; set; }
string ThemeAttributeName { get; }
double MinDataValue { get; }
double MaxDataValue { get; }
bool CanBeRemovedByUser { get; set; }
///
/// Defines the layer opacity, expressed as a value between 0.0 and 1.0. A value of 0.0 indicates fully transparent.
///
float Opacity { get; set; }
void ClearImage();
///
/// Disposes the layer (releases all resources used by the layer)
///
/// Option to determine if the should also be disposed
void Dispose(bool disposeDataSource = true);
///
/// Use this method to render layer manually. Results will be rendered into Image property.
///
/// This method should call OnRender which can be overriden in the implementations.
///
void Render();
///
/// Gets features using envelope.
///
/// Envelope, in current layer coordinate system (not in DataSoure)
///
IEnumerable GetFeatures(IEnvelope envelope);
///
/// Gets features using geometry.
///
/// Geometry, defined in current layer coordinate system (not in DataSoure)
///
///
IEnumerable GetFeatures(IGeometry geometry, bool useCustomRenderers = true);
}
}