using System;
using System.Collections.Generic;
using System.Text;
using OSGeo.MapGuide.MaestroAPI.Resource;
using System.ComponentModel;
using OSGeo.MapGuide.MaestroAPI;
namespace OSGeo.MapGuide.ObjectModels.WebLayout
{
///
/// Defines a region of the web layout where UI items can reside
///
public enum WebLayoutRegion
{
///
/// The context menu
///
ContextMenu,
///
/// The toolbar
///
Toolbar,
///
/// The task bar
///
TaskBar
}
///
/// Encompasses all built-in commands usable by the web layout (AJAX and DWF)
///
public enum BuiltInCommandType : int
{
///
///
///
Pan = BasicCommandActionType.Pan,
///
///
///
PanUp = BasicCommandActionType.PanUp,
///
///
///
PanDown = BasicCommandActionType.PanDown,
///
///
///
PanRight = BasicCommandActionType.PanRight,
///
///
///
PanLeft = BasicCommandActionType.PanLeft,
///
///
///
Zoom = BasicCommandActionType.Zoom,
///
///
///
ZoomIn = BasicCommandActionType.ZoomIn,
///
///
///
ZoomOut = BasicCommandActionType.ZoomOut,
///
///
///
ZoomRectangle = BasicCommandActionType.ZoomRectangle,
///
///
///
ZoomToSelection = BasicCommandActionType.ZoomToSelection,
///
///
///
FitToWindow = BasicCommandActionType.FitToWindow,
///
///
///
PreviousView = BasicCommandActionType.PreviousView,
///
///
///
NextView = BasicCommandActionType.NextView,
///
///
///
RestoreView = BasicCommandActionType.RestoreView,
///
///
///
Select = BasicCommandActionType.Select,
///
///
///
SelectRadius = BasicCommandActionType.SelectRadius,
///
///
///
SelectPolygon = BasicCommandActionType.SelectPolygon,
///
///
///
ClearSelection = BasicCommandActionType.ClearSelection,
///
///
///
Refresh = BasicCommandActionType.Refresh,
///
///
///
CopyMap = BasicCommandActionType.CopyMap,
///
///
///
About = BasicCommandActionType.About,
///
///
///
Buffer,
///
///
///
SelectWithin,
///
///
///
Print,
///
///
///
GetPrintablePage,
///
///
///
Measure,
///
///
///
ViewOptions,
///
///
///
Help,
}
///
///
///
[System.SerializableAttribute()]
public enum BasicCommandActionType
{
///
Pan,
///
PanUp,
///
PanDown,
///
PanRight,
///
PanLeft,
///
Zoom,
///
ZoomIn,
///
ZoomOut,
///
ZoomRectangle,
///
ZoomToSelection,
///
FitToWindow,
///
PreviousView,
///
NextView,
///
RestoreView,
///
Select,
///
SelectRadius,
///
SelectPolygon,
///
ClearSelection,
///
Refresh,
///
CopyMap,
///
About,
///
MapTip,
}
///
///
///
[System.SerializableAttribute()]
public enum UIItemFunctionType
{
///
Separator,
///
Command,
///
Flyout,
}
///
///
///
[System.SerializableAttribute()]
public enum TargetType
{
///
TaskPane,
///
NewWindow,
///
SpecifiedFrame,
}
///
///
///
[System.SerializableAttribute()]
public enum TargetViewerType
{
///
Dwf,
///
Ajax,
///
All,
}
///
/// Represents a result of a command import
///
public class ImportedCommandResult
{
///
/// Gets or sets the original name
///
public string OriginalName { get; set; }
///
/// Gets or sets the imported name
///
public string ImportedName { get; set; }
///
/// Gets whether the name was changed when importing
///
public bool NameChanged { get { return !this.ImportedName.Equals(this.OriginalName); } }
///
/// Gets the string representation
///
///
public override string ToString()
{
return string.Format("{0} => {1}", this.OriginalName, this.ImportedName); //NOXLATE
}
}
///
/// The Web Layout
///
public interface IWebLayout : IResource, INotifyPropertyChanged
{
///
/// Exports the specified commands to the specified file
///
///
///
void ExportCustomCommands(string file, string[] cmdNames);
///
/// Imports commands from the specified file
///
///
///
ImportedCommandResult[] ImportCustomCommands(string file);
///
/// Determines whether the specified command name is referenced in any regions
///
/// The name.
/// The region.
bool IsCommandReferenced(string name, out WebLayoutRegion[] region);
///
/// Removes all references to the specified command name
///
/// Name of the command.
///
int RemoveAllReferences(string cmdName);
///
/// Gets a command by its name
///
/// Name of the command.
///
ICommand GetCommandByName(string cmdName);
///
/// Gets the custom commands.
///
///
IEnumerable GetCustomCommands();
///
/// Finds the command by its name in the specified menu.
///
/// The name.
/// The menu.
///
bool FindCommand(string name, IMenu menu);
///
/// Gets or sets the title.
///
/// The title.
string Title { get; set; }
///
/// Creates the default view.
///
///
IMapView CreateDefaultView();
///
/// Gets the map.
///
/// The map.
IMap Map { get; }
///
/// Gets the task pane.
///
/// The task pane.
ITaskPane TaskPane { get; }
///
/// Gets the tool bar.
///
/// The tool bar.
IToolbar ToolBar { get; }
///
/// Gets the information pane.
///
/// The information pane.
IInformationPane InformationPane { get; }
///
/// Gets the context menu.
///
/// The context menu.
IContextMenu ContextMenu { get; }
///
/// Gets the status bar.
///
/// The status bar.
IStatusBar StatusBar { get; }
///
/// Gets the zoom control.
///
/// The zoom control.
IZoomControl ZoomControl { get; }
///
/// Gets the command set.
///
/// The command set.
ICommandSet CommandSet { get; }
///
/// Creates the basic command.
///
/// The label.
/// The tooltip.
/// The description.
/// Name of the icon.
/// The targets.
/// The action.
///
IBasicCommand CreateBasicCommand(string label, string tooltip, string description, string iconName, TargetViewerType targets, BasicCommandActionType action);
///
/// Creates the flyout.
///
/// The label.
/// The tooltip.
/// The description.
/// The image URL.
/// The disabled image URL.
/// The sub items.
///
IFlyoutItem CreateFlyout(
string label,
string tooltip,
string description,
string imageUrl,
string disabledImageUrl,
params IUIItem[] subItems);
///
/// Creates the targeted command.
///
///
/// The name.
/// The label.
/// The tooltip.
/// The description.
/// Name of the icon.
/// The targets.
/// The target.
/// The target frame.
///
T CreateTargetedCommand(string name, string label, string tooltip, string description, string iconName, TargetViewerType targets, TargetType target, string targetFrame) where T : ITargetedCommand, new();
///
/// Creates the command item.
///
/// Name of the CMD.
///
ICommandItem CreateCommandItem(string cmdName);
///
/// Creates the invoke URL command.
///
///
IInvokeUrlCommand CreateInvokeUrlCommand();
///
/// Creates the search command.
///
///
ISearchCommand CreateSearchCommand();
///
/// Creates the invoke script command.
///
///
IInvokeScriptCommand CreateInvokeScriptCommand();
///
/// Creates the separator.
///
///
ISeparatorItem CreateSeparator();
}
///
/// Web Layout from v1.1.0 schema
///
public interface IWebLayout2 : IWebLayout
{
///
/// Gets or sets a value indicating whether [enable ping server].
///
/// true if [enable ping server]; otherwise, false.
bool EnablePingServer { get; set; }
}
///
/// The map referenced in this web layout
///
public interface IMap : INotifyPropertyChanged
{
///
/// Gets or sets the resource id.
///
/// The resource id.
string ResourceId { get; set; }
///
/// Gets or sets the initial view.
///
/// The initial view.
IMapView InitialView { get; set; }
///
/// Gets or sets the hyperlink target for feature selection urls
///
/// The hyperlink target.
TargetType HyperlinkTarget { get; set; }
///
/// Gets or sets the hyperlink target frame for feature selection urls.
///
/// The hyperlink target frame.
string HyperlinkTargetFrame { get; set; }
}
///
/// The initial view of the map
///
public interface IMapView : INotifyPropertyChanged
{
///
/// Gets or sets the center X.
///
/// The center X.
double CenterX { get; set; }
///
/// Gets or sets the center Y.
///
/// The center Y.
double CenterY { get; set; }
///
/// Gets or sets the scale.
///
/// The scale.
double Scale { get; set; }
}
///
/// A web layout element
///
public interface IWebLayoutControl : INotifyPropertyChanged
{
///
/// Gets or sets a value indicating whether this is visible.
///
/// true if visible; otherwise, false.
bool Visible { get; set; }
}
///
/// A resizable web layout element
///
public interface IWebLayoutResizableControl
{
///
/// Gets or sets the width.
///
/// The width.
int Width { get; set; }
}
///
/// A UI element
///
public interface IUIItem
{
///
/// Gets the parent menu.
///
/// The parent menu.
IMenu Parent { get; }
///
/// Gets or sets the function.
///
/// The function.
UIItemFunctionType Function { get; set; }
}
///
/// A UI element with localizable features
///
public interface ILocalizable : INotifyPropertyChanged
{
///
/// Gets or sets the tooltip.
///
/// The tooltip.
string Tooltip { get; set; }
///
/// Gets or sets the description.
///
/// The description.
string Description { get; set; }
///
/// Gets or sets the image URL.
///
/// The image URL.
string ImageURL { get; set; }
///
/// Gets or sets the disabled image URL.
///
/// The disabled image URL.
string DisabledImageURL { get; set; }
}
///
/// A separator item
///
public interface ISeparatorItem : IUIItem { }
///
/// A menu item that invokes a command
///
public interface ICommandItem : IUIItem
{
///
/// Gets or sets the command.
///
/// The command.
string Command { get; set; }
}
///
/// A flyout menu item
///
public interface IFlyoutItem : IUIItem, IMenu, ILocalizable
{
///
/// Gets or sets the label.
///
/// The label.
string Label { get; set; }
}
///
/// Represents a UI element that can have any number of child UI elements
///
public interface IMenu
{
///
/// Gets the item count.
///
/// The item count.
int ItemCount { get; }
///
/// Gets the items.
///
/// The items.
IEnumerable Items { get; }
///
/// Moves the specified item up.
///
/// The item.
///
bool MoveUp(IUIItem item);
///
/// Moves the specified item down.
///
/// The item.
///
bool MoveDown(IUIItem item);
///
/// Gets the index of the specified item.
///
/// The item.
///
int GetIndex(IUIItem item);
///
/// Inserts the specified item at the specified index.
///
/// The item.
/// The index.
void Insert(IUIItem item, int index);
///
/// Adds the item.
///
/// The item.
void AddItem(IUIItem item);
///
/// Removes the item.
///
/// The item.
void RemoveItem(IUIItem item);
}
///
/// Extension method class
///
public static class MenuExtensions
{
///
/// Adds items to the menu
///
///
///
public static void AddItems(this IMenu mnu, params IUIItem[] items)
{
Check.NotNull(mnu, "mnu"); //NOXLATE
Check.NotNull(items, "items"); //NOXLATE
foreach (var item in items)
{
mnu.AddItem(item);
}
}
}
///
/// The viewer toolbar
///
public interface IToolbar : IMenu, IWebLayoutControl, INotifyPropertyChanged
{
}
///
/// The legend and property pane
///
public interface IInformationPane : IWebLayoutResizableControl, INotifyPropertyChanged
{
///
/// Gets or sets a value indicating whether [legend visible].
///
/// true if [legend visible]; otherwise, false.
bool LegendVisible { get; set; }
///
/// Gets or sets a value indicating whether [properties visible].
///
/// true if [properties visible]; otherwise, false.
bool PropertiesVisible { get; set; }
}
///
/// The viewer context menu
///
public interface IContextMenu : IMenu, IWebLayoutControl, INotifyPropertyChanged
{
}
///
/// The task pane
///
public interface ITaskPane : IWebLayoutResizableControl, INotifyPropertyChanged
{
///
/// Gets or sets whether this control is visible
///
bool Visible { get; set; }
///
/// Gets or sets the url of the initial task.
///
/// The url of the initial task.
string InitialTask { get; set; }
///
/// Gets the task bar.
///
/// The task bar.
ITaskBar TaskBar { get; }
}
///
/// The task bar
///
public interface ITaskBar : IWebLayoutControl, IMenu, INotifyPropertyChanged
{
///
/// Gets the home button.
///
/// The home.
ITaskButton Home { get; }
///
/// Gets the forward button.
///
/// The forward.
ITaskButton Forward { get; }
///
/// Gets the back button.
///
/// The back.
ITaskButton Back { get; }
///
/// Gets the tasks button.
///
/// The tasks.
ITaskButton Tasks { get; }
}
///
/// A button on the task pane
///
public interface ITaskButton : ILocalizable
{
}
///
/// The status bar
///
public interface IStatusBar : IWebLayoutControl, INotifyPropertyChanged
{
}
///
/// The zoom slider
///
public interface IZoomControl : IWebLayoutControl, INotifyPropertyChanged
{
}
///
///
///
public delegate void CommandEventHandler(ICommand cmd);
///
/// The master list of viewer commands
///
public interface ICommandSet
{
///
/// Gets the command count.
///
/// The command count.
int CommandCount { get; }
///
/// Clears this instance.
///
void Clear();
///
/// Gets the commands.
///
/// The commands.
IEnumerable Commands { get; }
///
/// Adds the command.
///
/// The CMD.
void AddCommand(ICommand cmd);
///
/// Removes the command.
///
/// The CMD.
void RemoveCommand(ICommand cmd);
///
/// Occurs when [custom command added].
///
event CommandEventHandler CustomCommandAdded;
///
/// Occurs when [custom command removed].
///
event CommandEventHandler CustomCommandRemoved;
}
///
/// Base viewer command
///
public interface ICommand : ILocalizable, INotifyPropertyChanged
{
///
/// Gets or sets the name.
///
/// The name.
string Name { get; set; }
///
/// Gets or sets the label.
///
/// The label.
string Label { get; set; }
///
/// Gets or sets the target viewer.
///
/// The target viewer.
TargetViewerType TargetViewer { get; set; }
}
///
/// A built-in basic command
///
public interface IBasicCommand : ICommand
{
///
/// Gets or sets the action.
///
/// The action.
BasicCommandActionType Action { get; set; }
}
///
/// A custom command
///
public interface ICustomCommand : ICommand
{
}
///
/// A command that operates in a certain viewer frame
///
public interface ITargetedCommand : ICustomCommand
{
///
/// Gets or sets the target.
///
/// The target.
TargetType Target { get; set; }
///
/// Gets or sets the target frame.
///
/// The target frame.
string TargetFrame { get; set; }
}
///
/// Search command
///
public interface ISearchCommand : ITargetedCommand
{
///
/// Gets or sets the layer.
///
/// The layer.
string Layer { get; set; }
///
/// Gets or sets the prompt.
///
/// The prompt.
string Prompt { get; set; }
///
/// Gets the result columns.
///
/// The result columns.
IResultColumnSet ResultColumns { get; }
///
/// Gets or sets the filter.
///
/// The filter.
string Filter { get; set; }
///
/// Gets or sets the match limit.
///
/// The match limit.
int MatchLimit { get; set; }
}
///
/// A search command result specification
///
public interface IResultColumnSet
{
///
/// Clears this instance.
///
void Clear();
///
/// Gets the columns.
///
/// The columns.
IEnumerable Column { get; }
///
/// Creates the column.
///
/// The name.
/// The property.
///
IResultColumn CreateColumn(string name, string property);
///
/// Adds the result column.
///
/// The col.
void AddResultColumn(IResultColumn col);
///
/// Removes the result column.
///
/// The col.
void RemoveResultColumn(IResultColumn col);
}
///
/// A search command result column
///
public interface IResultColumn
{
///
/// Gets or sets the name.
///
/// The name.
string Name { get; set; }
///
/// Gets or sets the property.
///
/// The property.
string Property { get; set; }
}
///
/// Invoke URL command
///
public interface IInvokeUrlCommand : ITargetedCommand
{
///
/// Gets or sets the URL.
///
/// The URL.
string URL { get; set; }
///
/// Gets the layer set that this layer applies to
///
/// The layer set.
ILayerSet LayerSet { get; }
///
/// Gets the additional parameters.
///
/// The additional parameters.
IEnumerable AdditionalParameter { get; }
///
/// Creates the parameter.
///
/// The name.
/// The value.
///
IParameterPair CreateParameter(string name, string value);
///
/// Adds the parameter.
///
/// The param.
void AddParameter(IParameterPair param);
///
/// Removes the parameter.
///
/// The param.
void RemoveParameter(IParameterPair param);
///
/// Gets or sets a value indicating whether [disable if selection empty].
///
///
/// true if [disable if selection empty]; otherwise, false.
///
bool DisableIfSelectionEmpty { get; set; }
}
///
/// A set of layers
///
public interface ILayerSet
{
///
/// Gets the layers.
///
/// The layers.
BindingList Layer { get; }
}
///
/// A key value pair
///
public interface IParameterPair
{
///
/// Gets or sets the key.
///
/// The key.
string Key { get; set; }
///
/// Gets or sets the value.
///
/// The value.
string Value { get; set; }
}
///
/// Buffer command
///
public interface IBufferCommand : ITargetedCommand { }
///
/// Select within command
///
public interface ISelectWithinCommand : ITargetedCommand { }
///
/// A resource reference
///
public interface IResourceReference : INotifyPropertyChanged
{
///
/// Gets or sets the resource id.
///
/// The resource id.
string ResourceId { get; set; }
}
///
/// Print command
///
public interface IPrintCommand : ICustomCommand
{
///
/// Clears this instance.
///
void Clear();
///
/// Gets the print layouts.
///
/// The print layouts.
IEnumerable PrintLayout { get; }
///
/// Creates the print layout.
///
/// The resource id.
///
IResourceReference CreatePrintLayout(string resourceId);
///
/// Adds the print layout.
///
/// The reference.
void AddPrintLayout(IResourceReference reference);
///
/// Removes the print layout.
///
/// The reference.
void RemovePrintLayout(IResourceReference reference);
}
///
/// Get printable page command
///
public interface IGetPrintablePageCommand : ITargetedCommand { }
///
/// Measure command
///
public interface IMeasureCommand : ITargetedCommand { }
///
/// View options command
///
public interface IViewOptionsCommand : ITargetedCommand { }
///
/// A help command
///
public interface IHelpCommand : ITargetedCommand
{
///
/// Gets or sets the URL.
///
/// The URL.
string URL { get; set; }
}
///
/// An invoke script command
///
public interface IInvokeScriptCommand : ICustomCommand
{
///
/// Gets or sets the script.
///
/// The script.
string Script { get; set; }
}
}