#region Disclaimer / License
// Copyright (C) 2009, Kenneth Skovhede
// http://www.hexad.dk, opensource@hexad.dk
//
// This library 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.1 of the License, or (at your option) any later version.
//
// This library 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 this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
#endregion
using System;
namespace OSGeo.MapGuide.MaestroAPI
{
///
/// Commonly used string constants for MapGuide
///
public class StringConstants
{
///
/// The root resource identifier
///
public const string RootIdentifier = "Library://"; //NOXLATE
///
/// A thumbnail dwf resource role
///
public const string Thumbnail = "Thumbnail"; //NOXLATE
///
/// The username login placeholder token
///
public const string MgUsernamePlaceholder = "%MG_USERNAME%"; //NOXLATE
///
/// The password login placeholder token
///
public const string MgPasswordPlaceholder = "%MG_PASSWORD%"; //NOXLATE
///
/// The placeholder token that resolves to the path containing resource data
///
public const string MgDataFilePath = "%MG_DATA_FILE_PATH%"; //NOXLATE
///
/// The name of the resource data item containing the secured Feature Source credentials
///
public const string MgUserCredentialsResourceData = "MG_USER_CREDENTIALS"; //NOXLATE
///
/// The file picker filter for all files
///
public static string AllFilesFilter
{
get
{
return string.Format(Strings.GenericFilter, Strings.PickAll, "*");
}
}
}
///
/// Represents the common resource types in MapGuide
///
public enum ResourceTypes
{
///
/// Map Definition
///
MapDefinition,
///
/// Layer Definition
///
LayerDefinition,
///
/// Feature Source
///
FeatureSource,
///
/// Web Layout
///
WebLayout,
///
/// Runtime Map
///
RuntimeMap,
///
/// Folder
///
Folder,
///
/// Fusion Flexible Layout
///
ApplicationDefinition,
///
/// Print Layout
///
PrintLayout,
///
/// Symbol Definition
///
SymbolDefinition,
///
/// Load Procedure
///
LoadProcedure,
///
/// Drawing Source
///
DrawingSource,
///
/// DWF-based Symbol Library
///
SymbolLibrary,
///
/// A watermark
///
WatermarkDefinition,
///
/// A selection for a runtime map
///
Selection
}
///
/// Represents a method involving a resource id
///
///
///
public delegate void ResourceEventHandler(object sender, ResourceEventArgs e);
///
/// Contains the resource id
///
public class ResourceEventArgs : EventArgs
{
///
/// Constructor
///
///
public ResourceEventArgs(string resourceID) { this.ResourceID = resourceID; }
///
/// Gets or sets the resource id
///
public string ResourceID { get; set; }
}
///
/// Helper class to filter into the ones that are
/// editable
///
public static class SiteResourceType
{
private static ResourceTypes[] _resTypes;
static SiteResourceType()
{
_resTypes = (ResourceTypes[])Enum.GetValues(typeof(ResourceTypes));
}
///
/// Returns an array of all editable values
///
///
public static ResourceTypes[] All()
{
return _resTypes;
}
}
internal class EnumHelper
{
private static string[] ResourceTypeNames = new string[]
{
"MapDefinition", //NOXLATE
"LayerDefinition", //NOXLATE
"FeatureSource", //NOXLATE
"WebLayout", //NOXLATE
"Map", //NOXLATE
string.Empty, //NOXLATE
"ApplicationDefinition", //NOXLATE
};
internal static string ResourceName(ResourceTypes type)
{
return ResourceName(type, false);
}
internal static string ResourceName(ResourceTypes type, bool prefixWithDot)
{
if (type == ResourceTypes.Folder || !prefixWithDot)
return ResourceTypeNames[(int)type];
else
return "." + ResourceTypeNames[(int)type]; //NOXLATE
}
}
///
/// Flags that can be used for the QueryMapFeatures operation
///
public enum QueryMapFeaturesLayerAttributes : int
{
///
/// All layers
///
AllLayers = 0,
///
/// Only visible
///
OnlyVisible = 1,
///
/// Only selectable
///
OnlySelectable = 2,
///
/// Default
///
Default = 3,
///
/// Only with tooltips
///
OnlyWithToolTips = 4,
///
/// Visible with tooltips
///
VisibleWithToolTips = 5
}
///
/// Defines the types of unmananged data
///
public enum UnmanagedDataTypes : int
{
///
/// Files
///
Files,
///
/// Folders
///
Folders,
///
/// Files and Folders
///
Both
}
}