#region Disclaimer / License
// Copyright (C) 2010, Jackie Ng
// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie@gmail.com
//
// 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;
using System.Collections.Generic;
using System.Text;
using OSGeo.MapGuide.MaestroAPI.Resource;
using System.ComponentModel;
using OSGeo.MapGuide.MaestroAPI;
namespace OSGeo.MapGuide.ObjectModels.LoadProcedure
{
///
/// Defines how to handle duplicate SDF2 keys (not supported by Maestro)
///
[System.SerializableAttribute()]
public enum SdfKeyTreatmentType
{
///
AutogenerateAll,
///
DiscardDuplicates,
///
MergeDuplicates,
}
///
/// The types of load procedures
///
public enum LoadType
{
///
/// A Load Procedure for SDF 3.0 files
///
Sdf,
///
/// A Load Procedure for SHP files
///
Shp,
///
/// A Load Procedure for DWF files
///
Dwf,
///
/// A Load Procedure for Raster files (not supported by Maestro)
///
Raster,
///
/// A Load Procedure for DWG files (not supported by Maestro)
///
Dwg,
///
/// A Load Procedure for SQLite files
///
Sqlite
}
///
/// Represents Load Procedures
///
public interface ILoadProcedure : IResource
{
///
/// Gets the type of the sub.
///
/// The type of the sub.
IBaseLoadProcedure SubType { get; }
}
///
/// A DWG load procedure. Execution not supported by Maestro
///
public interface IDwgLoadProcedure : IBaseLoadProcedure
{
}
///
/// A raster load procedure. Execution not supported by Maestro
///
public interface IRasterLoadProcedure : IBaseLoadProcedure
{
}
///
/// Base type of all load procedures. All Load Procedures at the minimum require
/// the following information:
///
///
/// -
/// A list of source files.
///
/// -
/// The root path to load into
///
/// -
/// The folder where spatial data sources will be created [optional, but useless if not specified]
///
/// -
/// The folder where layers will be created [optional. dependent on #3]
///
///
///
/// Once initialized, load procedures can be executed via method
///
/// Because Load Procedures are also resources, they can be saved into the library repository via the method
/// and retrieved from the repository via the method
///
public interface IBaseLoadProcedure : INotifyPropertyChanged
{
///
/// Gets the type.
///
/// The type.
LoadType Type { get; }
///
/// Gets the source files.
///
/// The source files.
BindingList SourceFile { get; }
///
/// Adds the file.
///
/// The file.
void AddFile(string file);
///
/// Removes the file.
///
/// The file.
void RemoveFile(string file);
///
/// Gets or sets the root path.
///
/// The root path.
string RootPath { get; set; }
///
/// Gets or sets the coordinate system to use if none found in the source file.
///
/// The coordinate system.
string CoordinateSystem { get; set; }
///
/// Gets or sets a value indicating whether to create a spatial data source for each source
/// file. The spatial data sources will be created under the
/// under the
///
///
/// true if [generate spatial data sources]; otherwise, false.
///
bool GenerateSpatialDataSources { get; set; }
///
/// Gets or sets the spatial data sources path.
///
/// The spatial data sources path.
string SpatialDataSourcesPath { get; set; }
///
/// Gets or sets the spatial data sources folder.
///
/// The spatial data sources folder.
string SpatialDataSourcesFolder { get; set; }
///
/// Gets or sets a value indicating whether to create a layer for each spatial data source that
/// is created. This will be created in the under the
///
/// true if [generate layers]; otherwise, false.
bool GenerateLayers { get; set; }
///
/// Gets or sets the layers path.
///
/// The layers path.
string LayersPath { get; set; }
///
/// Gets or sets the layers folder.
///
/// The layers folder.
string LayersFolder { get; set; }
///
/// Gets or sets the generate maps. Not supported by Maestro
///
/// The generate maps.
bool? GenerateMaps { get; set; }
///
/// Gets or sets the maps path. Not supported by Maestro
///
/// The maps path.
string MapsPath { get; set; }
///
/// Gets or sets the maps folder. Not supported by Maestro
///
/// The maps folder.
string MapsFolder { get; set; }
///
/// Not supported by Maestro
///
bool? GenerateSymbolLibraries { get; set; }
///
/// Not supported by Maestro
///
string SymbolLibrariesPath { get; set; }
///
/// Not supported by Maestro
///
string SymbolLibrariesFolder { get; set; }
///
/// Gets or sets the resource id that were created as part of executing this load procedure
///
/// The resource id.
BindingList ResourceId { get; set; }
}
///
/// Extension method class
///
public static class BaseLoadProcedureExtensions
{
///
/// Adds a group of files to this load procedure
///
///
///
public static void AddFiles(this IBaseLoadProcedure proc, IEnumerable files)
{
Check.NotNull(proc, "proc");
Check.NotNull(files, "files");
foreach (var f in files)
{
proc.AddFile(f);
}
}
}
///
/// A DWF load procedure. Execution is supported with limitations
///
public interface IDwfLoadProcedure : IBaseLoadProcedure
{
}
///
/// A SDF load procedure. Execution is supported with limitations
///
///
/// The SDF Load Procedure has the following limitations when executed by Maestro
///
/// - The input SDF files must be SDF3 files. Loading of SDF2 files is not supported
///
///
public interface ISdfLoadProcedure : IBaseLoadProcedure
{
///
/// Not supported by Maestro
///
double Generalization { get; set; }
///
/// Not supported by Maestro
///
SdfKeyTreatmentType SdfKeyTreatment { get; set; }
}
///
/// A SHP load procedure. Execution is supported with limitations
///
///
/// The SHP Load Procedure has the following limitations when executed by Maestro
///
/// - Generalization is not supported
/// - Conversion to SDF is not supported
///
///
public interface IShpLoadProcedure : IBaseLoadProcedure
{
///
/// Not supported by Maestro
///
double Generalization { get; set; }
///
/// Not supported by Maestro
///
bool ConvertToSdf { get; set; }
}
///
/// A SQLite load procedure. Execution is supported with limitations
///
///
/// SQLite load procedures can only be saved to a server whose site version is 2.2 or higher
/// The SQLite Load Procedure has the following limitations when executed by Maestro
///
/// - Generalization is not supported
///
///
public interface ISqliteLoadProcedure : IBaseLoadProcedure
{
///
/// Not supported by Maestro
///
double Generalization { get; set; }
}
}